diff --git a/.gitignore b/.gitignore
index de5f9a2..8f78f5b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -128,6 +128,4 @@ bin/
 include/
 *.cfg
 migrations/
-config.py
 lib64
-
diff --git a/Procfile b/Procfile
new file mode 100644
index 0000000..ca6e941
--- /dev/null
+++ b/Procfile
@@ -0,0 +1 @@
+web: gunicorn app:app
diff --git a/README.md b/README.md
index 4a32af2..2ae5925 100644
--- a/README.md
+++ b/README.md
@@ -4,13 +4,16 @@
 
 # 説明
 
-　閲覧機能・投稿機能・いいね機能・ランキング機能を持ったWebアプリを目指します。<br>
+　閲覧機能・投稿機能・いいね機能・タグ機能・ランキング機能を持ったWebアプリです。<br>
 
 ・解法の投稿・解法ブログのURLの投稿<br>
-ー＞バラバラだった多くの解法が、１箇所に集まることを目指します。<br>
+->バラバラだった多くの解法が、１箇所に集まることを目指します。<br>
 
 ・いいね機能<br>
-ー＞いいね順に並び替えることで、より質の高い解法が探しやすくなることを目指します。<br>
+->いいね順に並び替えることで、より質の高い解法が探しやすくなることを目指します。<br>
 
 ・ランキング機能<br>
