Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
s=list(input())
fld="WA"
if s[0]=="A":
  if "C" in s[2:len(s)-1]:
    s.remove("A")
    s.remove("C")
    s=' '.join(s)
    if s.islower()==True:
      flg="AC"

print(flg)


Fixed submission:
s = list(input())
flg = 'WA'
if s[0] == 'A':
    if 'C'in s[2:len(s)-1]:
        s.remove('A')
        s.remove('C')
        s = ''.join(s)
        if s.islower() == True:
            flg = 'AC'
print(flg)

Buggy python submission (verdict: Runtime Error):
s=list(input())
fld="WA"
if s[0]=="A":
  if "C" in s[2:len(s)-1]:
    s.remove("A")
    s.remove("C")
    s=''.join(s)
    if s.islower()==True:
      flg="AC"

print(flg)

Fixed submission:
s = list(input())
flg = 'WA'
if s[0] == 'A':
    if 'C'in s[2:len(s)-1]:
        s.remove('A')
        s.remove('C')
        s = ''.join(s)
        if s.islower() == True:
            flg = 'AC'
print(flg)
Buggy python submission (verdict: Runtime Error):
n=int(input())
s=0
if 1<=n<10:
  print("Yes")
  exit()
else:
  while n>10:
    s+=n%10
    n//=10
  if n%s==0:
    print("Yes")
    exit()

print("No")

Fixed submission:
n=str(input())
s=0
for i in range(len(n)):
  s+=int(n[i])

n=int(n)
if n%s==0:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
s=str(input())
e=["0",'1','2','3','4','5','6','7','8','9']
for i in range(len(s)):
  if a=i:
    if s[i]!='-':
      print("No")
      exit()
  else:
    if s[i] not in e:
      print("No")
      exit()

print("Yes")


Fixed submission:
a,b=map(int,input().split())
s=str(input())
e=["0",'1','2','3','4','5','6','7','8','9']
for i in range(len(s)):
  if a==i:
    if s[i]!='-':
      print("No")
      exit()
  else:
    if s[i] not in e:
      print("No")
      exit()

print("Yes")

Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
s=str(input())
e=[0,1,2,3,4,5,6,7,8,9]
for i in range(len(s)):
  if a=i:
    if s[i]!='-':
      print("No")
      exit()
  else:
    if s[i] not in e:
      print("No")
      exit()

print("Yes")

Fixed submission:
a,b=map(int,input().split())
s=str(input())
e=["0",'1','2','3','4','5','6','7','8','9']
for i in range(len(s)):
  if a==i:
    if s[i]!='-':
      print("No")
      exit()
  else:
    if s[i] not in e:
      print("No")
      exit()

print("Yes")
Buggy python submission (verdict: Runtime Error):
n=int(input())
L=[]
L.append(2)
L.append(1)
for i in range(3,n+1):
  x=L[i-1]+L[i-2]
  L.append(x)

print(L[n])

Fixed submission:
n=int(input())
l=[0 for i in range(n+1)]
l[0]=2
l[1]=1
for j in range(2,n+1):
  l[j]=l[j-1]+l[j-2]
print(l[n])
Buggy python submission (verdict: Time Limit Exceeded):
x,y,z=map(int,input().split())
while True:
  n=0
  if n*y+(n+1)*z>x:
    print(n-1)
    exit()
  n+=1

Fixed submission:
x,y,z=map(int,input().split())
n=0
while True:
  if n*y+(n+1)*z>x:
    print(n-1)
    exit()
  n+=1

Buggy python submission (verdict: Runtime Error):
x,y,z=int(input().split())
while True:
  n=0
  if n*y+(n+1)*z>x:
    print(n-1)
    exit()
  n+=1

Fixed submission:
x,y,z=map(int,input().split())
n=0
while True:
  if n*y+(n+1)*z>x:
    print(n-1)
    exit()
  n+=1
Buggy python submission (verdict: Runtime Error):
r=int(input())
g=int(input())
print(2g-r)

