Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p02803 (python)

Fixed submission:
n, m = list(map(int, input().split()))
maze = []
for i in range(n):
  l = input()
  dl = []
  for j in range(m):
    if l[j] == '.':
      dl.append(0)
    else:
      dl.append(1)
  maze.append(dl)
ans = 0
for i in range(n):
  for j in range(m):
    if maze[i][j] == 0:
      a = [list(l) for l in maze]
      a[i][j] = 1
      q = [(i, j)]
      d = 0
      while len(q) > 0:
        nq = []
        for x, y in q:
          if x > 0 and a[x - 1][y] == 0:
            a[x - 1][y] = 1
            nq.append((x - 1, y))
          if y > 0 and a[x][y - 1] == 0:
            a[x][y - 1] = 1
            nq.append((x, y - 1))
          if x < n - 1 and a[x + 1][y] == 0:
            a[x + 1][y] = 1
            nq.append((x + 1, y))
          if y < m - 1 and a[x][y + 1] == 0:
            a[x][y + 1] = 1
            nq.append((x, y + 1))
        if len(nq) > 0:
          d += 1
        q = nq
      ans = max(ans, d)
print(ans)

Buggy submission (verdict: Runtime Error):
n, m = list(map(int, input().split()))
maze = []
for i in range(n):
  l = input()
  dl = []
  for j in range(m):
    if l[j] == '.':
      dl.append(0)
    else:
      dl.append(1)
  maze.append(dl)
ans = 0
for i in range(n):
  for j in range(m):
    if maze[i][j] == 0:
      a = [list(l) for l in maze]
      a[i][j] = 1
      q = [(i, j)]
      d = 0
      while len(q) > 0:
        nq = []
        d += 1
        for x, y in q:
          if x > 0 and a[x - 1][y] == 0:
            a[x - 1][y] = 1
            np.append((x - 1, y))
          if y > 0 and a[x][y - 1] == 0:
            a[x][y - 1] = 1
            np.append((x, y - 1))
          if x < n - 1 and a[x + 1][y] == 0:
            a[x + 1][y] = 1
            np.append((x + 1, y))
          if y < m - 1 and a[x][y + 1] == 0:
            a[x][y + 1] = 1
            np.append((x, y + 1))
        q = nq
      ans = max(ans, d)
print(ans)
Problem p02846 (python)

Fixed submission:
t1, t2 = map(int, input().split())
a1, a2 = map(int, input().split())
b1, b2 = map(int, input().split())

sa = a1 * t1 + a2 * t2
sb = b1 * t1 + b2 * t2

if sa == sb:
	print("infinity")
	exit()

# a is faster
if sa < sb:
	a1, a2, b1, b2 = b1, b2, a1, a2
	sa, sb = sb, sa
delta = sa - sb

# no meeting
if a1 > b1:
	print(0)
	exit()

# count the meeting in T1 period
cnt = (b1 - a1) * t1 // delta

# count the meeting in T2 period
cnt += (b1 - a1) * t1 // delta + 1

# common one
if (b1 - a1) * t1 % delta == 0:
	cnt -= 1

print(cnt)

Buggy submission (verdict: Runtime Error):
t1, t2 = map(int, input().split())
a1, a2 = map(int, input().split())
b1, b2 = map(int, input().split())

sa = a1 * t1 + a2 * t2
sb = b1 * t1 + b2 * t2

if sa == sb:
	print("infinity")
	exit()

# a is faster
if sa < sb:
	a1, a2, b1, b2 = b1, b2, a1, a2
	sa, sb = sb, sa
delta = sa - sb

# no meeting
if a1 > b1:
	print(0)
	exit()

# count the meeting in T1 period
cnt = (b1 - a1) * t1 // delta

# count the meeting in T2 period
cnt += (b1 - a1) * t1 // delta + 1

# common one
if (b1 - a1) * t1 % delta == 0:
	cnt -= 1

print(cnt)
Problem p02867 (python)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
l = list(zip(b, a))
 
a.sort()
b.sort()
for i in range(n):
  if a[i] > b[i]:
    print('No')
    exit()

