towns.cpp: In function 'int hubDistance(int, int)':
towns.cpp:31:7: warning: conversion from 'long long int' to 'std::map<int, int>::key_type' {aka 'int'} may change value [-Wconversion]
31 | cnt[D]++;
| ^
towns.cpp:32:10: warning: conversion from 'long long int' to '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} may change value [-Wconversion]
32 | f[i] = D;
| ^
towns.cpp:38:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
38 | for(int i = 0; i < v.size(); i++) {
| ~~^~~~~~~~~~
towns.cpp:43:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
43 | for(int i = 0; i < v.size(); i++) {
| ~~^~~~~~~~~~
towns.cpp:47:31: warning: conversion from '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} to 'std::map<int, int>::key_type' {aka 'int'} may change value [-Wconversion]
47 | if(cnR <= n / 2 && cnt[v[i]] <= n / 2 && n - cnR - cnt[v[i]] <= n / 2) return R;
| ^
towns.cpp:47:63: warning: conversion from '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} to 'std::map<int, int>::key_type' {aka 'int'} may change value [-Wconversion]
47 | if(cnR <= n / 2 && cnt[v[i]] <= n / 2 && n - cnR - cnt[v[i]] <= n / 2) return R;
| ^
towns.cpp:47:82: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
47 | if(cnR <= n / 2 && cnt[v[i]] <= n / 2 && n - cnR - cnt[v[i]] <= n / 2) return R;
| ^
towns.cpp:49:41: warning: conversion from '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} to 'std::map<int, int>::key_type' {aka 'int'} may change value [-Wconversion]
49 | if(cnR <= n / 2 && n - cnR - cnt[v[i]] <= n / 2) {
| ^
towns.cpp:55:25: warning: declaration of 'V' shadows a previous local [-Wshadow]
55 | int u = a.back(), V = j;
| ^
towns.cpp:13:13: note: shadowed declaration is here
13 | int U = 0, V = 0;
| ^
towns.cpp:67:9: warning: declaration of 'V' shadows a previous local [-Wshadow]
67 | int V = a.back(), F = 0;
| ^
towns.cpp:13:13: note: shadowed declaration is here
13 | int U = 0, V = 0;
| ^
towns.cpp:82:25: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
82 | if(b.size()) return -R;
| ^~
towns.cpp:83:31: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
83 | if(F || !a.size()) return R;
| ^
towns.cpp:84:12: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
84 | return -R;
| ^~
towns.cpp:87:18: warning: conversion from '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} to 'std::map<int, int>::key_type' {aka 'int'} may change value [-Wconversion]
87 | cnR += cnt[v[i]];
| ^
towns.cpp:89:9: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
89 | return -R;
| ^~
towns.cpp:12:28: warning: unused parameter 'sub' [-Wunused-parameter]
12 | int hubDistance(int n, int sub) {
| ~~~~^~~