problem_id
stringlengths 6
6
| buggy_code
stringlengths 8
526k
| fixed_code
stringlengths 12
526k
| labels
listlengths 0
15
โ | buggy_submission_id
int64 1
1.54M
| fixed_submission_id
int64 2
1.54M
| user_id
stringlengths 10
10
| language
stringclasses 8
values |
|---|---|---|---|---|---|---|---|
p02981
|
n, a, b = gets.split(' ').map(&:to_i)
if b < a*n then
print b
else
print
print a*n
end
|
n, a, b = gets.split(' ').map(&:to_i)
if b < a*n then
print b
else
print a*n
end
|
[
"io.output.change",
"call.remove"
] | 785,382
| 785,383
|
u197497255
|
ruby
|
p02981
|
a,b,c = gets.split("").map(&:to_i)
puts (a*b >= c ? c : a*b)
|
a,b,c = gets.split(" ").map(&:to_i)
puts (a*b >= c ? c : a*b)
|
[
"literal.string.change",
"assignment.value.change",
"call.arguments.change"
] | 785,388
| 785,389
|
u538351278
|
ruby
|
p02982
|
n, d = gets.chomp.split(" ").map(&:to_i)
x = []
n.times do
x << gets.chomp.split(" ").map(&:to_i)
end
ans = 0
n.times do |i|
(i+1).upto(d-1) do |j|
sum = 0
d.times do |k|
tmp = (x[i][k] - x[j][k]).abs
sum += tmp*tmp
end
flag = false
(sum+1).times do |k|
flag = true if k*k == sum
end
ans += 1 if flag
end
end
puts ans
|
n, d = gets.chomp.split(" ").map(&:to_i)
x = []
n.times do
x << gets.chomp.split(" ").map(&:to_i)
end
ans = 0
n.times do |i|
(i+1).upto(n-1) do |j|
sum = 0
d.times do |k|
tmp = (x[i][k] - x[j][k]).abs
sum += tmp*tmp
end
flag = false
(sum+1).times do |k|
flag = true if k*k == sum
end
ans += 1 if flag
end
end
puts ans
|
[
"identifier.change",
"call.arguments.change",
"expression.operation.binary.change"
] | 786,043
| 786,044
|
u466332671
|
ruby
|
p02982
|
N,D = gets.split.map(&:to_i)
X_arr = N.times.map{gets.split.map(&:to_i)}
p X_arr
ans = 0
X_arr.combination(2) do |x1, x2|
sum = 0
D.times do |i|
sum += (x1[i] - x2[i])**2
end
sq = Math.sqrt(sum)
ans += 1 if sq % 1 == 0
end
puts ans
|
N,D = gets.split.map(&:to_i)
X_arr = N.times.map{gets.split.map(&:to_i)}
ans = 0
X_arr.combination(2) do |x1, x2|
sum = 0
D.times do |i|
sum += (x1[i] - x2[i])**2
end
sq = Math.sqrt(sum)
ans += 1 if sq % 1 == 0
end
puts ans
|
[
"call.remove"
] | 786,443
| 786,444
|
u012110567
|
ruby
|
p02982
|
inp = gets.split.map!(&:to_i)
X = []
inp[0].times do |i|
X[i] = gets.split.map!(&:to_i)
end
#p X #for debug
#puts X[0][0] #for debug
count = 0
inp[0].times do |i|
(i+1).upto(inp[0]-1) do |j|
dist = 0
inp[1].times do |k|
d = (X[i][k] - X[j][k]).abs
dist += d**2 #ใใใ2็นใฎ่ท้ข
end
dist.times do |x|
if x**2 == dist
count += 1
break
end
end
end
end
puts count
|
inp = gets.split.map!(&:to_i)
X = []
inp[0].times do |i|
X[i] = gets.split.map!(&:to_i)
end
#p X #for debug
#puts X[0][0] #for debug
count = 0
inp[0].times do |i|
(i+1).upto(inp[0]-1) do |j|
dist = 0
inp[1].times do |k|
d = (X[i][k] - X[j][k]).abs
dist += d**2 #ใใใ2็นใฎ่ท้ข
end
(dist+1).times do |x|
if x**2 == dist
count += 1
break
end
end
end
end
puts count
|
[] | 786,570
| 786,571
|
u318009838
|
ruby
|
p02982
|
n, _ = gets.split.map(&:to_i)
xs = readlines.map { |l| l.split.map(&:to_i) }
count = 0
xs.each_with_index do |is, i|
((i + 1)..(n - 1)).each do |j|
js = xs[j]
r = 0
is.each_with_index do |v, idx|
r += (v.abs - js[idx].abs) ** 2
end
r = r ** (1 / 2.0)
count += 1 if r % 1 == 0
end
end
puts count
|
n, _ = gets.split.map(&:to_i)
xs = readlines.map { |l| l.split.map(&:to_i) }
count = 0
xs.each_with_index do |is, i|
((i + 1)..(n - 1)).each do |j|
js = xs[j]
r = 0
is.each_with_index do |v, idx|
r += (v - js[idx]).abs ** 2
end
r = r ** (1 / 2.0)
count += 1 if r % 1 == 0
end
end
puts count
|
[
"call.remove"
] | 786,841
| 786,842
|
u893351742
|
ruby
|
p02982
|
n, d = gets.split.map(&:to_i)
xs = readlines.map { |l| l.split.map(&:to_i) }
count = 0
xs.each_with_index do |is, i|
((i + 1)..(n - 1)).each do |j|
js = xs[j]
r = 0
is.each_with_index do |v, idx|
r += (v.abs - js[idx].abs) ** 2
end
r = r ** (1 / 2.0)
count += 1 if r % 1 == 0
end
end
puts count
|
n, _ = gets.split.map(&:to_i)
xs = readlines.map { |l| l.split.map(&:to_i) }
count = 0
xs.each_with_index do |is, i|
((i + 1)..(n - 1)).each do |j|
js = xs[j]
r = 0
is.each_with_index do |v, idx|
r += (v - js[idx]).abs ** 2
end
r = r ** (1 / 2.0)
count += 1 if r % 1 == 0
end
end
puts count
|
[
"assignment.variable.change",
"identifier.change",
"call.remove"
] | 786,843
| 786,842
|
u893351742
|
ruby
|
p02982
|
n,d = gets.split.map{ |x| x.to_i }
v = []
n.times{
v << gets.split.map{ |x| x.to_i }
}
result = 0
(0...v.size).each{ |i|
((i+1)...v.size).each{ |j|
sum = 0
(0...v[i].size).each{ |k|
sum += (v[i][k] - v[j][k]) ** 2
}
x = sum ** (1/2.0)
puts x
if x.ceil == x then
result+=1
end
}
}
puts result
|
n,d = gets.split.map{ |x| x.to_i }
v = []
n.times{
v << gets.split.map{ |x| x.to_i }
}
result = 0
(0...v.size).each{ |i|
((i+1)...v.size).each{ |j|
sum = 0
(0...v[i].size).each{ |k|
sum += (v[i][k] - v[j][k]) ** 2
}
x = sum ** (1/2.0)
if x.ceil == x then
result+=1
end
}
}
puts result
|
[
"call.remove"
] | 786,856
| 786,857
|
u874414087
|
ruby
|
p02983
|
l,r = gets.chomp.split.map(&:to_i)
ans = 10**18
if r - l > 2020
ans = 1
else
(l..r).each do |i|
(l..r).each do |j|
next if i == j
t = i*j % 2019
ans = t if ans > t
end
end
end
puts ans
|
l,r = gets.chomp.split.map(&:to_i)
ans = 10**18
if r - l > 2019
ans = 0
else
(l..r).each do |i|
(l..r).each do |j|
next if i == j
t = i*j % 2019
ans = t if ans > t
end
end
end
puts ans
|
[
"literal.number.integer.change",
"control_flow.branch.if.condition.change",
"assignment.value.change"
] | 788,104
| 788,105
|
u191196346
|
ruby
|
p02983
|
l,r = gets.chomp.split.map(&:to_i)
ans = 10**18
if r - l > 2019
ans = 1
else
(l..r).each do |i|
(l..r).each do |j|
next if i == j
t = i*j % 2019
ans = t if ans > t
end
end
end
puts ans
|
l,r = gets.chomp.split.map(&:to_i)
ans = 10**18
if r - l > 2019
ans = 0
else
(l..r).each do |i|
(l..r).each do |j|
next if i == j
t = i*j % 2019
ans = t if ans > t
end
end
end
puts ans
|
[
"literal.number.integer.change",
"assignment.value.change"
] | 788,106
| 788,105
|
u191196346
|
ruby
|
p02983
|
l, r = gets.split.map(&:to_i)
r = [r, l*2].min
ans = 2020
(l..r-1).each do |i|
(i+1..r).each do |j|
ans = [ans, (i*j) % 2019] .min
end
end
p ans
|
l, r = gets.split.map(&:to_i)
r = [r, l+2020].min
ans = 2020
(l..r-1).each do |i|
(i+1..r).each do |j|
ans = [ans, (i*j) % 2019] .min
end
end
p ans
|
[] | 788,187
| 788,188
|
u354261726
|
ruby
|
p02983
|
left, right = gets.chomp.split(" ").map(&:to_i)
mod = 2019
if right-left >= mod then
puts 0
else
ans = 1 << 40
left.upto(right-1) do |i|
left.upto(right-1) do |j|
next if i == j
tmp = i*j % mod
ans = ans > tmp ? tmp : ans
end
end
puts ans
end
|
left, right = gets.chomp.split(" ").map(&:to_i)
mod = 2019
if right-left >= mod then
puts 0
else
ans = 1 << 40
left.upto(right) do |i|
left.upto(right) do |j|
next if i == j
tmp = i*j % mod
ans = ans > tmp ? tmp : ans
end
end
puts ans
end
|
[
"expression.operation.binary.remove"
] | 788,508
| 788,509
|
u466332671
|
ruby
|
p02983
|
l, r = gets.split.map(&:to_i)
ans = 2018
divided_zero = false
l.upto(r - 1) do |i|
break if divided_zero == true
(i + 1).upto(r - 1) do |j|
p = i % 2019 * j % 2019
if p == 0
ans = 0
divided_zero = true
break
elsif p <= ans
ans = p
end
end
end
puts ans
|
l, r = gets.split.map(&:to_i)
ans = 2018
divided_zero = false
l.upto(r - 1) do |i|
break if divided_zero == true
(i + 1).upto(r) do |j|
p = i % 2019 * j % 2019
if p == 0
ans = 0
divided_zero = true
break
elsif p <= ans
ans = p
end
end
end
puts ans
|
[
"expression.operation.binary.remove"
] | 788,773
| 788,774
|
u889326464
|
ruby
|
p02983
|
L, R = gets.split.map(&:to_i)
min = 2020
L.upto(R) do |i|
(L + 1).upto(R) do |j|
mod = i * j % 2019
if mod == 0
puts 0
exit
end
min = mod < min ? mod : min
end
end
puts min
|
L, R = gets.split.map(&:to_i)
min = 2020
L.upto(R - 1) do |i|
(L + 1).upto(R) do |j|
mod = i * j % 2019
if mod == 0
puts 0
exit
end
min = mod < min ? mod : min
end
end
puts min
|
[
"expression.operation.binary.add"
] | 788,854
| 788,855
|
u039293076
|
ruby
|
p02983
|
l, r = gets.split.map(&:to_i)
if r - l >= 2019
puts 0
else
(l..r).each do |i|
(i + 1..r).each do |j|
array << i * j % 2019
end
end
end
puts array.min
|
l, r = gets.split.map(&:to_i)
array = []
if r - l >= 2019
puts 0
else
(l..r).each do |i|
(i + 1..r).each do |j|
array << i * j % 2019
end
end
end
puts array.min
|
[
"assignment.add"
] | 788,890
| 788,891
|
u866325115
|
ruby
|
p02983
|
INPUT = gets
tmp = INPUT.split(" ")
L = tmp[0].to_i
R = tmp[1].to_i
min = 2019
isBreak = false
for i in L..R-1
for j in i+1..R
result = (i*j).modulo(2019)
min = result if result < min
if min == 2
isBreak = true
break
end
end
break if isBreak
end
print min
|
INPUT = gets
tmp = INPUT.split(" ")
L = tmp[0].to_i
R = tmp[1].to_i
min = 2019
isBreak = false
for i in L..R-1
for j in i+1..R
result = (i*j).modulo(2019)
min = result if result < min
if min == 0
isBreak = true
break
end
end
break if isBreak
end
print min
|
[
"literal.number.integer.change",
"control_flow.branch.if.condition.change"
] | 789,418
| 789,419
|
u570252969
|
ruby
|
p02983
|
l, r = gets.split.map(&:to_i)
i_list = Array.new
z_list = Array.new
#print(i_list, "\n")
shokichi = 2019
for i in l..r-1
for j in l+1..r
z = (i*j)%2019
if z < shokichi
res = z
end
if z == 0
puts z
exit
end
end
end
p res
|
l, r = gets.split.map(&:to_i)
i_list = Array.new
z_list = Array.new
#print(i_list, "\n")
res = 2019
for i in l..r-1
for j in l+1..r
z = (i*j)%2019
if z < res
res = z
end
if res == 0
puts z
exit
end
end
end
p res
|
[
"assignment.variable.change",
"identifier.change",
"control_flow.branch.if.condition.change"
] | 789,598
| 789,599
|
u911815052
|
ruby
|
p02983
|
l,r=gets.split.map(&:to_i)
m=2019
l.upto(r-1){|i|i.upto(r){|j|k=i*j%2019;(m>k)?m=k:0;(puts m;exit)if m==0}}
puts m
|
l,r=gets.split.map(&:to_i)
m=2019
l.upto(r-1){|i|(i+1).upto(r){|j|k=(i*j)%2019;(m>k)?m=k:0;(puts m;exit)if m==0}}
puts m
|
[] | 789,610
| 789,611
|
u883824971
|
ruby
|
p02983
|
l,r=gets.split.map(&:to_i)
m=0
l.upto(r-1){|i|(i+1).upto(r){|j|k=i*j%2019;(m>k)?m=k:0;(puts m;exit)if m==0}}
puts m
|
l,r=gets.split.map(&:to_i)
m=2019
l.upto(r-1){|i|(i+1).upto(r){|j|k=(i*j)%2019;(m>k)?m=k:0;(puts m;exit)if m==0}}
puts m
|
[
"literal.number.integer.change",
"assignment.value.change"
] | 789,612
| 789,611
|
u883824971
|
ruby
|
p02983
|
l,r=gets.split.map(&:to_i)
m=0
l.upto(r){|i|(i+1).upto(r){|j|k=i*j%2019;(m>k)?m=k:0;(puts m;exit)if m==0}}
puts m
|
l,r=gets.split.map(&:to_i)
m=2019
l.upto(r-1){|i|(i+1).upto(r){|j|k=(i*j)%2019;(m>k)?m=k:0;(puts m;exit)if m==0}}
puts m
|
[
"literal.number.integer.change",
"assignment.value.change"
] | 789,613
| 789,611
|
u883824971
|
ruby
|
p02983
|
l, r = gets.split.map &:to_i
p 0 if r-l>=673
ans = Float::INFINITY
(l...r).each do |_i|
i = _i%2019
(_i+1..r).each do |j|
m = i*j%2019
ans = m if m < ans
if ans==0
p 0
exit
end
end
end
p ans
|
l, r = gets.split.map &:to_i
if r-l>=673
p 0
exit
end
ans = Float::INFINITY
(l...r).each do |_i|
i = _i%2019
(_i+1..r).each do |j|
m = i*j%2019
ans = m if m < ans
if ans==0
p 0
exit
end
end
end
p ans
|
[
"call.remove",
"call.add",
"control_flow.exit.add"
] | 789,771
| 789,772
|
u976045235
|
ruby
|
p02983
|
L, R = gets.split.map(&:to_i)
ans = 2019
L.upto(R-1) do |i|
(i+1).upto(R) do |j|
mod = (i * j) % 2019
if mod == 0
puts 0
exit
end
ans = mod if mod < ans
end
end
|
L, R = gets.split.map(&:to_i)
ans = 2019
L.upto(R-1) do |i|
(i+1).upto(R) do |j|
mod = (i * j) % 2019
if mod == 0
puts 0
exit
end
ans = mod if mod < ans
end
end
puts ans
|
[
"call.add"
] | 789,927
| 789,928
|
u516361212
|
ruby
|
p02983
|
L,R=gets.chomp.split(" ").map(&:to_i);
qL=L/2019
qR=R/2019
if(qL<qR)
print(0)
else
modL=L.modulo(2019)
modR=R.modulo(2019)
min=2019*2019
for j in modL+1..modR
for i in modL..j-1
x=[(i*j).modulo(2019)].min
end
end
print(x)
end
|
L,R=gets.chomp.split(" ").map(&:to_i);
qL=L/2019
qR=R/2019
if(qL<qR)
print(0)
else
modL=L.modulo(2019)
modR=R.modulo(2019)
x=2019*2019
for j in modL+1..modR
for i in modL..j-1
x=[(i*j).modulo(2019),x].min
end
end
print(x)
end
|
[
"assignment.variable.change",
"identifier.change",
"literal.array.change"
] | 790,285
| 790,286
|
u918601425
|
ruby
|
p02983
|
def main(l,r)
min = 2020
(l..r-1).each do |i|
(i+1..r).each do |j|
mod = (i*j)%2019
min = mod if min > mod
break if min == 0
end
break if min == 0
end
end
L, R = gets.chomp.split.map(&:to_i)
p main(L, R)
|
def main(l,r)
min = 2020
(l..r-1).each do |i|
((i+1)..r).each do |j|
mod = (i*j)%2019
min = mod if min >= mod
break if min == 0
end
break if min == 0
end
return min
end
L, R = gets.chomp.split.map(&:to_i)
p main(L, R)
|
[
"expression.operator.compare.change",
"control_flow.branch.if.condition.change",
"control_flow.return.add"
] | 790,656
| 790,655
|
u521197112
|
ruby
|
p02983
|
def main(l,r)
min = 2020
l.upto(r-1) do |i|
(i+1).upto(r).each do |j|
mod = (i*j)%2019
min = mod if min >= mod
break if min == 0
end
break if min == 0
end
return min
end
L, R = gets.chomp.split.map(&:to_i)
p L, R
p main(L, R)
|
def main(l,r)
min = 2020
l.upto(r-1) do |i|
(i+1).upto(r).each do |j|
mod = (i*j)%2019
min = mod if min >= mod
break if min == 0
end
break if min == 0
end
return min
end
L, R = gets.chomp.split.map(&:to_i)
p main(L, R)
|
[
"call.remove"
] | 790,657
| 790,658
|
u521197112
|
ruby
|
p02983
|
l, r = gets.chomp.split.map(&:to_i)
ans = 2019
l.upto((r-1 <= l + 2018) ? (r - 1) : (l + 2018)) do |i|
(i+1).upto((r <= i + 2019) ? r : (i + 2019)) do |j|
r = (i * j) % 2019
ans = r if r < ans
end
end
puts ans
|
l, r = gets.chomp.split.map(&:to_i)
ans = 2019
l.upto((r - 1 <= l + 2018) ? (r - 1) : (l + 2018)) do |i|
(i+1).upto((r <= i + 2019) ? r : (i + 2019)) do |j|
re = (i * j) % 2019
ans = re if re < ans
end
end
puts ans
|
[
"assignment.variable.change",
"identifier.change",
"assignment.value.change",
"control_flow.branch.if.condition.change"
] | 791,183
| 791,184
|
u938270657
|
ruby
|
p02983
|
l, r = gets.chomp.split.map(&:to_i)
ans = 2019
l.upto((r <= l + 2018) ? (r - 1) : (l + 2018)) do |i|
(i+1).upto((r <= i + 2019) ? r : (i + 2019)) do |j|
r = (i * j) % 2019
ans = r if r < ans
end
end
puts ans
|
l, r = gets.chomp.split.map(&:to_i)
ans = 2019
l.upto((r - 1 <= l + 2018) ? (r - 1) : (l + 2018)) do |i|
(i+1).upto((r <= i + 2019) ? r : (i + 2019)) do |j|
re = (i * j) % 2019
ans = re if re < ans
end
end
puts ans
|
[
"control_flow.branch.if.condition.change",
"assignment.variable.change",
"identifier.change",
"assignment.value.change"
] | 791,185
| 791,184
|
u938270657
|
ruby
|
p02983
|
L,R=gets.chomp.split.map(&:to_i)
ans=2020
if R-L>=2019
puts 0
else
L.upto(R) do |i|
(i+1).upto(R) do |j|
ans = (i*j)%2019 if ans > (i*j)%2019
end
end
end
puts ans
|
L,R=gets.chomp.split.map(&:to_i)
ans=2020
if R-L>=2019
puts 0
exit
else
L.upto(R) do |i|
(i+1).upto(R) do |j|
ans = (i*j)%2019 if ans > (i*j)%2019
end
end
end
puts ans
|
[
"control_flow.exit.add"
] | 791,689
| 791,690
|
u868089307
|
ruby
|
p02984
|
N=gets.to_i
as=gets.split.map(&:to_i)
dam=Array.new(N+1)
fall=Array.new(N+1)
for i in 1..N
dam[i]=as.shift
end
fall[1]=(1..N).to_a.map{|x|dam[x]*(x.odd? ? 1 : -1)}.inject(:+)
puts fall[1]
for i in 2..N
fall[i]=2*dam[i-1]-fall[i-1]
end
puts fall[1..-1].join(" ")
|
N=gets.to_i
as=gets.split.map(&:to_i)
dam=Array.new(N+1)
fall=Array.new(N+1)
for i in 1..N
dam[i]=as.shift
end
fall[1]=(1..N).to_a.map{|x|dam[x]*(x.odd? ? 1 : -1)}.inject(:+)
for i in 2..N
fall[i]=2*dam[i-1]-fall[i-1]
end
puts fall[1..-1].join(" ")
|
[
"call.remove"
] | 792,212
| 792,213
|
u926099741
|
ruby
|
p02984
|
n = gets.to_i
rains = gets.split.map(&:to_i) #ๆบใพใฃใ้จใฎ้
# nใๅฅๆฐใงใใใจใใx = A5 - A4 + A3 - A2 + A1 - xใๆใ็ซใคใ
# ็งป้
ใใใจ 2x = A5 - A4 + A3 - A2 + A1
# xใๆฑใใใใใใใจใฏๆฐ็ ใคใชใใซๅ็นใฎ้ๆฐด้ใๆฑใใใใใ
x2 = 0
(0 .. n - 1).each { |i| i.even? ? x2 += rains[i] : x2 -= rains[i] }
ans = Array.new(n)
ans[0] = x2 / 2
p ans[0]
(0...n-1).each { |i| ans[i+1] = rains[i] - ans[i] }
ans.map! { |i| i *= 2}
puts ans.join(' ')
|
n = gets.to_i # ๅฑฑใฎๆฐ๏ผๅฅๆฐ)
rains = gets.split.map(&:to_i) # ๆบใพใฃใ้จใฎ้
# nใๅฅๆฐใงใใใจใใx = A5 - A4 + A3 - A2 + A1 - xใๆใ็ซใคใ
# ็งป้
ใใใจ 2x = A5 - A4 + A3 - A2 + A1
# ๅถๆฐใฎใจใใซ่ถณใใฆใๅฅๆฐใฎใจใใซๅผใใ
# xใๆฑใใใใใใใจใฏๆฐ็ ใคใชใใซๅ็นใฎ้ๆฐด้ใๆฑใใใใใ
x2 = 0
(0 .. n - 1).each { |i| i.even? ? x2 += rains[i] : x2 -= rains[i] }
ans = Array.new(n)
ans[0] = x2 / 2
(0...n-1).each { |i| ans[i+1] = rains[i] - ans[i] }
ans.map! { |i| i *= 2}
puts ans.join(' ')
|
[
"call.remove"
] | 792,319
| 792,320
|
u306465660
|
ruby
|
p02984
|
n = gets.to_i
rains = gets.split.map(&:to_i) #ๆบใพใฃใ้จใฎ้
# nใๅฅๆฐใงใใใจใใx = A5 - A4 + A3 - A2 + A1 - xใๆใ็ซใคใ
# ็งป้
ใใใจ 2x = A5 - A4 + A3 - A2 + A1
# xใๆฑใใใใใใใจใฏๆฐ็ ใคใชใใซๅ็นใฎ้ๆฐด้ใๆฑใใใใใ
x2 = 0
(0 .. n - 1).each { |i| i.even? ? x2 += rains[i] : x2 -= rains[i] }
ans = Array.new(n)
ans[0] = x2 / 2
p ans[0]
(0...n-1).each { |i| ans[i+1] = rains[i] - ans[i] }
ans.map! { |i| i *= 2}
puts ans.join(' ')
|
n = gets.to_i # ๅฑฑใฎๆฐ๏ผๅฅๆฐ)
rains = gets.split.map(&:to_i) # ๆบใพใฃใ้จใฎ้
# nใๅฅๆฐใงใใใจใใx = A5 - A4 + A3 - A2 + A1 - xใๆใ็ซใคใ
# ็งป้
ใใใจ 2x = A5 - A4 + A3 - A2 + A1
# xใๆฑใใใใใใใจใฏๆฐ็ ใคใชใใซๅ็นใฎ้ๆฐด้ใๆฑใใใใใ
x2 = 0
(0 .. n - 1).each { |i| i.even? ? x2 += rains[i] : x2 -= rains[i] }
ans = Array.new(n)
ans[0] = x2 / 2
(0...n-1).each { |i| ans[i+1] = rains[i] - ans[i] }
ans.map! { |i| i *= 2}
puts ans.join(' ')
|
[
"call.remove"
] | 792,319
| 792,321
|
u306465660
|
ruby
|
p02984
|
n = gets.to_i
rains = gets.split.map(&:to_i) #ๆบใพใฃใ้จใฎ้
# nใๅฅๆฐใงใใใจใใx = A5 - A4 + A3 - A2 + A1 - xใๆใ็ซใคใ
# ็งป้
ใใใจ 2x = A5 - A4 + A3 - A2 + A1
# xใๆฑใใใใใใใจใฏๆฐ็ ใคใชใใซๅ็นใฎ้ๆฐด้ใๆฑใใใใใ
x2 = 0
(0 .. n - 1).each { |i| i.even? ? x2 += rains[i] : x2 -= rains[i] }
ans = Array.new(n)
ans[0] = x2 / 2
p ans[0]
(0...n-1).each { |i| ans[i+1] = rains[i] - ans[i] }
ans.map! { |i| i *= 2}
puts ans.join(' ')
|
n = gets.to_i
rains = gets.split.map(&:to_i)
# nใๅฅๆฐใงใใใจใใx = A5 - A4 + A3 - A2 + A1 - xใๆใ็ซใคใ
# ็งป้
ใใใจ 2x = A5 - A4 + A3 - A2 + A1
# xใๆฑใใใใใใใจใฏๆฐ็ ใคใชใใซๅ็นใฎ้ๆฐด้ใๆฑใใใใใ
x2 = 0
(0 .. n - 1).each { |i| i.even? ? x2 += rains[i] : x2 -= rains[i] }
ans = Array.new(n)
ans[0] = x2 / 2
(0...n-1).each { |i| ans[i+1] = rains[i] - ans[i] }
ans.map! { |i| i *= 2}
puts ans.join(' ')
|
[
"call.remove"
] | 792,319
| 792,322
|
u306465660
|
ruby
|
p02984
|
N = gets.to_i
A = gets.split(' ').map(&:to_i)
allrain = A.inject(:+)
x = Array.new
otherrain = 0
(N/2).times do |ji|
otherrain += A[(1+i*2)%N]*2
end
x[0] = allrain - otherrain
(1..N-1).each do |i|
x[i] = 2*A[i] - x[i-1]
end
N.times do |i|
print x[i].to_s + " "
end
|
N = gets.to_i
A = gets.split(' ').map(&:to_i)
allrain = A.inject(:+)
x = Array.new
otherrain = 0
(N/2).times do |i|
otherrain += A[(1+i*2)%N]*2
end
x[0] = allrain - otherrain
(1..N-1).each do |i|
x[i] = 2*A[i-1] - x[i-1]
end
N.times do |i|
print x[i].to_s + " "
end
|
[
"identifier.change"
] | 792,418
| 792,419
|
u548834738
|
ruby
|
p02984
|
n=gets.chomp.to_i
l=gets.chomp.split(" ").map{|s| s.to_i}
m=[]
m[1]=0
for i in 0..n-1
m[1]+=l[i] if i%2==0
m[1]-=l[i] if i%2==1
end
m[1]=m[1]/2
i=n-1
m[n]=l[n-1]-m[1]
while i!=1
m[i]=l[i-1]-m[i+1]
i-=1
end
for i in 1..n
print "#{m[i]*2} "
end
printf "\b"
|
n=gets.chomp.to_i
l=gets.chomp.split(" ").map{|s| s.to_i}
m=[]
m[1]=0
for i in 0..n-1
m[1]+=l[i] if i%2==0
m[1]-=l[i] if i%2==1
end
m[1]=m[1]/2
i=n-1
m[n]=l[n-1]-m[1]
while i!=1
m[i]=l[i-1]-m[i+1]
i-=1
end
for i in 1..n
print "#{m[i]*2} "
end
|
[
"call.remove"
] | 792,498
| 792,499
|
u087165202
|
ruby
|
p02987
|
s = gets
u = s.chars.uniq
if u.size != 2
puts :No
else
puts (s.count(u[0]) == 2 && s.count(u[1]) == 2) ? :Yes: :No
end
|
s = gets.chomp
u = s.chars.uniq
if u.size != 2
puts :No
else
puts (s.count(u[0]) == 2 && s.count(u[1]) == 2) ? :Yes: :No
end
|
[
"call.add"
] | 793,566
| 793,567
|
u489339677
|
ruby
|
p02987
|
S = gets.chomp
if S.uniq.size == 2 && S.count(S[1]) == 2
puts "Yes"
exit
end
puts "No"
|
S = gets.chomp
if S.chars.uniq.size == 2 && S.count(S[1]) == 2
puts "Yes"
exit
end
puts "No"
|
[
"control_flow.branch.if.condition.change",
"call.add"
] | 793,693
| 793,694
|
u846185950
|
ruby
|
p02987
|
s=gets.chomp.sort
puts s[0] == s[1] && s[2] == s[3] && s[0] != s[3] ? "Yes" : "No"
|
s=gets.chomp.chars.sort
puts s[0]==s[1] && s[2]==s[3] && s[1]!=s[2] ? "Yes" : "No"
|
[
"call.add",
"literal.number.integer.change",
"variable_access.subscript.index.change",
"control_flow.branch.if.condition.change"
] | 793,752
| 793,753
|
u056944756
|
ruby
|
p02987
|
s=gets.split("").sort;puts (s[1]==s[0]&&s[2]==s[3]&&s[0]!=s[2])?"Yes":"No"
|
s=gets.chomp.split("").sort;puts (s[1]==s[0]&&s[2]==s[3]&&s[0]!=s[2])?"Yes":"No"
|
[
"call.add"
] | 793,800
| 793,801
|
u803684095
|
ruby
|
p02987
|
a = gets.chomp
p a.each_char.map{|s|a.count(s)==2}.count(true)==4 ? 'Yes' : 'No'
|
a = gets.chomp
puts a.each_char.map{|s|a.count(s)==2}.count(true)==4 ? 'Yes' : 'No'
|
[
"call.function.change",
"io.output.change"
] | 793,842
| 793,843
|
u600153083
|
ruby
|
p02987
|
a = gets.chomp
p a.each_char.map{|s|a.count(s)==2}.count(true)==4 ? 'YES' : 'NO'
|
a = gets.chomp
puts a.each_char.map{|s|a.count(s)==2}.count(true)==4 ? 'Yes' : 'No'
|
[
"call.function.change",
"io.output.change",
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 793,844
| 793,843
|
u600153083
|
ruby
|
p02987
|
p gets.chomp.each_char.map{|s|a.count(s)==2}.count(true)==4 ? 'YES' : 'NO'
|
a = gets.chomp
puts a.each_char.map{|s|a.count(s)==2}.count(true)==4 ? 'Yes' : 'No'
|
[
"assignment.variable.change",
"call.add",
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 793,845
| 793,843
|
u600153083
|
ruby
|
p02987
|
# s = gets.chomp.split.map(&:to_i)
# s = readline.chomp.split
s = readline.chomp.split.sort
# ASSA ใซใใ
if s[0] == s[1] && s[1] != s[2] && s[2] == s[3]
puts "Yes"
else
puts "No"
end
|
s = readline.chomp.split("").sort
# ASSA ใซใใ
if s[0] == s[1] && s[1] != s[2] && s[2] == s[3]
puts "Yes"
else
puts "No"
end
|
[
"call.arguments.add"
] | 793,927
| 793,928
|
u552761221
|
ruby
|
p02987
|
# s = gets.chomp.split.map(&:to_i)
# s = readline.chomp.split
s = readlin.chomp.split.sort
# ASSA ใซใใ
if s[0] == s[1] && s[1] != s[2] && s[2] == s[3]
puts "Yes"
else
puts "No"
end
|
s = readline.chomp.split("").sort
# ASSA ใซใใ
if s[0] == s[1] && s[1] != s[2] && s[2] == s[3]
puts "Yes"
else
puts "No"
end
|
[
"assignment.value.change",
"identifier.change",
"call.arguments.add"
] | 793,929
| 793,928
|
u552761221
|
ruby
|
p02987
|
p gets.chomp.chars.group_by {|r| r}.map {|k, v| v.size}.all? {|r| r==2} ? "Yes" : "No"
|
puts gets.chomp.chars.group_by {|r| r}.map {|k, v| v.size}.all? {|r| r==2} ? "Yes" : "No"
|
[
"call.function.change",
"io.output.change"
] | 793,991
| 793,992
|
u370564845
|
ruby
|
p02987
|
s = gets.split("")
if s.uniq.length == 2 then
print("Yes")
else
print("No")
end
|
s = gets.split("")
if s.uniq.length == 3 then
print("Yes")
else
print("No")
end
|
[
"literal.number.integer.change",
"control_flow.branch.if.condition.change"
] | 794,042
| 794,043
|
u291303244
|
ruby
|
p02987
|
str = $stdin.gets.chomp
ans = "No"
if str[0] == str[1] and str[2] == str[3] and str[0] != str[2]
ans = "Yes"
elsif str[0] == str[2] and str[1] == atr[3] and str[0] != str[1]
ans = "Yes"
elsif str[0] == str[3] and str[1] == str[2] and str[0] != str[1]
ans = "Yes"
end
puts ans
|
str = $stdin.gets.chomp
ans = "No"
if str[0] == str[1] and str[2] == str[3] and str[0] != str[2]
ans = "Yes"
elsif str[0] == str[2] and str[1] == str[3] and str[0] != str[1]
ans = "Yes"
elsif str[0] == str[3] and str[1] == str[2] and str[0] != str[1]
ans = "Yes"
end
puts ans
|
[
"identifier.change",
"control_flow.branch.if.condition.change"
] | 794,062
| 794,063
|
u294388467
|
ruby
|
p02987
|
str = $stdin.gets.chomp
ans = "No"
if str[0] == str[1] and str[2] == str[3] and str[0] != str[2]
ans = "Yes"
elsif str[0] == str[2] and str[1] == atr[3] and str[0] != atr[1]
ans = "Yes"
elsif str[0] == str[3] and str[1] == str[2] and str[0] != str[1]
ans = "Yes"
end
puts ans
|
str = $stdin.gets.chomp
ans = "No"
if str[0] == str[1] and str[2] == str[3] and str[0] != str[2]
ans = "Yes"
elsif str[0] == str[2] and str[1] == str[3] and str[0] != str[1]
ans = "Yes"
elsif str[0] == str[3] and str[1] == str[2] and str[0] != str[1]
ans = "Yes"
end
puts ans
|
[
"identifier.change",
"control_flow.branch.if.condition.change"
] | 794,064
| 794,063
|
u294388467
|
ruby
|
p02987
|
s = gets
result = s.chop.split('').uniq
p result.size == 2 ? 'Yes' : 'No'
|
s = gets
result = s.chop.split('').uniq
puts result.size == 2 ? 'Yes' : 'No'
|
[
"call.function.change",
"io.output.change"
] | 794,097
| 794,098
|
u649468708
|
ruby
|
p02987
|
s = gets
result = s.split('').uniq
p result.size == 2 ? 'Yes' : 'No'
|
s = gets
result = s.chop.split('').uniq
puts result.size == 2 ? 'Yes' : 'No'
|
[
"call.add",
"call.function.change",
"io.output.change"
] | 794,100
| 794,098
|
u649468708
|
ruby
|
p02987
|
S = gets.to_s.chomp!
arr = S.split('')
uniq_arr = arr.uniq
first = uniq_arr[0]
second = uniq_arr[1]
if uniq_arr.size == 2 && arr.count(first) == 2 && arr.count(second) == 2
p 'Yes'
else
p 'No'
end
|
S = gets.to_s.chomp!
arr = S.split('')
uniq_arr = arr.uniq
first = uniq_arr[0]
second = uniq_arr[1]
if uniq_arr.size == 2 && arr.count(first) == 2 && arr.count(second) == 2
puts 'Yes'
else
puts 'No'
end
|
[
"call.function.change",
"io.output.change"
] | 794,101
| 794,102
|
u289815651
|
ruby
|
p02987
|
a = gets.chomp
if a[0] == a[1] && a[2] == a[3] && a[1] != a[2]
puts "Yes"
elsif a[0] == a[2] && a[1] == a[3] && a[0] != a[1]
puts "Yes"
elsif a[0] == a[3] && a[1] == a[2] && a[0] != a[1]
puts "Yes"
else
puts "NO"
end
|
a = gets.chomp
if a[0] == a[1] && a[2] == a[3] && a[1] != a[2]
puts "Yes"
elsif a[0] == a[2] && a[1] == a[3] && a[0] != a[1]
puts "Yes"
elsif a[0] == a[3] && a[1] == a[2] && a[0] != a[1]
puts "Yes"
else
puts "No"
end
|
[
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 794,178
| 794,179
|
u521114363
|
ruby
|
p02987
|
s = gets.chomp.split('')
if s.uniq.length == 1
puts("No")
else
a = s.slice!(0)
if s.include?(a)
s.slice!(s.index(a))
p(s)
if s.uniq.length == 1
puts("Yes")
else
puts("No")
end
else
puts("No")
end
end
|
s = gets.chomp.split('')
if s.uniq.length == 1
puts("No")
else
a = s.slice!(0)
if s.include?(a)
s.slice!(s.index(a))
if s.uniq.length == 1
puts("Yes")
else
puts("No")
end
else
puts("No")
end
end
|
[
"call.remove"
] | 794,212
| 794,213
|
u429775245
|
ruby
|
p02987
|
s = gets.chomp.split("")
cs = Hash.new(0)
cnt = 0
flag = 1
s.each do |c|
cs[c] += 1
end
cs.each do |k,v|
if v != 2
flag = 0
break
end
cnt += 1
end
if cnt == 2 && flag == 1
puts Yes
else
puts No
end
|
s = gets.chomp.split("")
cs = Hash.new(0)
cnt = 0
flag = 1
s.each do |c|
cs[c] += 1
end
cs.each do |k,v|
if v != 2
flag = 0
break
end
cnt += 1
end
if cnt == 2 && flag == 1
puts "Yes"
else
puts "No"
end
|
[
"call.arguments.change"
] | 794,309
| 794,310
|
u326891688
|
ruby
|
p02987
|
ary = gets.chomp.chars.map(&:to_s).sort!
t = nil
hash = {}
ary.each do |v|
if hash[v]
hash[v] += 1
else
hash[v] = 1
end
end
hash.each do |v, k|
if v != 2
t = "No"
break
end
t = "Yes"
end
puts t
|
ary = gets.chomp.chars.map(&:to_s).sort!
t = nil
hash = {}
ary.each do |v|
if hash[v]
hash[v] += 1
else
hash[v] = 1
end
end
hash.each do |k, v|
if v != 2
t = "No"
break
end
t = "Yes"
end
puts t
|
[] | 794,367
| 794,368
|
u126541218
|
ruby
|
p02987
|
ary = gets.chomp.chars.map(&:to_s).sort!
t = nil
hash = {}
ary.each do |v|
if hash[v]
hash[v] += 1
else
hash[v] = 1
end
end
hash.each do |v, k|
if v != 2
t = "No"
break
end
t = "Yes"
end
p t
|
ary = gets.chomp.chars.map(&:to_s).sort!
t = nil
hash = {}
ary.each do |v|
if hash[v]
hash[v] += 1
else
hash[v] = 1
end
end
hash.each do |k, v|
if v != 2
t = "No"
break
end
t = "Yes"
end
puts t
|
[
"call.function.change",
"io.output.change"
] | 794,369
| 794,368
|
u126541218
|
ruby
|
p02987
|
s = gets.chomp.split.map(&:to_s)
puts s.uniq.size == 2 ? "Yes" : "No"
|
s = gets.chomp.split("").map(&:to_s)
puts s.uniq.size == 2 ? "Yes" : "No"
|
[
"call.arguments.add"
] | 794,405
| 794,406
|
u303448696
|
ruby
|
p02987
|
s = gets.chomp.split(" ").map(&:to_s)
puts s.uniq.size == 2 ? 'Yes' : 'No'
|
s = gets.chomp.split("").map(&:to_s)
puts s.uniq.size == 2 ? "Yes" : "No"
|
[
"literal.string.change",
"assignment.value.change",
"call.arguments.change"
] | 794,407
| 794,406
|
u303448696
|
ruby
|
p02987
|
n = gets.strip.split("")
if n.uniq.size == 2
puts 'Yes'
else
p 'No'
end
|
n = gets.strip.split("")
if n.uniq.size == 2
puts 'Yes'
else
puts 'No'
end
|
[
"call.function.change",
"io.output.change"
] | 794,435
| 794,436
|
u167516416
|
ruby
|
p02987
|
n = gets.strip.split("")
if n.uniq.size == 2
p 'Yes'
else
p 'No'
end
|
n = gets.strip.split("")
if n.uniq.size == 2
puts 'Yes'
else
puts 'No'
end
|
[
"call.function.change",
"io.output.change"
] | 794,437
| 794,436
|
u167516416
|
ruby
|
p02987
|
a = gets.to_i
count = 0
('A'..'Z').each do |n|
count += 1 if a.count(n) == 2
end
if count == 2
puts 'Yes'
else
puts 'NO'
end
|
a = gets
count = 0
('A'..'Z').each do |n|
count += 1 if a.count(n) == 2
end
if count == 2
puts 'Yes'
else
puts 'No'
end
|
[
"call.remove",
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 794,620
| 794,621
|
u396511998
|
ruby
|
p02987
|
a = 'FREE'
count = 0
('A'..'Z').each do |n|
count += 1 if a.count(n) == 2
end
if count == 2
puts 'Yes'
else
puts 'NO'
end
|
a = gets
count = 0
('A'..'Z').each do |n|
count += 1 if a.count(n) == 2
end
if count == 2
puts 'Yes'
else
puts 'No'
end
|
[
"assignment.value.change",
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 794,622
| 794,621
|
u396511998
|
ruby
|
p02987
|
a = gets.to_i
count = nil
('A'..'Z').each do |n|
count += 1 if a.count(n) == 2
end
if count == 2
puts 'Yes'
else
puts 'NO'
end
|
a = gets
count = 0
('A'..'Z').each do |n|
count += 1 if a.count(n) == 2
end
if count == 2
puts 'Yes'
else
puts 'No'
end
|
[
"call.remove",
"assignment.value.change",
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 794,623
| 794,621
|
u396511998
|
ruby
|
p02987
|
str_list = gets.chomp.chars.sort
puts ((str_list.uniq == 2) && (str_list[0] == str_list[1]) && (str_list[2] == str_list[3])) ? "Yes" : "No"
|
str_list = gets.chomp.chars.sort
puts ((str_list.uniq.size == 2) && (str_list[0] == str_list[1]) && (str_list[2] == str_list[3])) ? "Yes" : "No"
|
[
"control_flow.branch.if.condition.change",
"call.add"
] | 794,709
| 794,710
|
u283202192
|
ruby
|
p02987
|
s = gets.chomp
if s[0] == s[1] && s[1] != s[2] && s[2] == s[3]
print "yes\n"
elsif s[0] == s[2] && s[2] != s[1] && s[1] == s[3]
print "yes\n"
elsif s[0] == s[3] && s[3] != s[1] && s[1] == s[2]
print "yes\n"
else
print "no\n"
end
|
s = gets.chomp
if s[0] == s[1] && s[1] != s[2] && s[2] == s[3]
print "Yes\n"
elsif s[0] == s[2] && s[2] != s[1] && s[1] == s[3]
print "Yes\n"
elsif s[0] == s[3] && s[3] != s[1] && s[1] == s[2]
print "Yes\n"
else
print "No\n"
end
|
[
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 794,768
| 794,769
|
u800017962
|
ruby
|
p02987
|
puts gets.chomp.split(//).uniq!.size == 2 ? "Yes" : "No"
|
puts gets.chomp.split(//).uniq.size == 2 ? "Yes" : "No"
|
[
"identifier.change",
"control_flow.branch.if.condition.change"
] | 794,865
| 794,866
|
u306465660
|
ruby
|
p02987
|
puts gets.split(//).uniq.size == 2 ? "Yes" : "No"
|
puts gets.chomp.split(//).uniq.size == 2 ? "Yes" : "No"
|
[
"control_flow.branch.if.condition.change",
"call.add"
] | 794,867
| 794,866
|
u306465660
|
ruby
|
p02987
|
puts gets.split.uniq.size == 2 ? "Yes" : "No"
|
puts gets.chomp.split(//).uniq.size == 2 ? "Yes" : "No"
|
[
"control_flow.branch.if.condition.change",
"call.add",
"call.arguments.add"
] | 794,868
| 794,866
|
u306465660
|
ruby
|
p02987
|
s = gets.split("")
s.sort!
if ((s[0]==s[1]) && (s[2]==s[3]) && (s[0] != s[2]))
puts 'Yes'
else
puts 'No'
end
|
s = gets.chomp.split("")
s.sort!
#p s
if ((s[0]==s[1]) && (s[2]==s[3]) && (s[0] != s[2]))
puts "Yes"
else
puts "No"
end
|
[
"call.add",
"literal.string.change",
"call.arguments.change"
] | 794,889
| 794,888
|
u164522933
|
ruby
|
p02987
|
s = gets.split("")
s.sort!
#p s
if ((s[0]==s[1]) && (s[2]==s[3]) && (s[0] != s[2]))
puts "Yes"
else
puts "No"
end
|
s = gets.chomp.split("")
s.sort!
#p s
if ((s[0]==s[1]) && (s[2]==s[3]) && (s[0] != s[2]))
puts "Yes"
else
puts "No"
end
|
[
"call.add"
] | 794,890
| 794,888
|
u164522933
|
ruby
|
p02987
|
s = gets.split("")
s.sort!
#p s
if ((s[0]==s[1]) and (s[2]==s[3]) and (s[0] != s[2]))
puts "Yes"
else
puts "No"
end
|
s = gets.chomp.split("")
s.sort!
#p s
if ((s[0]==s[1]) && (s[2]==s[3]) && (s[0] != s[2]))
puts "Yes"
else
puts "No"
end
|
[
"call.add",
"control_flow.branch.if.condition.change"
] | 794,891
| 794,888
|
u164522933
|
ruby
|
p02987
|
s = gets.split("")
s.sort!
#p s
if ((s[0]==s[1]) and (s[2]==s[3]) and (s[0]!=s[2]))
puts "Yes"
else
puts "No"
end
|
s = gets.chomp.split("")
s.sort!
#p s
if ((s[0]==s[1]) && (s[2]==s[3]) && (s[0] != s[2]))
puts "Yes"
else
puts "No"
end
|
[
"call.add",
"control_flow.branch.if.condition.change"
] | 794,892
| 794,888
|
u164522933
|
ruby
|
p02987
|
s = gets.split("").sort
if ((s[0]==s[1]) && (s[2]==s[3]) && (s[0] != s[2]))
puts 'Yes'
else
puts 'No'
end
|
s = gets.chomp.split("").sort
if ((s[0]==s[1]) && (s[2]==s[3]) && (s[0] != s[2]))
puts 'Yes'
else
puts 'No'
end
|
[
"call.add"
] | 794,887
| 794,896
|
u164522933
|
ruby
|
p02987
|
s = gets.split("")
s.sort!
if ((s[0]==s[1]) && (s[2]==s[3]) && (s[0] != s[2]))
puts 'Yes'
else
puts 'No'
end
|
s = gets.chomp.split("").sort
if ((s[0]==s[1]) && (s[2]==s[3]) && (s[0] != s[2]))
puts 'Yes'
else
puts 'No'
end
|
[
"call.add",
"assignment.value.change",
"identifier.change"
] | 794,889
| 794,896
|
u164522933
|
ruby
|
p02987
|
s = gets.split("")
s.sort!
#p s
if ((s[0]==s[1]) and (s[2]==s[3]) and (s[0]!=s[2]))
puts 'Yes'
else
puts 'No'
end
|
s = gets.chomp.split("").sort
if ((s[0]==s[1]) && (s[2]==s[3]) && (s[0] != s[2]))
puts 'Yes'
else
puts 'No'
end
|
[
"call.add",
"assignment.value.change",
"identifier.change",
"control_flow.branch.if.condition.change"
] | 794,893
| 794,896
|
u164522933
|
ruby
|
p02987
|
s = gets.split("")
s.sort!
if ((s[0]==s[1]) and (s[2]==s[3]) and (s[0]!=s[2]))
puts 'Yes'
else
puts 'No'
end
|
s = gets.chomp.split("").sort
if ((s[0]==s[1]) && (s[2]==s[3]) && (s[0] != s[2]))
puts 'Yes'
else
puts 'No'
end
|
[
"call.add",
"assignment.value.change",
"identifier.change",
"control_flow.branch.if.condition.change"
] | 794,895
| 794,896
|
u164522933
|
ruby
|
p02987
|
vhash = Hash.new(0)
str = gets.chomp.chars { |c| hash[c] += 1 }
puts hash.all? { |_key, value| value == 2 } ? 'Yes' : 'No'
|
hash = Hash.new(0)
str = gets.chomp.chars { |c| hash[c] += 1 }
puts hash.all? { |_key, value| value == 2 } ? 'Yes' : 'No'
|
[
"assignment.variable.change",
"identifier.change"
] | 794,905
| 794,906
|
u987208743
|
ruby
|
p02987
|
S = gets
if S.count(S[0]) == 2 && S.count(S[1]) == 2 && S.count(S[2]) == 2 && S.count(S[3]) == 2
p "Yes"
else
p "No"
end
|
S = gets
if S.count(S[0]) == 2 && S.count(S[1]) == 2 && S.count(S[2]) == 2 && S.count(S[3]) == 2
puts 'Yes'
else
puts 'No'
end
|
[
"literal.string.change",
"call.arguments.change"
] | 794,964
| 794,965
|
u865846477
|
ruby
|
p02987
|
s = gets.split('').sort
if s[0] == s[1] && s[2] == s[3] && s[0] != s[3]
puts 'Yes'
else
puts 'No'
end
|
s = gets.chomp.split('').sort
if s[0] == s[1] && s[2] == s[3] && s[0] != s[3]
puts 'Yes'
else
puts 'No'
end
|
[
"call.add"
] | 795,018
| 795,019
|
u876846619
|
ruby
|
p02987
|
S = gets
X = [S[0], S[1], S[2], S[3]]
Z = X.each_with_object(Hash.new(0)){|v,o| o[v]+=1}.values
if Z == [2,2]
print 'YES'
else
print 'NO'
end
|
S = gets
X = [S[0], S[1], S[2], S[3]]
Z = X.each_with_object(Hash.new(0)){|v,o| o[v]+=1}.values
if Z == [2,2]
print 'Yes'
else
print 'No'
end
|
[
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 795,062
| 795,063
|
u563722393
|
ruby
|
p02987
|
S = gets#.chop.split.map(&:to_i)
X = [S[0], S[1], S[2], S[3]]
Z = X.each_with_object(Hash.new(0)){|v,o| o[v]+=1}.values
if Z == [2,2]
print 'YES'
else
print 'NO'
end
|
S = gets
X = [S[0], S[1], S[2], S[3]]
Z = X.each_with_object(Hash.new(0)){|v,o| o[v]+=1}.values
if Z == [2,2]
print 'Yes'
else
print 'No'
end
|
[
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 795,064
| 795,063
|
u563722393
|
ruby
|
p02987
|
s=gets
print (s.chars.group_by(&:itself).map{|_,v|v.size} == [2,2] ? 'Yes' : 'No')
|
s=gets.chomp
print (s.chars.group_by(&:itself).map{|_,v|v.size} == [2,2] ? 'Yes' : 'No')
|
[
"call.add"
] | 795,094
| 795,095
|
u702482655
|
ruby
|
p02987
|
s=gets
print (s.chars.group_by(&:itself).map{|_,v|v.size} == [2,2,] ? 'Yes' : 'No')
|
s=gets.chomp
print (s.chars.group_by(&:itself).map{|_,v|v.size} == [2,2] ? 'Yes' : 'No')
|
[
"call.add",
"control_flow.branch.if.condition.change"
] | 795,096
| 795,095
|
u702482655
|
ruby
|
p02987
|
S = STDIN.gets.chomp
A = S.chars.map { |c|
c
}
A.sort!
if (A[0] == A[1] && A[2] == A[2] && A[0] != A[2]) then
puts "Yes"
else
puts "No"
end
|
S = STDIN.gets.chomp
A = S.chars.map { |c|
c
}
A.sort!
if (A[0] == A[1] && A[2] == A[3] && A[0] != A[2]) then
puts "Yes"
else
puts "No"
end
|
[
"literal.number.integer.change",
"variable_access.subscript.index.change",
"control_flow.branch.if.condition.change"
] | 795,184
| 795,185
|
u231458241
|
ruby
|
p02987
|
puts gets.chomp.split('').uniq.length == 2 ? 'YES' : 'NO'
|
puts gets.chomp.split('').uniq.length == 2 ? 'Yes' : 'No'
|
[
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 795,310
| 795,311
|
u598150937
|
ruby
|
p02988
|
# frozen_string_literal: true
_ = gets.to_i
p = gets.split.map(&:to_i)
puts p.each_cons(3).count do |a|
a[0] < a[1] && a[1] < a[2] || a[0] > a[1] && a[1] > a[2]
end
|
# frozen_string_literal: true
_ = gets.to_i
p = gets.split.map(&:to_i)
puts p.each_cons(3).count { |a|
a[0] < a[1] && a[1] < a[2] || a[0] > a[1] && a[1] > a[2]
}
|
[] | 795,452
| 795,453
|
u104886851
|
ruby
|
p02988
|
n = gets.to_i
p = gets.chomp.split.map(&:to_i)
sum =0
n-2.times do |i|
if [p[i],p[i+1],p[i+2]].sort[1] == p[i+1]
sum += 1
end
end
puts sum
|
n = gets.to_i
p = gets.chomp.split.map(&:to_i)
sum =0
(n-2).times do |i|
if [p[i],p[i+1],p[i+2]].sort[1] == p[i+1]
sum += 1
end
end
puts sum
|
[] | 795,515
| 795,516
|
u689027433
|
ruby
|
p02988
|
n=gets.to_i
q=gets.split.map &:to_i
p (1..n-2).count{|i|(q[i-1]-q[i])*(q[i]-q[i+1])<0}
|
n=gets.to_i
q=gets.split.map &:to_i
p (1..n-2).count{|i|(q[i-1]-q[i])*(q[i]-q[i+1])>0}
|
[
"misc.opposites",
"expression.operator.compare.change",
"call.arguments.change",
"expression.operation.binary.change"
] | 795,532
| 795,533
|
u657913472
|
ruby
|
p02988
|
n=gets.to_i
q=gets.split.map &:to_i
p (1..n-2).count{|i|(q[i-1]-q[i])*(q[i]-q[i-1])<0}
|
n=gets.to_i
q=gets.split.map &:to_i
p (1..n-2).count{|i|(q[i-1]-q[i])*(q[i]-q[i+1])>0}
|
[
"misc.opposites",
"expression.operator.arithmetic.change",
"variable_access.subscript.index.change",
"call.arguments.change",
"expression.operation.binary.change",
"expression.operator.compare.change"
] | 795,534
| 795,533
|
u657913472
|
ruby
|
p02988
|
n = gest.to_i
num = gets.strip.split.map(&:to_i)
sum = 0
for i in 1..n-2
ary = [num[i-1],num[i],num[i+1]].sort
if num[i] == ary[1]
sum += 1
end
end
puts sum
|
n = gets.to_i
num = gets.strip.split.map(&:to_i)
sum = 0
for i in 1..n-2
ary = [num[i-1],num[i],num[i+1]].sort
if num[i] == ary[1]
sum += 1
end
end
puts sum
|
[
"misc.typo",
"assignment.value.change",
"identifier.change"
] | 795,548
| 795,549
|
u313103408
|
ruby
|
p02988
|
def ordinary_number(p)
f = ->(a, b, c) {
a, c = c, a if a > c
a < b && b < c
}
ans = 0
1.upto(p.size - 2) do |i|
ans += 1 if f.call(p[i - 1], p[i], p[i + 1])
end
ans
end
p = gets.split.map(&:to_i)
puts ordinary_number(p)
|
def ordinary_number(p)
f = ->(a, b, c) {
a, c = c, a if a > c
a < b && b < c
}
ans = 0
1.upto(p.size - 2) do |i|
ans += 1 if f.call(p[i - 1], p[i], p[i + 1])
end
ans
end
n = gets
p = gets.split.map(&:to_i)
puts ordinary_number(p)
|
[
"assignment.add"
] | 795,776
| 795,777
|
u976045502
|
ruby
|
p02988
|
n=gets.to_i
p=gets.slice.map(&:to_i)
c=0
0.upto(n-2){|i|([p[i],p[i+1],p[i+2]].sort)[1]==p[i+1] ?c+=1:0 }
puts c
|
n=gets.to_i
p=gets.split.map(&:to_i)
c=0
0.upto(n-3){|i|([p[i],p[i+1],p[i+2]].sort)[1]==p[i+1] ?c+=1:0 }
puts c
|
[
"assignment.value.change",
"identifier.change",
"literal.number.integer.change",
"call.arguments.change",
"expression.operation.binary.change"
] | 795,868
| 795,869
|
u883824971
|
ruby
|
p02988
|
n = gets.to_i
ary = gets.strip.split.map(&:to_i)
cnt = 0
ary.each_with_index do |p, i|
break if i+2 == ary.length
new_ary = ary[i], ary[i+1], ary[i+2]
p new_ary
cnt+=1 if new_ary.max == new_ary[0] && new_ary.min == new_ary[2] || new_ary.min == new_ary[0] && new_ary.max == new_ary[2]
end
puts cnt
|
n = gets.to_i
ary = gets.strip.split.map(&:to_i)
cnt = 0
ary.each_with_index do |p, i|
break if i+2 == ary.length
new_ary = ary[i], ary[i+1], ary[i+2]
cnt+=1 if new_ary.max == new_ary[0] && new_ary.min == new_ary[2] || new_ary.min == new_ary[0] && new_ary.max == new_ary[2]
end
puts cnt
|
[
"call.remove"
] | 795,887
| 795,888
|
u167516416
|
ruby
|
p02988
|
n = gets.chomp.to_i
nums = gets.chomp.split(' ').map(&:to_i)
res = 0
(1..n-2).times do |i|
res += 1 if (nums[i-1] < nums[i] && nums[i] < nums[i+1]) || (nums[i+1] < nums[i] && nums[i] < nums[i-1])
end
puts res
|
n = gets.chomp.to_i
nums = gets.chomp.split(' ').map(&:to_i)
res = 0
(1..n-2).each do |i|
res += 1 if (nums[i-1] < nums[i] && nums[i] < nums[i+1]) || (nums[i+1] < nums[i] && nums[i] < nums[i-1])
end
puts res
|
[
"identifier.change"
] | 795,891
| 795,892
|
u920525832
|
ruby
|
p02988
|
class Object
def is_true?
self === true
end
end
def main(one, two)
p arr = two.split.map(&:to_i)
tes = arr.map.with_index do |v, index|
next false if index - 1 < 0
next false if arr.size <= index + 1
next false if v < arr[index - 1] and v < arr[index + 1]
next false if v > arr[index - 1] and v > arr[index + 1]
true
end
puts tes.count(&:is_true?)
end
main(gets.strip, gets.strip)
|
class Object
def is_true?
self === true
end
end
def main(one, two)
arr = two.split.map(&:to_i)
tes = arr.map.with_index do |v, index|
next false if index - 1 < 0
next false if arr.size <= index + 1
next false if v < arr[index - 1] and v < arr[index + 1]
next false if v > arr[index - 1] and v > arr[index + 1]
true
end
puts tes.count(&:is_true?)
end
main(gets.strip, gets.strip)
|
[
"io.output.change",
"call.remove"
] | 795,935
| 795,936
|
u531302221
|
ruby
|
p02988
|
gets
p gets.chomp.split.map.each_cons(3).select{|a,b,c|x=[a,b,c].sort; x[1] == b && x[0]<x[1]}.size
|
gets
p gets.chomp.split.map(&:to_i).each_cons(3).select{|a,b,c|x=[a,b,c].sort; x[1] == b && x[0]<x[1]}.size
|
[
"call.arguments.add"
] | 796,029
| 796,030
|
u538188080
|
ruby
|
p02988
|
i = gets.to_i
h = gets.split.map(&:to_i)
list =[]
h.each do |t|
list << t
end
count = 0
huf = []
for x in 0..(i - 3) do
huf << list[x]
huf << list[x + 1]
huf << list[x + 2]
p huf
huf = huf.sort
if list[x + 1] == huf[1]
count += 1
end
huf.clear
end
puts count
|
i = gets.to_i
h = gets.split.map(&:to_i)
list =[]
h.each do |t|
list << t
end
count = 0
huf = []
for x in 0..(i - 3) do
huf << list[x]
huf << list[x + 1]
huf << list[x + 2]
huf = huf.sort
if list[x + 1] == huf[1]
count += 1
end
huf.clear
end
puts count
|
[
"call.remove"
] | 796,188
| 796,189
|
u611507615
|
ruby
|
p02988
|
N = gets.chomp.to_i
P = gets.chomp.split(" ").map(&:to_i)
cnt = 0
0.upto(N-2) do |i|
cnt += 1 if (P[i-1] < P[i] && P[i] < P[i+1]) || (P[i-1] > P[i] && P[i] > P[i+1])
end
puts cnt
|
N = gets.chomp.to_i
P = gets.chomp.split(" ").map(&:to_i)
cnt = 0
1.upto(N-2) do |i|
cnt += 1 if (P[i-1] < P[i] && P[i] < P[i+1]) || (P[i-1] > P[i] && P[i] > P[i+1])
end
puts cnt
|
[
"literal.number.integer.change"
] | 796,271
| 796,272
|
u443924743
|
ruby
|
p02988
|
n = gets.to_i
p = Array.new(n-1)
p = gets.split(" ").map(&:to_i);
for i in 1..n-2 do
if p[i] > p[i-1] && p[i] <= p[i+1]
count += 1
else
if p[i] >= p[i-1] && p[i] < p[i+1]
count += 1
else
if p[i] < p[i-1] && p[i] >= p[i+1]
count += 1
else
if p[i] <= p[i-1] && p[i] > p[i+1]
count += 1
end
end
end
end
end
puts count
|
n = gets.to_i
p = Array.new(n-1)
p = gets.split(" ").map(&:to_i);
count = 0
for i in 1..n-2 do
if p[i] > p[i-1] && p[i] <= p[i+1]
count += 1
else
if p[i] >= p[i-1] && p[i] < p[i+1]
count += 1
else
if p[i] < p[i-1] && p[i] >= p[i+1]
count += 1
else
if p[i] <= p[i-1] && p[i] > p[i+1]
count += 1
end
end
end
end
end
puts count
|
[
"assignment.add"
] | 796,319
| 796,320
|
u307452818
|
ruby
|
p02988
|
n = gets.to_i
p = Array.new(n-1)
p = gets.split(" ").map(&to_i);
count = 0
for i in 1..n-2 do
if p[i] > p[i-1] && p[i] <= p[i+1]
count += 1
else
if p[i] >= p[i-1] && p[i] < p[i+1]
count += 1
else
if p[i] < p[i-1] && p[i] >= p[i+1]
count += 1
else
if p[i] <= p[i-1] && p[i] > p[i+1]
count += 1
end
end
end
end
end
puts count
|
n = gets.to_i
p = Array.new(n-1)
p = gets.split(" ").map(&:to_i);
count = 0
for i in 1..n-2 do
if p[i] > p[i-1] && p[i] <= p[i+1]
count += 1
else
if p[i] >= p[i-1] && p[i] < p[i+1]
count += 1
else
if p[i] < p[i-1] && p[i] >= p[i+1]
count += 1
else
if p[i] <= p[i-1] && p[i] > p[i+1]
count += 1
end
end
end
end
end
puts count
|
[
"assignment.value.change",
"call.arguments.change"
] | 796,321
| 796,320
|
u307452818
|
ruby
|
p02988
|
N = gets.to_i
P = gets.split(' ').map(&:to_i)
cnt = 0
(1...N-1).each{ |i|
if P[i-1] < P[i]
cnt += 1 if P[i] >= P[i+1]
elsif P[i-1] >= P[i]
cnt += 1 if P[i] > P[i+1]
end
}
puts cnt
|
N = gets.to_i
P = gets.split(' ').map(&:to_i)
cnt = 0
(1...N-1).each{ |i|
if P[i-1] < P[i]
cnt += 1 if P[i] <= P[i+1]
elsif P[i-1] >= P[i]
cnt += 1 if P[i] > P[i+1]
end
}
puts cnt
|
[
"misc.opposites",
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 796,381
| 796,382
|
u039504682
|
ruby
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.