ptr, pos = {}, {}
for i in range(n):
  if i > 0 and a[i] <= b[i - 1]:
    print('Yes')
    exit()
  ptr[l[i][1]] = l[i][0]
  pos[b[i]] = i

sta, now, cnt = a[0], a[0], 1
while True:
  now = a[pos[ptr[now]]]
  if now == sta:
    break
  cnt += 1
if cnt == n:
  print('No')
else:
  print('Yes')

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
l = sorted(list(zip(b, a)))
 
a.sort()
b.sort()
for i in range(n):
  if a[i] > b[i]:
    print('No')
    exit()
    
fir, las = {}, {}
s = [0] * n
for i in range(n):
  fir[a[i]] = min(fir.get(a[i], n), i)
  las[a[i]] = max(las.get(a[i], 0), i)
  if i > 0 and a[i] <= b[i - 1]:
    s[i] = 1
for i in range(1, n):
  s[i] += s[i - 1]
 
for i, (x, y) in enumerate(l):
  if x >= y:
    if y >= a[i] or s[fir[x]] - s[las[y]] == fir[x] - las[y]:
      print('Yes')
      exit()
 
print('No')

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
l = sorted(list(zip(b, a)))
 
a.sort()
b.sort()
for i in range(n):
  if a[i] > b[i]:
    print('No')
    exit()
    
fir, las = {}, {}
s = [0] * n
for i in range(n):
  fir[a[i]] = min(fir.get(a[i], n), i)
  las[a[i]] = max(las.get(a[i], 0), i)
  if i > 0 and a[i] <= b[i - 1]:
    s[i] = 1
for i in range(1, n):
  s[i] += s[i - 1]
 
for i, (x, y) in enumerate(l):
  if x >= y:
    if y >= a[i] or s[fir[x]] - s[las[y]] == fir[x] - las[y]:
      print('Yes')
      exit()
 
print('No')

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
l = sorted(list(zip(b, a)))
 
a.sort()
b.sort()
for i in range(n):
  if a[i] > b[i]:
    print('No')
    exit()
    
fir, las = {}, {}
s = [0] * n
for i in range(n):
  fir[a[i]] = min(fir.get(a[i], n), i)
  las[a[i]] = max(fir.get(a[i], 0), i)
  if i > 0 and a[i] <= b[i - 1]:
    s[i] = 1
for i in range(1, n):
  s[i] += s[i - 1]
 
for i, (x, y) in enumerate(l):
  if x >= y:
    if y >= a[i] or s[fir[x]] - s[las[y]] == fir[x] - las[y]:
      print('Yes')
      exit()
 
print('No')

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
l = sorted(list(zip(b, a)))
 
a.sort()
b.sort()
for i in range(n):
  if a[i] > b[i]:
    print('No')
    exit()
 
p = 0
for i, (x, y) in enumerate(l):
  if x >= y:
    if y >= a[i] or i == 0 or l[i - 1][0] >= a[i]
      print('Yes')
      exit()
 
print('No')
Problem p02882 (python)

Fixed submission:
import math
a, b, x = list(map(float, input().split()))
y = 2 * x / (a * b)
if y > a:
  y = 2 * (a * a * b - x) / (a * a)
  a = math.atan(y / a)
else:
  a = math.atan(b / y)
print(a / math.acos(-1.0) * 180)

Buggy submission (verdict: Runtime Error):
a, b, x = list(map(float, input().split()))
y = 2 * x / (a * b)
if y > a:
  y = 2 * (a * a * b - x) / (a * a)
  a = math.atan(y / a)
else:
  a = math.atan(b / y)
print(a / math.acos(-1.0) * 180)
Problem p02917 (python)

Fixed submission:
n = int(input())
b = list(map(int, input().split()))
a = [b[0]]
for i in range(1, n - 1):
  a.append(min(b[i - 1], b[i]))
a.append(b[-1])
print(sum(a))

Buggy submission (verdict: Runtime Error):
n = int(input())
b = map(int, input().split())
a = [b[0]]
for i in range(1, n - 1):
  a.append(min(b[i - 1], b[i]))
