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 |
|---|---|---|---|---|---|---|---|
p03834
|
if __FILE__==$0
reads_s=lambda{|s,d|s.strip.split(d)}
text=reads_s[fp.gets,","]
for i in 0..text.length-1
print( i<text.length-1 ? text[i]+" " : text[i]+"\n")
end
end
|
if __FILE__==$0
reads_s=lambda{|s,d|s.strip.split(d)}
text=reads_s[gets,","]
for i in 0..text.length-1
print( i<text.length-1 ? text[i]+" " : text[i]+"\n")
end
end
|
[
"call.remove"
] | 1,453,855
| 1,453,856
|
u036059298
|
ruby
|
p03834
|
p gets.chomp.tr(',', ' ')
|
puts gets.chomp.tr(',', ' ')
|
[
"call.function.change",
"io.output.change"
] | 1,453,914
| 1,453,915
|
u809554629
|
ruby
|
p03835
|
number = gets.split(' ')
k = number[0].to_i
s = number[1].to_i
count = 0
for x in 0..k do
for y in 0..k do
z = s-x-y
if z <= k then
count = count+1
end
end
end
puts count
|
number = gets.split(' ')
k = number[0].to_i
s = number[1].to_i
count = 0
for x in 0..k do
for y in 0..k do
z = s-x-y
if z <= k and z >= 0 then
count = count+1
end
end
end
puts count
|
[
"control_flow.branch.if.condition.change"
] | 1,454,189
| 1,454,190
|
u680649274
|
ruby
|
p03835
|
k,s = gets.split.map &:to_i
count = 0
for x in 0..k do
for y in 0..k - x do
z = s - (x + y)
if z >= 0 && z <= k && x + y + z == s
count += 1
end
end
end
puts count
|
k,s = gets.split.map &:to_i
count = 0
for x in 0..k do
for y in 0..k do
z = s - (x + y)
if z >= 0 && z <= k && x + y + z == s
count += 1
end
end
end
puts count
|
[
"expression.operation.binary.remove"
] | 1,454,477
| 1,454,478
|
u133389966
|
ruby
|
p03835
|
a,b = gets.chomp.split(" ").map(&:to_i)
num = 0
(a+1).times do |k|
(a+1).times do |j|
res = b - k - j
if res = 0 && res <= a
num += 1
end
end
end
puts num
|
a,b = gets.chomp.split(" ").map(&:to_i)
num = 0
(a+1).times do |k|
(a+1).times do |j|
res = b - k - j
if 0 <= res && res <= a
num += 1
end
end
end
puts num
|
[
"control_flow.branch.if.condition.change"
] | 1,454,714
| 1,454,715
|
u343055017
|
ruby
|
p03835
|
k,s=gets.split.map &:to_i
l=k+1
a=0
l.times do |x|
l.times do |y|
z=s-x+y
a+=1 if z>=0 && z<=k
end
end
puts a
|
k,s=gets.split.map &:to_i
l=k+1
a=0
l.times do |x|
l.times do |y|
z=s-x-y
a+=1 if z>=0 && z<=k
end
end
puts a
|
[
"misc.opposites",
"expression.operator.arithmetic.change",
"assignment.value.change",
"expression.operation.binary.change"
] | 1,454,907
| 1,454,908
|
u630043039
|
ruby
|
p03835
|
k, s = gets.split.map(&:to_i)
count = 0
(0..k).each do |x|
(0..k).each do |y|
z = x - y
count += 1 if (0..k).include?(z)
end
end
puts count
|
k, s = gets.split.map(&:to_i)
count = 0
(0..k).each do |x|
(0..k).each do |y|
z = s - x - y
count += 1 if (0..k).include?(z)
end
end
puts count
|
[
"assignment.change"
] | 1,455,051
| 1,455,052
|
u156180166
|
ruby
|
p03835
|
k, s = gets.strip.split.map(&:to_i)
cnt = 0
(0..k).each do |x|
(0..k).each do |y|
z = s - x - y
cnt +=1 if z.betwwen?(0,k)
end
end
puts cnt
|
k, s = gets.strip.split.map(&:to_i)
cnt = 0
(0..k).each do |x|
(0..k).each do |y|
z = s - x - y
cnt +=1 if z.between?(0,k)
end
end
puts cnt
|
[
"identifier.change",
"control_flow.branch.if.condition.change"
] | 1,455,625
| 1,455,626
|
u124214522
|
ruby
|
p03835
|
k,s=gets.sprit.split.map(&:to_i)
ans = 0
(k+1).times{|x|
(k+1).times{|y|
ans+=1 if (x+y<=s && s-x-y <=k)
}
}
puts ans
|
k,s=gets.strip.split.map(&:to_i)
ans = 0
(k+1).times{|x|
(k+1).times{|y|
ans+=1 if (x+y<=s && s-x-y <=k)
}
}
puts ans
|
[
"assignment.value.change",
"identifier.change"
] | 1,455,627
| 1,455,628
|
u124214522
|
ruby
|
p03835
|
K, S = gets.split.map(&:to_i)
ans = 0
min = (S/3.0).ceil
(min..K).each do |a|
rest = S - a
next if rest > K*2
minb = (rest/2.0).ceil
maxb = [rest, K].min
(minb..maxb).each do |b|
c = rest - b
if a == b
if b == c
#p [1,a,b,c]
ans += 1
else
#p [3,a,b,c]
ans += 3
end
elsif b == c
#p [3,a,b,c]
ans += 3
else
#p [6,a,b,c]
ans += 6
end
end
end
p ans
|
K, S = gets.split.map(&:to_i)
ans = 0
min = (S/3.0).ceil
(min..K).each do |a|
rest = S - a
next if rest > K*2
minb = (rest/2.0).ceil
maxb = [rest, K, a].min
(minb..maxb).each do |b|
c = rest - b
if a == b
if b == c
#p [1,a,b,c]
ans += 1
else
#p [3,a,b,c]
ans += 3
end
elsif b == c
#p [3,a,b,c]
ans += 3
else
#p [6,a,b,c]
ans += 6
end
end
end
p ans
|
[
"literal.array.change"
] | 1,455,691
| 1,455,692
|
u437302815
|
ruby
|
p03835
|
k, s = get.split.map(&:to_i)
cnt = 0
(k + 1).times do |x|
(k + 1).times do |y|
z = s - x - y
if z >= 0 && z <= k
cnt += 1
end
end
end
p cnt
|
k, s = gets.split.map(&:to_i)
cnt = 0
(k + 1).times do |x|
(k + 1).times do |y|
z = s - x - y
if z >= 0 && z <= k
cnt += 1
end
end
end
puts cnt
|
[
"assignment.value.change",
"identifier.change",
"call.function.change",
"io.output.change"
] | 1,456,061
| 1,456,062
|
u667235836
|
ruby
|
p03835
|
k, s = get.split.map(&:to_i)
cnt = 0
(k + 1).times do |x|
(k + 1).times do |y|
z = s - x - y
if z >= 0 && z <= k
cnt += 1
end
end
end
puts cnt
|
k, s = gets.split.map(&:to_i)
cnt = 0
(k + 1).times do |x|
(k + 1).times do |y|
z = s - x - y
if z >= 0 && z <= k
cnt += 1
end
end
end
puts cnt
|
[
"assignment.value.change",
"identifier.change"
] | 1,456,063
| 1,456,062
|
u667235836
|
ruby
|
p03835
|
k,s=gets.split.map &:to_i;p (0..(k+=1)*k).count{|i|z=s-i%k-i/k;0<=z&&z<k}
|
k,s=gets.split.map &:to_i;p (0...(k+=1)*k).count{|i|z=s-i%k-i/k;0<=z&&z<k}
|
[
"call.arguments.change"
] | 1,457,134
| 1,457,135
|
u280667879
|
ruby
|
p03835
|
line = gets.chomp.split(' ').map { |e| e.to_i }
k = line[0]
s = line[1]
count = 0
for x in 0..K
for y in 0..K
z = s - x - y
if 0 <= z && z <= K
count += 1
end
end
end
puts count
|
line = gets.chomp.split(' ').map { |e| e.to_i }
k = line[0]
s = line[1]
count = 0
for x in 0..k
for y in 0..k
z = s - x - y
if 0 <= z && z <= k
count += 1
end
end
end
puts count
|
[
"control_flow.branch.if.condition.change"
] | 1,457,142
| 1,457,143
|
u796890576
|
ruby
|
p03838
|
x, y = gets.chomp.split(" ").map(&:to_i)
if x <= y
if 0 <= x || y < 0
puts y - x
elsif y.abs < x.abs
puts (- y) - x + 2
else
puts y + x + 1
end
else
if 0 <= y || x < 0
puts (- y) + x + 2
elsif y.abs < x.abs
puts y + x + 1
else
puts (- y) - x + 1
end
end
|
x, y = gets.chomp.split(" ").map(&:to_i)
if x <= y
if 0 <= x || y <= 0
puts y - x
elsif y.abs < x.abs
puts (- y) - x + 1
else
puts y + x + 1
end
else
if 0 < y || x < 0
puts (- y) + x + 2
elsif y.abs < x.abs
puts y + x + 1
else
puts (- y) - x + 1
end
end
|
[
"expression.operator.compare.change",
"control_flow.branch.if.condition.change",
"literal.number.integer.change",
"call.arguments.change",
"expression.operation.binary.change"
] | 1,457,984
| 1,457,983
|
u655122274
|
ruby
|
p03838
|
array = gets.split(" ")
array.map!{|i|i.to_i}
sa = ( array[0].abs - array[1].abs ).abs
if array[0] * array[1] == 0 && array[0] <= array[1]
puts sa
elsif array[0] * array[1] == 0 && array[0] > array[1]
puts sa + 1
else
if array[0] * array[1] > 0 && array[0] < array[1]
puts sa
elsif array[0] * array[1] > 0 && array[0] >= array[1]
puts sa + 1
else
puts sa + 2
end
end
|
array = gets.split(" ")
array.map!{|i|i.to_i}
sa = ( array[0].abs - array[1].abs ).abs
if array[0] * array[1] == 0 && array[0] <= array[1]
puts sa
elsif array[0] * array[1] == 0 && array[0] > array[1]
puts sa + 1
else
if array[0] * array[1] > 0 && array[0] < array[1]
puts sa
elsif array[0] * array[1] > 0 && array[0] >= array[1]
puts sa + 2
else
puts sa + 1
end
end
|
[
"call.remove",
"call.add"
] | 1,458,864
| 1,458,865
|
u441320643
|
ruby
|
p03839
|
n,k,*a=`dd`.split.map &:to_i
a=(b=[0])+a
1.upto(a.size-1){|i|b[i]=b[i-1]+[0,a[i]].max;a[i]+=a[i-1]}
p k.upto(a.size-1).map{|i|b[-1]-(b[i]-b[i-k])+a[i]-a[i-k]}.max
|
n,k,*a=`dd`.split.map &:to_i
a=(b=[0])+a
1.upto(a.size-1){|i|b[i]=b[i-1]+[0,a[i]].max;a[i]+=a[i-1]}
p k.upto(a.size-1).map{|i|b[-1]-(b[i]-b[i-k])+[a[i]-a[i-k],0].max}.max
|
[
"call.arguments.change",
"call.add"
] | 1,459,819
| 1,459,820
|
u280667879
|
ruby
|
p03840
|
require 'set'; require 'prime'
INF=Float::INFINITY; MOD=10**9+7
ai, ao, _, aj, al, _, _ = gets.chomp.split.map(&:to_i)
ans = ao
ans += ai/2*2 + aj/2*2 + al/2*2
ans = [ans, (ai-1)/2*2 + (aj-1)/2*2 + (al-1)/2*2 + 3].max if ai > 0 && aj > 0 && al > 0
puts ans
|
require 'set'; require 'prime'
INF=Float::INFINITY; MOD=10**9+7
ai, ao, _, aj, al, _, _ = gets.chomp.split.map(&:to_i)
ans = 0
ans += ai/2*2 + aj/2*2 + al/2*2
ans = [ans, (ai-1)/2*2 + (aj-1)/2*2 + (al-1)/2*2 + 3].max if ai > 0 && aj > 0 && al > 0
ans += ao
puts ans
|
[
"assignment.value.change",
"identifier.replace.remove",
"literal.replace.add"
] | 1,460,184
| 1,460,185
|
u524019694
|
ruby
|
p03844
|
arr = gets.chomp.split(' ')
if arr[1] == "+"
puts arr[0].to_i + arr[2].to_i
else
arr[0].to_i - arr[2].to_i
end
|
arr = gets.chomp.split(' ')
if arr[1] == "+"
puts arr[0].to_i + arr[2].to_i
else
puts arr[0].to_i - arr[2].to_i
end
|
[
"io.output.change",
"call.add"
] | 1,460,383
| 1,460,384
|
u847977106
|
ruby
|
p03844
|
a = "5 - 7".split(" ")
if a[1] == "+"
puts a[0].to_i + a[2].to_i
else
puts a[0].to_i - a[2].to_i
end
|
a = gets.split(" ")
if a[1] == "+"
puts a[0].to_i + a[2].to_i
else
puts a[0].to_i - a[2].to_i
end
|
[
"assignment.value.change"
] | 1,460,729
| 1,460,730
|
u523351024
|
ruby
|
p03844
|
a = gets.split(" ")
if a[1] = "+"
puts a[0].to_i + a[2].to_i
else
puts a[0].to_i - a[2].to_i
end
|
a = gets.split(" ")
if a[1] == "+"
puts a[0].to_i + a[2].to_i
else
puts a[0].to_i - a[2].to_i
end
|
[
"expression.operation.compare.replace.add",
"assignment.replace.remove",
"misc.typo"
] | 1,460,731
| 1,460,730
|
u523351024
|
ruby
|
p03844
|
eval gets.chomp
|
puts eval gets.chomp
|
[
"io.output.change",
"call.add"
] | 1,460,833
| 1,460,834
|
u579668395
|
ruby
|
p03844
|
a,op,b = gets.split
if op == '+'
p a.to_i + b.to_i
else
p a.to_ - b.to_i
end
|
a,op,b = gets.split
if op == '+'
p a.to_i + b.to_i
else
p a.to_i - b.to_i
end
|
[
"identifier.change",
"call.arguments.change",
"expression.operation.binary.change"
] | 1,460,880
| 1,460,881
|
u049159332
|
ruby
|
p03844
|
x=gets.chomp.split.map(&:to_s)
a=x[0].to_s
b=x[2].to_s
if x[1]=="+" then
puts a+b
else
puts a-b
end
|
x=gets.chomp.split.map(&:to_s)
a=x[0].to_i
b=x[2].to_i
if x[1]=="+" then
puts a+b
else
puts a-b
end
|
[
"call.function.change",
"type_conversion.to_integer.change",
"type_conversion.to_number.change"
] | 1,461,091
| 1,461,092
|
u411903982
|
ruby
|
p03844
|
eval gets
|
puts eval gets
|
[
"io.output.change",
"call.add"
] | 1,461,376
| 1,461,377
|
u098367142
|
ruby
|
p03845
|
gets
a=gets.split.map &:to_i
c=a.inject(:+)
gets.to_i.times do
x,y=gets.split.map &:to_i
p c-a[x]+y
end
|
gets
a=gets.split.map &:to_i
c=a.inject(:+)
gets.to_i.times do
x,y=gets.split.map &:to_i
p c-a[x-1]+y
end
|
[
"expression.operation.binary.add"
] | 1,462,202
| 1,462,203
|
u554838392
|
ruby
|
p03840
|
a,b,c,d,e,f,g = gets.split.map(&:to_i)
ans = 0
ans += b*2
ans += (a/2)*4
ans += (d/2)*4
ans += (e/2)*4
if a.odd? && d.odd? && e.odd?
ans += 6
elsif d.odd? && e.odd?
ans += 2
elsif a.odd? && ((d.odd? && e != 0) || (e.odd? && d != 0))
ans += 2
end
puts ans/2
|
a,b,c,d,e,f,g = gets.split.map(&:to_i)
ans = 0
ans += b*2
ans += (a/2)*4
ans += (d/2)*4
ans += (e/2)*4
if a.odd? && d.odd? && e.odd?
ans += 6
elsif d.odd? && e.odd? && a != 0
ans += 2
elsif a.odd? && ((d.odd? && e != 0) || (e.odd? && d != 0))
ans += 2
end
puts ans/2
|
[
"control_flow.branch.if.condition.change"
] | 1,462,373
| 1,462,374
|
u506255180
|
ruby
|
p03846
|
n = STDIN.gets.to_i
a = STDIN.gets.chomp.split(" ").map{|x| x.to_i}.sort
if (n&1) == 1
for i in 0..(n-1) do
if i == 0 && a[i] != 0
puts 0
exit
elsif 2*((i+1)/2) != a[i]
puts 0
exit
end
end
else
for i in 0..(n-1) do
if ((i == 0) || (i == 1)) && a[i] != 1
puts 0
exit
elsif ((i/2) + 1) != a[i]
puts 0
exit
end
end
end
puts (2**(n/2))%(10**9 + 7)
|
n = STDIN.gets.to_i
a = STDIN.gets.chomp.split(" ").map{|x| x.to_i}.sort
if (n&1) == 1
for i in 0..(n-1) do
if i == 0 && a[i] != 0
puts 0
exit
elsif 2*((i+1)/2) != a[i]
puts 0
exit
end
end
else
for i in 0..(n-1) do
if ((i == 0) || (i == 1)) && a[i] != 1
puts 0
exit
elsif ((i/2)*2 + 1) != a[i]
puts 0
exit
end
end
end
puts (2**(n/2))%((10**9) + 7)
|
[
"control_flow.branch.if.condition.change",
"call.arguments.change"
] | 1,463,030
| 1,463,031
|
u561201295
|
ruby
|
p03846
|
N = gets.to_i
A = gets.split.map(&:to_i)
MOD = 10 ** 9
counter = Hash.new(0)
A.each do |a|
counter[a] += 1
end
f = counter.keys.sort.each_cons(2).all? { |a, b| b - a == 2 }
if counter.all? { |k, v| k.odd? && v == 2 } && f
puts (2 ** counter.keys.size) % MOD
elsif (counter[0] == 1) && counter.all? { |k, v| k.zero? || k.even? && v == 2 } && f
puts (2 ** counter.keys.size - 1) % MOD
else
puts 0
end
|
N = gets.to_i
A = gets.split.map(&:to_i)
MOD = 10 ** 9 + 7
counter = Hash.new(0)
A.each do |a|
counter[a] += 1
end
f = counter.keys.sort.each_cons(2).all? { |a, b| b - a == 2 }
if counter.all? { |k, v| k.odd? && v == 2 } && f
puts (2 ** counter.keys.size) % MOD
elsif (counter[0] == 1) && counter.all? { |k, v| k.zero? || k.even? && v == 2 } && f
puts (2 ** (counter.keys.size - 1)) % MOD
else
puts 0
end
|
[
"call.arguments.change"
] | 1,463,053
| 1,463,052
|
u740836226
|
ruby
|
p03852
|
# 英小文字 c が与えられるので、c が母音であるか判定してください。
# 英小文字を取得
word = gets.chomp
# 結果を格納する変数を宣言
result = String.new
# 英小文字が母音かどうか判定
case word
when "a" || "i" || "u" || "e" || "o"
result = "vowel"
else
result = "consonant"
end
# 結果を出力
puts result
|
# 英小文字 c が与えられるので、c が母音であるか判定してください。
# 英小文字を取得
word = gets.chomp
# 結果を格納する変数を宣言
result = String.new
# 英小文字が母音かどうか判定
case word
when "a", "i", "u", "e", "o"
result = "vowel"
else
result = "consonant"
end
# 結果を出力
puts result
|
[
"expression.operation.binary.change"
] | 1,464,630
| 1,464,631
|
u139850627
|
ruby
|
p03852
|
puts [?a,?i,?u,?e,?o].include?(gets.chpmp) ? "vowel" : "consonant"
|
puts [?a,?i,?u,?e,?o].include?(gets.chomp) ? "vowel" : "consonant"
|
[
"identifier.change",
"control_flow.branch.if.condition.change"
] | 1,464,727
| 1,464,728
|
u966810027
|
ruby
|
p03852
|
c = gets
vowels = "aiueo"
flag = false
5.times do |i|
if c == vowels[i]
puts "vowel"
flag = true
break
end
end
unless flag
puts "consonant"
end
|
c = gets.strip
vowels = "aiueo"
flag = false
5.times do |i|
if c == vowels[i]
puts "vowel"
flag = true
break
end
end
unless flag
puts "consonant"
end
|
[
"call.add"
] | 1,464,779
| 1,464,780
|
u458429268
|
ruby
|
p03852
|
c = gets
vowels = "aiueo"
flag = true
5.times do |i|
if c == vowels[i]
puts "vowel"
flag = false
break
end
end
unless flag
puts "consonant"
end
|
c = gets.strip
vowels = "aiueo"
flag = false
5.times do |i|
if c == vowels[i]
puts "vowel"
flag = true
break
end
end
unless flag
puts "consonant"
end
|
[
"call.add",
"misc.opposites",
"assignment.value.change"
] | 1,464,781
| 1,464,780
|
u458429268
|
ruby
|
p03852
|
puts ["a","e","i","o","u"].include?(gets.to_s) ? "vowel" : "consonant"
|
puts ["a","e","i","o","u"].include?(gets.chomp.to_s) ? "vowel" : "consonant"
|
[
"control_flow.branch.if.condition.change",
"call.add"
] | 1,464,802
| 1,464,803
|
u390727364
|
ruby
|
p03852
|
puts ["a","e","i","o","u"].include(gets.to_s) ? "vowel" : "consonant"
|
puts ["a","e","i","o","u"].include?(gets.chomp.to_s) ? "vowel" : "consonant"
|
[
"call.suffix.change",
"control_flow.branch.if.condition.change",
"call.add"
] | 1,464,805
| 1,464,803
|
u390727364
|
ruby
|
p03852
|
puts %w[a e i o u].include?(gets) ? 'vowel':'consonant'
|
puts %w[a e i o u].include?(gets[0]) ? 'vowel':'consonant'
|
[
"control_flow.branch.if.condition.change"
] | 1,464,880
| 1,464,879
|
u050914494
|
ruby
|
p03852
|
c=gets
puts "aeiou".include?(c) ? "vowel" : "consonant"
|
c=gets.strip
puts "aeiou".include?(c) ? "vowel" : "consonant"
|
[
"call.add"
] | 1,465,034
| 1,465,035
|
u025592199
|
ruby
|
p03852
|
c=gets
puts "aiueo".include?(c) ? "vowel" : "consonant"
|
c=gets.strip
puts "aeiou".include?(c) ? "vowel" : "consonant"
|
[
"call.add",
"literal.string.change",
"control_flow.branch.if.condition.change"
] | 1,465,036
| 1,465,035
|
u025592199
|
ruby
|
p03852
|
a = gets.chomp
p ['a','i','u','e','o'].include?(a) ? 'vowel' : 'consonant'
|
a = gets.chomp
puts ['a','i','u','e','o'].include?(a) ? 'vowel' : 'consonant'
|
[
"call.function.change",
"io.output.change"
] | 1,465,058
| 1,465,059
|
u147126921
|
ruby
|
p03852
|
c = gets
if c == "a" || c == "i" || c == "u" || c == "e" || c == "o"
puts "vowel"
else
puts "consonant"
end
|
c = gets.chomp
if c == "a" || c == "i" || c == "u" || c == "e" || c == "o"
puts "vowel"
else
puts "consonant"
end
|
[
"call.add"
] | 1,465,079
| 1,465,080
|
u649242511
|
ruby
|
p03852
|
str = gets.chomp
vowel = ["a","e","i","o","u"]
result = "consonant"
if vowel.all? {|x| x == str}
result = "vowel"
end
puts result
|
str = gets.chomp
vowel = ["a","e","i","o","u"]
result = "consonant"
if vowel.any? {|x| str == x }
result = "vowel"
end
puts result
|
[
"identifier.change",
"control_flow.branch.if.condition.change",
"expression.operation.binary.remove"
] | 1,465,405
| 1,465,406
|
u788437785
|
ruby
|
p03852
|
c=gets
vowel="aiueo".split(//)
puts vowel.include?(c)? 'vowel': 'consonant'
|
c=gets.chomp
vowel="aiueo".split(//)
puts vowel.include?(c)? 'vowel': 'consonant'
|
[
"call.add"
] | 1,465,669
| 1,465,671
|
u882868478
|
ruby
|
p03852
|
c=gets
vowel="aiueo".split(//)
puts vowel.include?(c)? "vowel": "consonant"
|
c=gets.chomp
vowel="aiueo".split(//)
puts vowel.include?(c)? 'vowel': 'consonant'
|
[
"call.add",
"literal.string.change",
"call.arguments.change"
] | 1,465,673
| 1,465,671
|
u882868478
|
ruby
|
p03852
|
c = gets
print 'aeiou'.include? c ? 'vowel' : 'consonant'
|
c = gets.chomp
puts ('aeiou'.include? c) ? 'vowel' : 'consonant'
|
[
"assignment.value.change",
"call.add",
"control_flow.branch.if.condition.change"
] | 1,465,553
| 1,465,554
|
u494006126
|
ruby
|
p03852
|
a=gets
if a =="a" || a=="e" || a=="i" || a=="o" || a=="u"
puts "vowel"
else
puts "consonant"
end
|
a=gets.chomp
if a =="a" || a=="e" || a=="i" || a=="o" || a=="u"
puts "vowel"
else
puts "consonant"
end
|
[
"call.add"
] | 1,465,611
| 1,465,613
|
u292268276
|
ruby
|
p03852
|
VOWEL = %w(a b c d e)
c = gets.chomp
if VOWEL.include?(c)
puts 'vowel'
else
puts 'consonant'
end
|
VOWEL = %w(a e i o u)
c = gets.chomp
if VOWEL.include?(c)
puts 'vowel'
else
puts 'consonant'
end
|
[] | 1,465,681
| 1,465,682
|
u717398243
|
ruby
|
p03854
|
s = gets.chomp
%w(eraser erase dreamer dream).each{ |w| s.gsub!(w,'') }
puts s == '' ? 'Yes' : 'No'
|
s = gets.chomp
%w(eraser erase dreamer dream).each{ |w| s.gsub!(w,'') }
puts s == '' ? 'YES' : 'NO'
|
[
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 1,466,295
| 1,466,296
|
u693378622
|
ruby
|
p03854
|
def cnt(str,word)
return str.scan(word).length
end
s = gets.chomp
dreameraser = cnt(s,"dreameraser")
dreamerase = cnt(s,"dreamerase" ) - dreameraser
dreamer = cnt(s,"dreamer") - ( dreameraser + dreamerase)
dream = cnt(s,"dream") - ( dreameraser + dreamerase + dreamer)
eraser = cnt(s,"eraser") - dreameraser
erase = cnt(s,"erase") - (dreameraser + eraser)
# puts [dreamer, dream, eraser, erase]
if s.size == 11 * dreameraser + 10 * dreamerase + 7 * dreamer + 5 * dream + 6 * eraser + 5 * erase
puts "YES"
else
puts "NO"
end
|
def cnt(str,word)
return str.scan(word).length
end
s = gets.chomp
dreameraser = cnt(s,"dreameraser")
dreamerase = cnt(s,"dreamerase" ) - dreameraser
dreamer = cnt(s,"dreamer") - ( dreameraser + dreamerase)
dream = cnt(s,"dream") - ( dreameraser + dreamerase + dreamer)
eraser = cnt(s,"eraser") - dreameraser
erase = cnt(s,"erase") - (dreameraser + dreamerase + eraser )
# puts [dreamer, dream, eraser, erase]
if s.size == 11 * dreameraser + 10 * dreamerase + 7 * dreamer + 5 * dream + 6 * eraser + 5 * erase
puts "YES"
else
puts "NO"
end
|
[
"assignment.change"
] | 1,466,297
| 1,466,298
|
u693378622
|
ruby
|
p03854
|
S = gets.chomp
divides = ['dream', 'dreamer', 'erase', 'eraser']
dp = S.size.times.map{false}
dp[0] = true
0.step (S.size - 1) do |i|
next if !dp[i]
divides.each do |d|
# puts "#{i}: #{d}"
dp[i + d.size] = true if S.slice(i, d.size) == d
end
end
p dp
puts dp[S.size] ? 'YES' : 'NO'
|
S = gets.chomp
divides = ['dream', 'dreamer', 'erase', 'eraser']
dp = S.size.times.map{false}
dp[0] = true
0.step (S.size - 1) do |i|
next if !dp[i]
divides.each do |d|
# puts "#{i}: #{d}"
dp[i + d.size] = true if S.slice(i, d.size) == d
end
end
#p dp
puts dp[S.size] ? 'YES' : 'NO'
|
[
"call.remove"
] | 1,466,350
| 1,466,351
|
u984479733
|
ruby
|
p03854
|
s = gets.chomp
print s = /\A(dream|dreamer|erase|eraser)*\z/ ? 'YES' : 'NO'
|
s = gets.chomp
puts s =~ /\A(dream|dreamer|erase|eraser)*\Z/ ? 'YES' : 'NO'
|
[
"identifier.change",
"control_flow.branch.if.condition.change"
] | 1,466,361
| 1,466,362
|
u921695699
|
ruby
|
p03854
|
s = gets.chomp
print s = /\A(dream|dreamer|erase|eraser)*\z/ ? 'YES' : 'NO'
|
s = gets.chomp
print s =~ /\A(dream|dreamer|erase|eraser)*\z/ ? 'YES' : 'NO'
|
[
"control_flow.branch.if.condition.change"
] | 1,466,361
| 1,466,363
|
u921695699
|
ruby
|
p03854
|
# n = gets.split.map(&:to_i)
# array = readlines.map(&:chomp!).map { |e| e.split.map(&:to_i) }
#
#
s = gets.chomp.reverse
t = ""
u1 = "dreamer".reverse
u2 = "eraser".reverse
u3 = "dream".reverse
u4 = "erase".reverse
while s.slice!(u2)
end
while s.slice!(u4)
end
while s.slice!(u1)
end
while s.slice!(u3)
end
puts s.reverse
puts s.length == 0 ? "YES" : "NO"
|
# n = gets.split.map(&:to_i)
# array = readlines.map(&:chomp!).map { |e| e.split.map(&:to_i) }
#
#
s = gets.chomp.reverse
t = ""
u1 = "dreamer".reverse
u2 = "eraser".reverse
u3 = "dream".reverse
u4 = "erase".reverse
while s.slice!(u2)
end
while s.slice!(u4)
end
while s.slice!(u1)
end
while s.slice!(u3)
end
puts s.length == 0 ? "YES" : "NO"
|
[
"call.remove"
] | 1,466,372
| 1,466,373
|
u219902564
|
ruby
|
p03854
|
s = gets.chomp!
until s == "" do
l = s.length - 1
if s[l-4..l] == "dream" then
s.slice!(l-4..l)
elsif s[l-6..l] == "dreamer"
s.slice!(l-6..l)
elsif s[l-4..l] == "erase"
s.slice!(l-4..l)
elsif s[l-5..l] == "eraser"
s.slice!(l-5..l)
else
puts "No"
exit
end
end
puts "Yes"
|
s = gets.chomp!
until s == "" do
l = s.length - 1
if s[l-4..l] == "dream" then
s.slice!(l-4..l)
elsif s[l-6..l] == "dreamer"
s.slice!(l-6..l)
elsif s[l-4..l] == "erase"
s.slice!(l-4..l)
elsif s[l-5..l] == "eraser"
s.slice!(l-5..l)
else
puts "NO"
exit
end
end
puts "YES"
|
[
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 1,466,504
| 1,466,505
|
u692254521
|
ruby
|
p03854
|
s = gets.chomp!
s.reverse!
sl = ["dream", "dreamer", "erase", "eraser"]
sl.each { |st| st.reverse! }
while !s.empty? do
fl = false
sl.each do |st|
if s[0...st.length] == st
s.slice!(0...st.length)
fl = true
end
end
break if(!fl)
end
p "YES" if fl
p "NO" unless fl
|
s = gets.chomp!
s.reverse!
sl = ["dream", "dreamer", "erase", "eraser"]
sl.each { |st| st.reverse! }
while !s.empty? do
fl = false
sl.each do |st|
if s[0...st.length] == st
s.slice!(0...st.length)
fl = true
end
end
break if(!fl)
end
puts "YES" if fl
puts "NO" unless fl
|
[
"call.function.change",
"io.output.change"
] | 1,466,680
| 1,466,681
|
u506846578
|
ruby
|
p03854
|
s = gets.chomp
puts (s[/^(dream|erase|eraser|dreamer)*$/] != "")? "YES" : "NO"
|
s = gets.chomp
puts (s[/^(dream|erase|eraser|dreamer)*$/])? "YES" : "NO"
|
[
"expression.operation.binary.remove"
] | 1,466,931
| 1,466,932
|
u482840940
|
ruby
|
p03854
|
s = gets.chomp
puts (s[/(dream|erase|eraser|dreamer)*$/])? "YES" : "NO"
|
s = gets.chomp
puts (s[/^(dream|erase|eraser|dreamer)*$/])? "YES" : "NO"
|
[
"control_flow.branch.if.condition.change"
] | 1,466,933
| 1,466,932
|
u482840940
|
ruby
|
p03854
|
s = gets.chomp
a = ["dream", "dreamer", "erase", "eraser"]
a.each do |i|
s.gsub!(/#{i}/,'')
end
puts s.empty? ? "YES": "NO"
|
s = gets.chomp
a = ["dream", "dreamer", "erase", "eraser"]
a.reverse!
a.each do |i|
s.gsub!(/#{i}/,'')
end
puts s.empty? ? "YES": "NO"
|
[
"call.add"
] | 1,467,217
| 1,467,218
|
u684458716
|
ruby
|
p03854
|
# T の末尾に dream dreamer erase eraser のいずれかを追加する。
s = gets.chomp
len = s.size
(len - 1).downto(0) do |j|
if aaa = s[j..-1].match(/dreamer|dream|eraser|erase/)
s[j, aaa.to_s.size] = ""
puts s
end
end
puts s == "" ? "YES" : "NO"
|
# T の末尾に dream dreamer erase eraser のいずれかを追加する。
s = gets.chomp
len = s.size
(len - 1).downto(0) do |j|
if aaa = s[j..-1].match(/dreamer|dream|eraser|erase/)
s[j, aaa.to_s.size] = ""
end
end
puts s == "" ? "YES" : "NO"
|
[
"call.remove"
] | 1,467,414
| 1,467,415
|
u729246375
|
ruby
|
p03854
|
s = gets.chomp.to_s
s.gsub!(/eraser/, "")
s.gsub!(/erase/, "")
s.gsub!(/dreamer/, "")
s.gsub!(/dream/, "")
puts s ? 'YES':'NO'
|
s = gets.chomp.to_s
s.gsub!(/eraser/, "")
s.gsub!(/erase/, "")
s.gsub!(/dreamer/, "")
s.gsub!(/dream/, "")
puts s == '' ? 'YES':'NO'
|
[
"control_flow.branch.if.condition.change"
] | 1,467,508
| 1,467,509
|
u511421299
|
ruby
|
p03854
|
s = gets
s.gsub!(/eraser/, "")
s.gsub!(/erase/, "")
s.gsub!(/dreamer/, "")
s.gsub!(/dream/, "")
if s == ""
puts "YES"
else
puts "NO"
end
|
s = gets.chomp.to_s
s.gsub!(/eraser/, "")
s.gsub!(/erase/, "")
s.gsub!(/dreamer/, "")
s.gsub!(/dream/, "")
if s == ""
puts "YES"
else
puts "NO"
end
|
[
"call.add"
] | 1,467,512
| 1,467,513
|
u511421299
|
ruby
|
p03854
|
s = gets.strip.chars.reverse.join
strings = %w(dream dreamer erase eraser).map {|str| str.chars.reverse.join}
while true
can = false
strings.each do |str|
if s[0..str.length - 1] == str
s = s[str.length..-1]
can = true
end
end
if !can
puts "No"
break
end
if s.empty?
puts "Yes"
break
end
end
|
s = gets.strip.chars.reverse.join
strings = %w(dream dreamer erase eraser).map {|str| str.chars.reverse.join}
while true
can = false
strings.each do |str|
if s[0..str.length - 1] == str
s = s[str.length..-1]
can = true
end
end
if !can
puts "NO"
break
end
if s.empty?
puts "YES"
break
end
end
|
[
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 1,467,626
| 1,467,627
|
u617691573
|
ruby
|
p03854
|
n = gets
if n =~ /(dream|dreamer|erase|eraser)+/
puts 'YES'
else
puts 'NO'
end
|
n = gets
if n =~ /^(dream|dreamer|erase|eraser)+$/
puts 'YES'
else
puts 'NO'
end
|
[
"control_flow.branch.if.condition.change"
] | 1,467,634
| 1,467,635
|
u195257137
|
ruby
|
p03854
|
puts gets.chomp.gsub(/(eraser?|dream(er)?)/, '').length == 0 ? 'YES' : 'NO'
|
puts gets.chomp.gsub(/(dreameraser?|eraser?|dream(er)?)/, '').length == 0 ? 'YES' : 'NO'
|
[
"control_flow.branch.if.condition.change"
] | 1,467,682
| 1,467,683
|
u543466827
|
ruby
|
p03854
|
S = gets.chomp.split("")
s_rev = S.reverse
s_con = s_rev.inject(:+)
N = S.length / 5 + 1
subs = ["maerd", "remaerd", "esare", "resare"]
N.times {
subs.each do |sub|
if s_con.start_with?(sub)
s_con.slice!(0..sub.length - 1)
end
end
}
if s_con == ""
puts "Yes"
else
puts "No"
end
|
S = gets.chomp.split("")
s_rev = S.reverse
s_con = s_rev.inject(:+)
N = S.length + 1
subs = ["maerd", "remaerd", "esare", "resare"]
N.times {
subs.each do |sub|
if s_con.start_with?(sub)
s_con.slice!(0..sub.length - 1)
end
end
}
if s_con == ""
puts "YES"
else
puts "NO"
end
|
[
"expression.operation.binary.remove",
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 1,467,770
| 1,467,771
|
u060633673
|
ruby
|
p03854
|
s = gets.chomp.reverse
l = s.length
t = %w(eraser dreamer dream erase).map(&:reverse)
u = ""
now = ""
l.times do |i|
now += s[i]
t.each do |tt|
if now == tt
u += tt
now = ""
end
end
end
p u == s ? "YES" : "NO"
|
s = gets.chomp.reverse
l = s.length
t = %w(eraser dreamer dream erase).map(&:reverse)
u = ""
now = ""
l.times do |i|
now += s[i]
t.each do |tt|
if now == tt
u += tt
now = ""
end
end
end
puts u == s ? "YES" : "NO"
|
[
"call.function.change",
"io.output.change"
] | 1,468,300
| 1,468,301
|
u764011970
|
ruby
|
p03854
|
S = STDIN.gets.chomp
set = ['dream', 'dreamer', 'erase', 'eraser']
# erasedream
#
len = S.size
current = 0
flg = true
S.reverse!
puts S
while len > current
if S[current..current + 6] == 'remaerd'
current += 7
elsif S[current..current + 4] == 'maerd'
current += 5
elsif S[current..current + 5] == 'resare'
current += 6
elsif S[current..current + 4] == 'esare'
current += 5
else
flg = false
break
end
end
if flg
puts 'YES'
else
puts 'NO'
end
|
S = STDIN.gets.chomp
set = ['dream', 'dreamer', 'erase', 'eraser']
# erasedream
#
len = S.size
current = 0
flg = true
S.reverse!
while len > current
if S[current..current + 6] == 'remaerd'
current += 7
elsif S[current..current + 4] == 'maerd'
current += 5
elsif S[current..current + 5] == 'resare'
current += 6
elsif S[current..current + 4] == 'esare'
current += 5
else
flg = false
break
end
end
if flg
puts 'YES'
else
puts 'NO'
end
|
[
"call.remove"
] | 1,468,029
| 1,468,030
|
u853554960
|
ruby
|
p03854
|
puts gets =~ /(dream(er)?|eraser?)*/ ? "YES" : "NO"
|
puts gets =~ /^(dream(er)?|eraser?)*$/ ? "YES" : "NO"
|
[
"control_flow.branch.if.condition.change"
] | 1,468,138
| 1,468,139
|
u467508794
|
ruby
|
p03854
|
s = gets.chomp
s = s.gsub("eraser", "1").gsub("erase", "1").gsub("dreamer", "1").gsub("dream", "1").delete("1")
puts s.empty? ? "YES" : "No"
|
s = gets.chomp
s = s.gsub("eraser", "1")
.gsub("erase", "1")
.gsub("dreamer", "1")
.gsub("dream", "1")
.delete("1")
puts s.empty? ? "YES" : "NO"
|
[
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 1,468,386
| 1,468,387
|
u757568397
|
ruby
|
p03854
|
io = STDIN
io = DATA #!#!#!#!must delete
s=io.gets.chomp
$ar= %w(dreamer dream eraser erase)
def check(s)
while true
return false if $ar.none?{|st|s.end_with?(st)}
$ar.each do |st|
if s.end_with?(st)
s = s[0..-(st.size+1)]
return true if s.size==0
end
end
end
end
puts check(s) ? "YES" : "NO"
|
io = STDIN
s=io.gets.chomp
$ar= %w(dreamer dream eraser erase)
def check(s)
while true
return false if $ar.none?{|st|s.end_with?(st)}
$ar.each do |st|
if s.end_with?(st)
s = s[0..-(st.size+1)]
return true if s.size==0
end
end
end
end
puts check(s) ? "YES" : "NO"
|
[
"assignment.remove"
] | 1,468,518
| 1,468,519
|
u132360211
|
ruby
|
p03856
|
#!/usr/bin/env ruby
def check(str)
loop do
return true if str == ''
if str.end_with? 'dreamer'
str = str[0...-6]
elsif str.end_with? 'dream'
str = str[0...-4]
elsif str.end_with? 'eraser'
str = str[0...-6]
elsif str.end_with? 'erase'
str = str[0...-4]
else
return false
end
end
end
if $0 == __FILE__
S = gets.chomp
puts check(S) ? 'YES' : 'NO'
end
|
#!/usr/bin/env ruby
def check(str)
loop do
return true if str == ''
if str.end_with? 'dreamer'
str = str[0...-7]
elsif str.end_with? 'dream'
str = str[0...-5]
elsif str.end_with? 'eraser'
str = str[0...-6]
elsif str.end_with? 'erase'
str = str[0...-5]
else
return false
end
end
end
if $0 == __FILE__
S = gets.chomp
puts check(S) ? 'YES' : 'NO'
end
|
[
"literal.number.integer.change",
"assignment.value.change",
"variable_access.subscript.index.change",
"expression.operation.binary.change"
] | 1,468,823
| 1,468,824
|
u041550672
|
ruby
|
p03856
|
puts (gets.chomp =~ /^((dream|erase)(er)?)*$/) ? "YES" : "NO"
|
puts (gets.chomp =~ /^(dream(er)?|eraser?)*$/) ? "YES" : "NO"
|
[
"control_flow.branch.if.condition.change"
] | 1,468,927
| 1,468,928
|
u467508794
|
ruby
|
p03854
|
s=gets.chomp
n=s.size
pat=['dream', 'dreamer', 'erase', 'eraser'].map{|s| s.reverse}
s.reverse!
i=0
while i<n
tmp=''
pat.each do |t|
if s.start_with?(t)
tmp=t
break
end
end
if tmp.size>0
i+=tmp.size
else
puts 'NO'
exit 0
end
end
puts 'YES'
|
s=gets.chomp
n=s.size
pat=['dream', 'dreamer', 'erase', 'eraser'].map{|s| s.reverse}
s.reverse!
i=0
while i<n
tmp=''
pat.each do |t|
if s[i...n].start_with?(t)
tmp=t
break
end
end
if tmp.size>0
i+=tmp.size
else
puts 'NO'
exit 0
end
end
puts 'YES'
|
[
"control_flow.branch.if.condition.change"
] | 1,469,015
| 1,469,016
|
u882868478
|
ruby
|
p03854
|
S = gets.chomp
puts /^((dream)|(dreamer)|(eraser)|(eraser))+$/ =~ S ? "YES" : "NO"
|
S = gets.chomp
puts /^((dream)|(dreamer)|(erase)|(eraser))+$/ =~ S ? "YES" : "NO"
|
[
"literal.string.change",
"control_flow.branch.if.condition.change"
] | 1,469,138
| 1,469,139
|
u113091201
|
ruby
|
p03854
|
S = gets.chomp
puts /^((dream)|(dreamer)|(erase)|(eraser))+$/ =~ S ? "Yes" : "No"
|
S = gets.chomp
puts /^((dream)|(dreamer)|(erase)|(eraser))+$/ =~ S ? "YES" : "NO"
|
[
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 1,469,140
| 1,469,139
|
u113091201
|
ruby
|
p03860
|
def contenst(word)
puts "A#{x[0]}C"
end
A,x,C = gets.chomp.split(" ").map(&:to_s)
contenst(x)
|
def contenst(x)
puts "A#{x[0]}C"
end
A,x,C = gets.chomp.split(" ").map(&:to_s)
contenst(x)
|
[
"identifier.change"
] | 1,469,981
| 1,469,982
|
u050641473
|
ruby
|
p03860
|
s = gets.chomp.split(' ')
word = s[1]
p 'A' + word[0] + 'C'
|
s = gets.chomp.split(' ')
word = s[1]
puts 'A' + word[0] + 'C'
|
[
"call.function.change",
"io.output.change"
] | 1,469,999
| 1,470,000
|
u147126921
|
ruby
|
p03860
|
a,b,c = gets.split.map(&:to_i)
puts "A#{b[0]}C"
|
a,b,c = gets.split(' ')
puts "A#{b[0]}C"
|
[
"call.remove",
"call.arguments.change"
] | 1,470,119
| 1,470,120
|
u866325115
|
ruby
|
p03860
|
puts 'A'+gets.split[1][0]+'c'
|
puts 'A'+gets.split[1][0]+'C'
|
[
"misc.typo",
"literal.string.change",
"literal.string.case.change",
"call.arguments.change",
"expression.operation.binary.change"
] | 1,470,179
| 1,470,180
|
u050914494
|
ruby
|
p03861
|
a,b,x = gets.split.map(&:to_i)
l = a / x
m = b / x
if l % x == 0
puts m - l + 1
else
puts m - l
end
|
a,b,x = gets.split.map(&:to_i)
l = a / x
m = b / x
if a % x == 0
puts m - l + 1
else
puts m - l
end
|
[
"identifier.change",
"control_flow.branch.if.condition.change"
] | 1,470,847
| 1,470,848
|
u392423112
|
ruby
|
p03861
|
A, B, X = gets.split.map &:to_i
puts B.div(X) - [A-1,0].max.div(X)
|
A, B, X = gets.split.map &:to_i
puts B.div(X) - (A-1).div(X)
|
[
"call.arguments.change",
"expression.operation.binary.change",
"call.remove"
] | 1,471,106
| 1,471,107
|
u024039486
|
ruby
|
p03861
|
a,b,n=gets.split.map &:to_i
big=b/n
small=-~-a/n
p big+small
|
a,b,n=gets.split.map &:to_i
big=b/n
small=-a/n
p big-~small
|
[
"misc.opposites",
"expression.operator.arithmetic.change",
"call.arguments.change",
"expression.operation.binary.change",
"expression.operation.unary.add"
] | 1,471,731
| 1,471,732
|
u264508862
|
ruby
|
p03861
|
a, b, x = gets.chomp.split(" ").map(&:to_i)
puts (b/x) - (a/x) + 1
|
a, b, x = gets.chomp.split(" ").map(&:to_i)
puts (b/x) - ((a-1)/x)
|
[
"call.arguments.change",
"expression.operation.binary.remove"
] | 1,471,967
| 1,471,968
|
u512524057
|
ruby
|
p03861
|
a, b, x = gets.chomp.split(" ").map(&:to_i)
puts b / x - a / x + 1
|
a, b, x = gets.chomp.split(" ").map(&:to_i)
puts b / x - (a - 1) / x
|
[
"call.arguments.change",
"expression.operation.binary.remove"
] | 1,472,148
| 1,472,149
|
u653737129
|
ruby
|
p03860
|
a, b, c = gets.chomp.split
p a[0] + b[0] + c[0]
|
a, b, c = gets.chomp.split
puts a[0] + b[0] + c[0]
|
[
"call.function.change",
"io.output.change"
] | 1,472,581
| 1,472,582
|
u188011210
|
ruby
|
p03862
|
n, x = gets.split.map(&:to_i)
a = gets.split.map(&:to_i)
tmp = count = 0
a.each_cons(2) do |i, j|
if x < i + j - tmp
count += i + j - tmp - x
tmp = [i + j - tmp - x, j].max
else
tmp = 0
end
end
puts count
|
n, x = gets.split.map(&:to_i)
a = gets.split.map(&:to_i)
tmp = count = 0
a.each_cons(2) do |i, j|
if x < i + j - tmp
count += i + j - tmp - x
tmp = [i + j - tmp - x, j].min
else
tmp = 0
end
end
puts count
|
[
"misc.opposites",
"assignment.value.change",
"identifier.change"
] | 1,472,963
| 1,472,964
|
u104886851
|
ruby
|
p03862
|
n,x = gets.split.map!(&:to_i)
a = gets.split.map!(&:to_i)
ans = 0
pre = a.shift
a.each do |e|
if pre + e > x then
c = pre + e - x
ans += c
pre = e > c ? e - c : 0
end
end
puts ans
|
n,x = gets.split.map!(&:to_i)
a = gets.split.map!(&:to_i)
ans = 0
pre = a.shift
a.each do |e|
if pre + e > x then
c = pre + e - x
ans += c
pre = e > c ? e - c : 0
else
pre = e
end
end
puts ans
|
[
"assignment.add"
] | 1,473,116
| 1,473,117
|
u692254521
|
ruby
|
p03862
|
n, x = gets.split.map(&:to_i)
arr = gets.split.map(&:to_i)
count = 0
(n - 1).times do |i| #0からn-1まで回
next if arr[i] + a[i + 1] <= x
y = arr[i] + arr[i + 1] - x
count += y
arr[i + 1] = [0, arr[i + 1] - y].max
end
p ans
|
n, x = gets.split.map(&:to_i)
arr = gets.split.map(&:to_i)
count = 0
(n - 1).times do |i| #0からn-1まで回
next if arr[i] + arr[i + 1] <= x
y = arr[i] + arr[i + 1] - x
count += y
arr[i + 1] = [0, arr[i + 1] - y].max
end
p count
|
[
"identifier.change",
"control_flow.branch.if.condition.change",
"call.arguments.change"
] | 1,473,467
| 1,473,468
|
u259861571
|
ruby
|
p03862
|
n, goal = gets.split.map(&:to_i)
boxes = gets.split.map(&:to_i)
ans = 0
if boxes[0] > goal
ans += (goal - boxes[0])
boxes[0] = goal
end
(n - 1).times do |i|
candies = boxes[i] + boxes[i + 1]
if candies > goal
boxes[i + 1] -= (candies - goal)
ans += candies - goal
end
end
puts ans
|
n, goal = gets.split.map(&:to_i)
boxes = gets.split.map(&:to_i)
ans = 0
if boxes[0] > goal
ans += (boxes[0] - goal)
boxes[0] = goal
end
(n - 1).times do |i|
candies = boxes[i] + boxes[i + 1]
if candies > goal
boxes[i + 1] -= (candies - goal)
ans += candies - goal
end
end
puts ans
|
[
"expression.operation.binary.remove"
] | 1,473,503
| 1,473,504
|
u785521224
|
ruby
|
p03861
|
a,b,x=get.split.map(&:to_i)
p b / x - (a - 1) / x
|
a,b,x=gets.split.map(&:to_i)
p b / x - (a - 1) / x
|
[
"assignment.value.change",
"identifier.change"
] | 1,473,826
| 1,473,827
|
u553623615
|
ruby
|
p03861
|
a,b,x = gets.split.map(&:to_i)
if a % x != 0
a = x * (a / x + 1)
end
if b % x != 0
b = x * (b / x + 1)
end
puts (b - a) / x
|
a,b,x = gets.split.map(&:to_i)
if a % x != 0
a = x * (a / x + 1)
end
if b % x != 0
b = x * (b / x)
end
puts (b - a) / x + 1
|
[
"expression.operation.binary.remove"
] | 1,473,830
| 1,473,831
|
u409390792
|
ruby
|
p03863
|
s = gets.chomp!
l = s.length - 1
if (s[0] == s[l]) ^ (s.size % 2 == 1) then
puts "Fisrt"
else
puts "Second"
end
|
s = gets.chomp!
l = s.length - 1
if (s[0] == s[l]) ^ (s.size % 2 == 1) then
puts "First"
else
puts "Second"
end
|
[
"literal.string.change",
"call.arguments.change"
] | 1,473,930
| 1,473,931
|
u692254521
|
ruby
|
p03863
|
s=gets;puts s.size.odd? ^ s[0] == s[-2] ? 'First' : 'Second'
|
s=gets;puts s.size.odd?^(s[0]!=s[-2])?'First':'Second'
|
[
"control_flow.branch.if.condition.change",
"misc.opposites",
"expression.operator.compare.change"
] | 1,473,993
| 1,473,995
|
u214983738
|
ruby
|
p03863
|
a = gets;if (a[-2] != a[0] && a.length % 2 == 0) || (a[-2] == a[0] && a.length % 2 == 1) then puts "Second" else puts "First" end
|
a = gets;if (a[-2] != a[0] && a.length % 2 == 0) || (a[-2] == a[0] && a.length % 2 == 1) then puts "First" else puts "Second" end
|
[
"literal.string.change",
"call.arguments.change"
] | 1,474,033
| 1,474,034
|
u775993937
|
ruby
|
p03863
|
# 「先手と後手が最善を尽くす」とあるけど、実は最善も最悪も存在しない
# 先手と後手がどのような手を出しても、勝者は変わらない……と、予想
# 以上より、両者とも「取れる最初の文字を取り去る」
str = gets.chomp
c = 0
fl = 0
while true do
0.upto(str.length - 3) do |i|
if str[i] != str[i+2]
str.slice!(i+1)
c += 1
puts str
break
end
if i == str.length - 3
# 文字を削除できない
fl = 1
break
end
end
break if fl == 1
break if str.length == 2
end
if c % 2 == 0
puts "Second"
else
puts "First"
end
|
# 「先手と後手が最善を尽くす」とあるけど、実は最善も最悪も存在しない
# 先手と後手がどのような手を出しても、勝者は変わらない……と、予想
# 以上より、両者とも「取れる最初の文字を取り去る」
str = gets.chomp
c = 0
fl = 0
while true do
0.upto(str.length - 3) do |i|
if str[i] != str[i+2]
str.slice!(i+1)
c += 1
# puts str
break
end
if i == str.length - 3
# 文字を削除できない
fl = 1
break
end
end
break if fl == 1
break if str.length == 2
end
if c % 2 == 0
puts "Second"
else
puts "First"
end
|
[
"call.remove"
] | 1,474,044
| 1,474,045
|
u162612857
|
ruby
|
p03862
|
N,X = gets.split.map(&:to_i)
A = gets.split.map(&:to_i)
ans = 0
A.map! {|n| X <= n ? (ans += n - X; X) : n }
1.step(N-1,2) do |i|
n = A[i-1] + A[i]
if X < n
m = n - X
A[i] -= m
A[i-1] += A[i] if A[i] < 0
ans += m
end
end
puts ans
|
N,X = gets.split.map(&:to_i)
A = gets.split.map(&:to_i)
ans = 0
A.map! {|n| X <= n ? (ans += n - X; X) : n }
1.step(N-1) do |i|
n = A[i-1] + A[i]
if X < n
m = n - X
A[i] -= m
A[i-1] += A[i] if A[i] < 0
ans += m
end
end
puts ans
|
[
"call.arguments.change"
] | 1,474,065
| 1,474,066
|
u064100484
|
ruby
|
p03865
|
s=gets.chomp
if (s[0]==s[-1])^ s.length%2==1
puts :Second
else
puts :First
end
|
s=gets.chomp
if (s[0]==s[-1])^(s.length%2==0)
puts :Second
else
puts :First
end
|
[
"control_flow.branch.if.condition.change",
"literal.number.integer.change"
] | 1,474,849
| 1,474,850
|
u554838392
|
ruby
|
p03863
|
s = gets.chomp
ca = s.size()%2 == 0 and s[0] == s[-1]
cb = s.size()%2 != 0 and s[0] != s[-1]
ans = 'Second'
if ca or cb
ans = 'First'
end
puts ans
|
s = gets.chomp
ca = (s.size()%2 == 0 and s[0] == s[-1])
cb = (s.size()%2 != 0 and s[0] != s[-1])
ans = 'Second'
if ca or cb
ans = 'First'
end
puts ans
|
[] | 1,475,148
| 1,475,149
|
u714724786
|
ruby
|
p03863
|
s = gets.chomp
ans = (s[0] == s[-1] ^ s.size.even?) ? "Second" : "First"
puts ans
|
s = gets.chomp
ans = ((s[0] == s[-1]) ^ s.size.even?) ? "Second" : "First"
puts ans
|
[
"control_flow.branch.if.condition.change"
] | 1,475,172
| 1,475,173
|
u792512290
|
ruby
|
p03889
|
s=gets.chomp
a=s.gsub("b","1").gsub("d","2").gsub("p","3").gsub("q","4")
c=s.reverse.gsub("b","2").gsub("d","1").gsub("p","3").gsub("q","4")
if a==c
puts "Yes"
else
puts "No"
end
|
s=gets.chomp
a=s.gsub("b","1").gsub("d","2").gsub("p","3").gsub("q","4")
c=s.reverse.gsub("b","2").gsub("d","1").gsub("p","4").gsub("q","3")
if a==c
puts "Yes"
else
puts "No"
end
|
[
"literal.string.change",
"assignment.value.change",
"call.arguments.change"
] | 1,476,045
| 1,476,046
|
u292268276
|
ruby
|
p03893
|
def calc(l)
return 0 if l<=2
return calc((l-1)/2)+1
end
x = gets.to_i
l=2
h=10000
while l<h
c=(l+h+1)/2
y=calc(c)
if y<=x
l=c
else
h=c-1
end
end
p l
|
def calc(l)
return 0 if l<=2
return calc((l-1)/2)+1
end
x = gets.to_i
l=2
h=10000000000000
while l<h
c=(l+h+1)/2
y=calc(c)
if y<=x
l=c
else
h=c-1
end
end
p l
|
[
"literal.number.integer.change",
"assignment.value.change"
] | 1,476,503
| 1,476,504
|
u169354574
|
ruby
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.