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 |
|---|---|---|---|---|---|---|---|
p03599 | A,B,C,D,E,F = gets.split.map(&:to_i)
mx = -1 # 最大濃度
max_ws = 0
max_su = 0
31.times do |a|
break if 100*A*a > F
31.times do |b|
break if 100*B*b > F
s = (A*a + B*b) * E # 砂糖の最大値
31.times do |c|
break if C*c > s
31.times do |d|
su = C*c + D*d # 砂糖の量
ws = 100*A*a + 100*B*b + su... | A,B,C,D,E,F = gets.split.map(&:to_i)
mx = -1 # 最大濃度
max_ws = 0
max_su = 0
33.times do |a|
break if 100*A*a > F
33.times do |b|
break if 100*B*b > F
s = (A*a + B*b) * E # 砂糖の最大値
100.times do |c|
break if C*c > s
100.times do |d|
su = C*c + D*d # 砂糖の量
ws = 100*A*a + 100*B*b + ... | [
"literal.number.integer.change"
] | 1,298,033 | 1,298,034 | u244087909 | ruby |
p03599 | A,B,C,D,E,F = gets.split.map(&:to_i)
mx = -1 # 最大濃度
max_ws = 0
max_su = 0
30.times do |a|
break if 100*A*a > F
30.times do |b|
break if 100*B*b > F
s = (A*a + B*b) * E # 砂糖の最大値
30.times do |c|
break if C*c > s
30.times do |d|
su = C*c + D*d # 砂糖の量
ws = 100*A*a + 100*B*b + su... | A,B,C,D,E,F = gets.split.map(&:to_i)
mx = -1 # 最大濃度
max_ws = 0
max_su = 0
33.times do |a|
break if 100*A*a > F
33.times do |b|
break if 100*B*b > F
s = (A*a + B*b) * E # 砂糖の最大値
100.times do |c|
break if C*c > s
100.times do |d|
su = C*c + D*d # 砂糖の量
ws = 100*A*a + 100*B*b + ... | [
"literal.number.integer.change"
] | 1,298,035 | 1,298,034 | u244087909 | ruby |
p03605 | def ascan; gets.split.map(&:to_i);end
b = gets=~/9/
if a
puts "Yes"
else
puts "No"
end
| def ascan; gets.split.map(&:to_i);end
b = gets=~/9/
if b
puts "Yes"
else
puts "No"
end
| [
"identifier.change",
"control_flow.branch.if.condition.change"
] | 1,302,381 | 1,302,382 | u079330987 | ruby |
p03607 | require 'pp'
n = gets.chomp!.to_i
memo = {}
n.times do |i|
a = gets.to_i
memo[a] ||= 0
memo[a] += 1
end
puts memo.count {|_, v| v == 1 }
| require 'pp'
n = gets.chomp!.to_i
memo = {}
n.times do |i|
a = gets.to_i
memo[a] ||= 0
memo[a] += 1
end
puts memo.count {|_, v| v % 2 == 1 }
| [
"expression.operation.binary.add"
] | 1,304,213 | 1,304,214 | u754375546 | ruby |
p03608 | n, m, r = gets.split.map(&:to_i)
rs = gets.split.map(&:to_i)
d = Array.new(201){ Array.new(201, 0) }
m.times do
a, b, c = gets.split.map(&:to_i)
d[a][b] = c
d[b][a] = c
end
1.upto(n) do |k|
1.upto(n) do |i|
1.upto(n) do |j|
if d[i][j] > d[i][k] + d[k][j]
d[i][j] = d[i][k] + d[k][j]
... | n, m, r = gets.split.map(&:to_i)
rs = gets.split.map(&:to_i)
d = Array.new(201){ Array.new(201, Float::INFINITY) }
m.times do
a, b, c = gets.split.map(&:to_i)
d[a][b] = c
d[b][a] = c
end
1.upto(n) do |k|
1.upto(n) do |i|
1.upto(n) do |j|
if d[i][j] > d[i][k] + d[k][j]
d[i][j] = d[i][k] ... | [
"assignment.value.change",
"call.arguments.change"
] | 1,310,012 | 1,310,013 | u959188276 | ruby |
p03623 | a, b, c = readline.chomp.split("").map(&:to_i)
puts (a - b).abs < (a - c).abs ? "A" : "B" | a, b, c = readline.chomp.split(" ").map(&:to_i)
puts (a-b).abs < (a-c).abs ? "A" : "B" | [
"literal.string.change",
"assignment.value.change",
"call.arguments.change"
] | 1,313,375 | 1,313,376 | u353707427 | ruby |
p03624 | a = "abcdefghijklmnopqrstuvwxyz"
s = gets.chomp
s.each_char{|c| a.delete!(c)}
puts a[0] | a = "abcdefghijklmnopqrstuvwxyz"
s = gets.chomp
s.each_char{|c| a.delete!(c)}
puts a[0] ||= "None" | [] | 1,315,352 | 1,315,353 | u693378622 | ruby |
p03627 | n = gets.to_i
as = gets.split
.map(&:to_i).sort!
.each_with_object(Hash.new(0)) { |a, h| h[a] += 1 }
.select! { |k, v| v >= 2 }
ans = 0
length = 0
as.each do |k, v|
s = length * k
s = [length * k, k ** 2].max if v >= 4
ans = s if s >= ans
length = k
end
puts ans | n = gets.to_i
as = gets.split
.map(&:to_i).sort!
.each_with_object(Hash.new(0)) { |a, h| h[a] += 1 }
.select { |k, v| v >= 2 }
ans = 0
length = 0
as.each do |k, v|
s = length * k
s = [length * k, k ** 2].max if v >= 4
ans = s if s >= ans
length = k
end
puts ans
| [
"assignment.value.change",
"identifier.change"
] | 1,317,789 | 1,317,790 | u889326464 | ruby |
p03631 | n=gets.split("").map(&:to_i)
puts n == n.reverse ? "Yes" : "No" | n=gets.chomp.split("").map(&:to_i)
puts n == n.reverse ? "Yes" : "No" | [
"call.add"
] | 1,320,168 | 1,320,169 | u390727364 | ruby |
p03632 | a,b,c,d = gets.chomp.split(" ").map(&:to_i)
lower = [a,c].max
upper = [b,d].min
if upper > lower
puts upper
else
puts 0
end
| a,b,c,d = gets.chomp.split(" ").map(&:to_i)
lower = [a,c].max
upper = [b,d].min
if upper > lower
puts upper-lower
else
puts 0
end
| [
"expression.operation.binary.add"
] | 1,322,432 | 1,322,433 | u966695319 | ruby |
p03632 | A,B,C,D=gets.split.map &:to_i
p [B,D].min-[A,C].max | A,B,C,D=gets.split.map &:to_i
p [0,[B,D].min-[A,C].max].max | [
"literal.array.change",
"call.add"
] | 1,322,597 | 1,322,598 | u647875062 | ruby |
p03635 | gets.split.map{|c| c.to_i - 1}.inject(:*) | puts gets.split.map{|c| c.to_i - 1}.inject(:*) | [
"io.output.change",
"call.add"
] | 1,325,340 | 1,325,341 | u304198114 | ruby |
p03636 | s = gets.chomp.split("")
n = s.pop
m = s.shift
o = s.length.to_s
ans = m + o + n
p ans | s = gets.chomp.split("")
n = s.pop
m = s.shift
o = s.length.to_s
ans = m + o + n
puts ans
| [
"call.function.change",
"io.output.change"
] | 1,326,557 | 1,326,558 | u267223179 | ruby |
p03636 | s=gets.chomp
l=s.size
print s[0],l,s[l-1] | s=gets.chomp
l=s.size
print s[0],(l-2),s[l-1] | [
"call.arguments.change"
] | 1,326,710 | 1,326,711 | u662265921 | ruby |
p03637 | n = gets.chomp.to_i
a = gets.chomp.split(' ').map(&:to_i)
odd = a.select { |item| item % 2 != 0 }.count
even = n - odd
four = a.select { |item| item % 4 == 0}.count
if even - four > 0
print odd > four ? 'NO' : 'YES'
else
print odd > (four + 1) ? 'NO' : 'YES'
end | n = gets.chomp.to_i
a = gets.chomp.split(' ').map(&:to_i)
odd = a.select { |item| item % 2 != 0 }.count
even = n - odd
four = a.select { |item| item % 4 == 0}.count
if even - four > 0
print odd > four ? 'No' : 'Yes'
else
print odd > (four + 1) ? 'No' : 'Yes'
end | [
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 1,331,231 | 1,331,232 | u065618194 | ruby |
p03644 | n=gets.to_i
a=[2,4,8,16,32,64]
cnt = 0
a.reverse.each do |i|
if i<=n
cnt =i
break
end
end
puts cnt | n=gets.to_i
a=[2,4,8,16,32,64]
cnt = 1
a.reverse.each do |i|
if i<=n
cnt =i
break
end
end
puts cnt | [
"literal.number.integer.change",
"assignment.value.change"
] | 1,332,416 | 1,332,417 | u135201316 | ruby |
p03644 | n=gets.to_i
a=[2,4,8,16,32,64]
cnt = 0
a.reverse.each do |i|
if i<n
cnt =i
break
end
end
puts cnt | n=gets.to_i
a=[2,4,8,16,32,64]
cnt = 1
a.reverse.each do |i|
if i<=n
cnt =i
break
end
end
puts cnt | [
"literal.number.integer.change",
"assignment.value.change",
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 1,332,418 | 1,332,417 | u135201316 | ruby |
p03644 | num = gets.to_i
i=2
if num == 0
puts 0
return
elsif num == 1
puts 0
return
elsif num == 2
puts 2
return
end
loop do
if i * 2 > num
puts i
break
else
i = i * 2
end
end
| num = gets.to_i
i=2
if num == 0
puts 0
return
elsif num == 1
puts 1
elsif num == 2
puts 2
else
loop do
if i * 2 > num
puts i
break
else
i = i * 2
end
end
end
| [
"literal.number.integer.change",
"call.arguments.change",
"control_flow.return.remove",
"function.return_value.change"
] | 1,333,597 | 1,333,598 | u514883150 | ruby |
p03652 | N,M=gets.split.map &:to_i
A=$<.map{|e|e.split.map &:to_i}
r=N
j=Hash.new 0
v={}
(M-1).times{
c=Hash.new 0
x=0
N.times{|i|
j[i]+=1 while v[A[i][j[i]]]
(x<c[A[i][j[i]]]+=1) && x=c[k=A[i][j[i]]]
}
v[k]=1
r=[r,x].min
}
p r | N,M=gets.split.map &:to_i
A=$<.map{|e|e.split.map &:to_i}
r=N
j=Hash.new 0
v={}
(M-1).times{
c=Hash.new k=x=0
N.times{|i|
j[i]+=1 while v[A[i][j[i]]]
(x<c[A[i][j[i]]]+=1) && x=c[k=A[i][j[i]]]
}
v[k]=1
r=[r,x].min
}
p r | [
"assignment.variable.change",
"identifier.replace.add",
"literal.replace.remove",
"call.arguments.change"
] | 1,337,637 | 1,337,638 | u280667879 | ruby |
p03657 | a,b = gets.split.map(&:to_i)
puts [a, b, a + b].any?{|v| v % 3 == 0} ? 'Yes' : 'No'
| a,b = gets.split.map(&:to_i)
puts [a, b, a + b].any?{|v| v % 3 == 0} ? 'Possible' : 'Impossible' | [
"literal.string.change",
"call.arguments.change"
] | 1,338,885 | 1,338,886 | u627981707 | ruby |
p03658 | n, k = gets.chomp.split.map &:to_i
a =gets.chomp.split.map &:to_i
sortar = a.sort
c = n-1
ans = 0
p sortar
k.times do |i|
ans += sortar[c]
c -= 1
end
puts ans
| n, k = gets.chomp.split.map &:to_i
a =gets.chomp.split.map &:to_i
sortar = a.sort
c = n-1
ans = 0
k.times do |i|
ans += sortar[c]
c -= 1
end
puts ans
| [
"call.remove"
] | 1,339,868 | 1,339,869 | u722652068 | ruby |
p03659 | n = gets.chomp.to_i
a = gets.chomp.split.map(&:to_i)
sum = a.inject(:+)
last_sum = 0
ans = 10 ** 18
(n-1).times do |i|
x = last_sum + a[i]
y = sum - x
s = (x - y).abs
ans = s if s < ans
end
p ans
| n = gets.chomp.to_i
a = gets.chomp.split.map(&:to_i)
sum = a.inject(:+)
last_sum = 0
ans = 10 ** 18
(n-1).times do |i|
x = last_sum + a[i]
last_sum = x
y = sum - x
s = (x - y).abs
ans = s if s < ans
end
p ans
| [
"assignment.add"
] | 1,340,895 | 1,340,896 | u195257137 | ruby |
p03665 | eval"X,Y,*A="+`dd`.split*?,;p 1.<<A.any?&:odd??~-X : Y>0?-1:X | eval"X,Y,*A="+`dd`.split*?,;p 1.<<A.any?(&:odd?)?~-X : Y>0?-1:X | [
"control_flow.branch.if.condition.change"
] | 1,346,521 | 1,346,522 | u280667879 | ruby |
p03672 | s = gets(&:chomp)
sa = s.split(//)
slen=s.length-2
i=0
str = String.new
ans = 2
while i<slen/2
str=str+sa[i]
str2 = String.new
#puts str
j=i+1
num=i+1
num.times do |k|
str2+=sa[j]
j=j+1
end
#puts "str2 "+str2
if str.eql?(str2)
ans = str.length
end
i=i+... | s = gets(&:chomp)
sa = s.split(//)
slen=s.length-2
i=0
str = String.new
ans = 2
while i<slen/2
str=str+sa[i]
str2 = String.new
#puts str
j=i+1
num=i+1
num.times do |k|
str2+=sa[j]
j=j+1
end
#puts "str2 "+str2
if str.eql?(str2)
ans = str.length+str2.length
... | [
"assignment.change"
] | 1,348,362 | 1,348,363 | u656481579 | ruby |
p03673 | n = gets.to_i
a = gets.chomp.split.map &:to_i
b_push = []
b_unshift = []
a.each_with_index do |an,i|
i.even? ? b_push << an : b_unshift.unshift(an)
end
b = b_unshift + b_push
b.reverse! if a.length.odd?
p b.join(' ')
| n = gets.to_i
a = gets.chomp.split.map &:to_i
b_push = []
b_unshift = []
a.each_with_index do |an,i|
i.even? ? b_push << an : b_unshift.unshift(an)
end
b = b_unshift + b_push
b.reverse! if a.length.odd?
puts b.join(' ')
| [
"call.function.change",
"io.output.change"
] | 1,348,631 | 1,348,632 | u772625937 | ruby |
p03679 | x,a,b = gets.split(" ").map(&:to_i)
syomi = b - a
if syomi < 0
puts "delicious"
elsif syomi >= x
puts "dangerous"
else
puts "safe"
end
| x,a,b = gets.split(" ").map(&:to_i)
syomi = b - a
if 0 >= syomi
puts "delicious"
elsif syomi > x
puts "dangerous"
else
puts "safe"
end
| [
"control_flow.branch.if.condition.change",
"expression.operation.binary.remove",
"expression.operator.compare.change"
] | 1,352,094 | 1,352,095 | u944733909 | ruby |
p03679 | x,a,b = gets.split(" ").map(&:to_i)
syomi = b - a
if syomi < 0
puts "delicious"
elsif syomi > x
puts "dangerous"
else
puts "safe"
end
| x,a,b = gets.split(" ").map(&:to_i)
syomi = b - a
if 0 >= syomi
puts "delicious"
elsif syomi > x
puts "dangerous"
else
puts "safe"
end
| [
"control_flow.branch.if.condition.change",
"expression.operation.binary.remove"
] | 1,352,096 | 1,352,095 | u944733909 | ruby |
p03679 | x, a, b = gets.chomp.split(" ").map(&:to_i)
if a > b
puts "delicious"
elsif b - a > x
puts "dangerous"
else
puts "safe"
end
| x, a, b = gets.chomp.split(" ").map(&:to_i)
if a >= b
puts "delicious"
elsif b - a > x
puts "dangerous"
else
puts "safe"
end
| [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 1,353,458 | 1,353,459 | u126541218 | ruby |
p03687 | gets.tap{|x| puts ("a".."z").map{|s| x.chomp.split(s).map(&:size).max}.min} | gets.chomp.tap{|x|puts ("a".."z").map{|s|x.split(s).map(&:size).max||0}.min} | [
"call.add",
"call.remove"
] | 1,358,994 | 1,358,995 | u776725702 | ruby |
p03693 | puts (gets.chomp.gsub(' ', '').to_i) % 4 == 0 ? 'Yes' : 'No' | puts (gets.chomp.gsub(' ', '').to_i) % 4 == 0 ? 'YES' : 'NO' | [
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 1,361,809 | 1,361,810 | u546441021 | ruby |
p03695 | _ = gets
a = gets.chomp.split.map(&:to_i)
c = [399, 799, 1199, 1599, 1999, 2399, 2799, 3199]
d = Hash.new(0)
rc = 0
a.each do |r|
rank = c.bsearch {|x| x > r }
d[rank] += 1 if !rank.nil?
rc += 1 if rank.nil?
end
lb = d.size
ub = d.size + rc
lb += 1 if d.size == 0
puts [lb, ub].join(" ") | _ = gets
a = gets.chomp.split.map(&:to_i)
c = [399, 799, 1199, 1599, 1999, 2399, 2799, 3199]
d = Hash.new(0)
rc = 0
a.each do |r|
rank = c.bsearch {|x| x >= r }
d[rank] += 1 if !rank.nil?
rc += 1 if rank.nil?
end
lb = d.size
ub = d.size + rc
lb += 1 if d.size == 0
puts [lb, ub].join(" ") | [
"expression.operator.compare.change",
"assignment.value.change",
"expression.operation.binary.change"
] | 1,364,498 | 1,364,499 | u482840940 | ruby |
p03695 | N = gets.to_i
a = gets.strip.split.map(&:to_i)
answer = 0
if a.any?{|x| 1 <= x && x <= 399}
answer += 1
end
if a.any?{|x| 400 <= x && x <= 799}
answer += 1
end
if a.any?{|x| 800 <= x && x <= 1199}
answer += 1
end
if a.any?{|x| 1200 <= x && x <= 1599}
answer += 1
end
if a.any?{|x| 1600 <= x ... | N = gets.to_i
a = gets.strip.split.map(&:to_i)
answer = 0
if a.any?{|x| 1 <= x && x <= 399}
answer += 1
end
if a.any?{|x| 400 <= x && x <= 799}
answer += 1
end
if a.any?{|x| 800 <= x && x <= 1199}
answer += 1
end
if a.any?{|x| 1200 <= x && x <= 1599}
answer += 1
end
if a.any?{|x| 1600 <= x ... | [
"literal.string.change",
"call.arguments.change"
] | 1,367,007 | 1,367,008 | u162758522 | ruby |
p03697 | str = gets
arr = str.split(" "),map(&:to_i)
sum = arr[0] + arr[1]
puts sum >= 10 ? 'error' : sum
| str = gets
arr = str.split(" ").map(&:to_i)
sum = arr[0] + arr[1]
puts sum >= 10 ? 'error' : sum
| [
"assignment.value.change"
] | 1,368,730 | 1,368,731 | u759137620 | ruby |
p03697 | str = gets
arr = str.split(" ")
sum = arr[0].to_i + arr[1].to_i
puts sum == 10 ? 'error' : sum
| str = gets
arr = str.split(" ")
sum = arr[0].to_i + arr[1].to_i
puts sum >= 10 ? 'error' : sum
| [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 1,368,732 | 1,368,733 | u759137620 | ruby |
p03698 | str = gets.chomp
msg = "no"
str.length.times { |i|
(str.length - i).times { |j|
if str[i] == str[i+j+1] ; msg = "yes"
end
}
}
puts msg | str = gets.chomp
msg = "yes"
str.length.times { |i|
(str.length - i).times { |j|
if str[i] == str[i+j+1] ; msg = "no"
end
}
}
puts msg | [
"literal.string.change",
"assignment.value.change"
] | 1,370,626 | 1,370,627 | u352287030 | ruby |
p03719 | a, b, c = gets.split.map(&:to_i)
puts (a <= c) && (c <= b) ? 'YES' : 'NO' | a, b, c = gets.split.map(&:to_i)
puts (a <= c) && (c <= b) ? 'Yes' : 'No' | [
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 1,383,203 | 1,383,204 | u457499130 | ruby |
p03720 | N,M = gets.split.map(&:to_i)
D = Array.new(N+1,0)
M.times do
u,v = gets.split.map(&:to_i)
D[u] += 1
D[v] += 1
end
D.shift
puts (1 .. N).map{|i| D[i] } | N,M = gets.split.map(&:to_i)
D = Array.new(N+1,0)
M.times do
u,v = gets.split.map(&:to_i)
D[u] += 1
D[v] += 1
end
puts (1 .. N).map{|i| D[i] } | [
"call.remove"
] | 1,385,625 | 1,385,626 | u627981707 | ruby |
p03729 | A, B, C = gets.chomp.split(" ")
if A[-1] == B[0] && B[-1] == C[0] then
puts "Yes"
else
puts "No"
end | A, B, C = gets.chomp.split(" ")
if A[-1] == B[0] && B[-1] == C[0] then
puts "YES"
else
puts "NO"
end | [
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 1,394,128 | 1,394,129 | u226855113 | ruby |
p03729 | A, B, C = gets.chomp.split(" ")
if A[-1] == B[0] && B[-1] == C[0]
then puts "Yes"
else puts "No"
end | A, B, C = gets.chomp.split(" ")
if A[-1] == B[0] && B[-1] == C[0] then
puts "YES"
else
puts "NO"
end | [
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 1,394,130 | 1,394,129 | u226855113 | ruby |
p03738 | #
a=gets().chomp
b=gets().chomp
la=a.length
lb=b.length
k=0
if la>lb
k=1
elsif la>lb
k=-1
else
for i in 0..la-1
if a[i]>b[i]
k=1
elsif a[i]<b[i]
k=-1
end
if k!=0
break
end
end
end
if k==1
puts("GREATER")
elsif k==-1
... | #
a=gets().chomp
b=gets().chomp
la=a.length
lb=b.length
k=0
if la>lb
k=1
elsif la<lb
k=-1
else
for i in 0..la-1
if a[i]>b[i]
k=1
elsif a[i]<b[i]
k=-1
end
if k!=0
break
end
end
end
if k==1
puts("GREATER")
elsif k==-1
... | [
"misc.opposites",
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 1,399,901 | 1,399,902 | u060936992 | ruby |
p03745 | n = gets.to_i
as = gets.split.map(&:to_i)
ans = 1
if as[0] == as[i]
increased = 0
else
increased = as[0] < as[1] ? 1 : -1
end
1.upto(n - 1) do |i|
next if as[i - 1] == as[i]
if increased == 0
increased = as[i - 1] < as[i] ? 1 : -1
next
end
if (increased == 1 && as[i - 1] > as[i]) || (increased =... | n = gets.to_i
as = gets.split.map(&:to_i)
ans = 1
if n == 1 || as[0] == as[1]
increased = 0
else
increased = as[0] < as[1] ? 1 : -1
end
1.upto(n - 1) do |i|
next if as[i - 1] == as[i]
if increased == 0
increased = as[i - 1] < as[i] ? 1 : -1
next
end
if (increased == 1 && as[i - 1] > as[i]) || (i... | [
"control_flow.branch.if.condition.change",
"identifier.replace.remove",
"literal.replace.add",
"variable_access.subscript.index.change"
] | 1,402,873 | 1,402,872 | u889326464 | ruby |
p03759 | def l(a, b, c)
puts b - a == c - b ? "YES" : "No"
end
a, b, c= gets.chomp.split(" ").map(&:to_i)
l(a, b, c) | def l(a, b, c)
puts b - a == c - b ? "YES" : "NO"
end
a, b, c= gets.chomp.split(" ").map(&:to_i)
l(a, b, c) | [
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 1,405,755 | 1,405,756 | u050641473 | ruby |
p03767 | a = gets.to_i
b = gets.split.map(&:to_i)
a = a * 3
cnt = 0
sum = 0
ind = a - 2
b.sort!
while cnt < 2 do
sum += b[ind]
ind = ind - 2
cnt = cnt + 1
end
puts sum | a = gets.to_i
b = gets.split.map(&:to_i)
a = a * 3
cnt = 0
sum = 0
ind = a - 2
b.sort!
while cnt < a / 3 do
sum += b[ind]
ind = ind - 2
cnt = cnt + 1
end
puts sum | [
"identifier.replace.add",
"literal.replace.remove",
"expression.operation.binary.change"
] | 1,409,995 | 1,409,996 | u962609087 | ruby |
p03773 | a,b = gets.split(" ").map(&:to_i)
if a + b > 24
puts a + b -24
else
puts a+ b
end | a,b = gets.split(" ").map(&:to_i)
if a + b >= 24
puts a + b -24
else
puts a+ b
end | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 1,413,426 | 1,413,427 | u135201316 | ruby |
p03773 | a,b = gets.split(" ").map(&:to_s)
if a + b > 24
puts a + b -24
else
puts a+ b
end | a,b = gets.split(" ").map(&:to_i)
if a + b >= 24
puts a + b -24
else
puts a+ b
end | [
"assignment.value.change",
"call.arguments.change",
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 1,413,428 | 1,413,427 | u135201316 | ruby |
p03774 | # frozen_string_literal: true
n, m = gets.split.map(&:to_i)
a, b = Array.new(n) { gets.split.map(&:to_i) }.transpose
c, d = Array.new(m) { gets.split.map(&:to_i) }.transpose
n.times do |i|
min = 4 * 10**8 + 1
checkpoint = nil
n.times do |j|
tmp = (a[i] - c[j]).abs + (b[i] - d[j]).abs
if min > tmp
... | # frozen_string_literal: true
n, m = gets.split.map(&:to_i)
a, b = Array.new(n) { gets.split.map(&:to_i) }.transpose
c, d = Array.new(m) { gets.split.map(&:to_i) }.transpose
n.times do |i|
min = 4 * 10**8 + 1
checkpoint = nil
m.times do |j|
tmp = (a[i] - c[j]).abs + (b[i] - d[j]).abs
if min > tmp
... | [
"identifier.change",
"io.output.change"
] | 1,414,210 | 1,414,211 | u104886851 | ruby |
p03785 | require 'pp'
# 入力値を数値で返却する
def gets_i()
gets.chomp.to_i
end
# N = gets_i
# 空白区切の入力値を数値の配列で返却する
def gets_i_list()
gets.chomp.split(" ").map(&:to_i)
end
# N, M = gets_i_list
# list = gets_i_list
N, C, K = gets_i_list
t_list = []
N.times do
t_list.push(gets_i)
end
t_list.sort!
t_end = t_list[0] + K
p_count = 0
c... | require 'pp'
# 入力値を数値で返却する
def gets_i()
gets.chomp.to_i
end
# N = gets_i
# 空白区切の入力値を数値の配列で返却する
def gets_i_list()
gets.chomp.split(" ").map(&:to_i)
end
# N, M = gets_i_list
# list = gets_i_list
N, C, K = gets_i_list
t_list = []
N.times do
t_list.push(gets_i)
end
t_list.sort!
t_end = t_list[0] + K
p_count = 0
c... | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change",
"literal.number.integer.change",
"assignment.value.change"
] | 1,422,635 | 1,422,636 | u370977023 | ruby |
p03785 | require 'pp'
# 入力値を数値で返却する
def gets_i()
gets.chomp.to_i
end
# N = gets_i
# 空白区切の入力値を数値の配列で返却する
def gets_i_list()
gets.chomp.split(" ").map(&:to_i)
end
# N, M = gets_i_list
# list = gets_i_list
N, C, K = gets_i_list
t_list = []
N.times do
t_list.push(gets_i)
end
t_list.sort!
t_end = t_list[0] + K
p_count = 0
c... | require 'pp'
# 入力値を数値で返却する
def gets_i()
gets.chomp.to_i
end
# N = gets_i
# 空白区切の入力値を数値の配列で返却する
def gets_i_list()
gets.chomp.split(" ").map(&:to_i)
end
# N, M = gets_i_list
# list = gets_i_list
N, C, K = gets_i_list
t_list = []
N.times do
t_list.push(gets_i)
end
t_list.sort!
t_end = t_list[0] + K
p_count = 0
c... | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 1,422,637 | 1,422,638 | u370977023 | ruby |
p03795 | i = STDIN.gets.to_i
puts i * 800 - i % 15 * 200
| i = STDIN.gets.to_i
puts i * 800 - i / 15 * 200
| [
"expression.operator.arithmetic.change",
"call.arguments.change",
"expression.operation.binary.change"
] | 1,426,638 | 1,426,639 | u039293076 | ruby |
p03795 | i = STDIN.gets.to_i
puts i * 1800 - i % 15 * 200
| i = STDIN.gets.to_i
puts i * 800 - i / 15 * 200
| [
"literal.number.integer.change",
"call.arguments.change",
"expression.operation.binary.change",
"expression.operator.arithmetic.change"
] | 1,426,640 | 1,426,639 | u039293076 | ruby |
p03797 | n, m = gets.split.map(&:to_i)
ans = 0
if m >= 2
if n >= m / 2
ans = n
elsif
ans = n + ((m - (n * 2)) / 4)
end
end
puts ans
| n, m = gets.split.map(&:to_i)
ans = 0
if m >= 2
if n >= m / 2
ans = m / 2
elsif
ans = n + ((m - (n * 2)) / 4)
end
end
puts ans
| [
"assignment.value.change"
] | 1,429,561 | 1,429,562 | u457499130 | ruby |
p03798 | def choose_animal(last_animal:, last_say:, two_last_animal:)
if last_animal == 0
if last_say == 'o'
two_last_animal
else
(two_last_animal + 1) % 2
end
else
if last_say == 'o'
(two_last_animal + 1) % 2
else
two_last_animal
end
end
end
N = gets.to_i
string = gets.cho... | def choose_animal(last_animal:, last_say:, two_last_animal:)
if last_animal == 0
if last_say == 'o'
two_last_animal
else
(two_last_animal + 1) % 2
end
else
if last_say == 'o'
(two_last_animal + 1) % 2
else
two_last_animal
end
end
end
N = gets.to_i
string = gets.cho... | [
"control_flow.branch.if.condition.change"
] | 1,433,308 | 1,433,309 | u482583772 | ruby |
p03803 | a, b = gets.chomp.split(" ").map(&:to_i)
if a == b
puts "Draw"
else
if a == 1
puts "ALice"
elsif b == 1
puts "Bob"
else
if a > b
puts "Alice"
elsif b > a
puts "Bob"
end
end
end
| a, b = gets.chomp.split(" ").map(&:to_i)
if a == b
puts "Draw"
else
if a == 1
puts "Alice"
elsif b == 1
puts "Bob"
else
if a > b
puts "Alice"
else
puts "Bob"
end
end
end | [
"literal.string.change",
"literal.string.case.change",
"call.arguments.change",
"expression.operation.binary.remove"
] | 1,434,229 | 1,434,230 | u842880209 | ruby |
p03803 | a, b = gets.chomp.split(" ").map(&:to_i)
if a == b
puts "Draw"
else
if a == 1
puts "ALice"
elsif b == 1
puts "Bob"
else
if a > b
puts "Alice"
else
puts "Bob"
end
end
end | a, b = gets.chomp.split(" ").map(&:to_i)
if a == b
puts "Draw"
else
if a == 1
puts "Alice"
elsif b == 1
puts "Bob"
else
if a > b
puts "Alice"
else
puts "Bob"
end
end
end | [
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 1,434,231 | 1,434,230 | u842880209 | ruby |
p03807 | puts gets.split.map(&:to_i).inject(:+).odd? ? "NO" : "YES"
| gets
arr = gets.split.map(&:to_i)
puts arr.inject(:+).odd? ? "NO" : "YES"
| [
"call.add"
] | 1,439,917 | 1,439,918 | u617691573 | ruby |
p03807 | puts gets.split.map(&:to_i).inject(:+).odd? ? "NO" : "YES"
| gets
puts gets.split.map(&:to_i).inject(:+).odd? ? "NO" : "YES"
| [] | 1,439,917 | 1,439,919 | u617691573 | ruby |
p03814 | include Math
define_method :max, -> (a,b) { a > b ? a : b }
define_method :min, -> (a,b) { a < b ? a : b }
define_method :swap, -> (a,b) { a, b = b, a }
define_method :rep, -> (num, &block) { num.times do |i| block.call(i) end }
define_method :repl, -> (st,en, &block) { st.upto en-1 do |i| block.call(i) end }
define_m... | include Math
define_method :max, -> (a,b) { a > b ? a : b }
define_method :min, -> (a,b) { a < b ? a : b }
define_method :swap, -> (a,b) { a, b = b, a }
define_method :rep, -> (num, &block) { num.times do |i| block.call(i) end }
define_method :repl, -> (st,en, &block) { st.upto en-1 do |i| block.call(i) end }
define_m... | [
"expression.operation.binary.add"
] | 1,444,143 | 1,444,144 | u988228861 | ruby |
p03815 | x = gets.to_i
a, b = x.divmod(5 + 6)
puts 2*a + (case b; when 0 .. 6; 1; when 7 .. 10; 2;end) | x = gets.to_i
a, b = x.divmod(5 + 6)
puts 2*a + (case b; when 0; 0; when 1 .. 6; 1; when 7 .. 10; 2;end) | [] | 1,447,018 | 1,447,019 | u304198114 | ruby |
p03817 | x = gets.to_i
ans = (x/11) * 2
x = x%11
if x > 5
ans += 2
elsif x > 0
ans += 1
end
puts ans | x = gets.to_i
ans = (x/11) * 2
x = x%11
if x > 6
ans += 2
elsif x > 0
ans += 1
end
puts ans | [
"literal.number.integer.change",
"control_flow.branch.if.condition.change"
] | 1,451,895 | 1,451,896 | u238956837 | ruby |
p03835 | def C(n,k)
k = n - k if n - k < k
k.times.inject(1){|s,i| s * (n - i) / (i + 1) }
end
K, S = gets.split.map(&:to_i)
ans = (0..3).inject(0) do |t, i|
sign = i.even? ? 1 : -1
n = S + 3 - (K + 1) * i - 1
n >= 3 ? t + sign * C(n, 2) * C(3, i) : t
end
puts ans
| def C(n,k)
k = n - k if n - k < k
k.times.inject(1){|s,i| s * (n - i) / (i + 1) }
end
K, S = gets.split.map(&:to_i)
ans = (0..3).inject(0) do |t, i|
sign = i.even? ? 1 : -1
n = S + 3 - (K + 1) * i - 1
n >= 2 ? t + sign * C(n, 2) * C(3, i) : t
end
puts ans
| [
"literal.number.integer.change",
"assignment.value.change",
"control_flow.branch.if.condition.change"
] | 1,455,581 | 1,455,582 | u627981707 | ruby |
p03835 | def C(n,k)
k = n - k if n - k < k
k.times.inject(1){|s,i| s * (n - i) / (i + 1) }
end
K, S = gets.split.map(&:to_i)
ans = 3.times.inject(0) do |t, i|
sign = i.even? ? 1 : -1
n = S + 3 - (K + 1) * i - 1
n >= 3 ? t + sign * C(n, 2) * C(3, i) : t
end
puts ans
| def C(n,k)
k = n - k if n - k < k
k.times.inject(1){|s,i| s * (n - i) / (i + 1) }
end
K, S = gets.split.map(&:to_i)
ans = (0..3).inject(0) do |t, i|
sign = i.even? ? 1 : -1
n = S + 3 - (K + 1) * i - 1
n >= 2 ? t + sign * C(n, 2) * C(3, i) : t
end
puts ans
| [
"assignment.value.change",
"literal.number.integer.change",
"control_flow.branch.if.condition.change"
] | 1,455,583 | 1,455,582 | u627981707 | ruby |
p03852 | word = gets.chomp
if word = "a" || word = "i" || word = "u" || word = "e" || word = "o"
puts "vowel"
else
puts "consonant"
end
| word = gets.chomp
if word == "a" || word == "i" || word == "u" || word == "e" || word == "o"
puts "vowel"
else
puts "consonant"
end
| [
"expression.operation.compare.replace.add",
"assignment.replace.remove",
"misc.typo"
] | 1,464,885 | 1,464,886 | u945412921 | ruby |
p03852 | word = gets.chomp
if word = "a" || word = "i" || word = "u" || word = "e" || word = "o"
puts "vowel"
else
puts "constant"
end | word = gets.chomp
if word == "a" || word == "i" || word == "u" || word == "e" || word == "o"
puts "vowel"
else
puts "consonant"
end
| [
"expression.operation.compare.replace.add",
"assignment.replace.remove",
"misc.typo",
"literal.string.change",
"call.arguments.change"
] | 1,464,887 | 1,464,886 | u945412921 | ruby |
p03852 | c = gets.chomp
if c = "a" || c = "u" || c = "o" || c = "i" || c = "e"
puts "vowel"
else
puts "consonant"
end
| c = gets.chomp
if c == "a" || c == "u" || c == "o" || c == "i" || c == "e"
puts "vowel"
else
puts "consonant"
end
| [
"expression.operation.compare.replace.add",
"assignment.replace.remove",
"misc.typo"
] | 1,465,264 | 1,465,265 | u744908753 | ruby |
p03854 | S = gets
A = ['dream', 'dreamer', 'erase', 'eraser']
sss = S
# str=任意長の文字列
# output=dream, dreamer, erase, eraser の誰か
def hoge(str)
if str[0..5] == A[3]
return 5+1
elsif str[0..4] == A[2]
return 4+1
elsif str[0..6] == A[1] && str[7] != 'a'
return 6+1
elsif str[0..4] == A[0]
return 4+1
else
... | S = gets.chomp
A = ['dream', 'dreamer', 'erase', 'eraser']
sss = S
# str=任意長の文字列
# output=dream, dreamer, erase, eraser の誰か
def hoge(str)
if str[0..5] == A[3]
return 5+1
elsif str[0..4] == A[2]
return 4+1
elsif str[0..6] == A[1] && str[7] != 'a'
return 6+1
elsif str[0..4] == A[0]
return 4+1
e... | [
"call.add"
] | 1,467,869 | 1,467,870 | u563722393 | ruby |
p03854 | puts gets.chop.gsub("eraser","").gsub("dreamer","").gsub("erase","").gsub("dream","").empty? ? :YES : :NO | puts gets.chop.gsub("eraser","").gsub("erase","").gsub("dreamer","").gsub("dream","").empty?? :YES: :NO | [
"literal.string.change",
"control_flow.branch.if.condition.change"
] | 1,469,066 | 1,469,067 | u647875062 | ruby |
p03861 | a, b, x=gets.split.map &:to_i
puts (b-a+1)/x | a, b, x=gets.split.map &:to_i
puts b/x-(a-1)/x | [
"call.arguments.change",
"misc.opposites",
"expression.operator.arithmetic.change",
"expression.operation.binary.change"
] | 1,473,245 | 1,473,246 | u882868478 | ruby |
p03943 | a, b, c = gets.chomp.split.sort.map(&:to_i)
puts (a + b == c) ? "Yes" : "No" | a, b, c = gets.chomp.split.map(&:to_i).sort
puts (a + b == c) ? "Yes" : "No" | [
"call.remove",
"call.add"
] | 1,483,549 | 1,483,550 | u398298270 | ruby |
p03958 | k = gets.to_i
a = gets.split.map(&:to_i).max
p [0, a-k-1].max | k = gets.to_i
a = gets.split.map(&:to_i).max
p [0, a*2-k-1].max | [] | 1,488,014 | 1,488,015 | u976045235 | ruby |
p03963 | n, k = gets.split.map(&:to_i)
puts k * (n-1) ** (k-1)
| n, k = gets.split.map(&:to_i)
puts k * (k-1)**(n-1)
| [
"expression.operation.binary.remove"
] | 1,490,291 | 1,490,292 | u940363789 | ruby |
p03962 | puts gets.chomp.chars.uniq.size | puts gets.split.uniq.size | [
"identifier.change",
"call.arguments.change",
"call.remove"
] | 1,490,804 | 1,490,805 | u614596051 | ruby |
p03992 | s = gets
print s[0..4]+" "+s[4..-1] | s = gets
print s[0...4]+" "+s[4..-1] | [
"call.arguments.change"
] | 1,497,075 | 1,497,074 | u520404466 | ruby |
p03998 | S = %i(A B C).each_with_object({}){|x, h| h[x] = gets.chomp.upcase.split(//).map(&:to_sym)}
turn = :A
until S[turn].empty?
turn = S[turn].pop
end
puts turn
| S = %i(A B C).each_with_object({}){|x, h| h[x] = gets.chomp.upcase.split(//).map(&:to_sym)}
turn = :A
until S[turn].empty?
turn = S[turn].shift
end
puts turn.to_s
| [
"assignment.value.change",
"identifier.change",
"call.add"
] | 1,501,749 | 1,501,750 | u304198114 | ruby |
p03999 | class Integer
def fac
return 1 if self.zero?
(1..self).reduce(&:*)
end
def combi r
self.fac / (r.fac * (self - r).fac)
end
end
def line_sum s_size, i, idx
(0..idx).reduce(0) do |sum, k|
sum + if k != 0
i * (10 ** (idx - k)) * ((1 + 1) ** (s_size - 1 - 1 - (idx - k)))
else
i *... | class Integer
def fac
return 1 if self.zero?
(1..self).reduce(&:*)
end
def combi r
self.fac / (r.fac * (self - r).fac)
end
end
def line_sum s_size, i, idx
(0..idx).reduce(0) do |sum, k|
sum + if k != 0
i * (10 ** (idx - k)) * ((1 + 1) ** (s_size - 1 - 1 - (idx - k)))
else
i *... | [
"assignment.variable.change",
"call.add"
] | 1,502,001 | 1,502,002 | u792512290 | ruby |
p04012 | S=gets
puts (?a..?z).find{|v|S.count(v)%2>0}? 'NO':'YES' | S=gets
puts (?a..?z).find{|v|S.count(v)%2>0}? 'No':'Yes' | [
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 1,509,620 | 1,509,621 | u041282550 | ruby |
p04013 | N,A=gets.split.map(&:to_i)
X=gets.split.map{|i|i.to_i-a}.sort
H=Hash.new(0)
H[0]=1
N.times do |i|
HH=H.dup
H.each do |k,v|
HH[X[i]+k]+=v
end
H=HH.dup
end
puts H[0]-1 | N,A=gets.split.map(&:to_i)
X=gets.split.map{|i|i.to_i-A}.sort!
H=Hash.new(0)
H[0]=1
N.times do |i|
HH=H.dup
H.each do |k,v|
HH[X[i]+k]+=v
end
H=HH.dup
end
puts H[0]-1 | [
"assignment.value.change",
"expression.operation.binary.change",
"call.suffix.change"
] | 1,511,010 | 1,511,011 | u041282550 | ruby |
p04019 | s = gets.chomp
s.split("").uniq!
c = 0
c += 1 if s.count('N') > 0
c -= 1 if s.count('S') > 0
d = 0
d += 1 if s.count('W') > 0
d -= 1 if s.count('E') > 0
if c > 0 || d > 0
puts 'No'
else
puts 'Yes'
end | s = gets.chomp
s.split("").uniq!
c = 0
c += 1 if s.count('N') > 0
c -= 1 if s.count('S') > 0
d = 0
d += 1 if s.count('W') > 0
d -= 1 if s.count('E') > 0
if c != 0 || d != 0
puts 'No'
else
puts 'Yes'
end | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 1,514,141 | 1,514,142 | u729246375 | ruby |
p04030 | str = gets.chomp
ans = ""
str.each_char do |i|
if str[i] == 'B'
ans.chop!
else
ans << i
end
end
p ans | str = gets.chomp
ans = ""
str.each_char do |i|
if str[i] == 'B'
ans.chop!
else
ans << i
end
end
puts ans | [
"call.function.change",
"io.output.change"
] | 1,520,226 | 1,520,227 | u712322283 | ruby |
p04043 | a = gets.chomp!
if a == "5 5 7" or a == "5 7 5" or a == "7 5 5"
puts "Yes"
else
puts "No"
end
| a = gets.chomp!
if a == "5 5 7" or a == "5 7 5" or a == "7 5 5"
puts "YES"
else
puts "NO"
end
| [
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 1,529,045 | 1,529,046 | u868099754 | ruby |
p04043 | puts gets.split.map(&:to_i).sort == [5,5,7] ? :Yes : :No | puts gets.split.map(&:to_i).sort == [5,5,7] ? :YES : :NO | [
"call.arguments.change"
] | 1,529,315 | 1,529,316 | u170008347 | ruby |
p04043 | puts gets.split.map(&:to_i).sort == [5,5,7] ? :Yes : :Nos | puts gets.split.map(&:to_i).sort == [5,5,7] ? :YES : :NO | [
"call.arguments.change"
] | 1,529,317 | 1,529,316 | u170008347 | ruby |
p04044 | n, _ = gets.split(" ").map(&:to_i)
words = n.times.map { gets.chomp }
words.sort!
print words.join.inspect
| n, _ = gets.split(" ").map(&:to_i)
words = n.times.map { gets.chomp }
words.sort!
puts words.join
| [
"identifier.change",
"call.remove"
] | 1,530,097 | 1,530,098 | u200916944 | ruby |
p04044 | n, _ = gets.split(" ").map(&:to_i)
words = n.times.map { gets.chomp }
words.sort!
puts words.join.inspect
| n, _ = gets.split(" ").map(&:to_i)
words = n.times.map { gets.chomp }
words.sort!
puts words.join
| [
"call.remove"
] | 1,530,099 | 1,530,098 | u200916944 | ruby |
p04044 | puts gets.to_i.map{gets.chomp}.sort.join | puts gets.to_i.times.map{gets.chomp}.sort.join | [
"call.add"
] | 1,531,210 | 1,531,212 | u056944756 | ruby |
p04045 | n,k=gets.split;a=[*0..9]-gets.split.map(&:to_i)
idx1=(0...n.size-1).find{|i|!a.find{|e|e==n[i].to_i}}
(puts n;exit)if !idx1
idx2=idx1.downto(0).find{|i|a.find{|e|e>n[i].to_i}}||-1
if idx2<0
$><<(a[0]>0 ? a[0] : a[1])
else
$><<n[0...idx2]<<a.find{|e|e>n[idx2].to_i}
end
puts a[0].to_s*(n.size-idx2-1) | n,k=gets.split;a=[*0..9]-gets.split.map(&:to_i)
idx1=(0...n.size).find{|i|!a.find{|e|e==n[i].to_i}}
(puts n;exit)if !idx1
idx2=idx1.downto(0).find{|i|a.find{|e|e>n[i].to_i}}||-1
if idx2<0
$><<(a[0]>0 ? a[0] : a[1])
else
$><<n[0...idx2]<<a.find{|e|e>n[idx2].to_i}
end
puts a[0].to_s*(n.size-idx2-1) | [
"expression.operation.binary.remove"
] | 1,533,830 | 1,533,831 | u280667879 | ruby |
p02390 | num = 46979
h = num/3600
num -= h*3600
m = num/60
num -= m*60
puts sprintf("%d:%d:%d", h, m, num) | num = gets.to_i
h = num/3600
num -= h*3600
m = num/60
num -= m*60
puts sprintf("%d:%d:%d", h, m, num) | null | 152,502 | 152,503 | u404374904 | ruby |
p02390 | s = gets.to_i
h = s/3600
s -= h*3600
m = s/60
s -= s*60
puts [h,m,s].join ':' | s = gets.to_i
h = s/3600
s -= h*3600
m = s/60
s -= m*60
puts [h,m,s].join(':') | null | 152,504 | 152,505 | u861698758 | ruby |
p02400 | r = gets.to_f
s = r*r*3.141592
l = 2*r*3.141592
puts([sprintf("%.8f",s),sprintf("%.8f",l)].join(" ")) | r = gets.to_f
s = r*r*Math::PI
l = 2*r*Math::PI
puts([sprintf("%.8f",s),sprintf("%.8f",l)].join(" ")) | null | 187,482 | 187,483 | u307525591 | ruby |
p02419 | k = gets.chomp
s = readlines.map(&:chop).map(&:strip).join(" ").split(" ")
puts s[0...-1].count(k) | k = gets.chomp
s = readlines.map(&:chop).map(&:strip).map(&:downcase).join(" ").split(" ")
puts s[0...-1].count(k) | null | 224,666 | 224,667 | u213421924 | ruby |
p02550 | N, X, M = $stdin.gets.split.map {|i| i.to_i }
case X
when 0
puts "0"
exit
when 1
puts N
exit
end
A = { 0 => X }
R = { X => 0 }
last = 0
sum0 = X
offset = nil
1.upto(N - 1) do |i|
f = (A[i - 1] ** 2) % M
if f == 0
puts sum0
exit
elsif offset = R[f]
break
end
A[i] = f
R[f] = i
last = i
... | N, X, M = $stdin.gets.split.map {|i| i.to_i }
case X
when 0
puts "0"
exit
when 1
puts N
exit
end
A = { 0 => X }
R = { X => 0 }
last = 0
sum0 = X
offset = nil
1.upto(N - 1) do |i|
f = (A[i - 1] ** 2) % M
if f == 0
puts sum0
exit
elsif offset = R[f]
break
end
A[i] = f
R[f] = i
last = i
... | null | 247,275 | 247,276 | u190178474 | ruby |
p02607 |
n = gets.chomp.to_i
count = 0
a = gets.chomp.split(" ").map(&:to_i)
for i in 0...n do
if ( a[i] % 2 == 1 && i%2 == 1)
count += 1
end
end
puts count
| n = gets.chomp.to_i
count = 0
a = gets.chomp.split(" ").map(&:to_i)
for i in 0...n do
if ( a[i] % 2 == 1 && i % 2 == 0)
count += 1
end
end
puts count
| null | 311,037 | 311,038 | u469583382 | ruby |
p02713 | k = 200
gcds = Array.new(k+1).map{Array.new(k+1,0)}
for i in 1..k
for j in 1..k
gcds[i][j] = gcds[j][i] = i.gcd(j)
end
end
sum = 0
for i in 1..k
for j in i..k
for k in j..k
cs = 6
if i == j
cs = 3
if j == k
cs = 1
end
elsif j == k
cs = 3
... | k = gets.to_i
gcds = Array.new(k+1).map{Array.new(k+1,0)}
for i in 1..k
for j in 1..k
gcds[i][j] = gcds[j][i] = i.gcd(j)
end
end
sum = 0
for i in 1..k
for j in i..k
for k in j..k
cs = 6
if i == j
cs = 3
if j == k
cs = 1
end
elsif j == k
cs = 3
... | null | 475,851 | 475,852 | u326891688 | ruby |
p02743 | a, b, c = gets.split(" ").map(&:to_i)
d = c - a - b
if d > 0
if (d * d) - 4 * a * b
puts "Yes"
else
puts "No"
end
else
puts "No"
end | a, b, c = gets.split(" ").map(&:to_i)
d = c - a - b
if d > 0
if (d * d) - (4 * a * b) > 0
puts "Yes"
else
puts "No"
end
else
puts "No"
end | null | 522,144 | 522,145 | u748406041 | ruby |
p02933 | a = gets.to_i
s = gets.chomp
if a > 3200
puts s
else
puts 'red'
end
| a = gets.to_i
s = gets.chomp
if a >= 3200
puts s
else
puts 'red'
end
| null | 734,735 | 734,736 | u066670883 | ruby |
p03067 | a, b, c = gets.chop.split.map(&:to_i)
if a < b
p (a..b).to_a.include?(c) ? "Yes" : "No"
else
p (b..a).to_a.include?(c) ? "Yes" : "No"
end
| a, b, c = gets.chop.split.map(&:to_i)
if a < b
puts (a..b).to_a.include?(c) ? "Yes" : "No"
else
puts (b..a).to_a.include?(c) ? "Yes" : "No"
end
| null | 878,414 | 878,415 | u868040597 | ruby |
p03126 | n, m = gets.split.map(&:to_i)
ans = []
n.times do
ans.concat(gets.split.map(&:to_i)[1..-1])
end
(1..m).each do |i|
if ans.count(i) == n
count+=1
end
end
puts count | n, m = gets.split.map(&:to_i)
ans = []
count = 0
n.times do
ans.concat(gets.split.map(&:to_i)[1..-1])
end
(1..m).each do |i|
if ans.count(i) == n
count += 1
end
end
puts count | null | 927,462 | 927,463 | u514143079 | ruby |
p03280 | input = STDIN.read.split("\n").map{|a| a.to_i}
print (input[0] - 1) * (input[1] - 1) | input = STDIN.read.split(" ").map{|a| a.to_i}
print (input[0] - 1) * (input[1] - 1) | null | 1,061,666 | 1,061,667 | u346050999 | ruby |
p03302 | a,b = gets.map &:to_i
if a + b == 15
puts "+"
elsif a * b == 15
puts "*"
else
puts "x"
end | a,b = gets.split.map &:to_i
if a + b == 15
puts "+"
elsif a * b == 15
puts "*"
else
puts "x"
end | null | 1,085,192 | 1,085,193 | u158131514 | ruby |
p03369 | s = gets.split('').map(&:to_i)
count = 700
s.each do |i|
if i == "o"
count = count + 100
end
end
puts count | s = gets.split('').map(&:to_s)
count = 700
s.each do |s|
if s == "o"
count = count + 100
end
end
puts count | null | 1,135,486 | 1,135,487 | u448303895 | ruby |
p03545 | s = gets.chomp.chars
ans = ['+', '-'].repeated_permutation(3).find {|o| eval(s.zip(o).join) == 7 }
p s.zip(ans).join + "=7" | s = gets.chomp.chars
ans = ['+', '-'].repeated_permutation(3).find {|o| eval(s.zip(o).join) == 7 }
puts s.zip(ans).join + "=7" | null | 1,266,083 | 1,266,084 | u333012034 | ruby |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.