Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import math
a,b =map(int, input().split())
x = list(map(int, input().split()))
m = abs(x[0]-b)
for i in range(a):
    m = math.gcd(m,abs(x[i]-b))
print(m)

Fixed submission:
import fractions
a,b =map(int, input().split())
x = list(map(int, input().split()))
m = abs(x[0]-b)
for i in range(a):
    m = fractions.gcd(m,abs(x[i]-b))
print(m)

Buggy python submission (verdict: Runtime Error):
a,b =map(int, input().split())
x = list(map(int, input().split()))
m = abs(x[0]-b)
for i in range(a):
    m = math.gcd(m,abs(x[i]-b))
print(m)

Fixed submission:
import fractions
a,b =map(int, input().split())
x = list(map(int, input().split()))
m = abs(x[0]-b)
for i in range(a):
    m = fractions.gcd(m,abs(x[i]-b))
print(m)

Buggy python submission (verdict: Runtime Error):
a,b =map(int, input().split())
x = list(map(int, input().split()))
m = abs(x[0]-b)
for i in range(a):
    m = math.gcd(m,abs(x[i]-b))
print(m)

Fixed submission:
import fractions
a,b =map(int, input().split())
x = list(map(int, input().split()))
m = abs(x[0]-b)
for i in range(a):
    m = fractions.gcd(m,abs(x[i]-b))
print(m)
Buggy python submission (verdict: Runtime Error):
def a():return input()#s
def ai():return int(input())#a,n or k
def ma():return map(int, input().split())#a,b,c,d or n,k
def ms():return map(str, input().split())#,a,b,c,d
def lma():return list(map(int, input().split()))#x or y
def lms():return list(map(str, input().split()))#x or y
a,b  = ma()
x = lma()
ans = 10 **18
for i in range(a-b+1):
    a0 = x[i]
    ab = x[i+b-1]
    if ab< 0 :
        ans = min(ans,ab)
    elif a0 <=0 and 0 <= ab:
        ans = min(ans, ab-2*a0, 2*ab-a0)
    else:
        ans = min(ans,ab)
print(ans)

