Dataset Viewer
Auto-converted to Parquet Duplicate
submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
1 value
status
stringclasses
1 value
code_size
int64
26
8.99k
cpu_time
float64
0
100
memory
float64
2.57k
99k
code
stringlengths
26
8.99k
input
stringlengths
2
906
output
stringlengths
2
686
problem_description
stringlengths
415
9.48k
s715901262
p02576
Python
Accepted
62
25
9,084
N,X,T = map(int,input().split()) cnt = -(-N//X) print(cnt * T)
20 12 6
12
<span class="lang-en"> <p>Score : <var>100</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Takahashi loves takoyaki - a ball-shaped snack.</p> <p>With a takoyaki machine, he can make at most <var>X</var> pieces of takoyaki at a time, taking <var>T</var> minutes regardless of the number of pie...
s227404596
p03694
Python
Accepted
523
19
9,148
# クリスマスもあと半年となり、トナカイのAtCoDeer君はプレゼントを配る計画を立てることにしました。 # TopCoDeer通りにはN個の家が並んでいます。i個目の家は座標aiにあります。彼はこのすべての家にプレゼントを配ることにしました。 # 好きな場所から開始し好きな場所で終了することができる時、最小の移動距離を求めなさい。 N = int(input()) a = list(map(int,input().split())) print(max(a) - min(a))
4 2 3 7 9
7
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>It is only six months until Christmas, and AtCoDeer the reindeer is now planning his travel to deliver gifts.<br/> There are <var>N</var> houses along <em>TopCoDeer street</em>. The <var>i</var>-th hous...
s559547612
p02567
Python
Accepted
1,753
81
14,848
import sys if sys.argv[-1] == 'ONLINE_JUDGE': import os, zlib, base64 open('solve.pyx', 'wb').write(zlib.decompress(base64.b85decode("c$}SA&2Hm15WWY<I}lj3krE|{7kgL)ac-Mq_tINx2(m=mglS4k%ig571ikgvK0t5np+H~Cmp;bMkQ7CcRDM=4V3EW5`{v__d`HTMc2$cjGOu@{+LkL?uBW#J-_qlwg{(J5ez9ltD=FEgsbxzFDT@aq=WJeHY}*R{t$b5(UY8kJND5|-kIM...
5 5 1 2 3 2 1 2 1 5 3 2 3 1 3 1 2 2 4 3 1 3
3 3 2 6
<span class="lang-en"> <p>Score : <var>100</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>You are given an array <var>a_0, a_1, ..., a_{N-1}</var> of length <var>N</var>. Process <var>Q</var> queries of the following types.</p> <p>The type of <var>i</var>-th query is represented by <var>T_i<...
s556371913
p03533
Python
Accepted
223
60
61,592
A=["KIHBR","KIHABR","AKIHBR","KIHBAR","KIHBRA","AKIHABR","AKIHBAR","AKIHBRA","KIHABAR","KIHABRA","KIHBARA","AKIHABAR","AKIHABRA","AKIHBARA","KIHABARA","AKIHABARA"] s=input() if s in A: print("YES") else: print("NO")
KIHBR
YES
<span class="lang-en"> <p>Score : <var>300</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>You are given a string <var>S</var>.</p> <p>Takahashi can insert the character <code>A</code> at any position in this string any number of times.</p> <p>Can he change <var>S</var> into <code>AKIHABARA</...
s196419657
p00607
Python
Accepted
4,936
20
5,632
class Editer: def __init__(self, text): # カーソルの位置 self.row = 0 #行 self.col = 0 #列 # 編集中のテキスト self.text = [list(t) + ['\n'] for t in text] # バッファー self.buffer = [] def row_head(self): return 0 def row_tail(self): return len(self.text)...
hyo ni END_OF_TEXT f d f f k p p e y a k y y n y -
honihoni honi
<H1><font color="#000000">Problem C:</font> Emacs-like Editor</H1> <p> Emacs is a text editor which is widely used by many programmers. </p> <p> The advantage of Emacs is that we can move a cursor without arrow keys and the mice. For example, the cursor can be moved right, left, down, and up by pushing <span>f</span>...
s668216812
p03398
Python
Accepted
465
39
28,396
print[0,1,2,12,84,770,8340,106400,1546888,25343766,461133960,232367169,627905865,632459808,928262728,919805769,382796331,887217496,639768068,869694124,205875097,205589953,487772376,239955313,998339621,31622834,902930073,146839084,449786840,982224660,865803735,21834818,721531716,26008837,471774471,69010090,700009308,776...
3
12
<span class="lang-en"> <p>Score : <var>1600</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Let <var>X = 10^{100}</var>. Inaba has <var>N</var> checker pieces on the number line, where the <var>i</var>-th checker piece is at coordinate <var>X^{i}</var> for all <var>1 \leq i \leq N</var>.</p> ...
s009469424
p00020
Python
Accepted
29
10
4,604
print raw_input().swapcase()
this is a pen.
THIS IS A PEN.
<H1>Capitalize</H1> <p> Write a program which replace all the lower-case letters of a given text with the corresponding captital letters. </p> <H2>Input</H2> <p> A text including lower-case letters, periods, and space is given in a line. The number of characters in the text is less than or equal to 200. </p> <H2>...
s125064404
p02312
Python
Accepted
2,432
60
7,348
from math import acos, hypot, isclose, sqrt from typing import List, Tuple def intersection(circle: Tuple[int, int, int], polygon: List[Tuple[float, float]]) -> float: x, y, r = circle area = 0.0 for p1, p2 in zip(polygon, polygon[1:] + [polygon[0]]): ps = seg_intersection(circle...
3 5 1 1 4 1 5 5
4.639858417607
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Intersection of a Circle and a Polygon</H1>...
s948499044
p00354
Python
Accepted
79
20
5,588
ans=["thu","fri","sat","sun","mon","tue","wed"] i=int(input()) print(ans[i%7])
1
fri
<!--<H1>X-th day of September</H1>--> <h1>Day of Week</h1> <p> The 9th day of September 2017 is Saturday. Then, what day of the week is the X-th of September 2017? </p> <p> Given a day in September 2017, write a program to report what day of the week it is. </p> <h2>Input</h2> <p> The input is given in t...
s949780828
p01858
Python
Accepted
1,281
10
6,464
K = int(raw_input()) nakaji = isono = 0 for I, N in zip([raw_input() for i in xrange(K)], [raw_input() for i in xrange(K)]): lose1 = lose2 = False if I == "kougekida" and isono == 0: lose1 = True if N == "kougekida" and nakaji == 0: lose2 = True if lose1 and lose2: continue elif lose1: print...
3 tameru tameru tameru tameru kougekida tameru
Nakajima-kun
<!--<script language="JavaScript" type="text/javascript" src="js/varmath.js" charset="UTF-8"></script>--> <h2>A: 磯野、あれやろうぜ! - Sendame -</h2> <h3>物語</h3> <p>中島「磯野〜,あれやろうぜ!」</p> <p>磯野「あれって何だよ,中島」</p> <p>中島「ほら,あれだよ,あれ.なぜか文字で表さなきゃならないから,説明しづらいな〜」</p> <p>磯野「いや,図や写真も入れられるみたいだぞ?」</p> <img src="https://judgeapi.u-aizu...
s971614031
p00435
Python
Accepted
348
20
5,716
x = input() str_list = list(x) dict_ = { "D":"A", "E":"B", "F":"C", "G":"D", "H":"E", "I":"F", "J":"G", "K":"H", "L":"I", "M":"J", "N":"K", "O":"L", "P":"M", "Q":"N", "R":"O", "S":"P", "T":"Q", "U":"R", "V":"S", "W":"T", "X":"U", "Y":"V", "Z":"W", "A":"X", "B":"Y", "C":"Z" } for a in str_list: print(dict_...
MRL
JOI
<H1>シーザー暗号</H1> <h2>問題</h2> <p> ガイウス・ユリウス・カエサル(Gaius Julius Caesar),英語読みでジュリアス・シーザー(Julius Caesar)は,古代ローマの軍人であり政治家である.カエサルは,秘密の手紙を書くときに, 'A' を 'D' に, 'B' を 'E' に, 'C' を 'F' に,というように3つずらして表記したという記録が残っている. </p> <p> 大文字のアルファベット26文字だけからなる文字列を,カエサルがしたように3文字ずつずらす変換を施し得られた文字列がある.このような文字列を元の文字列に戻すプログラムを作成せよ. </p> <p> 各文字の変...
s938943334
p00433
Python
Accepted
162
20
4,192
a_score = sum(map(int, raw_input().split())) b_score = sum(map(int, raw_input().split())) if a_score > b_score: print a_score else: print b_score
100 80 70 60 80 70 80 90
320
<H1>得点</H1> <h2>問題</h2> <p> JOI高校の2人の生徒 A さんと B さんは,情報,数学,理科,英語の4教科の試験を受けた. A さんと B さんのこれら4教科の得点が与えられると, Aさんの合計点 S と Bさんの合計点 T のうち大きな方を出力するプログラムを作成せよ.ただし,同点の場合は S (= T) を出力せよ. </p> <H2>入力</H2> <p> <!--入力ファイルは2行からなる.--> 入力は2行からなる. </p> <p> 1行目は4つの整数が1つの空白を区切りとして書かれており,それぞれ順に, A さんの情報の得点,数学の得点,理科の得点,英語の得点を表している. <...
s169448030
p01905
Python
Accepted
97
20
5,580
# AOJ 2805: Tournament # Python3 2018.7.11 bal4u N, M = map(int, input().split()) print(N-1-M)
2 0
1
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]} }); </script> <script type="text/javascript" async src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <h1>A: トーナメント</h1> <h2>問題</h2> <p> AOR イカちゃんとあなたは、トーナメント形式の卓球大会...
s089387393
p03167
Python
Accepted
2,418
99
80,800
''' =============================== -- @uthor : Kaleab Asfaw -- Handle : kaleabasfaw2010 -- Bio : High-School Student ===============================''' # Fast IO import sys import os from io import BytesIO, IOBase BUFSIZE = 8192 class FastIO(IOBase): newlines = 0 def __init__(self, file): self._fd = file.fil...
3 4 ...# .#.. ....
3
<span class="lang-en"> <p>Score : <var>100</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>There is a grid with <var>H</var> horizontal rows and <var>W</var> vertical columns. Let <var>(i, j)</var> denote the square at the <var>i</var>-th row from the top and the <var>j</var>-th column from t...
s664158188
p02255
Python
Accepted
1,048
20
5,600
length=int(input()) firstArray=input() listForArray=list(map(int,firstArray.split())) listForPrint=[firstArray] def insertionSort(list,length): index=1 while index<length: if listForArray[index]<=listForArray[index-1]: for index2 in range(0,index): if listForArray[index2-1]...
6 5 2 4 6 1 3
5 2 4 6 1 3 2 5 4 6 1 3 2 4 5 6 1 3 2 4 5 6 1 3 1 2 4 5 6 3 1 2 3 4 5 6
<H1>Insertion Sort</H1> <p> Write a program of the Insertion Sort algorithm which sorts a sequence A in ascending order. The algorithm should be based on the following pseudocode: </p> <pre> for i = 1 to A.length-1 key = A[i] /* insert A[i] into the sorted sequence A[0,...,j-1] */ j = i - 1 while j >...
s444434531
p03891
Python
Accepted
137
73
61,900
a=int(input()) b=int(input()) c=int(input()) d=c*3-a-b g=c*2-d h=c*2-b i=c*2-a e=c*3-a-g f=c*3-d-i print(a,b,d) print(e,c,f) print(g,h,i)
8 3 5
8 3 4 1 5 9 6 7 2
<span class="lang-en"> <p>Score : <var>100</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>A <var>3×3</var> grid with a integer written in each square, is called a magic square if and only if the integers in each row, the integers in each column, and the integers in each diagonal (from the to...
s073784356
p03388
Python
Accepted
1,554
29
9,444
q=int(input()) ab=[list(map(int,input().split())) for _ in range(q)] from math import floor for a,b in ab: # a*bをぎりぎりまで攻めたい # (1,1)とかはもったいない。(1,a*b-1)は良い。片方は√a*b未満で、片方は√a*bより大きい組み合わせ。 # a==bならa未満の整数yについて適切な数字xを選べばy*x<a*bとできる。xは他のxと被らないように選択できる。 if a==b: print(2*a-2) else: # t,t+1 組み合...
8 1 4 10 5 3 3 4 11 8 9 22 40 8 36 314159265 358979323
1 12 4 11 14 57 31 671644785
<span class="lang-en"> <p>Score : <var>700</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p><var>10^{10^{10}}</var> participants, including Takahashi, competed in two programming contests. In each contest, all participants had distinct ranks from first through <var>10^{10^{10}}</var>-th.</p> <...
s934603618
p02696
Python
Accepted
123
64
61,860
a,b,n=map(int,input().split()) x=min(b-1,n) #上記よりxとしてmin(B-1,N)を選ぶのが最善 print((a*x)//b-a*(x//b))
5 7 4
2
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Given are integers <var>A</var>, <var>B</var>, and <var>N</var>.</p> <p>Find the maximum possible value of <var>floor(Ax/B) - A × floor(x/B)</var> for a non-negative integer <var>x</var> not greater tha...
s107222901
p02801
Python
Accepted
37
62
61,668
print(chr(ord(input().strip()) + 1))
a
b
<span class="lang-en"> <p>Score : <var>100</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Given is a lowercase English letter <var>C</var> that is not <code>z</code>. Print the letter that follows <var>C</var> in alphabetical order.</p> </section> </div> <div class="part"> <section> <h3>Cons...
s970409947
p02715
Python
Accepted
934
96
69,056
n, k = map(int, input().split()) mod = 10**9 + 7 # For each X, in 1<= X <= K, let us find the number of sequences {A1, A2, .., An} with GCD = X. # The necessary and sufficient condition of the greatest common divisor being a multiple of X # is that all the A1, ..., AN are multiples of X. The number of such sequences ...
3 2
9
<span class="lang-en"> <p>Score : <var>500</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Consider sequences <var>\{A_1,...,A_N\}</var> of length <var>N</var> consisting of integers between <var>1</var> and <var>K</var> (inclusive).</p> <p>There are <var>K^N</var> such sequences. Find the su...
s893956280
p02909
Python
Accepted
113
21
8,832
S = input() if S == 'Sunny': print('Cloudy') elif S == 'Cloudy': print('Rainy') else: print('Sunny')
Sunny
Cloudy
<span class="lang-en"> <p>Score: <var>100</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3> <p>The weather in Takahashi's town changes day by day, in the following cycle: Sunny, Cloudy, Rainy, Sunny, Cloudy, Rainy, ...</p> <p>Given is a string <var>S</var> representing the weather in the town tod...
s113807170
p02735
Python
Accepted
623
91
74,104
H, W = map(int,input().split()) grid = [input() for _ in range(H)] dp = [[float('inf')]*(W) for _ in range(H)] dp[0][0] = 0 if grid[0][0] == '.' else 1 for i in range(H): for k in range(W): if i+1 < H: if grid[i][k] == '.' and grid[i+1][k] == '#': dp[i+1][k] = min(dp[i][k]+1,dp[i...
3 3 .## .#. ##.
1
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Consider a grid with <var>H</var> rows and <var>W</var> columns of squares. Let <var>(r, c)</var> denote the square at the <var>r</var>-th row from the top and the <var>c</var>-th column from the left. ...
s498456168
p00007
Python
Accepted
138
10
4,708
import math price = 100000.0 n = int(raw_input()) for i in range(n): price = math.ceil((price * 1.05) / 1000) * 1000 print int(price)
5
130000
<H1>Debt Hell</H1> <p> Your friend who lives in undisclosed country is involved in debt. He is borrowing 100,000-yen from a loan shark. The loan shark adds 5% interest of the debt and rounds it to the nearest 1,000 above week by week. </p> <p> Write a program which computes the amount of the debt in <var>n</var> wee...
s889897473
p02847
Python
Accepted
122
28
8,972
def resolve(): week = ['SUN','MON','TUE','WED','THU','FRI','SAT'] s = input() print(7-week.index(s)) resolve()
SAT
1
<span class="lang-en"> <p>Score : <var>100</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Given is a string <var>S</var> representing the day of the week today.</p> <p><var>S</var> is <code>SUN</code>, <code>MON</code>, <code>TUE</code>, <code>WED</code>, <code>THU</code>, <code>FRI</code>, ...
s045969688
p00606
Python
Accepted
1,068
20
6,400
time = -1 place = ["a","b","c","d","e","f","g","h","i"] empty_count={} for i in place: empty_count[i] = 0 count_d = empty_count.copy() def reset(): global d global count_d d={"a":["a","a","b","d"],"b":["a","e","c","b"],"c":["b","f","c","c"],"d":["a","e","g","d"],"e":["b","d","f","h"],"f":["c","e","i","f"],"g":["d...
1 E A C 1 E B C 2 E A B 0
0.00000000 0.25000000 0.06250000
<H1><font color="#000000">Problem B:</font> Cleaning Robot</H1> <p> Dr. Asimov, a robotics researcher, loves to research, but hates houseworks and his house were really dirty. So, he has developed a cleaning robot. </p> <p> As shown in the following figure, his house has 9 rooms, where each room is identified by an ...
s981851807
p03742
Python
Accepted
61
67
61,644
print(["Alice","Brown"][-1<=eval(input().replace(*" -"))<=1])
2 1
Brown
<span class="lang-en"> <p>Score : <var>500</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Alice and Brown loves games. Today, they will play the following game.</p> <p>In this game, there are two piles initially consisting of <var>X</var> and <var>Y</var> stones, respectively. Alice and Bob ...
s322831715
p02415
Python
Accepted
81
20
5,548
def main(): print(input().swapcase()) if __name__ == '__main__': main()
fAIR, LATER, OCCASIONALLY CLOUDY.
Fair, later, occasionally cloudy.
<H1>Toggling Cases</H1><br> <p> Write a program which converts uppercase/lowercase letters to lowercase/uppercase for a given string. </p> <H2>Input</H2> <p> A string is given in a line. </p> <H2>Output</H2> <p> Print the converted string in a line. Note that you do not need to convert any characters othe...
s885658910
p02939
Python
Accepted
126
67
9,304
s = input() ans = 0 a = b = "" for i in s: b += i if a != b: a = b b = "" ans += 1 print(ans)
aabbaa
4
<span class="lang-en"> <p>Score : <var>300</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Given is a string <var>S</var> consisting of lowercase English letters. Find the maximum positive integer <var>K</var> that satisfies the following condition:</p> <ul> <li>There exists a partition of <v...
s594356635
p00148
Python
Accepted
66
10
4,188
while 1: try: print '3C%02d' %((input()-1)%39+1) except: break
50 5576 5577 5578
3C11 3C38 3C39 3C01
<H1>キャンディーとクラス旗</H1> <p> 3年C組では、平成19年11月10日の体育祭で使用する「クラス旗」を、将来のクラス会の時にも使うことにしました。そこで「クラス旗」を保管する生徒を決めるために、先生が先日差し入れてくれた大量のキャンディーを使って次のようなゲームを行うことにしました。 </p> <ul> <li>各生徒は生徒番号の順に1個ずつキャンディーを取ります。</li> <li>一巡してもキャンディーが残っていたら、最初の生徒番号の人から順々にキャンディーを取り続けます。</li> <li>最後のキャンディーを取った人が「クラス旗」を保管する生徒になります。</li> </ul> <p> 3年C組の...
s908556789
p02553
Python
Accepted
71
29
8,984
a, b, c, d = map(int, input().split()) print(max([a*c, b*c, a*d, b*d]))
1 2 1 1
2
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Given are integers <var>a,b,c</var> and <var>d</var>. If <var>x</var> and <var>y</var> are integers and <var>a \leq x \leq b</var> and <var>c\leq y \leq d</var> hold, what is the maximum possible value ...
s511681237
p02945
Python
Accepted
173
23
9,172
A,B=map(int,input().split()) if (A+B)>=(A-B) and (A+B)>=(A*B): print(A+B) elif (A-B)>=(A+B) and (A-B)>=(A*B): print(A-B) elif (A*B)>=(A+B) and (A*B)>=(A-B): print(A*B)
-13 3
-10
<span class="lang-en"> <p>Score : <var>100</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>We have two integers: <var>A</var> and <var>B</var>.</p> <p>Print the largest number among <var>A + B</var>, <var>A - B</var>, and <var>A \times B</var>.</p> </section> </div> <div class="part"> <sectio...
s250337778
p02419
Python
Accepted
495
20
5,564
def main(): Counter = 0 Text_W = input() while True: Text_T = input() if "END_OF_TEXT" in Text_T: temp = Text_T.lower().split() for i in range(len(temp)): Counter += 1 if Text_W == temp[i] else 0 break else: temp = Text...
computer Nurtures computer scientists and highly-skilled computer engineers who will create and exploit "knowledge" for the new era. Provides an outstanding computer environment. END_OF_TEXT
3
<H1>Finding a Word</H1><br> <p> Write a program which reads a word <var>W</var> and a text <var>T</var>, and prints the number of word <var>W</var> which appears in text <var>T</var> </p> <p> <var>T</var> consists of string <var>T<sub>i</sub></var> separated by space characters and newlines. Count the number of <va...
s697218269
p03136
Python
Accepted
273
26
8,896
# listを並び替えてif-elseで条件分岐 N = int(input()) L = list(map(int, input().split())) descending_L = sorted(L, reverse=True) # print(descending_L) other_side = sum(descending_L[1:]) if descending_L[0] < other_side: print('Yes') else: print('No')
4 3 8 5 1
Yes
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Determine if an <var>N</var>-sided polygon (not necessarily convex) with sides of length <var>L_1, L_2, ..., L_N</var> can be drawn in a two-dimensional plane.</p> <p>You can use the following theorem:<...
s678635123
p02321
Python
Accepted
1,174
20
5,628
import sys input = sys.stdin.buffer.readline sys.setrecursionlimit(10 ** 7) def branchAndBound(N, items, lim_w): items.sort(key=lambda x: x[0] / x[1], reverse=True) Value = [] Weight = [] Ratio = [] for v, w in items: Value.append(v) Weight.append(w) Ratio.append(v / w) def upperbound(cur, cur_w, cur_v):...
4 5 4 2 5 2 2 1 8 3
13
<H1>Huge Knapsack Problem</H1> <br/> <p> You have <var>N</var> items that you want to put them into a knapsack. Item <var>i</var> has value <var>v<sub>i</sub></var> and weight <var>w<sub>i</sub></var>. </p> <p> You want to find a subset of items to put such that: </p> <ul> <li>The total value of the items is as large...
s827019671
p02859
Python
Accepted
28
28
8,836
r = int(input()) print(r*r)
2
4
<span class="lang-en"> <p>Score : <var>100</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Given is an integer <var>r</var>.</p> <p>How many times is the area of a circle of radius <var>r</var> larger than the area of a circle of radius <var>1</var>?</p> <p>It can be proved that the answer is...
s171758791
p03369
Python
Accepted
39
20
8,704
s=input() print((s.count('o'))*100+700)
oxo
900
<span class="lang-en"> <p>Score : <var>100</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>In "Takahashi-ya", a ramen restaurant, a bowl of ramen costs <var>700</var> yen (the currency of Japan), plus <var>100</var> yen for each kind of topping (boiled egg, sliced pork, green onions).</p> <p>...
s006555876
p02399
Python
Accepted
208
20
5,624
#coding:utf-8 ''' a ÷ b : d (整数) a ÷ b の余り : r (整数) a ÷ b : f (浮動小数点数) ''' a, b = map(int, input().split()) d = a // b r = a % b f = a / b print('%d %d %.8f' % (d, r, f))
3 2
1 1 1.50000
<H1>A/B Problem</H1> <p> Write a program which reads two integers <var>a</var> and <var>b</var>, and calculates the following values: </p> <ul> <li><var>a</var> &divide; <var>b</var>: <var>d</var> (in integer)</li> <li>remainder of <var>a</var> &divide; <var>b</var>: <var>r</var> (in integer)</li> <li><var>a...
s996136946
p01859
Python
Accepted
1,204
20
5,608
li, ri = map(int, input().split()) ln, rn = map(int, input().split()) ISONO = True NAKAJIMA = False def search(li, ri, ln, rn, turn): if li == None and ri == None: return False if ln == None and rn == None: return True if turn == ISONO: ret = False if li and ln: ret = ret or search(li, ri,...
3 2 2 2
NAKAJIMA
<!--<script language="JavaScript" type="text/javascript" src="js/varmath.js" charset="UTF-8"></script>--> <h2>B: 中島、あれやろうぜ! - Match Peas War -</h2> <h3>問題</h3> <p>中島「うぅっ・・・」</p> <p>磯野「中島,大丈夫か?」</p> <p>中島「・・・なんだか嫌な夢を見ていた気がするよ」</p> <p>磯野「どんな夢だい?」</p> <p>中島「無限に遊ぶ夢」</p> <p>磯野「意味わからん.まぁいいや,中島,あれやろうぜ!」</p> <p>中島「あれ...
s209541683
p00081
Python
Accepted
299
10
4,232
import sys for s in sys.stdin: x1,y1,x2,y2,xq,yq = map(float,s.split(",")) dx,dy = x2-x1,y2-y1 det = dx*dx+dy*dy y0 = dx*(y1*dx-x1*dy) + dy*(yq*dy+xq*dx) x0 = -dy*(y1*dx-x1*dy) + dx*(yq*dy+xq*dx) x0 /= det y0 /= det xp = x0+(x0-xq) yp = y0+(y0-yq) print xp,yp
1.0,0.0,-1.0,0.0,1.0,1.0 1.0,0.0,0.0,-1.0,3.0,0.0 0.0,1.0,0.0,-1.0,1.0,1.0
1.000000 -1.000000 1.000000 2.000000 -1.000000 1.000000
<H1>線対称</H1> <p> 平面上の異なる 3 点 <var>P1(x1,y1)</var>, <var>P2(x2,y2)</var>, <var>Q(xq,yq)</var> の座標の組を読み込んで、点 <var>P1</var> 点<var>P2</var> を通る直線を対称軸として点 <var>Q</var> と線対称の位置にある点 <var>R(x,y)</var> を出力するプログラムを作成してください。なお、点 <var>Q</var> は、その対称軸上にないものとします。 </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/i...
s848963629
p02016
Python
Accepted
74
20
5,540
s = input() if s == "ani": print("square1001") else: print("e869120")
ani
square1001
<h2>B: 双子 (Twins)</h2> <p>とある双子は、自分たちのどちらが兄でどちらが弟かがあまり知られていないことに腹を立てた。</p> <p>"ani" と入力されたら "square1001"、"otouto" と入力されたら "e869120" と出力するプログラムを作りなさい。</p> <h3>入力</h3> <p>入力として "ani" または "otouto" という文字列のどちらかが与えられます。</p> <h3>出力</h3> <p>"e869120" または "square1001" を、問題文の通りに出力してください。最後の改行を忘れないようにしましょう。</p> <h3>入力例1</h3> ...
s731849660
p02022
Python
Accepted
116
100
18,516
n,m=map(int,input().split()) a=list(map(int,input().split())) b=list(map(int,input().split())) print(sum(a)*sum(b))
3 2 3 1 5 2 4
54
<h2>H: 慈悲 (Mercy)</h2> <p>サンタクロースは、クリスマスなのにプログラミングをやっている集団を見つけた。</p> <p>サンタクロースは彼らを可哀想に思ったので、ケーキをプレゼントすることにした。</p> <p>クリームが $N$ 種類あって、美味しさは $A_1, A_2, A_3, \dots, A_N$ である。</p> <p>スポンジが $M$ 種類あって、美味しさは $B_1, B_2, B_3, \dots, B_M$ である。</p> <p>クリーム 1 種類とスポンジ 1 種類を組み合わせてケーキを作り、その美味しさは (クリームの美味しさ) × (スポンジの美味しさ) になる。</p> <...
s386184267
p00595
Python
Accepted
208
20
4,200
def gcd(m,n): while m%n>0: m,n=n,m%n else: return n while True: try: m,n = map(int,raw_input().split()) print gcd(m,n) except EOFError: break
57 38 60 84
19 12
<H1><font color="#000000">Problem A:</font> Greatest Common Divisor</H1> <p> Please find the greatest common divisor of two natural numbers. A clue is: The Euclid's algorithm is a way to resolve this task. </p> <H2>Input</H2> <p> The input file consists of several lines with pairs of two natural numbers in each lin...
s607631239
p03332
Python
Accepted
429
94
85,200
n,a,b,k=map(int,input().split()) mod1,mod2=10**9+7,998244353 mod=mod2 fact=[1]*(n+1) inv=[1]*(n+1) for i in range(2,n+1): fact[i]=i*fact[i-1]%mod inv[-1]=pow(fact[-1],mod-2,mod) for i in range(n,1,-1): inv[i-1]=inv[i]*i%mod def comb(x,y):return fact[x]*inv[y]%mod*inv[x-y]%mod if x>=y>=0 else 0 ans=0 for i in ra...
4 1 2 5
40
<span class="lang-en"> <p>Score : <var>700</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Takahashi has a tower which is divided into <var>N</var> layers. Initially, all the layers are uncolored. Takahashi is going to paint some of the layers in red, green or blue to make a beautiful tower. ...
s858597585
p03834
Python
Accepted
49
21
9,028
haike = input().split(',') print(' '.join(haike))
happy,newyear,enjoy
happy newyear enjoy
<span class="lang-en"> <p>Score : <var>100</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>As a New Year's gift, Dolphin received a string <var>s</var> of length <var>19</var>.<br/> The string <var>s</var> has the following format: <code>[five lowercase English letters],[seven lowercase Engli...
s963330449
p02675
Python
Accepted
216
29
9,036
n = input() if n[-1] == "2" or n[-1] == "4" or n[-1] == "5" or n[-1] =="7" or n[-1] == "9": print("hon") elif n[-1] == "0" or n[-1] == "1" or n[-1] == "6" or n[-1] == "8": print("pon") else: print("bon")
16
pon
<span class="lang-en"> <p>Score: <var>100</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3> <p>The cat Snuke wants to play a popular Japanese game called ÅtCoder, so Iroha has decided to teach him Japanese.</p> <p>When counting pencils in Japanese, the counter word "本" follows the number. The pro...
s050443659
p00111
Python
Accepted
620
30
4,284
import sys def f1(s): return "".join([d0[c] for c in s]) d0={"M":"10010","N":"10011"} a="ABCD"; for i in range(4): d0[a[i]]=format(i,"02b") a="EFGHIJKL" for i in range(8): d0[a[i]]=format(i,"03b") L0="ABCDEFGHIJKLMNOPQRSTUVWXYZ" L1=" ',-.?"+L0 L2=L0+" .,-'?" dc={} a="J,EE,EH,MF,GF,EF,IJ,NG,BB,AB,K,BF,NH,GE,BD,NE,BC,...
?D-C'KOPUA
PETER POTTER
<H1>博士の暗号</H1> <p> 博 士 : ?D-C'KOPUA </p> <p> ピーター : どうしたんですか、デビッド博士? わけのわからないことを叫ぶのにはもう慣れましたが、 今日は文章にすらなっていませんよ。 </p> <p> 博 士 : ほれ。 </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_memorableCodes1"> </center> <br/> <p> ピーター : なんですか? この表は......ああ、予選の問題にこんなのがありました。表を使って文字を置き換え...
s642203400
p00064
Python
Accepted
71
30
6,548
import sys,re print(sum(map(int,re.findall(r"\d+",sys.stdin.read()))))
Thereare100yenonthetable.Iam17yearsold. Ishouldgohomeat6pm.
123
<H1>暗証番号</H1> <p> 新しい暗証番号は覚えにくいものです。メモするのはダメといわれましたが、覚えられそうにありません。そこで文章の中に数値を埋め込んで暗証番号をメモすることにしました。ここでは全ての数値の和が暗証番号になります。 </p> <p> メモされた文章を読み込んで、暗証番号を出力するプログラムを作成してください。 </p> <H2>Input</H2> <p> 正の整数が埋め込まれた文章が複数行にわたり与えられます。各行は半角英数字、記号、空白を含む文字列または空行です。 ただし、入力は 1 行あたり 80 文字以内で、暗証番号は 10,000 以下であることが保障されています。 </p> <...
s049922902
p02663
Python
Accepted
89
71
61,448
H1, M1, H2, M2, K = map(int, input().split()) T = (H2 - H1) * 60 + (M2 - M1) print(T - K)
10 0 15 0 30
270
<span class="lang-en"> <p>Score : <var>100</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>In this problem, we use the <var>24</var>-hour clock.</p> <p>Takahashi gets up exactly at the time <var>H_1</var> : <var>M_1</var> and goes to bed exactly at the time <var>H_2</var> : <var>M_2</var>. (S...
s095304763
p02542
Python
Accepted
8,952
51
13,828
code = r''' # distutils: language=c++ # distutils: include_dirs=[/home/contestant/.local/lib/python3.8/site-packages/numpy/core/include,/opt/atcoder-stl] # cython: boundscheck=False # cython: wraparound=False from libcpp cimport bool from libcpp.string cimport string from libcpp.vector cimport vector from libcpp.pair c...
3 3 o.. ... o.#
4
<span class="lang-en"> <p>Score : <var>600</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>There is a board with <var>N</var> rows and <var>M</var> columns. The information of this board is represented by <var>N</var> strings <var>S_1,S_2,\ldots,S_N</var>. Specifically, the state of the squar...
s096910698
p02052
Python
Accepted
401
20
5,608
H,W=map(int,input().split()) MAP=[list(input()) for i in range(H)] BLIST=[] for i in range(H): for j in range(W): if MAP[i][j]=="B": BLIST.append([i,j]) BLIST.sort(key=lambda x:x[0]+x[1]) ANS=abs(BLIST[0][0]-BLIST[-1][0])+abs(BLIST[0][1]-BLIST[-1][1]) BLIST.sort(key=lambda x:x[0]-x[1]) ANS=m...
3 3 B.B ..B .BB
4
<h2>A: Hokkaido University Easy</h2> <h3>注意</h3> <p> 問題設定は B 問題と同一のものですが、制約のみが異なりますのでご注意ください。</p> <h3>物語</h3> <p> 北海道大学に合格し、新たな生活の始まりに心を躍らせるほむらちゃん。しかし彼女の前には、とてつもなく広いキャンパスが待ち受けていた...。</p> <p> 「え...次の授業に間に合わないんだけど...」</p> <h3>問題</h3> <p> 北海道大学札幌キャンパスは異常に広いことで有名です。札幌キャンパスは縦に <var>H</var> マス、横に <var>W</var> マス並んだ長方形のマス...
s673025921
p00333
Python
Accepted
98
20
5,660
import math W,H,C=map(int,input().split()) sikaku=math.gcd(W,H) print(C*(W*H)//(sikaku*sikaku))
10 20 5
10
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>ニュータウン</H1> <p> 会津県では人口増加のためにニュータウンを作ること...
s541529419
p00466
Python
Accepted
169
30
6,720
while(1): N=int(input()) if(N==0): exit() l=[] for i in range(9): tmp=int(input()) l.append(tmp) ans=0 for i in range(9): ans+=l[i] a=N-ans print(a)
9850 1050 800 420 380 600 820 2400 1800 980 0
600
<H1>レシート </H1> <h2>問題</h2> <p> 太郎君は10冊の本を購入した. 後日, レシートをもとに価格を調べようとしたが, レシートには汚れがあり, ある本の価格が読み取れなかった. その本の価格を, 10冊の総額と他の9冊の価格から計算することにした. </p> <p> 価格が読み取れなかった本の価格を出力するプログラムを書け. なお,本の価格はすべて正の整数である. また,消費税を考慮する必要はない. </p> <h2> 入力</h2> <p> 入力は複数のデータセットからなる.各データセットは以下の形式で与えられる. </p> <p> 各データセットは10行からなり,1行に1つずつ正の整数...
s237164062
p03252
Python
Accepted
250
49
9,708
import collections A = input() B = input() A_c = collections.Counter(A) B_c = collections.Counter(B) A_c = A_c.values() B_c = B_c.values() A_c = list(A_c) B_c = list(B_c) A_c.sort() B_c.sort() if A_c == B_c: print("Yes") else: print("No")
azzel apple
Yes
<span class="lang-en"> <p>Score : <var>300</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>You are given strings <var>S</var> and <var>T</var> consisting of lowercase English letters.</p> <p>You can perform the following operation on <var>S</var> any number of times:</p> <p>Operation: Choose ...
s150531799
p03085
Python
Accepted
100
30
8,836
moji = str(input()) correct = ["A","C","G","T"] ind = correct.index(moji) + 1 print(correct[ind*-1])
A
T
<span class="lang-en"> <p>Score : <var>100</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>On the Planet AtCoder, there are four types of bases: <code>A</code>, <code>C</code>, <code>G</code> and <code>T</code>. <code>A</code> bonds with <code>T</code>, and <code>C</code> bonds with <code>G</...
s110833628
p03575
Python
Accepted
801
28
9,196
# Union Find # xの根を求める def find(x): if par[x] < 0: return x else: par[x] = find(par[x]) return par[x] # xとyの属する集合の併合 def unite(x, y): x = find(x) y = find(y) if x == y: return False else: # x < y にする if par[x] > par[y]: x, y = y, x ...
7 7 1 3 2 7 3 4 4 5 4 6 5 6 6 7
4
<span class="lang-en"> <p>Score : <var>300</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>You are given an undirected connected graph with <var>N</var> vertices and <var>M</var> edges that does not contain self-loops and double edges.<br/> The <var>i</var>-th edge <var>(1 \leq i \leq M)</var...
s361106056
p02700
Python
Accepted
1,594
27
9,208
''' 問題: 高橋君と青木君がモンスターを闘わせます。 高橋君のモンスターは体力が A で攻撃力が B です。 青木君のモンスターは体力が C で攻撃力が D です。 高橋君→青木君→高橋君→青木君→... の順に攻撃を行います。 攻撃とは、相手のモンスターの体力の値を自分のモンスターの攻撃力のぶんだけ減らすことをいいます。 このことをどちらかのモンスターの体力が 0 以下になるまで続けたとき、 先に自分のモンスターの体力が 0 以下になった方の負け、そうでない方の勝ちです。 高橋君が勝つなら Yes、負けるなら No を出力してください。 ''' ''' 制...
10 9 10 10
No
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Takahashi and Aoki will have a battle using their monsters.</p> <p>The health and strength of Takahashi's monster are <var>A</var> and <var>B</var>, respectively, and those of Aoki's monster are <var>C<...
s676588810
p02383
Python
Accepted
1,197
20
5,608
class Dice: def __init__(self): # 初期値がない場合 self.t = 1 self.s = 2 self.e = 4 self.w = 8 self.n = 16 self.b = 32 def __init__(self, t, s, e, w, n, b): # 初期値が指定される場合 self.t = t self.s = s self.e = e self.w = w ...
1 2 4 8 16 32 SE
8
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <h1>Dice I</h1><br> <p> Wri...
s106297760
p02924
Python
Accepted
766
68
65,624
import math from math import gcd,pi,sqrt INF = float("inf") MOD = 10**9 + 7 import sys sys.setrecursionlimit(10**6) import itertools import bisect from collections import Counter,deque def i_input(): return int(input()) def i_map(): return map(int, input().split()) def i_list(): return list(i_map()) def i_row(N): retu...
2
1
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>For an integer <var>N</var>, we will choose a permutation <var>\{P_1, P_2, ..., P_N\}</var> of <var>\{1, 2, ..., N\}</var>.</p> <p>Then, for each <var>i=1,2,...,N</var>, let <var>M_i</var> be the remain...
s003961310
p03039
Python
Accepted
1,389
77
81,804
# N, M から相異なる二点を取った時のマンハッタン距離の、二点の取り方についての総和を、 # _{N + M - 2} C _{K - 2} 倍したものが答え。 N, M, K = map(int, input().split()) # コンビネーション前計算。 MOD = 10 ** 9 + 7 table_len = 2 * 10 ** 5 + 10 fac = [1, 1] for i in range(2, table_len): fac.append(fac[-1] * i % MOD) finv = [0] * table_len finv[-1] = pow(fac[-1], MOD - 2, M...
2 2 2
8
<span class="lang-en"> <p>Score : <var>500</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>We have a grid of squares with <var>N</var> rows and <var>M</var> columns. Let <var>(i, j)</var> denote the square at the <var>i</var>-th row from the top and <var>j</var>-th column from the left. We wi...
s868966337
p02786
Python
Accepted
209
24
9,032
H = int(input()) attackcnt = 0 monstercnt = 1 def monster(h, m, a): if h == 1: return 0,0,a+m else: return monster(int((h/2)),2*m,a+m) a, b, c = monster(H,monstercnt,attackcnt) print(c)
2
3
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Caracal is fighting with a monster.</p> <p>The <em>health</em> of the monster is <var>H</var>.</p> <p>Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's ...
End of preview. Expand in Data Studio
README.md exists but content is empty.
Downloads last month
9