a.append(b[-1])
print(sum(a))
Problem p02982 (python)

Fixed submission:
n, d = list(map(int, input().split()))
p = []
ans = 0
for i in range(n):
  p.append(list(map(int, input().split())))
  for j in range(i):
    s = 0
    for k in range(d):
      s += (p[i][k] - p[j][k]) ** 2
    t = int(s ** 0.5 + 1e-7)
    if t * t == s:
      ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
n, d = list(map(int, input().split()))
p = []
ans = 0
for i in n:
  p.append(list(map(int, input().split())))
  for j in range(i):
    s = 0
    for k in d:
      s += (p[i][k] - p[j][k]) ** 2
    t = int(s ** 0.5 + 1e-7)
    if t * t == s:
      ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
n, d = list(map(int, input().split()))
p = []
ans = 0
for i in n:
  p.append(list(map(int, input().split())))
  for j in range(i):
    s = 0
    for k in d:
      s += (p[i] - p[j]) ** 2
    t = int(s ** 0.5 + 1e-7)
    if t * t == s:
      ans += 1
print(ans)
Problem p03044 (python)

Fixed submission:
n = int(input())
links = {u: {} for u in range(1, n + 1)}
for i in range(n - 1):
	x, y, z = map(int, input().split())
	links[x][y] = z
	links[y][x] = z
vis = [0] * (n + 1)
col = [0] * (n + 1)

now = 0
q = [(1, 0)]
while now < len(q):
	u = q[now][0]
	c = q[now][1]
	now += 1
	vis[u] = 1
	col[u] = c
	for v, l in links[u].items():
		if vis[v] == 0:
			if l & 1:
				q.append((v, c ^ 1))
			else:
				q.append((v, c))

for u in range(1, n + 1):
	print(col[u])

Buggy submission (verdict: Runtime Error):
n = int(input())
links = {u: {} for u in range(1, n + 1)}
for i in range(n - 1):
	x, y, z = map(int, input().split())
	links[x][y] = z
	links[y][x] = z
vis = [0] * (n + 1)
col = [0] * (n + 1)

def dfs(u, c):
	vis[u] = 1
	col[u] = c
	for v, l in links[u].items():
		# print("%d, %d" % (v, l))
		if vis[v] == 0:
			if l & 1:
				dfs(v, c ^ 1)
			else:
				dfs(v, c)

dfs(1, 0)

for u in range(1, n + 1):
	print(col[u])
Problem p03086 (python)

Fixed submission:
s = input()
ans = 0
cnt = 0
for c in s:
  if c in ['A', 'C', 'T', 'G']:
    cnt += 1
    if cnt > ans:
      ans = cnt
  else:
    cnt = 0
print(ans)

Buggy submission (verdict: Runtime Error):
s = input()
ans = 0, cnt = 0
for c in s:
  if c in ['A', 'C', 'T', 'G']:
    cnt += 1
    if cnt > ans:
      ans = cnt
  else:
    cnt = 0
print(ans)
Problem p03103 (python)

Fixed submission:
n, m = map(int, input().split())
shop = []
for i in range(n):
  shop.append(list(map(int, input().split())))
shop.sort()
bought = 0
cost = 0
for i in range(n):
  bought += min(m, shop[i][1])
  cost += min(m, shop[i][1]) * shop[i][0]
  m -= min(m, shop[i][1])
print(cost)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
shop = []
for i in range(n):
  shop.append(list(map(int, input().split())))
shop.sort()
bought = 0
cost = 0
for i in range(n):
  bought += min(m, b[i])
  cost += min(m, b[i]) * a[i]
  m -= min(m, b[i])
print(cost)
Problem p03261 (python)

Fixed submission:
n = input()
d = set()
pre = ""
for i in range(n):
    s = raw_input()
    if s in d:
        print "No"
        exit()
    if pre == "" or pre[-1] == s[0]:
        d.add(s)
        pre = s
    else:
        print "No"
        exit()
print "Yes"

Buggy submission (verdict: Runtime Error):
n = input()
d = set()
pre = ""
for i in range(n):
    s = raw_input()
    if s in d:
        print "No"
        exit()
    if pre == "" or pre[-1] == s[0]:
        d.add(s)
        pre = d
    else:
        print "No"
        exit()