Fixed submission:
n,k = map(int,input().split())
if k%2==1:print((n//k)**3)
elif k%2==0:print((n//k)**3 + (n//(k//2) - n//k)**3 )
Buggy python submission (verdict: Runtime Error):
input = get_input(INPUT)

h, w = map(int, input().split())
a = [input() for w in range(h)]

for i in range(h)[::-1]:
    if "#" not in a[i]:
        del a[i]
        h -= 1

n = []
for j in range(w):
    m = ["".join(t[j] for t in a)]
    if "#" in m[0]:
        n += m

for k in range(h):
    print("".join(u[k] for u in n))

Fixed submission:
h, w = map(int, input().split())
a = [input() for w in range(h)]

for i in range(h)[::-1]:
    if "#" not in a[i]:
        del a[i]
        h -= 1

n = []
for j in range(w):
    m = ["".join(t[j] for t in a)]
    if "#" in m[0]:
        n += m

for k in range(h):
    print("".join(u[k] for u in n))
Buggy python submission (verdict: Runtime Error):
a,b  = ma()
x = lma()
ans = 10 **18
for i in range(a-b+1):
    a0 = x[i]
    ab = x[i+b-1]
    if ab< 0 :
        ans = min(ans,ab)
    elif a0 <=0 and 0 <= ab:
        ans = min(ans, ab-2*a0, 2*ab-a0)
    else:
        ans = min(ans,ab)
print(ans)

Fixed submission:
def a():return input()#s
def ai():return int(input())#a,n or k
def ma():return map(int, input().split())#a,b,c,d or n,k
def ms():return map(str, input().split())#,a,b,c,d
def lma():return list(map(int, input().split()))#x or y
def lms():return list(map(str, input().split()))#x or y
a,b  = ma()
x = lma()
ans = 10 **18
for i in range(a-b+1):
    a0 = x[i]
    ab = x[i+b-1]
    if ab< 0 :
        ans = min(ans,abs(a0))
    elif a0 <=0 and 0 <= ab:
        ans = min(ans, ab-2*a0, 2*ab-a0)
    else:
        ans = min(ans,ab)
print(ans)
Buggy python submission (verdict: Runtime Error):
a=int(input());s=''
while a!=0:s+=str(a%2);a=-(a//2)
print(int(s[::-1]))

Fixed submission:
a=int(input());s=''
while a!=0:s+=str(a%2);a=-(a//2)
print(int(s[::-1]) if s != '' else 0)
Buggy python submission (verdict: Runtime Error):
#B AcCepted
b = input()
a = list(b)
c=z = len(b)
d =""
if a[0] == "A":
    a[0] = "a"
    c = 10000
for i in range(2,c):
    if a[i] == "C":
        a[i]="c"
        c+=1
for i in a:
    d+=i
if d.islower() and c == 10001:
    print("AC")
else:
    print("WA")
    
    

Fixed submission:
#B AcCepted
b = input()
a = list(b)
c=z = len(b)
d =""
if a[0] == "A":
    a[0] = "a"
    c = 10000
for i in range(2,z-1):
    if a[i] == "C":
        a[i]="c"
        c+=1
for i in a:
    d+=i
if d.islower() and c == 10001:
    print("AC")
else:
    print("WA")
Buggy python submission (verdict: Time Limit Exceeded):
e,a,b,c=1,0,0,0
for i in input():
  if i == "A":
    a+=e
  elif i == "B":
    b+=a
  elif i == "C":
    c+=b
  else:
    e,a,b,c = 3*e,e+3*a,a+3*b,b+3*c
print(c%1000000007) 


Fixed submission:
e,a,b,c=1,0,0,0
p=1000000007
for i in input():
  if i == "A":
    a+=e
  elif i == "B":
    b+=a
  elif i == "C":
    c+=b
  else:
    e,a,b,c = (3*e)%p,(e+3*a)%p,(a+3*b)%p,(b+3*c)%p
print(c%1000000007)

Buggy python submission (verdict: Time Limit Exceeded):
p = 1000000007
s = input()
n = len(s)
e,a,b,c = 1,0,0,0
for i in range(n):
  if s[i] == "A":
    a+=e
  elif s[i] == "B":
    b+=a
  elif s[i] == "C":
    c+=b
  else:
    e,a,b,c = 3*e,e+3*a,a+3*b,b+3*c
print(c%p) 


Fixed submission:
e,a,b,c=1,0,0,0
p=1000000007
for i in input():
  if i == "A":
    a+=e
  elif i == "B":
    b+=a
  elif i == "C":
    c+=b
  else:
    e,a,b,c = (3*e)%p,(e+3*a)%p,(a+3*b)%p,(b+3*c)%p
print(c%1000000007)
Buggy python submission (verdict: Runtime Error):
a = ai()
x = lma()
print(sum(x)-a)

Fixed submission:
def a():return input()#s
def ai():return int(input())#a,n or k
def ma():return map(int, input().split())#a,b,c,d or n,k
def ms():return map(str, input().split())#,a,b,c,d
def lma():return list(map(int, input().split()))#x or y
def lms():return list(map(str, input().split()))#x or y
a = ai()
x = lma()
print(sum(x)-a)
Buggy python submission (verdict: Runtime Error):
n = input()
a=list(map(int, input().split()))
t=a[0]
s=0
Ans=0
for i in range(1,n):
  if t==a[i]:
    s+=1
  else:
    Ans+=s//2
    s=0
  t=a[i]
print(Ans)
  
  
  

Fixed submission:
n = int(input())
a=list(map(int, input().split()))
t=a[0]
s=1
Ans=0
for i in range(1,n):
  if t==a[i]:
    s+=1
  else:
    Ans+=s//2
    s=1
  t=a[i]
Ans+=s//2
print(Ans)
Buggy python submission (verdict: Runtime Error):
a = list(map(int, input().split()))
a.sort()
if a < 9:
    print("Yay!")
else:
    print(":(")

Fixed submission:
a = list(map(int, input().split()))
a.sort()
if a[1] < 9:
    print("Yay!")
else:
    print(":(")
Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
x = [list(map(int, input().split())) for _ in range(n)]
from itertools import *
res = 0
for a in product([-1, 1], [-1, 1], [-1, 1]):
    ts =[]
    for t in x:
        ta = 0
        for i,j in zip(a,t):
            ta+=i*j
        ts.append(t)
    s = sum(sorted(ts,reverse=True)[:m])
    res = max(res, s)
print(res)

Fixed submission:
n,m=map(int,input().split())
x = [tuple(map(int, input().split())) for _ in range(n)]
from itertools import *
res = 0
for a in product([-1, 1], [-1, 1], [-1, 1]):
    ts = (sum(i*j for i,j in zip(a,t)) for t in x)
    s = sum(sorted(ts,reverse=True)[:m])
    res = max(res, s)
print(res)

Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
x = [list(map(int, input().split())) for _ in range(n)]
from itertools import *
res = 0
for a in product([-1, 1], [-1, 1], [-1, 1]):
    ts =[]
    for t in x:
        t = 0
        for i,j in zip(a,t):
            t+=i*j
        ts.append(t)
    s = sum(sorted(ts,reverse=True)[:m])
    res = max(res, s)
print(res)

Fixed submission:
n,m=map(int,input().split())
x = [tuple(map(int, input().split())) for _ in range(n)]
from itertools import *
res = 0
for a in product([-1, 1], [-1, 1], [-1, 1]):
    ts = (sum(i*j for i,j in zip(a,t)) for t in x)
    s = sum(sorted(ts,reverse=True)[:m])
    res = max(res, s)
print(res)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = input()
m = n
for i in range(n):
    if m > a[:i].count("W")+a[i:].count("E"):
        m = a[:i].count("W")+a[i:].count("E")
print(m)

Fixed submission:
n = int(input())
a = input()
m = mi= a.count("E")
for i in range(n):
    if a[i] == "W" : m+=1
    else : m-=1
    mi = min(mi,m) 
print(mi)
Buggy python submission (verdict: Runtime Error):
a=input()
p = int(input())
k = []
for i in range(len(a)):
    for j in range(i+1,min(i+6,len(a)-1)):
        k.append(a[i:j])
k = set(k)
k = list(k)
k.sort()
#print(k)
print(k[p-1])

Fixed submission:
a=input()
p = int(input())
k = []
for i in range(len(a)):
    for j in range(i+1,min(i+6,len(a)+1)):
        k.append(a[i:j])
#(k)
k = set(k)
k = list(k)
k.sort()
#(k)
print(k[p-1])
Buggy python submission (verdict: Runtime Error):
import collections
import itertools
import operator


class UnionFind:
    def __init__(self, n):
        self.par = [i for i in range(n+1)]
        self.rank = [0] * (n+1)

    # 検索
    def find(self, x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    # 併合
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if self.rank[x] < self.rank[y]:
            self.par[x] = y
        else:
            self.par[y] = x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1

    # 同じ集合に属するか判定
    def same_check(self, x, y):
        return self.find(x) == self.find(y)


a,b =  map(int, input().split())
l = list(map(int, input().split()))
uf = UnionFind(a)
for i in range(b):
    x,y =map(int, input().split())
    x-=1
    y-=1
    uf.union(x, y)  # (3)
ans=0
for i,t in enumerate(l):
    if uf.same(t-1,l[i]-1):ans+=1

print(ans)


Fixed submission:
import collections
import itertools
import operator


class UnionFind:
    def __init__(self, n):
        self.par = [i for i in range(n+1)]
        self.rank = [0] * (n+1)

    # 検索
    def find(self, x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    # 併合
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if self.rank[x] < self.rank[y]:
            self.par[x] = y
        else:
            self.par[y] = x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1

    # 同じ集合に属するか判定
    def same(self, x, y):
        return self.find(x) == self.find(y)


a,b =  map(int, input().split())
l = list(map(int, input().split()))
uf = UnionFind(a)
for i in range(b):
    x,y =map(int, input().split())
    x-=1
    y-=1
    uf.union(x, y)  # (3)
ans=0
for i,t in enumerate(l):
    if uf.same(t-1,i):ans+=1

print(ans)
Buggy python submission (verdict: Runtime Error):
a = int(input())
x = list(map(float, input().split()))
m = max(x)
M = m/2
t = 0
s = float("INF")
for i in x:
    #print(s,abs(M-i),i,M)
    if s >= abs(M-i):
        s = min(s,abs(M-i))
        t = i
print(str(int(m))+" "+str(int(t)))

Fixed submission:
a,b,c= map(int, input().split())
p = list(map(int, input().split()))
k = 0
for i in range(b):
    if p[i] < c:
        k+=1
print(min(k,b-k))

Buggy python submission (verdict: Runtime Error):
a = int(input())
x = list(map(float, input().split()))
m = max(x)
M = m/2
t = 0
s = float("INF")
for i in x:
    print(s,abs(M-i),i,M)
    if s >= abs(M-i):
        s = min(s,abs(M-i))
        t = i
print(str(int(m))+" "+str(int(t)))

Fixed submission:
a,b,c= map(int, input().split())
p = list(map(int, input().split()))
k = 0
for i in range(b):
    if p[i] < c:
        k+=1
print(min(k,b-k))
Buggy python submission (verdict: Runtime Error):
a = int(input())
N= map(int, input().split())
x = list(map(int, input().split()))
m = max(x)
M = m/2
s = float("INF")
for i in x:
    s = min(s,abs(M-i))
print(m,s)

Fixed submission:
a = int(input())
x = list(map(float, input().split()))
m = max(x)
M = m/2
t = 0
s = float("INF")
for i in x:
    #print(s,abs(M-i),i,M)
    if s >= abs(M-i):
        s = min(s,abs(M-i))
        t = i
print(str(int(m))+" "+str(int(t)))
Buggy python submission (verdict: Runtime Error):
a= int(input())
b = int(input())
c=int(input())
d = int(input())
pritn(min(a,b)*min(c,d))

Fixed submission:
a=int(input())
b=int(input())
c=int(input())
d=int(input())
print(min(a,b)+min(c,d))
Buggy python submission (verdict: Runtime Error):
a=int(input())
x = list(map(str,input().split()))
x = [0]+x+[0]
s = 0
for i in range(1,a+2):
    s+=abs(x[i-1]-x[i])
for i in range(1,a+1):
    print(s+abs(x[i-1]-x[i+1])-(abs(x[i-1]-x[i])+abs(x[i]-x[i+1])))


Fixed submission:
a=int(input())
x = list(map(int,input().split()))
x = [0]+x+[0]
s = 0
for i in range(1,a+2):
    s+=abs(x[i-1]-x[i])
for i in range(1,a+1):
    print(s+abs(x[i-1]-x[i+1])-(abs(x[i-1]-x[i])+abs(x[i]-x[i+1])))
Buggy python submission (verdict: Runtime Error):
n = int(input())
k=[]
for i in range(n):
    k.append(input())
p = set(k)
if len(p) == 3:
    print("Three")
else:
    print("Four")


Fixed submission:
n = int(input())
k = list(map(str, input().split()))
p = set(k)
if len(p) == 3:
    print("Three")
else:
    print("Four")
Buggy python submission (verdict: Runtime Error):
a = input()
b = int(a)
c = list(a)
t = int(a[0])
#print(t,a.count("9"))
if t != 9  and a.count("9") == len(a)-1:
    r = t+(len(a)-1)*9
elif a.count("9") != len(a):
    t -= 1
    r = t+(len(a)-1)*9
if b<9:
    r = b
elif b == 9:
    r = 9
    
print(r)

Fixed submission:
a = input()
b = int(a)
c = list(a)
t = int(a[0])
r = t+(len(a)-1)*9
#print(t,a.count("9"))
if t != 9  and a.count("9") == len(a)-1:
    r = t+(len(a)-1)*9
elif a.count("9") != len(a):
    t -= 1
    r = t+(len(a)-1)*9
if b<9:
    r = b
elif b == 9:
    r = 9
    
print(r)

Buggy python submission (verdict: Runtime Error):
a = input()
b = int(a)
c = list(a)
t = int(a[0])
#print(t,a.count("9"))
if t != 9  and a.count("9") == len(a)-1:
    r = t+(len(a)-1)*9
elif a.count("9") != len(a):
    t -= 1
    r = t+(len(a)-1)*9
if b<9:
    r = b
else: b == 9
    r = 9
    
print(r)

Fixed submission:
a = input()
b = int(a)
c = list(a)
t = int(a[0])
r = t+(len(a)-1)*9
#print(t,a.count("9"))
if t != 9  and a.count("9") == len(a)-1:
    r = t+(len(a)-1)*9
elif a.count("9") != len(a):
    t -= 1
    r = t+(len(a)-1)*9
if b<9:
    r = b
elif b == 9:
    r = 9
    
print(r)

Buggy python submission (verdict: Runtime Error):
a = input()
b = int(a)
c = list(a)
t = int(a[0])
#print(t,a.count("9"))
if t != 9  and a.count("9") == len(a)-1:
    r = t+(len(a)-1)*9
elif a.count("9") != len(a):
    t -= 1
    r = t+(len(a)-1)*9
if b<9:
    r = b
    
print(r)

Fixed submission:
a = input()
b = int(a)
c = list(a)
t = int(a[0])
r = t+(len(a)-1)*9
#print(t,a.count("9"))
if t != 9  and a.count("9") == len(a)-1:
    r = t+(len(a)-1)*9
elif a.count("9") != len(a):
    t -= 1
    r = t+(len(a)-1)*9
if b<9:
    r = b
elif b == 9:
    r = 9
    
print(r)

Buggy python submission (verdict: Runtime Error):
a = input()
b = int(a)
c = list(a)
t = int(a[0])
print(t,a.count("9"))
if t != 9  and a.count("9") == len(a)-1:
    r = t+(len(a)-1)*9
elif a.count("9") != len(a):
    t -= 1
    r = t+(len(a)-1)*9
if b<9:
    r = b
    
print(r)

Fixed submission:
a = input()
b = int(a)
c = list(a)
t = int(a[0])
r = t+(len(a)-1)*9
#print(t,a.count("9"))
if t != 9  and a.count("9") == len(a)-1:
    r = t+(len(a)-1)*9
elif a.count("9") != len(a):
    t -= 1
    r = t+(len(a)-1)*9
if b<9:
    r = b
elif b == 9:
    r = 9
    
print(r)

Buggy python submission (verdict: Runtime Error):
a = input()
b = int(a)
c = list(a)
if a.count("9") != len(a):
    t = int(a[0]) -1
print(t+(len(a)-1)*9)

Fixed submission:
a = input()
b = int(a)
c = list(a)
t = int(a[0])
r = t+(len(a)-1)*9
#print(t,a.count("9"))
if t != 9  and a.count("9") == len(a)-1:
    r = t+(len(a)-1)*9
elif a.count("9") != len(a):
    t -= 1
    r = t+(len(a)-1)*9
if b<9:
    r = b
elif b == 9:
    r = 9
    
print(r)
Buggy python submission (verdict: Runtime Error):
def a():return input()#s
def ai():return int(input())#a,n or k
def ma():return map(int, input().split())#a,b,c,d or n,k
def ms():return map(str, input().split())#,a,b,c,d
def lma():return list(map(int, input().split()))#x or y
def lms():return list(map(str, input().split()))#x or y
k= [0]
l = [0]
m=[]
co = range(1,10**5,2)
ce = range(0,10**5,2)
f = 1
def say(i):return print("Yes" if i == 0 else "No")
def Say(i):return print("YES" if i == 0 else "NO")
#def rep(i):return for i in range()
def addarray(k,l):
    for i in range(n+1):
        a ,b,c = map(int,input().split())
        k.append(a)
        l.append(b+c)
n = ai()
addarray(k,l)
for i in range(1,n):
    t = k[i]-k[i-1]
    if not t%2==1 and abs(l[i]-l[i-1]) in ce[:t//2+1]:
        f = 0
        break
    elif not t%2!=1 and abs(l[i]-l[i-1]) in co[:t//2+1]:
        f = 0
        break
say(f)
    

Fixed submission:
def a():return input()#s
def ai():return int(input())#a,n or k
def ma():return map(int, input().split())#a,b,c,d or n,k
def ms():return map(str, input().split())#,a,b,c,d
def lma():return list(map(int, input().split()))#x or y
def lms():return list(map(str, input().split()))#x or y
k= [0]
l = [0]
m=[]
co = range(1,10**5+2,2)
ce = range(0,10**5+2,2)
f = 1
def say(i):return print("Yes" if i == 1 else "No")
def Say(i):return print("YES" if i == 0 else "NO")
#def rep(i):return for i in range()
def addarray(k,l):
    for i in range(n):
        a ,b,c = map(int,input().split())
        k.append(a)
        l.append(b+c)
n = ai()
addarray(k,l)
for i in range(1,n+1):
    t = k[i]-k[i-1]
    if t%2==1 and abs(l[i]-l[i-1]) in co[:t//2+1]:
        f = 1
    elif t%2==0 and abs(l[i]-l[i-1]) in ce[:t//2+1]:
        f = 1
    else:
        f = 0
        break
say(f)
Buggy python submission (verdict: Runtime Error):
a = input()
s = ""
for i in range(a):
    if i == 3:s+="8"
    else:s+=a[i]
print(s)

Fixed submission:
a = input()
s = ""
for i in range(len(a)):
    if i == 3:s+="8"
    else:s+=a[i]
print(s)

Buggy python submission (verdict: Runtime Error):
a = input()
s = ""
for i in range(a):
    if i == 3:s+=8
    else:s+=i
print(s)

Fixed submission:
a = input()
s = ""
for i in range(len(a)):
    if i == 3:s+="8"
    else:s+=a[i]
print(s)
Buggy python submission (verdict: Runtime Error):
import math
n = int(input())
l = []
M= 0
for i in range(n):
    x,y = map(int,input().split())
    l.append((x,y))
for i ,(x1,y1) in enumerate(l):
    for x2,y2 in l[i+1:n]:
        M = max(M,math.sqrt((x1-x2)**2+(y1-y2)**2))
print(M)





Fixed submission:
def a():return input()#s
def ai():return int(input())#a,n or k
def ma():return map(int, input().split())#a,b,c,d or n,k
def ms():return map(str, input().split())#,a,b,c,d
def lma():return list(map(int, input().split()))#x or y
def lms():return list(map(str, input().split()))#x or y
a,b = ma()
c=d=e=-1
for i in range(a+1):
    for j in range(a-i+1):
        if b == i*10000 + j*5000 + (a-i-j)*1000: 
            c,d,e=i,j,a-i-j
            break
print(c,d,e)

Buggy python submission (verdict: Runtime Error):
a,b = ma()
c=d=e=-1
b=b//1000
for i in range(a):
    for j in range(a-i):
        if b == i*10 + j*5 + (a-i-j): 
            c,d,e=i,j,a-i-j
            break
print(c,d,e)

Fixed submission:
def a():return input()#s
def ai():return int(input())#a,n or k
def ma():return map(int, input().split())#a,b,c,d or n,k
def ms():return map(str, input().split())#,a,b,c,d
def lma():return list(map(int, input().split()))#x or y
def lms():return list(map(str, input().split()))#x or y
a,b = ma()
c=d=e=-1
for i in range(a+1):
    for j in range(a-i+1):
        if b == i*10000 + j*5000 + (a-i-j)*1000: 
            c,d,e=i,j,a-i-j
            break
print(c,d,e)
Buggy python submission (verdict: Runtime Error):
#include<iostream>
using namespace std;

int findN(int n){
    int sum = 0;
    while(n>0){
        sum+=n%10;
        n/=10;
    }
    return sum;
}
int main(){
    int N,A,B;
    cin >> N >> A >>B;
    int total = 0;
    for(int i = 1; i<=N;++i){
        int sum = findN(i);
        if(sum>= A && sum<=B){
            if(sum>=A && sum <= B){
                total += i;
            }
        }
    }
    cout << total << endl;
}

Fixed submission:
n,a,b= map(int, input().split())
r=0
for i in range(n+1):
    s = 0
    t = str(i)
    k = len(t)
    for j in range(k):
        s +=int(t[j])
    if  a <= s <= b:
        r+=int(t)
print(r)
Buggy python submission (verdict: Runtime Error):
inf = float("INF")
from operator import itemgetter
a,b=map(int,input().split())
d = [0]*(2*(10**5)+10)
dp = []
for i in range(a):
    ts,tf,c =map(int,input().split())
    dp.append([ts,tf,c])

dp = sorted(dp, key=itemgetter(2))
for i in range(1,a):
    if dp[i][0] == dp[i-1][1] and dp[i][2] == dp[i-1][2]:
        dp[i][0] = dp[i-1][0]
        dp[i-1][0],dp[i-1][1],dp[i-1][2]=inf,inf,inf
        
M = 0
for ts,tf,ll in dp:
    d[(ts-1)*2]+=1
    d[(tf-1)*2+3]-=1
M = 0

for i in range(len(d)):
    if i > 0:
        d[i] = d[i-1]+d[i]
    if i%2!=0 :M = max(M,d[i])
print(M)

Fixed submission:
##########################
from collections import defaultdict as ddict
N, C = map(int, input().split())
imos = [0] * (10**5 + 2)
last_s_by_c = ddict(lambda: 1)
last_t_by_c = ddict(int)
stc = [list(map(int, input().split())) for i in range(N)]
for s, t, c in sorted(stc, key=lambda x: x[1]):
	if last_t_by_c[c] != s:
		imos[last_s_by_c[c] - 1] += 1
		imos[last_t_by_c[c]] -= 1
		last_s_by_c[c] = s
	last_t_by_c[c] = t
for c in last_s_by_c:
	imos[last_s_by_c[c] - 1] += 1
	imos[last_t_by_c[c]] -= 1
for i in range(10**5 + 1):
	imos[i + 1] += imos[i]
print(max(imos))

Buggy python submission (verdict: Runtime Error):

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

d = [0]*(2*(10**5))
for i in range(a):
    ts,tf,c =map(int,input().split())
    d[(ts-1)*2]+=1
    d[(tf-1)*2+2]-=1
M = 0
for i in range(len(d)):
    if i > 0:
        d[i] = d[i-1]+d[i]
    M = max(M,d[i])
print(M)


Fixed submission:
##########################
from collections import defaultdict as ddict
N, C = map(int, input().split())
imos = [0] * (10**5 + 2)
last_s_by_c = ddict(lambda: 1)
last_t_by_c = ddict(int)
stc = [list(map(int, input().split())) for i in range(N)]
for s, t, c in sorted(stc, key=lambda x: x[1]):
	if last_t_by_c[c] != s:
		imos[last_s_by_c[c] - 1] += 1
		imos[last_t_by_c[c]] -= 1
		last_s_by_c[c] = s
	last_t_by_c[c] = t
for c in last_s_by_c:
	imos[last_s_by_c[c] - 1] += 1
	imos[last_t_by_c[c]] -= 1
for i in range(10**5 + 1):
	imos[i + 1] += imos[i]
print(max(imos))
Buggy python submission (verdict: Runtime Error):
a = input()
s = 0
for i in (l,len(a)):
  if a[i-1] ==a[i]:
          s+=1
if s>=3:
          print("Yes")
else:print("No")

Fixed submission:
a=list(input())
print('Yes' if((a[0]==a[1]==a[2]) or(a[1]==a[2]==a[3])) else 'No')

Buggy python submission (verdict: Runtime Error):
a = input()
s = 0
for i in (l,len(a)):
  if a[i-1] ==a[i]:
          s+=1
if s>=3:
          print("Yes")
else:print("No")

Fixed submission:
a=list(input())
print('Yes' if((a[0]==a[1]==a[2]) or(a[1]==a[2]==a[3])) else 'No')

Buggy python submission (verdict: Runtime Error):
a = input()
s = 0
for i in (l,len(a):
  if a[i-1] ==a[i]:
          s+=1
if s>=3:
          print("Yes")
else:print("No")

Fixed submission:
a=list(input())
print('Yes' if((a[0]==a[1]==a[2]) or(a[1]==a[2]==a[3])) else 'No')
Buggy python submission (verdict: Time Limit Exceeded):
def cal(n):
    if n==0:return 2
    elif n == 1:return 1
    else: return cal(n-1)+cal(n-2)
a = int(input())
print(cal(a))

Fixed submission:
import numpy as np
a = int(input())
p =[0]*(a+1)
def cal(n):
    if p[n] !=0:return p[n]
    if n==0:res =  2
    elif n == 1:res = 1
    else: res =  cal(n-1)+cal(n-2)
    p[n] = int(res)
    return p[n]
print(int(cal(a)))