-ー＞最もわかりやすい解説者は誰なのかをハッキリさせることを目指します。<br>
+->最もわかりやすい解説者は誰なのかをハッキリさせることを目指します。<br>
+
+・タグ機能<br>
+->ジャンルから問題を選択できる、そんな精進の形を提供することを目指します。<br>
diff --git a/app.py b/app.py
new file mode 100644
index 0000000..d0ef95e
--- /dev/null
+++ b/app.py
@@ -0,0 +1,441 @@
+from flask import Flask, render_template, request,url_for, redirect,session,jsonify,abort, make_response, current_app
+from flask_sqlalchemy import SQLAlchemy
+from sqlalchemy import desc
+from flask_migrate import Migrate
+from flask_login import UserMixin, LoginManager, login_user, logout_user, current_user
+from datetime import datetime
+from rauth import OAuth1Service
+import requests
+import json
+from collections import defaultdict
+from config import app, db, service, login_manager,csrf
+
+#ユーザー情報
+class User(UserMixin,db.Model):
+    id = db.Column(db.Integer, primary_key=True)
+    username = db.Column(db.String(64), index=True)
+    description = db.Column(db.String(1024), index=True)
+    user_image_url = db.Column(db.String(1024), index=True)
+    date_published = db.Column(db.DateTime, nullable=False, default=datetime.utcnow)
+    twitter_id = db.Column(db.String(64), nullable=False, unique=True)
+    like_sum=db.Column(db.Integer)
+
+#解法情報
+class Editorial(db.Model):
+    id = db.Column(db.Integer, primary_key=True)
+    username = db.Column(db.String(64))
+    contestname = db.Column(db.String(64))
+    title = db.Column(db.String(64))
+    url = db.Column(db.String(1024))
+    description = db.Column(db.String(3000))
+    like = db.Column(db.Integer)
+    user_image_url = db.Column(db.String(1024), index=True)
+    user_id=db.Column(db.Integer)
+    problem_id=db.Column(db.String(64))
+    
+
+#いいね情報
+class Like(db.Model):
+    id=db.Column(db.Integer,primary_key=True)
+    user_id=db.Column(db.Integer)
+    edit_id=db.Column(db.Integer)
+
+class Tag(db.Model):
+    id=db.Column(db.Integer,primary_key=True)
+    problem_id=db.Column(db.String(64))
+    tag=db.Column(db.String(64))
+    user_id=db.Column(db.Integer)
+
+class problem_tag(db.Model):
+    id=db.Column(db.Integer,primary_key=True)
+    problem_official_name=db.Column(db.String(64))
+    problem_name=db.Column(db.String(64))
+    first_tag=db.Column(db.String(64))
+
+#コンテスト名に含まれる空白などを取り除く
+def _normalize_contestname(contestname):
+    if isinstance(contestname, str):
+        contestname = contestname.strip()
+    return contestname
+
+
+@app.route('/')
+def index():
+    return render_template('index.html')
+
+@app.route('/search', methods=['GET'])
+def contest_search():
+    #JSON取得　
+    get_problem=requests.get('https://kenkoooo.com/atcoder/resources/problems.json')
+    get_contest=requests.get('https://kenkoooo.com/atcoder/resources/contests.json')
+    #list型に変換
+    get_problem=get_problem.json()
+    get_contest=get_contest.json()
+
+    #コンテストを新しい順に並び替える
+    contest_list=sorted(get_contest,key=lambda x: x['start_epoch_second'],reverse=True)
+    #最新のコンテスト名
+    contestname=contest_list[0]['id']
+
+    #新着問題を取得する
+    problem_list=[]
+    for problem in get_problem:
+        if problem['contest_id']==contestname:
+            problem_list.append((problem['title'],problem['id']))
+
+    return render_template('search.html',problems=problem_list)
+
+@app.route('/tag_search',methods=['POST'])
+def tag_search():
+    tagName=request.args.get('tagName')
+    problems=db.session.query(problem_tag).filter(problem_tag.first_tag==tagName)
+    return render_template('tag_result.html',tagName=tagName,problems=problems)
+
+@app.route('/search/<problem_id>/<int:page>', methods=['GET','POST'])
+def contest_get(problem_id,page=1):
+    contestname = _normalize_contestname(request.args.get('contestname'))
+    
+    get_problem=requests.get('https://kenkoooo.com/atcoder/resources/problems.json')
+    get_problem=get_problem.json()
+
+    contest_id=''
+    for problem in get_problem:
+        if problem_id==problem['id']:
+            contest_id=problem['contest_id']
+            break
+
+    tag_flag=False
+
+    if current_user.is_authenticated==True:
+         voted=db.session.query(Tag).filter(Tag.user_id==current_user.id,Tag.problem_id==problem_id).first()
+         if voted==None:
+             tag_flag=True
+    
+    tags=db.session.query(Tag).filter(Tag.problem_id==problem_id)
+    vote_num=defaultdict(int)
+    for t in tags:
+        vote_num[t.tag]+=1
+    
+    vote_num= sorted(vote_num.items(), key=lambda x:x[1],reverse=True)
+
+    tag=None
+    if len(vote_num)!=0:
+        tag=vote_num[0][0]
+    
+
+    #ページネーション
+    per_page = 10
+    editorials = db.session.query(Editorial).filter_by(problem_id=problem_id).order_by(desc(Editorial.like)).paginate(page, per_page, error_out=False)
+    
+    #ログインしている場合は、既にいいねしている「いいね欄」を塗りつぶす
+    if current_user.is_authenticated==True:
+        flag={}
+        for edit in editorials.items:
+            like=db.session.query(Like).filter(Like.edit_id==edit.id,Like.user_id==current_user.id).first()
+            if like:
+                flag[edit.id]=True
+            else:
+                flag[edit.id]=False
+
+        return render_template('contest.html', contestname=contestname, editorials=editorials,flag=flag,problem_id=problem_id,contest_id=contest_id,tag_flag=tag_flag,tag=tag)
+    else:
+        return render_template('contest.html',contestname=contestname,editorials=editorials,problem_id=problem_id,contest_id=contest_id,tag_flag=tag_flag,tag=tag)
+
+@app.route('/tag_vote',methods=['POST'])
+def tag_vote(): 
+    params={
+        'problem_id':request.args.get('problem_id'),
+        'tag':request.args.get('tagName'),
+        'user_id':current_user.id
+    }
+    newTag=Tag(**params)
+    db.session.add(newTag)
+    db.session.commit()
+
+    tag=db.session.query(problem_tag).filter_by(problem_official_name=params['problem_id']).first()
+
+    if tag==None:
+        tag_params={
+            'problem_official_name':params['problem_id'],
+            'problem_name':request.args.get('problem_name'),
+            'first_tag':params['tag']
+        }
+        newProblemTag=problem_tag(**tag_params)
+        db.session.add(newProblemTag)
+        db.session.commit()
+
+    else:
+        tags=db.session.query(Tag).filter(Tag.problem_id==params['problem_id'])
+        vote_num=defaultdict(int)
+
+        for t in tags:
+             vote_num[t.tag]+=1
+        
+        vote_num= sorted(vote_num.items(), key=lambda x:x[1],reverse=True)
+
+        tag_=None
+        if len(vote_num)!=0:
+             tag_=vote_num[0][0]
+         
+        if tag !=None:
+             tag.first_tag=tag_
+             db.session.commit()
+
+    return render_template('vote_fin.html')
+
+@app.route('/submited', methods=['POST','GET'])
+def submit():
+    #DBに挿入する解法情報
+    params = {
+        'title': request.form.get('title'),
+        'description': request.form.get('description'),
+        'contestname': _normalize_contestname(request.form.get('contestname')),
+        'problem_id':request.form.get('problem_id'),
+        'url': request.form.get('url'),
+        'like':int(0),
+        'user_image_url': current_user.user_image_url,
+        'username': current_user.username,
+        'user_id':current_user.id
+    }   
+    
+    if params['description']!=None:
+            params['description']=params['description'].replace('\r\n','<br>')
+
+
+    #必要量記入されているかチェック
+    if (params['description'] is not None and params['description'] is not '') or ((params['url'] is not None and params['url'] is not '')\
+          and (params['title'] is not None and params['title'] is not '')):
+        newEditorial = Editorial(**params)
+        db.session.add(newEditorial)
+        db.session.commit()
+        return render_template('submited.html')
+    else:
+        if params['title'] is None:
+            return render_template('error.html', message='Error:タイトルを入力して下さい。')
+        else:
+            return render_template('error.html', message='Error:URLまたは解説文を入力して下さい。')
+
+#編集
+@app.route('/edit',methods=['POST'])
+def edit():
+    id=request.form['edit_id']
+    edit=Editorial.query.filter_by(id=id).first()
+    description=edit.description.replace('<br>','&#13')
+    return render_template('edit.html',edit=edit,description=description)
+
+@app.route('/edit_fin',methods=['POST'])
+def edit_fin():
+    id=request.form['id']
+    edit=Editorial.query.filter_by(id=id).first()
+
+    edit.title=request.form['title']
+    edit.url=request.form['url']
+
+    description=request.form['description']
+    if description!=None:
+            description=description.replace('\r\n','<br>')
+    
+    edit.description=description
+
+    db.session.commit()
+
+    return render_template('edit_fin.html')
+
+@app.route('/user/<int:id>/<int:page>',methods=['GET'])
+def user(id,page=1):
+    user=User.query.filter_by(id=id).first()
+
+    #ページネーション
+    per_page=10
+    edit=Editorial.query.filter_by(user_id=id).paginate(page, per_page, error_out=False)
+
+    #投稿数
+    editorials=Editorial.query.filter_by(user_id=id).all()
+    num=len(editorials)
+
+    flag={}
+    #ログインしている場合は、既にいいねしている「いいね欄」を塗りつぶす
+    if current_user.is_authenticated==True:
+        for edit_ in editorials:
+            like=db.session.query(Like).filter(Like.edit_id==edit_.id,Like.user_id==current_user.id).first()
+            if like:
+                flag[edit_.id]=True
+            else:
+                flag[edit_.id]=False
+
+    #順位計算（繰り上がり処理付き）
+    rank_dict=dict({})
+    user_list=db.session.query(User).order_by(desc(User.like_sum)).all()
+
+    for  i in user_list:
+        rank_dict[i.like_sum]=-1
+        
+    for i in range(0,len(user_list)):
+        if rank_dict[user_list[i].like_sum]!=-1:
+            continue
+        else:
+            rank_dict[user_list[i].like_sum]=i+1
+    rank=rank_dict[user.like_sum]
+    
+    #登録日(何時何分何秒は除いている)
+    date_published=str(user.date_published)
+    date_published=date_published.split(' ')[0]
+
+    return render_template('user.html',user=user,edit=edit,num=num,rank=rank,flag=flag,date_published=date_published)
+
+@app.route('/ranking/<int:page>')
+def ranking(page=1):
+    #ページネーション
+    per_page = 100
+    users=db.session.query(User).order_by(desc(User.like_sum)).paginate(page, per_page, error_out=False)
+
+    #順位計算（繰り上がり処理付き）
+    rank=dict({})
+    user=db.session.query(User).order_by(desc(User.like_sum)).all()
+    for  i in user:
+        rank[i.like_sum]=-1
+    
+    for i in range(0,len(user)):
+        if rank[user[i].like_sum]!=-1:
+            continue
+        else:
+            rank[user[i].like_sum]=i+1
+
+    return render_template('ranking.html',users=users,page=page,per_page=per_page,rank=rank)
+
+#Twitterログアウト
+@app.route('/logout')
+def logout():
+    logout_user()
+    return redirect(url_for('index'))
+
+#Twitterログイン処理
+@app.route('/oauth/twitter')
+def oauth_authorize():
+    if not current_user.is_anonymous:
+        return redirect(url_for('index'))
+    else:
+        request_token = service.get_request_token(params={
+            'oauth_callback': url_for('oauth_callback', provider='twitter', _external=True)
+        })
+        session['request_token'] = request_token
+        return redirect(service.get_authorize_url(request_token[0]))
+
+
+@app.route('/oauth/twitter/callback')
+def oauth_callback():
+    request_token = session.pop('request_token')
+    oauth_session = service.get_auth_session(
+        request_token[0],
+        request_token[1],
+        data={
+            'oauth_verifier': request.args['oauth_verifier']
+        }
+    )
+
+    profile = oauth_session.get('account/verify_credentials.json').json()
+
+    twitter_id = str(profile.get('id'))
+    username = str(profile.get('name'))
+    description = str(profile.get('description'))
+    profile_image_url = str(profile.get('profile_image_url'))
+    user = db.session.query(User).filter(User.twitter_id == twitter_id).first()
+
+    if user:
+        user.twitter_id = twitter_id
+        user.username = username
+    else:
+        user = User(
+            twitter_id=twitter_id,
+            username=username,
+            description=description,
+            user_image_url=profile_image_url,
+            like_sum=int(0)
+        )
+        db.session.add(user)
+
+    db.session.commit()
+    login_user(user, True)
+    return redirect(url_for('index'))
+
+#いいね処理
+@app.route('/like',methods=['POST'])
+def like():
+    id=request.args.get('id')
+
+    #いいねを既にされているかどうか
+    flag=db.session.query(Like).filter(Like.edit_id==id).filter(Like.user_id==current_user.id).first()
+    #解法情報
+    edit=db.session.query(Editorial).filter(Editorial.id==id).first()
+    #ユーザー情報
+    user=db.session.query(User).filter(User.id==edit.user_id).first()
+
+    #既にいいねされていた場合
+    newLike=Like(user_id=current_user.id,edit_id=id)
+    if flag!=None:
+        #解法情報のいいね数と投稿者の総いいね数を減らす
+        edit.like-=1
+        user.like_sum-=1
+        db.session.delete(flag)
+
+    #まだいいねされていなかった場合
+    else:
+        #解法情報のいいね数と投稿者の総いいね数を増やす
+        edit.like+=1
+        user.like_sum+=1
+        db.session.add(newLike)
+
+    db.session.commit()
+
+    return 'hoge'
+
+#解法消去処理
+@app.route('/delete',methods=['GET'])
+def delete():
+    edit=db.session.query(Editorial).filter(Editorial.id==request.args.get('id')).first()
+
+    #投稿者の総いいね数から、消去する解法のいいね数を減らす
+    user=db.session.query(User).filter(User.id==edit.user_id).first()
+    user.like_sum-=edit.like
+
+    #いいねテーブルから消去する記事の情報を全て消す
+    like=db.session.query(Like).filter(Like.edit_id==edit.id).all()
+    for i in like:
+        db.session.delete(i)
+
+    db.session.delete(edit)
+    db.session.commit()
+
+    return 'hoge'
+
+@app.route('/getName',methods=['GET'])
+def getName():
+    res=requests.get('https://kenkoooo.com/atcoder/resources/problems.json')
+    return jsonify(res.json())
+
+
+#エラー処理
+@app.errorhandler(401)
+def authentication_failed(error):
+    return render_template('401.html'),401
+
+@app.errorhandler(404)
+def page_not_found(error):
+    return render_template('404.html'),404
+
+@app.errorhandler(500)
+def page_not_found(error):
+    return render_template('500.html'),500
+
+@login_manager.user_loader
+def load_user(id):
+    return User.query.get(int(id))
+
+
+@app.cli.command('initdb')
+def initdb_command():
+    db.create_all()
+
+
+if __name__ == '__main__':
+    app.run(debug=True)
\ No newline at end of file
diff --git a/app/app.py b/app/app.py
deleted file mode 100644
index d612189..0000000
--- a/app/app.py
+++ /dev/null
@@ -1,119 +0,0 @@
-from flask import Flask,render_template,request,url_for,redirect,session
-from flask_sqlalchemy import SQLAlchemy
-from flask_migrate import Migrate
-from flask_login import UserMixin,LoginManager,login_user,logout_user,current_user
-from datetime import datetime
-from rauth import OAuth1Service
-
-from config import app,db,service,login_manager
-
-class User(UserMixin,db.Model):
-    id=db.Column(db.Integer,primary_key=True)
-    username=db.Column(db.String(64),index=True)
-    description=db.Column(db.String(1024),index=True)
-    user_image_url=db.Column(db.String(1024),index=True)
-    date_published=db.Column(db.DateTime,nullable=False,default=datetime.utcnow)
-    twitter_id=db.Column(db.String(64),nullable=False,unique=True)
-
-class Editorial(db.Model):
-    id=db.Column(db.Integer,primary_key=True)
-    username=db.Column(db.String(64))
-    contestname=db.Column(db.String(64))
-    title=db.Column(db.String(64))
-    url=db.Column(db.String(120))
-    description=db.Column(db.String(1024))
-    like=db.Column(db.Integer)
-    user_image_url=db.Column(db.String(1024),index=True)
-
-
-@app.route('/')
-def index():
-    return render_template('index.html')
-
-
-@app.route('/search',methods=["GET"])
-def contest_search():
-    return render_template('search.html')
-
-
-@app.route('/search/contest',methods=["POST"])
-def contest_get():
-    if request.form['contestname']:
-        #データベースからコンテスト名と等しいものを取得する
-        editorials=Editorial.query.filter_by(contestname=request.form['contestname']).all()
-
-        return render_template('contest.html',contestname=request.form.get('contestname',None),editorials=editorials)
-    else:
-        return render_template('error.html',message="Error:指定されたコンテストが見つかりません、もう一度お確かめください。")
-
-@app.route('/submited',methods=["POST"])
-def submit():
-    if (request.form.get('description',None)!=None or request.form.get('url',None)!=None) and request.form.get('title',None):
-        newEditorial=Editorial(title=request.form.get('title',None),description=request.form.get('description',None),contestname=request.form.get('contestname',None),url=request.form.get('url',None),user_image_url=current_user.user_image_url,username=current_user.username)
-        db.session.add(newEditorial)
-        db.session.commit()
-        return render_template("submited.html")
-    else:
-        if request.form.get('title',None)==None:
-            return render_template("error.html",message="Error:タイトルを入力して下さい。")
-        else:
-            return render_template("error.html",message="Error:URLまたは解説文を入力して下さい。")
-
-
-@app.route('/logout')
-def logout():
-    logout_user()
-    return redirect(url_for('index'))
-
-@app.route('/oauth/twitter')
-def oauth_authorize():
-    if not current_user.is_anonymous:
-        return redirect(url_for('index'))
-    else:
-        request_token=service.get_request_token(params={'oauth_callback':url_for('oauth_callback',provider='twitter',_external=True)})
-        session['request_token']=request_token
-        return redirect(service.get_authorize_url(request_token[0]))
-
-@app.route('/oauth/twitter/callback')
-def oauth_callback():
-    request_token=session.pop('request_token')
-    oauth_session=service.get_auth_session(
-        request_token[0],
-        request_token[1],
-        data={'oauth_verifier':request.args['oauth_verifier']}
-    )
-
-    profile=oauth_session.get('account/verify_credentials.json').json()
-    
-    twitter_id=str(profile.get('id'))
-    username=str(profile.get('name'))
-    description=str(profile.get('description'))
-    profile_image_url=str(profile.get('profile_image_url'))
-    user=db.session.query(User).filter(User.twitter_id==twitter_id).first()
-
-    if user:
-        user.twitter_id=twitter_id
-        user.username=username
-    else:
-        user=User(twitter_id=twitter_id,
-        username=username,
-        description=description,
-        user_image_url=profile_image_url)
-        db.session.add(user)
-    
-    db.session.commit()
-    login_user(user,True)
-    return redirect(url_for('index'))
-
-
-@login_manager.user_loader
-def load_user(id):
-    return User.query.get(int(id))
-
-@app.cli.command('initdb')
-def initdb_command():
-    db.create_all()
-
-
-if __name__=="__main__":
-    app.run(debug=True)
\ No newline at end of file
diff --git a/app/static/script.js b/app/static/script.js
deleted file mode 100644
index ee51048..0000000
--- a/app/static/script.js
+++ /dev/null
@@ -1,38 +0,0 @@
-(async function() {
-
-    const contestName = [];
-    $.ajax({
-        type: 'GET',
-        url: 'https://kenkoooo.com/atcoder/resources/contests.json',
-        dataType: 'json',
-        success: function(json) {
-            var len = json.length;
-            for (var i = 0; i < len; i++) {
-                contestName.push(json[i].title);
-            }
-        }
-    });
-
-    //検索候補を表示する。
-    $('#autocomplete_search').autocomplete({
-        source: contestName,
-        autoFocus: true,
-        delay: 100,
-        minLength: 2,
-        appendTo: "menu",
-
-        //候補をクリックすることでsubmitできるようにする
-        select: function(event, ui) {
-            $("#autocomplete_search").val(ui.item.label);
-            $("#search").submit();
-        }
-    });
-
-})();
-
-//input内でのEnter無効化
-$(function() {
-    $(document).on("keypress", "input:not(.allow_submit)", function(event) {
-        return event.which !== 13;
-    });
-});
\ No newline at end of file
diff --git a/app/static/style.css b/app/static/style.css
deleted file mode 100644
index e5ae75e..0000000
--- a/app/static/style.css
+++ /dev/null
@@ -1,19 +0,0 @@
-textarea {
-    vertical-align: top;
-}
-
-a,
-a:focus {
-    outline: none;
-}
-
-button,
-input,
-input:focus {
-    outline: none;
-}
-
-input::-moz-focus-inner,
-button::-moz-focus-inner {
-    border: none;
-}
\ No newline at end of file
diff --git a/app/templates/_pagination.html b/app/templates/_pagination.html
deleted file mode 100644
index 7524b1f..0000000
--- a/app/templates/_pagination.html
+++ /dev/null
@@ -1,25 +0,0 @@
-{% macro pagination_widget(pagination, endpoint, fragment='') %}
-<ul class="pagination">
-    <li{% if not pagination.has_prev %} class="disabled" {% endif %}>
-        <a href="{% if pagination.has_prev %}{{ url_for(endpoint, page=pagination.prev_num, **kwargs) }}{{ fragment }}{% else %}#{% endif %}">
-            &laquo;
-        </a>
-        </li>
-        {% for p in pagination.iter_pages() %} {% if p %} {% if p == pagination.page %}
-        <li class="active">
-            <a href="{{ url_for(endpoint, page = p, **kwargs) }}{{ fragment }}">{{ p }}</a>
-        </li>
-        {% else %}
-        <li>
-            <a href="{{ url_for(endpoint, page = p, **kwargs) }}{{ fragment }}">{{ p }}</a>
-        </li>
-        {% endif %} {% else %}
-        <li class="disabled"><a href="#">&hellip;</a></li>
-        {% endif %} {% endfor %}
-        <li{% if not pagination.has_next %} class="disabled" {% endif %}>
-            <a href="{% if pagination.has_next %}{{ url_for(endpoint, page=pagination.next_num, **kwargs) }}{{ fragment }}{% else %}#{% endif %}">
-                &raquo;
-            </a>
-            </li>
-</ul>
-{% endmacro %}
\ No newline at end of file
diff --git a/app/templates/contest.html b/app/templates/contest.html
deleted file mode 100644
index aafa2e7..0000000
--- a/app/templates/contest.html
+++ /dev/null
@@ -1,115 +0,0 @@
-<!DOCTYPE html>
-<html lang="ja">
-
-<head>
-    <meta charset="utf-8" />
-    <meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no">
-    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
-    <title>AtCoder Editorials</title>
-</head>
-
-<body style="padding-top:5rem">
-    <noscript>You need to enable JavaScript to run this app.</noscript>
-
-    <nav class="navbar navbar-expand-md  navbar-dark bg-dark fixed-top">
-        <a href="/" class="navbar-brand">AtCoder Editorials</a>
-
-        <button class="navbar-toggler" data-toggle="collapse" data-target="#nav1">
-            <span class="navbar-toggler-icon"></span>
-        </button>
-
-        <div class="collapse navbar-collapse" id="nav1">
-            <ul class="navbar-nav">
-                <li class="nav-item"><a href="/" class="nav-link">ホーム</a></li>
-                <li class="nav-item active"><a href="/search" class="nav-link">コンテスト</a></li>
-            </ul>
-            {% if current_user.is_authenticated==False %}
-            <span class="navbar-text"><a href="/oauth/twitter" class="btn btn-info">ログイン</a></span> {%else%}
-            <span class="navbar-text"><a href="/logout" class="btn btn-info">ログアウト</a></span> {%endif%}
-        </div>
-    </nav>
-
-
-    <div class="container-fluid">
-        <h1>{{contestname}}</h1>
-    </div>
-
-
-    <br> {% if current_user.is_authenticated== True %}
-    <div id="submit-card">
-
-        <div class="card col-6 border-0">
-            <h4 class="card-header text-white bg-info col-10" data-toggle="collapse" data-target="#sub1">
-                投稿する
-            </h4>
-            <div class="collapse" id="sub1" data-parent="#submit-card">
-                <form action="/submited " method='POST'>
-                    <input type="text" placeholder="タイトル" name="title" style="width:535px" />
-                    <br>
-                    <input type="text" placeholder="URL" name="url" style="width:535px" />
-                    <br>
-                    <textarea placeholder=" 解説文 " name="description" rows=15 cols=55></textarea>
-                    <button type="submit" class="btn btn-info" name="contestname" value="{{contestname}} ">投稿</button>
-                </form>
-            </div>
-        </div>
-    </div>
-    {% else %}
-    <h4>投稿をするにはログインが必要です</h4>
-    {%endif%}
-    <br>
-
-
-    <div>
-        {% if editorials|length==0 %}
-        <h4>まだ投稿がありません</h4>
-        {%else%}
-
-        <div class="container-fluid">
-            <div id="editorial-card">
-
-                {% for edit in editorials %}
-                <div class="row">
-                    <div></div>
-                    <div>
-                        <img class="img-thumbnail" style="min-width: 40px" src={{edit.user_image_url}}/>
-                    </div>
-                    <div>
-                        <h5>{{edit.username}}</h5>
-                    </div>
-                </div>
-                <div class="card col-6 border-0">
-                    <h4 class="card-header text-light bg-dark col-10" data-toggle="collapse" data-target="#edi{{loop.index}}">
-                        {{edit.title}}
-                    </h4>
-
-                    <div class="collapse" id="edi{{loop.index}}" data-parent="#editorial-card">
-                        {% if edit.url!=None%}
-                        <a href={{edit.url}}>{{edit.url}}</a> {%endif%}
-                    </div>
-
-                    <div class="collapse" id="edi{{loop.index}}" data-parent="#editorial-card">
-                        {%if edit.description!=None%}
-                        <br>
-                        <p>{{edit.description}}</p>
-                        {%endif%}
-                    </div>
-
-                </div>
-                <br>
-                <br> {% endfor %}
-            </div>
-            {%endif%}
-
-
-        </div>
-    </div>
-
-
-    <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js " integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo " crossorigin="anonymous "></script>
-    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js " integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1 " crossorigin="anonymous "></script>
-    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js " integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM " crossorigin="anonymous "></script>
-</body>
-
-
-</html>
\ No newline at end of file
diff --git a/app/templates/index.html b/app/templates/index.html
deleted file mode 100644
index 5c5d341..0000000
--- a/app/templates/index.html
+++ /dev/null
@@ -1,78 +0,0 @@
-<!DOCTYPE html>
-<html lang="ja">
-
-<head>
-    <meta charset="utf-8" />
-    <meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no">
-    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
-    <title>AtCoder Editorials</title>
-</head>
-
-<body style="padding-top:5rem">
-    <noscript>You need to enable JavaScript to run this app.</noscript>
-
-    <nav class="navbar navbar-expand-md  navbar-dark bg-dark fixed-top">
-        <a href="/" class="navbar-brand">AtCoder Editorials</a>
-
-        <button class="navbar-toggler" data-toggle="collapse" data-target="#nav1">
-        <span class="navbar-toggler-icon"></span>
-    </button>
-
-        <div class="collapse navbar-collapse" id="nav1">
-            <ul class="navbar-nav">
-                <li class="nav-item active"><a href="/" class="nav-link">ホーム</a></li>
-                <li class="nav-item"><a href="/search" class="nav-link">コンテスト</a></li>
-            </ul>
-            {% if current_user.is_authenticated==False %}
-            <span class="navbar-text"><a href="/oauth/twitter" class="btn btn-info">ログイン</a></span> {%else%}
-            <span class="navbar-text"><a href="/logout" class="btn btn-info">ログアウト</a></span> {%endif%}
-        </div>
-    </nav>
-
-    <div class="container-fluid">
-        <div id="events-imfo">
-
-            <div class="card">
-                <h5 class="card-header bg-info text-white" data-toggle="collapse" data-target="#action1">
-                    インフォメーション
-                </h5>
-                <div class="collapse" id="action1" 　data-parent="#events-imfo">
-                    <div class="card-body">
-                        AtCoderEditorialsが誕生しました。
-                    </div>
-                </div>
-            </div>
-
-            <br>
-
-            <div class="card">
-                <h5 class="card-header bg-info text-white" data-toggle="collapse" data-target="#action2">
-                    このサイトについて
-                </h5>
-                <div class="collapse　show" id="action2" data-parent="#events-imfo">
-                    <div class="card-body">
-                        <h4>AtCoderEditorialsはAtCoderの解法を集めるサイトです。</h4>
-                        <h5>主な機能は　解法の閲覧・投稿　の2つです</h5>
-                        <br>
-                        <h5>投稿方法は以下の２つです。</h5>
-                        ・AtCoderEditorialsに直接書き込む
-                        <br> ・外部サイトのリンクを貼る
-                        <br>
-                        <br> 解法の投稿にはTwitter認証でのログインが必要です。
-                        <br> 解法の閲覧にはログインは必要ありません。
-                    </div>
-                </div>
-            </div>
-
-        </div>
-
-    </div>
-
-
-    <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
-    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
-    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
-</body>
-
-
-</html>
\ No newline at end of file
diff --git a/app/templates/search.html b/app/templates/search.html
deleted file mode 100644
index 6debb9b..0000000
--- a/app/templates/search.html
+++ /dev/null
@@ -1,51 +0,0 @@
-<!DOCTYPE html>
-<html lang="ja">
-
-<head>
-    <meta charset="utf-8" />
-    <meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no">
-    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
-    <title>AtCoder Editorials</title>
-</head>
-
-<body style="padding-top:5rem">
-    <noscript>You need to enable JavaScript to run this app.</noscript>
-
-    <nav class="navbar navbar-expand-md  navbar-dark bg-dark fixed-top">
-        <a href="/" class="navbar-brand">AtCoder Editorials</a>
-
-        <button class="navbar-toggler" data-toggle="collapse" data-target="#nav1">
-            <span class="navbar-toggler-icon"></span>
-        </button>
-
-        <div class="collapse navbar-collapse" id="nav1">
-            <ul class="navbar-nav">
-                <li class="nav-item"><a href="/" class="nav-link">ホーム</a></li>
-                <li class="nav-item active"><a href="/search" class="nav-link">コンテスト</a></li>
-            </ul>
-            {% if current_user.is_authenticated==False %}
-            <span class="navbar-text"><a href="/oauth/twitter" class="btn btn-info">ログイン</a></span> {%else%}
-            <span class="navbar-text"><a href="/logout" class="btn btn-info">ログアウト</a></span> {%endif%}
-        </div>
-    </nav>
-
-    <div class="container-fluid">
-        <h3>コンテスト名を記入し、下の候補からコンテストを選んで下さい</h3>
-        <br>
-        <form id="search" method="POST" action="/search/contest">
-            <input id="autocomplete_search" placeholder="コンテスト名" style="width:600px" name="contestname" type="text" />
-        </form>
-
-
-    </div>
-
-
-    <script src="http://code.jquery.com/jquery-3.2.1.min.js " integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" crossorigin=" anonymous "></script>
-    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js " integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1 " crossorigin="anonymous "></script>
-    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js " integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM " crossorigin="anonymous "></script>
-    <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1/jquery-ui.min.js "></script>
-    <script src="../static/script.js "></script>
-</body>
-
-
-</html>
\ No newline at end of file
diff --git a/config.py b/config.py
new file mode 100644
index 0000000..a16cdb9
--- /dev/null
+++ b/config.py
@@ -0,0 +1,32 @@
+from flask import Flask,render_template,request,url_for,redirect,session
+from flask_sqlalchemy import SQLAlchemy
+from flask_migrate import Migrate
+from flask_login import UserMixin,LoginManager,login_user,logout_user,current_user
+from datetime import datetime
+from flask_wtf.csrf import CSRFProtect
+from rauth import OAuth1Service
+from dotenv import load_dotenv
+from os.path import join, dirname
+import os
+
+load_dotenv('.env')
+
+app=Flask(__name__)
+app.secret_key=os.environ['SECRET_KEY']
+app.config['SQLALCHEMY_TRACK_MODIFICATIONS']=False
+app.config['SQLALCHEMY_DATABASE_URI']=os.environ['SQLALCHEMY_DATABASE_URI']
+db=SQLAlchemy(app)
+login_manager=LoginManager(app)
+login_manager.login_view='index'
+migrate=Migrate(app,db)
+csrf=CSRFProtect(app)
+
+service=OAuth1Service(
+    name='twitter',
+    consumer_key=os.environ['CONSUMER_KEY'],
+    consumer_secret=os.environ['CONSUMER_SECRET'],
+    request_token_url=os.environ['REQUEST_TOKEN_URI'],
+    authorize_url=os.environ['AUTHORIZE_URI'],
+    access_token_url=os.environ['ACCESS_TOKEN_URI'],
+    base_url=os.environ['BASE_URI']
+)
\ No newline at end of file
diff --git a/favicon.ico b/favicon.ico
new file mode 100644
index 0000000..4213ce6
Binary files /dev/null and b/favicon.ico differ
diff --git a/requirements.txt b/requirements.txt
new file mode 100644
index 0000000..917c5bc
--- /dev/null
+++ b/requirements.txt
@@ -0,0 +1,35 @@
+alembic==1.0.11
+certifi==2019.6.16
+chardet==3.0.4
+Click==7.0
+Flask==1.1.1
+Flask-Login==0.4.1
+Flask-Migrate==2.5.2
+flask-paginate==0.5.3
+Flask-SQLAlchemy==2.4.0
+Flask-WTF==0.14.2
+get==2019.4.13
+gunicorn==19.9.0
+idna==2.8
+itsdangerous==1.1.0
+Jinja2==2.10.1
+Mako==1.1.0
+MarkupSafe==1.1.1
+numpy==1.17.0
+post==2019.4.13
+psycopg2==2.8.3
+psycopg2-binary==2.8.3
+public==2019.4.13
+python-dateutil==2.8.0
+python-dotenv==0.10.3
+python-editor==1.0.4
+query-string==2019.4.13
+rauth==0.7.3
+request==2019.4.13
+requests==2.22.0
+scipy==1.3.1
+six==1.12.0
+SQLAlchemy==1.3.6
+urllib3==1.25.3
+Werkzeug==0.15.5
+WTForms==2.2.1
diff --git a/static/script.js b/static/script.js
new file mode 100644
index 0000000..7739c28
--- /dev/null
+++ b/static/script.js
@@ -0,0 +1,56 @@
+$('.like_button').on('click', function() {
+    $(this).toggleClass('active');
+
+    if ($(this).hasClass('active')) {
+        var text = $(this).data('btn btn-info');
+    } else {
+        var text = $(this).data('btn btn-outline-info');
+    }
+
+    $(this).html(text);
+
+    event.preventDefault();
+
+    url = '/like?id=' + $(this).val();
+    console.log(url);
+    $.ajax({
+        url: url,
+        type: 'POST',
+        dataType: 'text',
+    }).done(function() {
+        console.log('success');
+    }).fail(function() {
+        console.log('fail');
+    })
+})
+
+$('.delete_button ').on('click ', function() {
+    flag = window.confirm("本当に削除してもよろしいでしょうか？")
+    event.preventDefault();
+    if (flag === true) {
+        url = '/delete?id=' + $(this).val();
+        $.ajax({
+            url: url,
+            type: 'GET',
+            dataType: 'text',
+
+        })
+    }
+})
+
+//input内でのEnter無効化
+$(function() {
+    $(document).on("keypress", "input:not(.allow_submit)", function(event) {
+        return event.which !== 13;
+    });
+});
+
+var csrftoken = $('meta[name=csrf-token]').attr('content')
+
+$.ajaxSetup({
+    beforeSend: function(xhr, settings) {
+        if (!/^(GET|HEAD|OPTIONS|TRACE)$/i.test(settings.type)) {
+            xhr.setRequestHeader("X-CSRFToken", csrftoken)
+        }
+    }
+})
\ No newline at end of file
diff --git a/static/style.css b/static/style.css
new file mode 100644
index 0000000..94775e0
--- /dev/null
+++ b/static/style.css
@@ -0,0 +1,36 @@
+textarea {
+    vertical-align: top;
+}
+
+a,
+a:focus {
+    outline: none;
+}
+
+button,
+input,
+input:focus {
+    outline: none;
+}
+
+input::-moz-focus-inner,
+button::-moz-focus-inner {
+    border: none;
+}
+
+.pagination-page-info {
+    padding: .6em;
+    padding-left: 0;
+    width: 40em;
+    margin: .5em;
+    margin-left: 0;
+    font-size: 12px;
+}
+
+.pagination-page-info b {
+    color: black;
+    background: #6aa6ed;
+    padding-left: 2px;
+    padding: .1em .25em;
+    font-size: 150%;
+}
\ No newline at end of file
diff --git a/tag.txt b/tag.txt
new file mode 100644
index 0000000..35ad58b
--- /dev/null
+++ b/tag.txt
@@ -0,0 +1,50 @@
+
+
+
+tags=["実装","探索","数学","算数","貪欲法","文字列","数え上げ",
+"門松列","二分探索","場合分け","幾何","セグメント木","累積和","組合せ",
+"幅優先探索","発想","グラフ","ソート","期待値","リアクティブ","素因数分解",
+"BIT","bitDP","ゲーム","文字列処理","構築","確率","桁DP","シミュレーション",
+"剰余","回文","木","union-find","メモ化再帰","平方分割","座標圧縮",
+"しゃくとり法","探索","深さ優先探索","漸化式","約数","ダイクストラ法",
+"フェルマーの小定理","包除原理","埋め込み","最大公約数","素数判定","行列べき乗",
+"誤差","Grundy数","cww","ビット演算","分数","半分全列挙","平衡二分探索木",
+"構文解析","繰り返し二乗法","置換","貪欲","逆元","FFT","Nim","アドホック",
+"マンハッタン距離","三分探索","中華風剰余定理","周期性","多倍長整数",
+"最小公倍数","木DP","正規表現","考察","行列","計算","遅延セグメント木",
+"Heavy-Light_Decomposition","Miller-Rabin素数判定法","RMQ","SPFA",
+"チェビシェフ距離","バケット法","フィボナッチ","優先度付きキュー","分割統治法",
+"基数変換","場合の数","巡回群","整数論","素数","素数列挙","経路復元",
+"行列累乗","転倒数","連立方程式","順列","魔方陣","-SAT","Garner","LCA",
+"Mod","Polyaの定理","dfs","imos法","union-find木","きたまさ法",
+"カタラン数","スライド最小値","チャンパーノウン定数","テトラナッチ","データ構造",
+"ハッシュテーブル","バケットソート","バックトラック","パスカルの三角形",
+"ビット並列","メモリ制限","メモ化","モンテカルロ法","ルジャンドルの定理",
+"ロシアゲー","ローリングハッシュ","ワーシャルフロイド","乱択アルゴリズム",
+"二次関数","余り","偶奇性","入出力","全列挙","凸包","図形","多項式","巡回路",
+"挿入DP","排他的論理和","数値計算","数字根","整数計算","最大流","最小カット",
+"最小全域木","最短経路","期待値の線形性","木構造","条件分岐","枝刈り","格子点",
+"独立性","畳み込み","精度落ち","総当り","配列","閉路検出","inline-DP"]
+
+tag=["フロー","最小費用流","最大マッチング","最大流","数学",
+"包除原理","連立方程式","半環","確率","期待値","FFT",
+"アダマール変換","メビウス変換","ゼータ変換","XOR","中国剰余定理",
+"線形計画法","フィボナッチ数列","有理数","木構造",
+"LCA","HL分解","オイラーツアー","木の同型判定",
+"重心分解","LinkCutTree","DynamicTree","グラフ理論",
+"スペクトルグラフ理論","行列木定理","ケイリーの公式",
+"橋"、"関節点","サイクル基底","lowlink","ダイクストラ","ベルマンフォード",
+"ワーシャルフロイド","オイラー路","強連結成分分解","最小パス被覆",
+"Dilworthの定理","トポロジカルソート","最大クリーク","最大独立集合",
+"BFS","後退解析","最小全域木","プリム","クラスカル","ブルーフカ",
+"データ構造","UnionFind","セグメントツリー","BIT","遅延評価セグメントツリー",
+"永続データ構造","平衡二分木","SparseTable","WaveletMatrix","動的計画法",
+"区間DP","桁DP","CHT","MongeDP","AlianDP","インラインDP","きたまさ法",
+"行列累乗","戻すDP","全方位木DP","木DP","bitDP","挿入DP","連結DP","inlineDP",
+"枝刈り","マンハッタン距離","しゃくとり法","二分探索","三分探索",
+"imos法","累積和","最長部分増加列","Mo'sAlgorithm",
+"平方分割","ローリングハッシュ","SuffixArray","LCP","KMP",
+"Aho-Corasick","Z-algorithm","PalindromicTree","Manacher",
+"SuffixTree","Nim","Grundy数","後退解析","ミニマックス法",
+"2-SAT","マージテク","エラトステネスの篩","区間篩","分割統治法","凸包",
+"構築","乱択アルゴリズム","半分全列挙","最近点対","幾何","構文解析","平面走査"]
diff --git a/app/templates/error.html b/templates/401.html
similarity index 57%
rename from app/templates/error.html
rename to templates/401.html
index 413a9f3..ac27986 100644
--- a/app/templates/error.html
+++ b/templates/401.html
@@ -2,13 +2,38 @@
 <html lang="ja">
 
 <head>
