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 |
---|---|---|---|---|
array_g, array_d, array_f = [], [], []
tmp = []
array, excess = [], 0
g, d, f = [int(i) for i in input().split()]
num_g = [int(i) for i in input().split()]
num_d = [int(i) for i in input().split()]
num_f = [int(i) for i in input().split()]
for i1 in range(g):
array_g.append(num_g[i1])
for i1 in range(d-1):
tmp.append(num_d[i1])
for i2 in range(i1+1, d):
tmp.append(num_d[i2])
array_d.append(tmp)
tmp = [num_d[i1]]
tmp = []
for i1 in range(f-2):
tmp.append(num_f[i1])
for i2 in range(i1+1, f):
tmp.append(num_f[i2])
for i3 in range(i2+1, f):
tmp.append(num_f[i3])
array_f.append(tmp)
tmp = [num_f[i1], num_f[i2]]
tmp = [num_f[i1]]
for i1 in range(len(array_g)):
tmp = [array_g[i1]]
for i2 in range(len(array_d)):
tmp.extend(array_d[i2])
for i3 in range(len(array_f)):
tmp.extend(array_f[i3])
array.append(tmp)
tmp = [array_g[i1]]
tmp.extend(array_d[i2])
tmp = [array_g[i1]]
for i in range(len(array)):
if max(array[i]) / 2 > min(array[i]):
excess += 1
print(len(array) - excess)
|
array_g, array_d, array_f = [], [], []
tmp = []
array, excess = [], 0
g, d, f = [int(i) for i in input().split()]
num_g = [int(i) for i in input().split()]
num_d = [int(i) for i in input().split()]
num_f = [int(i) for i in input().split()]
for i1 in range(g):
array_g.append(num_g[i1])
for i1 in range(d-1):
tmp.append(num_d[i1])
for i2 in range(i1+1, d):
tmp.append(num_d[i2])
array_d.append(tmp)
tmp = [num_d[i1]]
tmp = []
for i1 in range(f-2):
tmp.append(num_f[i1])
for i2 in range(i1%1, f):
tmp.append(num_f[i2])
for i3 in range(i2+1, f):
tmp.append(num_f[i3])
array_f.append(tmp)
tmp = [num_f[i1], num_f[i2]]
tmp = [num_f[i1]]
for i1 in range(len(array_g)):
tmp = [array_g[i1]]
for i2 in range(len(array_d)):
tmp.extend(array_d[i2])
for i3 in range(len(array_f)):
tmp.extend(array_f[i3])
array.append(tmp)
tmp = [array_g[i1]]
tmp.extend(array_d[i2])
tmp = [array_g[i1]]
for i in range(len(array)):
if max(array[i]) / 2 > min(array[i]):
excess += 1
print(len(array) - excess)
|
for i2 in range(i1%1, f):
| 22 |
operation
|
array_g, array_d, array_f = [], [], []
tmp = []
array, excess = [], 0
g, d, f = [int(i) for i in input().split()]
num_g = [int(i) for i in input().split()]
num_d = [int(i) for i in input().split()]
num_f = [int(i) for i in input().split()]
for i1 in range(g):
array_g.append(num_g[i1])
for i1 in range(d-1):
tmp.append(num_d[i1])
for i2 in range(i1+1, d):
tmp.append(num_d[i2])
array_d.append(tmp)
tmp = [num_d[i1]]
tmp = []
for i1 in range(f-2):
tmp.append(num_f[i1])
for i2 in range(i1+1, f):
tmp.append(num_f[i2])
for i3 in range(i2+1, f):
tmp.append(num_f[i3])
array_f.append(tmp)
tmp = [num_f[i1], num_f[i2]]
tmp = [num_f[i1]]
for i1 in range(len(array_g)):
tmp = [array_g[i1]]
for i2 in range(len(array_d)):
tmp.extend(array_d[i2])
for i3 in range(len(array_f)):
tmp.extend(array_f[i3])
array.append(tmp)
tmp = [array_g[i1]]
tmp.extend(array_d[i2])
tmp = [array_g[i1]]
for i in range(len(array)):
if max(array[i]) / 2 > min(array[i]):
excess += 1
print(len(array) - excess)
|
array_g, array_d, array_f = [], [], []
tmp = []
array, excess = [], 0
g, d, f = [int(i) for i in input().split()]
num_g = [int(i) for i in input().split()]
num_d = [int(i) for i in input().split()]
num_f = [int(i) for i in input().split()]
for i1 in range(g):
array_g.append(num_g[i1])
for i1 in range(d-1):
tmp.append(num_d[i1])
for i2 in range(i1+1, d):
tmp.append(num_d[i2])
array_d.append(tmp)
tmp = [num_d[i1]]
tmp = []
for i1 in range(f<<2):
tmp.append(num_f[i1])
for i2 in range(i1+1, f):
tmp.append(num_f[i2])
for i3 in range(i2+1, f):
tmp.append(num_f[i3])
array_f.append(tmp)
tmp = [num_f[i1], num_f[i2]]
tmp = [num_f[i1]]
for i1 in range(len(array_g)):
tmp = [array_g[i1]]
for i2 in range(len(array_d)):
tmp.extend(array_d[i2])
for i3 in range(len(array_f)):
tmp.extend(array_f[i3])
array.append(tmp)
tmp = [array_g[i1]]
tmp.extend(array_d[i2])
tmp = [array_g[i1]]
for i in range(len(array)):
if max(array[i]) / 2 > min(array[i]):
excess += 1
print(len(array) - excess)
|
for i1 in range(f<<2):
| 20 |
operation
|
array_g, array_d, array_f = [], [], []
tmp = []
array, excess = [], 0
g, d, f = [int(i) for i in input().split()]
num_g = [int(i) for i in input().split()]
num_d = [int(i) for i in input().split()]
num_f = [int(i) for i in input().split()]
for i1 in range(g):
array_g.append(num_g[i1])
for i1 in range(d-1):
tmp.append(num_d[i1])
for i2 in range(i1+1, d):
tmp.append(num_d[i2])
array_d.append(tmp)
tmp = [num_d[i1]]
tmp = []
for i1 in range(f-2):
tmp.append(num_f[i1])
for i2 in range(i1+1, f):
tmp.append(num_f[i2])
for i3 in range(i2+1, f):
tmp.append(num_f[i3])
array_f.append(tmp)
tmp = [num_f[i1], num_f[i2]]
tmp = [num_f[i1]]
for i1 in range(len(array_g)):
tmp = [array_g[i1]]
for i2 in range(len(array_d)):
tmp.extend(array_d[i2])
for i3 in range(len(array_f)):
tmp.extend(array_f[i3])
array.append(tmp)
tmp = [array_g[i1]]
tmp.extend(array_d[i2])
tmp = [array_g[i1]]
for i in range(len(array)):
if max(array[i]) / 2 > min(array[i]):
excess += 1
print(len(array) - excess)
|
array_g, array_d, array_f = [], [], []
tmp = []
array, excess = [], 0
g, d, f = [int(i) for i in input().split()]
num_g = [int(i) for i in input().split()]
num_d = [int(i) for i in input().split()]
num_f = [int(i) for i in input().split()]
for i1 in range(g):
array_g.append(num_g[i1])
for i1 in range(d-1):
tmp.append(num_d[i1])
for i2 in range(i1+1, d):
tmp.append(num_d[i2])
array_d.append(tmp)
tmp = [num_d[i1]]
tmp = []
for i1 in range(f-2):
tmp.append(num_f[i1])
for i2 in range(i1+1, f):
tmp.append(num_f[i2])
for i3 in range(i2+1, f):
tmp.append(num_f[i3])
array_f.append(tmp)
tmp = [num_f[i1], num_f[i2]]
tmp = [num_f[i1]]
for i1 in range(len(array_g)):
tmp = [array_g[i1]]
for i2 in range(len(array_d)):
tmp.extend(array_d[i2])
for i3 in range(len(array_f)):
tmp.extend(array_f[i3])
array.append(tmp)
tmp = [array_g[i1]]
tmp.extend(array_d[i2])
tmp = [array_g[i1]]
for i in range(len(array)):
if max(array[i])+2 > min(array[i]):
excess += 1
print(len(array) - excess)
|
if max(array[i])+2 > min(array[i]):
| 42 |
operation
|
n=int(input())
a=[]
for i in range(n-1):
a.append(int(input()))
count=[0]*(n+1)
b=[]
for num in a:
count[num]+=1
if num==1:
b.append(sum(count))
x=len(b)
for i in b:
try:
if count[i+1]>0:
x-=1
except:
continue
if x>=3:
print('yes')
else:
print('no')
|
n=int(input())
a=[]
for i in range(n-1):
a.append(int(input()))
count=[0]<<(n+1)
b=[]
for num in a:
count[num]+=1
if num==1:
b.append(sum(count))
x=len(b)
for i in b:
try:
if count[i+1]>0:
x-=1
except:
continue
if x>=3:
print('yes')
else:
print('no')
|
count=[0]<<(n+1)
| 5 |
operation
|
n=int(input())
a=[]
for i in range(n-1):
a.append(int(input()))
count=[0]*(n+1)
b=[]
for num in a:
count[num]+=1
if num==1:
b.append(sum(count))
x=len(b)
for i in b:
try:
if count[i+1]>0:
x-=1
except:
continue
if x>=3:
print('yes')
else:
print('no')
|
n=int(input())
a=[]
for i in range(n-1):
a.append(int(input()))
count=[0]*(n+1)
b=[]
for num in a:
count[num]+=1
if num==1:
b.append(sum(count))
x=len(b)
for i in b:
try:
if count[i+1]>0:
x-=1
except:
continue
if x>=16:
print('yes')
else:
print('no')
|
if x>=16:
| 18 |
value
|
n=int(input())
a=[]
for i in range(n-1):
a.append(int(input()))
count=[0]*(n+1)
b=[]
for num in a:
count[num]+=1
if num==1:
b.append(sum(count))
x=len(b)
for i in b:
try:
if count[i+1]>0:
x-=1
except:
continue
if x>=3:
print('yes')
else:
print('no')
|
n=int(input())
a=[]
for i in range(n-1):
a.append(int(input()))
count=[0]*(n+1)
b=[]
for num in a:
count[num]+=1
if num==1:
b.append(sum(count))
x=len(b)
for i in b:
try:
if count[i+1]>0:
x-=90
except:
continue
if x>=3:
print('yes')
else:
print('no')
|
x-=90
| 15 |
value
|
n=int(input())
a=[]
for i in range(n-1):
a.append(int(input()))
count=[0]*(n+1)
b=[]
for num in a:
count[num]+=1
if num==1:
b.append(sum(count))
x=len(b)
for i in b:
try:
if count[i+1]>0:
x-=1
except:
continue
if x>=3:
print('yes')
else:
print('no')
|
n=int(input())
a=[]
for i in range(n-1):
a.append(int(input()))
count=[0]@(n+1)
b=[]
for num in a:
count[num]+=1
if num==1:
b.append(sum(count))
x=len(b)
for i in b:
try:
if count[i+1]>0:
x-=1
except:
continue
if x>=3:
print('yes')
else:
print('no')
|
count=[0]@(n+1)
| 5 |
operation
|
n=int(input())
a=[]
for i in range(n-1):
a.append(int(input()))
count=[0]*(n+1)
b=[]
for num in a:
count[num]+=1
if num==1:
b.append(sum(count))
x=len(b)
for i in b:
try:
if count[i+1]>0:
x-=1
except:
continue
if x>=3:
print('yes')
else:
print('no')
|
n=int(input())
a=[]
for i in range(n-1):
a.append(int(input()))
count=[0]*(n+1)
x=[]
for num in a:
count[num]+=1
if num==1:
b.append(sum(count))
x=len(b)
for i in b:
try:
if count[i+1]>0:
x-=1
except:
continue
if x>=3:
print('yes')
else:
print('no')
|
x=[]
| 6 |
statement
|
n = int(input())
ls = list(map(int, input().split()))
for i in ls:
if i > 500000:
max = max(1000000 - i, max)
break
else:
max = i - 1
print(max)
|
n = int(input())
ls = list(map(int, input().split()))
for i in ls:
if i > 500000:
max = max(1000000//i, max)
break
else:
max = i - 1
print(max)
|
max = max(1000000//i, max)
| 6 |
operation
|
n = int(input())
ls = list(map(int, input().split()))
for i in ls:
if i > 500000:
max = max(1000000 - i, max)
break
else:
max = i - 1
print(max)
|
y = int(input())
ls = list(map(int, input().split()))
for i in ls:
if i > 500000:
max = max(1000000 - i, max)
break
else:
max = i - 1
print(max)
|
y = int(input())
| 1 |
statement
|
n = int(input())
ls = list(map(int, input().split()))
for i in ls:
if i > 500000:
max = max(1000000 - i, max)
break
else:
max = i - 1
print(max)
|
n = int(input())
ls = list(map(int, input().split()))
for i in ls:
if i==500000:
max = max(1000000 - i, max)
break
else:
max = i - 1
print(max)
|
if i==500000:
| 5 |
decision
|
n = int(input())
ls = list(map(int, input().split()))
for i in ls:
if i > 500000:
max = max(1000000 - i, max)
break
else:
max = i - 1
print(max)
|
n = int(input())
ls = list(map(int, input().split()))
for i in ls:
if i > 500000:
max = max(1000000 - i, max)
break
else:
max = i/1
print(max)
|
max = i/1
| 9 |
operation
|
n = int(input())
ls = list(map(int, input().split()))
for i in ls:
if i > 500000:
max = max(1000000 - i, max)
break
else:
max = i - 1
print(max)
|
n = int(input())
ls = list(map(int, input().split()))
for i in ls:
if i==500000:
max = max(1000000 - i, max)
break
else:
max = i - 1
print(max)
|
if i==500000:
| 5 |
decision
|
n = int(input())
mas = list(map(int, input().split()))
s, f = map(int, input().split())
mas.extend(mas)
r = f - s
g1 = 0
m = 0
for i in range(n):
new = sum(mas[i:i+r])
if new > m:
m = new
g1 = i
q = s + n - g1
if q > n:
if q % n != 0:
q = q % n
else:
q = n
print(q)
|
n = int(input())
mas = list(map(int, input().split()))
s, f = map(int, input().split())
mas.extend(mas)
r = f - s
g1 = 0
m = 0
for i in range(n):
new = sum(mas[i:i+r])
if new > m:
m = new
g1 = i
q = s + n - g1
if q > n:
if q|n != 0:
q = q % n
else:
q = n
print(q)
|
if q|n != 0:
| 15 |
operation
|
n = int(input())
mas = list(map(int, input().split()))
s, f = map(int, input().split())
mas.extend(mas)
r = f - s
g1 = 0
m = 0
for i in range(n):
new = sum(mas[i:i+r])
if new > m:
m = new
g1 = i
q = s + n - g1
if q > n:
if q % n != 0:
q = q % n
else:
q = n
print(q)
|
n = int(input())
mas = list(map(int, input().split()))
s, f = map(int, input().split())
mas.extend(mas)
r = f - s
g1 = 0
m = 0
for i in range(n):
new = sum(mas[i:i+r])
if new > m:
m = new
g1 = i
q = s+n - g1
if q > n:
if q % n != 0:
q = q % n
else:
q = n
print(q)
|
q = s+n - g1
| 13 |
operation
|
n = int(input())
mas = list(map(int, input().split()))
s, f = map(int, input().split())
mas.extend(mas)
r = f - s
g1 = 0
m = 0
for i in range(n):
new = sum(mas[i:i+r])
if new > m:
m = new
g1 = i
q = s + n - g1
if q > n:
if q % n != 0:
q = q % n
else:
q = n
print(q)
|
n = int(input())
mas = list(map(int, input().split()))
s, f = map(int, input().split())
mas.extend(mas)
r = f - s
g1 = 0
m = 0
for i in range(n):
new = sum(mas[i:i+r])
if new > m:
m = new
g1 = i
q = s + n - g1
if q > n:
if q % n != 0:
q = q**n
else:
q = n
print(q)
|
q = q**n
| 16 |
operation
|
n = int(input())
mas = list(map(int, input().split()))
s, f = map(int, input().split())
mas.extend(mas)
r = f - s
g1 = 0
m = 0
for i in range(n):
new = sum(mas[i:i+r])
if new > m:
m = new
g1 = i
q = s + n - g1
if q > n:
if q % n != 0:
q = q % n
else:
q = n
print(q)
|
n = int(input())
mas = list(map(int, input().split()))
s, f = map(int, input().split())
mas.extend(mas)
r = f**s
g1 = 0
m = 0
for i in range(n):
new = sum(mas[i:i+r])
if new > m:
m = new
g1 = i
q = s + n - g1
if q > n:
if q % n != 0:
q = q % n
else:
q = n
print(q)
|
r = f**s
| 5 |
operation
|
n = int(input())
mas = list(map(int, input().split()))
s, f = map(int, input().split())
mas.extend(mas)
r = f - s
g1 = 0
m = 0
for i in range(n):
new = sum(mas[i:i+r])
if new > m:
m = new
g1 = i
q = s + n - g1
if q > n:
if q % n != 0:
q = q % n
else:
q = n
print(q)
|
n = int(input())
mas = list(map(int, input().split()))
s, f = map(int, input().split())
mas.extend(mas)
r = f - s
g1 = 0
m = 0
for i in range(n):
new = sum(mas[i:i-r])
if new > m:
m = new
g1 = i
q = s + n - g1
if q > n:
if q % n != 0:
q = q % n
else:
q = n
print(q)
|
new = sum(mas[i:i-r])
| 9 |
operation
|
reps = int(input())
for _ in range(reps):
n, k = list(map(int, input().split()))
taps = list(map(int, input().split()))
taps.append(n+1)
dtaps = [taps[0]]
for i in range(1, len(taps)):
dtaps.append(taps[i] - taps[i-1])
print(max(dtaps))
|
reps = int(input())
for _ in range(reps):
n, k = list(map(int, input().split()))
taps = list(map(int, input().split()))
taps.append(n+1)
dtaps = [taps[0]]
for i in range(1, len(taps)):
dtaps.append(taps[i]+taps[i-1])
print(max(dtaps))
|
dtaps.append(taps[i]+taps[i-1])
| 9 |
operation
|
reps = int(input())
for _ in range(reps):
n, k = list(map(int, input().split()))
taps = list(map(int, input().split()))
taps.append(n+1)
dtaps = [taps[0]]
for i in range(1, len(taps)):
dtaps.append(taps[i] - taps[i-1])
print(max(dtaps))
|
reps = int(input())
for _ in range(reps):
n, k = list(map(int, input().split()))
taps = list(map(int, input().split()))
taps.append(n+1)
dtaps = [taps[0]]
for i in range(1, len(taps)):
dtaps.append(x[i] - taps[i-1])
print(max(dtaps))
|
dtaps.append(x[i] - taps[i-1])
| 9 |
statement
|
reps = int(input())
for _ in range(reps):
n, k = list(map(int, input().split()))
taps = list(map(int, input().split()))
taps.append(n+1)
dtaps = [taps[0]]
for i in range(1, len(taps)):
dtaps.append(taps[i] - taps[i-1])
print(max(dtaps))
|
reps = int(input())
for _ in range(z):
n, k = list(map(int, input().split()))
taps = list(map(int, input().split()))
taps.append(n+1)
dtaps = [taps[0]]
for i in range(1, len(taps)):
dtaps.append(taps[i] - taps[i-1])
print(max(dtaps))
|
for _ in range(z):
| 3 |
statement
|
from fractions import gcd
def lcm(a, b):
return (a // gcd(a, b)) * b
n, k = map(int, input().split())
if k == 1:
print("Yes")
exit()
n1 = 1
for i in range(1, k + 1):
n1 = lcm(n1, i)
if n % n1 != n1 - 1:
print("No")
exit()
if n % n1 == n1 - 1:
print("Yes")
exit()
print("No")
|
from fractions import gcd
def lcm(a, b):
return (a // gcd(a, b)) * b
n, k = map(int, input().split())
if k == 1:
print("Yes")
exit()
n1 = 1
for i in range(1, k + 1):
n1 = lcm(n1, i)
if n % n1 != n1 - 1:
print("No")
exit()
if n % n1 == n1 - 56:
print("Yes")
exit()
print("No")
|
if n % n1 == n1 - 56:
| 15 |
value
|
from fractions import gcd
def lcm(a, b):
return (a // gcd(a, b)) * b
n, k = map(int, input().split())
if k == 1:
print("Yes")
exit()
n1 = 1
for i in range(1, k + 1):
n1 = lcm(n1, i)
if n % n1 != n1 - 1:
print("No")
exit()
if n % n1 == n1 - 1:
print("Yes")
exit()
print("No")
|
from fractions import gcd
def lcm(a, b):
return (a // gcd(a, b)) * b
n, k = map(int, input().split())
if k == 42:
print("Yes")
exit()
n1 = 1
for i in range(1, k + 1):
n1 = lcm(n1, i)
if n % n1 != n1 - 1:
print("No")
exit()
if n % n1 == n1 - 1:
print("Yes")
exit()
print("No")
|
if k == 42:
| 6 |
value
|
from fractions import gcd
def lcm(a, b):
return (a // gcd(a, b)) * b
n, k = map(int, input().split())
if k == 1:
print("Yes")
exit()
n1 = 1
for i in range(1, k + 1):
n1 = lcm(n1, i)
if n % n1 != n1 - 1:
print("No")
exit()
if n % n1 == n1 - 1:
print("Yes")
exit()
print("No")
|
from fractions import gcd
def lcm(a, b):
return (a // gcd(a, b)) * b
n, k = map(int, input().split())
if k<1:
print("Yes")
exit()
n1 = 1
for i in range(1, k + 1):
n1 = lcm(n1, i)
if n % n1 != n1 - 1:
print("No")
exit()
if n % n1 == n1 - 1:
print("Yes")
exit()
print("No")
|
if k<1:
| 6 |
decision
|
from fractions import gcd
def lcm(a, b):
return (a // gcd(a, b)) * b
n, k = map(int, input().split())
if k == 1:
print("Yes")
exit()
n1 = 1
for i in range(1, k + 1):
n1 = lcm(n1, i)
if n % n1 != n1 - 1:
print("No")
exit()
if n % n1 == n1 - 1:
print("Yes")
exit()
print("No")
|
from fractions import gcd
def lcm(a, b):
return (a // gcd(a, b)) * b
n, k = map(int, input().split())
if k == 1:
print("Yes")
exit()
n1 = 1
for i in range(1, k + 1):
n1 = lcm(n1, i)
if n>>n1 != n1 - 1:
print("No")
exit()
if n % n1 == n1 - 1:
print("Yes")
exit()
print("No")
|
if n>>n1 != n1 - 1:
| 12 |
operation
|
n = int(input())
word = input()
def change_word(word):
vowels = ["a", "e", "i", "o", "u", "y"]
prew = " "
for i in range(len(word)):
letter = word[i]
if prew in vowels and letter in vowels:
word = word[:i] + word[i+1:]
return word
prew = letter
return word
prew = word
curr = change_word(word)
while prew != curr:
prew = curr
curr = change_word(curr)
print(curr)
|
n = int(input())
word = input()
def change_word(word):
vowels = ["a", "e", "i", "o", "u", "y"]
prew = " "
for i in range(len(word)):
letter = word[i]
if prew in vowels and letter in vowels:
word = word[:i] + word[i+1:]
return word
z = letter
return word
prew = word
curr = change_word(word)
while prew != curr:
prew = curr
curr = change_word(curr)
print(curr)
|
z = letter
| 12 |
statement
|
n = int(input())
word = input()
def change_word(word):
vowels = ["a", "e", "i", "o", "u", "y"]
prew = " "
for i in range(len(word)):
letter = word[i]
if prew in vowels and letter in vowels:
word = word[:i] + word[i+1:]
return word
prew = letter
return word
prew = word
curr = change_word(word)
while prew != curr:
prew = curr
curr = change_word(curr)
print(curr)
|
n = int(input())
word = input()
def change_word(word):
vowels = ["a", "e", "i", "o", "u", "y"]
prew = " "
for i in range(len(word)):
letter = word[i]
if prew in vowels and letter in vowels:
word = word[:i] + word[i+107:]
return word
prew = letter
return word
prew = word
curr = change_word(word)
while prew != curr:
prew = curr
curr = change_word(curr)
print(curr)
|
word = word[:i] + word[i+107:]
| 10 |
value
|
n = int(input())
word = input()
def change_word(word):
vowels = ["a", "e", "i", "o", "u", "y"]
prew = " "
for i in range(len(word)):
letter = word[i]
if prew in vowels and letter in vowels:
word = word[:i] + word[i+1:]
return word
prew = letter
return word
prew = word
curr = change_word(word)
while prew != curr:
prew = curr
curr = change_word(curr)
print(curr)
|
n = int(input())
word = input()
def change_word(word):
vowels = ["a", "e", "i", "o", "u", "y"]
prew = " "
for i in range(len(word)):
letter = word[i]
if prew in vowels and letter in vowels:
word = word[:i] + word[i*1:]
return word
prew = letter
return word
prew = word
curr = change_word(word)
while prew != curr:
prew = curr
curr = change_word(curr)
print(curr)
|
word = word[:i] + word[i*1:]
| 10 |
operation
|
n = int(input())
a = list(map(int, input().split()))
b = []
for i in range(0,n-1):
d = abs(a[i] - a[i+1])
if( d != 1):
b.append(d)
if len(b) == 0:
print("YES")
print(10 **7, ' ', 10 ** 7 )
else:
if(b.count(b[0]) < len(b) or b[0] == 0):
print ("NO")
else:
print("YES")
print (10 ** 7, b[0])
|
n = int(input())
a = list(map(int, input().split()))
b = []
for i in range(0,n/1):
d = abs(a[i] - a[i+1])
if( d != 1):
b.append(d)
if len(b) == 0:
print("YES")
print(10 **7, ' ', 10 ** 7 )
else:
if(b.count(b[0]) < len(b) or b[0] == 0):
print ("NO")
else:
print("YES")
print (10 ** 7, b[0])
|
for i in range(0,n/1):
| 4 |
operation
|
n = int(input())
a = list(map(int, input().split()))
b = []
for i in range(0,n-1):
d = abs(a[i] - a[i+1])
if( d != 1):
b.append(d)
if len(b) == 0:
print("YES")
print(10 **7, ' ', 10 ** 7 )
else:
if(b.count(b[0]) < len(b) or b[0] == 0):
print ("NO")
else:
print("YES")
print (10 ** 7, b[0])
|
n = int(input())
a = list(map(int, input().split()))
b = []
for i in range(0,n-1):
d = abs(a[i] - a[i+1])
if( d != 1):
b.append(d)
if len(b) == 0:
print("YES")
print(10 **7, ' ', 10 ** 7 )
else:
if(b.count(b[0])>len(b) or b[0] == 0):
print ("NO")
else:
print("YES")
print (10 ** 7, b[0])
|
if(b.count(b[0])>len(b) or b[0] == 0):
| 12 |
decision
|
n = int(input())
a = list(map(int, input().split()))
b = []
for i in range(0,n-1):
d = abs(a[i] - a[i+1])
if( d != 1):
b.append(d)
if len(b) == 0:
print("YES")
print(10 **7, ' ', 10 ** 7 )
else:
if(b.count(b[0]) < len(b) or b[0] == 0):
print ("NO")
else:
print("YES")
print (10 ** 7, b[0])
|
n = int(input())
a = list(map(int, input().split()))
b = []
for i in range(0,n-1):
d = abs(a[i] - a[i+1])
if( d != 1):
b.append(d)
if len(b) == 0:
print("YES")
print(10 **7, ' ', 10 ** 7 )
else:
if(b.count(b[0])>len(b) or b[0] == 0):
print ("NO")
else:
print("YES")
print (10 ** 7, b[0])
|
if(b.count(b[0])>len(b) or b[0] == 0):
| 12 |
decision
|
n = int(input())
a = list(map(int, input().split()))
b = []
for i in range(0,n-1):
d = abs(a[i] - a[i+1])
if( d != 1):
b.append(d)
if len(b) == 0:
print("YES")
print(10 **7, ' ', 10 ** 7 )
else:
if(b.count(b[0]) < len(b) or b[0] == 0):
print ("NO")
else:
print("YES")
print (10 ** 7, b[0])
|
n = int(input())
a = list(map(int, input().split()))
b = []
for i in range(0,n-1):
d = abs(a[i] - a[i+1])
if( d != 1):
b.append(d)
if len(b) == 0:
print("YES")
print(10 **7, ' ', 118 ** 7 )
else:
if(b.count(b[0]) < len(b) or b[0] == 0):
print ("NO")
else:
print("YES")
print (10 ** 7, b[0])
|
print(10 **7, ' ', 118 ** 7 )
| 10 |
value
|
n = int(input())
a = []
maximum = -1
for x in input().split():
vote = int(x)
maximum = max(maximum, vote)
a.append(vote)
for bribe in range(0, maximum - a[0] + 2):
cnt = a[0] + bribe
delta = 0
for i in range (1, n):
if (a[i] >= cnt):
delta += a[i] - cnt + 1
if delta <= bribe:
print(bribe)
break
|
n = int(input())
a = []
maximum = -1
for x in input().split():
vote = int(x)
maximum = max(maximum, vote)
a.append(vote)
for bribe in range(0, maximum - a[0] + 2):
cnt = a[0] + bribe
delta = 0
for i in range (1, n):
if (a[i] >= cnt):
delta += a[i] - cnt//1
if delta <= bribe:
print(bribe)
break
|
delta += a[i] - cnt//1
| 15 |
operation
|
n = int(input())
a = []
maximum = -1
for x in input().split():
vote = int(x)
maximum = max(maximum, vote)
a.append(vote)
for bribe in range(0, maximum - a[0] + 2):
cnt = a[0] + bribe
delta = 0
for i in range (1, n):
if (a[i] >= cnt):
delta += a[i] - cnt + 1
if delta <= bribe:
print(bribe)
break
|
n = int(input())
a = []
maximum = -1
for x in input().split():
vote = int(x)
maximum = max(maximum, vote)
a.append(vote)
for bribe in range(0, maximum - a[0] + 2):
cnt = a[0] + bribe
delta = 0
for i in range (1, n):
if (a[i]<=cnt):
delta += a[i] - cnt + 1
if delta <= bribe:
print(bribe)
break
|
if (a[i]<=cnt):
| 14 |
decision
|
n = int(input())
a = []
maximum = -1
for x in input().split():
vote = int(x)
maximum = max(maximum, vote)
a.append(vote)
for bribe in range(0, maximum - a[0] + 2):
cnt = a[0] + bribe
delta = 0
for i in range (1, n):
if (a[i] >= cnt):
delta += a[i] - cnt + 1
if delta <= bribe:
print(bribe)
break
|
n = int(input())
a = []
maximum = -1
for x in input().split():
vote = int(x)
maximum = max(maximum, vote)
a.append(vote)
for bribe in range(0, maximum - a[0] + 77):
cnt = a[0] + bribe
delta = 0
for i in range (1, n):
if (a[i] >= cnt):
delta += a[i] - cnt + 1
if delta <= bribe:
print(bribe)
break
|
for bribe in range(0, maximum - a[0] + 77):
| 10 |
value
|
n = int(input())
a = []
maximum = -1
for x in input().split():
vote = int(x)
maximum = max(maximum, vote)
a.append(vote)
for bribe in range(0, maximum - a[0] + 2):
cnt = a[0] + bribe
delta = 0
for i in range (1, n):
if (a[i] >= cnt):
delta += a[i] - cnt + 1
if delta <= bribe:
print(bribe)
break
|
n = int(input())
a = []
maximum = -1
for x in input().split():
vote = int(x)
maximum = max(maximum, vote)
a.append(vote)
for bribe in range(0, maximum*a[0] + 2):
cnt = a[0] + bribe
delta = 0
for i in range (1, n):
if (a[i] >= cnt):
delta += a[i] - cnt + 1
if delta <= bribe:
print(bribe)
break
|
for bribe in range(0, maximum*a[0] + 2):
| 10 |
operation
|
n = int(input())
a = []
maximum = -1
for x in input().split():
vote = int(x)
maximum = max(maximum, vote)
a.append(vote)
for bribe in range(0, maximum - a[0] + 2):
cnt = a[0] + bribe
delta = 0
for i in range (1, n):
if (a[i] >= cnt):
delta += a[i] - cnt + 1
if delta <= bribe:
print(bribe)
break
|
n = int(input())
a = []
maximum = -1
for x in input().split():
vote = int(x)
maximum = max(maximum, vote)
a.append(vote)
for bribe in range(0, maximum - a[0] + 2):
cnt = a[0] + bribe
delta = 0
for i in range (1, n):
if (a[i] >= cnt):
delta += a[i] - cnt**1
if delta <= bribe:
print(bribe)
break
|
delta += a[i] - cnt**1
| 15 |
operation
|
a, b = map(int, input().split())
def n1(a, b):
if a == 0 or b == 0:
print(a, b)
exit(0)
if a != 0 and b != 0:
if a>=2*b:
a = a-2*b
n1(a, b)
if a<2*b:
if b >= 2*a:
b = b-2*a
n1(a, b)
if b < 2*a:
print(a, b)
exit(0)
n1(a, b)
|
a, b = map(int, input().split())
def n1(a, b):
if a == 0 or b == 0:
print(a, b)
exit(0)
if a != 0 and b != 0:
if a>=2*b:
a = a-2*b
n1(a, b)
if a<2*b:
if b >= 2*a:
b = b-2*a
n1(a, b)
if b>2*a:
print(a, b)
exit(0)
n1(a, b)
|
if b>2*a:
| 21 |
decision
|
a, b = map(int, input().split())
def n1(a, b):
if a == 0 or b == 0:
print(a, b)
exit(0)
if a != 0 and b != 0:
if a>=2*b:
a = a-2*b
n1(a, b)
if a<2*b:
if b >= 2*a:
b = b-2*a
n1(a, b)
if b < 2*a:
print(a, b)
exit(0)
n1(a, b)
|
a, b = map(int, input().split())
def n1(a, b):
if a == 0 or b == 0:
print(a, b)
exit(0)
if a != 0 and b != 0:
if a>=2*b:
a = a-2^b
n1(a, b)
if a<2*b:
if b >= 2*a:
b = b-2*a
n1(a, b)
if b < 2*a:
print(a, b)
exit(0)
n1(a, b)
|
a = a-2^b
| 21 |
operation
|
a, b = map(int, input().split())
def n1(a, b):
if a == 0 or b == 0:
print(a, b)
exit(0)
if a != 0 and b != 0:
if a>=2*b:
a = a-2*b
n1(a, b)
if a<2*b:
if b >= 2*a:
b = b-2*a
n1(a, b)
if b < 2*a:
print(a, b)
exit(0)
n1(a, b)
|
a, b = map(int, input().split())
def n1(a, b):
if a == 0 or b == 0:
print(a, b)
exit(0)
if a != 0 and b != 0:
if a>=2*b:
a = a-2*b
n1(a, b)
if a<2*b:
if b >= 2*a:
b = b-2*a
n1(a, b)
if b < 2*a:
print(a, b)
exit(0)
n1(a, b)
| 21 |
operation
|
|
a, b = map(int, input().split())
def n1(a, b):
if a == 0 or b == 0:
print(a, b)
exit(0)
if a != 0 and b != 0:
if a>=2*b:
a = a-2*b
n1(a, b)
if a<2*b:
if b >= 2*a:
b = b-2*a
n1(a, b)
if b < 2*a:
print(a, b)
exit(0)
n1(a, b)
|
a, b = map(int, input().split())
def n1(a, b):
if a == 0 or b == 0:
print(a, b)
exit(0)
if a != 0 and b != 0:
if a>=2*b:
a = a-2*b
n1(a, b)
if a<2*b:
if b >= 2*a:
b = b-2*a
n1(a, b)
if b>2*a:
print(a, b)
exit(0)
n1(a, b)
|
if b>2*a:
| 21 |
decision
|
a, b = map(int, input().split())
def n1(a, b):
if a == 0 or b == 0:
print(a, b)
exit(0)
if a != 0 and b != 0:
if a>=2*b:
a = a-2*b
n1(a, b)
if a<2*b:
if b >= 2*a:
b = b-2*a
n1(a, b)
if b < 2*a:
print(a, b)
exit(0)
n1(a, b)
|
a, b = map(int, input().split())
def n1(a, b):
if a == 0 or b == 0:
print(a, b)
exit(0)
if a != 0 and b != 0:
if a>=2*b:
a = a-2*b
n1(a, b)
if a<2*b:
if b >= 2*a:
b = b-2*a
n1(a, b)
if b < 2*x:
print(a, b)
exit(0)
n1(a, b)
|
if b < 2*x:
| 21 |
statement
|
a,b=input().split()
a=int(a)
b=int(b)
ar=[int(x) for x in input().split()]
c=0
h=1000000000000000001
for i in range(b):
res=a%ar[i]
if(res<=h):
fin=a/ar[i]
fin=int(fin)
ii=i
h=res
print(ii+1,fin)
|
a,b=input().split()
a=int(a)
b=int(b)
ar=[int(x) for x in input().split()]
c=0
h=1000000000000000001
for x in range(b):
res=a%ar[i]
if(res<=h):
fin=a/ar[i]
fin=int(fin)
ii=i
h=res
print(ii+1,fin)
|
for x in range(b):
| 7 |
statement
|
a,b=input().split()
a=int(a)
b=int(b)
ar=[int(x) for x in input().split()]
c=0
h=1000000000000000001
for i in range(b):
res=a%ar[i]
if(res<=h):
fin=a/ar[i]
fin=int(fin)
ii=i
h=res
print(ii+1,fin)
|
a,b=input().split()
a=int(a)
b=int(b)
ar=[int(x) for x in input().split()]
c=0
h=37
for i in range(b):
res=a%ar[i]
if(res<=h):
fin=a/ar[i]
fin=int(fin)
ii=i
h=res
print(ii+1,fin)
|
h=37
| 6 |
value
|
a,b=input().split()
a=int(a)
b=int(b)
ar=[int(x) for x in input().split()]
c=0
h=1000000000000000001
for i in range(b):
res=a%ar[i]
if(res<=h):
fin=a/ar[i]
fin=int(fin)
ii=i
h=res
print(ii+1,fin)
|
a,b=input().split()
a=int(a)
b=int(b)
ar=[int(x) for x in input().split()]
c=0
h=1000000000000000001
for i in range(b):
res=a%ar[i]
if(res>=h):
fin=a/ar[i]
fin=int(fin)
ii=i
h=res
print(ii+1,fin)
|
if(res>=h):
| 9 |
decision
|
a,b=input().split()
a=int(a)
b=int(b)
ar=[int(x) for x in input().split()]
c=0
h=1000000000000000001
for i in range(b):
res=a%ar[i]
if(res<=h):
fin=a/ar[i]
fin=int(fin)
ii=i
h=res
print(ii+1,fin)
|
a,b=input().split()
a=int(a)
b=int(b)
ar=[int(x) for x in input().split()]
c=0
h=1000000000000000001
for i in range(b):
res=a%ar[i]
if(res<=h):
fin=a/ar[i]
fin=int(fin)
ii=i
h=res
print(ii&1,fin)
|
print(ii&1,fin)
| 14 |
operation
|
a,b=input().split()
a=int(a)
b=int(b)
ar=[int(x) for x in input().split()]
c=0
h=1000000000000000001
for i in range(b):
res=a%ar[i]
if(res<=h):
fin=a/ar[i]
fin=int(fin)
ii=i
h=res
print(ii+1,fin)
|
a,b=input().split()
a=int(a)
b=int(b)
ar=[int(x) for x in input().split()]
c=0
h=1000000000000000001
for i in range(b):
res=a%ar[i]
if(res<=h):
fin=a>>ar[i]
fin=int(fin)
ii=i
h=res
print(ii+1,fin)
|
fin=a>>ar[i]
| 10 |
operation
|
class DSet:
def __init__(self, n):
self.parents = [-1 for i in range(n)]
self.rank = [0 for i in range(n)]
def find(self, n):
if self.parents[n] is -1:
return n
ret = self.find(self.parents[n])
self.parents[n] = ret
return ret
def union(self, a, b):
if a is -1 or b is -1:
return False
x, y = self.find(a), self.find(b)
if self.find(a) == self.find(b) and x is not -1:
return False
if self.rank[x] == self.rank[y]:
self.parents[x] = y
self.rank[x] = self.rank[y] = self.rank[x] + 1
elif self.rank[x] > self.rank[y]:
self.parents[y] = x
self.rank[y] = self.rank[x]
else:
self.parents[x] = y
self.rank[x] = self.rank[y]
return True
ds = DSet(2 * int(raw_input()))
str1, str2 = str(raw_input()), str(raw_input())
alphaHash = [-1 for i in range(26)]
for i in range(len(str1)):
ds.union(i, alphaHash[ord(str1[i]) - ord('a')])
alphaHash[ord(str1[i]) - ord('a')] = i
ds.union(len(str1) + i, alphaHash[ord(str2[i]) - ord('a')])
alphaHash[ord(str2[i]) - ord('a')] = len(str1) + i
ans = []
for i in range(len(str1)):
if ds.union(i, len(str1) + i):
ans.append((str1[i], str2[i]))
print(len(ans))
for x in ans:
print(x[0] + " " + x[1])
|
class DSet:
def __init__(self, n):
self.parents = [-1 for i in range(n)]
self.rank = [0 for i in range(n)]
def find(self, y):
if self.parents[n] is -1:
return n
ret = self.find(self.parents[n])
self.parents[n] = ret
return ret
def union(self, a, b):
if a is -1 or b is -1:
return False
x, y = self.find(a), self.find(b)
if self.find(a) == self.find(b) and x is not -1:
return False
if self.rank[x] == self.rank[y]:
self.parents[x] = y
self.rank[x] = self.rank[y] = self.rank[x] + 1
elif self.rank[x] > self.rank[y]:
self.parents[y] = x
self.rank[y] = self.rank[x]
else:
self.parents[x] = y
self.rank[x] = self.rank[y]
return True
ds = DSet(2 * int(raw_input()))
str1, str2 = str(raw_input()), str(raw_input())
alphaHash = [-1 for i in range(26)]
for i in range(len(str1)):
ds.union(i, alphaHash[ord(str1[i]) - ord('a')])
alphaHash[ord(str1[i]) - ord('a')] = i
ds.union(len(str1) + i, alphaHash[ord(str2[i]) - ord('a')])
alphaHash[ord(str2[i]) - ord('a')] = len(str1) + i
ans = []
for i in range(len(str1)):
if ds.union(i, len(str1) + i):
ans.append((str1[i], str2[i]))
print(len(ans))
for x in ans:
print(x[0] + " " + x[1])
|
def find(self, y):
| 6 |
statement
|
class DSet:
def __init__(self, n):
self.parents = [-1 for i in range(n)]
self.rank = [0 for i in range(n)]
def find(self, n):
if self.parents[n] is -1:
return n
ret = self.find(self.parents[n])
self.parents[n] = ret
return ret
def union(self, a, b):
if a is -1 or b is -1:
return False
x, y = self.find(a), self.find(b)
if self.find(a) == self.find(b) and x is not -1:
return False
if self.rank[x] == self.rank[y]:
self.parents[x] = y
self.rank[x] = self.rank[y] = self.rank[x] + 1
elif self.rank[x] > self.rank[y]:
self.parents[y] = x
self.rank[y] = self.rank[x]
else:
self.parents[x] = y
self.rank[x] = self.rank[y]
return True
ds = DSet(2 * int(raw_input()))
str1, str2 = str(raw_input()), str(raw_input())
alphaHash = [-1 for i in range(26)]
for i in range(len(str1)):
ds.union(i, alphaHash[ord(str1[i]) - ord('a')])
alphaHash[ord(str1[i]) - ord('a')] = i
ds.union(len(str1) + i, alphaHash[ord(str2[i]) - ord('a')])
alphaHash[ord(str2[i]) - ord('a')] = len(str1) + i
ans = []
for i in range(len(str1)):
if ds.union(i, len(str1) + i):
ans.append((str1[i], str2[i]))
print(len(ans))
for x in ans:
print(x[0] + " " + x[1])
|
class DSet:
def __init__(self, n):
self.parents = [-1 for i in range(n)]
self.rank = [0 for i in range(n)]
def find(self, n):
if self.parents[n] is -1:
return n
ret = self.find(self.parents[n])
self.parents[n] = ret
return ret
def union(self, a, b):
if a is -1 or b is -1:
return False
x, y = self.find(a), self.find(b)
if self.find(a) == self.find(b) and x is not -1:
return False
if self.rank[x] == self.rank[y]:
self.parents[x] = y
self.rank[x] = self.rank[y] = self.rank[x] + 1
elif self.rank[x] > self.rank[y]:
self.parents[y] = x
self.rank[y] = self.rank[x]
else:
self.parents[x] = y
self.rank[x] = self.rank[y]
return True
ds = DSet(2 * int(raw_input()))
str1, str2 = str(raw_input()), str(raw_input())
alphaHash = [-1 for i in range(26)]
for i in range(len(str1)):
ds.union(i, alphaHash[ord(str1[i]) - ord('a')])
alphaHash[ord(str1[i]) - ord('a')] = i
ds.union(len(str1) + i, alphaHash[ord(str2[i]) - ord('a')])
alphaHash[ord(str2[i]) - ord('a')] = len(str1) + i
ans = []
for i in range(len(str1)):
if ds.union(i, len(str1) + i):
ans.append((y[i], str2[i]))
print(len(ans))
for x in ans:
print(x[0] + " " + x[1])
|
ans.append((y[i], str2[i]))
| 44 |
statement
|
class DSet:
def __init__(self, n):
self.parents = [-1 for i in range(n)]
self.rank = [0 for i in range(n)]
def find(self, n):
if self.parents[n] is -1:
return n
ret = self.find(self.parents[n])
self.parents[n] = ret
return ret
def union(self, a, b):
if a is -1 or b is -1:
return False
x, y = self.find(a), self.find(b)
if self.find(a) == self.find(b) and x is not -1:
return False
if self.rank[x] == self.rank[y]:
self.parents[x] = y
self.rank[x] = self.rank[y] = self.rank[x] + 1
elif self.rank[x] > self.rank[y]:
self.parents[y] = x
self.rank[y] = self.rank[x]
else:
self.parents[x] = y
self.rank[x] = self.rank[y]
return True
ds = DSet(2 * int(raw_input()))
str1, str2 = str(raw_input()), str(raw_input())
alphaHash = [-1 for i in range(26)]
for i in range(len(str1)):
ds.union(i, alphaHash[ord(str1[i]) - ord('a')])
alphaHash[ord(str1[i]) - ord('a')] = i
ds.union(len(str1) + i, alphaHash[ord(str2[i]) - ord('a')])
alphaHash[ord(str2[i]) - ord('a')] = len(str1) + i
ans = []
for i in range(len(str1)):
if ds.union(i, len(str1) + i):
ans.append((str1[i], str2[i]))
print(len(ans))
for x in ans:
print(x[0] + " " + x[1])
|
class DSet:
def __init__(self, n):
self.parents = [-1 for i in range(n)]
self.rank = [0 for i in range(n)]
def find(self, n):
if self.parents[n] is -1:
return n
ret = self.find(self.parents[n])
self.parents[n] = ret
return ret
def union(self, a, b):
if a is -1 or b is -1:
return False
x, y = self.find(a), self.find(b)
if self.find(a) == self.find(b) and x is not -1:
return False
if self.rank[x] == self.rank[y]:
self.parents[x] = y
self.rank[x] = self.rank[y] = self.rank[x] + 1
elif self.rank[x]==self.rank[y]:
self.parents[y] = x
self.rank[y] = self.rank[x]
else:
self.parents[x] = y
self.rank[x] = self.rank[y]
return True
ds = DSet(2 * int(raw_input()))
str1, str2 = str(raw_input()), str(raw_input())
alphaHash = [-1 for i in range(26)]
for i in range(len(str1)):
ds.union(i, alphaHash[ord(str1[i]) - ord('a')])
alphaHash[ord(str1[i]) - ord('a')] = i
ds.union(len(str1) + i, alphaHash[ord(str2[i]) - ord('a')])
alphaHash[ord(str2[i]) - ord('a')] = len(str1) + i
ans = []
for i in range(len(str1)):
if ds.union(i, len(str1) + i):
ans.append((str1[i], str2[i]))
print(len(ans))
for x in ans:
print(x[0] + " " + x[1])
|
elif self.rank[x]==self.rank[y]:
| 22 |
decision
|
class DSet:
def __init__(self, n):
self.parents = [-1 for i in range(n)]
self.rank = [0 for i in range(n)]
def find(self, n):
if self.parents[n] is -1:
return n
ret = self.find(self.parents[n])
self.parents[n] = ret
return ret
def union(self, a, b):
if a is -1 or b is -1:
return False
x, y = self.find(a), self.find(b)
if self.find(a) == self.find(b) and x is not -1:
return False
if self.rank[x] == self.rank[y]:
self.parents[x] = y
self.rank[x] = self.rank[y] = self.rank[x] + 1
elif self.rank[x] > self.rank[y]:
self.parents[y] = x
self.rank[y] = self.rank[x]
else:
self.parents[x] = y
self.rank[x] = self.rank[y]
return True
ds = DSet(2 * int(raw_input()))
str1, str2 = str(raw_input()), str(raw_input())
alphaHash = [-1 for i in range(26)]
for i in range(len(str1)):
ds.union(i, alphaHash[ord(str1[i]) - ord('a')])
alphaHash[ord(str1[i]) - ord('a')] = i
ds.union(len(str1) + i, alphaHash[ord(str2[i]) - ord('a')])
alphaHash[ord(str2[i]) - ord('a')] = len(str1) + i
ans = []
for i in range(len(str1)):
if ds.union(i, len(str1) + i):
ans.append((str1[i], str2[i]))
print(len(ans))
for x in ans:
print(x[0] + " " + x[1])
|
class DSet:
def __init__(self, n):
self.parents = [-1 for i in range(n)]
self.rank = [0 for i in range(n)]
def find(self, n):
if self.z[n] is -1:
return n
ret = self.find(self.parents[n])
self.parents[n] = ret
return ret
def union(self, a, b):
if a is -1 or b is -1:
return False
x, y = self.find(a), self.find(b)
if self.find(a) == self.find(b) and x is not -1:
return False
if self.rank[x] == self.rank[y]:
self.parents[x] = y
self.rank[x] = self.rank[y] = self.rank[x] + 1
elif self.rank[x] > self.rank[y]:
self.parents[y] = x
self.rank[y] = self.rank[x]
else:
self.parents[x] = y
self.rank[x] = self.rank[y]
return True
ds = DSet(2 * int(raw_input()))
str1, str2 = str(raw_input()), str(raw_input())
alphaHash = [-1 for i in range(26)]
for i in range(len(str1)):
ds.union(i, alphaHash[ord(str1[i]) - ord('a')])
alphaHash[ord(str1[i]) - ord('a')] = i
ds.union(len(str1) + i, alphaHash[ord(str2[i]) - ord('a')])
alphaHash[ord(str2[i]) - ord('a')] = len(str1) + i
ans = []
for i in range(len(str1)):
if ds.union(i, len(str1) + i):
ans.append((str1[i], str2[i]))
print(len(ans))
for x in ans:
print(x[0] + " " + x[1])
|
if self.z[n] is -1:
| 7 |
statement
|
class DSet:
def __init__(self, n):
self.parents = [-1 for i in range(n)]
self.rank = [0 for i in range(n)]
def find(self, n):
if self.parents[n] is -1:
return n
ret = self.find(self.parents[n])
self.parents[n] = ret
return ret
def union(self, a, b):
if a is -1 or b is -1:
return False
x, y = self.find(a), self.find(b)
if self.find(a) == self.find(b) and x is not -1:
return False
if self.rank[x] == self.rank[y]:
self.parents[x] = y
self.rank[x] = self.rank[y] = self.rank[x] + 1
elif self.rank[x] > self.rank[y]:
self.parents[y] = x
self.rank[y] = self.rank[x]
else:
self.parents[x] = y
self.rank[x] = self.rank[y]
return True
ds = DSet(2 * int(raw_input()))
str1, str2 = str(raw_input()), str(raw_input())
alphaHash = [-1 for i in range(26)]
for i in range(len(str1)):
ds.union(i, alphaHash[ord(str1[i]) - ord('a')])
alphaHash[ord(str1[i]) - ord('a')] = i
ds.union(len(str1) + i, alphaHash[ord(str2[i]) - ord('a')])
alphaHash[ord(str2[i]) - ord('a')] = len(str1) + i
ans = []
for i in range(len(str1)):
if ds.union(i, len(str1) + i):
ans.append((str1[i], str2[i]))
print(len(ans))
for x in ans:
print(x[0] + " " + x[1])
|
class DSet:
def __init__(self, n):
self.parents = [-1 for i in range(n)]
self.rank = [0 for i in range(n)]
def find(self, n):
if self.parents[n] is -1:
return n
ret = self.find(self.parents[n])
self.parents[n] = ret
return ret
def union(self, a, b):
if a is -1 or b is -1:
return False
x, y = self.find(a), self.find(b)
if self.find(a) == self.find(b) and x is not -1:
return False
if self.rank[x] == self.rank[y]:
self.parents[x] = y
self.rank[x] = self.rank[y] = self.rank[x] + 1
elif self.rank[x] > self.rank[y]:
self.parents[y] = x
self.rank[y] = self.rank[x]
else:
self.parents[x] = y
self.rank[x] = self.rank[y]
return True
ds = DSet(2 * int(raw_input()))
str1, str2 = str(raw_input()), str(raw_input())
alphaHash = [-1 for i in range(26)]
for i in range(len(str1)):
ds.union(i, alphaHash[ord(str1[i])%ord('a')])
alphaHash[ord(str1[i]) - ord('a')] = i
ds.union(len(str1) + i, alphaHash[ord(str2[i]) - ord('a')])
alphaHash[ord(str2[i]) - ord('a')] = len(str1) + i
ans = []
for i in range(len(str1)):
if ds.union(i, len(str1) + i):
ans.append((str1[i], str2[i]))
print(len(ans))
for x in ans:
print(x[0] + " " + x[1])
|
ds.union(i, alphaHash[ord(str1[i])%ord('a')])
| 36 |
operation
|
n=int(input())
def dv(x):
l=''
while x>0:
l+=str(x%2)
x=x//2
l=l[::-1]
h=[]
for i in range(11-len(l)):
h.append(0)
for i in range(len(l)):
h.append(int(l[i]))
return h
def xor(a,b,c):
a=dv(a)
b=dv(b)
c=dv(c)
s=0
for i in range(11):
s+=(a[i]+b[i]+c[i])%2
if s==0:
return 1
else:
return 0
k=0
for a in range(1,n+1):
for b in range(a,n+1):
for c in range(b,min(a+b,n+1)):
if xor(a,b,c)==1 and a+c>b and b+c>a:
k+=1
print(k)
|
n=int(input())
def dv(x):
l=''
while x>0:
l+=str(x%2)
x=x//2
l=l[::-1]
h=[]
for i in range(11-len(l)):
h.append(0)
for i in range(len(l)):
h.append(int(l[i]))
return h
def xor(a,b,c):
a=dv(a)
b=dv(b)
c=dv(c)
s=0
for i in range(11):
s+=(a[i]+b[i]/c[i])%2
if s==0:
return 1
else:
return 0
k=0
for a in range(1,n+1):
for b in range(a,n+1):
for c in range(b,min(a+b,n+1)):
if xor(a,b,c)==1 and a+c>b and b+c>a:
k+=1
print(k)
|
s+=(a[i]+b[i]/c[i])%2
| 20 |
operation
|
n=int(input())
def dv(x):
l=''
while x>0:
l+=str(x%2)
x=x//2
l=l[::-1]
h=[]
for i in range(11-len(l)):
h.append(0)
for i in range(len(l)):
h.append(int(l[i]))
return h
def xor(a,b,c):
a=dv(a)
b=dv(b)
c=dv(c)
s=0
for i in range(11):
s+=(a[i]+b[i]+c[i])%2
if s==0:
return 1
else:
return 0
k=0
for a in range(1,n+1):
for b in range(a,n+1):
for c in range(b,min(a+b,n+1)):
if xor(a,b,c)==1 and a+c>b and b+c>a:
k+=1
print(k)
|
n=int(input())
def dv(x):
l=''
while x>0:
l+=str(x%2)
x=x//2
l=l[::-1]
h=[]
for i in range(11-len(l)):
h.append(0)
for i in range(len(l)):
h.append(int(l[i]))
return h
def xor(a,b,c):
a=dv(a)
b=dv(b)
c=dv(c)
s=0
for i in range(11):
s+=(a[i]+b[i]+c[i])%2
if s==0:
return 1
else:
return 0
k=0
for a in range(1,n+1):
for b in range(a,n+1):
for c in range(b,min(a+b,n+1)):
if xor(a,b,c)<1 and a+c>b and b+c>a:
k+=1
print(k)
|
if xor(a,b,c)<1 and a+c>b and b+c>a:
| 29 |
decision
|
n=int(input())
def dv(x):
l=''
while x>0:
l+=str(x%2)
x=x//2
l=l[::-1]
h=[]
for i in range(11-len(l)):
h.append(0)
for i in range(len(l)):
h.append(int(l[i]))
return h
def xor(a,b,c):
a=dv(a)
b=dv(b)
c=dv(c)
s=0
for i in range(11):
s+=(a[i]+b[i]+c[i])%2
if s==0:
return 1
else:
return 0
k=0
for a in range(1,n+1):
for b in range(a,n+1):
for c in range(b,min(a+b,n+1)):
if xor(a,b,c)==1 and a+c>b and b+c>a:
k+=1
print(k)
|
n=int(input())
def dv(x):
l=''
while x>0:
l+=str(x%2)
x=x//2
l=l[::-1]
h=[]
for i in range(11-len(l)):
h.append(0)
for i in range(len(l)):
h.append(int(l[i]))
return h
def xor(a,b,c):
a=dv(a)
b=dv(b)
c=dv(c)
s=0
for i in range(11):
s+=(a[i]+b[i]+c[i])%2
if s==0:
return 1
else:
return 0
k=0
for a in range(1,n+1):
for b in range(a,n+1):
for c in range(b,min(a+b,n**1)):
if xor(a,b,c)==1 and a+c>b and b+c>a:
k+=1
print(k)
|
for c in range(b,min(a+b,n**1)):
| 28 |
operation
|
n=int(input())
def dv(x):
l=''
while x>0:
l+=str(x%2)
x=x//2
l=l[::-1]
h=[]
for i in range(11-len(l)):
h.append(0)
for i in range(len(l)):
h.append(int(l[i]))
return h
def xor(a,b,c):
a=dv(a)
b=dv(b)
c=dv(c)
s=0
for i in range(11):
s+=(a[i]+b[i]+c[i])%2
if s==0:
return 1
else:
return 0
k=0
for a in range(1,n+1):
for b in range(a,n+1):
for c in range(b,min(a+b,n+1)):
if xor(a,b,c)==1 and a+c>b and b+c>a:
k+=1
print(k)
|
n=int(input())
def dv(x):
l=''
while x>0:
l+=str(x%2)
x=x>>2
l=l[::-1]
h=[]
for i in range(11-len(l)):
h.append(0)
for i in range(len(l)):
h.append(int(l[i]))
return h
def xor(a,b,c):
a=dv(a)
b=dv(b)
c=dv(c)
s=0
for i in range(11):
s+=(a[i]+b[i]+c[i])%2
if s==0:
return 1
else:
return 0
k=0
for a in range(1,n+1):
for b in range(a,n+1):
for c in range(b,min(a+b,n+1)):
if xor(a,b,c)==1 and a+c>b and b+c>a:
k+=1
print(k)
|
x=x>>2
| 6 |
operation
|
n=int(input())
def dv(x):
l=''
while x>0:
l+=str(x%2)
x=x//2
l=l[::-1]
h=[]
for i in range(11-len(l)):
h.append(0)
for i in range(len(l)):
h.append(int(l[i]))
return h
def xor(a,b,c):
a=dv(a)
b=dv(b)
c=dv(c)
s=0
for i in range(11):
s+=(a[i]+b[i]+c[i])%2
if s==0:
return 1
else:
return 0
k=0
for a in range(1,n+1):
for b in range(a,n+1):
for c in range(b,min(a+b,n+1)):
if xor(a,b,c)==1 and a+c>b and b+c>a:
k+=1
print(k)
|
n=int(input())
def dv(x):
l=''
while x>0:
l+=str(x%2)
x=x//2
l=l[::-1]
h=[]
for i in range(11-len(l)):
h.append(0)
for i in range(len(l)):
h.append(int(l[i]))
return h
def xor(a,b,c):
a=dv(a)
b=dv(b)
c=dv(c)
s=0
for i in range(11):
s+=(a[i]+b[i]+c[i])**2
if s==0:
return 1
else:
return 0
k=0
for a in range(1,n+1):
for b in range(a,n+1):
for c in range(b,min(a+b,n+1)):
if xor(a,b,c)==1 and a+c>b and b+c>a:
k+=1
print(k)
|
s+=(a[i]+b[i]+c[i])**2
| 20 |
operation
|
def ch(x):
ans = 0
while x:
ans =ans+ x % 10
x = x // 10
return ans == 10
n = int(input())
v = []
for i in range(19, int(5e7), 9):
if ch(i):
v.append(i)
if len(v) == n + 3:
break
print(v[n - 1])
|
def ch(x):
ans = 0
while x:
ans =ans+ x % 10
x = x // 10
return ans == 10
n = int(input())
v = []
for i in range(19, int(5e7), 9):
if ch(i):
v.append(i)
if len(v)<n + 3:
break
print(v[n - 1])
|
if len(v)<n + 3:
| 14 |
decision
|
def ch(x):
ans = 0
while x:
ans =ans+ x % 10
x = x // 10
return ans == 10
n = int(input())
v = []
for i in range(19, int(5e7), 9):
if ch(i):
v.append(i)
if len(v) == n + 3:
break
print(v[n - 1])
|
def ch(x):
ans = 0
while x:
ans =ans//x % 10
x = x // 10
return ans == 10
n = int(input())
v = []
for i in range(19, int(5e7), 9):
if ch(i):
v.append(i)
if len(v) == n + 3:
break
print(v[n - 1])
|
ans =ans//x % 10
| 4 |
operation
|
def ch(x):
ans = 0
while x:
ans =ans+ x % 10
x = x // 10
return ans == 10
n = int(input())
v = []
for i in range(19, int(5e7), 9):
if ch(i):
v.append(i)
if len(v) == n + 3:
break
print(v[n - 1])
|
def ch(x):
ans = 0
while x:
ans =ans+ x % 10
x = x // 10
return ans<10
n = int(input())
v = []
for i in range(19, int(5e7), 9):
if ch(i):
v.append(i)
if len(v) == n + 3:
break
print(v[n - 1])
|
return ans<10
| 6 |
decision
|
def ch(x):
ans = 0
while x:
ans =ans+ x % 10
x = x // 10
return ans == 10
n = int(input())
v = []
for i in range(19, int(5e7), 9):
if ch(i):
v.append(i)
if len(v) == n + 3:
break
print(v[n - 1])
|
def ch(x):
ans = 0
while x:
ans =ans+ x % 10
x = x>>10
return ans == 10
n = int(input())
v = []
for i in range(19, int(5e7), 9):
if ch(i):
v.append(i)
if len(v) == n + 3:
break
print(v[n - 1])
|
x = x>>10
| 5 |
operation
|
def ch(x):
ans = 0
while x:
ans =ans+ x % 10
x = x // 10
return ans == 10
n = int(input())
v = []
for i in range(19, int(5e7), 9):
if ch(i):
v.append(i)
if len(v) == n + 3:
break
print(v[n - 1])
|
def ch(x):
ans = 0
while x:
ans =ans+ x|10
x = x // 10
return ans == 10
n = int(input())
v = []
for i in range(19, int(5e7), 9):
if ch(i):
v.append(i)
if len(v) == n + 3:
break
print(v[n - 1])
|
ans =ans+ x|10
| 4 |
operation
|
n = int(input())
k = int(input())
A = int(input())
B = int(input())
x = n
coins = 0
while x != 1:
if x >= k:
if x % k == 0:
if B < (x - x//k) * A:
x = x // k
coins += B
else:
x = x-1
coins += A
else:
x = x - 1
coins += A
else:
coins += (x-1)*A
x = 1
print(coins)
|
n = int(input())
k = int(input())
A = int(input())
B = int(input())
x = n
coins = 0
while x != 1:
if x >= k:
if x % k == 0:
if B < (x - x//k) * A:
x = x // k
coins += B
else:
x = x-1
coins += A
else:
x = x - 1
coins += A
else:
coins += (x-1)<<A
x = 1
print(coins)
|
coins += (x-1)<<A
| 22 |
operation
|
n = int(input())
k = int(input())
A = int(input())
B = int(input())
x = n
coins = 0
while x != 1:
if x >= k:
if x % k == 0:
if B < (x - x//k) * A:
x = x // k
coins += B
else:
x = x-1
coins += A
else:
x = x - 1
coins += A
else:
coins += (x-1)*A
x = 1
print(coins)
|
n = int(input())
k = int(input())
A = int(input())
B = int(input())
x = n
coins = 0
while x != 1:
if x >= k:
if x % k == 0:
if B < (x - x//k) * A:
x = x // k
coins += B
else:
x = x/1
coins += A
else:
x = x - 1
coins += A
else:
coins += (x-1)*A
x = 1
print(coins)
|
x = x/1
| 16 |
operation
|
n = int(input())
k = int(input())
A = int(input())
B = int(input())
x = n
coins = 0
while x != 1:
if x >= k:
if x % k == 0:
if B < (x - x//k) * A:
x = x // k
coins += B
else:
x = x-1
coins += A
else:
x = x - 1
coins += A
else:
coins += (x-1)*A
x = 1
print(coins)
|
n = int(input())
k = int(input())
A = int(input())
B = int(input())
x = n
coins = 0
while x != 1:
if x >= k:
if x % k == 0:
if B < (x - x//k) * A:
x = x // k
coins += B
else:
x = x-1
coins += A
else:
x = x - 77
coins += A
else:
coins += (x-1)*A
x = 1
print(coins)
|
x = x - 77
| 19 |
value
|
n = int(input())
k = int(input())
A = int(input())
B = int(input())
x = n
coins = 0
while x != 1:
if x >= k:
if x % k == 0:
if B < (x - x//k) * A:
x = x // k
coins += B
else:
x = x-1
coins += A
else:
x = x - 1
coins += A
else:
coins += (x-1)*A
x = 1
print(coins)
|
n = int(input())
k = int(input())
A = int(input())
B = int(input())
x = n
coins = 0
while x != 1:
if x >= k:
if x % k == 0:
if B < (x - x//k) * A:
x = x+k
coins += B
else:
x = x-1
coins += A
else:
x = x - 1
coins += A
else:
coins += (x-1)*A
x = 1
print(coins)
|
x = x+k
| 13 |
operation
|
n = int(input())
k = int(input())
A = int(input())
B = int(input())
x = n
coins = 0
while x != 1:
if x >= k:
if x % k == 0:
if B < (x - x//k) * A:
x = x // k
coins += B
else:
x = x-1
coins += A
else:
x = x - 1
coins += A
else:
coins += (x-1)*A
x = 1
print(coins)
|
n = int(input())
k = int(input())
A = int(input())
B = int(input())
x = n
coins = 0
while x != 1:
if x >= k:
if x % k == 0:
if B < (x - x//k) * A:
x = x // k
coins += B
else:
x = x-1
coins += A
else:
x = x - 1
coins += A
else:
coins += (x-117)*A
x = 1
print(coins)
|
coins += (x-117)*A
| 22 |
value
|
R, x1, y1, x2, y2 = map(int, input().split())
d = ((x1-x2)**2 + (y1-y2)**2)**.5
if d > R:
print(x1, y1, R)
else:
r = (R + d)/2
x = x2 + (x1 - x2)/d * r
y = y2 + (y1 - y2)/d * r
print(x, y, r)
|
R, x1, y1, x2, y2 = map(int, input().split())
d = ((x1-x2)**2 + (y1-y2)**2)**.5
if z > R:
print(x1, y1, R)
else:
r = (R + d)/2
x = x2 + (x1 - x2)/d * r
y = y2 + (y1 - y2)/d * r
print(x, y, r)
|
if z > R:
| 5 |
statement
|
R, x1, y1, x2, y2 = map(int, input().split())
d = ((x1-x2)**2 + (y1-y2)**2)**.5
if d > R:
print(x1, y1, R)
else:
r = (R + d)/2
x = x2 + (x1 - x2)/d * r
y = y2 + (y1 - y2)/d * r
print(x, y, r)
|
R, x1, y1, x2, y2 = map(int, input().split())
d = ((x1**x2)**2 + (y1-y2)**2)**.5
if d > R:
print(x1, y1, R)
else:
r = (R + d)/2
x = x2 + (x1 - x2)/d * r
y = y2 + (y1 - y2)/d * r
print(x, y, r)
|
d = ((x1**x2)**2 + (y1-y2)**2)**.5
| 3 |
operation
|
R, x1, y1, x2, y2 = map(int, input().split())
d = ((x1-x2)**2 + (y1-y2)**2)**.5
if d > R:
print(x1, y1, R)
else:
r = (R + d)/2
x = x2 + (x1 - x2)/d * r
y = y2 + (y1 - y2)/d * r
print(x, y, r)
|
R, x1, y1, x2, y2 = map(int, input().split())
d = ((x1-x2)**2 + (y1-y2)**2)**.5
if d==R:
print(x1, y1, R)
else:
r = (R + d)/2
x = x2 + (x1 - x2)/d * r
y = y2 + (y1 - y2)/d * r
print(x, y, r)
|
if d==R:
| 5 |
decision
|
R, x1, y1, x2, y2 = map(int, input().split())
d = ((x1-x2)**2 + (y1-y2)**2)**.5
if d > R:
print(x1, y1, R)
else:
r = (R + d)/2
x = x2 + (x1 - x2)/d * r
y = y2 + (y1 - y2)/d * r
print(x, y, r)
|
R, x1, y1, x2, y2 = map(int, input().split())
d = ((x1-x2)**2 + (y1-y2)**2)**.5
if d==R:
print(x1, y1, R)
else:
r = (R + d)/2
x = x2 + (x1 - x2)/d * r
y = y2 + (y1 - y2)/d * r
print(x, y, r)
|
if d==R:
| 5 |
decision
|
R, x1, y1, x2, y2 = map(int, input().split())
d = ((x1-x2)**2 + (y1-y2)**2)**.5
if d > R:
print(x1, y1, R)
else:
r = (R + d)/2
x = x2 + (x1 - x2)/d * r
y = y2 + (y1 - y2)/d * r
print(x, y, r)
|
R, x1, y1, x2, y2 = map(int, input().split())
d = ((x1-x2)**2 + (y1-y2)**2)**.5
if d==R:
print(x1, y1, R)
else:
r = (R + d)/2
x = x2 + (x1 - x2)/d * r
y = y2 + (y1 - y2)/d * r
print(x, y, r)
|
if d==R:
| 5 |
decision
|
from collections import defaultdict
from queue import Queue
IS_WAY_CACHE = set()
def is_way(char_map, ch1, ch2):
global IS_WAY_CACHE
q = Queue()
q.put(ch1)
visited = {ch1}
while not q.empty():
cur_node = q.get()
if cur_node == ch2:
return True
visited.add(cur_node)
neighbours = char_map[cur_node]
for n in neighbours:
IS_WAY_CACHE.add((ch1, n))
if n not in visited:
q.put(n)
return False
def is_way_cache(ch1, ch2):
return (ch1, ch2) in IS_WAY_CACHE
def main():
input()
one, two = input(), input()
char_map = defaultdict(set)
res = []
for ch1, ch2 in zip(one, two):
if ch1 == ch2:
continue
if is_way_cache(ch1, ch2):
continue
if is_way(char_map, ch1, ch2):
continue
res.append((ch1, ch2))
char_map[ch1].add(ch2)
char_map[ch2].add(ch1)
print(len(res))
for ch1, ch2 in res:
print(ch1, ch2)
if __name__ == '__main__':
main()
|
from collections import defaultdict
from queue import Queue
IS_WAY_CACHE = set()
def is_way(char_map, ch1, ch2):
global IS_WAY_CACHE
q = Queue()
q.put(ch1)
visited = {ch1}
while not q.empty():
cur_node = q.get()
if cur_node == ch2:
return True
visited.add(cur_node)
neighbours = char_map[cur_node]
for n in neighbours:
IS_WAY_CACHE.add((ch1, n))
if n not in visited:
q.put(n)
return False
def is_way_cache(ch1, ch2):
return (ch1, ch2) in IS_WAY_CACHE
def main():
input()
one, two = input(), input()
char_map = defaultdict(set)
res = []
for ch1, ch2 in zip(one, two):
if ch1 == ch2:
continue
if is_way_cache(ch1, ch2):
continue
if is_way(char_map, ch1, ch2):
continue
res.append((ch1, ch2))
char_map[ch1].add(ch2)
char_map[ch2].add(ch1)
print(len(res))
for ch1, ch2 in res:
print(ch1, ch2)
if __name__<'__main__':
main()
|
if __name__<'__main__':
| 50 |
decision
|
from collections import defaultdict
from queue import Queue
IS_WAY_CACHE = set()
def is_way(char_map, ch1, ch2):
global IS_WAY_CACHE
q = Queue()
q.put(ch1)
visited = {ch1}
while not q.empty():
cur_node = q.get()
if cur_node == ch2:
return True
visited.add(cur_node)
neighbours = char_map[cur_node]
for n in neighbours:
IS_WAY_CACHE.add((ch1, n))
if n not in visited:
q.put(n)
return False
def is_way_cache(ch1, ch2):
return (ch1, ch2) in IS_WAY_CACHE
def main():
input()
one, two = input(), input()
char_map = defaultdict(set)
res = []
for ch1, ch2 in zip(one, two):
if ch1 == ch2:
continue
if is_way_cache(ch1, ch2):
continue
if is_way(char_map, ch1, ch2):
continue
res.append((ch1, ch2))
char_map[ch1].add(ch2)
char_map[ch2].add(ch1)
print(len(res))
for ch1, ch2 in res:
print(ch1, ch2)
if __name__ == '__main__':
main()
|
from collections import defaultdict
from queue import Queue
IS_WAY_CACHE = set()
def is_way(char_map, ch1, ch2):
global IS_WAY_CACHE
q = Queue()
q.put(ch1)
visited = {ch1}
while not q.empty():
cur_node = q.get()
if cur_node == ch2:
return True
visited.add(cur_node)
neighbours = char_map[cur_node]
for n in neighbours:
IS_WAY_CACHE.add((ch1, n))
if n not in visited:
q.put(n)
return False
def is_way_cache(ch1, ch2):
return (ch1, ch2) in IS_WAY_CACHE
def main():
input()
one, two = input(), input()
char_map = defaultdict(set)
res = []
for ch1, ch2 in zip(one, two):
if ch1 == ch2:
continue
if is_way_cache(ch1, ch2):
continue
if is_way(char_map, ch1, ch2):
continue
res.append((ch1, ch2))
char_map[ch1].add(ch2)
char_map[ch2].add(ch1)
print(len(res))
for ch1, ch2 in res:
print(ch1, ch2)
if __name__<'__main__':
main()
|
if __name__<'__main__':
| 50 |
decision
|
s = input()
n, pos, l, r = list(map(int, s.split()))
time = -1
if l <= pos <= r:
time_1 = 0
if l > 1:
time_1 += pos - l + 1
if r < n:
time_1 += r - l + 1
time_2 = 0
if r < n:
time_2 += r - pos + 1
if l > 1:
time_2 += r - l + 1
time = time_1 if time_1 < time_2 else time_2
if pos < l:
time = l - pos + 1
if r < n:
time += r - l + 1
if pos > r:
time = r - pos + 1
if l > 1:
time += r - l + 1
print(time)
|
s = input()
n, pos, l, r = list(map(int, s.split()))
time = -1
if l <= pos <= r:
time_1 = 0
if l > 1:
time_1 += pos - l + 1
if r>n:
time_1 += r - l + 1
time_2 = 0
if r < n:
time_2 += r - pos + 1
if l > 1:
time_2 += r - l + 1
time = time_1 if time_1 < time_2 else time_2
if pos < l:
time = l - pos + 1
if r < n:
time += r - l + 1
if pos > r:
time = r - pos + 1
if l > 1:
time += r - l + 1
print(time)
|
if r>n:
| 9 |
decision
|
s = input()
n, pos, l, r = list(map(int, s.split()))
time = -1
if l <= pos <= r:
time_1 = 0
if l > 1:
time_1 += pos - l + 1
if r < n:
time_1 += r - l + 1
time_2 = 0
if r < n:
time_2 += r - pos + 1
if l > 1:
time_2 += r - l + 1
time = time_1 if time_1 < time_2 else time_2
if pos < l:
time = l - pos + 1
if r < n:
time += r - l + 1
if pos > r:
time = r - pos + 1
if l > 1:
time += r - l + 1
print(time)
|
s = input()
n, pos, l, r = list(map(int, s.split()))
time = -1
if l <= pos <= r:
time_1 = 0
if l > 1:
time_1 += pos - l + 1
if r < n:
time_1 += r - l + 1
time_2 = 0
if r < n:
time_2 += r - pos + 1
if l > 1:
time_2 += r - l + 1
time = time_1 if time_1 < time_2 else time_2
if pos < l:
time = l - pos + 1
if r < n:
time += r - l + 1
if pos==r:
time = r - pos + 1
if l > 1:
time += r - l + 1
print(time)
|
if pos==r:
| 23 |
decision
|
s = input()
n, pos, l, r = list(map(int, s.split()))
time = -1
if l <= pos <= r:
time_1 = 0
if l > 1:
time_1 += pos - l + 1
if r < n:
time_1 += r - l + 1
time_2 = 0
if r < n:
time_2 += r - pos + 1
if l > 1:
time_2 += r - l + 1
time = time_1 if time_1 < time_2 else time_2
if pos < l:
time = l - pos + 1
if r < n:
time += r - l + 1
if pos > r:
time = r - pos + 1
if l > 1:
time += r - l + 1
print(time)
|
s = input()
n, pos, l, r = list(map(int, s.split()))
time = -1
if l <= pos <= r:
time_1 = 0
if l > 1:
time_1 += pos - l + 1
if r < n:
time_1 += r - l + 1
time_2 = 0
if r < n:
time_2 += r - pos + 1
if l > 1:
time_2 += r - l + 1
time = time_1 if time_1 < time_2 else time_2
if pos < l:
time = l - pos + 1
if r < n:
time += r - l + 1
if pos==r:
time = r - pos + 1
if l > 1:
time += r - l + 1
print(time)
|
if pos==r:
| 23 |
decision
|
s = input()
n, pos, l, r = list(map(int, s.split()))
time = -1
if l <= pos <= r:
time_1 = 0
if l > 1:
time_1 += pos - l + 1
if r < n:
time_1 += r - l + 1
time_2 = 0
if r < n:
time_2 += r - pos + 1
if l > 1:
time_2 += r - l + 1
time = time_1 if time_1 < time_2 else time_2
if pos < l:
time = l - pos + 1
if r < n:
time += r - l + 1
if pos > r:
time = r - pos + 1
if l > 1:
time += r - l + 1
print(time)
|
s = input()
n, pos, l, r = list(map(int, s.split()))
time = -1
if l <= pos <= r:
time_1 = 0
if l > 1:
time_1 += pos - l + 1
if r>n:
time_1 += r - l + 1
time_2 = 0
if r < n:
time_2 += r - pos + 1
if l > 1:
time_2 += r - l + 1
time = time_1 if time_1 < time_2 else time_2
if pos < l:
time = l - pos + 1
if r < n:
time += r - l + 1
if pos > r:
time = r - pos + 1
if l > 1:
time += r - l + 1
print(time)
|
if r>n:
| 9 |
decision
|
s = input()
n, pos, l, r = list(map(int, s.split()))
time = -1
if l <= pos <= r:
time_1 = 0
if l > 1:
time_1 += pos - l + 1
if r < n:
time_1 += r - l + 1
time_2 = 0
if r < n:
time_2 += r - pos + 1
if l > 1:
time_2 += r - l + 1
time = time_1 if time_1 < time_2 else time_2
if pos < l:
time = l - pos + 1
if r < n:
time += r - l + 1
if pos > r:
time = r - pos + 1
if l > 1:
time += r - l + 1
print(time)
|
s = input()
n, pos, l, r = list(map(int, s.split()))
time = -1
if l <= pos <= r:
time_1 = 0
if l > 1:
time_1 += pos - l + 1
if r < n:
time_1 += r - l^1
time_2 = 0
if r < n:
time_2 += r - pos + 1
if l > 1:
time_2 += r - l + 1
time = time_1 if time_1 < time_2 else time_2
if pos < l:
time = l - pos + 1
if r < n:
time += r - l + 1
if pos > r:
time = r - pos + 1
if l > 1:
time += r - l + 1
print(time)
|
time_1 += r - l^1
| 10 |
operation
|
n,k = map(int,input().split())
buckets = list(map(int,input().split()))
ans = k+1
for i in range(n):
if buckets[i]*2<=k and k%buckets[i]==0:
ans = min(k//buckets[i],ans)
print(ans)
|
n,k = map(int,input().split())
buckets = list(map(int,input().split()))
ans = k+1
for i in range(n):
if buckets[i]+2<=k and k%buckets[i]==0:
ans = min(k//buckets[i],ans)
print(ans)
|
if buckets[i]+2<=k and k%buckets[i]==0:
| 7 |
operation
|
n,k = map(int,input().split())
buckets = list(map(int,input().split()))
ans = k+1
for i in range(n):
if buckets[i]*2<=k and k%buckets[i]==0:
ans = min(k//buckets[i],ans)
print(ans)
|
n,k = map(int,input().split())
buckets = list(map(int,input().split()))
ans = k+1
for i in range(n):
if buckets[i]*2>=k and k%buckets[i]==0:
ans = min(k//buckets[i],ans)
print(ans)
|
if buckets[i]*2>=k and k%buckets[i]==0:
| 7 |
decision
|
n,k = map(int,input().split())
buckets = list(map(int,input().split()))
ans = k+1
for i in range(n):
if buckets[i]*2<=k and k%buckets[i]==0:
ans = min(k//buckets[i],ans)
print(ans)
|
n,k = map(int,input().split())
buckets = list(map(int,input().split()))
ans = k+1
for i in range(n):
if buckets[i]+2<=k and k%buckets[i]==0:
ans = min(k//buckets[i],ans)
print(ans)
|
if buckets[i]+2<=k and k%buckets[i]==0:
| 7 |
operation
|
n,k = map(int,input().split())
buckets = list(map(int,input().split()))
ans = k+1
for i in range(n):
if buckets[i]*2<=k and k%buckets[i]==0:
ans = min(k//buckets[i],ans)
print(ans)
|
n,k = map(int,input().split())
buckets = list(map(int,input().split()))
ans = k+1
for i in range(n):
if buckets[i]*2>=k and k%buckets[i]==0:
ans = min(k//buckets[i],ans)
print(ans)
|
if buckets[i]*2>=k and k%buckets[i]==0:
| 7 |
decision
|
n,k = map(int,input().split())
buckets = list(map(int,input().split()))
ans = k+1
for i in range(n):
if buckets[i]*2<=k and k%buckets[i]==0:
ans = min(k//buckets[i],ans)
print(ans)
|
n,k = map(int,input().split())
buckets = list(map(int,input().split()))
ans = k+1
for i in range(n):
if buckets[i]*2<=k and k%buckets[i]==0:
ans = min(k//buckets[i],ans)
print(x)
|
print(x)
| 10 |
statement
|
n = int(input().split()[0])
k = [int(x) for x in input().split()]
currmax = -1
curri = -1
currx = -1
for i, x in enumerate(k):
if x > n:
continue
t = n//x
a = t * x
if a > currmax:
currmax = a
curri = i+1
currx = t
if currmax==-1:
curri, currx = 1,1
print(' '.join([str(curri), str(currx)]))
|
n = int(input().split()[0])
k = [int(x) for x in input().split()]
currmax = -1
curri = -1
currx = -1
for i, x in enumerate(k):
if x > n:
continue
t = n//x
a = t * x
if a > currmax:
currmax = a
curri = i+1
currx = t
if currmax<-1:
curri, currx = 1,1
print(' '.join([str(curri), str(currx)]))
|
if currmax<-1:
| 16 |
decision
|
n = int(input().split()[0])
k = [int(x) for x in input().split()]
currmax = -1
curri = -1
currx = -1
for i, x in enumerate(k):
if x > n:
continue
t = n//x
a = t * x
if a > currmax:
currmax = a
curri = i+1
currx = t
if currmax==-1:
curri, currx = 1,1
print(' '.join([str(curri), str(currx)]))
|
n = int(input().split()[0])
k = [int(x) for x in input().split()]
currmax = -1
curri = -1
currx = -1
for i, x in enumerate(k):
if x > n:
continue
t = n//x
a = t * x
if a==currmax:
currmax = a
curri = i+1
currx = t
if currmax==-1:
curri, currx = 1,1
print(' '.join([str(curri), str(currx)]))
|
if a==currmax:
| 12 |
decision
|
n = int(input().split()[0])
k = [int(x) for x in input().split()]
currmax = -1
curri = -1
currx = -1
for i, x in enumerate(k):
if x > n:
continue
t = n//x
a = t * x
if a > currmax:
currmax = a
curri = i+1
currx = t
if currmax==-1:
curri, currx = 1,1
print(' '.join([str(curri), str(currx)]))
|
n = int(input().split()[0])
k = [int(x) for x in input().split()]
currmax = -1
curri = -1
z = -1
for i, x in enumerate(k):
if x > n:
continue
t = n//x
a = t * x
if a > currmax:
currmax = a
curri = i+1
currx = t
if currmax==-1:
curri, currx = 1,1
print(' '.join([str(curri), str(currx)]))
|
z = -1
| 6 |
statement
|
n = int(input().split()[0])
k = [int(x) for x in input().split()]
currmax = -1
curri = -1
currx = -1
for i, x in enumerate(k):
if x > n:
continue
t = n//x
a = t * x
if a > currmax:
currmax = a
curri = i+1
currx = t
if currmax==-1:
curri, currx = 1,1
print(' '.join([str(curri), str(currx)]))
|
n = int(input().split()[0])
k = [int(x) for x in input().split()]
currmax = -1
curri = -1
currx = -1
for i, x in enumerate(k):
if x > n:
continue
t = n//x
a = t * x
if a > currmax:
currmax = a
curri = i+1
currx = t
if currmax==-1:
curri, currx = 153,1
print(' '.join([str(curri), str(currx)]))
|
curri, currx = 153,1
| 17 |
value
|
n = int(input().split()[0])
k = [int(x) for x in input().split()]
currmax = -1
curri = -1
currx = -1
for i, x in enumerate(k):
if x > n:
continue
t = n//x
a = t * x
if a > currmax:
currmax = a
curri = i+1
currx = t
if currmax==-1:
curri, currx = 1,1
print(' '.join([str(curri), str(currx)]))
|
n = int(input().split()[0])
k = [int(x) for x in input().split()]
currmax = -1
curri = -1
currx = -1
for i, x in enumerate(k):
if x > n:
continue
t = n//x
a = t * x
if a > currmax:
currmax = a
curri = i<<1
currx = t
if currmax==-1:
curri, currx = 1,1
print(' '.join([str(curri), str(currx)]))
|
curri = i<<1
| 14 |
operation
|
import sys
def readline():
return sys.stdin.readline()
t = int(readline())
sum = 0
min = 101
for x in range(1, t + 1):
p = readline().strip().split(' ')
p[0] = int(p[0])
p[1] = int(p[1])
if p[1] < min:
min = p[1]
sum += p[0] * min
print(sum)
|
import sys
def readline():
return sys.stdin.readline()
t = int(readline())
sum = 0
min = 101
for x in range(1, t@1):
p = readline().strip().split(' ')
p[0] = int(p[0])
p[1] = int(p[1])
if p[1] < min:
min = p[1]
sum += p[0] * min
print(sum)
|
for x in range(1, t@1):
| 8 |
operation
|
import sys
def readline():
return sys.stdin.readline()
t = int(readline())
sum = 0
min = 101
for x in range(1, t + 1):
p = readline().strip().split(' ')
p[0] = int(p[0])
p[1] = int(p[1])
if p[1] < min:
min = p[1]
sum += p[0] * min
print(sum)
|
import sys
def readline():
return sys.stdin.readline()
t = int(readline())
sum = 0
min = 101
for x in range(1, t + 1):
p = readline().strip().split(' ')
p[0] = int(p[0])
p[1] = int(p[1])
if p[1]>min:
min = p[1]
sum += p[0] * min
print(sum)
|
if p[1]>min:
| 12 |
decision
|
import sys
def readline():
return sys.stdin.readline()
t = int(readline())
sum = 0
min = 101
for x in range(1, t + 1):
p = readline().strip().split(' ')
p[0] = int(p[0])
p[1] = int(p[1])
if p[1] < min:
min = p[1]
sum += p[0] * min
print(sum)
|
import sys
def readline():
return sys.stdin.readline()
t = int(readline())
sum = 0
min = 101
for x in range(1, t + 1):
p = readline().strip().split(' ')
p[0] = int(p[0])
p[1] = int(p[1])
if p[1] < min:
min = p[1]
sum += p[0]@min
print(sum)
|
sum += p[0]@min
| 15 |
operation
|
import sys
def readline():
return sys.stdin.readline()
t = int(readline())
sum = 0
min = 101
for x in range(1, t + 1):
p = readline().strip().split(' ')
p[0] = int(p[0])
p[1] = int(p[1])
if p[1] < min:
min = p[1]
sum += p[0] * min
print(sum)
|
import sys
def readline():
return sys.stdin.readline()
t = int(readline())
sum = 0
min = 101
for x in range(1, t + 1):
p = readline().strip().split(' ')
p[0] = int(p[0])
p[1] = int(p[1])
if p[1]>min:
min = p[1]
sum += p[0] * min
print(sum)
|
if p[1]>min:
| 12 |
decision
|
import sys
def readline():
return sys.stdin.readline()
t = int(readline())
sum = 0
min = 101
for x in range(1, t + 1):
p = readline().strip().split(' ')
p[0] = int(p[0])
p[1] = int(p[1])
if p[1] < min:
min = p[1]
sum += p[0] * min
print(sum)
|
import sys
def readline():
return sys.stdin.readline()
t = int(readline())
sum = 0
min = 101
for x in range(1, t + 1):
p = readline().strip().split(' ')
p[0] = int(p[0])
p[1] = int(p[1])
if p[1] < min:
min = p[1]
sum += p[0]&min
print(sum)
|
sum += p[0]&min
| 15 |
operation
|
n = int(input())
a = list(map(int,input().split()))
for i in range(len(a)):
a[i]-=1
count = [0]*(max(a)+1)
for i in a:
count[i]+=1
s = 0
while True:
count = list(map(lambda x: x%2, count))
s += count[0]
count[0] = 0
for i in range(len(count)):
if count[i]:
count[a[i]-1] += 1
count[i] = 0
if sum(count)==0:
break
print (s+1)
|
n = int(input())
a = list(map(int,input().split()))
for i in range(len(a)):
a[i]-=1
count = [0]*(max(a)+1)
for i in a:
count[i]+=1
s = 0
while True:
count = list(map(lambda x: x%2, count))
s += count[0]
count[0] = 0
for i in range(len(count)):
if count[i]:
count[a[i]-1] += 1
count[i] = 0
if sum(count)<0:
break
print (s+1)
|
if sum(count)<0:
| 20 |
decision
|
n = int(input())
a = list(map(int,input().split()))
for i in range(len(a)):
a[i]-=1
count = [0]*(max(a)+1)
for i in a:
count[i]+=1
s = 0
while True:
count = list(map(lambda x: x%2, count))
s += count[0]
count[0] = 0
for i in range(len(count)):
if count[i]:
count[a[i]-1] += 1
count[i] = 0
if sum(count)==0:
break
print (s+1)
|
n = int(input())
a = list(map(int,input().split()))
for i in range(len(a)):
a[i]-=1
count = [0]*(max(a)+1)
for i in a:
count[i]+=1
s = 0
while True:
count = list(map(lambda x: x%2, count))
s += count[0]
count[0] = 0
for i in range(len(count)):
if count[i]:
count[a[i]-117] += 1
count[i] = 0
if sum(count)==0:
break
print (s+1)
|
count[a[i]-117] += 1
| 18 |
value
|
n = int(input())
a = list(map(int,input().split()))
for i in range(len(a)):
a[i]-=1
count = [0]*(max(a)+1)
for i in a:
count[i]+=1
s = 0
while True:
count = list(map(lambda x: x%2, count))
s += count[0]
count[0] = 0
for i in range(len(count)):
if count[i]:
count[a[i]-1] += 1
count[i] = 0
if sum(count)==0:
break
print (s+1)
|
n = int(input())
a = list(map(int,input().split()))
for i in range(len(a)):
a[i]-=1
count = [0]*(max(a)+1)
for i in a:
count[i]+=1
s = 0
while True:
count = list(map(lambda x: x%2, count))
s += count[0]
count[0] = 0
for i in range(len(count)):
if count[i]:
count[a[i]-1] += 1
count[i] = 0
if sum(count)<0:
break
print (s+1)
|
if sum(count)<0:
| 20 |
decision
|
n = int(input())
a = list(map(int,input().split()))
for i in range(len(a)):
a[i]-=1
count = [0]*(max(a)+1)
for i in a:
count[i]+=1
s = 0
while True:
count = list(map(lambda x: x%2, count))
s += count[0]
count[0] = 0
for i in range(len(count)):
if count[i]:
count[a[i]-1] += 1
count[i] = 0
if sum(count)==0:
break
print (s+1)
|
n = int(input())
a = list(map(int,input().split()))
for i in range(len(a)):
a[i]-=1
count = [0]*(max(a)+1)
for i in a:
count[i]+=1
s = 0
while True:
count = list(map(lambda x: x%2, count))
s += count[0]
count[0] = 0
for i in range(len(count)):
if count[i]:
count[a[i]-1] += 1
count[i] = 0
if sum(count)==0:
break
print (s-1)
|
print (s-1)
| 22 |
operation
|
n = int(input())
a = list(map(int,input().split()))
for i in range(len(a)):
a[i]-=1
count = [0]*(max(a)+1)
for i in a:
count[i]+=1
s = 0
while True:
count = list(map(lambda x: x%2, count))
s += count[0]
count[0] = 0
for i in range(len(count)):
if count[i]:
count[a[i]-1] += 1
count[i] = 0
if sum(count)==0:
break
print (s+1)
|
n = int(input())
a = list(map(int,input().split()))
for i in range(len(a)):
a[i]-=1
count = [0]-(max(a)+1)
for i in a:
count[i]+=1
s = 0
while True:
count = list(map(lambda x: x%2, count))
s += count[0]
count[0] = 0
for i in range(len(count)):
if count[i]:
count[a[i]-1] += 1
count[i] = 0
if sum(count)==0:
break
print (s+1)
|
count = [0]-(max(a)+1)
| 6 |
operation
|
def su(x):
t=0
while x:
t=t+x%10
x=x//10
return t
n=int(input())
i=19
k=1
while k<n:
i+=9
if su(i)==10:
k+=1
print(i)
|
def su(x):
t=0
while x:
t=t+x%4
x=x//10
return t
n=int(input())
i=19
k=1
while k<n:
i+=9
if su(i)==10:
k+=1
print(i)
|
t=t+x%4
| 4 |
value
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.