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

Fixed submission:
def main(n):
    c=[[0]*10 for _ in range(10)]
    for k in range(1,n+1):
        n=str(k)
        i = int(n[0])
        j = int(n[-1])
        c[i][j] += 1
    ans =0
    for i in range(10):
        for j in range(10):
            ans+=c[i][j]*c[j][i]
    print(ans)
             
if __name__=='__main__':
    main(int(input()))

Buggy submission (verdict: Runtime Error):
def main(n):
    cnt=0
    for i in range(1,n+1):
        i_list=list(str(i))
        for j in range(1,n+1):
            j_list=list(str(j))
            if i_list[1]==j_list[-1] and i_list[-1]==j_list[1]:
                cnt+=1
    print(cnt)        
        

    
if __name__=='__main__':
    main(int(input()))
Problem p02829 (python)

Fixed submission:
a=int(input())
b=int(input())

c=[1,2,3]
c[a-1]=0
c[b-1]=0

print(max(c))

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
i,k=0,1
while i<n:
  if a[i]==k:
    k+=1
    i+=1
  else:
    i+=1
if k==1:
  print(-1)
else:
  print(n-k+1)
Problem p02831 (python)

Fixed submission:
a,b=map(int,input().split())

def lcm(x, y):
 
   #  获取最大的数
   if x > y:
       lower = y
   else:
       lower = x
 
   while(True):
       if((x % lower == 0) and (y % lower == 0)):
           lcm = x*y//lower
           break 
       lower -= 1
 
   return lcm
print(lcm(a,b))

Buggy submission (verdict: Runtime Error):
a, b=map(int,input().split())
print(gcd(a,b))
Problem p02859 (python)

Fixed submission:
print(int(input())**2)

