problem_id stringlengths 6 6 | buggy_code stringlengths 8 526k β | fixed_code stringlengths 12 526k β | labels listlengths 0 15 β | buggy_submission_id int64 1 1.54M β | fixed_submission_id int64 2 1.54M β | user_id stringlengths 10 10 β | language stringclasses 9
values |
|---|---|---|---|---|---|---|---|
p02676 | #!/usr/bin/env ruby
N = gets.to_i
S = gets.to_s
if S.size < N
puts S
else
puts S.slice!(0, N) + "..."
end
| #!/usr/bin/env ruby
N = gets.to_i
S = gets.chomp.to_s
if S.size <= N
puts S
else
puts S.slice!(0, N) + "..."
end
| [
"call.add",
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 393,621 | 393,622 | u305512012 | ruby |
p02676 | K = gets.to_i
S = gets
if S.length <= K
puts S
else
ans = S.slice(0, K)
puts(ans+"...")
end
| K = gets.to_i
S = gets
if S.length <= K+1
puts S
else
ans = S.slice(0, K)
puts(ans+"...")
end
| [
"control_flow.branch.if.condition.change"
] | 393,630 | 393,631 | u246530341 | ruby |
p02676 | k=gets.to_i
s=gets.chomp
p s.length
if k>=s.length
puts s
else
line=[]
line.push(s.chars)
ary=[]
k.times do |i|
ary[i]=line[0][i]
end
if k<s.length
ary.push('...')
end
puts str = ary.join
end | k=gets.to_i
s=gets.chomp
s.length
if k>=s.length
puts s
else
line=[]
line.push(s.chars)
ary=[]
k.times do |i|
ary[i]=line[0][i]
end
if k<s.length
ary.push('...')
end
puts str = ary.join
end | [
"io.output.change",
"call.remove"
] | 393,650 | 393,651 | u857765095 | ruby |
p02676 | n = gets.chomp.to_i
s = gets.chomp.to_s
if n >= s.length
puts s
else
puts s[0..n-1]
end | n = gets.chomp.to_i
s = gets.chomp.to_s
if n >= s.length
puts s
else
puts s[0..n-1] + '...'
end | [
"expression.operation.binary.add"
] | 393,677 | 393,678 | u443793571 | ruby |
p02676 | n = gets.chomp.to_i
s = gets.chomp.to_s
if n > s.length
puts s
else
puts s[0..n-1]
end | n = gets.chomp.to_i
s = gets.chomp.to_s
if n >= s.length
puts s
else
puts s[0..n-1] + '...'
end | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 393,679 | 393,678 | u443793571 | ruby |
p02676 | n=gets.to_i
s=gets.chomp
puts s.size>n ? s[0,7]+"..." : s
| n=gets.to_i
s=gets.chomp
puts s.size>n ? s[0,n]+"..." : s | [
"identifier.replace.add",
"literal.replace.remove",
"variable_access.subscript.index.change",
"call.arguments.change",
"expression.operation.binary.change"
] | 393,690 | 393,691 | u966810027 | ruby |
p02676 | k = gets.to_i
s = gets.chomp
if k > s.length
puts s
else
puts "#{s[0..k-1]}..."
end | k = gets.to_i
s = gets.chomp
if k >= s.length
puts s
else
puts "#{s[0..k-1]}..."
end | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 393,694 | 393,695 | u341702138 | ruby |
p02676 |
def main
limit_num = gets.to_i
string = gets
if string.length > limit_num
ans = ''
for i in 0..limit_num - 1
ans << string[i]
end
print(ans+'...')
else
print(string)
end
end
main |
def main
limit_num = gets.to_i
string = gets.chomp
if string.length > limit_num
ans = ''
for i in 0..limit_num - 1
ans << string[i]
end
print(ans+'...')
else
print(string)
end
end
main | [
"call.add"
] | 393,891 | 393,892 | u341534571 | ruby |
p02676 |
def main
limit_num = gets.to_i
string = gets
if string.length >= limit_num
ans = ''
for i in 0..limit_num - 1
ans << string[i]
end
print(ans+'...')
else
print(string)
end
end
main |
def main
limit_num = gets.to_i
string = gets.chomp
if string.length > limit_num
ans = ''
for i in 0..limit_num - 1
ans << string[i]
end
print(ans+'...')
else
print(string)
end
end
main | [
"call.add",
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 393,893 | 393,892 | u341534571 | ruby |
p02676 | k = gets.to_i
s = gets
output = s
if s.length > k
output = s[..k-1] + '...'
end
puts output | k = gets.to_i
s = gets.chomp
output = s
if s.length > k
output = s[..k-1] + "..."
end
puts output | [
"call.add",
"literal.string.change",
"assignment.value.change",
"expression.operation.binary.change"
] | 394,044 | 394,045 | u301362135 | ruby |
p02676 | k=gets.to_i
s=gets
if s.size > k
puts b[0..k-1]+"..."
else
puts b.chomp
end | k=gets.to_i
s=gets.chomp
if s.size > k
puts s[0..k-1]+"..."
else
puts s
end | [
"call.add",
"identifier.change",
"call.arguments.change",
"expression.operation.binary.change",
"io.output.change",
"call.remove"
] | 394,067 | 394,068 | u085647568 | ruby |
p02676 | k = gets.to_i
s = gets
if s.size <= k
puts s
else
puts s[0,k] + '...'
end | k = gets.to_i
s = gets.chomp
if s.size <= k
puts s
else
puts s[0,k] + '...'
end | [
"call.add"
] | 394,653 | 394,654 | u489339677 | ruby |
p02676 | k = gets.to_i
s = gets
if s.size < k
puts s
else
puts s[0,k] + '...'
end | k = gets.to_i
s = gets.chomp
if s.size <= k
puts s
else
puts s[0,k] + '...'
end | [
"call.add",
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 394,655 | 394,654 | u489339677 | ruby |
p02676 | k = gets.to_i
s = gets
if s.size < k
puts s
else
puts "#{s[0..k-1]}..."
end
| k = gets.to_i
s = gets.chomp
if s.size <= k
puts s
else
puts "#{s[0..k-1]}..."
end
| [
"call.add",
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 394,658 | 394,659 | u771457429 | ruby |
p02676 | k = gets.to_i
s = gets
num = s.length
puts num <= k ? s : "#{s[0..k-1]}..." | k = gets.to_i
s = gets.strip
num = s.length
puts num <= k ? s : "#{s[0..k-1]}..." | [
"call.add"
] | 394,751 | 394,752 | u514143079 | ruby |
p02676 | k = gets.to_i
s = gets
if k < s.length then
puts s[0..k-1] + "..."
else
puts s
end
| k = gets.to_i
s = gets.chomp
if k < s.length then
puts s[0..k-1] + "..."
else
puts s
end
| [
"call.add"
] | 394,823 | 394,824 | u014800961 | ruby |
p02676 | K = gets.to_i
S = gets.chomp
if S.size > K
puts "#{S[0..K-1]}..."
elsif S.size == K
puts S
end
| K = gets.to_i
S = gets.chomp
if S.size > K
puts "#{S[0..K-1]}..."
elsif S.size == K
puts S
else
puts S
end
| [
"call.add"
] | 394,910 | 394,911 | u501591853 | ruby |
p02676 | k=gets.to_i
s=gets.chars
if s.size<=k
puts s.join
elsif s.size>k
puts s[0,k].join + "..."
end | k=gets.to_i
s=gets.chomp
if s.size<=k
puts s
elsif s.size>k
puts s[0,k]+ "..."
end | [
"assignment.value.change",
"identifier.change",
"call.remove"
] | 395,018 | 395,019 | u128694188 | ruby |
p02676 | k=gets.to_i
s=gets.chars
if s.size<=k
puts s.join
elsif s.size>k
puts s[0,k].join + "..."
end | k=gets.to_i
s=gets.chomp.chars
if s.size<=k
puts s.join
elsif s.size>k
puts s[0,k].join + "..."
end | [
"call.add"
] | 395,018 | 395,020 | u128694188 | ruby |
p02676 | K = gets.to_i
S = gets.chomp
k = K - 1
if S.length > k
s = S.slice(0..k)
puts s + "..."
else
puts S
end | K = gets.to_i
S = gets.chomp
k = K - 1
if S.length > K
s = S.slice(0..k)
puts s + "..."
else
puts S
end | [
"control_flow.branch.if.condition.change"
] | 395,238 | 395,239 | u462163804 | ruby |
p02676 | a = gets.chomp
b = gets.chomp
if a.to_i < b.length
p b.slice!(0, a.to_i) + "..."
else
p b
end
| a = gets.chomp
b = gets.chomp
if a.to_i < b.length
puts b.slice!(0, a.to_i) + "..."
else
puts b
end
| [
"call.function.change",
"io.output.change"
] | 395,357 | 395,358 | u776258667 | ruby |
p02676 | k = gets.chomp.to_i
s = gets.chomp
if s.size > k then
puts s.slise(k) + "..."
else
puts s
end | k = gets.chomp.to_i
s = gets.chomp
if s.size > k then
puts s.slice(0..k-1) + "..."
else
puts s
end | [
"identifier.change",
"call.arguments.change",
"expression.operation.binary.change",
"io.output.change"
] | 395,521 | 395,522 | u713980442 | ruby |
p02676 | k = gets.chomp.to_i
s = gets.chomp
if k > s.length
puts s
else
puts s.slice(0..(k-1)) + "..."
end | k = gets.chomp.to_i
s = gets.chomp
if k >= s.length
puts s
else
puts s.slice(0..(k-1)) + "..."
end | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 395,574 | 395,575 | u302654038 | ruby |
p02676 | K = gets.to_i
S = gets.chomp
if S.size < K+1
puts S
else
T = S.slice(0,K-1)
U = T + '...'
puts U
end | K = gets.to_i
S = gets.chomp
if S.size < K+1
puts S
else
T = S.slice(0,K)
U = T + '...'
puts U
end
| [
"expression.operation.binary.remove"
] | 395,607 | 395,608 | u663404111 | ruby |
p02676 | line = readlines.map(&:chomp)
line[0] = line[0].to_i
if line[1].length < line[0]
puts line[1]
else
puts line[1][0, line[0]] + "..."
end
| line = readlines.map(&:chomp)
line[0] = line[0].to_i
if line[1].length <= line[0]
puts line[1]
else
puts line[1][0, line[0]] + "..."
end
| [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 395,685 | 395,686 | u389410817 | ruby |
p02676 | k = gets.to_i
s = gets.chomp
string = s.split("")
result = []
if string.length >= k
(0...k).each do |i|
result << string[i]
end
puts result.join("") + "..."
else puts s
end | k = gets.to_i
s = gets.chomp
string = s.split("")
result = []
if string.length > k
(0...k).each do |i|
result << string[i]
end
puts result.join("") + "..."
else puts s
end
| [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 395,895 | 395,896 | u895926909 | ruby |
p02676 | k = gets.to_i
s = gets.chomp
string = s.split("")
result = []
if string.length >= k
(0...k).each do |i|
result << string[i]
end
result.join("") + "..."
else puts s
end
| k = gets.to_i
s = gets.chomp
string = s.split("")
result = []
if string.length > k
(0...k).each do |i|
result << string[i]
end
puts result.join("") + "..."
else puts s
end
| [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change",
"io.output.change",
"call.add"
] | 395,897 | 395,896 | u895926909 | ruby |
p02676 | K=gets.chomp.to_i
S=gets.chomp.strip.to_s
s_len = S.length
s_array = []
if K > s_len
puts S
else
s_array = S.chars
s_tmp = s_array[0..K-1].inject(:+)
s_tmp << '...'
puts s_tmp
end | K=gets.chomp.to_i
S=gets.chomp.strip.to_s
s_len = S.length
s_array = []
if K >= s_len
puts S
else
s_array = S.chars
s_tmp = s_array[0..K-1].inject(:+)
s_tmp << '...'
puts s_tmp
end | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 395,934 | 395,935 | u525844030 | ruby |
p02676 | K=gets.chomp.to_i
S=gets.chomp.to_s
s_len = S.length
s_array = []
if K > s_len
puts S
else
s_array = S.chars
s_tmp = s_array[0..K-1].inject(:+)
s_tmp << '...'
puts s_tmp
end | K=gets.chomp.to_i
S=gets.chomp.strip.to_s
s_len = S.length
s_array = []
if K >= s_len
puts S
else
s_array = S.chars
s_tmp = s_array[0..K-1].inject(:+)
s_tmp << '...'
puts s_tmp
end | [
"call.add",
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 395,936 | 395,935 | u525844030 | ruby |
p02676 | K = gets.to_i
S = gets.chomp
if(K>S.length)
puts S
else
print S[0...K]
print "...\n"
end | K = gets.to_i
S = gets.chomp
if(K>=S.length)
puts S
else
print S[0...K]
print "...\n"
end | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 396,054 | 396,055 | u616360029 | ruby |
p02676 | k = gets.to_i
s = gets
if (s.size <= k)
puts s
else
puts "#{s[0..(k-1)]}..."
end
| k = gets.to_i
s = gets.chop
if (s.size <= k)
puts s
else
puts "#{s[0..(k-1)]}..."
end
| [
"call.add"
] | 396,171 | 396,172 | u425047940 | ruby |
p02676 | k = gets.chomp.to_i
s = gets.chomp
if s.length >= k
puts s[0...k] + '...'
else
puts s
end
| k = gets.chomp.to_i
s = gets.chomp
if s.length > k
puts s[0...k] + '...'
else
puts s
end
| [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 396,609 | 396,610 | u022453911 | ruby |
p02677 | a, b, h, m = gets.split.map(&:to_i)
theta = 1.0 * (60 * h - 11 * m).abs / 360
theta -= 1 if theta > 1
puts Math.sqrt(a ** 2 + b ** 2 - 2 * a * b * Math.cos(Math::PI * theta))
| a, b, h, m = gets.split.map(&:to_i)
theta = 1.0 * (60 * h - 11 * m).abs / 360
theta = 2 - theta if theta > 1
puts Math.sqrt(a ** 2 + b ** 2 - 2 * a * b * Math.cos(Math::PI * theta))
| [
"assignment.change"
] | 396,929 | 396,930 | u771770008 | ruby |
p02677 | #https://atcoder.jp/contests/abc168
a,b,h,m=gets.split(" ")
a,b,h,m=[a,b,h,m].map{|n| n.to_f}
#Aζι12ζιδΈε¨οΌδΈζι2/12Οι²θ‘
#BειδΈζιδΈε¨οΌδΈζι2Οι²θ‘
#a=3.0;b=4.0;m=0.0;h=9.0#.0γ€γγ
sitaA=(h+m/60)*2/12*Math::PI
sitaB=(h+m/60)*2*Math::PI
p sitaA,sitaB
#x^2=a^2+b^2-2ab cos sita
p Math.sqrt(a**2+b**2-2*a*b*Math.cos(sitaA-sitaB) )
| #https://atcoder.jp/contests/abc168
a,b,h,m=gets.split(" ")
a,b,h,m=[a,b,h,m].map{|n| n.to_f}
#Aζι12ζιδΈε¨οΌδΈζι2/12Οι²θ‘
#BειδΈζιδΈε¨οΌδΈζι2Οι²θ‘
#a=3.0;b=4.0;m=0.0;h=9.0#.0γ€γγ
sitaA=(h+m/60)*2/12*Math::PI
sitaB=(h+m/60)*2*Math::PI
#p sitaA,sitaB
#x^2=a^2+b^2-2ab cos sita
p Math.sqrt(a**2+b**2-2*a*b*Math.cos(sitaA-sitaB) )
| [
"call.remove"
] | 397,018 | 397,019 | u103662738 | ruby |
p02677 | # array = [*1..q].map { |_| gets.split.map(&:to_i) }
# n = gets.split.map(&:to_i)
# a = [*1..m].repeated_combination(n).to_a
a,b,h,m = gets.split.map(&:to_i)
if ((30*h+0.5*m) - 6*m).abs < 180
w = ((30*h+0.5*m) - 6*m).abs
else
w = ((360 - 6*m) - (30*h+0.5*m)).abs
end
h = a * Math.sin(w / 180.0000000000 * Math::PI);
bs = a * Math.cos(w / 180.000000000 * Math::PI);
bn = (b - bs).abs
c2 = h*h + bn*bn
puts Math.sqrt(c2)
| # array = [*1..q].map { |_| gets.split.map(&:to_i) }
# n = gets.split.map(&:to_i)
# a = [*1..m].repeated_combination(n).to_a
a,b,h,m = gets.split.map(&:to_i)
if ((30*h+0.5*m) - 6*m).abs < 180
w = ((30*h+0.5*m) - 6*m).abs
else
w = ((360 - 6*m) + (30*h+0.5*m)).abs
end
# PI = 3.14159265358979323846264
h = a * Math.sin(w / 180.0 * Math::PI);
bs = a * Math.cos(w / 180.0 * Math::PI);
bn = (b - bs).abs
c2 = h*h + bn*bn
puts Math.sqrt(c2)
| [
"misc.opposites",
"expression.operator.arithmetic.change",
"assignment.value.change",
"expression.operation.binary.change",
"literal.number.float.change",
"call.arguments.change"
] | 397,756 | 397,757 | u219902564 | ruby |
p02677 | a, b, h, m = gets.chomp.split(" ").map(&:to_i)
mizikai = h * 30 + m * 0.5
nagai = m * 6
if mizikai > nagai
s = mizikai - nagai
p s
if s > 180
s = 360 -s
end
c = Math.cos( s/ 180.0 * Math::PI)
d = a**2 + b**2 - 2*a*b*c
puts (d**0.5).floor(9)
elsif mizikai == nagai
puts (b-a).abs
else
t = nagai - mizikai
p t
if t > 180
t = 360 - t
end
f = Math.cos( t/ 180.0 * Math::PI)
g = a**2 + b**2 - 2*a*b*f
puts g**0.5
end | a, b, h, m = gets.chomp.split(" ").map(&:to_i)
mizikai = h * 30 + m * 0.5
nagai = m * 6
if mizikai > nagai
s = mizikai - nagai
if s > 180
s = 360 -s
end
c = Math.cos( s/ 180.0 * Math::PI)
d = a**2 + b**2 - 2*a*b*c
puts (d**0.5).floor(9)
elsif mizikai == nagai
puts (b-a).abs
else
t = nagai - mizikai
if t > 180
t = 360 - t
end
f = Math.cos( t/ 180.0 * Math::PI)
g = a**2 + b**2 - 2*a*b*f
puts g**0.5
end | [
"call.remove"
] | 397,909 | 397,910 | u412789323 | ruby |
p02677 | #εΎ©ηΏη¨
a, b, h, m = gets.split(" ").map(&:to_i)
rh = h * 30.0 + m * 0.5
rm = m * 6.0
r = (rh - rm).abs
r = r - 180.0 if r > 180.0
ans = (a ** 2) + (b ** 2) - (2 * a * b * Math.cos(r / 180 * Math::PI))
puts Math.sqrt(ans) | #εΎ©ηΏη¨
a, b, h, m = gets.split(" ").map(&:to_i)
rh = h * 30.0 + m * 0.5
rm = m * 6.0
r = (rh - rm).abs
r = 360 - r if r > 180.0
ans = (a ** 2) + (b ** 2) - (2 * a * b * Math.cos(r / 180 * Math::PI))
puts Math.sqrt(ans) | [
"assignment.value.change",
"identifier.replace.remove",
"literal.replace.add",
"expression.operation.binary.change",
"identifier.replace.add",
"literal.replace.remove"
] | 397,939 | 397,940 | u748406041 | ruby |
p02677 | a,b,h,m = gets.split(' ').map(&:to_i)
h=h.to_f
m=m.to_f
#puts 90 * Math::PI / 180
#puts Math.cos(90 * Math::PI / 180)
#d = ((h * 5.0 + m / 12.0) - m).abs #* 60
lt = (h * 30.0) + (m * 0.5)
st = m * 6.0
d=(lt-st).abs
if d>180.0
d = d-180.0
end
#puts lt
#puts st
#puts d
#rad = d * Math::PI / 180.0
#puts 2 * b * a * Math.cos(rad)
#naka = 2.0 * b * a * Math.cos(rad)
puts Math.sqrt(a**2.0 + b**2.0 - 2.0*b*a*Math.cos(d*Math::PI/180.0))
| a,b,h,m = gets.split(' ').map(&:to_i)
h=h.to_f
m=m.to_f
#puts 90 * Math::PI / 180
#puts Math.cos(90 * Math::PI / 180)
#d = ((h * 5.0 + m / 12.0) - m).abs #* 60
lt = (h * 30.0) + (m * 0.5)
st = m * 6.0
d=(lt-st).abs
if d>180.0
d = 360.0 -d
end
#puts lt
#puts st
#puts d
#rad = d * Math::PI / 180.0
#puts 2 * b * a * Math.cos(rad)
#naka = 2.0 * b * a * Math.cos(rad)
puts Math.sqrt(a**2.0 + b**2.0 - 2.0*b*a*Math.cos(d*Math::PI/180.0))
| [
"expression.operation.binary.remove"
] | 398,116 | 398,117 | u387173453 | ruby |
p02677 | a,b,h,m = gets.split.map(&:to_i)
rh = (h + m / 60.1) * 2 * Math::PI / 12
rm = m * 2 * Math::PI / 60
xa = a * Math.sin(rh)
xb = b * Math.sin(rm)
ya = a * Math.cos(rh)
yb = b * Math.cos(rm)
puts Math.sqrt((xa - xb)**2 + (ya - yb)**2)
| a,b,h,m = gets.split.map(&:to_i)
rh = (h + m / 60.0) * 2 * Math::PI / 12
rm = m * 2 * Math::PI / 60
xa = a * Math.sin(rh)
xb = b * Math.sin(rm)
ya = a * Math.cos(rh)
yb = b * Math.cos(rm)
puts Math.sqrt((xa - xb)**2 + (ya - yb)**2)
| [
"literal.number.float.change",
"assignment.value.change",
"expression.operation.binary.change"
] | 398,263 | 398,261 | u453682522 | ruby |
p02677 | a, b, h, m = gets.chomp.split(" ").map {|c| c.to_i}
h = h.to_f
m = m.to_f
theta = (30.0*h + (m/2.0) - 6.0*m).abs
p theta
if theta > 180.0
theta = 360.0 - theta
end
puts Math.sqrt(a**2 + b**2 \
- 2.0*a*b*Math.cos(Math::PI * theta / 180.0)) | a, b, h, m = gets.chomp.split(" ").map {|c| c.to_i}
h = h.to_f
m = m.to_f
theta = (30.0*h + (m/2.0) - 6.0*m).abs
if theta > 180.0
theta = 360.0 - theta
end
puts Math.sqrt(a**2 + b**2 \
- 2.0*a*b*Math.cos(Math::PI * theta / 180.0)) | [
"call.remove"
] | 398,454 | 398,455 | u644533034 | ruby |
p02677 | a, b, h, m = gets.chomp.split(" ").map {|c| c.to_i}
h = h.to_f
m = m.to_f
theta = (30.0*h + (m/2.0) - 6.0*m)
if theta > 180.0
theta -= 180.0
end
puts Math.sqrt(a**2 + b**2 \
- 2.0*a*b*Math.cos(Math::PI * theta / 180.0)) | a, b, h, m = gets.chomp.split(" ").map {|c| c.to_i}
h = h.to_f
m = m.to_f
theta = (30.0*h + (m/2.0) - 6.0*m).abs
if theta > 180.0
theta = 360.0 - theta
end
puts Math.sqrt(a**2 + b**2 \
- 2.0*a*b*Math.cos(Math::PI * theta / 180.0)) | [
"call.add"
] | 398,457 | 398,455 | u644533034 | ruby |
p02677 | A,B,H,M=gets.split.map(&:to_i)
p r_hour=(H*(360/12))+(M*0.5)
p r_minute=(M*(360/60))
p angle=[(r_hour-r_minute).abs,360-r_hour+r_minute,360-r_minute+r_hour].min
p Math.sqrt((A**2)+(B**2)-(2*A*B*(Math.cos(angle/180*Math::PI)))) | A,B,H,M=gets.split.map(&:to_i)
r_hour=(H*(360/12))+(M*0.5)
r_minute=(M*(360/60))
angle=[(r_hour-r_minute).abs,360-r_hour+r_minute,360-r_minute+r_hour].min
p Math.sqrt((A**2)+(B**2)-(2*A*B*(Math.cos(angle/180*Math::PI)))) | [
"io.output.change",
"call.remove"
] | 398,543 | 398,544 | u168915361 | ruby |
p02677 | def to_radian(degree)
degree * Math::PI / 180
end
a, b, h, m = gets.split.map(&:to_i)
l = 360 * (h * 60 + m) / 720
s = 360 * m / 60
d = l - s
puts Math.sqrt(a ** 2 + b ** 2 - 2 * a * b * Math.cos(to_radian(d)))
| def to_radian(degree)
degree * Math::PI / 180
end
a, b, h, m = gets.split.map(&:to_i)
l = 360.0 * (h * 60 + m) / 720
s = 360.0 * m / 60
d = l - s
puts Math.sqrt(a ** 2 + b ** 2 - 2 * a * b * Math.cos(to_radian(d)))
| [
"assignment.value.change",
"expression.operation.binary.change"
] | 398,833 | 398,834 | u889326464 | ruby |
p02677 | include Math
A, B, H, M = gets.chop.split.map(&:to_i)
hour = H + M/60.0
radi = hour*(11.0/6.0)
l = A**2 + B**2 -2*A*B(Math.cos(radi*PI))
puts sqrt(l) | include Math
A, B, H, M = gets.chop.split.map(&:to_i)
hour = H + M/60.0
radi = hour*(11.0/6.0)
l = A**2 + B**2 - 2*A*B*(Math.cos(radi*PI))
puts sqrt(l) | [
"call.arguments.change"
] | 399,162 | 399,163 | u663404111 | ruby |
p02677 | include Math
A,B,H,M = gets.chop.split.map(&:to_i)
hour = H + M/60.0
radi = hour*(11.0/6.0)
l = A**2 + B**2 -2*A*B(Math.cos(radi*PI))
puts sqrt(l) | include Math
A, B, H, M = gets.chop.split.map(&:to_i)
hour = H + M/60.0
radi = hour*(11.0/6.0)
l = A**2 + B**2 - 2*A*B*(Math.cos(radi*PI))
puts sqrt(l) | [
"call.arguments.change"
] | 399,164 | 399,163 | u663404111 | ruby |
p02677 | include'Math'
A,B,H,M = gets.chop.split.map(&:to_i)
hour = H + M/60.0
radi = hour*(11.0/6.0)
l = A**2 + B**2 -2*A*B(Math.cos(radi*PI))
puts sqrt(l) | include Math
A, B, H, M = gets.chop.split.map(&:to_i)
hour = H + M/60.0
radi = hour*(11.0/6.0)
l = A**2 + B**2 - 2*A*B*(Math.cos(radi*PI))
puts sqrt(l) | [
"call.arguments.change"
] | 399,165 | 399,163 | u663404111 | ruby |
p02677 | A, B, H, M = gets.chop.split.map(&:to_i)
total_m = 60 * H + M
a = total_m * 0.5
b = M * 6
x = 0
ans = nil
if a == b && a == 0
ans = (a - b).abs
elsif a - b == 0
ans = (a - b).abs
elsif (a - b).abs == 180
ans = a + b
else
if a > b
if a - b < 180
x = a - b
else
x = b + 360 - a
end
else
if b - a < 180
x = b - a
else
x = a + 360 - b
end
end
end
if ans
puts ans
else
puts Math.sqrt(A**2 + B**2 - 2 * A * B * Math.cos(x / 180.0 * Math::PI))
end
| A, B, H, M = gets.chop.split.map(&:to_i)
total_m = 60 * H + M
a = total_m * 0.5
b = M * 6
x = 0
ans = nil
if a == b && a == 0
ans = (A - B).abs
elsif a - b == 0
ans = (A - B).abs
elsif (a - b).abs == 180
ans = A + B
else
if a > b
if a - b < 180
x = a - b
else
x = b + 360 - a
end
else
if b - a < 180
x = b - a
else
x = a + 360 - b
end
end
end
if ans
puts ans
else
puts Math.sqrt(A**2 + B**2 - 2 * A * B * Math.cos(x / 180.0 * Math::PI))
end
| [
"assignment.value.change",
"expression.operation.binary.change"
] | 399,324 | 399,325 | u450617345 | ruby |
p02677 | a,b,h,m = gets.chomp.split(/ /).map {|i| i.to_i}
hrad = (h*30.0+m/2)*Math::PI/180.0
mrad = m*6.0*Math::PI/180.0
hx = Math.sin(hrad)*a
hy = Math.cos(hrad)*a
mx = Math.sin(mrad)*b
my = Math.cos(mrad)*b
d = Math.sqrt(((hx-mx)**2) + ((hy-my)**2))
puts d
| a,b,h,m = gets.chomp.split(/ /).map {|i| i.to_i}
hrad = (h*30.0+m/2.0)*Math::PI/180.0
mrad = m*6.0*Math::PI/180.0
hx = Math.sin(hrad)*a
hy = Math.cos(hrad)*a
mx = Math.sin(mrad)*b
my = Math.cos(mrad)*b
d = Math.sqrt(((hx-mx)**2) + ((hy-my)**2))
puts d
| [
"assignment.value.change",
"call.arguments.change",
"expression.operation.binary.change"
] | 399,343 | 399,344 | u345519530 | ruby |
p02677 | a,b,h,m = gets.split.map(&:to_i)
d = (h * 30 - m * 6).abs
s = [d, 360-d].min
puts Math.sqrt(a**2 + b**2 + (-2 * a * b * Math.cos(s * (Math::PI / 180)))) | a,b,h,m = gets.split.map(&:to_i)
d = (h * 30 + 0.5 * m - m * 6).abs
s = [d, 360-d].min
puts Math.sqrt(a**2 + b**2 + (-2 * a * b * Math.cos(s * (Math::PI / 180))))
| [
"assignment.change"
] | 399,560 | 399,561 | u173515518 | ruby |
p02677 | a, b, h, m = gets.split.map(&:to_f)
a_kakudo = 30.0 * h + 30.0 * (m/60.0)
b_kakudo = m
kakudo = (a_kakudo - b_kakudo).abs
kakudo = [kakudo, 360-kakudo].min
puts (a**2+b**2 - 2*a*b*Math.cos(kakudo/180.0 * Math::PI))**0.5 | a, b, h, m = gets.split.map(&:to_f)
a_kakudo = 30.0 * h + 30.0 * (m/60.0)
b_kakudo = 6.0*m
kakudo = (a_kakudo - b_kakudo).abs
kakudo = [kakudo, 360-kakudo].min
puts (a**2+b**2 - 2*a*b*Math.cos(kakudo/180.0 * Math::PI))**0.5 | [
"assignment.change"
] | 399,714 | 399,715 | u729246375 | ruby |
p02677 | a,b,h,m = gets.split.map &:to_f
rad = 2 * Math::PI * ((60 * h + m) / 720 - m / 60)
puts rad
puts Math.sqrt(a ** 2 + b ** 2 - 2 * a * b * Math.cos( rad ))
| a,b,h,m = gets.split.map &:to_f
rad = 2 * Math::PI * ((60 * h + m) / 720 - m / 60)
puts Math.sqrt(a ** 2 + b ** 2 - 2 * a * b * Math.cos( rad ))
| [
"call.remove"
] | 399,807 | 399,808 | u874414087 | ruby |
p02677 | include Math
a, b, h, m = gets.chomp.split.map(&:to_f)
hour = 2.0 * Math::PI * ( (h * 60.0 + m) / (12.0 * 60.0) )
min = 2.0 * Math::PI * ( m / 60.0 )
p hx = a * Math.cos(hour)
p hy = a * Math.sin(hour)
p mx = b * Math.cos(min)
p my = b * Math.sin(min)
puts Math.sqrt((hx - mx) ** 2 + (hy - my) ** 2)
| include Math
a, b, h, m = gets.chomp.split.map(&:to_f)
hour = 2.0 * Math::PI * ( (h * 60.0 + m) / (12.0 * 60.0) )
min = 2.0 * Math::PI * ( m / 60.0 )
hx = a * Math.cos(hour)
hy = a * Math.sin(hour)
mx = b * Math.cos(min)
my = b * Math.sin(min)
puts Math.sqrt((hx - mx) ** 2 + (hy - my) ** 2)
| [
"io.output.change",
"call.remove"
] | 399,846 | 399,847 | u946334556 | ruby |
p02677 | a, b, h, m = gets.split.map(&:to_i)
x = (60 * h + m).fdiv(60 * 12) * 360
y = m.fdiv(60) * 360
p [x, y]
puts Math.sqrt(a ** 2 + b ** 2 - 2 * a * b * Math.cos((x - y) / 180 * Math::PI)) | a, b, h, m = gets.split.map(&:to_i)
x = (60 * h + m).fdiv(60 * 12) * 360
y = m.fdiv(60) * 360
puts Math.sqrt(a ** 2 + b ** 2 - 2 * a * b * Math.cos((x - y) / 180 * Math::PI)) | [
"call.remove"
] | 399,944 | 399,945 | u692254521 | ruby |
p02678 | N,M = gets.split.map &:to_i
AB = M.times.map{ gets.split.map &:to_i}
Map = Array.new(M+1).map{[]}
AB.each do |a,b|
Map[a] << b
Map[b] << a
end
ans = [nil]*(N+1)
qry = Map[1].map{|i| [i,1]}
while q = qry.shift
to,from = q
next if ans[to]
ans[to] = from
Map[to].each{|i| qry << [i,to]}
end
if ans[2..-1].compact.size == N-1 then
puts "Yes"
puts ans[2..-1]
else
puts "No"
end | N,M = gets.split.map &:to_i
AB = M.times.map{ gets.split.map &:to_i}
Map = Array.new(N+1).map{[]}
AB.each do |a,b|
Map[a] << b
Map[b] << a
end
ans = [nil]*(N+1)
qry = Map[1].map{|i| [i,1]}
while q = qry.shift
to,from = q
next if ans[to]
ans[to] = from
Map[to].each{|i| qry << [i,to]}
end
if ans[2..-1].compact.size == N-1 then
puts "Yes"
puts ans[2..-1]
else
puts "No"
end | [
"assignment.value.change",
"call.arguments.change",
"expression.operation.binary.change"
] | 400,341 | 400,342 | u009976559 | ruby |
p02678 | N,M=gets.split.map(&:to_i)
G=Array.new(N+1){[]}
M.times do
a,b=gets.split.map(&:to_i)
G[a]<<b
G[b]<<a
end
post=[]
q=[[0,1]]
until q.empty?
pre,cur=q.shift
p cur
next if post[cur]
post[cur]=pre
G[cur].each do |nex|
q<<[cur,nex] unless post[nex]
end
end
puts :Yes
puts post[2..-1]
| N,M=gets.split.map(&:to_i)
G=Array.new(N+1){[]}
M.times do
a,b=gets.split.map(&:to_i)
G[a]<<b
G[b]<<a
end
post=[]
q=[[0,1]]
until q.empty?
pre,cur=q.shift
next if post[cur]
post[cur]=pre
G[cur].each do |nex|
q<<[cur,nex] unless post[nex]
end
end
puts :Yes
puts post[2..-1]
| [
"call.remove"
] | 400,710 | 400,711 | u647875062 | ruby |
p02678 | n, m = gets.split.map(&:to_i)
graph = Hash.new { |h, k| h[k] = [] }
m.times do
a, b = gets.split.map(&:to_i)
graph[a].push(b)
graph[b].push(a)
end
dist = Array.new(n + 1, -1)
dist[1] = 0
que = []
que.push(1)
ans = Array.new(n + 1, -1)
until que.empty?
v = que.shift
graph[v].each do |nv|
next if dist[nv] != -1
dist[nv] = dist[v] + 1
ans[nv] = v
que.push(nv)
end
end
puts "Yes"
puts dist[2..-1]
| n, m = gets.split.map(&:to_i)
graph = Hash.new { |h, k| h[k] = [] }
m.times do
a, b = gets.split.map(&:to_i)
graph[a].push(b)
graph[b].push(a)
end
dist = Array.new(n + 1, -1)
dist[1] = 0
que = []
que.push(1)
ans = Array.new(n + 1, -1)
until que.empty?
v = que.shift
graph[v].each do |nv|
next if dist[nv] != -1
dist[nv] = dist[v] + 1
ans[nv] = v
que.push(nv)
end
end
puts "Yes"
puts ans[2..-1]
| [
"identifier.change",
"call.arguments.change"
] | 401,303 | 401,304 | u889326464 | ruby |
p02678 | def solve(dpt, cur, nxt)
ser = Array.new(0)
flag = 0
nxt.each do |nx|
@ans[nx[0]] = nx[1]
@pt[nx[0]].each do |thr|
if @dps[thr] == 0
flag = 1
@dps[thr] = dpt+1
ser.push([thr,nx[0]])
end
end
end
solve(dpt+1, nxt, thr) if flag == 1
end
n,m = gets.split.map(&:to_i)
a,b = m.times.map{gets.split.map(&:to_i)}.transpose
@pt = Array.new(n+1).map{Array.new(0)}
for i in 0..(m-1)
@pt[a[i]].push(b[i])
@pt[b[i]].push(a[i])
end
@dps = Array.new(n+1,0)
@ans = Array.new(n+1,0)
@dps[1] = 1
nxtid = Array.new(0)
@pt[1].each do |nxt|
nxtid.push([nxt,1])
@dps[nxt] = 2
end
solve(1, [1], nxtid)
puts "Yes"
for i in 2..n
puts @ans[i]
end | def solve(dpt, cur, nxt)
ser = Array.new(0)
flag = 0
nxt.each do |nx|
@ans[nx[0]] = nx[1]
@pt[nx[0]].each do |thr|
if @dps[thr] == 0
flag = 1
@dps[thr] = dpt+1
ser.push([thr,nx[0]])
end
end
end
solve(dpt+1, nxt, ser) if flag == 1
end
n,m = gets.split.map(&:to_i)
a,b = m.times.map{gets.split.map(&:to_i)}.transpose
@pt = Array.new(n+1).map{Array.new(0)}
for i in 0..(m-1)
@pt[a[i]].push(b[i])
@pt[b[i]].push(a[i])
end
@dps = Array.new(n+1,0)
@ans = Array.new(n+1,0)
@dps[1] = 1
nxtid = Array.new(0)
@pt[1].each do |nxt|
nxtid.push([nxt,1])
@dps[nxt] = 2
end
solve(1, [1], nxtid)
puts "Yes"
for i in 2..n
puts @ans[i]
end | [
"identifier.change",
"call.arguments.change"
] | 401,342 | 401,343 | u326891688 | ruby |
p02678 | require 'set'
n, m = gets.split.map(&:to_i)
link = Array.new(n+1) { [] }
prev = [nil, 'Yes']
visited = Set.new([1])
m.times do
a, b = gets.split.map(&:to_i)
link[a] << b
link[b] << a
end
q = [1]
unless q.empty?
c = q.shift
link[c].each do |l|
next if visited.include?(l)
prev[l] = c
visited.add(l)
q << l
end
end
if visited.size != n
puts 'No'
exit 0
end
prev[1..n].each do |t|
puts t
end | require 'set'
n, m = gets.split.map(&:to_i)
link = Array.new(n+1) { [] }
prev = [nil, 'Yes']
visited = Set.new([1])
m.times do
a, b = gets.split.map(&:to_i)
link[a] << b
link[b] << a
end
q = [1]
until q.empty?
c = q.shift
link[c].each do |l|
next if visited.include?(l)
prev[l] = c
visited.add(l)
q << l
end
end
if prev.compact.size != n
puts 'No'
exit 0
end
prev[1..n].each do |t|
puts t
end | [
"identifier.change",
"control_flow.branch.if.condition.change",
"call.add"
] | 401,368 | 401,369 | u604352408 | ruby |
p02678 | n, m = gets.split.map(&:to_i)
edges = Array.new(n) { Array.new }
m.times do
a, b = gets.split.map(&:to_i).map(&:pred)
edges[a] << b
edges[b] << a
end
# [current]
queue = [0]
ans = Array.new(n)
until queue.empty?
current = queue.shift
puts current
edges[current].each do |to|
next if to == 0
unless ans[to]
ans[to] = current
queue << to
end
end
end
ans.shift
puts "Yes"
ans.each { |n| puts n + 1 }
| n, m = gets.split.map(&:to_i)
edges = Array.new(n) { Array.new }
m.times do
a, b = gets.split.map(&:to_i).map(&:pred)
edges[a] << b
edges[b] << a
end
# [current]
queue = [0]
ans = Array.new(n)
until queue.empty?
current = queue.shift
edges[current].each do |to|
next if to == 0
unless ans[to]
ans[to] = current
queue << to
end
end
end
ans.shift
puts "Yes"
ans.each { |n| puts n + 1 }
| [
"call.remove"
] | 401,457 | 401,458 | u653737129 | ruby |
p02678 | n,m = gets.split.map(&:to_i)
marks = Array.new(n)
links = []
m.times do
a,b = gets.split.map(&:to_i)
(links[a] ||= []) << b
(links[b] ||= []) << a
end
visit = [1]
marks[0] = 0
while !visit.empty?
next_visit = []
visit.each do |i|
links[i].each do |j|
unless marks[j-1]
marks[j-1] = i
next_visit << j
end
end
end
unless marks.any?(nil)
puts "yes"
puts marks[1..].join("\n")
return
end
visit = next_visit
end
puts "no"
| n,m = gets.split.map(&:to_i)
marks = Array.new(n)
links = []
m.times do
a,b = gets.split.map(&:to_i)
(links[a] ||= []) << b
(links[b] ||= []) << a
end
visit = [1]
marks[0] = 0
while !visit.empty?
next_visit = []
visit.each do |i|
links[i].each do |j|
unless marks[j-1]
marks[j-1] = i
next_visit << j
end
end
end
unless marks.any?(nil)
puts "Yes"
puts marks[1..].join("\n")
return
end
visit = next_visit
end
puts "No"
| [
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 401,542 | 401,543 | u453682522 | ruby |
p02678 | # frozen_string_literal: true
n, m = gets.split.map(&:to_i)
ab = m.times.map { gets.split.map(&:to_i) }
h = Array.new(n) { [] }
c = Array.new(n) { -1 }
d = Array.new(n) { 10**12 }
d[0] = 0
ab.each do |e|
a = e[0] - 1
b = e[1] - 1
h[a].push b if b.positive?
h[b].push a if a.positive?
end
q = [0]
loop do
break if q.empty?
dd = q.pop
h[dd].each do |e|
if d[e] - 1 > d[dd]
c[e] = dd + 1
d[e] = d[dd] + 1
q.push e
end
end
end
if c[1..-1].all? { |e| e.positive? }
puts 'Yes'
puts c[1..-1]
else
puts 'No'
end
| # frozen_string_literal: true
n, m = gets.split.map(&:to_i)
ab = m.times.map { gets.split.map(&:to_i) }
h = Array.new(n) { [] }
c = Array.new(n) { -1 }
d = Array.new(n) { 10**12 }
d[0] = 0
ab.each do |e|
a = e[0] - 1
b = e[1] - 1
h[a].push b if b.positive?
h[b].push a if a.positive?
end
q = [0]
loop do
break if q.empty?
dd = q.shift
h[dd].each do |e|
if d[e] - 1 > d[dd]
c[e] = dd + 1
d[e] = d[dd] + 1
q.push e
end
end
end
if c[1..-1].all? { |e| e.positive? }
puts 'Yes'
puts c[1..-1]
else
puts 'No'
end
| [
"assignment.value.change",
"identifier.change"
] | 401,551 | 401,552 | u434509016 | ruby |
p02678 | require 'pp'
n, m = gets.split.map(&:to_i)
pathes = Array.new(m)
graph = {}
m.times do |i|
a, b = gets.split.map(&:to_i)
pathes[i] = [a, b]
graph[a] ||= {}
graph[b] ||= {}
graph[a][b] = 1
graph[b][a] = 1
end
visited = Array.new(n + 1, -1)
visited[1] = 0
queue = graph[1].map {|k, _| visited[k] = 1; [k, 1] }
while queue.empty?.!
x, d = queue.shift
graph[x].each do |k, _|
next if visited[k] != -1
visited[k] = x
queue.push([k, d + 1])
end
end
2.upto(n) do |i|
puts visited[i]
end
| require 'pp'
n, m = gets.split.map(&:to_i)
pathes = Array.new(m)
graph = {}
m.times do |i|
a, b = gets.split.map(&:to_i)
pathes[i] = [a, b]
graph[a] ||= {}
graph[b] ||= {}
graph[a][b] = 1
graph[b][a] = 1
end
visited = Array.new(n + 1, -1)
visited[1] = 0
queue = graph[1].map {|k, _| visited[k] = 1; [k, 1] }
while queue.empty?.!
x, d = queue.shift
graph[x].each do |k, _|
next if visited[k] != -1
visited[k] = x
queue.push([k, d + 1])
end
end
puts "Yes"
2.upto(n) do |i|
puts visited[i]
end
| [
"call.add"
] | 401,755 | 401,756 | u754375546 | ruby |
p02678 | n,m = gets.split.map(&:to_i)
g = Array.new(n+1){[]}
m.times do
f,t = gets.split.map(&:to_i)
g[f].push t
g[t].push f
end
ans = Array.new(n+1)
ans[0] = ans[1] = 0
queue = []
queue.push [1, g[1]]
while !queue.empty? do
from, nexts = queue.shift
nexts.each do |nex|
next if ans[nex]
ans[nex] = from
queue.push [nex, g[nex]]
end
end
if ans.include?(nil)
puts 'No'
else
2.upto(n).each do |i|
puts ans[i]
end
end
| n,m = gets.split.map(&:to_i)
g = Array.new(n+1){[]}
m.times do
f,t = gets.split.map(&:to_i)
g[f].push t
g[t].push f
end
ans = Array.new(n+1)
ans[0] = ans[1] = 0
queue = []
queue.push [1, g[1]]
while !queue.empty? do
from, nexts = queue.shift
nexts.each do |nex|
next if ans[nex]
ans[nex] = from
queue.push [nex, g[nex]]
end
end
if ans.include?(nil)
puts 'No'
else
puts 'Yes'
2.upto(n).each do |i|
puts ans[i]
end
end | [
"call.add"
] | 401,787 | 401,788 | u173515518 | ruby |
p02678 | # abc168 D
n, m = gets.split.map(&:to_i)
ab = m.times.map {
gets.split.map(&:to_i).map{|x|x-1}
}
nodes = Array.new(n){ [] }
ab.each do |(a,b)|
nodes[a] << b
nodes[b] << a
end
lens = Array.new(n, 0)
# pp nodes
sirube = Array.new(n, nil)
stack = [ 0 ] # index, len
until stack.empty?
s = stack.pop
nodes[s].size.times do |ind|
tonari_ind = nodes[s][ind]
if sirube[tonari_ind].nil?
sirube[tonari_ind] = s
stack << tonari_ind
end
end
end
# p sirube
if sirube[1..-1].any? {|x|x.nil?}
puts 'No'
else
puts 'Yes'
puts sirube[1..-1].map{|x|x+1}.join("\n")
end
| # abc168 D
n, m = gets.split.map(&:to_i)
ab = m.times.map {
gets.split.map(&:to_i).map{|x|x-1}
}
nodes = Array.new(n){ [] }
ab.each do |(a,b)|
nodes[a] << b
nodes[b] << a
end
lens = Array.new(n, 0)
# pp nodes
sirube = Array.new(n, nil)
stack = [ 0 ] # index, len
until stack.empty?
s = stack.shift
nodes[s].size.times do |ind|
tonari_ind = nodes[s][ind]
if sirube[tonari_ind].nil?
sirube[tonari_ind] = s
stack << tonari_ind
end
end
end
# p sirube
if sirube[1..-1].any? {|x|x.nil?}
puts 'No'
else
puts 'Yes'
puts sirube[1..-1].map{|x|x+1}.join("\n")
end
| [
"assignment.value.change",
"identifier.change"
] | 401,881 | 401,882 | u315597999 | ruby |
p02679 | require 'set'
def get_ints
gets.split.map(&:to_i)
end
def get_int
gets.chomp.to_i
end
MOD = 1000000007
params = []
N = get_int
premise = Hash.new(0)
additional = 0
result = 1
N.times do
a, b = get_ints
if a == 0 && b == 0
additional += 1
elsif a == 0
premise[[0, 1]] += 1
elsif b == 0
premise[[1, 0]] += 1
else
gcd = a.gcd(b)
a /= gcd
b /= gcd
if a < 0
a *= -1
b *= -1
end
premise[[a, b]] += 1
end
end
premise.each do |(a, b), count|
pair = b < 0 ? [-b, a] : [b, -a]
pair_count = premise[pair]
premise.delete(pair)
result *= (2 ** count - 1) + (2 ** pair_count - 1) + 1
result %= MOD
end
puts (result + additional - 1) % MOD
| require 'set'
def get_ints
gets.split.map(&:to_i)
end
def get_int
gets.chomp.to_i
end
MOD = 1000000007
params = []
N = get_int
premise = Hash.new(0)
additional = 0
result = 1
N.times do
a, b = get_ints
if a == 0 && b == 0
additional += 1
elsif a == 0
premise[[0, -1]] += 1
elsif b == 0
premise[[1, 0]] += 1
else
gcd = a.gcd(b)
a /= gcd
b /= gcd
if a < 0
a *= -1
b *= -1
end
premise[[a, b]] += 1
end
end
premise.each do |(a, b), count|
pair = b < 0 ? [-b, a] : [b, -a]
pair_count = premise[pair]
premise.delete(pair)
result *= (2 ** count - 1) + (2 ** pair_count - 1) + 1
result %= MOD
end
puts (result + additional - 1) % MOD
| [
"expression.operation.unary.add"
] | 402,183 | 402,184 | u305883349 | ruby |
p02679 | n = gets.to_i
@n = n
a = Array.new n
b = Array.new n
c = {}
zerozero = 0
MOD = 1000000007
n.times do |i|
_a, _b = gets.split.map(&:to_i)
a[i] = _a
b[i] = _b
if _a == 0 && _b == 0
zerozero += 1
elsif _a == 0
c[[0,1]] ||= 0
c[[0,1]] += 1
elsif _b == 0
c[[1,0]] ||= 0
c[[1,0]] += 1
else
if _a < 0
_a = - _a
_b = - _b
end
gcd = _a.gcd(_b)
_a /= gcd
_b /= gcd
c[[_a,_b]] ||= 0
c[[_a,_b]] += 1
end
end
result = 1
c.each do |(_a, _b), count|
if _b < 0
_a = - _a
_b = - _b
end
if pair_count = c[[_b,- _a]]
c.delete([_b,-_a])
result *= (2**count - 1) + (2**pair_count -1) + 1
else
result *= (2**count)
end
result %= MOD
end
result += zerozero
result -= 1 # δ½γιΈγ°γͺγζ
result %= MOD
puts result | n = gets.to_i
@n = n
a = Array.new n
b = Array.new n
c = {}
zerozero = 0
MOD = 1000000007
n.times do |i|
_a, _b = gets.split.map(&:to_i)
a[i] = _a
b[i] = _b
if _a == 0 && _b == 0
zerozero += 1
elsif _a == 0
c[[0,-1]] ||= 0
c[[0,-1]] += 1
elsif _b == 0
c[[1,0]] ||= 0
c[[1,0]] += 1
else
if _a < 0
_a = - _a
_b = - _b
end
gcd = _a.gcd(_b)
_a /= gcd
_b /= gcd
c[[_a,_b]] ||= 0
c[[_a,_b]] += 1
end
end
result = 1
c.each do |(_a, _b), count|
if _b < 0
_a = - _a
_b = - _b
end
if pair_count = c[[_b,- _a]]
c.delete([_b,-_a])
result *= (2**count - 1) + (2**pair_count -1) + 1
else
result *= (2**count)
end
result %= MOD
end
result += zerozero
result -= 1 # δ½γιΈγ°γͺγζ
result %= MOD
puts result | [
"expression.operation.unary.add"
] | 402,228 | 402,229 | u299761130 | ruby |
p02679 | MODC = 1000000007
n = gets.strip.to_i
z = 0
st = Hash.new{|hash, key| hash[key] = [0,0]}
n.times do
a,b = gets.strip.split.map(&:to_i)
if b == 0
if a == 0
z += 1
else
st[0][1] += 1
end
else
rr = Rational(a,b)
if rr >= 0 then st[rr][0] += 1
else st[-1/rr][1] += 1
end
end
end
ans = 1
st.each do |key, val|
ans *= 2.pow(val[0], MODC) + 2.pow(val[1], MODC) - 1
ans %= MODC
end
ans += z - 1
ans %= MODC
p ans | MODC = 1000000007
n = gets.strip.to_i
z = 0
st = Hash.new{|hash, key| hash[key] = [0,0]}
n.times do
a,b = gets.strip.split.map(&:to_i)
if b == 0
if a == 0
z += 1
else
st[0r][1] += 1
end
else
rr = Rational(a,b)
if rr >= 0 then st[rr][0] += 1
else st[-1/rr][1] += 1
end
end
end
ans = 1
st.each do |key, val|
ans *= 2.pow(val[0], MODC) + 2.pow(val[1], MODC) - 1
ans %= MODC
end
ans += z - 1
ans %= MODC
p ans
| [] | 402,318 | 402,319 | u188673878 | ruby |
p02679 | # frozen_string_literal: true
n = gets.to_i
ab = n.times.map { gets.split.map(&:to_i) }
MOD = 1_000_000_007
h = Hash.new { 0 }
done = Hash.new { false }
ab.each do |e|
a = e[0]
b = e[1]
c = []
if b.zero?
c = if a.zero?
[0, 0]
else
[-1, 0]
end
else
t = Rational(a, b)
c = [t.numerator, t.denominator]
end
h[c] += 1
end
mul = 1
mul2 = 0
count = 0
h.each do |k, v|
if k == [0, 0]
mul2 = v % MOD
else
kk = if k[0].negative?
[k[1], -k[0]]
else
[-k[1], k[0]]
end
if h[kk].positive? && !done[k] && !done[kk]
mul *= (2**v + 2**h[kk] - 1)
mul %= MOD
done[k] = true
done[kk] = true
else
count += 1 unless done[k]
end
end
end
puts (mul2 + (mul * 2**count) - 1) % MOD
| # frozen_string_literal: true
n = gets.to_i
ab = n.times.map { gets.split.map(&:to_i) }
MOD = 1_000_000_007
h = Hash.new { 0 }
done = Hash.new { false }
ab.each do |e|
a = e[0]
b = e[1]
c = []
if b.zero?
c = if a.zero?
[0, 0]
else
[-1, 0]
end
else
t = Rational(a, b)
c = [t.numerator, t.denominator]
end
h[c] += 1
end
mul = 1
mul2 = 0
count = 0
h.each do |k, v|
if k == [0, 0]
mul2 = v % MOD
else
kk = if k[0].negative?
[k[1], -k[0]]
else
[-k[1], k[0]]
end
if h[kk].positive? && !done[k] && !done[kk]
mul *= (2**v + 2**h[kk] - 1)
mul %= MOD
done[k] = true
done[kk] = true
else
count += v unless done[k]
end
end
end
puts((mul2 + (mul * 2**count) - 1) % MOD)
| [
"identifier.replace.add",
"literal.replace.remove",
"call.arguments.change"
] | 402,531 | 402,532 | u434509016 | ruby |
p02679 | # Consider sardines as vectors in 2D plane,
# and grouping them by their tangent(B[i] / A[i]).
Mod = 1000000007
N = gets.to_i
zs = 0 # count of zero vectors
X = []
Y = []
(0...N).each{
a,b = gets.split.map &:to_i
if a == 0 && b == 0
zs += 1; next
end
# limitate arg into [0,pi)
if b < 0
a = -a; b = -b;
end
if b == 0 && a < 0
a = -a
end
if a > 0
# arg in [0,pi/2)
g = b > 0 ? a.gcd(b) : 1
a /= g; b /= g
X << b.to_r / a
else
# arg in [pi/2,pi)
# -> rotate -pi/2
a,b = b,-a
g = b > 0 ? a.gcd(b) : 1
a /= g; b /= g
Y << b.to_r / a
end
}
xh = {} # count of finite-positive tangents
yh = {} # count of infinite or negative tangents
args = {} # all tangents
X.each{ |arg| args[arg] = 1; xh[arg] = (xh[arg] || 0) + 1 }
Y.each{ |arg| args[arg] = 1; yh[arg] = (yh[arg] || 0) + 1 }
bins = [1] # bins[i] = 2^i
(N+1).times{ bins << ((bins[-1] * 2) % Maod) }
ans = args.keys.reduce(1){ |s,arg|
x = xh[arg] || 0
y = yh[arg] || 0
s = s * (bins[x] + bins[y] - 1)
s % Mod
} + zs - 1
p ans % Mod
| # Consider sardines as vectors in 2D plane,
# and grouping them by their tangent(B[i] / A[i]).
Mod = 1000000007
N = gets.to_i
zs = 0 # count of zero vectors
X = []
Y = []
(0...N).each{
a,b = gets.split.map &:to_i
if a == 0 && b == 0
zs += 1; next
end
# limitate arg into [0,pi)
if b < 0
a = -a; b = -b;
end
if b == 0 && a < 0
a = -a
end
if a > 0
# arg in [0,pi/2)
g = b > 0 ? a.gcd(b) : 1
a /= g; b /= g
X << b.to_r / a
else
# arg in [pi/2,pi)
# -> rotate -pi/2
a,b = b,-a
g = b > 0 ? a.gcd(b) : 1
a /= g; b /= g
Y << b.to_r / a
end
}
xh = {} # count of finite-positive tangents
yh = {} # count of infinite or negative tangents
args = {} # all tangents
X.each{ |arg| args[arg] = 1; xh[arg] = (xh[arg] || 0) + 1 }
Y.each{ |arg| args[arg] = 1; yh[arg] = (yh[arg] || 0) + 1 }
bins = [1] # bins[i] = 2^i
(N+1).times{ bins << ((bins[-1] * 2) % Mod) }
ans = args.keys.reduce(1){ |s,arg|
x = xh[arg] || 0
y = yh[arg] || 0
s = s * (bins[x] + bins[y] - 1)
s % Mod
} + zs - 1
p ans % Mod
| [
"expression.operation.binary.change"
] | 403,015 | 403,016 | u670503797 | ruby |
p02679 | require 'set'; require 'prime'; require 'pp'
INF=Float::INFINITY; MOD=10**9+7
n = gets.chomp.to_i
h = Hash.new(0)
mu = 0
n.times do
a,b = gets.chomp.split.map(&:to_i)
if a == 0 && b == 0
mu += 1
elsif a == 0
h[[0,1]] += 1
elsif b == 0
h[[1,0]] += 1
else
r = Rational(a,b)
num = r.numerator
den = r.denominator
h[[num,den]] += 1
end
end
# p h
pairs = []
h.each do |k, v|
num, den = k
next if den == 0
if num == 0
key = [1,0]
if h.has_key? key
pairs.push [v, h[key]]
end
next
end
next if num != den && num.abs <= den
key = num < 0 ? [den, -num] : [-den, num]
if h.has_key? key
# p [[num,den], key]
pairs.push [v, h[key]]
end
end
remaining = n - mu - pairs.map(&:sum).sum
# p '--'
ans = 1
pairs.each do |x,y|
xx = (1 << x) % MOD
yy = (1 << y) % MOD
tmp = xx + yy - 1
ans = ans * tmp % MOD
end
ans = ans * (1 << remaining) - 1 % MOD
ans = (ans + MOD) % MOD
puts ans
| require 'set'; require 'prime'; require 'pp'
INF=Float::INFINITY; MOD=10**9+7
n = gets.chomp.to_i
h = Hash.new(0)
mu = 0
n.times do
a,b = gets.chomp.split.map(&:to_i)
if a == 0 && b == 0
mu += 1
elsif a == 0
h[[0,1]] += 1
elsif b == 0
h[[1,0]] += 1
else
r = Rational(a,b)
num = r.numerator
den = r.denominator
h[[num,den]] += 1
end
end
# p h
pairs = []
h.each do |k, v|
num, den = k
next if den == 0
if num == 0
key = [1,0]
if h.has_key? key
pairs.push [v, h[key]]
end
next
end
next if num != den && num.abs <= den
key = num < 0 ? [den, -num] : [-den, num]
if h.has_key? key
# p [[num,den], key]
pairs.push [v, h[key]]
end
end
remaining = n - mu - pairs.map(&:sum).sum
# p '--'
# p pairs
# p remaining
ans = 1
pairs.each do |x,y|
xx = (1 << x) % MOD
yy = (1 << y) % MOD
tmp = xx + yy - 1
ans = ans * tmp % MOD
end
ans = ans * (1 << remaining) - 1 % MOD
ans += mu
ans = (ans + MOD) % MOD
puts ans
| [] | 403,118 | 403,119 | u524019694 | ruby |
p02681 | s = gets.chomp.split("").map(&:to_s)
t = gets.split("").map(&:to_s)
if s.join + t[-1] == t.join
puts "Yes"
else
puts "No"
end | s = gets.chomp.split("").map(&:to_s)
t = gets.chomp.split("").map(&:to_s)
if s.join + t[-1] == t.join
puts "Yes"
else
puts "No"
end | [
"call.add"
] | 403,269 | 403,270 | u575740023 | ruby |
p02681 | a = gets.chomp
b = gets.chomp
b.chop == a ? 'Yes' : 'No' | a = gets.chomp
b = gets.chomp
puts b.chop == a ? 'Yes' : 'No'
| [
"io.output.change",
"call.add"
] | 403,382 | 403,383 | u299289108 | ruby |
p02681 | a = gets.chomp
b = gets.chomp
if b.include?(a) && b.length == a.length + 1
puts 'Yes'
else
puts 'No'
end
| a = gets.chomp
b = gets.chomp
if b.chop == a && b.length == a.length + 1
puts 'Yes'
else
puts 'No'
end
| [
"control_flow.branch.if.condition.change"
] | 403,384 | 403,385 | u299289108 | ruby |
p02681 | a = gets.chomp
b = gets.chomp
if b.include?(a) && b.length = a.length + 1
puts 'Yes'
else
puts 'No'
end | a = gets.chomp
b = gets.chomp
if b.chop == a && b.length == a.length + 1
puts 'Yes'
else
puts 'No'
end
| [
"control_flow.branch.if.condition.change",
"expression.operation.compare.replace.add",
"assignment.replace.remove",
"misc.typo"
] | 403,386 | 403,385 | u299289108 | ruby |
p02681 | s, t = 2.times.map{gets.chomp}
print t.include?(s) ? "Yes" : "No" | s, t = 2.times.map{gets.chomp}
print t.chop == s ? "Yes" : "No" | [
"control_flow.branch.if.condition.change"
] | 403,822 | 403,823 | u011809316 | ruby |
p02681 | s, t = 2.times.map{gets.chomp}
print t.include?(t) ? "Yes" : "No" | s, t = 2.times.map{gets.chomp}
print t.chop == s ? "Yes" : "No" | [
"control_flow.branch.if.condition.change"
] | 403,824 | 403,823 | u011809316 | ruby |
p02681 | s = gets.chomp
t = gets.chomp
if s == t[0,-2]
puts "Yes"
else
puts "No"
end | s = gets.chomp
t = gets.chomp
if s == t[0..-2]
puts "Yes"
else
puts "No"
end | [
"variable_access.subscript.index.change",
"control_flow.branch.if.condition.change"
] | 404,059 | 404,060 | u354325208 | ruby |
p02681 | s = gets.chomp.to_s
t = gets.chomo.to_s
d = t.chop!
if s == d
puts "Yes"
else
puts "No"
end
| s = gets.chomp.to_s
t = gets.chomp.to_s
d = t.chop!
if s == d
puts "Yes"
else
puts "No"
end
| [
"assignment.value.change",
"identifier.change"
] | 404,081 | 404,082 | u252059917 | ruby |
p02681 | s = gets
t = gets
if s == t.chop
puts "Yes"
else
puts "No"
end
| s = gets.strip
t = gets.strip
if s == t.chop
puts "Yes"
else
puts "No"
end
| [
"call.add"
] | 404,366 | 404,367 | u188673878 | ruby |
p02681 | s = gets.chomp
t = gets.chop
if(s == t)
puts 'Yes'
else
puts 'No'
end | s = gets.chomp
t = gets.chomp.chop
if(s == t)
puts 'Yes'
else
puts 'No'
end | [
"call.add"
] | 404,782 | 404,783 | u510200974 | ruby |
p02681 | s = gets
t = gets.chop
if(s == t)
puts 'Yes'
else
puts 'No'
end | s = gets.chomp
t = gets.chomp.chop
if(s == t)
puts 'Yes'
else
puts 'No'
end | [
"call.add"
] | 404,784 | 404,783 | u510200974 | ruby |
p02681 | s = gets.chomp
t = gets.chomp
puts s == t[0, t.size - 2] ? "Yes" : "No" | s = gets.chomp
t = gets.chomp
puts s == t[0, t.size - 1] ? "Yes" : "No" | [
"literal.number.integer.change",
"variable_access.subscript.index.change",
"control_flow.branch.if.condition.change"
] | 404,787 | 404,788 | u392423112 | ruby |
p02681 | n = gets.chomp.split("")
a = gets.chomp.split("")
b = n.size
count = 0
(0..b-1).each do |i|
if n[i] == a[i]
conunt += 1
end
end
if b == count
puts "Yes"
else
puts "No"
end
| n = gets.chomp.split("")
a = gets.chomp.split("")
b = n.size
count = 0
(0..b-1).each do |i|
if n[i] == a[i]
count += 1
end
end
if b == count
puts "Yes"
else
puts "No"
end
| [
"identifier.change"
] | 404,902 | 404,903 | u412789323 | ruby |
p02681 | n = gets.chomp.split("")
a = gets.chomp.split("")
b = n.size
count = 0
(0..n-1).each do |i|
if n[i] == a[i]
conunt += 1
end
end
if b == count
puts "Yes"
else
puts "No"
end
| n = gets.chomp.split("")
a = gets.chomp.split("")
b = n.size
count = 0
(0..b-1).each do |i|
if n[i] == a[i]
count += 1
end
end
if b == count
puts "Yes"
else
puts "No"
end
| [
"identifier.change",
"expression.operation.binary.change"
] | 404,904 | 404,903 | u412789323 | ruby |
p02681 | n = gets.chomp.split(" ")
a = gets.chomp.split(" ")
b = n.size
count = 0
(0..n-1).each do |i|
if n[i] == a[i]
conunt += 1
end
end
if b == count
puts "Yes"
else
puts "No"
end | n = gets.chomp.split("")
a = gets.chomp.split("")
b = n.size
count = 0
(0..b-1).each do |i|
if n[i] == a[i]
count += 1
end
end
if b == count
puts "Yes"
else
puts "No"
end
| [
"literal.string.change",
"assignment.value.change",
"call.arguments.change",
"identifier.change",
"expression.operation.binary.change"
] | 404,905 | 404,903 | u412789323 | ruby |
p02681 | io = STDIN
str1=io.gets.chomp
str2=io.gets.chomp
if str1==str2[0..-2]
puts 'Yes'
else
puts 'N'
end
| io = STDIN
str1=io.gets.chomp
str2=io.gets.chomp
if str1==str2[0..-2]
puts 'Yes'
else
puts 'No'
end
| [
"literal.string.change",
"call.arguments.change"
] | 405,392 | 405,393 | u132360211 | ruby |
p02681 | s = gets.chpmp.split("")
t = gets.chpmp.split("")
flag = 1
for i in 0..(s.length-1)
if s[i] != t[i]
flag = 0
break
end
end
(flag == 1) ? (puts "Yes"):(puts "No") | s = gets.chomp.split("")
t = gets.chomp.split("")
flag = 1
for i in 0..(s.length-1)
if s[i] != t[i]
flag = 0
break
end
end
(flag == 1) ? (puts "Yes"):(puts "No") | [
"assignment.value.change",
"identifier.change"
] | 405,739 | 405,740 | u326891688 | ruby |
p02681 | S=gets.chop
T=gets.chop
if(S==T.chop)
print('Yes\n')
else
print('No\n')
end
| S=gets.chop
T=gets.chop
if(S==T.chop)
print("Yes\n")
else
print("No\n")
end
| [
"literal.string.change",
"call.arguments.change"
] | 405,776 | 405,777 | u628268449 | ruby |
p02681 | s = gets.chomp
t = gets.chomp
puts s == t.chop ? "YES" : "NO" | s = gets.chomp
t = gets.chomp
puts s == t.chop ? "Yes" : "No" | [
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 405,872 | 405,873 | u265810213 | ruby |
p02682 | x,y,z,a=gets.split.map!(&:to_i)
ans=0
if a<x
ans=x-a
elsif a-x<y
ans=x
elsif a-x-y<z
ans=x-(a-x-y)
else
ans=x-z
end
puts ans
| x,y,z,a=gets.split.map!(&:to_i)
ans=0
if a<x
ans=a
elsif a-x<y
ans=x
elsif a-x-y<z
ans=x-(a-x-y)
else
ans=x-z
end
puts ans
| [
"expression.operation.binary.remove"
] | 406,117 | 406,118 | u977506075 | ruby |
p02682 | x,y,z,a=gets.split.map!(&:to_i)
ans=0
if a<=x
ans=a-x
elsif a-x<=y
ans=x
elsif a-x-y<=z
ans=x-(a-x-y)
else
ans=x-z
end
puts ans
| x,y,z,a=gets.split.map!(&:to_i)
ans=0
if a<x
ans=a
elsif a-x<y
ans=x
elsif a-x-y<z
ans=x-(a-x-y)
else
ans=x-z
end
puts ans
| [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change",
"expression.operation.binary.remove"
] | 406,119 | 406,118 | u977506075 | ruby |
p02682 | x,y,z,a=gets.split.map!(&:to_i)
ans=0
if a<x
ans=a-x
elsif a-x<y
ans=x
elsif a-x-y<z
ans=x-(a-x-y)
else
ans=x-z
end
puts ans
| x,y,z,a=gets.split.map!(&:to_i)
ans=0
if a<x
ans=a
elsif a-x<y
ans=x
elsif a-x-y<z
ans=x-(a-x-y)
else
ans=x-z
end
puts ans
| [
"expression.operation.binary.remove"
] | 406,120 | 406,118 | u977506075 | ruby |
p02682 | a, b, c, k = gets.split.map(&:to_i)
if k<=a
puts k
elsif k <= a+b
puts k
else
puts a-(k-a-b)
end
| a, b, c, k = gets.split.map(&:to_i)
if k<=a
puts k
elsif k <= a+b
puts a
else
puts a-(k-a-b)
end | [
"identifier.change",
"call.arguments.change"
] | 406,388 | 406,389 | u358554431 | ruby |
p02682 | a, b, c, k = gets.split.map(&:to_i)
if k<=a
puts a
elsif k <= a+b
puts a
else
puts a-(k-a-b)
end | a, b, c, k = gets.split.map(&:to_i)
if k<=a
puts k
elsif k <= a+b
puts a
else
puts a-(k-a-b)
end | [
"identifier.change",
"call.arguments.change"
] | 406,390 | 406,389 | u358554431 | ruby |
p02682 | a, b, c, k = gets.split.map(&:to_i)
if k<=a
puts a
elsif k-a <= b
puts a
else
puts a-(k-a-b)
end | a, b, c, k = gets.split.map(&:to_i)
if k<=a
puts k
elsif k <= a+b
puts a
else
puts a-(k-a-b)
end | [
"identifier.change",
"call.arguments.change",
"expression.operation.binary.remove",
"control_flow.branch.if.condition.change"
] | 406,391 | 406,389 | u358554431 | ruby |
p02682 | a, b, c, k = gets.chomp.split(' ').map(&:to_i)
s = 0
def calc(k, i, d, s)
if k >= i
k -= i
s += d * i
else
s += d * k
end
return k, s
end
[[a, 1], [b, 0], [c, -1]].each do |arr|
k, s = calc(k, arr[0], arr[1], s)
break if k <= 0
end
puts s | a, b, c, k = gets.chomp.split(' ').map(&:to_i)
s = 0
def calc(k, i, d, s)
if k >= i
k -= i
s += d * i
else
s += d * k
k = 0
end
return k, s
end
[[a, 1], [b, 0], [c, -1]].each do |arr|
k, s = calc(k, arr[0], arr[1], s)
break if k <= 0
end
puts s
| [
"assignment.add"
] | 406,464 | 406,465 | u882179152 | ruby |
p02682 | a, b, c, k = gets.split(" ").map(&:to_i)
if a >= k
puts a
elsif a + b >= k
puts a
else
puts a - (k - (a + b))
end | a, b, c, k = gets.split(" ").map(&:to_i)
if a >= k
puts k
elsif a + b >= k
puts a
else
puts a - (k - (a + b))
end | [
"identifier.change",
"call.arguments.change"
] | 406,959 | 406,960 | u011809316 | ruby |
p02682 | a, b, c, k = gets.split(" ").map(&:to_i)
if a >= k
puts a
elsif a + b >= k
puts a
else
puts a - (k - a - b)
end | a, b, c, k = gets.split(" ").map(&:to_i)
if a >= k
puts k
elsif a + b >= k
puts a
else
puts a - (k - (a + b))
end | [
"identifier.change",
"call.arguments.change",
"misc.opposites",
"expression.operator.arithmetic.change",
"expression.operation.binary.change"
] | 406,961 | 406,960 | u011809316 | ruby |
p02682 | a, b, c, k = gets.chomp.split.map(&:to_i)
if a >= k
puts a
elsif a < k && k < a + b
puts a
else
puts a - (k - a - b)
end
| a, b, c, k = gets.chomp.split.map(&:to_i)
if a >= k
puts k
elsif a < k && k < a + b
puts a
else
puts a - (k - a - b)
end
| [
"identifier.change",
"call.arguments.change"
] | 407,536 | 407,537 | u920244601 | ruby |
p02682 | a, b, c, k = gets.chomp.split.map(&:to_i)
if a > k
puts a
elsif a < k && k < a + b
puts a
else
puts a - (k - a - b)
end
| a, b, c, k = gets.chomp.split.map(&:to_i)
if a >= k
puts k
elsif a < k && k < a + b
puts a
else
puts a - (k - a - b)
end
| [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change",
"identifier.change",
"call.arguments.change"
] | 407,538 | 407,537 | u920244601 | ruby |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.