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
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s409796146 | p02417 | u297342993 | 1,000 | 131,072 | Wrong Answer | 30 | 6,724 | 279 | Write a program which counts and reports the number of each alphabetical letter. Ignore the case of characters. | alphabetTable = dict.fromkeys([chr(i) for i in range(97, 123)], 0)
text = input()
for i in range(len(text)):
if text[i] in alphabetTable:
alphabetTable[text[i]] += 1
sortedTable = sorted(alphabetTable.keys())
for r in sortedTable:
print(r,':',alphabetTable[r]) | s687236005 | Accepted | 30 | 6,724 | 367 | alphabetTable = dict.fromkeys([chr(i) for i in range(97, 123)], 0)
while True:
try:
for text in input():
for i in range(len(text)):
if text[i].lower() in alphabetTable:
alphabetTable[text[i].lower()] += 1
except EOFError:
break
for r in sorted(alphabetTable):
print(r,':',alphabetTable[r]) |
s152627718 | p03160 | u798931445 | 2,000 | 1,048,576 | Wrong Answer | 111 | 20,516 | 367 | There are N stones, numbered 1, 2, \ldots, N. For each i (1 \leq i \leq N), the height of Stone i is h_i. There is a frog who is initially on Stone 1. He will repeat the following action some number of times to reach Stone N: * If the frog is currently on Stone i, jump to Stone i + 1 or Stone i + 2. Here, a cost of |h_i - h_j| is incurred, where j is the stone to land on. Find the minimum possible total cost incurred before the frog reaches Stone N. | # DP practice
N = int(input())
h = list(map(int, input().split()))
dp = list()
dp.append(0)
dp.append(dp[0] + h[1] - h[0])
for i in range(2, N):
dp.append(min(dp[i-2] + h[i] - h[i-2], dp[i-1] + h[i] - h[i-2]))
print(dp[N-1]) | s782612608 | Accepted | 122 | 20,600 | 383 | # DP practice
N = int(input())
h = list(map(int, input().split()))
dp = list()
dp.append(0)
dp.append(dp[0] + abs(h[1] - h[0]))
for i in range(2, N):
dp.append(min(dp[i-2] + abs(h[i] - h[i-2]), dp[i-1] + abs(h[i] - h[i-1])))
print(dp[N-1]) |
s231920291 | p02646 | u985972698 | 2,000 | 1,048,576 | Wrong Answer | 20 | 9,184 | 387 | Two children are playing tag on a number line. (In the game of tag, the child called "it" tries to catch the other child.) The child who is "it" is now at coordinate A, and he can travel the distance of V per second. The other child is now at coordinate B, and she can travel the distance of W per second. He can catch her when his coordinate is the same as hers. Determine whether he can catch her within T seconds (including exactly T seconds later). We assume that both children move optimally. | # -*- coding: utf-8 -*-
def input_one_number():
return int(input())
def input_multiple_number():
return map(int, input().split())
def input_multiple_number_as_list():
return list(map(int, input().split()))
A , V = input_multiple_number()
B, W = input_multiple_number()
T = input_one_number()
D = abs(B-A)
v = abs(V-W)
if D - v*T > 0:
print("NO")
else:
print("Yes")
| s721128835 | Accepted | 21 | 9,124 | 383 | # -*- coding: utf-8 -*-
def input_one_number():
return int(input())
def input_multiple_number():
return map(int, input().split())
def input_multiple_number_as_list():
return list(map(int, input().split()))
A , V = input_multiple_number()
B, W = input_multiple_number()
T = input_one_number()
D = abs(B-A)
v = V-W
if D - v*T > 0 :
print("NO")
else:
print("YES")
|
s348576011 | p03379 | u106778233 | 2,000 | 262,144 | Wrong Answer | 219 | 25,620 | 128 | 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, ..., X_{i-1}, X_{i+1}, ..., X_N be B_i. Find B_i for each i = 1, 2, ..., N. | n=int(input())
x=list(map(int,input().split()))
a=n//2
b=a+1
for i in range(a):
print(x[a])
for i in range(a):
print(x[a-1]) | s882277193 | Accepted | 307 | 25,052 | 93 | n,*x=map(int,open(0).read().split())
y=sorted(x)[n//2-1:n//2+1]
for i in x:print(y[i<=y[0]])
|
s451935327 | p03693 | u361826811 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 249 | 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 integer a multiple of 4? |
import sys
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 7)
a, b, c = map(int, readline().rstrip().split())
print("YES" if a*100+b*10+c % 4 == 0 else "NO")
| s711306965 | Accepted | 17 | 3,060 | 304 |
import sys
import itertools
# import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
r, g, b = map(int, readline().split())
print('YES' if (100 * r + g * 10 + b) % 4 == 0 else 'NO')
|
s345266806 | p02833 | u227082700 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,060 | 364 | For an integer n not less than 0, let us define f(n) as follows: * f(n) = 1 (if n < 2) * f(n) = n f(n-2) (if n \geq 2) Given is an integer N. Find the number of trailing zeros in the decimal notation of f(N). | n=int(input())
ans=0
for i in [5, 25, 125, 625, 3125, 15625, 78125, 390625, 1953125, 9765625, 48828125, 244140625, 1220703125, 6103515625, 30517578125, 152587890625, 762939453125, 3814697265625, 19073486328125, 95367431640625, 476837158203125, 2384185791015625, 11920928955078125, 59604644775390625, 298023223876953125, 1490116119384765625]:
ans+=n//i
print(ans) | s621798809 | Accepted | 18 | 3,064 | 399 | n=int(input())
if n%2:print(0);exit()
d=[10, 50, 250, 1250, 6250, 31250, 156250, 781250, 3906250, 19531250, 97656250, 488281250, 2441406250, 12207031250, 61035156250, 305175781250, 1525878906250, 7629394531250, 38146972656250, 190734863281250, 953674316406250, 4768371582031250, 23841857910156250, 119209289550781250, 596046447753906250, 2980232238769531250]
ans=0
for i in d:
ans+=n//i
print(ans) |
s997471444 | p03456 | u500297289 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 147 | 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. | """ AtCoder """
a, b = input().split()
ab = int(a + b)
for i in range(317):
if ab == i**2:
print("YES")
exit()
print("NO")
| s775650456 | Accepted | 17 | 2,940 | 147 | """ AtCoder """
a, b = input().split()
ab = int(a + b)
for i in range(317):
if ab == i**2:
print("Yes")
exit()
print("No")
|
s527035724 | p03845 | u088488125 | 2,000 | 262,144 | Wrong Answer | 28 | 9,152 | 275 | 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 drink i(1≦i≦M), her brain will be stimulated and the time it takes for her to solve problem P_i will become X_i seconds. It does not affect the time to solve the other problems. A contestant is allowed to take exactly one of the drinks before the start of the contest. For each drink, Joisino wants to know how many seconds it takes her to solve all the problems if she takes that drink. Here, assume that the time it takes her to solve all the problems is equal to the sum of the time it takes for her to solve individual problems. Your task is to write a program to calculate it instead of her. | n=int(input())
t=list(map(int, input().split()))
m=int(input())
p=[]
x=[]
for i in range(m):
a,b=map(int, input().split())
p.append(a)
x.append(b)
for i in range(m):
time=0
for j in range(n):
if j==p[i]:
time+=x[i]
else:
time+=t[j]
print(time) | s486335114 | Accepted | 31 | 9,192 | 214 | n=int(input())
t=list(map(int, input().split()))
m=int(input())
for i in range(m):
p,x=map(int, input().split())
time=0
for j in range(n):
if j==p-1:
time+=x
else:
time+=t[j]
print(time) |
s375488491 | p03587 | u703890795 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 18 | Snuke prepared 6 problems for a upcoming programming contest. For each of those problems, Rng judged whether it can be used in the contest or not. You are given a string S of length 6. If the i-th character of s is `1`, it means that the i-th problem prepared by Snuke is accepted to be used; `0` means that the problem is not accepted. How many problems prepared by Snuke are accepted to be used in the contest? | input().count("1") | s908659778 | Accepted | 17 | 2,940 | 25 | print(input().count("1")) |
s772540177 | p03544 | u757274384 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 104 | It is November 18 now in Japan. By the way, 11 and 18 are adjacent Lucas numbers. You are given an integer N. Find the N-th Lucas number. Here, the i-th Lucas number L_i is defined as follows: * L_0=2 * L_1=1 * L_i=L_{i-1}+L_{i-2} (i≥2) | n = int(input())
L = [2,1]
for i in range(2,n):
k = L[i-2]+L[i-1]
L.append(k)
print(L[len(L)-1]) | s951986123 | Accepted | 17 | 2,940 | 107 | n = int(input())
L = [2,1]
for i in range(2,n+1):
k = L[i-2]+L[i-1]
L.append(k)
print(L[len(L)-1])
|
s382418893 | p03480 | u547167033 | 2,000 | 262,144 | Wrong Answer | 65 | 3,188 | 110 | You are given a string S consisting of `0` and `1`. Find the maximum integer K not greater than |S| such that we can turn all the characters of S into `0` by repeating the following operation some number of times. * Choose a contiguous segment [l,r] in S whose length is at least K (that is, r-l+1\geq K must be satisfied). For each integer i such that l\leq i\leq r, do the following: if S_i is `0`, replace it with `1`; if S_i is `1`, replace it with `0`. | s=input()
n=len(s)
ans=10**18
for i in range(n-1):
if s[i+1]!=s[i]:
ans=min(ans,max(i,n-i-1))
print(ans) | s738352830 | Accepted | 63 | 3,188 | 110 | s=input()
n=len(s)
ans=n
for i in range(n-1):
if s[i+1]!=s[i]:
ans=min(ans,max(i+1,n-i-1))
print(ans) |
s298809316 | p02619 | u757715307 | 2,000 | 1,048,576 | Wrong Answer | 37 | 9,344 | 423 | Let's first write a program to calculate the score from a pair of input and output. You can know the total score by submitting your solution, or an official program to calculate a score is often provided for local evaluation as in this contest. Nevertheless, writing a score calculator by yourself is still useful to check your understanding of the problem specification. Moreover, the source code of the score calculator can often be reused for solving the problem or debugging your solution. So it is worthwhile to write a score calculator unless it is very complicated. | d = int(input())
c = list(map(int, input().split(' ')))
s = [list(map(int, input().split(' '))) for _ in range(d)]
t = [int(input()) - 1 for _ in range(d)]
ca = [0] * 26
dc = 0
dl = []
for i in range(1, d + 1):
dc += s[i - 1][t[i - 1]]
ca[t[i - 1]] = i
dc -= sum([c[i2] * (i - ca[i2]) for i2 in range(26)])
dl.append(dc) | s817864170 | Accepted | 35 | 9,296 | 457 | d = int(input())
c = list(map(int, input().split(' ')))
s = [list(map(int, input().split(' '))) for _ in range(d)]
t = [int(input()) - 1 for _ in range(d)]
ca = [0] * 26
dc = 0
dl = []
for i in range(1, d + 1):
dc += s[i - 1][t[i - 1]]
ca[t[i - 1]] = i
dc -= sum([c[i2] * (i - ca[i2]) for i2 in range(26)])
dl.append(dc)
print('\n'.join(list(map(str, dl)))) |
s151230191 | p02255 | u370086573 | 1,000 | 131,072 | Wrong Answer | 20 | 7,504 | 242 | 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 A[j+1] = A[j] j-- A[j+1] = key Note that, indices for array elements are based on 0-origin. To illustrate the algorithms, your program should trace intermediate result for each step. | # ??\?????????
N = int(input())
list = input().split()
# ?????\?????????
for i in range(1,len(list)):
v = list[i]
j = i - 1
while j >=0 and list[j] > v:
list[j+1] = list[j]
j -= 1
list[j+1] = v
print(list) | s714163071 | Accepted | 30 | 8,044 | 334 | def insertionSort(n, A):
for i in range(n):
t = A[i]
j = i - 1
while (j >= 0) and (A[j] > t):
A[j + 1] = A[j]
j -= 1
A[j + 1] = t
print(*A)
return A
if __name__ == '__main__':
N = int(input())
A = list(map(int, input().split()))
insertionSort(N, A) |
s073090653 | p03637 | u514383727 | 2,000 | 262,144 | Wrong Answer | 2,104 | 14,224 | 526 | We have a sequence of length N, a = (a_1, a_2, ..., a_N). Each a_i is a positive integer. Snuke's objective is to permute the element in a so that the following condition is satisfied: * For each 1 ≤ i ≤ N - 1, the product of a_i and a_{i + 1} is a multiple of 4. Determine whether Snuke can achieve his objective. | n = int(input())
a = list(map(int, input().split()))
def prime_factor(n):
ass = []
for i in range(2,int(n**0.5)+1):
while n % i==0:
ass.append(i)
n = n//i
if n != 1:
ass.append(n)
return ass
for i in range(n):
a[i] = min(2, prime_factor(a[i]).count(2))
two = a.count(2)
one = a.count(1)
zero = a.count(0)
if two >= n // 2:
print("YES")
else:
if n - two * 2 == one:
print("YES")
else:
print("NO")
| s433066710 | Accepted | 79 | 14,252 | 351 | n = int(input())
a = list(map(int, input().split()))
for i in range(n):
if a[i] % 4 == 0:
a[i] = 2
elif a[i] % 2 == 0:
a[i] = 1
else:
a[i] = 0
two = a.count(2)
one = a.count(1)
zero = a.count(0)
if two >= n // 2:
print("Yes")
else:
if n - two * 2 == one:
print("Yes")
else:
print("No")
|
s693365488 | p02678 | u765758367 | 2,000 | 1,048,576 | Wrong Answer | 725 | 38,332 | 274 | 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 the cave, so we have decided to place a signpost in each room except Room 1. The signpost in each room will point to one of the rooms directly connected to that room with a passage. Since it is dangerous in the cave, our objective is to satisfy the condition below for each room except Room 1. * If you start in that room and repeatedly move to the room indicated by the signpost in the room you are in, you will reach Room 1 after traversing the minimum number of passages possible. Determine whether there is a way to place signposts satisfying our objective, and print one such way if it exists. | N, M = map(int, input().split())
G =[[]for i in range(N)]
for _ in range(M):
A,B = map(int,input().split())
G[A-1].append(B-1)
G[B-1].append(A-1)
print(G)
if len(G[0])==0:
print('No')
else:
print('Yee')
for i in range(1,N):
print(min(G[i])+1) | s010401744 | Accepted | 725 | 38,516 | 405 | from collections import deque
N, M = map(int, input().split())
G = [[] for i in range(N)]
for _ in range(M):
A, B = map(int, input().split())
G[A-1].append(B-1)
G[B-1].append(A-1)
T = [-1]*N
que = deque()
que.append(0)
while que:
v = que.popleft()
for e in G[v]:
if T[e] == -1:
T[e] = v+1
que.append(e)
print("Yes")
print(*T[1:], sep="\n") |
s014338109 | p04044 | u648452607 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 44 | 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 smaller_ than another string t=t_1t_2t_3...t_m if and only if one of the following holds: * There exists an index i(1≦i≦min(n,m)), such that s_j = t_j for all indices j(1≦j<i), and s_i<t_i. * s_i = t_i for all integers i(1≦i≦min(n,m)), and n<m. | s=input().split()
s.sort()
print(''.join(s)) | s271851924 | Accepted | 17 | 3,060 | 110 | [n,l]=[int(_) for _ in input().split()]
s=[]
for i in range(n):
s.append(input())
s.sort()
print(''.join(s)) |
s342622674 | p04043 | u875347753 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 103 | 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 of the phrases once, in some order. | a = sorted(list(map(int, input().split())))
if a == [5, 5, 7]:
print("Yes")
else:
print("No")
| s897403946 | Accepted | 17 | 2,940 | 125 | a, b, c = map(int, input().split())
if (a, b, c) in [(5, 5, 7), (5, 7, 5), (7, 5, 5)]:
print('YES')
else:
print('NO') |
s180579297 | p02843 | u624613992 | 2,000 | 1,048,576 | Wrong Answer | 41 | 9,104 | 91 | AtCoder Mart sells 1000000 of each of the six items below: * Riceballs, priced at 100 yen (the currency of Japan) each * Sandwiches, priced at 101 yen each * Cookies, priced at 102 yen each * Cakes, priced at 103 yen each * Candies, priced at 104 yen each * Computers, priced at 105 yen each Takahashi wants to buy some of them that cost exactly X yen in total. Determine whether this is possible. (Ignore consumption tax.) | x = int(input())
for i in range(100000):
if i * 100 <= x <= i *105:
print(1)
print(0) | s132132337 | Accepted | 39 | 9,152 | 102 | x = int(input())
for i in range(100000):
if i * 100 <= x <= i *105:
print(1)
exit()
print(0) |
s397969252 | p02390 | u956645355 | 1,000 | 131,072 | Wrong Answer | 30 | 7,524 | 159 | 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. | n = int(input())
if (n < 60):
h = 0
m = 0
s = n
else:
s = n % 60
h = n // 3600
m = n - (h * 3600) - s
print('{}:{}:{}'.format(h, m, s)) | s859854931 | Accepted | 40 | 7,680 | 170 | n = int(input())
if (n < 60):
h = 0
m = 0
s = n
else:
s = n % 60
h = n // 3600
m = (n - (h * 3600) - s) / 60
print('{}:{:.0f}:{}'.format(h, m, s)) |
s853200073 | p03303 | u434500430 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 89 | You are given a string S consisting of lowercase English letters. We will write down this string, starting a new line after every w letters. Print the string obtained by concatenating the letters at the beginnings of these lines from top to bottom. | S = input()
w = int(input())
s = ''
for i in range(len(S)//w):
s += S[w * i]
print(s) | s945280255 | Accepted | 17 | 2,940 | 191 | S = str(input())
w = int(input())
s = ''
if len(S)%w == 0:
for i in range(len(S)//w):
s += S[w * i]
else:
for i in range(len(S)//w+1):
s += S[w * i]
print(s) |
s858391916 | p03977 | u356832650 | 1,000 | 262,144 | Wrong Answer | 650 | 3,188 | 321 | A professor invented Cookie Breeding Machine for his students who like cookies very much. When one cookie with the taste of x is put into the machine and a non-negative integer y less than or equal to 127 is input on the machine, it consumes the cookie and generates two cookies with the taste of y and (x XOR y). Here, XOR represents . At first, there is only one cookie and the taste of it is D . Find the maximum value of the sum of the taste of the exactly N cookies generated after the following operation is conducted N-1 times. 1. Put one of the cookies into the machine. 2. Input a non-negative integer less than or equal to 127 on the machine. | from heapq import heappush, heappop
T = int(input())
for i in range(T):
N, D = map(int, input().split())
ans = D
h = []
heappush(h,D)
for _ in range(N - 1):
k = heappop(h)
z = bin(k)[2:].zfill(7)
t = int(z,2)
heappush(h,t)
ans += (127 + t - k)
print(ans)
| s144717245 | Accepted | 333 | 3,316 | 336 | from heapq import heappush, heappop
T = int(input())
A = []
for i in range(T):
N, D = map(int, input().split())
ans = D
h = []
heappush(h,D)
for _ in range(N - 1):
k = heappop(h)
t = 127 ^ k
heappush(h,t)
ans += (127 + t - k)
A.append(ans)
for i in range(len(A)):
print(A[i])
|
s474008720 | p03673 | u840988663 | 2,000 | 262,144 | Wrong Answer | 119 | 26,020 | 234 | You are given an integer sequence of length n, a_1, ..., a_n. Let us consider performing the following n operations on an empty sequence b. The i-th operation is as follows: 1. Append a_i to the end of b. 2. Reverse the order of the elements in b. Find the sequence b obtained after these n operations. | n = int(input())
a = list(map(int, input().split()))
ki=a[0::2]
ki2=[]
for i in ki[::-1]:
ki2.append(i)
guu=a[1::2]
guu2=[]
for i in guu[::-1]:
guu2.append(i)
if n%2==0:
kotae=guu2+ki
else:
kotae=ki2+guu
print(kotae) | s943153290 | Accepted | 136 | 33,144 | 264 | n = int(input())
a = list(map(int, input().split()))
ki=a[0::2]
ki2=[]
for i in ki[::-1]:
ki2.append(i)
guu=a[1::2]
guu2=[]
for i in guu[::-1]:
guu2.append(i)
if n%2==0:
kotae=guu2+ki
else:
kotae=ki2+guu
kotae=" ".join(map(str,kotae))
print(kotae) |
s535638138 | p02831 | u759412327 | 2,000 | 1,048,576 | Wrong Answer | 35 | 5,048 | 77 | Takahashi is organizing a party. At the party, each guest will receive one or more snack pieces. Takahashi predicts that the number of guests at this party will be A or B. Find the minimum number of pieces that can be evenly distributed to the guests in both of the cases predicted. We assume that a piece cannot be divided and distributed to multiple guests. | import fractions
A,B = map(int,input().split())
print(A*B/fractions.gcd(A,B)) | s084906490 | Accepted | 119 | 26,972 | 68 | import numpy as np
A,B = map(int,input().split())
print(np.lcm(A,B)) |
s821213944 | p03999 | u785578220 | 2,000 | 262,144 | Wrong Answer | 32 | 3,188 | 257 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | s = input()
n = int(s)
r = 0
for bit in range(2**(len(s)-1)):
e = s[0]
for i in range(len(s)-1):
if ((bit>>i)&1) == 1:
e += '+'
e += s[i+1]
print(e)
#r += sum(map(int, e.split('+')))
r+= eval(e)
print(r)
| s078434732 | Accepted | 29 | 3,060 | 259 |
s =input()
n = int(s)
r = 0
p=0
for bit in range(2**(len(s)-1)):
e = s[0]
for i in range(len(s)-1):
if ((bit>>i)&1) == 1:
e += '+'
e += s[i+1]
#print(e)
r+= sum(map(int, e.split('+')))
p+= eval(e)
print(r)
|
s347467196 | p03478 | u929582923 | 2,000 | 262,144 | Wrong Answer | 37 | 3,060 | 139 | Find the sum of the integers between 1 and N (inclusive), whose sum of digits written in base 10 is between A and B (inclusive). | n,a,b = map(int,input().split())
ans = 0
for i in range(n+1):
if a <= sum(list(map(int,list(str(i)))))<= b:
ans += 1
print(ans) | s818889140 | Accepted | 36 | 3,060 | 139 | n,a,b = map(int,input().split())
ans = 0
for i in range(n+1):
if a <= sum(list(map(int,list(str(i)))))<= b:
ans += i
print(ans) |
s938357688 | p02393 | u450020188 | 1,000 | 131,072 | Wrong Answer | 20 | 7,648 | 56 | Write a program which reads three integers, and prints them in ascending order. | x =[int(i) for i in input().split()]
x.sort()
print (x) | s292443374 | Accepted | 20 | 7,696 | 74 | x =[int(i) for i in input().split()]
x.sort()
print (x[0] , x[1] , x[2]) |
s735582548 | p03193 | u855186748 | 2,000 | 1,048,576 | Wrong Answer | 22 | 3,060 | 142 | There are N rectangular plate materials made of special metal called AtCoder Alloy. The dimensions of the i-th material are A_i \times B_i (A_i vertically and B_i horizontally). Takahashi wants a rectangular plate made of AtCoder Alloy whose dimensions are exactly H \times W. He is trying to obtain such a plate by choosing one of the N materials and cutting it if necessary. When cutting a material, the cuts must be parallel to one of the sides of the material. Also, the materials have fixed directions and cannot be rotated. For example, a 5 \times 3 material cannot be used as a 3 \times 5 plate. Out of the N materials, how many can produce an H \times W plate if properly cut? | n,h,w = map(int,input().split())
ans = 0
for i in range(n):
a,b = map(int,input().split())
if a>=h and w>=b:
ans+=1
print(ans) | s918106923 | Accepted | 21 | 3,060 | 142 | n,h,w = map(int,input().split())
ans = 0
for i in range(n):
a,b = map(int,input().split())
if a>=h and w<=b:
ans+=1
print(ans) |
s924145767 | p03625 | u503901534 | 2,000 | 262,144 | Wrong Answer | 144 | 18,956 | 558 | We have N sticks with negligible thickness. The length of the i-th stick is A_i. Snuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides. Find the maximum possible area of the rectangle. | n = int(input())
a = list(map(int,input().split()))
aa = list(reversed(list(sorted(a))))
aad = {}
for i in aa:
if i in aad.keys():
aad[i] = aad[i] + 1
else:
aad.update({i:1})
m4 = 0
p = 0
q = 0
for k ,l in aad.items():
if l > 3:
m4 = m4 + l
del(aad[k])
break
for k ,l in aad.items():
if l > 1:
p = p + l
del(aad[k])
break
for k ,l in aad.items():
if l > 1:
q = q + l
del(aad[k])
break
if m4 > 0:
print(m4 * m4)
else:
print(p * q)
| s667063867 | Accepted | 103 | 18,060 | 307 | N = int(input())
A = list(map(int, input().split()))
Adict = {}
for i in A:
if i in Adict:
Adict[i]=Adict[i]+1
else:
Adict.update({i:1})
B = [0, 0]
for i in Adict.keys():
if Adict[i] >= 2:
B.append(i)
if Adict[i] >= 4:
B.append(i)
B.sort()
print(B[-1]*B[-2])
|
s729063135 | p02694 | u917558625 | 2,000 | 1,048,576 | Wrong Answer | 22 | 9,100 | 72 | 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 above for the first time? | s=int(input())
a=100
b=0
while a<=s:
a=int(a*(1+0.01))
b+=1
print(b) | s092216636 | Accepted | 24 | 9,156 | 71 | s=int(input())
a=100
b=0
while a<s:
a=int(a*(1+0.01))
b+=1
print(b) |
s269534962 | p03493 | u842028864 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 52 | 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. | s = list(map(int,input().split()))
print(s.count(1)) | s486467882 | Accepted | 17 | 2,940 | 31 | s = input()
print(s.count("1")) |
s665838421 | p03719 | u813098295 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 74 | 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("YSes" if a <= c <= b else "No") | s938537611 | Accepted | 24 | 2,940 | 73 | a, b, c = map(int, input().split())
print("Yes" if a <= c <= b else "No") |
s926024268 | p03337 | u143318682 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 88 | You are given two integers A and B. Find the largest value among A+B, A-B and A \times B. | # -*- coding: utf-8 -*-
A, B = map(int, input().split())
print(min(A + B, A - B, A * B)) | s539453035 | Accepted | 17 | 2,940 | 88 | # -*- coding: utf-8 -*-
A, B = map(int, input().split())
print(max(A + B, A - B, A * B)) |
s693749713 | p02613 | u474122160 | 2,000 | 1,048,576 | Wrong Answer | 153 | 9,212 | 240 | 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`, `WA`, `TLE`, and `RE`, respectively. See the Output section for the output format. | n=int(input())
ac,wa,tl,re=0,0,0,0
for i in range(n):
s=input()
if(s=="AC"):
ac+=1
if(s=="WA"):
wa+=1
if(s=="TLE"):
tl+=1
else:
re+=1
print("AC",'x',ac)
print("WA",'x',wa)
print("TLE",'x',tl)
print("RE",'x',re)
| s610582381 | Accepted | 149 | 9,156 | 245 | n=int(input())
ac,wa,tl,re=0,0,0,0
for i in range(n):
s=input()
if(s=="AC"):
ac+=1
elif(s=="WA"):
wa+=1
elif(s=="TLE"):
tl+=1
else:
re+=1
print("AC",'x',ac)
print("WA",'x',wa)
print("TLE",'x',tl)
print("RE",'x',re)
|
s628657562 | p03359 | u506302470 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 53 | 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 example, 5-5 is Takahashi. How many days from 2018-1-1 through 2018-a-b are Takahashi? | A,B=map(int,input().split())
print(A if A>B else A+1) | s341117401 | Accepted | 18 | 2,940 | 53 | A,B=map(int,input().split())
print(A-1 if A>B else A) |
s049190110 | p03434 | u945405878 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 344 | We have N cards. A number a_i is written on the i-th card. Alice and Bob will play a game using these cards. In this game, Alice and Bob alternately take one card. Alice goes first. The game ends when all the cards are taken by the two players, and the score of each player is the sum of the numbers written on the cards he/she has taken. When both players take the optimal strategy to maximize their scores, find Alice's score minus Bob's score. | N = int(input())
card_values = list(map(int, input().split(" ")))
card_values_sorted = sorted(card_values, reverse=True)
print(card_values_sorted)
Alice_score = 0
Bob_score = 0
for i in range(N):
if i%2 == 0:
Alice_score += card_values_sorted[i]
else:
Bob_score += card_values_sorted[i]
print(Alice_score - Bob_score) | s013964266 | Accepted | 18 | 3,060 | 320 | N = int(input())
card_values = list(map(int, input().split(" ")))
card_values_sorted = sorted(card_values, reverse=True)
Alice_score = 0
Bob_score = 0
for i in range(N):
if i%2 == 0:
Alice_score += card_values_sorted[i]
else:
Bob_score += card_values_sorted[i]
print(Alice_score - Bob_score) |
s061858113 | p03471 | u780962115 | 2,000 | 262,144 | Wrong Answer | 1,202 | 3,472 | 253 | 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 situation is possible, and if it is, find a possible set of bills contained in the envelope. Assume that his grandfather is rich enough, and the envelope was large enough. |
n,y=map(int,input().split())
flag=False
for i in range(2001):
for j in range(2001):
if i+j<=n and 1000*i+5000*j+1000*(n-i-j)==y:
flag=True
print(i,j,n-i-j)
break
if not flag:
print(-1,-1,-1) | s080470034 | Accepted | 1,241 | 3,064 | 314 |
n,y=map(int,input().split())
a,b,c=0,0,0
flag=False
for i in range(2001):
for j in range(2001):
if i+j<=n and 10000*i+5000*j+1000*(n-i-j)==y:
a=i
b=j
c=n-i-j
flag=True
break
if flag:
print(a,b,c)
if not flag:
print(-1,-1,-1)
|
s605991644 | p03962 | u603234915 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 135 | AtCoDeer the deer recently bought three paint cans. The color of the one he bought two days ago is a, the color of the one he bought yesterday is b, and the color of the one he bought today is c. Here, the color of each paint can is represented by an integer between 1 and 100, inclusive. Since he is forgetful, he might have bought more than one paint can in the same color. Count the number of different kinds of colors of these paint cans and tell him. | l = list(map(int,input().split()))
k = 1
if l[0]==l[1]:
k+=1
if l[1]==l[2]:
k+=1
if l[2]==l[0]:
k+=1
print('{}'.format(k))
| s378927956 | Accepted | 17 | 3,060 | 180 | l = list(map(int,input().split()))
k=0
if l[0]== l[1]==l[2]:
k+=1
if l[0]!=l[1]:
k+=1
if l[1]!=l[2]:
k+=1
if l[2]!=l[0]:
k+=1
if k>3:
k=3
print('{}'.format(k))
|
s139031545 | p04029 | u567434159 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 39 | 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())
print(n * (n + 1) / 2) | s435176112 | Accepted | 17 | 2,940 | 40 | n = int(input())
print(n * (n + 1) // 2) |
s184818717 | p03795 | u722670579 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 55 | Snuke has a favorite restaurant. The price of any meal served at the restaurant is 800 yen (the currency of Japan), and each time a customer orders 15 meals, the restaurant pays 200 yen back to the customer. So far, Snuke has ordered N meals at the restaurant. Let the amount of money Snuke has paid to the restaurant be x yen, and let the amount of money the restaurant has paid back to Snuke be y yen. Find x-y. | num=int(input())
x=800*num
y=int(num/15)
s=x-y
print(s) | s358753322 | Accepted | 17 | 2,940 | 62 | user=int(input())
x=user*800
y=(int(user/15))*200
print(x-y) |
s481853201 | p02612 | u080419397 | 2,000 | 1,048,576 | Wrong Answer | 28 | 9,152 | 61 | 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())
yen=int(N/1000)
oturi=N-1000*yen
print(oturi) | s444177274 | Accepted | 30 | 9,156 | 102 | N= int(input())
yen=int(N/1000)
if N%1000==0:
oturi=0
else:
oturi=1000*(yen+1)-N
print(oturi)
|
s657542715 | p03860 | u268470352 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 47 | Snuke is going to open a contest named "AtCoder s Contest". Here, s is a string of length 1 or greater, where the first character is an uppercase English letter, and the second and subsequent characters are lowercase English letters. Snuke has decided to abbreviate the name of the contest as "AxC". Here, x is the uppercase English letter at the beginning of s. Given the name of the contest, print the abbreviation of the name. | s = input()
''.join([i[0] for i in s.split() ]) | s061773528 | Accepted | 17 | 2,940 | 54 | s = input()
print(''.join([i[0] for i in s.split() ])) |
s726459363 | p03081 | u778814286 | 2,000 | 1,048,576 | Wrong Answer | 2,116 | 196,332 | 2,824 | There are N squares numbered 1 to N from left to right. Each square has a character written on it, and Square i has a letter s_i. Besides, there is initially one golem on each square. Snuke cast Q spells to move the golems. The i-th spell consisted of two characters t_i and d_i, where d_i is `L` or `R`. When Snuke cast this spell, for each square with the character t_i, all golems on that square moved to the square adjacent to the left if d_i is `L`, and moved to the square adjacent to the right if d_i is `R`. However, when a golem tried to move left from Square 1 or move right from Square N, it disappeared. Find the number of golems remaining after Snuke cast the Q spells. | N, Q = map(int, input().split())
s = input()
T = [0 for i in range(Q)]
D = [0 for i in range(Q)]
for i in range(Q):
T[i], D[i] = input().split()
word_of_cell = [0] * N
for i in range(1,N+1):
w = s[i-1:i]
if w == 'A':
word_of_cell[i-1] = 0
elif w == 'B':
word_of_cell[i-1] = 1
elif w == 'C':
word_of_cell[i-1] = 2
elif w == 'D':
word_of_cell[i-1] = 3
elif w == 'E':
word_of_cell[i-1] = 4
elif w == 'F':
word_of_cell[i-1] = 5
elif w == 'G':
word_of_cell[i-1] = 6
elif w == 'H':
word_of_cell[i-1] = 7
elif w == 'I':
word_of_cell[i-1] = 8
elif w == 'J':
word_of_cell[i-1] = 9
elif w == 'K':
word_of_cell[i-1] = 10
elif w == 'L':
word_of_cell[i-1] = 11
elif w == 'M':
word_of_cell[i-1] = 12
elif w == 'N':
word_of_cell[i-1] = 13
elif w == 'O':
word_of_cell[i-1] = 14
elif w == 'P':
word_of_cell[i-1] = 15
elif w == 'Q':
word_of_cell[i-1] = 16
elif w == 'R':
word_of_cell[i-1] = 17
elif w == 'S':
word_of_cell[i-1] = 18
elif w == 'T':
word_of_cell[i-1] = 19
elif w == 'U':
word_of_cell[i-1] = 20
elif w == 'V':
word_of_cell[i-1] = 21
elif w == 'W':
word_of_cell[i-1] = 22
elif w == 'X':
word_of_cell[i-1] = 23
elif w == 'Y':
word_of_cell[i-1] = 24
elif w == 'Z':
word_of_cell[i-1] = 25
g_leave = [[[0 for i in range(N+3)] for d in range(2)] for t in range(26)]
g_enter = [[[0 for i in range(N+3)] for d in range(2)] for t in range(26)]
for t in range(26):
for d in range(2):
for i in range(1,N+1):
if word_of_cell[i-1] == t and d == 0:
g_enter[t][d][0] += 1
g_enter[t][d][g_enter[t][d][0]] = i
g_leave[t][d][0] += 1
g_leave[t][d][g_leave[t][d][0]] = i+1
if word_of_cell[i-1] == t and d == 1:
g_enter[t][d][0] += 1
g_enter[t][d][g_enter[t][d][0]] = i+2
g_leave[t][d][0] += 1
g_leave[t][d][g_leave[t][d][0]] = i+1
golem_count = [0]*(N+2)
for i in range(1,N+1):
golem_count[i] = 1
for q in range(Q):
for t in range(26):
for d in range(2):
for i in range(1,g_enter[t][d][0]+1):
if d == 0:
golem_count[g_enter[t][d][i]-1] = golem_count[g_enter[t][d][i]]
if d == 1:
golem_count[g_enter[t][d][i]-1] = golem_count[g_enter[t][d][i]-2]
for i in range(1,g_leave[t][d][0]+1):
if golem_count[g_leave[t][d][i]] > 0:
golem_count[g_leave[t][d][i]] = 0
print(N-golem_count[0]-golem_count[N+1])
| s050274469 | Accepted | 1,167 | 42,600 | 1,059 | N, Q = map(int, input().split())
s = '#' + input() + '#'
T = []
D = []
for t, d in [input().split() for _ in range(Q)]:
T.append(t)
D.append(-1 if d=='L' else 1)
def canReachEnd(iL, dir):
nowL = iL
nowt = s[iL]
for t, d in zip(T, D):
if t == nowt:
nowL += d
nowt = s[nowL]
if dir == 1 and nowL == N+1:
return True
elif dir == -1 and nowL == 0:
return True
else:
return False
left = 0
right = N+1
while right > left+1:
check = (left+right)//2
if canReachEnd(check, -1):
left = check
else:
right = check
leftborder = left
left = leftborder
right = N+1
while right > left+1:
check = (left+right)//2
if canReachEnd(check, 1):
right = check
else:
left = check
rightborder = right
dropcnt = 0
dropcnt += leftborder
dropcnt += (N-(rightborder-1))
print(N-dropcnt)
|
s116770255 | p03048 | u760794812 | 2,000 | 1,048,576 | Wrong Answer | 2,103 | 3,060 | 189 | 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 green boxes and b blue boxes. How many triples of non-negative integers (r,g,b) achieve this? | R, G, B, N = map(int, input().split())
Ans = 0
for r in range(N//R+1):
rest = N - R*r
for g in range(N//G+1):
rest = rest - G*g
if rest % G == 0:
Ans +=1
print(Ans) | s939169407 | Accepted | 1,179 | 9,132 | 226 | R, G, B, N = map(int, input().split())
counter = 0
r_max = N//R+1
for r in range(r_max+1):
temp = N - R*r
for g in range(temp//G+1):
now = temp - G*g
if now% B == 0 and now//B >= 0:
counter +=1
print(counter) |
s324158685 | p03852 | u928784113 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 129 | 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`. | # -*- coding: utf-8 -*-
c = str(input())
S = {"a","i","u","e","o"}
if c in S is True:
print("vowel")
else:
print("consonant") | s112229543 | Accepted | 18 | 2,940 | 145 | # -*- coding: utf-8 -*-
c = str(input())
if c == "a" or c == "i" or c == "u" or c == "e" or c == "o":
print("vowel")
else:
print("consonant") |
s202177802 | p02409 | u756468156 | 1,000 | 131,072 | Wrong Answer | 20 | 7,672 | 258 | 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 floor at building b. If v is negative, it means that −v persons left. Assume that initially no person lives in the building. | l = [[[0] * 10 for _ in range(3)] for _ in range(4)]
for _ in range(int(input())):
b, f, r, v = map(int, input().split())
l[b - 1][f - 1][r - 1] += v
for x in range(4):
for y in range(3):
print(*l[x][y])
print("####################") | s834401972 | Accepted | 30 | 7,740 | 267 | l = [[[0] * 10 for _ in range(3)] for _ in range(4)]
for _ in range(int(input())):
b, f, r, v = map(int, input().split())
l[b - 1][f - 1][r - 1] += v
for x in range(4):
for y in range(3):
print("", *l[x][y])
if x != 3:
print("#" * 20) |
s690115459 | p03359 | u262244504 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 114 | 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 example, 5-5 is Takahashi. How many days from 2018-1-1 through 2018-a-b are Takahashi? | a,b = map(int,input().split())
ans = a-1
for i in range(1,b-1):
if a==i:
ans = ans+1
break
print(ans) | s384423634 | Accepted | 17 | 2,940 | 115 | a,b = map(int,input().split())
ans = a-1
for i in range(1,b+1):
if a==i:
ans = ans+1
break
print(ans) |
s981953154 | p04039 | u089230684 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 464 | 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 particular about numbers. When she hands money to the cashier, the decimal notation of the amount must not contain any digits that she dislikes. Under this condition, she will hand the minimum amount of money. Find the amount of money that she will hand to the cashier. | # cook your dish here
s=input()
m=s.split()
n,k=m[0],m[1];
s=input()
m=s.split()
list=[]
nlist=[]
for i in m:
list.append(int(i))
for i in range(0,10):
if i not in list:
nlist.append(i)
num=[int(d) for d in str(n)]
for i in range(len(num)):
if (num[(-1)*i]) not in list:
continue
else:
for j in nlist:
if(j>num[(-1)*i]):
num[(-1)*i]=j
for i in num:
print(i,end="")
| s077575886 | Accepted | 38 | 9,176 | 241 | n, k = map(int, input().split())
d = list(map(int, input().split()))
w = [False] * 10
for i in d:
w[i] = True
def check(n):
while n:
if w[n % 10]:
return False
n //= 10
return True
ans = n
while not check(ans):
ans += 1
print(ans) |
s190350576 | p02612 | u289102924 | 2,000 | 1,048,576 | Wrong Answer | 27 | 9,084 | 42 | We will buy a product for N yen (the currency of Japan) at a shop. If we use only 1000-yen bills to pay the price, how much change will we receive? Assume we use the minimum number of bills required. | n = int(input())
ans = 1000 - n
print(ans) | s314653911 | Accepted | 29 | 9,152 | 80 | n = int(input())
ans = 1000 - (n % 1000)
print(ans) if ans != 1000 else print(0) |
s308859994 | p02742 | u922416423 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 96 | We have a board with H horizontal rows and W vertical columns of squares. There is a bishop at the top-left square on this board. How many squares can this bishop reach by zero or more movements? Here the bishop can only move diagonally. More formally, the bishop can move from the square at the r_1-th row (from the top) and the c_1-th column (from the left) to the square at the r_2-th row and the c_2-th column if and only if exactly one of the following holds: * r_1 + c_1 = r_2 + c_2 * r_1 - c_1 = r_2 - c_2 For example, in the following figure, the bishop can move to any of the red squares in one move: | h,w = map(int, input().split())
if (h*w)%2==0:
print((h*w)/2)
else:
print(((h*w)+1)/2) | s247747665 | Accepted | 17 | 3,060 | 146 | h,w = map(int, input().split())
if (h == 1) or (w == 1):
print(1)
elif (h*w)%2==0:
print(int((h*w)/2))
else:
print(int(((h*w)+1)/2)) |
s623483475 | p03853 | u911622131 | 2,000 | 262,144 | Wrong Answer | 31 | 9,164 | 130 | 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, print a image with a height of 2H pixels and a width of W pixels where the pixel at the i-th row and j-th column is equal to C_{(i+1)/2,j} (the result of division is rounded down). | # coding = SJIS
h, w = map(int, input().split())
for i in range(h):
a = str(input())
for j in range(1):
print(a)
| s303319466 | Accepted | 25 | 9,052 | 173 | # coding = SJIS
h, w = map(int, input().split())
row = []
for i in range(h):
row.append(str(input()))
for i in range(h):
for j in range(2):
print(row[i])
|
s721408018 | p03565 | u159994501 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 397 | 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 more thing he found is a sheet of paper with the following facts written on it: * Condition 1: The string S contains a string T as a contiguous substring. * Condition 2: S is the lexicographically smallest string among the ones that satisfy Condition 1. Print the string S. If such a string does not exist, print `UNRESTORABLE`. | S = list(input())
T = list(input())
LS = len(S)
LT = len(T)
for i in range(LS - LT + 1):
for j in range(LT):
if S[i + j] != T[j] and S[i + j] != "?":
break
if j == LT - 1:
for k in range(LT):
S[i + k] = T[k]
s = str(S).replace("?", "a")
print(S)
exit()
# S = S.replace("?", "a")
print("UNRESTORABLE")
| s012304901 | Accepted | 18 | 3,060 | 390 | S = list(input())
T = list(input())
LS = len(S)
LT = len(T)
for i in reversed(range(LS - LT + 1)):
for j in range(LT):
if S[i + j] != T[j] and S[i + j] != "?":
break
if j == LT - 1:
for k in range(LT):
S[i + k] = T[k]
s = str("".join(S)).replace("?", "a")
print(s)
exit()
print("UNRESTORABLE")
|
s000781215 | p03474 | u539517139 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 120 | 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()
d=s[:a]+s[a+1:]
if s[a]=='-' and '-' not in d:
print('YES')
else:
print('NO') | s421818520 | Accepted | 17 | 2,940 | 120 | a,b=map(int,input().split())
s=input()
d=s[:a]+s[a+1:]
if s[a]=='-' and '-' not in d:
print('Yes')
else:
print('No') |
s229719126 | p03795 | u558764629 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 61 | Snuke has a favorite restaurant. The price of any meal served at the restaurant is 800 yen (the currency of Japan), and each time a customer orders 15 meals, the restaurant pays 200 yen back to the customer. So far, Snuke has ordered N meals at the restaurant. Let the amount of money Snuke has paid to the restaurant be x yen, and let the amount of money the restaurant has paid back to Snuke be y yen. Find x-y. | a = int(input())
y = (a / 15) * 200
x = a * 800
print(x-y) | s760467196 | Accepted | 17 | 2,940 | 51 | a = int(input())
print((a * 800)-((a // 15) * 200)) |
s667902822 | p03605 | u518556834 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 79 | It is September 9 in Japan now. You are given a two-digit integer N. Answer the question: Is 9 contained in the decimal notation of N? | N = list(input())
if N[0] == 9 or N[1] == 9:
print("Yes")
else:
print("No") | s633232395 | Accepted | 17 | 2,940 | 77 | N = input()
if N[0] == "9"or N[1] == "9":
print("Yes")
else:
print("No")
|
s278082536 | p03679 | u464912173 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 103 | 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. Otherwise, he does not find it delicious. Takahashi bought some food A days before the "best-by" date, and ate it B days after he bought it. Write a program that outputs `delicious` if he found it delicious, `safe` if he did not found it delicious but did not get a stomachache either, and `dangerous` if he got a stomachache. | X,A,B = map(int,input().split())
print('delicious' if B <= A else 'safe' if A+B <= X else 'dangerous') | s928243709 | Accepted | 17 | 2,940 | 103 | X,A,B = map(int,input().split())
print('delicious' if B <= A else 'safe' if B <= A+X else 'dangerous') |
s084460032 | p03485 | u554784585 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 168 | You are given two positive integers a and b. Let x be the average of a and b. Print x rounded up to the nearest integer. |
a,b=input().split()
a=int(a)
b=int(b)
if ((a+b)/2)%1==0:
print((a+b)/2)
else:
print((a+b)/2-((a+b)/2)%1+1)
| s503275135 | Accepted | 18 | 2,940 | 78 |
a,b=input().split()
a=int(a)
b=int(b)
print((a+b+1)//2)
|
s144760773 | p03471 | u808427016 | 2,000 | 262,144 | Wrong Answer | 71 | 3,064 | 223 | 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 situation is possible, and if it is, find a possible set of bills contained in the envelope. Assume that his grandfather is rich enough, and the envelope was large enough. | import sys
N, Y = [int(x) for x in sys.stdin.readline().strip().split()]
a = Y // 10000
b = (Y - a * 10000) // 5000
c = (Y - a * 10000 - b * 5000) // 1000
if a + b + c > N:
print("-1 -1 -1")
else:
print(a, b, c)
| s309962566 | Accepted | 17 | 3,064 | 569 | import sys
N, Y = [int(x) for x in sys.stdin.readline().strip().split()]
a = Y // 10000
b = (Y - a * 10000) // 5000
c = (Y - a * 10000 - b * 5000) // 1000
while 1:
t = a + b + c
if N >= t + 9 and a > 0:
a -= 1
c += 10
continue
if N >= t + 4 and b > 0:
b -= 1
c += 5
continue
if N > t and a > 0:
a -= 1
b += 2
continue
break
if a + b + c != N or a < 0 or b < 0 or c < 0:
print("-1 -1 -1")
else:
print(a, b, c)
#print(a + b + c)
#print(a*10000+b*5000+c*1000)
|
s055899336 | p03624 | u448743361 | 2,000 | 262,144 | Wrong Answer | 41 | 4,204 | 119 | You are given a string S consisting of lowercase English letters. Find the lexicographically (alphabetically) smallest lowercase English letter that does not occur in S. If every lowercase English letter occurs in S, print `None` instead. | import sys
s=list(input())
snum=len(list(set(s)))
if snum==26:
print('None')
sys.exit(0)
s.sort()
print(s[0])
| s554255395 | Accepted | 22 | 3,956 | 271 | import sys
sin={'a','b','c','d','e','f','g','h','i','j','k','l',
'm','n','o','p','q','r','s','t','u','v','w','x',
'y','z'}
s=list(input())
snum=len(list(set(s)))
if snum==26:
print('None')
sys.exit(0)
kotae=list(sin-set(s))
kotae.sort()
print(kotae[0]) |
s193387642 | p03478 | u370429695 | 2,000 | 262,144 | Wrong Answer | 49 | 3,700 | 318 | 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 check(i,A,B):
k = 0
for j in range(len(str(i))):
k += i % 10
i = int(i/10)
if k >= A and k <= B:
return 1
else:
return 0
N,A,B = map(int,input().split())
num = 0
for i in range(N + 1):
c = check(i,A,B)
if c == 1:
print(i)
num += i
print(num) | s405427249 | Accepted | 43 | 3,060 | 221 | n,a,b = map(int,input().split())
total = 0
for i in range(1,n+1):
tmp = list(str(i))
for j in range(len(tmp)):
tmp[j] = int(tmp[j])
tmp = sum(tmp)
if a <= tmp <= b:
total += i
print(total)
|
s887704905 | p03545 | u329399746 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 276 | 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 input guarantees that there is a solution. If there are multiple solutions, any of them will be accepted. | s = input()
op = ["+","-"]
for i in range(1 << len(s) - 1):
tmp = s[0]
for j in range(len(s) - 1):
if ((i >> j) & 1):
tmp += op[0]
else:
tmp += op[1]
tmp += s[j+1]
ans = eval(tmp)
if ans == 7:
print(ans)
| s331949847 | Accepted | 17 | 3,060 | 302 | s = input()
op = ["+","-"]
ans = ""
for i in range(1 << len(s) - 1):
tmp = s[0]
for j in range(len(s) - 1):
if ((i >> j) & 1):
tmp += op[0]
else:
tmp += op[1]
tmp += s[j+1]
ans_ = eval(tmp)
if ans_ == 7:
ans = tmp+"=7"
print(ans)
|
s824281778 | p03478 | u325492232 | 2,000 | 262,144 | Wrong Answer | 32 | 3,064 | 237 | 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 abc083b():
n, a, b = map(int,input().split())
cnt = 0
for i in range(1, n + 1):
if a <=sum([int(num) for num in str(i)]) <= b:
cnt += 1
print(cnt)
if __name__ == '__main__':
abc083b() | s717096201 | Accepted | 33 | 2,940 | 236 | def abc083b():
n, a, b = map(int,input().split())
cnt = 0
for num in range(n + 1):
if a <=sum([int(i) for i in str(num)]) <= b:
cnt += num
print(cnt)
if __name__ == '__main__':
abc083b() |
s144208544 | p02742 | u583276018 | 2,000 | 1,048,576 | Wrong Answer | 31 | 9,048 | 53 | We have a board with H horizontal rows and W vertical columns of squares. There is a bishop at the top-left square on this board. How many squares can this bishop reach by zero or more movements? Here the bishop can only move diagonally. More formally, the bishop can move from the square at the r_1-th row (from the top) and the c_1-th column (from the left) to the square at the r_2-th row and the c_2-th column if and only if exactly one of the following holds: * r_1 + c_1 = r_2 + c_2 * r_1 - c_1 = r_2 - c_2 For example, in the following figure, the bishop can move to any of the red squares in one move: | h, w = map(int, input().split())
print(round(h*w))
| s870303591 | Accepted | 26 | 9,100 | 92 | h, w = map(int, input().split())
if(h == 1 or w == 1):
print(1)
else:
print((h*w+1)//2)
|
s075151433 | p02972 | u490084374 | 2,000 | 1,048,576 | Wrong Answer | 2,104 | 20,996 | 695 | There are N empty boxes arranged in a row from left to right. The integer i is written on the i-th box from the left (1 \leq i \leq N). For each of these boxes, Snuke can choose either to put a ball in it or to put nothing in it. We say a set of choices to put a ball or not in the boxes is good when the following condition is satisfied: * For every integer i between 1 and N (inclusive), the total number of balls contained in the boxes with multiples of i written on them is congruent to a_i modulo 2. Does there exist a good set of choices? If the answer is yes, find one good set of choices. | n = int(input())
li = list(map(int, input().split()))
def make_divisors(n):
divisors = []
for i in range(1, int(n**0.5)+1):
if n % i == 0:
divisors.append(i)
if i != n // i:
divisors.append(n//i)
return divisors
li.reverse()
li_len = len(li)
li_ans = []
dic = {}
for n, l in enumerate(li):
i = li_len - n
s = 0
if dic.get(i):
s = dic[i]
d2 = s % 2
if l == d2:
li_ans.append(0)
else:
divi = make_divisors(i)
for d in divi:
dic.setdefault(d, 0)
dic[d] += 1
li_ans.append(1)
li_ans.reverse()
print(sum(li_ans))
print(' '.join(map(str, li_ans))) | s419638704 | Accepted | 244 | 14,780 | 197 | n=int(input())
a=list(map(int,input().split()))
t=[0]*n
p=[]
g=0
for i in range(n-1,-1,-1):
if sum(t[i::i+1])%2!=a[i]:
t[i]=1
p.append(i+1)
g+=1
print(g)
print(*p[::-1]) |
s777868215 | p03760 | u273010357 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 233 | 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 characters at the even-numbered positions. You are given two strings O and E. O contains the characters at the odd- numbered positions retaining their relative order, and E contains the characters at the even-numbered positions retaining their relative order. Restore the original password. | O = list(input())
E = list(input())
N = len(O)+len(E)
if len(O)>len(E):
E += ' '
elif len(O)<len(E):
O += ' '
print(E)
print(O)
answer = []
for i,j in zip(O,E):
answer.append(i)
answer.append(j)
print(''.join(answer)) | s837361020 | Accepted | 17 | 3,060 | 216 | O = list(input())
E = list(input())
N = len(O)+len(E)
if len(O)>len(E):
E += ' '
elif len(O)<len(E):
O += ' '
answer = []
for i,j in zip(O,E):
answer.append(i)
answer.append(j)
print(''.join(answer))
|
s505668753 | p03502 | u329143273 | 2,000 | 262,144 | Wrong Answer | 19 | 2,940 | 58 | 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=input()
print('Yes' if int(n)%sum(map(int,n)) else 'No') | s184748901 | Accepted | 17 | 3,064 | 61 | n=input()
print('Yes' if int(n)%sum(map(int,n))==0 else 'No') |
s024618890 | p03361 | u526459074 | 2,000 | 262,144 | Wrong Answer | 22 | 3,316 | 514 | We have a canvas divided into a grid with H rows and W columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Initially, all the squares are white. square1001 wants to draw a picture with black paint. His specific objective is to make Square (i, j) black when s_{i, j}= `#`, and to make Square (i, j) white when s_{i, j}= `.`. However, since he is not a good painter, he can only choose two squares that are horizontally or vertically adjacent and paint those squares black, for some number of times (possibly zero). He may choose squares that are already painted black, in which case the color of those squares remain black. Determine if square1001 can achieve his objective. | from collections import deque
H,W = map(int, input().split())
m = [input() for _ in range(H)]
visited=[[0]*W for _ in range(H)]
dhw = [(1,0),(-1,0),(0,1),(0,-1)]
def main():
global visited
for h in range(H):
for w in range(W):
if m[h][w]==".":
continue
for dh, dw in dhw:
nh, nw = h+dh, w+dw
if 0<=nh<H and 0<=nw<W:
if m[nh][nw]=="#":
break
else:
print("NO")
return
print("YES")
return
if __name__ == "__main__":
main() | s759474186 | Accepted | 22 | 3,316 | 514 | from collections import deque
H,W = map(int, input().split())
m = [input() for _ in range(H)]
visited=[[0]*W for _ in range(H)]
dhw = [(1,0),(-1,0),(0,1),(0,-1)]
def main():
global visited
for h in range(H):
for w in range(W):
if m[h][w]==".":
continue
for dh, dw in dhw:
nh, nw = h+dh, w+dw
if 0<=nh<H and 0<=nw<W:
if m[nh][nw]=="#":
break
else:
print("No")
return
print("Yes")
return
if __name__ == "__main__":
main() |
s817193432 | p02972 | u203843959 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 9 | There are N empty boxes arranged in a row from left to right. The integer i is written on the i-th box from the left (1 \leq i \leq N). For each of these boxes, Snuke can choose either to put a ball in it or to put nothing in it. We say a set of choices to put a ball or not in the boxes is good when the following condition is satisfied: * For every integer i between 1 and N (inclusive), the total number of balls contained in the boxes with multiples of i written on them is congruent to a_i modulo 2. Does there exist a good set of choices? If the answer is yes, find one good set of choices. | print(-1) | s720534377 | Accepted | 595 | 14,132 | 323 | N=int(input())
alist=[0]+list(map(int,input().split()))
#print(alist)
blist=[0]*(N+1)
for i in reversed(range(1,N+1)):
blist[i]=alist[i]
for j in range(2*i,N+1,i):
blist[i]+=blist[j]
blist[i]%=2
#print(blist[1:])
answer_list=[i for i in range(1,N+1) if blist[i]==1]
print(len(answer_list))
print(*answer_list) |
s136434197 | p00728 | u209989098 | 1,000 | 131,072 | Wrong Answer | 20 | 5,592 | 298 | The International Clown and Pierrot Competition (ICPC), is one of the most distinguished and also the most popular events on earth in the show business. One of the unique features of this contest is the great number of judges that sometimes counts up to one hundred. The number of judges may differ from one contestant to another, because judges with any relationship whatsoever with a specific contestant are temporarily excluded for scoring his/her performance. Basically, scores given to a contestant's performance by the judges are averaged to decide his/her score. To avoid letting judges with eccentric viewpoints too much influence the score, the highest and the lowest scores are set aside in this calculation. If the same highest score is marked by two or more judges, only one of them is ignored. The same is with the lowest score. The average, which may contain fractions, are truncated down to obtain final score as an integer. You are asked to write a program that computes the scores of performances, given the scores of all the judges, to speed up the event to be suited for a TV program. | i = int(input())
while i == 0:
i = 0
p = 0
k[20][100] = [[0]]
ma = 0
mi = 1000
for i in range(i):
l = int(input())
k[p][i] = l
ma = max(ma,l)
mi = min(mi,l)
su = sum(k[p]) - ma - mi
print(su // (i-2))
p += 1
i = int(input())
| s341297486 | Accepted | 30 | 5,604 | 293 | i = int(input())
p = 0
while i != 0:
k =[ [0]*100]*20
ma = 0
mi = 1000
for pp in range(i):
l = int(input())
k[p][pp] = l
ma = max(ma,l)
mi = min(mi,l)
su = sum(k[p]) - ma - mi
l = i -2
print(su // l)
p += 1
i = int(input())
|
s201443472 | p03920 | u030726788 | 2,000 | 262,144 | Wrong Answer | 2,104 | 15,824 | 131 | The problem set at _CODE FESTIVAL 20XX Finals_ consists of N problems. The score allocated to the i-th (1≦i≦N) problem is i points. Takahashi, a contestant, is trying to score exactly N points. For that, he is deciding which problems to solve. As problems with higher scores are harder, he wants to minimize the highest score of a problem among the ones solved by him. Determine the set of problems that should be solved. | n=int(input())
c=n
for i in range(n):
s=(i*(i+1))//2
if(i>=n):
c=i
break
for i in range(1,c+1):
if(i!=(s-n)):print(i) | s400832275 | Accepted | 22 | 3,316 | 133 | n=int(input())
c=n
for i in range(n+1):
s=(i*(i+1))//2
if(s>=n):
c=i
break
for i in range(1,c+1):
if(i!=(s-n)):print(i) |
s643726799 | p02409 | u518939641 | 1,000 | 131,072 | Wrong Answer | 20 | 7,620 | 332 | 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 floor at building b. If v is negative, it means that −v persons left. Assume that initially no person lives in the building. | import sys
residence=[[[0 for i in range(10)] for j in range(3)] for k in range(4)]
input()
lines=sys.stdin.readlines()
for l in lines:
k=list(map(int,l.split()))
residence[k[0]-1][k[1]-1][k[2]-1]=k[3]
for b in range(4):
for f in range(3):
print(' '.join(map(str,residence[b][f])))
if b!=3: print('#'*20) | s997435024 | Accepted | 30 | 7,744 | 416 | residence=[[[0 for i in range(10)] for j in range(3)] for k in range(4)]
n=int(input())
lines=[input() for i in range(n)]
for l in lines:
k=list(map(int,l.split()))
residence[k[0]-1][k[1]-1][k[2]-1]+=k[3]
if residence[k[0]-1][k[1]-1][k[2]-1]>9: residence[k[0]-1][k[1]-1][k[2]-1]=9
for b in range(4):
for f in range(3):
print(' '+' '.join(map(str,residence[b][f])))
if b!=3: print('#'*20) |
s183074898 | p03455 | u917138620 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 81 | AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd. | print("Yes") if (int(input().replace(" ",""))**0.5).is_integer() else print("No") | s703381534 | Accepted | 17 | 2,940 | 92 | a, b= (int(i) for i in input().split())
print('Even') if a * b % 2 == 0 else print('Odd') |
s781225690 | p04011 | u825528847 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 105 | There is a hotel with the following accommodation fee: * X yen (the currency of Japan) per night, for the first K nights * Y yen per night, for the (K+1)-th and subsequent nights Tak is staying at this hotel for N consecutive nights. Find his total accommodation fee. | N = int(input())
K = int(input())
X = int(input())
Y = int(input())
print(min(K, N)*X - max(0, N-K) * Y)
| s437719364 | Accepted | 17 | 2,940 | 105 | N = int(input())
K = int(input())
X = int(input())
Y = int(input())
print(min(K, N)*X + max(0, N-K) * Y)
|
s647215235 | p02865 | u326870273 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 273 | How many ways are there to choose two distinct positive integers totaling N, disregarding the order? | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
------------------------
author : iiou16
------------------------
'''
def main():
N = int(input())
if N % 2 == 0:
print(N / 2 - 1)
else:
print(N // 2)
if __name__ == '__main__':
main()
| s025741474 | Accepted | 18 | 2,940 | 278 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
------------------------
author : iiou16
------------------------
'''
def main():
N = int(input())
if N % 2 == 0:
print(int(N / 2 - 1))
else:
print(N // 2)
if __name__ == '__main__':
main()
|
s047656647 | p04043 | u223646582 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 68 | 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 of the phrases once, in some order. | print('Yes' if sorted(input().split()) == ['5', '5', '7'] else 'No') | s730618930 | Accepted | 17 | 2,940 | 68 | print('YES' if sorted(input().split()) == ['5', '5', '7'] else 'NO') |
s399952946 | p02606 | u551058317 | 2,000 | 1,048,576 | Wrong Answer | 30 | 9,096 | 180 | How many multiples of d are there among the integers between L and R (inclusive)? | L, R, d = [int(v) for v in input().strip().split(" ")]
# int(input().strip())
# eval(input().strip())
num = int((R - L) / d)
if L % d == 0:
print(num + 1)
else:
print(num) | s746179500 | Accepted | 31 | 9,152 | 182 | L, R, d = [int(v) for v in input().strip().split(" ")]
# int(input().strip())
# eval(input().strip())
num = 0
for n in range(L, R+1):
if n % d == 0:
num += 1
print(num) |
s130358884 | p02747 | u023762741 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,060 | 292 | A Hitachi string is a concatenation of one or more copies of the string `hi`. For example, `hi` and `hihi` are Hitachi strings, while `ha` and `hii` are not. Given a string S, determine whether S is a Hitachi string. | input_line = input()
Line = list(input_line)
flag = 0
for i in Line:
print(i)
if i == "h" and flag == 0:
flag = 1
elif i == "i" and flag ==1:
flag = 0
else:
flag = 2
print("No")
if flag == 1:
print("No")
elif flag == 0:
print("Yes") | s139002414 | Accepted | 17 | 3,060 | 307 |
input_line = input()
Line = list(input_line)
flag = 0
for i in Line:
# print(i)
if i == "h" and flag == 0:
flag = 1
elif i == "i" and flag ==1:
flag = 0
else:
flag = 2
if flag == 1:
print("No")
elif flag == 2:
print("No")
elif flag == 0:
print("Yes") |
s326553997 | p03486 | u672898046 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 85 | 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. | s = sorted(input())
t = sorted(input())
if t > s:
print("Yes")
else:
print("No")
| s067320658 | Accepted | 17 | 2,940 | 97 | s = sorted(input())
t = sorted(input(),reverse=True)
if t > s:
print("Yes")
else:
print("No") |
s827879141 | p03548 | u027929618 | 2,000 | 262,144 | Wrong Answer | 29 | 2,940 | 72 | We have a long seat of width X centimeters. There are many people who wants to sit here. A person sitting on the seat will always occupy an interval of length Y centimeters. We would like to seat as many people as possible, but they are all very shy, and there must be a gap of length at least Z centimeters between two people, and between the end of the seat and a person. At most how many people can sit on the seat? | x,y,z=map(int,input().split())
n=0
while y*n+z*(n+1)<=x:
n+=1
print(n) | s782421646 | Accepted | 31 | 2,940 | 74 | x,y,z=map(int,input().split())
n=1
while y*n+z*(n+1)<=x:
n+=1
print(n-1) |
s620442132 | p00025 | u737311644 | 1,000 | 131,072 | Wrong Answer | 30 | 5,604 | 401 | Let's play Hit and Blow game. _A_ imagines four numbers and _B_ guesses the numbers. After _B_ picks out four numbers, _A_ answers: * The number of numbers which have the same place with numbers _A_ imagined (Hit) * The number of numbers included (but different place) in the numbers _A_ imagined (Blow) For example, if _A_ imagined numbers: 9 1 8 2 and _B_ chose: 4 1 5 9 _A_ should say 1 Hit and 1 Blow. Write a program which reads four numbers _A_ imagined and four numbers _B_ chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. | while True:
hit=0
bro=0
try:
a = [int(i) for i in input().split()]
b= [int(j) for j in input().split()]
for l in range(4):
if a[l]==b[l]:
hit+=1
for g in range(4):
for p in range(4):
if a[g]==a[p]:
bro+=1
bro=bro-hit
bro-=1
print(hit,bro)
except:break
| s905961385 | Accepted | 20 | 5,604 | 388 | while True:
hit=0
bro=0
try:
a = [int(i) for i in input().split()]
b= [int(j) for j in input().split()]
for g in range(4):
for p in range(4):
if a[g]==b[p]:
bro+=1
for l in range(4):
if a[l]==b[l]:
hit+=1
bro-=1
print(hit,bro)
except:break
|
s367137873 | p03711 | u449998745 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 257 | Based on some criterion, Snuke divided the integers from 1 through 12 into three groups as shown in the figure below. Given two integers x and y (1 ≤ x < y ≤ 12), determine whether they belong to the same group. | a=[1,3,5,7,8,10,12]
b=[4,6,9,11]
c=[2]
x,y=map(int,input().split())
def jj(n):
if n in a:
return 1
if n in b:
return 2
if n in c:
return 3
if jj(x)==jj(y):
print("yes")
else:
print("no") | s797335771 | Accepted | 17 | 3,060 | 257 | a=[1,3,5,7,8,10,12]
b=[4,6,9,11]
c=[2]
x,y=map(int,input().split())
def jj(n):
if n in a:
return 1
if n in b:
return 2
if n in c:
return 3
if jj(x)==jj(y):
print("Yes")
else:
print("No") |
s204207941 | p02396 | u369313788 | 1,000 | 131,072 | Wrong Answer | 150 | 7,508 | 118 | In the online judge system, a judge file may include multiple datasets to check whether the submitted program outputs a correct answer for each test case. This task is to practice solving a problem with multiple datasets. Write a program which reads an integer x and print it as is. Note that multiple datasets are given for this problem. | i = 1
while 1:
x = int(input())
print("Case ", (i), ': ', (x),sep='')
i += 1
if x == 0:
break | s546888951 | Accepted | 90 | 8,316 | 183 | b = []
i = 1
while 1:
x = int(input())
b.append(x)
if x == 0:
break
for x in b:
if x == 0:
break
print("Case ", (i), ': ', (x), sep='')
i += 1 |
s526842613 | p03129 | u281733053 | 2,000 | 1,048,576 | Wrong Answer | 19 | 3,060 | 101 | Determine if we can choose K different integers between 1 and N (inclusive) so that no two of them differ by 1. | a,b = input().split( )
a=int(a)
b=int(b)
c = (a-2)*(a-1)/2
if b > c:
print("no")
else:
print("yes") | s292664996 | Accepted | 17 | 2,940 | 95 | a,b = input().split( )
a=int(a)
b=int(b)
c = (a+1)/2
if b > c:
print("NO")
else:
print("YES") |
s317201517 | p03943 | u317785246 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 118 | Two students of AtCoder Kindergarten are fighting over candy packs. There are three candy packs, each of which contains a, b, and c candies, respectively. Teacher Evi is trying to distribute the packs between the two students so that each student gets the same number of candies. Determine whether it is possible. Note that Evi cannot take candies out of the packs, and the whole contents of each pack must be given to one of the students. | ary = sorted([int(x) for x in input().split()])
if ary[0] + ary[1] == ary[2]:
print("YES")
else:
print("NO") | s822520989 | Accepted | 17 | 2,940 | 121 | ary = sorted([int(x) for x in input().split()])
if ary[0] + ary[1] == ary[2]:
print("Yes")
else:
print("No")
|
s207726996 | p03473 | u373529207 | 2,000 | 262,144 | Wrong Answer | 19 | 3,060 | 32 | How many hours do we have until New Year at M o'clock (24-hour notation) on 30th, December? | S = input()
print("2018"+S[4:])
| s342724673 | Accepted | 17 | 2,940 | 29 | M = int(input())
print(48-M)
|
s099198815 | p02690 | u569322757 | 2,000 | 1,048,576 | Time Limit Exceeded | 2,206 | 9,140 | 506 | Give a pair of integers (A, B) such that A^5-B^5 = X. It is guaranteed that there exists such a pair for the given integer X. | x = int(input())
i = 1
a = 1
b = 0
while a**5 - b**5 <= x:
if a**5 - b**5 == x:
print(a, b)
exit
a += 1
b -= 1
while True:
i += 1
if x % i:
continue
b = 1
a = i - b
while b < a and a**5 - b**5 <= x:
if a**5 - b**5 == x:
print(a, b)
exit
a += 1
b -= 1
a = i
b = 0
while a**5 - b**5 <= x:
if a**5 - b**5 == x:
print(a, b)
exit
a += 1
b -= 1 | s160909169 | Accepted | 39 | 9,180 | 253 | x = int(input())
OP = [+1, -1]
for a in range(1000):
for b in range(a + 1):
for op1 in OP:
for op2 in OP:
if (op1 * a)**5 - (op2 * b)**5 == x:
print(op1 * a, op2 * b)
exit() |
s730569931 | p03471 | u354916249 | 2,000 | 262,144 | Wrong Answer | 1,368 | 3,060 | 272 | 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 situation is possible, and if it is, find a possible set of bills contained in the envelope. Assume that his grandfather is rich enough, and the envelope was large enough. | N, Y = map(int, input().split())
x = -1
y = -1
z = -1
for i in range(N):
for j in range(N):
m = Y - i * 1000 - j * 5000
if (m % 10000 == 0) and (m // 10000 == N - i - j):
x = i
y = j
z = m // 10000
print(x, y, z)
| s800654103 | Accepted | 1,065 | 3,188 | 269 | N, Y = map(int, input().split())
x = -1
y = -1
z = -1
for i in range(N + 1):
for j in range(N - i + 1):
if (0 <= N - i - j) and (Y == 10000 * i + 5000 * j + 1000 * (N - i - j)):
x = i
y = j
z = N - i - j
print(x, y, z) |
s242087392 | p03699 | u335278042 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 345 | You are taking a computer-based examination. The examination consists of N questions, and the score allocated to the i-th question is s_i. Your answer to each question will be judged as either "correct" or "incorrect", and your grade will be the sum of the points allocated to questions that are answered correctly. When you finish answering the questions, your answers will be immediately judged and your grade will be displayed... if everything goes well. However, the examination system is actually flawed, and if your grade is a multiple of 10, the system displays 0 as your grade. Otherwise, your grade is displayed correctly. In this situation, what is the maximum value that can be displayed as your grade? | N = int(input())
lis = []
all10 = True
res = 0
for _ in range(N):
tmp = int(input())
res += tmp
lis.append(tmp)
if all10 and tmp % 10 != 0:
all10 = False
if all10:
print(0)
exit()
if res % 10 != 0:
print(res)
exit()
else:
lis.sort()
for i in lis:
if i % 10 != 0:
print(res-i)
| s433766014 | Accepted | 19 | 3,064 | 364 | N = int(input())
lis = []
all10 = True
res = 0
for _ in range(N):
tmp = int(input())
res += tmp
lis.append(tmp)
if all10 and tmp % 10 != 0:
all10 = False
if all10:
print(0)
exit()
if res % 10 != 0:
print(res)
exit()
else:
lis.sort()
for i in lis:
if i % 10 != 0:
print(res-i)
exit()
|
s130899981 | p02646 | u087731474 | 2,000 | 1,048,576 | Wrong Answer | 23 | 9,056 | 216 | Two children are playing tag on a number line. (In the game of tag, the child called "it" tries to catch the other child.) The child who is "it" is now at coordinate A, and he can travel the distance of V per second. The other child is now at coordinate B, and she can travel the distance of W per second. He can catch her when his coordinate is the same as hers. Determine whether he can catch her within T seconds (including exactly T seconds later). We assume that both children move optimally. | a, v = [int(i) for i in input().split()]
b, w = [int(i) for i in input().split()]
t = int(input())
if w >= v:
print("NO")
exit()
#print((b-a) / (v-w))
if (b-a) / (v-w) <= t:
print("Yes")
else :
print("No") | s549465814 | Accepted | 24 | 9,188 | 308 | a, v = [int(i) for i in input().split()]
b, w = [int(i) for i in input().split()]
t = int(input())
if w >= v:
print("NO")
exit()
#print((b-a) / (v-w))
if b > a:
if a + v*t >= b + w*t:
print("YES")
else:
print("NO")
else :
if a - v*t <= b - w*t:
print("YES")
else:
print("NO")
|
s504888297 | p02414 | u067975558 | 1,000 | 131,072 | Wrong Answer | 30 | 6,724 | 406 | 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$ respectively. | (n,m,l) = [int(x) for x in input().split()]
a = []
b = []
c = [[0 for x in range(l)] for y in range(n)]
for nc in range(n):
a.append([int(i) for i in input().split()])
for mc in range(m):
b.append([int(i) for i in input().split()])
for i in range(n):
for j in range(m):
for k in range(l):
c[k][i] += a[i][j] * b[j][k]
for r in c:
print(' '.join([str(d) for d in r])) | s521066812 | Accepted | 580 | 7,764 | 406 | (n,m,l) = [int(x) for x in input().split()]
a = []
b = []
c = [[0 for x in range(l)] for y in range(n)]
for nc in range(n):
a.append([int(i) for i in input().split()])
for mc in range(m):
b.append([int(i) for i in input().split()])
for i in range(n):
for j in range(l):
for k in range(m):
c[i][j] += a[i][k] * b[k][j]
for r in c:
print(' '.join([str(d) for d in r])) |
s004809858 | p03337 | u820351940 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 59 | You are given two integers A and B. Find the largest value among A+B, A-B and A \times B. | a, b = map(int, input().split())
print(a + b, a - b, a * b) | s071156953 | Accepted | 17 | 2,940 | 64 | a, b = map(int, input().split())
print(max(a + b, a - b, a * b)) |
s940110867 | p02406 | u650790815 | 1,000 | 131,072 | Wrong Answer | 20 | 7,704 | 94 | In programming languages like C/C++, a goto statement provides an unconditional jump from the "goto" to a labeled statement. For example, a statement "goto CHECK_NUM;" is executed, control of the program jumps to CHECK_NUM. Using these constructs, you can implement, for example, loops. Note that use of goto statement is highly discouraged, because it is difficult to trace the control flow of a program which includes goto. Write a program which does precisely the same thing as the following program (this example is wrtten in C++). Let's try to write the program without goto statements. void call(int n){ int i = 1; CHECK_NUM: int x = i; if ( x % 3 == 0 ){ cout << " " << i; goto END_CHECK_NUM; } INCLUDE3: if ( x % 10 == 3 ){ cout << " " << i; goto END_CHECK_NUM; } x /= 10; if ( x ) goto INCLUDE3; END_CHECK_NUM: if ( ++i <= n ) goto CHECK_NUM; cout << endl; } | n = int(input())
print('',' '.join([str(x) for x in range(1,n+1) if n%3==0 or '3' in str(x)])) | s802696331 | Accepted | 30 | 7,808 | 90 | print('',' '.join([str(x) for x in range(1,int(input())+1) if x % 3==0 or '3' in str(x)])) |
s845695261 | p02678 | u441064181 | 2,000 | 1,048,576 | Wrong Answer | 2,209 | 157,660 | 3,061 | 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 the cave, so we have decided to place a signpost in each room except Room 1. The signpost in each room will point to one of the rooms directly connected to that room with a passage. Since it is dangerous in the cave, our objective is to satisfy the condition below for each room except Room 1. * If you start in that room and repeatedly move to the room indicated by the signpost in the room you are in, you will reach Room 1 after traversing the minimum number of passages possible. Determine whether there is a way to place signposts satisfying our objective, and print one such way if it exists. | import bisect,collections,copy,heapq,itertools,math,numpy,string
#from operator import itemgetter
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
N, M = LI()
AB = [LS() for _ in range(M)]
path = {}
allpath = []
for ind,ab in enumerate(AB):
if ab[0] not in path:
path[ab[0]] = []
tmp = []
tmp.append(ind+1)
tmp.append(ab[1])
path[ab[0]].append(tmp[::])
if ab[1] not in path:
path[ab[1]] = []
tmp = []
tmp.append(-ind-1)
tmp.append(ab[0])
path[ab[1]].append(tmp[::])
#print(path)
def dfs(st, end):
global allpath
stack = []
#res = []
is_passed = [False] * (M*2+1)
hist = [[0, '0']]
now = [0, st]
pre = None
st_flag = (st!=end)
while True:
#print(now)
#print(stack)
hist.append(now)
#print(hist)
if now[0] != 0:
if now[1] != '1':
is_passed[now[0]] = True
if st_flag and now[1] == end:
# ended
#print("\tsuccess! route is below:\n\t\t{0}".format(hist))
allpath.append(hist)
if not stack:
break
next = stack[len(stack)-1]
target_p = AB[abs(next[0])-1]
if target_p[0] == next[1]:
target = target_p[1]
else:
target = target_p[0]
for i,v in enumerate(hist[-2::-1]):
if v[1] == target:
break
is_passed[v[0]] = False
#print("hit id is {0}".format(i))
hist = hist[0:len(hist)-i-1]
#print(hist)
else:
st_flag = True
useflag = True
for v in path[now[1]]:
if is_passed[v[0]]:
continue
if v[1]==hist[len(hist)-2][1]:
continue
for w in hist[2:]:
if v[1]==w[1]:
break
else:
stack.append(v)
useflag = False
continue
if useflag:
#print("\tno route from path{0}".format(now))
#print("\tstack is {0}".format(stack))
if not stack:
break
next = stack[len(stack)-1]
#print("\tnext is {0}".format(next))
target_p = AB[abs(next[0])-1]
if target_p[0] == next[1]:
target = target_p[1]
else:
target = target_p[0]
#print("\ttarget is {0}".format(target))
for i,v in enumerate(hist[::-1]):
if v[1] == target:
break
is_passed[v[0]] = False
hist = hist[0:len(hist)-i]
if not stack:
break
now = stack.pop()
dfs('1','1')
for P in allpath:
if len(P) == N+2:
print("yes")
Q = []
for p in P:
if p[0] == 0:
continue
tmp = AB[abs(p[0])-1][0]
if tmp == p[1]:
tmp = AB[abs(p[0])-1][1]
Q.append([tmp, p[1]])
Q.sort(key=lambda x:x[0])
#print(Q)
for q in Q[1:]:
print(q[1])
break | s264398881 | Accepted | 1,011 | 95,952 | 1,467 | import bisect,collections,copy,heapq,itertools,math,numpy,string
#from operator import itemgetter
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
N, M = LI()
AB = [LI() for _ in range(M)]
path = [[] for _ in range(N+1)]
mp = []
ans = [0] * (N+1)
for ab in AB:
a = ab[0]
b = ab[1]
path[a].append(b)
path[b].append(a)
#print(a,b)
def bfs(tree, st, endlist, endnum):
queue = collections.deque()
queue.append([-1,st])
endlist[st] -= 1
now = [-1,-1,-1]
pre = []
depth = 0
histind = -1
node = -1
hist = []
res = []
allres = []
while queue:
pre = now[:]
now = queue.popleft()
histind = now[0]
node = now[1]
hist.append([histind,node])
res = [node,hist[histind][1]]
allres.append(res[::])
endnum -= 1
if endnum == 0:
return allres
for v in path[node]:
if endlist[v] > 0:
queue.append([len(hist)-1,v])
endlist[v] -= 1
continue
return None
#print_map(path)
result = bfs(path, 1, [1] * (N+1), N)
#print("[TO, FROM] = {0}".format(result))
if result is None:
print("No")
exit(0)
print("Yes")
execnum = N
maxlen = len(result[len(result)-1])
for i in result:
#print(i)
if ans[i[0]] == 0:
ans[i[0]] = i[1]
execnum-=1
if execnum == 0:
break
for i in ans[2:]:
print(i)
|
s400957888 | p03730 | u987164499 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 136 | 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 objective is to make the sum congruent to C modulo B. Determine whether this is possible. If the objective is achievable, print `YES`. Otherwise, print `NO`. | from sys import stdin
a,b,c = [int(x) for x in stdin.readline().rstrip().split()]
if a%b == c:
print("YES")
else:
print("NO")
| s334062242 | Accepted | 17 | 2,940 | 181 | from sys import stdin
a,b,c = [int(x) for x in stdin.readline().rstrip().split()]
for i in range(1,b):
if a*i%b == c:
print("YES")
exit()
else:
print("NO") |
s216831583 | p02557 | u922449550 | 2,000 | 1,048,576 | Wrong Answer | 294 | 41,216 | 492 | Given are two sequences A and B, both of length N. A and B are each sorted in the ascending order. Check if it is possible to reorder the terms of B so that for each i (1 \leq i \leq N) A_i \neq B_i holds, and if it is possible, output any of the reorderings that achieve it. | N = int(input())
A = list(map(int, input().split())) + [N+1]
B = list(map(int, input().split()))
ans = []
ida = 0
while ida < N:
a = A[ida]
c = 1
while ida+c < N+1 and A[ida+c] == a:
c += 1
ida += c
temp = []
while c:
if len(B) == 0:
print('No')
quit()
b = B.pop()
if b != a:
ans.append(b)
c -= 1
else:
temp.append(b)
B += temp
print('Yes')
print(*ans) | s867177897 | Accepted | 323 | 41,424 | 490 | N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
count = [0] * (N+1)
for a, b in zip(A, B):
count[a] += 1
count[b] += 1
for i in range(N+1):
if count[i] > N:
print('No')
quit()
diff = 0
checked = set()
ida = 0
for i, b in enumerate(B):
if b in checked:
continue
checked.add(b)
while ida < N and A[ida] <= b:
ida += 1
diff = max(diff, ida - i)
print('Yes')
print(*(B[-diff:]+B[:-diff])) |
s244048493 | p03813 | u620945921 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 190 | 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. | s=input()
#print(s)
cnt=0
flag1=0
flag2=0
for i in range(len(s)):
if s[i]=='A':
flag1=1
if flag1==1 and flag2==0:
cnt+=1
if flag1==1 and s[i]=='Z':
flag2=1
print(cnt) | s457400396 | Accepted | 18 | 2,940 | 48 | x=int(input())
print('ABC' if x<1200 else 'ARC') |
s124808949 | p02396 | u663910047 | 1,000 | 131,072 | Wrong Answer | 140 | 7,532 | 93 | In the online judge system, a judge file may include multiple datasets to check whether the submitted program outputs a correct answer for each test case. This task is to practice solving a problem with multiple datasets. Write a program which reads an integer x and print it as is. Note that multiple datasets are given for this problem. | x=1
i =0
while x > 0:
x = int(input())
i = i+ 1
print("Case"+str(i)+":" +str(x)) | s736829185 | Accepted | 90 | 7,944 | 153 | l=[]
x=1
while x > 0 and (len(l)-1) < 10000:
x = int(input())
l.append(x)
for i in range(len(l)-1):
print("Case "+str(i+1)+": " +str(l[i])) |
s456882361 | p02393 | u337016727 | 1,000 | 131,072 | Wrong Answer | 20 | 7,420 | 73 | Write a program which reads three integers, and prints them in ascending order. | # coding: utf-8
num = input().rstrip().split(" ")
num.sort()
print(num) | s526702181 | Accepted | 30 | 7,404 | 118 | # coding: utf-8
num = sorted(input().rstrip().split(" "))
print(str(num[0] + " " + str(num[1]) + " " + str(num[2]))) |
s951187368 | p03361 | u659100741 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 432 | We have a canvas divided into a grid with H rows and W columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Initially, all the squares are white. square1001 wants to draw a picture with black paint. His specific objective is to make Square (i, j) black when s_{i, j}= `#`, and to make Square (i, j) white when s_{i, j}= `.`. However, since he is not a good painter, he can only choose two squares that are horizontally or vertically adjacent and paint those squares black, for some number of times (possibly zero). He may choose squares that are already painted black, in which case the color of those squares remain black. Determine if square1001 can achieve his objective. | H,W = map(int, input().split())
s = []
answer = "YES"
for i in range(H):
s.append(str(input()))
for i in range(H):
for j in range(W):
if s[i][j] == "#":
if j-1 >= 0 and s[i][j-1] == ".":
if j+1 < W and s[i][j+1] == ".":
if i-1 >=0 and s[i-1][j] == ".":
if i+1 < H and s[i+1][j] == ".":
answer ="NO"
print(answer)
| s059997052 | Accepted | 18 | 3,064 | 432 | H,W = map(int, input().split())
s = []
answer = "Yes"
for i in range(H):
s.append(str(input()))
for i in range(H):
for j in range(W):
if s[i][j] == "#":
if j != 0 and s[i][j-1] == ".":
if j+1 != W and s[i][j+1] == ".":
if i != 0 and s[i-1][j] == ".":
if i+1 != H and s[i+1][j] == ".":
answer ="No"
print(answer)
|
s541749463 | p04011 | u846150137 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 90 | There is a hotel with the following accommodation fee: * X yen (the currency of Japan) per night, for the first K nights * Y yen per night, for the (K+1)-th and subsequent nights Tak is staying at this hotel for N consecutive nights. Find his total accommodation fee. | a=int(input())
b=int(input())
c=int(input())
d=int(input())
print(min(a,b)*c+max(b-a,0)*d) | s933154048 | Accepted | 17 | 2,940 | 90 | a=int(input())
b=int(input())
c=int(input())
d=int(input())
print(min(a,b)*c+max(a-b,0)*d) |
s228658326 | p03251 | u896741788 | 2,000 | 1,048,576 | Wrong Answer | 28 | 9,152 | 97 | 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 inclined to put the cities at coordinates y_1, y_2, ..., y_M under its control. If there exists an integer Z that satisfies all of the following three conditions, they will come to an agreement, but otherwise war will break out. * X < Z \leq Y * x_1, x_2, ..., x_N < Z * y_1, y_2, ..., y_M \geq Z Determine if war will break out. | i=lambda:map(int,input().split());n,m,x,y=i();print("No"*(max(x,max(i()))<min(min(i()),y))+'War') | s579726193 | Accepted | 26 | 9,052 | 98 | i=lambda:map(int,input().split());n,m,x,y=i();print("No "*(max(x,max(i()))<min(min(i()),y))+'War') |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.