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
p03719
input = gets.split.map(&:to_s) if input[0] <= input[2] && input[2] <= input[1] puts "Yes" else puts "No" end
input = gets.split.map(&:to_i) if input[0] <= input[2] && input[2] <= input[1] puts "Yes" else puts "No" end
[ "assignment.value.change", "call.arguments.change" ]
1,384,069
1,384,070
u817142576
ruby
p03720
a,b=gets.split.map(&:to_i) h=Hash.new (1..b).each {|i|h[i]=0} b.times do n,m=gets.split.map(&:to_i) h[n]+=1 h[m]+=1 end h.each {|a,b| puts b}
a,b=gets.split.map(&:to_i) h=Hash.new (1..a).each {|i|h[i]=0} b.times do n,m=gets.split.map(&:to_i) h[n]+=1 h[m]+=1 end h.each {|a,b| puts b}
[ "identifier.change" ]
1,384,264
1,384,265
u966810027
ruby
p03719
a, b, c = gets.split.map(&:to_i) puts (a..b).include?(c) ? "Yex" : "No"
a, b, c = gets.split.map(&:to_i) puts (a..b).include?(c) ? "Yes" : "No"
[ "literal.string.change", "call.arguments.change" ]
1,384,316
1,384,317
u467508794
ruby
p03719
a, b, c = gets.split.map(&:to_i) puts (a..b).include?(c) ? "YES" : "NO"
a, b, c = gets.split.map(&:to_i) puts (a..b).include?(c) ? "Yes" : "No"
[ "literal.string.change", "literal.string.case.change", "call.arguments.change" ]
1,384,318
1,384,317
u467508794
ruby
p03719
a,b,c=gets.split.map(&:to_i) puts c >= a && a <= b ? "Yes" : "No"
a,b,c=gets.split.map(&:to_i) puts c >= a && c <= b ? "Yes" : "No"
[ "identifier.change", "control_flow.branch.if.condition.change" ]
1,384,423
1,384,424
u553623615
ruby
p03719
a,b,c = gets.split(" ").map(&:to_i) if a <= c && c <= b puts "YES" else puts "NO" end
a,b,c = gets.split(" ").map(&:to_i) if a <= c && c <= b puts "Yes" else puts "No" end
[ "literal.string.change", "literal.string.case.change", "call.arguments.change" ]
1,384,484
1,384,485
u094826590
ruby
p03720
n,m=gets.chomp.split(" ").map(&:to_i) arr = Array.new(n){0} m.times do b,c=gets.chomp.split(" ").map(&:to_i) arr[b-1] = arr[b-1] + 1 #้…ๅˆ—ใฎๆœ€ๅˆใฏ0็•ช็›ฎใงใ‚ใ‚‹ใ“ใจใซๆณจๆ„ arr[c-1] = arr[c-1] + 1 end m.times do |k| #0-(m-1)ใฎๅ€คใ‚’ๅ–ใ‚‹ใ‹ใ‚‰ๆณจๆ„ puts(arr[k]) end
n,m=gets.chomp.split(" ").map(&:to_i) arr = Array.new(n){0} m.times do b,c=gets.chomp.split(" ").map(&:to_i) arr[b-1] = arr[b-1] + 1 #้…ๅˆ—ใฎๆœ€ๅˆใฏ0็•ช็›ฎใงใ‚ใ‚‹ใ“ใจใซๆณจๆ„ arr[c-1] = arr[c-1] + 1 end n.times do |k| #0-(m-1)ใฎๅ€คใ‚’ๅ–ใ‚‹ใ‹ใ‚‰ๆณจๆ„ puts(arr[k]) end
[ "identifier.change" ]
1,384,865
1,384,866
u688809543
ruby
p03720
N, M = gets.split.map(&:to_i) a, b = M.times.map { gets.chomp.split.map(&:to_i) }.transpose # ่‡ช่บซใ‚’่กŒๅˆ—ใจ่ฆ‹็ซ‹ใฆใฆใ€่กŒๅˆ—ใฎ่ปข็ฝฎ(่กŒใจๅˆ—ใฎๅ…ฅใ‚Œๆ›ใˆ)ใ‚’่กŒใ†ใ€‚่ปข็ฝฎใ—ใŸ้…ๅˆ—ใ‚’็”Ÿๆˆใ—ใฆ่ฟ”ใ™ใ€‚ ans = Array.new(N + 1, 0) # ้•ทใ• size ใฎ้…ๅˆ—ใ‚’็”Ÿๆˆใ—ใ€ๅ„่ฆ็ด ใ‚’ val ใงๅˆๆœŸๅŒ–ใ—ใฆ่ฟ”ใ™ใ€‚ M.times do |i| ans[a[i]] += 1 ans[b[i]] += 1 end puts ans
N, M = gets.split.map(&:to_i) a, b = M.times.map { gets.chomp.split.map(&:to_i) }.transpose # ่‡ช่บซใ‚’่กŒๅˆ—ใจ่ฆ‹็ซ‹ใฆใฆใ€่กŒๅˆ—ใฎ่ปข็ฝฎ(่กŒใจๅˆ—ใฎๅ…ฅใ‚Œๆ›ใˆ)ใ‚’่กŒใ†ใ€‚่ปข็ฝฎใ—ใŸ้…ๅˆ—ใ‚’็”Ÿๆˆใ—ใฆ่ฟ”ใ™ใ€‚ ans = Array.new(N + 1, 0) # ้•ทใ• size ใฎ้…ๅˆ—ใ‚’็”Ÿๆˆใ—ใ€ๅ„่ฆ็ด ใ‚’ val ใงๅˆๆœŸๅŒ–ใ—ใฆ่ฟ”ใ™ใ€‚ M.times do |i| ans[a[i]] += 1 ans[b[i]] += 1 end puts ans[1..N] # ans ใ ใ‘ใ ใจ่ฆ็ด 1 ็•ช็›ฎใ‚‚่ฆ‹ใ‚‹
[]
1,385,000
1,385,001
u552761221
ruby
p03720
n,m = getsgets.chomp.split.map(&:to_i) num = Array.new(n,0) m.times do |i| a,b = gets.chomp.split.map(&:to_i) num[a - 1] += 1 num[b - 1] += 1 end n.times do |i| puts num[i] end
n,m = gets.chomp.split.map(&:to_i) num = Array.new(n,0) m.times do |i| a,b = gets.chomp.split.map(&:to_i) num[a - 1] += 1 num[b - 1] += 1 end n.times do |i| puts num[i] end
[ "assignment.value.change", "identifier.change" ]
1,385,603
1,385,604
u001025229
ruby
p03720
N, M = gets.split.map &:to_i; cnt = Array.new(n,0) M.times do a,b = gets.split.map &:to_i cnt[a-1] += 1 cnt[b-1] += 1 end cnt.each do |i| puts i end
N, M= gets.split.map &:to_i; cnt = Array.new(N,0) M.times do |i| a,b = gets.split.map &:to_i cnt[a-1] += 1 cnt[b-1] += 1 end cnt.each do |i| puts i end
[ "assignment.value.change", "call.arguments.change" ]
1,385,647
1,385,648
u151483411
ruby
p03720
N, M = gets.chomp.split.map &:to_i; cnt = Array.new(n,0) M.times do a,b = gets.split.map &:to_i cnt[a-1] += 1 cnt[b-1] += 1 end cnt.each do |i| puts i end
N, M= gets.split.map &:to_i; cnt = Array.new(N,0) M.times do |i| a,b = gets.split.map &:to_i cnt[a-1] += 1 cnt[b-1] += 1 end cnt.each do |i| puts i end
[ "call.remove", "assignment.value.change", "call.arguments.change" ]
1,385,649
1,385,648
u151483411
ruby
p03720
N, M = gets.split.map(&:to_i) L = Hash.new {|h, x| h[x] = []} M.times do a, b = gets.split.map(&:to_i) L[a] << b L[b] << a end L.keys.sort.each do |k| puts L[k].size end
N, M = gets.split.map(&:to_i) L = Hash.new {|h, x| h[x] = []} M.times do a, b = gets.split.map(&:to_i) L[a] << b L[b] << a end (1..N).each do |k| puts L[k].size end
[ "io.output.change" ]
1,385,802
1,385,803
u004588855
ruby
p03720
n, m = gets.split.map(&:to_i) count = {} n.times do |i| count[i] = 0 end m.times do |i| a, b = gets.split.map(&:to_i) count[a] += 1 count[b] += 1 end n.times do |i| puts count[i+1] end
n, m = gets.split.map(&:to_i) count = {} n.times do |i| count[i+1] = 0 end m.times do |i| a, b = gets.split.map(&:to_i) count[a] += 1 count[b] += 1 end n.times do |i| puts count[i+1] end
[ "assignment.change" ]
1,385,817
1,385,818
u817142576
ruby
p03721
n,k=gets.split.map(&:to_i) barray=[] n.times.each do v=gets.split.map(&:to_i) barray<<v end barray=barray.sort{|x,y|x[0]<=>y[0]} count=0 p barray for i in 0..barray.length-1 v=barray[i][1] count+=v if count>=k p barray[i][0] exit end end
n,k=gets.split.map(&:to_i) barray=[] n.times.each do v=gets.split.map(&:to_i) barray<<v end barray=barray.sort{|x,y|x[0]<=>y[0]} count=0 #p barray for i in 0..barray.length-1 v=barray[i][1] count+=v if count>=k p barray[i][0] exit end end
[]
1,386,361
1,386,362
u590472228
ruby
p03721
n,k = gets.split.map(&:to_i) arr = [] n.times {arr << gets.split.map(&:to_i)} arr.sort_by{|e| e[0]} sum = 0 arr.each do |a,b| k -= b if k <= 0 puts a break end end
n,k = gets.split.map(&:to_i) arr = [] n.times {arr << gets.split.map(&:to_i)} arr.sort_by!{|e| e[0]} sum = 0 arr.each do |a,b| k -= b if k <= 0 puts a break end end
[ "call.suffix.change" ]
1,386,911
1,386,912
u692254521
ruby
p03721
n,k = gets.split.map(&:to_i) nums = {} n.times do a,b = gets.split.map(&:to_i) if nums[a] == nil nums[a] = b else nums[a] += b end end nums = Hash[nums.sort] cnt = 0 nums.each do |i,v| cnt += v if cnt >= k puts i exit end puts cnt end
n,k = gets.split.map(&:to_i) nums = {} n.times do a,b = gets.split.map(&:to_i) if nums[a] == nil nums[a] = b else nums[a] += b end end nums = Hash[nums.sort] cnt = 0 nums.each do |i,v| cnt += v if cnt >= k puts i exit end end
[ "call.remove" ]
1,387,232
1,387,233
u238956837
ruby
p03721
n,k=gets.split.map(&:to_i) ab=n.times.map{gets.split.map(&:to_i)} ab.each do |an,bn| k-=bn if k<=0 puts an break end end
n,k=gets.split.map(&:to_i) ab=n.times.map{gets.split.map(&:to_i)}.sort ab.each do |an,bn| k-=bn if k<=0 puts an break end end
[ "call.add" ]
1,387,709
1,387,710
u602591412
ruby
p03721
n, k = gets.split.map(&:to_i) hash = Hash.new(0) n.times do a, b = gets.split.map(&:to_i) hash[a] += b end hash.each do |key, value| k -= value if k <= 0 puts key exit end end
n, k = gets.split.map(&:to_i) hash = Hash.new(0) n.times do a, b = gets.split.map(&:to_i) hash[a] += b end hash.sort.each do |key, value| k -= value if k <= 0 puts key exit end end
[ "call.add" ]
1,388,256
1,388,257
u653737129
ruby
p03721
n, k = gets.chomp.split.map(&:to_i) ki = 0 # k็•ช็›ฎใซๅฐใ•ใ„ๆ•ฐ...? # ->ใ‚ฝใƒผใƒˆใ—ใŸใจใใฎ้ †็•ชใ ใจๆ€ใ‚ใ‚Œ arr = {} n.times do a, b = gets.chomp.split.map(&:to_i) if arr[a].nil? arr[a] = b else arr[a]+=b end end arr = arr.sort_by{arr[0]} arr.each do |a, v| if ki+v<k ki+=v else puts a exit # ้ ญๆนงใ„ใฆใ‚‹ใ‹ใ‚‰breakใซใ—ใฆใŸ end end
n, k = gets.chomp.split.map(&:to_i) ki = 0 # k็•ช็›ฎใซๅฐใ•ใ„ๆ•ฐ...? # ->ใ‚ฝใƒผใƒˆใ—ใŸใจใใฎ้ †็•ชใ ใจๆ€ใ‚ใ‚Œ arr = {} n.times do a, b = gets.chomp.split.map(&:to_i) if arr[a].nil? arr[a] = b else arr[a]+=b end end arr = arr.sort_by{|x|x[0]} # ้ ญๆนงใ„ใฆใ‚‹ใ‹ใ‚‰arr[0]ใซใ—ใฆใŸ arr.each do |a, v| if ki+v<k ki+=v else puts a exit # ้ ญๆนงใ„ใฆใ‚‹ใ‹ใ‚‰breakใซใ—ใฆใŸ end end
[ "assignment.value.change" ]
1,388,835
1,388,836
u445624660
ruby
p03721
n, k = gets.chomp.split.map(&:to_i) ki = 0 # k็•ช็›ฎใซๅฐใ•ใ„ๆ•ฐ...? # ->ใ‚ฝใƒผใƒˆใ—ใŸใจใใฎ้ †็•ชใ ใจๆ€ใ‚ใ‚Œ arr = {} n.times do a, b = gets.chomp.split.map(&:to_i) if arr[a].nil? arr[a] = b else arr[a]+=b end end arr = arr.sort_by{arr[0]} arr.each do |a, v| if ki+v<k ki+=v else puts a break end end
n, k = gets.chomp.split.map(&:to_i) ki = 0 # k็•ช็›ฎใซๅฐใ•ใ„ๆ•ฐ...? # ->ใ‚ฝใƒผใƒˆใ—ใŸใจใใฎ้ †็•ชใ ใจๆ€ใ‚ใ‚Œ arr = {} n.times do a, b = gets.chomp.split.map(&:to_i) if arr[a].nil? arr[a] = b else arr[a]+=b end end arr = arr.sort_by{|x|x[0]} # ้ ญๆนงใ„ใฆใ‚‹ใ‹ใ‚‰arr[0]ใซใ—ใฆใŸ arr.each do |a, v| if ki+v<k ki+=v else puts a exit # ้ ญๆนงใ„ใฆใ‚‹ใ‹ใ‚‰breakใซใ—ใฆใŸ end end
[ "assignment.value.change", "control_flow.break.remove", "control_flow.exit.add" ]
1,388,838
1,388,836
u445624660
ruby
p03719
a,b,c = gets.split(' ').map(&:to_i) # a<=c<=b if a <= c || c <= b puts "Yes" else puts "No" end
a,b,c = gets.split(' ').map(&:to_i) # a<=c<=b if a <= c && c <= b puts "Yes" else puts "No" end
[ "misc.opposites", "control_flow.branch.if.condition.change" ]
1,389,859
1,389,860
u243107999
ruby
p03719
a,b,c = gets.split(' ').map{ |x|x.to_i } puts (a <= c and c <= b) ? 'YES' : 'NO'
a,b,c = gets.split(' ').map{ |x|x.to_i } puts (a <= c and c <= b) ? 'Yes' : 'No'
[ "literal.string.change", "literal.string.case.change", "call.arguments.change" ]
1,389,895
1,389,896
u546897790
ruby
p03719
a,b,c = gets.chomp.split(" ").map(&:to_i) puts (c >= a && c <= b) ? "YES" : "NO"
a,b,c = gets.chomp.split(" ").map(&:to_i) puts (c >= a && c <= b) ? "Yes" : "No"
[ "literal.string.change", "literal.string.case.change", "call.arguments.change" ]
1,389,915
1,389,916
u406810545
ruby
p03719
a,b,c = gets.split.map(&:to_i) puts (a<=c && c<=b) ? "YES" : "NO"
a,b,c = gets.split.map(&:to_i) puts (a<=c && c<=b) ? "Yes" : "No"
[ "literal.string.change", "literal.string.case.change", "call.arguments.change" ]
1,389,926
1,389,927
u079330987
ruby
p03719
io = STDIN a,b,c=io.gets.chomp.split.map(&:to_i) puts (c>=a)&&(c<<b) ? 'Yes' : 'No'
io = STDIN a,b,c=io.gets.chomp.split.map(&:to_i) puts (c>=a)&&(c<=b) ? 'Yes' : 'No'
[ "control_flow.branch.if.condition.change" ]
1,389,958
1,389,959
u132360211
ruby
p03721
n,k = gets.chomp.split.map(&:to_i) array = Array.new hash = Hash.new n.times do |i| a,b = gets.split.map(&:to_i) array << a #puts "a=#{a} b=#{b}" hash[a] = hash[a].to_i + b end array.sort! cnt = 0 array.size.times do |j| cnt += hash[array[j]] if cnt >= k - 1 then puts array[j] #puts "hash #{hash[100000]}" exit end end
n,k = gets.chomp.split.map(&:to_i) array = Array.new hash = Hash.new n.times do |i| a,b = gets.split.map(&:to_i) array << a #puts "a=#{a} b=#{b}" hash[a] = hash[a].to_i + b end array.sort! array.uniq! cnt = 0 array.size.times do |j| cnt += hash[array[j]] if cnt >= k then puts array[j] # p array #puts "hash #{hash[100000]}" exit end end
[ "call.add", "expression.operation.binary.remove" ]
1,390,115
1,390,116
u409390792
ruby
p03721
n,k = gets.chomp.split.map(&:to_i) array = Array.new hash = Hash.new n.times do |i| a,b = gets.split.map(&:to_i) array << a #puts "a=#{a} b=#{b}" hash[a] = hash[a].to_i + b end array.sort! cnt = 0 array.size.times do |j| cnt += hash[array[j]] if cnt >= k then puts array[j] #puts "hash #{hash[100000]}" exit end end
n,k = gets.chomp.split.map(&:to_i) array = Array.new hash = Hash.new n.times do |i| a,b = gets.split.map(&:to_i) array << a #puts "a=#{a} b=#{b}" hash[a] = hash[a].to_i + b end array.sort! array.uniq! cnt = 0 array.size.times do |j| cnt += hash[array[j]] if cnt >= k then puts array[j] # p array #puts "hash #{hash[100000]}" exit end end
[ "call.add" ]
1,390,117
1,390,116
u409390792
ruby
p03721
N, K = gets.split.map(&:to_i) num_map = Hash.new(0) N.times do a, b = gets.split.map(&:to_i) num_map[a] += b end num_count = 0 num_map.keys.sort do |num| if num_count + num_map[num] >= K puts num break end num_count += num_map[num] end
N, K = gets.split.map(&:to_i) num_map = Hash.new(0) N.times do a, b = gets.split.map(&:to_i) num_map[a] += b end num_count = 0 num_map.keys.sort.each do |num| if num_count + num_map[num] >= K puts num break end num_count += num_map[num] end
[ "call.add" ]
1,390,804
1,390,805
u764026162
ruby
p03722
n,m = gets.chomp.split(" ").map(&:to_i) edge = m.times.map{gets.chomp.split(" ").map(&:to_i)} score = Array.new(n,-10**12) score[0] = 0 n.times do |e| edge.each do |i, j, k| if score[i-1] + k > score[j-1] score[j-1] = score[i-1] + k if e = n-1 && j == n puts "inf" exit end end end end puts score[-1]
n,m = gets.chomp.split(" ").map(&:to_i) edge = m.times.map{gets.chomp.split(" ").map(&:to_i)} score = Array.new(n,-10**12) score[0] = 0 n.times do |e| edge.each do |i, j, k| if score[i-1] + k > score[j-1] score[j-1] = score[i-1] + k if e == n-1 && j == n puts "inf" exit end end end end puts score[-1]
[ "expression.operation.compare.replace.add", "assignment.replace.remove", "misc.typo" ]
1,391,892
1,391,893
u475329018
ruby
p03722
n,m = gets.chomp.split(" ").map(&:to_i) edge = m.times.map{gets.chomp.split(" ").map(&:to_i)} score = Array.new(n,-10**12) score[0] = 0 n.times do |e| edge.each do |i, j, k| if score[i-1] + k > score[j-1] score[j-1] = score[i-1] + k if e >= n-1 puts "inf" exit end end end end puts score[-1]
n,m = gets.chomp.split(" ").map(&:to_i) edge = m.times.map{gets.chomp.split(" ").map(&:to_i)} score = Array.new(n,-10**12) score[0] = 0 n.times do |e| edge.each do |i, j, k| if score[i-1] + k > score[j-1] score[j-1] = score[i-1] + k if e == n-1 && j == n puts "inf" exit end end end end puts score[-1]
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
1,391,894
1,391,893
u475329018
ruby
p03722
n,m = gets.chomp.split(" ").map(&:to_i) edge = m.times.map{gets.chomp.split(" ").map(&:to_i)} score = Array.new(n,-10**12) score[0] = 0 n.times do |e| edge.each do |i, j, k| if score[i-1] + k > score[j-1] score[j-1] = score[i-1] + k if e == n-1 #nๅ›ž็›ฎใซใ‚‚ๆ›ดๆ–ฐใŒใ‚ใ‚‹ใจใ puts "inf" exit end end end end puts score[n-1]
n,m = gets.chomp.split(" ").map(&:to_i) edge = m.times.map{gets.chomp.split(" ").map(&:to_i)} score = Array.new(n,-10**12) score[0] = 0 n.times do |e| edge.each do |i, j, k| if score[i-1] + k > score[j-1] score[j-1] = score[i-1] + k if e == n-1 && j == n puts "inf" exit end end end end puts score[-1]
[ "control_flow.branch.if.condition.change", "call.arguments.change" ]
1,391,895
1,391,893
u475329018
ruby
p03724
n,m=gets.split.map(&:to_i) l=[0]*(n+1) m.times do a,b=gets.split.map(&:to_i) l[a]+=1 l[b]+=1 end l.each do |k| if k.odd? puts "No" exit end end puts "Yes"
n,m=gets.split.map(&:to_i) l=[0]*(n+1) m.times do a,b=gets.split.map(&:to_i) l[a]+=1 l[b]+=1 end l.each do |k| if k.odd? puts "NO" exit end end puts "YES"
[ "literal.string.change", "literal.string.case.change", "call.arguments.change", "io.output.change" ]
1,392,005
1,392,006
u744908753
ruby
p03724
n,m=gets.split.map &:to_i u=[false]*(n+1) n.times{ a,b=gets.split.map &:to_i u[a]^=true u[b]^=true } puts u.none? ? "YES" : "NO"
n,m=gets.split.map &:to_i u=[false]*(n+1) m.times{ a,b=gets.split.map &:to_i u[a]^=true u[b]^=true } puts u.none? ? "YES" : "NO"
[ "identifier.change" ]
1,392,357
1,392,358
u019489252
ruby
p03724
N, M = gets.split.map(&:to_i) edges = Array.new(N){Hash.new} M.times do |i| a, b = gets.split.map{|s|s.to_i-1} if edges[a][b] edges[a].delete(b) edges[b].delete(a) else edges[a][b] = true edges[b][a] = true end end N.times do |i| next if edges[i].length == 0 prev = i loop do succ = edges[prev].first[0] edges[prev].delete(succ) edges[succ].delete(prev) if edges[succ].length == 0 if succ == 0 break else puts 'NO' exit end end prev = succ end end puts 'YES'
N, M = gets.split.map(&:to_i) edges = Array.new(N){Hash.new} M.times do |i| a, b = gets.split.map{|s|s.to_i-1} if edges[a][b] edges[a].delete(b) edges[b].delete(a) else edges[a][b] = true edges[b][a] = true end end N.times do |i| next if edges[i].length == 0 prev = i loop do succ = edges[prev].first[0] edges[prev].delete(succ) edges[succ].delete(prev) if edges[succ].length == 0 if succ == i break else puts 'NO' exit end end prev = succ end end puts 'YES'
[ "identifier.replace.add", "literal.replace.remove", "control_flow.branch.if.condition.change" ]
1,392,407
1,392,408
u314396879
ruby
p03729
s = gets puts s.gsub(/(.) \1/){ $1 } && s.gsub(/(.) \1/){ $1 } ? "YES" : "NO"
s = gets puts s.sub!(/(.) \1/){ $1 } && s.sub!(/(.) \1/){ $1 } ? "YES" : "NO"
[ "identifier.change", "control_flow.branch.if.condition.change" ]
1,393,521
1,393,522
u693378622
ruby
p03729
s = gets puts s.gsub(/(.) \1/){ $1 } && s.gsub(/(.) \1/){ $1 } ? "YES" : "No"
s = gets puts s.sub!(/(.) \1/){ $1 } && s.sub!(/(.) \1/){ $1 } ? "YES" : "NO"
[ "identifier.change", "control_flow.branch.if.condition.change", "literal.string.change", "literal.string.case.change", "call.arguments.change" ]
1,393,523
1,393,522
u693378622
ruby
p03729
a, b, c = gets.chomp.split if a[-1] == b[0] && b[-1] == c[0] puts 'YES' else puts 'No' end
a, b, c = gets.chomp.split if a[-1] == b[0] && b[-1] == c[0] puts 'YES' else puts 'NO' end
[ "literal.string.change", "literal.string.case.change", "call.arguments.change" ]
1,393,746
1,393,747
u244257825
ruby
p03729
def shiritori(a, b, c) puts a[a.length-1] == b[0] && b[b.length-1] + c[0] ? "YES" : "NO" end a, b, c= gets.chomp.split(" ") shiritori(a, b, c)
def shiritori(a, b, c) puts a[a.length-1] == b[0] && b[b.length-1] == c[0] ? "YES" : "NO" end a, b, c= gets.chomp.split(" ") shiritori(a, b, c)
[ "control_flow.branch.if.condition.change" ]
1,393,764
1,393,765
u050641473
ruby
p03729
a,b,c=gets.split;puts a[-1]==b[0]and b[-1]==c[0] ? 'YES':'NO'
a,b,c=gets.split;puts (a[-1]==b[0]and b[-1]==c[0]) ? 'YES':'NO'
[ "control_flow.branch.if.condition.change" ]
1,394,136
1,394,137
u050914494
ruby
p03729
A,B,C = gets.chomp.split puts A[-1]==B[0] and B[-1]==C[0] ? "YES" : "NO"
A,B,C = gets.chomp.split puts A[-1]==B[0] && B[-1]==C[0] ? "YES" : "NO"
[ "expression.operation.binary.change" ]
1,394,320
1,394,322
u502306384
ruby
p03729
a, b, c = gets.chomp.split puts a[-1] == b[0] && b[-1] == c[0] ? 'Yes' : 'No'
a, b, c = gets.chomp.split puts a[-1] == b[0] && b[-1] == c[0] ? 'YES' : 'NO'
[ "literal.string.change", "literal.string.case.change", "call.arguments.change" ]
1,394,311
1,394,313
u124214522
ruby
p03729
w = gets.split l = w[0][-1] ret = true w.each{|s| if ret ret = l == s[0] l = s[-1] end } puts ret ? 'YES' : 'NO'
w = gets.split l = w[0][0] ret = true w.each{|s| if ret ret = l == s[0] l = s[-1] end } puts ret ? 'YES' : 'NO'
[ "assignment.value.change", "variable_access.subscript.index.change", "expression.operation.unary.remove" ]
1,394,641
1,394,642
u907904115
ruby
p03729
input_list = gets.split(" ") if(input_list[0][-1] == input_list[1][0] && input_list[1][-1] == input_list[2][0]) then puts("Yes") else puts("No") end
input_list = gets.split(" ") if(input_list[0][-1] == input_list[1][0] && input_list[1][-1] == input_list[2][0]) then puts("YES") else puts("NO") end
[ "literal.string.change", "literal.string.case.change", "call.arguments.change" ]
1,394,672
1,394,673
u884847580
ruby
p03730
a, b, c = gets.strip.split.map(&:to_i) puts (1..b).any? {|i| i * a % b == c} ? "Yes" : "No"
a, b, c = gets.strip.split.map(&:to_i) puts (1..b).any? {|i| i * a % b == c} ? "YES" : "NO"
[ "literal.string.change", "literal.string.case.change", "call.arguments.change" ]
1,395,623
1,395,624
u367259152
ruby
p03730
a, b, c = gets.split(' ').map!(&:to_i) exist = Hash.new(false) ans = 'No' times = 1 loop do r = (a * times) % b if r == c ans = 'Yes' break end break if exist[r] # ใ™ใงใซๅญ˜ๅœจใ—ใฆใ„ใ‚‹ไฝ™ใ‚Šใ ใฃใŸๅ ดๅˆใฏใ€ใ“ใ‚Œไปฅ้™ใฏๅ‡บ็พใ—ใชใ„ exist[r] = true times += 1 end puts ans
a, b, c = gets.split(' ').map!(&:to_i) exist = Hash.new(false) ans = 'NO' times = 1 loop do r = (a * times) % b if r == c ans = 'YES' break end break if exist[r] # ใ™ใงใซๅญ˜ๅœจใ—ใฆใ„ใ‚‹ไฝ™ใ‚Šใ ใฃใŸๅ ดๅˆใฏใ€ใ“ใ‚Œไปฅ้™ใฏๅ‡บ็พใ—ใชใ„ exist[r] = true times += 1 end puts ans
[ "literal.string.change", "literal.string.case.change", "assignment.value.change" ]
1,395,670
1,395,671
u315984289
ruby
p03730
a, b, c = gets.chomp.split.map &:to_i b.times do |i| if (a*i)%b == c puts "Yes" exit end end puts "No"
a, b, c = gets.chomp.split.map &:to_i b.times do |i| if (a*i)%b == c puts "YES" exit end end puts "NO"
[ "literal.string.change", "literal.string.case.change", "call.arguments.change", "io.output.change" ]
1,396,318
1,396,319
u722652068
ruby
p03730
a, b, c = gets.chomp.split.map &:to_i b.times do |i| if (a*i)%b == c puts "Yes" exit end end puts "No"
a, b, c = gets.chomp.split.map &:to_i b.times do |i| if (a*i)%b == c puts "YES" exit end end puts "NO"
[ "literal.string.change", "literal.string.case.change", "call.arguments.change", "io.output.change" ]
1,396,318
1,396,320
u722652068
ruby
p03730
a, b, c = gets.chomp.split(" ").map(&:to_i) for i in 0..b do if (a*i)%b == c puts "YES" break end end puts "NO"
a, b, c = gets.chomp.split(" ").map(&:to_i) for i in 0..b do if (a*i)%b == c puts "YES" exit end end puts "NO"
[ "control_flow.break.remove", "control_flow.exit.add" ]
1,396,439
1,396,440
u966695319
ruby
p03730
a,b,c = gets.split.map{|n|n.to_i} def judge(a,b,c) (1..b*10).each do |i| if (i * a) % b == 1 return "YES" end end return "NO" end puts judge(a,b,c)
a,b,c = gets.split.map{|n|n.to_i} def judge(a,b,c) (1..b*10).each do |i| if (i * a) % b == c return "YES" end end return "NO" end puts judge(a,b,c)
[ "identifier.replace.add", "literal.replace.remove", "control_flow.branch.if.condition.change" ]
1,396,562
1,396,563
u273927571
ruby
p03730
a,b,c = gets.split(" ").map(&:to_i) tmp = a % b flag = true (b+1).times{|i| if (c == tmp*i%b) then puts("YES") flag = false end } if flag then puts("NO") end
a,b,c = gets.split(" ").map(&:to_i) tmp = a % b flag = true (b).times{|i| if (c == tmp*i%b && flag) then puts("YES") flag = false end } if flag then puts("NO") end
[ "expression.operation.binary.remove", "control_flow.branch.if.condition.change" ]
1,396,584
1,396,585
u884847580
ruby
p03730
a,b,c = gets.split(" ").map(&:to_i) tmp = a % b flag = true b.times{|i| if (c == tmp*i%b) then puts("YES") flag = false end } if flag then puts("NO") end
a,b,c = gets.split(" ").map(&:to_i) tmp = a % b flag = true (b).times{|i| if (c == tmp*i%b && flag) then puts("YES") flag = false end } if flag then puts("NO") end
[ "control_flow.branch.if.condition.change" ]
1,396,586
1,396,585
u884847580
ruby
p03730
a,b,c = gets.chomp.split(' ').map(&:to_i) i = 0 result = 'YES' numbers = [] loop do num = (a * i) % b break if num == c if numbers.include?(num) result = 'NO' break end numbers << num i += 1 end p result
a,b,c = gets.chomp.split(' ').map(&:to_i) i = 0 result = 'YES' numbers = [] loop do num = (a * i) % b break if num == c if numbers.include?(num) result = 'NO' break end numbers << num i += 1 end print result
[ "call.function.change", "io.output.change" ]
1,396,636
1,396,637
u320973356
ruby
p03731
N, T = gets.split(" ").map{|s| s.to_i} a = gets.split(" ").map{|s| s.to_i} sum = 0 class Hoge def self.min(a,b) if a > b b else a end end end (N-1).times do |i| sum += Hoge.min(T, a[i+1]-a[i]) end puts sum
N, T = gets.split(" ").map{|s| s.to_i} a = gets.split(" ").map{|s| s.to_i} sum = 0 class Hoge def self.min(a,b) if a > b b else a end end end (N-1).times do |i| sum += Hoge.min(T, a[i+1]-a[i]) end sum += T puts sum
[]
1,396,922
1,396,923
u201090690
ruby
p03737
array = gets.chomp.split(" ") answer = "" array.each do |string| answer += string.first.upcase end puts answer
array = gets.chomp.split(" ") answer = "" array.each do |string| answer += string.slice(0).upcase end puts answer
[ "identifier.change", "call.arguments.add" ]
1,398,669
1,398,670
u333374716
ruby
p03737
S = get.split puts S.map{|s| s[0].upcase }.join
S = gets.split puts S.map{|s| s[0].upcase }.join
[ "assignment.value.change", "identifier.change" ]
1,398,747
1,398,748
u320576758
ruby
p03737
a,b,c = gets.chomp ans = a[0]+b[0]+c[0] puts ans.upcase
a,b,c = gets.chomp.split ans = a[0]+b[0]+c[0] puts ans.upcase
[ "call.add" ]
1,398,820
1,398,821
u706730549
ruby
p03737
puts `dd`.split.map{|a|a[0]}.join
puts `dd`.split.map{|a|a[0]}.join.upcase
[ "call.add" ]
1,398,862
1,398,863
u670503797
ruby
p03737
str = gets().upcase.split() str.each do |i| p i[0] end
str = gets().upcase.split() str.each do |i| print i[0] end puts()
[ "call.function.change", "io.output.change", "call.add" ]
1,398,937
1,398,938
u259046272
ruby
p03737
puts gets.split.map{|x|x[0]}.upcase.join
puts gets.split.map{|x|x[0].upcase}.join
[ "call.arguments.change" ]
1,398,943
1,398,944
u056944756
ruby
p03738
A = gets.to_i B = gets.to_i if A > B puts 'GREATER' elsif A == B puts 'LESS' else puts 'EQUAL' end
A = gets.to_i B = gets.to_i if A > B puts 'GREATER' elsif A == B puts 'EQUAL' else puts 'LESS' end
[ "call.remove", "call.add" ]
1,399,722
1,399,723
u503890246
ruby
p03738
a,b = gets.split.map(&:to_i) if a < b puts "LESS" elsif a > b puts "GREATER" else puts "EQUAL" end
a,b = 2.times.map{ gets.to_i } if a < b puts "LESS" elsif a > b puts "GREATER" else puts "EQUAL" end
[ "assignment.value.change", "identifier.replace.remove", "literal.replace.add", "identifier.change" ]
1,399,931
1,399,932
u627981707
ruby
p03738
puts %w[EQUAL LESS GREATER][gets.to_i<=>gets.to_i]
puts %w[EQUAL GREATER LESS][gets.to_i<=>gets.to_i]
[ "call.arguments.change" ]
1,399,982
1,399,983
u657913472
ruby
p03738
def f(a, b) r = a.size - b.size return r if r != 0 a.size.times{|i| r = a[i].to_i - b[i].to_i return r if r != 0 } return 0 end A = gets.chomp B = gets.chomp puts case f(A, B) when 0..1.0/0; "GREATER" when 0; "EQUAL" else "LESS" end
def f(a, b) r = a.size - b.size return r if r != 0 a.size.times{|i| r = a[i].to_i - b[i].to_i return r if r != 0 } return 0 end A = gets.chomp B = gets.chomp puts case f(A, B) when 1..1.0/0; "GREATER" when 0; "EQUAL" else "LESS" end
[ "literal.number.integer.change", "call.arguments.change" ]
1,400,204
1,400,205
u711705317
ruby
p03738
a =gets.to_i b = gets.to_i if a > b then puts("GREATE") elsif a < b then puts("LESS") else puts("EQUAL") end
a =gets.to_i b = gets.to_i if a > b then puts("GREATER") elsif a < b then puts("LESS") else puts("EQUAL") end
[ "literal.string.change", "call.arguments.change" ]
1,400,292
1,400,293
u090855597
ruby
p03738
a = gets.to_i b = gets.to_i if a < b puts "LESS" elif a > b puts "GREATER" else puts "EQUAL" end
a = gets.to_i b = gets.to_i if a < b puts "LESS" elsif a > b puts "GREATER" else puts "EQUAL" end
[ "misc.typo" ]
1,400,333
1,400,334
u687214625
ruby
p03738
A = STDIN.gets.strip B = STDIN.gets.strip if B < A puts "GREATER" elsif A < B puts "LESS" else puts "EQUAL" end
A = STDIN.gets.to_i B = STDIN.gets.to_i if B < A puts "GREATER" elsif A < B puts "LESS" else puts "EQUAL" end
[ "assignment.value.change", "identifier.change" ]
1,400,343
1,400,344
u248145233
ruby
p03739
n = gets.to_i a_list = gets.split.map(&:to_i) def calc(list, first_is_positive) first = list[0] count = if first_is_positive first > 0 ? 0 : 1 - first else first < 0 ? 0 : (-1 - first).abs end sum = first_is_positive ? first + count : first - count list[1..-1].each do |a| if sum > 0 # plus to minus if a >= 0 count += (a + sum) + 1 sum = -1 else if sum + a < 0 sum += a else count += (sum + a) + 1 sum = -1 end end else # minus to plus if a >= 0 if sum + a > 0 sum += a else count += (sum + a).abs + 1 sum = -1 end else count += (a + sum).abs + 1 sum = 1 end end end count end ans = [ calc(a_list, true), calc(a_list, false) ].min puts ans
n = gets.to_i a_list = gets.split.map(&:to_i) def calc(list, first_is_positive) first = list[0] count = if first_is_positive first > 0 ? 0 : 1 - first else first < 0 ? 0 : (-1 - first).abs end sum = first_is_positive ? first + count : first - count list[1..-1].each do |a| if sum > 0 # plus to minus if a >= 0 count += (a + sum) + 1 sum = -1 else if sum + a < 0 sum += a else count += (sum + a) + 1 sum = -1 end end else # minus to plus if a >= 0 if sum + a > 0 sum += a else count += (sum + a).abs + 1 sum = 1 end else count += (a + sum).abs + 1 sum = 1 end end end count end ans = [ calc(a_list, true), calc(a_list, false) ].min puts ans
[ "expression.operation.unary.arithmetic.remove" ]
1,400,976
1,400,977
u012133968
ruby
p03740
x, y = gets.strip.split.map(&:to_i) if (x-y).abs <= 1 puts 'Bob' else puts 'Alice' end
x, y = gets.strip.split.map(&:to_i) if (x-y).abs <= 1 puts 'Brown' else puts 'Alice' end
[ "literal.string.change", "call.arguments.change" ]
1,401,287
1,401,288
u021358975
ruby
p03740
x, y = gets.strip.split.map(&:to_i) if (x-y).abx <= 1 puts 'Bob' else puts 'Alice' end
x, y = gets.strip.split.map(&:to_i) if (x-y).abs <= 1 puts 'Brown' else puts 'Alice' end
[ "identifier.change", "control_flow.branch.if.condition.change", "literal.string.change", "call.arguments.change" ]
1,401,289
1,401,288
u021358975
ruby
p03740
require 'prime' include Math def max(a,b); a > b ? a : b end def min(a,b); a < b ? a : b end def swap(a,b); a, b = b, a end def gif; gets.to_i end def gff; gets.to_f end def gsf; gets.chomp end def gi; gets.split.map(&:to_i) end def gf; gets.split.map(&:to_f) end def gs; gets.chomp.split.map(&:to_s) end def gc; gets.chomp.split('') end def pr(num); num.prime_division end def digit(num); num.to_s.length end def array(s,ini=nil); Array.new(s){ini} end def darray(s1,s2,ini=nil); Array.new(s1){Array.new(s2){ini}} end def rep(num); num.times{|i|yield(i)} end def repl(st,en,n=1); st.step(en,n){|i|yield(i)} end x,y = gi puts (x-y).abs <= 1 ? 'Bob' : 'Alice'
require 'prime' include Math def max(a,b); a > b ? a : b end def min(a,b); a < b ? a : b end def swap(a,b); a, b = b, a end def gif; gets.to_i end def gff; gets.to_f end def gsf; gets.chomp end def gi; gets.split.map(&:to_i) end def gf; gets.split.map(&:to_f) end def gs; gets.chomp.split.map(&:to_s) end def gc; gets.chomp.split('') end def pr(num); num.prime_division end def digit(num); num.to_s.length end def array(s,ini=nil); Array.new(s){ini} end def darray(s1,s2,ini=nil); Array.new(s1){Array.new(s2){ini}} end def rep(num); num.times{|i|yield(i)} end def repl(st,en,n=1); st.step(en,n){|i|yield(i)} end x,y = gi puts (x-y).abs <= 1 ? 'Brown' : 'Alice'
[ "literal.string.change", "call.arguments.change" ]
1,401,389
1,401,390
u988228861
ruby
p03740
require 'prime' include Math def max(a,b); a > b ? a : b end def min(a,b); a < b ? a : b end def swap(a,b); a, b = b, a end def gif; gets.to_i end def gff; gets.to_f end def gsf; gets.chomp end def gi; gets.split.map(&:to_i) end def gf; gets.split.map(&:to_f) end def gs; gets.chomp.split.map(&:to_s) end def gc; gets.chomp.split('') end def pr(num); num.prime_division end def digit(num); num.to_s.length end def array(s,ini=nil); Array.new(s){ini} end def darray(s1,s2,ini=nil); Array.new(s1){Array.new(s2){ini}} end def rep(num); num.times{|i|yield(i)} end def repl(st,en,n=1); st.step(en,n){|i|yield(i)} end x,y = gi puts (x-y).abs <= 1 ? 'Alice' : 'Bob'
require 'prime' include Math def max(a,b); a > b ? a : b end def min(a,b); a < b ? a : b end def swap(a,b); a, b = b, a end def gif; gets.to_i end def gff; gets.to_f end def gsf; gets.chomp end def gi; gets.split.map(&:to_i) end def gf; gets.split.map(&:to_f) end def gs; gets.chomp.split.map(&:to_s) end def gc; gets.chomp.split('') end def pr(num); num.prime_division end def digit(num); num.to_s.length end def array(s,ini=nil); Array.new(s){ini} end def darray(s1,s2,ini=nil); Array.new(s1){Array.new(s2){ini}} end def rep(num); num.times{|i|yield(i)} end def repl(st,en,n=1); st.step(en,n){|i|yield(i)} end x,y = gi puts (x-y).abs <= 1 ? 'Brown' : 'Alice'
[ "literal.string.change", "call.arguments.change" ]
1,401,391
1,401,390
u988228861
ruby
p03739
# ๅ‚่€ƒ: https://beta.atcoder.jp/contests/abc059/submissions/3269205 N = gets.to_i AS = gets.split.map(&:to_i) results = [1, -1].map do |s| sum = 0 count = 0 AS.each do |a| s = s < 0 ? 1 : -1 sum += a if sum == 0 count += 1 sum = s ? -1 : 1 next end if s > 0 if sum > 0 count += sum + 1 sum = -1 end else if sum < 0 count += -sum + 1 sum = 1 end end end count end p results.min
# ๅ‚่€ƒ: https://beta.atcoder.jp/contests/abc059/submissions/3269205 N = gets.to_i AS = gets.split.map(&:to_i) results = [1, -1].map do |s| sum = 0 count = 0 AS.each do |a| s = s < 0 ? 1 : -1 sum += a if sum == 0 count += 1 sum = s > 0 ? -1 : 1 next end if s > 0 if sum > 0 count += sum + 1 sum = -1 end else if sum < 0 count += -sum + 1 sum = 1 end end end count end p results.min
[ "control_flow.branch.if.condition.change" ]
1,401,795
1,401,796
u083707708
ruby
p03745
n = gets.to_i aa = gets.split.map(&:to_i) prev, current = 0, 0 ret = 1 (n - 1).times do |i| diff = aa[i + 1] - aa[i] if diff > 0 if prev == -1 ret += 1 current = 0 else current = 1 end else if prev == 1 ret += 1 current = 0 else current = -1 end end prev = current end puts ret
n = gets.to_i aa = gets.split.map(&:to_i) prev, current = 0, 0 ret = 1 (n - 1).times do |i| diff = aa[i + 1] - aa[i] next if diff == 0 if diff > 0 if prev == -1 ret += 1 current = 0 else current = 1 end else if prev == 1 ret += 1 current = 0 else current = -1 end end prev = current end puts ret
[]
1,402,923
1,402,924
u104678771
ruby
p03745
n = gets.to_i arr = gets.split.map(&:to_i) div = 0 counter = 1 (1..n).each do |i| c = arr[i-1] <=> arr[i] if div == 0 if c == 1 div = 1 elsif c == -1 div = -1 end elsif (div == 1 && c == -1 || div == -1 && c == 1) counter += 1 div = 0 end end puts
n = gets.to_i arr = gets.split.map(&:to_i) div = 0 counter = 1 (1..n).each do |i| c = arr[i-1] <=> arr[i] if div == 0 if c == 1 div = 1 elsif c == -1 div = -1 end elsif (div == 1 && c == -1 || div == -1 && c == 1) counter += 1 div = 0 end end puts counter
[ "call.arguments.change" ]
1,403,162
1,403,163
u296101474
ruby
p03745
N = gets.to_i arr = gets.chomp!.split(" ").map { |v| v.to_i } fir = 0 dir = "" isfirst = true ans = 1 0.upto(N-1) { |i| if (isfirst && (arr[i] == arr[fir]) ) then next end if (isfirst && (arr[i] > arr[fir]) ) then isfirst = false dir = "up" next end if (isfirst && (arr[i] < arr[fir]) ) then isfirst = false dir = "down" next end if (dir == "up" && arr[i] >= arr[i-1]) then next end if (dir == "down" && arr[i] <= arr[i-1]) then next end ans += 1 fir = i } puts ans
N = gets.to_i arr = gets.chomp!.split(" ").map { |v| v.to_i } fir = 0 dir = "" isfirst = true ans = 1 0.upto(N-1) { |i| if (isfirst && (arr[i] == arr[fir]) ) then next end if (isfirst && (arr[i] > arr[fir]) ) then isfirst = false dir = "up" next end if (isfirst && (arr[i] < arr[fir]) ) then isfirst = false dir = "down" next end if (dir == "up" && arr[i] >= arr[i-1]) then next end if (dir == "down" && arr[i] <= arr[i-1]) then next end ans += 1 fir = i isfirst = true } puts ans
[ "assignment.add" ]
1,403,736
1,403,737
u162612857
ruby
p03745
N = gets.to_i arr = gets.chomp!.split(" ").map { |v| v.to_i } fir = 0 dir = "" isfirst = true ans = 1 0.upto(N-1) { |i| if (isfirst && (arr[i] == arr[fir]) ) then next end if (isfirst && (arr[i] > arr[fir]) ) then isfirst = false dir = "up" next end if (isfirst && (arr[i] > arr[fir]) ) then isfirst = false dir = "down" next end if (dir == "up" && arr[i] >= arr[i-1]) then next end if (dir == "down" && arr[i] <= arr[i-1]) then next end ans += 1 fir = i } puts ans
N = gets.to_i arr = gets.chomp!.split(" ").map { |v| v.to_i } fir = 0 dir = "" isfirst = true ans = 1 0.upto(N-1) { |i| if (isfirst && (arr[i] == arr[fir]) ) then next end if (isfirst && (arr[i] > arr[fir]) ) then isfirst = false dir = "up" next end if (isfirst && (arr[i] < arr[fir]) ) then isfirst = false dir = "down" next end if (dir == "up" && arr[i] >= arr[i-1]) then next end if (dir == "down" && arr[i] <= arr[i-1]) then next end ans += 1 fir = i isfirst = true } puts ans
[ "misc.opposites", "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
1,403,738
1,403,737
u162612857
ruby
p03745
io = STDIN io = DATA #!#!#!#!must delete n=io.gets.chomp.to_i ar=io.gets.chomp.split.map(&:to_i) cnt=0 delta=:mid ar.each_cons(2) do |a,b| case delta when :mid if a==b elsif a<b cnt += 1 delta = :up else cnt += 1 delta = :down end when :up if a==b elsif a<b else delta = :mid end when :down if a==b elsif a<b delta = :mid else end end end cnt += 1 if delta == :mid puts cnt
io = STDIN n=io.gets.chomp.to_i ar=io.gets.chomp.split.map(&:to_i) cnt=0 delta=:mid ar.each_cons(2) do |a,b| case delta when :mid if a==b elsif a<b cnt += 1 delta = :up else cnt += 1 delta = :down end when :up if a==b elsif a<b else delta = :mid end when :down if a==b elsif a<b delta = :mid else end end end cnt += 1 if delta == :mid puts cnt
[ "assignment.remove" ]
1,403,739
1,403,740
u132360211
ruby
p03745
n=gets.to_i a=gets.split.map(&:to_i) b, c, f=a[0], 0, -1 (1...n).each do |i| e=a[i] if f==-1 # ? if b<e f=0 elsif b>e f=1 else f=-1 end elsif f==0 # increasing if b<=e # else f=-1 c+=1 end elsif f==1 # dec if b>e # else f=-1 c+=1 end else # yabai # end b=e end puts c+1
n=gets.to_i a=gets.split.map(&:to_i) b, c, f=a[0], 0, -1 (1...n).each do |i| e=a[i] if f==-1 # ? if b<e f=0 elsif b>e f=1 else f=-1 end elsif f==0 # increasing if b<=e # else f=-1 c+=1 end elsif f==1 # dec if b>=e # else f=-1 c+=1 end else # yabai exit(1) end b=e end puts c+1
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change", "call.arguments.add" ]
1,403,745
1,403,746
u882868478
ruby
p03745
# ้…ๅˆ—ใฎ้•ทใ•ใ‚’ๅ–ๅพ— n = gets.chomp.to_i # ้…ๅˆ—ใ‚’ๅ–ๅพ— arr = gets.chomp.split(" ").map{|e| e.to_i} # ้…ๅˆ—ใ‚’ใƒใ‚งใƒƒใ‚ฏ order = 0 group = 1 for i in 1...n # ๆ•ฐๅญ—ใŒๅค‰ใ‚ใ‚‰ใชใ‘ใ‚Œใฐไฝ•ใ‚‚่€ƒใˆใชใ„ if arr[i - 1] != arr[i] # ๆœ€ๅˆใฏOK if order == 0 if arr[i - 1] < arr[i] # ไธŠๆ˜‡ใŒๅง‹ใพใ‚‹ order = 1 else # ไธ‹้™ใŒๅง‹ใพใ‚‹ order = -1 end # ไธŠๆ˜‡ไธญใฎๅ ดๅˆ elsif order == 1 # ไธ‹ใŒใ‚Œใฐๅˆ‡ใ‚Šๆ›ฟใˆ if arr[i - 1] > arr[i] group += 1 order *= -1 end # ไธ‹้™ไธญใฎๅ ดๅˆ else if arr[i - 1] < arr[i] group += 1 order *= -1 end end end end # ็ตๆžœใ‚’่กจ็คบ puts group
# ้…ๅˆ—ใฎ้•ทใ•ใ‚’ๅ–ๅพ— n = gets.chomp.to_i # ้…ๅˆ—ใ‚’ๅ–ๅพ— arr = gets.chomp.split(" ").map{|e| e.to_i} # ้…ๅˆ—ใ‚’ใƒใ‚งใƒƒใ‚ฏ order = 0 group = 1 for i in 1...n # ๆ•ฐๅญ—ใŒๅค‰ใ‚ใ‚‰ใชใ‘ใ‚Œใฐไฝ•ใ‚‚่€ƒใˆใชใ„ if arr[i - 1] != arr[i] # ๆœ€ๅˆใ‚„ใ€ๅˆ‡ใ‚Šๆ›ฟใ‚ใฃใŸ็›ดๅพŒใฏOK if order == 0 if arr[i - 1] < arr[i] # ไธŠๆ˜‡ใŒๅง‹ใพใ‚‹ order = 1 else # ไธ‹้™ใŒๅง‹ใพใ‚‹ order = -1 end # ไธŠๆ˜‡ไธญใฎๅ ดๅˆ elsif order == 1 # ไธ‹ใŒใ‚Œใฐๅˆ‡ใ‚Šๆ›ฟใˆ if arr[i - 1] > arr[i] group += 1 order = 0 end # ไธ‹้™ไธญใฎๅ ดๅˆ else if arr[i - 1] < arr[i] group += 1 order = 0 end end end end # ็ตๆžœใ‚’่กจ็คบ puts group
[ "expression.operation.unary.remove" ]
1,403,804
1,403,805
u684078009
ruby
p03759
a, b, c = gets.strip.split.map(&:to_i) puts (b - a) == (c -b) ? "Yes" : "No"
a, b, c = gets.strip.split.map(&:to_i) puts (b - a) == (c -b) ? "YES" : "NO"
[ "literal.string.change", "literal.string.case.change", "call.arguments.change" ]
1,405,729
1,405,730
u561391668
ruby
p03759
a,b,c=gets.split.map(&:to_i) if b - a == c - b p 'YES' else p 'NO' end
a,b,c=gets.split.map(&:to_i) if b - a == c - b print 'YES' else print 'NO' end
[ "call.function.change", "io.output.change" ]
1,405,736
1,405,737
u049159332
ruby
p03759
a = gets.split(" ").map(&:to_i) if a[1] - a[0] == a[2] - 1[1] puts "YES" else puts "NO" end
a = gets.split(" ").map(&:to_i) if a[1] - a[0] == a[2] - a[1] puts "YES" else puts "NO" end
[ "identifier.replace.add", "literal.replace.remove", "control_flow.branch.if.condition.change" ]
1,405,911
1,405,912
u414166540
ruby
p03759
a = gets.split(" ").map(&:to_i) if a[0] - a[1] == a[2] - 1[1] puts "YES" else puts "NO" end
a = gets.split(" ").map(&:to_i) if a[1] - a[0] == a[2] - a[1] puts "YES" else puts "NO" end
[ "literal.number.integer.change", "variable_access.subscript.index.change", "control_flow.branch.if.condition.change", "identifier.replace.add", "literal.replace.remove" ]
1,405,913
1,405,912
u414166540
ruby
p03759
a,b,c= gets.split.map(&:to_i) puts b-a==c-d ? "YES" : "NO"
a,b,c= gets.split.map(&:to_i) puts b-a==c-b ? "YES" : "NO"
[ "identifier.change", "control_flow.branch.if.condition.change" ]
1,405,988
1,405,989
u585819925
ruby
p03759
a, b, c = gets.split.map(&:to_i) puts b*2-a = c ? 'YES' : 'NO'
a, b, c = gets.split.map(&:to_i) puts b*2-a == c ? 'YES' : 'NO'
[ "expression.operation.compare.replace.add", "assignment.replace.remove", "misc.typo" ]
1,406,010
1,406,011
u968699140
ruby
p03759
a,b,c=gets.chomp.split.map(&:to_i) puts b-a && c-b ? "YES" : "NO"
a,b,c=gets.chomp.split.map(&:to_i) puts b-a == c-b ? "YES" : "NO"
[ "control_flow.branch.if.condition.change" ]
1,406,100
1,406,101
u616320334
ruby
p03759
a = gets.chomp.split(" ").map(&:to_i) if a[0]-a[1] == a[1]-[2] puts "YES" else puts "NO" end
a = gets.chomp.split(" ").map(&:to_i) if a[0]-a[1] == a[1]-a[2] puts "YES" else puts "NO" end
[ "control_flow.branch.if.condition.change" ]
1,406,169
1,406,170
u506255180
ruby
p03759
a,b,c = gets.chomp.split(' ').map{|n| n.to_i} ans = "No" ans = "Yes" if b - a == c - b puts ans
a,b,c = gets.chomp.split(' ').map{|n| n.to_i} ans = "NO" ans = "YES" if b - a == c - b puts ans
[ "literal.string.change", "literal.string.case.change", "assignment.value.change" ]
1,406,282
1,406,283
u698501698
ruby
p03759
a,b,c=gets.split.map &:to_i;puts b-a==c-b ? :Yes : :NO
a,b,c=gets.split.map &:to_i;puts b-a==c-b ? :YES : :NO
[ "call.arguments.change" ]
1,406,341
1,406,342
u657913472
ruby
p03759
a,b,c = gets.split(" ").map(&:to_i) if b-a == c-a puts 'YES' else puts 'NO' end
a,b,c = gets.split(" ").map(&:to_i) if b-a == c-b puts 'YES' else puts 'NO' end
[ "identifier.change", "control_flow.branch.if.condition.change" ]
1,406,392
1,406,393
u135201316
ruby
p03759
a,b,c=gets.split.map(&:to_i) puts b-a==c-a ? 'YES' : 'NO'
a,b,c=gets.split.map(&:to_i) puts b-a==c-b ? 'YES' : 'NO'
[ "identifier.change", "control_flow.branch.if.condition.change" ]
1,406,440
1,406,441
u183509493
ruby
p03759
a,b,c = gets.split.map &:to_i puts b-a == c-b ? YES : NO
a,b,c = gets.split.map &:to_i puts b-a == c-b ? "YES" : "NO"
[ "call.arguments.change" ]
1,406,487
1,406,488
u094826590
ruby
p03759
a,b,c = gets.split.map &:to_i puts b-a==c-b ? YES : NO
a,b,c = gets.split.map &:to_i puts b-a == c-b ? "YES" : "NO"
[ "call.arguments.change" ]
1,406,489
1,406,488
u094826590
ruby
p03759
a, b, c = gets.chomp.split(" ").map(&:to_i) if bโˆ’a == cโˆ’b then puts "YES" else puts "NO" end
a, b, c = gets.chomp.split(" ").map(&:to_i) if b - a == c - b then puts "YES" else puts "NO" end
[ "control_flow.branch.if.condition.change" ]
1,406,569
1,406,570
u910756197
ruby
p03759
a = "" a = gets.chomp.split(" ").map(&:to_i) if( (a[1] - a[0]).abs == (a[2] - a[1]).abs ) print("YES") else print("NO") end
a = "" a = gets.chomp.split(" ").map(&:to_i) if( (a[1] - a[0]) == (a[2] - a[1]) ) print("YES") else print("NO") end
[ "call.remove" ]
1,406,593
1,406,594
u573474386
ruby
p03760
o = gets.split e = gets.split puts o.chars.zip(e.chars).flatten.join
o = gets e = gets puts o.chars.zip(e.chars).flatten.join
[ "call.remove" ]
1,406,809
1,406,810
u489339677
ruby
p03760
o = gets.strip.chars e = gets.strip.chars puts o.chars.zip(e).flatten.join('')
o = gets.strip.chars e = gets.strip.chars puts o.zip(e).flatten.join('')
[ "call.remove" ]
1,406,921
1,406,922
u173515518
ruby
p03760
O = gets.chomp E = gets.chomp result = [] O.size.times do |i| result << O[i] result << E[i] end p result.join
O = gets.chomp E = gets.chomp result = [] O.size.times do |i| result << O[i] result << E[i] end puts result.join
[ "call.function.change", "io.output.change" ]
1,407,117
1,407,118
u503890246
ruby
p03760
o = gets.chomp e = gets.chomp o.chars.zip(e.chars).flatten.compact.inject{|a,b| a + b}
o = gets.chomp e = gets.chomp print o.chars.zip(e.chars).flatten.compact.inject{|a,b| a + b}
[ "io.output.change", "call.add" ]
1,407,155
1,407,156
u019986937
ruby
p03760
o = gets.chomp.split('') e = gets.chomp.split('') a = [] p o,e o.length.times do |x| a << o[x] a << e[x] end puts a.join('')
o = gets.chomp.split('') e = gets.chomp.split('') a = [] o.length.times do |x| a << o[x] a << e[x] end puts a.join('')
[ "call.remove" ]
1,407,157
1,407,158
u875730451
ruby