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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s043564536 | p04030 | u842388336 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 191 | 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 = input()
ans=[]
for c in s:
if s=="0":
ans.append(0)
if s=="i":
ans.append(1)
if s=="B":
if len(ans)==0:
pass
else:
ans.pop()
ans="".join(ans)
print(ans) | s010128987 | Accepted | 17 | 2,940 | 195 | s = input()
ans=[]
for c in s:
if c=="0":
ans.append("0")
if c=="1":
ans.append("1")
if c=="B":
if len(ans)==0:
pass
else:
ans.pop()
ans="".join(ans)
print(ans) |
s353279142 | p02414 | u671553883 | 1,000 | 131,072 | Wrong Answer | 30 | 7,624 | 202 | Write a program which reads a $n \times m$ matrix $A$ and a $m \times l$ matrix $B$, and prints their product, a $n \times l$ matrix $C$. An element of matrix $C$ is obtained by the following formula: \\[ c_{ij} = \sum_{k=1}^m a_{ik}b_{kj} \\] where $a_{ij}$, $b_{ij}$ and $c_{ij}$ are elements of $A$, $B$ and $C$ res... | n, m, l = [int(i) for i in input().split()]
A = []
B = []
C = []
for ni in range(n):
A.append([int(i) for i in input().split()])
for mi in range(m):
B.append([int(i) for i in input().split()]) | s249507423 | Accepted | 520 | 8,988 | 422 | n, m, l = [int(i) for i in input().split()]
A = []
B = []
C = []
for ni in range(n):
A.append([int(i) for i in input().split()])
for mi in range(m):
B.append([int(i) for i in input().split()])
for i in range(n):
C.append([])
for j in range(l):
C[i].append(0)
for k in range(m):
... |
s069768969 | p03251 | u477216059 | 2,000 | 1,048,576 | Wrong Answer | 19 | 3,060 | 307 | Our world is one-dimensional, and ruled by two empires called Empire A and Empire B. The capital of Empire A is located at coordinate X, and that of Empire B is located at coordinate Y. One day, Empire A becomes inclined to put the cities at coordinates x_1, x_2, ..., x_N under its control, and Empire B becomes incli... | if __name__ == '__main__':
n, m, X, Y = (int(i) for i in input().split())
x = [int(i) for i in input().split()]
y = [int(i) for i in input().split()]
result = "War"
for i in range(X + 1, Y + 1):
if max(x) < 16 and min(y) >= 16:
result = "No war"
print(result)
| s983895158 | Accepted | 18 | 3,060 | 323 | if __name__ == '__main__':
n, m, X, Y = (int(i) for i in input().split())
x = [int(i) for i in input().split()]
y = [int(i) for i in input().split()]
result = "War"
for i in range(-100, 101):
if X < i and Y >= i and max(x) < i and min(y) >= i:
result = "No War"
print(resul... |
s766191994 | p03680 | u777028980 | 2,000 | 262,144 | Wrong Answer | 2,104 | 7,084 | 164 | Takahashi wants to gain muscle, and decides to work out at AtCoder Gym. The exercise machine at the gym has N buttons, and exactly one of the buttons is lighten up. These buttons are numbered 1 through N. When Button i is lighten up and you press it, the light is turned off, and then Button a_i will be lighten up. It ... | n=int(input())
hoge=[]
for i in range(n):
hoge.append(int(input()))
ans=0
punch=1
while 1:
ans+=1
punch=hoge[punch-1]
if(punch==1):
print(ans)
break | s247859419 | Accepted | 212 | 7,084 | 211 | n=int(input())
hoge=[]
for i in range(n):
hoge.append(int(input()))
ans=0
punch=1
while 1:
ans+=1
punch=hoge[punch-1]
if(punch-1==1):
print(ans)
break
if(ans>=100001):
print(-1)
break
|
s601785171 | p00010 | u519227872 | 1,000 | 131,072 | Wrong Answer | 30 | 7,688 | 758 | Write a program which prints the central coordinate $(p_x, p_y)$ and the radius $r$ of a circumscribed circle of a triangle which is constructed by three points $(x_1, y_1)$, $(x_2, y_2)$ and $(x_3, y_3)$ on the plane surface. | from math import sqrt
n = int(input())
for i in range(n):
l = input()
x1,y1,x2,y2,x3,y3=map(float,l.split(' '))
a_2 = (x1 - x2)**2 + (y1 - y2)**2
b_2 = (x2 - x3)**2 + (y2 - y3)**2
c_2 = (x3 - x1)**2 + (y3 - y1)**2
cos_a_2 = (b_2 + c_2 - a_2)**2/(4* b_2 * c_2)
sin_a_2 = 1 - cos_a_2
r = r... | s903524426 | Accepted | 30 | 7,672 | 772 | from math import sqrt
n = int(input())
for i in range(n):
l = input()
x1,y1,x2,y2,x3,y3=map(float,l.split(' '))
a_2 = (x1 - x2)**2 + (y1 - y2)**2
b_2 = (x2 - x3)**2 + (y2 - y3)**2
c_2 = (x3 - x1)**2 + (y3 - y1)**2
cos_a_2 = (b_2 + c_2 - a_2)**2/(4* b_2 * c_2)
sin_a_2 = 1 - cos_a_2
r = r... |
s187255411 | p03450 | u765386817 | 2,000 | 262,144 | Wrong Answer | 2,110 | 151,448 | 748 | There are N people standing on the x-axis. Let the coordinate of Person i be x_i. For every i, x_i is an integer between 0 and 10^9 (inclusive). It is possible that more than one person is standing at the same coordinate. You will given M pieces of information regarding the positions of these people. The i-th piece of... | import queue
n,m = map(int,input().split())
dis = [[] for i in range(n)]
for i in range(m):
g1,g2,L = map(int,input().split())
dis[g1-1].append((g2-1,L))
dis[g2-1].append((g1-1,-L))
print(dis)
geo = dict()
geo[0] = 0
q = queue.Queue()
q.put(0)
#fig[0] = 1
while not q.empty():
g1 = q.get()
... | s915799712 | Accepted | 1,126 | 109,956 | 837 | import collections
from collections import deque
import sys
input = sys.stdin.readline
def bfs(s):
d = deque()
d.append(s)
dis[s]=0
flag=True
while len(d):
x = d.popleft()
for i,j in vec[x]:
if dis[i] == INF:
dis[i]=dis[x]+j
d.append(i)
... |
s963917640 | p03448 | u103341055 | 2,000 | 262,144 | Wrong Answer | 33 | 9,176 | 698 | 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())
ans = 0
# for a in range(A+1):
# x = X - a*500
# for b in range(B+1):
# x -= b*100
# for c in range(C+1):
# x -= c*50
# print(a,b,c,x)
# if x == 0:
# ans += 1
# for a in r... | s278320184 | Accepted | 27 | 9,096 | 783 | A = int(input())
B = int(input())
C = int(input())
X = int(input())
ans = 0
# for a in range(A+1):
# x = X - a*500
# for b in range(B+1):
# x -= b*100
# for c in range(C+1):
# x -= c*50
# print(a,b,c,x)
# if x == 0:
# ans += 1
# for a in r... |
s317498514 | p03997 | u003505857 | 2,000 | 262,144 | Wrong Answer | 26 | 8,972 | 118 | 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())
answer = (a + b) / 2 * h
print(answer) | s048475518 | Accepted | 27 | 9,092 | 98 |
a = int(input())
b = int(input())
h = int(input())
print(int((a + b) / 2 * h)) |
s975282799 | p03359 | u846652026 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 56 | 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())
print(a if a<b else a-1) | s496131864 | Accepted | 17 | 2,940 | 57 | a,b = map(int, input().split())
print(a if a<=b else a-1) |
s657112821 | p03591 | u077685310 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 141 | Ringo is giving a present to Snuke. Ringo has found out that Snuke loves _yakiniku_ (a Japanese term meaning grilled meat. _yaki_ : grilled, _niku_ : meat). He supposes that Snuke likes grilled things starting with `YAKI` in Japanese, and does not like other things. You are given a string S representing the Japanese ... | a=list(input())
if len(a)<=3:
print("No")
else:
if a[0]=="T" and a[1]=="A" and a[2]=="K" and a[3]=="I":
print("Yes")
else:
print("No") | s087093878 | Accepted | 17 | 2,940 | 141 | a=list(input())
if len(a)<=3:
print("No")
else:
if a[0]=="Y" and a[1]=="A" and a[2]=="K" and a[3]=="I":
print("Yes")
else:
print("No") |
s530427192 | p02397 | u681232780 | 1,000 | 131,072 | Wrong Answer | 50 | 5,608 | 171 | Write a program which reads two integers x and y, and prints them in ascending order. | while True :
x,y = map(int,input().split())
if y < x :
print(y,x)
elif x < y :
print(x,y)
else :
print(x,y)
if x == 0 and y == 0 :
break
| s187257562 | Accepted | 50 | 5,608 | 143 | while True :
x,y = map(int,input().split())
if x == 0 and y == 0 :
break
elif y < x :
print(y,x)
else :
print(x,y)
|
s124424718 | p03853 | u264681142 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 139 | There is an image with a height of H pixels and a width of W pixels. Each of the pixels is represented by either `.` or `*`. The character representing the pixel at the i-th row from the top and the j-th column from the left, is denoted by C_{i,j}. Extend this image vertically so that its height is doubled. That is, p... | h, w = map(int, input().split())
l = []
for i in range(h):
l.append(input().split())
for i in range(h):
print(l[i])
print(l[i]) | s642816613 | Accepted | 17 | 3,060 | 139 | h, w = map(int, input().split())
l = []
for i in range(h):
s = input()
l.append(s)
for i in range(h):
print(l[i])
print(l[i]) |
s152563248 | p02602 | u969081133 | 2,000 | 1,048,576 | Wrong Answer | 142 | 31,512 | 141 | M-kun is a student in Aoki High School, where a year is divided into N terms. There is an exam at the end of each term. According to the scores in those exams, a student is given a grade for each term, as follows: * For the first through (K-1)-th terms: not given. * For each of the K-th through N-th terms: the m... | n,k=map(int,input().split())
a=list(map(int,input().split()))
for i in range(k,n):
if a[k]>a[i-k]:
print('Yes')
else:
print('No') | s478849994 | Accepted | 141 | 31,444 | 141 | n,k=map(int,input().split())
a=list(map(int,input().split()))
for i in range(k,n):
if a[i]>a[i-k]:
print('Yes')
else:
print('No') |
s903422188 | p03693 | u037164984 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 140 | AtCoDeer has three cards, one red, one green and one blue. An integer between 1 and 9 (inclusive) is written on each card: r on the red card, g on the green card and b on the blue card. We will arrange the cards in the order red, green and blue from left to right, and read them as a three-digit integer. Is this i... | # -*- coding: utf-8 -*-
r, g, b = map(int,input().split())
a = g+b
answer = a % 4
if answer == 0:
print("YES")
else:
print("NO") | s791338552 | Accepted | 17 | 2,940 | 145 | # -*- coding: utf-8 -*-
r, g, b = map(int,input().split())
a = 10*g + b
answer = a % 4
if answer == 0:
print("YES")
else:
print("NO") |
s310142145 | p03555 | u590048048 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 93 | You are given a grid with 2 rows and 3 columns of squares. The color of the square at the i-th row and j-th column is represented by the character C_{ij}. Write a program that prints `YES` if this grid remains the same when rotated 180 degrees, and prints `NO` otherwise. | a = input()
b = input()
if "".join(reversed(a)) == b:
print("Yes")
else:
print("No")
| s080037389 | Accepted | 17 | 2,940 | 93 | a = input()
b = input()
if "".join(reversed(a)) == b:
print("YES")
else:
print("NO")
|
s676906496 | p04044 | u333917945 | 2,000 | 262,144 | Wrong Answer | 24 | 3,316 | 97 | Iroha has a sequence of N strings S_1, S_2, ..., S_N. The length of each string is L. She will concatenate all of the strings in some order, to produce a long string. Among all strings that she can produce in this way, find the lexicographically smallest one. Here, a string s=s_1s_2s_3...s_n is _lexicographically sm... | n, l = map(int, input().split())
s = [[i for i in input()] for j in range(n)]
s.sort()
print(s)
| s895480559 | Accepted | 24 | 3,064 | 178 | n, l = map(int, input().split())
s = [[i for i in input()] for j in range(n)]
#print(s)
s.sort()
#print(s)
for i in range(n):
s[i] = "".join(s[i])
s = "".join(s)
print(s)
|
s803187828 | p03861 | u325206354 | 2,000 | 262,144 | Wrong Answer | 2,104 | 3,068 | 118 | You are given nonnegative integers a and b (a ≤ b), and a positive integer x. Among the integers between a and b, inclusive, how many are divisible by x? | a,b,c=list(map(int,input().split()))
count = 0
for i in range(a,b):
if i % c == 0:
count+=1
print(count)
| s515214975 | Accepted | 17 | 2,940 | 58 | a,b,c=list(map(int,input().split()))
print(b//c-(a-1)//c)
|
s071417942 | p03593 | u930705402 | 2,000 | 262,144 | Wrong Answer | 23 | 3,436 | 753 | We have an H-by-W matrix. Let a_{ij} be the element at the i-th row from the top and j-th column from the left. In this matrix, each a_{ij} is a lowercase English letter. Snuke is creating another H-by-W matrix, A', by freely rearranging the elements in A. Here, he wants to satisfy the following condition: * Every ... | from collections import Counter
H,W=map(int,input().split())
li=[]
for i in range(H):
a=list(input())
for j in range(W):
li.append(a[j])
c=Counter(li)
if(H%2==0 and W%2==0):
for x,y in c.items():
if(y%4!=0):
print('No')
exit()
print('Yes')
elif(H%2==1 and W%2==1)... | s463747340 | Accepted | 21 | 3,444 | 483 | from collections import Counter
H,W=map(int,input().split())
li=[]
for i in range(H):
a=list(input())
li+=a
c=Counter(li)
t,o=0,0
for x,y in c.items():
l=y%4
t+=l//2
o+=l%2
isok=True
if(H%2==0 and W%2==0):
if t!=0 or o!=0:
isok=False
elif(H%2==0 and W%2==1):
if(t>H//2 or o>0):
... |
s058713938 | p03623 | u440478998 | 2,000 | 262,144 | Wrong Answer | 26 | 9,028 | 83 | 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("A") if abs(x-a) > abs(x-b) else print("B") | s103092475 | Accepted | 28 | 9,160 | 83 | x,a,b = map(int, input().split())
print("A") if abs(x-a) < abs(x-b) else print("B") |
s165341399 | p03387 | u798731634 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 697 | You are given three integers A, B and C. Find the minimum number of operations required to make A, B and C all equal by repeatedly performing the following two kinds of operations in any order: * Choose two among A, B and C, then increase both by 1. * Choose one among A, B and C, then increase it by 2. It can be ... | n = list(map(int,input().split()))
n.sort(reverse=True)
a = n[0]-n[1]
b = n[0]-n[2]
if a == 0 and b == 0:
print(0)
if a != 0 and b == 0:
if a%2 == 0:
print(a/2)
elif a == 1:
print(2)
elif a%2 != 0:
print(1+(a-1)/2)
if a == 0 and b != 0:
if b%2 == 0:
print(b/2)
eli... | s793210239 | Accepted | 18 | 3,064 | 737 | n = list(map(int,input().split()))
n.sort(reverse=True)
a = n[0]-n[1]
b = n[0]-n[2]
if a == 0 and b == 0:
print(0)
if a != 0 and b == 0:
if a%2 == 0:
print(int(a/2))
elif a == 1:
print(2)
elif a%2 != 0:
print(int(2+(a-1)/2))
if a == 0 and b != 0:
if b%2 == 0:
print(in... |
s232341985 | p03457 | u487392837 | 2,000 | 262,144 | Wrong Answer | 455 | 21,148 | 526 | AtCoDeer the deer is going on a trip in a two-dimensional plane. In his plan, he will depart from point (0, 0) at time 0, then for each i between 1 and N (inclusive), he will visit point (x_i,y_i) at time t_i. If AtCoDeer is at point (x, y) at time t, he can be at one of the following points at time t+1: (x+1,y), (x-1... | nums = int(input())
tmp = list()
for num in range(nums):
tmp.append([int(_) for _ in str(input()).split(" ")])
for num, case in enumerate(tmp):
t, x, y = case
if t < abs(x) + abs(y):
print("No")
break
else:
if ((abs(x) + abs(y)) % 2) and (t % 2):
if num == len(tmp):
... | s060131358 | Accepted | 450 | 21,108 | 532 | nums = int(input())
tmp = list()
for num in range(nums):
tmp.append([int(_) for _ in str(input()).split(" ")])
for num, case in enumerate(tmp):
t, x, y = case
if t < abs(x) + abs(y):
print("No")
break
else:
if ((abs(x) + abs(y)) % 2) and (t % 2):
if num +1 == len(tmp... |
s531626179 | p00516 | u352394527 | 8,000 | 131,072 | Wrong Answer | 20 | 5,600 | 328 | A global sports event will be held in Tokyo in 20XX. Programming contests are enjoyed all over the world as sports, and there is a possibility that they will be adopted as competitions. When I researched the judging committee that decides which competitions will be adopted, I found the following. For the judging panel,... | def main():
n,m = map(int,input().split())
A = [int(input()) for _ in range(n)]
V = [0 for _ in range(n)]
m = 0
ans = 0
for i in range(m):
b = int(input())
for j in range(n):
if A[j] <= b:
V[j] += 1
if m < V[j]:
m += 1
ans = j
break
print(ans + 1)
... | s371700314 | Accepted | 60 | 5,620 | 328 | def main():
n,m = map(int,input().split())
A = [int(input()) for _ in range(n)]
V = [0 for _ in range(n)]
M = 0
ans = 0
for i in range(m):
b = int(input())
for j in range(n):
if A[j] <= b:
V[j] += 1
if M < V[j]:
M += 1
ans = j
break
print(ans + 1)
... |
s840251004 | p03379 | u780698286 | 2,000 | 262,144 | Wrong Answer | 191 | 30,656 | 143 | 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, ..... | n = int(input())
x = list(map(int, input().split()))
x.sort()
for i in range(n):
if i < n//2:
print(x[n//2])
else:
print(x[n//2-1]) | s864048256 | Accepted | 208 | 30,952 | 157 | n = int(input())
x = list(map(int, input().split()))
y = sorted(x)
for i in range(n):
if x[i] <= y[n//2-1]:
print(y[n//2])
else:
print(y[n//2-1]) |
s414045255 | p03067 | u729133443 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 62 | There are three houses on a number line: House 1, 2 and 3, with coordinates A, B and C, respectively. Print `Yes` if we pass the coordinate of House 3 on the straight way from House 1 to House 2 without making a detour, and print `No` otherwise. | a,b,c=map(int,input().split());print('YNeo s'[(c>a)^(c>b)::2]) | s134392576 | Accepted | 18 | 2,940 | 62 | a,b,c=map(int,input().split());print('NYoe s'[(c>a)^(c>b)::2]) |
s299943821 | p00637 | u546285759 | 1,000 | 131,072 | Wrong Answer | 30 | 7,536 | 458 | To write a research paper, you should definitely follow the structured format. This format, in many cases, is strictly defined, and students who try to write their papers have a hard time with it. One of such formats is related to citations. If you refer several pages of a material, you should enumerate their page num... | while True:
n = int(input())
if n == 0:
break
line = list(map(int, input().split()))
t = len(line)-1
ans = []
i = 0
while True:
ans.append(line[i])
while i < t:
if line[i]+1 == line[i+1]:
i += 1
else:
ans.append(... | s702601982 | Accepted | 30 | 7,600 | 434 | while True:
n = int(input())
if n == 0:
break
line = list(map(int, input().split()))
i = 0
while i < n:
j = i
while j+1 < n and line[j+1]-line[j] == 1:
j += 1
s = "\n" if n-1 == j else " "
if i == j:
print("%d%s" % (line[i], s), end='')... |
s268522051 | p04043 | u329407311 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 177 | 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+b+c == 19:
if a == 7 or a == 5:
if b == 7 or b == 5:
if c == 7 or c == 5:
print("YES")
else:
print("NO") | s808064442 | Accepted | 17 | 2,940 | 201 | a,b,c = map(int,input().split())
d=0
if a+b+c == 17:
if a == 7 or a == 5:
if b == 7 or b == 5:
if c == 7 or c == 5:
print("YES")
d =1
if d == 0:print("NO")
|
s684154540 | p02238 | u094978706 | 1,000 | 131,072 | Wrong Answer | 20 | 5,592 | 557 | Depth-first search (DFS) follows the strategy to search ”deeper” in the graph whenever possible. In DFS, edges are recursively explored out of the most recently discovered vertex $v$ that still has unexplored edges leaving it. When all of $v$'s edges have been explored, the search ”backtracks” to explore edges leaving ... | n = int(input())
adj = [0]*n
for i in range(n):
tmp = list(map( int, input().split() ) )
adj[tmp[0]-1] = list(map(lambda x : x - 1, tmp[2:]))
c = ['w']*n # color of each vertex
d = [0]*n # discovery time for each vertex
f = [0]*n # finish time for each vertex
time = 0
def DFS_visit(u):
global time
... | s717306292 | Accepted | 20 | 5,636 | 628 | n = int(input())
adj = [0]*n
for i in range(n):
tmp = list(map( int, input().split() ) )
adj[tmp[0]-1] = list(map(lambda x : x - 1, tmp[2:]))
c = ['w']*n # color of each vertex
d = [0]*n # discovery time for each vertex
f = [0]*n # finish time for each vertex
time = 0
def DFS_visit(u):
global time
... |
s947596126 | p02612 | u741579801 | 2,000 | 1,048,576 | Wrong Answer | 29 | 9,052 | 44 | 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())
# N = 1900
print(N % 1000) | s510127144 | Accepted | 29 | 9,004 | 53 | N = int(input())
# N = 1900
print((1000 - N) % 1000) |
s201901079 | p03370 | u757274384 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 125 | 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())
A = [int(input()) for i in range(n)]
A.sort()
A.reverse()
print(len(A) + (x - sum(A))//A[0]) | s098313956 | Accepted | 17 | 2,940 | 107 | n,x = map(int, input().split())
A = [int(input()) for i in range(n)]
print(len(A) + (x - sum(A))//min(A))
|
s949126172 | p03251 | u294385082 | 2,000 | 1,048,576 | Wrong Answer | 18 | 3,060 | 198 | Our world is one-dimensional, and ruled by two empires called Empire A and Empire B. The capital of Empire A is located at coordinate X, and that of Empire B is located at coordinate Y. One day, Empire A becomes inclined to put the cities at coordinates x_1, x_2, ..., x_N under its control, and Empire B becomes incli... | N,M,X,Y = map(int,input().split())
x = list(input().split())
y = list(input().split())
if X >= Y:
print("War")
exit()
else:
Z = Y
if int(max(x)) < Z and int(min(y)) >= Z:
print("No War") | s534358528 | Accepted | 18 | 3,060 | 177 | N,M,X,Y = map(int,input().split())
x = list(map(int,input().split()))
y = list(map(int,input().split()))
if max(max(x),X) < min(min(y),Y):
print("No War")
else:
print("War") |
s770895213 | p03997 | u620157187 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 68 | 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) | s133520070 | Accepted | 17 | 2,940 | 73 | a = int(input())
b = int(input())
h = int(input())
print(int((a+b)*h/2)) |
s864252332 | p03997 | u628070051 | 2,000 | 262,144 | Wrong Answer | 22 | 8,856 | 103 | 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, b, h = [int(input())for i in range(3)]
S = (a + b) * h / 2
print(S) | s232791120 | Accepted | 27 | 9,156 | 104 |
a, b, h = [int(input())for i in range(3)]
S = (a + b) * h // 2
print(S) |
s426574804 | p03163 | u163907160 | 2,000 | 1,048,576 | Wrong Answer | 327 | 21,132 | 355 | 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())
w, v = [], []
for i in range(N):
a, b = map(int, input().split())
w += [a]
v += [b]
DP = np.zeros(W + 1)
for i in range(N):
# print(DP[w[i]:])
# print(DP[:-w[i]])
# print(DP[:-w[i]] + v[i])
DP[w[i]:] = np.maximum(DP[:-w[i]] + v[i], DP[w[... | s034094403 | Accepted | 214 | 15,480 | 365 | import numpy as np
N, W = map(int, input().split())
w, v = [], []
for i in range(N):
a, b = map(int, input().split())
w += [a]
v += [b]
DP = np.zeros(W + 1,dtype=int)
for i in range(N):
# print(DP[w[i]:])
# print(DP[:-w[i]])
# print(DP[:-w[i]] + v[i])
DP[w[i]:] = np.maximum(DP[:-w[i]] + v... |
s842492564 | p03149 | u911206742 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 99 | You are given four digits N_1, N_2, N_3 and N_4. Determine if these can be arranged into the sequence of digits "1974". | i = input()
set_1 = set(i)
if set_1 == {"1", "9", "7", "4"}:
print("YES")
else:
print("NO") | s487881888 | Accepted | 18 | 2,940 | 110 | i = input().split(" ")
set_1 = set(i)
if set_1 == {"1", "9", "7", "4"}:
print("YES")
else:
print("NO") |
s226718199 | p03852 | u951601135 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 133 | 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().replace('eraser','').replace('erase','').replace('dreamer','').replace('dream','')
if s:
print('NO')
else:
print('YES') | s199950913 | Accepted | 19 | 2,940 | 78 | if(input() in ['a','i','u','e','o']):
print('vowel')
else:print('consonant') |
s404054025 | p02562 | u401686269 | 5,000 | 1,048,576 | Wrong Answer | 537 | 54,800 | 761 | You are given a grid of N rows and M columns. The square at the i-th row and j-th column will be denoted as (i,j). A nonnegative integer A_{i,j} is written for each square (i,j). You choose some of the squares so that each row and column contains at most K chosen squares. Under this constraint, calculate the maximum v... | import networkx as nx
N,K=map(int,input().split())
A=[list(map(int,input().split())) for _ in range(N)]
maxA = max([max(A[i]) for i in range(N)])
G = nx.DiGraph()
G.add_node('source',demand=-K*N)
G.add_node('sink',demand=K*N)
for i in range(N):
for j in range(N):
G.add_edge(i,N+j,weight=maxA-A[i][j],capacity=1)... | s688537700 | Accepted | 465 | 54,964 | 815 | import networkx as nx
N,K=map(int,input().split())
A=[list(map(int,input().split())) for _ in range(N)]
maxA = max([max(A[i]) for i in range(N)])
G = nx.DiGraph()
G.add_node('source',demand=-K*N)
G.add_node('sink',demand=K*N)
G.add_edge('source','sink',weight=maxA, capacity=K*N)
for i in range(N):
for j in range(N)... |
s621676340 | p02259 | u722558010 | 1,000 | 131,072 | Wrong Answer | 20 | 7,636 | 229 | Write a program of the Bubble Sort algorithm which sorts a sequence _A_ in ascending order. The algorithm should be based on the following pseudocode: BubbleSort(A) 1 for i = 0 to A.length-1 2 for j = A.length-1 downto i+1 3 if A[j] < A[j-1] 4 swap A[j] and A[j-1] Note that, in... | N=int(input())
A=list(map(int,input().split()))
count=0
i=N-1
while i>=0:
j=0
while j<=i:
if A[N-1-j]<A[N-2-j]:
(A[N-1-j],A[N-2-j])=(A[N-2-j],A[N-1-j])
count+=1
j+=1
i-=1
print(' '.join(map(str,A)))
print(count) | s184698479 | Accepted | 40 | 7,704 | 259 | N=int(input())
A=list(map(int,input().split()))
count=0
i=N-1
while i>0:
j=0
while j<i:
if A[N-1-j]<A[N-2-j]:
(A[N-1-j],A[N-2-j])=(A[N-2-j],A[N-1-j])
count+=1
#print(' '.join(map(str,A)))
j+=1
i-=1
print(' '.join(map(str,A)))
print(count) |
s716122991 | p03695 | u970809473 | 2,000 | 262,144 | Wrong Answer | 19 | 3,064 | 601 | In AtCoder, a person who has participated in a contest receives a _color_ , which corresponds to the person's rating as follows: * Rating 1-399 : gray * Rating 400-799 : brown * Rating 800-1199 : green * Rating 1200-1599 : cyan * Rating 1600-1999 : blue * Rating 2000-2399 : yellow * Rating 2400-2799 : or... | n = int(input())
a = list(map(int, input().split()))
color = [0] * 9
for i in range(n):
if a[i] < 400:
color[0] = 1
elif a[i] < 800:
color[1] = 1
elif a[i] < 1200:
color[2] = 1
elif a[i] < 1600:
color[3] = 1
elif a[i] < 2000:
color[4] = 1
elif a[i] < 2400:
color[5] = 1
elif a[i] < ... | s046929043 | Accepted | 17 | 3,064 | 513 | n = int(input())
a = list(map(int, input().split()))
color = [0] * 8
tmp = 0
for i in range(n):
if a[i] < 400:
color[0] = 1
elif a[i] < 800:
color[1] = 1
elif a[i] < 1200:
color[2] = 1
elif a[i] < 1600:
color[3] = 1
elif a[i] < 2000:
color[4] = 1
elif a[i] < 2400:
color[5] = 1
elif... |
s305867019 | p03456 | u548545174 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 198 | 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, b = input().split()
target = a + b
heihousuu = [i ** 2 for i in range(1000) if i ** 2 <= 100100]
for h in heihousuu:
if target == h:
print('Yes')
break
else:
print('No') | s095349751 | Accepted | 17 | 3,060 | 109 | a, b = input().split()
ab = int(a + b)
if (ab ** 0.5).is_integer():
print("Yes")
else:
print("No") |
s176051638 | p02613 | u015019251 | 2,000 | 1,048,576 | Wrong Answer | 146 | 16,180 | 393 | 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`,... | # -*- coding: utf-8 -*-
"""
Created on Sat Aug 15 17:00:46 2020
@author: saito
"""
# %% import phase
# %% input phase
N = int(input())
S = [0]*N
for i in range(N):
S[i] = input()
# %% process phase
C = [0]*4
rslt = ['AC', 'WA', 'TLE', 'RE']
for i in range(4):
C[i] = S.count(rslt[i])
# %%output phase
for ... | s725735092 | Accepted | 144 | 16,184 | 392 | # -*- coding: utf-8 -*-
"""
Created on Sat Aug 15 17:00:46 2020
@author: saito
"""
# %% import phase
# %% input phase
N = int(input())
S = [0]*N
for i in range(N):
S[i] = input()
# %% process phase
C = [0]*4
rslt = ['AC', 'WA', 'TLE', 'RE']
for i in range(4):
C[i] = S.count(rslt[i])
# %%output phase
for ... |
s957752753 | p03338 | u102242691 | 2,000 | 1,048,576 | Wrong Answer | 22 | 3,064 | 280 | 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 = list(input())
x = []
y = []
ans = []
for i in range(1,n):
x = s[0:i]
y = s[i:n]
print(x)
print(y)
for j in range(len(x)):
a = 0
if y.count(x[j]) >= 1:
a += 1
ans.append(a)
print(ans)
print(max(ans))
| s845017467 | Accepted | 18 | 3,060 | 253 | n = int(input())
s = input()
ans = 0
for i in range(1, n):
head = s[:i]
tail = s[i:]
cnt = 0
for i in range(26):
c = chr(ord('a') + i)
if c in head and c in tail:
cnt += 1
ans = max(ans, cnt)
print(ans) |
s104399106 | p02606 | u081075058 | 2,000 | 1,048,576 | Wrong Answer | 29 | 9,020 | 67 | How many multiples of d are there among the integers between L and R (inclusive)? | L,R,d = map(int,input().split())
r = R//4
l = (L-1)//4
print(r-l) | s706177420 | Accepted | 24 | 9,168 | 67 | L,R,d = map(int,input().split())
r = R//d
l = (L-1)//d
print(r-l) |
s320363711 | p02678 | u285257696 | 2,000 | 1,048,576 | Wrong Answer | 2,206 | 35,176 | 674 | 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().rstrip().split())
G = [[] for i in range(N+1)]
for i in range(M):
A, B = map(int, input().rstrip().split())
G[A].append(B)
G[B].append(A)
sign = [-1]*(N+1)
sign[1] = 0
queue = deque([1])
while queue:
node = queue.popleft()
for next in G[nod... | s322541348 | Accepted | 622 | 34,168 | 572 | from collections import deque
N, M = map(int, input().rstrip().split())
G = [[] for i in range(N+1)]
for i in range(M):
A, B = map(int, input().rstrip().split())
G[A].append(B)
G[B].append(A)
sign = [-1]*(N+1)
sign[0] = None
sign[1] = 0
queue = deque([1])
while queue:
node = queue.popleft()
fo... |
s511064972 | p00015 | u957021485 | 1,000 | 131,072 | Wrong Answer | 30 | 7,692 | 881 | A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. If given integers or t... | import sys
import itertools
dataset_num = int(input())
class Overflow(Exception):
pass
for _ in range(dataset_num):
try:
k1 = input()
k2 = input()
k1_val = [0] * 80
k2_val = [0] * 80
if len(k1) >= 80 or len(k2) >= 80:
raise Overflow()
for ... | s434659223 | Accepted | 30 | 7,656 | 937 | import sys
import itertools
dataset_num = int(input())
class Overflow(Exception):
pass
for _ in range(dataset_num):
try:
k1 = input()
k2 = input()
k1_val = [0] * 100
k2_val = [0] * 100
if len(k1) > 80 or len(k2) > 80:
raise Overflow()
for ... |
s414843703 | p02694 | u030856690 | 2,000 | 1,048,576 | Wrong Answer | 23 | 9,172 | 279 | 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... | # -*- coding: utf-8 -*-
"""
Created on Sat May 2 19:45:18 2020
@author: harsh
"""
#%%
import math
x=int(input())
rate=100
i=1
while(True):
if(rate>=x):
print(i)
break
else:
rate=rate*1.01
i+=1
#print((math.log(x/100))/(math.log(1.01)))
| s392216002 | Accepted | 25 | 9,096 | 286 | # -*- coding: utf-8 -*-
"""
Created on Sat May 2 19:45:18 2020
@author: harsh
"""
#%%
import math
x=int(input())
rate=100
i=1
while(True):
if(rate>=x):
print(i-1)
break
else:
rate=int(rate*1.01)
i+=1
#print((math.log(x/100))/(math.log(1.01)))
|
s334475941 | p03698 | u277104886 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 93 | You are given a string S consisting of lowercase English letters. Determine whether all the characters in S are different. | s = input()
for i in s:
if s.count(i) != 1:
print('No')
exit
print('Yes') | s739672933 | Accepted | 18 | 2,940 | 95 | s = input()
for i in s:
if s.count(i) != 1:
print('no')
exit()
print('yes') |
s627637287 | p03719 | u550574002 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 59 | 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(int,input().split())
print(("NO","YES")[a<=c<=b]) | s217251817 | Accepted | 17 | 2,940 | 59 | a,b,c=map(int,input().split())
print(("No","Yes")[a<=c<=b]) |
s212968048 | p04043 | u464912173 | 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())
s = sorted([a, b, c])
print('Yes' if s[0] ==5 and s[1] == 5 and s[2]== 7 else 'No') | s043573551 | Accepted | 17 | 2,940 | 85 | a,b,c = sorted(map(int, input().split()))
print("YES" if a==b==5 and c ==7 else "NO") |
s233569252 | p03302 | u583276018 | 2,000 | 1,048,576 | Wrong Answer | 30 | 8,968 | 97 | You are given two integers a and b. Determine if a+b=15 or a\times b=15 or neither holds. Note that a+b=15 and a\times b=15 do not hold at the same time. | a, b = map(int, input().split())
if(a + b == 15 or a * b == 15):
print("*")
else:
print("x") | s589904855 | Accepted | 32 | 9,028 | 115 | a, b = map(int, input().split())
if(a + b == 15):
print("+")
elif(a * b == 15):
print("*")
else:
print("x")
|
s482414637 | p03720 | u652081898 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 214 | 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? | n, m = map(int, input().split())
bridge = [list(map(int, input().split())) for _ in range(m)]
for i in range(n):
ans = 0
for x, y in bridge:
if x == i or y == i:
ans += 1
print(ans) | s337072818 | Accepted | 18 | 2,940 | 220 | n, m = map(int, input().split())
bridge = [list(map(int, input().split())) for _ in range(m)]
for i in range(1, n+1):
ans = 0
for x, y in bridge:
if x == i or y == i:
ans += 1
print(ans)
|
s146594177 | p03695 | u844789719 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 242 | In AtCoder, a person who has participated in a contest receives a _color_ , which corresponds to the person's rating as follows: * Rating 1-399 : gray * Rating 400-799 : brown * Rating 800-1199 : green * Rating 1200-1599 : cyan * Rating 1600-1999 : blue * Rating 2000-2399 : yellow * Rating 2400-2799 : or... | N = input()
a = [int(i) for i in input().split()]
scores = [0,0,0,0,0,0,0,0]
score8 = 0
for i in a:
checknum = int(i/400)
if checknum > 7:
score8 += 1
else:
scores[checknum] = 1
print(min([sum(scores) + score8,8])) | s809865057 | Accepted | 18 | 2,940 | 214 | N = int(input())
A = [int(_) for _ in input().split()]
colors = [0] * 9
for a in A:
c = a // 400
if c < 8:
colors[c] = 1
else:
colors[8] += 1
print(max(sum(colors[:8]), 1), sum(colors))
|
s740410065 | p03502 | u218843509 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 97 | An integer X is called a Harshad number if X is divisible by f(X), where f(X) is the sum of the digits in X when written in base 10. Given an integer N, determine whether it is a Harshad number. | n = int(input())
t = sum(map(int, list(str(n))))
if n // t == 0:
print("Yes")
else:
print("No") | s107592426 | Accepted | 18 | 2,940 | 96 | n = int(input())
t = sum(map(int, list(str(n))))
if n % t == 0:
print("Yes")
else:
print("No") |
s104463653 | p03433 | u379424722 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 95 | 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())
M = N % 500
if M < A:
print("YES")
else:
print("NO") | s552009360 | Accepted | 17 | 2,940 | 96 | N = int(input())
A = int(input())
M = N % 500
if M <= A:
print("Yes")
else:
print("No") |
s533840023 | p02255 | u209940149 | 1,000 | 131,072 | Wrong Answer | 20 | 5,592 | 203 | Write a program of the Insertion Sort algorithm which sorts a sequence A in ascending order. The algorithm should be based on the following pseudocode: for i = 1 to A.length-1 key = A[i] /* insert A[i] into the sorted sequence A[0,...,j-1] */ j = i - 1 while j >= 0 and A[j] > key ... | n = int(input())
A = list(map(int, input().split()))
for i in range(1, n):
v = A[i]
j = i - 1
while j >= 0 and A[j] > v:
A[j + 1] = A[j]
j -= 1
A[j + 1] = v
print(A)
| s196350000 | Accepted | 20 | 5,984 | 214 | n = int(input())
A = list(map(int, input().split()))
print(*A)
for i in range(1, n):
v = A[i]
j = i - 1
while j >= 0 and A[j] > v:
A[j + 1] = A[j]
j -= 1
A[j + 1] = v
print(*A)
|
s799429618 | p03486 | u870518235 | 2,000 | 262,144 | Wrong Answer | 26 | 9,072 | 701 | You are given strings s and t, consisting of lowercase English letters. You will create a string s' by freely rearranging the characters in s. You will also create a string t' by freely rearranging the characters in t. Determine whether it is possible to satisfy s' < t' for the lexicographic order. | # B - Two Anagrams
s = list(input())
t = list(input())
s = sorted(s)
s = "".join(s)
t = sorted(t, reverse=True)
t = "".join(t)
print(s,t)
ans = ""
N = min(len(s),len(t))
for i in range(N):
print(ord(s[i]), ord(t[i]))
if ord(s[i]) == ord(t[i]):
pass
elif ord(s[i]) < ord(t[i]):
ans = "Y... | s924634682 | Accepted | 27 | 9,096 | 657 | # B - Two Anagrams
s = list(input())
t = list(input())
s = sorted(s)
s = "".join(s)
t = sorted(t, reverse=True)
t = "".join(t)
ans = ""
N = min(len(s),len(t))
for i in range(N):
if ord(s[i]) == ord(t[i]):
pass
elif ord(s[i]) < ord(t[i]):
ans = "Yes"
break
else:
ans = "N... |
s029844170 | p03720 | u117193815 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 212 | 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? | n,m = map(int ,input().split())
l=[list(map(int ,input().split())) for x in range(m)]
count=0
for i in range(1,m+1):
for j in range(m):
if i in l[j]:
count+=1
print(count)
count=0 | s403644698 | Accepted | 17 | 3,060 | 217 | n,m = map(int ,input().split())
l=[list(map(int ,input().split())) for x in range(m)]
count=0
for i in range(1,n+1):
for j in range(m):
if i in l[j]:
count+=1
print(count)
count=0 |
s298837505 | p00015 | u747479790 | 1,000 | 131,072 | Wrong Answer | 20 | 7,568 | 113 | A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. If given integers or t... | n=int(input())
for i in range(n):
a=input()
if a==1:
break
b=input()
print(str(a)+str(b)) | s882422220 | Accepted | 30 | 7,572 | 167 | n = int(input())
for i in range(n):
a = int(input())
b = int(input())
if (a + b) < (10 ** 80):
print(a + b)
else:
print("overflow") |
s040515409 | p03836 | u780962115 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 163 | 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())
string="U"*(ty-sy)+"R"*(tx-sx)+"L"*(tx-sx+1)+"U"*(ty-sy+1)+"R"*(tx-sx+1)+"D"+"R"+"D"*(ty-sy+1)+"L"*(tx-sx+1)+"U"
print(string) | s610125846 | Accepted | 17 | 3,060 | 175 | sx,sy,tx,ty=map(int,input().split())
string="U"*(ty-sy)+"R"*(tx-sx)+"D"*(ty-sy)+"L"*(tx-sx+1)+"U"*(ty-sy+1)+"R"*(tx-sx+1)+"D"+"R"+"D"*(ty-sy+1)+"L"*(tx-sx+1)+"U"
print(string) |
s546111829 | p03478 | u256801986 | 2,000 | 262,144 | Wrong Answer | 768 | 3,472 | 387 | 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). | def DigitsSUM(Num):
sumN = 0
while Num > 0:
sumN += Num % 10
Num/=10
return int(sumN)
N,A,B = input().split()
LowerLimit=int(A)
UpperLimit=int(B)
num = int(N)
sumary = []
counter = 0
for i in range(1,num+1):
sumN = DigitsSUM(i)
if LowerLimit <= sumN and sumN <= UpperLimit+1:
... | s588062693 | Accepted | 887 | 3,064 | 371 | def DigitsSUM(Num):
sumN = 0
while Num > 0:
sumN += int(Num) % 10
Num /= 10
return int(sumN)
N,A,B = input().split()
LowerLimit=int(A)
UpperLimit=int(B)
num = int(N)
sumary = []
counter = 0
for i in range(1,num+1):
sumN = DigitsSUM(i)
if LowerLimit <= sumN and sumN <= UpperLim... |
s138067743 | p03813 | u614875193 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 110 | 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. | X=int(input())
ans=X//11
if X%11==0:
print(ans*2)
elif X%11<7:
print(ans*2+1)
else:
print(ans*2+2) | s268213519 | Accepted | 17 | 2,940 | 38 | print('A'+'RB'[int(input())<1200]+'C') |
s882619423 | p02420 | u283452598 | 1,000 | 131,072 | Wrong Answer | 20 | 7,504 | 261 | Your task is to shuffle a deck of n cards, each of which is marked by a alphabetical letter. A single shuffle action takes out h cards from the bottom of the deck and moves them to the top of the deck. The deck of cards is represented by a string as follows. abcdeefab The first character and the las... | moto=""
while True:
x = input()
if x == "-":
print(moto)
break
try:
num = int(x)
cop = moto[:num]
moto = moto[num:]
moto = moto+cop
except:
if moto:
print(moto)
moto = x | s805530872 | Accepted | 20 | 7,592 | 171 | while True:
s = input()
if s == '-':
break
m = int(input())
for mi in range(m):
h = int(input())
s = s[h:] + s[:h]
print(s) |
s950927309 | p03387 | u363825867 | 2,000 | 262,144 | Wrong Answer | 28 | 9,032 | 174 | You are given three integers A, B and C. Find the minimum number of operations required to make A, B and C all equal by repeatedly performing the following two kinds of operations in any order: * Choose two among A, B and C, then increase both by 1. * Choose one among A, B and C, then increase it by 2. It can be ... | A, B, C = sorted(list(map(int, input().split())))
print(A, B, C)
r = C-B
B += r
A += r
print(A, B, C)
s = C-A
if s % 2 == 0:
s = s//2
else:
s = (s//2) + 2
print(r+s)
| s521678172 | Accepted | 28 | 9,112 | 144 | A, B, C = sorted(list(map(int, input().split())))
r = C-B
B += r
A += r
s = C-A
if s % 2 == 0:
s = s//2
else:
s = (s//2) + 2
print(r+s)
|
s672121391 | p03471 | u145415974 | 2,000 | 262,144 | Wrong Answer | 2,104 | 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 = (int(x) for x in input().split())
for a in range(N+1):
for b in range(N+1):
for c in range(N+1):
if Y==10000*a+5000*b+1000*c and N==a+b+c:
ans = [a,b,c]
break
else:
ans = [-1,-1,-1]
print(*ans)
| s729974132 | Accepted | 779 | 3,060 | 212 | N,Y = map(int, input().split())
ans = [-1,-1,-1]
for a in range(N+1):
for b in range(N+1-a):
c = N-a-b
if Y == 10000*a+5000*b+1000*c:
ans = [a,b,c]
break
print(*ans)
|
s351535308 | p02743 | u995861601 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,060 | 115 | Does \sqrt{a} + \sqrt{b} < \sqrt{c} hold? | import math
a, b, c = map(int, input().split())
c -= a+b
if c > math.sqrt(a*b):
print("Yes")
else:
print("No") | s791075045 | Accepted | 19 | 3,064 | 109 | a, b, c = map(int, input().split())
c -= a+b
if c >= 0 and a*b*4 < c**2:
print("Yes")
else:
print("No") |
s034055640 | p03110 | u813286880 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,060 | 236 | 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())
x = []
u = []
for _ in range(N):
inp = input().split(' ')
if inp[1] == 'JPN':
x.append(int(inp[0]))
else:
x.append(float(inp[0]))
u.append(inp[1])
sum = 0
for i in range(N):
sum += x[i]
print(sum)
| s122738114 | Accepted | 20 | 2,940 | 223 | N = int(input())
x = []
for _ in range(N):
inp = input().split(' ')
if inp[1] == 'JPY':
x.append(int(inp[0]))
else:
x.append(float(inp[0]) * 380000.0)
sum = 0
for i in range(N):
sum += x[i]
print(sum)
|
s341959394 | p03998 | u706414019 | 2,000 | 262,144 | Wrong Answer | 31 | 8,944 | 323 | 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())
s = Sa.pop(0)
while True:
if Sa==[]or Sb==[] or Sc ==[]:
break
if s == 'a':
s = Sa.pop(0)
elif s == 'b':
s = Sb.pop(0)
else:
s = Sc.pop(0)
if Sa ==[]:
print('A')
elif Sb == []:
print('B')
else:
print('C... | s151341155 | Accepted | 29 | 8,848 | 379 | Sa = list(input())
Sb = list(input())
Sc = list(input())
s = Sa.pop(0)
while True:
if s == 'a':
if Sa ==[]:
print('A')
break
s = Sa.pop(0)
elif s == 'b':
if Sb ==[]:
print('B')
break
s = Sb.pop(0)
else:
if Sc ==[]:
... |
s010826015 | p03494 | u516361212 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 150 | 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 = input()
list_a = list(map(int,input().split()))
ans = 0
while all(a % 2 == 0 for a in list_a):
list_a = [a / 2 for a in list_a]
ans += 1 | s188230687 | Accepted | 19 | 3,060 | 162 | n = input()
list_a = list(map(int,input().split()))
ans = 0
while all(a % 2 == 0 for a in list_a):
list_a = [a / 2 for a in list_a]
ans += 1
print(ans) |
s429726976 | p00137 | u546285759 | 1,000 | 131,072 | Wrong Answer | 30 | 7,688 | 176 | 古典的な乱数生成方法の一つである平方採中法のプログラムを作成します。平方採中法は、フォンノイマンによって 1940 年代半ばに提案された方法です。 平方採中法は、生成する乱数の桁数を n としたとき、初期値 s の2乗を計算し、その数値を 2n 桁の数値とみて、(下の例のように 2 乗した桁数が足りないときは、0 を補います。)その中央にある n 個の数字を最初の乱数とします。次にこの乱数を 2 乗して、同じ様に、中央にある n 個の数字をとって、次の乱数とします。例えば、123 を初期値とすると 1232 = 00015129 → 0151 1512 = 00022801 → 0228 2282... | n = int(input())
for i in range(n):
s = int(input())
print("Case {}".format(i+1))
for _ in range(10):
s = int("{:08d}".format(s ** 2)[2:7])
print(s) | s577556772 | Accepted | 30 | 7,524 | 177 | n = int(input())
for i in range(n):
s = int(input())
print("Case {}:".format(i+1))
for _ in range(10):
s = int("{:08d}".format(s ** 2)[2:6])
print(s) |
s359498597 | p02265 | u848218390 | 1,000 | 131,072 | Wrong Answer | 20 | 5,604 | 564 | Your task is to implement a double linked list. Write a program which performs the following operations: * insert x: insert an element with key x into the front of the list. * delete x: delete the first element which has the key of x from the list. If there is not such element, you need not do anything. * delet... | n = int(input("command number:"))
L = []
for i in range(n):
com = input()
if com == "deleteFirst":
del L[0]
elif com == "deleteLast":
del L[len(L)-1]
else:
c = com.split()
if c[0] == "insert":
L.insert(0, int(c[1]))
elif c[0] == "delete":
... | s344197370 | Accepted | 4,950 | 45,884 | 450 | from collections import deque
n = int(input())
L = deque()
for i in range(n):
com = input()
if com[0] == 'i':
C = com.split()
L.appendleft(int(C[1]))
else:
if com[6] == 'F':
L.popleft()
elif com[6] == 'L':
L.pop()
else:
C = com.sp... |
s650061550 | p03997 | u089142196 | 2,000 | 262,144 | Wrong Answer | 19 | 2,940 | 62 | 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) | s023105330 | Accepted | 16 | 2,940 | 63 | a=int(input())
b=int(input())
h=int(input())
print((a+b)*h//2) |
s542937689 | p03730 | u445511055 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 463 | 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... | # -*- coding: utf-8 -*-
def main():
"""Function."""
a, b, c = map(int, input().split())
check = set()
temp = a
flag = 0
while temp % b not in check:
print(check)
print(temp)
if c in check:
flag = 1
break
else:
check.add(temp ... | s622632905 | Accepted | 18 | 3,060 | 422 | # -*- coding: utf-8 -*-
def main():
"""Function."""
a, b, c = map(int, input().split())
check = set()
temp = a
flag = 0
while temp % b not in check:
if c in check:
flag = 1
break
else:
check.add(temp % b)
temp = temp + a
if ... |
s268657294 | p03679 | u580697892 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 83 | 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())
print("delicious" if a+b <= x else "dangerous") | s158925634 | Accepted | 17 | 2,940 | 158 | # coding: utf-8
X, A, B = map(int, input().split())
if A - B >= 0:
print("delicious")
elif A + X - B >= 0:
print("safe")
else:
print("dangerous")
|
s947557310 | p03214 | u408375121 | 2,525 | 1,048,576 | Wrong Answer | 17 | 3,060 | 163 | Niwango-kun is an employee of Dwango Co., Ltd. One day, he is asked to generate a thumbnail from a video a user submitted. To generate a thumbnail, he needs to select a frame of the video according to the following procedure: * Get an integer N and N integers a_0, a_1, ..., a_{N-1} as inputs. N denotes the numbe... | n = int(input())
a = list(map(int, input().split()))
mean = sum(a) / n
INF = 10**5
flg = INF
for i in range(n):
if abs(mean - a[i]) < flg:
idx = i
print(idx) | s736970747 | Accepted | 17 | 3,060 | 191 | n = int(input())
a = list(map(int, input().split()))
mean = sum(a) / n
INF = 10**5
flg = INF
for i in range(n):
if abs(mean - a[i]) < flg:
idx = i
flg = abs(mean - a[i])
print(idx)
|
s937622471 | p03455 | u530169312 | 2,000 | 262,144 | Wrong Answer | 30 | 9,104 | 182 | 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())
c = a*b
if c / 2 ==0:
print('Even')
else:
print('Odd') | s661706977 | Accepted | 24 | 8,920 | 182 |
a,b=map(int,input().split())
c = a*b
if c % 2 ==0:
print('Even')
else:
print('Odd') |
s810045787 | p03545 | u351241495 | 2,000 | 262,144 | Wrong Answer | 19 | 3,444 | 592 | 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=input()
listA=[0,0,0,0]
i=0
for x in s:
listA[i]=int(x)
i+=1
a=listA[0]
b=listA[1]
c=listA[2]
d=listA[3]
if(a+b+c+d==7):
print("%d+%d+%d+%d==7"% (a,b,c,d))
elif(a+b+c-d==7):
print("%d+%d+%d-%d==7"% (a,b,c,d))
elif(a+b-c+d==7):
print("%d+%d-%d+%d==7" % (a, b, c, d))
elif(a+b-c-d==7):
print("%d+... | s355859736 | Accepted | 19 | 3,064 | 584 | s=input()
listA=[0,0,0,0]
i=0
for x in s:
listA[i]=int(x)
i+=1
a=listA[0]
b=listA[1]
c=listA[2]
d=listA[3]
if(a+b+c+d==7):
print("%d+%d+%d+%d=7"% (a,b,c,d))
elif(a+b+c-d==7):
print("%d+%d+%d-%d=7"% (a,b,c,d))
elif(a+b-c+d==7):
print("%d+%d-%d+%d=7" % (a, b, c, d))
elif(a+b-c-d==7):
print("%d+%d-... |
s267017347 | p03636 | u633548583 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 51 | 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=str(input())
a=len(s[1:-1])
print(s[0]+'a'+s[-1]) | s229001292 | Accepted | 17 | 2,940 | 37 | a,*b,c=input()
print(a+str(len(b))+c) |
s920095666 | p03377 | u816116805 | 2,000 | 262,144 | Wrong Answer | 20 | 3,316 | 90 | There are a total of A + B cats and dogs. Among them, A are known to be cats, but the remaining B are not known to be either cats or dogs. Determine if it is possible that there are exactly X cats among these A + B animals. | a,b,x = map(int,input().split())
if a <= x <= a+b:
print("Yes")
else:
print("No")
| s914528780 | Accepted | 17 | 2,940 | 90 | a,b,x = map(int,input().split())
if a <= x <= a+b:
print("YES")
else:
print("NO")
|
s143879592 | p02393 | u917722865 | 1,000 | 131,072 | Time Limit Exceeded | 9,990 | 5,584 | 354 | Write a program which reads three integers, and prints them in ascending order. | abc_s = input()
abc_a = abc_s.split(" ")
abc = [int(x) for x in abc_a]
sorted = False
while sorted == False:
sorted == True
if abc[0] > abc[1]:
sorted == False
tmp = abc[0]
abc[0] = abc[1]
abc[1] = tmp
if abc[1] > abc[2]:
sorted == False
tmp = abc[1]
abc[1] = abc[2]
abc[2] = tmp
... | s685497509 | Accepted | 20 | 5,600 | 363 | abc_s = input()
abc_a = abc_s.split(" ")
abc = [int(x) for x in abc_a]
sorted = False
while sorted == False:
sorted = True
if abc[0] > abc[1]:
sorted = False
tmp = abc[0]
abc[0] = abc[1]
abc[1] = tmp
if abc[1] > abc[2]:
sorted = False
tmp = abc[1]
abc[1] = abc[2]
abc[2] = tmp
... |
s578394132 | p03694 | u767995501 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 52 | It is only six months until Christmas, and AtCoDeer the reindeer is now planning his travel to deliver gifts. There are N houses along _TopCoDeer street_. The i-th house is located at coordinate a_i. He has decided to deliver gifts to all these houses. Find the minimum distance to be traveled when AtCoDeer can star... | l=sorted(map(int,input().split()))
print(l[-1]-l[0]) | s885405855 | Accepted | 20 | 3,064 | 60 | input()
l=sorted(map(int,input().split()))
print(l[-1]-l[0]) |
s394335538 | p03693 | u940780117 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 94 | AtCoDeer has three cards, one red, one green and one blue. An integer between 1 and 9 (inclusive) is written on each card: r on the red card, g on the green card and b on the blue card. We will arrange the cards in the order red, green and blue from left to right, and read them as a three-digit integer. Is this i... | R,G,B =map(str,input().split())
RGB=R+G+B
if int(RGB) %4 ==0:
print('Yes')
else:
print('No') | s847883205 | Accepted | 17 | 2,940 | 126 | cards=list(map(int,input().split()))
num=cards[0]*100+cards[1]*10+cards[2]
if num%4==0:
print('YES')
else:
print('NO') |
s717436195 | p03694 | u898143674 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 59 | It is only six months until Christmas, and AtCoDeer the reindeer is now planning his travel to deliver gifts. There are N houses along _TopCoDeer street_. The i-th house is located at coordinate a_i. He has decided to deliver gifts to all these houses. Find the minimum distance to be traveled when AtCoDeer can star... | a = list(map(int, input().split()))
print(max(a) - min(a))
| s002927467 | Accepted | 17 | 2,940 | 67 | input()
a = list(map(int, input().split()))
print(max(a) - min(a))
|
s167861068 | p02257 | u339728776 | 1,000 | 131,072 | Wrong Answer | 20 | 5,588 | 288 | 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. | x = int(input())
count = 0
for i in range(0, x):
a = int(input())
if a % 2 == 0:
count += 1
else:
c =int( a / 2)
for j in range ( 3, c ):
if a % j == 0:
count += 1
break;
print(x-count)
| s052890023 | Accepted | 2,240 | 5,604 | 262 | x = int(input())
count = 0
for i in range(0, x):
a = int(input())
for j in range ( 2, a ):
c = int(a)
if a % j == 0:
count += 1
break;
if j * j > c:
break;
print(x-count)
|
s612535553 | p04043 | u384793271 | 2,000 | 262,144 | Wrong Answer | 27 | 9,020 | 121 | 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 ... | abc = list(map(int, input().split()))
if abc.count(5) == 2 and abc.count(7) == 1:
print('Yes')
else:
print('No') | s983835427 | Accepted | 25 | 8,964 | 114 | s = list(map(int, input().split()))
if s.count(5) == 2 and s.count(7) == 1:
print('YES')
else:
print('NO') |
s496274837 | p03607 | u803647747 | 2,000 | 262,144 | Wrong Answer | 211 | 16,268 | 325 | You are playing the following game with Joisino. * Initially, you have a blank sheet of paper. * Joisino announces a number. If that number is written on the sheet, erase the number from the sheet; if not, write the number on the sheet. This process is repeated N times. * Then, you are asked a question: How many... | N = int(input())
a_list = [int(input())for _ in range(N)]
count_dct = {}
for input_num in a_list:
if input_num in count_dct.keys():
count_dct[input_num] += 1
else:
count_dct[input_num] = 1
counter = 0
for i, j in count_dct.items():
if j%2 == 1:
counter +=1
else:
... | s334653885 | Accepted | 216 | 16,268 | 345 | N = int(input())
a_list = [int(input())for _ in range(N)]
count_dct = {}
for input_num in a_list:
if input_num in count_dct.keys():
count_dct[input_num] += 1
else:
count_dct[input_num] = 1
counter = 0
for i, j in count_dct.items():
if j%2 == 1:
counter +=1
else:
... |
s072821591 | p03455 | u972795791 | 2,000 | 262,144 | Wrong Answer | 30 | 8,904 | 89 | AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd. | a,b=input().split()
a,b=map(int,(a,b))
if a*b%2==0:
print("EVEN")
else :
print("0dd") | s901592068 | Accepted | 27 | 8,956 | 89 | a,b=input().split()
a,b=map(int,(a,b))
if a*b%2==0:
print("Even")
else :
print("Odd") |
s615061573 | p02850 | u865119809 | 2,000 | 1,048,576 | Wrong Answer | 506 | 30,000 | 369 | Given is a tree G with N vertices. The vertices are numbered 1 through N, and the i-th edge connects Vertex a_i and Vertex b_i. Consider painting the edges in G with some number of colors. We want to paint them so that, for each vertex, the colors of the edges incident to that vertex are all different. Among the colo... | n = int(input())
graph = [[] for i in range(n)]
for i in range(1,n):
a,b = map(int,input().split())
graph[a-1].append([b,i])
ans = [0]*(n-1)
def col(now,color):
c = 1
for [b,j] in graph[now-1]:
if c == color:
c += 1
ans[j-1] = c
col(b,c)
c += 1
print(ma... | s579959098 | Accepted | 588 | 70,996 | 420 | import sys
sys.setrecursionlimit(10 ** 7)
n = int(input())
graph = [[] for i in range(n)]
for i in range(1,n):
a,b = map(int,input().split())
graph[a-1].append([b,i])
ans = [0]*(n-1)
def col(now,color):
c = 1
for [b,j] in graph[now-1]:
if c == color:
c += 1
ans[j-1] = c
... |
s079283157 | p03338 | u811169796 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,068 | 155 | 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 = list(input())
ans = 0
for i in range(1,n-1):
sa = set(s[:i])
sb = set(s[i+1:])
ans = max(ans,len(sa&sb))
print(ans)
| s719490989 | Accepted | 18 | 3,064 | 147 | n = int(input())
s = list(input())
ans = 0
for i in range(1,n-1):
sa = set(s[:i])
sb = set(s[i:])
ans = max(ans,len(sa&sb))
print(ans) |
s387332872 | p03997 | u894440853 | 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, b, h = map(int, [input() for _ in range(3)])
print(round((a + b) * h)) | s612712078 | Accepted | 17 | 2,940 | 80 | a, b, h = map(int, [input() for _ in range(3)])
print(round(((a + b) * h) / 2))
|
s425612623 | p03563 | u484856305 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 42 | 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... | a=int(input())
b=int(input())
print(b-2*a) | s537268580 | Accepted | 17 | 2,940 | 42 | r=int(input())
g=int(input())
print(2*g-r) |
s383616650 | p03385 | u127856129 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 123 | You are given a string S of length 3 consisting of `a`, `b` and `c`. Determine if S can be obtained by permuting `abc`. | a=input()
if a=="abc" and a=="acb" and a=="bac" and a=="bca" and a=="cab" and a=="cba":
print="Yes"
else:
print="No"
| s494994729 | Accepted | 21 | 3,060 | 121 | a=input()
if a=="abc" or a=="acb" or a=="bac" or a=="bca" or a=="cab" or a=="cba":
print("Yes")
else:
print("No")
|
s094345106 | p04029 | u822179469 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 85 | 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? | n = int(input())
total = 0
for i in range(n):
total = total + i*i
print(total) | s688828796 | Accepted | 17 | 2,940 | 85 | n = int(input())
total = 0
for i in range(n+1):
total = total + i
print(total) |
s532835880 | p03623 | u392319141 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 70 | 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))) | s242577286 | Accepted | 17 | 2,940 | 75 | x, a, b = map(int, input().split())
print('AB'[abs(x - a) > abs(x - b)::2]) |
s531080847 | p03719 | u604262137 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 133 | You are given three integers A, B and C. Determine whether C is not less than A and not greater than B. | table = input().split()
A,B,C = int(table[0]),int(table[1]),int(table[2])
if A <= C and C<= B:
print('yes')
else:
print('no') | s917350854 | Accepted | 17 | 2,940 | 133 | table = input().split()
A,B,C = int(table[0]),int(table[1]),int(table[2])
if A <= C and C<= B:
print('Yes')
else:
print('No') |
s175868019 | p03090 | u668785999 | 2,000 | 1,048,576 | Wrong Answer | 31 | 9,356 | 266 | You are given an integer N. Build an undirected graph with N vertices with indices 1 to N that satisfies the following two conditions: * The graph is simple and connected. * There exists an integer S such that, for every vertex, the sum of the indices of the vertices adjacent to that vertex is S. It can be proved... | N = int(input())
if(N%2 == 0):
for i in range(1,N):
for j in range(i+1,N+1):
if(i+j != N+1):
print(*[i,j])
else:
for i in range(1,N):
for j in range(i+1,N+1):
if(i+j != N):
print(*[i,j]) | s621545903 | Accepted | 28 | 9,264 | 291 | N = int(input())
print(N*(N-1)//2 - N//2)
if(N%2 == 0):
for i in range(1,N):
for j in range(i+1,N+1):
if(i+j != N+1):
print(*[i,j])
else:
for i in range(1,N):
for j in range(i+1,N+1):
if(i+j != N):
print(*[i,j]) |
s645596716 | p04012 | u848647227 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 168 | 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. | a = list(input())
br = []
for ar in a:
br.append(a.count(ar))
x = 0
for b in br:
if b % 2 == 1:
x += 1
if x == 0:
print("YES")
else:
print("NO") | s882686349 | Accepted | 17 | 2,940 | 168 | a = list(input())
br = []
for ar in a:
br.append(a.count(ar))
x = 0
for b in br:
if b % 2 == 1:
x += 1
if x == 0:
print("Yes")
else:
print("No") |
s573791126 | p02259 | u456917014 | 1,000 | 131,072 | Wrong Answer | 20 | 5,600 | 248 | Write a program of the Bubble Sort algorithm which sorts a sequence _A_ in ascending order. The algorithm should be based on the following pseudocode: BubbleSort(A) 1 for i = 0 to A.length-1 2 for j = A.length-1 downto i+1 3 if A[j] < A[j-1] 4 swap A[j] and A[j-1] Note that, in... | N=int(input())
A=list(map(int,input().split()))[::-1]
flag=1
count=0
while flag:
flag=0
for i in range(N-1):
if A[i]<A[i+1]:
A[i],A[i+1]=A[i+1],A[i]
flag=1
count+=1
print(A[::-1],count,sep='\n')
| s760393048 | Accepted | 20 | 5,612 | 247 | N=int(input())
A=list(map(int,input().split()))[::-1]
flag=1
count=0
while flag:
flag=0
for i in range(N-1):
if A[i]<A[i+1]:
A[i],A[i+1]=A[i+1],A[i]
flag=1
count+=1
print(*A[::-1])
print(count)
|
s169913417 | p04039 | u497046426 | 2,000 | 262,144 | Wrong Answer | 75 | 3,064 | 251 | Iroha is very particular about numbers. There are K digits that she dislikes: D_1, D_2, ..., D_K. She is shopping, and now paying at the cashier. Her total is N yen (the currency of Japan), thus she has to hand at least N yen to the cashier (and possibly receive the change). However, as mentioned before, she is very ... | numbers = {str(i) for i in range(10)}
N, K = map(int, input().split())
*D, = map(str, input().split())
D = set(D)
available = numbers - D
ans = 0
for i in range(N, 100000):
nums = set(str(i))
if nums < available:
print(i)
break | s965720108 | Accepted | 65 | 3,064 | 252 | numbers = {str(i) for i in range(10)}
N, K = map(int, input().split())
*D, = map(str, input().split())
D = set(D)
available = numbers - D
ans = 0
for i in range(N, 100000):
nums = set(str(i))
if nums <= available:
print(i)
break |
s764911014 | p02694 | u392058721 | 2,000 | 1,048,576 | Wrong Answer | 21 | 9,156 | 104 | 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
x = int(input())
d = 100
a = 0
while x >= d:
d += math.floor(d*0.01)
a += 1
print(a) | s235341659 | Accepted | 22 | 9,160 | 104 | import math
x = int(input())
d = 100
a = 0
while x > d:
d += math.floor(d*0.01)
a += 1
print(a) |
s344475480 | p02408 | u986199217 | 1,000 | 131,072 | Wrong Answer | 20 | 5,596 | 321 | Taro is going to play a card game. However, now he has only n cards, even though there should be 52 cards (he has no Jokers). The 52 cards include 13 ranks of each of the four suits: spade, heart, club and diamond. | Suit = ["S","H","C","D"]
deck = []
for i in range(4):
for n in range(1,14):
tmp = (Suit[i]+" "+str(n))
deck.append(tmp)
u = int(input())
for _ in range(u):
s = str(input())
if s in deck:
deck.remove(s)
for y in range(len(deck)):
print('{} {}'.format(deck[y][0],deck[y][2]))
... | s657384672 | Accepted | 20 | 5,596 | 317 | Suit = ["S","H","C","D"]
deck = []
for i in range(4):
for n in range(1,14):
tmp = (Suit[i]+" "+str(n))
deck.append(tmp)
#print (deck)
u = int(input())
for _ in range(u):
s = str(input())
if s in deck:
deck.remove(s)
for y in range(len(deck)):
print('{}'.format(deck[y]))
|
s935773329 | p03472 | u500297289 | 2,000 | 262,144 | Wrong Answer | 357 | 11,256 | 345 | You are going out for a walk, when you suddenly encounter a monster. Fortunately, you have N katana (swords), Katana 1, Katana 2, …, Katana N, and can perform the following two kinds of attacks in any order: * Wield one of the katana you have. When you wield Katana i (1 ≤ i ≤ N), the monster receives a_i points of d... | N, H = map(int, input().split())
A = []
B = []
for _ in range(N):
a, b = map(int, input().split())
A.append(a)
B.append(b)
a = max(A)
B.sort(reverse=True)
ans = 0
for b in B:
if b < a:
break
H -= b
ans += 1
if H <= 0:
print(ans)
exit()
import math
ans += math.floor... | s539559871 | Accepted | 351 | 11,276 | 344 | N, H = map(int, input().split())
A = []
B = []
for _ in range(N):
a, b = map(int, input().split())
A.append(a)
B.append(b)
a = max(A)
B.sort(reverse=True)
ans = 0
for b in B:
if b < a:
break
H -= b
ans += 1
if H <= 0:
print(ans)
exit()
import math
ans += math.ceil(... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.