Fixed submission:
r=int(input())
g=int(input())
print(2*g-r)
Buggy python submission (verdict: Runtime Error):
h,w = map(int,input().split())
l = [["."]*(w+2)]
for i in range(h):
    l.append(["."] + [i for i in input()] + ["."])
l.append(["."]*(w+2))
 
def count(i,j):
    if l[i][j] == "#":
        return "#"
    c = 0
    for n in range(i-1,i+2):
        for m in range(j-1,j+2):
            if l[n][m] == "#":
                c += 1
    return str(c)
 
ans = ["".join([count(i,j) for j in range(1,1+w)]) for i in range(1,1+h)]
 
print("\n".join(ans))
h,w = map(int,input().split())
l = [["."]*(w+2)]
for i in range(h):
    l.append(["."] + [i for i in input()] + ["."])
l.append(["."]*(w+2))

def count(i,j):
    if l[i][j] == "#":
        return "#"
    c = 0
    for n in range(i-1,i+2):
        for m in range(j-1,j+2):
            if l[n][m] == "#":
                c += 1
    return str(c)

ans = ["".join([count(i,j) for j in range(1,1+w)]) for i in range(1,1+h)]

print("\n".join(ans))



Fixed submission:
h,w = map(int,input().split())
l = [["."]*(w+2)]
for i in range(h):
    l.append(["."] + [i for i in input()] + ["."])
l.append(["."]*(w+2))
 
def count(i,j):
    if l[i][j] == "#":
        return "#"
    c = 0
    for n in range(i-1,i+2):
        for m in range(j-1,j+2):
            if l[n][m] == "#":
                c += 1
    return str(c)
 
ans = ["".join([count(i,j) for j in range(1,1+w)]) for i in range(1,1+h)]
 
print("\n".join(ans))

Buggy python submission (verdict: Runtime Error):
h,w=map(int,input().split())
l=[["."*(w+2)]]
for i in range(h):
  l.append(["."]+[i for i in input()]+["."])
l.append(["."]*(w+2))

def count(i,j):
  if l[i][j]=="#":
    return "#"
  c=0
  for n in range(i-1,i+2):
    for m in range(j-1,j+2):
      if l[n][m]=="#":
        c+=1
  return str(c)

ans=["".join([count(i,j) for j in range(1,1+w)]) for i in range(1,1+h)]

print("\n".join(ans))

Fixed submission:
h,w = map(int,input().split())
l = [["."]*(w+2)]
for i in range(h):
    l.append(["."] + [i for i in input()] + ["."])
l.append(["."]*(w+2))
 
def count(i,j):
    if l[i][j] == "#":
        return "#"
    c = 0
    for n in range(i-1,i+2):
        for m in range(j-1,j+2):
            if l[n][m] == "#":
                c += 1
    return str(c)
 
ans = ["".join([count(i,j) for j in range(1,1+w)]) for i in range(1,1+h)]
 
print("\n".join(ans))
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
if n==1:
  print(1)
  exit()
a.sort()
b=[]
for i in range(a[0],a[n-1]-1):
  ans=0
  ans+=a.count(i)+a.count(i+1)+a.count(i+2)
  b.append(ans)

b.sort()
print(b[-1])

Fixed submission:
import collections
n=int(input())
a=list(map(int,input().split()))
a1=[x-1 for x in a]
a2=[x+1 for x in a]
b=a+a1+a2
c=collections.Counter(b)

print(max(c.values()))
Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int,input().split())
x=[]
y=[]
for i in range(m):
  a,b=map(int,input().split())
  if a==1:
    x.append(b)
  elif b==n:
    y.append(a)

if len(x)==0 or len(y)==0:
  print("IMPOSSIBLE")
  exit()

ans="IMPOSSIBLE"

for i in range(len(y)):
  if y[i] in x:
    ans="POSSIBLE"

print(ans)

