手写hash(int对int)

#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
namespace Hash{
    struct Line{int u, v, next;}e[1000000];
    const int HashMod=100007;
    int h[HashMod], cnt;
    inline int Add(int u, int v, int w){e[++cnt] = (Line){w, v, h[u]}; h[u] = cnt;return v;}
    inline void clear(){memset(h, 0, sizeof(h)); cnt = 0;}
    inline void insert(int x, int k = 0){//插入新的映射对
        int s = x % HashMod;
        Add(s, k, x);
    }
    void updata(int x, int k = 0){//修改映射值
            int s = x % HashMod;
            for(int i = h[s]; i; i = e[i].next)
                if(e[i].u == x){
                    e[i].v = k;
                    return;
                } 
            Add(s, k, x);
        }
    inline int query(int x){//查询映射值
        int s = x % HashMod;
        for(int i = h[s]; i; i = e[i].next)
            if(e[i].u == x)    return e[i].v;
        return 0;
    }
    inline int count(int x){//判断是否存在映射的键值
        int s = x % HashMod;
        for(int i = h[s]; i; i = e[i].next)
            if(e[i].u == x)    return 1;
        return 0;
    }
    inline int add(int x)//映射值自加1
    {
        int s = x % HashMod;
        for(int i = h[s]; i; i = e[i].next)
            if(e[i].u == x)    return e[i].v = e[i].v + 1;
        return Add(s, 1, x);
    }
    inline int sub(int x)//映射值自减1
    {
        int s = x % HashMod;
        for(int i = h[s]; i; i = e[i].next)
            if(e[i].u == x)    return e[i].v = e[i].v - 1;
        return Add(s, -1, x);
    }
}