+    <!-- Google Tag Manager -->
+    <script>
+        (function(w, d, s, l, i) {
+            w[l] = w[l] || [];
+            w[l].push({
+                'gtm.start': new Date().getTime(),
+                event: 'gtm.js'
+            });
+            var f = d.getElementsByTagName(s)[0],
+                j = d.createElement(s),
+                dl = l != 'dataLayer' ? '&l=' + l : '';
+            j.async = true;
+            j.src =
+                'https://www.googletagmanager.com/gtm.js?id=' + i + dl;
+            f.parentNode.insertBefore(j, f);
+        })(window, document, 'script', 'dataLayer', 'GTM-WW39BS6');
+    </script>
+    <!-- End Google Tag Manager -->
+
     <meta charset="utf-8" />
     <meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge">
     <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
+    <link rel="icon" type="image/x-icon" href="/favicon.ico">
     <title>AtCoder Editorials</title>
 </head>
 
 <body style="padding-top:5rem">
+    <!-- Google Tag Manager (noscript) -->
+    <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-WW39BS6" height="0" width="0"
+            style="display:none;visibility:hidden"></iframe></noscript>
+    <!-- End Google Tag Manager (noscript) -->
     <noscript>You need to enable JavaScript to run this app.</noscript>
 
     <nav class="navbar navbar-expand-md  navbar-dark bg-dark fixed-top">