print "Yes"

Buggy submission (verdict: Runtime Error):
n = input()
d = set()
pre = ""
for i in range(n):
    s = raw_input()
    if s in d:
        print "No"
        exit()
    if pre = "" or pre[-1] == s[0]:
        d.add(s)
        pre = d
    else:
        print "No"
        exit()
print "Yes"

Buggy submission (verdict: Runtime Error):
n = input()
d = set()
for i in range(n):
    s = raw_input()
    if s in d:
        print "No"
        exit()
    if pre = "" or pre[-1] == s[0]:
        continue
    else:
        print "No"
        exit()
print "Yes"
Problem p03262 (python)

Fixed submission:
def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)
n, x = map(int, raw_input().split())
d = map(int, raw_input().split())
g = abs(x - d[0])
for z in d:
    g = gcd(g, abs(z - x))
print g

Buggy submission (verdict: Runtime Error):
def gcd(a, b):
    if b == 0:
        return a
    return(b, a % b)
n, x = map(int, raw_input().split())
d = map(int, raw_input().split())
g = abs(x - d[0])
for z in d:
    g = gcd(g, abs(z - x))
print g
Problem p03263 (python)

Fixed submission:
n, m = map(int, raw_input().split())
a = []
for i in range(n):
    row = map(int, raw_input().split())
    a.append(row)
op = []
for i in range(n):
    for j in range(m - 1):
        if a[i][j] % 2 == 1:
            a[i][j + 1] += 1
            op.append([i + 1, j + 1, i + 1, j + 2])
for i in range(n - 1):
    if a[i][m - 1] % 2 == 1:
        a[i + 1][m - 1] += 1
        op.append([i + 1, m, i + 2, m])
print len(op)
for tup in op:
    print " ".join(map(str, tup))

Buggy submission (verdict: Runtime Error):
n, m = map(int, raw_input().split())
a = []
for i in range(n):
    row = map(int, raw_input().split())
    a.append(row)
op = []
for i in range(n):
    for j in range(m - 1):
        if a[i][j] % 2 == 1:
            a[i][j + 1] += 1
            op.append([i + 1, j + 1, i + 1, j + 2])
for i in range(n - 1):
    if a[i][m - 1] % 2 == 1:
        a[i + 1][m - 1] += 1
        op.append([i + 1, m, i + 2, m])
print len(op)
for tup in op:
    print " ".join(tup)
Problem p03001 (python)

Fixed submission:
w,h,x,y=map(int,input().split())
n=0
if w==2*x and h==2*y:
  n=1
print(float(w*h/2), end=" ")
print(n)

Buggy submission (verdict: Runtime Error):
w,h,x,y=map(int,input().split())
n=0
if w%x==0 and h%y==0:
  n=1
print(float(w*h/2), end=" ")
print(n)
Problem p03220 (python)

Fixed submission:
N=int(input())
T,A=map(int,input().split())
h=list(map(int,input().split()))
AA=[]
for i in range(N):
  a=T-h[i]*0.006-A
  if a<0:
    a*=-1
  AA.append(a)
print(AA.index(min(AA))+1)

Buggy submission (verdict: Runtime Error):
N=int(input())
T,A=map(int,input().split())
H=list(map(int,input().split()))
a=[A-(T-H[i]*0.006) for i in range(0,N) if A-(T-H[i]*0.006)>=0]
b=[A-(T-H[i]*0.006) for i in range(0,N) if A-(T-H[i]*0.006)<0]
if a==[]:
  c=max(b)
elif b==[]:
  c=min(a)
elif min(a)>=-max(b):
  c=max(b)
else:
  c=min(a)
print(H.index((T-A+c)/0.006)+1)
Problem p03282 (python)

Fixed submission:
S=input()
if all(S[i]=="1" for i in range(len(S))):
  print(1)
elif S[0]!="1":
  print(S[0])
else:
  K=int(input())
  i=0
  while S[i]=="1":
    i+=1
  if i<K:
    print(S[i])
  else:
    print(1)

