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 |
|---|---|---|---|---|---|---|---|
p04030
|
command = gets.chomp.split("")
p command
string = ""
command.size.times do |i|
case command[i]
when "0" then
string << "0"
when "1" then
string << "1"
when "B" then
string.chop!
else
end
end
p string
|
command = gets.chomp.split("")
string = ""
command.size.times do |i|
case command[i]
when "0" then
string << "0"
when "1" then
string << "1"
when "B" then
string.chop!
else
end
end
puts string
|
[
"call.remove",
"call.function.change",
"io.output.change"
] | 1,522,064
| 1,522,063
|
u743652948
|
ruby
|
p04030
|
s = gets.chomp
t = ''
s.split(' ').each do |c|
case c
when '0' then
t = t + '0'
when '1' then
t = t + '1'
when 'B' then
t.chop!
end
end
puts t
|
s = gets.chomp
t = ''
s.split('').each do |c|
case c
when '0' then
t = t + '0'
when '1' then
t = t + '1'
when 'B' then
t.chop!
end
end
puts t
|
[
"literal.string.change",
"call.arguments.change"
] | 1,522,065
| 1,522,066
|
u198355306
|
ruby
|
p04032
|
S=gets.strip
L,R=-1,-1
S.size.times do |i|
L,R=i+1,i+2 if S[i]==S[i+1]
L,R=i+1,i+3 if S[i]==S[i+2]
end
puts '#{L} #{R}'
|
S=gets.chomp
L,R=-1,-1
S.size.times do |i|
L,R=i+1,i+2 if S[i]==S[i+1]
L,R=i+1,i+3 if S[i]==S[i+2]
end
puts "#{L} #{R}"
|
[
"assignment.value.change",
"identifier.change",
"literal.string.change",
"call.arguments.change"
] | 1,522,472
| 1,522,473
|
u041282550
|
ruby
|
p04032
|
S=gets.chomp
L,R=-1,-1
S.size.times do |i|
L,R=i+1,i+2 if S[i]==S[i+1]
L,R=i+1,i+3 if S[i]==S[i+2]
end
puts '#{L} #{R}'
|
S=gets.chomp
L,R=-1,-1
S.size.times do |i|
L,R=i+1,i+2 if S[i]==S[i+1]
L,R=i+1,i+3 if S[i]==S[i+2]
end
puts "#{L} #{R}"
|
[
"literal.string.change",
"call.arguments.change"
] | 1,522,474
| 1,522,473
|
u041282550
|
ruby
|
p04032
|
S=gets.strip
L,R=-1,-1
S.size.times do |i|
L,R=i+1,i+2 if S[i]==S[i+1]
L,R=i+1,i+3 if S[i]==S[i+2]
end
puts '#{L} #{R}'
|
S=gets.strip
L,R=-1,-1
S.size.times do |i|
L,R=i+1,i+2 if S[i]==S[i+1]
L,R=i+1,i+3 if S[i]==S[i+2]
end
puts "#{L} #{R}"
|
[
"literal.string.change",
"call.arguments.change"
] | 1,522,472
| 1,522,475
|
u041282550
|
ruby
|
p04032
|
S=gets.chomp
L,R=-1,-1
S.size.times do |i|
L,R=i+1,i+2 if S[i]==S[i+1]
L,R=i+1,i+3 if S[i]==S[i+2]
end
puts '#{L} #{R}'
|
S=gets.strip
L,R=-1,-1
S.size.times do |i|
L,R=i+1,i+2 if S[i]==S[i+1]
L,R=i+1,i+3 if S[i]==S[i+2]
end
puts "#{L} #{R}"
|
[
"assignment.value.change",
"identifier.change",
"literal.string.change",
"call.arguments.change"
] | 1,522,474
| 1,522,475
|
u041282550
|
ruby
|
p04032
|
def search_xx(s)
(s.size - 1).times do |i|
if s[i] == s[i+1] then
return [i, i+1]
end
end
return nil
end
def search_xyx(s)
(s.size - 2).times do |i|
if s[i] == s[i+2] then
return [i, i+2]
end
end
return nil
end
s = gets.chomp
r1 = search_xx(s)
r2 = search_xyx(s)
r = [-1, -1]
if r1 != nil then
r = r1
elsif r2 != nil then
r = r2
end
puts r.map{|v| v+1}.map(&:to_s).join(' ')
|
def search_xx(s)
(s.size - 1).times do |i|
if s[i] == s[i+1] then
return [i, i+1]
end
end
return nil
end
def search_xyx(s)
(s.size - 2).times do |i|
if s[i] == s[i+2] then
return [i, i+2]
end
end
return nil
end
s = gets.chomp
r1 = search_xx(s)
r2 = search_xyx(s)
r = [-2, -2]
if r1 != nil then
r = r1
elsif r2 != nil then
r = r2
end
puts r.map{|v| v+1}.map(&:to_s).join(' ')
|
[
"literal.number.integer.change",
"assignment.value.change"
] | 1,522,943
| 1,522,944
|
u198355306
|
ruby
|
p04033
|
a,b=gets.chomp.split.map(&:to_i)
if a*b <= 0
puts "Zero"
elsif a > 0
puts "Positive"
elsif (b-a).even?
puts "Negavite"
else
puts "Positive"
end
|
a,b=gets.chomp.split.map(&:to_i)
if a*b <= 0
puts "Zero"
elsif a > 0
puts "Positive"
elsif (b-a).even?
puts "Negative"
else
puts "Positive"
end
|
[
"literal.string.change",
"call.arguments.change"
] | 1,523,532
| 1,523,533
|
u868089307
|
ruby
|
p04033
|
array = gets.split(" ")
array.map!{|i|i.to_i}
all_num = 1
if array[0]*array[1] <= 0
puts "Zero"
elsif array[1] < 0 && (array[1] - array[0]).odd?
puts "Negative"
else
puts "Positive"
end
|
array = gets.split(" ")
array.map!{|i|i.to_i}
all_num = 1
if array[0]*array[1] <= 0
puts "Zero"
elsif array[1] < 0 && (array[1] - array[0]).even?
puts "Negative"
else
puts "Positive"
end
|
[
"identifier.change",
"control_flow.branch.if.condition.change"
] | 1,523,669
| 1,523,670
|
u441320643
|
ruby
|
p04033
|
a, b = gets.chomp.split(" ").map(&:to_i)
if a > 0 then
puts "Positive"
elsif a < 0 && b >= 0 then
puts "Zero"
elsif (b - a + 1).even? then
puts "Positive"
else
puts "Negatiive"
end
|
a, b = gets.chomp.split(" ").map(&:to_i)
if a > 0 then
puts "Positive"
elsif a < 0 && b >= 0 then
puts "Zero"
elsif (b - a + 1).even? then
puts "Positive"
else
puts "Negative"
end
|
[
"literal.string.change",
"call.arguments.change"
] | 1,523,867
| 1,523,868
|
u910756197
|
ruby
|
p04033
|
a,b=gets.split(" ").map(&:to_i)
if (a<0&&b>0)||a==0||b==0 then
puts "Zero"
elsif a>0||(a-b)%2==0 then
puts "Positive"
else
puts "Negative"
end
|
a,b=gets.split(" ").map(&:to_i)
if (a<0&&b>0)||a==0||b==0 then
puts "Zero"
elsif a>0||(a-b)%2==1 then
puts "Positive"
else
puts "Negative"
end
|
[
"literal.number.integer.change",
"control_flow.branch.if.condition.change"
] | 1,523,985
| 1,523,986
|
u360090862
|
ruby
|
p04033
|
a,b=gets.split.map &:to_i
if a>0
puts :Positive
elsif b>=0
puts :Zero
else
puts [:Positive,:Negative][b-a%2]
end
|
a,b=gets.split.map &:to_i
if a>0
puts :Positive
elsif b>=0
puts :Zero
else
puts [:Negative,:Positive][b-a%2]
end
|
[
"literal.array.change"
] | 1,524,022
| 1,524,023
|
u280667879
|
ruby
|
p04034
|
n,m = gets.split.map &:to_i
red = Array.new(n){ false }
red[0] = true
num = Array.new(n){ 1 }
m.times do
x,y = gets.split.map &:to_i
x -= 1
y -= 1
num[y] += 1
num[x] -= 1
red[y] = red[x]
red[x] &&= num[x] > 0
end
puts red.select(&:itself).size
|
n,m = gets.split.map &:to_i
red = Array.new(n){ false }
red[0] = true
num = Array.new(n){ 1 }
m.times do
x,y = gets.split.map &:to_i
x -= 1
y -= 1
num[y] += 1
num[x] -= 1
red[y] ||= red[x]
red[x] &&= num[x] > 0
end
puts red.select(&:itself).size
|
[] | 1,524,158
| 1,524,159
|
u106964380
|
ruby
|
p04034
|
N,M=gets.split.map(&:to_i)
x,y=M.times.map{gets.split.map{|e|e.to_i-1}}.transpose
pos=Array.new(N,false)
cnt=Array.new(N,1)
pos[0]=true
N.times do |i|
pos[y[i]]=true if pos[x[i]]
cnt[y[i]]+=1
cnt[x[i]]-=1
pos[x[i]]=false if cnt[x[i]]==0
end
res=0
N.times do |i|
res+=1 if pos[i]
end
puts res
|
N,M=gets.split.map(&:to_i)
x,y=M.times.map{gets.split.map{|e|e.to_i-1}}.transpose
pos=Array.new(N,false)
cnt=Array.new(N,1)
pos[0]=true
M.times do |i|
pos[y[i]]=true if pos[x[i]]
cnt[y[i]]+=1
cnt[x[i]]-=1
pos[x[i]]=false if cnt[x[i]]==0
end
res=0
N.times do |i|
res+=1 if pos[i]
end
puts res
|
[] | 1,524,183
| 1,524,184
|
u926099741
|
ruby
|
p04035
|
(n, l) = gets.split.map {|x| x.to_i}
a = gets.split.map {|x| x.to_i}
a.unshift(0)
#p a
n.times { |i|
if (a[i+1] >= l)
puts "Possible"
1.upto(i-1) { |j|
puts j
}
(n-1).downto(i) { |j|
puts j
}
exit
end
if (a[i] + a[i+1] >= l)
puts "Possible"
1.upto(i-1) { |j|
puts j
}
(n-1).downto(i+1) { |j|
puts j
}
puts i
exit
end
}
puts "Impossible"
|
(n, l) = gets.split.map {|x| x.to_i}
a = gets.split.map {|x| x.to_i}
a.unshift(0)
#p a
n.times { |i|
if (a[i+1] >= l)
puts "Possible"
1.upto(i) { |j|
puts j
}
(n-1).downto(i+1) { |j|
puts j
}
exit
end
if (a[i] + a[i+1] >= l)
puts "Possible"
1.upto(i-1) { |j|
puts j
}
(n-1).downto(i+1) { |j|
puts j
}
puts i
exit
end
}
puts "Impossible"
|
[
"expression.operation.binary.remove"
] | 1,525,434
| 1,525,435
|
u584272055
|
ruby
|
p04039
|
n,k=gets.split.map(&:to_i)
d=gets.split
loop do
break unless n.to_s.chars.include? d
n=n+1
end
puts n
|
n,k=gets.split.map(&:to_i)
d=gets.split
loop do
break if d - n.to_s.chars == d
n=n+1
end
puts n
|
[
"control_flow.branch.if.condition.change"
] | 1,525,747
| 1,525,748
|
u056944756
|
ruby
|
p04043
|
a = gets.split.map(&:to_i)
puts (a.count(5) == 2 && a.count(7) == 1) ? "Yes" : "No"
|
a = gets.split.map(&:to_i)
puts (a.count(5) == 2 && a.count(7) == 1) ? "YES" : "NO"
|
[
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 1,527,599
| 1,527,600
|
u056083754
|
ruby
|
p04043
|
a = gets.split.map(&:to_i)
puts a.count(5) == 2 and a.count(7) == 1 ? "Yes" : "No"
|
a = gets.split.map(&:to_i)
puts (a.count(5) == 2 && a.count(7) == 1) ? "YES" : "NO"
|
[
"control_flow.branch.if.condition.change",
"expression.operation.binary.change",
"literal.string.change",
"literal.string.case.change"
] | 1,527,601
| 1,527,600
|
u056083754
|
ruby
|
p04043
|
a = gets.chomp.split(" ").map(&:to_i)
x = a[0]
y = a[1]
z = a[2]
if (x == 5 && y == 5 && z == 7) || (x == 5 && y == 7 && z == 5) || (x == 7 && y == 5 && z == 5)
p "YES"
else
p "NO"
end
|
a = gets.chomp.split(" ").map(&:to_i)
x = a[0]
y = a[1]
z = a[2]
if (x == 5 && y == 5 && z == 7) || (x == 5 && y == 7 && z == 5) || (x == 7 && y == 5 && z == 5)
print("YES")
else
print("NO")
end
|
[
"call.function.change",
"io.output.change",
"call.arguments.change"
] | 1,527,700
| 1,527,701
|
u265679940
|
ruby
|
p04043
|
# 整数の入力
a = gets.chomp.split(" ").map(&:to_i)
x = a[0]
y = a[1]
z = a[2]
if (x == 5 && y == 5 && z == 7) || (x == 5 && y == 7 && z == 5) || (x == 7 && y == 5 && z == 5)
p "YES"
else
p "NO"
end
|
a = gets.chomp.split(" ").map(&:to_i)
x = a[0]
y = a[1]
z = a[2]
if (x == 5 && y == 5 && z == 7) || (x == 5 && y == 7 && z == 5) || (x == 7 && y == 5 && z == 5)
print("YES")
else
print("NO")
end
|
[
"call.function.change",
"io.output.change",
"call.arguments.change"
] | 1,527,702
| 1,527,701
|
u265679940
|
ruby
|
p04043
|
a, b, c = gets.split(' ').to_i
if a + b + c ==17
if a == 7 && b == c
puts 'YES'
elsif b == 7 && a == c
puts 'YES'
elsif c == 7 && a == b
puts 'YES'
else
puts 'NO'
end
else
puts 'NO'
end
|
a, b, c = gets.split(' ').map(&:to_i)
if a + b + c == 17
if a == 7 && b == c
puts 'YES'
elsif b == 7 && a == c
puts 'YES'
elsif c == 7 && a == b
puts 'YES'
else
puts 'NO'
end
else
puts 'NO'
end
|
[
"assignment.value.change",
"identifier.change",
"call.arguments.add"
] | 1,527,743
| 1,527,744
|
u022164890
|
ruby
|
p04043
|
n = gets.split(" ").map(&:to_i)
p n.count(7) == 1 && n.count(5) == 2 ? "YES" : "NO"
|
n = gets.split(" ").map(&:to_i)
puts n.count(7) == 1 && n.count(5) == 2 ? "YES" : "NO"
|
[
"call.function.change",
"io.output.change"
] | 1,527,453
| 1,527,454
|
u768478434
|
ruby
|
p04043
|
N = gets.split.map(&:to_i)
xx = N.sort
y = [5, 5, 7]
if xx == y
puts "yes"
else
puts "no"
end
|
N = gets.split.map(&:to_i)
xx = N.sort
y = [5, 5, 7]
if xx == y
puts "YES"
else
puts "NO"
end
|
[
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 1,527,482
| 1,527,483
|
u462163804
|
ruby
|
p04043
|
line = gets.split
if line == ["5","5","7"] || ["5","7","5"] || ["7","5","5"]
puts "YES"
else
puts "NO"
end
|
line = gets.split
if line == ["5","5","7"] || line == ["5","7","5"] || line == ["7","5","5"]
puts "YES"
else
puts "NO"
end
|
[
"control_flow.branch.if.condition.change"
] | 1,527,911
| 1,527,912
|
u308894173
|
ruby
|
p04043
|
r = gets .split.map(&:to_i)
puts r.count(5) == 2 && r.count(7) == 1 ? "Yes":"No"
|
r = gets .split.map(&:to_i)
puts r.count(5) == 2 && r.count(7) == 1 ? "YES":"NO"
|
[
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 1,528,438
| 1,528,439
|
u467484398
|
ruby
|
p04043
|
puts %w(5 5 7) == gets.split.sort ? :Yes : :No
|
puts %w(5 5 7) == gets.split.sort ? 'YES' : 'NO'
|
[
"call.arguments.change"
] | 1,528,469
| 1,528,470
|
u467800529
|
ruby
|
p04043
|
p %w(5 5 7) == gets.split.sort ? 'Yes' : 'No'
|
puts %w(5 5 7) == gets.split.sort ? 'YES' : 'NO'
|
[
"call.function.change",
"io.output.change",
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 1,528,471
| 1,528,470
|
u467800529
|
ruby
|
p04043
|
puts %w(5 5 7) == gets.split.sort ? 'Yes' : 'No'
|
puts %w(5 5 7) == gets.split.sort ? 'YES' : 'NO'
|
[
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 1,528,472
| 1,528,470
|
u467800529
|
ruby
|
p04043
|
def hoge(nums)
return "NO" if nums.index(7).nil?
@count = 0
nums.each{|n| @count += 1 if n == 5 }
@count == 2 ? "YES" : "NO"
end
nums = gets.split.map(&:to_i)
p hoge(nums)
|
def hoge(nums)
return "NO" if nums.index(7).nil?
@count = 0
nums.each{|n| @count += 1 if n == 5 }
@count == 2 ? "YES" : "NO"
end
nums = gets.split.map(&:to_i)
puts hoge(nums)
|
[
"call.function.change",
"io.output.change"
] | 1,528,514
| 1,528,515
|
u067300355
|
ruby
|
p04043
|
def hoge(nums)
return "NO" if nums.index(7).nil?
@count = 0
nums.each{|n| @count += 1 if n == 5 }
@count == 2 ? "YES" : "NO"
end
nums = gets.split.map(&:to_i)
hoge(nums)
|
def hoge(nums)
return "NO" if nums.index(7).nil?
@count = 0
nums.each{|n| @count += 1 if n == 5 }
@count == 2 ? "YES" : "NO"
end
nums = gets.split.map(&:to_i)
puts hoge(nums)
|
[
"io.output.change",
"call.add"
] | 1,528,516
| 1,528,515
|
u067300355
|
ruby
|
p04043
|
input = $stdin.gets.chomp.split(' ')
puts (input.count("7")==2 && input.count("5")==1) ? "YES" : "NO";
|
input = $stdin.gets.chomp.split(' ')
puts (input.count("7")==1 && input.count("5")==2) ? "YES" : "NO";
|
[
"literal.number.integer.change",
"control_flow.branch.if.condition.change"
] | 1,528,762
| 1,528,763
|
u606813767
|
ruby
|
p04043
|
arr = gets.chomp.split.map(&:to_i)
arr.sort!
if arr[0]=5 && arr[1]=5 && arr[2]=7
puts "YES"
else
puts "NO"
end
|
arr = gets.chomp.split.map(&:to_i)
arr.sort!
if arr[0]==5 && arr[1]==5 && arr[2]==7
puts "YES"
else
puts "NO"
end
|
[
"expression.operation.compare.replace.add",
"assignment.replace.remove",
"misc.typo"
] | 1,528,981
| 1,528,982
|
u616320334
|
ruby
|
p04043
|
if "577" == gets.split.sort.join()
puts "YES"
else
puts "NO"
end
|
if "557" == gets.split.sort.join()
puts "YES"
else
puts "NO"
end
|
[
"literal.string.change",
"control_flow.branch.if.condition.change"
] | 1,529,054
| 1,529,055
|
u766205979
|
ruby
|
p04043
|
n, m, l = gets.split.map(&:to_i)
if [5, 7, 7] == [n, m, l].sort
puts 'YES'
else
puts 'NO'
end
|
n, m, l = gets.split.map(&:to_i)
if [5, 5, 7] == [n, m, l].sort
puts 'YES'
else
puts 'NO'
end
|
[
"literal.number.integer.change",
"control_flow.branch.if.condition.change"
] | 1,529,056
| 1,529,057
|
u766205979
|
ruby
|
p04043
|
n, m, l = gets.split.map(&:to_i)
if [5, 7, 7] == [n, m, l].sort
puts "YES"
else
puts "NO"
end
|
n, m, l = gets.split.map(&:to_i)
if [5, 5, 7] == [n, m, l].sort
puts 'YES'
else
puts 'NO'
end
|
[
"literal.number.integer.change",
"control_flow.branch.if.condition.change",
"literal.string.change",
"call.arguments.change"
] | 1,529,058
| 1,529,057
|
u766205979
|
ruby
|
p04043
|
a = gets.split.map(&:to_i).sort.join
puts a == '557' ? 'Yes' : 'No'
|
a = gets.split.map(&:to_i).sort.join
puts a == '557' ? 'YES' : 'NO'
|
[
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 1,529,120
| 1,529,121
|
u124214522
|
ruby
|
p04043
|
abc = gets.chomp.split.sort
if abc[0] == abc[1] && abc[0] == "5" && abc[2] == "7"
puts "Yes"
else
puts "No"
end
|
abc = gets.chomp.split.sort
if abc[0] == abc[1] && abc[0] == "5" && abc[2] == "7"
puts "YES"
else
puts "NO"
end
|
[
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 1,529,142
| 1,529,143
|
u840923028
|
ruby
|
p04043
|
a,b,c = gets.split.map(&:to_i)
if a == 7 && b == 5 && c == 5
puts "Yes"
elsif a == 5 && b == 7 && c == 5
puts "Yes"
elsif a == 5 && b == 5 && c == 7
puts "Yes"
else
puts "No"
end
|
a,b,c = gets.split.map(&:to_i)
if a == 7 && b == 5 && c == 5
puts "YES"
elsif a == 5 && b == 7 && c == 5
puts "YES"
elsif a == 5 && b == 5 && c == 7
puts "YES"
else
puts "NO"
end
|
[
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 1,529,148
| 1,529,149
|
u990788654
|
ruby
|
p04043
|
# encoding: utf-8
fline = gets
puts fline
ary = []
ary = fline.split(" ")
p ary
if ary.include?('7')
if ary.select{|n| n === '5'}.count === 2
ans = 'YES'
else
ans = 'NO'
end
else
ans = 'NO'
end
puts ans
|
# encoding: utf-8
fline = gets
ary = []
ary = fline.split(" ")
if ary.include?('7')
if ary.select{|n| n === '5'}.count === 2
ans = 'YES'
else
ans = 'NO'
end
else
ans = 'NO'
end
puts ans
|
[
"call.remove"
] | 1,529,162
| 1,529,163
|
u928977525
|
ruby
|
p04043
|
arr = gets.chomp.split.map{|x| x.to_i}
cnt_7 = 0
cnt_5 = 0
arr.times do |i|
if arr[i] == 5
cnt_5 += 1
elsif arr[i] == 7
cnt_7 += 1
end
end
if cnt_5 == 2 && cnt_7 == 1
puts 'YES'
else
puts 'NO'
end
|
arr = gets.chomp.split.map{|x| x.to_i}
cnt_7 = 0
cnt_5 = 0
arr.length.times do |i|
if arr[i] == 5
cnt_5 += 1
elsif arr[i] == 7
cnt_7 += 1
end
end
if cnt_5 == 2 && cnt_7 == 1
puts 'YES'
else
puts 'NO'
end
|
[
"call.add"
] | 1,529,181
| 1,529,182
|
u271044469
|
ruby
|
p04043
|
nums = gets.chomp.split.map(&:to_i)
if nums.count(5) == 2 && nums.cont(7) == 1
puts "YES"
else
puts "NO"
end
|
nums = gets.chomp.split.map(&:to_i)
if nums.count(5) == 2 && nums.count(7) == 1
puts "YES"
else
puts "NO"
end
|
[
"identifier.change",
"control_flow.branch.if.condition.change"
] | 1,529,371
| 1,529,372
|
u502774641
|
ruby
|
p04043
|
a = gets.chomp.split("").sort!.join
if a == '557'
puts 'YES'
else
puts 'NO'
end
|
a = gets.chomp.split("").sort!.join
if a.include?('557')
puts 'YES'
else
puts 'NO'
end
|
[
"control_flow.branch.if.condition.change",
"call.add"
] | 1,529,473
| 1,529,474
|
u180077477
|
ruby
|
p04043
|
NS = gets.split.map(:to_i)
puts(NS.sort == [5, 5, 7] ? 'YES' : 'NO')
|
NS = gets.split.map(&:to_i)
puts(NS.sort == [5, 5, 7] ? 'YES' : 'NO')
|
[
"call.arguments.change"
] | 1,529,486
| 1,529,487
|
u437302815
|
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'
|
[
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 1,529,492
| 1,529,493
|
u214983738
|
ruby
|
p04043
|
puts(if (gets.split.sort == ["5","5","7"]) then "Yes" else "NO" end)
|
puts(if (gets.split.sort == ["5","5","7"]) then "YES" else "NO" end)
|
[
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 1,529,562
| 1,529,563
|
u938109276
|
ruby
|
p04043
|
tab = gets.strip.map(&:to_i).sort
if tab[0] == 5 && tab[1] == 5 && tab[2] == 7
puts "Yes"
else
puts "No"
end
|
tab = gets.strip.split.map(&:to_i).sort
if tab[0] == 5 && tab[1] == 5 && tab[2] == 7
puts "YES"
else
puts "NO"
end
|
[
"call.add",
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 1,529,615
| 1,529,616
|
u013734211
|
ruby
|
p04043
|
five = 0
seven = 0
gets.chomp.split.each { |n|
num = n.to_i
if num == 5
five += 1
elsif num == 7
seven += 1
end
}
if five == 2 && seven == 1
puts 'OK'
else
puts 'NO'
end
|
five = 0
seven = 0
gets.chomp.split.each { |n|
num = n.to_i
if num == 5
five += 1
elsif num == 7
seven += 1
end
}
if five == 2 && seven == 1
puts 'YES'
else
puts 'NO'
end
|
[
"literal.string.change",
"call.arguments.change"
] | 1,529,876
| 1,529,877
|
u476736609
|
ruby
|
p04044
|
n, l = gets.chomp.split(' ').map(&:to_i)
list = []
n.times do
list << gets.chomp
end
list.sort
print list.join('')
|
n, l = gets.chomp.split(' ').map(&:to_i)
list = []
n.times do
list << gets.chomp
end
list.sort!
print list.join('')
|
[
"call.suffix.change"
] | 1,529,970
| 1,529,971
|
u978288665
|
ruby
|
p04044
|
N, L = gets.split.map(&:to_i)
S = N.times.map{gets.chomp}.sort[0,L].join
puts S
|
N, L = gets.split.map(&:to_i)
S = N.times.map{gets.chomp}.sort.join
puts S
|
[] | 1,530,087
| 1,530,088
|
u984479733
|
ruby
|
p04044
|
L,N = gets.split(" ").map(&:to_i)
s = N.times.map{gets.chomp}.sort
puts s.join
|
L,N = gets.split.map(&:to_i)
s = L.times.map{ gets.chomp }.sort
puts s.join
|
[
"call.arguments.change",
"assignment.value.change"
] | 1,530,138
| 1,530,139
|
u462163804
|
ruby
|
p04044
|
L,N = gets.split(" ").map(&:to_i)
s = N.times.map{ gets.chomp }.sort
puts s.join
|
L,N = gets.split.map(&:to_i)
s = L.times.map{ gets.chomp }.sort
puts s.join
|
[
"call.arguments.change",
"assignment.value.change"
] | 1,530,140
| 1,530,139
|
u462163804
|
ruby
|
p04044
|
L, N = gets.split.map(&:to_i)
s = N.times.map{ gets.chomp }.sort
puts s.join
|
L,N = gets.split.map(&:to_i)
s = L.times.map{ gets.chomp }.sort
puts s.join
|
[
"assignment.value.change"
] | 1,530,142
| 1,530,139
|
u462163804
|
ruby
|
p04044
|
L, N = gets.split(" ").map(&:to_i)
s = N.times.map{ gets.chomp }.sort
puts s.join
|
n,l = gets.split(" ").map(&:to_i)
s = n.times.map{gets.chomp}.sort
puts s.join
|
[
"assignment.variable.change",
"assignment.value.change"
] | 1,530,141
| 1,530,143
|
u462163804
|
ruby
|
p04044
|
l, n = gets.split
s = []
n.to_i.times { s << gets.chomp }
s.sort.each { |i| printf i }
|
n, l = gets.split
s = []
n.to_i.times { s << gets.chomp }
s.sort.each { |i| printf i }
|
[] | 1,530,539
| 1,530,540
|
u624505752
|
ruby
|
p04044
|
n, m = gets.split.map(&:to_i)
words = []
n.times do
words.push(gets.chomp)
end
puts words.sort[0]
|
n, m = gets.split.map(&:to_i)
words = []
n.times do
words.push(gets.chomp)
end
puts words.sort.join
|
[
"call.arguments.change"
] | 1,530,543
| 1,530,544
|
u866325115
|
ruby
|
p04044
|
a,b=gets.split(" ").map(&:to_i)
array=[]
a.times{
array << gets.champ
}
puts array.sort.join
|
a,b=gets.split(" ").map(&:to_i)
array=[]
a.times{
array << gets.chomp
}
puts array.sort.join
|
[
"identifier.change",
"expression.operation.binary.change"
] | 1,530,556
| 1,530,557
|
u085647568
|
ruby
|
p04044
|
a,b=gets.split.map(&:to_i)
array=[]
b.times{
array << gets.chomp
}
puts array.sort.join
|
a,b=gets.split(" ").map(&:to_i)
array=[]
a.times{
array << gets.chomp
}
puts array.sort.join
|
[
"call.arguments.add",
"identifier.change"
] | 1,530,558
| 1,530,557
|
u085647568
|
ruby
|
p04044
|
n, l = gets.split.map(&:to_i).sort
arr = n.times.map{gets.chomp}.sort.join
puts arr
|
n, l = gets.split.map(&:to_i)
arr = n.times.map{gets.chomp}.sort.join
puts arr
|
[
"call.remove"
] | 1,530,631
| 1,530,632
|
u876846619
|
ruby
|
p04044
|
L, N = gets.split.map(&:to_i)
words = []
N.times do
words << gets.chomp
end
puts words.sort.join
|
N, L = gets.split.map(&:to_i)
words = []
N.times do
words << gets.chomp
end
puts words.sort.join
|
[] | 1,530,700
| 1,530,701
|
u502306384
|
ruby
|
p04044
|
n_l = gets.chomp.split(' ').map(&:to_i)
ss = []
n_l[0].times do
ss << gets.chomp
end
ss.sort
puts ss.join
|
n_l = gets.chomp.split(' ').map(&:to_i)
ss = []
n_l[0].times do
ss << gets.chomp
end
ss.sort!
puts ss.join
|
[
"call.suffix.change"
] | 1,530,711
| 1,530,712
|
u808711621
|
ruby
|
p04044
|
list = gets.chomp.split(" ").map{|aa| aa.to_i}
n = list[0]
l = list[1]
str = []
for i in 0..l-1
str[i] = gets.chomp.to_s
end
str = str.sort
puts str.join
|
list = gets.chomp.split(" ").map{|aa| aa.to_i}
n = list[0]
l = list[1]
str = []
for i in 0..n-1
str[i] = gets.chomp.to_s
end
str = str.sort
puts str.join
|
[
"identifier.change",
"expression.operation.binary.change"
] | 1,530,768
| 1,530,769
|
u876281298
|
ruby
|
p04044
|
n,l=gets.split().map(&:to_i)
s=[]
n.times{s<<gets.chomp}
s.sort!
r=''
n.times{|i|r+=s[i]}
p r
|
n,l=gets.split().map(&:to_i)
s=[]
n.times{s<<gets.chomp}
s.sort!
r=""
n.times{|i|r+=s[i]}
puts r
|
[
"call.function.change",
"io.output.change"
] | 1,530,981
| 1,530,982
|
u534978789
|
ruby
|
p04044
|
n, l = gets.split.map(&:to_i)
a = n.times.map{gets.chomp}
pp a.sort.join
|
n, l = gets.split.map(&:to_i)
a = n.times.map{gets.chomp}
puts a.sort.join
|
[
"call.function.change",
"io.output.change"
] | 1,531,103
| 1,531,104
|
u819939299
|
ruby
|
p04044
|
words = []
N,L = gets.split.map(&:to_i)
N.times do
words << gets.chomp
end
words.sort! do |a,b|
result = a <=> b
end
p words.inject(:+)
|
words = []
N,L = gets.split.map(&:to_i)
N.times do
words << gets.chomp
end
words.sort! do |a,b|
result = a <=> b
end
puts words.inject(:+)
|
[
"call.function.change",
"io.output.change"
] | 1,531,759
| 1,531,760
|
u979208312
|
ruby
|
p04044
|
n,l=gets.chomp.split.map(:to_i);a=[];1.upto(n){a<<gets.chomp};puts a.sort.join('')
|
n,l=gets.chomp.split.map(&:to_i);a=[];1.upto(n){a<<gets.chomp};puts a.sort.join('')
|
[
"call.arguments.change"
] | 1,531,763
| 1,531,764
|
u018539875
|
ruby
|
p04044
|
num, len = gets.split.to_a
list = []
num.to_i.times {
list.push gets
}
puts list.sort.join
|
num, len = gets.split
list = []
num.to_i.times {
list.push gets.chomp
}
puts list.sort.join
|
[
"call.remove",
"call.add"
] | 1,531,778
| 1,531,779
|
u521750665
|
ruby
|
p04045
|
n,k = gets.split.map(&:to_i)
a = n.to_s.split('').map(&:to_i)
d = gets.split.map(&:to_i)
(n..9999).each do |f|
q = f.to_s.split('').map(&:to_i)
if !q.any? {|y| d.include?(y)}
p f
exit
end
end
|
n,k = gets.split.map(&:to_i)
a = n.to_s.split('').map(&:to_i)
d = gets.split.map(&:to_i)
(n..99999).each do |f|
q = f.to_s.split('').map(&:to_i)
if !q.any? {|y| d.include?(y)}
p f
exit
end
end
|
[
"literal.number.integer.change"
] | 1,532,235
| 1,532,236
|
u875730451
|
ruby
|
p04045
|
n,k = gets.split.map(&:to_i)
a = n.to_s.split('').map(&:to_i)
d = gets.split.map(&:to_i)
(n..10000).each do |f|
q = f.to_s.split('').map(&:to_i)
if !q.any? {|y| d.include?(y)}
p f
exit
end
end
|
n,k = gets.split.map(&:to_i)
a = n.to_s.split('').map(&:to_i)
d = gets.split.map(&:to_i)
(n..99999).each do |f|
q = f.to_s.split('').map(&:to_i)
if !q.any? {|y| d.include?(y)}
p f
exit
end
end
|
[
"literal.number.integer.change"
] | 1,532,237
| 1,532,236
|
u875730451
|
ruby
|
p04045
|
N, = gets.split
D = gets.split.map(&:to_i)
digits = ([*0..9]-D).sort
nz = digits[0]!=0 ? digits[0] : digits[1]
borrow = N.size-2-(N.each_char.reverse_each.with_index.inject(nil){|borrow, ci|
n, i = ci[0].ord-'0'.ord, ci[1]
m = digits.find{|d| borrow==i-1 ? n<d : n<=d }
next m.nil? ? i : borrow
}||-2)
over = false
p N.each_char.with_index.inject(borrow==-1?nz:0){|a,ci|
n, i = ci[0].ord-'0'.ord, ci[1]
m = over ? digits[0] : digits.find{|d| borrow == i ? n<d : n<=d }
over ||= n<m
next a*10 + m
}
|
N, = gets.split
D = gets.split.map(&:to_i)
digits = ([*0..9]-D).sort
nz = digits[0]!=0 ? digits[0] : digits[1]
borrow = N.size-2-(N.each_char.reverse_each.with_index.inject(nil){|borrow, ci|
n, i = ci[0].ord-'0'.ord, ci[1]
m = digits.find{|d| borrow==i-1 ? n<d : n<=d }
next m.nil? ? i : borrow
}||-2)
over = borrow==-1
p N.each_char.with_index.inject(borrow==-1?nz:0){|a,ci|
n, i = ci[0].ord-'0'.ord, ci[1]
m = over ? digits[0] : digits.find{|d| borrow == i ? n<d : n<=d }
over ||= n<m
next a*10 + m
}
|
[
"assignment.value.change"
] | 1,532,346
| 1,532,347
|
u977697682
|
ruby
|
p04045
|
# せいぜいひとつ繰り上がって10*Nになる程度なので
# 全探索で構わんという罠
n, k = gets.chomp.split.map(&:to_i)
arr = gets.chomp.split
p arr
n.upto(10*n) do |i|
flag = true
i.to_s.chars.each do |c|
if arr.include?(c)
flag = false
break
end
end
if flag
puts i
exit
end
end
|
# せいぜいひとつ繰り上がって10*Nになる程度なので
# 全探索で構わんという罠
n, k = gets.chomp.split.map(&:to_i)
arr = gets.chomp.split
n.upto(10*n) do |i|
flag = true
i.to_s.chars.each do |c|
if arr.include?(c)
flag = false
break
end
end
if flag
puts i
exit
end
end
|
[
"call.remove"
] | 1,532,591
| 1,532,592
|
u445624660
|
ruby
|
p04045
|
n=gets.to_i
d=gets.split
loop do
j=true
l=n.to_s.length
l.times do |i|
if d.include?(n.to_s[l-1-i])
n+=10**i
j=false
break
end
end
break if j
end
p n
|
n=gets.to_i
d=gets.split
loop do
j=true
l=n.to_s.length
l.times do |i|
if d.include?(n.to_s[l-1-i])
n+=1
j=false
break
end
end
break if j
end
p n
|
[
"literal.number.integer.change",
"expression.operation.binary.change",
"expression.operation.binary.remove"
] | 1,532,644
| 1,532,645
|
u554838392
|
ruby
|
p04045
|
n, k = gets.split.map(&:to_i)
d = gets.split
n.upto(9999) do |num|
check = 0
num.to_s.each_char do |digit|
if d.include?(digit) then
check = 1
break
end
end
if check == 0 then
print num
exit
end
end
|
n, k = gets.split.map(&:to_i)
d = gets.split
n.upto(10*n) do |num|
check = 0
num.to_s.each_char do |digit|
if d.include?(digit) then
check = 1
break
end
end
if check == 0 then
print num
exit
end
end
|
[
"literal.number.integer.change",
"call.arguments.change"
] | 1,532,767
| 1,532,768
|
u118284895
|
ruby
|
p04045
|
puts proc{ |n,d| (n...10000).select{ |i| i.to_s.chars.all?{ |j| !d.include?(j) }}.first}.(gets.to_i,gets.split)
|
p proc{ |n,d| (n..100000).select{ |i| i.to_s.chars.all?{ |j| !d.include?(j) }}.first}.(gets.to_i,gets.split)
|
[
"identifier.change",
"call.arguments.change"
] | 1,532,789
| 1,532,790
|
u871239364
|
ruby
|
p04045
|
p proc{ |n,d| (n..10000).select{ |i| i.to_s.chars.all?{ |j| !d.include?(j) }}.first}.(gets.to_i,gets.split)
|
p proc{ |n,d| (n..100000).select{ |i| i.to_s.chars.all?{ |j| !d.include?(j) }}.first}.(gets.to_i,gets.split)
|
[
"literal.number.integer.change",
"call.arguments.change"
] | 1,532,791
| 1,532,790
|
u871239364
|
ruby
|
p04046
|
h, w, a, b = gets.strip.split.map(&:to_i)
MOD = 10**9+7
def power(x, n)
return 1 if n.zero?
if n.even?
return power(x*x, n/2) % MOD
else
return x*power(x, n/2)**2 % MOD
end
end
$fac = []
$fac[0] = $fac[1] = 1
2.upto(h+w) do |num|
$fac[num] = num * $fac[num-1]
end
$ifac = []
$ifac[0] = $ifac[1] = 1
$ifac[h+w-2] = power($fac[h+w-2], (MOD-2)) % MOD
(h+w-3).downto(2) do |num|
$ifac[num] = $ifac[num+1] * (num+1) % MOD
end
def comb(n,k)
return 0 if n<k || n<0 || k<0
$fac[n] * ($ifac[n-k] * $ifac[k] % MOD) % MOD
end
sum = 0
(b+1).upto(w) do |num|
c1 = comb(h-a-1+num-1, num-1)
c2 = comb(a-1+w-num+1-1, a-1)
sum += c1*c2 % MOD
end
p sum%MOD
#p $fac
#p $ifac
|
h, w, a, b = gets.strip.split.map(&:to_i)
MOD = 10**9+7
def power(x, n)
return 1 if n.zero?
if n.even?
return power(x*x, n/2) % MOD
else
return x*power(x, n/2)**2 % MOD
end
end
$fac = []
$fac[0] = $fac[1] = 1
2.upto(h+w) do |num|
$fac[num] = num * $fac[num-1] % MOD
end
$ifac = []
$ifac[0] = $ifac[1] = 1
$ifac[h+w-2] = power($fac[h+w-2], (MOD-2)) % MOD
(h+w-3).downto(2) do |num|
$ifac[num] = $ifac[num+1] * (num+1) % MOD
end
def comb(n,k)
return 0 if n<k || n<0 || k<0
$fac[n] * ($ifac[n-k] * $ifac[k] % MOD) % MOD
end
sum = 0
(b+1).upto(w) do |num|
c1 = comb(h-a-1+num-1, num-1)
c2 = comb(a-1+w-num+1-1, a-1)
sum += c1*c2 % MOD
end
p sum%MOD
#p $fac
#p $ifac
|
[
"assignment.change"
] | 1,532,864
| 1,532,865
|
u021358975
|
ruby
|
p04046
|
h, w, a, b = gets.strip.split.map(&:to_i)
MOD = 10**9+7
def power(x, n)
return 1 if n.zero?
if n.even?
return power(x*x, n/2) % MOD
else
return x*power(x, n/2)**2 % MOD
end
end
$fac = []
$fac[0] = $fac[1] = 1
2.upto(h+w) do |num|
$fac[num] = num * $fac[num-1]
end
$ifac = []
$ifac[0] = $ifac[1] = 1
$ifac[h+w-2] = power($fac[h+w-2], (MOD-2)) % MOD
(h+w-3).downto(2) do |num|
$ifac[num] = $ifac[num+1] * (num+1) % MOD
end
def comb(n,k)
return 0 if n<k || n<0 || k<0
$fac[n] * $ifac[n-k] * $ifac[k] % MOD
end
sum = 0
(b+1).upto(w) do |num|
c1 = comb(h-a-1+num-1, num-1)
c2 = comb(a-1+w-num+1-1, a-1)
sum += c1*c2 % MOD
end
p sum%MOD
#p $fac
#p $ifac
|
h, w, a, b = gets.strip.split.map(&:to_i)
MOD = 10**9+7
def power(x, n)
return 1 if n.zero?
if n.even?
return power(x*x, n/2) % MOD
else
return x*power(x, n/2)**2 % MOD
end
end
$fac = []
$fac[0] = $fac[1] = 1
2.upto(h+w) do |num|
$fac[num] = num * $fac[num-1] % MOD
end
$ifac = []
$ifac[0] = $ifac[1] = 1
$ifac[h+w-2] = power($fac[h+w-2], (MOD-2)) % MOD
(h+w-3).downto(2) do |num|
$ifac[num] = $ifac[num+1] * (num+1) % MOD
end
def comb(n,k)
return 0 if n<k || n<0 || k<0
$fac[n] * ($ifac[n-k] * $ifac[k] % MOD) % MOD
end
sum = 0
(b+1).upto(w) do |num|
c1 = comb(h-a-1+num-1, num-1)
c2 = comb(a-1+w-num+1-1, a-1)
sum += c1*c2 % MOD
end
p sum%MOD
#p $fac
#p $ifac
|
[
"assignment.change",
"expression.operation.binary.add"
] | 1,532,866
| 1,532,865
|
u021358975
|
ruby
|
p04047
|
n = gets.to_i
l = gets.chomp.split(' ').map(&:to_i).sort.reverse
sum = 0
n.times do |i|
sum += l[(i+1)]
end
print sum
|
n = gets.to_i
l = gets.chomp.split(' ').map(&:to_i).sort
sum = 0
n.times do |i|
sum += l[(i*2)]
end
print sum
|
[
"call.remove"
] | 1,533,065
| 1,533,066
|
u978288665
|
ruby
|
p04047
|
count = gets.chomp.to_i
line = gets.chomp.split(" ").map(&:to_i)
line2 = line.sort
line3 = line2.each_slice(2).to_a
reslut = []
(0..count-1).each do |i|
minnum = line3[i].min
reslut.push(minnum)
end
p reslut
puts reslut.inject(:+)
|
count = gets.chomp.to_i
line = gets.chomp.split(" ").map(&:to_i)
line2 = line.sort
line3 = line2.each_slice(2).to_a
reslut = []
(0..count-1).each do |i|
minnum = line3[i].min
reslut.push(minnum)
end
puts reslut.inject(:+)
|
[
"call.remove"
] | 1,533,127
| 1,533,128
|
u343055017
|
ruby
|
p04047
|
count = gets.chomp.to_i
line = gets.chomp.split(" ").map(&:to_i)
line2 = line.sort
line3 = line2.each_slice(2).to_a
reslut = []
(0..count-1).each do |i|
maxnum = line3[i].max
reslut.push(maxnum)
end
p reslut.inject(:+)
|
count = gets.chomp.to_i
line = gets.chomp.split(" ").map(&:to_i)
line2 = line.sort
line3 = line2.each_slice(2).to_a
reslut = []
(0..count-1).each do |i|
minnum = line3[i].min
reslut.push(minnum)
end
puts reslut.inject(:+)
|
[
"assignment.variable.change",
"identifier.change",
"misc.opposites",
"assignment.value.change",
"call.arguments.change",
"call.function.change",
"io.output.change"
] | 1,533,129
| 1,533,128
|
u343055017
|
ruby
|
p04047
|
count = gets.chomp.to_i
line = gets.chomp.split(" ").map(&:to_i)
line2 = line.sort
line3 = line2.each_slice(2).to_a
reslut = []
(0..count-1).each do |i|
maxnum = line3[i].max
reslut.push(maxnum)
end
puts reslut.inject(:+)
|
count = gets.chomp.to_i
line = gets.chomp.split(" ").map(&:to_i)
line2 = line.sort
line3 = line2.each_slice(2).to_a
reslut = []
(0..count-1).each do |i|
minnum = line3[i].min
reslut.push(minnum)
end
puts reslut.inject(:+)
|
[
"assignment.variable.change",
"identifier.change",
"misc.opposites",
"assignment.value.change",
"call.arguments.change"
] | 1,533,130
| 1,533,128
|
u343055017
|
ruby
|
p04047
|
n = gets.to_i
as=gets.split.map &:to_i
puts as.sort.each_slice(2).map(&:last).inject (:+)
|
n = gets.to_i
as=gets.split.map &:to_i
puts as.sort.reverse.each_slice(2).map(&:last).inject (:+)
|
[
"call.add"
] | 1,533,242
| 1,533,243
|
u926099741
|
ruby
|
p04047
|
sum=0
list = STDIN.read.split(/\n/).last.split(/\s/).map(&:to_i)
list.sort!
while (list.pop)
sum += list.pop
p sum
end
puts sum
|
sum=0
list = STDIN.read.split(/\n/).last.split(/\s/).map(&:to_i)
list.sort!
while (list.pop)
sum += list.pop
end
puts sum
|
[
"call.remove"
] | 1,533,459
| 1,533,460
|
u351502293
|
ruby
|
p04047
|
sum=0
list = STDIN.read.split(/\n/).last.split(/\s/).map(&:to_i)
list.sort!
while (a = list.pop)
sum += list.pop
p sum
end
puts sum
|
sum=0
list = STDIN.read.split(/\n/).last.split(/\s/).map(&:to_i)
list.sort!
while (list.pop)
sum += list.pop
end
puts sum
|
[
"call.remove"
] | 1,533,461
| 1,533,460
|
u351502293
|
ruby
|
p04047
|
gets
puts gets.split.map(&:to_i).each_slice(2).map{|x,y|x}.inject(&:+)
|
gets
puts gets.split.map(&:to_i).sort.each_slice(2).map{|x,y|x}.inject(&:+)
|
[
"call.add"
] | 1,533,590
| 1,533,591
|
u056944756
|
ruby
|
p04047
|
gets
x = []
p gets.split.map(&:to_i).sort.each_slice(2) {|a| x << a.min}
puts x.inject(:+)
|
gets;x=[];gets.split.map(&:to_i).sort.each_slice(2) {|a|x<<a.min};p x.inject(:+)
|
[
"io.output.change",
"call.add"
] | 1,533,592
| 1,533,593
|
u534173972
|
ruby
|
p04047
|
gets
x = []
p gets.split.map(&:to_i).sort.each_slice(2) {|a| x << a.min}
puts x.inject(:+)
|
gets;x = [];gets.split.map(&:to_i).sort.each_slice(2) {|a| x << a.min};p x.inject(:+)
|
[
"io.output.change",
"call.add"
] | 1,533,592
| 1,533,594
|
u534173972
|
ruby
|
p04047
|
gets
x = []
p gets.split.map(&:to_i).sort.each_slice(2) {|a| x << a.min}
puts x.inject(:+)
|
gets
x = []
gets.split.map(&:to_i).sort.each_slice(2) {|a| x << a.min}
p x.inject(:+)
|
[
"io.output.change",
"call.remove",
"identifier.change"
] | 1,533,592
| 1,533,595
|
u534173972
|
ruby
|
p04047
|
gets
x = []
p gets.split.map(&:to_i).sort.each_slice(2) {|a| x << a.min}
puts x.inject(:+)
|
gets
x = []
gets.split.map(&:to_i).sort.each_slice(2) {|a| x << a.min}
puts x.inject(:+)
|
[
"io.output.change",
"call.remove"
] | 1,533,592
| 1,533,596
|
u534173972
|
ruby
|
p04045
|
n,m = gets.split.map(&:to_i)
A = gets.split.map(&:to_i)
y = 1
while y == 1
B = Array.new(6)
x = n
i = 0
while i <= 5
B[i] = x%10
x = x/10
if x == 0
i = 100
end
end
if (A & B).length != 0
n = n + 1
else
y = 2
end
end
puts n
|
n,m = gets.split.map(&:to_i)
A = gets.split.map(&:to_i)
y = 1
while y == 1
B = Array.new(6)
x = n
i = 0
while i <= 5
B[i] = x%10
x = x/10
i += 1
if x == 0
i = 100
end
end
if (A & B).length != 0
n = n + 1
else
y = 2
end
end
puts n
|
[] | 1,533,761
| 1,533,762
|
u399527088
|
ruby
|
p04045
|
io = STDIN
n,k=io.gets.chomp.split.map(&:to_i)
d=io.gets.chomp.split.map(&:to_i)
like=((0..9).to_a - d)
(n..10000).each do |x|
if x.to_s
.split(//)
.map(&:to_i)
.all?{|a|like.include?(a)}
puts x
break
end
end
|
io = STDIN
n,k=io.gets.chomp.split.map(&:to_i)
d=io.gets.chomp.split.map(&:to_i)
like=((0..9).to_a - d)
(n..99999).each do |x|
if x.to_s
.split(//)
.map(&:to_i)
.all?{|a|like.include?(a)}
puts x
break
end
end
|
[
"literal.number.integer.change"
] | 1,533,861
| 1,533,862
|
u132360211
|
ruby
|
p04048
|
n,x = gets.split.map(&:to_i)
def para(a,b)
short,long = [a,b].sort
if short == long
return short
elsif long % short == 0
return long*2 - short
elsif short < long
return 2*short(long/short) + para(short,long%short)
end
end
puts n + para(x,n-x)
|
n,x = gets.split.map(&:to_i)
def para(a,b)
short,long = [a,b].sort
if short == long
return short
elsif long % short == 0
return long*2 - short
elsif short < long
return 2*short*(long/short) + para(short,long%short)
end
end
puts n + para(x,n-x)
|
[
"call.arguments.change",
"function.return_value.change"
] | 1,534,361
| 1,534,362
|
u386799456
|
ruby
|
p04048
|
n,x = gets.split.map(&:to_i)
def para(a,b)
short,long = [a,b].sort
if short == long
return short
elsif long % short == 0
return long*2 - short
elsif short < long
return 2*short(long/short) + para(long,long%short)
end
end
puts n + para(x,n-x)
|
n,x = gets.split.map(&:to_i)
def para(a,b)
short,long = [a,b].sort
if short == long
return short
elsif long % short == 0
return long*2 - short
elsif short < long
return 2*short*(long/short) + para(short,long%short)
end
end
puts n + para(x,n-x)
|
[
"call.arguments.change",
"function.return_value.change",
"identifier.change",
"expression.operation.binary.change"
] | 1,534,363
| 1,534,362
|
u386799456
|
ruby
|
p04045
|
def hate?(v, hates)
return hates[v] if v < 10
return true if hates[v % 10]
hate?(v / 10, hates)
end
def solve(n, k, d)
hates = Array.new(10)
d.each {|i| hates[i] = true}
(0..Float::INFINITY1).lazy
.map{|i| n + i }
.find { |i| !hate?(i, hates) }
end
def main
stdin = STDIN.gets
nk = stdin.split(/\s/)
n = nk[0].to_i
k = nk[1].to_i
stdin = STDIN.gets
d = stdin.split(/\s/).map!(&:to_i)
puts solve(n, k, d)
end
main
|
def hate?(v, hates)
return hates[v] if v < 10
return true if hates[v % 10]
hate?(v / 10, hates)
end
def solve(n, k, d)
hates = Array.new(10)
d.each {|i| hates[i] = true}
(0..Float::INFINITY).lazy
.map{|i| n + i }
.find { |i| !hate?(i, hates) }
end
def main
stdin = STDIN.gets
nk = stdin.split(/\s/)
n = nk[0].to_i
k = nk[1].to_i
stdin = STDIN.gets
d = stdin.split(/\s/).map!(&:to_i)
puts solve(n, k, d)
end
main
|
[] | 1,534,435
| 1,534,436
|
u923888512
|
ruby
|
p04045
|
N, K = gets.split.map(&:to_i)
D_array = gets.split.map(&:to_i)
ans = 0
N.upto(10000) do |i|
next if D_array.any? { |d| i.to_s.chars.map(&:to_i).include?(d) }
puts i
exit
end
|
N, K = gets.split.map(&:to_i)
D_array = gets.split.map(&:to_i)
ans = 0
N.upto(10*N) do |i|
next if D_array.any? { |d| i.to_s.chars.map(&:to_i).include?(d) }
puts i
exit
end
|
[
"literal.number.integer.change",
"call.arguments.change"
] | 1,534,455
| 1,534,456
|
u093372948
|
ruby
|
p04048
|
n,x = gets.split.map(&:to_i)
p (n-1)*3
|
n,x = gets.split.map(&:to_i)
p (n-n.gcd(x))*3
|
[
"identifier.replace.add",
"literal.replace.remove",
"call.arguments.change",
"expression.operation.binary.change",
"call.add"
] | 1,534,497
| 1,534,498
|
u397763977
|
ruby
|
p04046
|
####### 二項係数 C(n,k) mod pの計算 #######
MOD=10**9+7
FACT=[]
INV=[]
def pow(a,b)
return 1 if b==0
return a*pow(a,b-1)%MOD if b%2==1
return pow(a**2%MOD,b/2)
end
def calc_fact(n)
FACT[0]=1
INV[0]=pow(FACT[0],MOD-2)
for i in 1..n
FACT[i]=FACT[i-1]*i%MOD
INV[i]=pow(FACT[i],MOD-2)
end
end
def com(n,k)
(FACT[n]*INV[n-k]%MOD)*INV[k]%MOD
end
#########################################
H,W,A,B=gets.split.map(&:to_i)
calc_fact(H+W-2)
ans=0
for i in 1..H-A do
ans+=frac(i+B-2,B-1)*frac(H+W-i-B-1,W-B-1)%MOD
end
puts ans%MOD
|
####### 二項係数 C(n,k) mod pの計算 #######
MOD=10**9+7
FACT=[]
INV=[]
def pow(a,b)
return 1 if b==0
return a*pow(a,b-1)%MOD if b%2==1
return pow(a**2%MOD,b/2)
end
def calc_fact(n)
FACT[0]=1
INV[0]=pow(FACT[0],MOD-2)
for i in 1..n
FACT[i]=FACT[i-1]*i%MOD
INV[i]=pow(FACT[i],MOD-2)
end
end
def com(n,k)
(FACT[n]*INV[n-k]%MOD)*INV[k]%MOD
end
#########################################
H,W,A,B=gets.split.map(&:to_i)
calc_fact(H+W-2)
ans=0
for i in 1..H-A do
ans+=com(i+B-2,B-1)*com(H+W-i-B-1,W-B-1)%MOD
end
puts ans%MOD
|
[
"identifier.change",
"expression.operation.binary.change"
] | 1,534,793
| 1,534,794
|
u041282550
|
ruby
|
p04046
|
####### 二項係数 C(n,k) mod pの計算 #######
MOD=10**9+7
FACT=[]
INV=[]
def pow(a,b)
return 1 if b==0
return a*pow(a,b-1)%MOD if b%2==1
return pow(a**2%MOD,b/2)
end
def calc_fact(n)
FACT[0]=1
INV[0]=pow(FACT[0],MOD-2)
for i in i..n
FACT[i]=FACT[i-1]*i%MOD
INV[i]=pow(FACT[i],MOD-2)
end
end
def com(n,k)
(FACT[n]*INV[n-k]%MOD)*INV[k]%MOD
end
#########################################
H,W,A,B=gets.split.map(&:to_i)
calc_fact(H+W-2)
ans=0
for i in 1..H-A do
ans+=frac(i+B-2,B-1)*frac(H+W-i-B-1,W-B-1)%MOD
end
puts ans%MOD
|
####### 二項係数 C(n,k) mod pの計算 #######
MOD=10**9+7
FACT=[]
INV=[]
def pow(a,b)
return 1 if b==0
return a*pow(a,b-1)%MOD if b%2==1
return pow(a**2%MOD,b/2)
end
def calc_fact(n)
FACT[0]=1
INV[0]=pow(FACT[0],MOD-2)
for i in 1..n
FACT[i]=FACT[i-1]*i%MOD
INV[i]=pow(FACT[i],MOD-2)
end
end
def com(n,k)
(FACT[n]*INV[n-k]%MOD)*INV[k]%MOD
end
#########################################
H,W,A,B=gets.split.map(&:to_i)
calc_fact(H+W-2)
ans=0
for i in 1..H-A do
ans+=com(i+B-2,B-1)*com(H+W-i-B-1,W-B-1)%MOD
end
puts ans%MOD
|
[
"identifier.replace.remove",
"literal.replace.add",
"identifier.change",
"expression.operation.binary.change"
] | 1,534,795
| 1,534,794
|
u041282550
|
ruby
|
p00000
|
a = 1..9
a.map { |i| a.map { |j| [[i, j].join('x'), i * j].join('=') } }
|
a = 1..9
a.map { |i| a.map { |j| puts [[i, j].join('x'), i * j].join('=') } }
| null | 2,751
| 2,752
|
u890794282
|
ruby
|
p00000
|
def kuku
a = [1, 2, 3, 4, 5, 6, 7, 8, 9]
b = [1, 2, 3, 4, 5, 6, 7, 8, 9]
c = Array.new(9).map { Array.new(9) }
9.times do |i|
9.times do |j|
c[i][j] = a[i] * b[j]
puts "#{i + 1} x #{j + 1} = #{c[i][j]}"
end
end
end
kuku
|
def kuku
a = [1, 2, 3, 4, 5, 6, 7, 8, 9]
b = [1, 2, 3, 4, 5, 6, 7, 8, 9]
c = Array.new(9).map { Array.new(9) }
9.times do |i|
9.times do |j|
c[i][j] = a[i] * b[j]
puts "#{i + 1}x#{j + 1}=#{c[i][j]}"
end
end
end
kuku
| null | 2,764
| 2,765
|
u229669351
|
ruby
|
p00000
|
(1..9).map { |i| (1..9).map { |j| puts "#{i} * #{j} = #{i * j} " } }
|
(1..9).map { |i| (1..9).map { |j| puts "#{i}x#{j}=#{i * j}" } }
| null | 2,791
| 2,792
|
u648595404
|
ruby
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.