Tags: python sql 

Rating:

Using Ctrl+F in the .sql file, I found that Remizide had an ID of 13.
Therefore, we can write a short Python script to parse it:

```
'''
# MAKE NEW LINES

r = open('inventory.txt', 'r').read()
w = open('inventory_newline.txt', 'w')

r = r.split('),')
for line in r:
w.write(line)
w.write('),\n')
w.close()
'''

f = open('inventory_newline.txt', 'r')

a = [0] * 1501 # there exist 1500 cities
for line in f:
line = line.split(',')
if int(line[1]) == 13:
a[int(line[2])] += int(line[4][:-1])

m = 0
mi = 0
for i in range(len(a)):
if a[i] > m:
m = a[i]
mi = i
print(m, mi)
```

Note that the first half of the code that is commented out is just for the purpose of making a file that is easier to parse through.
This gives us an ID of 531, which corresponds to Miami in the .sql file!

flag{Miami}