Problem:


Score : 100 points

Problem Statement

The door of Snuke's laboratory is locked with a security code.

The security code is a 4-digit number. We say the security code is hard to enter when it contains two consecutive digits that are the same.

You are given the current security code S. If S is hard to enter, print Bad; otherwise, print Good.

Constraints

S is a 4-character string consisting of digits.

Input

Input is given from Standard Input in the following format:

S

Output

If S is hard to enter, print Bad; otherwise, print Good.

Sample Input 1

3776

Sample Output 1

Bad

The second and third digits are the same, so 3776 is hard to enter.

Sample Input 2

8080

Sample Output 2

Good

There are no two consecutive digits that are the same, so 8080 is not hard to enter.

Sample Input 3

1333

Sample Output 3

Bad

Sample Input 4

0024

Sample Output 4

Bad



Sample input:
3776


Sample output:
Bad

Submission status: Runtime Error

Solution code:
from sys import stdin




def gcd(n,m):
    if n<m:
        return gcd(m,n)
    if n%m==0:
        return m
    else:
        return gcd(m,n%m)



a,b,c,d = [int(x) for x in stdin.readline().rstrip().split()]

c_num = b//c-(a-1)//c
d_num = b//d-(a-1)//d

LCM = d*c//gcd(c,d)

LCM_num = int(b//(LCM)-(a-1)//(LCM))

ans = b-a+1
ans -= c_num
ans -= d_num
ans += LCM_num
print(ans)

Submission status: Runtime Error

Solution code:
N = int(input())
A = [None for _ in range(N)]
B = [None for _ in range(N)]
endflg = [0 for _ in range(N)]
for i in range(N):
  A[i],B[i] = map(int,input().split())
time = 0

limit = max(B) + 1

for i in range(N):
  Pb = B.index(min(B))
  if time + A[Pb] <= B[Pb]:
    endflg[Pb] = 1
    B[Pb] = limit
    time = time + A[Pb]
  else:
    break
    
if endflg == [1 for _ in range(N)]:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
def GCD(a,b):
  if a<b:
    tmp = a
    a = b
    b = tmp
 
  r = a % b
  while (r!=0): 
    a = b
    b = r
    r = a % b
  return b


A,B,C,D = map(int,input().split())
A = A - 1
upperC = int(B // C)
upperD = int(B // D)
lowerC = int(A // C)
lowerD = int(A // D)

numC = upperC - lowerC
numD = upperD - lowerD

gcd = GCD(C,D)

lcm = C * D / gcd
upperL = int(B / lcm)
lowerL = int(A / lcm)
numL = upperL - lowerL

print(str(B - A - (numC + numD - numL)))

Submission status: Runtime Error

Solution code:

lst_A = list(input())

ans = "Bad"

for i in range(3):
	if lst_A[i] == lst_A[i + 1]
  		break
else:
  ans = "Good"
  
print(ans)

Submission status: Runtime Error

Solution code:
a, b, c, d = map(int, input().split())

count = b - a
def baisuu(n):
    i1 = (a // n + bool(a % n or b % n))
    i2 = (b // n)
    return int(i2 - i1)

def gcd(x1, x2):
    x = x1 * x2
    r = x2 % x1
    while r != 0:
        x2 = x1
        x1 = r
        r = x2 % x1
    return x / x1

print(count - baisuu(c) - baisuu(d) + baisuu(gcd(c, d)))

Submission status: Runtime Error

Solution code:
s = input()

flag = False

for i in range(4):
    if s[i] == s[i + 1]:
        flag = True
        break

if flag:
    print("Bad")
else:
    print("Good")

Submission status: Runtime Error

Solution code:
import fractions

A,B,C,D = input().strip().split(" ")
A = int(A)
B = int(B)
C = int(C)
D = int(D)

div1 = A // C
div2 = A // D
div3 = (B-1) // C
div4 = (B-1) // D

X = C*D // int(fractions.gcd(C,D))
div5 = B // X

del_nums = (div3 + div4) - (div1 + div2) + div5
result = B - A - del_nums
print(result)

Submission status: Runtime Error

Solution code:
S = input()
A = S.split()

for i in A:
    if A[i] == A[i + 1]:
        print('Bad')
    else:
        print('Good')

Submission status: Runtime Error

Solution code:
S = str(input())
A = S.split()

for i in A:
    if A[i] == A[i + 1]:
        print('Bad')
    else:
        print('Good')

Submission status: Runtime Error

Solution code:
S = str(input())
A = S.split()

for i in range(A):
    if A[i]=A[i+1]:
        print('Bad')
    else:
        print('Good')

Submission status: Runtime Error

Solution code:
S = str(input())
A = S.split()

for i in A:
    if A[i]=A[i+1]:
        print('Bad')
    else:
        print('Good')

Submission status: Runtime Error

Solution code:
S = input()
A = S.split()

for i in A:
    if A[i]=A[i+1]:
        print('Bad')
    else:
        print('Good')

Submission status: Runtime Error

Solution code:
n = int(input())
li = [tuple(map(int,input().split())) for _ in range(n)]
li.sort(key=lambda x: x[1])
t = 0
for i in range(n):
    if t + li[i][0] > li[i][1]:
        print("No")
        exit()
    else:
        t += li[i][0]
print("Yes")

Submission status: Runtime Error

Solution code:
import math

def lcm(x, y):
    return (x * y)//math.gcd(x, y)

A,B,C,D = map(int,input().split())
E = lcm(C, D)
sample = B-A
ans = sample - ((B//C-A//C) + (B//D-A//D)-(B//E-A//E))
print(ans)

Submission status: Runtime Error

Solution code:
a,b,c,d = map(int,input().split())
if a==b or b==c or c==d:
  print("Bad")
else:
  print("Good")

Submission status: Runtime Error

Solution code:
lock_num = list(input())
#lock_num = [int(x) for x in lock_num]
tag = 0
for i in range(3):
  if int(lock_num[i]) == int(lock_num[i+1]):
    tag = 1
if tag == 0:
  print("Good")
else tag ==1:
  print("Bad")

Submission status: Runtime Error

Solution code:
lock_num = input()
#lock_num = [int(x) for x in lock_num]
tag = 0
for i in range(len(lock_num)-1):
  if int(lock_num[i]) == int(lock_num[i+1]):
    tag = 1
if tag == 0:
  print("Good")
else tag ==1:
  print("Bad")

Submission status: Runtime Error

Solution code:
lock_num = input().split()
lock_num = [int(x) for x in lock_num]
tag = 0
for i in range(len(lock_num)-1):
  if lock_num[i] == lock_num[i+1]:
    tag = 1
if tag == 0:
  print("Good")
else tag ==1:
  print("Bad")

Submission status: Runtime Error

Solution code:
import fractions as frac
a,b,c,d = map(int,input().split())


lcm = (c * d) // frac.gcd(c,d)
if a % lcm != 0:
    s = lcm - a % lcm
else:
    s = 0
e = b % lcm
m = ((b - e) - (a + s)) // lcm
modgcd = (b - a + 1) - (s + (lcm - 1) * m + e)

if a % c != 0:
    s = c - a % c
else:
    s = 0
e = b % c
m = ((b - e) - (a + s)) // c
modc = (b - a + 1)- (s + (c - 1) * m + e)

if a % d != 0:
    s = d - a % d
else:
    s = 0
e = b % d
m = ((b - e) - (a + s)) // d
modd = (b - a + 1) - (s + (d - 1) * m + e)

print((b - a + 1)-(modc + modd - modgcd))

Submission status: Runtime Error

Solution code:
s=int(input())

b=int(s%1000)
a=int((s-b)/1000)
d=int(b%100)
c=int((b-d)/100)
f=int(d%10)
e=int((d-f)/10)

if a=d or d=e or e=f :
    print("Bad")
else:
    print("Good")

Submission status: Runtime Error

Solution code:
#!/usr/bin/env python3
#import math
import fractions

def lcm(x, y):
    #return (x * y) // math.gcd(x, y)
    return (x * y) // fractions.gcd(x, y)

if __name__ == '__main__':
    a, b, c, d = list(map(int, input().split()))
    bc = b // c
    bd = b // d
    ac = (a - 1) // c
    ad = (a - 1) // d
    l = lcm(c, d)

    ans = (b - (bc + bd)) - ((a - 1) - (ac + ad)) + b // l
    print(ans)

Submission status: Runtime Error

Solution code:
a = list(map(int, input().split()))
for i in range(len(a - 1)):
    if a[i] == a[i + 1]:
        print("Bad")
        break
else:
  print("Good")

Submission status: Runtime Error

Solution code:
a = list(map(int, input().split()))
for i in range(len(a)):
    if a[i] == a[i + 1]:
        print("Bad")
        break
else:
  print("Good")

Submission status: Runtime Error

Solution code:
# coding: utf-8
import re
import bisect
from datetime import datetime as dt
import bisect
import fractions

def gcd(a, b):
    return int(fractions.gcd(a, b))

def lcm(a, b):
    return a // gcd(a,b) * b

class slist(list):
    def __init__(self, *args, **kw):
        list.__init__(self, *args, **kw)
        self.sort()

    def append(self, value):
        bisect.insort(self,value)

    def index_left(self, value):
        return bisect.bisect_left(self, value)

def calc(n, a, b):
    return n//a + n//b - n//lcm(a,b)

if __name__ == '__main__':
    a, b, c, d = map(int, input().split())
    ans = calc(b, c, d) - calc(a - 1, c, d)
    print(b - a + 1 - ans)

Submission status: Runtime Error

Solution code:
n = input()
for i in range(0,len(n)-1,1):
  if (n[i] == n[i+1]):
    print("Bad")
    else:
print("Good")

Submission status: Runtime Error

Solution code:
n = input()
for i in range(0,len(n)-1,1):
  if (n[i] == n[i+1]):
    print("Bad")
    else:
    print("Good")

Submission status: Runtime Error

Solution code:
n = input()
for i in range(0,len(n)-1,1):
  if (n[i] ==-n[i+1]):
    print("Bad")
    else:
print("Good")

Submission status: Runtime Error

Solution code:
n = input()
for i in range(0,len(n)-1,1):
  if (n[i] ==-n[i+1]):
    print("Bad")
    else:
      print("Good")

Submission status: Runtime Error

Solution code:
n = int(input())
lst = []
STATUS = "Good"
while n > 0:
    lst.append(n%10)
    n //= 10 # 必須
lst.reverse()
for i in range(3):
  if lst[i] == lst[i + 1]:
    STATUS = "Bad"
  else:
    pass
print(STATUS)

Submission status: Runtime Error

Solution code:
s = int(input())
sl = list(str(s))
prev = a
for si in sl:
    if prev == si:
        print('Bad')
        exit()
print('Good')

Submission status: Runtime Error

Solution code:
作成したプログラムには欠陥がある。今回の課題ではない1度ずつ探索を行いその中でも最もスコアが高かった時の角度を最後の出力しているが、自分が想定した角度とは違う角度が最大となっている例として画像2-2では自分は最適な角度が0度であると考えているのに対して、出力では最適な角度は----と自分が想定している角度ではなかった。このようになった理由として考えられるのはキティの特徴の考え方の一つであると思われる黄色の目と鼻の位置が元からある場所よりも近いのがあったからと考えられる。また画像2-2や2-3であった複数のキティを検出だが検出することはできたものの最終出力では複数の赤枠の出力ができなかった。2ー3のファイルでは画像を回転させるごとにキティを探索することができたが(60、180、300)このプログラムでは最もテンプレートに近い時のキティである

Submission status: Runtime Error

Solution code:
input = input()
is_good = True
for i, s in enumerate(input):
    if i > 0 and s == input[i-1]:
        is_good = False
        break
    if i < len(input) and s == input[i+1]:
        is_good = False
        break
if is_good:
    print('Good')
else:
    print('Bad')

Submission status: Runtime Error

Solution code:
s = 1001
st_s = list(s)
for i in range(length(st_s)):
  fig_s = int(i)
for i in range(4):
  if fig_s(i)==fig_s(i+1):
    flag = 1
  else:
    flag = 0

if flag == 0:
  print("Good")
else:
  print("Bad")

Submission status: Runtime Error

Solution code:
s = input()
for c, d in zip(s, s[1:]):
  if c == d:
    print('Bad')
 	break
else:
  print('Good')

Submission status: Runtime Error

Solution code:
N = int(input() )
for i in range(N):
  C[i] = [map(int, input().split() ) ]
 
C.sort(key= lambda s:(s[1],s[0]) )
 
judge = "Yes"
time = 0
for i in range(N):
  time += C[i][0]
  if time > C[i][1]:
    judge = "No"
    break
print(judge)

Submission status: Runtime Error

Solution code:
N = int(input() )
for i in range(N):
  C[i] = list(map(int, input().split() ) )

C.sort(key= lambda s:(s[1],s[0]) )


judge = "Yes"
time = 0
for i in range(N):
  time += C[i][0]
  if time > C[i][1]:
    judge = "No"
    break
print(judge)

Submission status: Runtime Error

Solution code:
N, L = map(int, input().split())
 
if L > -1:
  N_eat = 1
elif N+L-1 < 1:
  N_eat = N
else:
  N_eat = 1-L
pie = N*N/2 +N*(L-1) - (L + N_eat-1) 
print(pie)

Submission status: Runtime Error

Solution code:
S = input()
bad = 0
for num in range(2):
  if S[num] == S[num + 1]:
    print("Bad")
    break
    bad = 1
if bad == 0:
  print(Good)

Submission status: Runtime Error

Solution code:
import fractions

A, B, C, D = map(int, input().split())

count = B - A + 1
lcd_of_CD = C * D // fractions.gcd(C, D)

count -= B // C
count += (A - 1) // C
count -= B // D
count += (A - 1) // D
count += B // lcd_of_CD
count -= (A - 1) // lcd_of_CD

print(count)

Submission status: Runtime Error

Solution code:
import fractions

A, B, C, D = map(int, input().split())

count = B - A + 1
lcd_of_CD = C * D // math.gcd(C, D)

count -= B // C
count += (A - 1) // C
count -= B // D
count += (A - 1) // D
count += B // lcd_of_CD
count -= (A - 1) // lcd_of_CD

print(count)

Submission status: Runtime Error

Solution code:
output = []
 
for (i, x) in enumerate(S):
    if i == 0:
        pre = x
    else:
        if pre == x:
            output = "Bad"
        pre = x
            
if len(output) > 0:
    print(output)
else:
    output = "Good"
    print(output)

Submission status: Runtime Error

Solution code:
a, b, c, d = map(int, input().split())

x,y = c,d

# 最小公倍数
while y != 0:
	x,y = y,x%y

x = (c*d)//x

count1 = b - (b//c + b//d -b//x)
count2 = (a - 1) - ((a-1)//c + (a-1)//d -(a-1)//x) 
print(count1 - count2)

Submission status: Runtime Error

Solution code:
A,B,C,D = (int(x) for x in input().split())
n = A
count = 0
while n <= B:
    if n%C != 0 
        if n%D != 0:
            count += 1
    n += 1
print(count)

Submission status: Runtime Error

Solution code:
a, b, c, d = map(int, input().split())
print("Bad" if a == b or b == c or c == d else "Good")

Submission status: Runtime Error

Solution code:
S = input()

if S[0] == S[1]:
  print(Bad)
  break
elif S[1] == S[2]:
  print(Bad)
  break
elif S[2] == S[3]:
  print(Bad)
  break
else:
  print(Good)

Submission status: Runtime Error

Solution code:
S = input()

if S[0] == S[1]:
  print(Bad)
elif S[1] == S[2]:
  print(Bad)
elif S[2] == S[3]:
  print(Bad)
else:
  print(Good)

Submission status: Runtime Error

Solution code:
S = input()

if S[0] == S[1]:
  print(Bad)
elif S[1] == S[2]:
  print(Bad)
elif S[2] == S[3]:
  print(Bad)
else:
 print(Good)

Submission status: Runtime Error

Solution code:
S = input()

if S[0] == S[1]:
  print(Bad)
elif S[1] == S[2]:
  print(Bad)
elif S[2] == S[3]:
  print(Bad)
else
	print(Good)

Submission status: Runtime Error

Solution code:
S=int(input())
l=[]
while S>0:
  l.append(S%10)
  S//=10
if l[0]==l[1] or l[1]==l[2] or l[2]==l[3]:
  print('Bad')
else:
  print('Good')

Submission status: Runtime Error

Solution code:
s = int(input())

ans = "Good"

s_temp = 99

for num in s:
    if int(num) == s_temp:
        ans = "Bad"
        break
    else:
        s_temp = int(num)

print(ans)

Submission status: Runtime Error

Solution code:
import sys
import fractions as fl

a, b, c, d = list(input().split())
a = int(a)
b = int(b)
c = int(c)
d = int(d)

#全体の個数
all = b - a + 1
#cとdの最小公倍数
e = c * d // fl.gcd(c, d)
# a以下でcまたはdで割れる個数
r1 = (a-1) // c + (a-1) // d - (a-1) // e
# b以下でcまたはdで割れる個数
r2 = b // c + b // d - b // e
ans = all - (r2 - r1)
print(ans)

Submission status: Runtime Error

Solution code:
import sys
n = int(input())
ab = [list(map(int, input().split())) for i in range(n)]

ab.sort(key=lambda x: x[1])
now = 0 #現在時刻
for i in range(n):
    now = now + ab[i][0]
    if now > ab[i][1]:
        print('No')
        sys.exit()

print('Yes')

Submission status: Runtime Error

Solution code:
S= str(input())
cou = 0
for i in range(len(S)-1):
  if(S[i]==S[i+1]):
    cou += 1
  break
if(cou=1):
  print("Bad")
else:
  print("Good")

Submission status: Runtime Error

Solution code:
import fractions
a, b, c, d = map(int, input().split())
 
def wareruzu(x):
    start_a = a if a % x == 0 else a - (a % x) + x
    end_b = b - (b % x)
    m = end_b - start_a
    return int(m / x) + 1
 
all_n = b - a + 1
print(all_n - wareruzu(c) - wareruzu(d) + wareruzu((c*d) / fractions.gcd(c,d)))

Submission status: Runtime Error

Solution code:
l = ['%d%d'%(i, i) for i in range(10)]
S = input()
if S.count(l) > 0:
    print('Bad')
else:
    print('Good')

Submission status: Runtime Error

Solution code:
N = int(input())
l = [list(map(int, input().split())) for i in range(n)]
l.sort(key= x:x[1])
t=0
for i in l:
    a,b=i
    t+=a
    if(t>b):
        print("No")
        break
    else:
        print("Yes")

Submission status: Runtime Error

Solution code:
a, b, c, d = map(int, input().split())

# ans = b-(a-1) - (b//c - (a-1)//c) - (b//d - (a-1)//d) + (b//(c*d) - (a-1)//(c*d))
ans = b - b//c - b//d + b//(c*d) - (a-1 - (a-1)//c - (a-1)//d + (a-1)//(c*d))

print(ans)

Submission status: Runtime Error

Solution code:
input_line = input()
last_c = ''
bad = False
for i in range(len(input_line)):
  c = input_line[i]
  if last_c == c:
    print('Bad')
    bad = true
    break
  last_c = c
if not bad:
  print('Good')

Submission status: Runtime Error

Solution code:
pass=input()

x1=pass[0]
x2=pass[1]
x3=pass[2]
x4=pass[3]

res='Good'
if x1=x2: res='Bad'
if x2=x3: res='Bad'
if x3=x4: res='Bad'

print(res)

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0;i<(int)(n);i++)
#define all(x)    (x).begin(),(x).end()
typedef long long ll;
const int MOD = (int)1e9 + 7;

int main(){
  string p;
  cin >> p;
  flag = !((p[0] == p[1])||(p[1]==p[2])||p[2]==p[3]);
  if(flag){
  cout << "No" << endl;
  }
  else{
  cout << "Yes" <<endl;
  } 
}

Submission status: Runtime Error

Solution code:
import fractions
import sys

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)


A,B,C,D = map(int,input().split())
if C == 1 or D == 1:
    print(0)
    sys.exit(0)

E = lcm(C,D)
c = (A-1)//C + 1 if C!=1 else A
d = (A-1)//D + 1 if D!=1 else A
e = (A-1)//E + 1 if E!=1 else A
cde = [[c,C], [d,D], [e,E]]
cnt_cde = []
for x,y in cde:
    if x*y < B:
        cnt_cde.append((B-x*y)//y+1)
    elif x*y == B:
        cnt_cde.append(1)
    else :
        cnt_cde.append(0)
answer = B-A+1-(cnt_cde[0]+cnt_cde[1]-cnt_cde[2])
print(answer)

Submission status: Runtime Error

Solution code:
import math
def Euclidean(x,y):
    if y == 0:
        return x
    else:
        return Euclidean(y,x%y)
         
A,B,C,D = [int(x) for x in input().split()]
count = B - A + 1
E = Euclidean(C,D)
F = C*D/E
         
C_ = math.floor(B/C) - math.floor((A-1)/C)
D_ = math.floor(B/D) - math.floor((A-1)/D)
C_and_D = math.floor(B/F) - math.floor((A-1)/F)
print(count - int(C_ + D_ - C_and_D))

Submission status: Runtime Error

Solution code:
import math
    def Euclidean(x,y):
        if y == 0:
            return x
        else:
            return Euclidean(y,x%y)
     
A,B,C,D = [int(x) for x in input().split()]
count = B - A + 1
E = Euclidean(C,D)
F = C*D/E
     
C_ = math.floor(B/C) - math.floor((A-1)/C)
D_ = math.floor(B/D) - math.floor((A-1)/D)
C_and_D = math.floor(B/F) - math.floor((A-1)/F)
print(count - int(C_ + D_ - C_and_D))

Submission status: Runtime Error

Solution code:
import math

def lcm(x, y):
    return (x * y) // math.gcd(x, y)


A,B,C,D = map(int,input().split())
c = B//C - (A-1)//C
d = B//D - (A-1)//D
E = lcm(C,D)
e = B//E - (A-1)//E
answer = B-A+1-(c+d-e)
print(answer)

Submission status: Runtime Error

Solution code:
from math import gcd
a,b,c,d = map(int, input().split())
c_n = b//c - (a-1)//c
d_n = b//d - (a-1)//d
l = (c*d)//gcd(c,d)
l_n = b//l - (a-1)//l
print(b - a - c_n - d_n + l_n + 1)

Submission status: Runtime Error

Solution code:
a,b,c,d=map(int,input().split())
from fractions import gcd
lcm=(c*d)//gcd(c,d)
n=(b//c)-((a-1)//c)
n+=(b//d)-((a-1)//d)
print(b-a+1-n+((b//lcm)-((a-1)//lcm)))

Submission status: Runtime Error

Solution code:
N , L = map(int, input().split())

list = [L + (i+1)-1 for i in range(N)]

list.sort(key=lambda x:abs(x))

del list[0]
print(list)

Submission status: Runtime Error

Solution code:
import fractions
a,b,c,d = list(map(int, input().split()))
a -= 1
l = c/fractions.gcd(c,d)*d
b = b - b //c - b // d + b //l
a = a - a //c - a // d + a //l
print("{:.0f}".format(b-a))

Submission status: Runtime Error

Solution code:
str = input()
p = ""
resut = "Good"
for s in str:
  if p == s:
    result = "Bad"
  p = s
print(result)

Submission status: Runtime Error

Solution code:
str = input()
p = ""
resut = "Good"
for s in str:
  if p == s:
    result = "Bat"
  p = s
print(result)

Submission status: Runtime Error

Solution code:
str = input()
p = ""
resut = "Good"
for s in str:
  if p == s:
    result = "Bat"
print(result)

Submission status: Runtime Error

Solution code:
a,b,c,d=input().split()
a=int(a)
b=int(b)
c=int(c)
d=int(d)
n=(b)//c-(a-1)//c+b//d-(a-1)//d
f=b//d
g=a//d
i=g

while i<=f:
  if (i*d)>=a and (i*d)%c==0:
    n-=1
  i+=1
n=(b-a+1-n)
print(n)

Submission status: Runtime Error

Solution code:
a,b,c,d = list(map(int,input().split()))
cou = 0
if a is b:
  cou = cou + 1
elif b is c:
   cou = cou + 1
elif c is d:
   cou = cou + 1
else:
  print("Good")
if cou > 0:
  print("Bad")

Submission status: Runtime Error

Solution code:
a,b,c,d = list(map(int,input().split()))
cou = 0
if a is b:
  cou +=1
elif b is c:
  cou +=1
elif c is d:
  cou +=1
else:
  print("Good")
if cou > 0:
  print("Bad")

Submission status: Runtime Error

Solution code:
a,b,c,d=input().split()
a=int(a)
b=int(b)
c=int(c)
d=int(d)
n=(b)//c-a//c+b//d-a//d
f=b//d
g=a//d
i=g

while i<=f:
  if (i*d)%c==0:
    n-=1
  i+=1
n=(b-a+1-n)
print(n)

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
import numpy as np

#N個のリンゴ
#リンゴiの味＝L+i-1

#入力（数値）
spline = input().split()
N = int(spline[0])
L = int(spline[1])

#リンゴの味
taste = []
for i in range(1,N+1): #リンゴNは１から数える
    taste.append(L+i-1)  #味の設定
#print(taste)

#1つも食べなかった場合の味
taste_max = sum(taste)
#print("max"+str(taste_max))


#1つ食べた場合の味のリスト
taste_any = []
for k in range(0,N):
    taste_any.append(sum(taste) - taste[k])
#print(taste_any)

#maxとanyの差
#numpy配列にしてから計算
taste_any = np.asarray(taste_any)
diff = abs(sum(taste) - taste_any)
#numpy配列からリストに戻す（.indexメソッドが使いたいから）
diff_list = diff.tolist()
#print("diff_list"+str(diff_list))
#最小値のインデックスを取得する
coef = diff_list.index(min(diff_list))
#print(coef)

print(taste_any[coef])

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>

using namespace std;

int main(){

    string s;
    cin >> s;

    if (s[0] == s[1] || s[1] == s[2] || s[2] == s[3]){
        cout << "Bad" << endl;
    }
    else{
        cout << "Good" << endl;
    }

    return 0;
}

Submission status: Runtime Error

Solution code:
import math
Input = input()
a, b, c, d = Input.split()
a, b, c, d = int(a), int(b), int(c), int(d)
c_min = int(a/c) if a % c == 0 else int(a/c) + 1
c_max = int(b/c)
delta_c = c_max - c_min + 1
d_min = int(a/d) if a % c == 0 else int(a/d) + 1
d_max = int(b/d)
delta_d = d_max - d_min + 1
cd = int((c * d) / math.gcd(c, d))
cd_min = int(a/cd) if a % c == 0 else int(a/cd) + 1
cd_max = int(b/cd)
delta_cd = cd_max -cd_min + 1
print( b-a+1 - (delta_c + delta_d - delta_cd), end='')

Submission status: Runtime Error

Solution code:
a=list(input())
flag=True
for i in range(len(a)-1):
  if a[i]==a[i+1]:
    print("Bad")
    return
print("Good")

Submission status: Runtime Error

Solution code:
import math
Input = input()
a, b, c, d = Input.split()
a, b, c, d = int(a), int(b), int(c), int(d)
c_min = int(a/c) if a % c == 0 else int(a/c) + 1
c_max = int(b/c)
delta_c = c_max - c_min + 1
d_min = int(a/d) if a % c == 0 else int(a/d) + 1
d_max = int(b/d)
delta_d = d_max - d_min + 1
cd = (c * d) // math.gcd(c, d)
cd_min = int(a/cd) if a % c == 0 else int(a/cd) + 1
cd_max = int(b/cd)
delta_cd = cd_max -cd_min + 1
print( b-a+1 - (delta_c + delta_d - delta_cd), end='')

Submission status: Runtime Error

Solution code:
import math
Input = input()
a, b, c, d = Input.split()
a, b, c, d = int(a), int(b), int(c), int(d)
c_min = int(a/c) if a % c == 0 else int(a/c) + 1
c_max = int(b/c)
delta_c = c_max - c_min + 1
d_min = int(a/d) if a % c == 0 else int(a/d) + 1
d_max = int(b/d)
delta_d = d_max - d_min + 1
def lcm(x, y):
    return (x * y) // math.gcd(x, y)
cd = lcm(c, d)
cd_min = int(a/cd) if a % c == 0 else int(a/cd) + 1
cd_max = int(b/cd)
delta_cd = cd_max -cd_min + 1
print( b-a+1 - (delta_c + delta_d - delta_cd), end='')

Submission status: Runtime Error

Solution code:
from fractions import gcd
A, B, C, D = map(int, input().split())
def solve(N):
    ans = N
    ans -= N//C
    ans -= N//D
    ans += N//(C*D//gcd(C, D))
    return ans
print(solve(B) - solve(A-1))

Submission status: Runtime Error

Solution code:
import math
Input = input()
a, b, c, d = Input.split()
a, b, c, d = int(a), int(b), int(c), int(d)
c_min = int(a/c) if a % c == 0 else int(a/c) + 1
c_max = int(b/c)
delta_c = c_max - c_min + 1
d_min = int(a/d) if a % c == 0 else int(a/d) + 1
d_max = int(b/d)
delta_d = d_max - d_min + 1
def lcm(x, y):
    return (x * y) // math.gcd(x, y)
cd = lcm(c, d)
cd_min = int(a/cd) if a % c == 0 else int(a/cd) + 1
cd_max = int(b/cd)
delta_cd = cd_max -cd_min + 1
num_cd = delta_c + delta_d - delta_cd
print( b-a+1 - num_cd, end='')

Submission status: Runtime Error

Solution code:
import fractions
a, b, c, d = list(map(int, input().split()))
e = c * d // fractions.gcd(c, d)

cko = b//c - (a-1)//c
dko = b//d - (a-1)//d
eko = b//e - (a-1)//e
print(b-a+1-cko-dko+eko)

Submission status: Runtime Error

Solution code:
import fractions
a,b,c,d=map(int, input().split()) 

i = b//c- (a-1)//c
j = b//d- (a-1)//d

f=fractions.gcd(c,d)
f2= c * d / f
k = b//f2 - (a-1)//f2

pot = i + j - k

print(b-(a-1)-pot)

Submission status: Runtime Error

Solution code:
e = list(map(int,input().split()))
a,b,c,d = e

def gcd(x,y):
    while y !=0:
        x,y = y,x%y
    return x

def sums(x):
    S1 = x//c
    S2 = x//d
    S3 = x// (c*d//gcd(c,d))
    return x - S1 - S2 + S3


print(sums(b)-sums(a-1))

Submission status: Runtime Error

Solution code:
n = int(input())
hoge = []

for i in range(n):
    hoge.append(list(map(int, input().split())))
hoge.sort(key = lambda x: x[1])

total = 0
able = True
for i in hoge:
    total += i[0]
    if i[1]<total:
        able = False

if able:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
import fractions
def lcm(x, y):
    return (x*y) // fractions.gcd(x, y)
def main():
    A,B,C,D = map(int,input().split())
    E = lcm(C,D)
    Cc = B // C
    Dd = B // D
    Ee = B // E
    flo = A-1
    Cf = flo // C
    Df = flo // D
    Ef = flo // E
    All = B-(Cc+Dd-Ee)
    Sub = flo-(Cf+Df-Ef)
    print(int(All - Sub))
if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
def saidaikouyaku(a, b):
    if b > a:
        a, b = b, a

    while b != 0:
        a, b=b,(a%b)
    return a

A, B, C, D = map(int, input().split())
hani = B - A + 1
Cnum = int(B / C) - int((A - 1) / C)
Dnum = int(B / D) - int((A - 1) / D)
saisyoukoubai = int(C * D / saidaikouyaku(C, D))
koubainum = int(B / saisyoukoubai) - int((A - 1) / saisyoukoubai)
#print(hani)
#print(Cnum, Dnum, koubainum, saisyoukoubai)
print(hani - Cnum - Dnum + koubainum)

Submission status: Runtime Error

Solution code:
import fractions

ABCD = list(map(int, input().split()))

A = ABCD[0]
B = ABCD[1]
C = ABCD[2]
D = ABCD[3]


def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)


firstC = int((A-1)/C)
firstD = int((A-1)/D)
firstCD = int((A-1)/lcm(C,D))

# if A%lcm(C,D) ==0 and firstCD > 0:
#     firstCD -= 1

endC = int(B/C)
endD = int(B/D)
endCD = int(B/lcm(C,D))

End = B-endC-firstD + endCD
First = (A-1) - firstC - firstD + firstCD



thereC = endC - firstC
thereD = endD - firstD
thereCD = endCD - firstCD

NoP = thereC+thereD - thereCD

# print(thereC)
# print(thereD)
# print(thereCD)
# print(NoP)
print((B-A+1)-NoP)
# print(End-First)

Submission status: Runtime Error

Solution code:
n=int(input())
a=[]
b=[]
gap=0
e=0
f=0
m=0
for i in range(n):
    c,d=map(int,input().split())
    a.append(c)
    b.append(d)
while (gap<=n/9):
    gap=gap*3+1
while (gap>0):
    for i in range(gap,n):
        key=b[i]
        l=a[i]
        if(key<b[i-gap]):
            j=i
            while True:
                b[j]=b[j-gap]
                a[j]=a[j-gap]
                j-=gap
                if(j<gap or key>=b[j-gap]):
                    break
            b[j]=key
            a[j]=l
        gap=int((gap-1)/3)
for i in range(n):
    e+=a[i]
    if(e>b[i]):
        m=1
if(m==1):
    print('No')
else:
    print('Yes')

Submission status: Runtime Error

Solution code:
import fractions
  
A,B,C,D= map(int,input().split())
 
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)
 
CD=lcm(C, D)
 
dc =  B//C -  (A-1)//C
dd = B//D - (A-1)//D
dcd = B//CD - (A-1)//CD
 
print(B-A+1-dc-dd+dcd)

Submission status: Runtime Error

Solution code:
def gcd(a, b):
	while b:
		a, b = b, a % b
	return a
def baisu(x,a):
    return int(x//a)
a,b,c,d = map(int,input().split())

to_a = a - baisu(a,c) - baisu(a,d) + baisu(a,c*d/gcd(c,d))
to_b = b - baisu(b,c) - baisu(b,d) + baisu(b,c*d/gcd(c,d))



if a%c == 0 or a%d == 0:
    print(int(to_b - to_a))
else:
    print(int(to_b-to_a+1))

Submission status: Runtime Error

Solution code:
a = input()

for i in range(3):
  if a[i] == a[i+1]:
    print("Bad")
    return
print("Good")

Submission status: Runtime Error

Solution code:
s = input()
if(s[0] == s[1] or s[1] == s[2] || s[2] == s[3]):print("Bad")
else: print("Good")

Submission status: Runtime Error

Solution code:
import numpy as np


def taste(N, L):
    all_abs = np.array([np.abs(L + i - 1) for i in range(1, N + 1)])
    all_base = np.array([L + i - 1 for i in range(1, N + 1)])

    return all_abs, all_base

N, L = map(int, input().split())

all_abs, all_base = taste(N, L)

N_1_all = all_base[np.min(all_abs) != all_abs]

re = np.sum(N_1_all)
print(re)

Submission status: Runtime Error

Solution code:
import math

X,A=map(int,input().split())

if X<A:
	print(0)
else:
	print(10)

Submission status: Runtime Error

Solution code:
def gcd(a, b):
	while b:
		a, b = b, a % b
	return a
def baisu(x,a):
    return int(x//a)
a,b,c,d = map(int,input().split())

to_a = a - baisu(a,c) - baisu(a,d) + baisu(a,c*d/gcd(c,d))
to_b = b - baisu(b,c) - baisu(b,d) + baisu(b,c*d/gcd(c,d))


if a%c == 0 or a%d == 0:
    print(int(to_b - to_a))
else:
    print(int(to_b-to_a+1))

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
import math
def main():
    A,B,C,D = map(int,input().split())
    E = (C*D)//math.gcd(C,D)
    Cc = B / C
    Dd = B / D
    Ee = B / E
    flo = A-1
    Cf = flo / C
    Df = flo / D
    Ef = flo / E
    All = B-(math.floor(Cc)+math.floor(Dd)-math.floor(Ee))
    Sub = flo-(math.floor(Cf)+math.floor(Df)-math.floor(Ef))
    print(All - Sub)
if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
a, b, c, d = (int(i) for i in input().split())

if a != b:
  if: b != c:
      if: c != d:
          print("Good")
          return 0
        
print("Bad")

Submission status: Runtime Error

Solution code:
n, k= map(int,input().split())
if k > (n-1)+(n-2):
    print(-1)
elif n == 2:
    if k == 0:
        print(1,2)
    else:
        print(-1)
else:
    for i in range(2,n+1):
        print(1,i)
    ima = (n-1)*(n-2) / 2
    #print(ima)
    hajime = 2
    owari = 3
    while(ima > k):
        print(hajime ,owari)
        ima -= 1
        if(owari < n):
            owari += 1
        else:
            hajime += 1
            owari = hajime + 1

Submission status: Runtime Error

Solution code:
from math import ceil,floor
from fractions import gcd

def lcm(x, y):
    return (x * y) // gcd(x, y)

A,B,C,D = map(int,input().split())

ans = B-A+1
ans -= (B//C - ceil(A/C) + 1)
ans -= (B//D - ceil(A/D) + 1)
ans += (B//lcm(C,D) - ceil(A/lcm(C,D)) + 1)

print(ans)

Submission status: Runtime Error

Solution code:
S=input()
S=list(S)
for i in range(len(S)-1):
  if S[i] == S[i+1]:
	print("Bad")
  else:
    print("Good")

Submission status: Runtime Error

Solution code:
S=int(input())
S=list(S)
for i in range(len(S)-1):
  if S[i] == S[i+1]:
	print("Bad")
  else:
    print("Good")

Submission status: Runtime Error

Solution code:
code = str(input())

for i, s in enumerate(code):
  if i != 0:
  	if s == pre:
      print("Bad")
      exit()
  pre = s
  
print("Good")

Submission status: Runtime Error

Solution code:
def gcd(a, b):
	while b:
		a, b = b, a % b
	return a
def baisu(x,a):
    if x%a ==0:
        return int(x//a)
    else:
        x -=1
        return baisu(x,a)

a,b,c,d = map(int,input().split())

to_a = a - baisu(a,c) - baisu(a,d) + baisu(a,c*d/gcd(c,d))
to_b = b - baisu(b,c) - baisu(b,d) + baisu(b,c*d/gcd(c,d))


print(int(to_b-to_a+1))