Fixed submission:
n,m=map(int,input().split())
data=[0]*n
for i in range(m):
  a,b=map(int,input().split())
  if a==1:
    data[b-1]+=1
    if data[b-1]==2:
      print('POSSIBLE')
      exit()
  if b==n:
    data[a-1]+=1
    if data[a-1]==2:
      print('POSSIBLE')
      exit()

print('IMPOSSIBLE')

Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int,input().split())
x=[]
y=[]
for i in range(m):
  a,b=map(int,input().split())
  if a==1:
    x.append(b)
  elif b==n:
    y.append(a)

ans="IMPOSSIBLE"

for i in range(len(y)):
  if y[i] in x:
    ans="POSSIBLE"

print(ans)

Fixed submission:
n,m=map(int,input().split())
data=[0]*n
for i in range(m):
  a,b=map(int,input().split())
  if a==1:
    data[b-1]+=1
    if data[b-1]==2:
      print('POSSIBLE')
      exit()
  if b==n:
    data[a-1]+=1
    if data[a-1]==2:
      print('POSSIBLE')
      exit()

print('IMPOSSIBLE')

Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int,input().split())
x=[]
y=[]
for i in range(m):
  a,b=map(int,input().split())
  if a==1:
    x.append(b)
  elif b==n:
    y.append(a)

ans="IMPOSSIBLE"

for i in range(len(x)):
  if x[i] in y:
    ans="POSSIBLE"

print(ans)

Fixed submission:
n,m=map(int,input().split())
data=[0]*n
for i in range(m):
  a,b=map(int,input().split())
  if a==1:
    data[b-1]+=1
    if data[b-1]==2:
      print('POSSIBLE')
      exit()
  if b==n:
    data[a-1]+=1
    if data[a-1]==2:
      print('POSSIBLE')
      exit()

print('IMPOSSIBLE')

Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int,input().split())
x=[]
y=[]
for i in range(m):
  a,b=map(int,input().split())
  if a==1:
    x.append(b)
  elif b==n:
    y.append(a)

ans="IMPOSSIBLE"

for i in range(len(x)):
  if x[i] in y:
    ans="POSSIBLE"

print(ans)

Fixed submission:
n,m=map(int,input().split())
data=[0]*n
for i in range(m):
  a,b=map(int,input().split())
  if a==1:
    data[b-1]+=1
    if data[b-1]==2:
      print('POSSIBLE')
      exit()
  if b==n:
    data[a-1]+=1
    if data[a-1]==2:
      print('POSSIBLE')
      exit()

