Datasets:

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
p02760
card = [] for i in 1..3 card << gets.split(" ").map(&:to_i) end n = gets.to_i nums = [] for i in 1..n nums << gets.to_i end i = 0 while i <= 2 j = 0 while j <= 2 if nums.include?(card[i][j]) card[i][j] = "○" end j += 1 end i += 1 end if (card[0][0] == "○" && card[0][1] == "○" && card[0...
card = [] for i in 1..3 card << gets.split(" ").map(&:to_i) end n = gets.to_i nums = [] for i in 1..n nums << gets.to_i end i = 0 while i <= 2 j = 0 while j <= 2 if nums.include?(card[i][j]) card[i][j] = "○" end j += 1 end i += 1 end if (card[0][0] == "○" && card[0][1] == "○" && card[0...
[ "literal.string.change", "call.arguments.change" ]
546,705
546,706
u748406041
ruby
p02760
card = [] for i in 1..3 card << gets.split(" ").map(&:to_i) end n = gets.to_i nums = [] for i in 1..n nums << gets.to_i end i = 0 while i <= 2 j = 0 while j <= 2 if nums.include?(card[i][j]) card[i][j] = "○" end j += 1 end i += 1 end if (card[0][0] == "○" && card[0][1] == "○" && card[0...
card = [] for i in 1..3 card << gets.split(" ").map(&:to_i) end n = gets.to_i nums = [] for i in 1..n nums << gets.to_i end i = 0 while i <= 2 j = 0 while j <= 2 if nums.include?(card[i][j]) card[i][j] = "○" end j += 1 end i += 1 end if (card[0][0] == "○" && card[0][1] == "○" && card[0...
[ "literal.number.integer.change", "variable_access.subscript.index.change", "control_flow.branch.if.condition.change", "literal.string.change", "call.arguments.change" ]
546,707
546,706
u748406041
ruby
p02760
card = Array.new(3){gets.split.map(&:to_i)} n = gets.to_i ans = "No" n.times do b = gets.to_i 3.times do |i| 3.times do |j| if card[i][j] == b card[i][j] = -1 end end end end #横 card.each do |row| ans = "Yes" if row.all?{|a| a<0} end #縦 card.transpose do |column| ans = "Yes" if c...
card = Array.new(3){gets.split.map(&:to_i)} n = gets.to_i ans = "No" n.times do b = gets.to_i 3.times do |i| 3.times do |j| if card[i][j] == b card[i][j] = -1 end end end end #横 card.each do |row| ans = "Yes" if row.all?{|a| a<0} end #縦 card.transpose.each do |column| ans = "Yes"...
[ "call.add" ]
547,362
547,363
u358554431
ruby
p02766
x,y=gets.split.map!(&:to_i) ans=0 ryou=1 while x>ryou ryou*=y ans+=1 end puts ans
x,y=gets.split.map!(&:to_i) ans=0 ryou=1 while x>=ryou ryou*=y ans+=1 end puts ans
[ "expression.operator.compare.change", "expression.operation.binary.change" ]
558,903
558,904
u977506075
ruby
p02768
####### 二項係数 C(n,k) mod pの計算 ####### MOD=10**9+7 ## a**b mod p by 繰り返し二乗法 ## 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 ## n! mod p ## def fact(n) ret=1 n.times do |i| ret=ret*(i+1)%MOD end ret end ## a**(-1) mod p ## def inv(n) pow(n,MOD-2)%MOD ...
####### 二項係数 C(n,k) mod pの計算 ####### MOD=10**9+7 ## a**b mod p by 繰り返し二乗法 ## 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 ## n! mod p ## def fact(n) ret=1 n.times do |i| ret=ret*(i+1)%MOD end ret end ## a**(-1) mod p ## def inv(n) pow(n,MOD-2)%MOD ...
[ "identifier.change", "assignment.variable.change", "call.arguments.change", "expression.operation.binary.change" ]
564,644
564,645
u041282550
ruby
p02768
####### 二項係数 C(n,k) mod pの計算 ####### MOD=10**9+7 ## a**b mod p by 繰り返し二乗法 ## 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 ## n! mod p ## def fact(n) ret=1 n.times do |i| ret=ret*(i+1)%MOD end ret end ## a**(-1) mod p ## def inv(a) pow(a,MOD-2)%MOD ...
####### 二項係数 C(n,k) mod pの計算 ####### MOD=10**9+7 ## a**b mod p by 繰り返し二乗法 ## 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 ## n! mod p ## def fact(n) ret=1 n.times do |i| ret=ret*(i+1)%MOD end ret end ## a**(-1) mod p ## def inv(a) pow(a,MOD-2)%MOD ...
[ "identifier.change", "expression.operation.binary.change" ]
564,647
564,648
u041282550
ruby
p02771
l, n, m = gets.split(" ").map(&:to_i) if l==m && m==n then print "No" elsif l==m || m==n then print "Yes" else print "No" end
l, n, m = gets.split(" ").map(&:to_i) if l==m && m==n then print "No" elsif l==m || m==n || n==l then print "Yes" else print "No" end
[ "control_flow.branch.if.condition.change" ]
567,676
567,677
u590322956
ruby
p02772
N = gets ary = gets.chomp.split(' ').map(&:to_i).select{|num| num.even?} if ary.length == 0 puts "DENIED" exit; end for n in ary do if n % 5 != 0 and n % 3 != 0 puts "DENIED"; exit end end puts "APPROVED";
N = gets ary = gets.chomp.split(' ').map(&:to_i).select{|num| num.even?} if ary.length == 0 puts "APPROVED" exit; end for n in ary do if n % 5 != 0 and n % 3 != 0 puts "DENIED"; exit end end puts "APPROVED";
[ "literal.string.change", "call.arguments.change" ]
569,206
569,207
u119099532
ruby
p02772
N = gets ary = gets.chomp.split(' ').map(&:to_i).select{|num| num.even?} if ary.length == 0 puts "DENIED1" exit; end for n in ary do if n % 5 != 0 and n % 3 != 0 puts "DENIED"; exit end end puts "APPROVED";
N = gets ary = gets.chomp.split(' ').map(&:to_i).select{|num| num.even?} if ary.length == 0 puts "APPROVED" exit; end for n in ary do if n % 5 != 0 and n % 3 != 0 puts "DENIED"; exit end end puts "APPROVED";
[ "literal.string.change", "call.arguments.change" ]
569,208
569,207
u119099532
ruby
p02777
s,t = gets.chomp.split(' ').map(&:to_s) a,b = gets.chomp.split(' ').map(&:to_i) u = gets.chomp.to_s ans = [] if u == s ans = (a - 1),b else ans = b,(b - 1) end puts ans.join
s,t = gets.chomp.split(' ').map(&:to_s) a,b = gets.chomp.split(' ').map(&:to_i) u = gets.chomp.to_s ans = [] if u == s ans = (a - 1),b else ans = a,(b - 1) end puts ans.join(' ')
[ "assignment.value.change", "identifier.change", "call.arguments.add" ]
574,170
574,169
u802039083
ruby
p02777
s,t = gets.chomp.split(' ').map(&:to_s) a,b = gets.chomp.split(' ').map(&:to_i) u = gets.to_s ans = [] if u == s ans = (a - 1),b else ans = a,(b - 1) end print ans.join(' ')
s,t = gets.chomp.split(' ').map(&:to_s) a,b = gets.chomp.split(' ').map(&:to_i) u = gets.chomp.to_s ans = [] if u == s ans = (a - 1),b else ans = a,(b - 1) end puts ans.join(' ')
[ "call.add", "identifier.change" ]
574,171
574,169
u802039083
ruby
p02777
s,t = gets.chomp.split(' ').map(&:to_s) a,b = gets.chomp.split(' ').map(&:to_i) u = gets.to_s ans = [] if u == s ans = (a - 1),b else ans = a,(b - 1) end print ans.join(' ')
s,t = gets.chomp.split(' ').map(&:to_s) a,b = gets.chomp.split(' ').map(&:to_i) u = gets.chomp.to_s ans = [] if u == s ans = (a - 1),b else ans = a,(b - 1) end puts ans.join(' ')
[ "call.add", "identifier.change" ]
574,172
574,169
u802039083
ruby
p02777
s,t = gets.chomp.split(' ').map(&:to_s) a,b = gets.chomp.split(' ').map(&:to_i) u = gets.to_s ans = [] if u == s ans = (a - 1),b else ans = a,(b - 1) end print ans.join(' ')
s,t = gets.chomp.split(' ').map(&:to_s) a,b = gets.chomp.split(' ').map(&:to_i) u = gets.chomp.to_s ans = [] if u == s ans = (a - 1),b else ans = a,(b - 1) end print ans.join(' ')
[ "call.add" ]
574,171
574,173
u802039083
ruby
p02777
s,t = gets.chomp.split(' ').map(&:to_s) a,b = gets.chomp.split(' ').map(&:to_i) u = gets.to_s ans = [] if u == s ans = (a - 1),b else ans = a,(b - 1) end print ans.join(' ')
s,t = gets.chomp.split(' ').map(&:to_s) a,b = gets.chomp.split(' ').map(&:to_i) u = gets.chomp.to_s ans = [] if u == s ans = (a - 1),b else ans = a,(b - 1) end print ans.join(' ')
[ "call.add" ]
574,172
574,173
u802039083
ruby
p02777
s, t = gets.split.map(&:to_s) a, b = gets.split.map(&:to_s) u = gets.chomp if u == s a -= 1 else b -= 1 end puts "#{a} #{b}"
s, t = gets.split.map(&:to_s) a, b = gets.split.map(&:to_i) u = gets.chomp if u == s a -= 1 else b -= 1 end puts "#{a} #{b}"
[ "assignment.value.change", "call.arguments.change" ]
574,226
574,227
u341279393
ruby
p02777
s, t = gets.split.map(&:to_s) a, b = gets.split.map(&:to_s) u = gets.chomp u == s ? a -= 1 : b -= 1 puts "#{a} #{b}"
s, t = gets.split.map(&:to_s) a, b = gets.split.map(&:to_i) u = gets.chomp if u == s a -= 1 else b -= 1 end puts "#{a} #{b}"
[ "assignment.value.change", "call.arguments.change" ]
574,228
574,227
u341279393
ruby
p02778
puts ?x*gets.size
puts ?x*gets.chomp.size
[ "call.add" ]
574,883
574,884
u489339677
ruby
p02779
as = gets.split(' ').map(&:to_i) puts as.uniq.count == as.count ? 'YES' : 'NO'
_N = gets.chomp as = gets.split(' ').map(&:to_i) puts as.uniq.count == as.count ? 'YES' : 'NO'
[ "assignment.add" ]
577,441
577,442
u889326464
ruby
p02779
#!/usr/bin/env ruby attrs = Array.new while line = $stdin.gets attrs << line.chomp.split end if attrs[1].uniq == attrs[0][0].to_i then puts 'YES' else puts 'NO' end
#!/usr/bin/env ruby attrs = Array.new while line = $stdin.gets attrs << line.chomp.split end if attrs[1].uniq.length == attrs[0][0].to_i then puts 'YES' else puts 'NO' end
[ "control_flow.branch.if.condition.change", "call.add" ]
578,123
578,124
u244257825
ruby
p02783
n,a = gets.chomp.split(" ") n = n.to_i a = a.to_i cnt = 1 while n/(a*cnt) >= 1 cnt+= 1 end puts cnt
n,a = gets.chomp.split(" ") n = n.to_i a = a.to_i cnt = 1 while n-(a*cnt) > 0 cnt+= 1 end puts cnt
[ "expression.operator.arithmetic.change", "expression.operation.binary.change" ]
584,338
584,339
u760636024
ruby
p02789
line = gets.split(' ').map(&:to_i) if line[0] == line[1] puts Yes else puts No end
line = gets.split(' ').map(&:to_i) if (line[0] == line[1]) puts 'Yes' else puts 'No' end
[ "control_flow.branch.if.condition.change", "call.arguments.change" ]
594,009
594,008
u828888746
ruby
p02790
a, b = gets.split.map(&:to_i) arr = [a, b] arr.sort ans = arr[0].to_s * arr[1] puts ans
a, b = gets.split.map(&:to_i) arr = [a, b].min(2) ans = arr[0].to_s * arr[1] puts ans
[ "assignment.value.change", "identifier.change", "call.arguments.add" ]
595,403
595,404
u682209098
ruby
p02796
lines = readlines.map{|line| line.split(' ').map(&:to_i)} a=[] for i in 1..lines[0][0] b=lines[i][0]-lines[i][1] c=lines[i][0]+lines[i][1] a.push([b,c]) end a=a.sort_by(&:first) j=0 k=0 while j<lines[0][0]-1-k do if a[j].last!=nil&&a[j+1]!=nil&&a[j].last>a[j+1].first then a.delete_at(j+1) k=k+1 else ...
lines = readlines.map{|line| line.split(' ').map(&:to_i)} a=[] for i in 1..lines[0][0] b=lines[i][0]-lines[i][1] c=lines[i][0]+lines[i][1] a.push([b,c]) end a=a.sort_by(&:last) j=0 k=0 while j<lines[0][0]-1-k do if a[j].last!=nil&&a[j+1]!=nil&&a[j].last>a[j+1].first then a.delete_at(j+1) k=k+1 else ...
[ "assignment.value.change", "call.arguments.change" ]
602,054
602,055
u413184068
ruby
p02796
lines = readlines.map{|line| line.split(' ').map(&:to_i)} a=[] for i in 1..lines[0][0] b=lines[i][0]-lines[i][1] c=lines[i][0]+lines[i][1] a.push([b,c]) end a=a.sort_by(&:first) j=0 k=0 while j<lines[0][0]-1-k do if a[j].last!=nil&&a[j+1]!=nil&&a[j].last>a[j+1].first then a.delete_at(j+1) k=k+1 end ...
lines = readlines.map{|line| line.split(' ').map(&:to_i)} a=[] for i in 1..lines[0][0] b=lines[i][0]-lines[i][1] c=lines[i][0]+lines[i][1] a.push([b,c]) end a=a.sort_by(&:last) j=0 k=0 while j<lines[0][0]-1-k do if a[j].last!=nil&&a[j+1]!=nil&&a[j].last>a[j+1].first then a.delete_at(j+1) k=k+1 else ...
[ "assignment.value.change", "call.arguments.change" ]
602,056
602,055
u413184068
ruby
p02796
lines = readlines.map{|line| line.split(' ').map(&:to_i)} a=[] for i in 1..lines[0][0] b=lines[i][0]-lines[i][1] c=lines[i][0]+lines[i][1] a.push([b,c]) end a=a.sort_by(&:first) j=0 k=0 while j<lines[0][0]-1-k do if a[j].last!=nil&&a[j+1]!=nil&&a[j].last>a[j+1].last then a.delete_at(j+1) k=k+1 end j...
lines = readlines.map{|line| line.split(' ').map(&:to_i)} a=[] for i in 1..lines[0][0] b=lines[i][0]-lines[i][1] c=lines[i][0]+lines[i][1] a.push([b,c]) end a=a.sort_by(&:last) j=0 k=0 while j<lines[0][0]-1-k do if a[j].last!=nil&&a[j+1]!=nil&&a[j].last>a[j+1].first then a.delete_at(j+1) k=k+1 else ...
[ "assignment.value.change", "call.arguments.change", "identifier.change", "control_flow.branch.if.condition.change" ]
602,057
602,055
u413184068
ruby
p02801
puts ('a'..'z').to_a[('a'..'z').to_a.index(gets.to_i)+1]
puts ('a'..'z').to_a[('a'..'z').to_a.index(gets.chomp)+1]
[ "identifier.change", "variable_access.subscript.index.change", "call.arguments.change", "expression.operation.binary.change" ]
604,924
604,925
u891258088
ruby
p02811
K, X = gets.chomp.split(" ").map(&:to_i) if K * 500 >= X puts "Yes" else pus "No" end
K, X = gets.chomp.split(" ").map(&:to_i) if K * 500 >= X puts "Yes" else puts "No" end
[ "identifier.change" ]
610,783
610,784
u729911058
ruby
p02812
N = gets.chomp.to_i S = gets.chomp.to_s if S.include?("ABC") puts S.count("ABC") else puts 0 end
N = gets.chomp.to_i S = gets.chomp.to_s if S.include?("ABC") puts S.scan("ABC").length else puts 0 end
[ "identifier.change", "call.arguments.change", "io.output.change", "call.add" ]
614,845
614,846
u270015690
ruby
p02813
n = gets.to_i p = gets.split.map(&:to_i) q = gets.split.map(&:to_i) combi = (1..n).to_a.permutation puts (combi.index(p) - combi.index(q)).abs
n = gets.to_i p = gets.split.map(&:to_i) q = gets.split.map(&:to_i) combi = (1..n).to_a.permutation.to_a puts (combi.index(p) - combi.index(q)).abs
[ "call.add" ]
615,497
615,498
u895926909
ruby
p02817
x,y=gets.split.map(&:chomp) puts "y+x"
x,y=gets.split.map(&:chomp) puts y+x
[]
618,048
618,049
u977506075
ruby
p02817
# 入力 s,t = gets.chomp.split # こたえ print s,t
# 入力 s,t = gets.chomp.split # こたえ print t,s
[ "call.arguments.change", "call.arguments.add" ]
618,866
618,867
u689027433
ruby
p02829
a = gets.to_i b = gets.to_i if a==1 if b==2 puts 3 elsif b==3 puts 2 end elsif a==2 if b==1 puts 3 elsif b==3 puts 1 end elsif a==3 if b==1 puts 2 elsif b==2 puts 3 end end
a = gets.to_i b = gets.to_i if a==1 if b==2 puts 3 elsif b==3 puts 2 end elsif a==2 if b==1 puts 3 elsif b==3 puts 1 end elsif a==3 if b==1 puts 2 elsif b==2 puts 1 end end
[ "literal.number.integer.change", "call.arguments.change" ]
630,353
630,354
u284262180
ruby
p02833
n = gets.to_i if n.odd? p 0 else cnt = 0 div = 10 while n > div cnt += n / div div *= 5 end p cnt end
n = gets.to_i if n.odd? p 0 else cnt = 0 div = 10 while n >= div cnt += n / div div *= 5 end p cnt end
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
637,024
637,025
u084335038
ruby
p02835
sum = gets.chop.split.map(&:to_i).inject(:+) puts sum > 22 ? 'bust' : 'win'
sum = gets.chop.split.map(&:to_i).inject(:+) puts sum >= 22 ? 'bust' : 'win'
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
637,749
637,750
u604352408
ruby
p02836
S = gets ans = 0 (S.size / 2).times do |i| ans += 1 if S[i] != S[-(i+1)] end puts ans
S = gets.chomp ans = 0 (S.size / 2).times do |i| ans += 1 if S[i] != S[-i-1] end puts ans
[ "call.add", "control_flow.branch.if.condition.change", "misc.opposites", "expression.operator.arithmetic.change", "variable_access.subscript.index.change" ]
640,225
640,226
u846185950
ruby
p02837
n = gets.to_i d = Array.new(n+1){Array.new(n+1)} 1.upto(n) do |i| a = gets.to_i a.times do x,y = gets.split.map(&:to_i) d[i][x] = y end end ans = 0 (2**n-1).times do |i| x = i.to_s(2) y = x.size x = "0" * (n-y+1) + x s = 0 c = 0 1.upto(n) do |i| next if x...
n = gets.to_i d = Array.new(n+1){Array.new(n+1)} 1.upto(n) do |i| a = gets.to_i a.times do x,y = gets.split.map(&:to_i) d[i][x] = y end end ans = 0 (2**n).times do |i| x = i.to_s(2) y = x.size x = "0" * (n-y+1) + x s = 0 c = 0 1.upto(n) do |k| next if x[k...
[ "expression.operation.binary.remove", "identifier.change", "variable_access.subscript.index.change", "control_flow.branch.if.condition.change" ]
641,521
641,522
u692254521
ruby
p02844
N = gets.chomp.to_i S = gets.chomp.split(//).map(&:to_i) dp = {} 0.upto(N-1) do |i| dp.keys.each do |k1| dp[k1].keys.each do |k2| dp[k1][k2] << S[i] end dp[k1][S[i]] ||= Set.new end dp[S[i]] ||= {} end ans = 0 dp.each do |k1, v1| v1.each do |k2, v2| ans += v2.size end end puts ans
N = gets.chomp.to_i S = gets.chomp.split(//).map(&:to_i) require "set" dp = {} 0.upto(N-1) do |i| dp.keys.each do |k1| dp[k1].keys.each do |k2| dp[k1][k2] << S[i] end dp[k1][S[i]] ||= Set.new end dp[S[i]] ||= {} end ans = 0 dp.each do |k1, v1| v1.each do |k2, v2| ans += v2.size end end ...
[ "call.add" ]
651,080
651,081
u443924743
ruby
p02847
p Hash[%w(SAT FRI THU WED TUE MON SUN).zip(1..7)][gets]
p Hash[%w(SAT FRI THU WED TUE MON SUN).zip(1..7)][gets.chomp]
[ "call.add" ]
653,581
653,582
u353917577
ruby
p02847
p Hash[%w(SAT FRI THU WED TUE MON SUN).zip(*1..7)][gets]
p Hash[%w(SAT FRI THU WED TUE MON SUN).zip(1..7)][gets.chomp]
[ "call.arguments.change", "call.add" ]
653,583
653,582
u353917577
ruby
p02847
p 7-`date +%w -d#{gets}`
p 7-`date +%w -d$(dd)`.oct
[ "literal.string.change", "call.arguments.change", "expression.operation.binary.change", "call.add" ]
653,842
653,843
u657913472
ruby
p02848
alp = ('A'..'Z').to_a Alp = {} alp.each_with_index do |x, i| Alp[i] = x end newStrings = [] N = gets.to_i S = gets.chomp.split('') S.each do |x| i = Alp.key(x)+N i -= 26 if i >= 26 newStrings << Alp[i] end p newStrings.join
alp = ('A'..'Z').to_a Alp = {} alp.each_with_index do |x, i| Alp[i] = x end newStrings = [] N = gets.to_i S = gets.chomp.split('') S.each do |x| i = Alp.key(x)+N i -= 26 if i >= 26 newStrings << Alp[i] end puts newStrings.join
[ "call.function.change", "io.output.change" ]
655,160
655,161
u764202875
ruby
p02859
r = gets.chomp.to_i puts r ** r
r = gets.chomp.to_i puts r*r
[ "call.arguments.change", "expression.operation.binary.change" ]
661,696
661,697
u928941036
ruby
p02860
n = gets.to_i s = gets.chomp if s.size != n puts "No" exit end unless s.match(/\A[a-z]+\z/) puts "No" exit end m = s.size / 2 - 1 if s[0..m] == s[m + 1..s.size] puts "Yes" else puts "No" end
n = gets.to_i s = gets.chomp if s.size != n || s.size < 2 puts "No" exit end unless s.match(/\A[a-z]+\z/) puts "No" exit end m = s.size / 2 - 1 if s[0..m] == s[m + 1..s.size] puts "Yes" else puts "No" end
[ "control_flow.branch.if.condition.change" ]
663,578
663,581
u574162665
ruby
p02863
N, T = gets.chomp.split(" ").map(&:to_i) F = Array.new(N).map{ gets.chomp.split(" ").map(&:to_i) } dp = Array.new(T) ans = 0 dp[0] = 0 F.each{|a, b| (T-1).downto(0){|n| next if dp[n].nil? if n+a < T then if dp[n+a].nil? || dp[n+a] < dp[n] + b then dp[n+a] = dp[n] + b end else ...
N, T = gets.chomp.split(" ").map(&:to_i) F = Array.new(N).map{ gets.chomp.split(" ").map(&:to_i) } dp = Array.new(T) ans = 0 dp[0] = 0 F.sort.each{|a, b| (T-1).downto(0){|n| next if dp[n].nil? if n+a < T then if dp[n+a].nil? || dp[n+a] < dp[n] + b then dp[n+a] = dp[n] + b end else ...
[ "call.add" ]
667,670
667,671
u276517671
ruby
p02866
#exec({'RUBY_THREAD_VM_STACK_SIZE'=>'100000000'},'/usr/bin/ruby', $0) if !ENV['RUBY_THREAD_VM_STACK_SIZE'] def inpf() a=gets.chomp.split(" ").map(&:to_f)end def inps() a=gets.chomp.split(" ")end def copy(a) Marshal.load(Marshal.dump(a)) end def kaijo(n,r = 10**9+7)(n < 2)? 1 : (2..n).inject{|memo,u|memo=(memo*u)%r}...
#exec({'RUBY_THREAD_VM_STACK_SIZE'=>'100000000'},'/usr/bin/ruby', $0) if !ENV['RUBY_THREAD_VM_STACK_SIZE'] def inpf() a=gets.chomp.split(" ").map(&:to_f)end def inps() a=gets.chomp.split(" ")end def copy(a) Marshal.load(Marshal.dump(a)) end def kaijo(n,r = 10**9+7)(n < 2)? 1 : (2..n).inject{|memo,u|memo=(memo*u)%r}...
[ "misc.opposites", "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
669,511
669,512
u145123922
ruby
p02866
#exec({'RUBY_THREAD_VM_STACK_SIZE'=>'100000000'},'/usr/bin/ruby', $0) if !ENV['RUBY_THREAD_VM_STACK_SIZE'] def inpf() a=gets.chomp.split(" ").map(&:to_f)end def inps() a=gets.chomp.split(" ")end def copy(a) Marshal.load(Marshal.dump(a)) end def kaijo(n,r = 10**9+7)(n < 2)? 1 : (2..n).inject{|memo,u|memo=(memo*u)%r}...
#exec({'RUBY_THREAD_VM_STACK_SIZE'=>'100000000'},'/usr/bin/ruby', $0) if !ENV['RUBY_THREAD_VM_STACK_SIZE'] def inpf() a=gets.chomp.split(" ").map(&:to_f)end def inps() a=gets.chomp.split(" ")end def copy(a) Marshal.load(Marshal.dump(a)) end def kaijo(n,r = 10**9+7)(n < 2)? 1 : (2..n).inject{|memo,u|memo=(memo*u)%r}...
[ "control_flow.branch.if.condition.change", "misc.opposites", "expression.operator.compare.change" ]
669,513
669,512
u145123922
ruby
p02873
S = gets.chomp! lefts = Array.new(S.size + 1, 0) S.each_char.with_index do |c, i| if c == '<' lefts[i+1] = lefts[i] + 1 end end rights = Array.new(S.size + 1, 0) S.each_char.with_index do |c, i| if c == '>' rights[i+1] = rights[i] + 1 end end rights.reverse! ans = 0 (S.size + 1).times do |i| ans ...
S = gets.chomp! lefts = Array.new(S.size + 1, 0) S.each_char.with_index do |c, i| if c == '<' lefts[i+1] = lefts[i] + 1 end end rights = Array.new(S.size + 1, 0) S.each_char.reverse_each.with_index do |c, i| if c == '>' rights[i+1] = rights[i] + 1 end end rights.reverse! ans = 0 (S.size + 1).times d...
[ "call.add" ]
670,859
670,860
u393913844
ruby
p02879
b=gets.chomp.split(" ").map(&:to_i); if b[0]>=1 and b[1]<=9 and b[1]>=1 and b[1]<=9 print("#{b[0]*b[1]}\n") else print("-1") end
b=gets.chomp.split(" ").map(&:to_i); if b[0]>=1 and b[0]<=9 and b[1]>=1 and b[1]<=9 print("#{b[0]*b[1]}\n") else print("-1") end
[ "literal.number.integer.change", "variable_access.subscript.index.change", "control_flow.branch.if.condition.change" ]
673,618
673,619
u678700651
ruby
p02879
b=gets.chomp.split(" ").map(&:to_i); if b[0]>=1 and b[1]<=9 and b[1]>=1 and b[1]<=9 print("#{b[0]*b[1]}\n") else print("-1") end
b=gets.chomp.split(" ").map(&:to_i); if b[0]>=1 and b[0]<=9 and b[1]>=1 and b[1]<=9 print("#{b[0]*b[1]}\n") else print("-1") end
[ "literal.number.integer.change", "variable_access.subscript.index.change", "control_flow.branch.if.condition.change" ]
673,620
673,619
u678700651
ruby
p02880
b = [] (1..9).to_a.permutation(2) do |a| b << a[0] * a[1] end b.uniq! n = gets.chomp.to_i puts b.include?(n) ? 'Yes' : 'No'
b = [] (1..9).to_a.repeated_permutation(2) do |a| b << a[0] * a[1] end b.uniq! n = gets.chomp.to_i puts b.include?(n) ? 'Yes' : 'No'
[ "identifier.change" ]
676,063
676,064
u164316941
ruby
p02885
a, b = gets.split.map(&:to_i) int = a - b * 2 if a > 0 puts int else puts 0 end
a, b = gets.split.map(&:to_i) int = a - b * 2 if int > 0 puts int else puts 0 end
[ "identifier.change", "control_flow.branch.if.condition.change" ]
685,681
685,682
u501591853
ruby
p02887
N = gets.to_i puts gets.squeeze.size
N = gets.to_i puts gets.chomp.squeeze.size
[ "call.add" ]
688,215
688,216
u117321178
ruby
p02897
n=gets.to_f puts ((n+1)/2)/n
n=gets.to_i puts ((n+1)/2).fdiv(n)
[ "call.function.change", "type_conversion.to_integer.change", "type_conversion.to_number.change", "call.arguments.change", "expression.operation.binary.change", "call.add" ]
694,524
694,525
u560481052
ruby
p02898
input_lines = readlines input_0 = input_lines[0].split(' ') members_height = input_lines[1].split(' ') cnt = 0 N = input_0[0] HEIGHT_LIMIT = input_0[1] if members_height members_height.each do |mem_height| cnt = cnt + 1 if mem_height.to_i >= HEIGHT_LIMIT end end puts cnt
input_lines = readlines input_0 = input_lines[0].split(' ') members_height = input_lines[1].split(' ') cnt = 0 N = input_0[0] HEIGHT_LIMIT = input_0[1].to_i if members_height members_height.each do |mem_height| cnt = cnt + 1 if mem_height.to_i >= HEIGHT_LIMIT end end puts cnt
[ "call.add" ]
696,320
696,321
u532764966
ruby
p02899
n = gets.chomp.to_i a = gets.chomp.split(' ').map(&:to_i) ans = Array.new(8, 0) i = 1 a.each do |x| ans[x - 1] = i i += 1 end puts ans.join(' ')
n = gets.chomp.to_i a = gets.chomp.split(' ').map(&:to_i) ans = Array.new(n, 0) i = 1 a.each do |x| ans[x - 1] = i i += 1 end puts ans.join(' ')
[ "assignment.value.change", "identifier.replace.add", "literal.replace.remove", "call.arguments.change" ]
697,366
697,367
u683116963
ruby
p02903
H, W, A, B = gets.split.map(&:to_i) (H - B).times do arr = [] (W - A).times do arr << 0 end A.times do arr << 1 end puts arr.join(" ") end (B).times do arr = [] (W - A).times do arr << 1 end A.times do arr << 0 end puts arr.join(" ") end
H, W, A, B = gets.split.map(&:to_i) (H - B).times do arr = [] (W - A).times do arr << 0 end A.times do arr << 1 end puts arr.join("") end (B).times do arr = [] (W - A).times do arr << 1 end A.times do arr << 0 end puts arr.join("") end
[ "literal.string.change", "call.arguments.change", "io.output.change" ]
701,851
701,852
u482583772
ruby
p02909
S = gets.to_s puts 'Sunny' if S=='Rainy' puts 'Cloudy' if S=='Sunny' puts 'Rainy' if S=='Cloudy'
S = gets.chomp.to_s puts 'Sunny' if S=='Rainy' puts 'Cloudy' if S=='Sunny' puts 'Rainy' if S=='Cloudy'
[ "call.add" ]
703,499
703,500
u884511822
ruby
p02909
s = gets.to_s if s == 'Sunny' puts 'Cloudy' elsif s == 'Cloudy' puts 'Rainy' else puts 'Sunny' end
s = gets.to_s.chomp if s == 'Sunny' puts 'Cloudy' elsif s == 'Cloudy' puts 'Rainy' else puts 'Sunny' end
[ "call.add" ]
703,602
703,603
u944733909
ruby
p02909
S = gets if S == "Sunny" puts "Cloudy" end if S == "Cloudy" puts "Rainy" end if S == "Rainy" puts "Sunny" end
S = gets.chomp if S == "Sunny" puts "Cloudy" end if S == "Cloudy" puts "Rainy" end if S == "Rainy" puts "Sunny" end
[ "call.add" ]
704,463
704,464
u060633673
ruby
p02909
S = gets if S == "Sunny" then puts "Cloudy" end if S == "Cloudy" then puts "Rainy" end if S == "Rainy" then puts "Sunny" end
S = gets.chomp if S == "Sunny" puts "Cloudy" end if S == "Cloudy" puts "Rainy" end if S == "Rainy" puts "Sunny" end
[ "call.add" ]
704,465
704,464
u060633673
ruby
p02909
S = gets if S == "Sunny" puts "Cloudy" end if S == "Cloudy" puts "Rainy" end if S == "Rainy" puts "Sunny" end
S = gets.chomp if S == "Sunny" puts "Cloudy" end if S == "Cloudy" puts "Rainy" end if S == "Rainy" puts "Sunny" end
[ "call.add" ]
704,466
704,464
u060633673
ruby
p02910
odd_fleq_step_pattern = ['R','U','D'] even_fleq_step_pattern = ['L','U','D'] steps = gets.chomp.split('') ans = [] steps.each.with_index(1) do |step, i| if i.odd? ans << odd_fleq_step_pattern.include?(step) else ans << even_fleq_step_pattern.include?(step) end end puts ans.all? ? 'YES' : 'NO'
odd_fleq_step_pattern = ['R','U','D'] even_fleq_step_pattern = ['L','U','D'] steps = gets.chomp.split('') ans = [] steps.each.with_index(1) do |step, i| if i.odd? ans << odd_fleq_step_pattern.include?(step) else ans << even_fleq_step_pattern.include?(step) end end puts ans.all? ? 'Yes' : 'No'
[ "literal.string.change", "literal.string.case.change", "call.arguments.change" ]
707,144
707,145
u608949838
ruby
p02915
a=get.to_i() p a*a*a
a=gets.to_i() p a*a*a
[ "assignment.value.change", "identifier.change" ]
710,924
710,925
u803684095
ruby
p02918
N, K = gets.split.map(&:to_i) S = gets.split("") ans = 2 * K (N-1).times do |n| if S[n] == S[n+1] ans += 1 end end if ans == N ans = ans - 1 end print ans
N, K = gets.split.map(&:to_i) S = gets.split("") ans = 2 * K (N-1).times do |n| if S[n] == S[n+1] ans += 1 end end if ans >= N ans = N - 1 end print ans
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change", "assignment.value.change", "expression.operation.binary.change" ]
715,647
715,648
u563722393
ruby
p02921
s = gets.chomp.split('') t = gets.chomp.split('') check = 0 s.times do |i| if s[i] == t[i] check += 1 end end puts check
s = gets.chomp.split('') t = gets.chomp.split('') check = 0 s.size.times do |i| if s[i] == t[i] check += 1 end end puts check
[ "call.add" ]
716,540
716,541
u437368899
ruby
p02922
A, B = gets.chomp.split.map(&:to_i) # ans = 1 # B -= A # while B > 0 # ans += 1 # B -= (A - 1) # end ans = 1 cnt = A while B > cnt ans += 1 cnt += (A - 1) end puts ans
A, B = gets.chomp.split.map(&:to_i) ans = 0 cnt = 1 while B > cnt ans += 1 cnt += (A - 1) end puts ans
[ "assignment.add", "assignment.remove" ]
718,582
718,583
u080348635
ruby
p02922
a,b = gets.split.map(&:to_i) sum = 1 count = 0 while sum < b do sum += a count += 1 end puts count
a,b = gets.split.map(&:to_i) sum = 1 count = 0 while sum < b do sum += a - 1 count += 1 end puts count
[ "expression.operation.binary.add" ]
720,987
720,988
u634482428
ruby
p02923
gets h=gets.split.map(&:to_i) a = h.each_cons(2).each_with_index.select{|(l,r),i| l<r }.map{|a,i|i} r = [0,*a,h.size-1].each_cons(2).map{|l,r|r-l}.max p r-1
gets h=gets.split.map(&:to_i) a = h.each_cons(2).each_with_index.select{|(l,r),i| l<r }.map{|a,i|i} r = [-1,*a,h.size-1].each_cons(2).map{|l,r|r-l}.max p r-1
[ "assignment.value.change", "expression.operation.unary.add" ]
723,464
723,465
u702482655
ruby
p02933
hoge = gets.chomp.to_i b = gets.chomp if a >= 3200 print b else print 'red' end
a = gets.chomp.to_i b = gets.chomp if a >= 3200 print b else print 'red' end
[ "assignment.variable.change", "identifier.change" ]
733,882
733,883
u401248484
ruby
p02935
n=gets.to_i a=gets.split.map &:to_f a.sort! (n-1).times{|i| a[i-1]=(a[i-1]+a[i])/2} printf "%.12f\n", a[n-1]
n=gets.to_i a=gets.split.map &:to_f a.sort! (n-1).times{|i| a[i+1]=(a[i+1]+a[i])/2} printf "%.12f\n", a[n-1]
[ "misc.opposites", "expression.operator.arithmetic.change", "assignment.variable.change", "variable_access.subscript.index.change", "expression.operation.binary.change", "assignment.value.change" ]
737,182
737,183
u976045235
ruby
p02935
n = gets.chomp.to_i v = gets.chomp.split.map(&:to_i) v.sort! b = 0 (n-1).times do |i| if i == 0 b = (v[i] + v[i + 1]) / 2 else b = (b + v[i + 1]) / 2 end end p b
n = gets.chomp.to_i v = gets.chomp.split.map(&:to_i) v.sort! b = 0 (n-1).times do |i| if i == 0 b = (v[i] + v[i + 1]) / 2.0 else b = (b + v[i + 1]) / 2.0 end end p b
[ "assignment.value.change", "expression.operation.binary.change" ]
737,295
737,296
u195257137
ruby
p02937
s = gets.chomp t = gets.chomp n = 0 pos = 0 t.chars.each do |c| while true if i = s.index(c, pos) pos = i break end unless s.index(c) puts(-1) exit end n += 1 pos = 0 end end p n * s.length + pos + 1
s = gets.chomp t = gets.chomp n = 0 pos = 0 t.chars.each do |c| while true if i = s.index(c, pos) pos = i + 1 break end unless s.index(c) puts(-1) exit end n += 1 pos = 0 end end p n * s.length + pos
[ "expression.operation.binary.remove" ]
740,279
740,280
u976684425
ruby
p02945
a, b = gets.chomp.split(" ").map(&:to_i) # aとbを活用してがんばってanswerを出す # answer = ??? answer = max(a + b, a - b, a * b) print("#{answer}\n")
a, b = gets.chomp.split(" ").map(&:to_i) # aとbを活用してがんばってanswerを出す # answer = ??? answer = [a + b, a - b, a * b].max print("#{answer}\n")
[ "assignment.value.change", "call.arguments.change", "call.add" ]
743,607
743,608
u842633542
ruby
p02946
k,x = gets.chomp.split.map(&:to_i) puts ((x - k +1)..(x + k -1).to_a.join(' '))
k,x = gets.chomp.split.map(&:to_i) puts ((x - k +1)..(x + k -1)).to_a.join(' ')
[ "call.arguments.change" ]
745,230
745,231
u573770840
ruby
p02951
a, b, c = gets.split.map(&:to_i) if c-a-b <= 0 puts 0 else puts c-a-b end
a, b, c = gets.split.map(&:to_i) if c-(a-b) <= 0 puts 0 else puts c-(a-b) end
[ "control_flow.branch.if.condition.change", "call.arguments.change" ]
752,883
752,884
u326891688
ruby
p02951
a, b, c = gets.split.map(&:to_i) if c-a-b <= 0 puts 0 else puts c-a+b end
a, b, c = gets.split.map(&:to_i) if c-(a-b) <= 0 puts 0 else puts c-(a-b) end
[ "control_flow.branch.if.condition.change", "call.arguments.change", "misc.opposites", "expression.operator.arithmetic.change", "expression.operation.binary.change" ]
752,885
752,884
u326891688
ruby
p02952
n=gets.chomp.to_i t = n kq = 0 stt = t.to_s.length if stt == 1 kq = n elsif(stt%2==0) for num in 1..(stt-1) do if num % 2 == 1 kq += 10**(num-1)*9 end end elsif(stt%2==1) for num in 1..(stt-2) do if num % 2 == 1 kq += 10**(num-1)*9 end end kq = n + 1 - 10**(stt-1) end puts kq
n=gets.chomp.to_i t = n kq = 0 stt = t.to_s.length if stt == 1 kq = n elsif(stt%2==0) for num in 1..(stt-1) do if num % 2 == 1 kq += 10**(num-1)*9 end end elsif(stt%2==1) for num in 1..(stt-2) do if num % 2 == 1 kq += 10**(num-1)*9 end end kq = kq + n + 1 - 10**(stt-1) end puts...
[ "assignment.change" ]
754,899
754,900
u151224155
ruby
p02952
n = gets.to_i (1..n).each { |i| i.to_s.size.odd? }.count(true)
n = gets.to_i puts (1..n).to_a.map { |i| i.to_s.size.odd? }.count(true)
[ "io.output.change", "call.add", "identifier.change" ]
755,622
755,623
u467800529
ruby
p02953
#1行目 hoge = gets.chomp.to_i - 1 #2行目読み込み x = gets.chomp.split(" ").map!{|i | i.to_i} unchi = 0 for i in 0..(hoge-1) do sa = x[hoge - i] - x[hoge - i - 1] if sa < 1 unchi = 1 break elsif sa == -1 x[hoge - i - 1] = x[hoge - i - 1] - 1 end end if unchi > 0 print "No" else print "Yes" end
#1行目 hoge = gets.chomp.to_i - 1 #2行目読み込み x = gets.chomp.split(" ").map!{|i | i.to_i} unchi = 0 for i in 0..(hoge-1) do sa = x[hoge - i] - x[hoge - i - 1] if sa < -1 unchi = 1 break elsif sa == -1 x[hoge - i - 1] = x[hoge - i - 1] - 1 end end if unchi > 0 print "No" else print "Yes" end
[ "expression.operation.unary.add", "control_flow.branch.if.condition.change" ]
757,675
757,676
u401248484
ruby
p02953
#1行目 hoge = gets.chomp.to_i - 1 #2行目読み込み x = gets.chomp.split(" ").map!{|i | i.to_i} unchi = 0 for i in 0..(hoge-1) do sa = x[hoge - i] - x[hoge - i - 1] if sa > 1 unchi = 1 break elsif sa == 1 x[hoge - i - 1] = x[hoge - i - 1] - 1 end end if unchi > 0 print "No" else print "Yes" end
#1行目 hoge = gets.chomp.to_i - 1 #2行目読み込み x = gets.chomp.split(" ").map!{|i | i.to_i} unchi = 0 for i in 0..(hoge-1) do sa = x[hoge - i] - x[hoge - i - 1] if sa < -1 unchi = 1 break elsif sa == -1 x[hoge - i - 1] = x[hoge - i - 1] - 1 end end if unchi > 0 print "No" else print "Yes" end
[ "misc.opposites", "expression.operator.compare.change", "control_flow.branch.if.condition.change", "expression.operation.unary.add" ]
757,677
757,676
u401248484
ruby
p02954
s = gets.chomp.chars r = s.reverse a = 0 b = 0 ltr = [] for i in 0..(s.size-2) if s[i] == 'R' a += 1 if s[i+1] == 'L' ltr[i] = a ltr[i+1] = b a, b = 0, 0 end end a, b = b, a end a = 0 b = 0 rtl = [] for i in 0..(r.size-2) if r[i] == 'L' a += 1 if r[i+1] == 'R' rtl...
s = gets.chomp.chars r = s.reverse a = 0 b = 0 ltr = [] for i in 0..(s.size-2) if s[i] == 'R' a += 1 if s[i+1] == 'L' ltr[i] = a ltr[i+1] = b a, b = 0, 0 end end a, b = b, a end a = 0 b = 0 rtl = [] for i in 0..(r.size-2) if r[i] == 'L' a += 1 if r[i+1] == 'R' rtl...
[]
759,102
759,103
u145602296
ruby
p02957
a,b=gets.split.map(&:to_i) m=(a+b)/2 if 2*m == a+b puts m else puts 'IMPOSSIBLE"' end
a,b=gets.split.map(&:to_i) m=(a+b)/2 if 2*m == a+b puts m else puts 'IMPOSSIBLE' end
[ "literal.string.change", "call.arguments.change" ]
762,071
762,072
u056944756
ruby
p02958
n = gets.to_i p = gets.split.map(&:to_i) n.times do |i| counts += 1 if p[i] != i + 1 end if counts == 0 || counts == 2 puts 'YES' else puts 'NO' end
n = gets.to_i p = gets.split.map(&:to_i) count = 0 n.times do |i| count += 1 if p[i] != i + 1 end if count == 0 || count == 2 puts 'YES' else puts 'NO' end
[ "identifier.change", "control_flow.branch.if.condition.change" ]
763,545
763,546
u889326464
ruby
p02958
n = gets.to_i p = gets.split.map(&:to_i) need_swap = Array.new(n, 0) n.times do |i| need_swap[i] = 1 if p[i] != i + 1 end count = need_swap.count { |n| n == 1 } puts count if count == 0 || count == 2 puts 'YES' else puts 'NO' end
n = gets.to_i p = gets.split.map(&:to_i) need_swap = Array.new(n, 0) n.times do |i| need_swap[i] = 1 if p[i] != i + 1 end count = need_swap.count { |n| n == 1 } if count == 0 || count == 2 puts 'YES' else puts 'NO' end
[ "call.remove" ]
763,547
763,548
u889326464
ruby
p02955
require 'prime' # 約数リスト def divisors(n) n.prime_division.inject([1]) do |array, (k, v)| (0..v).map{ |i| k ** i }.product(array).map{ |a, b| a * b } end.sort end n, k = gets.split.map(&:to_i) nums = gets.split.map(&:to_i) sum = nums.inject(:+) divisors = divisors(sum).reverse divisors.each do |div| mods = nu...
require 'prime' # 約数リスト def divisors(n) n.prime_division.inject([1]) do |array, (k, v)| (0..v).map{ |i| k ** i }.product(array).map{ |a, b| a * b } end.sort end n, k = gets.split.map(&:to_i) nums = gets.split.map(&:to_i) sum = nums.inject(:+) divisors = divisors(sum).reverse divisors.each do |div| mods = nu...
[ "call.add" ]
766,541
766,542
u653737129
ruby
p02959
n = gets.to_i a = gets.strip.split(' ').map(&:to_i) b = gets.strip.split(' ').map(&:to_i) result = 0 n.times do |i| p i if a[i] < b[i] result += a[i] b[i] -= a[i] a[i] = 0 if a[i+1] < b[i] result += a[i+1] a[i+1] = 0 else result += b[i] a[i+1] -= b[i] end else r...
n = gets.to_i a = gets.strip.split(' ').map(&:to_i) b = gets.strip.split(' ').map(&:to_i) result = 0 n.times do |i| if a[i] < b[i] result += a[i] b[i] -= a[i] a[i] = 0 if a[i+1] < b[i] result += a[i+1] a[i+1] = 0 else result += b[i] a[i+1] -= b[i] end else result ...
[ "call.remove" ]
766,881
766,882
u259578064
ruby
p02970
n.d=gets.split.map(&:to_i) p (n+2*d)/(2*d+1)
n,d = gets.split.map(&:to_i) p (n+2*d)/(2*d+1)
[ "misc.typo", "assignment.variable.change" ]
773,241
773,242
u781354194
ruby
p02971
n = gets.to_i a = [] n.times do i = gets.to_i a << i end k = a.sort_by!{|i|-i} n.times do |i| if a[i] != k[0] puts k[0] else puts k[1] end end
n = gets.to_i a = [] n.times do i = gets.to_i a << i end k = a.sort_by{|i|-i} n.times do |i| if a[i] != k[0] puts k[0] else puts k[1] end end
[ "assignment.value.change", "identifier.change" ]
775,502
775,503
u437368899
ruby
p02972
N = gets.to_i A = gets.chomp.split(" ").map(&:to_i) A.unshift(0) B = Array.new(N + 1) N.downto(1){|i| w = A[i] c = 2 while(c * i <= N) do w ^= A[c * i] c += 1 end B[i] = w } puts B.count{|b| b == 1} (1..N).each{|i| printf("#{i} ") if B[i] == 1 } printf("\n")
N = gets.to_i A = gets.chomp.split(" ").map(&:to_i) A.unshift(0) B = Array.new(N + 1) N.downto(1){|i| w = A[i] c = 2 while(c * i <= N) do w ^= B[c * i] c += 1 end B[i] = w } puts B.count{|b| b == 1} (1..N).each{|i| printf("#{i} ") if B[i] == 1 } printf("\n")
[]
777,300
777,301
u276517671
ruby
p02972
N = gets.to_i A = gets.chomp.split(" ").map(&:to_i) A.unshift(0) B = Array.new(N + 1) N.downto(1){|i| w = A[i] c = 2 while(c * i <= N) do w ^= A[c * i] c += 1 end B[i] = w } puts B.count{|b| b == 1} (1..N).each{|i| printf("#{i} ") if B[i] == 1 } printf("\b\n")
N = gets.to_i A = gets.chomp.split(" ").map(&:to_i) A.unshift(0) B = Array.new(N + 1) N.downto(1){|i| w = A[i] c = 2 while(c * i <= N) do w ^= B[c * i] c += 1 end B[i] = w } puts B.count{|b| b == 1} (1..N).each{|i| printf("#{i} ") if B[i] == 1 } printf("\n")
[ "literal.string.change", "call.arguments.change" ]
777,302
777,301
u276517671
ruby
p02983
L, R = gets.chomp.split(" ").map(&:to_i) l = L % 2019 r = R % 2019 if L / 2019 != R / 2019 || l == 0 puts 0 elsif l < 4 && r > 672 puts 0 else ary = (l..r).to_a.map{|a| a %= 2019}.sort min = 2019 (ary.size - 1).times do |i| j = i + 1 while j < ary.size do tmp = ary[i] * ...
L, R = gets.chomp.split(" ").map(&:to_i) l = L % 2019 r = R % 2019 if L / 2019 != R / 2019 || l == 0 puts 0 elsif l < 4 && r > 672 puts 0 else ary = (l..r).to_a.map{|a| a %= 2019}.sort min = 2019 (ary.size - 1).times do |i| j = i + 1 while j < ary.size do tmp = (ary[i] *...
[ "assignment.change" ]
787,796
787,797
u729911058
ruby
p02987
puts gets.chomp.cchars.uniq.size == 2 ? 'Yes' : 'No'
puts gets.chomp.chars.uniq.size == 2 ? 'Yes' : 'No'
[ "identifier.change", "control_flow.branch.if.condition.change" ]
794,863
794,864
u281407580
ruby
p02988
N = gets.chomp.to_i Ps = gets.chiomp.split(" ").map(&:to_i) count = 0 Ps.each_with_index do |e,i| if i ==0 || i == N-1 next elsif (Ps[i-1]<e&&e<Ps[i+1])||(Ps[i-1]>e&&e>Ps[i+1]) count += 1 end end puts count
N = gets.chomp.to_i Ps = gets.chomp.split(" ").map(&:to_i) count = 0 Ps.each_with_index do |e,i| if i ==0 || i == N-1 next elsif (Ps[i-1]<e&&e<Ps[i+1])||(Ps[i-1]>e&&e>Ps[i+1]) count += 1 end end puts count
[ "misc.typo", "assignment.value.change", "identifier.change" ]
795,721
795,722
u623975979
ruby
p02989
n = gets d = gets.split.map(&:to_i).sort half_num = n / 2 p d[half_num] - d[half_num - 1]
n = gets.to_i d = gets.split.map(&:to_i).sort half_num = n / 2 p d[half_num] - d[half_num - 1]
[ "call.add" ]
797,809
797,810
u080340943
ruby
p02991
def extend(node, step) @edge_hash[node].each do |next_node| next if @done[next_node][(step + 1) % 3] @done[next_node][(step + 1) % 3] = true @que.push([next_node, step + 1]) end end n, m = gets.chomp.split.map(&:to_i) @edge_hash = Array.new(n + 1) { [] } m.times do e1, e2 = gets.chomp.split.map(&:to_...
def extend(node, step) @edge_hash[node].each do |next_node| next if @done[next_node][(step + 1) % 3] @done[next_node][(step + 1) % 3] = true @que.push([next_node, step + 1]) end end n, m = gets.chomp.split.map(&:to_i) @edge_hash = Array.new(n + 1) { [] } m.times do e1, e2 = gets.chomp.split.map(&:to_...
[ "assignment.value.change", "identifier.change" ]
799,230
799,231
u052546116
ruby
p02993
S = gets.chomp S.chars.each_with_index do |s,i| next if i == 0 if S == S[i-1] puts "Bad" exit end end puts "Good"
S = gets.chomp S.chars.each_with_index do |s,i| next if i == 0 if s == S[i-1] puts "Bad" exit end end puts "Good"
[ "misc.typo", "control_flow.branch.if.condition.change" ]
800,236
800,237
u846185950
ruby
p02993
s=gets.split("") 0.upto(2){|i| puts "Bad"||exit if s[i].eql?(s[i+1])} puts "Good"
s=gets.split("") 0.upto(2){|i| (puts "Bad";exit) if s[i].eql?(s[i+1])} puts "Good"
[ "call.arguments.change", "expression.operation.binary.change", "io.output.change" ]
801,000
801,001
u883824971
ruby
p02993
s=gets.split 0.upto(2){|i| (puts "Bad";exit) if s[i].eql?(s[i+1])} puts "Good"
s=gets.split("") 0.upto(2){|i| (puts "Bad";exit) if s[i].eql?(s[i+1])} puts "Good"
[ "call.arguments.add" ]
801,002
801,001
u883824971
ruby
p02994
n, l = gets.split(' ') N = n.to_i L = l.to_i abs_min = 9999999999 ret_val = 9999999999 (0..(N-1)).each do |i| sum = 0 sum_normal = 0 (0..(N-1)).each do |sum_i| sum = sum + sum_i + L unless sum_i == i sum_normal = sum + sum_i+ L end if (sum - sum_normal).abs < abs_min ret_val = sum abs_min = (...
n, l = gets.split(' ') N = n.to_i L = l.to_i abs_min = 9999999999999999999 ret_val = 0 (0..(N-1)).each do |i| sum = 0 sum_normal = 0 (0..(N-1)).each do |sum_i| sum = sum + sum_i + L unless sum_i == i sum_normal = sum_normal + sum_i + L end if (sum - sum_normal).abs < abs_min ret_val = sum abs...
[ "literal.number.integer.change", "assignment.value.change", "identifier.change", "expression.operation.binary.change" ]
804,101
804,102
u686577486
ruby
p02996
N=gets.to_i temp=N.times.map{gets.split.map(&:to_i)}.transpose.map{|t|t.map.with_index{|e,i|[e,i]}} temp[1].sort!{|a,b|a[0]<=>b[0]} cnt="Yes" fc,lc =0,0 N.times do |i| fc+=temp[0][temp[1][i][1]][0] lc+=temp[1][i][0] cnt="No" if lc<fc end puts cnt
N=gets.to_i temp=N.times.map{gets.split.map(&:to_i)}.transpose.map{|t|t.map.with_index{|e,i|[e,i]}} temp[1].sort!{|a,b|a[0]<=>b[0]} cnt="Yes" fc,lc =0,0 N.times do |i| fc+=temp[0][temp[1][i][1]][0] lc=temp[1][i][0] cnt="No" if lc<fc end puts cnt
[ "assignment.value.change" ]
807,285
807,286
u926099741
ruby