wrong_submission_id stringlengths 10 10 | problem_id stringlengths 6 6 | user_id stringlengths 10 10 | time_limit float64 1k 8k | memory_limit float64 131k 1.05M | wrong_status stringclasses 2
values | wrong_cpu_time float64 10 40k | wrong_memory float64 2.94k 3.37M | wrong_code_size int64 1 15.5k | problem_description stringlengths 1 4.75k | wrong_code stringlengths 1 6.92k | acc_submission_id stringlengths 10 10 | acc_status stringclasses 1
value | acc_cpu_time float64 10 27.8k | acc_memory float64 2.94k 960k | acc_code_size int64 19 14.9k | acc_code stringlengths 19 14.9k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s132667621 | p02613 | u367323774 | 2,000 | 1,048,576 | Wrong Answer | 143 | 9,108 | 264 | Takahashi is participating in a programming contest called AXC002, and he has just submitted his code to Problem A. The problem has N test cases. For each test case i (1\leq i \leq N), you are given a string S_i representing the verdict for that test case. Find the numbers of test cases for which the verdict is `AC`,... | n=int(input())
ac=0
tle=0
wa=0
re=0
for i in range(n):
a=input()
if a=='AC':
ac=ac+1
elif a=='TLE':
tle=tle+1
elif a=='WA':
w=wa+1
else:
re=re+1
print('AC x '+str(ac))
print('WA x '+str(wa))
print('TLE x '+str(tle))
print('RE x '+str(re)) | s276009347 | Accepted | 145 | 9,072 | 265 | n=int(input())
ac=0
tle=0
wa=0
re=0
for i in range(n):
a=input()
if a=='AC':
ac=ac+1
elif a=='TLE':
tle=tle+1
elif a=='WA':
wa=wa+1
else:
re=re+1
print('AC x '+str(ac))
print('WA x '+str(wa))
print('TLE x '+str(tle))
print('RE x '+str(re)) |
s980364004 | p03836 | u243699903 | 2,000 | 262,144 | Wrong Answer | 34 | 4,468 | 514 | Dolphin resides in two-dimensional Cartesian plane, with the positive x-axis pointing right and the positive y-axis pointing up. Currently, he is located at the point (sx,sy). In each second, he can move up, down, left or right by a distance of 1. Here, both the x\- and y-coordinates before and after each movement ... | sx,sy,tx,ty=map(int,input().split())
for _ in range(ty-sy):
print("U",end='')
for _ in range(tx-sx):
print("R",end='')
for _ in range(ty-sy):
print("D",end='')
for _ in range(tx-sx+1):
print("L",end='')
print("L",end='')
for _ in range(ty-sy+1):
print("U",end='')
for _ in range(tx-sx+1):
pri... | s337610386 | Accepted | 33 | 4,468 | 512 | sx,sy,tx,ty=map(int,input().split())
for _ in range(ty-sy):
print("U",end='')
for _ in range(tx-sx):
print("R",end='')
for _ in range(ty-sy):
print("D",end='')
for _ in range(tx-sx):
print("L",end='')
print("L",end='')
for _ in range(ty-sy+1):
print("U",end='')
for _ in range(tx-sx+1):
print... |
s041085542 | p03160 | u245299842 | 2,000 | 1,048,576 | Wrong Answer | 237 | 17,344 | 407 | There are N stones, numbered 1, 2, \ldots, N. For each i (1 \leq i \leq N), the height of Stone i is h_i. There is a frog who is initially on Stone 1. He will repeat the following action some number of times to reach Stone N: * If the frog is currently on Stone i, jump to Stone i + 1 or Stone i + 2. Here, a cost of... |
dp = []
for i in range(100001):
dp.append(float('inf'))
N = int(input())
h = list(map(int, input().split()))
dp[0] = 0
dp[1] = abs(h[1] - h[0])
for i in range(N - 2):
dp[i + 2] = min(dp[i + 1] + abs(h[i + 2] - h[i + 1]), dp[i] + abs(h[i + 2] - h[i]))
for i in range(N):
print(dp[i]) | s101753028 | Accepted | 167 | 17,464 | 387 |
dp = []
for i in range(100001):
dp.append(float('inf'))
N = int(input())
h = list(map(int, input().split()))
dp[0] = 0
dp[1] = abs(h[1] - h[0])
for i in range(N - 2):
dp[i + 2] = min(dp[i + 1] + abs(h[i + 2] - h[i + 1]), dp[i] + abs(h[i + 2] - h[i]))
print(dp[N-1])
|
s718184704 | p02467 | u908651435 | 1,000 | 131,072 | Wrong Answer | 20 | 5,600 | 109 | Factorize a given integer n. | n=int(input())
p=n
x=[]
for i in range(2,p):
if n%i==0:
n=n/i
x.append(i)
print(p,':',x)
| s890793831 | Accepted | 20 | 5,660 | 245 | import math
n = int(input())
nc = n
result = []
i = 2
while i <= math.sqrt(n):
if n%i == 0:
n //= i
result.append(str(i))
else:
i += 1
if n != 1:
result.append(str(n))
print(str(nc) + ": " + " ".join(result))
|
s263625326 | p02936 | u453306058 | 2,000 | 1,048,576 | Wrong Answer | 2,106 | 41,908 | 452 | Given is a rooted tree with N vertices numbered 1 to N. The root is Vertex 1, and the i-th edge (1 \leq i \leq N - 1) connects Vertex a_i and b_i. Each of the vertices has a counter installed. Initially, the counters on all the vertices have the value 0. Now, the following Q operations will be performed: * Operati... | import queue
n,q = map(int,input().split())
graph = [[] for _ in range(n)]
for i in range(n-1):
a,b = map(int,input().split())
graph[a-1].append(b-1)
v = [0 for _ in range(n)]
qs = queue.Queue()
for i in range(q):
p,x = map(int,input().split())
qs.put(p-1)
while not qs.empty():
now = qs.g... | s580241894 | Accepted | 1,836 | 55,728 | 507 | n,q = map(int,input().split())
graph = [[] for _ in range(n)]
point = [0]*n
for i in range(n-1):
a,b = map(int,input().split())
graph[a-1].append(b-1)
graph[b-1].append(a-1)
for _ in range(q):
a,b = map(int,input().split())
a = a -1
point[a]+=b
stack = []
stack.append(0)
visited = [False]*... |
s562502717 | p02694 | u509739538 | 2,000 | 1,048,576 | Wrong Answer | 23 | 9,120 | 244 | Takahashi has a deposit of 100 yen (the currency of Japan) in AtCoder Bank. The bank pays an annual interest rate of 1 % compounded annually. (A fraction of less than one yen is discarded.) Assuming that nothing other than the interest affects Takahashi's balance, in how many years does the balance reach X yen or abo... | import math
def readInt():
return int(input())
def readInts():
return list(map(int, input().split()))
def readChars():
return input().split()
x = readInt()
m = 100
n = 0
while 1:
if m>x:
print(n)
break
n+=1
m=math.floor(m*1.01) | s808844432 | Accepted | 22 | 9,184 | 248 | import math
def readInt():
return int(input())
def readInts():
return list(map(int, input().split()))
def readChars():
return input().split()
x = readInt()
m = 100
n = 0
while 1:
if m>=x:
print(n)
break
n+=1
m=math.floor(m*1.01) |
s903478037 | p02565 | u102461423 | 5,000 | 1,048,576 | Wrong Answer | 543 | 107,712 | 2,819 | Consider placing N flags on a line. Flags are numbered through 1 to N. Flag i can be placed on the coordinate X_i or Y_i. For any two different flags, the distance between them should be at least D. Decide whether it is possible to place all N flags. If it is possible, print such a configulation. | import sys
import numpy as np
import numba
from numba import njit, b1, i4, i8, f8
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
@njit((i8, i8[:, :], i8[:], i8[:], i8[:], i8[:], i8[:], i8, i8, i8, i8),
cache=True)
def scc_dfs(N, G, idx, low, ord, ids, vi... | s055516366 | Accepted | 534 | 108,080 | 2,850 | import sys
import numpy as np
import numba
from numba import njit, b1, i4, i8, f8
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
@njit((i8, i8[:, :], i8[:], i8[:], i8[:], i8[:], i8[:], i8, i8, i8, i8),
cache=True)
def scc_dfs(N, G, idx, low, ord, ids, vi... |
s423409586 | p03852 | u025504404 | 2,000 | 262,144 | Wrong Answer | 22 | 3,064 | 346 | Given a lowercase English letter c, determine whether it is a vowel. Here, there are five vowels in the English alphabet: `a`, `e`, `i`, `o` and `u`. | s = input()
if len(s) < 5:
print('NO')
else:
flag = True
i = 0
j = 5
while(flag):
if (j <= len(s)) and (s[i:j] in ['dream', 'erase']):
i = j
j += 5
elif (len(s) > 5) and (j <= len(s)) and (s[i:(j+1)] in ['dreamer','eraser']):
i = j
j += 5
else:
print('NO')
flag = False
if flag:
print('... | s762306153 | Accepted | 22 | 3,064 | 85 | c = input()
if c in ['a','e','i','o','u']:
print('vowel')
else:
print('consonant') |
s375619823 | p03730 | u353652911 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 228 | We ask you to select some number of positive integers, and calculate the sum of them. It is allowed to select as many integers as you like, and as large integers as you wish. You have to follow these, however: each selected integer needs to be a multiple of A, and you need to select at least one integer. Your objecti... | a,b,c=map(int,input().split())
d=a
jol=[]
while True:
if d%b==c:
print("Yes")
exit()
elif d%b not in jol:
jol.append(a%b)
else:
print("No")
exit()
d+=a | s265408611 | Accepted | 17 | 2,940 | 228 | a,b,c=map(int,input().split())
d=a
jol=[]
while True:
if d%b==c:
print("YES")
exit()
elif d%b not in jol:
jol.append(a%b)
else:
print("NO")
exit()
d+=a |
s730519471 | p03636 | u246809151 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 59 | The word `internationalization` is sometimes abbreviated to `i18n`. This comes from the fact that there are 18 letters between the first `i` and the last `n`. You are given a string s of length at least 3 consisting of lowercase English letters. Abbreviate s in the same way. | s = input()
num = int(len(s)-2)
print(s[1]+str(num)+s[-1]) | s666932524 | Accepted | 17 | 3,064 | 48 | S = input()
print(S[0]+str(len(S[0:-2]))+S[-1])
|
s928639467 | p03407 | u286955577 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 106 | An elementary school student Takahashi has come to a variety store. He has two coins, A-yen and B-yen coins (yen is the currency of Japan), and wants to buy a toy that costs C yen. Can he buy it? Note that he lives in Takahashi Kingdom, and may have coins that do not exist in Japan. | def solve():
A, B, C = map(int, input().split())
return 'Yes' if A + B <= C else 'No'
print(solve())
| s841011608 | Accepted | 17 | 2,940 | 95 | print('Yes' if (lambda l: l[0] + l[1] - l[2])(list(map(int, input().split()))) >= 0 else 'No')
|
s088034226 | p02262 | u300645821 | 6,000 | 131,072 | Wrong Answer | 40 | 6,800 | 586 | Shell Sort is a generalization of [Insertion Sort](http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_1_A) to arrange a list of $n$ elements $A$. 1 insertionSort(A, n, g) 2 for i = g to n-1 3 v = A[i] 4 j = i - g 5 while j >= 0 && A[j] > v 6 A[j+... | #!/usr/bin/ruby
from __future__ import print_function
import sys
if sys.version_info[0]>=3: raw_input=input
def insertionSort(a, n, g):
global cnt
for i in range(g,n):
v = a[i]
j = i - g
while j >= 0 and a[j] > v:
a[j+g] = a[j]
j = j - g
cnt+=1
a[j+g] = v
def shellSort(a, n):
global cnt
cnt = 0
... | s118486216 | Accepted | 27,750 | 47,252 | 550 | #!/usr/bin/python
import sys
if sys.version_info[0]>=3: raw_input=input
def insertionSort(a,g):
global cnt
for i in range(g,len(a)):
v = a[i]
j = i - g
while j >= 0 and a[j] > v:
a[j+g] = a[j]
j = j - g
cnt+=1
a[j+g] = v
def shellSort(a):
global cnt
cnt = 0
g = []
h = 1
while h <= len(a):
g... |
s455125941 | p03845 | u340781749 | 2,000 | 262,144 | Wrong Answer | 23 | 3,064 | 163 | Joisino is about to compete in the final round of a certain programming competition. In this contest, there are N problems, numbered 1 through N. Joisino knows that it takes her T_i seconds to solve problem i(1≦i≦N). Also, there are M kinds of drinks offered to the contestants, numbered 1 through M. If Joisino takes d... | input()
ts = list(map(int, input().split()))
t_sum = sum(ts)
m = int(input())
for _ in range(m):
p, x = map(int, input().split())
print(t_sum - ts[p] + x)
| s204178675 | Accepted | 24 | 3,064 | 167 | input()
ts = list(map(int, input().split()))
t_sum = sum(ts)
m = int(input())
for _ in range(m):
p, x = map(int, input().split())
print(t_sum - ts[p - 1] + x)
|
s070021077 | p03448 | u626881915 | 2,000 | 262,144 | Wrong Answer | 57 | 9,100 | 216 | You have A 500-yen coins, B 100-yen coins and C 50-yen coins (yen is the currency of Japan). In how many ways can we select some of these coins so that they are X yen in total? Coins of the same kind cannot be distinguished. Two ways to select coins are distinguished when, for some kind of coin, the numbers of that co... | a = int(input())
b = int(input())
c = int(input())
x = int(input())
count = 0
for i in range(a+1):
for j in range(b+1):
for k in range(c+1):
if 500*a + 100*b + 50*c == x:
count += 1
print(count) | s363153169 | Accepted | 55 | 9,056 | 217 | a = int(input())
b = int(input())
c = int(input())
x = int(input())
count = 0
for i in range(a+1):
for j in range(b+1):
for k in range(c+1):
if 500*i + 100*j + 50*k == x:
count += 1
print(count)
|
s489038267 | p02865 | u127499732 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 47 | How many ways are there to choose two distinct positive integers totaling N, disregarding the order? | n=int(input())
print(n/2-1 if n%2==0 else n//2) | s314673029 | Accepted | 17 | 2,940 | 60 | n=int(input())
print(int(n/2)-1 if n%2==0 else int((n-1)/2)) |
s930402948 | p03469 | u689835643 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 39 | On some day in January 2018, Takaki is writing a document. The document has a column where the current date is written in `yyyy/mm/dd` format. For example, January 23, 2018 should be written as `2018/01/23`. After finishing the document, she noticed that she had mistakenly wrote `2017` at the beginning of the date col... | x = list(input())
x[3] = "8"
print(x)
| s232389852 | Accepted | 17 | 2,940 | 48 | x = list(input())
x[3] = "8"
print("".join(x))
|
s468845137 | p02559 | u102461423 | 5,000 | 1,048,576 | Wrong Answer | 5,517 | 193,904 | 1,363 | You are given an array a_0, a_1, ..., a_{N-1} of length N. Process Q queries of the following types. * `0 p x`: a_p \gets a_p + x * `1 l r`: Print \sum_{i = l}^{r - 1}{a_i}. | import sys
import numpy as np
import numba
from numba import njit, b1, i4, i8, f8
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
@njit((i8[:], ), cache=True)
def build(raw_data):
bit = raw_data.copy()
for i in range(len(bit)):
j = i + (i & (-i)... | s670706060 | Accepted | 1,025 | 193,128 | 1,369 | import sys
import numpy as np
import numba
from numba import njit, b1, i4, i8, f8
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
@njit((i8[:], ), cache=True)
def build(raw_data):
bit = raw_data.copy()
for i in range(len(bit)):
j = i + (i & (-i)... |
s292417663 | p02678 | u785213188 | 2,000 | 1,048,576 | Wrong Answer | 2,270 | 2,384,312 | 649 | There is a cave. The cave has N rooms and M passages. The rooms are numbered 1 to N, and the passages are numbered 1 to M. Passage i connects Room A_i and Room B_i bidirectionally. One can travel between any two rooms by traversing passages. Room 1 is a special room with an entrance from the outside. It is dark in th... | from collections import deque, defaultdict
N, M = map(int, input().split())
D = [[float("inf")]*N for _ in range(N)]
for i in range(N):
D[i][i] = 0
for i in range(M):
s, t = map(int, input().split())
s -= 1
t -= 1
D[s][t] = 1
D[t][s] = 1
q = deque()
q.append(0)
d = defaultdict(lambda : int(-1))... | s612674902 | Accepted | 806 | 47,488 | 497 | from collections import deque, defaultdict
N, M = map(int, input().split())
D = defaultdict(list)
for i in range(M):
s, t = map(int, input().split())
D[s].append(t)
D[t].append(s)
q = deque()
q.append(1)
d = defaultdict(lambda : float("inf"))
d[1] = 0
while q:
u = q.popleft()
for v in D[u]:
... |
s096977128 | p03227 | u735763891 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 174 | You are given a string S of length 2 or 3 consisting of lowercase English letters. If the length of the string is 2, print it as is; if the length is 3, print the string after reversing it. | def tpbc_2018_a():
import sys
input = sys.stdin.readline
s = input()
if len(s) == 2:
return s
else:
return s[::-1]
print(tpbc_2018_a()) | s559586034 | Accepted | 17 | 2,940 | 127 | def tpbc_2018_a():
s = input()
if len(s) == 2:
return s
else:
return s[::-1]
print(tpbc_2018_a()) |
s357373022 | p03623 | u766566560 | 2,000 | 262,144 | Wrong Answer | 19 | 2,940 | 107 | Snuke lives at position x on a number line. On this line, there are two stores A and B, respectively at position a and b, that offer food for delivery. Snuke decided to get food delivery from the closer of stores A and B. Find out which store is closer to Snuke's residence. Here, the distance between two points s and... | x, a, b = map(int, input().split())
A = abs(a - x)
B = abs(b - x)
if A > B:
print('A')
else:
print('B') | s794807551 | Accepted | 17 | 3,064 | 107 | x, a, b = map(int, input().split())
A = abs(a - x)
B = abs(b - x)
if A > B:
print('B')
else:
print('A') |
s469837509 | p03730 | u059828923 | 2,000 | 262,144 | Wrong Answer | 27 | 9,120 | 228 | We ask you to select some number of positive integers, and calculate the sum of them. It is allowed to select as many integers as you like, and as large integers as you wish. You have to follow these, however: each selected integer needs to be a multiple of A, and you need to select at least one integer. Your objecti... | a, b, c = map(int, input().split())
l = []
for i in range(b + 1):
if i == 0:
pass
else:
l.append((i * a) % b)
if c in l == True:
print("Yes")
else:
print("No") | s043959275 | Accepted | 27 | 9,052 | 250 | a, b, c = map(int, input().split())
count = 0
for i in range(b + 1):
if ((i * a) % b) == c:
print("YES")
count += 1
break
else:
pass
if count == 0:
print("NO")
else:
pass
|
s470500184 | p02615 | u667084803 | 2,000 | 1,048,576 | Wrong Answer | 134 | 31,488 | 135 | Quickly after finishing the tutorial of the online game _ATChat_ , you have decided to visit a particular place with N-1 players who happen to be there. These N players, including you, are numbered 1 through N, and the **friendliness** of Player i is A_i. The N players will arrive at the place one by one in some order... | N = int(input())
A = list(map(int, input().split()))
A.sort(reverse=True)
ans = 0
for i in range(N):
ans += A[(i+1)//2]
print(ans) | s758094677 | Accepted | 145 | 31,444 | 137 | N = int(input())
A = list(map(int, input().split()))
A.sort(reverse=True)
ans = 0
for i in range(N-1):
ans += A[(i+1)//2]
print(ans) |
s920727645 | p03814 | u316603606 | 2,000 | 262,144 | Wrong Answer | 86 | 9,260 | 201 | Snuke has decided to construct a string that starts with `A` and ends with `Z`, by taking out a substring of a string s (that is, a consecutive part of s). Find the greatest length of the string Snuke can construct. Here, the test set guarantees that there always exists a substring of s that starts with `A` and ends w... | s = input ()
n = len (s)
print (n)
for i in range (n):
if s[i] == 'A':
x = i
break
for i in range (n):
print (s[-1-i])
if s[-1-i] == 'Z':
y = n-i-1
break
print (x,y)
print (y-x+1) | s016876392 | Accepted | 48 | 9,152 | 161 | s = input ()
n = len (s)
for i in range (n):
if s[i] == 'A':
x = i
break
for i in range (n):
if s[-1-i] == 'Z':
y = n-i-1
break
print (y-x+1) |
s353192956 | p03852 | u063073794 | 2,000 | 262,144 | Wrong Answer | 16 | 2,940 | 92 | Given a lowercase English letter c, determine whether it is a vowel. Here, there are five vowels in the English alphabet: `a`, `e`, `i`, `o` and `u`. | s=input()
l=["a","i","u","e","o"]
if s is not l:
print("consonant")
else:
print("vowel") | s465967111 | Accepted | 17 | 2,940 | 88 | s=input()
l=["a","i","u","e","o"]
if s in l:
print("vowel")
else:
print("consonant") |
s397841460 | p02396 | u480053997 | 1,000 | 131,072 | Wrong Answer | 140 | 7,656 | 118 | In the online judge system, a judge file may include multiple datasets to check whether the submitted program outputs a correct answer for each test case. This task is to practice solving a problem with multiple datasets. Write a program which reads an integer x and print it as is. Note that multiple datasets are give... | for i in range(1,10001):
x = int(input())
if x == 0:
break
print('case ' + str(i) + ': ' + str(x)) | s506342590 | Accepted | 70 | 7,432 | 127 | import sys
for i, x in enumerate(sys.stdin):
x = x.strip()
if x == '0':
break
print('Case %d: %s'%(i+1, x)) |
s812753301 | p03623 | u821251381 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 61 | Snuke lives at position x on a number line. On this line, there are two stores A and B, respectively at position a and b, that offer food for delivery. Snuke decided to get food delivery from the closer of stores A and B. Find out which store is closer to Snuke's residence. Here, the distance between two points s and... | x,a,b= map(int,input().split())
print(min(abs(x-a),abs(x-b))) | s545474163 | Accepted | 17 | 2,940 | 74 | x,a,b= map(int,input().split())
print("A" if abs(x-a) < abs(x-b) else "B") |
s091992919 | p02381 | u510829608 | 1,000 | 131,072 | Wrong Answer | 20 | 7,624 | 339 | You have final scores of an examination for n students. Calculate standard deviation of the scores s1, s2 ... sn. The variance α2 is defined by α2 = (∑n _i_ =1(s _i_ \- m)2)/n where m is an average of si. The standard deviation of the scores is the square root of their variance. | import math
li = []
n_var = 0.0
while True:
temp = list(map(int, input().split()))
if len(temp) == 1 and temp[0] == 0:
break
if len(temp) > 1:
li.extend(temp)
ave = sum(li) / len(li)
for i in range(len(li)):
n_var += ( li[i] - ave )**2
var = n_var / len(li)
print('{0:.8f}'.format(math.sqrt(var)))
print('... | s127285923 | Accepted | 30 | 7,732 | 259 | import math
while True:
cnt = int(input())
if cnt == 0:
break
li = list(map(int, input().split()))
ave = sum(li) / cnt
n_var = 0.0
for i in range(cnt):
n_var += ( li[i] - ave )**2
var = n_var / cnt
print('{0:.8f}'.format(math.sqrt(var))) |
s701255972 | p04043 | u170410075 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 145 | Iroha loves _Haiku_. Haiku is a short form of Japanese poetry. A Haiku consists of three phrases with 5, 7 and 5 syllables, in this order. To create a Haiku, Iroha has come up with three different phrases. These phrases have A, B and C syllables, respectively. Determine whether she can construct a Haiku by using each ... | A,B,C = map(int,input().split())
if A==1 or B==1 or C==1:
print('NO')
MLT = A*B*C
if MLT == 125:
print('YES')
else:
print('NO')
| s559144421 | Accepted | 17 | 2,940 | 145 | A,B,C = map(int,input().split())
if A==1 or B==1 or C==1:
print('NO')
MLT = A*B*C
if MLT == 175:
print('YES')
else:
print('NO')
|
s450601849 | p03998 | u023229441 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 292 | Alice, Bob and Charlie are playing _Card Game for Three_ , as below: * At first, each of the three players has a deck consisting of some number of cards. Each card has a letter `a`, `b` or `c` written on it. The orders of the cards in the decks cannot be rearranged. * The players take turns. Alice goes first. * ... | A=list(input())
B=list(input())
C=list(input())
s=A[0]
while len(A)!=0 and len(B)!=0 and len(C)!=0:
if s=="a":
s=A[0]
del A[0]
if s=="b":
s=B[0]
del B[0]
if s=="c":
s=C[0]
del C[0]
if len(A)==0:
print("A")
if len(B)==0:
print("B")
if len(C)==0:
print("C") | s633532137 | Accepted | 18 | 3,064 | 304 | A=list(input())+["d"]
B=list(input())+["d"]
C=list(input())+["d"]
s=A[0]
while s!="d":
if s=="a":
s=A[0]
del A[0]
elif s=="b":
s=B[0]
del B[0]
elif s=="c":
s=C[0]
del C[0]
if len(A)==0:
print("A")
if len(B)==0:
print("B")
if len(C)==0:
print("C") |
s878971066 | p03720 | u799479335 | 2,000 | 262,144 | Wrong Answer | 152 | 12,396 | 201 | There are N cities and M roads. The i-th road (1≤i≤M) connects two cities a_i and b_i (1≤a_i,b_i≤N) bidirectionally. There may be more than one road that connects the same pair of two cities. For each city, how many roads are connected to the city? | import numpy as np
N,M = map(int, input().split())
a = np.zeros(M)
b = np.zeros(M)
for i in range(M):
a[i],b[i] = map(int, input().split())
for i in range(N):
print((a==i).sum() + (b==i).sum()) | s163977926 | Accepted | 342 | 21,916 | 206 | import numpy as np
N,M = map(int, input().split())
a = np.zeros(M)
b = np.zeros(M)
for i in range(M):
a[i],b[i] = map(int, input().split())
for i in range(1,N+1):
print((a==i).sum() + (b==i).sum())
|
s286352168 | p03573 | u636775911 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 155 | You are given three integers, A, B and C. Among them, two are the same, but the remaining one is different from the rest. For example, when A=5,B=7,C=5, A and C are the same, but B is different. Find the one that is different from the rest among the given three integers. | #coding:utf-8
n=[int(i) for i in input().split()]
if(n.count(n[0]==1)):
print(n[0])
else:
if(n.count(n[1]==1)):
print(n[1])
else:
print(n[2]) | s603622707 | Accepted | 17 | 3,060 | 143 | #coding:utf-8
n=[int(i) for i in input().split()]
if(n.count(n[0])==1):
print(n[0])
elif(n.count(n[1])==1):
print(n[1])
else:
print(n[2]) |
s667125365 | p03449 | u500207661 | 2,000 | 262,144 | Wrong Answer | 19 | 3,064 | 341 | We have a 2 \times N grid. We will denote the square at the i-th row and j-th column (1 \leq i \leq 2, 1 \leq j \leq N) as (i, j). You are initially in the top-left square, (1, 1). You will travel to the bottom-right square, (2, N), by repeatedly moving right or down. The square (i, j) contains A_{i, j} candies. You ... | n = int(input().strip())
a = [ list(map(int, input().strip().split())) for i in range(2) ]
maximum = 0
mov = 0
for i in range(n):
ans = 0
for i in range(mov+1):
ans += a[0][i]
for i in range(n-mov):
ans += a[1][i+mov]
print(ans)
mov += 1
if maximum < ans:
maximum ... | s030674865 | Accepted | 19 | 3,064 | 326 | n = int(input().strip())
a = [ list(map(int, input().strip().split())) for i in range(2) ]
maximum = 0
mov = 0
for i in range(n):
ans = 0
for i in range(mov+1):
ans += a[0][i]
for i in range(n-mov):
ans += a[1][i+mov]
mov += 1
if maximum < ans:
maximum = ans
print(ma... |
s901814452 | p03416 | u308684517 | 2,000 | 262,144 | Wrong Answer | 207 | 4,040 | 174 | Find the number of _palindromic numbers_ among the integers between A and B (inclusive). Here, a palindromic number is a positive integer whose string representation in base 10 (without leading zeros) reads the same forward and backward. | a, b = map(int, input().split())
c = 0
for i in range(a, b+1):
s = str(i)
print(s[:len(s)//2], s[len(s)//2+1:])
if s[:len(s)//2] == s[len(s)//2+1:]:
c += 1
print(c) | s490966259 | Accepted | 71 | 2,940 | 137 | a, b = map(int, input().split())
c = 0
for i in range(a, b+1):
s = str(i)
t = s[4] + s[3]
if s[0] + s[1] == t :
c += 1
print(c) |
s552160326 | p04030 | u973069173 | 2,000 | 262,144 | Wrong Answer | 26 | 9,056 | 187 | Sig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has 3 keys on it: the `0` key, the `1` key and the backspace key. To begin with, he is using a plain text editor with this keyboard. This editor always displays one string (possibly empty). Just after the editor is launched, this stri... | a = input()
test = ''
for i in range(len(a)):
if a[i] == '0':
test += '0'
elif a[i] == '1':
test += '1'
else:
if len(a) == 0:
pass
else:
test = test[:-1] | s250202807 | Accepted | 31 | 9,028 | 204 | a = input()
test = ''
for i in range(len(a)):
if a[i] == '0':
test += '0'
elif a[i] == '1':
test += '1'
else:
if len(a) == 0:
pass
else:
test = test[:-1]
print(test) |
s717880664 | p02613 | u343850880 | 2,000 | 1,048,576 | Wrong Answer | 149 | 16,656 | 357 | Takahashi is participating in a programming contest called AXC002, and he has just submitted his code to Problem A. The problem has N test cases. For each test case i (1\leq i \leq N), you are given a string S_i representing the verdict for that test case. Find the numbers of test cases for which the verdict is `AC`,... | import sys
stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)
def LI(): return list(map(int, stdin.readline().split()))
def LS(): return list(stdin.readline())
import collections
n = int(input())
s = [input() for i in range(n)]
c = collections.Counter(s)
print(f'AC x {c["AC"]}')
print(f'WA x {c["WA"]}')
print(f'LTE x ... | s717385636 | Accepted | 144 | 16,544 | 357 | import sys
stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)
def LI(): return list(map(int, stdin.readline().split()))
def LS(): return list(stdin.readline())
import collections
n = int(input())
s = [input() for i in range(n)]
c = collections.Counter(s)
print(f'AC x {c["AC"]}')
print(f'WA x {c["WA"]}')
print(f'TLE x ... |
s631013812 | p04043 | u016622494 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 82 | Iroha loves _Haiku_. Haiku is a short form of Japanese poetry. A Haiku consists of three phrases with 5, 7 and 5 syllables, in this order. To create a Haiku, Iroha has come up with three different phrases. These phrases have A, B and C syllables, respectively. Determine whether she can construct a Haiku by using each ... | a , b , c = input().split()
if a + b + c == 22:
print("YES")
else:
print("NO") | s128450811 | Accepted | 17 | 2,940 | 202 | a , b , c =map(int,input().split())
if a + b + c ==17:
if a != 5:
if b == c and b ==5:
print("YES")
exit()
else:
if b == 5 or c == 5:
print("YES")
exit()
print("NO")
|
s901900027 | p03943 | u759412327 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 104 | Two students of AtCoder Kindergarten are fighting over candy packs. There are three candy packs, each of which contains a, b, and c candies, respectively. Teacher Evi is trying to distribute the packs between the two students so that each student gets the same number of candies. Determine whether it is possible. Not... | a = list(map(int,input().split()))
b = sorted(a)
if b[1]+b[2]==b[0]:
print("Yes")
else:
print("No") | s166272528 | Accepted | 26 | 9,140 | 86 | a,b,c = sorted(map(int,input().split()))
if a+b==c:
print("Yes")
else:
print("No") |
s964332038 | p02615 | u907865484 | 2,000 | 1,048,576 | Wrong Answer | 150 | 32,940 | 192 | Quickly after finishing the tutorial of the online game _ATChat_ , you have decided to visit a particular place with N-1 players who happen to be there. These N players, including you, are numbered 1 through N, and the **friendliness** of Player i is A_i. The N players will arrive at the place one by one in some order... | import math
N = int(input())
A = list(map(int,input().split()))
A.sort(reverse=True)
comfortPoint = A[0]
for i in range(N)[1::]:
comfortPoint += A[math.ceil(i/2)]
print(comfortPoint)
| s477640048 | Accepted | 149 | 32,836 | 194 | import math
N = int(input())
A = list(map(int,input().split()))
A.sort(reverse=True)
comfortPoint = A[0]
for i in range(N-1)[1::]:
comfortPoint += A[math.ceil(i/2)]
print(comfortPoint)
|
s595229333 | p03557 | u798818115 | 2,000 | 262,144 | Wrong Answer | 91 | 23,328 | 637 | The season for Snuke Festival has come again this year. First of all, Ringo will perform a ritual to summon Snuke. For the ritual, he needs an altar, which consists of three parts, one in each of the three categories: upper, middle and lower. He has N parts for each of the three categories. The size of the i-th upper ... | # coding: utf-8
# Your code here!
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))
def binary (l,num):
high=len(l)-1
low=0
while True:
print(high,low)
mid=int((high+low))//2
if l[mid]<num:
if l[mid+1]>... | s221112362 | Accepted | 1,866 | 23,328 | 1,029 | # coding: utf-8
# Your code here!
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))
A.sort()
B.sort()
C.sort()
ans=[]
count=0
def binary (l,num):
high=len(l)-1
low=0
if num<=l[0]:
return 0
elif num>l[-1]:
return len(l... |
s928424561 | p03456 | u207799478 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 125 | AtCoDeer the deer has found two positive integers, a and b. Determine whether the concatenation of a and b in this order is a square number. | a=list(input().split())
aa=''.join(a)
for i in range(1,101):
if i*i==aa:
print('Yes')
exit()
print('No')
| s225676270 | Accepted | 157 | 2,940 | 144 | a=list(input().split())
aa=int(''.join(a))
for i in range(1,1000000):
if i*i==aa:
print('Yes')
break
else:
print('No')
|
s124437733 | p03110 | u667505876 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 186 | Takahashi received _otoshidama_ (New Year's money gifts) from N of his relatives. You are given N values x_1, x_2, ..., x_N and N strings u_1, u_2, ..., u_N as input. Each string u_i is either `JPY` or `BTC`, and x_i and u_i represent the content of the otoshidama from the i-th relative. For example, if x_1 = `10000`... | n = int(input())
money = 0
for i in range(n):
a,b = map(str,input().split(' '))
x = float(a)
if b == 'JPY':
money = money + x
else:
money = money + x * 380000.0
print('money')
| s886825495 | Accepted | 17 | 2,940 | 220 | import sys
n = int(input())
money = 0
for i in range(n):
y = sys.stdin.readline().rstrip('\n')
a,b = y.split(' ')
x = float(a)
if b == 'JPY':
money = money + x
else:
money = money + x * 380000.0
print(money)
|
s784054568 | p03494 | u527993431 | 2,000 | 262,144 | Wrong Answer | 2,104 | 3,060 | 239 | There are N positive integers written on a blackboard: A_1, ..., A_N. Snuke can perform the following operation when all integers on the blackboard are even: * Replace each integer X on the blackboard by X divided by 2. Find the maximum possible number of operations that Snuke can perform. | N = int(input())
A = list(map(int,input().split()))
count = 0
tmp = 0
while(1):
if tmp == 1:
break
for i in range (N):
if A[i]%2 == 1:
print(count)
tmp = 1
break
else:
count += 1
for i in range (N):
A[i] = A[i]/2 | s390815753 | Accepted | 19 | 3,060 | 278 | N = int(input())
A = list(map(int,input().split()))
count = 0
tmp = 0
while(1):
tmp_2=0
if tmp == 1:
break
for i in range (N):
if A[i]%2 == 1:
print(count)
tmp = 1
break
else:
tmp_2 += 1
if tmp_2 == N:
count += 1
for i in range (N):
A[i] = A[i]/2
|
s234089628 | p03567 | u698535708 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 824 | Snuke built an online judge to hold a programming contest. When a program is submitted to the judge, the judge returns a verdict, which is a two-character string that appears in the string S as a contiguous substring. (The judge can return any two-character substring of S.) Determine whether the judge can return the ... | s = input()
s_x = [i for i in s if 'x' not in i]
cnt = 1
cen = int(len(s) / 2)
for i, c in enumerate(s):
d = len(s_x)/2
if cnt == int(d):
cen = i+1
if c == 'x':
pass
elif c != s_x[len(s_x)-cnt]:
print(-1)
break
else:
cnt += 1
else:
a = s[:cen]
... | s952188889 | Accepted | 17 | 2,940 | 41 | print("Yes" if "AC" in input() else "No") |
s665208860 | p03433 | u083960235 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 203 | E869120 has A 1-yen coins and infinitely many 500-yen coins. Determine if he can pay exactly N yen using only these coins. | N=int(input())#total
A=int(input())#1
#500*x+1*A=N
#x is undecided
a=N-1*A
#a can devided by 500?
if(N>=A):
if(a%500==0):
print("yes")
else:
print("No")
else:
print("No") | s283271569 | Accepted | 18 | 2,940 | 120 | N=int(input())#total
A=int(input())#1
#500*x+1*A=N
#x is undecided
if(N%500<=A):
print("Yes")
else:
print("No") |
s278009670 | p03501 | u484856305 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 70 | You are parking at a parking lot. You can choose from the following two fee plans: * Plan 1: The fee will be A×T yen (the currency of Japan) when you park for T hours. * Plan 2: The fee will be B yen, regardless of the duration. Find the minimum fee when you park for N hours. | a,b,c=map(int,input().split())
if a*b>c:
print(a*b)
else:
print(c) | s577086445 | Accepted | 17 | 2,940 | 70 | a,b,c=map(int,input().split())
if a*b>c:
print(c)
else:
print(a*b) |
s751390384 | p03160 | u695079172 | 2,000 | 1,048,576 | Wrong Answer | 128 | 14,616 | 560 | There are N stones, numbered 1, 2, \ldots, N. For each i (1 \leq i \leq N), the height of Stone i is h_i. There is a frog who is initially on Stone 1. He will repeat the following action some number of times to reach Stone N: * If the frog is currently on Stone i, jump to Stone i + 1 or Stone i + 2. Here, a cost of... | def flog(heights,n):
dp = [0 for _ in heights]
dp [0] = 0
dp [1] = abs(heights[1]-heights[0])
for i in range(2,n):
from_one_before = dp[i-1] + abs(heights[i] - heights[i-1])
from_two_before = dp[i-2] + abs(heights[i] - heights[i-2])
dp[i] = min(from_one_before,from_two_... | s276614962 | Accepted | 100 | 20,572 | 345 |
def main():
n = int(input())
h = list(map(int,input().split()))
dp = [0] * n
dp[1] = abs(h[1]-h[0])
for i in range(2,n):
one_behind = dp[i-1] + abs(h[i-1] - h[i])
two_behind = dp[i-2] + abs(h[i-2] - h[i])
dp[i] = min(one_behind,two_behind)
print(dp[n-1])
if __name__ =... |
s732281476 | p03963 | u672898046 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 52 | There are N balls placed in a row. AtCoDeer the deer is painting each of these in one of the K colors of his paint cans. For aesthetic reasons, any two adjacent balls must be painted in different colors. Find the number of the possible ways to paint the balls. | n, k = map(int, input().split())
print(k*(n**(k-1))) | s041388940 | Accepted | 17 | 2,940 | 56 | n, k = map(int, input().split())
print(((k-1)**(n-1))*k) |
s940720331 | p02399 | u131984977 | 1,000 | 131,072 | Wrong Answer | 40 | 6,744 | 101 | Write a program which reads two integers a and b, and calculates the following values: * a ÷ b: d (in integer) * remainder of a ÷ b: r (in integer) * a ÷ b: f (in real number) | import sys
(a, b) = [int(i) for i in sys.stdin.readline().split(' ')]
print(a // b, a % b, a / b) | s210166779 | Accepted | 30 | 7,700 | 114 | a, b = [int(i) for i in input().split()]
d = a // b
r = a % b
f = a / b
print("{0} {1} {2:.5f}".format(d, r, f)) |
s287732836 | p03456 | u430198125 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 161 | AtCoDeer the deer has found two positive integers, a and b. Determine whether the concatenation of a and b in this order is a square number. | # -*- coding: utf-8 -*-
import math
a, b = map(str, input().split())
c = int(a + b)
if math.sqrt(c).is_integer():
print ("YES")
else:
print("No") | s465055617 | Accepted | 17 | 2,940 | 161 | # -*- coding: utf-8 -*-
import math
a, b = map(str, input().split())
c = int(a + b)
if math.sqrt(c).is_integer():
print ("Yes")
else:
print("No") |
s505697921 | p03943 | u546235346 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 131 | Two students of AtCoder Kindergarten are fighting over candy packs. There are three candy packs, each of which contains a, b, and c candies, respectively. Teacher Evi is trying to distribute the packs between the two students so that each student gets the same number of candies. Determine whether it is possible. Not... | n = input().split()
a = int(n[0])
b = int(n[1])
c = int(n[2])
m = max([a,b,c])
if 2*m == a+b+c:
print("YES")
else:
print("NO") | s507752940 | Accepted | 18 | 2,940 | 131 | n = input().split()
a = int(n[0])
b = int(n[1])
c = int(n[2])
m = max([a,b,c])
if 2*m == a+b+c:
print("Yes")
else:
print("No") |
s312223550 | p03371 | u764401543 | 2,000 | 262,144 | Wrong Answer | 2,104 | 3,064 | 314 | "Pizza At", a fast food chain, offers three kinds of pizza: "A-pizza", "B-pizza" and "AB-pizza". A-pizza and B-pizza are completely different pizzas, and AB-pizza is one half of A-pizza and one half of B-pizza combined together. The prices of one A-pizza, B-pizza and AB-pizza are A yen, B yen and C yen (yen is the curr... | A, B, C, X, Y = map(int, input().split())
ans = float('inf')
if A + B > 2 * C:
p = (2 * max(X, Y)) * C
ans = min(ans, p)
else:
for x in range(X + 1):
for y in range(Y + 1):
c = max(X - x, Y - y)
p = x * A + y * B + (2 * c) * C
ans = min(ans, p)
print(ans) | s208344914 | Accepted | 17 | 3,060 | 351 | A, B, C, X, Y = map(int, input().split())
# ans = float('inf')
# ans = min(ans, A * max(X - i, 0) + B * max(Y - i, 0) + 2 * C * i)
# print(ans)
min_xy = min(X, Y)
max_xy = max(X, Y)
ans1 = 2 * C * min_xy + A * (X - min_xy) + B * (Y - min_xy)
ans2 = A * X + B * Y
ans3 = 2 * C * max_xy
print(min(ans1, ans2, ans3)... |
s388548256 | p03814 | u217627525 | 2,000 | 262,144 | Wrong Answer | 71 | 3,512 | 256 | Snuke has decided to construct a string that starts with `A` and ends with `Z`, by taking out a substring of a string s (that is, a consecutive part of s). Find the greatest length of the string Snuke can construct. Here, the test set guarantees that there always exists a substring of s that starts with `A` and ends w... | s=input()
a=0
find_a=0
z=len(s)-1
find_z=0
while find_a==0 or find_z==0:
if find_a==0 and s[a]=="A":
find_a=1
if find_z==0 and s[z]=="Z":
find_z=1
if find_a==0:
a+=1
if find_z==0:
z-=1
print(z,a)
print(z-a+1) | s862868853 | Accepted | 59 | 3,516 | 269 | s=input()
a=0
find_a=0
z=len(s)-1
find_z=0
while find_a==0 or find_z==0:
if find_a==0:
if s[a]=="A":
find_a=1
else:
a+=1
if find_z==0:
if s[z]=="Z":
find_z=1
else:
z-=1
print(z-a+1) |
s528001245 | p03369 | u085334230 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 43 | In "Takahashi-ya", a ramen restaurant, a bowl of ramen costs 700 yen (the currency of Japan), plus 100 yen for each kind of topping (boiled egg, sliced pork, green onions). A customer ordered a bowl of ramen and told which toppings to put on his ramen to a clerk. The clerk took a memo of the order as a string S. S is ... | s = str(input())
print(s.count("o") * 100)
| s190474029 | Accepted | 17 | 2,940 | 48 | s = str(input())
print(s.count("o") * 100 + 700) |
s786015025 | p02615 | u414050834 | 2,000 | 1,048,576 | Wrong Answer | 123 | 31,324 | 220 | Quickly after finishing the tutorial of the online game _ATChat_ , you have decided to visit a particular place with N-1 players who happen to be there. These N players, including you, are numbered 1 through N, and the **friendliness** of Player i is A_i. The N players will arrive at the place one by one in some order... | n=int(input())
a=list(map(int,input().split()))
a.sort(reverse=True)
t=(len(a)-1)//2
ans=a[0]
if t%2==0:
for i in range(1,t+1):
ans+=a[i]*2
else:
ans=ans+a[t+1]
for i in range(1,t+1):
ans+=a[i]*2
print(ans) | s805676878 | Accepted | 127 | 31,596 | 230 | n=int(input())
a=list(map(int,input().split()))
a.sort(reverse=True)
t=(len(a)-2)//2
ans=a[0]
if (len(a)-2)%2==0:
for i in range(1,t+1):
ans+=a[i]*2
else:
ans=ans+a[t+1]
for i in range(1,t+1):
ans+=a[i]*2
print(ans)
|
s669519014 | p02392 | u600195957 | 1,000 | 131,072 | Wrong Answer | 20 | 7,632 | 95 | Write a program which reads three integers a, b and c, and prints "Yes" if a < b < c, otherwise "No". | a,b,c = [int(i) for i in input().split()]
if a < b < c:
print("YES")
else:
print("NO") | s447027463 | Accepted | 20 | 7,700 | 95 | a,b,c = [int(i) for i in input().split()]
if a < b < c:
print("Yes")
else:
print("No") |
s549622353 | p03605 | u439392790 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 76 | It is September 9 in Japan now. You are given a two-digit integer N. Answer the question: Is 9 contained in the decimal notation of N? | N=str(input())
if N[0]==9 or N[1]==9:
print('Yes')
else:
print('No') | s086589922 | Accepted | 20 | 2,940 | 66 | N=str(input())
if '9' in N:
print('Yes')
else:
print('No') |
s412566106 | p02415 | u283452598 | 1,000 | 131,072 | Wrong Answer | 20 | 7,420 | 33 | Write a program which converts uppercase/lowercase letters to lowercase/uppercase for a given string. | s = input()
s.swapcase()
print(s) | s216385274 | Accepted | 20 | 7,408 | 31 | s = input()
print(s.swapcase()) |
s016581933 | p02601 | u581248859 | 2,000 | 1,048,576 | Wrong Answer | 29 | 9,188 | 201 | M-kun has the following three cards: * A red card with the integer A. * A green card with the integer B. * A blue card with the integer C. He is a genius magician who can do the following operation at most K times: * Choose one of the three cards and multiply the written integer by 2. His magic is successfu... | A,B,C = map(int,input().split())
K = int(input())
cnt = 0
for _ in range(K):
if A>B:
B *= 2
cnt += 1
for _ in range(K-cnt):
if B>C:
C *= 2
if (A<B) and (B<C):
print('YES')
else:
print('NO') | s768053330 | Accepted | 31 | 9,076 | 245 | A,B,C = map(int,input().split())
K = int(input())
cnt = 0
for _ in range(K):
if A>=B:
B *= 2
cnt += 1
else:
break
for _ in range(K-cnt):
if B>=C:
C *= 2
else:
break
#print(cnt)
if (A<B) and (B<C):
print('Yes')
else:
print('No') |
s493815357 | p03857 | u001024152 | 2,000 | 262,144 | Wrong Answer | 790 | 46,248 | 1,530 | There are N cities. There are also K roads and L railways, extending between the cities. The i-th road bidirectionally connects the p_i-th and q_i-th cities, and the i-th railway bidirectionally connects the r_i-th and s_i-th cities. No two roads connect the same pair of cities. Similarly, no two railways connect the s... | # D
class UnionFind:
def __init__(self, size: int):
self.par = [-1]*size
for i in range(size):
self.par[i] = i
def root(self, x: int) -> int:
if self.par[x] == x: # if root
return x
else:
self.par[x] = self.root(... | s968458364 | Accepted | 1,880 | 52,960 | 1,632 | # D
class UnionFind:
def __init__(self, size: int):
self.par = [-1]*size
for i in range(size):
self.par[i] = i
def root(self, x: int) -> int:
if self.par[x] == x: # if root
return x
else:
self.par[x] = self.root(... |
s394897125 | p03407 | u923712635 | 2,000 | 262,144 | Wrong Answer | 20 | 2,940 | 87 | An elementary school student Takahashi has come to a variety store. He has two coins, A-yen and B-yen coins (yen is the currency of Japan), and wants to buy a toy that costs C yen. Can he buy it? Note that he lives in Takahashi Kingdom, and may have coins that do not exist in Japan. | A,B,C = [int(x) for x in input().split()]
if(A+B<C):
print('Yes')
else:
print('No') | s630313310 | Accepted | 17 | 2,940 | 88 | A,B,C = [int(x) for x in input().split()]
if(A+B>=C):
print('Yes')
else:
print('No') |
s808803338 | p03681 | u662613022 | 2,000 | 262,144 | Wrong Answer | 70 | 3,064 | 617 | Snuke has N dogs and M monkeys. He wants them to line up in a row. As a Japanese saying goes, these dogs and monkeys are on bad terms. _("ken'en no naka", literally "the relationship of dogs and monkeys", means a relationship of mutual hatred.)_ Snuke is trying to reconsile them, by arranging the animals so that there... | import math
N,M = map(int,input().split())
ans = 1
if N-M >= 2 or M-N >= 2:
print(0)
else:
if N > M:
for i in range(1,N+1):
if i == N:
ans *= i
else:
ans *= i**2
ans = ans % 1000000007
elif N < M:
for i in range(1,M+1):
... | s680841832 | Accepted | 69 | 3,064 | 632 | import math
N,M = map(int,input().split())
ans = 1
if N-M >= 2 or M-N >= 2:
print(0)
else:
if N > M:
for i in range(1,N+1):
if i == N:
ans *= i
else:
ans *= i**2
ans = ans % 1000000007
elif N < M:
for i in range(1,M+1):
... |
s099791235 | p03407 | u390958150 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 81 | An elementary school student Takahashi has come to a variety store. He has two coins, A-yen and B-yen coins (yen is the currency of Japan), and wants to buy a toy that costs C yen. Can he buy it? Note that he lives in Takahashi Kingdom, and may have coins that do not exist in Japan. | a,b,c = map(int,input().split())
if a+b <= c:
print("Yes")
else:
print("No") | s505090802 | Accepted | 17 | 2,940 | 82 | a,b,c = map(int,input().split())
if a+b >= c:
print("Yes")
else:
print("No")
|
s372167378 | p03729 | u614917104 | 2,000 | 262,144 | Wrong Answer | 27 | 9,092 | 116 | You are given three strings A, B and C. Check whether they form a _word chain_. More formally, determine whether both of the following are true: * The last character in A and the initial character in B are the same. * The last character in B and the initial character in C are the same. If both are true, print `Y... | a,b,c = input().split()
n = 0
if a[len(a)-1] == b[0] and b[len(b)-1] == c[0]:
print('Yes')
else:
print('No') | s159911676 | Accepted | 27 | 8,968 | 116 | a,b,c = input().split()
n = 0
if a[len(a)-1] == b[0] and b[len(b)-1] == c[0]:
print('YES')
else:
print('NO') |
s396632110 | p03719 | u668352391 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 107 | You are given three integers A, B and C. Determine whether C is not less than A and not greater than B. | a, b, c = map(lambda x: int(x), input().split())
if a <= c and b >= c:
print('YES')
else:
print('NO')
| s304911418 | Accepted | 17 | 2,940 | 106 | a, b, c = map(lambda x: int(x), input().split())
if a <= c and b >= c:
print('Yes')
else:
print('No') |
s902226141 | p03814 | u074220993 | 2,000 | 262,144 | Wrong Answer | 49 | 9,076 | 198 | Snuke has decided to construct a string that starts with `A` and ends with `Z`, by taking out a substring of a string s (that is, a consecutive part of s). Find the greatest length of the string Snuke can construct. Here, the test set guarantees that there always exists a substring of s that starts with `A` and ends w... | s = input()
i, j = 0, len(s)-1
while(1):
if s[i] == "A":
start = i
break
i += 1
while(1):
if s[j] == "Z":
end = j + 1
break
j -= 1
print(s[start:end]) | s306671152 | Accepted | 27 | 9,196 | 45 | s = input()
print(s.rfind('Z')-s.find('A')+1) |
s949998539 | p03448 | u477651929 | 2,000 | 262,144 | Wrong Answer | 29 | 3,060 | 351 | You have A 500-yen coins, B 100-yen coins and C 50-yen coins (yen is the currency of Japan). In how many ways can we select some of these coins so that they are X yen in total? Coins of the same kind cannot be distinguished. Two ways to select coins are distinguished when, for some kind of coin, the numbers of that co... | a, b, c, x = map(int, [input() for i in range(4)])
ans = 0
for i in range(a):
if x - (500 * i) >= 0:
x_ = x - (500 * i)
for j in range(b):
if x_ - (100 * j) >= 0:
x_ = x - (100 * j)
for k in range(c):
if x_ - (50 * k) == 0:
... | s871908996 | Accepted | 50 | 3,060 | 235 | a, b, c, x = map(int, [input() for i in range(4)])
ans = 0
for i in range(a + 1):
for j in range(b + 1):
for k in range(c + 1):
if x - 500 * i - 100 * j - 50 * k == 0:
ans += 1
print(ans) |
s375120788 | p03624 | u798129018 | 2,000 | 262,144 | Wrong Answer | 17 | 3,188 | 169 | You are given a string S consisting of lowercase English letters. Find the lexicographically (alphabetically) smallest lowercase English letter that does not occur in S. If every lowercase English letter occurs in S, print `None` instead. | s = input()
a = list("abcdefghijklmnopqrstuvwxyz")
for i in range(len(a)):
if s.count(a[i]):
break
else:
print(a[i])
exit()
print("None") | s824379744 | Accepted | 21 | 3,188 | 172 | s = input()
a = list("abcdefghijklmnopqrstuvwxyz")
for i in range(len(a)):
if s.count(a[i]):
continue
else:
print(a[i])
exit()
print("None") |
s085500827 | p03697 | u325282913 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 86 | You are given two integers A and B as the input. Output the value of A + B. However, if A + B is 10 or greater, output `error` instead. | A, B = map(int, input().split())
if A+B <= 10:
print('error')
else:
print(A+B) | s073074452 | Accepted | 17 | 2,940 | 86 | A, B = map(int, input().split())
if A+B >= 10:
print('error')
else:
print(A+B) |
s456875855 | p04000 | u149991748 | 3,000 | 262,144 | Wrong Answer | 3,196 | 796,080 | 533 | We have a grid with H rows and W columns. At first, all cells were painted white. Snuke painted N of these cells. The i-th ( 1 \leq i \leq N ) cell he painted is the cell at the a_i-th row and b_i-th column. Compute the following: * For each integer j ( 0 \leq j \leq 9 ), how many subrectangles of size 3×3 of the ... | h, w, n = map(int, input().split())
hako = [[0 for i in range(w)] for j in range(h)]
ans = [0]*10
#print("hako1 = {0}".format(hako))
if n != 0:
print('a')
for i in range(n):
s, t = map(int, input().split())
hako[s-1][t-1] = 1
#print("hako2 = {0}".format(hako))
for i in range(h-2):
for j... | s547516322 | Accepted | 1,894 | 174,432 | 270 | f=lambda:map(int,input().split())
h,w,n = f()
d={}
while n:
n-=1
x,y=f()
for i in range(9):
a=(x+i%3,y+i//3)
d[a]=d.get(a,0)+(h>=a[0]>2<a[1]<=w)
c=[list(d.values()).count(i+1)for i in range(9)]
print((h-2)*(w-2)-sum(c))
for i in range(9):
print(c[i]) |
s817780836 | p03852 | u508273185 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 78 | Given a lowercase English letter c, determine whether it is a vowel. Here, there are five vowels in the English alphabet: `a`, `e`, `i`, `o` and `u`. | c = input()
if c == "aiueo":
print("vowel")
else :
print("consonant") | s935565972 | Accepted | 18 | 2,940 | 78 | c = input()
if c in "aiueo":
print("vowel")
else :
print("consonant") |
s502494389 | p02646 | u134520518 | 2,000 | 1,048,576 | Wrong Answer | 20 | 9,196 | 176 | Two children are playing tag on a number line. (In the game of tag, the child called "it" tries to catch the other child.) The child who is "it" is now at coordinate A, and he can travel the distance of V per second. The other child is now at coordinate B, and she can travel the distance of W per second. He can catch ... | a,v = map(int, input().split())
b,w = map(int, input().split())
t = int(input())
if v <= w:
print('No')
elif ((a-b)/(v-w))**2 <t**2:
print('Yes')
else:
print('No') | s775193733 | Accepted | 19 | 9,120 | 177 | a,v = map(int, input().split())
b,w = map(int, input().split())
t = int(input())
if v <= w:
print('NO')
elif ((a-b)/(v-w))**2 <=t**2:
print('YES')
else:
print('NO') |
s070369635 | p02272 | u772417059 | 1,000 | 131,072 | Wrong Answer | 20 | 5,596 | 495 | Write a program of a Merge Sort algorithm implemented by the following pseudocode. You should also report the number of comparisons in the Merge function. Merge(A, left, mid, right) n1 = mid - left; n2 = right - mid; create array L[0...n1], R[0...n2] for i = 0 to n1-1 do L[i] = A[left + i] ... | cnt = 0
INFTY=10**10
def merge_sort(a,left,right):
if left+1<right:
mid=(left+right)//2
merge_sort(a,left,mid)
merge_sort(a,mid,right)
merge(a,left,mid,right)
def merge(a,left,mid,right):
L=a[left:mid]
R=a[mid:right]
L.append(INFTY)
R.append(INFTY)
global cnt
i=0
j=0
for k in range(left,right):
cnt+... | s970528420 | Accepted | 3,780 | 61,648 | 496 | cnt = 0
INFTY=10**10
def merge_sort(a,left,right):
if left+1<right:
mid=(left+right)//2
merge_sort(a,left,mid)
merge_sort(a,mid,right)
merge(a,left,mid,right)
def merge(a,left,mid,right):
L=a[left:mid]
R=a[mid:right]
L.append(INFTY)
R.append(INFTY)
global cnt
i=0
j=0
for k in range(left,right):
cnt+... |
s335807973 | p03637 | u487594898 | 2,000 | 262,144 | Wrong Answer | 193 | 23,104 | 574 | We have a sequence of length N, a = (a_1, a_2, ..., a_N). Each a_i is a positive integer. Snuke's objective is to permute the element in a so that the following condition is satisfied: * For each 1 ≤ i ≤ N - 1, the product of a_i and a_{i + 1} is a multiple of 4. Determine whether Snuke can achieve his objective. | import numpy as np
N=int(input())
A = list(map(int,input().split()))
Aa = np.array(A) %4
if np.count_nonzero(Aa%4==2)==0 and N//2-np.count_nonzero(Aa%4==0)>0:
print("No")
elif np.count_nonzero(Aa%4==2)==0 and N//2-np.count_nonzero(Aa%4==0)<=0:
print("Yes")
elif np.count_nonzero(Aa%4==2)!=0:
if N%2==np.count... | s501771690 | Accepted | 199 | 23,136 | 574 | import numpy as np
N=int(input())
A = list(map(int,input().split()))
Aa = np.array(A) %4
if np.count_nonzero(Aa%4==2)==0 and N//2-np.count_nonzero(Aa%4==0)>0:
print("No")
elif np.count_nonzero(Aa%4==2)==0 and N//2-np.count_nonzero(Aa%4==0)<=0:
print("Yes")
elif np.count_nonzero(Aa%4==2)!=0:
if N%2==np.count... |
s898618582 | p03547 | u029329478 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 137 | In programming, hexadecimal notation is often used. In hexadecimal notation, besides the ten digits 0, 1, ..., 9, the six letters `A`, `B`, `C`, `D`, `E` and `F` are used to represent the values 10, 11, 12, 13, 14 and 15, respectively. In this problem, you are given two letters X and Y. Each X and Y is `A`, `B`, `C`,... | X, Y = map(str, input().split())
x = int(X, 16)
y = int(Y, 16)
if x > y:
print(">")
elif y < x:
print("<")
else:
print("=")
| s187858985 | Accepted | 19 | 3,060 | 137 | X, Y = map(str, input().split())
x = int(X, 16)
y = int(Y, 16)
if x > y:
print(">")
elif x < y:
print("<")
else:
print("=")
|
s003717748 | p02646 | u658987783 | 2,000 | 1,048,576 | Wrong Answer | 25 | 9,228 | 283 | Two children are playing tag on a number line. (In the game of tag, the child called "it" tries to catch the other child.) The child who is "it" is now at coordinate A, and he can travel the distance of V per second. The other child is now at coordinate B, and she can travel the distance of W per second. He can catch ... | a,v=list(map(int,input().split()))
b,w=a,v=list(map(int,input().split()))
n=int(input())
if a<=b:
if (a+v*n)>=(b+w*n):
print("Yes")
exit()
else:
print("No")
exit()
if a>b:
if (a-v*n)<=(b-w*n):
print("Yes")
exit()
else:
print("No")
exit()
| s405667598 | Accepted | 21 | 9,196 | 235 | a,v=list(map(int,input().split()))
b,w=list(map(int,input().split()))
n=int(input())
if a<=b:
if (a+v*n)>=(b+w*n):
print("YES")
else:
print("NO")
if a>b:
if (a-v*n)<=(b-w*n):
print("YES")
else:
print("NO")
|
s614721828 | p03588 | u796424048 | 2,000 | 262,144 | Wrong Answer | 2,104 | 11,044 | 225 | A group of people played a game. All players had distinct scores, which are positive integers. Takahashi knows N facts on the players' scores. The i-th fact is as follows: the A_i-th highest score among the players is B_i. Find the maximum possible number of players in the game. | N = int(input())
A = []
B = []
for i in range(N):
a,b = map(int,input().split())
A.append(a)
B.append(b)
res_1 = min(A)-1
for i in range(N):
if B[i] == min(B):
res_2 = B[i]
print(max(B)+res_1+res_2) | s441065889 | Accepted | 316 | 11,052 | 156 | N = int(input())
A = []
B = []
for i in range(N):
a,b = map(int,input().split())
A.append(a)
B.append(b)
res = max(A)
res += min(B)
print(res) |
s550734358 | p04011 | u728611988 | 2,000 | 262,144 | Wrong Answer | 19 | 3,060 | 165 | There is a hotel with the following accommodation fee: * X yen (the currency of Japan) per night, for the first K nights * Y yen per night, for the (K+1)-th and subsequent nights Tak is staying at this hotel for N consecutive nights. Find his total accommodation fee. | n = int(input())
k = int(input())
x = int(input())
y = int(input())
ans = 0
for i in range(n+1):
if i < k:
ans += x
else:
ans += y
print(ans) | s254002103 | Accepted | 19 | 3,060 | 168 | n = int(input())
k = int(input())
x = int(input())
y = int(input())
ans = 0
for i in range(1,n+1):
if i <= k:
ans += x
else:
ans += y
print(ans) |
s461403314 | p01101 | u617401892 | 8,000 | 262,144 | Wrong Answer | 1,480 | 6,036 | 560 | Mammy decided to give Taro his first shopping experience. Mammy tells him to choose any two items he wants from those listed in the shopping catalogue, but Taro cannot decide which two, as all the items look attractive. Thus he plans to buy the pair of two items with the highest price sum, not exceeding the amount Mamm... | #!/usr/bin/env python3
n_list = []
m_list = []
a_list = []
while True:
n, m = list(map(int, input().split(' ')))
if n == 0 and m == 0:
break
a = list(map(int, input().split(' ')))
n_list.append(n)
m_list.append(m)
a_list.append(a)
for n, m, a in zip(n_list, m_list, a_list):
m_... | s639109009 | Accepted | 1,480 | 6,044 | 560 | #!/usr/bin/env python3
n_list = []
m_list = []
a_list = []
while True:
n, m = list(map(int, input().split(' ')))
if n == 0 and m == 0:
break
a = list(map(int, input().split(' ')))
n_list.append(n)
m_list.append(m)
a_list.append(a)
for n, m, a in zip(n_list, m_list, a_list):
m_... |
s419093050 | p00001 | u114315703 | 1,000 | 131,072 | Wrong Answer | 20 | 5,600 | 142 | There is a data which provides heights (in meter) of mountains. The data is only for ten mountains. Write a program which prints heights of the top three mountains in descending order. | N = 10
mnts = []
for i in range(N):
mnts.append(int(input()))
mnts.sort(reverse=True)
print(mnts)
for mnt in mnts[:3]:
print(mnt)
| s541827829 | Accepted | 20 | 5,600 | 130 | N = 10
mnts = []
for i in range(N):
mnts.append(int(input()))
mnts.sort(reverse=True)
for mnt in mnts[:3]:
print(mnt)
|
s272648791 | p03712 | u046136258 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 177 | You are given a image with a height of H pixels and a width of W pixels. Each pixel is represented by a lowercase English letter. The pixel at the i-th row from the top and j-th column from the left is a_{ij}. Put a box around this image and output the result. The box should consist of `#` and have a thickness of 1. | # coding: utf-8
# Your code here!
h,w=map(int,input().split())
moji=[]
for i in range(h):
moji.append(input())
print('#'*w)
for s in moji:
print('#'+s+'#')
print('#'*w)
| s736726817 | Accepted | 18 | 3,060 | 185 | # coding: utf-8
# Your code here!
h,w=map(int,input().split())
moji=[]
for i in range(h):
moji.append(input())
print('#'*(w+2))
for s in moji:
print('#'+s+'#')
print('#'*(w+2))
|
s115792675 | p03160 | u225685297 | 2,000 | 1,048,576 | Wrong Answer | 129 | 14,716 | 310 | There are N stones, numbered 1, 2, \ldots, N. For each i (1 \leq i \leq N), the height of Stone i is h_i. There is a frog who is initially on Stone 1. He will repeat the following action some number of times to reach Stone N: * If the frog is currently on Stone i, jump to Stone i + 1 or Stone i + 2. Here, a cost of... | from sys import stdin,stdout
n = int(stdin.readline())
dp = [0 for i in range(n)]
a = list(map(int,stdin.readline().split()))
dp[1] = a[1] - a[0]
for i in range(2,n):
if(abs(a[i] - a[i-1]) < abs(a[i] - a[i-2])):
dp[i] = dp[i-1] + a[i] - a[i-1]
else:
dp[i] = dp[i-2] + a[i] - a[i-2]
print(dp[-1]) | s088340198 | Accepted | 138 | 14,716 | 272 | from sys import stdin,stdout
n = int(stdin.readline())
dp = [0 for i in range(n)]
a = list(map(int,stdin.readline().split()))
dp[1] = abs(a[1] - a[0])
if(n>1):
for i in range(2,n):
dp[i] = min(dp[i-1] + abs(a[i]-a[i-1]) , dp[i-2] + abs(a[i]-a[i-2]))
print(dp[-1])
|
s394514434 | p03696 | u000349418 | 2,000 | 262,144 | Wrong Answer | 17 | 3,188 | 1,152 | You are given a string S of length N consisting of `(` and `)`. Your task is to insert some number of `(` and `)` into S to obtain a _correct bracket sequence_. Here, a correct bracket sequence is defined as follows: * `()` is a correct bracket sequence. * If X is a correct bracket sequence, the concatenation of... | N = int(input())
s=list(input())
n=0
l=0
r=0
L=[]
while n < N:
if s[n] == '(':
l+=1
if r != 0:
L.append(-1*r)
r=0
n +=1
else:
r += 1
if l != 0:
L.append(l)
l=0
n += 1
if r!=0:
L.append(-1*r)
elif l != 0:
L.append(l)
... | s263159202 | Accepted | 17 | 3,064 | 331 | n=int(input());s=input()
ans = '';v = 0;vmin = 0
for s0 in s:
if s0 == '(':
v += 1
else:
v -= 1
vmin = min(v,vmin)
left = '('; right = ')'
if vmin < 0:
ans += left*(-1*vmin)
v += (-1*vmin)
if v == 0:
ans += s
elif v > 0:
ans += s + right*v
else:
ans += left*(-1*v) + s... |
s868702856 | p03731 | u667458133 | 2,000 | 262,144 | Wrong Answer | 161 | 26,836 | 194 | In a public bath, there is a shower which emits water for T seconds when the switch is pushed. If the switch is pushed when the shower is already emitting water, from that moment it will be emitting water for T seconds. Note that it does not mean that the shower emits water for T additional seconds. N people will pus... | N, T = map(int, input().split())
t = list(map(int, input().split()))
result = T
for i in range(1, N):
if t[i]-t[i-1] < T:
result += T-t[i]+t[i-1]
else:
result += T
print(result) | s654261253 | Accepted | 148 | 26,708 | 209 | N, T = map(int, input().split())
t = list(map(int, input().split()))
result = T
for i in range(1, N):
if t[i] - t[i-1] < T:
result += (t[i] - t[i-1])
else:
result += T
print(result)
|
s034553657 | p03478 | u755180064 | 2,000 | 262,144 | Wrong Answer | 28 | 3,060 | 279 | Find the sum of the integers between 1 and N (inclusive), whose sum of digits written in base 10 is between A and B (inclusive). | n, r_from, r_to = [int(v) for v in input().split(' ')]
ans = 0
for nn in range(1, n + 1):
ad_digit = 0
tmp = nn
while True:
ad_digit += tmp % 10
tmp //= 10
if tmp == 0:
break
if r_from <= ad_digit and ad_digit <= r_to:
ans += ad_digit
print(ans) | s624113057 | Accepted | 29 | 3,060 | 278 | n, r_from, r_to = [int(v) for v in input().split(' ')]
ans = 0
for nn in range(1, n + 1):
ad_digit = 0
tmp = nn
while True:
ad_digit += tmp % 10
tmp = tmp // 10
if tmp == 0:
break
if r_from <= ad_digit and ad_digit <= r_to:
ans += nn
print(ans) |
s188554150 | p03943 | u065466683 | 2,000 | 262,144 | Wrong Answer | 29 | 9,104 | 187 | Two students of AtCoder Kindergarten are fighting over candy packs. There are three candy packs, each of which contains a, b, and c candies, respectively. Teacher Evi is trying to distribute the packs between the two students so that each student gets the same number of candies. Determine whether it is possible. Not... | x = list(map(int, input().split(' ')))
if x[0] == x[1] + x[2]:
print('yes')
elif x[0] + x[1] == x[2]:
print('yes')
elif x[0] + x[2] == x[1]:
print('yes')
else:
print('no') | s914497392 | Accepted | 27 | 9,084 | 187 | x = list(map(int, input().split(' ')))
if x[0] == x[1] + x[2]:
print('Yes')
elif x[0] + x[1] == x[2]:
print('Yes')
elif x[0] + x[2] == x[1]:
print('Yes')
else:
print('No') |
s453117685 | p03698 | u569776981 | 2,000 | 262,144 | Wrong Answer | 30 | 9,040 | 147 | You are given a string S consisting of lowercase English letters. Determine whether all the characters in S are different. | S = input()
N = len(S)
a = []
for i in range(N):
if S[i] in a:
print('No')
exit()
else:
a.append(S[i])
print('Yes') | s202482518 | Accepted | 26 | 9,052 | 147 | S = input()
N = len(S)
a = []
for i in range(N):
if S[i] in a:
print('no')
exit()
else:
a.append(S[i])
print('yes') |
s870407265 | p03564 | u905582793 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 90 | Square1001 has seen an electric bulletin board displaying the integer 1. He can perform the following operations A and B to change this value: * Operation A: The displayed value is doubled. * Operation B: The displayed value increases by K. Square1001 needs to perform these operations N times in total. Find the m... | n=int(input())
k=int(input())
ans = 1
for i in range(n):
ans=max(2*ans,ans+k)
print(ans) | s404489875 | Accepted | 17 | 2,940 | 90 | n=int(input())
k=int(input())
ans = 1
for i in range(n):
ans=min(2*ans,ans+k)
print(ans) |
s385036080 | p02603 | u464819941 | 2,000 | 1,048,576 | Wrong Answer | 38 | 8,840 | 448 | To become a millionaire, M-kun has decided to make money by trading in the next N days. Currently, he has 1000 yen and no stocks - only one kind of stock is issued in the country where he lives. He is famous across the country for his ability to foresee the future. He already knows that the price of one stock in the n... | import math
N = int(input())
A = list(map(int, input().split()))
C = 1
m = A[0]
M = A[0]
money = 1000;
for i in range(1,N):
if C == 1 and M <= A[i]:
M = A[i]
elif C == 1 and M > A[i]:
money = (money % m) + math.floor(money / m)*M
C = 0
m = A[i]
print(money)
elif C == 0 and m >= A[i]:
m = A... | s049561835 | Accepted | 31 | 9,232 | 429 | import math
N = int(input())
A = list(map(int, input().split()))
C = 1
m = A[0]
M = A[0]
money = 1000;
for i in range(1,N):
if C == 1 and M <= A[i]:
M = A[i]
elif C == 1 and M > A[i]:
money = (money % m) + math.floor(money / m)*M
C = 0
m = A[i]
elif C == 0 and m >= A[i]:
m = A[i]
elif C == 0... |
s159360953 | p03597 | u211349618 | 2,000 | 262,144 | Wrong Answer | 32 | 8,960 | 42 | We have an N \times N square grid. We will paint each square in the grid either black or white. If we paint exactly A squares white, how many squares will be painted black? | a=int(input())
b=int(input())
print(a^2-b) | s637960428 | Accepted | 25 | 9,092 | 42 | a=int(input())
b=int(input())
print(a*a-b) |
s258340901 | p02396 | u580737984 | 1,000 | 131,072 | Time Limit Exceeded | 40,000 | 8,408 | 201 | In the online judge system, a judge file may include multiple datasets to check whether the submitted program outputs a correct answer for each test case. This task is to practice solving a problem with multiple datasets. Write a program which reads an integer x and print it as is. Note that multiple datasets are give... | case = []
i = j = 0
while True:
num = int(input())
if num == 0:
break
case.append(num)
i += 1
while j < i:
print("Case",end=' ')
print(j+1,end=': ')
print(case[j]) | s120983181 | Accepted | 110 | 8,216 | 212 | case = []
i = j = 0
while True:
num = int(input())
if num == 0:
break
case.append(num)
i += 1
while j < i:
print("Case",end=' ')
print(j+1,end=': ')
print(case[j])
j += 1 |
s136155600 | p03606 | u703890795 | 2,000 | 262,144 | Wrong Answer | 20 | 2,940 | 105 | Joisino is working as a receptionist at a theater. The theater has 100000 seats, numbered from 1 to 100000. According to her memo, N groups of audiences have come so far, and the i-th group occupies the consecutive seats from Seat l_i to Seat r_i (inclusive). How many people are sitting at the theater now? | N = int(input())
s = 0
for i in range(N):
l, r = map(int, input().split())
s = s + 1 + (l-r)
print(s) | s310018021 | Accepted | 20 | 2,940 | 105 | N = int(input())
s = 0
for i in range(N):
l, r = map(int, input().split())
s = s + 1 + (r-l)
print(s) |
s125296953 | p03400 | u811730180 | 2,000 | 262,144 | Wrong Answer | 20 | 3,444 | 310 | Some number of chocolate pieces were prepared for a training camp. The camp had N participants and lasted for D days. The i-th participant (1 \leq i \leq N) ate one chocolate piece on each of the following days in the camp: the 1-st day, the (A_i + 1)-th day, the (2A_i + 1)-th day, and so on. As a result, there were X ... | n = int(input())
d, x= map(int, input().split())
a = []
for i in range(n):
a.append(int(input()))
# n = 3
# d, x = 7, 1
# a = [2, 5, 10]
choco = n+x
for A in a:
j = 0
while (j+1)*A+1 <= d:
print("A:%s" % A)
print((j+1)*A+1)
choco += 1
j += 1
print(choco)
| s616531850 | Accepted | 17 | 2,940 | 164 | n = int(input())
d, x= map(int, input().split())
a = []
for i in range(n):
a.append(int(input()))
c = n+x
for A in a:
c += int((d-1)/A)
print(c)
|
s294042881 | p02603 | u331390010 | 2,000 | 1,048,576 | Wrong Answer | 29 | 9,028 | 278 | To become a millionaire, M-kun has decided to make money by trading in the next N days. Currently, he has 1000 yen and no stocks - only one kind of stock is issued in the country where he lives. He is famous across the country for his ability to foresee the future. He already knows that the price of one stock in the n... | N = int(input())
A = list(map(int, input().split()))
M = 1000
X = 0
for i in range(N-1):
if A[i] < A[i+1]:
X = int(M/A[i])
M = M - X * A[i]
elif A[i] > A[i+1]:
M = M + A[i] * X
X = 0
if X > 0:
M = M + X * A[N-1]
print(M,X) | s494547733 | Accepted | 35 | 9,184 | 222 | N = int(input())
A = list(map(int, input().split()))
M = 1000
X = 0
for i in range(N-1):
if A[i] < A[i+1]:
X = int(M/A[i])
M = int(M - X * A[i])
M = M + X * A[i+1]
X = 0
print(int(M))
|
s547166243 | p02647 | u111652094 | 2,000 | 1,048,576 | Wrong Answer | 2,206 | 32,292 | 323 | We have N bulbs arranged on a number line, numbered 1 to N from left to right. Bulb i is at coordinate i. Each bulb has a non-negative integer parameter called intensity. When there is a bulb of intensity d at coordinate x, the bulb illuminates the segment from coordinate x-d-0.5 to x+d+0.5. Initially, the intensity o... | N,K=map(int,input().split())
A=list(map(int,input().split()))
B=[0]*N
sousa=0
while sousa<K:
for i in range(N):
ma=i+A[i]+1
if ma>N:
ma=N
mi=i-A[i]
if mi<0:
mi=0
for j in range(mi,ma):
B[j]+=1
A=list(B)
B=[0]*N
sousa+=1
print... | s081725707 | Accepted | 1,468 | 51,476 | 362 | import numpy as np
N,K=map(int,input().split())
A=list(map(int,input().split()))
B=np.zeros(shape=N+1,dtype=np.int64)
C=np.arange(0,N)
sousa=0
kaisuu=min(K,42)
while sousa<kaisuu:
np.add.at(B, np.maximum(0,C-A),1)
np.add.at(B,np.minimum(N,C+A+1),-1)
A = B.cumsum()[:-1]
sousa+=1
B *= 0
... |
s376887429 | p03545 | u694810977 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 441 | Sitting in a station waiting room, Joisino is gazing at her train ticket. The ticket is numbered with four digits A, B, C and D in this order, each between 0 and 9 (inclusive). In the formula A op1 B op2 C op3 D = 7, replace each of the symbols op1, op2 and op3 with `+` or `-` so that the formula holds. The given in... | S = str(input())
A = int(S[0])
B = int(S[1])
C = int(S[2])
D = int(S[3])
lists = [A,B,C,D]
lists.sort(reverse=True)
ans = lists[0]
lists_2 = [lists[1],lists[2],lists[3]]
op_list = []
for i in lists_2:
if ans < 7:
ans += i
op_list.append("+")
else:
ans -= i
op_list.append("-")
pri... | s437825103 | Accepted | 17 | 3,064 | 745 | s = str(input())
n = len(s)
lists = []
ans_list = []
Sum = 0
for i in range(2**n):
lists = []
ans_list = []
Sum = int(s[0])
for j in range(n-1):
if ((i >> j) & 1):
lists.append(1)
else:
lists.append(0)
for k in range(n-1):
ans_list.append(s[k])
... |
s811269551 | p02928 | u234636620 | 2,000 | 1,048,576 | Wrong Answer | 2,112 | 22,316 | 722 | We have a sequence of N integers A~=~A_0,~A_1,~...,~A_{N - 1}. Let B be a sequence of K \times N integers obtained by concatenating K copies of A. For example, if A~=~1,~3,~2 and K~=~2, B~=~1,~3,~2,~1,~3,~2. Find the inversion number of B, modulo 10^9 + 7. Here the inversion number of B is defined as the number of o... | import numpy as np
import sys
from functools import lru_cache
def main():
count = 0
n,k = map(int, input().split(' '))
a = [i for i in map(int, input().split(' '))]
for i in range(n):
moto = a[i]
for j in range(n):
if i == j:
continue
if moto > ... | s703232959 | Accepted | 572 | 13,412 | 587 | import numpy as np
import random
import sys
from functools import lru_cache
def main(n,k,a):
mod = 10**9 + 7
c1,c2 = 0,0
for i in range(len(a)):
for j in range(len(a)):
# print('--- ---', i,j)
if a[i] > a[j]:
if i < j:
c1... |
s970611206 | p02744 | u572026348 | 2,000 | 1,048,576 | Wrong Answer | 234 | 18,332 | 724 | In this problem, we only consider strings consisting of lowercase English letters. Strings s and t are said to be **isomorphic** when the following conditions are satisfied: * |s| = |t| holds. * For every pair i, j, one of the following holds: * s_i = s_j and t_i = t_j. * s_i \neq s_j and t_i \neq t_j. F... | import collections
def main():
n = int(input())
# if n == 1:
# print("a")
# bin_str = "0" + format(i, f'0{n-1}b')
# print(bin_str.replace("0", "a").replace("1", "b"))
ret = [[] for _ in range(10)]
ret[0] = ["a"]
alp = "abcdefghijklmnopqrstuvwxyz"
if n == 1:
... | s476764573 | Accepted | 264 | 14,852 | 748 | import collections
def main():
n = int(input())
# if n == 1:
# print("a")
# bin_str = "0" + format(i, f'0{n-1}b')
# print(bin_str.replace("0", "a").replace("1", "b"))
ret = [[] for _ in range(10)]
ret[0] = ["a"]
alp = "abcdefghijklmnopqrstuvwxyz"
if n == 1:
... |
s517783599 | p03160 | u969639186 | 2,000 | 1,048,576 | Wrong Answer | 131 | 20,576 | 305 | There are N stones, numbered 1, 2, \ldots, N. For each i (1 \leq i \leq N), the height of Stone i is h_i. There is a frog who is initially on Stone 1. He will repeat the following action some number of times to reach Stone N: * If the frog is currently on Stone i, jump to Stone i + 1 or Stone i + 2. Here, a cost of... | N = int(input())
H = list(map(int,input().split()))
DP = [float('inf')]*N
DP[0] = 0
DP[1] = abs(H[1] - H[0])
for i in range(2,N):
one_step = DP[i-1] + abs(H[i]-H[i-1])
two_step = DP[i-2] + abs(H[i]-H[i-2])
DP[i] = min(one_step,two_step)
print(DP)
print(DP[N-1]) | s977918065 | Accepted | 123 | 20,572 | 295 | N = int(input())
H = list(map(int,input().split()))
DP = [float('inf')]*N
DP[0] = 0
DP[1] = abs(H[1] - H[0])
for i in range(2,N):
one_step = DP[i-1] + abs(H[i]-H[i-1])
two_step = DP[i-2] + abs(H[i]-H[i-2])
DP[i] = min(one_step,two_step)
print(DP[N-1]) |
s418836546 | p02399 | u737311644 | 1,000 | 131,072 | Wrong Answer | 20 | 5,604 | 75 | Write a program which reads two integers a and b, and calculates the following values: * a ÷ b: d (in integer) * remainder of a ÷ b: r (in integer) * a ÷ b: f (in real number) | a,b=map(int,input().split())
d=str(a//b)
r=str(a%b)
f=str(a/b)
print(d,r,f) | s260745531 | Accepted | 20 | 5,608 | 80 | a,b= map(int, input().split())
d=a//b
r=a%b
f=a/b
print(d,r,"{0:.5f}".format(f)) |
s164964805 | p03408 | u506858457 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 188 | Takahashi has N blue cards and M red cards. A string is written on each card. The string written on the i-th blue card is s_i, and the string written on the i-th red card is t_i. Takahashi will now announce a string, and then check every card. Each time he finds a blue card with the string announced by him, he will ea... | N=int(input())
n=[input() for _ in range(N)]
M=int(input())
m=[input() for _ in range(M)]
l=list(set(n))
ans=0
for i in range(len(l)):
ans+=n.count(l[i])
ans-=m.count(l[i])
print(ans)
| s877620408 | Accepted | 17 | 3,064 | 221 | N=int(input())
n=[input() for _ in range(N)]
M=int(input())
m=[input() for _ in range(M)]
l=list(set(n))
ans=0
for i in range(len(l)):
tmp=0
tmp+=n.count(l[i])
tmp-=m.count(l[i])
ans=max(ans,tmp)
print(max(ans,0)) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.