print('IMPOSSIBLE')
Buggy python submission (verdict: Runtime Error):
s=str(input())
flag=0
for i in range(len(s)):
  s=s[:len(s)-2*i]
  for j in range(len(s)//2):
    if s[j]!=s[len(s)-j]:
      flag=1
      break
  if flag==0:
    print(len(s))
    exit()
  else:
    flag=0
    continue

Fixed submission:
s=str(input())
flag=0
for i in range(1,len(s)):
  s=s[:len(s)-2]
  for j in range(len(s)//2):
    if s[j]!=s[len(s)//2+j]:
      flag=1
      break
  if flag==0:
    print(len(s))
    exit()
  else:
    flag=0
    continue
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=[]
t=[]
t.append(1)
for i in range(n):
  a.append(input())

x=a[0]
while True:
  if x==2:
    print(len(t))
    break
  elif x in t:
    print(-1)
    break
  else:
    t.append(x)
    y=x
    x=a[y-1]


Fixed submission:
n=int(input())
a=[int(input()) for i in range(n)]
ans=1
res=1
for i in range(n):
  if a[res-1]==2:
    print(ans)
    exit()
  else:
    ans+=1
    res=a[res-1]

print(-1)

Buggy python submission (verdict: Runtime Error):
n=int(input())
a=[]
t=[]
t.append(1)
for i in range(n):
  a.append(input())

x=a[0]
while True:
  if x==2:
    print(len(t))
    exit()
  elif x in t:
    print(-1)
    exit()
  else:
    x=a[x-1]

Fixed submission:
n=int(input())
a=[int(input()) for i in range(n)]
ans=1
res=1
for i in range(n):
  if a[res-1]==2:
    print(ans)
    exit()
  else:
    ans+=1
    res=a[res-1]

print(-1)
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
a.sort()
print(a[n-1]a[0])

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
a.sort()
print(a[n-1]-a[0])
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
a1=0
b=0
c=0
d=0
e=0
f=0
g=0
h=0
ans=0
for i in range(n):
  if 1<=a[i]<=399:
    a1=1
  elif 400<=a[i]<=799:
    b=1
  elif 800<=a[i]<=1199:
    c=1
  elif 1200<=a[i]<=1599:
    d=1
  elif 1600<=a[i]<=1999:
    e=1
  elif 2000<=a[i]<=2399:
    f=1
  elif 2400<=a[i]<=2799:
    g=1
  elif 2800<=a[i]<=3199:
    h=1
  else:
    ans+=1

x=a1+b+c+d+e+f+g+h
if a1=b=c=d=e=f=g=h=0:
  print(1,ans)
else:
  print(x,x+ans)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
a1=0
b=0
c=0
d=0
e=0
f=0
g=0
h=0
ans=0
for i in range(n):
  if 1<=a[i]<=399:
    a1=1
  elif 400<=a[i]<=799:
    b=1
  elif 800<=a[i]<=1199:
    c=1
  elif 1200<=a[i]<=1599:
    d=1
  elif 1600<=a[i]<=1999:
    e=1
  elif 2000<=a[i]<=2399:
    f=1
  elif 2400<=a[i]<=2799:
    g=1
  elif 2800<=a[i]<=3199:
    h=1
  else:
    ans+=1

x=a1+b+c+d+e+f+g+h
if a1==b==c==d==e==f==g==h==0:
  print(1,ans)
else:
  print(x,x+ans)
Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
a_s=[]
b_s=[]
for i in range(m):
  a,b=map(int,input().split())
  a_s.append(a)
  b_s.append(b)

for i in range(1,N+1):
  print(a_s.count(i)+b_s.count(i))

Fixed submission:
n,m=map(int,input().split())
a_s=[]
b_s=[]
for i in range(m):
  a,b=map(int,input().split())
  a_s.append(a)
  b_s.append(b)

for i in range(1,n+1):
  print(a_s.count(i)+b_s.count(i))
Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
s[0]*10**5
for i in range(n):
  a,b=map(int,input().split())
  s[a-1]+=b
i=0
while k>0:
  k-=s[i]
  i+=1
print(i)

Fixed submission:
n,k=map(int,input().split())
s=[0]*10**5
for i in range(n):
    a,b=map(int,input().split())
    s[a-1]+=b
i=0
while k>0:
    k-=s[i]
    i+=1
print(i)
Buggy python submission (verdict: Runtime Error):
,b,c=map(int,input().split())
s={}
while True:
  if a%b==c:
    print("YES")
    break
  elif (a%b) in s:
    print("NO")
    break
  else:
    s.add((a%b))
    a+=a

Fixed submission:
a,b,c=map(int,input().split())
ans="NO"
for i in range(1,b+1):
  if a*i%b==c:
    ans="YES"
    break

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
k,s=map(int,input().split())
ans=0
for i in range(k+1):
  for j in range(k+1):
    for x in range(k+1):
      if i+j+x==s:
        ans+=1

print(ans)

Fixed submission:
k,s=map(int,input().split())
cnt=0
for i in range(k+1):
  for j in range(k+1):
    if 0<=s-(i+j)<=k:
      cnt+=1

print(cnt)
Buggy python submission (verdict: Runtime Error):
a,b,c=map(input().split())
if b=="+":
  print(a+b)
else:
  print(a-b)

Fixed submission:
a,op,b=map(str,input().split())
a=int(a)
b=int(b)
if op=="+":
  print(a+b)
else:
  print(a-b)
Buggy python submission (verdict: Runtime Error):
n=int(input())
t=list(map(int,input().split()))
m=int(input())
for i in range(m):
  p,x=map(int,input().split())
  y=t[p-1]
  t[p-1]=x:
  print(sum(t))
  t[p-1]=y

Fixed submission:
n=int(input())
t=list(map(int,input().split()))
m=int(input())
for i in range(m):
  p,x=map(int,input().split())
  y=t[p-1]
  t[p-1]=x
  print(sum(t))
  t[p-1]=y
Buggy python submission (verdict: Runtime Error):
n=int(input())
*A=sorted(map(int,input().split()))

a=True
if n%2==0:
  for i in range(1,n,2):
    if A[i-1]!=i or A[i]!=i:
      a=False
      break
else:
  if A[0]!=0:a=False
  else:
    for i in range(2,n,2):
      if A[i-1]!=i or A[i]!=i:
        a=False
        break
print(2**(n//2)%(10**9+7) if a else 0)


Fixed submission:
N=int(input())
*A,=sorted(map(int,input().split()))
 
a=True
if N%2==0:
 for i in range(1,N,2):
  if A[i-1]!=i or A[i]!=i:
    a=False
    break
else:
 if A[0]!=0:a=False
 else:
    for i in range(2,N,2):
     if A[i-1]!=i or A[i]!=i:
        a=False
        break
print(2**(N//2)%(10**9+7) if a else 0)
Buggy python submission (verdict: Runtime Error):
h,w=int(input())
for i in range(h):
  s=input()
  print(s)
  print(s)

Fixed submission:
h,w=map(int,input().split())
for i in range(h):
  c=input()
  print(c)
  print(c)
Buggy python submission (verdict: Time Limit Exceeded):
a,b,x=map(int,input().split())
for i in range(a,b+1):
  if i%x==0:
    y=(b-i)//x
    print(y+1)
    exit()

print(0)

Fixed submission:
a,b,x=map(int,input().split())
bb=b//x
aa=a//x
ans=bb-aa
if a%x==0:
  ans+=1
print(ans)
Buggy python submission (verdict: Runtime Error):
s={'a': input(), 'b': input(), 'c' input()}
now='a'
while s[now]!="":
  next =s[now][0]
  s[now]=s[now][1:]
  now= next
print(now.upper())

Fixed submission:
s = {'a': input(), 'b': input(), 'c': input()}
 
now = 'a'
while s[now] != '':
    next = s[now][0]
    s[now] = s[now][1:]
    now = next
print(now.upper())

Buggy python submission (verdict: Runtime Error):
a=str(input())
b=str(input())
c=str(input())
x=a[1]
a=a[1:]
while True:
  if x=='a':
    x=a[1]
    a=a[1:]
    if len(a)==0:
      print("A")
      break
  elif x=='b':
    x=b[1]
    b=b[1:]
    if len(b)==0:
      print("B")
      break
  else:
    x=c[1]
    c=c[1:]
    if len(c)==0:
      print("C")
      break

Fixed submission:
s = {'a': input(), 'b': input(), 'c': input()}
 
now = 'a'
while s[now] != '':
    next = s[now][0]
    s[now] = s[now][1:]
    now = next
print(now.upper())
Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
if a==b==5 and c==7:
  print('YES')
elif a==c==5 and b==7:
  print('YES')
elif b==c==5 amd c==7:
  print("YES")
else:
  print('NO')

Fixed submission:
a,b,c=map(int,input().split())
if a==b==5 and c==7:
  print('YES')
elif a==c==5 and b==7:
  print('YES')
elif b==c==5 and a==7:
  print("YES")
else:
  print('NO')
Buggy python submission (verdict: Time Limit Exceeded):
l = list(map(int,input().split()))
a = l[0]
b = l[1]
n = l[2]

def floor(a,b,x):
    p = (a*x)//b - a*(x//b)
    return p

max = 0
if n <= b-1:
    max = floor(a,b,n)
else:
    for i in range(b-1,n+1,b):
        c = floor(a,b,i)
        if c >= max:
            max = c

print(max)

Fixed submission:
l = list(map(int,input().split()))
a = l[0]
b = l[1]
n = l[2]

def floor(a,b,x):
    p = (a*x)//b - a*(x//b)
    return p

max = 0
if b == 1:
    max = 0
elif n <= b-1:
    max = floor(a,b,n)
elif n > b-1:
    for i in range(b-1,n+1,b):
        c = floor(a,b,i)
        if c >= max:
            max = c

print(max)

Buggy python submission (verdict: Time Limit Exceeded):
l = list(map(int,input().split()))
a = l[0]
b = l[1]
n = l[2]

def floor(a,b,x):
    p = (a*x)//b - a*(x//b)
    return p

max = 0
if n < b-1:
    max = floor(a,b,n)
else:
    for i in range(b-1,n+1,b):
        c = floor(a,b,i)
        if c >= max:
            max = c

print(max)

Fixed submission:
l = list(map(int,input().split()))
a = l[0]
b = l[1]
n = l[2]

def floor(a,b,x):
    p = (a*x)//b - a*(x//b)
    return p

max = 0
if b == 1:
    max = 0
elif n <= b-1:
    max = floor(a,b,n)
elif n > b-1:
    for i in range(b-1,n+1,b):
        c = floor(a,b,i)
        if c >= max:
            max = c

print(max)

Buggy python submission (verdict: Time Limit Exceeded):
l = list(map(int,input().split()))
a = l[0]
b = l[1]
n = l[2]

def floor(a,b,x):
    p = (a*x)//b - a*(x//b)
    return p

max = 0
if n < b-1:
    for i in range(n+1):
        c = floor(a,b,i)
        if c >= max:
            max = c
else:
    for i in range(b-1,n+1,b):
        c = floor(a,b,i)
        if c >= max:
            max = c

print(max)

Fixed submission:
l = list(map(int,input().split()))
a = l[0]
b = l[1]
n = l[2]

def floor(a,b,x):
    p = (a*x)//b - a*(x//b)
    return p

max = 0
if b == 1:
    max = 0
elif n <= b-1:
    max = floor(a,b,n)
elif n > b-1:
    for i in range(b-1,n+1,b):
        c = floor(a,b,i)
        if c >= max:
            max = c

print(max)
Buggy python submission (verdict: Runtime Error):
n = int(input())

total = 0

for i in range(n):
  if (i+1)%3 != 0 and (i+!)%5 != 0:
    total += i+1
    
print(total)

Fixed submission:
n = int(input())

total = 0

for i in range(n):
  if (i+1)%3 != 0 and (i+1)%5 != 0:
    total += i+1
    
print(total)
Buggy python submission (verdict: Time Limit Exceeded):
import math

n=int(input())
total=0

for i in range(n):
  for j in range(n):
    for k in range(n):
      gcdij=math.gcd(i+1,j+1)
      gcd=math.gcd(gcdij,k+1)
      total+=gcd
      
print(total)

Fixed submission:
n=int(input())

total=0

for i in range(n):
  #print(f'i+1={i+1}')
  j=i
  while j<n:
    #print(f'j+1={j+1}')
    k=j
    while k<n:
      #print(f'k+1={k+1}')
      kouho=min(i+1,j+1,k+1)
      while True:
        #kouhoが最大公約数の時
        if (i+1)%kouho==0 and (j+1)%kouho==0 and (k+1)%kouho==0:
          #３つとも同じ数字
          if i==j and j==k:
            total+=kouho
          #２つのみ同じ数字
          elif i==j or j==k or k==i:
            total+=kouho*3
          #同じ数字がない時
          else:
            total+=kouho*6
          break
        else:
          kouho -= 1
      k+=1
    j+=1
          
print(total)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())

total=0

for i in range(n):
  #print(f'i+1={i+1}')
  j=i
  while j<n:
    #print(f'j+1={j+1}')
    k=j
    while k<n:
      #print(f'k+1={k+1}')
      kouho=min(i+1,j+1,k+1)
      while True:
        #kouhoが最大公約数の時
        if (i+1)%kouho==0 and (j+1)%kouho==0 and (k+1)%kouho==0:
          #３つとも同じ数字
          if i==j and j==k:
            total+=kouho
          #２つのみ同じ数字
          elif i==j or j==k or k==i:
            total+=kouho*3
          #同じ数字がない時
          else:
            total+=kouho*6
          break
        else:
          kouho -= 1
      k+=1
    j+=1
          
print(total)

Fixed submission:
n=int(input())

total=0

for i in range(n):
  #print(f'i+1={i+1}')
  j=i
  while j<n:
    #print(f'j+1={j+1}')
    k=j
    while k<n:
      #print(f'k+1={k+1}')
      kouho=min(i+1,j+1,k+1)
      while True:
        #kouhoが最大公約数の時
        if (i+1)%kouho==0 and (j+1)%kouho==0 and (k+1)%kouho==0:
          #３つとも同じ数字
          if i==j and j==k:
            total+=kouho
          #２つのみ同じ数字
          elif i==j or j==k or k==i:
            total+=kouho*3
          #同じ数字がない時
          else:
            total+=kouho*6
          break
        else:
          kouho -= 1
      k+=1
    j+=1
          
print(total)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
s=input()

count=0

i=0
while i < n:
  si = s[i]
  j = i + 1
  while j < n:
    sj = s[j]
    if si != sj:
      k = j + 1
      while k < n:
        sk = s[k]
        if si != sk and sj != sk and (j - i) != (k - j):
          count += 1
        k += 1
    j += 1
  i += 1
  
print(count)

Fixed submission:
n=int(input())
s=input()

r=0
g=0
b=0
count=0

for i in s:
  if i == "R":
    r += 1
  elif i == "G":
    g += 1
  elif i == "B":
    b += 1

count = r*g*b

# k-j==j-iの場合を引く
for i in range(n-2):
  si = s[i]
  for j in range(i+1,i+(n-i-1)//2+1):
    if si != s[j]:
      sj = s[j]
      k = j+(j-i)
      if s[k] != si and s[k] != sj:
        count -= 1
        
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
s=input()

count=0

i=0
while i < n:
  si = s[i]
  j = i + 1
  while j < n:
    sj = s[j]
    if si != sj:
      k = j + 1
      while k < n:
        sk = s[k]
        if si != sk and sj != sk and (j - i) != (k - j):
          count += 1
        k += 1
    j += 1
  i += 1
  
print(count)

Fixed submission:
n=int(input())
s=input()

r=0
g=0
b=0
count=0

for i in s:
  if i == "R":
    r += 1
  elif i == "G":
    g += 1
  elif i == "B":
    b += 1

count = r*g*b

# k-j==j-iの場合を引く
for i in range(n-2):
  si = s[i]
  for j in range(i+1,i+(n-i-1)//2+1):
    if si != s[j]:
      sj = s[j]
      k = j+(j-i)
      if s[k] != si and s[k] != sj:
        count -= 1
        
print(count)
Buggy python submission (verdict: Runtime Error):
a = input()
b1 = a // 10
b2 = a % 1000
if (b1 * b2) % 111 == 0:
	print(Yes)
else:
	print(No)

Fixed submission:
a = int(input())
b1 = a // 10
b2 = a % 1000
if (b1 * b2) % 111 == 0:
	print("Yes")
else:
	print("No")
Buggy python submission (verdict: Time Limit Exceeded):
k=int(input())


k9=k*9
l=10
for n in range(1,k9+5):
    if l*7%k9==7%k9:
        print(n)
        break
    l=l*10%k9
else:
    print(-1)

Fixed submission:
k=int(input())
k9=k*9
l=10
for n in range(1,k+5):
    if l*7%k9==7%k9:
        print(n)
        break
    l=l*10%k9
else:
    print(-1)