<commit_before>{% set title = problem.oj_id %}

{% extends 'base.html' %}

{% block endhead %}
{{ super() }}
<style>
{% include 'pygments.css' %}
</style>
{% endblock %}

{% block content %}
<h1 class="page-header text-center">Problem {{ problem.oj_id }}</h1>
<div class="text-right">
  {% if not shared %}
  <a href="{{ problem.share_url }}"><button class="btn btn-primary">share your AC to see others' code</button></a>
  {% else %}
  <a href="{{ problem.share_url }}"><button class="btn btn-primary">update shared code</button></a>
  <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#hintmodal">{% if hinted %}Update{% else %}Share{% endif %} hint</button>
  {% endif %}
</div>
<p class="text-right">{{ code_list.count() }} AC code shared, {{ hint_list.count() }} hints shared.</p>
<div class="row">
  <div class="col-sm-11 col-sm-offset-1">
    <iframe src="http://acm.cs.nthu.edu.tw/problem/{{ problem_id }}/" style="width: 100%; height: 400px"></iframe>
  </div>
</div>
<hr>

{% if hint_list.exists() %}
<div class="row">
  <div class="col-sm-offset-1 col-sm-11">
    <button class="btn btn-primary" role="button" data-toggle="collapse" href="#hintcollapse" aria-expanded="false" aria-controls="hintcollapse" style="margin-bottom: 5px">
    Hints ({{ hint_list.count() }})
    </button>
  </div>
  <div class="collapse" id="hintcollapse">
    {% for hint in hint_list %}
    <div class="col-sm-1">
      #{{ hint.pk }}<br>
      <a href="{{ url('problem:hint-upvote', pk=hint.pk) }}">upvote</a><br>
      (+{{ hint.upvotes}})<br>
    </div>
    <div class="col-sm-11">
      <blockquote>
        <div style="word-wrap: pre">{{ hint.text }}</div>
        <footer>{{ hint.user }}</footer>
      </blockquote>
    </div>
    {% endfor -%}
  </div>
</div>
{% endif %}

{% if shared %}
<div>
  {% for code in code_list %}
  <div class="row">
    <div class="col-sm-1">
      #{{ code.pk }}
      <br>
      <a href="{{ url('problem:code-upvote', pk=code.pk) }}">upvote</a> (+{{ code.upvotes }})
    </div>
    <div class="col-sm-11">
      {{ code.text | highlight }}
    </div>
  </div>
  {% endfor %}
</div>
{% endif %}

{% if shared %}
<div class="modal" tabindex="-1" role="dialog" id="hintmodal"><commit_msg>fix hints animation and button position<commit_after>{% set title = problem.oj_id %}

{% extends 'base.html' %}

{% block endhead %}
{{ super() }}
<style>
{% include 'pygments.css' %}
</style>
{% endblock %}

{% block content %}
<h1 class="page-header text-center">Problem {{ problem.oj_id }}</h1>
<div class="text-right">
  {% if not shared %}
  <a href="{{ problem.share_url }}"><button class="btn btn-primary">share your AC to see others' code</button></a>
  {% else %}
  <a href="{{ problem.share_url }}"><button class="btn btn-primary">update shared code</button></a>
  <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#hintmodal">{% if hinted %}Update{% else %}Share{% endif %} hint</button>
  {% endif %}
</div>
<p class="text-right">{{ code_list.count() }} AC code shared, {{ hint_list.count() }} hints shared.</p>
<div class="row">
  <div class="col-sm-1" style="height: 400px; position: relative">
    <button class="btn btn-primary" role="button" data-toggle="collapse" href="#hintcollapse" aria-expanded="false" aria-controls="hintcollapse" style="position: absolute; bottom: 0">
    hints ({{ hint_list.count() }})
    </button>
  </div>
  <div class="col-sm-11">
    <iframe src="http://acm.cs.nthu.edu.tw/problem/{{ problem_id }}/" style="width: 100%; height: 400px"></iframe>
  </div>
</div>
<hr>

{% if hint_list.exists() %}
<div class="collapse" id="hintcollapse">
  {% for hint in hint_list %}
  <div class="row">
    <div class="col-sm-1">
      #{{ hint.pk }}<br>
      <a href="{{ url('problem:hint-upvote', pk=hint.pk) }}">upvote</a><br>
      (+{{ hint.upvotes}})<br>
    </div>
    <div class="col-sm-11">
      <blockquote>
        <div style="word-wrap: pre">{{ hint.text }}</div>
        <footer>{{ hint.user }}</footer>
      </blockquote>
    </div>
  </div>
  {% endfor %}
</div>
{% endif %}

{% if shared %}
<div>
  {% for code in code_list %}
  <div class="row">
    <div class="col-sm-1">
      #{{ code.pk }}
      <br>
      <a href="{{ url('problem:code-upvote', pk=code.pk) }}">upvote</a> (+{{ code.upvotes }})
    </div>
    <div class="col-sm-11">
      {{ code.text | highlight }}
    </div>
  </div>
  {% endfor %}
</div>
{% endif %}

{% if shared %}
<div class="modal" tabindex="-1" role="dialog" id="hintmodal">
{'fraction_non_alphanumeric': 0.2353720468094502, 'fraction_numerical': 0.009715168911459484, 'mean_word_length': 3.6413934426229506, 'pattern_counts': {'":': 0, '<': 123, '<?xml version=': 0, '>': 123, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6409147', 'n_tokens_mistral': 1740, 'n_tokens_neox': 1600, 'n_words': 364}