Buggy submission (verdict: Runtime Error):
S=input()
if S[0]!="1":
  print(S[0])
else:
  K=int(input())
  i=0
  while S[i]=="1":
    i+=1
  if i<K:
    print(S[i])
  else:
    print(1)
Problem p03369 (python)

Fixed submission:
s=list(input())
n=s.count("o")
print(700+100*n)

Buggy submission (verdict: Runtime Error):
s=list(input())
n=s.count(o)
print(700+100*n)
Problem p03455 (python)

Fixed submission:
a,b=map(int,input().split())
if (a*b)%2==0:
  print("Even")
else:
  print("Odd")

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
if (a*b)%2=0:
  print("Even")
else:
  print("Odd")
Problem p03485 (python)

Fixed submission:
a,b=map(int,input().split())
x=(a+b)/2
if (a+b)%2==0:
  print(int(x))
else:
  print(int(x)+1)

Buggy submission (verdict: Runtime Error):
a,b=map(int,input(),split())
x=(a+b)/2
if (a+b)%2==0:
  print(x)
else:
  print(x+1)

Buggy submission (verdict: Runtime Error):
a,b=map(int,input(),split())
x=(a+b)/2
if (a+b)%2==0:
  print(int(x))
else:
  print(int(x)+1)
Problem p03493 (python)

Fixed submission:
s=str(input())
if s=="111":
  print(3)
elif s=="000":
  print(0)
elif s=="001" or s=="010" or s=="100":
  print(1)
else:
  print(2)

Buggy submission (verdict: Runtime Error):
S=str(input())
print(S.count(”1”))

Buggy submission (verdict: Runtime Error):
S=int(input())
print(S.count(1))
Problem p03494 (python)

Fixed submission:
n=input()
A=list(map(int,input().split()))
c=0
while all(a%2==0 for a in A):
  A=[a/2 for a in A]
  c+=1
print(c)

