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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s382268242 | p02409 | u476441153 | 1,000 | 131,072 | Wrong Answer | 20 | 5,628 | 388 | You manage 4 buildings, each of which has 3 floors, each of which consists of 10 rooms. Write a program which reads a sequence of tenant/leaver notices, and reports the number of tenants for each room. For each notice, you are given four integers b, f, r and v which represent that v persons entered to room r of fth fl... | a = [[0 for i in range(10)] for j in range(12)]
n = int(input())
for i in range(n):
b,f,r,v = map(int, input().split())
a[f-1][r-1] = v
for i in range(1,13):
for y in range(10):
if y==9:
print(a[i-1][y],end='')
else:
print(a[i-1][y],end='')
print(" ",en... | s027060032 | Accepted | 20 | 5,612 | 288 | n = int(input())
a = [[[0 for _ in range(10)] for _ in range(3)] for _ in range(4)]
for _ in range(n):
b, f, r, v = map(int, input().split())
a[b-1][f-1][r-1] += v
for i in range(4):
for j in range(3):
print(' '+' '.join(map(str, a[i][j])))
if i != 3:
print('#'*20)
|
s426265049 | p03149 | u102960641 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 93 | 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". | a = set(map(int, input().split()))
if a == set([1,9,7,4]):
print("Yes")
else:
print("No") | s000917355 | Accepted | 20 | 3,316 | 93 | a = set(map(int, input().split()))
if a == set([9,1,7,4]):
print("YES")
else:
print("NO") |
s424785924 | p03998 | u072717685 | 2,000 | 262,144 | Wrong Answer | 18 | 3,316 | 657 | 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. * ... | aa = input()
bb = input()
cc = input()
def kansu(char,a,b,c):
print("im called {} {} {} {}".format(char,a,b,c))
if char == 'a':
if not a:
return 'a'
else:
char = a[0:1]
a = a[1:]
r = kansu(char,a,b,c)
elif char == 'b':
if not b:
... | s663001420 | Accepted | 18 | 2,940 | 144 | ss = {i:list(input()) for i in "abc"}
x = ss['a'].pop(0)
while True:
if not ss[x]:
print(x.upper())
break
else:
x = ss[x].pop(0) |
s748238502 | p03251 | u607865971 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,064 | 392 | 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... | from sys import stdin
n, m, x, y = [int(x) for x in stdin.readline().rstrip().split()]
xList = [int(x) for x in stdin.readline().rstrip().split()]
yList = [int(x) for x in stdin.readline().rstrip().split()]
isOk = True
xMax = max(xList)
yMin = min(yList)
ret = [int(z) for z in range(xMax+1, yMin+1) if (x < z) an... | s351215709 | Accepted | 18 | 3,060 | 252 | N, M, x, y = [int(x) for x in input().split()]
X = [int(x) for x in input().split()]
Y = [int(x) for x in input().split()]
X.append(x)
Y.append(y)
maX = max(X)
miY = min(Y)
ans = ""
if maX < miY:
ans = "No War"
else:
ans = "War"
print(ans)
|
s971346122 | p03493 | u199290844 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 67 | Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble. | arr = [int(i) for i in input().rstrip().split(' ')]
print(sum(arr)) | s559731684 | Accepted | 17 | 2,940 | 53 | arr = [int(i) for i in list(input())]
print(sum(arr)) |
s051097609 | p02612 | u686536081 | 2,000 | 1,048,576 | Wrong Answer | 26 | 9,036 | 25 | 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. | print(int(input())%1000)
| s345002774 | Accepted | 27 | 9,140 | 36 | print((1000-int(input())%1000)%1000) |
s929422584 | p04029 | u264265458 | 2,000 | 262,144 | Wrong Answer | 23 | 3,316 | 31 | 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? | a=int(input())
print((a+1)*a/2) | s422583682 | Accepted | 17 | 2,940 | 36 | a=int(input())
print(int((a+1)*a/2)) |
s733256523 | p02399 | u992449685 | 1,000 | 131,072 | Wrong Answer | 20 | 5,596 | 83 | Write a program which reads two integers a and b, and calculates the following values: * a ÷ b: d (in integer) * remainder of a ÷ b: r (in integer) * a ÷ b: f (in real number) | a, b = map(int, input().split())
print('{} {} {}'.format(int(a/b), a % b, a / b))
| s961821099 | Accepted | 20 | 5,600 | 87 | a, b = map(int, input().split())
print('{} {} {:.5f}'.format(int(a/b), a % b, a / b))
|
s519999349 | p03814 | u923712635 | 2,000 | 262,144 | Wrong Answer | 53 | 3,516 | 162 | Snuke has decided to construct a string that starts with `A` and ends with `Z`, by taking out a substring of a string s (that is, a consecutive part of s). Find the greatest length of the string Snuke can construct. Here, the test set guarantees that there always exists a substring of s that starts with `A` and ends w... | s = input()
num_A = 0
num_B = 0
for ind,i in enumerate(s):
if(num_A == 0 and i == 'A'):
num_A = ind
if(i == 'Z'):
num_Z = ind
print(num_B - num_A + 1) | s679401142 | Accepted | 51 | 3,516 | 166 | s = input()
num_A = -1
num_Z = -1
for ind,i in enumerate(s):
if(num_A == -1 and i == 'A'):
num_A = ind
if(i == 'Z'):
num_Z = ind
print(num_Z - num_A + 1)
|
s863025211 | p03777 | u706828591 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 67 | Two deer, AtCoDeer and TopCoDeer, are playing a game called _Honest or Dishonest_. In this game, an honest player always tells the truth, and an dishonest player always tell lies. You are given two characters a and b as the input. Each of them is either `H` or `D`, and carries the following information: If a=`H`, AtCo... | x, y = input().split()
if(x != y):
print("H")
else:
print("D") | s959785444 | Accepted | 17 | 2,940 | 68 |
x, y = input().split()
if(x != y):
print("D")
else:
print("H") |
s899176144 | p03963 | u633450100 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 87 | There are N balls placed in a row. AtCoDeer the deer is painting each of these in one of the K colors of his paint cans. For aesthetic reasons, any two adjacent balls must be painted in different colors. Find the number of the possible ways to paint the balls. | N,K = [int(i) for i in input().split()]
answer = K
for i in range(N-1):
answer *= K-1 | s433475178 | Accepted | 19 | 2,940 | 101 | N,K = [int(i) for i in input().split()]
answer = K
for i in range(N-1):
answer *= K-1
print(answer) |
s151906036 | p03836 | u787562674 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 210 | 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())
yu = "U" * (ty - sy)
xr = "R" * (tx - sx)
yd = "D" * (ty - sy)
xl = "L" * (tx - sx)
print(yu + xr + yd + xl + "L" + yu + "U" + xr + "R" + yd + "DD" + xl + "L" + "U") | s626695925 | Accepted | 17 | 3,060 | 222 | sx, sy, tx, ty = map(int, input().split())
yu = "U" * (ty - sy)
xr = "R" * (tx - sx)
yd = "D" * (ty - sy)
xl = "L" * (tx - sx)
print(yu + xr + yd + xl + "L" + yu + "U" + xr + "R" + "D" + "R" + yd + "D" + xl + "L" + "U")
|
s582577049 | p03568 | u226155577 | 2,000 | 262,144 | Wrong Answer | 255 | 3,316 | 263 | We will say that two integer sequences of length N, x_1, x_2, ..., x_N and y_1, y_2, ..., y_N, are _similar_ when |x_i - y_i| \leq 1 holds for all i (1 \leq i \leq N). In particular, any integer sequence is similar to itself. You are given an integer N and an integer sequence of length N, A_1, A_2, ..., A_N. How man... | n = int(input())
*A, = map(int, input().split())
from itertools import product
ans = 0
for P in product(range(3), repeat=10):
even = 0
for i in range(n):
b = A[i] + P[i] - 1
even |= (b % 2) == 0
if even:
ans += 1
print(ans)
| s340911596 | Accepted | 269 | 3,316 | 260 | n = int(input())
*A, = map(int, input().split())
from itertools import product
ans = 0
for P in product(range(3), repeat=n):
even = 0
for i in range(n):
b = A[i] + P[i] - 1
even |= (b % 2) == 0
if even:
ans += 1
print(ans) |
s468278544 | p03399 | u804048521 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 108 | You planned a trip using trains and buses. The train fare will be A yen (the currency of Japan) if you buy ordinary tickets along the way, and B yen if you buy an unlimited ticket. Similarly, the bus fare will be C yen if you buy ordinary tickets along the way, and D yen if you buy an unlimited ticket. Find the minimu... | A = int(input())
B = int(input())
C = int(input())
D = int(input())
print(min(min(A+C, A-D), min(B-C, B-D))) | s482103432 | Accepted | 17 | 2,940 | 108 | A = int(input())
B = int(input())
C = int(input())
D = int(input())
print(min(min(A+C, A+D), min(B+C, B+D))) |
s779029691 | p02608 | u063896676 | 2,000 | 1,048,576 | Wrong Answer | 719 | 9,176 | 364 | 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). | # coding: utf-8
def main():
N = int(input())
fs = [0] * N
for x in range(1, 100):
for y in range(1, 100):
for z in range(1, 100):
i = (x**2) + (y**2) + (z**2) + (x+y) + (y+z) + (z+x)
if i <= N:
fs[i-1] += 1
for i in range(N):
... | s853445286 | Accepted | 744 | 9,136 | 364 | # coding: utf-8
def main():
N = int(input())
fs = [0] * N
for x in range(1, 100):
for y in range(1, 100):
for z in range(1, 100):
i = (x**2) + (y**2) + (z**2) + (x*y) + (y*z) + (z*x)
if i <= N:
fs[i-1] += 1
for i in range(N):
... |
s877207036 | p02850 | u255943004 | 2,000 | 1,048,576 | Wrong Answer | 2,105 | 59,068 | 968 | 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())
AB = []
for _ in range(N-1):
AB.append([int(i) for i in input().split()])
from collections import defaultdict as ddict
tree_children = ddict(set)
tree_parent = ddict(int)
for ab in AB:
tree_children[ab[0]].add(ab[1])
tree_parent[ab[1]] = ab[0]
max_col = 0
for key in tree_children.keys():
... | s931474700 | Accepted | 659 | 44,344 | 804 | N = int(input())
AB = [[]]*(N-1)
for i in range(N-1):
AB[i] = list(map(int,input().split()))
from collections import defaultdict as ddict
from collections import deque
tree = ddict(list)
B = [0]*(N-1)
for i,ab in enumerate(AB):
tree[ab[0]].append(ab[1])
B[i] = ab[1]
C = [0]*N
Q = deque([1])
while Q:
... |
s370401180 | p04043 | u416258526 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 117 | 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 ... | num_list = list(input().split())
if num_list.count(5)==2 and num_list.count(7)==1:
print('YES')
else:
print('NO') | s579591082 | Accepted | 17 | 2,940 | 124 | num_list = list(input().split())
if num_list.count("5")==2 and num_list.count("7")==1:
print('YES')
else:
print('NO')
|
s965238273 | p03997 | u263226212 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 125 | 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. | # -*- coding: utf-8 -*-
# input
a = int(input())
b = int(input())
h = int(input())
# solve & output
print((a + b) * h / 2)
| s442169914 | Accepted | 17 | 2,940 | 130 | # -*- coding: utf-8 -*-
# input
a = int(input())
b = int(input())
h = int(input())
# solve & output
print(int((a + b) * h / 2))
|
s113460307 | p03644 | u620846115 | 2,000 | 262,144 | Wrong Answer | 29 | 9,148 | 31 | 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())
print(n - n%2) | s272834765 | Accepted | 28 | 9,176 | 83 | n = int(input())
ans = 0
for i in range(8):
if 2**i <= n:
ans=2**i
print(ans) |
s209519158 | p02647 | u216015528 | 2,000 | 1,048,576 | Wrong Answer | 2,206 | 32,936 | 418 | We have N bulbs arranged on a number line, numbered 1 to N from left to right. Bulb i is at coordinate i. Each bulb has a non-negative integer parameter called intensity. When there is a bulb of intensity d at coordinate x, the bulb illuminates the segment from coordinate x-d-0.5 to x+d+0.5. Initially, the intensity o... | import copy
n, k = map(int, input().split())
a = list(map(int, input().split()))
b = [1] * n
for _ in range(k):
for i in range(n):
light = 0
for j in range(n):
if i < j:
if (j - a[j] - 0.5) < i:
light += 1
else:
if (j + a[j]... | s325607401 | Accepted | 691 | 124,392 | 1,270 | # ac
import sys
import numpy as np
from numba import njit
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
@njit('(i8[::1],)', cache=True)
def update(a):
n = len(a)
b = np.zeros_like(a)
for i, x in enumerate(a):
l = max(0, i - x) ... |
s458456107 | p03729 | u713539685 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 97 | You are given three strings A, B and C. Check whether they form a _word chain_. More formally, determine whether both of the following are true: * The last character in A and the initial character in B are the same. * The last character in B and the initial character in C are the same. If both are true, print `Y... | A, B, C = input().split()
if A[-1] == B[0] and B[-1] == C[0]:
print('Yes')
else:
print('No') | s149094605 | Accepted | 17 | 2,940 | 97 | A, B, C = input().split()
if A[-1] == B[0] and B[-1] == C[0]:
print('YES')
else:
print('NO') |
s836060220 | p03815 | u934868410 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 51 | Snuke has decided to play with a six-sided die. Each of its six sides shows an integer 1 through 6, and two numbers on opposite sides always add up to 7. Snuke will first put the die on the table with an arbitrary side facing upward, then repeatedly perform the following operation: * Operation: Rotate the die 90° t... | x = int(input())
print((x//11) * 2 + (x % 11 > 5)) | s520543626 | Accepted | 17 | 2,940 | 64 | x = int(input())
print((x//11) * 2 + (x % 11 > 0) + (x%11 > 6)) |
s953731930 | p03556 | u296150111 | 2,000 | 262,144 | Wrong Answer | 22 | 2,940 | 83 | Find the largest square number not exceeding N. Here, a _square number_ is an integer that can be represented as the square of an integer. | n=int(input())
for i in range(n):
if i*i>n:
print(i-1)
break
else:
continue | s992955104 | Accepted | 24 | 2,940 | 84 | n=int(input())
a=1
while a<=n+2:
if a*a<=n:
a+=1
else:
print((a-1)**2)
break |
s469120872 | p03455 | u125269142 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 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 = map(int, input().split())
if a * b % 2 == 0:
print('even')
else:
print('odd') | s748247268 | Accepted | 17 | 2,940 | 95 | a, b = map(int, input().split())
c = a * b
if c % 2 == 0:
print('Even')
else:
print('Odd') |
s708065525 | p03377 | u499259667 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 72 | 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())
print("YES" if x<=a+b and b<=x else "NO") | s498027104 | Accepted | 17 | 2,940 | 72 | a,b,x=map(int,input().split())
print("YES" if x<=a+b and a<=x else "NO") |
s341988613 | p03493 | u063614215 | 2,000 | 262,144 | Wrong Answer | 149 | 12,392 | 106 | Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble. | import numpy as np
s_list = [int(i) for i in list(input())]
ans = np.count_nonzero(s_list!=0)
print(ans) | s359761181 | Accepted | 17 | 2,940 | 97 | s = input()
counter = 0
for i in range(len(s)):
if s[i]=='1':
counter += 1
print(counter) |
s868014597 | p02390 | u737311644 | 1,000 | 131,072 | Wrong Answer | 20 | 7,708 | 100 | 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. | a=int(input())
h=int(int(a)/3600)
b=int((int(a)-h*3600)/60)
s=int((int(a)-h*3600-b*60))
print(h,b,s) | s258433772 | Accepted | 20 | 5,588 | 104 | a=int(input())
h1=a//3600
h2=a%3600
m=h2//60
s=h2%60
h1=str(h1)
m=str(m)
s=str(s)
print(h1+":"+m+":"+s)
|
s627427041 | p03546 | u188745744 | 2,000 | 262,144 | Wrong Answer | 302 | 17,788 | 304 | Joisino the magical girl has decided to turn every single digit that exists on this world into 1. Rewriting a digit i with j (0≤i,j≤9) costs c_{i,j} MP (Magic Points). She is now standing before a wall. The wall is divided into HW squares in H rows and W columns, and at least one square contains a digit between 0 and... | N,M=list(map(int,input().split()))
l=[list(map(int,input().split())) for i in range(10)]
s=[list(map(int,input().split())) for i in range(N)]
from scipy.sparse.csgraph import floyd_warshall
l=floyd_warshall(l)
print(l)
ans=0
for i in s:
for j in i:
ans+=0 if j == -1 else l[j][1]
print(int(ans)) | s156824485 | Accepted | 432 | 27,716 | 295 | N,M=list(map(int,input().split()))
l=[list(map(int,input().split())) for i in range(10)]
s=[list(map(int,input().split())) for i in range(N)]
from scipy.sparse.csgraph import floyd_warshall
l=floyd_warshall(l)
ans=0
for i in s:
for j in i:
ans+=0 if j == -1 else l[j][1]
print(int(ans)) |
s746665809 | p02392 | u698693989 | 1,000 | 131,072 | Wrong Answer | 20 | 7,524 | 172 | Write a program which reads three integers a, b and c, and prints "Yes" if a < b < c, otherwise "No". | x=input().split()
y=list(map(int,x))
a=y[0]
b=y[1]
c=y[2]
if a<b<c:
print("OK")
else:
print("NG") | s133521109 | Accepted | 20 | 5,596 | 121 | list=input().split()
a=int(list[0])
b=int(list[1])
c=int(list[2])
if a < b and b < c:
print("Yes")
else:
print("No")
|
s782151852 | p02260 | u424720817 | 1,000 | 131,072 | Wrong Answer | 20 | 5,596 | 343 | Write a program of the Selection Sort algorithm which sorts a sequence A in ascending order. The algorithm should be based on the following pseudocode: SelectionSort(A) 1 for i = 0 to A.length-1 2 mini = i 3 for j = i to A.length-1 4 if A[j] < A[mini] 5 mini = j 6 swap A[... | times = int(input())
numbers = list(map(int, input().split()))
count = 0
minj = 0
for i in range(times):
minj = i
for j in range(i, times, 1):
if numbers[j] < numbers[minj]:
minj = j
count += 1
numbers[i], numbers[minj] = numbers[minj], numbers[i]
print(' '.join(map(str, nu... | s887986832 | Accepted | 20 | 5,600 | 362 | times = int(input())
numbers = list(map(int, input().split()))
count = 0
minj = 0
for i in range(times):
minj = i
for j in range(i, times, 1):
if numbers[j] < numbers[minj]:
minj = j
if i != minj:
numbers[i], numbers[minj] = numbers[minj], numbers[i]
count += 1
print('... |
s564971342 | p03698 | u203843959 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 109 | You are given a string S consisting of lowercase English letters. Determine whether all the characters in S are different. | S=list(input())
sset=set()
for s in S:
sset.add(s)
if len(sset)==26:
print("yes")
else:
print("no") | s869064852 | Accepted | 17 | 2,940 | 113 | S=list(input())
sset=set()
for s in S:
sset.add(s)
if len(sset)==len(S):
print("yes")
else:
print("no") |
s464950903 | p03360 | u471289663 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 196 | There are three positive integers A, B and C written on a blackboard. E869120 performs the following operation K times: * Choose one integer written on the blackboard and let the chosen integer be n. Replace the chosen integer with 2n. What is the largest possible sum of the integers written on the blackboard after... | a, b, c = map(int, input().split())
k = int(input())
ans = a+b+c
m = 100
if m > a:
m = a
if m > b:
m = b
if m > c:
m = c
ans = ans - m
for i in range(k):
m = m*2
print(ans + m)
| s850540422 | Accepted | 17 | 3,064 | 196 | a, b, c = map(int, input().split())
k = int(input())
ans = a+b+c
m = -100
if m < a:
m = a
if m < b:
m = b
if m < c:
m = c
ans = ans - m
for i in range(k):
m = m*2
print(ans + m) |
s229930822 | p03359 | u266569040 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 62 | 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 print(a-1) | s331935629 | Accepted | 17 | 2,940 | 63 | a,b = map(int,input().split())
print(a) if a<=b else print(a-1) |
s250221177 | p03555 | u699295339 | 2,000 | 262,144 | Wrong Answer | 154 | 12,508 | 146 | 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. | import numpy as np
up_ = np.array(list(reversed(input())))
lo = np.array(list(input()))
if (up_ == lo).any():
print('Yes')
else:
print('No') | s288485297 | Accepted | 149 | 12,508 | 146 | import numpy as np
up_ = np.array(list(reversed(input())))
lo = np.array(list(input()))
if (up_ == lo).all():
print('YES')
else:
print('NO') |
s559544297 | p02418 | u175224634 | 1,000 | 131,072 | Wrong Answer | 20 | 5,556 | 202 | Write a program which finds a pattern $p$ in a ring shaped text $s$. | def judg_unit(ss,pp):
sss = ss + ss + ss
result = sss.find(pp)
if result != -1:
return True
else :
return False
s = str(input())
p = str(input())
print(judg_unit(s,p))
| s820571472 | Accepted | 20 | 5,560 | 202 | def judg_unit(ss,pp):
sss = ss + ss + ss
result = sss.find(pp)
if result != -1:
return "Yes"
else :
return "No"
s = str(input())
p = str(input())
print(judg_unit(s,p))
|
s800633363 | p03448 | u940102677 | 2,000 | 262,144 | Wrong Answer | 19 | 3,060 | 215 | 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()) / 50
count = 0
a = 0
while a <= A:
b = 0
while b <= B:
r = X - 10*a - 2*b
if r >= 0:
count += min(r, C) + 1
b += 1
a += 1 | s591530486 | Accepted | 18 | 3,064 | 228 | A = int(input())
B = int(input())
C = int(input())
X = int(input()) / 50
count = 0
a = 0
while a <= A:
b = 0
while b <= B:
r = X - 10*a - 2*b
if r >= 0 and r <= C:
count += 1
b += 1
a += 1
print(count) |
s859138002 | p02659 | u494058663 | 2,000 | 1,048,576 | Wrong Answer | 24 | 9,100 | 81 | Compute A \times B, truncate its fractional part, and print the result as an integer. | a,b = map(float,input().split())
ans = a*b
print(ans)
ans= ans//1
print(int(ans)) | s569909291 | Accepted | 25 | 9,820 | 106 | from decimal import Decimal
a,b = map(str,input().split())
a = Decimal(a)
b = Decimal(b)
print((a*b)//1) |
s798724264 | p02612 | u353919145 | 2,000 | 1,048,576 | Wrong Answer | 31 | 8,968 | 302 | 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. | money=int(input())
name=0
if money%1000==name:
print(name)
print("you can pay the exact price")
elif money//1000!=0:
remainder=money%1000
dividend=money//1000
print(dividend)
print(f"We will use {dividend} 1000-yen bills to pay the price and receive {remainder} yen in change.") | s622624843 | Accepted | 29 | 9,140 | 166 | money=int(input())
yen_bills=1000
if yen_bills>=money:
print(yen_bills-money)
else:
while yen_bills<money:
yen_bills+=1000
print(yen_bills-money)
|
s253262596 | p03623 | u006425112 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 92 | 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... | import sys
x, a, b = map(int, sys.stdin.readline().split())
print(min(abs(x-a), abs(x-b))) | s889845811 | Accepted | 18 | 2,940 | 121 | import sys
x, a, b = map(int, sys.stdin.readline().split())
if abs(x-a) > abs(x-b):
print("B")
else:
print("A") |
s963087214 | p02612 | u892923530 | 2,000 | 1,048,576 | Wrong Answer | 29 | 9,084 | 65 | 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())
if N%1000 == 0:
print(0)
else:
print(N%1000) | s330241142 | Accepted | 31 | 9,148 | 72 | N = int(input())
if N%1000 == 0:
print(0)
else:
print(1000 - N%1000) |
s589424158 | p03163 | u479638406 | 2,000 | 1,048,576 | Wrong Answer | 2,104 | 7,668 | 440 | 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 ... | def dynamic():
N, W = map(int, input().split())
wv = [list(map(int, input().split())) for _ in range(N)]
dp = [[0]*(W + 1)]*(N + 1)
for i in range(N):
w = wv[i][0]
v = wv[i][1]
for sum_w in range(W+1):
if sum_w - w >= 0:
dp[i+1][sum_w] = max(dp[i+1][sum_w], dp[i][sum_w - w... | s831053805 | Accepted | 218 | 15,456 | 197 | import numpy as np
N, W = map(int, input().split())
dp = np.zeros(W + 1)
for n in range(N):
w, v = map(int, input().split())
dp[w:] = np.maximum(dp[w:], dp[:-w] + v)
print(int(dp[-1])) |
s177970475 | p00075 | u498511622 | 1,000 | 131,072 | Wrong Answer | 30 | 7,536 | 215 | 肥満は多くの成人病の原因として挙げられています。過去においては、一部の例外を除けば、高校生には無縁なものでした。しかし、過度の受験勉強等のために運動不足となり、あるいはストレスによる過食症となることが、非現実的なこととはいえなくなっています。高校生にとっても十分関心を持たねばならない問題になるかもしれません。 そこで、あなたは、保健室の先生の助手となって、生徒のデータから肥満の疑いのある生徒を探し出すプログラムを作成することになりました。 方法は BMI (Body Mass Index) という数値を算出する方法です。BMIは次の式で与えられます。 BMI = 22 が標準的で、25 以上だと肥満の疑いがあります。 ... | total=0
s=0
i=0
try:
while True:
a,b = map(int,input().split(','))
total += a*b
s+=b
i+=1
except:
result=i+0.5
print(total)
if isinstance(result,float):
print(round(result))
else:
print(result) | s177258271 | Accepted | 20 | 7,416 | 121 | while True:
try:
a,b,c=map(float,input().split(','))
bmi=b/c**2
if bmi>=25:
print(int(a))
except:
break |
s465215843 | p03760 | u227082700 | 2,000 | 262,144 | Wrong Answer | 19 | 2,940 | 98 | Snuke signed up for a new website which holds programming competitions. He worried that he might forget his password, and he took notes of it. Since directly recording his password would cause him trouble if stolen, he took two notes: one contains the characters at the odd-numbered positions, and the other contains the... | a,b,s=input(),input(),""
for i in range(len(a)-1):s+=a[i]+b[i]
if len(a)!=len(b):s+=a[-1]
print(s) | s762979360 | Accepted | 17 | 2,940 | 106 | s=input()
t=input()
ans=""
for i in range(len(t)):
ans+=s[i]+t[i]
if len(s)-len(t):ans+=s[-1]
print(ans) |
s592874942 | p02612 | u046247133 | 2,000 | 1,048,576 | Wrong Answer | 29 | 9,156 | 139 | 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. | def Next(): return input()
def NextInt(): return int(Next())
N = NextInt()*0.001
import math
ans = math.ceil(N)
print(int(ans*1000-N*1000)) | s353672482 | Accepted | 35 | 9,024 | 154 | def Next(): return input()
def NextInt(): return float(Next())
N = round(NextInt()*0.0010, 3)
import math
ans = math.ceil(N)
print(int(ans*1000-N*1000)) |
s738337118 | p03377 | u846652026 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 79 | 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,c = map(int, input().split())
print("Yes" if a <= c and a+b >= c else "No") | s830326304 | Accepted | 18 | 2,940 | 79 | a,b,c = map(int, input().split())
print("YES" if a <= c and a+b >= c else "NO") |
s263130624 | p03470 | u755180064 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 83 | An _X -layered kagami mochi_ (X ≥ 1) is a pile of X round mochi (rice cake) stacked vertically where each mochi (except the bottom one) has a smaller diameter than that of the mochi directly below it. For example, if you stack three mochi with diameters of 10, 8 and 6 centimeters from bottom to top in this order, you h... | t = int(input())
s = set()
for i in range(t):
s.add(int(input()))
print(len(s)) | s113641928 | Accepted | 17 | 2,940 | 135 | if __name__ == '__main__':
t = int(input())
s = []
for i in range(t):
s.append(int(input()))
print(len(set(s))) |
s015024959 | p03141 | u623687794 | 2,000 | 1,048,576 | Wrong Answer | 481 | 32,548 | 233 | There are N dishes of cuisine placed in front of Takahashi and Aoki. For convenience, we call these dishes Dish 1, Dish 2, ..., Dish N. When Takahashi eats Dish i, he earns A_i points of _happiness_ ; when Aoki eats Dish i, she earns B_i points of happiness. Starting from Takahashi, they alternately choose one dish a... | from collections import deque
n=int(input())
l=[list(map(int,input().split())) for i in range(n)]
l.sort(key = lambda x:x[0]-x[1])
ans=0
for i in range(n):
if i%2==0:
ans+=l[i//2][0]
else:
ans-=l[n-1-(i//2)][1]
print(ans) | s900389385 | Accepted | 462 | 32,552 | 235 | from collections import deque
n=int(input())
l=[list(map(int,input().split())) for i in range(n)]
l.sort(key = lambda x:x[0]+x[1],reverse=True)
ans=0
for i in range(n):
if i%2==0:
ans+=l[i][0]
else:
ans-=l[i][1]
print(ans)
|
s742058455 | p00002 | u123596571 | 1,000 | 131,072 | Wrong Answer | 30 | 7,532 | 90 | Write a program which computes the digit number of sum of two integers a and b. | while True:
try:
a,b = map(int, input().split())
except:
break
print(len(str(a+b))) | s357175729 | Accepted | 20 | 7,620 | 113 | while True:
try:
a,b = map(int,input().split())
except:
exit()
print(len(str(a+b))) |
s341486431 | p03162 | u962197874 | 2,000 | 1,048,576 | Wrong Answer | 1,075 | 5,876 | 158 | Taro's summer vacation starts tomorrow, and he has decided to make plans for it now. The vacation consists of N days. For each i (1 \leq i \leq N), Taro will choose one of the following activities and do it on the i-th day: * A: Swim in the sea. Gain a_i points of happiness. * B: Catch bugs in the mountains. Gain... | n=int(input())
a,b,c=0,0,0
for i in range(n):
x,y,z=map(int,input().split())
a,b,c=max(b,c)+x,max(a,c)+y,max(a,b)+z
print(a,b,c)
print(max(a,b,c)) | s209292146 | Accepted | 386 | 3,060 | 141 | n=int(input())
a,b,c=0,0,0
for i in range(n):
x,y,z=map(int,input().split())
a,b,c=max(b,c)+x,max(a,c)+y,max(a,b)+z
print(max(a,b,c)) |
s110856756 | p03845 | u336325457 | 2,000 | 262,144 | Wrong Answer | 24 | 3,060 | 259 | Joisino is about to compete in the final round of a certain programming competition. In this contest, there are N problems, numbered 1 through N. Joisino knows that it takes her T_i seconds to solve problem i(1≦i≦N). Also, there are M kinds of drinks offered to the contestants, numbered 1 through M. If Joisino takes d... | N=int(input())
T=input().split()
M=int(input())
for i in range(M):
time=0
P=input().split()
drink=int(P[0])
for ti in T:
k=0
if(int(T[k]) == drink):
time+=int(P[1])
k+=1
else:
time+=int(ti)
k+=1
print(time)
| s625263070 | Accepted | 21 | 3,060 | 231 | N=int(input())
T=input().split()
M=int(input())
for i in range(M):
time=0
P=input().split()
drink=int(P[0])
for k in range(N):
if(k+1 == drink):
time+=int(P[1])
else:
time+=int(T[k])
print(time)
|
s438407042 | p03495 | u266569040 | 2,000 | 262,144 | Wrong Answer | 2,105 | 25,760 | 3,085 | Takahashi has N balls. Initially, an integer A_i is written on the i-th ball. He would like to rewrite the integer on some balls so that there are at most K different integers written on the N balls. Find the minimum number of balls that Takahashi needs to rewrite the integers on them. |
import sys
variety = 0
element1 = 0
def main():
n, k = input().split()
#N = int(n)
K = int(k)
numeric = input().split()
numeric = [int(x) for x in numeric]
の判定アルゴリズム
numeric.sort()
#print(numeric)
vary = []
TypeDetermination(numeric, vary)
#print(... | s230913398 | Accepted | 204 | 39,316 | 318 | import collections
N,K = map(int,input().split())
ball = [int(j) for j in input().split()]
kind = dict(collections.Counter(ball))
if len(kind) <= K:
print(0)
else:
skind = sorted(kind.items(),key=lambda x: x[1])
sumNum = 0
for i in range(len(skind)-K):
sumNum += skind[i][1]
print(sumNum) |
s925073575 | p03048 | u771804983 | 2,000 | 1,048,576 | Wrong Answer | 2,104 | 13,780 | 214 | Snuke has come to a store that sells boxes containing balls. The store sells the following three kinds of boxes: * Red boxes, each containing R red balls * Green boxes, each containing G green balls * Blue boxes, each containing B blue balls Snuke wants to get a total of exactly N balls by buying r red boxes, g... | R,G,B,N=map(int,input().split())
counter=0
for r in range(N+1):
for g in range(N+1):
b=(N-r*R-g*G)/B
if b.is_integer() and b>=0:
print(r,g)
counter += 1
print(counter)
| s857937369 | Accepted | 19 | 3,060 | 133 | R,G,B,N=map(int,input().split())
a=[0]*(N+1)
a[0]=1
for i in [R,G,B]:
for j in range(N+1-i):
a[j+i]+=a[j]
print(a[N])
|
s163290099 | p03814 | u964998676 | 2,000 | 262,144 | Wrong Answer | 59 | 3,516 | 165 | 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... | str = input('')
start = 0
end = 0
for x in range(len(str)):
if str[x] == 'A' and start != 0:
start = x
elif str[x] == 'Z':
end = x
print(end - start + 1) | s487242424 | Accepted | 17 | 3,500 | 81 | str = input('')
start = str.find('A')
end = str.rfind('Z')
print(end - start + 1) |
s500843100 | p02415 | u629874472 | 1,000 | 131,072 | Wrong Answer | 20 | 5,536 | 35 | Write a program which converts uppercase/lowercase letters to lowercase/uppercase for a given string. | char = input()
print(char.lower())
| s662930264 | Accepted | 20 | 5,548 | 38 | char = input()
print(char.swapcase())
|
s096144535 | p03555 | u569272329 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 90 | 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. | x = str(input())
y = str(input())
if x == y[::-1]:
print("Yes")
else:
print("No")
| s425130468 | Accepted | 17 | 2,940 | 90 | x = str(input())
y = str(input())
if x == y[::-1]:
print("YES")
else:
print("NO")
|
s033635433 | p03992 | u685244071 | 2,000 | 262,144 | Wrong Answer | 16 | 2,940 | 64 | This contest is `CODE FESTIVAL`. However, Mr. Takahashi always writes it `CODEFESTIVAL`, omitting the single space between `CODE` and `FESTIVAL`. So he has decided to make a program that puts the single space he omitted. You are given a string s with 12 letters. Output the string putting a single space between the fi... | s = input()
a = s[0:4]
b = s[4:-1]
print('{} {}.format(a, b)') | s568837627 | Accepted | 17 | 2,940 | 62 | s = input()
a = s[:4]
b = s[-8:]
print('{} {}'.format(a, b)) |
s325003969 | p03578 | u024804656 | 2,000 | 262,144 | Wrong Answer | 291 | 47,968 | 412 | Rng is preparing a problem set for a qualification round of CODEFESTIVAL. He has N candidates of problems. The difficulty of the i-th candidate is D_i. There must be M problems in the problem set, and the difficulty of the i-th problem must be T_i. Here, one candidate of a problem cannot be used as multiple problems.... | N = int(input())
DS = input().split()
D = {}
for i in range(N):
if DS[i] not in D:
D[DS[i]] = 0
D[DS[i]] += 1
M = int(input())
T = input().split()
flg = True
for i in range(M):
if T[i] in D:
D[T[i]] -= 1
if D[T[i]] < 0:
print('No')
flg = False
bre... | s927744621 | Accepted | 258 | 47,968 | 413 | N = int(input())
DS = input().split()
D = {}
for i in range(N):
if DS[i] not in D:
D[DS[i]] = 0
D[DS[i]] += 1
M = int(input())
T = input().split()
flg = True
for i in range(M):
if T[i] in D:
D[T[i]] -= 1
if D[T[i]] < 0:
print('NO')
flg = False
bre... |
s507126336 | p03385 | u627747800 | 2,000 | 262,144 | Time Limit Exceeded | 2,104 | 3,060 | 547 | You are given a string S of length 3 consisting of `a`, `b` and `c`. Determine if S can be obtained by permuting `abc`. | #!/usr/bin/env python
# coding: utf-8
#
def main(input_str):
checker = {}
checker['a'] = False
checker['b'] = False
checker['c'] = False
if 3 != len(list(input_str)):
print('No')
return
for s in list(input_str):
checker[s] = True
if checker['a'] and c... | s396174384 | Accepted | 17 | 3,060 | 515 | #!/usr/bin/env python
# coding: utf-8
#
def main(input_str):
checker = {}
checker['a'] = False
checker['b'] = False
checker['c'] = False
if 3 != len(list(input_str)):
print('No')
return
for s in list(input_str):
checker[s] = True
if checker['a'] and c... |
s401691878 | p03645 | u411858517 | 2,000 | 262,144 | Wrong Answer | 736 | 55,600 | 416 | In Takahashi Kingdom, there is an archipelago of N islands, called Takahashi Islands. For convenience, we will call them Island 1, Island 2, ..., Island N. There are M kinds of regular boat services between these islands. Each service connects two islands. The i-th service connects Island a_i and Island b_i. Cat Snuk... | N, M = map(int, input().split())
L = [list(map(int, input().split())) for i in range(M)]
s = []
g = []
for i in range(M):
if 1 == L[i][0]:
s.append(L[i][1])
if 1 == L[i][1]:
s.append(L[i][0])
for i in range(M):
if N == L[i][0]:
g.append(L[i][1])
if M == L[i][1]:
... | s880987594 | Accepted | 788 | 61,228 | 416 | N, M = map(int, input().split())
L = [list(map(int, input().split())) for i in range(M)]
s = []
g = []
for i in range(M):
if 1 == L[i][0]:
s.append(L[i][1])
if 1 == L[i][1]:
s.append(L[i][0])
for i in range(M):
if N == L[i][0]:
g.append(L[i][1])
if N == L[i][1]:
... |
s409064902 | p03574 | u279229189 | 2,000 | 262,144 | Wrong Answer | 33 | 3,188 | 964 | 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... | tmp = (input().split(" "))
H = int(tmp[0])
W = int(tmp[1])
datas = [input() for i in range(0, H, 1)]
array = []
for data in datas:
tmp = [x for x in list(data)]
array.append(tmp)
for i in range(0, H, 1):
for j in range(0, W, 1):
cnt = 0
if array[i][j] == "#":
continue
... | s238607554 | Accepted | 31 | 3,188 | 921 | tmp = (input().split(" "))
H = int(tmp[0])
W = int(tmp[1])
datas = [input() for i in range(0, H, 1)]
array = []
for data in datas:
tmp = [x for x in list(data)]
array.append(tmp)
for i in range(0, H, 1):
for j in range(0, W, 1):
cnt = 0
if array[i][j] == "#":
continue
e... |
s071532127 | p03680 | u791110052 | 2,000 | 262,144 | Wrong Answer | 161 | 12,804 | 167 | 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())
a = [int(input()) for _ in range(n)]
count = 1
i = 0
while count < n:
i = a[i] - 1
if i == 1:
print(count)
break
count += 1
print(-1)
| s849279082 | Accepted | 158 | 12,988 | 183 | n = int(input())
a = [int(input()) for _ in range(n)]
count = 1
i = 0
while count < n:
i = a[i] - 1
if i == 1:
print(count)
break
count += 1
if count >= n:
print(-1) |
s571897223 | p02615 | u333700164 | 2,000 | 1,048,576 | Wrong Answer | 150 | 31,372 | 240 | Quickly after finishing the tutorial of the online game _ATChat_ , you have decided to visit a particular place with N-1 players who happen to be there. These N players, including you, are numbered 1 through N, and the **friendliness** of Player i is A_i. The N players will arrive at the place one by one in some order... | n=int(input())
a=list(map(int,input().split()))
a.sort()
a=a[::-1]
if n%2==0:
m=n//2
ans=0
for i in range(m):
ans+=2*a[i]
ans-=a[0]
else:
m=n//2
ans=0
for i in range(m):
ans+=2*a[i]
ans+=a[m]
ans-=a[0]
print(ans,a) | s290382873 | Accepted | 140 | 31,536 | 238 | n=int(input())
a=list(map(int,input().split()))
a.sort()
a=a[::-1]
if n%2==0:
m=n//2
ans=0
for i in range(m):
ans+=2*a[i]
ans-=a[0]
else:
m=n//2
ans=0
for i in range(m):
ans+=2*a[i]
ans+=a[m]
ans-=a[0]
print(ans) |
s055790956 | p01101 | u064320529 | 8,000 | 262,144 | Wrong Answer | 2,460 | 32,368 | 778 | Mammy decided to give Taro his first shopping experience. Mammy tells him to choose any two items he wants from those listed in the shopping catalogue, but Taro cannot decide which two, as all the items look attractive. Thus he plans to buy the pair of two items with the highest price sum, not exceeding the amount Mamm... | maxes=[]
cnt=0
while True:
s=input()
d=s.split()
n=int(d[0])
m=int(d[1])
if n==0 and m==0:
break
s=input()
d=s.split()
a=[]
for i in range(n):
if int(d[i]) in a:
n-=1
else:
a.append(int(d[i]))
p=[[0 for i in range(n)] for j i... | s716989607 | Accepted | 3,030 | 32,276 | 716 | maxes=[]
cnt=0
while True:
s=input()
d=s.split()
n=int(d[0])
m=int(d[1])
if n==0 and m==0:
break
s=input()
d=s.split()
a=[]
for i in range(n):
a.append(int(d[i]))
p=[[0 for i in range(n)] for j in range(n)]
for i in range(n):
for j in range(i+1,... |
s850603525 | p03474 | u840958781 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 239 | The postal code in Atcoder Kingdom is A+B+1 characters long, its (A+1)-th character is a hyphen `-`, and the other characters are digits from `0` through `9`. You are given a string S. Determine whether it follows the postal code format in Atcoder Kingdom. | a,b=map(int,input().split())
s=input()
ans=0
for i in range(a+b+1):
if i==a and s[i]=="-":
ans+=1
print("a")
elif i!=a and s[i].isdecimal()==True:
ans+=1
if ans==a+b+1:
print("Yes")
else:
print("No") | s510928463 | Accepted | 17 | 3,060 | 220 | a,b=map(int,input().split())
s=input()
ans=0
for i in range(a+b+1):
if i==a and s[i]=="-":
ans+=1
elif i!=a and s[i].isdecimal()==True:
ans+=1
if ans==a+b+1:
print("Yes")
else:
print("No") |
s273075703 | p03339 | u748241164 | 2,000 | 1,048,576 | Wrong Answer | 161 | 21,072 | 317 | There are N people standing in a row from west to east. Each person is facing east or west. The directions of the people is given as a string S of length N. The i-th person from the west is facing east if S_i = `E`, and west if S_i = `W`. You will appoint one of the N people as the leader, then command the rest of the... | N = int(input())
S = str(input())
west = 0
for i in range(N):
if S[i] == "W":
west += 1
ans_list = [0] * N
for i in range(N):
if S[i] == "W":
west -= 1
if i != 0:
if S[i - 1] == "E":
west += 1
#ans_list[i] = min(west, N - west)
ans_list[i] = west
#print(ans_list)
print(min(ans_list))
| s446887376 | Accepted | 184 | 9,716 | 259 | N = int(input())
S = str(input())
count = 0
for i in range(N):
if S[i] == "E":
count += 1
ans = 10 ** 10
for i in range(N):
if S[i] == "E":
count -= 1
if i != 0:
if S[i - 1] == "W":
count += 1
ans = min(ans, count)
print(ans)
|
s833501437 | p02409 | u756958775 | 1,000 | 131,072 | Wrong Answer | 30 | 7,580 | 300 | You manage 4 buildings, each of which has 3 floors, each of which consists of 10 rooms. Write a program which reads a sequence of tenant/leaver notices, and reports the number of tenants for each room. For each notice, you are given four integers b, f, r and v which represent that v persons entered to room r of fth fl... | x = [[[0 for k in range(10)]for j in range(3)]for i in range(4)]
n = int(input())
for i in range(n):
[b, f, r, v] = map(int, input().split())
x[b-1][f-1][r-1] += v
for b in range(4):
for f in range(3):
tmp = list(map(str, x[b][f]))
print(" ".join(tmp))
print("#"*20) | s337207493 | Accepted | 20 | 7,736 | 320 | x = [[[0 for k in range(10)]for j in range(3)]for i in range(4)]
n = int(input())
for i in range(n):
[b, f, r, v] = map(int, input().split())
x[b-1][f-1][r-1] += v
for b in range(4):
for f in range(3):
tmp = list(map(str, x[b][f]))
print(" "+" ".join(tmp))
if b!=3:
print("#"*20) |
s930810317 | p03436 | u474270503 | 2,000 | 262,144 | Wrong Answer | 26 | 3,188 | 1,178 | 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... | class BFS():
def __init__(self, H, W, maze):
self.H = H
self.W = W
self.maze = maze
self.distance = [[0 for i in range(self.W)] for j in range(self.H)]
self.sx = 0
self.sy = 0
self.gx = W-1
self.gy = H-1
def bfs(self):
queue = []
q... | s557928583 | Accepted | 26 | 3,188 | 1,161 | class BFS():
def __init__(self, H, W, maze):
self.H = H
self.W = W
self.maze = maze
self.distance = [[0 for i in range(self.W)] for j in range(self.H)]
self.sx = 0
self.sy = 0
self.gx = W-1
self.gy = H-1
def bfs(self):
queue = []
q... |
s641339699 | p03543 | u185523406 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 158 | 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**? | # -*- coding: utf-8 -*-
str = input()
if int(str[0:2]) % 111 == 0:
print("Yes")
elif int(str[1:3]) % 111 == 0:
print("Yes")
print("No")
| s782849405 | Accepted | 17 | 2,940 | 164 | # -*- coding: utf-8 -*-
str = input()
if int(str[0:3]) % 111 == 0:
print("Yes")
elif int(str[1:4]) % 111 == 0:
print("Yes")
else:
print("No")
|
s689132874 | p03555 | u277802731 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 110 | 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. | #77a
a=input()
b=input()
if a[0]==b[-1] and a[1]==b[1] and a[-1]==b[0]:
print('Yes')
else:
print('No') | s844220457 | Accepted | 17 | 2,940 | 110 | #77a
a=input()
b=input()
if a[0]==b[-1] and a[1]==b[1] and a[-1]==b[0]:
print('YES')
else:
print('NO') |
s544107807 | p03644 | u256464928 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 176 | 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())
if n < 2:
print(1)
elif n < 3:
print(2)
elif n < 5:
print(4)
elif n < 9:
print(8)
elif n < 17:
print(16)
elif n < 33:
print(32)
else:
print(64)
| s580538962 | Accepted | 19 | 2,940 | 36 | print(2**(len(bin(int(input())))-3)) |
s862842747 | p04030 | u030726788 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 203 | 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... | import sys
S=list(input())
print(S)
outp=""
for i in S:
if(i=="0"):
outp+="0"
elif(i=="1"):
outp+="1"
else:
if(len(outp)!=0):
outp = outp[0:-1]
print(outp) | s998051244 | Accepted | 17 | 3,060 | 194 | import sys
S=list(input())
outp=""
for i in S:
if(i=="0"):
outp+="0"
elif(i=="1"):
outp+="1"
else:
if(len(outp)!=0):
outp = outp[0:-1]
print(outp) |
s811654294 | p03591 | u497285470 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 104 | 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 ... | i = input()
if len(i) < 4:
print('NO')
elif i[:4] == 'YAKI':
print('YES')
else:
print('NO') | s532976542 | Accepted | 17 | 2,940 | 104 | i = input()
if len(i) < 4:
print('No')
elif i[:4] == 'YAKI':
print('Yes')
else:
print('No') |
s659746563 | p02401 | u922633376 | 1,000 | 131,072 | Wrong Answer | 20 | 7,512 | 370 | Write a program which reads two integers a, b and an operator op, and then prints the value of a op b. The operator op is '+', '-', '*' or '/' (sum, difference, product or quotient). The division should truncate any fractional part. | if __name__ == "__main__":
while True:
a,op,b = map(str,input().split())
if op is "+":
print("%d"%(int(a)+int(b)))
elif op is "-":
print("%d"%(int(a)-int(b)))
elif op is "*":
print("%d"%(int(a)*int(b)))
elif op is "/":
print("%d... | s180074611 | Accepted | 20 | 7,668 | 370 | if __name__ == "__main__":
while True:
a,op,b = map(str,input().split())
if op is "+":
print("%d"%(int(a)+int(b)))
elif op is "-":
print("%d"%(int(a)-int(b)))
elif op is "*":
print("%d"%(int(a)*int(b)))
elif op is "/":
print("%d... |
s522316469 | p03659 | u374051158 | 2,000 | 262,144 | Wrong Answer | 446 | 24,800 | 240 | Snuke and Raccoon have a heap of N cards. The i-th card from the top has the integer a_i written on it. They will share these cards. First, Snuke will take some number of cards from the top of the heap, then Raccoon will take all the remaining cards. Here, both Snuke and Raccoon have to take at least one card. Let th... | n = int(input())
a = list(map(int, input().split()))
s = sum(a)
subsum = 0
res = 1001001001001001
for i in range(n-1):
subsum += a[i]
remain = s - subsum
print(subsum, remain)
res = min(res, abs(remain-subsum))
print(res) | s912872726 | Accepted | 177 | 24,820 | 214 | n = int(input())
a = list(map(int, input().split()))
s = sum(a)
subsum = 0
res = 1001001001001001
for i in range(n-1):
subsum += a[i]
remain = s - subsum
res = min(res, abs(remain-subsum))
print(res) |
s879596365 | p01359 | u798803522 | 8,000 | 131,072 | Wrong Answer | 20,870 | 12,616 | 572 | As many of you know, we have two major calendar systems used in Japan today. One of them is Gregorian calendar which is widely used across the world. It is also known as “Western calendar” in Japan. The other calendar system is era-based calendar, or so-called “Japanese calendar.” This system comes from ancient Chines... | inputnum,outputnum = (int(n) for n in input().split(' '))
data = {}
while True:
for i in range(inputnum):
temp = input().split(' ')
data[temp[0]] = [int(temp[2]) - int(temp[1]) + 1,int(temp[2])]
for o in range(outputnum):
targ = int(input())
for k,v in data.items():
i... | s605280988 | Accepted | 4,560 | 7,948 | 576 | inputnum,outputnum = (int(n) for n in input().split(' '))
while True:
data = {}
for i in range(inputnum):
temp = input().split(' ')
data[temp[0]] = [int(temp[2]) - int(temp[1]) + 1,int(temp[2])]
for o in range(outputnum):
targ = int(input())
for k,v in data.items():
... |
s286883620 | p03997 | u416258526 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 67 | 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) | s463885119 | Accepted | 17 | 2,940 | 69 | a = int(input())
b = int(input())
h = int(input())
print((a+b)*h//2) |
s606303228 | p03798 | u353919145 | 2,000 | 262,144 | Wrong Answer | 219 | 6,388 | 1,329 | Snuke, who loves animals, built a zoo. There are N animals in this zoo. They are conveniently numbered 1 through N, and arranged in a circle. The animal numbered i (2≤i≤N-1) is adjacent to the animals numbered i-1 and i+1. Also, the animal numbered 1 is adjacent to the animals numbered 2 and N, and the animal numbered... | #!/usr/bin/env python3
n = int(input())
s = input()
t = []
l = []
for i in range(n):
t.append("S")
for i in range(n):
if i+1 <= n-1:
if (s[i] == "x" and t[i] == "S") or (s[i] == "o" and t[i] == "W"):
if t[i-1] == "S":
t[i+1] = "W"
else:
t[i+1] =... | s114501463 | Accepted | 551 | 3,572 | 1,306 | def addleave(p):
for i in range(1, n-1):
if s[i]=="o":
if p[i]=="S":
p += "S" if p[i-1]=="S" else "W"
else:
p += "W" if p[i-1]=="S" else "S"
else:
if p[i]=="S":
p += "W" if p[i-1]=="S" else "S"
else:
... |
s411619322 | p02697 | u788260274 | 2,000 | 1,048,576 | Wrong Answer | 81 | 9,700 | 328 | You are going to hold a competition of one-to-one game called AtCoder Janken. _(Janken is the Japanese name for Rock-paper-scissors.)_ N players will participate in this competition, and they are given distinct integers from 1 through N. The arena has M playing fields for two players. You need to assign each playing fi... | from sys import stdin
import sys
import math
from functools import reduce
import functools
import itertools
from collections import deque,Counter
from operator import mul
import copy
# ! /usr/bin/env python
# -*- coding: utf-8 -*-
import heapq
n,m = list(map(int, input().split()))
for i in range(1,m+1):
print(i,n... | s655080267 | Accepted | 84 | 9,648 | 484 | from sys import stdin
import sys
import math
from functools import reduce
import functools
import itertools
from collections import deque,Counter
from operator import mul
import copy
# ! /usr/bin/env python
# -*- coding: utf-8 -*-
import heapq
n,m = list(map(int, input().split()))
p = m // 2
for i in range(p):
pr... |
s487468457 | p03433 | u797550216 | 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())
a = int(input())
c = n // 500
one = n - c
if one <= a:
print('Yes')
else:
print('No') | s263764132 | Accepted | 20 | 3,316 | 118 | n = int(input())
a = int(input())
c = n // 500
one = n - c*500
if one <= a:
print('Yes')
else:
print('No')
|
s501251579 | p03565 | u293359059 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 836 | E869120 found a chest which is likely to contain treasure. However, the chest is locked. In order to open it, he needs to enter a string S consisting of lowercase English letters. He also found a string S', which turns out to be the string S with some of its letters (possibly all or none) replaced with `?`. One mo... | def CountE(x):
cnt = 0
ind = 0
temp = 1
for i in range(len(x)-1, 0, -1):
if x[i] == "?" and x[i] == x[i-1]:
temp += 1
cnt = temp
ind = i-1
else:
temp = 1
return cnt, ind
Sp = input()
T = input()
s = [i for i in Sp]
t = [i for i in T]... | s148144194 | Accepted | 18 | 3,064 | 408 | S = input()
T = input()
flg = 0
ans = ""
temp = ""
for i in range(len(S)):
flg = 0
if len(S[i:]) < len(T):
break
for j in range(len(T)):
if S[i:][j] != T[j] and S[i:][j] != "?":
flg = 1
if flg == 0:
temp = (S[0:i]+T+S[i+len(T):]).replace("?", "a")
if temp < a... |
s576310572 | p02612 | u374395860 | 2,000 | 1,048,576 | Wrong Answer | 28 | 9,048 | 40 | 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(A) | s711247406 | Accepted | 27 | 9,088 | 92 | N = int(input())
A = N % 1000
if A == 0:
print(0)
else:
B = 1000 - A
print(B)
|
s040020106 | p03623 | u010090035 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 86 | 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())
if(abs(x-a)>=abs(x-b)):
print(b)
else:
print(a) | s927749257 | Accepted | 17 | 2,940 | 90 | x,a,b=map(int,input().split())
if(abs(x-a)>=abs(x-b)):
print("B")
else:
print("A") |
s097852928 | p02616 | u135389999 | 2,000 | 1,048,576 | Wrong Answer | 2,206 | 31,796 | 1,367 | Given are N integers A_1,\ldots,A_N. We will choose exactly K of these elements. Find the maximum possible product of the chosen elements. Then, print the maximum product modulo (10^9+7), using an integer between 0 and 10^9+6 (inclusive). | num = (10 ** 9) + 7
n, k = map(int, input().split())
a = list(map(int, input().split()))
ans = 1
r = 0
r_f = 0
l = n - 1
l_f = 1
a.sort()
if n == 1:
ans = a[0]
elif a[0] * a[-1] > 0:
if a[0] < 0:
if k % 2 == 0:
for i in range(k):
ans *= (a[i] % num)
else:
... | s026246346 | Accepted | 193 | 31,608 | 1,730 | num = (10 ** 9) + 7
n, k = map(int, input().split())
a = list(map(int, input().split()))
plus = []
minus = []
zero = 0
ans = 1
for i in a:
if i > 0:
plus.append(i)
elif i < 0:
minus.append(-i)
else:
zero += 1
plus.sort()
minus.sort()
p_l = len(plus)
m_l = len(minus)
cnt = 0
def ... |
s815246666 | p03623 | u462538484 | 2,000 | 262,144 | Wrong Answer | 19 | 3,316 | 76 | 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... | n, a, b = map(int, input().split())
print("A" if (a - n) < (b - n) else "B") | s838748843 | Accepted | 17 | 2,940 | 82 | x, a, b = map(int, input().split())
print("A" if abs(a - x) < abs(b - x) else "B") |
s670708414 | p03407 | u578953945 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 160 | An elementary school student Takahashi has come to a variety store. He has two coins, A-yen and B-yen coins (yen is the currency of Japan), and wants to buy a toy that costs C yen. Can he buy it? Note that he lives in Takahashi Kingdom, and may have coins that do not exist in Japan. | A,B,C = map(int,input().split())
COIN=[1,5,10,100,500]
if A in COIN and B in COIN:
if A + B >= C:
print('Yes')
else:
print('No')
else:
print('No') | s961434407 | Accepted | 17 | 2,940 | 85 | A,B,C = map(int,input().split())
if (A + B) >= C:
print('Yes')
else:
print('No')
|
s631083276 | p03958 | u472534477 | 1,000 | 262,144 | Wrong Answer | 81 | 3,700 | 453 | There are K pieces of cakes. Mr. Takahashi would like to eat one cake per day, taking K days to eat them all. There are T types of cake, and the number of the cakes of type i (1 ≤ i ≤ T) is a_i. Eating the same type of cake two days in a row would be no fun, so Mr. Takahashi would like to decide the order for eating ... | K,T=map(int,input().split())
a=list(map(int,input().split()))
b=[]
for i,an in enumerate(a):
b.append([an,i])
ex = -1
ans = 0
if T == 1:
print(K-1)
else:
for i in range(K):
list.sort(b, reverse=True)
if ex == b[0][1] and b[0][0] == b[1][0]:
b[1][0] -= 1
else:
b[0][0] -= 1
if ex ==... | s033517509 | Accepted | 73 | 3,064 | 499 | K,T=map(int,input().split())
a=list(map(int,input().split()))
b=[]
for i,an in enumerate(a):
b.append([an,i])
ex = -1
ans = 0
if T == 1:
print(K-1)
else:
for i in range(K):
list.sort(b, reverse=True)
if ex == b[0][1] and b[1][0] != 0:
b[1][0] -= 1
ex = b[1][1]
if b[0][1] == 0 and b[1]... |
s615680962 | p03488 | u617515020 | 2,000 | 524,288 | Wrong Answer | 1,025 | 10,264 | 491 | A robot is put at the origin in a two-dimensional plane. Initially, the robot is facing in the positive x-axis direction. This robot will be given an instruction sequence s. s consists of the following two kinds of letters, and will be executed in order from front to back. * `F` : Move in the current direction by d... | from copy import copy
s = input() + "T"
x,y = map(int, input().split())
d = [len(p) for p in s.split("T")]
x = d[0]
d_x = d[2::2]
d_y = d[1::2]
xs = set([x])
ys = set([0])
dpx = [x in xs]
for d in d_x:
xs_ = set()
for x in xs:
xs_.add(x+d)
xs_.add(x-d)
dpx.append(x in xs_)
xs = copy(xs_)
dpy = []
f... | s639013608 | Accepted | 1,019 | 10,396 | 495 | from copy import copy
s = input() + "T"
x,y = map(int, input().split())
d = [len(p) for p in s.split("T")]
init = d[0]
d_x = d[2::2]
d_y = d[1::2]
xs = set([init])
ys = set([0])
dpx = [x in xs]
for d in d_x:
xs_ = set()
for u in xs:
xs_.add(u+d)
xs_.add(u-d)
dpx.append(x in xs_)
xs = copy(xs_)
dpy = ... |
s787913746 | p03377 | u997641430 | 2,000 | 262,144 | Wrong Answer | 20 | 3,316 | 73 | 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+B>=X>=A:print('Yes')
else:print('No') | s550321728 | Accepted | 18 | 2,940 | 73 | A,B,X=map(int,input().split())
if A<=X<=A+B:print('YES')
else:print('NO') |
s406747459 | p03415 | u314050667 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 64 | We have a 3×3 square grid, where each square contains a lowercase English letters. The letter in the square at the i-th row from the top and j-th column from the left is c_{ij}. Print the string of length 3 that can be obtained by concatenating the letters in the squares on the diagonal connecting the top-left and bot... | s1 = input()
s2 = input()
s3 = input()
print(s1[0],s2[1],s3[2]) | s153951680 | Accepted | 17 | 2,940 | 64 | s1 = input()
s2 = input()
s3 = input()
print(s1[0]+s2[1]+s3[2]) |
s714681611 | p03944 | u984351908 | 2,000 | 262,144 | Wrong Answer | 24 | 3,064 | 671 | There is a rectangle in the xy-plane, with its lower left corner at (0, 0) and its upper right corner at (W, H). Each of its sides is parallel to the x-axis or y-axis. Initially, the whole region within the rectangle is painted white. Snuke plotted N points into the rectangle. The coordinate of the i-th (1 ≦ i ≦ N) po... | w, h, n = list(map(int, input().split()))
xya = []
for i in range(n):
xya.append(list(map(int, input().split())))
min_x_1 = w
max_x_2 = 0
min_y_3 = h
max_y_4 = 0
for i in range(n):
ai = xya[i][2]
if ai == 1:
if xya[i][0] < min_x_1:
min_x_1 = xya[i][0]
if ai == 2:
if xya[i][0... | s346333607 | Accepted | 23 | 3,064 | 671 | w, h, n = list(map(int, input().split()))
xya = []
for i in range(n):
xya.append(list(map(int, input().split())))
max_x_1 = 0
min_x_2 = w
max_y_3 = 0
min_y_4 = h
for i in range(n):
ai = xya[i][2]
if ai == 1:
if xya[i][0] > max_x_1:
max_x_1 = xya[i][0]
if ai == 2:
if xya[i][0... |
s445967467 | p03090 | u794173881 | 2,000 | 1,048,576 | Wrong Answer | 23 | 3,612 | 258 | 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:
print(n*(n+1)//2-n-1)
else:
print((n-1)*n//2)
if n%2 ==1:
for i in range(n-1):
print(i+1,n)
n = n-1
if n%2 ==0:
wa = n+1
for i in range(n):
for j in range(i+1,n):
if wa != i+j+2:
print(i+1,j+1) | s141203982 | Accepted | 17 | 3,064 | 374 | n = int(input())
li = []
for i in range(0,(n//2)*2):
if i+1 < n-i:
li.append([i+1,n-i-n%2])
else:
break
if n%2 == 1:
li.append([n])
if len(li) > 2:
li.append(li[0])
count = 0
for i in range(1,len(li)):
for j in li[i-1]:
for k in li[i]:
count += 1
print(count)
for i in range(1,len(li)):
... |
s568629310 | p03495 | u743164083 | 2,000 | 262,144 | Wrong Answer | 293 | 50,600 | 451 | Takahashi has N balls. Initially, an integer A_i is written on the i-th ball. He would like to rewrite the integer on some balls so that there are at most K different integers written on the N balls. Find the minimum number of balls that Takahashi needs to rewrite the integers on them. | from collections import Counter
n, k = list(map(int, input().split()))
balls = list(map(int, input().split()))
b_list = set(balls)
nums = len(b_list)
yoso, s_yoso = [], []
counter = Counter(balls)
kakikae, t = 0, 1
if nums > k:
for i, v in counter.most_common():
yoso += [v]
if nums <= k:
print(0)
els... | s679383487 | Accepted | 147 | 45,424 | 254 | from collections import Counter
n, k = list(map(int, input().split()))
a = Counter(map(int, input().split()))
a = list(a.items())
a.sort(key=lambda x: x[1])
opt = len(a) - k
ans = 0
if opt > 0:
for i in range(opt):
ans += a[i][1]
print(ans)
|
s877944173 | p00043 | u197615397 | 1,000 | 131,072 | Wrong Answer | 30 | 6,008 | 1,102 | 1 〜 9 の数字を 14 個組み合わせて完成させるパズルがあります。与えられた 13 個の数字にもうひとつ数字を付け加えて完成させます。 パズルの完成条件は * 同じ数字を2つ組み合わせたものが必ずひとつ必要です。 * 残りの12 個の数字は、3個の数字の組み合わせ4つです。 3個の数字の組み合わせ方は、同じ数字を3つ組み合わせたものか、または3つの連続する数字を組み合わせたものです。ただし、9 1 2 のような並びは連続する数字とは認められません。 * 同じ数字は4 回まで使えます。 13 個の数字からなる文字列を読み込んで、パズルを完成することができる数字を昇順に全て出力するプログラムを作成してください... | from collections import deque
try:
while True:
a = list(sorted(map(int, input())))
result = []
for i in range(1, 10):
if a.count(i) == 4:
continue
_a = sorted(a+[i])
dq = deque([(_a, 0)])
while dq:
hand, mentu... | s997133066 | Accepted | 30 | 6,008 | 1,164 | from collections import deque
try:
while True:
a = list(sorted(map(int, input())))
result = []
for i in range(1, 10):
if a.count(i) == 4:
continue
_a = sorted(a+[i])
dq = deque([(_a, 0)])
while dq:
hand, mentu... |
s139865182 | p03730 | u787059958 | 2,000 | 262,144 | Wrong Answer | 20 | 3,060 | 201 | 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%2==0 or b%2==0) and c%2==0) or ((a%2==1 or b%2==1) and c%2==1)):
if((a-b)%2==c%2):
print('Yes')
else:
print('No')
else:
print('No') | s906699957 | Accepted | 17 | 2,940 | 162 | a,b,c = map(int, input().split())
t = False
for i in range(1,b+1):
if((a*i)%b==c):
t=True
break
if(t):
print('YES')
else:
print('NO') |
s463458198 | p00001 | u150984829 | 1,000 | 131,072 | Wrong Answer | 20 | 5,600 | 69 | There is a data which provides heights (in meter) of mountains. The data is only for ten mountains. Write a program which prints heights of the top three mountains in descending order. | h=sorted([int(input())for _ in range(10)])
print(h[9:6:-1],sep='\n')
| s396705901 | Accepted | 20 | 5,600 | 59 | print(*sorted(int(input())for _ in[0]*10)[:6:-1],sep='\n')
|
s565275302 | p02393 | u313089641 | 1,000 | 131,072 | Wrong Answer | 20 | 7,636 | 80 | Write a program which reads three integers, and prints them in ascending order. | x = input()
# x = str('6 2 5')
a = [int(n) for n in x.split()]
a.sort()
print(a) | s300334653 | Accepted | 20 | 7,468 | 84 | x = input()
#x = str('6 2 5')
a = [n for n in x.split()]
a.sort()
print(' '.join(a)) |
s615899058 | p02279 | u742013327 | 2,000 | 131,072 | Wrong Answer | 30 | 7,728 | 1,721 | A graph _G_ = ( _V_ , _E_ ) is a data structure where _V_ is a finite set of vertices and _E_ is a binary relation on _V_ represented by a set of edges. Fig. 1 illustrates an example of a graph (or graphs). **Fig. 1** A free tree is a connnected, acyclic, undirected graph. A rooted tree is a free tree in which one... | #http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_7_A&lang=jp
class RootedTree:
def __init__(self, node, parent_node):
self.id = node[0]
self.parent = parent_node
self.item = node[2:]
self.children = []
self.depth = 0
self.type = None
self.next_i... | s737826575 | Accepted | 780 | 66,012 | 2,417 | #http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_7_A&lang=jp
"""
class RootedTree:
def __init__(self):
self.id = None
self.child = []
self.parent = -1
self.node_type = "root"
self.depth = 0
def show(self):
print("node {}: parent = {}, depth = {}, {... |
s052866316 | p03636 | u260036763 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 47 | The word `internationalization` is sometimes abbreviated to `i18n`. This comes from the fact that there are 18 letters between the first `i` and the last `n`. You are given a string s of length at least 3 consisting of lowercase English letters. Abbreviate s in the same way. | s = input()
print(s[0] + str(len(s)-2) + s[-0]) | s837304856 | Accepted | 18 | 2,940 | 69 | s = input()
c = 0
for i in s:
c += 1
print(s[0] + str(c-2) + s[-1]) |
s924404543 | p03387 | u987164499 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 259 | 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 ... | from sys import stdin
li = list(map(int,stdin.readline().rstrip().split()))
li.sort(reverse = True)
point = 0
su = sum(li)%2
sai = li[0]%2
if su != sai:
li[0] += 1
point += 1
for i in range(1,len(li)):
point += (li[0]-li[i])//2
print(point) | s205890114 | Accepted | 17 | 2,940 | 132 | li = list(map(int,input().split()))
li.sort()
lin = li[:]
if sum(li)%2 != 3*li[2]%2:
lin[2] += 1
print((lin[2]*3-sum(li))//2) |
s724113291 | p02258 | u843404779 | 1,000 | 131,072 | Wrong Answer | 20 | 7,572 | 221 | You can obtain profits from foreign exchange margin transactions. For example, if you buy 1000 dollar at a rate of 100 yen per dollar, and sell them at a rate of 108 yen per dollar, you can obtain (108 - 100) × 1000 = 8000 yen. Write a program which reads values of a currency $R_t$ at a certain time $t$ ($t = 0, 1, 2,... | n = int(input())
r_first = int(input())
max_r = r_first
min_r = r_first
for _ in range(n - 1):
r = int(input())
if r > max_r:
max_r = r
if r < min_r:
min_r = r
ans = max_r - min_r
print(ans) | s839530350 | Accepted | 530 | 15,512 | 204 | n = int(input())
R = list()
for _ in range(n):
R.append(int(input()))
ans = R[1] - R[0]
min_R = R[0]
for i in range(1, n):
ans = max(ans, R[i] - min_R)
min_R = min(min_R, R[i])
print(ans) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.