@@ -21,15 +46,19 @@
         <div class="collapse navbar-collapse" id="nav1">
             <ul class="navbar-nav">
                 <li class="nav-item"><a href="/" class="nav-link">ホーム</a></li>
-                <li class="nav-item"><a href="/search" class="nav-link">コンテスト</a></li>
+                <li class="nav-item"><a href="/search" class="nav-link">問題</a></li>
+                <li class="nav-item"><a href="/ranking/1" class="nav-link">ランキング</a></li>
+                {% if current_user.is_authenticated==True %}
+                <li class="nav-item"><a href="/user/{{current_user.id}}/1" class="nav-link">ユーザーページ</a></li>
+                {%endif%}
             </ul>
             {% if current_user.is_authenticated==False %}
             <span class="navbar-text"><a href="/oauth/twitter" class="btn btn-info">ログイン</a></span> {%else%}
-            <span class="navbar-text"><a href="/logout" class="btn btn-info">ログアウト</a></span> {%endif%}
+            <span class="navbar-text"><a href="/logout" class="btn btn-danger">ログアウト</a></span> {%endif%}
         </div>
     </nav>
 
-    <h1>{{message}}</h1>
+    <h1>401 Unauthorized</h1>
 
     <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
     <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
diff --git a/app/templates/login.html b/templates/404.html
similarity index 57%
rename from app/templates/login.html
rename to templates/404.html
index 2ba0738..a9fd6bc 100644
--- a/app/templates/login.html
+++ b/templates/404.html
@@ -2,13 +2,38 @@
 <html lang="ja">
 
 <head>
+    <!-- Google Tag Manager -->
+    <script>
+        (function(w, d, s, l, i) {
+            w[l] = w[l] || [];
+            w[l].push({
+                'gtm.start': new Date().getTime(),
+                event: 'gtm.js'
+            });
+            var f = d.getElementsByTagName(s)[0],
+                j = d.createElement(s),
+                dl = l != 'dataLayer' ? '&l=' + l : '';
+            j.async = true;
+            j.src =
+                'https://www.googletagmanager.com/gtm.js?id=' + i + dl;
+            f.parentNode.insertBefore(j, f);
+        })(window, document, 'script', 'dataLayer', 'GTM-WW39BS6');
+    </script>
+    <!-- End Google Tag Manager -->
+
     <meta charset="utf-8" />
     <meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge">
     <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
+    <link rel="icon" type="image/x-icon" href="/favicon.ico">
     <title>AtCoder Editorials</title>
 </head>
 
 <body style="padding-top:5rem">
+    <!-- Google Tag Manager (noscript) -->
+    <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-WW39BS6" height="0" width="0"
+            style="display:none;visibility:hidden"></iframe></noscript>
+    <!-- End Google Tag Manager (noscript) -->
     <noscript>You need to enable JavaScript to run this app.</noscript>
 
     <nav class="navbar navbar-expand-md  navbar-dark bg-dark fixed-top">
@@ -21,14 +46,19 @@
         <div class="collapse navbar-collapse" id="nav1">
             <ul class="navbar-nav">
                 <li class="nav-item"><a href="/" class="nav-link">ホーム</a></li>
-                <li class="nav-item"><a href="/search" class="nav-link">コンテスト</a></li>
+                <li class="nav-item"><a href="/search" class="nav-link">問題</a></li>
+                <li class="nav-item"><a href="/ranking/1" class="nav-link">ランキング</a></li>
+                {% if current_user.is_authenticated==True %}
+                <li class="nav-item"><a href="/user/{{current_user.id}}/1" class="nav-link">ユーザーページ</a></li>
+                {%endif%}
             </ul>
             {% if current_user.is_authenticated==False %}
             <span class="navbar-text"><a href="/oauth/twitter" class="btn btn-info">ログイン</a></span> {%else%}
-            <span class="navbar-text"><a href="/logout" class="btn btn-info">ログアウト</a></span> {%endif%}
+            <span class="navbar-text"><a href="/logout" class="btn btn-danger">ログアウト</a></span> {%endif%}
         </div>
     </nav>
 
+    <h1>404 Not Found</h1>
 
     <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
     <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
diff --git a/app/templates/submited.html b/templates/500.html
similarity index 55%
rename from app/templates/submited.html
rename to templates/500.html
index 945460d..1b76aa8 100644
--- a/app/templates/submited.html
+++ b/templates/500.html
@@ -2,13 +2,37 @@
 <html lang="ja">
 
 <head>
+    <!-- Google Tag Manager -->
+    <script>
+        (function(w, d, s, l, i) {
+            w[l] = w[l] || [];
+            w[l].push({
+                'gtm.start': new Date().getTime(),
+                event: 'gtm.js'
+            });
+            var f = d.getElementsByTagName(s)[0],
+                j = d.createElement(s),
+                dl = l != 'dataLayer' ? '&l=' + l : '';
+            j.async = true;
+            j.src =
+                'https://www.googletagmanager.com/gtm.js?id=' + i + dl;
+            f.parentNode.insertBefore(j, f);
+        })(window, document, 'script', 'dataLayer', 'GTM-WW39BS6');
+    </script>
+    <!-- End Google Tag Manager -->
     <meta charset="utf-8" />
     <meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge">
     <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
+    <link rel="icon" type="image/x-icon" href="/favicon.ico">
     <title>AtCoder Editorials</title>
 </head>
 
 <body style="padding-top:5rem">
+    <!-- Google Tag Manager (noscript) -->
+    <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-WW39BS6" height="0" width="0"
+            style="display:none;visibility:hidden"></iframe></noscript>
+    <!-- End Google Tag Manager (noscript) -->
     <noscript>You need to enable JavaScript to run this app.</noscript>
 
     <nav class="navbar navbar-expand-md  navbar-dark bg-dark fixed-top">
@@ -21,15 +45,19 @@
         <div class="collapse navbar-collapse" id="nav1">
             <ul class="navbar-nav">
                 <li class="nav-item"><a href="/" class="nav-link">ホーム</a></li>
-                <li class="nav-item active"><a href="/search" class="nav-link">コンテスト</a></li>
+                <li class="nav-item"><a href="/search" class="nav-link">問題</a></li>
+                <li class="nav-item"><a href="/ranking/1" class="nav-link">ランキング</a></li>
+                {% if current_user.is_authenticated==True %}
+                <li class="nav-item"><a href="/user/{{current_user.id}}/1" class="nav-link">ユーザーページ</a></li>
+                {%endif%}
             </ul>
             {% if current_user.is_authenticated==False %}
             <span class="navbar-text"><a href="/oauth/twitter" class="btn btn-info">ログイン</a></span> {%else%}
-            <span class="navbar-text"><a href="/logout" class="btn btn-info">ログアウト</a></span> {%endif%}
+            <span class="navbar-text"><a href="/logout" class="btn btn-danger">ログアウト</a></span> {%endif%}
         </div>
     </nav>
 
-    <h2>提出が完了しました。</h2>
+    <h1>500 Internal Server Error</h1>
 
     <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
     <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