Buggy submission (verdict: Runtime Error):
print((int(input())**2)
Problem p02862 (python)

Fixed submission:
x,y=map(int,input().split());n=0;mod=10**9+7;ans=0
if not (x+y)%3:
  n=(x+y)//3;x-=n;y-=n
  if x>=0 and y>=0:
    ans=1
    for i in range(x):ans=ans*(n-i)*pow(i+1,mod-2,mod)%mod
print(ans)

Buggy submission (verdict: Runtime Error):
def gho1(x):
  g=1
  for i in range(1,x+1):
    g*=i
  return g
def gho2(x):
  g=1
  for i in range(1,x+1):
    g*=i;g=g%(10**9+7)
  return g

q,w=map(int,input().split())
e,d=divmod((2*w-q),3)
r,f=divmod((2*q-w),3)

if d!=0 or f!=0:print(0)
else:
  print((gho(e+r)//(gho(e)*gho(r)))%(10*9+7))
Problem p02912 (python)

Fixed submission:
import heapq
def main():
    n,m=map(int, input().split()) 
    a = list(map(lambda x: int(x)*(-1), input().split())) 
    heapq.heapify(a)

    for i in range(m):
        tmp_min = heapq.heappop(a)
        heapq.heappush(a, -1*(-tmp_min//2))
    print(-sum(a))

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import heapq
def main():
    n,m=map(int, input().split()) 
    a = [map(lambda x: int(x)*(-1), input().split())] 
    heapq.heapify(a)

    for i in range(m):
        tmp_min = heapq.heappop(a)
        heapq.heappush(a, -1*(-tmp_min//2))
    print(-sum(a))

if __name__ == '__main__':
    main()
Problem p02916 (python)

Fixed submission:
n=int(input())
def lima():
    return list(map(int,input().split()))

a=lima()
b=lima()
c=lima()

sum=sum(b)
for i in range(n-1):
    if a[i]+1==a[i+1]:
        sum+=c[a[i]-1]        
print(sum)

Buggy submission (verdict: Runtime Error):
n=int(input())
def lima():
    return list(map(int,input().split()))

a=lima()
b=lima()
c=lima()

sum=0
for i in range(n-1):
    sum+=b[a[i]-1]+c[a[i]-1]*(a[i]+1==a[i+1])

print(sum)
Problem p02935 (python)

Fixed submission:
N=int(input())
v=list(map(float,input().split())) 
v.sort()
for i in range(N):
    v[i]/=2**(N-i)

print(sum(v)+v[0])

Buggy submission (verdict: Runtime Error):
N=int(input())
v=list(map(float,input().split())) 
v.sort()
for i in range(N):
    v/=2**(N-i)

print(sum(v)+v[0])
Problem p03017 (python)

Fixed submission:
int1 = lambda x: int(x) - 1
N, A, B, C, D = map(int1, input().split())
S = input()

if "##" not in S[A:B+1] and "##" not in S[C:D+1]:
    if C > D and "..." not in S[B-1:D+2]:
        print("No")
    else:
        print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
n,a,b,c,d=map(int,input().split())
a-=1;b-=1;c-=1;d-=1 
from collections import deque 

queueA=deque([a])
queueB=deque([b])
S=input()
JinA=JinB=[0]*n 
if c<b or c<d:
    for i in range(a,d):
        if S[i]=="#" and S[i+1]=="#":
            print("No")
            exit() 
    else:
        print("Yes")
        exit()
    
else:
    for j in range(min(a,c),max(a,c)):
        if S[i]=="#" and S[i+1]=="#":
            print("No")
            exit() 
    for j in range(min(b,d),max(b,d)):
        if S[i]=="#" and S[i+1]=="#":
            print("No")
            exit() 
    for i in range(n-2):
        if S[i]==S[i+1]==S[i+2]==".":
            print("Yes")
            exit()
    else:
        print('No')

Buggy submission (verdict: Runtime Error):
n,a,b,c,d=map(int,input().split())
a-=1;b-=1;c-=1;d-=1 
from collections import deque 

queueA=deque([a])
queueB=deque([b])
S=input()
JinA=JinB=[0]*n 
if c<b or c<d:
    for i in range(a,d):
        if S[i]=="#" and S[i+1]=="#":
            print("No")
            exit() 
    else:
        print("Yes")
        exit()
    
else:
    for j in range(a,max(c,d)):
        if S[i]=="#" and S[i+1]=="#":
            print("No")
            exit() 
    for i in range(n-2):
        if S[i]==S[i+1]==S[i+2]==".":
            print("Yes")
            exit()
    else:
        print('No')
Problem p03038 (python)

Fixed submission:
from operator import itemgetter

N, M = list(map(int, input().split()))
A = [[1, a] for a in list(map(int, input().split()))]
BC = [list(map(int, input().split())) for i in range(M)]

q = sorted(A+BC, key=itemgetter(1), reverse=True)

ans = 0
i = 0

while N:
    n = min(q[i][0], N)
    ans += q[i][1] * n
    N -= n
    i += 1
print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np
import bisect
N,M=map(int,input().split())
A=np.array(list(map(int,input().split())))
JinA=[]
for i in range(M):
    b,c=map(int,input().split())
    JinA.append((c,b))

JinA.sort(reverse=True)

A.sort()
len_b=0
new_list=[]
for c,b in JinA:
    add_b=min(b,N-len_b)
    new_list+=[c]*add_b
    if add_b==0:
        break
new_list+=[0]*(N-len(new_list))
now=np.array(new_list)    
Ans=np.maximum(A,now)
print(Ans.sum())

Buggy submission (verdict: Runtime Error):
import numpy as np
import bisect
N,M=map(int,input().split())
A=np.array(list(map(int,input().split())))
JinA=[]
for i in range(M):
    b,c=map(int,input().split())
    JinA.append((c,b))

JinA.sort(reverse=True)

A.sort()
len_b=0
new_list=[]
for c,b in JinA:
    add_b=min(b,N-len_b)
    new_list+=[c]*add_b
    
now=np.array(new_list)    
Ans=np.maximum(A,now)
print(Ans.sum())

Buggy submission (verdict: Runtime Error):
import numpy as np
import bisect
N,M=map(int,input().split())
A=np.array(list(map(int,input().split())))
JinA=[]
for i in range(M):
    b,c=map(int,input().split())
    JinA.append((c,b))

JinA.sort(reverse=True)

A.sort()
len_b=0
new_list=[]
for c,b in JinA:
    add_b=min(b,N-len_b)
    new_list+=[c]*add_b
    
now=np.array(new_list)    
Ans=np.minimum(A,now)
print(Ans.sum())
Problem p03041 (python)

Fixed submission:
n,k= map(int,input().split())
s=input()
print(s[:k-1] + s.lower()[k-1] + s[k:n])

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
s=input()
s[k-1]=s[k-1].lower()
print(s)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
s=input()
s[k-1]=s[k-1].lower
print(s)
Problem p03045 (python)

Fixed submission:
n,m=map(int,input().split())
    
root=[int(i) for i in range(n)] 
rank=[0]*n    
def find(x):
    if root[x]==x:
        return x 
    else:
        return find(root[x])

for i in range(m):
    x,y,z=map(int,input().split())
    fx=find(x-1)
    fy=find(y-1)
    if rank[fx]>=rank[fy]:
        root[fy]=fx
        if rank[fx]==rank[fy]:
            rank[fx]+=1
    else:
        root[fx]=fy 
a=[]
for i in range(n):
    a.append(find(i)) 
print(len(set(a)))

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
    
root=[int(i) for i in range(n)] 
rank=[0]*n    
def find(x):
    if root[x]==x:
        return x 
    else:
        return find(root[x])

for i in range(m):
    x,y,z=map(int,input().split())
    fx=find(x-1)
    fy=find(y-1)
    if rank[fx]>=rank[fy]:
        root[fy]=fx
        if rank[fx]==rank[fy]:
            rank[fx]+=1
    else:
        root[fx]=fy 
a=()
for i in range(n):
    a.add(find(i)) 
print(len(a))
Problem p03775 (python)

Fixed submission:
N = int(input()) 
ans = 111111111110
for i in range(1,int(N**0.5+2)):
    if N%i == 0:
        use = N//i 
        s = str(use) 
        t = str(i) 
        ans = min(ans, max(len(s), len(t))) 

print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input()) 
ans = 111111111110
for i in range(int(N**0.5+2)):
    if N%i == 0:
        use = N//i 
        s = str(use) 
        t = str(i) 
        ans = min(ans, max(len(s), len(t))) 

print(ans)
Problem p02550 (python)

Fixed submission:
N,X,M = map(int,input().split())

List = [X]

for i in range(N-1):
    X = X**2 % M
    if X in List:
        #配列の何番目か
        num = i + 1
        #同じ数字
        key = List.index(X)
        break
    List.append(X)

ans = sum(List)
if len(List) == N:
    print(ans)

else:
    loop = (N - len(List)) // (num - key)
    add = (N - len(List)) % (num - key)

    ans += (N - len(List)) // (num - key) * sum(List[key:num])
    ans += sum(List[key:key+((N - len(List)) % (num - key))])

    print(ans)

Buggy submission (verdict: Runtime Error):
N,X,M = map(int,input().split())

List = [X]

for i in range(N-1):
    X = X**2 % M
    if X in List:
        #配列の何番目か
        num = i + 1
        #同じ数字
        key = List.index(X)
        break
    List.append(X)

ans = sum(List)

loop = (N - len(List)) // (num - key)
add = (N - len(List)) % (num - key)

ans += loop * sum(List[key:num])
ans += sum(List[key:key+add])

print(ans)

Buggy submission (verdict: Runtime Error):
N,X,M = map(int,input().split())

List = [X]

for i in range(N-1):
    X = X**2 % M
    if X in List:
        #配列の何番目か
        num = i + 1
        #同じ数字
        key = List.index(X)
        break
    List.append(X)

ans = sum(List)

loop = (N - len(List)) // (num - key)
add = (N - len(List)) % (num - key)

ans += loop * sum(List[key:num])
ans += sum(List[key:key+add])
print(loop,key,num)
print(ans)
Problem p02546 (python)

Fixed submission:
n=input()
l=len(n)
if n[l-1]=="s":
  print(n+"es")
else:
  print(n+"s")

Buggy submission (verdict: Runtime Error):
n=input()
l=len(n)
if n[l-1]==s:
  print(n+"es")
else:
  print(n+"s")
Problem p02571 (python)

Fixed submission:
s=input()
l=input()
len_s=len(s)
len_l=len(l)
a=len_s-len_l
ans=1001
for i in range(len_s-len_l+1):
    cnt=0
    for j in range(len_l):
        if l[j]!=s[i+j]:
            cnt+=1
    ans=min(ans,cnt)

print(ans)

Buggy submission (verdict: Runtime Error):
s=input()
l=input()
len_s=len(s)
len_l=len(l)
a=len_s-len_l
ans=1001
for i in range(len_s-len_l+!):
    cnt=0
    for j in range(len_l):
        if l[j]!=s[i+j]:
            cnt+=1
    ans=min(ans,cnt)

print(ans)

Buggy submission (verdict: Runtime Error):
s=input()
l=input()
len_s=len(s)
len_l=len(l)
a=len_s-len_l
ans=1001
for i in range(len_s-a):
    cnt=0
    for j in range(len_s):
        if l[j]==s[i+j]:
            cnt+=1
    ans=min(ans,len_l-cnt)

print(ans)
Problem p02572 (python)

Fixed submission:
n=int(input())
i = list(map(int, input().split())) 

m=sum(i)

ans=0
for k in range(n):
    ans+=(i[k]*(m-i[k]))
ans=ans//2
ans=ans%(10**9+7)
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
i = list(map(int, input().split())) 

ans=0
for k in range(n-1):
    for j in range(i+1,n):
        ans+=(i[k]*i[j])%(10**9+7)

ans=ans%(10**9+7)
print(ans)
Problem p02682 (python)

Fixed submission:
a,b,c,d= list(map(int, input().split()))
if d<a:
    print(d)
elif d<a+b:
    print(a)
else:
    print(a-(d-a-b))

Buggy submission (verdict: Runtime Error):
a,b,c,d = list(map(int, input().split()))
if a+b>=d:
    print(a)
else:
    print(a-(d-a-b)
Problem p02707 (python)

Fixed submission:
n=int(input())
s = list(map(int, input().split()))
z=[0]*n
for  i in range(len(s)):
    k=s[i]-1
    z[k]+=1
for j in range(n):
    print(z[j])

Buggy submission (verdict: Runtime Error):
n=int(input())
s = list(map(int, input().split()))
z=[]*n
for  i in range(len(s)):
    z[s[i]-1]+=1
for j in range(n):
    print(z[j])
Problem p02753 (python)

Fixed submission:
n=input()
if n=="AAA" or n=="BBB":
    print("No")
else:
    print("Yes")

Buggy submission (verdict: Runtime Error):
x,y= list(map(int, input().split()))
i = list(map(int, input().split()))
i.sort(reverse=True)
k=sum(i)
flag=0
for j in range(x):
    if i[j]<(k/(4*(j+1))):
        pass
    else:
        flag+=1
if flag!=y:
    print("No")
else:
    print("Yes")
Problem p02771 (python)

Fixed submission:
i=list(map(int, input().split()))
if i[0]==i[1] and i[0]!=i[2]:
         print("Yes")
elif i[0]==i[2] and i[0]!=i[1]:
         print("Yes")
elif i[1]==i[2] and i[0]!=i[2]:
         print("Yes")   
else:
         print("No")

Buggy submission (verdict: Runtime Error):
i = list(map(int, input().split())
if i[0]==i[1] and i[0]!=i[2]:
         print("Yes")
elif i[0]==i[2] and i[0]!=i[1]:
         print("Yes")
elif i[1]==i[2] and i[0]!=i[2]:
         print("Yes")   
else:
         print("No")
Problem p02773 (python)

Fixed submission:
n=int(input())
l={}
ans=[]
for i in range(n):
    s=input()
    if s in l:
        l[s]+=1
    else:
        l.setdefault(s,1)
max_l=max(l.values())

for i in l.keys():
  if l[i]==max_l:
    ans.append(i)
    
ans.sort()
 
for j in ans:
  print(j)

Buggy submission (verdict: Runtime Error):
n=int(input())
l={}
ans=[]
for i in range(n):
    s=input()
    if s in l:
        l[s]+=1
    else:
        l.setdefault(s,1)
max_l=max(l.values)

for i in l.keys():
  if l[i]==max_l:
    ans.append(i)
    
ans.sort()
 
for j in ans:
  print(j)
Problem p02819 (python)

Fixed submission:
import math
n=int(input())
flag=0
def sosuu(m):
    h=int(math.sqrt(m))
    for i in range(2,h+1):
        if m%i==0:
            return False
    return True

while flag==0:
    
    if sosuu(n):
        flag=1
        break
    n+=1
print(n)

Buggy submission (verdict: Runtime Error):
import math
n=int(input())
flag=0
def sosuu(m):
    for i in range(2,math.sqrt(m)+1):
        if m%i==0:
            return False
    return True

while flag==0:
    if sosuu(n):
        flag=1
    n+=1
print(n)
Problem p02831 (python)

Fixed submission:
import fractions
i=list(map(int, input().split()))
a=i[0]
b=i[1]
c=fractions.gcd(a,b)
print(i[0]*i[1]//c)

Buggy submission (verdict: Runtime Error):
import math
i = list(map(int, input().split()))
c=math.gcd(i[0],i[1])
print(i[0]*i[1]/c)

Buggy submission (verdict: Runtime Error):
import math
i = list(map(int, input().split()))
c=math.gcd(i[0],i[1])
print(i[0]*i[1]/c)
Problem p03767 (python)

Fixed submission:
s=int(input())
i= list(map(int, input().split()))
i.sort(reverse=True)
sum=0
for j in range(s):
    sum+=i[(2*j)+1]
print(sum)

Buggy submission (verdict: Runtime Error):
s=int(input())
i= list(map(int, input().split()))
 
i.sort(reverse=True)
sum=0
ks=0
for j in range(s):
    sum+=i[j+1]
for j in range(n,2*n):
  ks+=i[j]
print(max(sum,ks))
Problem p03835 (python)

Fixed submission:
x,y = list(map(int, input().split()))
count=0
for i in range(x+1):
    for j in range(x+1):
        k=y-i-j
        if k<=x and 0<=k:
          count+=1
print(count)

Buggy submission (verdict: Runtime Error):
x,y = list(map(int, input().split()))
count=0
for i in range(x+1):
    for j in range(x+1):
        k=y-i-j
        if k=<x and 0=<k:
          count+=1
print(count)

Buggy submission (verdict: Runtime Error):
x,y = list(map(int, input().split()))
count=0
for i in range(x):
	for j in range(x):
      for k in range(x):
        a=i+j+K
        if y==a:
          count+=1
print(count)
Problem p02859 (python)

Fixed submission:
# -*- coding: utf-8 -*-

r = int(input().strip())
print(r*r)

Buggy submission (verdict: Runtime Error):
a = int(input().strip())
print a*a
Problem p02659 (python)

Fixed submission:
# coding: utf-8
# Your code here!
import math
import numpy as np


string = input().split()
A = int(string[0]) 
B = int (round(float(string[1]) * 100))

print(int(int( (A*B) )//int(100)))

Buggy submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!
import math
import numpy as np

string = input().split()
A = float(string[0])
B = float(string[1])

keta = np.log10(float(math.floor(A*B)))


def mypow(nuko):
    pai = 1
    for i in range(int(nuko)):
        pai = pai * 10
    return pai
    

hoge = np.log10(B)
neko = mypow(keta-(hoge+2)) 

print(int( math.floor(A*B) - (math.floor(A*B) % neko) ) )

Buggy submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!
import math
import numpy as np

string = input().split()
A = float(string[0])
B = float(string[1])

keta = np.log10(A)


def mypow(nuko):
    pai = 1
    for i in range(int(nuko)):
        pai = pai * 10
    return pai
    

hoge = np.log10(B)
neko = mypow(keta-(hoge+2)) 

print(int( math.floor(A*B) - (math.floor(A*B) % neko) ) )

Buggy submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!
import math
import numpy as np

string = input().split()
A = float(string[0])
B = float(string[1])

keta = np.log10(A)


def mypow(nuko):
    pai = 1
    for i in range(int(nuko)):
        pai = pai * 10
    return pai
    
    
hoge = np.log10(B)

neko = mypow(keta-(hoge+2)) 

print(int( math.floor(A*B) - (math.floor(A*B) % neko) ) )
Problem p02831 (python)

Fixed submission:
from fractions import gcd
a, b = map(int, input().split())
lcm = a * b // gcd(a, b)
print(lcm)

Buggy submission (verdict: Runtime Error):
from math import gcd
a, b = map(int, input().split())
lcm = a * b // gcd(a, b)
print(lcm)
Problem p02723 (python)

Fixed submission:
S = input()

if S[2] == S[3] and S[4] == S[5]:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
[N, X, Y] = input().split()
N = int(N)
X = int(X)
Y = int(Y)
dist_list = []

for i in range(N):
    for j in range(i+1, N):
        a = j - i
        b = abs(i+1 - X) + abs(j+1 -Y) + 1
        if a > b:
            dist_list.append(b)
        else:
            dist_list.append(a)

for k in range(N-1):
    print(dist_list.count(k+1))
Problem p02726 (python)

Fixed submission:
N, X, Y = map(int, input().split())
dist_list = [0]*N

for i in range(N-1):
    for j in range(i+1, N):
        a = j - i
        b = abs(i+1 - X) + abs(j+1 -Y) + 1
        dist_list[min(a,b)] += 1

for k in range(N-1):
    print(dist_list[k+1])

Buggy submission (verdict: Runtime Error):
N, X, Y = map(int, input().split())
dist_list = []*N

for i in range(N):
    for j in range(i+1, N):
        a = j - i
        b = abs(i+1 - X) + abs(j+1 -Y) + 1
        dist_list[min(a,b)] += 1
        
for k in range(N-1):
    print(dist_list.count(k+1))
Problem p02729 (python)

Fixed submission:
N, M = map(int, input().split())

a = N * (N-1) / 2
b = M * (M-1) / 2

print(int(a+b))

Buggy submission (verdict: Runtime Error):
H, W, K = map(int, input().split())
S = list(input() for i in range(H))

sum = [[0] * (W+1) for i in range((H+1))]
for i in range(H):
    for j in range(W):
        sum[i+1][j+1] = sum[i][j+1] + sum[i+1][j] - sum[i][j] + (1 if S[i][j] == '1' else 0)

ans = H + W - 2

for ptn in range(1<<H-1): # 2^H - 1 通り
    cand = 0

    sep = [0] # 横方向の分割リスト、ここ天才
    for i in range(H-1):
        if((ptn >> i) & 1): # & を取ることで、上の桁を消せる
            sep.append(i+1)
            cand += 1
    sep.append(H)

    left = 0 # left は直前の分割
    for pos in range(W):
    	cur = [] # cur は今見てるホワイトチョコの個数のリスト

    	# 横方向に分割されている各部分について
    	for i in range(len(sep) - 1):
    		cur.append(sum[sep[i+1]][pos+1] - sum[sep[i+1]][left] - sum[sep[i]][pos+1] + sum[sep[i]][left])

    	if max(cur) > K:
    		if left == pos: # 縦に分割できない場合(一列しかない場合)
    			cand = H * W
    			break
    		else:
    			cand += 1
    			left = pos

    ans = min(ans, cand)

print(ans)
Problem p02596 (python)

Fixed submission:
k = int(input())

mod = 7%k
path = [mod]
ans = '-1'

for i in range(1,k+1):
    if mod == 0:
        ans = i
        break
    mod = (mod*10 + 7)%k
    path.append(mod)
    if mod == path[0]:
        ans = '-1'
        break

print(ans)

Buggy submission (verdict: Runtime Error):
k = int(input())

mod = 7%k
period = [mod]

for i in range(1,k+1):
    if mod == 0:
        ans = i
        break
    mod = (mod*10 + 7)%k
    period.append(mod)
    if mod == period[0]:
        ans = '-1'
        break

print(ans)

Buggy submission (verdict: Runtime Error):
k = int(input())

cnt = 0
mod = 7%k
period = [mod]

for i in range(1,k+1):
    if mod == 0:
        ans = i
        break
    mod = (mod*10 + 7)%k
    period.append(mod)
    if period[i] == period[0]:
        ans = '-1'
        break

print(ans)

Buggy submission (verdict: Runtime Error):
k = int(input())

cnt = 0
mod = 7%k
period = [mod]

for i in range(1,k+1):
    if mod == 0:
        ans = i
        break
    mod = (mod*10 + 7)%k
    period.append(mod)
    if period[i] == period[0]:
        ans = -1
        break

print(ans)
Problem p02753 (python)

Fixed submission:
S = input()
if S == "AAA" or S == "BBB":
  print("No")
else:
  print("Yes")

Buggy submission (verdict: Runtime Error):
S = input()
if S = "AAA" or S = "BBB":
  print("No")
else:
  print("Yes")
Problem p02754 (python)

Fixed submission:
n, a,b = map(int, input().split())
ans = n//(a+b)*a
rem = n%(a+b)
ans+=min(a,rem)
print(ans)

Buggy submission (verdict: Runtime Error):
N,A,B = map(int,input().split())
S = 0
for i in range(2*N):
  if i%2 == 0:
    S += A
  else:
    S += B:
  if S >= N:
    if i%2 == 0:
      ans = (i-1)/2*A + N - (i-1)/2*(A+B)
    else:
      ans = i/2 * A
    break
print(ans)
Problem p02951 (python)

Fixed submission:
a,b,c = map(int,input().split())
d = b + c - a
if d >= 0:
  print(d)
else:
  print(0)

Buggy submission (verdict: Runtime Error):
n = int(input())
H = list(map(int, input().split()))
for i in reversed(range(n)):
    if i == 0:
        print("Yes")
    elif H[i] - H[i - 1] == -1:
        H[i - 1] -= 1
    elif H[i] - H[i - 1] < -1:
        print("No")
        break
    else:
        continue