<commit_before>od = 0
dist = 0
tsplib = ""
time = ""
filename = raw_input()
print("Enter output filename: ")
output_file = raw_input()

with open(filename, "r" ) as f:
	for lines in f:
		line = lines.split(' ')
		if "Optimal_Distance" in line:
			od = line[len(line)-1]
		elif "Min_distance_found" in line:
			dist = line[len(line)-1]
		elif "TSP_Instance" in line:
			tsplib = line[len(line)-1]
			if "\n" in tsplib:
				tsplib = tsplib[:-1]
		elif "Time_taken" in line:
			time = line[len(line)-1]
import os.path
firstline = os.path.isfile(output_file)	

with open(output_file, "a+") as f:
	if not firstline:
		f.write("TSPInstance\tError Rate(%)\t\tTime of Execution\n")
	error = "NA"
	if od!=0:
		error = 100*(float(dist) - float(od))/float(od)
	f.write(tsplib+"\t\t"+ "%.2f"%round(error,2) +"\t\t"+ str(time))<commit_msg>Changed error_rate.py for printing Distance calculated<commit_after>od = 0
dist = 0
tsplib = ""
time = ""
filename = raw_input()
print("Enter output filename: ")
output_file = raw_input()

with open(filename, "r" ) as f:
	for lines in f:
		line = lines.split(' ')
		if "Optimal_Distance" in line:
			od = line[len(line)-1]
		elif "Min_distance_found" in line:
			dist = line[len(line)-1]
		elif "TSP_Instance" in line:
			tsplib = line[len(line)-1]
			if "\n" in tsplib:
				tsplib = tsplib[:-1]
		elif "Time_taken" in line:
			time = line[len(line)-1]
import os.path
firstline = os.path.isfile(output_file)	

with open(output_file, "a+") as f:
	if not firstline:
		f.write("TSPInstance\tError Rate(%)\t\tDistance\t\tTime of Execution\n\n")
	error = "NA"
	if od!=0:
		error = 100*(float(dist) - float(od))/float(od)
	f.write(tsplib+"\t\t"+ "%.2f"%round(error,2) +"\t\t"+ str(dist)+"\t\t"+str(time)+"\n")
{'fraction_non_alphanumeric': 0.18160786581839214, 'fraction_numerical': 0.015037593984962405, 'mean_word_length': 4.043731778425656, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5482319', 'n_tokens_mistral': 762, 'n_tokens_neox': 708, 'n_words': 166}