Buggy submission (verdict: Runtime Error):
n=input()
A=list(map(int,input().split())
c=0
while all(a%2==0 for a in A):
  A=[a/2 for a in A]
  c+=1
print(c)
Problem p03644 (python)

Fixed submission:
N=int(input())
c=0
n=range(1,N)
while any(i%2==0 for i in n):
          N=int(N/2)
          n=range(1,N+1)
          c+=1
print(2**c)

Buggy submission (verdict: Runtime Error):
n=input()
l=list(range(1,n))
m=0
def c(n):
  return n/2
while any(i%2==0 for i in l):
       l=map(c,l)
       m+=1
print(2**m)

Buggy submission (verdict: Runtime Error):
n=input()
l=list(range(1,n))
m=0
while any(i%2==0 for i in l):
       l=[i/2 for i in l]
       m+=1
print(2**m)

Buggy submission (verdict: Runtime Error):
n=input()
l=range(1,n)
m=0
while any(i%2==0 for i in l):
       l=[i/2 for i in l]
       m+=1
print(2**m)

Buggy submission (verdict: Runtime Error):
n=input()
l=range(1,n)
m=0
while any(i&2==0 for i in l):
       l=[i/2 for i in l]
       m+=1
print(2**m)

Buggy submission (verdict: Runtime Error):
n=input()
l=(range(n+1))[1:]
while any(i%2==0 for i in l):
  l=[i/2 i%2==0 for i in l]
print(int(n))
Problem p03680 (python)

Fixed submission:
N=int(input())
L=[0 for i in range(N)]
A=[int(input())-1  for _ in range(N)]
n=0
m=1
while L[n]!=1 and A[n]!=1:
  L[n]=1
  m+=1
  n=A[n]
if L[n]==1:
  print(-1)
else:
  print(m)

Buggy submission (verdict: Runtime Error):
#変数に注意。。。#
def f(n,l):
  m=A[n]
  if m==1:
    print(l)
  elif L[m]==1:
    print(-1)
  else:
    L[m]=1
    return f(m,l+1)

N=int(input())
L=[0 for i in range(N)]
A=[int(input())-1  for _ in range(N)]
L[0]=1
f(0,1)

Buggy submission (verdict: Runtime Error):
def f(n):
  m=A[n]
  if m==1:
    print(n)
  elif L[m]==1:
    print(-1)
  else:
    n+=1
    L[m]=1
    return f(m)

N=int(input())
L=[0 for i in range(N)]
A=[int(input())-1  for _ in range(N)]
L[0]=1
n=0
if A[0]==1:
  print(1)
else:
  f(0)

Buggy submission (verdict: Runtime Error):
def f(n):
  m=A[n]
  if m==1:
    print(n)
  elif L[m]==1:
    print(-1)
  else:
    n+=1
    L[m]=1
    return f(m)

N=int(input())
L=[0 for i in range(N)]
A=[int(input())-1  for _ in range(N)]
L[0]=1
n=0
f(0)
Problem p03693 (python)

Fixed submission:
r,g,b=map(int,input().split())
if (100*r+10*g+b)%4==0:
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
r,g,b=map(int,input().split())
if (100*r+10*g+b)%4==0:
  print(YES)
else:
  print(NO)
Problem p03720 (python)

Fixed submission:
N,M=map(int,input().split())
list=[[] for j in range(N)]
for i in range(M):
  a,b=map(int,input().split())
  list[a-1]+="Y"
  list[b-1]+="Y"
for i in range(N):
  print(len(list[i]))

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
list=[[] for j in range(N)]
for i in range(M):
  a,b=map(int,input().split())
  list[a-1]+="Y"
  list[b-1]+="Y"
for i in range(M):
  print(len(list[i]))
Problem p02760 (python)

Fixed submission:
# -*- coding: utf-8 -*-
# @Time    : 2020/3/1 19:59
# @Author  : DIRICHLET
# @File    : main.py


b=[[0,0,0],[0,0,0],[0,0,0]]
#print(b)
m={}
for i in range(3):
    t=list(map(int,input().split()))
    k=0
    for j in t:
        m[j]=(i,k)
        k+=1
n=int(input())
for i in range(n):
    t=int(input())
    if t in m:
        #print(m[t])
        b[m[t][0]][m[t][1]]=1
for i in b:
    ans=1
    for j in i:
        ans*=j
    if ans==1:
        print('Yes')
        exit()
for i in range(3):
    ans=1
    for j in range(3):
        ans*=b[j][i]
    if ans==1:
        print('Yes')
        exit()
if b[0][0]*b[1][1]*b[2][2]==1:
    print('Yes')
    exit()
if b[0][2]*b[1][1]*b[2][0]==1:
    print('Yes')
    exit()
print('No')

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
# @Time    : 2020/3/1 19:59
# @Author  : DIRICHLET
# @File    : main.py


b=[[0,0,0]]*3
#print(b)
m={}
for i in range(3):
    t=list(map(int,input().split()))
    k=0
    for j in t:
        m[j]=(i,k)
        k+=1
n=int(input())
for i in n:
    t=int(input())
    if t in m:
        #print(m[t])
        b[m[t][0]][m[t][1]]=1
for i in b:
    ans=1
    for j in i:
        ans*=j
    if ans==1:
        print('Yes')
        exit()
for i in range(3):
    ans=1
    for j in range(3):
        ans*=b[j][i]
    if ans==1:
        print('Yes')
        exit()
if b[0][0]*b[1][1]*b[2][2]==1:
    print('Yes')
    exit()
if b[0][2]*b[1][1]*b[2][0]==1:
    print('Yes')
    exit()
print('No')
Problem p02995 (python)

Fixed submission:
#data=list(input().split())
a,b,c,d=map(int,input().split())
def gcd(x , y):
    if y == 0:
        return x 
    else:
        return gcd(y, x%y)

def gys(a,b):
    remainder = gcd(a,b)
    return a*b//remainder

lcmm=gys(c,d)
def ans(n,k):
    return n//k
def x(s):
    return ans(s,c)+ans(s,d)-ans(s,lcmm)
#print(x(b),x(a))

print(b-a+1-x(b)+x(a-1))

Buggy submission (verdict: Runtime Error):
#data=list(input().split())
a,b,c,d=map(int,input().split())
def gcd(x , y):
    if y == 0 
        return x 
    else gcd(y, x%y)

def gys(a,b):
    remainder = gcd(a,b)
    return int(a*b/remainder)

lcmm=gys(c,d)
def ans(n,k):
    return int(n/k)
def x(s):
    return ans(s,c)+ans(s,d)-ans(s,lcmm)
#print(x(b),x(a))
if a%c==0 or a%d==0:
    print(b-a-x(b)+x(a))
else:
    print(b-a+1-x(b)+x(a))
Problem p03194 (python)

Fixed submission:
a,b=map(int ,input().split())
x=int(pow(b,1/a)+0.00001)
while x>=1:
    if b%(x**a)==0:
        print(x)
        exit()
    x-=1

Buggy submission (verdict: Runtime Error):
a,b=map(int ,input().split())
x=int(pow(b,1/a))
x+=1
while x>=1:
    if b%(pow(x,a))==0:
        print(x)
        exit()
    x-=1

Buggy submission (verdict: Runtime Error):
a,b=map(int ,input().split())
x=int(pow(b,1/a))
x+=1
while x>=1:
    if b%(x**a)==0:
        print(x)
        exit()
    x-=1
Problem p02768 (python)

Fixed submission:
def choose(n,r):
    res = 1
    fac = 1
    for i in range(r):
        res *= n-i
        res %= MOD
        fac *= i+1
        fac %= MOD
    return res*pow(fac,MOD-2,MOD)%MOD        

n,a,b = list(map(int,input().split()))
MOD = 10**9+7
t=0
ans = pow(2,n,MOD)-1


ans -= choose(n,a)
ans -= choose(n,b)

ans = ans % MOD
print(int(ans))

Buggy submission (verdict: Runtime Error):
n,a,b = list(map(int,input().split()))
kumiawase_bunshi = 1
kumiawase_bunbo = 1
t=0
ans = 0
for i in range (1,n+1):
    if(i != a and i != b):
        t=n
        for j in range (n-i+1,n+1):
            kumiawase_bunshi = kumiawase_bunshi * j
        for k in range (1,i+1):
            kumiawase_bunbo = kumiawase_bunbo * k
        ans = ans + (kumiawase_bunshi / kumiawase_bunbo)
        kumiawase_bunshi = 1
        kumiawase_bunbo = 1
ans = ans % 1000000007
print(ans)
Problem p02780 (python)

Fixed submission:
#D - Dice in Line
#一つのサイコロふったときに出る目の期待値は(面の数+1)/2
n,k=list(map(int,input().split()))
dices = list(map(float,input().split()))
expected = []
answer = 0
i = 0
j = 0
sumOfValue = 0
expected.append(i)
#サイコロの目を期待値に変換して累積和のリスト作る
for eyes in dices:
    i = (eyes+1)/2
    j = j + i
    expected.append(j)
#最大値を求める
for t in range(n-k+1):
    sumOfValue = expected[t+k] - expected[t]
    if(answer <= sumOfValue):
        answer = sumOfValue
print(answer)

Buggy submission (verdict: Runtime Error):
#D - Dice in Line
#一つのサイコロふったときに出る目の期待値は(面の数+1)/2
n,k=list(map(int,input().split()))
dices = list(map(float,input().split()))
expected = []
cumulative_sum = []
answer = 0
i = 0
j = 0
sumOfValue = 0
#サイコロの目を期待値に変換して累積和のリスト作る
for eyes in dices:
    i = (eyes+1)/2
    j = j + i
    expected.append(j)
#最大値を求める
for maxvalue in range(len(expected)-k):
    sumOfValue = expected[maxvalue+3] - expected[maxvalue]
    if(answer < sumOfValue):
        answer = sumOfValue
print(answer)
Problem p02783 (python)

Fixed submission:
h,a = list(map(int,input().split()))
ans = 0
syou = h // a
mod = h % a
ans = syou
if(mod != 0):
    ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
h = int(input())
a = int(input())
ans = 0
ans = h // a
ans += 1
print(ans)