Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
str=list(input())
flag=True
if str[0]!='A':
    flag=False
str[0]='a'
cnt=0
for i in range(2,len(str)-1):
    if str[i]=='C':
        cnt+=1
        if cnt==1:
            str[i]='c'
if cnt!=1:
    flag=False

tmp="".join(str)
print(tmp)
if not tmp.islower():
    flag=False

if flag==True:
    print("AC")
else:
    print("WA

Fixed submission:
str=list(input())
flag=True
if str[0]!='A':
    flag=False
str[0]='a'
cnt=0
for i in range(2,len(str)-1):
    if str[i]=='C':
        cnt+=1
        if cnt==1:
            str[i]='c'
if cnt!=1:
    flag=False

tmp="".join(str)
if not tmp.islower():
    flag=False

if flag==True:
    print("AC")
else:
    print("WA")

Buggy python submission (verdict: Runtime Error):
str=input()
flag=True
if str[0]!='A':
    flag=False
    str[0]='a'
cnt=0
for i in range(2,len(str)-2):
    if str[i]=='C':
        cnt+=1
        if cnt==1:
            str[i]='c'
if cnt!=1:
    flag=False

if str.islower():
    flag=False

if flag==True:
    print("AC")
else:
    print("WA")

Fixed submission:
str=list(input())
flag=True
if str[0]!='A':
    flag=False
str[0]='a'
cnt=0
for i in range(2,len(str)-1):
    if str[i]=='C':
        cnt+=1
        if cnt==1:
            str[i]='c'
if cnt!=1:
    flag=False

tmp="".join(str)
if not tmp.islower():
    flag=False

if flag==True:
    print("AC")
else:
    print("WA")
Buggy python submission (verdict: Runtime Error):
def f(n):
	res=0
	while n>0:
		res+=n%10
		n//=10
	return res

N=int(input())
print(x)
if N%x==0:
	print("Yes")
else:
	print("No")

Fixed submission:
def f(n):
	res=0
	while n>0:
		res+=n%10
		n//=10
	return res

N=int(input())
x=f(N)
if N%x==0:
	print("Yes")
else:
	print("No")
Buggy python submission (verdict: Runtime Error):
def gcd(x,y):
    if y==0:
        return x
    else:
        return gcd(y,x%y)

n=int(input())

a=int(input())
b=int(input())
x=a*b//gcd(a,b)
for i in range(n-2):
    c=int(input())
    x=c*x//gcd(c,x)
print(x)

Fixed submission:
def gcd(x,y):
    if y==0:
        return x
    else:
        return gcd(y,x%y)

n=int(input())

x=1
for i in range(n):
    c=int(input())
    x=c*x//gcd(c,x)
print(x)

Buggy python submission (verdict: Runtime Error):
def gcd(x,y):
    if y==0:
        return x
    while y!=0:
        return gcd(y,x%y)

n=int(input())

a=int(input())
b=int(input())
x=a*b//gcd(a,b)
for i in range(n-2):
    c=int(input())
    x=c*x//gcd(c,x)
print(x)

Fixed submission:
def gcd(x,y):
    if y==0:
        return x
    else:
        return gcd(y,x%y)

n=int(input())

x=1
for i in range(n):
    c=int(input())
    x=c*x//gcd(c,x)
print(x)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [input() for _ in range(n)]
for i in range(n):
  print(max(a[:i] + a[(i + 1):]))
  

Fixed submission:
n = int(input())
a = [int(input()) for _ in range(n)]
b = sorted(a)
x = b[-1]
y = b[-2]
for i in a:
  if i != x:
  	print(x)
  else:
    print(y)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
p=list(map(int, input().split()))
c=0
x = sorted(p)
a,b= x[int(n/2)-1], x[int(n/2)]
for k in range(a, b+1):
  arc = []
  abc = []
  for i in p:
    if k >= i:
      arc.append(arc)
    elif k <= i:
      abc.append(abc)
  if len(arc) == len(abc):
    c+=1
print(c)

Fixed submission:
n=int(input())
p=sorted(list(map(int, input().split())))
print(p[int(n/2)]-p[int(n/2)-1])

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
p=list(map(int, input().split()))
c=0
for k in range(min(p), max(p)+1):
  arc = []
  abc = []
  for i in p:
    if k >= i:
      arc.append(arc)
    elif k <= i:
      abc.append(abc)
  if len(arc) == len(abc):
    c+=1
print(c)
  
      
  

Fixed submission:
n=int(input())
p=sorted(list(map(int, input().split())))
print(p[int(n/2)]-p[int(n/2)-1])

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
p=list(map(int, input().split()))
c=0
for k in range(1, max(p)+1):
  arc = []
  abc = []
  for i in p:
    if k >= i:
      arc.append(arc)
    elif k <= i:
      abc.append(abc)
  if len(arc) == len(abc):
    c+=1
print(c)
  
      
  

Fixed submission:
n=int(input())
p=sorted(list(map(int, input().split())))
print(p[int(n/2)]-p[int(n/2)-1])
Buggy python submission (verdict: Runtime Error):
n, l = map(int, input().split())
ss = [input() for _ in range(l)]
print(''.join(sorted(ss)))

Fixed submission:
n, l = map(int, input().split())
ss = [input() for _ in range(n)]
print(''.join(sorted(ss)))
Buggy python submission (verdict: Runtime Error):
a,b=input().split
print(max(a+b,a-b,a*b))

Fixed submission:
a,b = map(int,input().split())
print(max(a+b,a-b,a*b))
Buggy python submission (verdict: Runtime Error):
a=int(input())
b=int(input())
c=int(input())
if a==1:
  print("Hello World")
elif a==2:
  print(b+c)


Fixed submission:
a=int(input())
if a==1:
  print("Hello World")
else:
  b=int(input())
  c=int(input())
  print(b+c)

Buggy python submission (verdict: Runtime Error):
a=int(input())
b=int(input())
c=int(input())
if a==1:
  print("Hello World")
else:
  print(b+c)

Fixed submission:
a=int(input())
if a==1:
  print("Hello World")
else:
  b=int(input())
  c=int(input())
  print(b+c)
Buggy python submission (verdict: Runtime Error):
a=list(input())
print(a.replace("1","9").replace("9","1"))

Fixed submission:
a=input()
print(a.replace("1","x").replace("9","1").replace("x","9"))
Buggy python submission (verdict: Runtime Error):


s = raw_input()
print(s.count("+")-s.count("-"))


Fixed submission:
print(4-input().count("-")*2)

Buggy python submission (verdict: Runtime Error):


s=raw_input()
print(s.count("+")-s.count("-"))


Fixed submission:
print(4-input().count("-")*2)

Buggy python submission (verdict: Runtime Error):
a=raw_input()
print(a.count("+")-a.count("-"))

Fixed submission:
print(4-input().count("-")*2)

Buggy python submission (verdict: Runtime Error):
a=raw_input()
print((a.count("+")-(a.count("-"))

Fixed submission:
print(4-input().count("-")*2)

Buggy python submission (verdict: Runtime Error):
print(int(input().count("+"))+(-1*int(input().count("-"))))

Fixed submission:
print(4-input().count("-")*2)
Buggy python submission (verdict: Runtime Error):
a=int(input())
if a>999:
  print("ABC"+a)
else:
  print("ABD"+a%999)

Fixed submission:
a=int(input())
if 1<=a<=999:
  print("ABC")
else:
  print("ABD")
Buggy python submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())
e=abs(a-b)
f=abs(b-c)
g=abs(a-c)
if g>d and e>d or f>d
  print("No")
else:
  print("Yes")

Fixed submission:
a,b,c,d=map(int,input().split())
e=abs(a-b)
f=abs(b-c)
g=abs(a-c)
if g>d and (e>d or f>d):
  print("No")
else:
  print("Yes")
Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
if a+b>=c>=a
  print("YES")
else:
  print("NO")


Fixed submission:
a,b,c=map(int,input().split())
if a+b>=c>=a:
  print("YES")
else:
  print("NO")

Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
if a+b>=c and a<=c
  print("YES")
else:
  print("NO")


Fixed submission:
a,b,c=map(int,input().split())
if a+b>=c>=a:
  print("YES")
else:
  print("NO")
Buggy python submission (verdict: Runtime Error):
a,b,k=map(int,input().split())
if a-b<=c:
  for i in range(a,b):
    print(i)
else:
  for i in range(a,a+c-1):
    print(i)
  for y in range(b-c+1,b):
    print(y)

Fixed submission:
a,b,k=map(int,input().split())
if b-a+1<=k*2:
  for i in range(a,1+b):
    print(i)
else:
  for i in range(a,a+k):
    print(i)
  for y in range(b-k+1,b+1):
    print(y)

Buggy python submission (verdict: Runtime Error):
a,b,k=map(int,input().split())
if a-b<=c:
  for i in range[a:b]:
    print(i)
else:
  for i in range[a:a+c-1]:
     for y in range[b-c+1:b]:
        print(i)
        print(y)

Fixed submission:
a,b,k=map(int,input().split())
if b-a+1<=k*2:
  for i in range(a,1+b):
    print(i)
else:
  for i in range(a,a+k):
    print(i)
  for y in range(b-k+1,b+1):
    print(y)

Buggy python submission (verdict: Runtime Error):
a,b,k=map(int,input().split())
if a-b<=c:
  for i in range[a:b]:
    print(i)
else:
  for i in range[a:a+c-1]:
    print(i)
  for y in range[b-c+1:b]:
    print(y)

Fixed submission:
a,b,k=map(int,input().split())
if b-a+1<=k*2:
  for i in range(a,1+b):
    print(i)
else:
  for i in range(a,a+k):
    print(i)
  for y in range(b-k+1,b+1):
    print(y)

Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
d=c+1
e=b-a
f=0
g=0
if d==e:
  while e>f:
    print(a)
    a+=1
    f+=1
else:
  while c>f:
    print(a)
    a+=1
    f+=1
  while c>g:
    print(b-1)
      b+=1
      g+=1
    
      

Fixed submission:
a,b,k=map(int,input().split())
if b-a+1<=k*2:
  for i in range(a,1+b):
    print(i)
else:
  for i in range(a,a+k):
    print(i)
  for y in range(b-k+1,b+1):
    print(y)
Buggy python submission (verdict: Runtime Error):
a=int(input())
b,c=map(int,input().split())
d=0
while d<a:
  e=int(input())
  if e>0: 
    f=b//e+1
  else:
    f=b//e
  c+=f
print(c)
    
  
  
  


  
  


Fixed submission:
a=int(input())
b,c=map(int,input().split())
d=0
while d<a:
  e=((b-1)//int(input()))+1
  c+=e
  d+=1
print(c)

Buggy python submission (verdict: Runtime Error):
a=int(input())
b,c=map(int,input().split())
d=0
f=0
while d<a:
  e=(b//int(input()))
  if e==0:
    f+=e
  else:
    f+=(e+1)
    c+=f
    d+=1
    print(c)


  
  

Fixed submission:
a=int(input())
b,c=map(int,input().split())
d=0
while d<a:
  e=((b-1)//int(input()))+1
  c+=e
  d+=1
print(c)

Buggy python submission (verdict: Runtime Error):
a=int(input())
b,c=map(int,input().split())
d=0
while d<a:
  e=(b//int(input()))
  if e==0:
    f+=e
  else:
    f+=(e+1)
    c+=f
    d+=1
    print(c)


  
  

Fixed submission:
a=int(input())
b,c=map(int,input().split())
d=0
while d<a:
  e=((b-1)//int(input()))+1
  c+=e
  d+=1
print(c)

Buggy python submission (verdict: Runtime Error):
a=int(input())
b,c=map(int,input().split())
for i in range():
  e=(b//(int(input()))+1
  c+=e
  print(c)

  
  

Fixed submission:
a=int(input())
b,c=map(int,input().split())
d=0
while d<a:
  e=((b-1)//int(input()))+1
  c+=e
  d+=1
print(c)

Buggy python submission (verdict: Runtime Error):
a=int(input())
b,c=map(int,input().split())
d=0
for i in range():
  e=(b//(int(input()))+1
  d+=e
  print(d+c)

  
  

Fixed submission:
a=int(input())
b,c=map(int,input().split())
d=0
while d<a:
  e=((b-1)//int(input()))+1
  c+=e
  d+=1
print(c)

Buggy python submission (verdict: Runtime Error):
a=int(input())
b,c=map(int,input().split())
d=0
for i in range():
  e=(b//(int(input()))+1
  d+=e
  print(d+c)

  
  

Fixed submission:
a=int(input())
b,c=map(int,input().split())
d=0
while d<a:
  e=((b-1)//int(input()))+1
  c+=e
  d+=1
print(c)
Buggy python submission (verdict: Runtime Error):
from math import sprt
a,b=input().split()
c=sqrt(int(a+b))
if c==int(c):
  print("Yes")
else:
  print("No")

Fixed submission:
from math import sqrt
a,b=input().split()
c=sqrt(int(a+b))
if c==int(c):
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
from math import sprt
a,b=map(int,input().split())
c=sqrt(int(a+b))
if c==int(c):
  print("Yes")
else:
  print("No")

Fixed submission:
from math import sqrt
a,b=input().split()
c=sqrt(int(a+b))
if c==int(c):
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
from math import sqrt
a,b=input().split()
c=sqrt.(int(a+b))
if c==int(c):
  print("Yes")
else:
  print("No")

Fixed submission:
from math import sqrt
a,b=input().split()
c=sqrt(int(a+b))
if c==int(c):
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
from marh import sqrt
a,b=input().split()
c=sqrt(int(a+b))
if c==int(c):
  print("Yes")
else:
  print("No")

Fixed submission:
from math import sqrt
a,b=input().split()
c=sqrt(int(a+b))
if c==int(c):
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
a=input()
a[3]="8"
print(a)


Fixed submission:
a=input()
print("2018"+a[4:])

Buggy python submission (verdict: Runtime Error):
a=input()
if a[3]!="8":
    a[3]="8"
    print(a)
else:
    print(a)

Fixed submission:
a=input()
print("2018"+a[4:])

Buggy python submission (verdict: Runtime Error):
a=input()
if a[3]!=8:
    a[3]=8
    print(a)
else:
    print(a)

Fixed submission:
a=input()
print("2018"+a[4:])

Buggy python submission (verdict: Runtime Error):
a=input()
if a[3]!=8:
    a[3]=8
    print(a)

Fixed submission:
a=input()
print("2018"+a[4:])
Buggy python submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())
e=a+b
f=c+d
if e>f:
  print("Left")
elif e=f:
  print("Balanced")
else:
  print("Right")

Fixed submission:
a,b,c,d=map(int,input().split())
e=a+b
f=c+d
if e>f:
  print("Left")
elif e==f:
  print("Balanced")
else:
  print("Right")
Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input(),split())
d=a*b
if d<c:
  print(d)
else:
  print(c)

Fixed submission:
a,b,c=map(int,input().split())
d=a*b
if d<c:
  print(d)
else:
  print(c)
Buggy python submission (verdict: Runtime Error):
a=list(input())
if a[0]=a[1]=a[2] or a[1]=a[2]=a[3]:
    print("Yes")
else:
    print("No")


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

Buggy python submission (verdict: Runtime Error):
a=input()
if a[0]=a[1]=a[2] or a[1]=a[2]=a[3]:
    print("Yes")
else:
    print("No")


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

Buggy python submission (verdict: Runtime Error):
a=list(int(input()))
if a[0]=a[1]=a[2] or a[1]=a[2]=a[3]:
    print("Yes")
else:
    print("No")


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

Buggy python submission (verdict: Runtime Error):
a=list(input())
if a[0]=a[1]=a[2] or a[1]=a[2]=a[3]:
    print("Yes")
else:
    print("No")

Fixed submission:
a=list(input())
if a[0]==a[1]==a[2] or a[1]==a[2]==a[3]:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
a,b=input().split()
if a<b:
  print("<")
elif a==b:
  print("=")
else a>b:
  print(">")


Fixed submission:
a,b=input().split()
if (a<b):
  print("<")
elif (a==b):
  print("=")
else :
  print(">")

Buggy python submission (verdict: Runtime Error):
a,b=input().split()
if a<b
  print("<")
elif a==b:
  print("=")
else a>b:
  print(">")


Fixed submission:
a,b=input().split()
if (a<b):
  print("<")
elif (a==b):
  print("=")
else :
  print(">")

Buggy python submission (verdict: Runtime Error):
a,b=input().split()
if a<b:
  print("<")
elif a==b:
  print("=")
else a>b:
  print(">")


Fixed submission:
a,b=input().split()
if (a<b):
  print("<")
elif (a==b):
  print("=")
else :
  print(">")

Buggy python submission (verdict: Runtime Error):
a,b=input().split()
if c<d:
  print("<")
elif c==d:
  print("=")
else c>d:
  print(">")


Fixed submission:
a,b=input().split()
if (a<b):
  print("<")
elif (a==b):
  print("=")
else :
  print(">")

Buggy python submission (verdict: Runtime Error):
a,b=input().split()
c=ord(input(a))
d=ord(input(b))
if c<d:
  print("<")
elif c==d:
  print("=")
else c>d:
  print(">")


Fixed submission:
a,b=input().split()
if (a<b):
  print("<")
elif (a==b):
  print("=")
else :
  print(">")

Buggy python submission (verdict: Runtime Error):
a,b=input().split()
c=ord(a)
d=ord(b)
if c<d:
  print("<")
elif c==d:
  print("=")
else c>d:
  print(">")

Fixed submission:
a,b=input().split()
if (a<b):
  print("<")
elif (a==b):
  print("=")
else :
  print(">")
Buggy python submission (verdict: Runtime Error):
a=list(input().split())
if a[0]==9 or a[1]==9:
  print("Yes")
else:
  print("No")

Fixed submission:
a=list(input())
if a[0]!="9" and a[1]!="9":
  print("No")
else:
  print("Yes")
Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
if d>c:
  print("delicious")
elif abs(b-c)>a:
  print("dangerous")
else:
  print("safe")

Fixed submission:
a,b,c=map(int,input().split())
if b>=c:
  print("delicious")
elif abs(b-c)>a:
  print("dangerous")
else:
  print("safe")
Buggy python submission (verdict: Runtime Error):
a,b,c=input().split()
s=list(input(a))
f=list(input(b))
g=list(input(c))
if s[-0]==f[0] and f[-0]==g[0]:
  print("YES")
else:
  print("NO")


Fixed submission:
a,b,c=input().split()
s=[a,b,c]
if a[-1]==b[0] and b[-1]==c[0]:
  print("YES")
else:
  print("NO")

Buggy python submission (verdict: Runtime Error):
a,b,c=input().split()
e=list(input(a))
f=list(input(b))
g=list(input(c))
if e[-0]==f[0] and f[-0]==g[0]:
  print("YES")
else:
  print("NO")


Fixed submission:
a,b,c=input().split()
s=[a,b,c]
if a[-1]==b[0] and b[-1]==c[0]:
  print("YES")
else:
  print("NO")

Buggy python submission (verdict: Runtime Error):
a,b,c=input().split()
e=list(input(a))
f=list(input(b))
g=list(input(c))
if e[-0]==f[0] and f[-0]==g[0]
  print("YES")
else:
  print("NO")

Fixed submission:
a,b,c=input().split()
s=[a,b,c]
if a[-1]==b[0] and b[-1]==c[0]:
  print("YES")
else:
  print("NO")
Buggy python submission (verdict: Runtime Error):
a,b,c=input().split()
print(a[0].upper()+b[0].upper()+c[0].upper)
     

Fixed submission:
a,b,c=input().split()
print(a[0].upper()+b[0].upper()+c[0].upper())

Buggy python submission (verdict: Runtime Error):
a,b,c=input().split()
print(a.upper[0]+b.upper[0]+c.upper[0])
     

Fixed submission:
a,b,c=input().split()
print(a[0].upper()+b[0].upper()+c[0].upper())
Buggy python submission (verdict: Runtime Error):
s=[13,1,2,3,4,5,6,7,8,9,10,11,12]
a,b=map(int,input().split())
if s[a-1]==s[b-1]:
  print("Draw")
elif s[a-1]<s[b-1]
  print("Bob")
else:
  print("Alice")

Fixed submission:
s=[13,1,2,3,4,5,6,7,8,9,10,11,12]
a,b=map(int,input().split())
if s[a-1]==s[b-1]:
  print("Draw")
elif s[a-1]<s[b-1]:
  print("Bob")
else:
  print("Alice")
Buggy python submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())
if a*b=c*d:
  print(a*b)
elif a*b>c*d:
  print(a*b)
else:
  print(c*d)

Fixed submission:
a,b,c,d=map(int,input().split())
if a*b==c*d:
  print(a*b)
elif a*b>c*d:
  print(a*b)
else:
  print(c*d)
Buggy python submission (verdict: Runtime Error):
print(input().replace(","," ")

Fixed submission:
print(input().replace(","," "))

Buggy python submission (verdict: Runtime Error):
print(input().replace(","." "))

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


Fixed submission:
print(eval(input()))

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

Fixed submission:
print(eval(input()))

Buggy python submission (verdict: Runtime Error):
a,op,b=input().split()
print(int(a)+input(op)+int(b))

Fixed submission:
print(eval(input()))

Buggy python submission (verdict: Runtime Error):
a,op,b=input().split()
print(int(a)+op+int(b))

Fixed submission:
print(eval(input()))
Buggy python submission (verdict: Runtime Error):
a,b,c=input()
e=list(input(a))
f=list(input(b))
g=list(input(c))
print(e[0]+f[0]+g[0])

Fixed submission:
a,b,c=input().split()
print(a[0][0]+b[0][0]+c[0][0])

Buggy python submission (verdict: Runtime Error):
a,b,c=input()
e=list(input(a))
f=list(input(b))
g=list(input(c))
print(e[0],f[0],g[0])

Fixed submission:
a,b,c=input().split()
print(a[0][0]+b[0][0]+c[0][0])

Buggy python submission (verdict: Runtime Error):
a,b,c=list(input())
print(a[0],b[0],c[0])

Fixed submission:
a,b,c=input().split()
print(a[0][0]+b[0][0]+c[0][0])
Buggy python submission (verdict: Runtime Error):
a=int(input())
c==0
while a==0:
  c+=a
  a-=1
print(int(c))
  


Fixed submission:
a=int(input())
c=0
while a>=0:
  c+=a
  a=a-1
print(int(c))

Buggy python submission (verdict: Runtime Error):
a=int(input())
while a==0:
  c+=a
  a-=1
print(int(c))
  


Fixed submission:
a=int(input())
c=0
while a>=0:
  c+=a
  a=a-1
print(int(c))
Buggy python submission (verdict: Runtime Error):
n,l=map(int,input().split())
c=[]
for i range(n):
  c.append(input())
c.sort()
print(''.join(c))
  
    


Fixed submission:
n,l=map(int,input().split())
c=[]
for i in range(n):
  c.append(input())
c.sort()
print("".join(c))

Buggy python submission (verdict: Runtime Error):
n,l=map(int,input().split())
c=[]
for i range(n):
  c.append(input())
c.sort()
print("".join(c))
  
    


Fixed submission:
n,l=map(int,input().split())
c=[]
for i in range(n):
  c.append(input())
c.sort()
print("".join(c))

Buggy python submission (verdict: Runtime Error):
n,l=map(int,input().split())
c=[]
for i range(n):
  c.append(input())
c.sort()
print("",join(c))
  
    


Fixed submission:
n,l=map(int,input().split())
c=[]
for i in range(n):
  c.append(input())
c.sort()
print("".join(c))

Buggy python submission (verdict: Runtime Error):
n,l=map(int.input().split())
c=[]
for i in range(n):
  c.append(input())
c.sort()
print("".join(c))

Fixed submission:
n,l=map(int,input().split())
c=[]
for i in range(n):
  c.append(input())
c.sort()
print("".join(c))

Buggy python submission (verdict: Runtime Error):
n,l=map(int.input().split())
c=[]
for i in range(n):
  c.append(input())
c.sort
print(c)

Fixed submission:
n,l=map(int,input().split())
c=[]
for i in range(n):
  c.append(input())
c.sort()
print("".join(c))
Buggy python submission (verdict: Time Limit Exceeded):
import sys
 
stdin = sys.stdin
 
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces
 
n, m, p = na()
 
def bf(es, n, start):
    d = [999999999999] * n
    d[start] = 0
 
    for r in range(n-1):
        updated = False
        for e in es:
            if d[e[0]] == 999999999999:
                continue
            if d[e[0]] + e[2] < d[e[1]]:
                d[e[1]] = d[e[0]] + e[2]
                updated = True
        if not updated:
            break
 
    for e in es:
        if d[e[0]] < 999999999999 and d[e[0]] + e[2] < d[e[1]]:
            return None
 
    return d
 
es = []
for i in range(m):
    a, b, c = na()
    es.append((a-1, b-1, -(c-p)))
 
import collections
q = collections.deque()
q.append(n-1)
 
valid = [False] * n
valid[n-1] = True
while len(q) > 0:
    cur = q.popleft()
    for e in es:
        if e[1] == cur and not valid[e[0]]:
            valid[e[0]] = True
            q.append(e[0])
 
nes = []
for e in es:
    if valid[e[0]] and valid[e[1]]:
        nes.append(e)
es = nes
 
d = bf(es, n, 0)
if not d:
    print(-1)
else:
    print(max(0, -d[n-1]))

Fixed submission:
import sys
 
stdin = sys.stdin
 
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces
 
n, m, p = na()
 
def bf(es, n, start):
    d = [999999999999] * n
    d[start] = 0
 
    for r in range(n-1):
        updated = False
        for e in es:
            if d[e[0]] == 999999999999:
                continue
            if d[e[0]] + e[2] < d[e[1]]:
                d[e[1]] = d[e[0]] + e[2]
                updated = True
        if not updated:
            break
 
    for e in es:
        if d[e[0]] < 999999999999 and d[e[0]] + e[2] < d[e[1]]:
            return None
 
    return d
 
es = []
for i in range(m):
    a, b, c = na()
    es.append((a-1, b-1, -(c-p)))
 
import collections
q = collections.deque()
q.append(n-1)
 
valid = [False] * n
valid[n-1] = True
while len(q) > 0:
    cur = q.popleft()
    for e in es:
        if e[1] == cur and not valid[e[0]]:
            valid[e[0]] = True
            q.append(e[0])
 
nes = []
for e in es:
    if valid[e[0]] and valid[e[1]]:
        nes.append(e)
es = nes
 
d = bf(es, n, 0)
if not d:
    print(-1)
else:
    print(max(0, -d[n-1]))