diff --git a/templates/contest.html b/templates/contest.html
new file mode 100644
index 0000000..8d0fdad
--- /dev/null
+++ b/templates/contest.html
@@ -0,0 +1,286 @@
+<!DOCTYPE html>
+<html lang="ja">
+
+<head>
+    <!-- Google Tag Manager -->
+    <script>
+        (function(w, d, s, l, i) {
+            w[l] = w[l] || [];
+            w[l].push({
+                'gtm.start': new Date().getTime(),
+                event: 'gtm.js'
+            });
+            var f = d.getElementsByTagName(s)[0],
+                j = d.createElement(s),
+                dl = l != 'dataLayer' ? '&l=' + l : '';
+            j.async = true;
+            j.src =
+                'https://www.googletagmanager.com/gtm.js?id=' + i + dl;
+            f.parentNode.insertBefore(j, f);
+        })(window, document, 'script', 'dataLayer', 'GTM-WW39BS6');
+    </script>
+    <!-- End Google Tag Manager -->
+    <meta charset="utf-8" />
+    <meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge">
+    <meta name="csrf-token" content="{{ csrf_token() }}">
+    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
+    <link rel="icon" type="image/x-icon" href="/favicon.ico">
+    <title>AtCoder Editorials</title>
+</head>
+
+<body style="padding-top:5rem">
+    <!-- Google Tag Manager (noscript) -->
+    <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-WW39BS6" height="0" width="0"
+            style="display:none;visibility:hidden"></iframe></noscript>
+    <!-- End Google Tag Manager (noscript) -->
+    <noscript>You need to enable JavaScript to run this app.</noscript>
+
+    <nav class="navbar navbar-expand-md  navbar-dark bg-dark fixed-top">
+        <a href="/" class="navbar-brand">AtCoder Editorials</a>
+
+        <button class="navbar-toggler" data-toggle="collapse" data-target="#nav1">
+            <span class="navbar-toggler-icon"></span>
+        </button>
+
+        <div class="collapse navbar-collapse" id="nav1">
+            <ul class="navbar-nav">
+                <li class="nav-item"><a href="/" class="nav-link">ホーム</a></li>
+                <li class="nav-item active"><a href="/search" class="nav-link">問題</a></li>
+                <li class="nav-item"><a href="/ranking/1" class="nav-link">ランキング</a></li>
+                {% if current_user.is_authenticated==True %}
+                <li class="nav-item"><a href="/user/{{current_user.id}}/1" class="nav-link">ユーザーページ</a></li>
+                {%endif%}
+            </ul>
+            {% if current_user.is_authenticated==False %}
+            <span class="navbar-text"><a href="/oauth/twitter" class="btn btn-info">ログイン</a></span> {%else%}
+            <span class="navbar-text"><a href="/logout" class="btn btn-danger">ログアウト</a></span> {%endif%}
+        </div>
+    </nav>
+
+    <div class="jumbotron jumbotron-fluid container-fluid">
+        <div class="row container-fluid">
+            <div>
+                <h1>{{contestname}}</h1>
+            </div>
+            <h4 class="col-1"></h4>
+            {% if current_user.is_authenticated== True %}
+            <div>
+                <div class="twitter">
+                    <a href="//twitter.com/share" class="twitter-share-button" data-text="AtCoderEditorialsで{{contestname}}の解法を書きました！" data-url="https://atcoder-editorials.herokuapp.com/search/{{problem_id}}/1" data-lang="ja">
+                    </a>
+                </div>
+            </div>
+            {%endif%}
+        </div>
+
+
+        <div class="container-fluid">
+            <a class="h5" href="https://atcoder.jp/contests/{{contest_id}}/tasks/{{problem_id}}" target="_blank">問題ページ</a>
+            <h4 class="col-1"></h4>
+            <a class="h5" href="https://img.atcoder.jp/{{contest_id}}/editorial.pdf" target="_blank">公式editorial</a>
+            <h4 class="col-1"></h4>
+
+            {%if tag==None%}
+            <span class="badge badge-pill badge-secondary w-auto">投票がありません</span> {%else%}
+            <span class="badge badge-pill badge-secondary w-auto">{{tag}}</span> {%endif%}
+        </div>
+    </div>
+
+    <br> {% if current_user.is_authenticated== True %}
+    <div id="submit-card">
+
+        <div class="card col-6 border-0" style="cursor: pointer;">
+            <h4 class="card-header text-white bg-info col-10" data-toggle="collapse" data-target="#sub1">
+                投稿する
+            </h4>
+            <div class="collapse" id="sub1" data-parent="#submit-card" style="cursor: pointer;">
+                <form action="/submited " method='POST'>
+                    <input type="hidden" name="csrf_token" value="{{csrf_token()}}" />
+                    <input type="hidden" name="problem_id" value="{{problem_id}}" />
+                    <input type="text" placeholder="タイトル" name="title" style="width:535px" />
+                    <br>
+                    <input type="text" placeholder="URL" name="url" style="width:535px" />
+                    <br>
+                    <textarea placeholder=" 解説文 " name="description" style="white-space:pre; word-wrap:break-word;" rows=15 cols=57></textarea>
+                    <button type="submit" class="btn btn-info" name="contestname" value="{{contestname}}">投稿</button>
+
+                </form>
+            </div>
+        </div>
+    </div>
+    {% else %}
+    <div class="container-fluid">
+        <h4>「投稿」「いいね」「タグ投票」をするにはログインが必要です。</h4>
+    </div>
+    {%endif%}
+
+    <div>
+        {% if editorials.items|length >0 %}
+
+        <div id="editorial-card">
+
+            {% for edit in editorials.items %}
+            <br>
+            <div class="row container-fluid">
+                {%if current_user.is_authenticated==True%} {% if flag[edit.id]==False%}
+                <form>
+                    <input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
+                    <button class="like_button btn btn-outline-info" name="id" value={{edit.id}}>{{edit.like}}いいね</button>
+                </form>
+                {%else%}
+                <form>
+                    <input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
+                    <button class="like_button btn btn-info" name="id" value={{edit.id}}>{{edit.like}}いいね</button>
+                </form>
+                {%endif%}{%else%}
+                <button class="like_button_no_login btn btn-outline-info" name="id" value={{edit.id}}>{{edit.like}}いいね</button> {%endif%}
+                <h5 class="col-1"></h5>
+                <img src={{edit.user_image_url}} alt='No Image ' style="width:36px;height:36px;vertical-align:middle;">
+                <a href="/user/{{edit.user_id}}/1" class="h4 text-dark" style="vertical-align:middle;">{{edit.username}}</a>
+                <h5 class="col-1"></h5>
+                {% if current_user.is_authenticated==True and edit.user_id==current_user.id%}
+                <form action="/edit" method="POST">
+                    <input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
+                    <button class="btn" name="edit_id" value={{edit.id}} type="submit">編集</button>
+                </form>
+                <form>
+                    <input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
+                    <button class="delete_button btn" style="color:tomato;" name="delete_id" value={{edit.id}}>削除</button>
+                </form>
+                <h5 class="col-1"></h5>
+                {%endif%}
+            </div>
+
+
+            <div class="card col-6 border-0" style="cursor: pointer;">
+                <h4 class="card-header text-light bg-light text-dark col-10" data-toggle="collapse" data-target="#edi{{loop.index}}">
+                    {{edit.title}}
+                </h4>
+
+                <div class="collapse" id="edi{{loop.index}}" data-parent="#editorial-card">
+                    {% if edit.url!=None%}
+                    <a href={{edit.url}}>{{edit.url}}</a> {%endif%}
+                </div>
+
+                <div class="collapse" id="edi{{loop.index}}" data-parent="#editorial-card">
+                    {% autoescape false %} {%if edit.description!=None%}
+                    <br>
+                    <p>{{edit.description}}</p>
+                    {%endif%} {% endautoescape %}
+                </div>
+            </div>
+            <br>
+            <br> {% endfor %}
+        </div>
+        {%else%}
+        <h4 class='container-fluid '>まだ投稿がありません。</h4>
+        <br> {%endif%}
+    </div>
+
+    <div class="container-fluid h4">
+
+        <ul class="pagination">
+            {% if editorials.has_prev %} {%if contestname==None%}
+
+            <li class="page-item"><a class="page-link" href="{{ url_for('contest_get', page=editorials.prev_num,contestname=request.args.get('contestname',' '),contest_id=contest_id,problem_id=problem_id,tag_flag=tag_flag,tag=tag)}}">
+        {%else%}
+             <li class="page-item"><a class="page-link" href="{{ url_for('contest_get', page=editorials.prev_num,contestname=contestname,contest_id=contest_id,problem_id=problem_id,tag_flag=tag_flag,tag=tag)}}">
+        {%endif%}
+             << 前のページ</a></li> {% endif %}{% if editorials.has_next %} {%if contestname==None%}
+            <li class="page-item"><a class="page-link" href="{{ url_for('contest_get', page=editorials.next_num,contestname=request.args.get('contestname',' '),contest_id=contest_id,problem_id=problem_id,tag_flag=tag_flag,tag=tag) }}">
+         {%else%}
+             <li class="page-item"><a  class="page-link" href="{{ url_for('contest_get', page=editorials.next_num,contestname=contestname,contest_id=contest_id,problem_id=problem_id,tag_flag=tag_flag,tag=tag)}}">
+        {%endif%}
+         次のページ >></a></li>{% endif %}
+        </ul>
+    </div>
+
+    {%if tag_flag==True%}
+    <br>
+    <br>
+
+    <div class="container-fluid">
+        <h3>タグ投票</h3>
+        <form id="search" method="POST" action="">
+            <input type="hidden" name="csrf_token" value="{{csrf_token()}}" />
+
+            <input id="tag_vote" placeholder="タグ名" style="width:600px" name="tagName" type="text" />
+        </form>
+    </div>
+
+    <br>
+    <br> {%endif%}
+
+    <script src="https://code.jquery.com/jquery-3.4.1.js" integrity="sha256-WpOohJOqMqqyKL9FccASB9O0KwACQJpFTUBLTYOVvVU=" crossorigin="anonymous"></script>
+    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js " integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1 " crossorigin="anonymous "></script>
+    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js " integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM " crossorigin="anonymous "></script>
+    <script src="https://code.jquery.com/ui/1.11.4/jquery-ui.js" integrity="sha256-DI6NdAhhFRnO2k51mumYeDShet3I8AKCQf/tf7ARNhI=" crossorigin="anonymous"></script>
+    <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
+    <script src="/static/script.js"></script>
+
+    <script type="text/javascript">
+        (async function() {
+            const tag = ["フロー", "最小費用流", "最大マッチング", "最大流", "数学",
+                "包除原理", "連立方程式", "半環", "確率", "期待値", "FFT",
+                "アダマール変換", "メビウス変換", "ゼータ変換", "XOR", "中国剰余定理",
+                "線形計画法", "フィボナッチ数列", "有理数", "木構造",
+                "LCA", "HL分解", "オイラーツアー", "木の同型判定",
+                "重心分解", "LinkCutTree", "DynamicTree", "グラフ理論",
+                "スペクトルグラフ理論", "行列木定理", "ケイリーの公式", "橋",
+                "関節点", "サイクル基底", "lowlink", "ダイクストラ", "ベルマンフォード",
+                "ワーシャルフロイド", "オイラー路", "強連結成分分解", "最小パス被覆",
+                "Dilworthの定理", "トポロジカルソート", "最大クリーク", "最大独立集合",
+                "BFS", "後退解析", "最小全域木", "プリム", "クラスカル", "ブルーフカ",
+                "データ構造", "UnionFind", "セグメントツリー", "BIT", "遅延評価セグメントツリー",
+                "永続データ構造", "平衡二分木", "SparseTable", "WaveletMatrix", "動的計画法",
+                "区間DP", "桁DP", "CHT", "MongeDP", "AlianDP", "インラインDP", "きたまさ法",
+                "行列累乗", "戻すDP", "全方位木DP", "木DP", "bitDP", "挿入DP", "連結DP", "inlineDP",
+                "枝刈り", "マンハッタン距離", "しゃくとり法", "二分探索", "三分探索",
+                "imos法", "累積和", "最長部分増加列", "Mo'sAlgorithm",
+                "平方分割", "ローリングハッシュ", "SuffixArray", "LCP", "KMP",
+                "Aho-Corasick", "Z-algorithm", "PalindromicTree", "Manacher",
+                "SuffixTree", "Nim", "Grundy数", "後退解析", "ミニマックス法",
+                "2-SAT", "マージテク", "エラトステネスの篩", "区間篩", "分割統治法", "凸包",
+                "構築", "乱択アルゴリズム", "半分全列挙", "最近点対", "幾何", "構文解析", "平面走査",
+                "再帰"
+            ];
+            $('#tag_vote').autocomplete({
+                source: tag,
+                autoFocus: true,
+                delay: 100,
+                minLength: 2,
+                appendTo: "menu",
+
+                //候補をクリックすることでsubmitできるようにする
+                select: function(event, ui) {
+                    var name = ui.item.label;
+                    $("#tag_vote").val(name);
+                    $('form').attr('action', '/tag_vote?tagName=' + name + '&problem_id={{problem_id}}' + '&problem_name={{contestname}}');
+                    $("#search").submit();
+                }
+            });
+
+            //input内でのEnter無効化
+            $(function() {
+                $(document).on("keypress", "input:not(.allow_submit)", function(event) {
+                    return event.which !== 13;
+                });
+            });
+
+            //日本語入力をスタートしたら無効化
+            $('#tag_vote').on('compositionstart', function() {
+                $('#tag_vote').autocomplete('disable');
+            });
+
+            //日本語入力が確定したら有効化
+            $('#tag_vote').on('compositionend', function() {
+                $('#tag_vote').autocomplete('enable').autocomplete('search');
+            });
+
+        })();
+    </script>
+
+</body>
+
+</html>
\ No newline at end of file
diff --git a/templates/edit.html b/templates/edit.html
new file mode 100644
index 0000000..9d4f3c3
--- /dev/null
+++ b/templates/edit.html
@@ -0,0 +1,89 @@
+<!DOCTYPE html>
+<html lang="ja">
+
+<head>
+    <!-- Google Tag Manager -->
+    <script>
+        (function(w, d, s, l, i) {
+            w[l] = w[l] || [];
+            w[l].push({
+                'gtm.start': new Date().getTime(),
+                event: 'gtm.js'
+            });
+            var f = d.getElementsByTagName(s)[0],
+                j = d.createElement(s),
+                dl = l != 'dataLayer' ? '&l=' + l : '';
+            j.async = true;
+            j.src =
+                'https://www.googletagmanager.com/gtm.js?id=' + i + dl;
+            f.parentNode.insertBefore(j, f);
+        })(window, document, 'script', 'dataLayer', 'GTM-WW39BS6');
+    </script>
+    <!-- End Google Tag Manager -->
+    <meta charset="utf-8" />
+    <meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge">
+    <meta name="csrf-token" content="{{ csrf_token() }}">
+    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
+    <link rel="icon" type="image/x-icon" href="/favicon.ico">
+    <title>AtCoder Editorials</title>
+</head>
+
+<body style="padding-top:5rem">
+    <!-- Google Tag Manager (noscript) -->
+    <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-WW39BS6" height="0" width="0"
+            style="display:none;visibility:hidden"></iframe></noscript>
+    <!-- End Google Tag Manager (noscript) -->
+    <noscript>You need to enable JavaScript to run this app.</noscript>
+
+    <nav class="navbar navbar-expand-md  navbar-dark bg-dark fixed-top">
+        <a href="/" class="navbar-brand">AtCoder Editorials</a>
+
+        <button class="navbar-toggler" data-toggle="collapse" data-target="#nav1">
+            <span class="navbar-toggler-icon"></span>
+        </button>
+
+        <div class="collapse navbar-collapse" id="nav1">
+            <ul class="navbar-nav">
+                <li class="nav-item"><a href="/" class="nav-link">ホーム</a></li>
+                <li class="nav-item"><a href="/search" class="nav-link">問題</a></li>
+                <li class="nav-item"><a href="/ranking/1" class="nav-link">ランキング</a></li>
+                {% if current_user.is_authenticated==True %}
+                <li class="nav-item"><a href="/user/{{current_user.id}}/1" class="nav-link">ユーザーページ</a></li>
+                {%endif%}
+            </ul>
+            {% if current_user.is_authenticated==False %}
+            <span class="navbar-text"><a href="/oauth/twitter" class="btn btn-info">ログイン</a></span> {%else%}
+            <span class="navbar-text"><a href="/logout" class="btn btn-danger">ログアウト</a></span> {%endif%}
+        </div>
+    </nav>
+
+    <br>
+    <div id="submit-card">
+
+        <div class="card col-6 border-0" style="cursor: pointer;">
+            <h4 class="card-header text-white bg-info col-10" data-toggle="collapse" data-target="#sub1">
+                編集する
+            </h4>
+            <div class="collapse　show" id="sub1" data-parent="#submit-card" style="cursor: pointer;">
+                <form action="/edit_fin " method='POST'>
+                    <input type="hidden" name="csrf_token" value="{{csrf_token()}}" />
+                    <input type="text" name="title" value={{edit.title}} style="width:545px" />
+                    <br>
+                    <input type="text" name="url" value="{{edit.url}}" style="width:545px" />
+                    <br>
+                    <textarea name="description" 　style="white-space:pre; word-wrap:break-word;" rows=15 cols=56>{%autoescape false%}{{description}}{%endautoescape%}</textarea>
+                    <button type="submit" class="btn btn-info" name="id" value="{{edit.id}}">編集</button>
+
+                </form>
+            </div>
+        </div>
+    </div>
+
+
+    <script src="https://code.jquery.com/jquery-3.4.1.js" integrity="sha256-WpOohJOqMqqyKL9FccASB9O0KwACQJpFTUBLTYOVvVU=" crossorigin="anonymous"></script>
+    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
+    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
+</body>
+
+</html>
\ No newline at end of file
diff --git a/templates/edit_fin.html b/templates/edit_fin.html
new file mode 100644
index 0000000..1d1332b
--- /dev/null
+++ b/templates/edit_fin.html
@@ -0,0 +1,70 @@
+<!DOCTYPE html>
+<html lang="ja">
+
+<head>
+    <!-- Google Tag Manager -->
+    <script>
+        (function(w, d, s, l, i) {
+            w[l] = w[l] || [];
+            w[l].push({
+                'gtm.start': new Date().getTime(),
+                event: 'gtm.js'
+            });
+            var f = d.getElementsByTagName(s)[0],
+                j = d.createElement(s),
+                dl = l != 'dataLayer' ? '&l=' + l : '';
+            j.async = true;
+            j.src =
+                'https://www.googletagmanager.com/gtm.js?id=' + i + dl;
+            f.parentNode.insertBefore(j, f);
+        })(window, document, 'script', 'dataLayer', 'GTM-WW39BS6');
+    </script>
+    <!-- End Google Tag Manager -->
+    <meta charset="utf-8" />
+    <meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge">
+    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
+    <link rel="icon" type="image/x-icon" href="/favicon.ico">
+    <title>AtCoder Editorials</title>
+</head>
+
+<body style="padding-top:5rem">
+    <!-- Google Tag Manager (noscript) -->
+    <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-WW39BS6" height="0" width="0"
+            style="display:none;visibility:hidden"></iframe></noscript>
+    <!-- End Google Tag Manager (noscript) -->
+    <noscript>You need to enable JavaScript to run this app.</noscript>
+
+    <nav class="navbar navbar-expand-md  navbar-dark bg-dark fixed-top">
+        <a href="/" class="navbar-brand">AtCoder Editorials</a>
+
+        <button class="navbar-toggler" data-toggle="collapse" data-target="#nav1">
+            <span class="navbar-toggler-icon"></span>
+        </button>
+
+        <div class="collapse navbar-collapse" id="nav1">
+            <ul class="navbar-nav">
+                <li class="nav-item"><a href="/" class="nav-link">ホーム</a></li>
+                <li class="nav-item"><a href="/search" class="nav-link">問題</a></li>
+                <li class="nav-item"><a href="/ranking/1" class="nav-link">ランキング</a></li>
+                {% if current_user.is_authenticated==True %}
+                <li class="nav-item"><a href="/user/{{current_user.id}}/1" class="nav-link">ユーザーページ</a></li>
+                {%endif%}
+            </ul>
+            {% if current_user.is_authenticated==False %}
+            <span class="navbar-text"><a href="/oauth/twitter" class="btn btn-info">ログイン</a></span> {%else%}
+            <span class="navbar-text"><a href="/logout" class="btn btn-danger">ログアウト</a></span> {%endif%}
+        </div>
+    </nav>
+
+    <div class="jumbotron jumbotron-fluid container-fluid">
+        <h2>編集しました。</h2>
+    </div>
+
+
+    <script src="https://code.jquery.com/jquery-3.4.1.js" integrity="sha256-WpOohJOqMqqyKL9FccASB9O0KwACQJpFTUBLTYOVvVU=" crossorigin="anonymous"></script>
+    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
+    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
+</body>
+
+</html>
\ No newline at end of file
diff --git a/templates/error.html b/templates/error.html
new file mode 100644
index 0000000..c6ff6ad
--- /dev/null
+++ b/templates/error.html
@@ -0,0 +1,69 @@
+<!DOCTYPE html>
+<html lang="ja">
+
+<head>
+    <!-- Google Tag Manager -->
+    <script>
+        (function(w, d, s, l, i) {
+            w[l] = w[l] || [];
+            w[l].push({
+                'gtm.start': new Date().getTime(),
+                event: 'gtm.js'
+            });
+            var f = d.getElementsByTagName(s)[0],
+                j = d.createElement(s),
+                dl = l != 'dataLayer' ? '&l=' + l : '';
+            j.async = true;
+            j.src =
+                'https://www.googletagmanager.com/gtm.js?id=' + i + dl;
+            f.parentNode.insertBefore(j, f);
+        })(window, document, 'script', 'dataLayer', 'GTM-WW39BS6');
+    </script>
+    <!-- End Google Tag Manager -->
+
+    <meta charset="utf-8" />
+    <meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge">
+    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
+    <link rel="icon" type="image/x-icon" href="/favicon.ico">
+    <title>AtCoder Editorials</title>
+</head>
+
+<body style="padding-top:5rem">
+    <!-- Google Tag Manager (noscript) -->
+    <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-WW39BS6" height="0" width="0"
+            style="display:none;visibility:hidden"></iframe></noscript>
+    <!-- End Google Tag Manager (noscript) -->
+    <noscript>You need to enable JavaScript to run this app.</noscript>
+
+    <nav class="navbar navbar-expand-md  navbar-dark bg-dark fixed-top">
+        <a href="/" class="navbar-brand">AtCoder Editorials</a>
+
+        <button class="navbar-toggler" data-toggle="collapse" data-target="#nav1">
+            <span class="navbar-toggler-icon"></span>
+        </button>
+
+        <div class="collapse navbar-collapse" id="nav1">
+            <ul class="navbar-nav">
+                <li class="nav-item"><a href="/" class="nav-link">ホーム</a></li>
+                <li class="nav-item"><a href="/search" class="nav-link">問題</a></li>
+                <li class="nav-item"><a href="/ranking/1" class="nav-link">ランキング</a></li>
+                {% if current_user.is_authenticated==True %}
+                <li class="nav-item"><a href="/user/{{current_user.id}}/1" class="nav-link">ユーザーページ</a></li>
+                {%endif%}
+            </ul>
+            {% if current_user.is_authenticated==False %}
+            <span class="navbar-text"><a href="/oauth/twitter" class="btn btn-info">ログイン</a></span> {%else%}
+            <span class="navbar-text"><a href="/logout" class="btn btn-danger">ログアウト</a></span> {%endif%}
+        </div>
+    </nav>
+
+    <h1>{{message}}</h1>
+
+    <script src="https://code.jquery.com/jquery-3.4.1.js" integrity="sha256-WpOohJOqMqqyKL9FccASB9O0KwACQJpFTUBLTYOVvVU=" crossorigin="anonymous"></script>
+    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
+    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
+</body>
+
+
+</html>
\ No newline at end of file
diff --git a/templates/index.html b/templates/index.html
new file mode 100644
index 0000000..d5ac9ff
--- /dev/null
+++ b/templates/index.html
@@ -0,0 +1,130 @@
+<!DOCTYPE html>
+<html lang="ja">
+
+<head>
+    <!-- Google Tag Manager -->
+    <script>
+        (function(w, d, s, l, i) {
+            w[l] = w[l] || [];
+            w[l].push({
+                'gtm.start': new Date().getTime(),
+                event: 'gtm.js'
+            });
+            var f = d.getElementsByTagName(s)[0],
+                j = d.createElement(s),
+                dl = l != 'dataLayer' ? '&l=' + l : '';
+            j.async = true;
+            j.src =
+                'https://www.googletagmanager.com/gtm.js?id=' + i + dl;
+            f.parentNode.insertBefore(j, f);
+        })(window, document, 'script', 'dataLayer', 'GTM-WW39BS6');
+    </script>
+    <!-- End Google Tag Manager -->
+    <meta charset="utf-8" />
+    <meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge">
+    <meta name="description" content="AtCoderEditorialsは、AtCoderの解法を投稿できるWebアプリです。良い解法をより見つけやすく出来るようなアプリを目指しています。" />
+    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
+    <link rel="shortcut icon" type="image/x-icon" href="favicon.ico" />
+    <title>AtCoder Editorials</title>
+</head>
+
+<body style="padding-top:5rem">
+    <!-- Google Tag Manager (noscript) -->
+    <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-WW39BS6" height="0" width="0"
+            style="display:none;visibility:hidden"></iframe></noscript>
+    <!-- End Google Tag Manager (noscript) -->
+    <noscript>You need to enable JavaScript to run this app.</noscript>
+
+    <nav class="navbar navbar-expand-md  navbar-dark bg-dark fixed-top">
+        <a href="/" class="navbar-brand">AtCoder Editorials</a>
+
+        <button class="navbar-toggler" data-toggle="collapse" data-target="#nav1">
+        <span class="navbar-toggler-icon"></span>
+    </button>
+
+        <div class="collapse navbar-collapse" id="nav1">
+            <ul class="navbar-nav">
+                <li class="nav-item active"><a href="/" class="nav-link">ホーム</a></li>
+                <li class="nav-item"><a href="/search" class="nav-link">問題</a></li>
+                <li class="nav-item "><a href="/ranking/1" class="nav-link">ランキング</a></li>
+                {% if current_user.is_authenticated==True %}
+                <li class="nav-item"><a href="/user/{{current_user.id}}/1" class="nav-link">ユーザーページ</a></li>
+                {%endif%}
+            </ul>
+            {% if current_user.is_authenticated==False %}
+            <span class="navbar-text"><a href="/oauth/twitter" class="btn btn-info">ログイン</a></span> {%else%}
+            <span class="navbar-text"><a href="/logout" class="btn btn-danger">ログアウト</a></span> {%endif%}
+        </div>
+    </nav>
+
+    <div class="container-fluid">
+        <div id="events-imfo">
+
+            <div class="card" style="cursor: pointer;">
+                <h5 class="card-header bg-secondary text-white" data-toggle="collapse" data-target="#action1">
+                    インフォメーション
+                </h5>
+                <div class="collapse" id="action1" 　data-parent="#events-imfo">
+                    <div class="card-body">
+                        ・ユーザーページの解法に消去ボタンを追加しました。
+                        <br>・ユーザーページにいいねボタンを追加しました。
+                        <br>・編集ボタンを追加しました。
+                        <br>・タグ投票機能を追加しました。
+                        <br>・タグ検索機能を追加しました。
+                    </div>
+                </div>
+            </div>
+
+            <br>
+
+            <div class="card" style="cursor: pointer;">
+                <h5 class="card-header bg-info text-white" data-toggle="collapse" data-target="#action2">
+                    お問い合わせ
+                </h5>
+                <div class="collapse" id="action2" 　data-parent="#events-imfo" ">
+                    <div class="card-body ">
+                        改善案・バグ・タグの不足などございましたら、ぬるぬる(@__Null_Null_)までご連絡お願いします。<br>
+                        Github: https://github.com/null-null-programming/AtCoder-Editorials
+                    </div>
+                </div>
+            </div>
+
+            <br>
+
+            <div class="container-fluid ">
+                <h3>AtCoderEditorialsはAtCoderの解法を集めるWebアプリです。</h3>
+                <h5>主な機能は、閲覧・投稿・いいね・タグ機能・ランキングの5つです。</h5>
+                <br>
+                <h4>良い解法をより見つけやすく</h4>
+                ・いいね順に解法を並び替えることで、良い解法を見つけやすくしています。
+                <br>
+                <br>
+                <h4>投稿方法</h4>
+                ・AtCoderEditorialsに直接書き込む。
+                <br>・解法ブログの記事などのURLを貼る。
+                <br>
+                <br>
+                <h4>ログインについて</h4>
+                ・解法の投稿・いいね機能の使用にはTwitter認証でのログインが必要です。
+                <br> ・解法の閲覧にログインは必要ありません。
+                <br>
+                <br>
+                <br>
+                <br>
+            </div>
+
+        </div>
+
+    </div>
+
+
+    <script src="https://code.jquery.com/jquery-3.4.1.js " integrity="sha256-WpOohJOqMqqyKL9FccASB9O0KwACQJpFTUBLTYOVvVU="crossorigin=" anonymous "></script>
+    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js " integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1 " crossorigin="anonymous "></script>
+    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js " integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM " crossorigin="anonymous "></script>
+</body>
+<hooter>
+    <p style="text-align:center; ">&copy;2019 Null_Null All Rights Reserved.</p>
+</hooter>
+
+</html>
\ No newline at end of file
diff --git a/templates/ranking.html b/templates/ranking.html
new file mode 100644
index 0000000..f30d233
--- /dev/null
+++ b/templates/ranking.html
@@ -0,0 +1,102 @@
+<!DOCTYPE html>
+<html lang="ja">
+
+<head>
+    <!-- Google Tag Manager -->
+    <script>
+        (function(w, d, s, l, i) {
+            w[l] = w[l] || [];
+            w[l].push({
+                'gtm.start': new Date().getTime(),
+                event: 'gtm.js'
+            });
+            var f = d.getElementsByTagName(s)[0],
+                j = d.createElement(s),
+                dl = l != 'dataLayer' ? '&l=' + l : '';
+            j.async = true;
+            j.src =
+                'https://www.googletagmanager.com/gtm.js?id=' + i + dl;
+            f.parentNode.insertBefore(j, f);
+        })(window, document, 'script', 'dataLayer', 'GTM-WW39BS6');
+    </script>
+    <!-- End Google Tag Manager -->
+    <meta charset="utf-8" />
+    <meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge">
+    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
+    <link rel="icon" type="image/x-icon" href="/favicon.ico">
+    <title>AtCoder Editorials</title>
+</head>
+
+<body style="padding-top:5rem">
+    <!-- Google Tag Manager (noscript) -->
+    <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-WW39BS6" height="0" width="0"
+            style="display:none;visibility:hidden"></iframe></noscript>
+    <!-- End Google Tag Manager (noscript) -->
+    <noscript>You need to enable JavaScript to run this app.</noscript>
+
+    <nav class="navbar navbar-expand-md  navbar-dark bg-dark fixed-top">
+        <a href="/" class="navbar-brand">AtCoder Editorials</a>
+
+        <button class="navbar-toggler" data-toggle="collapse" data-target="#nav1">
+            <span class="navbar-toggler-icon"></span>
+        </button>
+
+        <div class="collapse navbar-collapse" id="nav1">
+            <ul class="navbar-nav">
+                <li class="nav-item"><a href="/" class="nav-link">ホーム</a></li>
+                <li class="nav-item"><a href="/search" class="nav-link">問題</a></li>
+                <li class="nav-item active"><a href="/ranking/1" class="nav-link">ランキング</a></li>
+                {% if current_user.is_authenticated==True %}
+                <li class="nav-item"><a href="/user/{{current_user.id}}/1" class="nav-link">ユーザーページ</a></li>
+                {%endif%}
+            </ul>
+            {% if current_user.is_authenticated==False %}
+            <span class="navbar-text"><a href="/oauth/twitter" class="btn btn-info">ログイン</a></span> {%else%}
+            <span class="navbar-text"><a href="/logout" class="btn btn-danger">ログアウト</a></span> {%endif%}
+        </div>
+    </nav>
+    <div>
+        <table class="table table-borderd">
+            <thead class="thead-light">
+                <tr>
+                    <th scope="col">順位</th>
+                    <th scope="col">名前</th>
+                    <th scope="col">いいね数</th>
+                </tr>
+            </thead> {% for user in users.items%}
+            <tbody>
+                <tr>
+                    <th scope="row">{{rank[user.like_sum]}}</th>
+                    <td><img src={{user.user_image_url}} alt='' style="width:36px;height:36px;vertical-align:middle;"> <a href="/user/{{user.id}}/1" class="text-dark">{{user.username}}</a></td>
+                    <td>{{user.like_sum}}</td>
+                </tr>
+                {%endfor%}
+            </tbody>
+
+        </table>
+    </div>
+    <div>
+        <div class="container-fluid h4">
+
+            <ul class="pagination">
+                {% if users.has_prev %}
+                <li class="page-item">
+                    <a class="page-link" href="{{ url_for('ranking', page=users.prev_num)}}">前のページ</a>
+                </li>
+                {% endif %} {% if users.has_next %}
+                <li class="page-item">
+                    <a class="page-link" href="{{ url_for('ranking', page=users.next_num)}}">次のページ</a>
+                </li>
+                {% endif %}
+            </ul>
+        </div>
+    </div>
+
+
+    <script src="https://code.jquery.com/jquery-3.4.1.js" integrity="sha256-WpOohJOqMqqyKL9FccASB9O0KwACQJpFTUBLTYOVvVU=" crossorigin="anonymous"></script>
+    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
+    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
+</body>
+
+</html>
\ No newline at end of file
diff --git a/templates/search.html b/templates/search.html
new file mode 100644
index 0000000..057ef28
--- /dev/null
+++ b/templates/search.html
@@ -0,0 +1,248 @@
+<!DOCTYPE html>
+<html lang="ja">
+
+<head>
+    <!-- Google Tag Manager -->
+    <script>
+        (function(w, d, s, l, i) {
+            w[l] = w[l] || [];
+            w[l].push({
+                'gtm.start': new Date().getTime(),
+                event: 'gtm.js'
+            });
+            var f = d.getElementsByTagName(s)[0],
+                j = d.createElement(s),
+                dl = l != 'dataLayer' ? '&l=' + l : '';
+            j.async = true;
+            j.src =
+                'https://www.googletagmanager.com/gtm.js?id=' + i + dl;
+            f.parentNode.insertBefore(j, f);
+        })(window, document, 'script', 'dataLayer', 'GTM-WW39BS6');
+    </script>
+    <!-- End Google Tag Manager -->
+    <meta charset="utf-8" />
+    <meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge">
+    <meta name="csrf-token" content="{{ csrf_token() }}">
+    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
+    <link rel="icon" type="image/x-icon" href="/favicon.ico">
+    <title>AtCoder Editorials</title>
+</head>
+
+<body style="padding-top:5rem">
+    <!-- Google Tag Manager (noscript) -->
+    <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-WW39BS6" height="0" width="0"
+            style="display:none;visibility:hidden"></iframe></noscript>
+    <!-- End Google Tag Manager (noscript) -->
+    <noscript>You need to enable JavaScript to run this app.</noscript>
+
+    <nav class="navbar navbar-expand-md  navbar-dark bg-dark fixed-top">
+        <a href="/" class="navbar-brand">AtCoder Editorials</a>
+
+        <button class="navbar-toggler" data-toggle="collapse" data-target="#nav1">
+            <span class="navbar-toggler-icon"></span>
+        </button>
+
+        <div class="collapse navbar-collapse" id="nav1">
+            <ul class="navbar-nav">
+                <li class="nav-item"><a href="/" class="nav-link">ホーム</a></li>
+                <li class="nav-item active"><a href="/search" class="nav-link">問題</a></li>
+                <li class="nav-item "><a href="/ranking/1" class="nav-link">ランキング</a></li>
+                {% if current_user.is_authenticated==True %}
+                <li class="nav-item"><a href="/user/{{current_user.id}}/1" class="nav-link">ユーザーページ</a></li>
+                {%endif%}
+            </ul>
+            {% if current_user.is_authenticated==False %}
+            <span class="navbar-text"><a href="/oauth/twitter" class="btn btn-info">ログイン</a></span> {%else%}
+            <span class="navbar-text"><a href="/logout" class="btn btn-danger">ログアウト</a></span> {%endif%}
+        </div>
+    </nav>
+
+    <div class="container-fluid">
+        <div class="jumbotron jumbotron-fluid">
+            <div class="container">
+                <h4 class="display-4">問題名検索</h4>
+                <br>
+                <h5 class="text-muted">解法の見たい問題名を入力し、下の候補から選択して下さい
+                </h5>
+            </div>
+        </div>
+        <h3>新着問題</h3>
+
+        <table class="table table-borderd">
+            <thead class="thead-light">
+                <tr>
+                    <th scope="col">#</th>
+                    <th scope="col">名前</th>
+                </tr>
+            </thead> {% for problem in problems%}
+            <tbody>
+                <tr>
+                    <td scope="row">{{loop.index}}</td>
+                    <td>
+                        <a href="/search/{{problem[1]}}/1?contestname={{problem[0]}}" method="POST">{{problem[0]}}</a>
+                    </td>
+                </tr>
+                {%endfor%}
+            </tbody>
+        </table>
+
+        <br>
+
+        <div class="row container-fluid">
+            <div>
+                <h3>問題検索</h3>
+                <form id="search" method="POST" action="">
+                    <input type="hidden" name="csrf_token" value="{{csrf_token()}}" />
+                    <input id="autocomplete_search" placeholder="問題名" style="width:600px" name="contestname" type="text" />
+                </form>
+            </div>
+            <div>
+                <h4 class="col-1"></h4>
+            </div>
+            <div>
+                <h3>タグ検索</h3>
+                <form id="search" method="POST" action="">
+                    <input type="hidden" name="csrf_token" value="{{csrf_token()}}" />
+                    <input id="tag_search" placeholder="タグ名" style="width:600px" name="tagName" type="text" />
+                </form>
+            </div>
+        </div>
+        <br>
+        <br>
+        <br>
+
+    </div>
+
+    <script src="https://code.jquery.com/jquery-3.4.1.js" integrity="sha256-WpOohJOqMqqyKL9FccASB9O0KwACQJpFTUBLTYOVvVU=" crossorigin="anonymous"></script>
+    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js " integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1 " crossorigin="anonymous "></script>
+    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js " integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM " crossorigin="anonymous "></script>
+    <script src="https://code.jquery.com/ui/1.11.4/jquery-ui.js" integrity="sha256-DI6NdAhhFRnO2k51mumYeDShet3I8AKCQf/tf7ARNhI=" crossorigin="anonymous"></script>
+
+    <script type="text/javascript">
+        (async function() {
+
+            const contestName = [];
+            $.ajax({
+                type: 'GET',
+                url: '/getName',
+                dataType: 'json',
+                success: function(json) {
+                    var len = json.length;
+                    for (var i = 0; i < len; i++) {
+                        contestName.push(json[i].id + ":" + json[i].title);
+                    }
+                }
+            });
+
+            //検索候補を表示する。
+            $('#autocomplete_search').autocomplete({
+                source: contestName,
+                autoFocus: true,
+                delay: 100,
+                minLength: 2,
+                appendTo: "menu",
+
+                //候補をクリックすることでsubmitできるようにする
+                select: function(event, ui) {
+                    var name = ui.item.label;
+                    console.log(typeof(name))
+                    $("#autocomplete_search").val(name);
+
+                    var num = 0;
+                    for (let i = 0; i < name.length; i++) {
+                        if (name[i] == ':') {
+                            num = i + 1;
+                            break;
+                        }
+                    }
+
+                    var url = '/search/' + name.split(':')[0] + '/1?contestname=' + encodeURIComponent(name.slice(num));
+
+                    $('form').attr('action', url);
+                    $("#search").submit();
+                }
+            });
+
+            //input内でのEnter無効化
+            $(function() {
+                $(document).on("keypress", "input:not(.allow_submit)", function(event) {
+                    return event.which !== 13;
+                });
+            });
+
+            //日本語入力をスタートしたら無効化
+            $('#autocomplete_search').on('compositionstart', function() {
+                $('#autocomplete_search').autocomplete('disable');
+            });
+
+            //日本語入力が確定したら有効化
+            $('#autocomplete_search').on('compositionend', function() {
+                $('#autocomplete_search').autocomplete('enable').autocomplete('search');
+            });
+
+        })();
+
+        (async function() {
+            const tag = ["フロー", "最小費用流", "最大マッチング", "最大流", "数学",
+                "包除原理", "連立方程式", "半環", "確率", "期待値", "FFT",
+                "アダマール変換", "メビウス変換", "ゼータ変換", "XOR", "中国剰余定理",
+                "線形計画法", "フィボナッチ数列", "有理数", "木構造",
+                "LCA", "HL分解", "オイラーツアー", "木の同型判定",
+                "重心分解", "LinkCutTree", "DynamicTree", "グラフ理論",
+                "スペクトルグラフ理論", "行列木定理", "ケイリーの公式", "橋",
+                "関節点", "サイクル基底", "lowlink", "ダイクストラ", "ベルマンフォード",
+                "ワーシャルフロイド", "オイラー路", "強連結成分分解", "最小パス被覆",
+                "Dilworthの定理", "トポロジカルソート", "最大クリーク", "最大独立集合",
+                "BFS", "後退解析", "最小全域木", "プリム", "クラスカル", "ブルーフカ",
+                "データ構造", "UnionFind", "セグメントツリー", "BIT", "遅延評価セグメントツリー",
+                "永続データ構造", "平衡二分木", "SparseTable", "WaveletMatrix", "動的計画法",
+                "区間DP", "桁DP", "CHT", "MongeDP", "AlianDP", "インラインDP", "きたまさ法",
+                "行列累乗", "戻すDP", "全方位木DP", "木DP", "bitDP", "挿入DP", "連結DP", "inlineDP",
+                "枝刈り", "マンハッタン距離", "しゃくとり法", "二分探索", "三分探索",
+                "imos法", "累積和", "最長部分増加列", "Mo'sAlgorithm",
+                "平方分割", "ローリングハッシュ", "SuffixArray", "LCP", "KMP",
+                "Aho-Corasick", "Z-algorithm", "PalindromicTree", "Manacher",
+                "SuffixTree", "Nim", "Grundy数", "後退解析", "ミニマックス法",
+                "2-SAT", "マージテク", "エラトステネスの篩", "区間篩", "分割統治法", "凸包",
+                "構築", "乱択アルゴリズム", "半分全列挙", "最近点対", "幾何", "構文解析", "平面走査"
+            ];
+            $('#tag_search').autocomplete({
+                source: tag,
+                autoFocus: true,
+                delay: 100,
+                minLength: 2,
+                appendTo: "menu",
+
+                //候補をクリックすることでsubmitできるようにする
+                select: function(event, ui) {
+                    var name = ui.item.label;
+                    $("#tag_search").val(name);
+                    $('form').attr('action', '/tag_search?tagName=' + name);
+                    $("#search").submit();
+                }
+            });
+
+            //input内でのEnter無効化
+            $(function() {
+                $(document).on("keypress", "input:not(.allow_submit)", function(event) {
+                    return event.which !== 13;
+                });
+            });
+
+            //日本語入力をスタートしたら無効化
+            $('#tag_search').on('compositionstart', function() {
+                $('#tag_search').autocomplete('disable');
+            });
+
+            //日本語入力が確定したら有効化
+            $('#tag_search').on('compositionend', function() {
+                $('#tag_search').autocomplete('enable').autocomplete('search');
+            });
+
+        })();
+    </script>
+</body>
+
+
+</html>
\ No newline at end of file
diff --git a/templates/submited.html b/templates/submited.html
new file mode 100644
index 0000000..fc56336
--- /dev/null
+++ b/templates/submited.html
@@ -0,0 +1,69 @@
+<!DOCTYPE html>
+<html lang="ja">
+
+<head>
+    <!-- Google Tag Manager -->
+    <script>
+        (function(w, d, s, l, i) {
+            w[l] = w[l] || [];
+            w[l].push({
+                'gtm.start': new Date().getTime(),
+                event: 'gtm.js'
+            });
+            var f = d.getElementsByTagName(s)[0],
+                j = d.createElement(s),
+                dl = l != 'dataLayer' ? '&l=' + l : '';
+            j.async = true;
+            j.src =
+                'https://www.googletagmanager.com/gtm.js?id=' + i + dl;
+            f.parentNode.insertBefore(j, f);
+        })(window, document, 'script', 'dataLayer', 'GTM-WW39BS6');
+    </script>
+    <!-- End Google Tag Manager -->
+
+    <meta charset="utf-8" />
+    <meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no">
+    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
+    <link rel="icon" type="image/x-icon" href="/favicon.ico">
+    <title>AtCoder Editorials</title>
+</head>
+
+<body style="padding-top:5rem">
+    <!-- Google Tag Manager (noscript) -->
+    <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-WW39BS6" height="0" width="0"
+            style="display:none;visibility:hidden"></iframe></noscript>
+    <!-- End Google Tag Manager (noscript) -->
+    <noscript>You need to enable JavaScript to run this app.</noscript>
+
+    <nav class="navbar navbar-expand-md  navbar-dark bg-dark fixed-top">
+        <a href="/" class="navbar-brand">AtCoder Editorials</a>
+
+        <button class="navbar-toggler" data-toggle="collapse" data-target="#nav1">
+            <span class="navbar-toggler-icon"></span>
+        </button>
+
+        <div class="collapse navbar-collapse" id="nav1">
+            <ul class="navbar-nav">
+                <li class="nav-item"><a href="/" class="nav-link">ホーム</a></li>
+                <li class="nav-item active"><a href="/search" class="nav-link">問題</a></li>
+                <li class="nav-item "><a href="/ranking/1" class="nav-link">ランキング</a></li>
+                {% if current_user.is_authenticated==True %}
+                <li class="nav-item"><a href="/user/{{current_user.id}}/1" class="nav-link">ユーザーページ</a></li>
+                {%endif%}
+            </ul>
+            {% if current_user.is_authenticated==False %}
+            <span class="navbar-text"><a href="/oauth/twitter" class="btn btn-info">ログイン</a></span> {%else%}
+            <span class="navbar-text"><a href="/logout" class="btn btn-danger">ログアウト</a></span> {%endif%}
+        </div>
+    </nav>
+
+    <div class="jumbotron jumbotron-fluid">
+        <h2>投稿が完了しました。</h2>
+    </div>
+
+    <script src="https://code.jquery.com/jquery-3.4.1.js" integrity="sha256-WpOohJOqMqqyKL9FccASB9O0KwACQJpFTUBLTYOVvVU=" crossorigin="anonymous"></script>
+    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
+    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
+</body>
+
+</html>
\ No newline at end of file
diff --git a/templates/tag_result.html b/templates/tag_result.html
new file mode 100644
index 0000000..194ce19
--- /dev/null
+++ b/templates/tag_result.html
@@ -0,0 +1,90 @@
+<!DOCTYPE html>
+<html lang="ja">
+
+<head>
+    <!-- Google Tag Manager -->
+    <script>
+        (function(w, d, s, l, i) {
+            w[l] = w[l] || [];
+            w[l].push({
+                'gtm.start': new Date().getTime(),
+                event: 'gtm.js'
+            });
+            var f = d.getElementsByTagName(s)[0],
+                j = d.createElement(s),
+                dl = l != 'dataLayer' ? '&l=' + l : '';
+            j.async = true;
+            j.src =
+                'https://www.googletagmanager.com/gtm.js?id=' + i + dl;
+            f.parentNode.insertBefore(j, f);
+        })(window, document, 'script', 'dataLayer', 'GTM-WW39BS6');
+    </script>
+    <!-- End Google Tag Manager -->
+    <meta charset="utf-8" />
+    <meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge">
+    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
+    <link rel="icon" type="image/x-icon" href="/favicon.ico">
+    <title>AtCoder Editorials</title>
+</head>
+
+<body style="padding-top:5rem">
+    <!-- Google Tag Manager (noscript) -->
+    <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-WW39BS6" height="0" width="0"
+            style="display:none;visibility:hidden"></iframe></noscript>
+    <!-- End Google Tag Manager (noscript) -->
+    <noscript>You need to enable JavaScript to run this app.</noscript>
+
+    <nav class="navbar navbar-expand-md  navbar-dark bg-dark fixed-top">
+        <a href="/" class="navbar-brand">AtCoder Editorials</a>
+
+        <button class="navbar-toggler" data-toggle="collapse" data-target="#nav1">
+            <span class="navbar-toggler-icon"></span>
+        </button>
+
+        <div class="collapse navbar-collapse" id="nav1">
+            <ul class="navbar-nav">
+                <li class="nav-item"><a href="/" class="nav-link">ホーム</a></li>
+                <li class="nav-item"><a href="/search" class="nav-link">問題</a></li>
+                <li class="nav-item"><a href="/ranking/1" class="nav-link">ランキング</a></li>
+                {% if current_user.is_authenticated==True %}
+                <li class="nav-item"><a href="/user/{{current_user.id}}/1" class="nav-link">ユーザーページ</a></li>
+                {%endif%}
+            </ul>
+            {% if current_user.is_authenticated==False %}
+            <span class="navbar-text"><a href="/oauth/twitter" class="btn btn-info">ログイン</a></span> {%else%}
+            <span class="navbar-text"><a href="/logout" class="btn btn-danger">ログアウト</a></span> {%endif%}
+        </div>
+    </nav>
+    <div>
+        <h2 class="container-fluid">{{tagName}}</h2>
+    </div>
+    <div>
+        <table class="table table-borderd container-fluid">
+            <thead class="thead-light">
+                <tr>
+                    <th scope="col">#</th>
+                    <th scope="col">名前</th>
+                </tr>
+            </thead> {% for problem in problems%}
+            <tbody>
+                <tr>
+                    <td scope="row">{{loop.index}}</td>
+                    <td>
+                        <a href="/search/{{problem.problem_official_name}}/1?contestname={{problem.problem_name}}" method="POST">{{problem.problem_name}}</a>
+                    </td>
+                </tr>
+                {%endfor%}
+            </tbody>
+
+        </table>
+    </div>
+
+
+
+    <script src="https://code.jquery.com/jquery-3.4.1.js" integrity="sha256-WpOohJOqMqqyKL9FccASB9O0KwACQJpFTUBLTYOVvVU=" crossorigin="anonymous"></script>
+    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
+    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
+</body>
+
+</html>
\ No newline at end of file
diff --git a/templates/template.html b/templates/template.html
new file mode 100644
index 0000000..ecd9084
--- /dev/null
+++ b/templates/template.html
@@ -0,0 +1,66 @@
+<!DOCTYPE html>
+<html lang="ja">
+
+<head>
+    <!-- Google Tag Manager -->
+    <script>
+        (function(w, d, s, l, i) {
+            w[l] = w[l] || [];
+            w[l].push({
+                'gtm.start': new Date().getTime(),
+                event: 'gtm.js'
+            });
+            var f = d.getElementsByTagName(s)[0],
+                j = d.createElement(s),
+                dl = l != 'dataLayer' ? '&l=' + l : '';
+            j.async = true;
+            j.src =
+                'https://www.googletagmanager.com/gtm.js?id=' + i + dl;
+            f.parentNode.insertBefore(j, f);
+        })(window, document, 'script', 'dataLayer', 'GTM-WW39BS6');
+    </script>
+    <!-- End Google Tag Manager -->
+    <meta charset="utf-8" />
+    <meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge">
+    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
+    <link rel="icon" type="image/x-icon" href="/favicon.ico">
+    <title>AtCoder Editorials</title>
+</head>
+
+<body style="padding-top:5rem">
+    <!-- Google Tag Manager (noscript) -->
+    <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-WW39BS6" height="0" width="0"
+            style="display:none;visibility:hidden"></iframe></noscript>
+    <!-- End Google Tag Manager (noscript) -->
+    <noscript>You need to enable JavaScript to run this app.</noscript>
+
+    <nav class="navbar navbar-expand-md  navbar-dark bg-dark fixed-top">
+        <a href="/" class="navbar-brand">AtCoder Editorials</a>
+
+        <button class="navbar-toggler" data-toggle="collapse" data-target="#nav1">
+            <span class="navbar-toggler-icon"></span>
+        </button>
+
+        <div class="collapse navbar-collapse" id="nav1">
+            <ul class="navbar-nav">
+                <li class="nav-item"><a href="/" class="nav-link">ホーム</a></li>
+                <li class="nav-item"><a href="/search" class="nav-link">問題</a></li>
+                <li class="nav-item"><a href="/ranking/1" class="nav-link">ランキング</a></li>
+                {% if current_user.is_authenticated==True %}
+                <li class="nav-item"><a href="/user/{{current_user.id}}/1" class="nav-link">ユーザーページ</a></li>
+                {%endif%}
+            </ul>
+            {% if current_user.is_authenticated==False %}
+            <span class="navbar-text"><a href="/oauth/twitter" class="btn btn-info">ログイン</a></span> {%else%}
+            <span class="navbar-text"><a href="/logout" class="btn btn-danger">ログアウト</a></span> {%endif%}
+        </div>
+    </nav>
+
+
+    <script src="https://code.jquery.com/jquery-3.4.1.js" integrity="sha256-WpOohJOqMqqyKL9FccASB9O0KwACQJpFTUBLTYOVvVU=" crossorigin="anonymous"></script>
+    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
+    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
+</body>
+
+</html>
\ No newline at end of file
diff --git a/templates/user.html b/templates/user.html
new file mode 100644
index 0000000..68d62a5
--- /dev/null
+++ b/templates/user.html
@@ -0,0 +1,171 @@
+<!DOCTYPE html>
+
+<html lang="ja">
+
+<head>
+    <!-- Google Tag Manager -->
+    <script>
+        (function(w, d, s, l, i) {
+            w[l] = w[l] || [];
+            w[l].push({
+                'gtm.start': new Date().getTime(),
+                event: 'gtm.js'
+            });
+            var f = d.getElementsByTagName(s)[0],
+                j = d.createElement(s),
+                dl = l != 'dataLayer' ? '&l=' + l : '';
+            j.async = true;
+            j.src =
+                'https://www.googletagmanager.com/gtm.js?id=' + i + dl;
+            f.parentNode.insertBefore(j, f);
+        })(window, document, 'script', 'dataLayer', 'GTM-WW39BS6');
+    </script>
+    <!-- End Google Tag Manager -->
+    <meta charset="utf-8" />
+    <meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge">
+    <meta name="csrf-token" content="{{ csrf_token() }}">
+    <link rel="icon" type="image/x-icon" href="/favicon.ico">
+    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
+    <title>AtCoder Editorials</title>
+</head>
+
+<body style="padding-top:5rem">
+    <!-- Google Tag Manager (noscript) -->
+    <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-WW39BS6" height="0" width="0"
+            style="display:none;visibility:hidden"></iframe></noscript>
+    <!-- End Google Tag Manager (noscript) -->
+    <noscript>You need to enable JavaScript to run this app.</noscript>
+
+    <nav class="navbar navbar-expand-md  navbar-dark bg-dark fixed-top">
+        <a href="/" class="navbar-brand">AtCoder Editorials</a>
+
+        <button class="navbar-toggler" data-toggle="collapse" data-target="#nav1">
+            <span class="navbar-toggler-icon"></span>
+        </button>
+
+        <div class="collapse navbar-collapse" id="nav1">
+            <ul class="navbar-nav">
+                <li class="nav-item"><a href="/" class="nav-link">ホーム</a></li>
+                <li class="nav-item"><a href="/search" class="nav-link">問題</a></li>
+                <li class="nav-item"><a href="/ranking/1" class="nav-link">ランキング</a></li>
+                {% if current_user.is_authenticated==True %}
+                <li class="nav-item"><a href="/user/{{current_user.id}}/1" class="nav-link">ユーザーページ</a></li>
+                {%endif%}
+            </ul>
+            {% if current_user.is_authenticated==False %}
+            <span class="navbar-text"><a href="/oauth/twitter" class="btn btn-info">ログイン</a></span> {%else%}
+            <span class="navbar-text"><a href="/logout" class="btn btn-danger">ログアウト</a></span> {%endif%}
+        </div>
+    </nav>
+
+    <div class="container-fluid">
+        <div class="jumbotron jumbotron-fluid text-dark">
+            <h1>{{user.username}}</h1>
+            <div>
+                <h4>登録日時：{{date_published}}</h4>
+            </div>
+            <div>
+                <h4>順位　　：{{rank}}位</h4>
+            </div>
+            <div>
+                <h4> いいね数 :{{user.like_sum}}</h4>
+            </div>
+            <div>
+                <h4> 投稿数　 :{{num}}</h4>
+            </div>
+            <div>
+                {%if current_user.is_authenticated==True%}
+                <div class="twitter">
+                    <a href="//twitter.com/share" class="twitter-share-button" data-text="AtCoderEditorialsで{{rank}}位になりました！" data-url="https://atcoder-editorials.herokuapp.com/user/{{user.id}}/1" data-lang="ja">
+                    </a>
+                </div>
+                {%endif%}
+            </div>
+        </div>
+    </div>
+    <div class="container-fluid">
+        <h3>投稿一覧</h3>
+        <div>
+            {%for e in edit.items %}
+            <div id="editorial-card">
+                <br>
+                <br>
+
+                <div class="row container-fluid">
+                    {%if current_user.is_authenticated==True%} {% if flag[e.id]==False%}
+                    <form>
+                        <input type="hidden" name="csrf_token" value="{{csrf_token()}}" />
+                        <button class="like_button btn btn-outline-info" name="id" value={{e.id}}>{{e.like}}いいね</button>
+                    </form>
+                    {%else%}
+                    <form>
+                        <input type="hidden" name="csrf_token" value="{{csrf_token()}}" />
+                        <button class="like_button btn btn-info" name="id" value={{e.id}}>{{e.like}}いいね</button>
+                    </form>
+                    {%endif%}{%else%}
+                    <button class="like_button_no_login btn btn-outline-info" name="id" value={{e.id}}>{{e.like}}いいね</button> {%endif%}
+
+                    <h4>{{e.contestname}}</h4>
+                    <h4 class="col-1"></h4>
+                    {% if current_user.is_authenticated==True and e.user_id==current_user.id%}
+                    <form action="/edit" method="POST">
+                        <input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
+                        <button class="btn" name="edit_id" value={{e.id}} type="submit">編集</button>
+                    </form>
+                    <form>
+                        <input type="hidden" name="csrf_token" value="{{csrf_token()}}" />
+                        <button class="delete_button btn" style="color:tomato;" name="delete_id" value={{e.id}}>削除</button>
+                    </form>
+                    {%endif%}
+                </div>
+
+                <div class="container-fluid">
+                    <div class="card col-6 border-0" style="cursor: pointer;">
+                        <h4 class="card-header text-dark bg-light col-10" data-toggle="collapse" data-target="#e{{loop.index}}">
+                            {{e.title}}
+                        </h4>
+
+                        <div class="collapse" id="e{{loop.index}}" data-parent="#editorial-card">
+                            {% if e.url!=None%}
+                            <a href={{e.url}}>{{e.url}}</a> {%endif%}
+                        </div>
+
+                        <div class="collapse" id="e{{loop.index}}" data-parent="#editorial-card">
+                            {% autoescape false %} {%if e.description!=None%}
+                            <br>
+                            <p>{{e.description}}</p>
+                            {%endif%} {% endautoescape %}
+                        </div>
+                    </div>
+                    <br>
+                    <br>
+                </div>
+            </div>
+            {% endfor %}
+        </div>
+
+        <div class="container-fluid">
+            <ul class="pagination">
+                {% if edit.has_prev %}
+                <li class="page-item">
+                    <a class="page-link" href="{{ url_for('user', page=edit.prev_num,id=user.id)}}">前のページ</a>
+                </li>
+                {% endif %} {% if edit.has_next %}
+                <li class="page-item">
+                    <a class="page-link" href="{{ url_for('user', page=edit.next_num,id=user.id)}}">次のページ</a>
+                </li>
+                {% endif %}
+            </ul>
+        </div>
+
+
+        <script src="https://code.jquery.com/jquery-3.4.1.js" integrity="sha256-WpOohJOqMqqyKL9FccASB9O0KwACQJpFTUBLTYOVvVU=" crossorigin="anonymous"></script>
+        <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
+        <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
+        <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
+        <script src="/static/script.js"></script>
+</body>
+
+
+</html>
\ No newline at end of file
diff --git a/templates/vote_fin.html b/templates/vote_fin.html
new file mode 100644
index 0000000..be269c7
--- /dev/null
+++ b/templates/vote_fin.html
@@ -0,0 +1,70 @@
+<!DOCTYPE html>
+<html lang="ja">
+
+<head>
+    <!-- Google Tag Manager -->
+    <script>
+        (function(w, d, s, l, i) {
+            w[l] = w[l] || [];
+            w[l].push({
+                'gtm.start': new Date().getTime(),
+                event: 'gtm.js'
+            });
+            var f = d.getElementsByTagName(s)[0],
+                j = d.createElement(s),
+                dl = l != 'dataLayer' ? '&l=' + l : '';
+            j.async = true;
+            j.src =
+                'https://www.googletagmanager.com/gtm.js?id=' + i + dl;
+            f.parentNode.insertBefore(j, f);
+        })(window, document, 'script', 'dataLayer', 'GTM-WW39BS6');
+    </script>
+    <!-- End Google Tag Manager -->
+    <meta charset="utf-8" />
+    <meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge">
+    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
+    <link rel="icon" type="image/x-icon" href="/favicon.ico">
+    <title>AtCoder Editorials</title>
+</head>
+
+<body style="padding-top:5rem">
+    <!-- Google Tag Manager (noscript) -->
+    <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-WW39BS6" height="0" width="0"
+            style="display:none;visibility:hidden"></iframe></noscript>
+    <!-- End Google Tag Manager (noscript) -->
+    <noscript>You need to enable JavaScript to run this app.</noscript>
+
+    <nav class="navbar navbar-expand-md  navbar-dark bg-dark fixed-top">
+        <a href="/" class="navbar-brand">AtCoder Editorials</a>
+
+        <button class="navbar-toggler" data-toggle="collapse" data-target="#nav1">
+            <span class="navbar-toggler-icon"></span>
+        </button>
+
+        <div class="collapse navbar-collapse" id="nav1">
+            <ul class="navbar-nav">
+                <li class="nav-item"><a href="/" class="nav-link">ホーム</a></li>
+                <li class="nav-item"><a href="/search" class="nav-link">問題</a></li>
+                <li class="nav-item"><a href="/ranking/1" class="nav-link">ランキング</a></li>
+                {% if current_user.is_authenticated==True %}
+                <li class="nav-item"><a href="/user/{{current_user.id}}/1" class="nav-link">ユーザーページ</a></li>
+                {%endif%}
+            </ul>
+            {% if current_user.is_authenticated==False %}
+            <span class="navbar-text"><a href="/oauth/twitter" class="btn btn-info">ログイン</a></span> {%else%}
+            <span class="navbar-text"><a href="/logout" class="btn btn-danger">ログアウト</a></span> {%endif%}
+        </div>
+    </nav>
+
+    <div class="jumbotron jumbotron-fluid container-fluid">
+        <h2>投票しました。</h2>
+    </div>
+
+
+    <script src="https://code.jquery.com/jquery-3.4.1.js" integrity="sha256-WpOohJOqMqqyKL9FccASB9O0KwACQJpFTUBLTYOVvVU=" crossorigin="anonymous"></script>
+    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
+    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
+</body>
+
+</html>
\ No newline at end of file
