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 |
|---|---|---|---|---|---|---|---|
p03419 | n,m=(gets.split.map &:to_i).sort
if n==1
if m==1
p 1
else
p m-2
end
end
p (n-2)*(m-2) | n,m=(gets.split.map &:to_i).sort
if n==1
if m==1
p 1
else
p m-2
end
else
p (n-2)*(m-2)
end
| [] | 1,169,833 | 1,169,832 | u610697662 | ruby |
p03417 | #接地面が奇数の場合は最終的に面になる。
#接地面が奇数のカードは最終的に面になる
#角のカードアは必ず最終的に面になる(高さ1や幅n1の時は例外)
n,m = gets.chomp.split(" ")
n_i = n.to_i
m_i = m.to_i
ans = 0
if n_i == 1 && m_i == 1
ans = 0
elsif n_i == 1
ans = m_i - 2
elsif m_i == 1
ans = n_i - 2
else
ans = (n_i-2)*(m_i-2)
end
puts ans | #接地面が奇数の場合は最終的に面になる。
#接地面が奇数のカードは最終的に面になる
#角のカードアは必ず最終的に面になる(高さ1や幅n1の時は例外)
n,m = gets.chomp.split(" ")
n_i = n.to_i
m_i = m.to_i
ans = 0
if n_i == 1 && m_i == 1
ans = 1
elsif n_i == 1
ans = m_i - 2
elsif m_i == 1
ans = n_i - 2
else
ans = (n_i-2)*(m_i-2)
end
puts ans | [
"literal.number.integer.change",
"assignment.value.change"
] | 1,170,077 | 1,170,078 | u663807550 | ruby |
p03417 | n, m = gets.chomp.split(" ").map(&:to_i)
if n == 1 and m == 1
puts(1)
exit
end
if n == 1
puts(m-2)
exit
end
if m == 1
puts(n-1)
exit
end
n = n-2
m = m-2
puts(n*m)
| n, m = gets.chomp.split(" ").map(&:to_i)
if n == 1 and m == 1
puts(1)
exit
end
if n == 1
puts(m-2)
exit
end
if m == 1
puts(n-2)
exit
end
n = n-2
m = m-2
puts(n*m)
| [
"literal.number.integer.change",
"call.arguments.change",
"expression.operation.binary.change"
] | 1,170,169 | 1,170,170 | u136468939 | ruby |
p03417 | N, M = gets.split.map(&:to_i)
puts (N - 2) * (M - 2) | N, M = gets.split.map(&:to_i)
puts (N - 2).abs * (M - 2).abs | [
"call.add"
] | 1,170,263 | 1,170,264 | u764026162 | ruby |
p03423 | puts get.chomp.to_i/2 | puts gets.chomp.to_i/3 | [
"identifier.change",
"call.arguments.change",
"expression.operation.binary.change",
"literal.number.integer.change"
] | 1,171,388 | 1,171,389 | u792512290 | ruby |
p03423 | gets.to_i/3 | puts gets.to_i/3
| [
"io.output.change",
"call.add"
] | 1,171,828 | 1,171,829 | u049159332 | ruby |
p03424 | n = gets.to_i
variation = gets.split.chars.uniq.length
if variation == 3
puts 'Three'
else
puts 'Four'
end
| n = gets.to_i
variation = gets.split.uniq.length
if variation == 3
puts 'Three'
else
puts 'Four'
end
| [
"call.remove"
] | 1,172,883 | 1,172,884 | u866325115 | ruby |
p03424 | n = gets.chomp.to_i
ary = gets.split(" ").map(&:to_s)
if ary.uniq == 3
puts "Three"
else
puts "Four"
end | n = gets.chomp.to_i
ary = gets.split(" ").map(&:to_s)
if ary.uniq.size == 3
puts "Three"
else
puts "Four"
end | [
"control_flow.branch.if.condition.change",
"call.add"
] | 1,172,985 | 1,172,986 | u928941036 | ruby |
p03424 | n = gets.chomp.to_i
ary = gets.split(" ").map(&:to_i)
if ary.uniq == 3
puts "Three"
else
puts "Four"
end
| n = gets.chomp.to_i
ary = gets.split(" ").map(&:to_s)
if ary.uniq.size == 3
puts "Three"
else
puts "Four"
end | [
"assignment.value.change",
"call.arguments.change",
"control_flow.branch.if.condition.change",
"call.add"
] | 1,172,987 | 1,172,986 | u928941036 | ruby |
p03424 | n = gets.chomp.to_i
s = gets.chomp.split(" ")
for i in 0..s.length
if s[i] == "Y"
print("Four")
end
end
print("Three") | n = gets.chomp.to_i
s = gets.chomp.split(" ")
for i in 0..s.length
if s[i] == "Y"
print("Four")
exit()
end
end
print("Three") | [
"call.add"
] | 1,173,137 | 1,173,138 | u691896522 | ruby |
p03424 | n = gets.to_i
s = gets.split(" ").map!{|o| o.to_s}
frag = "Three"
0.upto(n-1) do |i|
if s[i] == "G"
frag = "Four"
end
end
puts frag
| n = gets.to_i
s = gets.split(" ").map!{|o| o.to_s}
frag = "Three"
0.upto(n-1) do |i|
if s[i] == "Y"
frag = "Four"
end
end
puts frag
| [
"literal.string.change",
"control_flow.branch.if.condition.change"
] | 1,173,414 | 1,173,415 | u974214237 | ruby |
p03424 | n = gets.chomp.to_i
s = gets.chomp.split(' ')
if s.uniq.size.to_s == 3 then
puts 'Three'
else
puts 'Four'
end | n = gets.chomp.to_i
s = gets.chomp.split(' ')
if s.uniq.size == 3 then
puts 'Three'
else
puts 'Four'
end | [
"call.remove"
] | 1,173,737 | 1,173,738 | u198355306 | ruby |
p03424 | puts gets(p)=~/Y/ ? "Three" : "Four" | puts gets(p)=~/Y/?"Four":"Three" | [
"literal.string.change",
"call.arguments.change"
] | 1,173,808 | 1,173,809 | u726630158 | ruby |
p03424 | gets; p gets.split.uniq.size==3 ? :Three: :Four | gets; puts gets.split.uniq.size==3 ? :Three: :Four | [
"call.function.change",
"io.output.change"
] | 1,173,814 | 1,173,815 | u785521224 | ruby |
p03424 | n=gets
p gets.split.uniq.size==3 ? :Three: :Four | gets; puts gets.split.uniq.size==3 ? :Three: :Four | [
"io.output.change",
"call.add"
] | 1,173,816 | 1,173,815 | u785521224 | ruby |
p03424 | h = Hash.new(0)
num = gets.to_i
st = gets.chomp!.split("")
st.each do |s|
h[s] += 1
end
if h.keys.length == 3
puts "Three"
elsif h.keys.length == 4
puts "Four"
end
| h = Hash.new(0)
num = gets.to_i
st = gets.chomp!.split(" ")
st.each do |s|
h[s] += 1
end
if h.keys.length == 3
puts "Three"
elsif h.keys.length == 4
puts "Four"
end
| [
"literal.string.change",
"assignment.value.change",
"call.arguments.change"
] | 1,173,926 | 1,173,927 | u966695319 | ruby |
p03424 | N = gets.chomp.to_i
S = gets.chomp.split
print "#{S.uniq.size==4 ? "four" : "three"}\n" | N = gets.chomp.to_i
S = gets.chomp.split
print "#{S.uniq.size==4 ? "Four" : "Three"}\n" | [
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 1,173,995 | 1,173,996 | u800051719 | ruby |
p03424 | gets; gets.split(' ').uniq.size == 3 ? "Three" : "Four" | gets; puts gets.split(' ').uniq.size == 3 ? "Three" : "Four" | [
"io.output.change",
"call.add"
] | 1,173,997 | 1,173,998 | u546897790 | ruby |
p03425 | n = gets.to_i
h = Hash.new(0)
n.times do
s = gets
h[s[0]] += 1
end
ans = 0
ans += h['M'] * h['A'] * h['R']
ans += h['M'] * h['A'] * h['C']
ans += h['M'] * h['A'] * h['H']
ans += h['M'] * h['R'] * h['C']
ans += h['M'] * h['R'] * h['H']
ans += h['M'] * h['C'] * h['H']
ans += h['A'] * h['R'] * h['C']
ans += h['A'] * h['C'] * h['H']
ans += h['A'] * h['C'] * h['H']
ans += h['R'] * h['C'] * h['H']
puts ans | n = gets.to_i
h = Hash.new(0)
n.times do
s = gets
h[s[0]] += 1
end
ans = 0
ans += h['M'] * h['A'] * h['R']
ans += h['M'] * h['A'] * h['C']
ans += h['M'] * h['A'] * h['H']
ans += h['M'] * h['R'] * h['C']
ans += h['M'] * h['R'] * h['H']
ans += h['M'] * h['C'] * h['H']
ans += h['A'] * h['R'] * h['C']
ans += h['A'] * h['R'] * h['H']
ans += h['A'] * h['C'] * h['H']
ans += h['R'] * h['C'] * h['H']
puts ans | [
"literal.string.change",
"variable_access.subscript.index.change",
"expression.operation.binary.change"
] | 1,174,704 | 1,174,705 | u979552932 | ruby |
p03425 | n = gets.to_i
a = Array.new(n,0)
n.times do
b = gets
if b[0] == 'M'
a[0] += 1
elsif b[0] == 'A'
a[1] += 1
elsif b[0] == 'R'
a[2] += 1
elsif b[0] == 'C'
a[3] += 1
elsif b[0] == 'H'
a[4] += 1
end
end
sum = 0
(0..2).each do |i|
(i + 1..3).each do |j|
(j + 1..4).each do |k|
sum += a[i] * a[j] * a[k] if a[k] + a[j] + a[i] >= 3
end
end
end
puts sum | n = gets.to_i
a = Array.new(5,0)
n.times do
b = gets
if b[0] == 'M'
a[0] += 1
elsif b[0] == 'A'
a[1] += 1
elsif b[0] == 'R'
a[2] += 1
elsif b[0] == 'C'
a[3] += 1
elsif b[0] == 'H'
a[4] += 1
end
end
sum = 0
(0..2).each do |i|
(i + 1..3).each do |j|
(j + 1..4).each do |k|
sum += a[i] * a[j] * a[k] if a[k] + a[j] + a[i] >= 3
end
end
end
puts sum | [
"assignment.value.change",
"identifier.replace.remove",
"literal.replace.add",
"call.arguments.change"
] | 1,174,923 | 1,174,924 | u962609087 | ruby |
p03425 | n = gets.chomp.to_i
s = []
n.times do
s.push gets.chomp
end
h = Hash.new(0)
s.each do |name|
if %w[M A R C H].include?(name[0])
h[name[0]] += 1
end
end
if h.empty?
puts 0
else
puts h.to_a.map{ |e| e.last }.combination(3).to_a.map { |e| e.reduce(1) { |mul, c| mul * c }}.reduce(:+)
end
| n = gets.chomp.to_i
s = []
n.times do
s.push gets.chomp
end
h = Hash.new(0)
s.each do |name|
if %w[M A R C H].include?(name[0])
h[name[0]] += 1
end
end
if h.empty? || h.size < 3
puts 0
else
puts h.to_a.map{ |e| e.last }.combination(3).to_a.map { |e| e.reduce(1) { |mul, c| mul * c }}.reduce(:+)
end
| [
"control_flow.branch.if.condition.change"
] | 1,175,702 | 1,175,703 | u434509016 | ruby |
p03426 | io = STDIN
io = DATA #!#!#!#!must delete
hh,ww,d=io.gets.split.map(&:to_i)
$hash={}
$memo=Array.new(hh*ww+1,0)
hh.times do |h|
row=io.gets.split.map(&:to_i)
row.each_with_index do |n,w|
$hash[n]=[h,w]
end
end
require 'pp'
((d+1)..hh*ww).each do |xy|
i,j=$hash[xy-d]
x,y=$hash[xy]
$memo[xy]=$memo[xy-d]+(x-i).abs+(y-j).abs
end
q=io.gets.to_i
q.times do
l,r=io.gets.split.map(&:to_i)
puts $memo[r]-$memo[l]
end
| io = STDIN
hh,ww,d=io.gets.split.map(&:to_i)
$hash={}
$memo=Array.new(hh*ww+1,0)
hh.times do |h|
row=io.gets.split.map(&:to_i)
row.each_with_index do |n,w|
$hash[n]=[h,w]
end
end
require 'pp'
((d+1)..hh*ww).each do |xy|
i,j=$hash[xy-d]
x,y=$hash[xy]
$memo[xy]=$memo[xy-d]+(x-i).abs+(y-j).abs
end
q=io.gets.to_i
q.times do
l,r=io.gets.split.map(&:to_i)
puts $memo[r]-$memo[l]
end
| [
"assignment.remove"
] | 1,177,852 | 1,177,853 | u132360211 | ruby |
p03427 | n = gets.chomp.split("").map(&:to_i)
m = n.size
p m,n
s = n.inject(:+)
puts [s,9*(m-1)+n[0]-1].max | n = gets.chomp.split("").map(&:to_i)
m = n.size
s = n.inject(:+)
puts [s,9*(m-1)+n[0]-1].max | [
"call.remove"
] | 1,178,454 | 1,178,455 | u506255180 | ruby |
p03427 | N=gets.chomp.split('')
if(N.size==1)
puts N[0]
elsif(N[1..-1].reject{|a|a==9}.size==0)
puts N[0].to_i+(N.size-1)*9
else
puts N[0].to_i-1+(N.size-1)*9
end | N=gets.chomp.split('')
if(N.size==1)
puts N[0]
elsif(N[1..-1].reject{|a|a.to_i==9}.size==0)
puts N[0].to_i+(N.size-1)*9
else
puts N[0].to_i-1+(N.size-1)*9
end | [
"control_flow.branch.if.condition.change",
"call.add"
] | 1,178,517 | 1,178,518 | u415591191 | ruby |
p03427 | a = []
a = gets.split("").map(&:to_i)
#p a[0].class
t = 0
for i in 1..a.length-1
if a[i] != 9
t = 1
end
end
#p t
if t==0
puts (a[0] + 9 * (a.length-1)).to_i
exit
end
puts (a[0] + 9 * (a.length-1) - 1).to_i | a = []
a = gets.chomp.split("").map(&:to_i)
#p a[0].class
t = 0
for i in 1..a.length-1
if a[i] != 9
t = 1
end
end
#p t
if t==0
puts (a[0] + 9 * (a.length-1)).to_i
exit
end
puts (a[0] + 9 * (a.length-1) - 1).to_i | [
"call.add"
] | 1,178,532 | 1,178,533 | u614043796 | ruby |
p03427 | num = gets.to_s
sum = 0
j = 0
num.chars do |i|
if i == 9
sum += 9
j += 1
else
sum += i.to_i - 1
j += 1
break
end
end
sum += ( num.length - j ) * 9
if num.length == 1
puts num.to_i
elsif num[j..-1].length < (num[j..-1].to_i + 1).to_s.length
puts sum + 1
else
puts sum
end | num = gets.to_s.chomp
sum = 0
j = 0
num.chars do |i|
if i == 9
sum += 9
j += 1
else
sum += i.to_i - 1
j += 1
break
end
end
sum += ( num.length - j ) * 9
if num.length == 1
p num.to_i
elsif num[j..-1].length < (num[j..-1].to_i + 1).to_s.length
p sum + 1
else
p sum
end | [
"call.add",
"identifier.change"
] | 1,178,541 | 1,178,542 | u441320643 | ruby |
p03427 | num = gets.to_s
sum = 0
j = 0
num.chars do |i|
if i == 9
sum += 9
j += 1
else
sum += i.to_i - 1
j += 1
break
end
end
sum += ( num.length - j ) * 9
if num.length == 1
p num.to_i
elsif num[j..-1].length < (num[j..-1].to_i + 1).to_s.length
p sum + 1
else
p sum
end | num = gets.to_s.chomp
sum = 0
j = 0
num.chars do |i|
if i == 9
sum += 9
j += 1
else
sum += i.to_i - 1
j += 1
break
end
end
sum += ( num.length - j ) * 9
if num.length == 1
p num.to_i
elsif num[j..-1].length < (num[j..-1].to_i + 1).to_s.length
p sum + 1
else
p sum
end | [
"call.add"
] | 1,178,543 | 1,178,542 | u441320643 | ruby |
p03427 | num = gets.to_s
sum = 0
j = 0
num.chars do |i|
if i == 9
sum += 9
j += 1
else
sum += i.to_i - 1
j += 1
break
end
end
sum += ( num.length - j ) * 9
if num.length == 1
puts num.to_i
elsif num[j..-1].length < (num[j..-1].to_i + 1).to_s.length
p sum + 1
else
p sum
end | num = gets.to_s.chomp
sum = 0
j = 0
num.chars do |i|
if i == 9
sum += 9
j += 1
else
sum += i.to_i - 1
j += 1
break
end
end
sum += ( num.length - j ) * 9
if num.length == 1
p num.to_i
elsif num[j..-1].length < (num[j..-1].to_i + 1).to_s.length
p sum + 1
else
p sum
end | [
"call.add",
"identifier.change"
] | 1,178,544 | 1,178,542 | u441320643 | ruby |
p03427 | ns=gets.chomp.split("").map(&:to_i)
sum=0
i=0
flag=false
case ns.size
when 1
puts ns[0]
else
ns.each do |n|
sum+=n-1 if i==0
sum+=9 if i!=0
flag=true if n!=9
i+=1
end
puts sum if flag==true
puts sum+1 if flag!=true
end | ns=gets.chomp.split("").map(&:to_i)
sum=0
i=0
flag=false
case ns.size
when 1
puts ns[0]
else
ns.each do |n|
sum+=n-1 if i==0
sum+=9 if i!=0
flag=true if n!=9 && i!=0
i+=1
end
puts sum if flag==true
puts sum+1 if flag!=true
end | [
"control_flow.branch.if.condition.change"
] | 1,178,616 | 1,178,617 | u308416164 | ruby |
p03427 | getnum = gets.chomp.split("").map{|s| s.to_i}
ans = Array.new(getnum.size)
all9_flg = 0
getnum.size.times do |keta|
if getnum[keta] == 9 && keta > 0
all9_flg += 1
end
end
getnum.size.times do |keta|
#最大桁以外が全て9の場合,1桁の数の時は最大桁をそのまま加算する
if keta == getnum.size - 1
if getnum.size == 1 || all9_flg >= getnum.size
ans[getnum.size - keta - 1] = getnum[getnum.size - keta - 1]
else
ans[getnum.size - keta - 1] = getnum[getnum.size - keta - 1] - 1
end
else
ans[getnum.size - keta - 1] = 9
end
end
puts ans.inject(:+) | getnum = gets.chomp.split("").map{|s| s.to_i}
ans = Array.new(getnum.size)
all9_flg = 0
getnum.size.times do |keta|
if getnum[keta] == 9 && keta > 0
all9_flg += 1
end
end
getnum.size.times do |keta|
#最大桁以外が全て9の場合,1桁の数の時は最大桁をそのまま加算する
if keta == getnum.size - 1
if getnum.size == 1 || all9_flg >= getnum.size - 1
ans[getnum.size - keta - 1] = getnum[getnum.size - keta - 1]
else
ans[getnum.size - keta - 1] = getnum[getnum.size - keta - 1] - 1
end
else
ans[getnum.size - keta - 1] = 9
end
end
puts ans.inject(:+) | [
"control_flow.branch.if.condition.change"
] | 1,179,130 | 1,179,131 | u663807550 | ruby |
p03427 | def answer(n)
keta = n.to_s.size - 1
return n if keta == 1
left = n.to_s[0].to_i
(n == (left + 1) * 10**keta - 1) ? keta * 9 + left : keta * 9 + left - 1
end
puts answer(gets.to_i) | def answer(n)
keta = n.to_s.size - 1
return n if keta == 0
left = n.to_s[0].to_i
(n == (left + 1) * 10**keta - 1) ? keta * 9 + left : keta * 9 + left - 1
end
puts answer(gets.to_i) | [
"literal.number.integer.change",
"control_flow.branch.if.condition.change"
] | 1,179,144 | 1,179,145 | u220997159 | ruby |
p03427 | n=gets.split("").map(&:to_i)
ll=n.length
sum=0
i=0
ll.times{
sum+=n[i]
i+=1
}
sum1=sum-n[0]
if n.length==1
p n[0]
elsif sum1==9*(ll-1)
p sum
else
p n[0]+9*(ll-1)-1
end
| n=gets.chomp.split("").map(&:to_i)
ll=n.length
sum=0
i=0
ll.times{
sum+=n[i]
i+=1
}
sum1=sum-n[0]
if n.length==1
p n[0]
elsif sum1==9*(ll-1)
p sum
else
p n[0]+9*(ll-1)-1
end
| [
"call.add"
] | 1,179,181 | 1,179,182 | u506544056 | ruby |
p03433 | input = readlines()
n = input.shift.chomp.to_i
a = input.shift.chomp.to_i
rem = n % 500
puts n <= a ? 'Yes' : 'No' | input = readlines()
n = input.shift.chomp.to_i
a = input.shift.chomp.to_i
rem = n % 500
puts rem <= a ? 'Yes' : 'No' | [
"identifier.change",
"control_flow.branch.if.condition.change"
] | 1,179,937 | 1,179,938 | u810199299 | ruby |
p03433 | n = gets.to_i
a = gets.to_i
puts n % 500 < a ? "Yes" : "No" | n = gets.to_i
a = gets.to_i
puts n % 500 <= a ? "Yes" : "No" | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 1,180,010 | 1,180,011 | u658673788 | ruby |
p03433 | N = gets.to_i
A = gets.to_i
puts N % 500 < A ? "Yes" : "No" | n = gets.to_i
a = gets.to_i
puts n % 500 <= a ? "Yes" : "No" | [
"assignment.variable.change",
"control_flow.branch.if.condition.change"
] | 1,180,012 | 1,180,011 | u658673788 | ruby |
p03433 | n = gets.to_i
a = gets.to_i
puts n % 500 < a ? "Yes" : "No" | n = gets.to_i
a = gets.to_i
puts n % 500 <= a ? "Yes" : "No" | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 1,180,013 | 1,180,011 | u658673788 | ruby |
p03433 | n = gets.to_i
a = gets.to_i
puts n % 500 < a ? "YES" : "NO" | n = gets.to_i
a = gets.to_i
puts n % 500 <= a ? "Yes" : "No" | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change",
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 1,180,014 | 1,180,011 | u658673788 | ruby |
p03433 | n = gets.chomp.to_i
a = gets.chomp.to_i
if (n % 500) < a
print "Yes"
else
print "No"
end | n = gets.chomp.to_i
a = gets.chomp.to_i
if (n % 500) <= a
print "Yes"
else
print "No"
end
| [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 1,180,213 | 1,180,214 | u978288665 | ruby |
p03433 | Price = gets.strip.to_i
One = gets.strip.to_i
puts Price % 500 <= One ? 'yes' : 'no' | Price = gets.strip.to_i
One = gets.strip.to_i
puts Price % 500 <= One ? 'Yes' : 'No' | [
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 1,180,699 | 1,180,700 | u683471974 | ruby |
p03433 | price = gets.strip.to_i
one = gets.strip.to_i
puts price % 500 <= one ? 'yes' : 'no' | Price = gets.strip.to_i
One = gets.strip.to_i
puts Price % 500 <= One ? 'Yes' : 'No' | [
"assignment.variable.change",
"control_flow.branch.if.condition.change",
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 1,180,701 | 1,180,700 | u683471974 | ruby |
p03433 | n, a = readlines.map(&:to_i)
b = n / 500
puts b <= a ? "Yes" : "No"
| n, a = readlines.map(&:to_i)
b = n % 500
puts b <= a ? "Yes" : "No"
| [
"expression.operator.arithmetic.change",
"assignment.value.change",
"expression.operation.binary.change"
] | 1,181,296 | 1,181,297 | u709852962 | ruby |
p03433 | n, a = readlines.map(&:to_i)
b = n / 500
p b < a ? "Yes" : "No"
| n, a = readlines.map(&:to_i)
b = n % 500
puts b <= a ? "Yes" : "No"
| [
"expression.operator.arithmetic.change",
"assignment.value.change",
"expression.operation.binary.change",
"call.function.change",
"io.output.change",
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 1,181,298 | 1,181,297 | u709852962 | ruby |
p03433 | n, a = readlines.map(&:to_i)
b = n / 500
puts b < a ? "YES" : "NO"
| n, a = readlines.map(&:to_i)
b = n % 500
puts b <= a ? "Yes" : "No"
| [
"expression.operator.arithmetic.change",
"assignment.value.change",
"expression.operation.binary.change",
"expression.operator.compare.change",
"control_flow.branch.if.condition.change",
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 1,181,299 | 1,181,297 | u709852962 | ruby |
p03433 | n, a = readlines.map(&:to_i)
b = n / 500
p b < a ? "YES" : "NO"
| n, a = readlines.map(&:to_i)
b = n % 500
puts b <= a ? "Yes" : "No"
| [
"expression.operator.arithmetic.change",
"assignment.value.change",
"expression.operation.binary.change",
"call.function.change",
"io.output.change",
"expression.operator.compare.change",
"control_flow.branch.if.condition.change",
"literal.string.change",
"literal.string.case.change",
"call.argume... | 1,181,300 | 1,181,297 | u709852962 | ruby |
p03433 | n, a = readlines.map(&:to_i)
b = n%500
puts b < a ? "Yes" : "No" | n, a = readlines.map(&:to_i)
b = n % 500
puts b <= a ? "Yes" : "No"
| [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 1,181,301 | 1,181,297 | u709852962 | ruby |
p03433 | n, a = readlines.map(&:to_i)
b = n%500
puts b > a ? "Yes" : "No" | n, a = readlines.map(&:to_i)
b = n % 500
puts b <= a ? "Yes" : "No"
| [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 1,181,302 | 1,181,297 | u709852962 | ruby |
p03433 | n, a = readlines.map(&:to_i)
b = n%500
puts b > a ? "YES" : "NO" | n, a = readlines.map(&:to_i)
b = n % 500
puts b <= a ? "Yes" : "No"
| [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change",
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 1,181,303 | 1,181,297 | u709852962 | ruby |
p03433 | n, a = readlines.map(&:to_i)
b = n%500
puts b < a ? "Yes" : "No" | n, a = readlines.map(&:to_i)
b = n%500
puts b > a ? "No" : "Yes" | [
"misc.opposites",
"expression.operator.compare.change",
"control_flow.branch.if.condition.change",
"literal.string.change",
"call.arguments.change"
] | 1,181,301 | 1,181,304 | u709852962 | ruby |
p03433 | n, a = readlines.map(&:to_i)
b = n%500
puts b > a ? "Yes" : "No" | n, a = readlines.map(&:to_i)
b = n%500
puts b > a ? "No" : "Yes" | [
"literal.string.change",
"call.arguments.change"
] | 1,181,302 | 1,181,304 | u709852962 | ruby |
p03433 | n, a = readlines.map(&:to_i)
b = n%500
puts b > a ? "YES" : "NO" | n, a = readlines.map(&:to_i)
b = n%500
puts b > a ? "No" : "Yes" | [
"literal.string.change",
"call.arguments.change"
] | 1,181,303 | 1,181,304 | u709852962 | ruby |
p03433 | n = gets.to_i
a = gets.to_i
if (n % 500) > a
p 'No'
else
p 'Yes'
end | n = gets.to_i
a = gets.to_i
if (n % 500) > a
puts 'No'
else
puts 'Yes'
end
| [
"call.function.change",
"io.output.change"
] | 1,182,436 | 1,182,437 | u881831478 | ruby |
p03433 | n = gets.to_i
a = gets.to_i
if (a % 500) > n
puts 'No'
else
puts 'Yes'
end | n = gets.to_i
a = gets.to_i
if (n % 500) > a
puts 'No'
else
puts 'Yes'
end
| [
"identifier.change",
"control_flow.branch.if.condition.change"
] | 1,182,438 | 1,182,437 | u881831478 | ruby |
p03433 | n = gets.chomp.to_i
a = gets.chomp.to_i
temp = n % 500
result = temp <= a ? 'YES' : 'NO'
puts result | n = gets.chomp.to_i
a = gets.chomp.to_i
temp = n % 500
result = temp <= a ? 'Yes' : 'No'
puts result | [
"literal.string.change",
"literal.string.case.change",
"assignment.value.change"
] | 1,182,766 | 1,182,767 | u542197477 | ruby |
p03433 | x = gets.to_i
a = gets.to_i
if (x % 500) - a < 0
puts "Yes"
else
puts "No"
end
| x = gets.to_i
a = gets.to_i
if (x % 500) - a <= 0
puts "Yes"
else
puts "No"
end
| [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 1,182,775 | 1,182,776 | u649242511 | ruby |
p03433 | n = gets.chomp.to_i
a = gets.chomp.to_i
#a = gets.chomp.split().map(&:to_i)
if n%500 < a
puts 'Yes'
else
puts 'No'
end
| n = gets.chomp.to_i
a = gets.chomp.to_i
#a = gets.chomp.split().map(&:to_i)
if n%500 <= a
puts 'Yes'
else
puts 'No'
end | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 1,182,873 | 1,182,874 | u524019694 | ruby |
p03433 | n = gets.to_i
a = gets.to_i
puts (n % 500) < a ? "Yes" : "No" | n = gets.to_i
a = gets.to_i
puts (n % 500) <= a ? "Yes" : "No" | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 1,182,949 | 1,182,950 | u985350486 | ruby |
p03433 | n = gets.to_i
a = gets.to_i
puts (n % 500) < a ? "YES" : "NO" | n = gets.to_i
a = gets.to_i
puts (n % 500) <= a ? "Yes" : "No" | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change",
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 1,182,951 | 1,182,950 | u985350486 | ruby |
p03433 | echo gets.to_i%500-gets.to_i<=0?:Yes: :No | puts gets.to_i%500-gets.to_i<=0?:Yes: :No | [
"identifier.change"
] | 1,183,583 | 1,183,584 | u025592199 | ruby |
p03433 | N = gets.to_i
A = gets.to_i
change = N % 500
if change <= A
puts "YES"
else
puts "NO"
end | N = gets.to_i
A = gets.to_i
change = N % 500
if change <= A
puts "Yes"
else
puts "No"
end | [
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 1,183,647 | 1,183,648 | u533566373 | ruby |
p03433 | N = gets.to_i
A = gets.to_i
if N % 500 < A
puts "Yes"
else
puts "No"
end
| N = gets.to_i
A = gets.to_i
if N % 500 <= A
puts "Yes"
else
puts "No"
end
| [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 1,183,740 | 1,183,741 | u816667486 | ruby |
p03433 | n,a = 2.times.map{gets.to_i}
puts n%500 <= a ? "YES" : "NO"
| n,a = 2.times.map{gets.to_i}
puts n%500 <= a ? "Yes" : "No" | [
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 1,183,771 | 1,183,772 | u618706993 | ruby |
p03433 | n, a = 2.times.map{gets.to_i}
puts n%500 <= a ? "YES" : "NO" | n,a = 2.times.map{gets.to_i}
puts n%500 <= a ? "Yes" : "No" | [
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 1,183,773 | 1,183,772 | u618706993 | ruby |
p03433 | n = gets.to_i
a = gets.to_i
puts n % 500 <= a ? "YES" : "NO" | n = gets.to_i
a = gets.to_i
puts n % 500 <= a ? 'Yes' : 'No' | [] | 1,183,899 | 1,183,900 | u889261386 | ruby |
p03433 | n=gets.to_i
a=gets.to_i
if n%500 <= a
puts 'yes'
else
puts 'no'
end | n=gets.to_i
a=gets.to_i
if n%500 <= a
puts 'Yes'
else
puts 'No'
end
| [
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 1,183,918 | 1,183,919 | u049159332 | ruby |
p03433 | n=gets.chomp.to_i
a=gets.chomp.to_i
if n%500<a then puts "Yes" else puts "No" end | n=gets.chomp.to_i
a=gets.chomp.to_i
if n%500<=a then puts "Yes" else puts "No" end | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 1,183,994 | 1,183,995 | u030183888 | ruby |
p03433 | A = gets.to_i
B = gets.to_i
FIVE_MILLION = 500
puts (A % FIVE_MILLION < B)? "Yes" : "No" | A = gets.to_i
B = gets.to_i
FIVE_MILLION = 500
puts (A % FIVE_MILLION <= B)? "Yes" : "No"
| [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 1,184,685 | 1,184,686 | u217624311 | ruby |
p03433 | n = gets.to_i
a = gets.to_i
pos = n % 500
puts a > pos ? "Yes" : "No"
| n = gets.to_i
a = gets.to_i
pos = n % 500
puts a >= pos ? "Yes" : "No"
| [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 1,184,723 | 1,184,724 | u296101474 | ruby |
p03433 | n = gets.to_i
a = gets.to_i
pos = n % 500
puts a > pos ? "YES" : "NO"
| n = gets.to_i
a = gets.to_i
pos = n % 500
puts a >= pos ? "Yes" : "No"
| [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change",
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 1,184,725 | 1,184,724 | u296101474 | ruby |
p03433 | N = gets.to_i
A = gets.to_i
puts A > (N % 500) ? "Yes" : "No"
| N = gets.to_i
A = gets.to_i
puts A >= (N % 500) ? "Yes" : "No"
| [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 1,184,911 | 1,184,912 | u725919406 | ruby |
p03433 | n, a = $stdin.read.split("\n").map(&:to_i)
print n%500 >= a ? "Yes" : "No" | n, a = $stdin.read.split("\n").map(&:to_i)
print n%500 <= a ? "Yes" : "No" | [
"misc.opposites",
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 1,185,029 | 1,185,030 | u644856766 | ruby |
p03433 | n = gets.chomp.to_i
a = gets.chomp.to_i
if n % 500 > a
puts "Yes"
else
puts "No"
end | n = gets.chomp.to_i
a = gets.chomp.to_i
if n % 500 > a
puts "No"
else
puts "Yes"
end | [
"call.remove",
"call.add"
] | 1,185,272 | 1,185,273 | u847307807 | ruby |
p03433 | x = gets.chomp.to_i
a = gets.chomp.to_i
num = x % 500
puts ( a - num ) > 0 ? :Yes : :No | x = gets.chomp.to_i
a = gets.chomp.to_i
num = x % 500
puts ( a - num ) >= 0 ? :Yes : :No | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 1,185,276 | 1,185,277 | u135201316 | ruby |
p03433 | class Problem
# start ========
def main
n = gets.to_i
a = gets.to_i
solve(n,a)
end
def solve(n, a)
if n % 500 < a
puts 'Yes'
else
puts 'No'
end
end
# ======== end
end
if __FILE__ == $0
Problem.new.main
end | class Problem
# start ========
def main
n = gets.to_i
a = gets.to_i
solve(n,a)
end
def solve(n, a)
if n % 500 <= a
puts 'Yes'
else
puts 'No'
end
end
# ======== end
end
if __FILE__ == $0
Problem.new.main
end | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 1,185,666 | 1,185,667 | u649620975 | ruby |
p03433 | require 'prime'
require 'set'
require 'tsort'
include Math
ALP = ('a'..'z').to_a
INF = 0xffffffffffffffff
def max(a,b); a > b ? a : b end
def min(a,b); a < b ? a : b end
def swap(a,b); a, b = b, a end
def gif; gets.to_i end
def gff; gets.to_f end
def gsf; gets.chomp end
def gi; gets.split.map(&:to_i) end
def gf; gets.split.map(&:to_f) end
def gs; gets.chomp.split.map(&:to_s) end
def gc; gets.chomp.split('') end
def pr(num); num.prime_division end
def pr?(num); Prime.prime?(num) end
def digit(num); num.to_s.length end
def array(s,ini=nil); Array.new(s){ini} end
def darray(s1,s2,ini=nil); Array.new(s1){Array.new(s2){ini}} end
def rep(num); num.times{|i|yield(i)} end
def repl(st,en,n=1); st.step(en,n){|i|yield(i)} end
n = gif
a = gif
puts n % 500 < a ? 'Yes' : 'No'
| require 'prime'
require 'set'
require 'tsort'
include Math
ALP = ('a'..'z').to_a
INF = 0xffffffffffffffff
def max(a,b); a > b ? a : b end
def min(a,b); a < b ? a : b end
def swap(a,b); a, b = b, a end
def gif; gets.to_i end
def gff; gets.to_f end
def gsf; gets.chomp end
def gi; gets.split.map(&:to_i) end
def gf; gets.split.map(&:to_f) end
def gs; gets.chomp.split.map(&:to_s) end
def gc; gets.chomp.split('') end
def pr(num); num.prime_division end
def pr?(num); Prime.prime?(num) end
def digit(num); num.to_s.length end
def array(s,ini=nil); Array.new(s){ini} end
def darray(s1,s2,ini=nil); Array.new(s1){Array.new(s2){ini}} end
def rep(num); num.times{|i|yield(i)} end
def repl(st,en,n=1); st.step(en,n){|i|yield(i)} end
n = gif
a = gif
puts n % 500 <= a ? 'Yes' : 'No'
| [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 1,185,771 | 1,185,772 | u988228861 | ruby |
p03433 | N = gets.to_i
A = gets.to_i
b = N%500
if b < A then
print "Yes"
else
print "No"
end | N = gets.to_i
A = gets.to_i
b = N%500
if b <= A then
print "Yes"
else
print "No"
end | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 1,185,881 | 1,185,882 | u476312489 | ruby |
p03433 | N=gets.to_i
A=gets.to_i
Ans = N%500
print "Yes\n" if Ans < A
print "No\n" if Ans > A | N=gets.to_i
A=gets.to_i
Ans = N%500
print "Yes\n" if Ans <= A
print "No\n" if Ans > A | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 1,185,938 | 1,185,939 | u308416164 | ruby |
p03433 | n = gets.to_i
a = gets.to_i
if n < 500
if a >= n
print("Yes\n")
else
print("No\n")
end
else
s = n%500
if s == a
print("Yes\n")
else
print("No\n")
end
end | n = gets.to_i
a = gets.to_i
if n < 500
if a >= n
print("Yes\n")
else
print("No\n")
end
else
s = n%500
if a >= s
print("Yes\n")
else
print("No\n")
end
end | [
"control_flow.branch.if.condition.change",
"expression.operation.binary.remove"
] | 1,185,940 | 1,185,941 | u269725575 | ruby |
p03433 | x = $stdin.gets.to_i
y = $stdin.gets.to_i
if (x % 500) <= y
puts "YES"
else
puts "NO"
end | x = $stdin.gets.to_i
y = $stdin.gets.to_i
if (x % 500) <= y
puts "Yes"
else
puts "No"
end
| [
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 1,185,965 | 1,185,966 | u080001451 | ruby |
p03433 | x = $stdin.gets.to_i
y = $stdin.gets.to_i
if (2018 % 500) <= y
puts "YES"
else
puts "NO"
end | x = $stdin.gets.to_i
y = $stdin.gets.to_i
if (x % 500) <= y
puts "Yes"
else
puts "No"
end
| [
"identifier.replace.add",
"literal.replace.remove",
"control_flow.branch.if.condition.change",
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 1,185,967 | 1,185,966 | u080001451 | ruby |
p03433 | eval"puts %d%%50>%d?:No: :Yes"%[*$<] | eval"puts %d%%500>%d?:No: :Yes"%[*$<] | [
"literal.string.change",
"call.arguments.change"
] | 1,185,970 | 1,185,971 | u711705317 | ruby |
p03434 | n = gets.to_i
nums = gets.strip.split.map(&:to_i)
num = nums.sort.reverse #大きい順
i = 0
sum = 0
tum = 0
while i < n do
if i%2==0
sum += num[i]
else
tum += num[i]
end
i += 1
end
puts sum-tum
print num | n = gets.to_i
nums = gets.strip.split.map(&:to_i)
num = nums.sort.reverse #大きい順
i = 0
sum = 0
tum = 0
while i < n do
if i%2==0
sum += num[i]
else
tum += num[i]
end
i += 1
end
puts sum-tum | [
"call.remove"
] | 1,186,044 | 1,186,045 | u313103408 | ruby |
p03434 | n = gets.to_i
num = gets.strip.split.map(&:to_i)
num.sort!.reverse #大きい順
i = 0
sum = 0
tum = 0
while i < n do
if i%2==0
sum += num[i]
else
tum += num[i]
end
i += 1
end
puts sum-tum | n = gets.to_i
nums = gets.strip.split.map(&:to_i)
num = nums.sort.reverse #大きい順
i = 0
sum = 0
tum = 0
while i < n do
if i%2==0
sum += num[i]
else
tum += num[i]
end
i += 1
end
puts sum-tum | [
"assignment.variable.change",
"identifier.change",
"assignment.value.change"
] | 1,186,046 | 1,186,045 | u313103408 | ruby |
p03434 | n = gets.to_i
num = gets.strip.split.map(&:to_i)
num.sort.reverse #大きい順
i = 0
sum = 0
tum = 0
while i < n do
if i%2==0
sum += num[i]
else
tum += num[i]
end
i += 1
end
puts sum-tum | n = gets.to_i
nums = gets.strip.split.map(&:to_i)
num = nums.sort.reverse #大きい順
i = 0
sum = 0
tum = 0
while i < n do
if i%2==0
sum += num[i]
else
tum += num[i]
end
i += 1
end
puts sum-tum | [
"assignment.variable.change",
"identifier.change"
] | 1,186,047 | 1,186,045 | u313103408 | ruby |
p03434 | # n
# a1 a2 ... an
n = gets.to_i
array_a_temp = gets.split
array_a = []
array_a_temp.each do |a|
array_a << a.to_i
end
array_a.sort
array_a.reverse!
alice = 0
bob = 0
array_a.each_with_index do |a, i|
if i.even?
alice += a
else
bob += a
end
end
puts bob - alice
| # n
# a1 a2 ... an
n = gets.to_i
array_a_temp = gets.split
array_a = []
array_a_temp.each do |a|
array_a << a.to_i
end
array_a.sort!
array_a.reverse!
alice = 0
bob = 0
array_a.each_with_index do |a, i|
if i.even?
alice += a
else
bob += a
end
end
puts alice - bob
| [
"call.suffix.change",
"expression.operation.binary.remove"
] | 1,186,125 | 1,186,126 | u859196277 | ruby |
p03434 | # n
# a1 a2 ... an
n = gets.to_i
array_a_temp = gets.split
array_a = []
array_a_temp.each do |a|
array_a << a.to_i
end
array_a.sort
array_a.reverse!
alice = 0
bob = 0
array_a.each_with_index do |a, i|
if i.even?
alice += a
else
bob += a
end
end
puts alice - bob
| # n
# a1 a2 ... an
n = gets.to_i
array_a_temp = gets.split
array_a = []
array_a_temp.each do |a|
array_a << a.to_i
end
array_a.sort!
array_a.reverse!
alice = 0
bob = 0
array_a.each_with_index do |a, i|
if i.even?
alice += a
else
bob += a
end
end
puts alice - bob
| [
"call.suffix.change"
] | 1,186,127 | 1,186,126 | u859196277 | ruby |
p03434 | N = gets.chomp.to_i
a = gets.chomp.split(" ").map(&:to_i)
al = 0
bo = 0
while a.size != 0
sa = a.max
a.each_with_index do |val,i|
if val == sa
a.delete_at(i)
break
end
end
sb = a.max
a.each_with_index do |val,i|
if val == sb
a.delete_at(i)
break
end
end
al += sa; bo += sb
end
puts al - bo | N = gets.chomp.to_i
a = gets.chomp.split(" ").map(&:to_i)
al = 0
bo = 0
while a.size != 0
sa = a.max
a.each_with_index do |val,i|
if val == sa
a.delete_at(i)
break
end
end
sb = a.max
a.each_with_index do |val,i|
if val == sb
a.delete_at(i)
break
end
end
al += sa if sa; bo += sb if sb
end
puts al - bo | [] | 1,186,276 | 1,186,277 | u742129941 | ruby |
p03434 | n = gets.to_i
a = gets.split.map(&:io_i)
alice = []
bob = []
a.each_with_index do |i, k|
if k % 2 == 0
alice << i
else
bob << i
end
end
puts alice.inject(:+) - bob.inject(:+) | n = gets.to_i
a = gets.split.map(&:to_i).sort.reverse
alice = []
bob = []
a.each_with_index do |i, k|
if k % 2 == 0
alice << i
else
bob << i
end
end
puts alice.inject(:+) - bob.inject(:+) | [
"assignment.value.change",
"call.arguments.change",
"call.add"
] | 1,186,289 | 1,186,290 | u684458716 | ruby |
p03434 |
n = gets.to_i
as = gets.split.map(&:to_i).sort!.reverse!
ans = as.each.with_index(0).inject(0) do |r, (a, i)|
r + i.even? ? a : -a
end
puts ans
| n = gets.to_i
as = gets.split.map(&:to_i).sort!.reverse!
ans = as.each.with_index(0).inject(0) do |r, (a, i)|
r + (i.even? ? a : -a)
end
puts ans
| [] | 1,186,539 | 1,186,541 | u889326464 | ruby |
p03434 | n = gets.to_i
cards = gets.split.map(&:to_i).sort.reverse
alice = 0
bob = 0
while cards.length > 0
alice += cards.shift
break if cards.empty
bob += cards.shift
end
puts alice - bob
| n = gets.to_i
cards = gets.split.map(&:to_i).sort.reverse
alice = 0
bob = 0
while cards.length > 0
alice += cards.shift
break if cards.empty?
bob += cards.shift
end
puts alice - bob
| [
"identifier.change",
"control_flow.branch.if.condition.change"
] | 1,186,675 | 1,186,676 | u809809975 | ruby |
p03434 | n = gets.to_i
cards = gets.strip.split.map(&:to_i).sort.reverce
alice = 0
bob = 0
while cards.count > 0 do
alice += cards.shift
break if cards.empty?
bob += cards.shift
end
puts (alice - bob) | n = gets.to_i
cards = gets.strip.split.map(&:to_i).sort.reverse
alice = 0
bob = 0
while cards.count > 0 do
alice += cards.shift
break if cards.empty?
bob += cards.shift
end
puts (alice - bob) | [
"assignment.value.change",
"identifier.change"
] | 1,186,677 | 1,186,678 | u809809975 | ruby |
p03434 | n = gets.to_i
cards = gets.strip.split.map(&:to_i).reverce
alice = 0
bob = 0
while cards.size > 0 do
alice += cards.shift
break if cards.empty?
bob += cards.shift
end
puts (alice - bob) | n = gets.to_i
cards = gets.strip.split.map(&:to_i).sort.reverse
alice = 0
bob = 0
while cards.count > 0 do
alice += cards.shift
break if cards.empty?
bob += cards.shift
end
puts (alice - bob) | [
"assignment.value.change",
"identifier.change",
"call.add",
"expression.operation.binary.change"
] | 1,186,679 | 1,186,678 | u809809975 | ruby |
p03434 | n = gets.to_i
cards = gets.strip.split.map(&:to_i).reverce
alice = 0
bob = 0
while cards.count > 0 do
alice += cards.shift
break if cards.empty?
bob += cards.shift
end
puts (alice - bob) | n = gets.to_i
cards = gets.strip.split.map(&:to_i).sort.reverse
alice = 0
bob = 0
while cards.count > 0 do
alice += cards.shift
break if cards.empty?
bob += cards.shift
end
puts (alice - bob) | [
"assignment.value.change",
"identifier.change",
"call.add"
] | 1,186,680 | 1,186,678 | u809809975 | ruby |
p03434 | n = gets.to_i
cards = gets.strip.split.map(&:to_i).reverce
alice = 0
bob = 0
while cards > 0 do
alice += cards.shift
break if cards.empty?
bob += cards.shift
end
puts (alice - bob) | n = gets.to_i
cards = gets.strip.split.map(&:to_i).sort.reverse
alice = 0
bob = 0
while cards.count > 0 do
alice += cards.shift
break if cards.empty?
bob += cards.shift
end
puts (alice - bob) | [
"assignment.value.change",
"identifier.change",
"call.add"
] | 1,186,681 | 1,186,678 | u809809975 | ruby |
p03434 | # ソート
n = gets.to_i
a = gets.chomp.split(' ').map(&:to_i)
alice = 0
bob = 0
a.sort!.reverse!
for i in 0..n-1
if i.even?
alice += a[i]
p alice
else
bob += a[i]
p bob
end
end
p alice - bob | # ソート
n = gets.to_i
a = gets.chomp.split(' ').map(&:to_i)
alice = 0
bob = 0
a.sort!.reverse!
for i in 0..n-1
if i.even?
alice += a[i]
else
bob += a[i]
end
end
p alice - bob | [
"call.remove"
] | 1,186,736 | 1,186,737 | u139629238 | ruby |
p03434 | # ソート
n = gets.to_i
a = gets.chomp.split(' ').map(&:to_i)
alice = 0
bob = 0
a.sort!
for i in 0..a.length-1
if i.even?
alice += a[i]
else
bob += a[i]
end
end
p alice - bob | # ソート
n = gets.to_i
a = gets.chomp.split(' ').map(&:to_i)
alice = 0
bob = 0
a.sort!.reverse!
for i in 0..n-1
if i.even?
alice += a[i]
else
bob += a[i]
end
end
p alice - bob | [
"call.add",
"expression.operation.binary.change",
"call.remove"
] | 1,186,738 | 1,186,737 | u139629238 | ruby |
p03434 | # ソート
n = gets.to_i
a = gets.chomp.split(' ').map(&:to_i)
alice = 0
bob = 0
a.sort!
for i in 0..a.length
if i.even
alice += a[i]
else
bob += a[i]
end
end
p alice - bob | # ソート
n = gets.to_i
a = gets.chomp.split(' ').map(&:to_i)
alice = 0
bob = 0
a.sort!.reverse!
for i in 0..n-1
if i.even?
alice += a[i]
else
bob += a[i]
end
end
p alice - bob | [
"call.add",
"identifier.change",
"control_flow.branch.if.condition.change"
] | 1,186,739 | 1,186,737 | u139629238 | ruby |
p03434 | n = gets.chomp.to_i
a = gets.chomp.split(" ").map(&:to_i)
a.sort!
a.reverse!
alice = 0
bob = 0
for i in 0..n
if i % 2 == 0
alice += a[i]
else
bob += a[i]
end
end
print(alice - bob) | n = gets.chomp.to_i
a = []
a = gets.chomp.split(" ").map(&:to_i)
a.sort!
a.reverse!
alice = 0
bob = 0
for i in 0...n
if i % 2 == 0
alice += a[i]
else
bob += a[i]
end
end
print(alice - bob) | [
"assignment.add"
] | 1,186,740 | 1,186,741 | u691896522 | ruby |
p03434 | n = gets.to_i
a = gets.split.map(&:to_i)
alice = 0
bob = 0
n.times do |i|
max = a.pop
if i.even?
alice += max
else
bob += max
end
end
puts alice - bob
| n = gets.to_i
a = gets.split.map(&:to_i)
a.sort!
alice = 0
bob = 0
n.times do |i|
max = a.pop
if i.even?
alice += max
else
bob += max
end
end
puts alice - bob
| [
"call.add"
] | 1,186,756 | 1,186,757 | u195257137 | ruby |
p03434 | n = gets.to_i
a = gets.split.map(&:to_i)
a.sort!
x = 0
y = 0
n.times do |i|
if i.even?
x += a[i]
else
y += a[i]
end
end
p x - y | n = gets.to_i
a = gets.split.map(&:to_i)
a.sort!.reverse!
x = 0
y = 0
n.times do |i|
if i.even?
x += a[i]
else
y += a[i]
end
end
p x - y | [
"call.add"
] | 1,186,758 | 1,186,759 | u315597999 | ruby |
p03434 | o=0;_=`dd`.split[1,100].map(&:to_i).sort.each_slice(2).map{|a,b|o+=a;o-=b}
p o.abs | o=0;_=`dd`.split[1,100].map(&:to_i).sort.each_slice(2).map{|a,b|o+=a;o-=b||=0}
p o.abs | [] | 1,186,917 | 1,186,918 | u264508862 | ruby |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.