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 |
|---|---|---|---|---|---|---|---|
p02699
|
s,w = gets.chomp.split.map(&:to_i)
if s < w
puts 'unsafe'
else puts 'safe'
end
|
s,w = gets.chomp.split.map(&:to_i)
if s <= w
puts 'unsafe'
else puts 'safe'
end
|
[
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 448,238
| 448,239
|
u895926909
|
ruby
|
p02699
|
s, w = gets.chom.split(" ").map(&:to_i)
if w >= s
puts "unsafe"
else
puts "safe"
end
|
s, w = gets.chomp.split(" ").map(&:to_i)
if w >= s
puts "unsafe"
else
puts "safe"
end
|
[
"assignment.value.change",
"identifier.change"
] | 448,809
| 448,810
|
u097182283
|
ruby
|
p02699
|
s,w = gets.split(" ").map(&:to_i)
puts s < w ? 'unsafe' : 'safe'
|
s,w = gets.split(" ").map(&:to_i)
puts w >= s ? 'unsafe' : 'safe'
|
[
"expression.operation.binary.remove",
"control_flow.branch.if.condition.change"
] | 449,018
| 449,019
|
u872636244
|
ruby
|
p02700
|
a_hp,a_at,b_hp,b_at = gets.chomp.split.map &:to_i
cnt = 1
a_flg = 0
b_flg = 0
while a_hp > 0 && b_hp > 0
b_hp -= a_at if cnt.odd?
a_hp -= b_at if cnt.even?
cnt += 1
# p "cnt: #{cnt},a,b: #{a_hp},#{b_hp}"
end
a_flg = 1 if b_hp <= 0
b_flg = 1 if a_hp <= 0
if a_flg
print 'Yes'
else
print 'No'
end
|
a_hp,a_at,b_hp,b_at = gets.chomp.split.map &:to_i
cnt = 1
a_flg = nil
b_flg = nil
while a_hp > 0 && b_hp > 0
b_hp -= a_at if cnt.odd?
a_hp -= b_at if cnt.even?
#p "cnt: #{cnt}, a: #{a_hp}, b: #{b_hp}"
cnt += 1
end
a_flg = 1 if b_hp <= 0
b_flg = 1 if a_hp <= 0
if a_flg
print 'Yes'
else
print 'No'
end
|
[
"assignment.value.change"
] | 449,750
| 449,751
|
u896269838
|
ruby
|
p02700
|
a_hp,a_at,b_hp,b_at = gets.chomp.split.map &:to_i
cnt = 1
a_flg = 0
b_flg = 0
while a_hp > 0 || b_hp > 0
b_hp -= a_at if cnt.odd?
a_hp -= b_at if cnt.even?
cnt += 1
end
a_flg = 1 if b_hp <= 0
b_flg = 1 if a_hp <= 0
if a_flg
print 'Yes'
else
print 'No'
end
|
a_hp,a_at,b_hp,b_at = gets.chomp.split.map &:to_i
cnt = 1
a_flg = nil
b_flg = nil
while a_hp > 0 && b_hp > 0
b_hp -= a_at if cnt.odd?
a_hp -= b_at if cnt.even?
#p "cnt: #{cnt}, a: #{a_hp}, b: #{b_hp}"
cnt += 1
end
a_flg = 1 if b_hp <= 0
b_flg = 1 if a_hp <= 0
if a_flg
print 'Yes'
else
print 'No'
end
|
[
"assignment.value.change",
"misc.opposites",
"expression.operation.binary.change"
] | 449,752
| 449,751
|
u896269838
|
ruby
|
p02700
|
a, b, c, d = gets.split.map(&:to_i)
takahashi_turn = (c%b == 0 ? c/b : c/b + 1)
aoki_turn = (a%d == 0? a/d : a/d + 1)
if takahashi_turn >= aoki_turn
puts "Yes"
else
puts "No"
end
|
a, b, c, d = gets.split.map(&:to_i)
aoki_turn = (c%b == 0 ? c/b : c/b + 1)
takahashi_turn = (a%d == 0 ? a/d : a/d + 1)
if takahashi_turn >= aoki_turn
puts "Yes"
else
puts "No"
end
|
[
"assignment.variable.change",
"identifier.change"
] | 449,810
| 449,811
|
u358554431
|
ruby
|
p02700
|
A,B,C,D = gets.chomp.split('').map(&:to_i)
countA = C % B == 0 ? C/B : C/B + 1
countC = A % D == 0 ? A/D : A/D + 1
if countA <= countC
puts('Yes')
else
puts('No')
end
|
A,B,C,D = gets.chomp.split(' ').map(&:to_i)
countA = C % B == 0 ? C/B : C/B + 1
countC = A % D == 0 ? A/D : A/D + 1
if countA <= countC
puts('Yes')
else
puts('No')
end
|
[
"literal.string.change",
"assignment.value.change",
"call.arguments.change"
] | 449,831
| 449,832
|
u662951622
|
ruby
|
p02700
|
hp1,at1,hp2,at2=gets.split.map!(&:to_i)
kai1=0
kai2=0
while hp2>0
hp2-=at1
kai1+=1
end
while hp1>0
hp1-=at2
kai2+=1
end
puts kai1
puts kai2
if kai1<=kai2
puts "Yes"
else
puts "No"
end
|
hp1,at1,hp2,at2=gets.split.map!(&:to_i)
kai1=0
kai2=0
while hp2>0
hp2-=at1
kai1+=1
end
while hp1>0
hp1-=at2
kai2+=1
end
if kai1<=kai2
puts "Yes"
else
puts "No"
end
|
[
"call.remove"
] | 449,854
| 449,855
|
u977506075
|
ruby
|
p02700
|
line = gets.split(' ').map(&:to_i)
thp = line[0]
tat = line[1]
ahp = line[2]
aat = line[3]
for i in 1..1000 do
ahp -= tat
if ahp <= 0 then
print "Yes"
break
end
thp -= aat
if ahp <= 0 then
print "No"
break
end
end
|
line = gets.split(' ').map(&:to_i)
thp = line[0]
tat = line[1]
ahp = line[2]
aat = line[3]
for i in 1..1000 do
ahp -= tat
if ahp <= 0 then
print "Yes"
break
end
thp -= aat
if thp <= 0 then
print "No"
break
end
end
|
[
"identifier.change",
"control_flow.branch.if.condition.change"
] | 450,225
| 450,226
|
u569559028
|
ruby
|
p02700
|
line = gets.split(' ').map(&:to_i)
takhp = line[0]
takatt = line[1]
aokhp = line[2]
aokatt = line[3]
loop do
aokhp = aokhp - takatt
takhp = takhp - aokatt
if aokhp <= 0 then
answer = "Yes"
break
end
if takhp <= 0 then
answer = "No"
break
end
end
print answer
|
line = gets.split(' ').map(&:to_i)
takhp = line[0]
takatt = line[1]
aokhp = line[2]
aokatt = line[3]
for i in 1..1000000
aokhp = aokhp - takatt
takhp = takhp - aokatt
if aokhp <= 0 then
answer = "Yes"
break
end
if takhp <= 0 then
answer = "No"
break
end
end
print answer
|
[] | 450,227
| 450,228
|
u569559028
|
ruby
|
p02700
|
a,b,c,d=gets.chomp.split.map(&:to_i)
class Monster
attr_accessor :name, :hitpoint, :attackpoint, :status
def initialize(name, hitpoint, attackpoint, status)
@name=name
@hitpoint=hitpoint
@attackpoint=attackpoint
@status=status
end
def attackEnemy(target)
target.receiveDamage(@attackpoint)
end
def receiveDamage(damage)
@hitpoint-=damage
end
def isAlive
if @hitpoint<=0
@status="dead"
else
@status="alive"
end
end
end
player1=Monster.new("takahashi",a,b,"alive")
player2=Monster.new("aoki",c,d,"alive")
inBattle=true
attacker=player1
receiver=player2
while inBattle==true do
attacker.attackEnemy(receiver)
receiver.isAlive
if receiver.status=="dead"
inBattle=false
else
attacker,receiver=receiver,attacker
end
end
if attacker.name=="takahashi"
puts "yes"
else
puts "no"
end
|
a,b,c,d=gets.chomp.split.map(&:to_i)
class Monster
attr_accessor :name, :hitpoint, :attackpoint, :status
def initialize(name, hitpoint, attackpoint, status)
@name=name
@hitpoint=hitpoint
@attackpoint=attackpoint
@status=status
end
def attackEnemy(target)
target.receiveDamage(@attackpoint)
end
def receiveDamage(damage)
@hitpoint-=damage
end
def isAlive
if @hitpoint<=0
@status="dead"
else
@status="alive"
end
end
end
player1=Monster.new("takahashi",a,b,"alive")
player2=Monster.new("aoki",c,d,"alive")
inBattle=true
attacker=player1
receiver=player2
while inBattle==true do
attacker.attackEnemy(receiver)
receiver.isAlive
if receiver.status=="dead"
inBattle=false
else
attacker,receiver=receiver,attacker
end
end
if attacker.name=="takahashi"
puts "Yes"
else
puts "No"
end
|
[
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 450,431
| 450,432
|
u168915361
|
ruby
|
p02700
|
a, b, c, d = gets.split.map(&:to_i)
puts ((a + b - 1) / b >= (c + d - 1) / d) ? "Yes" : "No"
|
a, b, c, d = gets.split.map(&:to_i)
puts ((c + b - 1) / b <= (a + d - 1) / d) ? "Yes" : "No"
|
[
"identifier.change",
"control_flow.branch.if.condition.change",
"misc.opposites",
"expression.operator.compare.change"
] | 451,030
| 451,031
|
u926099741
|
ruby
|
p02700
|
a, b, c, d = gets.split.map(&:to_i)
loop{
s = (
if (c -= b) <= 0
'No'
elsif (a -= d) <= 0
'Yes'
end)
unless s.nil?
puts s
break
end
}
|
a, b, c, d = gets.split.map(&:to_i)
loop{
s = (
if (c -= b) <= 0
'Yes'
elsif (a -= d) <= 0
'No'
end)
unless s.nil?
puts s
break
end
}
|
[
"literal.string.change",
"assignment.value.change"
] | 451,120
| 451,121
|
u692083672
|
ruby
|
p02700
|
HP_t, ATT_t, HP_a, ATT_a = gets.split
tHP = HP_t.to_i
tATT = ATT_t.to_i
aHP = HP_a.to_i
aATT = ATT_a.to_i
while(aHP >= 0 || tHP >= 0)
aHP = aHP - tATT
if(aHP <=0)
p 'Yes'
break
end
tHP = tHP - aATT
if(tHP <=0)
p 'No'
break
end
end
|
HP_t, ATT_t, HP_a, ATT_a = gets.split
tHP = HP_t.to_i
tATT = ATT_t.to_i
aHP = HP_a.to_i
aATT = ATT_a.to_i
while(aHP >= 0 || tHP >= 0)
aHP = aHP - tATT
if(aHP <=0)
print 'Yes'
break
end
tHP = tHP - aATT
if(tHP <=0)
print 'No'
break
end
end
|
[
"call.function.change",
"io.output.change"
] | 451,305
| 451,306
|
u470192783
|
ruby
|
p02700
|
a, b, c, d = gets.chop.split.map(&:to_i)
until a <= 0 || c <= 0
a -= d
c -= b
end
if a <= 0 && c <= 0
puts "Yes"
elsif a <= 0
puts "Yes"
else
puts "No"
end
|
a, b, c, d = gets.chop.split.map(&:to_i)
until a <= 0 || c <= 0
a -= d
c -= b
end
if a <= 0 && c <= 0
puts "Yes"
elsif c <= 0
puts "Yes"
else
puts "No"
end
|
[
"identifier.change",
"control_flow.branch.if.condition.change"
] | 452,014
| 452,015
|
u020467031
|
ruby
|
p02700
|
def count(hp,bp)
if(hp%bp!=0)
return hp/bp+1
end
return hp/bp
end
A,B,C,D = gets.split()
if(count(A.to_i(),D.to_i())<count(C.to_i(),B.to_i()))
puts('Yes')
else
puts('No')
end
|
def count(hp,bp)
if(hp%bp!=0)
return hp/bp+1
end
return hp/bp
end
A,B,C,D = gets.split()
if(count(A.to_i(),D.to_i())>=count(C.to_i(),B.to_i()))
puts('Yes')
else
puts('No')
end
|
[
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 452,133
| 452,134
|
u628268449
|
ruby
|
p02700
|
def count(hp,bp)
if(hp%bp==0)
return hp/bp+1
end
return hp/bp
end
A,B,C,D = gets.split()
if(count(A.to_i(),D.to_i())<count(C.to_i(),B.to_i()))
puts('Yes')
else
puts('No')
end
|
def count(hp,bp)
if(hp%bp!=0)
return hp/bp+1
end
return hp/bp
end
A,B,C,D = gets.split()
if(count(A.to_i(),D.to_i())>=count(C.to_i(),B.to_i()))
puts('Yes')
else
puts('No')
end
|
[
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 452,135
| 452,134
|
u628268449
|
ruby
|
p02700
|
def count(hp,bp)
if(hp%bp==0)
return hp/bp+1
end
return hp/bp
end
A,B,C,D = gets.split()
if(count(A.to_i(),D.to_i())<=count(C.to_i(),B.to_i()))
puts('Yes')
else
puts('No')
end
|
def count(hp,bp)
if(hp%bp!=0)
return hp/bp+1
end
return hp/bp
end
A,B,C,D = gets.split()
if(count(A.to_i(),D.to_i())>=count(C.to_i(),B.to_i()))
puts('Yes')
else
puts('No')
end
|
[
"misc.opposites",
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 452,136
| 452,134
|
u628268449
|
ruby
|
p02700
|
a, b, c, d = gets.chomp.split(" ").map(&:to_i)
i = 0
while a > 0 && b > 0
if i % 2 == 0
c -= b
else
a -= d
end
i += 1
end
puts a > c ? "Yes" : "No"
|
a, b, c, d = gets.chomp.split(" ").map(&:to_i)
i = 0
while a > 0 && c> 0
if i % 2 == 0
c -= b
else
a -= d
end
i += 1
end
puts a > c ? "Yes" : "No"
|
[
"identifier.change",
"expression.operation.binary.change"
] | 452,308
| 452,309
|
u466332671
|
ruby
|
p02700
|
a, b, c, d = gets.chomp.split(" ").map(&:to_i)
i = 0
while a <= 0 || b <= 0
if i % 2 == 0
c -= b
else
a -= d
end
i += 1
end
puts a > c ? "Yes" : "No"
|
a, b, c, d = gets.chomp.split(" ").map(&:to_i)
i = 0
while a > 0 && c> 0
if i % 2 == 0
c -= b
else
a -= d
end
i += 1
end
puts a > c ? "Yes" : "No"
|
[
"expression.operator.compare.change",
"expression.operation.binary.change"
] | 452,310
| 452,309
|
u466332671
|
ruby
|
p02700
|
A,B,C,D=$<.read.split.map(&:to_i)
a = (C/B.to_f).ceil
b = (A/D.to_f).ceil
if a <= b
p 'Yes'
else
p 'No'
end
|
A,B,C,D=$<.read.split.map(&:to_i)
a = (C/B.to_f).ceil
b = (A/D.to_f).ceil
if a <= b
puts 'Yes'
else
puts 'No'
end
|
[
"call.function.change",
"io.output.change"
] | 452,954
| 452,955
|
u852974293
|
ruby
|
p02701
|
n = gets.to_i
items = []
n.times do
items << gets
end
puts items.uniq
|
n = gets.to_i
items = []
n.times do
items.push gets.chomp
end
puts items.uniq.count
|
[
"expression.operation.binary.change",
"call.add"
] | 453,110
| 453,109
|
u365782862
|
ruby
|
p02701
|
n = gets.to_i
items = []
n.times do
items << gets
end
puts items.uniq
|
n = gets.to_i
items = []
n.times do
items.push gets.chomp
end
puts items.uniq.count
|
[
"expression.operation.binary.change",
"call.add"
] | 453,111
| 453,109
|
u365782862
|
ruby
|
p02701
|
n = gets.to_i
s = []
n.times do |i|
s << gets.chomp
end
puts s.count
|
n = gets.to_i
s = []
n.times do |i|
s << gets.chomp
end
puts s.uniq.count
|
[
"call.add"
] | 453,250
| 453,251
|
u684458716
|
ruby
|
p02701
|
num = gets.to_i
ary = []
num.times do |i|
ary += gets.chomp.to_s
end
puts ary.uniq.length
|
num = gets.to_i
ary = []
num.times do |i|
ary[i] = gets.chomp.to_s
end
puts ary.uniq.length
|
[
"assignment.variable.change",
"variable_access.subscript.index.change"
] | 453,301
| 453,302
|
u883866798
|
ruby
|
p02701
|
gets.to_i.times.map{gets}.each{|a| a.chomp!}.uniq.count
|
p gets.to_i.times.map{gets}.each{|a| a.chomp!}.uniq.count
|
[
"io.output.change",
"call.add"
] | 453,331
| 453,332
|
u642486344
|
ruby
|
p02701
|
num = gets.to_i
item = []
i = 0
for i in 0..num-1
item[i] = gets.chomp
end
p item.uniq!.length
|
num = gets.to_i
item = []
i = 0
for i in 0..num-1
item[i] = gets.chomp
end
p item.uniq.length
|
[
"identifier.change",
"call.arguments.change"
] | 453,610
| 453,611
|
u470192783
|
ruby
|
p02701
|
count = gets.chomp.to_i
table = {}
count.times do |i|
s = gets.chomp
unless table[s]
table[s] = true
end
end
gets table.length
|
count = gets.chomp.to_i
table = {}
count.times do |i|
s = gets.chomp
unless table[s]
table[s] = true
end
end
puts table.length
|
[
"identifier.change"
] | 453,821
| 453,822
|
u664737319
|
ruby
|
p02701
|
io = STDINa
n=io.gets.to_i
hash=Hash.new{|h,k|h[k]=0}
n.times do
hash[io.gets.chomp]+=1
end
puts hash.size
|
io = STDIN
n=io.gets.to_i
hash=Hash.new{|h,k|h[k]=0}
n.times do
hash[io.gets.chomp]+=1
end
puts hash.size
|
[
"assignment.value.change"
] | 453,864
| 453,865
|
u132360211
|
ruby
|
p02702
|
s = gets.chomp
ans = 0
len = s.length
modCount = Array.new(2019,0)
bit = 1
sum = 0
len.times do |i|
sum += s[len-1-i].to_i * bit
sum %= 2019
bit = bit * 10 % 2019
modCount[sum] += 1
end
2019.times do |i|
ans += modCount[i] * (modCount[i]-1) / 2
end
puts ans
|
s = gets.chomp
ans = 0
len = s.length
modCount = Array.new(2019,0)
bit = 1
sum = 0
len.times do |i|
sum += s[len-1-i].to_i * bit
sum %= 2019
bit = bit * 10 % 2019
modCount[sum] += 1
end
2019.times do |i|
ans += modCount[i] * (modCount[i]-1) / 2
end
puts ans + modCount[0]
|
[
"expression.operation.binary.add"
] | 454,222
| 454,223
|
u265679940
|
ruby
|
p02702
|
S = gets.chomp
MOD = 2019
dp = Array.new(2019) { 0 }
dp[0] += 1
ans = 0
tens = 1
sum = 0
S.reverse.each_char do |s|
n = s.to_i
n *= tens
sum += n
sum %= MOD
ans += dp[n % MOD]
dp[n % MOD] += 1
tens *= 10
tens %= MOD
end
puts ans
|
S = gets.chomp
MOD = 2019
dp = Array.new(2019) { 0 }
dp[0] += 1
ans = 0
tens = 1
sum = 0
S.reverse.each_char do |s|
n = s.to_i
n *= tens
sum += n
sum %= MOD
ans += dp[sum]
dp[sum % MOD] += 1
tens *= 10
tens %= MOD
end
puts ans
|
[
"variable_access.subscript.index.change",
"expression.operation.binary.change",
"expression.operation.binary.remove",
"identifier.change"
] | 454,260
| 454,261
|
u123648284
|
ruby
|
p02702
|
s = gets
M = 2019
m = Hash.new(0)
sc = 1
dm = 0
s.reverse.each_char do |c|
dm += c.to_i * sc
dm %= M
#puts "#{c} #{dm}"
m[dm % M] += 1
sc *= 10
sc %= M
end
ans = 0
m.each do |key, value|
ans += value * (value-1) / 2 if 2 <= value
end
puts ans + m[0]
|
s = gets.chomp
M = 2019
m = Hash.new(0)
sc = 1
dm = 0
s.reverse.each_char do |c|
dm += c.to_i * sc
dm %= M
#puts "#{c} #{dm}"
m[dm % M] += 1
sc *= 10
sc %= M
end
ans = 0
m.each do |key, value|
ans += value * (value-1) / 2 if 2 <= value
end
puts ans + m[0]
|
[
"call.add"
] | 454,716
| 454,717
|
u605918955
|
ruby
|
p02702
|
g=[a=0]*M=2019;g[0]=t=1;gets.reverse.bytes{g[a=(a+_1%48*t=t*10%M)%M]+=1};p g.sum{_1*~-_1/2}
|
g=[a=0]*M=2019;t=1;gets.reverse.bytes{g[a=(a+_1%48*t=t*10%M)%M]+=1};p g.sum{_1*~-_1/2}
|
[
"assignment.remove"
] | 454,722
| 454,723
|
u032223772
|
ruby
|
p02702
|
g=[a=0]*M=2019;g[0]=t=1;gets.reverse.bytes{g[a=(a+_1%48*t=t*10%M)%M]+=1};p g.sum{_1*~-_1/2}
|
g=[a=0]*M=2019;g[0]=t=1;gets.chop.reverse.bytes{g[a=(a+_1%48*t=t*10%M)%M]+=1};p g.sum{_1*~-_1/2}
|
[
"call.add"
] | 454,722
| 454,724
|
u032223772
|
ruby
|
p02705
|
pi = 3.141592
r = gets.chomp.to_i
puts(pi*r)
|
pi = 3.141592
r = gets.chomp.to_i
puts(pi * 2 * r)
|
[
"expression.operation.binary.add"
] | 455,821
| 455,822
|
u054798759
|
ruby
|
p02705
|
p gets.to_i * Math::PI
|
p 2 * gets.to_i * Math::PI
|
[
"expression.operation.binary.add"
] | 455,860
| 455,861
|
u347948131
|
ruby
|
p02705
|
p gets.to_i*Math::PI
|
p gets.to_i*2*Math::PI
|
[
"expression.operation.binary.add"
] | 455,923
| 455,924
|
u091810847
|
ruby
|
p02705
|
a = gets.to_f
b = a*3.141
print b
|
a = gets.to_f
print a*3.141*2
|
[] | 456,115
| 456,116
|
u076018778
|
ruby
|
p02705
|
a = gets.to_i
p a*3.141
|
a = gets.to_f
print a*3.141*2
|
[
"expression.operation.binary.add"
] | 456,117
| 456,116
|
u076018778
|
ruby
|
p02705
|
a = gets.to_f
b = a*3.141
print b
|
a = gets.to_f
b = a*3.141*2
print b
|
[
"assignment.change"
] | 456,115
| 456,118
|
u076018778
|
ruby
|
p02705
|
line = gets
print line * 2 * 3.1415
|
line = gets.to_i
print line * 2 * 3.1415
|
[
"call.add"
] | 456,324
| 456,325
|
u569559028
|
ruby
|
p02705
|
R = gets.chomp.to_i
R * 2 * 3.14
|
include Math
R = gets.chomp.to_i
puts R * 2 * PI
|
[
"call.add",
"io.output.change",
"expression.operation.binary.change"
] | 456,439
| 456,440
|
u483258535
|
ruby
|
p02705
|
p r = gets.to_i
p pi = Math::PI
puts 2 * r * pi
|
r = gets.to_i
pi = Math::PI
puts 2 * r * pi
|
[
"io.output.change",
"call.remove"
] | 457,122
| 457,123
|
u819764843
|
ruby
|
p02705
|
n = gets.chomp.to_i
puts 2 * n * Math.PI
|
n = gets.chomp.to_i
puts 2 * n * Math::PI
|
[] | 457,307
| 457,308
|
u808711621
|
ruby
|
p02703
|
def enq(a,x)
b = a[i=-1]
until b.frozen?
return a << x if x >= (a=b)[-1]
return a.unshift x if x <= a[0]
b = a[i = a.bsearch_index{|y| x < (y.frozen? ? y: y[0])}-1]
end if b && b=a
return a.insert i+1, x unless a[i+9]
i>0 ? a[i]=[b,x] : enq(a[i+=1].to_a,x) rescue a[i]=[x,a[i]]
end
def deq(a) r=a.pop; a.push *a.pop if !a[-1].frozen?; r end
NS = 6; NM = (1<<NS)-1
SS = 13;SM = (1<<SS)-1
F =-> {gets.split.map &:to_i}
N,M,S = F[]
V = Array.new N
E = V.map { [] }
M.times {
u,v,a,b = F[]
u -= 1; v -= 1
E[u] << [v,a,b]
E[v] << [u,a,b]
}
X = V.map { c,d = F[]; [d, [c,2500].min] }
R,Q = [], [[S,2500].min]
while R.size < N
t = deq Q
s = SM & t; t >>= SS
n = NM & t; t >>= NS
(v = V[n]&.&SM) ? (next if v>=s || v>2500) : R << [n,t]
V[n] = (t<< SS) + s
x = X[n]
enq Q, (t-x[0]<<NS+SS) + (n<<SS) + s+x[1]
E[n].each {|n,a,b| enq Q, (t-b<<NS+SS) + (n<<SS) + s-a if s >= a }
end
puts R.sort![1,n].map{|i,t| -t}
|
def enq(a,x)
b = a[i=-1]
until b.frozen?
return a << x if x >= (a=b)[-1]
return a.unshift x if x <= a[0]
b = a[i = a.bsearch_index{|y| x < (y.frozen? ? y: y[0])}-1]
end if b && b=a
return a.insert i+1, x unless a[i+9]
i>0 ? a[i]=[b,x] : enq(a[i+=1].to_a,x) rescue a[i]=[x,a[i]]
end
def deq(a) r=a.pop; a.push *a.pop if !a[-1].frozen?; r end
NS = 6; NM = (1<<NS)-1
SS = 13;SM = (1<<SS)-1
F =-> {gets.split.map &:to_i}
N,M,S = F[]
V = Array.new N
E = V.map { [] }
M.times {
u,v,a,b = F[]
u -= 1; v -= 1
E[u] << [v,a,b]
E[v] << [u,a,b]
}
X = V.map { c,d = F[]; [d, [c,2500].min] }
R,Q = [], [[S,2500].min]
while R.size < N
t = deq Q
s = SM & t; t >>= SS
n = NM & t; t >>= NS
(v = V[n]&.&SM) ? (next if v>=s || v>2500) : R << [n,t]
V[n] = (t<<SS) + s
x = X[n]
enq Q, (t-x[0]<<NS+SS) + (n<<SS) + s+x[1]
E[n].each {|n,a,b| enq Q, (t-b<<NS+SS) + (n<<SS) + s-a if s >= a }
end
puts R.sort![1,N].map{|i,t| -t}
|
[] | 457,471
| 457,472
|
u720281401
|
ruby
|
p02703
|
def enq(a,x)
b = a[i=-1]
until b.frozen?
return a << x if x >= (a=b)[-1]
return a.unshift x if x <= a[0]
b = a[i = a.bsearch_index{|y| x < (y.frozen? ? y: y[0])}-1]
end if b && b=a
return a.insert i+1, x unless a[i+2]
i>0 ? a[i]=[b,x] : enq(a[i+=1].to_a,x) rescue a[i]=[x,a[i]]
end
def deq(a) r=a.pop; a.push *a.pop if !a[-1].frozen?; r end
NS = 6; NM = (1<< NS)-1
SS = 30; SM = (1<< SS)-1
F =-> {gets.split.map &:to_i}
N,M,S = F[]
E = Array.new(N) { [] }
M.times {
u,v,a,b = F[]
u -= 1; v -= 1
E[u] << [v,a,b]
E[v] << [u,a,b]
}
X = N.times.map { F[] }
V = Array.new N
Q,R = [S],[]
while R.size < N
t = deq Q
s = SM & t; t >>= SS
n = NM & t; t >>= NS
(v = V[n]&.&SM) ? (next if v>=s || v>=2500) : R << [n,t]
V[n] = (t<<SS) + s
x = X[n]
enq Q, ((t-x[1])<<NS+SS) + (n<<SS) + s+x[0]
E[n].each {|n,a,b| enq Q, ((t-b)<<NS+SS) + (n<<SS) + s-a if s >= a }
end
puts R.sort![1,n].map{|i,t| -t}
|
def enq(a,x)
b = a[i=-1]
until b.frozen?
return a << x if x >= (a=b)[-1]
return a.unshift x if x <= a[0]
b = a[i = a.bsearch_index{|y| x < (y.frozen? ? y: y[0])}-1]
end if b && b=a
return a.insert i+1, x unless a[i+2]
i>0 ? a[i]=[b,x] : enq(a[i+=1].to_a,x) rescue a[i]=[x,a[i]]
end
def deq(a) r=a.pop; a.push *a.pop if !a[-1].frozen?; r end
NS = 6; NM = (1<< NS)-1
SS = 30; SM = (1<< SS)-1
F =-> {gets.split.map &:to_i}
N,M,S = F[]
E = Array.new(N) { [] }
M.times {
u,v,a,b = F[]
u -= 1; v -= 1
E[u] << [v,a,b]
E[v] << [u,a,b]
}
X = N.times.map { F[] }
V = Array.new N
Q,R = [S],[]
while R.size < N
t = deq Q
s = SM & t; t >>= SS
n = NM & t; t >>= NS
(v = V[n]&.&SM) ? (next if v>=s || v>=2500) : R << [n,t]
V[n] = (t<<SS) + s
x = X[n]
enq Q, (t-x[1]<<NS+SS) + (n<<SS) + s+x[0]
E[n].each {|n,a,b| enq Q, (t-b<<NS+SS) + (n<<SS) + s-a if s >= a }
end
puts R.sort![1,N].map{|i,t| -t}
|
[] | 457,473
| 457,474
|
u720281401
|
ruby
|
p02705
|
puts (gets.to_f * 2 * Math.PI)
|
puts (gets.to_f * 2 * Math::PI)
|
[] | 457,750
| 457,751
|
u664737319
|
ruby
|
p02705
|
R = gets.to_i
puts R*Math::PI
|
include Math
R = gets.to_i
puts 2*R*PI
|
[
"call.add",
"call.arguments.change",
"io.output.change"
] | 457,830
| 457,831
|
u326288614
|
ruby
|
p02705
|
R = gets.to_i
puts R*Math::PI
|
R = gets.to_i
puts 2*R*Math::PI
|
[
"expression.operation.binary.add"
] | 457,830
| 457,833
|
u326288614
|
ruby
|
p02705
|
R = gets.to_i
puts Math::PI*R*R
|
R = gets.to_i
puts 2*Math::PI*R
|
[
"expression.operation.binary.remove"
] | 457,893
| 457,894
|
u901068031
|
ruby
|
p02705
|
R = gets.to_i
puts Math::PI*R*R
|
R = gets.to_i
puts 2*Math::PI*R
|
[
"expression.operation.binary.remove"
] | 457,893
| 457,895
|
u901068031
|
ruby
|
p02705
|
r = gets.to_i
p 2 * r * Math::P
|
r = gets.to_i
p 2 * r * Math::PI
|
[
"call.arguments.change",
"expression.operation.binary.change"
] | 458,022
| 458,023
|
u354261726
|
ruby
|
p02705
|
r = gets.chomp.to_i
puts r * Math::PI
#p r
|
r = gets.chomp.to_i
puts 2 * r * Math::PI
#p r
|
[
"expression.operation.binary.add"
] | 458,058
| 458,059
|
u409390792
|
ruby
|
p02706
|
x,y=gets.split.map!(&:to_i)
s=gets.splot.map!(&:to_i)
day=x-s.sum
if day>=0
puts day
else
puts -1
end
|
x,y=gets.split.map!(&:to_i)
s=gets.split.map!(&:to_i)
day=x-s.sum
if day>=0
puts day
else
puts -1
end
|
[
"assignment.value.change",
"identifier.change"
] | 458,724
| 458,725
|
u977506075
|
ruby
|
p02706
|
n, m = gets.split.map(&:to_i)
a = gets.split.map(&:to_i)
sum_day = 0
a.times do |i|
sum_day += a
end
puts n >= sum_day ? (n - sum_day) : -1
|
n, m = gets.split.map(&:to_i)
a = gets.split.map(&:to_i)
sum_day = 0
a.each do |i|
sum_day += i
end
puts n >= sum_day ? (n - sum_day) : -1
|
[
"identifier.change"
] | 458,970
| 458,971
|
u684458716
|
ruby
|
p02706
|
b,c=gets.chomp.split(" ").map(&:to_i);
Ar = gets.chomp.split(" ").map(&:to_i);
a=c
a= b-Ar.sum
a=-1 if a<1
puts a.to_s
|
b,c=gets.chomp.split(" ").map(&:to_i);
Ar = gets.chomp.split(" ").map(&:to_i);
a=c
a= b-Ar.sum
a=-1 if a<0
puts a
|
[
"literal.number.integer.change",
"control_flow.branch.if.condition.change",
"call.remove"
] | 459,132
| 459,133
|
u076018778
|
ruby
|
p02706
|
b,c=gets.chomp.split(" ").map(&:to_i);
Ar = gets.chomp.split(" ").map(&:to_i);
a=c
a= b-Ar.sum
a='-1' if a<1
puts a
|
b,c=gets.chomp.split(" ").map(&:to_i);
Ar = gets.chomp.split(" ").map(&:to_i);
a=c
a= b-Ar.sum
a=-1 if a<0
puts a
|
[
"literal.number.integer.change",
"control_flow.branch.if.condition.change"
] | 459,134
| 459,133
|
u076018778
|
ruby
|
p02706
|
b,c=gets.chomp.split(" ").map(&:to_i);
Ar = gets.chomp.split(" ").map(&:to_i);
a=c
a= b-Ar.sum
a=-1 if a<1
puts a
|
b,c=gets.chomp.split(" ").map(&:to_i);
Ar = gets.chomp.split(" ").map(&:to_i);
a=c
a= b-Ar.sum
a=-1 if a<0
puts a
|
[
"literal.number.integer.change",
"control_flow.branch.if.condition.change"
] | 459,135
| 459,133
|
u076018778
|
ruby
|
p02706
|
a=gets.split.map(&:to_i)
b=gets.split.map(&:to_i)
sum=b.inject(&:+).to_i
puts a[0]-sum>0? a[0]-sum:-1
|
a=gets.split.map(&:to_i)
b=gets.split.map(&:to_i)
sum=b.inject(&:+).to_i
puts a[0]-sum>=0? a[0]-sum:-1
|
[
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 460,397
| 460,398
|
u590472228
|
ruby
|
p02706
|
n = gets.chomp.split(' ').map(&:to_i)
a = gets.chomp.split(' ').map(&:to_i)
result = 0;
a.foreach do |b|
result += b
end
if n[0] >= result
puts n[0]-result
else
puts '-1'
end
|
n = gets.chomp.split(' ').map(&:to_i)
a = gets.chomp.split(' ').map(&:to_i)
result = 0;
a.each do |b|
result += b
end
if n[0] >= result
puts n[0]-result
else
puts '-1'
end
|
[
"identifier.change"
] | 460,740
| 460,741
|
u808711621
|
ruby
|
p02706
|
n, m = gets.strip.split.map(&:to_i)
a = gets.strip.split.map(&:to_i)
p max(n - a.sum, -1)
|
n, m = gets.strip.split.map(&:to_i)
a = gets.strip.split.map(&:to_i)
p [n - a.sum, -1].max
|
[
"call.arguments.change",
"call.add"
] | 460,788
| 460,789
|
u374892957
|
ruby
|
p02706
|
n,m = gets.split.map(&:to_i)
a = gets.split.map(&:to_i)
s = a.inject(:+)
if s >= n
puts -1
else
puts n-s
end
|
n,m = gets.split.map(&:to_i)
a = gets.split.map(&:to_i)
s = a.inject(:+)
if s > n
puts -1
else
puts n-s
end
|
[
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 460,991
| 460,992
|
u911373146
|
ruby
|
p02706
|
n,m = gets.split(" ").map(&:to_i)
line = gets.split(" ").map(&:to_i)
puts n - line.sum > 0 ? n - line.sum : -1
|
n,m = gets.split(" ").map(&:to_i)
line = gets.split(" ").map(&:to_i)
p n - line.sum >= 0 ? n - line.sum : -1
|
[
"identifier.change",
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 461,146
| 461,147
|
u734430573
|
ruby
|
p02706
|
n,m=gets.split.map(&:to_i)
a=gets.split.map(&:to_i)
puts n-a.sum>0 ? n-a.sum : -1
|
n,m=gets.split.map(&:to_i)
a=gets.split.map(&:to_i)
puts n-a.sum>=0 ? n-a.sum : -1
|
[
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 461,349
| 461,350
|
u744908753
|
ruby
|
p02706
|
n, m = gets.split(' ').map(&:to_i)
a = gets.split(' ').map(&:to_i)
if a.sum < n
puts n - a.sum
else
puts -1
end
|
n, m = gets.split(' ').map(&:to_i)
a = gets.split(' ').map(&:to_i)
if a.sum <= n
puts n - a.sum
else
puts -1
end
|
[
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 461,367
| 461,368
|
u308460366
|
ruby
|
p02707
|
x = Array.new(200001, 0)
n = gets.to_i
a = gets.split.map(&:to_i)
for i in a
x[i] += 1
end
1.upto a.length do |i|
puts x[i]
end
|
x = Array.new(200001, 0)
n = gets.to_i
a = gets.split.map(&:to_i)
for i in a
x[i] += 1
end
1.upto a.length+1 do |i|
puts x[i]
end
|
[
"expression.operation.binary.add"
] | 461,746
| 461,747
|
u419982549
|
ruby
|
p02707
|
n = gets.strip.to_i
a = gets.strip.split.map(&:to_i)
h = Array.new(n-1, 0)
a.each do |ai|
h[ai-1] += 1
end
h.each do |ha|
p ha
end
|
n = gets.strip.to_i
a = gets.strip.split.map(&:to_i)
h = Array.new(n, 0)
a.each do |ai|
h[ai-1] += 1
end
h.each do |ha|
p ha
end
|
[
"expression.operation.binary.remove"
] | 462,683
| 462,684
|
u374892957
|
ruby
|
p02707
|
n = gets.strip.to_i
a = gets.strip.split.map(&:to_i)
h = Array.new(n-1, 0)
a.each do |ai|
h[ai] += 1
end
h.each do |ha|
p ha
end
|
n = gets.strip.to_i
a = gets.strip.split.map(&:to_i)
h = Array.new(n, 0)
a.each do |ai|
h[ai-1] += 1
end
h.each do |ha|
p ha
end
|
[
"expression.operation.binary.remove"
] | 462,685
| 462,684
|
u374892957
|
ruby
|
p02707
|
n = gets.strip.to_i
a = gets.strip.split.map(&:to_i)
h = Hash.new(0)
a.each do |ai|
h[ai] += 1
end
h.each do |ha|
p ha
end
|
n = gets.strip.to_i
a = gets.strip.split.map(&:to_i)
h = Array.new(n, 0)
a.each do |ai|
h[ai-1] += 1
end
h.each do |ha|
p ha
end
|
[
"assignment.value.change",
"call.arguments.add"
] | 462,686
| 462,684
|
u374892957
|
ruby
|
p02707
|
n = gets.chomp.to_i
a = gets.chomp.split(" ").map{|i|i.to_i}
cnum = Array.new(n, 0)
a.each do |num|
cnum[num] += 1
end
1.upto(n) do |i|
puts cnum[i]
end
|
n = gets.chomp.to_i
a = gets.chomp.split(" ").map{|i|i.to_i}
cnum = Array.new(n+1, 0)
a.each do |num|
cnum[num] += 1
end
1.upto(n) do |i|
puts cnum[i]
end
|
[
"assignment.change"
] | 463,038
| 463,039
|
u742129941
|
ruby
|
p02707
|
n = gets.chomp.to_i
arr = gets.chomp.split(' ').map(&:to_i)
ans = Array.new(n,0)
(n-1).times do |k|
ans[(arr[k]-1)] += 1
end
p ans
n.times do |l|
puts ans[l]
end
|
n = gets.chomp.to_i
arr = gets.chomp.split(' ').map(&:to_i)
ans = Array.new(n,0)
(n-1).times do |k|
ans[(arr[k]-1)] += 1
end
n.times do |l|
puts ans[l]
end
|
[
"call.remove"
] | 463,456
| 463,457
|
u688809543
|
ruby
|
p02707
|
n = gets.to_i
a = gets.split.map(&:to_i)
ans = Array.new(n, 0)
a.each do |x|
ans[x] += 1
end
1.upto(n) do |x|
puts ans[x]
end
|
n = gets.to_i
a = gets.split.map(&:to_i)
ans = Array.new(n+1, 0)
a.each do |x|
ans[x] += 1
end
1.upto(n+1) do |x|
puts ans[x]
end
|
[
"assignment.change",
"expression.operation.binary.add"
] | 463,466
| 463,467
|
u605918955
|
ruby
|
p02708
|
n = gets.chomp.split(" ").map(&:to_i)
count = 0
for i in n[1]..(n[0] + 1) do
min = (i - 1)* i / 2
max = (n[1] * 2 + i - 1) * i / 2
sa = max - min + 1
count = (count + sa) % (10**9 + 7)
end
puts count
|
n = gets.chomp.split(" ").map(&:to_i)
count = 0
for i in n[1]..(n[0] + 1) do
min = (i - 1)* i / 2
max = (n[0] * 2 - i + 1) * i / 2
sa = max - min + 1
count = (count + sa) % (10**9 + 7)
end
puts count
|
[
"literal.number.integer.change",
"assignment.value.change",
"variable_access.subscript.index.change",
"expression.operation.binary.change",
"expression.operation.binary.remove"
] | 463,789
| 463,790
|
u412789323
|
ruby
|
p02708
|
n = gets.chomp.split(" ").map(&:to_i)
count = 0
for i in n[1]..(n[0] + 1)
min = (i - 1)* i / 2
max = (n[0] * 2 + i - 1) * i / 2
sa = max - min + 1
count = (count + sa) % (10**9 + 7)
end
puts count
|
n = gets.chomp.split(" ").map(&:to_i)
count = 0
for i in n[1]..(n[0] + 1) do
min = (i - 1)* i / 2
max = (n[0] * 2 - i + 1) * i / 2
sa = max - min + 1
count = (count + sa) % (10**9 + 7)
end
puts count
|
[
"expression.operation.binary.remove"
] | 463,791
| 463,790
|
u412789323
|
ruby
|
p02711
|
n = gets().chomp
found = false
n.split("\s").each do |x|
found = true if x.to_i == 7
end
puts found == true ? 'Yes' : 'No'
|
n = gets().chomp
found = false
n.split('').each do |x|
found = true if x.to_i == 7
end
puts found == true ? 'Yes' : 'No'
|
[] | 465,016
| 465,017
|
u810199299
|
ruby
|
p02711
|
s=gets.to_i
ans1=s%100
ans2=(s/10)%10
ans3=(s/100)%10
if ans1==7 || ans2==7 || ans3==7
puts "Yes"
else
puts "No"
end
|
s=gets.to_i
ans1=s%10
ans2=(s/10)%10
ans3=(s/100)%10
if ans1==7 || ans2==7 || ans3==7
puts "Yes"
else
puts "No"
end
|
[
"literal.number.integer.change",
"assignment.value.change",
"expression.operation.binary.change"
] | 465,386
| 465,387
|
u977506075
|
ruby
|
p02711
|
n = gets.split('').map(&:to_i)
puts n.<F4>include?(7) ? 'Yes': 'No'
|
n = gets.split('').map(&:to_i)
puts n.include?(7) ? 'Yes': 'No'
|
[
"call.remove"
] | 465,652
| 465,653
|
u684458716
|
ruby
|
p02711
|
n = gets.to_s
if n.include?("7")
puts "yes"
else
puts "no"
end
|
n = gets.to_s
if n.include?("7")
puts "Yes"
else
puts "No"
end
|
[
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 465,874
| 465,875
|
u133389966
|
ruby
|
p02711
|
n = gets.chomp.split(//)
puts n.include?('7') ? 'YES' : 'NO'
|
n = gets.chomp.split(//)
puts n.include?('7') ? 'Yes' : 'No'
|
[
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 465,906
| 465,907
|
u470192783
|
ruby
|
p02711
|
N = gets.to_s
a = N.count("7")
if a >= 1
puts "YES"
else
puts "No"
end
|
N = gets.to_s
a = N.count("7")
if a >= 1
puts "Yes"
else
puts "No"
end
|
[
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 466,655
| 466,656
|
u412789323
|
ruby
|
p02711
|
N = gets.to_s
a = N.count("7")
if a >= 1
puts "YES"
else
puts "No"
end
|
N = gets.to_s
a = N.count("7")
if a >= 1
puts "Yes"
else
puts "No"
end
|
[
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 466,657
| 466,656
|
u412789323
|
ruby
|
p02711
|
if gets.chomp.include("7")
puts "Yes"
else
puts "No"
end
|
if gets.chomp.include?("7")
puts "Yes"
else
puts "No"
end
|
[
"call.suffix.change"
] | 467,430
| 467,431
|
u085647568
|
ruby
|
p02711
|
n = gets.chomp.split("").map(&:to_i)
ans = 0
n.each do |i|
if i == 7
ans = "Yes"
else
ans = "No"
end
end
puts ans
|
n = gets.chomp.split("").map(&:to_i)
ans = ""
n.each do |i|
if i == 7
ans = "Yes"
puts ans
return
else
ans = "No"
end
end
puts ans
|
[
"assignment.value.change",
"call.add",
"control_flow.return.add"
] | 467,552
| 467,550
|
u122184618
|
ruby
|
p02711
|
n = gets
puts "#{(n.include? '7') ? 'YES' : 'NO'}"
|
n = gets
puts "#{(n.include? '7') ? 'Yes' : 'No'}"
|
[
"literal.string.change",
"call.arguments.change"
] | 467,892
| 467,893
|
u796654386
|
ruby
|
p02711
|
N = gets.split("")
if S.include?('7')
puts "Yes"
else
puts "No"
end
|
N = gets.split("")
if N.include?('7')
puts "Yes"
else
puts "No"
end
|
[
"control_flow.branch.if.condition.change"
] | 468,064
| 468,065
|
u729911058
|
ruby
|
p02711
|
line1 = gets.strip
s=line1.include?('7') ? 'yes' : 'no'
puts s
|
line1 = gets.strip
s=line1.include?('7') ? 'Yes' : 'No'
puts s
|
[
"literal.string.change",
"literal.string.case.change",
"assignment.value.change"
] | 468,405
| 468,406
|
u262392777
|
ruby
|
p02711
|
n=gets
if n.to_s.include?("7")
p "Yes"
else
p "No"
end
|
n=gets
if n.to_s.include?("7")
puts "Yes"
else
puts "No"
end
|
[
"call.function.change",
"io.output.change"
] | 468,465
| 468,466
|
u702652578
|
ruby
|
p02711
|
n = gets.chomp
puts n.include("7") ? "Yes" : "No"
|
n = gets.chomp
puts n.include?("7") ? "Yes" : "No"
|
[
"call.suffix.change"
] | 468,612
| 468,613
|
u726523100
|
ruby
|
p02712
|
n = gets().chomp.to_i
sum = 0
(1..n).each do |x|
next if x % 3 == 0
next if x % 5 == 0
sum += x
end
puts x
|
n = gets().chomp.to_i
sum = 0
(1..n).each do |x|
next if x % 3 == 0
next if x % 5 == 0
sum += x
end
puts sum
|
[
"identifier.change",
"call.arguments.change"
] | 468,898
| 468,899
|
u810199299
|
ruby
|
p02712
|
a=0
(1..gets.to_i).each{|i|a+=i if i%3==0||i%5==0}
p a
|
a=0
(1..gets.to_i).each{|i|a+=i if i%3!=0&&i%5!=0}
p a
|
[
"misc.opposites",
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 470,118
| 470,119
|
u966810027
|
ruby
|
p02712
|
n = gets.to_i
sum = 0
(1..n).each do |i|
sum += i if i % 3 != 0 && i % 5 != 0
end
|
n = gets.to_i
sum = 0
(1..n).each do |i|
sum += i if i % 3 != 0 && i % 5 != 0
end
puts sum
|
[
"call.add"
] | 470,711
| 470,712
|
u962609087
|
ruby
|
p02712
|
n = gets.to_i
sum = 0
(1.n).each do |i|
sum += i if i % 3 != 0 && i % 5 != 0
end
|
n = gets.to_i
sum = 0
(1..n).each do |i|
sum += i if i % 3 != 0 && i % 5 != 0
end
puts sum
|
[
"call.add"
] | 470,713
| 470,712
|
u962609087
|
ruby
|
p02712
|
n = gets.chomp!.to_i
sum = n * (n+1) / 2
k = [*1..n].select{ |i| (i % 3 == 0 || i % 5 == 0) }.inject(:+)
puts sum - k
|
n = gets.chomp!.to_i
sum = n * (n+1) / 2
k = [*1..n].select{ |i| (i % 3 == 0 || i % 5 == 0) }.inject(:+) || 0
puts sum - k
|
[
"assignment.change"
] | 472,697
| 472,698
|
u081708706
|
ruby
|
p02712
|
N = gets.to_i
cnt = 0
(N+1).times do |i|
if i%3 != 0 && i%5 != 0
cnt += i
p i
end
end
p cnt
|
N = gets.to_i
cnt = 0
(N+1).times do |i|
if i%3 != 0 && i%5 != 0
cnt += i
end
end
p cnt
|
[
"call.remove"
] | 473,059
| 473,060
|
u244087909
|
ruby
|
p02712
|
N = gets.to_i
cnt = 0
N.times do |i|
if i%3 != 0 && i%5 != 0
cnt += i
end
end
p cnt
|
N = gets.to_i
cnt = 0
(N+1).times do |i|
if i%3 != 0 && i%5 != 0
cnt += i
end
end
p cnt
|
[] | 473,061
| 473,060
|
u244087909
|
ruby
|
p02712
|
# https://atcoder.jp/contests/abc162/tasks/abc162_b
N = gets.to_i
ans = 0
N.times do |i|
if (i % 15 == 0 || i % 3 == 0 || i % 5 == 0)
else
ans += i
end
end
puts ans
|
# https://atcoder.jp/contests/abc162/tasks/abc162_b
N = gets.to_i
ans = 0
N.times do |i|
i += 1
if (i % 15 == 0 || i % 3 == 0 || i % 5 == 0)
else
ans += i
end
end
puts ans
|
[] | 473,283
| 473,284
|
u339791405
|
ruby
|
p02712
|
# https://atcoder.jp/contests/abc162/tasks/abc162_b
N = gets.to_i
ans = 0
N.times do |i|
unless(i % 15 == 0 || i % 3 == 0 || i % 5 == 0)
ans += i
end
end
puts ans
|
# https://atcoder.jp/contests/abc162/tasks/abc162_b
N = gets.to_i
ans = 0
N.times do |i|
i += 1
if (i % 15 == 0 || i % 3 == 0 || i % 5 == 0)
else
ans += i
end
end
puts ans
|
[] | 473,285
| 473,284
|
u339791405
|
ruby
|
p02712
|
n=gets.chomp.to_i
sum = 0
1.upto(n) do |i|
if sum % 3 != 0 && sum % 5 != 0
sum += i
end
end
puts sum
|
n=gets.chomp.to_i
sum = 0
1.upto(n) do |i|
if i % 3 != 0 && i % 5 != 0
sum += i
end
end
puts sum
|
[
"identifier.change",
"control_flow.branch.if.condition.change"
] | 473,295
| 473,296
|
u742129941
|
ruby
|
p02712
|
N = gets.to_i
ret = 0
N.times do |n|
unless (n % 3) == 0 || (n % 5) == 0
ret += n
end
end
puts ret
|
N = gets.to_i
ret = 0
1.upto(N) do |n|
unless (n % 3) == 0 || (n % 5) == 0
ret += n
end
end
puts ret
|
[
"identifier.change",
"call.arguments.add"
] | 473,635
| 473,636
|
u559342926
|
ruby
|
p02712
|
n = gets.chomp.to_i
sum = 0
n.times do |i|
next if i%3 == 0 || i%5==0
sum +=i
end
puts sum
|
n = gets.chomp.to_i
sum = 0
(n+1).times do |i|
next if i%3 == 0 || i%5==0
sum +=i
end
puts sum
|
[] | 473,822
| 473,823
|
u650620788
|
ruby
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.