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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s029447191 | p03385 | u279493135 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 69 | You are given a string S of length 3 consisting of `a`, `b` and `c`. Determine if S can be obtained by permuting `abc`. | S = input()
if sorted(S) == "abc":
print("Yes")
else:
print("No") | s628080388 | Accepted | 17 | 2,940 | 78 | S = input()
if "".join(sorted(S)) == "abc":
print("Yes")
else:
print("No") |
s898357660 | p02392 | u248424983 | 1,000 | 131,072 | Wrong Answer | 20 | 7,512 | 82 | Write a program which reads three integers a, b and c, and prints "Yes" if a < b < c, otherwise "No". | a,b,c = input().split(' ')
a=int(a)
b=int(b)
c=int(c)
ret="Yes" if a<b<c else "No" | s258868827 | Accepted | 30 | 7,660 | 93 | a,b,c = input().split(' ')
a=int(a)
b=int(b)
c=int(c)
ret="Yes" if a<b<c else "No"
print(ret) |
s955210711 | p04012 | u958506960 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 75 | Let w be a string consisting of lowercase letters. We will call w _beautiful_ if the following condition is satisfied: * Each lowercase letter of the English alphabet occurs even number of times in w. You are given the string w. Determine if w is beautiful. | w = input()
c = w.count('w')
print('Yes' if c % 2 == 0 and c > 0 else 'No') | s508129480 | Accepted | 21 | 3,316 | 163 | from collections import Counter
w = input()
c = Counter(w)
cnt = 0
for i in c.values():
if i % 2 == 0:
cnt += 1
print('Yes' if cnt == len(c) else 'No') |
s515781677 | p02256 | u853619096 | 1,000 | 131,072 | Wrong Answer | 30 | 7,640 | 124 | Write a program which finds the greatest common divisor of two natural numbers _a_ and _b_ | a,b=map(int,input().split())
z=[]
for i in range(min(a,b)):
if a%(i+1)==0 and b%(i+1)==0:
z+=[i+1]
print(min(z)) | s915406775 | Accepted | 20 | 5,600 | 132 | def gcd(a,b):
if b==0:
return a
else:
return gcd(b,a%b)
a,b=list(map(int,input().split()))
print(gcd(a,b))
|
s571629600 | p04043 | u265118937 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 132 | 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())
List=[a,b,c]
if List.count("5") == 2 and List.count("7") ==1:
print("YES")
else:
print("NO") | s776438103 | Accepted | 17 | 3,060 | 326 | a, b, c = map(int, input().split())
if b == 7:
if a == 5 and c == 5:
print("YES")
else:
print("NO")
elif c == 7:
if a == 5 and b == 5:
print("YES")
else:
print("NO")
elif a == 7 :
if b == 5 and c == 5:
print("YES")
else:
print("NO")
else:
print... |
s369418241 | p03719 | u239342230 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 52 | You are given three integers A, B and C. Determine whether C is not less than A and not greater than B. | print(['No','Yes'][eval(input().replace(' ','<='))]) | s017013050 | Accepted | 18 | 2,940 | 59 | a,b,c=map(int,input().split());print(['No','Yes'][a<=c<=b]) |
s922608133 | p03826 | u679817762 | 2,000 | 262,144 | Wrong Answer | 30 | 9,144 | 251 | There are two rectangles. The lengths of the vertical sides of the first rectangle are A, and the lengths of the horizontal sides of the first rectangle are B. The lengths of the vertical sides of the second rectangle are C, and the lengths of the horizontal sides of the second rectangle are D. Print the area of the r... |
lst = input().split()
for i in range(len(lst)):
lst[i] = int(lst[i])
area1 = lst[0] * lst[1]
area2 = lst[2] * lst[3]
areas = [area1, area2]
areas.sort()
print(areas[0]) | s113190914 | Accepted | 29 | 9,152 | 251 |
lst = input().split()
for i in range(len(lst)):
lst[i] = int(lst[i])
area1 = lst[0] * lst[1]
area2 = lst[2] * lst[3]
areas = [area1, area2]
areas.sort()
print(areas[1]) |
s985390984 | p02600 | u107267797 | 2,000 | 1,048,576 | Wrong Answer | 33 | 9,184 | 346 | M-kun is a competitor in AtCoder, whose highest rating is X. In this site, a competitor is given a _kyu_ (class) according to his/her highest rating. For ratings from 400 through 1999, the following kyus are given: * From 400 through 599: 8-kyu * From 600 through 799: 7-kyu * From 800 through 999: 6-kyu * Fr... | N = int(input())
if N >=400 or N <= 599:
print(8)
elif N >=600 or N <= 799:
print(7)
elif N >=800 or N <= 999:
print(6)
elif N >=1000 or N <= 1199:
print(5)
elif N >=1200 or N <= 1399:
print(4)
elif N >=1400 or N <= 1599:
print(3)
elif N >=1600 or N <= 1799:
print(2)
elif N >=1800 o... | s947984565 | Accepted | 33 | 9,180 | 354 | N = int(input())
if N >= 400 and N <= 599:
print(8)
elif N >= 600 and N <= 799:
print(7)
elif N >= 800 and N <= 999:
print(6)
elif N >= 1000 and N <= 1199:
print(5)
elif N >= 1200 and N <= 1399:
print(4)
elif N >= 1400 and N <= 1599:
print(3)
elif N >= 1600 and N <= 1799:
print(2)
elif N >=... |
s847706567 | p02390 | u798565376 | 1,000 | 131,072 | Wrong Answer | 20 | 5,572 | 41 | Write a program which reads an integer $S$ [second] and converts it to $h:m:s$ where $h$, $m$, $s$ denote hours, minutes (less than 60) and seconds (less than 60) respectively. | s = int(input())
h = (s % 3600)
print(h)
| s926199650 | Accepted | 20 | 5,584 | 135 | input_s = int(input())
h = input_s // 3600
rest_s = input_s % 3600
m = rest_s // 60
s = rest_s % 60
print('{}:{}:{}'.format(h, m, s))
|
s208200797 | p03563 | u207707177 | 2,000 | 262,144 | Wrong Answer | 18 | 3,188 | 701 | Takahashi is a user of a site that hosts programming contests. When a user competes in a contest, the _rating_ of the user (not necessarily an integer) changes according to the _performance_ of the user, as follows: * Let the current rating of the user be a. * Suppose that the performance of the user in the cont... | S2 = list(input())
T = list(input())
S = []
Temp = 0
for _ in range(len(S2)-len(T)+1):
for j in range(len(T)):
if T[j] == S2[Temp + j] or S2[Temp + j] == "?":
if j == len(T) - 1:
S.append([S2[x] for x in range(Temp)] + [T[x] for x in range(len(T))] + [S2[x] for x in range(Temp +... | s727187568 | Accepted | 19 | 2,940 | 54 | R = int(input())
G = int(input())
x = 2*G - R
print(x) |
s852725243 | p03436 | u088552457 | 2,000 | 262,144 | Wrong Answer | 38 | 4,072 | 684 | We have an H \times W grid whose squares are painted black or white. The square at the i-th row from the top and the j-th column from the left is denoted as (i, j). Snuke would like to play the following game on this grid. At the beginning of the game, there is a character called Kenus at square (1, 1). The player re... | from collections import deque
H, W = map(int, input().split())
f_inf = float('inf')
C = [input() for _ in range(H)]
def bfs():
dist = [[f_inf] * W for _ in range(H)]
D = ((1,0), (0,1), (-1,0), (0,-1))
que = deque([])
que.append((0,0))
dist[0][0] = 0
while que:
p = que.popleft()
for d in D:
... | s951229585 | Accepted | 26 | 3,316 | 660 | from collections import deque
H, W = map(int, input().split())
f_inf = float('inf')
C = [input() for _ in range(H)]
def bfs():
dist = [[False]*W for _ in range(H)]
D = ((1,0), (0,1), (-1,0), (0,-1))
que = deque([])
que.append((0,0))
dist[0][0] = 0
while que:
p = que.popleft()
for d in D:
... |
s142182394 | p03999 | u809819902 | 2,000 | 262,144 | Wrong Answer | 29 | 9,156 | 191 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. ... | s=input()
n=len(s)-1
ans=0
for i in range(2**n):
k=0
for j in range(n):
if i>>j&1:
ans+=int(s[k:j+1])
k=j+1
ans+=int(s[k:])
print(ans)
| s236093843 | Accepted | 31 | 9,080 | 189 | s=input()
n=len(s)-1
ans=0
for i in range(2**n):
k=0
for j in range(n):
if i>>j & 1:
ans+=int(s[k:j+1])
k=j+1
ans+=int(s[k:])
print(ans)
|
s166529169 | p03369 | u580236524 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 59 | 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 ... | t = input()
ans=700
for x in t:
if x=='o':
ans+=100
| s856951882 | Accepted | 17 | 2,940 | 69 | t = input()
ans=700
for x in t:
if x=='o':
ans+=100
print(ans) |
s997443996 | p02613 | u697386253 | 2,000 | 1,048,576 | Wrong Answer | 144 | 16,276 | 249 | 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())
s = []
for i in range(n):
s.append(input())
ac = s.count('AC')
wa = s.count('WA')
tle = s.count('TLE')
re = s.count('RE')
print('AC x ' + str(ac))
print('WA × ' + str(wa))
print('TLE × ' + str(tle))
print('RE × ' + str(re)) | s638875750 | Accepted | 147 | 16,180 | 247 | n = int(input())
s = []
for i in range(n):
s.append(input())
ac = s.count('AC')
wa = s.count('WA')
tle = s.count('TLE')
re = s.count('RE')
print('AC x ' + str(ac))
print('WA x ' + str(wa))
print('TLE x ' + str(tle))
print('RE x ' + str(re))
|
s961329745 | p04029 | u169221932 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 55 | There are N children in AtCoder Kindergarten. Mr. Evi will arrange the children in a line, then give 1 candy to the first child in the line, 2 candies to the second child, ..., N candies to the N-th child. How many candies will be necessary in total? | num = int(input())
sum = (num + 1) * num / 2
print(sum) | s660908102 | Accepted | 17 | 2,940 | 60 | num = int(input())
sum = (num + 1) * num / 2
print(int(sum)) |
s187861231 | p03836 | u707808519 | 2,000 | 262,144 | Wrong Answer | 20 | 3,316 | 465 | 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())
dx, dy = tx-sx, ty-sy
ans = []
for _ in range(dy):
ans.append('U')
for _ in range(dx):
ans.append('R')
for _ in range(dy):
ans.append('D')
for _ in range(dx):
ans.append('L')
ans.append('L')
for _ in range(dy+1):
ans.append('U')
for _ in range(dx+1):
an... | s185380303 | Accepted | 17 | 3,060 | 187 | sx, sy, tx, ty = map(int, input().split())
dx, dy = tx-sx, ty-sy
S = 'U'*dy + 'R'*dx + 'D'*dy + 'L'*dx + 'L' + 'U'*(dy+1) + 'R'*(dx+1) + 'D' + 'R' + 'D'*(dy+1) + 'L'*(dx+1) + 'U'
print(S) |
s810383354 | p03712 | u302292660 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 227 | 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. | h,w = map(int,input().split())
L = []
L.append(["#"]*(w+2))
for i in range(h):
l=["#"]
l.append(input())
l.append("#")
print(l)
L.append(l)
L.append(["#"]*(w+2))
for i in range(h+2):
print("".join(L[i])) | s373219494 | Accepted | 17 | 3,060 | 214 | h,w = map(int,input().split())
L = []
L.append(["#"]*(w+2))
for i in range(h):
l=["#"]
l.append(input())
l.append("#")
L.append(l)
L.append(["#"]*(w+2))
for i in range(h+2):
print("".join(L[i])) |
s652817159 | p03400 | u903596281 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 108 | 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())
ans=X
for i in range(N):
ans+=1+(N-1)//int(input())
print(ans) | s401134921 | Accepted | 17 | 2,940 | 108 | N=int(input())
D,X=map(int,input().split())
ans=X
for i in range(N):
ans+=1+(D-1)//int(input())
print(ans) |
s830818201 | p02417 | u100813820 | 1,000 | 131,072 | Wrong Answer | 20 | 7,348 | 10 | Write a program which counts and reports the number of each alphabetical letter. Ignore the case of characters. | import sys | s386947446 | Accepted | 40 | 7,392 | 1,060 | # 17-Character-Counting_Characters.py
# ?????????????????????
# Input
# Output
# a : a????????°
# .
# .
# Constraints
# Sample Input
# This is a pen.
# Sample Output
# a : 1
# b : 0
# c : 0
# d : 0
# f : 0
# g : 0
# h : 1
# j : 0
# l : 0
# m : 0
# n : 1
# p : 1
# r : 0
# t : 1
# w : 0
# x : 0
... |
s361774488 | p03957 | u181431922 | 1,000 | 262,144 | Wrong Answer | 18 | 2,940 | 113 | This contest is `CODEFESTIVAL`, which can be shortened to the string `CF` by deleting some characters. Mr. Takahashi, full of curiosity, wondered if he could obtain `CF` from other strings in the same way. You are given a string s consisting of uppercase English letters. Determine whether the string `CF` can be obtai... | s = input()
a = s.find('C')
if a == -1:
print("No")
else:
if s[a:].find('F') == -1:
print("Yes") | s825248107 | Accepted | 18 | 2,940 | 135 | s = input()
a = s.find('C')
if a == -1:
print("No")
else:
if s[a:].find('F') == -1:
print("No")
else: print("Yes") |
s687847524 | p02678 | u252828980 | 2,000 | 1,048,576 | Wrong Answer | 2,268 | 2,213,304 | 648 | 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 scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra
n,m = map(int,input().split())
d = [[0]*n for i in range(n)]
for i in range(m):
a,b = map(int,input().split())
a,b = a-1,b-1
d[a][b] = 1
d[b][a] = 1
#print(d)
d = dijkstra(d)
#print(d)
li = []
for i in range(1,n):
for j in ran... | s048021853 | Accepted | 646 | 35,160 | 572 | n,m = map(int,input().split())
d = [[] for _ in range(n+1)]
for i in range(m):
a,b = map(int,input().split())
#a,b = a-1,b-1
d[a].append(b)
d[b].append(a)
#print(d)
from collections import deque
q = deque([1])
visited = [False]*(n+1)
visited[1] = True
signpost = [False]*(n+1)
while q:
k = q.pople... |
s525758277 | p03612 | u903005414 | 2,000 | 262,144 | Wrong Answer | 302 | 23,416 | 293 | You are given a permutation p_1,p_2,...,p_N consisting of 1,2,..,N. You can perform the following operation any number of times (possibly zero): Operation: Swap two **adjacent** elements in the permutation. You want to have p_i ≠ i for all 1≤i≤N. Find the minimum required number of operations to achieve this. | import numpy as np
N = int(input())
p = np.array(list(map(int, input().split())))
v = p == np.arange(1, N + 1)
print('v', v)
ans = 0
for i in range(N):
if i == N - 1 and v[i]:
ans += 1
continue
if v[i]:
v[i], v[i + 1] = False, False
ans += 1
print(ans)
| s817069851 | Accepted | 227 | 23,416 | 295 | import numpy as np
N = int(input())
p = np.array(list(map(int, input().split())))
v = p == np.arange(1, N + 1)
# print('v', v)
ans = 0
for i in range(N):
if i == N - 1 and v[i]:
ans += 1
continue
if v[i]:
v[i], v[i + 1] = False, False
ans += 1
print(ans)
|
s608198282 | p03535 | u785989355 | 2,000 | 262,144 | Wrong Answer | 25 | 3,536 | 1,221 | In CODE FESTIVAL XXXX, there are N+1 participants from all over the world, including Takahashi. Takahashi checked and found that the _time gap_ (defined below) between the local times in his city and the i-th person's city was D_i hours. The time gap between two cities is defined as follows. For two cities A and B, if... |
N=int(input())
D=list(map(int,input().split()))
flg =False
A = [0 for i in range(13)]
A[0]=1
for i in range(N):
j = min(i,24-i)
if j==0:
flg=True
break
elif j==12:
if A[j]==1:
flg=True
break
else:
A[j]+=1
else:
if A[j]==2:
... | s868602829 | Accepted | 28 | 3,536 | 1,238 | N=int(input())
D=list(map(int,input().split()))
flg =False
A = [0 for i in range(13)]
A[0]=1
for i in range(N):
j = min(D[i],24-D[i])
if j==0:
flg=True
break
elif j==12:
if A[j]==1:
flg=True
break
else:
A[j]+=1
else:
if A[j]==2... |
s723663163 | p02357 | u686180487 | 2,000 | 262,144 | Wrong Answer | 20 | 5,600 | 322 | For a given array $a_1, a_2, a_3, ... , a_N$ of $N$ elements and an integer $L$, find the minimum of each possible sub-arrays with size $L$ and print them from the beginning. For example, for an array $\\{1, 7, 7, 4, 8, 1, 6\\}$ and $L = 3$, the possible sub-arrays with size $L = 3$ includes $\\{1, 7, 7\\}$, $\\{7, 7, ... | # -*- coding: utf-8 -*-
N,L = list(map(int, input().split()))
alist = list(map(int, input().split()))
def printMax(arr, n, k):
max = 0
for i in range(n - k + 1):
max = arr[i]
for j in range(1, k):
if arr[i + j] > max:
max = arr[i + j]
print(str(max) + " ", end = "")
printMax(alist, N, L)
... | s612640323 | Accepted | 2,890 | 120,916 | 401 | # -*- coding: utf-8 -*-
N,L = list(map(int, input().split()))
alist = list(map(int, input().split()))
arr = []
for i in range(L):
while arr and alist[i] <= alist[arr[-1]]:
arr.pop()
arr.append(i)
for i in range(L, N):
print(alist[arr[0]], end=' ')
while arr and arr[0] <= i-L:
arr.pop(0)
while arr and... |
s781232537 | p03485 | u426964396 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 54 | You are given two positive integers a and b. Let x be the average of a and b. Print x rounded up to the nearest integer. | a,b=input().split()
a=int(a)
b=int(b)
print((a+b+1)/2) | s879898027 | Accepted | 17 | 2,940 | 75 | import math
print(int(math.ceil(sum([int(x) for x in input().split()])/2))) |
s561850179 | p04043 | u883048396 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 83 | 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 ... |
if input().rstrip in ("5 5 7","5 7 5","7 5 5"):
print("YES")
else:
print("NO") | s978501465 | Accepted | 17 | 2,940 | 90 |
if input().rstrip() in ("5 5 7","5 7 5","7 5 5"):
print("YES")
else:
print("NO")
|
s023324910 | p03471 | u225642513 | 2,000 | 262,144 | Wrong Answer | 977 | 3,060 | 286 | The commonly used bills in Japan are 10000-yen, 5000-yen and 1000-yen bills. Below, the word "bill" refers to only these. According to Aohashi, he received an otoshidama (New Year money gift) envelope from his grandfather that contained N bills for a total of Y yen, but he may be lying. Determine whether such a situat... | N,Y = map(int, input().split())
a = Y//10000
b = (Y%10000)//5000
c = (Y%5000)//1000
for i in range(a+1):
x = a-i
y = b + i * 2
for i in range(y+1):
z = c + i * 5
if x+y+z == N:
print("{} {} {}".format(x,y,z))
exit()
print("-1 -1 -1") | s746719603 | Accepted | 37 | 3,060 | 332 | N,Y = map(int, input().split())
a = Y//10000
b = (Y%10000)//5000
c = (Y%5000)//1000
for i in range(a+1):
x = a-i
y = b + i * 2
for j in range(y+1):
z = c + j * 5
if x+y-j+z == N:
print("{} {} {}".format(x,y-j,z))
exit()
if x+y-j+z > N:
break
print(... |
s358570155 | p02608 | u646130340 | 2,000 | 1,048,576 | Wrong Answer | 2,206 | 19,056 | 418 | Let f(n) be the number of triples of integers (x,y,z) that satisfy both of the following conditions: * 1 \leq x,y,z * x^2 + y^2 + z^2 + xy + yz + zx = n Given an integer N, find each of f(1),f(2),f(3),\ldots,f(N). | N = int(input())
def perfect_number(x, y, z):
n = x**2 + y**2 + z**2 + x*y + y*z + z*x
return n
l = []
for x in range(1, N):
for y in range(1, N):
for z in range(1, N):
n = perfect_number(x,y,z)
if n > N:
break
else:
l.append(n)
counts = [l.count(x) for x in sorted(set(l))]... | s482646214 | Accepted | 300 | 19,856 | 479 | N = int(input())
def calculate_n(x, y, z):
n = x**2 + y**2 + z**2 + x*y + y*z + z*x
return n
l = []
for x in range(1, N):
for y in range(1, N):
for z in range(1, N):
n = calculate_n(x,y,z)
if n > N:
break
else:
l.append(n)
if calculate_n(x, y+1, 1) > N:
break
if... |
s869351663 | p03433 | u717993780 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 113 | 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())
li = sorted(map(int,input().split()),reverse=True)
ans = sum(li[::2]) - sum(li[1::2])
print(ans) | s097889092 | Accepted | 17 | 2,940 | 86 | n = int(input())
a = int(input())
if n % 500 <= a:
print("Yes")
else:
print("No") |
s537040418 | p03471 | u096983897 | 2,000 | 262,144 | Wrong Answer | 779 | 3,064 | 385 | The commonly used bills in Japan are 10000-yen, 5000-yen and 1000-yen bills. Below, the word "bill" refers to only these. According to Aohashi, he received an otoshidama (New Year money gift) envelope from his grandfather that contained N bills for a total of Y yen, but he may be lying. Determine whether such a situat... | def main():
num, money = map(int, input().split())
array = [-1,-1,-1]
for i in range(num+1):
for j in range(num+1):
if i + j > num:
continue
sum = i*10000 + j*5000 + (num-i-j)*1000
if sum == money:
array[0]=i
array[1]=j
array[2]=num-i-j
break
pri... | s068247001 | Accepted | 772 | 3,060 | 370 | def main():
num, money = map(int, input().split())
array = [-1,-1,-1]
for i in range(num+1):
for j in range(num+1):
if i + j > num:
continue
sum = i*10000 + j*5000 + (num-i-j)*1000
if sum == money:
array[0]=i
array[1]=j
array[2]=num-i-j
break
pri... |
s643067437 | p03574 | u027622859 | 2,000 | 262,144 | Wrong Answer | 28 | 3,064 | 536 | You are given an H × W grid. The squares in the grid are described by H strings, S_1,...,S_H. The j-th character in the string S_i corresponds to the square at the i-th row from the top and j-th column from the left (1 \leq i \leq H,1 \leq j \leq W). `.` stands for an empty square, and `#` stands for a square con... | h, w = map(int, input().split())
s = [input() for i in range(h)]
print(s)
way = ((1,1),(1,0),(1,-1),(0,1),(0,-1),(-1,0),(-1,1),(-1,-1))
ans = [[0 for j in range(w)] for i in range(h)]
for i in range(h):
for j in range(w):
if s[i][j] == "#":
ans[i][j] = "#"
continue
for k in ... | s894339016 | Accepted | 32 | 3,444 | 688 | H, W = map(int, input().split())
s = [list(input())for _ in range(H)]
grid = [(-1,-1),(-1,1),(1,-1),(1,1),(1,0),(0,1),(-1,0),(0,-1)]
for y in range(H):
for x in range(W):
count = 0
if s[y][x] == '#':
print('#', end='')
else:
for g in grid:
try:
... |
s242460944 | p03880 | u729133443 | 2,000 | 262,144 | Wrong Answer | 111 | 7,068 | 220 | A cheetah and a cheater are going to play the game of Nim. In this game they use N piles of stones. Initially the i-th pile contains a_i stones. The players take turns alternately, and the cheetah plays first. In each turn, the player chooses one of the piles, and takes one or more stones from the pile. The player who ... | n,*a=map(int,open(0))
x=0
c=[0]*30
for i in a:
x^=i
c[bin(i^i-1)[::-1].rfind('1')]=1
a=0
for i in range(29,-1,-1):
if x&2**i:
if c[i]:
a+=1
x^=2**i-1
else:
print(-1)
break
else:
print(a) | s004252308 | Accepted | 110 | 7,068 | 226 | n,*a=map(int,open(0))
x=0
c=[0]*30
for i in a:
x^=i
c[bin(i^i-1)[::-1].rfind('1')]=1
a=0
for i in range(29,-1,-1):
if x&2**i:
if c[i]:
a+=1
x^=2**i-1
else:
print(-1)
break
else:
print(a) |
s940693591 | p03163 | u864013199 | 2,000 | 1,048,576 | Wrong Answer | 2,120 | 169,868 | 351 | There are N items, numbered 1, 2, \ldots, N. For each i (1 \leq i \leq N), Item i has a weight of w_i and a value of v_i. Taro has decided to choose some of the N items and carry them home in a knapsack. The capacity of the knapsack is W, which means that the sum of the weights of items taken must be at most W. Find ... | import sys
input = sys.stdin.readline
N,W = map(int,input().split())
dp = [[0]*(W+1) for _ in range(N+1)]
for i in range(N):
w,v = map(int,input().split())
for j in range(W+1):
if j+w <= W:
dp[i+1][j+w] = dp[i][j]+v
dp[i+1][j] = max(dp[i+1][j],dp[i][j])
print(dp)
print(dp[N][W])
| s897498032 | Accepted | 172 | 14,684 | 275 | import numpy as np
import sys
input = sys.stdin.readline
N,W = map(int,input().split())
dp = np.zeros(W+1, dtype=np.int64)
for i in range(N):
w,v = map(int,input().split())
np.maximum(dp[:-w]+v, dp[w:], out = dp[w:])
print(dp[-1])
|
s534282640 | p03739 | u268516119 | 2,000 | 262,144 | Wrong Answer | 110 | 14,332 | 648 | You are given an integer sequence of length N. The i-th term in the sequence is a_i. In one operation, you can select a term and either increment or decrement it by one. At least how many operations are necessary to satisfy the following conditions? * For every i (1≤i≤n), the sum of the terms from the 1-st through ... | import sys
fastinput=sys.stdin.readline
n=int(fastinput())
ai=[int(i) for i in fastinput().split()]
goukei=0
sousa=0
for a in ai:
goukei+=a
if a%2:
if goukei<=0:
sousa+=1-goukei
goukei=1
else:#odd:minus
if goukei>=0:
sousa+=goukei+1
goukei=-1
... | s274727772 | Accepted | 125 | 15,100 | 674 | import sys
fastinput=sys.stdin.readline
n=int(fastinput())
ai=[int(i) for i in fastinput().split()]
goukei=0
sousa=0
for k,a in enumerate(ai):
goukei+=a
if not k%2:
if goukei<=0:
sousa+=1-goukei
goukei=1
else:#odd:minus
if goukei>=0:
sousa+=goukei+1
... |
s187030040 | p02608 | u991619971 | 2,000 | 1,048,576 | Wrong Answer | 1,034 | 27,068 | 653 | Let f(n) be the number of triples of integers (x,y,z) that satisfy both of the following conditions: * 1 \leq x,y,z * x^2 + y^2 + z^2 + xy + yz + zx = n Given an integer N, find each of f(1),f(2),f(3),\ldots,f(N). | import numpy as np
#import functools
#from itertools import combinations as comb
#from itertools import combinations_with_replacement as comb_with
#from itertools import permutations as perm
#import collections as C #most_common
#import math
#import sympy
N = int(input())
#N,K,d= map(int,input().split())
#A = list(ma... | s096664546 | Accepted | 974 | 26,544 | 405 | import numpy as np
N = int(input())
#N,K,d= map(int,input().split())
#A = list(map(int,input().split()))
#S = str(input())
#T = str(input())
num=np.zeros(10**4+1)
for x in range(1,100):
for y in range(1,100):
for z in range(1,100):
ans = x**2 + y**2 + z**2 + x*y + y*z + z*x
if ans ... |
s626199453 | p03338 | u113255362 | 2,000 | 1,048,576 | Wrong Answer | 29 | 9,100 | 241 | You are given a string S of length N consisting of lowercase English letters. We will cut this string at one position into two strings X and Y. Here, we would like to maximize the number of different letters contained in both X and Y. Find the largest possible number of different letters contained in both X and Y when ... | N=int(input())
S=input()
s=""
m=""
ss=[]
mm=[]
s1=set()
m1=set()
res = 0
for i in range(N):
s=S[0:i]
m=S[i+1:N]
ss=list(s)
mm=list(m)
s1=set(ss)
m1=set(mm)
s_intersection = s1 & m1
res= max(res,len(s_intersection))
print(res) | s802285797 | Accepted | 30 | 9,192 | 243 | N=int(input())
S=input()
s=""
m=""
ss=[]
mm=[]
s1=set()
m1=set()
res = 0
for i in range(N):
s=S[0:i+1]
m=S[i+1:N]
ss=list(s)
mm=list(m)
s1=set(ss)
m1=set(mm)
s_intersection = s1 & m1
res= max(res,len(s_intersection))
print(res) |
s355985456 | p03854 | u744034042 | 2,000 | 262,144 | Wrong Answer | 17 | 3,188 | 204 | You are given a string S consisting of lowercase English letters. Another string T is initially empty. Determine whether it is possible to obtain S = T by performing the following operation an arbitrary number of times: * Append one of the following at the end of T: `dream`, `dreamer`, `erase` and `eraser`. | s = input()
u = ['dreamer', 'eraser', 'dream', 'erase']
while len(s) > 0:
for i in u:
if s[0:len(i)] == i:
s = s.lstrip(i)
else:
print("NO")
exit()
print("YES") | s081403770 | Accepted | 18 | 3,188 | 139 | s = input().replace('eraser','').replace('erase','').replace('dreamer','').replace('dream','')
if s:
print('NO')
else:
print('YES') |
s372240669 | p03359 | u229518917 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 71 | In AtCoder Kingdom, Gregorian calendar is used, and dates are written in the "year-month-day" order, or the "month-day" order without the year. For example, May 3, 2018 is written as 2018-5-3, or 5-3 without the year. In this country, a date is called _Takahashi_ when the month and the day are equal as numbers. For ... | a,b= map(int,input().split())
if b>a:
print(a)
else:
print(a-1) | s087600591 | Accepted | 17 | 2,940 | 72 | a,b= map(int,input().split())
if b>=a:
print(a)
else:
print(a-1) |
s798447091 | p03998 | u729133443 | 2,000 | 262,144 | Wrong Answer | 19 | 3,188 | 419 | 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. * ... | sa=list(input())
sb=list(input())
sc=list(input())
ia=0
ib=0
ic=0
a=len(sa)
b=len(sb)
c=len(sc)
t=0
while True:
if t==0:
if ia == a:
print('a')
break
t=abs(int(ord('a')-ord(sa[ia])))
ia+=1
elif t==1:
if ib == b:
print('b')
break
t=abs(int(ord('a')-ord(sb[ib])))
ib+=1
... | s068264626 | Accepted | 18 | 2,940 | 80 | d={i:list(input())for i in'abc'};i='a'
while d[i]:i=d[i].pop(0)
print(i.upper()) |
s772229565 | p03813 | u367130284 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 98 | Smeke has decided to participate in AtCoder Beginner Contest (ABC) if his current rating is less than 1200, and participate in AtCoder Regular Contest (ARC) otherwise. You are given Smeke's current rating, x. Print `ABC` if Smeke will participate in ABC, and print `ARC` otherwise. | i=int(input())
ans=i//11*2
if 0<i%11<=6:
ans+=1
elif i%11==0:
ans+=0
else:
ans+=2
print(ans) | s740985746 | Accepted | 17 | 2,940 | 35 | print("A"+"RB"[input()<"1200"]+"C") |
s343293735 | p02614 | u679390859 | 1,000 | 1,048,576 | Wrong Answer | 80 | 9,352 | 642 | We have a grid of H rows and W columns of squares. The color of the square at the i-th row from the top and the j-th column from the left (1 \leq i \leq H, 1 \leq j \leq W) is given to you as a character c_{i,j}: the square is white if c_{i,j} is `.`, and black if c_{i,j} is `#`. Consider doing the following operation... | H,W,K = map(int,input().split())
L = []
for _ in range(H):
l = list(input())
L.append(l)
import copy
ans =0
for x in range(2 ** H):
for y in range(2 ** W):
c = copy.copy(L)
for i in range(H):
if x & (1 << i):
for yoko in range(W):
c[i][yoko] =... | s717559985 | Accepted | 163 | 9,264 | 646 | H,W,K = map(int,input().split())
L = []
for _ in range(H):
l = list(input())
L.append(l)
import copy
ans =0
for x in range(2 ** H):
for y in range(2 ** W):
c = copy.deepcopy(L)
for i in range(H):
if x & (1 << i):
for yoko in range(W):
c[i][yok... |
s591421073 | p03385 | u269969976 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 107 | You are given a string S of length 3 consisting of `a`, `b` and `c`. Determine if S can be obtained by permuting `abc`. | # -*- coding: utf-8 -*-
print("yes" if "".join(sorted([i for i in input().rstrip()])) == "abc" else "no")
| s871992197 | Accepted | 17 | 2,940 | 107 | # -*- coding: utf-8 -*-
print("Yes" if "".join(sorted([i for i in input().rstrip()])) == "abc" else "No")
|
s159726984 | p03379 | u816587940 | 2,000 | 262,144 | Wrong Answer | 897 | 60,448 | 368 | When l is an odd number, the median of l numbers a_1, a_2, ..., a_l is the (\frac{l+1}{2})-th largest value among a_1, a_2, ..., a_l. You are given N numbers X_1, X_2, ..., X_N, where N is an even number. For each i = 1, 2, ..., N, let the median of X_1, X_2, ..., X_N excluding X_i, that is, the median of X_1, X_2, ..... | import numpy as np
n = int(input())
a = list(map(int, input().split()))
b = []
for i in range(n):
b.append([a[i], i])
b = sorted(b, key=lambda x: x[0], reverse=False)
for i in range(n):
if i<n//2:
b[i].append(b[n//2-1][0])
else:
b[i].append(b[n//2][0])
b = sorted(b, key=lambda x: x[1], rever... | s432447003 | Accepted | 716 | 51,392 | 349 | n = int(input())
a = list(map(int, input().split()))
b = []
for i in range(n):
b.append([a[i], i])
b = sorted(b, key=lambda x: x[0], reverse=False)
for i in range(n):
if i<n//2:
b[i].append(b[n//2][0])
else:
b[i].append(b[n//2-1][0])
b = sorted(b, key=lambda x: x[1], reverse=False)
for i in ... |
s466448083 | p03644 | u555356625 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 78 | Takahashi loves numbers divisible by 2. You are given a positive integer N. Among the integers between 1 and N (inclusive), find the one that can be divisible by 2 for the most number of times. The solution is always unique. Here, the number of times an integer can be divisible by 2, is how many times the integer can... | n = int(input())
cnt = 0
while n%2 == 0:
n = n / 2
cnt += 1
print(cnt) | s350564873 | Accepted | 17 | 2,940 | 78 | n = int(input())
for i in range(7):
if n >= 2**i:
ans = 2**i
print(ans) |
s616905914 | p02612 | u925478395 | 2,000 | 1,048,576 | Wrong Answer | 31 | 9,144 | 42 | We will buy a product for N yen (the currency of Japan) at a shop. If we use only 1000-yen bills to pay the price, how much change will we receive? Assume we use the minimum number of bills required. | a = int(input())
ans = a % 1000
print(ans) | s217521392 | Accepted | 33 | 9,164 | 83 | a = int(input())
b = a % 1000
if b != 0:
ans = 1000 - b
else:
ans = b
print(ans) |
s366968843 | p03730 | u776311944 | 2,000 | 262,144 | Wrong Answer | 30 | 9,164 | 167 | 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())
calc = 0
for i in range(1000):
calc += A
rem = calc % B
if rem == C:
print('Yes')
exit()
print('No')
| s770204073 | Accepted | 28 | 9,160 | 167 | A, B, C = map(int, input().split())
calc = 0
for i in range(1000):
calc += A
rem = calc % B
if rem == C:
print('YES')
exit()
print('NO')
|
s038260698 | p02264 | u604774382 | 1,000 | 131,072 | Wrong Answer | 30 | 6,716 | 333 | _n_ _q_ _name 1 time1_ _name 2 time2_ ... _name n timen_ In the first line the number of processes _n_ and the quantum _q_ are given separated by a single space. In the following _n_ lines, names and times for the _n_ processes are given. _name i_ and _time i_ are separated by a single space. | n, q = [ int( val ) for val in input( ).split( " " ) ]
ps = [0]*n
t = [0]*n
for i in range( n ):
ps[i], t[i] = input( ).split( " " )
output = []
qsum = 0
while t:
psi = ps.pop( 0 )
ti = int( t.pop( 0 ) )
if ti <= q:
qsum += ti
output.append( psi+" "+str( qsum ) )
else:
t.append( ti - q )
ps.append( psi ... | s332497154 | Accepted | 440 | 21,232 | 527 | from collections import deque
n, q = [ int( val ) for val in input( ).split( " " ) ]
processes = deque( )
for i in range( n ):
name, time = input( ).split( " " )
processes.append( ( name, int( time ) ) )
qsum = 0
output = []
while len( processes ):
process = processes.popleft( )
if process[1] <= q:
... |
s288724810 | p03795 | u739480378 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 90 | Snuke has a favorite restaurant. The price of any meal served at the restaurant is 800 yen (the currency of Japan), and each time a customer orders 15 meals, the restaurant pays 200 yen back to the customer. So far, Snuke has ordered N meals at the restaurant. Let the amount of money Snuke has paid to the restaurant ... | import math
N=int(input())
power=math.factorial(N)
v=10**9+7
answer=power%v
print(answer)
| s228872409 | Accepted | 17 | 2,940 | 50 | N=int(input())
x=800*N
v=N//15
y=200*v
print(x-y)
|
s742020473 | p04011 | u987164499 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 253 | 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. | from sys import stdin
from itertools import combinations
n = int(stdin.readline().rstrip())
k = int(stdin.readline().rstrip())
x = int(stdin.readline().rstrip())
y = int(stdin.readline().rstrip())
if n <= k:
print(x*n)
else:
print(x*n+y*(n-k)) | s697240129 | Accepted | 17 | 2,940 | 219 | from sys import stdin
n = int(stdin.readline().rstrip())
k = int(stdin.readline().rstrip())
x = int(stdin.readline().rstrip())
y = int(stdin.readline().rstrip())
if n <= k:
print(x*n)
else:
print(x*k+y*(n-k))
|
s521057598 | p03455 | u844196583 | 2,000 | 262,144 | Wrong Answer | 24 | 9,012 | 100 | AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd. | a, b = map(int, input().split())
if a*b-int(a*b/2)*2 == 0:
print('Odd')
else:
print('Even') | s830047842 | Accepted | 27 | 9,004 | 100 | a, b = map(int, input().split())
if a*b-int(a*b/2)*2 == 0:
print('Even')
else:
print('Odd') |
s200430976 | p03860 | u223646582 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 44 | Snuke is going to open a contest named "AtCoder s Contest". Here, s is a string of length 1 or greater, where the first character is an uppercase English letter, and the second and subsequent characters are lowercase English letters. Snuke has decided to abbreviate the name of the contest as "AxC". Here, x is the uppe... | s=input().split()[1]
print('A{}C'.format(s)) | s181735173 | Accepted | 17 | 2,940 | 47 | s=input().split()[1][0]
print('A{}C'.format(s)) |
s668282650 | p03448 | u630666565 | 2,000 | 262,144 | Wrong Answer | 314 | 3,440 | 646 | 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... | #-*- coding: utf-8 -*-
a = int(input())
b = int(input())
c = int(input())
x = int(input())
def combi(x, a, b):
ans = 0
b_num = []
if a == 0 and b != 0:
if x/b == 0:
ans += 1
b_num.append(x)
elif a != 0 and b == 0:
if x/a == 0:
ans += 1
elif a == 0... | s475174459 | Accepted | 49 | 3,060 | 258 | # -*- coding: utf-8 -*-
A = int(input())
B = int(input())
C = int(input())
X = int(input())
ans = 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:
ans += 1
print(ans) |
s235664382 | p03370 | u189487046 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 99 | Akaki, a patissier, can make N kinds of doughnut using only a certain powder called "Okashi no Moto" (literally "material of pastry", simply called Moto below) as ingredient. These doughnuts are called Doughnut 1, Doughnut 2, ..., Doughnut N. In order to make one Doughnut i (1 ≤ i ≤ N), she needs to consume m_i grams o... | N,X = map(int, input().split())
li = [int(input()) for i in range(N)]
print(N+(sum(li)//min(li)))
| s129987963 | Accepted | 17 | 2,940 | 101 | N,X = map(int, input().split())
li = [int(input()) for i in range(N)]
print(N+(X-sum(li))//min(li))
|
s019940477 | p02608 | u229518917 | 2,000 | 1,048,576 | Wrong Answer | 41 | 9,752 | 479 | Let f(n) be the number of triples of integers (x,y,z) that satisfy both of the following conditions: * 1 \leq x,y,z * x^2 + y^2 + z^2 + xy + yz + zx = n Given an integer N, find each of f(1),f(2),f(3),\ldots,f(N). | N=int(input())
ans=0
mul=1
while ans<=N:
ans=6*(mul**2)
mul+=1
ANS={}
for i in range(1,mul+1):
for j in range(i,mul+1):
for k in range(j,mul+1):
if i!=j and j!=k:
ANS[i*i+j*j+k*k+i*j+j*k+i*k]=6
elif i==j and j==k:
ANS[i*i+j*j+k*k+i*j+j*k+i*k]=1... | s281439257 | Accepted | 222 | 11,336 | 861 | N=int(input())
ans=0
mul=1
while ans<=N:
ans=6*(mul**2)
mul+=1
ANS={}
for i in range(1,101):
for j in range(i,101):
for k in range(j,101):
if (i*i+j*j+k*k+i*j+j*k+i*k) not in ANS.keys():
if i!=j and j!=k and k!=i:
ANS[i*i+j*j+k*k+i*j+j*k+i*k]=6
... |
s932375497 | p03455 | u648011094 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 128 | AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd. | # -*- coding: utf-8 -*-
a, b = map(int, input().split())
if a * b % 2 == 0:
print("even")
else:
print("odd")
| s647272450 | Accepted | 17 | 2,940 | 128 | # -*- coding: utf-8 -*-
a, b = map(int, input().split())
if a * b % 2 == 0:
print("Even")
else:
print("Odd")
|
s098487359 | p03079 | u231905444 | 2,000 | 1,048,576 | Wrong Answer | 18 | 2,940 | 104 | You are given three integers A, B and C. Determine if there exists an equilateral triangle whose sides have lengths A, B and C. | arr=list(map(int,input().split()))
if(arr.count(arr[0])==3):
print('yes')
else:
print('no')
| s091627244 | Accepted | 17 | 2,940 | 100 | arr=list(map(int,input().split()))
if(arr.count(arr[0])==3):
print('Yes')
else:
print('No')
|
s402147339 | p03836 | u405256066 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 325 | 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 ... | from sys import stdin
sx,sy,tx,ty = [int(x) for x in stdin.readline().rstrip().split()]
ans = ""
ans += (ty-sy)*"U"
ans += (tx-sx)*"R"
ans2 = ans.replace("R","tmp").replace("L","R").replace("tmp","L")
ans2 = ans2.replace("U","tmp").replace("D","U").replace("tmp","D")
ans = ans + "LU"+ans+"RD" + "RD" + ans2 + "LU"
print... | s850590239 | Accepted | 17 | 3,064 | 331 | from sys import stdin
sx,sy,tx,ty = [int(x) for x in stdin.readline().rstrip().split()]
ans = ""
ans += (ty-sy)*"U"
ans += (tx-sx)*"R"
ans2 = ans.replace("R","tmp").replace("L","R").replace("tmp","L")
ans2 = ans2.replace("U","tmp").replace("D","U").replace("tmp","D")
ans = ans + ans2 +"LU"+ans+"RD" + "RD" + ans2 + "LU"... |
s838388455 | p02646 | u746154235 | 2,000 | 1,048,576 | Wrong Answer | 24 | 9,208 | 208 | 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 A == B:
print('YES')
exit(0)
print(T*V+A)
print(T*W+B)
if ((T*V+A) - (T*W+B) >=0):
print("YES")
else:
print("NO")
| s782138942 | Accepted | 22 | 9,188 | 231 | A,V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())
if A < B:
if (T*V+A) >= (T*W+B):
print("YES")
else:
print("NO")
else:
if (A-T*V) <= (B-T*W):
print("YES")
else:
print("NO")
|
s989963732 | p03359 | u644778646 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 81 | In AtCoder Kingdom, Gregorian calendar is used, and dates are written in the "year-month-day" order, or the "month-day" order without the year. For example, May 3, 2018 is written as 2018-5-3, or 5-3 without the year. In this country, a date is called _Takahashi_ when the month and the day are equal as numbers. For ... | a,b = map(int,input().split())
if a >= b:
print(a-1)
else:
print(a)
| s587811959 | Accepted | 17 | 2,940 | 80 | a,b = map(int,input().split())
if a > b:
print(a-1)
else:
print(a)
|
s468720697 | p02831 | u185424824 | 2,000 | 1,048,576 | Wrong Answer | 34 | 2,940 | 108 | Takahashi is organizing a party. At the party, each guest will receive one or more snack pieces. Takahashi predicts that the number of guests at this party will be A or B. Find the minimum number of pieces that can be evenly distributed to the guests in both of the cases predicted. We assume that a piece cannot be ... | A,B = map(int,input().split())
C = 0
while C == 0:
if A % B == 0:
C = 1
else:
A += 1
print(A) | s428649614 | Accepted | 35 | 2,940 | 111 | A,B = map(int,input().split())
C = 0
for i in range(B):
if A * (i+1) % B == 0:
print(A*(i+1))
break |
s187757503 | p03730 | u046592970 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 141 | 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... | import sys
a,b,c = map(int,input().split())
for i in range(1,b+1):
if a*i % b == c:
print("Yes")
sys.exit()
print("No") | s858034123 | Accepted | 17 | 2,940 | 141 | import sys
a,b,c = map(int,input().split())
for i in range(1,b+1):
if a*i % b == c:
print("YES")
sys.exit()
print("NO") |
s699232812 | p02261 | u362520072 | 1,000 | 131,072 | Wrong Answer | 20 | 5,600 | 885 | Let's arrange a deck of cards. There are totally 36 cards of 4 suits(S, H, C, D) and 9 values (1, 2, ... 9). For example, 'eight of heart' is represented by H8 and 'one of diamonds' is represented by D1. Your task is to write a program which sorts a given set of cards in ascending order by their values using the Bubbl... | def bubble_sort(c, n):
for i in range(0,n):
for j in range(n-1,i-1,-1):
if c[j][1] < c[j-1][1]:
w = c[j]
c[j] = c[j-1]
c[j-1] = w
def selection_sort(c, n):
for i in range(0,n):
minj = i
for j in range(i, n):
if c[j][1] < c[minj][1]:
minj = j
w = c[i]
... | s533617556 | Accepted | 20 | 5,608 | 652 | def bubble_sort(a, n):
for i in range(0,n):
for j in range(n-1,i,-1):
if a[j][1] < a[j-1][1]:
a[j], a[j-1] = a[j-1], a[j]
return a
def selection_sort(b, n):
for i in range(0,n):
minj = i
for j in range(i, n):
if b[j][1] < b[minj][1]:
minj = j
b[i], b[minj] = b[minj], b... |
s854110901 | p03738 | u426572476 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 61 | You are given two positive integers A and B. Compare the magnitudes of these numbers. | 123456789012345678901234567890
234567890123456789012345678901 | s462822958 | Accepted | 17 | 2,940 | 112 | import math
a, b = [int(input()) for i in range(2)]
print("GREATER" if a > b else "LESS" if a < b else "EQUAL") |
s604307284 | p03737 | u177398299 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 47 | You are given three words s_1, s_2 and s_3, each composed of lowercase English letters, with spaces in between. Print the acronym formed from the uppercased initial letters of the words. | print(*(s[0].upper() for s in input().split())) | s013008118 | Accepted | 17 | 2,940 | 55 | print(*(s[0].upper() for s in input().split()), sep='') |
s086164534 | p03971 | u820357030 | 2,000 | 262,144 | Wrong Answer | 132 | 4,204 | 446 | There are N participants in the CODE FESTIVAL 2016 Qualification contests. The participants are either students in Japan, students from overseas, or neither of these. Only Japanese students or overseas students can pass the Qualification contests. The students pass when they satisfy the conditions listed below, from t... | nums = list(map(int, input().split()))
s=input()
print(nums[0], nums[1], nums[2])
print(s)
N=nums[0]
A=nums[1]
B=nums[2]
cA=0
cB=0
for i in range(N):
if(s[i:i+1] == "a"):
# print(s[i:i+1])
if((cA+cB)<(A+B)):
print("Yes")
else:
print("No")
cA+=1
elif(s[i:i+1]=="b"):
# print(s[i:i+1])
if((cA+cB)<(A+B)):... | s961522554 | Accepted | 137 | 4,040 | 452 | nums = list(map(int, input().split()))
s=input()
#print(nums[0], nums[1], nums[2])
#print(s)
N=nums[0]
A=nums[1]
B=nums[2]
cA=0
cB=0
for i in range(N):
if(s[i:i+1] == "a"):
# print(s[i:i+1])
if((cA+cB)<(A+B)):
print("Yes")
cA+=1
else:
print("No")
elif(s[i:i+1]=="b"):
# print(s[i:i+1])
if((cA+cB)<(A+B... |
s657518325 | p02833 | u816631826 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 137 | For an integer n not less than 0, let us define f(n) as follows: * f(n) = 1 (if n < 2) * f(n) = n f(n-2) (if n \geq 2) Given is an integer N. Find the number of trailing zeros in the decimal notation of f(N). | p=int(input())
if p%2 == 0:
num=10
c=0;
while num <= p:
c += (p/num)
num *= 5
print(c)
else:
print(0) | s546537590 | Accepted | 17 | 3,060 | 285 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
l= int(readline())
if l% 2 == 1:
print(0)
else:
l //= 2
ans = 0
while l:
l //= 5
ans += l
print(ans) |
s135147664 | p03971 | u767664985 | 2,000 | 262,144 | Wrong Answer | 112 | 4,016 | 412 | There are N participants in the CODE FESTIVAL 2016 Qualification contests. The participants are either students in Japan, students from overseas, or neither of these. Only Japanese students or overseas students can pass the Qualification contests. The students pass when they satisfy the conditions listed below, from t... | N, A, B = map(int, input().split())
S = input()
num = 0
num_b = 0
for i in range(N):
if S[i] == "a":
if num < A + B:
print("Yes")
num += 1
else:
print("No")
elif S[i] == "b":
if num < A + B and num_b < B:
print("Yes")
num += 1... | s521539218 | Accepted | 117 | 4,016 | 412 | N, A, B = map(int, input().split())
S = input()
num = 0
num_b = 0
for i in range(N):
if S[i] == "a":
if num < A + B:
print("Yes")
num += 1
else:
print("No")
elif S[i] == "b":
if num < A + B and num_b < B:
print("Yes")
num += 1... |
s768815112 | p03303 | u366886346 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 88 | You are given a string S consisting of lowercase English letters. We will write down this string, starting a new line after every w letters. Print the string obtained by concatenating the letters at the beginnings of these lines from top to bottom. | s=input()
w=int(input())
ans=""
for i in range(-len(s)//-w):
ans+=s[i*w]
print(ans)
| s714606452 | Accepted | 17 | 2,940 | 92 | s=input()
w=int(input())
ans=""
for i in range(-1*(len(s)//-w)):
ans+=s[i*w]
print(ans)
|
s270615333 | p02743 | u892308039 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,060 | 182 | Does \sqrt{a} + \sqrt{b} < \sqrt{c} hold? | import math
i = list(map(int, input().split()))
a = i[0]
b = i[1]
c = i[2]
a = math.sqrt(a)
b = math.sqrt(b)
c = math.sqrt(c)
if(a + b) > c:
print('Yes')
else:
print('No') | s994373256 | Accepted | 35 | 5,076 | 200 | import math
from decimal import *
i = list(map(int, input().split()))
a = Decimal(i[0])
b = Decimal(i[1])
c = Decimal(i[2])
if(a.sqrt() + b.sqrt()) < c.sqrt():
print('Yes')
else:
print('No')
|
s972596377 | p03163 | u167681750 | 2,000 | 1,048,576 | Wrong Answer | 171 | 14,592 | 278 | There are N items, numbered 1, 2, \ldots, N. For each i (1 \leq i \leq N), Item i has a weight of w_i and a value of v_i. Taro has decided to choose some of the N items and carry them home in a knapsack. The capacity of the knapsack is W, which means that the sum of the weights of items taken must be at most W. Find ... | import numpy as np
n, w = map(int, input().split())
wv = [list(map(int, input().split())) for i in range(n)]
table = np.zeros(w+1, dtype=np.int64)
for i in range(n):
l = table[:-wv[i][0]]
r = table[wv[i][0]:]
np.maximum(l + wv[i][1], r, out = r)
print(table[w-1]) | s308321741 | Accepted | 174 | 14,604 | 276 | import numpy as np
n, w = map(int, input().split())
wv = [list(map(int, input().split())) for i in range(n)]
table = np.zeros(w+1, dtype=np.int64)
for i in range(n):
l = table[:-wv[i][0]]
r = table[wv[i][0]:]
np.maximum(l + wv[i][1], r, out = r)
print(table[w]) |
s238503992 | p03730 | u932719058 | 2,000 | 262,144 | Wrong Answer | 34 | 2,940 | 159 | 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())
if a % b == 0 :
print('No')
exit()
for i in range(1, 10**5) :
if (a * i) % b == c :
print('Yes')
exit()
print('No') | s714061961 | Accepted | 34 | 2,940 | 159 | a, b, c = map(int, input().split())
if a % b == 0 :
print('NO')
exit()
for i in range(1, 10**5) :
if (a * i) % b == c :
print('YES')
exit()
print('NO') |
s586430113 | p02646 | u160224209 | 2,000 | 1,048,576 | Wrong Answer | 20 | 9,024 | 163 | 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())
oni = a + v*t
nige = b + w*t
if oni >= nige:
print("Yes")
else:
print("No")
| s199835285 | Accepted | 23 | 9,116 | 326 | a,v = map(int,input().split())
b,w = map(int,input().split())
t = int(input())
if a > b:
oni = a + (-1*v) * t
nige = b + (-1*w) * t
if oni <= nige:
print("YES")
else:
print("NO")
else:
oni = a + v*t
nige = b + w * t
if oni >= nige:
print("YES")
else:
print... |
s631883740 | p03449 | u678009529 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 368 | 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())
a = []
ans = 0
is_move = True
for i in range(2):
a.append(list(map(int, input().split())))
ans += a[0][0]
for i in range(n):
if i+1 == n:
ans += a[1][i]
else:
if sum(a[0][i:]) >= sum(a[1][i:]) and is_move == True:
ans += a[0][i+1]
else:
ans +=... | s178501836 | Accepted | 18 | 3,060 | 176 | n = int(input())
a = []
ans = 0
for i in range(2):
a.append(list(map(int, input().split())))
for i in range(n):
ans = max(ans, sum(a[0][:(i+1)] + a[1][i:]))
print(ans) |
s107500739 | p02678 | u764399371 | 2,000 | 1,048,576 | Wrong Answer | 665 | 34,764 | 594 | 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
n, m = map(int, input().split())
graph = [[] for _ in range(n)]
for i in range(m):
a, b = map(int, input().split())
a -= 1
b -= 1
graph[a].append(b)
graph[b].append(a)
que = deque()
que.append(0)
visited = [0 for _ in range(n)]
visited[0] = 1
ans = [None for _ in r... | s661138400 | Accepted | 656 | 34,976 | 607 | from collections import deque
n, m = map(int, input().split())
graph = [[] for _ in range(n)]
for i in range(m):
a, b = map(int, input().split())
a -= 1
b -= 1
graph[a].append(b)
graph[b].append(a)
que = deque()
que.append(0)
visited = [0 for _ in range(n)]
visited[0] = 1
ans = [None for _ in r... |
s497966459 | p04030 | u764401543 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 265 | 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... | s = list(input())
s.reverse()
print(''.join(s))
b = 0
ans = ''
for c in s:
if c == 'B':
b += 1
else:
if b > 0:
b -= 1
continue
else:
ans += c
ans = list(ans)
ans.reverse()
print(''.join(ans))
| s255117149 | Accepted | 17 | 2,940 | 224 | s = list(input())
s.reverse()
b = 0
ans = ''
for c in s:
if c == 'B':
b += 1
else:
if b > 0:
b -= 1
else:
ans += c
ans = list(ans)
ans.reverse()
print(''.join(ans))
|
s059476824 | p03997 | u760767494 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 73 | You are given a trapezoid. The lengths of its upper base, lower base, and height are a, b, and h, respectively. An example of a trapezoid Find the area of this trapezoid. | a = int(input())
b = int(input())
h = int(input())
print((a + b) * h / 2) | s108663915 | Accepted | 17 | 2,940 | 79 | a = int(input())
b = int(input())
h = int(input())
print(int((a + b) * h / 2))
|
s427361939 | p03478 | u750651325 | 2,000 | 262,144 | Wrong Answer | 27 | 9,136 | 147 | 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, A, B = map(int, input().split())
ans = 0
for i in range(1,N+1):
if B >= i >= A:
ans += i
elif i < B:
break
print(ans)
| s350445307 | Accepted | 35 | 9,220 | 655 | N, A, B = map(int, input().split())
ans = 0
for i in range(1,N+1):
if i < 10:
if A<=i<=B:
ans += i
elif i < 100:
a = i // 10
b = i - a*10
s = a+b
if A<=s<=B:
ans+=i
elif i < 1000:
a = i // 100
b = (i-a*100)//10
c = i-a*... |
s656452073 | p00037 | u024715419 | 1,000 | 131,072 | Wrong Answer | 20 | 5,576 | 1,260 | 上から見ると図 1 のような形の格子状の広場があります。この格子の各辺に「壁」があるかないかを 0 と 1 の並びで表します。点 A に立って壁に右手をつき、壁に右手をついたまま、矢印の方向に歩き続けて再び点 A に戻ってくるまでの経路を出力するプログラムを作成してください。 --- 図1 --- | def move(position):
x = position[0]
y = position[1]
d = position[2]
if d == "L":
p = "DLUR"
elif d == "R":
p = "URDL"
elif d == "U":
p = "LURD"
else:
p = "RDLU"
for i in range(4):
if p[i] in grid[y][x]:
d = p[i]
if d == "L":... | s781289891 | Accepted | 20 | 5,572 | 1,247 | def move(position):
x = position[0]
y = position[1]
d = position[2]
if d == "L":
p = "DLUR"
elif d == "R":
p = "URDL"
elif d == "U":
p = "LURD"
else:
p = "RDLU"
for i in range(4):
if p[i] in grid[y][x]:
d = p[i]
if d == "L":... |
s091949065 | p03469 | u779728630 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 34 | 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... | s = input()
print("2018" + s[:4]) | s466074955 | Accepted | 17 | 2,940 | 35 | s = input()
print("2018" + s[4:])
|
s960679147 | p02410 | u474232743 | 1,000 | 131,072 | Wrong Answer | 20 | 7,684 | 203 | Write a program which reads a $ n \times m$ matrix $A$ and a $m \times 1$ vector $b$, and prints their product $Ab$. A column vector with m elements is represented by the following equation. \\[ b = \left( \begin{array}{c} b_1 \\\ b_2 \\\ : \\\ b_m \\\ \end{array} \right) \\] A $n \times m$ matrix with $m$ column ve... | n, m = map(int, input().split())
a = [[v for v in list(map(int, input().split()))] for _ in range(n)]
b = [int(input()) for _ in range(m)]
print(sum([a[i][j] * b[j] for j in range(m)]) for i in range(n)) | s361437672 | Accepted | 50 | 8,060 | 208 | n, m = map(int, input().split())
a = [[v for v in list(map(int, input().split()))] for i in range(n)]
b = [int(input()) for j in range(m)]
for i in range(n):
print(sum([a[i][j] * b[j] for j in range(m)])) |
s529831016 | p03000 | u094932051 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,060 | 241 | A ball will bounce along a number line, making N + 1 bounces. It will make the first bounce at coordinate D_1 = 0, and the i-th bounce (2 \leq i \leq N+1) at coordinate D_i = D_{i-1} + L_{i-1}. How many times will the ball make a bounce where the coordinate is at most X? | while True:
try:
N, X = map(int, input().split())
L = list(map(int, input().split()))
D = 0
i = 0
while (D <= X):
D += L[i]
i += 1
print(i)
except:
break | s485842518 | Accepted | 17 | 3,060 | 347 | while True:
try:
N, X = map(int, input().split())
L = list(map(int, input().split()))
D = [0]
for i in range(1, N+1):
tmp = D[i-1] + L[i-1]
D.append(tmp)
if tmp > X:
print(i)
break
else:
print(N+1... |
s152209372 | p04011 | u785578220 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 136 | 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. | a = int(input())
b = int(input())
c = int(input())
d = int(input())
res = 0
if a<b:
res += c*a + d*(b-a)
else:res+=c*a
print(res)
| s034238691 | Accepted | 18 | 2,940 | 136 | a = int(input())
b = int(input())
c = int(input())
d = int(input())
res = 0
if a>b:
res += c*b + d*(a-b)
else:res+=c*a
print(res)
|
s928555935 | p02392 | u126478680 | 1,000 | 131,072 | Wrong Answer | 20 | 5,588 | 126 | Write a program which reads three integers a, b and c, and prints "Yes" if a < b < c, otherwise "No". | #! python3
# range.py
a, b, c = [int(x) for x in input().split()]
if a < b and b < c:
print('YES')
else:
print('NO')
| s769098455 | Accepted | 20 | 5,592 | 127 | #! python3
# range.py
a, b, c = [int(x) for x in input().split()]
if a < b and b < c:
print('Yes')
else:
print('No')
|
s490393480 | p02257 | u918276501 | 1,000 | 131,072 | Wrong Answer | 20 | 7,708 | 210 | A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7. Write a program which reads a list of _N_ integers and prints the number of prime numbers in the list. | n = int(input())
for i in range(n):
p = int(input())
if not p%2:
n -= 1
continue
for j in range(3,int(p**0.5),2):
if not p%j:
n -= 1
continue
print(n) | s813015608 | Accepted | 410 | 7,720 | 232 | n = int(input())
for i in range(n):
p = int(input())
if not p%2:
if p != 2:
n -= 1
continue
for j in range(3,int(p**0.5)+1,2):
if not p%j:
n -= 1
break
print(n) |
s526436315 | p03433 | u548545174 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 96 | 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())
A = int(input())
if (N - A) % 500 == 0:
print('Yes')
else:
print('No') | s965766195 | Accepted | 18 | 2,940 | 91 | N = int(input())
A = int(input())
if N % 500 <= A:
print('Yes')
else:
print('No')
|
s600709558 | p03449 | u594956556 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 247 | 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())
A1 = list(map(int, input().split()))
A2 = list(map(int, input().split()))
A2.reverse()
for i in range(N-1):
A1[i+1] += A1[i]
A2[i+1] += A2[i]
ans = 100000
for i in range(N):
ans = max(ans, A1[i]+A2[N-1-i])
print(ans)
| s555126247 | Accepted | 17 | 3,060 | 242 | N = int(input())
A1 = list(map(int, input().split()))
A2 = list(map(int, input().split()))
A2.reverse()
for i in range(N-1):
A1[i+1] += A1[i]
A2[i+1] += A2[i]
ans = 0
for i in range(N):
ans = max(ans, A1[i]+A2[N-1-i])
print(ans)
|
s674834768 | p02646 | u194472175 | 2,000 | 1,048,576 | Wrong Answer | 29 | 9,172 | 217 | 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())
dif = abs(B-A)
speed = V-W
if speed <= 0:
print('No')
else:
if speed*T >= dif:
print('Yes')
else:
print('No')
| s101599980 | Accepted | 26 | 9,172 | 217 | A,V = map(int,input().split())
B,W = map(int,input().split())
T = int(input())
dif = abs(B-A)
speed = V-W
if speed <= 0:
print('NO')
else:
if speed*T >= dif:
print('YES')
else:
print('NO')
|
s755240231 | p03814 | u224224351 | 2,000 | 262,144 | Wrong Answer | 41 | 6,180 | 208 | 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 = list(input())
r = list(reversed(s))
for i in range(len(s)):
if s[i] == "A":
a = i +1
break
for i in range(len(r)):
if s[i] == "Z":
z = i +1
break
print(z-a+2)
| s665364652 | Accepted | 41 | 6,180 | 209 | s = list(input())
r = list(reversed(s))
for i in range(len(s)):
if s[i] == "A":
a = i +1
break
for j in range(len(r)):
if r[j] == "Z":
z = len(r) - j
break
print(z-a+1) |
s642974324 | p02694 | u408791346 | 2,000 | 1,048,576 | Wrong Answer | 25 | 9,256 | 106 | 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... | x = int(input())
m = 100
ans = 0
while m < x:
m = int(m*1.01)
print(m)
ans += 1
print(ans) | s348905034 | Accepted | 24 | 9,160 | 92 | x = int(input())
m = 100
ans = 0
while m < x:
m = int(m*1.01)
ans += 1
print(ans) |
s943681797 | p03044 | u387774811 | 2,000 | 1,048,576 | Wrong Answer | 910 | 43,228 | 503 | We have a tree with N vertices numbered 1 to N. The i-th edge in the tree connects Vertex u_i and Vertex v_i, and its length is w_i. Your objective is to paint each vertex in the tree white or black (it is fine to paint all vertices the same color) so that the following condition is satisfied: * For any two vertices... | import sys
input = sys.stdin.readline
N=int(input())
ki=[[] for f in range(N)]
for i in range(N-1):
u,v,w = map(int,input().split())
ki[u-1].append([v-1,w%2])
ki[v-1].append([u-1,w%2])
stack = [[0,0]]
check = [0]*N
ans=[2]*N
ans[0]=0
while stack != [] :
a=stack.pop()
if check[a[0]]==0:
check[a[0]]=1
for i in ... | s166399738 | Accepted | 846 | 43,008 | 584 | from collections import deque
import sys
input = sys.stdin.readline
N=int(input())
ki=[[] for f in range(N)]
for i in range(N-1):
u,v,w = map(int,input().split())
ki[u-1].append([v-1,w%2])
ki[v-1].append([u-1,w%2])
stack = deque([[0,0]])
check = [0]*N
ans=[2]*N
ans[0]=0
while stack != deque([]) :
a=stack.pop()
ne... |
s587006246 | p03080 | u758973277 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 84 | There are N people numbered 1 to N. Each person wears a red hat or a blue hat. You are given a string s representing the colors of the people. Person i wears a red hat if s_i is `R`, and a blue hat if s_i is `B`. Determine if there are more people wearing a red hat than people wearing a blue hat. | N = int(input())
s = input()
if s.count('R')>N/2:
print('YES')
else:
print('NO') | s305400587 | Accepted | 17 | 2,940 | 84 | N = int(input())
s = input()
if s.count('R')>N/2:
print('Yes')
else:
print('No') |
s148535372 | p04029 | u674190122 | 2,000 | 262,144 | Wrong Answer | 16 | 2,940 | 172 | There are N children in AtCoder Kindergarten. Mr. Evi will arrange the children in a line, then give 1 candy to the first child in the line, 2 candies to the second child, ..., N candies to the N-th child. How many candies will be necessary in total? | given = [x for x in input()]
rets = ''
for i, v in enumerate(given):
if v == "B" and len(rets) > 0:
rets = rets[:-1]
else:
rets += v
print(rets)
| s571740502 | Accepted | 19 | 3,060 | 48 | N = int(input())
a = (N * (N + 1)) // 2
print(a) |
s113633965 | p02392 | u507758132 | 1,000 | 131,072 | Wrong Answer | 20 | 5,588 | 108 | Write a program which reads three integers a, b and c, and prints "Yes" if a < b < c, otherwise "No". | a,b,c = map(int,input().split())
if a> b:
if b>c:
print("Yes")
else:
print("No")
else:
print("No")
| s503038846 | Accepted | 20 | 5,588 | 90 | a,b,c = map(int,input().split())
if a < b and b < c:
print("Yes")
else:
print("No")
|
s893763596 | p02418 | u692415695 | 1,000 | 131,072 | Wrong Answer | 20 | 7,432 | 107 | Write a program which finds a pattern $p$ in a ring shaped text $s$. | # Belongs to : midandfeed aka asilentvoice
s = str(input())*2
q = str(input())
print(["NO", "YES"][q in s]) | s742855997 | Accepted | 60 | 7,512 | 107 | # Belongs to : midandfeed aka asilentvoice
s = str(input())*2
q = str(input())
print(["No", "Yes"][q in s]) |
s259334115 | p02601 | u353797797 | 2,000 | 1,048,576 | Wrong Answer | 27 | 9,228 | 564 | 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... | import sys
sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(ro... | s876558481 | Accepted | 31 | 9,208 | 564 | import sys
sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(ro... |
s364225087 | p03679 | u202570162 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 130 | Takahashi has a strong stomach. He never gets a stomachache from eating something whose "best-by" date is at most X days earlier. He gets a stomachache if the "best-by" date of the food is X+1 or more days earlier, though. Other than that, he finds the food delicious if he eats it not later than the "best-by" date. Ot... | x,a,b = map(int,input().split())
if a-b <= 0:
print('delicious')
elif a-b <= x:
print('safe')
else:
print('dangerous') | s325809793 | Accepted | 17 | 2,940 | 132 | x,a,b = map(int,input().split())
if -a+b <= 0:
print('delicious')
elif -a+b <= x:
print('safe')
else:
print('dangerous') |
s564058377 | p02277 | u918276501 | 1,000 | 131,072 | Wrong Answer | 20 | 7,776 | 929 | Let's arrange a deck of cards. Your task is to sort totally n cards. A card consists of a part of a suit (S, H, C or D) and an number. Write a program which sorts such cards based on the following pseudocode: Partition(A, p, r) 1 x = A[r] 2 i = p-1 3 for j = p to r-1 4 do if A[j] <= x 5 then ... | def swap(A,i,j):
A[i],A[j] = A[j],A[i]
return A
def isStable(A):
for i in range(1, len(A)):
if A[i][1] == A[i-1][1]:
if A[i][2] < A[i-1][2]:
return False
return True
def partition(A,p=0, r=None):
if r is None:
r = len(A)-1
x = A[r]
i = p-1
fo... | s420761190 | Accepted | 1,120 | 24,720 | 944 | def swap(A,i,j):
A[i],A[j] = A[j],A[i]
return A
def isStable(A):
for i in range(1, len(A)):
if A[i][1] == A[i-1][1]:
if A[i][2] < A[i-1][2]:
return False
return True
def partition(A,p=0, r=None):
if r is None:
r = len(A)-1
x = A[r]
i = p-1
fo... |
s481843078 | p03543 | u168416324 | 2,000 | 262,144 | Wrong Answer | 26 | 9,028 | 102 | We call a 4-digit integer with three or more consecutive same digits, such as 1118, **good**. You are given a 4-digit integer N. Answer the question: Is N **good**? | x=list(input())
for i in range(10):
if x.count(i)>=3:
print("Yes")
break
else:
print("No") | s033353776 | Accepted | 25 | 9,000 | 124 | x=list(input())
for i in range(10):
if x.count(str(i))>=3 and x[1]==x[2]:
print("Yes")
break
else:
print("No")
|
s551278881 | p02612 | u369796672 | 2,000 | 1,048,576 | Wrong Answer | 28 | 9,076 | 48 | We will buy a product for N yen (the currency of Japan) at a shop. If we use only 1000-yen bills to pay the price, how much change will we receive? Assume we use the minimum number of bills required. | N = int(input())
a = N//1000
print(N - 1000*a) | s264114697 | Accepted | 29 | 9,160 | 86 | N = int(input())
a = N//1000
if 1000*a != N:
print(1000*(a+1)-N)
else:
print(0) |
s302204855 | p03909 | u623349537 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 277 | There is a grid with H rows and W columns. The square at the i-th row and j-th column contains a string S_{i,j} of length 5. The rows are labeled with the numbers from 1 through H, and the columns are labeled with the uppercase English letters from `A` through the W-th letter of the alphabet. Exactly one of the sq... | abc = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
H, W = map(int, input().split())
S = [[] for i in range(H)]
for i in range(H):
S[i] = list(input().split())
for i in range(H):
for j in range(W):
if S[i][j] == "Snuke":
print(abc[j] + str(i))
break | s833651274 | Accepted | 18 | 3,060 | 281 | abc = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
H, W = map(int, input().split())
S = [[] for i in range(H)]
for i in range(H):
S[i] = list(input().split())
for i in range(H):
for j in range(W):
if S[i][j] == "snuke":
print(abc[j] + str(i + 1))
break |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.