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 9
values |
|---|---|---|---|---|---|---|---|
p03072 | n = gets.chomp.to_i
h = gets.chomp.split(' ').map(&:to_i)
max = -1
count = 0
h.each do |takasa|
if (takasa > max)
count += 1
max = takasa
end
end
puts count | n = gets.chomp.to_i
h = gets.chomp.split(' ').map(&:to_i)
max = -1
count = 0
h.each do |takasa|
if (takasa >= max)
count += 1
max = takasa
end
end
puts count | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 882,423 | 882,424 | u546441021 | ruby |
p03072 | n = gets.chomp.to_i
h = gets.chomp.split(' ').map!(&:to_i)
count = 0
(1..n).each do |a|
mountains = h[0,a]
puts mountains
if mountains.max == mountains.last
count += 1
end
end
puts count
| n = gets.chomp.to_i
h = gets.chomp.split(' ').map!(&:to_i)
count = 0
(1..n).each do |a|
mountains = h[0,a]
if mountains.max == mountains.last
count += 1
end
end
puts count
| [
"call.remove"
] | 882,634 | 882,635 | u932417742 | ruby |
p03072 | n = gets.to_i
h = gets.split.map(&:to_i)
sum = 0
max = 0
(n-1).times do |m|
if max <= h[m]
sum += 1
max = h[m]
end
end
puts sum | n = gets.to_i
h = gets.split.map(&:to_i)
sum = 0
max = 0
n.times do |m|
if max <= h[m]
sum += 1
max = h[m]
end
end
puts sum | [] | 882,766 | 882,767 | u654590131 | ruby |
p03072 | n = gets.to_i
h = gets.chomp.split.map(&:to_i)
cnt = 0
max = 0
h.each do |h|
if h >= max
max = h
cnt += 1
end
end
p count
| n = gets.to_i
h = gets.chomp.split.map(&:to_i)
cnt = 0
max = 0
h.each do |h|
if h >= max
max = h
cnt += 1
end
end
p cnt
| [
"identifier.change",
"call.arguments.change"
] | 882,783 | 882,784 | u921429241 | ruby |
p03072 | n = gets.to_i
hs = gets.split(" ").map(&:to_i)
count = 0
n.times do |i|
arr = hs[0..i-1]
arr_max = arr.max
puts arr.inspect
if arr_max <= hs[i] or i == 0
count += 1
end
end
puts count
| n = gets.to_i
hs = gets.split(" ").map(&:to_i)
count = 0
n.times do |i|
arr = hs[0..i-1]
arr_max = arr.max
if arr_max <= hs[i] or i == 0
count += 1
end
end
puts count
| [
"call.remove"
] | 882,953 | 882,954 | u030314915 | ruby |
p03072 | n = gets
h = gets.chomp!.split.map{|x| x.to_i}
cur, pre, cnt = 0, 0, 0
while cur=h.shift
if cur >= pre
cnt += 1
pre = cur
else
break
end
end
puts cnt
| n = gets
h = gets.chomp!.split.map{|x| x.to_i}
cur, pre, cnt = 0, 0, 0
while cur=h.shift
if cur >= pre
cnt += 1
pre = cur
end
end
puts cnt
| [
"control_flow.break.remove"
] | 882,968 | 882,969 | u732719646 | ruby |
p03072 | n = gets
h = gets.chomp!.split.map{|x| x.to_i}
cur, pre, cnt = 0, 0, 0
while cur=h.shift && cur > pre
cnt += 1
pre = cur
end
puts cnt | n = gets
h = gets.chomp!.split.map{|x| x.to_i}
cur, pre, cnt = 0, 0, 0
while cur=h.shift
if cur >= pre
cnt += 1
pre = cur
end
end
puts cnt
| [
"expression.operation.binary.change",
"expression.operator.compare.change"
] | 882,970 | 882,969 | u732719646 | ruby |
p03072 | n,*a=`dd`.split.map &:to_i
r=1;m=a[0]
(1...n).each{|i|m<=a[i]&&(m=a[i]&&r+=1)}
p r | n,*a=`dd`.split.map &:to_i
r=1;m=a[0]
(1...n).each{|i|m<=a[i]&&(m=a[i];r+=1)}
p r | [
"expression.operation.binary.change"
] | 883,122 | 883,123 | u280667879 | ruby |
p03072 | n,m,*a=`dd`.split.map &:to_i
r=1
(n-2).times{|i|m<=a[i]&&(m=a[i];r+=1)}
p r | n,m,*a=`dd`.split.map &:to_i
r=1
(n-1).times{|i|m<=a[i]&&(m=a[i];r+=1)}
p r | [
"literal.number.integer.change",
"expression.operation.binary.change"
] | 883,124 | 883,125 | u280667879 | ruby |
p03072 | n,m,*a=`dd`.split.map &:to_i
r=1
(1...n).each{|i|m<=a[i]&&(m=a[i];r+=1)}
p r | n,m,*a=`dd`.split.map &:to_i
r=1
(n-1).times{|i|m<=a[i]&&(m=a[i];r+=1)}
p r | [
"identifier.change"
] | 883,126 | 883,125 | u280667879 | ruby |
p03073 | s = gets.chomp
gu, ki = [], []
s.length.times do |i|
gu << s[i].to_i if i%2 == 0
ki << s[i].to_i if i%2 == 1
end
gu_sum = !gu.empty? ? gu.inject(&:+) : 0
ki_sum = !ki.empty? ? ki.inject(&:+) : 0
plan1 = gu.length - gu_sum + ki_sum
plan2 = ki.length - ki_sum + gu_sum
ans = [plan1, plan2].min |
s = gets.chomp
gu, ki = [], []
s.length.times do |i|
gu << s[i].to_i if i%2 == 0
ki << s[i].to_i if i%2 == 1
end
gu_sum = !gu.empty? ? gu.inject(&:+) : 0
ki_sum = !ki.empty? ? ki.inject(&:+) : 0
plan1 = gu.length - gu_sum + ki_sum
plan2 = ki.length - ki_sum + gu_sum
ans = [plan1, plan2].min
puts ans | [
"call.add"
] | 884,003 | 884,004 | u452808393 | ruby |
p03073 | def cc
s = gets.chomp
l = s.length
if l == 1
puts 1
exit
end
ss = s.split(//).uniq
if ss.length == 1
puts l/2
exit
end
# puts s
cnt = 0
for i in 2..l
if s[i-2] == s[i-1]
s[i-1] = (1 - s[i-1].to_i).to_s
cnt += 1
end
end
# puts s
puts cnt
end
cc
| def cc
s = gets.chomp
l = s.length
if l == 1
puts 0
exit
end
ss = s.split(//).uniq
if ss.length == 1
puts l/2
exit
end
# puts s
cnt = 0
for i in 2..l
if s[i-2] == s[i-1]
s[i-1] = (1 - s[i-1].to_i).to_s
cnt += 1
end
end
# puts s
puts cnt
end
cc | [
"literal.number.integer.change",
"call.arguments.change"
] | 884,034 | 884,035 | u510887956 | ruby |
p03073 | s = gets.chars.map(&:to_i)
s0 = 0
s1 = 0
f = 0
s.each do |n|
if f.zero?
s0 += 1 unless n.zero?
s1 += 1 if n.zero?
else
s0 += 1 if n.zero?
s1 += 1 unless n.zero?
end
f = 1 - f
end
puts [s0, s1].min | s = gets.chomp.chars.map(&:to_i)
s0 = 0
s1 = 0
f = 0
s.each do |n|
if f.zero?
s0 += 1 unless n.zero?
s1 += 1 if n.zero?
else
s0 += 1 if n.zero?
s1 += 1 unless n.zero?
end
f = 1 - f
end
puts [s0, s1].min | [
"call.add"
] | 884,316 | 884,317 | u325709450 | ruby |
p03073 | S = gets.chomp
b = 0
w = 0
(S.length-1).times do |i|
if i.even?
if S[i] == '0'
b += 1
else
w += 1
end
else
if S[i] == '0'
w += 1
else
b += 1
end
end
end
puts [w,b].min | S = gets.chomp
b = 0
w = 0
(S.length).times do |i|
if i.even?
if S[i] == '0'
b += 1
else
w += 1
end
else
if S[i] == '0'
w += 1
else
b += 1
end
end
end
puts [w,b].min | [
"expression.operation.binary.remove"
] | 884,348 | 884,349 | u244087909 | ruby |
p03073 | s = STDIN.gets.chomp.split("")
if s.size == 1
puts 0
exit
end
diff1 = 0
diff2 = 0
cnt = 0
s.each{|c|
if (cnt & 1) == 0
if c != "0"
diff1 += 1
else
diff2 += 1
end
else
if c != "1"
diff1 += 1
else
diff2 += 1
end
end
}
if diff1 < diff2
puts diff1
else
puts diff2
end | s = STDIN.gets.chomp.split("")
if s.size == 1
puts 0
exit
end
diff1 = 0
diff2 = 0
cnt = 0
s.each{|c|
if (cnt & 1) == 0
if c != "0"
diff1 += 1
else
diff2 += 1
end
else
if c != "1"
diff1 += 1
else
diff2 += 1
end
end
cnt += 1
}
if diff1 < diff2
puts diff1
else
puts diff2
end | [] | 884,524 | 884,525 | u561201295 | ruby |
p03073 | S = gets.to_s.split("")
ans = 0
S.reduce("") { |a, s|
next if a == ""
nx = s
if s == a
ans += 1
nx = s == '0' ? '1' : '0'
end
nx
}
puts ans
| S = gets.to_s.split("")
ans = 0
S.reduce("") { |a, s|
next s if a == ""
nx = s
if s == a
ans += 1
nx = s == '0' ? '1' : '0'
end
nx
}
puts ans
| [
"call.arguments.change"
] | 884,572 | 884,573 | u085342011 | ruby |
p03073 | count = 0
ary = gets.chop.chars.map(&:to_i)
first = ary[0]
odd = ary.select.with_index{|e, i| i % 2 == 0}
even = ary.select.with_index{|e, i| i % 2 == 1}
if first == 1
odd.each do |odd_ele|
if odd_ele != 1
count += 1
end
end
even.each do |even_ele|
if even_ele != 0
count += 1
end
end
end
if first == 0
odd.each do |odd_ele|
if odd_ele != 0
count += 1
end
end
even.each do |even_ele|
if even_ele != 1
p even_ele
count += 1
end
end
end
p count | count = 0
ary = gets.chop.chars.map(&:to_i)
first = ary[0]
odd = ary.select.with_index{|e, i| i % 2 == 0}
even = ary.select.with_index{|e, i| i % 2 == 1}
if first == 1
odd.each do |odd_ele|
if odd_ele != 1
count += 1
end
end
even.each do |even_ele|
if even_ele != 0
count += 1
end
end
end
if first == 0
odd.each do |odd_ele|
if odd_ele != 0
count += 1
end
end
even.each do |even_ele|
if even_ele != 1
count += 1
end
end
end
p count | [
"call.remove"
] | 884,616 | 884,617 | u819939299 | ruby |
p03069 | gets
s=gets.chomp
b=0
w=s.count(?.)
p ([w]+s.chars.map{|c|
c==?. ? b+=1 : w-=1
b+w
}).min | gets
s=gets.chomp
b=0
w=s.count(?.)
p ([w]+s.chars.map{|c|
c==?. ? w-=1 : b+=1
b+w
}).min | [] | 884,679 | 884,680 | u280667879 | ruby |
p03069 | n = gets.chomp.to_i
s = gets.chomp
min = 2*(10**5)
kuro=[]
shiro=[]
kuro_count=0
shiro_count=0
n.times do|i|
if s[i] == "#" then
kuro_count+=1
end
if s[(n-1)-i] == "." then
shiro_count+=1
end
kuro << kuro_count
shiro.unshift(shiro_count)
end
#puts "shiro = #{shiro}"
#puts "kuro = #{kuro}"
(n-1).times do |i|
m = shiro[i] + kuro[i+1]
if min>m then
min=m
end
end
#puts "min=#{min}"
puts [min,kuro[n-1],shiro[0]].min
| n = gets.chomp.to_i
s = gets.chomp
min = 2*(10**5)
kuro=[]
shiro=[]
kuro_count=0
shiro_count=0
n.times do|i|
if s[i] == "#" then
kuro_count+=1
end
if s[(n-1)-i] == "." then
shiro_count+=1
end
kuro << kuro_count
shiro.unshift(shiro_count)
end
#puts "shiro = #{shiro}"
#puts "kuro = #{kuro}"
(n-1).times do |i|
m = shiro[i+1] + kuro[i]
if min>m then
min=m
end
end
#puts "min=#{min}"
puts [min,kuro[n-1],shiro[0]].min
| [
"expression.operation.binary.remove"
] | 884,802 | 884,803 | u281662621 | ruby |
p03069 | n = gets.chomp.to_i
s = gets.chomp
stack = []
if (s[0] == '#')
stack.push(0)
end
tar = s[0]
cnt = 0
min = 0
for i in 1..n do
if (s[i-1]==tar)
cnt += 1
else
if (tar == ".")
min += cnt
end
tar = s[i-1]
stack.push(cnt)
cnt = 1
end
end
stack.push(cnt)
if (s[n-1] == '.')
stack.push(0)
end
min -= stack[0]
now = min
1.step(stack.size-2,2) do |i|
now += stack[i]
now -= stack[i+1]
if (min > now)
min = now
end
end
p min
| n = gets.chomp.to_i
s = gets.chomp
stack = []
if (s[0] == '#')
stack.push(0)
end
tar = s[0]
cnt = 0
min = 0
for i in 1..n do
if (s[i-1]==tar)
cnt += 1
else
if (tar == ".")
min += cnt
end
tar = s[i-1]
stack.push(cnt)
cnt = 1
end
end
stack.push(cnt)
if (s[n-1] == '.')
stack.push(0)
min += cnt
end
min -= stack[0]
# p stack
# p min
now = min
1.step(stack.size-3,2) do |i|
now += stack[i]
now -= stack[i+1]
# p now
if (min > now)
min = now
end
end
p min | [
"literal.number.integer.change",
"call.arguments.change",
"expression.operation.binary.change"
] | 884,823 | 884,824 | u988912858 | ruby |
p03073 | require "pry"
n = gets.chomp
len = n.length
kouho_1 = Array.new(len,0).map.with_index{|n,i| i % 2 == 0? n = 1 : n = 0}
kouho_2 = Array.new(len,0).map.with_index{|n,i| i % 2 == 0? n = 0 : n = 1}
diff1 = 0
diff2 = 0
kouho_1.each_with_index do |a,i|
if a.to_s != n[i]
diff1 += 1
end
end
kouho_2.each_with_index do |a,i|
if a.to_s != n[i]
diff2 += 1
end
end
puts diff1 >= diff2 ? diff2 : diff1
|
n = gets.chomp
len = n.length
kouho_1 = Array.new(len,0).map.with_index{|n,i| i % 2 == 0? n = 1 : n = 0}
kouho_2 = Array.new(len,0).map.with_index{|n,i| i % 2 == 0? n = 0 : n = 1}
diff1 = 0
diff2 = 0
kouho_1.each_with_index do |a,i|
if a.to_s != n[i]
diff1 += 1
end
end
kouho_2.each_with_index do |a,i|
if a.to_s != n[i]
diff2 += 1
end
end
puts diff1 >= diff2 ? diff2 : diff1 | [
"call.remove"
] | 884,934 | 884,935 | u991846372 | ruby |
p03073 | h=gets().chars.map(&:to_i)
cnt=0;
h.each_with_index{|x,i|
cnt+=1 if (x == i%2)
}
p [h.size-cnt,cnt].min | h=gets().chomp.chars.map(&:to_i)
cnt=0;
h.each_with_index{|x,i|
cnt+=1 if (x == i%2)
}
p [h.size-cnt,cnt].min | [
"call.add"
] | 884,989 | 884,990 | u702482655 | ruby |
p03073 | h=gets().chars.map(&:to_i);
cnt=0;
h.each_with_index{|x,i|
cnt+=1 if (x == i%2);
}
print [h.size-cnt,cnt].min | h=gets().chomp.chars.map(&:to_i)
cnt=0;
h.each_with_index{|x,i|
cnt+=1 if (x == i%2)
}
p [h.size-cnt,cnt].min | [
"call.add",
"identifier.change"
] | 884,991 | 884,990 | u702482655 | ruby |
p03073 | tile = get.split.map(&:to_i)
cnt0 = 0
cnt1 = 0
tile.size.times do |i|
if tile[i] == 0
if i % 2 == 0
cnt1 += 1
else
cnt0 += 1
end
else #tile[i] == 1
if i % 2 == 0
cnt0 += 1
else
cnt1 += 1
end
end
end
puts [cnt0, cnt1].min
| tile = gets.chomp.chars.map(&:to_i)
cnt0 = 0
cnt1 = 0
tile.size.times do |i|
if tile[i] == 0
if i % 2 == 0
cnt1 += 1
else
cnt0 += 1
end
else #tile[i] == 1
if i % 2 == 0
cnt0 += 1
else
cnt1 += 1
end
end
end
puts [cnt0, cnt1].min
| [
"assignment.value.change",
"identifier.change",
"call.add"
] | 885,008 | 885,009 | u785521224 | ruby |
p03073 | s = gets.chomp
n = s.length
kazu = 0
for i in 0..(n-1)
kazu += 1 if s[i] != i%2
end
if n - kazu > kazu
puts kazu
else
puts n - kazu
end
| s = gets.chomp
n = s.length
kazu = 0
for i in 0..(n-1)
kazu += 1 if s[i].to_i != i%2
end
if n - kazu > kazu
puts kazu
else
puts n - kazu
end
| [
"control_flow.branch.if.condition.change",
"call.add"
] | 885,014 | 885,015 | u562331708 | ruby |
p03073 | i = gets.split("").map(&:to_i)
k=0
l=0
i.count.times{|n|
if i[n] != n%2 then
k +=1
end
m = n+1
if i[n] != m%2 then
l +=1
end
}
if k > l then
print l
else
print k
end
| i = gets.split("").map(&:to_i)
k=0
l=0
(i.count-1).times{|n|
if i[n] != n%2 then
k +=1
end
m = n+1
if i[n] != m%2 then
l +=1
end
}
if k > l then
print l
else
print k
end | [] | 885,028 | 885,029 | u312004378 | ruby |
p03073 | p (1...gets.size).count{|i|$_[i].hex!=i%2^$_[0].hex} | p (1...gets.size-1).count{|i|$_[i].hex!=i%2^$_[0].hex} | [
"expression.operation.binary.add"
] | 885,032 | 885,033 | u656771711 | ruby |
p03073 | p (1...(S=gets).size).count{|i|S[i]!=((i%2)^(S[0]=='1'?1:0)).to_s} | p (1...(S=gets).size-1).count{|i|S[i]!=((i%2)^(S[0]=='1'?1:0)).to_s} | [
"expression.operation.binary.add"
] | 885,034 | 885,035 | u656771711 | ruby |
p03074 | def gs() gets.chomp end
def gi() gets.to_i end
def gsmi() gets.chomp.split.map(&:to_i) end
def desc(ar) ar.sort!{|x,y|y<=>x} end
def min(a,b) a<=b ? a : b end
def max(a,b) a>=b ? a : b end
def sum(ar) ar.inject(:+) end
N,K = gsmi
S = gs
tmp = []
cnt = 0
now = 1
S.each_char do |s|
if s.to_i==now
cnt += 1
else
tmp << cnt
now = 1 - now
cnt = 1
end
end
tmp << cnt if cnt!=0
tmp << 0 if S[-1] == '0'
ans = 0
left = 0
right = 2*K
if right > tmp.size
ans = sum tmp
else
now = sum tmp[left..right]
end
until (right+2) > tmp.size do
now -= (tmp[left] + tmp[left+1])
now += tmp[right+1] + tmp[right+2]
left += 2
right += 2
ans = max(ans,now)
end
puts ans | def gs() gets.chomp end
def gi() gets.to_i end
def gsmi() gets.chomp.split.map(&:to_i) end
def desc(ar) ar.sort!{|x,y|y<=>x} end
def min(a,b) a<=b ? a : b end
def max(a,b) a>=b ? a : b end
def sum(ar) ar.inject(:+) end
N,K = gsmi
S = gs
tmp = []
cnt = 0
now = 1
S.each_char do |s|
if s.to_i==now
cnt += 1
else
tmp << cnt
now = 1 - now
cnt = 1
end
end
tmp << cnt if cnt!=0
tmp << 0 if S[-1] == '0'
ans = 0
left = 0
right = 2*K
if right > tmp.size
ans = sum tmp
else
now = sum tmp[left..right]
ans = now
end
until (right+2) > tmp.size do
now -= (tmp[left] + tmp[left+1])
now += tmp[right+1] + tmp[right+2]
left += 2
right += 2
ans = max(ans,now)
end
puts ans | [
"assignment.add"
] | 885,311 | 885,312 | u600153083 | ruby |
p03071 | a,b=gets.split.map(&:to_i).sort
p a==b ?2*a:[a..b][-2,2].sum | a,b=gets.split.map(&:to_i).sort
p a==b ?2*a:[*a..b][-2,2].sum | [
"call.arguments.change"
] | 885,763 | 885,764 | u966810027 | ruby |
p03075 | a=gets.to_i
gets
gets
gets
e=gets.to_i
k=gets.to_i
puts e-a <=k ? :Yes: :No
| a=gets.to_i
gets
gets
gets
e=gets.to_i
k=gets.to_i
puts e-a <=k ? "Yay!": ":("
| [
"call.arguments.change"
] | 886,232 | 886,233 | u977506075 | ruby |
p03075 | a = gets.to_i
b = gets.to_i
c = gets.to_i
d = gets.to_i
e = gets.to_i
k = gets.to_i
if k < e-a
puts "Yay!"
else
puts ":("
end | a = gets.to_i
b = gets.to_i
c = gets.to_i
d = gets.to_i
e = gets.to_i
k = gets.to_i
if k < e-a
puts ":("
else
puts "Yay!"
end | [
"call.remove",
"call.add"
] | 886,465 | 886,466 | u182277075 | ruby |
p03075 | arr = []
5.times do |i|
a = gets.chomp.to_i
arr << a
end
k = gets.chomp.to_i
kkk = []
arr.each do |f|
arr.each do |k|
kkk << (f - k).abs
end
end
until kkk == []
aaa = kkk.pop
if aaa >= k
puts ":("
exit
end
end
puts "Yay!" |
arr = []
5.times do |i|
a = gets.chomp.to_i
arr << a
end
k = gets.chomp.to_i
kkk = []
arr.each do |f|
arr.each do |k|
kkk << (f - k).abs
end
end
until kkk == []
aaa = kkk.pop
if aaa > k
puts ":("
exit
end
end
puts "Yay!" | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 886,485 | 886,486 | u412789323 | ruby |
p03075 | arr = []
5.times do |i|
a = gets.chomp.to_i
arr << a
end
k = gets.chomp.to_i
kkk = []
arr.each do |f|
arr.each do |k|
kkk << (f - k).abs
end
end
until kkk == []
if kkk.pop >= k
puts ":("
exit
end
end
puts "Yay!"
|
arr = []
5.times do |i|
a = gets.chomp.to_i
arr << a
end
k = gets.chomp.to_i
kkk = []
arr.each do |f|
arr.each do |k|
kkk << (f - k).abs
end
end
until kkk == []
aaa = kkk.pop
if aaa > k
puts ":("
exit
end
end
puts "Yay!" | [
"assignment.variable.change",
"control_flow.branch.if.condition.change"
] | 886,487 | 886,486 | u412789323 | ruby |
p03075 | a=gets.to_i
4.times do
b=gets.to_i
end
k=gets.to_i
puts (b-a<=k)?"Yay!":":("
| a=gets.to_i
b=0
4.times do
b=gets.to_i
end
k=gets.to_i
puts (b-a<=k)?"Yay!":":("
| [
"assignment.add"
] | 886,496 | 886,497 | u803684095 | ruby |
p03075 | a=gets.to_i
5.times do
b=gets.to_i
end
k=gets.to_i
puts (b-a<=k)?"Yay!":":("
| a=gets.to_i
b=0
4.times do
b=gets.to_i
end
k=gets.to_i
puts (b-a<=k)?"Yay!":":("
| [
"assignment.variable.change",
"identifier.replace.add",
"literal.replace.remove",
"call.add"
] | 886,498 | 886,497 | u803684095 | ruby |
p03075 | a = gets.to_i
b = gets.to_i
c = gets.to_i
d = gets.to_i
e = gets.to_i
k = gets.to_i
puts (e - a) <= k ? 'Yey!' : ':('
| a = gets.to_i
b = gets.to_i
c = gets.to_i
d = gets.to_i
e = gets.to_i
k = gets.to_i
puts (e - a) <= k ? 'Yay!' : ':('
| [
"literal.string.change",
"call.arguments.change"
] | 886,973 | 886,974 | u641383521 | ruby |
p03075 | /n,a,b=gets.split.map(&:to_i)/
/.sort/
/S = gets.chomp.chars/
a=gets.to_i
b=gets.to_i
c=gets.to_i
d=gets.to_i
e=gets.to_i
k=gets.to_i
count=0
if(b-a>k||c-b>k||d-c>k||e-d>k)
puts ":("
else
puts "Yay!"
end | /n,a,b=gets.split.map(&:to_i)/
/.sort/
/S = gets.chomp.chars/
a=gets.to_i
b=gets.to_i
c=gets.to_i
d=gets.to_i
e=gets.to_i
k=gets.to_i
count=0
if(e-a>k||e-b>k||e-c>k||e-d>k)
puts ":("
else
puts "Yay!"
end | [
"identifier.change",
"control_flow.branch.if.condition.change"
] | 887,123 | 887,124 | u758406624 | ruby |
p03074 | require "pry"
n,k = gets.split(" ").map(&:to_i)
s = gets.chomp
a = s.split('0').map(&:length)
b = s.split('1').map(&:length)
a.delete(0)
b.delete(0)
c = []
c << 0 if s[0] == '0'
while !a.empty? || !b.empty? do
if s[0] == '1'
c << a.shift
c << b.shift unless b.empty?
else
c << b.shift
c << a.shift unless a.empty?
end
end
c << 0 if c.size % 2 == 0
r = [0]
c.size.times do |i|
r[i + 1] = r[i] + c[i]
end
ans = 0
add = 2 * k + 1
0.step(by: 2, to: c.size - 1) do |i|
left = i
right = [(i + add), c.size].min
tmp = r[right] - r[left]
ans = [tmp, ans].max
end
puts ans
| n,k = gets.split(" ").map(&:to_i)
s = gets.chomp
a = s.split('0').map(&:length)
b = s.split('1').map(&:length)
a.delete(0)
b.delete(0)
c = []
c << 0 if s[0] == '0'
while !a.empty? || !b.empty? do
if s[0] == '1'
c << a.shift
c << b.shift unless b.empty?
else
c << b.shift
c << a.shift unless a.empty?
end
end
c << 0 if c.size % 2 == 0
r = [0]
c.size.times do |i|
r[i + 1] = r[i] + c[i]
end
ans = 0
add = 2 * k + 1
0.step(by: 2, to: c.size - 1) do |i|
left = i
right = [(i + add), c.size].min
tmp = r[right] - r[left]
ans = [tmp, ans].max
end
puts ans
| [
"call.remove"
] | 887,266 | 887,267 | u351482714 | ruby |
p03075 | a,b,c,d,e,k = gets.split.map(&:to_i)
if (e - a <= k) && (e - b <= k) && (e - c <= k) && (e - d <= k)
puts "Yay!"
else
puts ":("
end
| a, b, c, d, e, k = 6.times.map { gets.to_i }
if (e - a <= k) && (e - b <= k) && (e - c <= k) && (e - d <= k)
puts "Yay!"
else
puts ":("
end | [
"assignment.value.change",
"identifier.replace.remove",
"literal.replace.add",
"identifier.change"
] | 887,485 | 887,486 | u012110567 | ruby |
p03075 | a,b,c,d,e,k = gets.split.map(&:to_i)
if e - a <= k
puts "Yay!"
else
puts ":("
end
| a, b, c, d, e, k = 6.times.map { gets.to_i }
if e - a <= k
puts "Yay!"
else
puts ":("
end | [
"assignment.value.change",
"identifier.replace.remove",
"literal.replace.add",
"identifier.change"
] | 887,487 | 887,488 | u012110567 | ruby |
p03075 | a,b,c,d,e,k = gets.split.map(&:to_i)
if e - a <= k
puts "Yay!"
else
puts ":("
end
| a, b, c, d, e, k = 6.times.map { gets.to_i }
if e - a <= k
puts "Yay!"
else
puts ":("
end | [
"assignment.value.change",
"identifier.replace.remove",
"literal.replace.add",
"identifier.change"
] | 887,489 | 887,488 | u012110567 | ruby |
p03075 | d = readlines.map(&:to_i)
puts d[4] - d[0] < d[5] ? "Yay!" : ":(" | d = readlines.map(&:to_i)
puts d[4] - d[0] <= d[5] ? "Yay!" : ":(" | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 887,864 | 887,865 | u091810847 | ruby |
p03075 | a=[]
5.times{|n|
a[n]=gets.to_i
}
s = a.sort
max = gets.to_i
if s[4]-s[0]>max then
puts":("
else
puts"Yey!"
end
| a=[]
5.times{|n|
a[n]=gets.to_i
}
s = a.sort
max = gets.to_i
if s[4]-s[0]>max then
puts":("
else
puts"Yay!"
end | [
"literal.string.change",
"call.arguments.change"
] | 887,929 | 887,930 | u606976120 | ruby |
p03075 | a = []
5.times do |i|
a[i] = gets.to_i
end
k = gets.to_i
dis = []
5.times do |i|
5.times do |j|
dis.push((a[i]-a[j]).abs)
end
end
success = true
dis.each do |d|
if d < k then
puts ":("
success = false
break
end
end
puts 'Yay!' if success
| a = []
5.times do |i|
a[i] = gets.to_i
end
k = gets.to_i
dis = []
5.times do |i|
5.times do |j|
dis.push((a[i]-a[j]).abs)
end
end
success = true
dis.each do |d|
if d > k then
puts ":("
success = false
break
end
end
puts 'Yay!' if success
| [
"misc.opposites",
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 887,945 | 887,946 | u670006196 | ruby |
p03075 | input_lines = readlines
length = input_lines.length
i = 0
while i < length
input_lines[i] = input_lines[i].chomp.to_i
i += 1
end
if (input_lines[4] -input_lines[0]) > input_lines[5]
print "Yay!"
else
print ":("
end | input_lines = readlines
length = input_lines.length
i = 0
while i < length
input_lines[i] = input_lines[i].chomp.to_i
i += 1
end
if (input_lines[4] -input_lines[0]) > input_lines[5]
print ":("
else
print "Yay!"
end | [
"call.remove",
"call.add"
] | 887,990 | 887,991 | u905276896 | ruby |
p03075 | input_lines = readlines
length = input_lines.length
i = 0
while i < length
input_lines[i] = input_lines[i].chomp.to_i
i += 1
end
if input_lines[4] -input_lines[0] > input_lines[5]
print "Yay!"
else
print ":("
end | input_lines = readlines
length = input_lines.length
i = 0
while i < length
input_lines[i] = input_lines[i].chomp.to_i
i += 1
end
if (input_lines[4] -input_lines[0]) > input_lines[5]
print ":("
else
print "Yay!"
end | [
"control_flow.branch.if.condition.change",
"literal.string.change",
"call.arguments.change"
] | 887,992 | 887,991 | u905276896 | ruby |
p03075 | input_lines = []
5.times do
input_lines << gets.chomp.to_i
end
k = gets.chomp.to_i
if (input_lines[4] -input_lines[0]) > k
print "Yay!"
else
print ":("
end | input_lines = []
5.times do
input_lines << gets.chomp.to_i
end
k = gets.chomp.to_i
if (input_lines[4] -input_lines[0]) > k
print ":("
else
print "Yay!"
end | [
"call.remove",
"call.add"
] | 887,993 | 887,994 | u905276896 | ruby |
p03075 | ary=$stdin.read.lines.map(&:to_i)
5.times do |i|
5.times do |j|
if (ary[i]-ary[j])>ary[5]
puts ":("
exit
end
end
end
puts "Yey!"
| ary=$stdin.read.lines.map(&:to_i)
5.times do |i|
5.times do |j|
if (ary[i]-ary[j])>ary[5]
puts ":("
exit
end
end
end
puts "Yay!" | [
"literal.string.change",
"call.arguments.change"
] | 888,037 | 888,038 | u622469330 | ruby |
p03075 | a, b, c, d, e, k = STDIN.read.lines.map(&:chomp).map(&:to_i)
if e - a <= k then
p "Yay!"
else
p ":("
end | a, b, c, d, e, k = STDIN.read.lines.map(&:chomp).map(&:to_i)
if e - a <= k then
puts 'Yay!'
else
puts ':('
end | [
"literal.string.change",
"call.arguments.change"
] | 888,091 | 888,092 | u231458241 | ruby |
p03075 | as = 5.times.map{gets.to_i}
p as
k = gets.to_i
puts as[4] - as[0] > k ? ':(' : 'Yay!'
| as = 5.times.map{gets.to_i}
k = gets.to_i
puts as[4] - as[0] > k ? ':(' : 'Yay!'
| [
"call.remove"
] | 888,118 | 888,119 | u124214522 | ruby |
p03075 |
input = readlines
input.each{|num|
num = num.chomp!
}
i = 0
stat = "0"
while i < (input.length-1)
j = i + 1
while j < (input.length-1)
dis = input[j].to_i - input[i].to_i
if dis > input[input.length].to_i
stat = ":("
elsif stat != ":("
stat = "Yay!"
end
j = j + 1
end
i = i + 1
end
print stat | input = readlines
input.each{|num|
num = num.chomp!
}
i = 0
stat = "0"
while i < (input.length-1)
j = i + 1
while j < (input.length-1)
dis = input[j].to_i - input[i].to_i
if dis > input[input.length-1].to_i
stat = ":("
elsif stat != ":("
stat = "Yay!"
end
j = j + 1
end
i = i + 1
end
print stat
| [
"control_flow.branch.if.condition.change"
] | 888,323 | 888,324 | u387233198 | ruby |
p03075 | temp = []
6.times do
temp << gets.chomp.to_i
end
if (temp[4] - temp[1]) <= temp[5]
puts "Yay!"
else
puts ":("
end
| temp = []
6.times do
temp << gets.chomp.to_i
end
if (temp[4] - temp[0]) <= temp[5]
puts "Yay!"
else
puts ":("
end
| [
"literal.number.integer.change",
"variable_access.subscript.index.change",
"control_flow.branch.if.condition.change"
] | 888,464 | 888,465 | u072284094 | ruby |
p03075 | temp = []
6.times do
temp << gets.chomp.to_i
end
if (temp[4] - temp[1]) >= temp[5]
puts "Yay!"
else
puts ":("
end
| temp = []
6.times do
temp << gets.chomp.to_i
end
if (temp[4] - temp[0]) <= temp[5]
puts "Yay!"
else
puts ":("
end
| [
"literal.number.integer.change",
"variable_access.subscript.index.change",
"control_flow.branch.if.condition.change",
"misc.opposites",
"expression.operator.compare.change"
] | 888,466 | 888,465 | u072284094 | ruby |
p03075 | temp = []
6.times do
temp << gets.chomp.to_i
end
if (temp[4] - temp[1]) > temp[5]
puts "Yay!"
else
puts ":("
end
| temp = []
6.times do
temp << gets.chomp.to_i
end
if (temp[4] - temp[0]) <= temp[5]
puts "Yay!"
else
puts ":("
end
| [
"literal.number.integer.change",
"variable_access.subscript.index.change",
"control_flow.branch.if.condition.change",
"expression.operator.compare.change"
] | 888,467 | 888,465 | u072284094 | ruby |
p03075 | a = gets.to_i
4.times {|k|
tmp = gets
}
b = gets.to_i
diff = gets.to_i
puts b-a>diff ? ":(" : "Yay!" | a = gets.to_i
3.times {|k|
tmp = gets
}
b = gets.to_i
diff = gets.to_i
puts b-a>diff ? ":(" : "Yay!" | [
"literal.number.integer.change"
] | 888,578 | 888,579 | u422581886 | ruby |
p03075 | antennas = []
5.times do
antennas << gets.chomp.to_i
end
k = gets.chomp.to_i
min = antennas.min
def determine(antennas, min, k)
return 'Yah!' if antennas.empty?
max = antennas.delete(antennas.max)
return ':(' if max - min > k
determine(antennas, min, k)
end
puts determine(antennas, min, k)
| antennas = []
5.times do
antennas << gets.chomp.to_i
end
k = gets.chomp.to_i
min = antennas.min
def determine(antennas, min, k)
return 'Yay!' if antennas.empty?
max = antennas.delete(antennas.max)
return ':(' if max - min > k
determine(antennas, min, k)
end
puts determine(antennas, min, k)
| [
"literal.string.change",
"call.arguments.change",
"function.return_value.change"
] | 888,705 | 888,706 | u207412310 | ruby |
p03075 | antennas = []
5.times do
antennas << gets.chomp.to_i
end
k = gets.chomp.to_i
min = antennas.min
def determine(antennas, min, k)
return 'Yah!' if antennas.empty?
max = antennas.delete(antennas.max)
return ':(' if max - min >= k
determine(antennas, min, k)
end
puts determine(antennas, min, k)
| antennas = []
5.times do
antennas << gets.chomp.to_i
end
k = gets.chomp.to_i
min = antennas.min
def determine(antennas, min, k)
return 'Yay!' if antennas.empty?
max = antennas.delete(antennas.max)
return ':(' if max - min > k
determine(antennas, min, k)
end
puts determine(antennas, min, k)
| [
"literal.string.change",
"call.arguments.change",
"function.return_value.change",
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 888,707 | 888,706 | u207412310 | ruby |
p03075 | antena = Array.new
5.times{
antena << gets.to_i
}
k = gets.to_i
if antena.combination(2).any?{|a, b|(a - b).abs >= k }
puts ':('
else
puts 'Yay!'
end
| antena = Array.new
5.times{
antena << gets.to_i
}
k = gets.to_i
if antena.combination(2).any?{|a, b|(a - b).abs > k }
puts ':('
else
puts 'Yay!'
end
| [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 888,723 | 888,724 | u663517263 | ruby |
p03075 | data = DATA.read.split(/\s+/).map(&:to_i)
k, a, b = data.pop, data.shift, data.pop
puts (b - a <= k) ? 'Yay!' : ':(' | data = STDIN.read.split(/\s+/).map(&:to_i)
k, a, b = data.pop, data.shift, data.pop
puts (b - a <= k) ? 'Yay!' : ':(' | [
"assignment.value.change"
] | 888,873 | 888,874 | u937432912 | ruby |
p03075 | a = gets.chomp.to_i
b = gets.chomp.to_i
c = gets.chomp.to_i
d = gets.chomp.to_i
e = gets.chomp.to_i
k = gets.chomp.to_i
array = [a, b, c, d, e]
array.each do |x|
array.each do |y|
next if x >= y
if y - x > k
puts ':('
exit
end
end
end
puts 'Yey!'
| a = gets.chomp.to_i
b = gets.chomp.to_i
c = gets.chomp.to_i
d = gets.chomp.to_i
e = gets.chomp.to_i
k = gets.chomp.to_i
array = [a, b, c, d, e]
array.each do |x|
array.each do |y|
next if x >= y
if y - x > k
puts ':('
exit
end
end
end
puts 'Yay!'
| [
"literal.string.change",
"call.arguments.change"
] | 888,882 | 888,883 | u199877973 | ruby |
p03075 | a = gets.chomp.to_i
b = gets.chomp.to_i
c = gets.chomp.to_i
d = gets.chomp.to_i
e = gets.chomp.to_i
k = gets.chomp.to_i
array = [a, b, c, d, e]
array.each do |x|
array.each do |y|
next if x == y
if y - x > k
puts ':('
exit
end
end
end
puts 'Yey!'
| a = gets.chomp.to_i
b = gets.chomp.to_i
c = gets.chomp.to_i
d = gets.chomp.to_i
e = gets.chomp.to_i
k = gets.chomp.to_i
array = [a, b, c, d, e]
array.each do |x|
array.each do |y|
next if x >= y
if y - x > k
puts ':('
exit
end
end
end
puts 'Yay!'
| [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change",
"literal.string.change",
"call.arguments.change"
] | 888,884 | 888,883 | u199877973 | ruby |
p03075 | a = 5.times.map{gets.to_i}
k = gets.to_i
if a[4] - a[0] <= k then
puts "Yay"
else
puts ":("
end | a = 5.times.map{gets.to_i}
k = gets.to_i
if a[4] - a[0] <= k then
puts "Yay!"
else
puts ":("
end | [
"literal.string.change",
"call.arguments.change"
] | 888,903 | 888,904 | u505420467 | ruby |
p03075 | a = []
6.times { a << gets.to_i }
k = a.last
if a[4] - a[0] <= k
puts ':('
else
puts 'Yay!'
end | a = []
6.times { a << gets.to_i }
k = a.last
if a[4] - a[0] <= k
puts 'Yay!'
else
puts ':('
end | [
"call.remove",
"call.add"
] | 888,905 | 888,906 | u349129336 | ruby |
p03075 | a = gets.to_i
b = gets.to_i
c = gets.to_i
d = gets.to_i
e = gets.to_i
k = gets.to_i
if (e - a) > k
puts ":("
else
"Yay!"
end | a = gets.to_i
b = gets.to_i
c = gets.to_i
d = gets.to_i
e = gets.to_i
k = gets.to_i
if (e - a) > k
puts ":("
else
puts "Yay!"
end | [
"io.output.change",
"call.add"
] | 888,907 | 888,908 | u053003310 | ruby |
p03075 | a = gets.to_i
b = gets.to_i
c = gets.to_i
d = gets.to_i
e = gets.to_i
k = gets.to_i
if e - a > k
puts ":("
else
"Yay!"
end | a = gets.to_i
b = gets.to_i
c = gets.to_i
d = gets.to_i
e = gets.to_i
k = gets.to_i
if (e - a) > k
puts ":("
else
puts "Yay!"
end | [
"control_flow.branch.if.condition.change",
"io.output.change",
"call.add"
] | 888,909 | 888,908 | u053003310 | ruby |
p03075 | A = 5.times.map{gets.to_i}
k = gets.to_i
A[4] - A[0] > k ? ':(' : 'Yay!'
| A = 5.times.map{gets.to_i}
k = gets.to_i
puts A[4] - A[0] > k ? ':(' : 'Yay!'
| [
"io.output.change",
"call.add"
] | 889,066 | 889,067 | u627981707 | ruby |
p03075 | lines = []
5.times {
line.push(gets.to_i)
}
k = gets.to_i
puts line[4] - line[0] > k ? ':(' : 'Yay!' | lines = []
5.times {
lines.push(gets.to_i)
}
k = gets.to_i
puts lines[4] - lines[0] > k ? ':(' : 'Yay!'
| [
"identifier.change",
"control_flow.branch.if.condition.change"
] | 889,068 | 889,069 | u277797473 | ruby |
p03075 | array = []
5.times do
array << gets.to_i
end
num = array[4] - array[0]
if num <= array[5]
puts 'Yay!'
else
puts ":("
end | array = []
6.times do
array << gets.to_i
end
num = array[4] - array[0]
if num <= array[5]
puts 'Yay!'
else
puts ":("
end | [
"literal.number.integer.change"
] | 889,214 | 889,215 | u741876960 | ruby |
p03075 | arr = Array.new(6, 0)
arr.size.times do |i|
arr[i] = gets.to_i
end
if arr[4] - arr[0] > arr[5]
puts ':('
else
puts 'Yay!'
end
p arr | arr = Array.new(6, 0)
arr.size.times do |i|
arr[i] = gets.to_i
end
if arr[4] - arr[0] > arr[5]
puts ':('
else
puts 'Yay!'
end | [
"call.remove"
] | 889,354 | 889,355 | u686508464 | ruby |
p03075 | a=gets.to_i
b=gets.to_i
c=gets.to_i
d=gets.to_i
e=gets.to_i
k=gets.to_i
p=[]
p<<a
p<<b
p<<c
p<<d
p<<e
p.sort!
puts (p[4]-p[0]<k) ? :Yay! : ':(' | a=gets.to_i
b=gets.to_i
c=gets.to_i
d=gets.to_i
e=gets.to_i
k=gets.to_i
p=[]
p<<a
p<<b
p<<c
p<<d
p<<e
p.sort!
puts (p[4]-p[0]<=k) ? :Yay! : ':(' | [
"expression.operator.compare.change"
] | 889,388 | 889,389 | u135201316 | ruby |
p03075 | a = gets.chomp.to_i
gets
gets
gets
e = gets.chomp.to_i
k = gets.chomp.to_i
puts e - a < k ? 'Yay!' : ':('
| a = gets.chomp.to_i
gets
gets
gets
e = gets.chomp.to_i
k = gets.chomp.to_i
puts e - a <= k ? 'Yay!' : ':(' | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 889,396 | 889,397 | u539847834 | ruby |
p03075 | def cin; gets.split.map(&:to_i) end
def cout(*x); puts x.join(" ") end
# exit if $0 != __FILE__
a = gets.to_i
b = gets.to_i
c = gets.to_i
d = gets.to_i
e = gets.to_i
k = gets.to_i
if e-a <= k then
puts 'Yey!'
exit
end
puts ':('
| def cin; gets.split.map(&:to_i) end
def cout(*x); puts x.join(" ") end
# exit if $0 != __FILE__
a = gets.to_i
b = gets.to_i
c = gets.to_i
d = gets.to_i
e = gets.to_i
k = gets.to_i
if e-a <= k then
puts 'Yay!'
exit
end
puts ':('
| [
"literal.string.change",
"call.arguments.change"
] | 889,552 | 889,553 | u388603285 | ruby |
p03075 | a = gets.to_i
b = gets.to_i
c = gets.to_i
d = gets.to_i
e = gets.to_i
k = gets.to_i
puts e - a < k ? 'Yay!' : ':(' | a = gets.to_i
b = gets.to_i
c = gets.to_i
d = gets.to_i
e = gets.to_i
k = gets.to_i
puts e - a <= k ? 'Yay!' : ':(' | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 889,640 | 889,641 | u460049292 | ruby |
p03075 | a = gets.to_i
b = gets.to_i
c = gets.to_i
d = gets.to_i
e = gets.to_i
k = gets.to_i
puts e - a > k ? 'Yay!' : ':(' | a = gets.to_i
b = gets.to_i
c = gets.to_i
d = gets.to_i
e = gets.to_i
k = gets.to_i
puts e - a <= k ? 'Yay!' : ':(' | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 889,642 | 889,641 | u460049292 | ruby |
p03076 | def maxtime(x); (x+5)/10*10; end
ary = 5.times.map{gets.to_i}
sum = 0
ary.each do |i|
sum += maxtime(i)
end
buf = ary.map{|i| maxtime(i) - i}
puts sum - buf.max
| def maxtime(x); (x+9)/10*10; end
ary = 5.times.map{gets.to_i}
sum = 0
ary.each do |i|
sum += maxtime(i)
end
buf = ary.map{|i| maxtime(i) - i}
puts sum - buf.max
| [
"literal.number.integer.change",
"expression.operation.binary.change"
] | 889,773 | 889,774 | u585819925 | ruby |
p03076 | a = gets.to_i
b = gets.to_i
c = gets.to_i
d = gets.to_i
e = gets.to_i
arr = [a, b, c, d, e].sort_by {|i| i % 10 + 1 }
puts arr[0] + arr[1].ceil(-1) + arr[2].ceil(-1) + arr[3].ceil(-1) + arr[4].ceil(-1) | a = gets.to_i
b = gets.to_i
c = gets.to_i
d = gets.to_i
e = gets.to_i
arr = [a, b, c, d, e].sort_by {|i| (i - 1) % 10 }
puts arr[0] + arr[1].ceil(-1) + arr[2].ceil(-1) + arr[3].ceil(-1) + arr[4].ceil(-1) | [
"expression.operation.binary.remove"
] | 889,841 | 889,842 | u771770008 | ruby |
p03075 | a = gets.to_i
b = gets.to_i
c = gets.to_i
d = gets.to_i
e = gets.to_i
k = gets.to_i
if e-a<k
puts "Yay!"
else
puts ":("
end | a = gets.to_i
b = gets.to_i
c = gets.to_i
d = gets.to_i
e = gets.to_i
k = gets.to_i
if e-a<=k
puts "Yay!"
else
puts ":("
end | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 890,315 | 890,316 | u053656954 | ruby |
p03076 | S = []
ID = 0
K = 10
res = 0
5.times do |n|
N = gets.chomp.to_i
puts N
S.push(N)
if N % 10 != 0 && K > N % 10 then
K = N % 10
ID = n
end
end
5.times do |n|
if ID == n || S[n]%10==0
res += S[n]
else
res += (S[n] / 10 + 1)*10
end
end
puts res | S = []
ID = 0
K = 10
res = 0
5.times do |n|
N = gets.chomp.to_i
S.push(N)
if N % 10 != 0 && K > N % 10 then
K = N % 10
ID = n
end
end
5.times do |n|
if ID == n || S[n]%10==0
res += S[n]
else
res += (S[n] / 10 + 1)*10
end
end
puts res | [
"call.remove"
] | 890,431 | 890,432 | u920525832 | ruby |
p03076 | dish = []
5.times do
dish << gets.to_i
end
ary = dish.map{|x| x%10}.sort_by{|x| x}
ary.delete(0)
if a.lenght == 0
min = 0
else
min = 10-ary[0]
end
5.times do |i|
dish[i] = ((dish[i]/10).to_i+1)*10 if dish[i]%10 != 0
end
print dish.inject(&:+)-min | dish = []
5.times do
dish << gets.to_i
end
ary = dish.map{|x| x%10}.sort_by{|x| x}
ary.delete(0)
if ary.length == 0
min = 0
else
min = 10-ary[0]
end
5.times do |i|
dish[i] = ((dish[i]/10).to_i+1)*10 if dish[i]%10 != 0
end
print dish.inject(&:+)-min | [
"identifier.change",
"control_flow.branch.if.condition.change"
] | 890,537 | 890,538 | u197497255 | ruby |
p03076 | li = 5.times.map{ gets.to_i }
best = 1e18
li.permutation do |pe|
best = [best, pe.reduce{|s,e| (s+9/10)+e}].min
end
p best |
li = 5.times.map{ gets.to_i }
best = 1e18
li.permutation do |pe|
best = [best, pe.reduce{|s,e| (s+9)/10*10+e}].min
end
p best | [
"assignment.value.change",
"expression.operation.binary.change"
] | 890,755 | 890,756 | u079330987 | ruby |
p03076 | a = gets.chop.to_i
b = gets.chop.to_i
c = gets.chop.to_i
d = gets.chop.to_i
e = gets.chop.to_i
times = [a,b,c,d,e]
ftimes = []
times.each_with_index do |t,i|
s = t%10
if s != 0
ftimes.push(s)
else
ftimes.push(9)
end
end
result = times[ftimes.index(ftimes.min)]
times.delete_at(ftimes.index(ftimes.min))
times.each_with_index do |t,i|
s = t%10
if s != 0
puts t-s+10
result += (t-s+10)
else
result += t
end
end
puts result
| a = gets.chop.to_i
b = gets.chop.to_i
c = gets.chop.to_i
d = gets.chop.to_i
e = gets.chop.to_i
times = [a,b,c,d,e]
ftimes = []
times.each_with_index do |t,i|
s = t%10
if s != 0
ftimes.push(s)
else
ftimes.push(9)
end
end
result = times[ftimes.index(ftimes.min)]
times.delete_at(ftimes.index(ftimes.min))
times.each_with_index do |t,i|
s = t%10
if s != 0
result += (t-s+10)
else
result += t
end
end
puts result
| [
"call.remove"
] | 891,031 | 891,032 | u634342027 | ruby |
p03076 | aryA = []
aryB = []
5.times do
x = gets.to_i
if x % 10 == 0
aryA << x
else
aryB << x
end
end
aryB = aryB.sort_by{|a| a % 10}.reverse
if aryA.size > 0
ans = aryA.inject(:+)
else
ans = 0
end
if aryB.size > 0
(aryB.size - 1).times do |i|
if aryB[i] > 9
ans += ((aryB[i] / 10.0).ceil) * 10
else
ans += 10
end
p ans
end
ans += aryB[-1]
end
puts ans
| aryA = []
aryB = []
5.times do
x = gets.to_i
if x % 10 == 0
aryA << x
else
aryB << x
end
end
aryB = aryB.sort_by{|a| a % 10}.reverse
if aryA.size > 0
ans = aryA.inject(:+)
else
ans = 0
end
if aryB.size > 0
(aryB.size - 1).times do |i|
if aryB[i] > 9
ans += ((aryB[i] / 10.0).ceil) * 10
else
ans += 10
end
end
ans += aryB[-1]
end
puts ans
| [
"call.remove"
] | 891,169 | 891,170 | u785521224 | ruby |
p03076 | a = gets.to_i
b = gets.to_i
c = gets.to_i
d = gets.to_i
e = gets.to_i
orders = [a,b,c,d,e].sort_by {|x|
x1 = x % 10
if x1 == 0
x1 = 10
end
x1
}
last_order = orders.shift
total_time = last_order + orders.reduce(0) {|acc, n|
n1 = n % 10
c = 0
if n1 != 0
c = 10 - n1
end
acc = acc + n + c
puts acc
acc
}
puts total_time
| a = gets.to_i
b = gets.to_i
c = gets.to_i
d = gets.to_i
e = gets.to_i
orders = [a,b,c,d,e].sort_by {|x|
x1 = x % 10
if x1 == 0
x1 = 10
end
x1
}
last_order = orders.shift
total_time = last_order + orders.reduce(0) {|acc, n|
n1 = n % 10
c = 0
if n1 != 0
c = 10 - n1
end
acc = acc + n + c
acc
}
puts total_time
| [
"call.remove"
] | 891,405 | 891,406 | u652695471 | ruby |
p03076 | ishes = []
for i in 0..4 do
dishes[i] = gets.chomp.to_i
end
sum = 0
min_minutes = 0
dishes.each_with_index do |dish, key|
minutes = (dish.to_s[-1]).to_i
if ( minutes != 0 && min_minutes < 10 - minutes)
min_minutes = 10 - minutes
end
time = (dish.to_f/10.to_f).ceil * 10
sum += time.to_i
end
print("#{sum - min_minutes}\n") | dishes = []
for i in 0..4 do
dishes[i] = gets.chomp.to_i
end
sum = 0
min_minutes = 0
dishes.each_with_index do |dish, key|
minutes = (dish.to_s[-1]).to_i
if ( minutes != 0 && min_minutes < 10 - minutes)
min_minutes = 10 - minutes
end
time = (dish.to_f/10.to_f).ceil * 10
sum += time.to_i
end
print("#{sum - min_minutes}\n") | [
"assignment.variable.change",
"identifier.change"
] | 891,457 | 891,458 | u302654038 | ruby |
p03077 | n = gets.chomp.to_i
a = gets.chomp.to_i
b = gets.chomp.to_i
c = gets.chomp.to_i
d = gets.chomp.to_i
e = gets.chomp.to_i
min = [a,b,c,d,e].min
puts 5 + (n / min)
| n = gets.chomp.to_i
a = gets.chomp.to_i
b = gets.chomp.to_i
c = gets.chomp.to_i
d = gets.chomp.to_i
e = gets.chomp.to_i
min = [a,b,c,d,e].min
puts 5 + ((n - 1) / min)
| [
"call.arguments.change"
] | 891,948 | 891,949 | u257668305 | ruby |
p03077 | n = gets.to_i
a = gets.to_i
b = gets.to_i
c = gets.to_i
d = gets.to_i
e = gets.to_i
ans = 0
min = [a, b, c, d, e].min
if min >= n
ans = 5
else
ans = n / min
ans += n % min
ans += 4
end
puts ans | n = gets.to_i
a = gets.to_i
b = gets.to_i
c = gets.to_i
d = gets.to_i
e = gets.to_i
ans = 0
min = [a, b, c, d, e].min
if min >= n
ans = 5
else
ans = n / min
ans += 1 if n % min != 0
ans += 4
end
puts ans | [
"control_flow.branch.if.condition.change"
] | 892,346 | 892,347 | u979552932 | ruby |
p03077 | n = gets.chomp.to_i
inputs = []
5.times do
inputs << gets.chomp.to_i
end
m = inputs.min
puts n/m + 5 | n = gets.chomp.to_f
inputs = []
5.times do
inputs << gets.chomp.to_i
end
m = inputs.min
puts (n / m).ceil + 4 | [
"call.function.change",
"type_conversion.to_float.change",
"type_conversion.to_number.change",
"call.arguments.change",
"call.add",
"literal.number.integer.change",
"expression.operation.binary.change"
] | 892,596 | 892,597 | u466332671 | ruby |
p03077 | n=gets.chomp.to_i
cities=readlines.map(&:chomp).map(&:to_i)
puts ((n/cities.min)+1)+4 | n=gets.chomp.to_i
cities=readlines.map(&:chomp).map(&:to_i)
puts ((n/cities.min.to_f).ceil)+4 | [
"call.add"
] | 892,641 | 892,642 | u429775245 | ruby |
p03077 | n = gets.chop.to_i
ae = []
5.times do
ae << gets.chop.to_i
end
min_ae = ae.min
puts (n/min_ae)+5
| n = gets.chop.to_i
ae = []
5.times do
ae << gets.chop.to_f
end
min_ae = ae.min
puts (n/min_ae).ceil+4
| [
"call.function.change",
"type_conversion.to_float.change",
"type_conversion.to_number.change",
"call.add",
"literal.number.integer.change",
"call.arguments.change",
"expression.operation.binary.change"
] | 892,689 | 892,690 | u157887852 | ruby |
p03077 | N = STDIN.gets.chomp.to_i
A = STDIN.gets.chomp.to_i
B = STDIN.gets.chomp.to_i
C = STDIN.gets.chomp.to_i
D = STDIN.gets.chomp.to_i
E = STDIN.gets.chomp.to_i
mini = [A, B, C, D, E].min
# 5は都市1から都市6までのステップ
puts ((N - 1).to_f / mini.to_f).ceil + 5 | N = STDIN.gets.chomp.to_i
A = STDIN.gets.chomp.to_i
B = STDIN.gets.chomp.to_i
C = STDIN.gets.chomp.to_i
D = STDIN.gets.chomp.to_i
E = STDIN.gets.chomp.to_i
mini = [A, B, C, D, E].min
# 5は都市1から都市6までのステップ
puts (N.to_f / mini.to_f).ceil - 1 + 5
| [
"call.arguments.change"
] | 892,950 | 892,949 | u231458241 | ruby |
p03077 | all_members = STDIN.gets.to_i
min_v = 10 ** 15 + 1
5.times do |_|
v = STDIN.gets.to_i
min_v = v if v < min_v
end
STDOUT.puts (all_members / min_v).ceil + 1
| all_members = STDIN.gets.to_f
min_v = 10 ** 15 + 1
5.times do |_|
v = STDIN.gets.to_i
min_v = v if v < min_v
end
STDOUT.puts (all_members / min_v).ceil + 4 | [
"call.function.change",
"type_conversion.to_float.change",
"type_conversion.to_number.change",
"literal.number.integer.change",
"call.arguments.change",
"expression.operation.binary.change"
] | 893,313 | 893,314 | u857130525 | ruby |
p03077 | n = gets.to_i
a = gets.to_i
b = gets.to_i
c = gets.to_i
d = gets.to_i
e = gets.to_i
infr = [a,b,c,d,e]
mini = infr.min
if mini >= n
steps = 5
else
indx = infr.index(mini)
steps = (n+indx)/mini + 5 - indx
end
puts steps | n = gets.to_i
a = gets.to_i
b = gets.to_i
c = gets.to_i
d = gets.to_i
e = gets.to_i
infr = [a,b,c,d,e]
mini = infr.min
if mini >= n
steps = 5
else
indx = infr.index(mini)
steps = (n-1)/mini + 5
end
puts steps | [
"expression.operation.binary.remove"
] | 893,325 | 893,326 | u288861745 | ruby |
p03077 | N, *P = readlines.map(&:to_i)
puts (N / P.min).ceil + 5 | N, *P = readlines.map(&:to_i)
puts (N / P.min.to_f).ceil + 4
| [
"call.add",
"literal.number.integer.change",
"call.arguments.change",
"expression.operation.binary.change"
] | 893,349 | 893,350 | u064100484 | ruby |
p03077 | n = gets.to_f
ans = 1E15 + 10
5.times do
ary = [ans, gets.to_i].min
end
puts (n / ans).ceil + 4 | n = gets.to_f
ans = 1E15 + 10
5.times do
ans = [ans, gets.to_i].min
end
puts (n / ans).ceil + 4
| [
"assignment.variable.change",
"identifier.change"
] | 893,370 | 893,371 | u785521224 | ruby |
p03077 | n = gets.to_f
ans = 1E15 + 10
5.times do
ary = [ans, gets.to_i].min
end
puts (n / ans).ceil | n = gets.to_f
ans = 1E15 + 10
5.times do
ans = [ans, gets.to_i].min
end
puts (n / ans).ceil + 4
| [
"assignment.variable.change",
"identifier.change"
] | 893,372 | 893,371 | u785521224 | ruby |
p03077 | n = STDIN.gets.chomp.to_i
transportation = []
5.times do
transportation << STDIN.gets.chomp.to_i
end
min_index = transportation.rindex(transportation.min)
counter = 0
counter = n / transportation[min_index]
if n % transportation[min_index]
counter += 1
end
puts counter+transportation.length-1
| n = STDIN.gets.chomp.to_i
transportation = []
5.times do
transportation << STDIN.gets.chomp.to_i
end
min_index = transportation.rindex(transportation.min)
counter = 0
counter = n / transportation[min_index]
unless (n % transportation[min_index]) == 0
counter += 1
end
puts counter+transportation.length-1
| [
"expression.operation.binary.add"
] | 893,498 | 893,499 | u930151394 | ruby |
p03077 | n = gets.to_i
x = (1..5).map { |e| gets.to_i }
p 5 + n/x.min
| n = gets.to_i-1
x = (1..5).map { |e| gets.to_i }
p 5 + n/x.min
| [
"assignment.change"
] | 894,172 | 894,173 | u098870186 | ruby |
p03077 | n,*a=$<.map &:to_i;m=a.min;p (n+m-1)/m*m+4 | n,*a=$<.map &:to_i;m=a.min;p (n+m-1)/m+4 | [
"expression.operation.binary.remove"
] | 894,519 | 894,520 | u280667879 | ruby |
p03077 | n = gets.to_i
a = gets.to_i
b = gets.to_i
c = gets.to_i
d = gets.to_i
e = gets.to_i
ary = [a,b,c,d,e]
min = ary.min
t = n-1 / min + 5
p t | n = gets.to_i
a = gets.to_i
b = gets.to_i
c = gets.to_i
d = gets.to_i
e = gets.to_i
ary = [a,b,c,d,e]
min = ary.min
t = (n-1) / min + 5
p t | [] | 894,569 | 894,570 | u164522933 | ruby |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.