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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s235582470 | p02928 | u363207161 | 2,000 | 1,048,576 | Wrong Answer | 477 | 3,188 | 365 | We have a sequence of N integers A~=~A_0,~A_1,~...,~A_{N - 1}. Let B be a sequence of K \times N integers obtained by concatenating K copies of A. For example, if A~=~1,~3,~2 and K~=~2, B~=~1,~3,~2,~1,~3,~2. Find the inversion number of B, modulo 10^9 + 7. Here the inversion number of B is defined as the number of o... | n, k = map(int, input().split())
a = list(map(int, input().split()))
const = pow(10, 9) + 7
c = 0
for i in range(n):
for j in range(n - i - 1):
# print(i, 10 - j - 1)
if a[i] > a[n - j - 1]:
c += 1
print("c", c)
p = len(set(a))
q = p * (p - 1) / 2
print("q", q)
ans = 0 + c * k + ... | s266957482 | Accepted | 1,294 | 3,700 | 421 | import copy
n, k = map(int, input().split())
a = list(map(int, input().split()))
const = 1000000007
c = 0
d = 0
for i in range(n):
for j in range(n - i - 1):
if a[i] > a[n - j - 1]:
c += 1
b = copy.deepcopy(a)
for i in range(n):
for j in range(n):
if b[i] > a[j]:
d +... |
s953911743 | p03795 | u871841829 | 2,000 | 262,144 | Wrong Answer | 25 | 9,080 | 38 | 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 ... | N=int(input())
print(N*800 - N%15*200) | s755804786 | Accepted | 25 | 9,004 | 39 | N=int(input())
print(N*800 - N//15*200) |
s187027017 | p02647 | u692453235 | 2,000 | 1,048,576 | Wrong Answer | 2,206 | 51,488 | 435 | We have N bulbs arranged on a number line, numbered 1 to N from left to right. Bulb i is at coordinate i. Each bulb has a non-negative integer parameter called intensity. When there is a bulb of intensity d at coordinate x, the bulb illuminates the segment from coordinate x-d-0.5 to x+d+0.5. Initially, the intensity o... | import numpy as np
N, K = map(int, input().split())
A = np.array(list(map(int, input().split())))
#A = np.array([0] * N)
#print(A)
cnt = 0
for _ in range(K):
B = np.array([0] * N)
stop = 0
for i in range(N):
p = A[i]
L = max(i-p, 0)
R = min(i+p, N-1)
for j in range(L, R+1):
B[j] += 1
... | s638259020 | Accepted | 913 | 123,384 | 397 | import numpy as np
N, K = map(int, input().split())
A = np.array(list(map(int, input().split())))
from numba import jit
@jit
def imos(x):
global N
B = np.zeros_like(x)
for i in range(N):
p = x[i]
L = max(i-p, 0)
R = min(i+p, N-1)
B[L] += 1
if R < N-1:
B[R+1] -= 1
B = np.cumsum(B)
... |
s818990826 | p02645 | u920103253 | 2,000 | 1,048,576 | Wrong Answer | 21 | 9,076 | 23 | When you asked some guy in your class his name, he called himself S, where S is a string of length between 3 and 20 (inclusive) consisting of lowercase English letters. You have decided to choose some three consecutive characters from S and make it his nickname. Print a string that is a valid nickname for him. | s=input()
print(s[:4]) | s514330681 | Accepted | 22 | 8,944 | 23 | s=input()
print(s[:3]) |
s785889612 | p03485 | u093033848 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 118 | 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 = map(int, input().split())
if (a + b) % 2 == 0:
print((a + b) / 2)
else:
print(round(((a + b) / 2) + 1)) | s639142321 | Accepted | 17 | 2,940 | 113 | a, b = map(int, input().split())
if (a + b) % 2 == 0:
print((a + b) // 2)
else:
print(((a + b) // 2 + 1)) |
s082309219 | p02255 | u231136358 | 1,000 | 131,072 | Wrong Answer | 20 | 7,344 | 287 | 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 = input().split()
N = A.pop()
# print(N)
# print(A)
# A = [5, 2, 4, 6, 1, 3]
print(' '.join(map(str, A)))
for i in range(1, len(A)):
key = A[i]
j = i - 1
while j >= 0 and A[j] > key:
A[j+1] = A[j]
j = j - 1
A[j+1] = key
print(' '.join(map(str, A))) | s227897178 | Accepted | 40 | 7,728 | 286 | N = int(input())
A = [int(s) for s in input().split()]
print(' '.join([str(item) for item in A]))
for i in range(1, N):
key = A[i]
j = i - 1
while j >= 0 and A[j] > key:
A[j+1] = A[j]
j = j - 1
A[j+1] = key
print(' '.join([str(item) for item in A])) |
s358271119 | p03583 | u801049006 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 225 | You are given an integer N. Find a triple of positive integers h, n and w such that 4/N = 1/h + 1/n + 1/w. If there are multiple solutions, any of them will be accepted. | N = int(input())
for h in range(1, 3501):
for n in range(1, 3501):
if 2 * h * n - N:
w = (h + n) // (2 * h * n - N)
if 0 < w <= 3500:
print(h, n, w)
exit()
| s779986166 | Accepted | 1,727 | 2,940 | 249 | N = int(input())
for h in range(1, 3501):
for n in range(h, 3501):
if 4 * h * n - N * n - N * h > 0 and N * h * n % (4 * h * n - N * n - N * h) == 0:
print(h, n, N * h * n // (4 * h * n - N * n - N * h))
exit()
|
s249359306 | p02393 | u613534067 | 1,000 | 131,072 | Wrong Answer | 20 | 5,576 | 52 | Write a program which reads three integers, and prints them in ascending order. | a = list(map(int, input().split()))
print(a.sort())
| s795276308 | Accepted | 20 | 5,584 | 74 | a = list(map(int, input().split()))
a.sort()
print(" ".join(map(str, a)))
|
s074782433 | p03351 | u021916304 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,064 | 317 | Three people, A, B and C, are trying to communicate using transceivers. They are standing along a number line, and the coordinates of A, B and C are a, b and c (in meters), respectively. Two people can directly communicate when the distance between them is at most d meters. Determine if A and C can communicate, either ... | def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))
a,b,c,d = iim()
if abs(a-c) < d or (abs(a-b) < d and abs(b-c) < d):
print('Yes')
else:
print('No') | s646625426 | Accepted | 17 | 3,060 | 153 | def iim():return map(int,input().split())
a,b,c,d = iim()
if abs(a-c) <= d or (abs(a-b) <= d and abs(b-c) <= d):
print('Yes')
else:
print('No') |
s647735185 | p03251 | u242031676 | 2,000 | 1,048,576 | Wrong Answer | 18 | 2,940 | 147 | Our world is one-dimensional, and ruled by two empires called Empire A and Empire B. The capital of Empire A is located at coordinate X, and that of Empire B is located at coordinate Y. One day, Empire A becomes inclined to put the cities at coordinates x_1, x_2, ..., x_N under its control, and Empire B becomes incli... | a, x, y = [list(map(int, input().split()))for i in range(3)]
if max(a[2], sorted(x)[-1])<min(a[3],sorted(y)[0]): print("No war")
else: print("War") | s641459310 | Accepted | 18 | 2,940 | 147 | a, x, y = [list(map(int, input().split()))for i in range(3)]
if max(a[2], sorted(x)[-1])<min(a[3],sorted(y)[0]): print("No War")
else: print("War") |
s122621846 | p03637 | u427344224 | 2,000 | 262,144 | Wrong Answer | 57 | 14,252 | 398 | 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 = list(map(int, input().split()))
multi4 = len([a for a in a_list if a % 4 == 0])
odd_num = len([a for a in a_list if a % 2 != 0])
even_num = len(a_list) - odd_num
not4 = even_num - multi4
if odd_num <= multi4:
if not4 >= 1:
if not4 % 2 == 0:
print("Yes")
else:... | s190027648 | Accepted | 57 | 15,020 | 394 | N = int(input())
a_list = list(map(int, input().split()))
multi4 = len([a for a in a_list if a % 4 == 0])
odd_num = len([a for a in a_list if a % 2 != 0])
even_num = len(a_list) - odd_num
not4 = even_num - multi4
if not4 >0 :
if odd_num <= multi4:
print("Yes")
else:
print("No")
else:
if ... |
s049285553 | p03369 | u843318346 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 35 | In "Takahashi-ya", a ramen restaurant, a bowl of ramen costs 700 yen (the currency of Japan), plus 100 yen for each kind of topping (boiled egg, sliced pork, green onions). A customer ordered a bowl of ramen and told which toppings to put on his ramen to a clerk. The clerk took a memo of the order as a string S. S is ... | s = input()
print(700+s.count('o')) | s781346810 | Accepted | 17 | 2,940 | 40 | s = input()
print(700+s.count('o')*100)
|
s969286476 | p03494 | u702786238 | 2,000 | 262,144 | Time Limit Exceeded | 2,108 | 9,328 | 99 | There are N positive integers written on a blackboard: A_1, ..., A_N. Snuke can perform the following operation when all integers on the blackboard are even: * Replace each integer X on the blackboard by X divided by 2. Find the maximum possible number of operations that Snuke can perform. | lis = list(map(int, input().split()))
count = 0
while(1):
if sum(lis) % 2 == 1:
print(count) | s096519124 | Accepted | 150 | 12,468 | 212 | import numpy as np
N = int(input())
lis = np.array(list(map(int, input().split())))
count = 0
while(1):
if np.mod(lis, 2).sum() != 0:
print(count)
break
else:
lis = lis // 2
count = count + 1 |
s213940868 | p03992 | u766407523 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 38 | This contest is `CODE FESTIVAL`. However, Mr. Takahashi always writes it `CODEFESTIVAL`, omitting the single space between `CODE` and `FESTIVAL`. So he has decided to make a program that puts the single space he omitted. You are given a string s with 12 letters. Output the string putting a single space between the fi... | S = input()
print(S[:5] + ' ' + S[5:]) | s937356107 | Accepted | 17 | 2,940 | 38 | S = input()
print(S[:4] + ' ' + S[4:]) |
s723039490 | p02821 | u311379832 | 2,000 | 1,048,576 | Wrong Answer | 1,186 | 18,460 | 691 | Takahashi has come to a party as a special guest. There are N ordinary guests at the party. The i-th ordinary guest has a _power_ of A_i. Takahashi has decided to perform M _handshakes_ to increase the _happiness_ of the party (let the current happiness be 0). A handshake will be performed as follows: * Takahashi c... | import bisect
from itertools import accumulate
def func(x):
cnt = 0
for i in a:
index = bisect.bisect_left(a, x - i)
cnt += N - index
if cnt >= M:
return True
else:
return False
N, M = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
ar = sorted(a,... | s574109062 | Accepted | 1,176 | 14,256 | 673 | import bisect
from itertools import accumulate
def func(x):
cnt = 0
for i in a:
index = bisect.bisect_left(a, x - i)
cnt += N - index
if cnt >= M:
return True
else:
return False
N, M = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
ar = sorted(a,... |
s402773360 | p03471 | u974935538 | 2,000 | 262,144 | Wrong Answer | 2,104 | 3,064 | 360 | The commonly used bills in Japan are 10000-yen, 5000-yen and 1000-yen bills. Below, the word "bill" refers to only these. According to Aohashi, he received an otoshidama (New Year money gift) envelope from his grandfather that contained N bills for a total of Y yen, but he may be lying. Determine whether such a situat... | N,Y = map(int,input().split())
a = 0
b = 0
c = 0
for i in range(N):
for j in range(N-i):
for k in range(N-i-j):
if 10000*i+5000*j+1000*k == Y:
a=i
b=j
c=k
break
if(a>0)|(b>0)|(c>0):
print(a,b,c)
elif (a==... | s746929827 | Accepted | 754 | 3,064 | 321 | N,Y = map(int,input().split())
a = 0
b = 0
c = 0
for i in range(N+1):
for j in range(N-i+1):
if 10000*i+5000*j+1000*(N-i-j) == Y:
a=i
b=j
c=N-i-j
if(a>0)|(b>0)|(c>0):
print(a,b,c)
elif (a==0)&(b ==0)&(c == 0):
print(-1,-1,-1... |
s227882569 | p03089 | u631277801 | 2,000 | 1,048,576 | Wrong Answer | 21 | 3,316 | 1,164 | Snuke has an empty sequence a. He will perform N operations on this sequence. In the i-th operation, he chooses an integer j satisfying 1 \leq j \leq i, and insert j at position j in a (the beginning is position 1). You are given a sequence b of length N. Determine if it is possible that a is equal to b after N oper... | import sys
stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)
def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x) - 1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip... | s704914891 | Accepted | 18 | 3,064 | 975 | import sys
stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)
def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x) - 1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip... |
s455311523 | p04029 | u121732701 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 84 | 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())
count = 0
for i in range(N+1):
count += i
print(i)
| s763948227 | Accepted | 18 | 2,940 | 90 | N = int(input())
count = 0
for i in range(N+1):
count += i
print(count)
|
s776100725 | p03110 | u848654125 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 235 | Takahashi received _otoshidama_ (New Year's money gifts) from N of his relatives. You are given N values x_1, x_2, ..., x_N and N strings u_1, u_2, ..., u_N as input. Each string u_i is either `JPY` or `BTC`, and x_i and u_i represent the content of the otoshidama from the i-th relative. For example, if x_1 = `10000`... | N = int(input())
gift = []
for i in range(N):
gift.append((input().split()))
sum = 0
for i in range(N):
if gift[i][1] == "JPN":
sum += float(gift[i][0])
else:
sum += float(gift[i][0]) * 380000
print(sum)
| s769325679 | Accepted | 17 | 2,940 | 235 | N = int(input())
gift = []
for i in range(N):
gift.append((input().split()))
sum = 0
for i in range(N):
if gift[i][1] == "JPY":
sum += float(gift[i][0])
else:
sum += float(gift[i][0]) * 380000
print(sum)
|
s763776843 | p03624 | u351914601 | 2,000 | 262,144 | Wrong Answer | 20 | 3,188 | 160 | You are given a string S consisting of lowercase English letters. Find the lexicographically (alphabetically) smallest lowercase English letter that does not occur in S. If every lowercase English letter occurs in S, print `None` instead. | s = sorted(set(input()))
print(*s)
ans = "None"
for i in range(len(s)):
if ord(s[i]) != ord("a")+i:
ans = chr(ord(s[i])-1)
break
print(ans)
| s358354850 | Accepted | 19 | 3,188 | 122 | letter = "abcdefghijklmnopqrstuvwxyz"
ans = sorted(set(letter) ^ set(input()))
print(ans[0] if len(ans) != 0 else "None")
|
s651951184 | p02257 | u500396695 | 1,000 | 131,072 | Wrong Answer | 20 | 7,540 | 339 | A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7. Write a program which reads a list of _N_ integers and prints the number of prime numbers in the list. | N = int(input())
A=[]
for i in range(N):
A.append(int(input()))
counter = 0
for i in range(0, N):
j = A[i] - 2
if j == 0 or j == 1:
counter += 1
else:
while j > 1:
if i % j == 0:
break
else:
j -= 1
else:
counter ... | s670848956 | Accepted | 770 | 8,072 | 440 | def isprime(x):
import math
if x == 2:
return True
elif x < 2 or x % 2 == 0:
return False
else:
i = 3
while i <= math.sqrt(x):
if x % i == 0:
return False
i += 2
return True
N = int(input())
A=[]
for i in range(N):
A.a... |
s488377792 | p02392 | u298413451 | 1,000 | 131,072 | Wrong Answer | 20 | 7,612 | 163 | Write a program which reads three integers a, b and c, and prints "Yes" if a < b < c, otherwise "No". | # coding: utf-8
# Your code here!
s = input().rstrip().split(' ')
a = int(s[0])
b = int(s[1])
c = int(s[2])
if a < b < c:
print("yes")
else:
print("no") | s391990409 | Accepted | 20 | 7,692 | 163 | # coding: utf-8
# Your code here!
s = input().rstrip().split(' ')
a = int(s[0])
b = int(s[1])
c = int(s[2])
if a < b < c:
print("Yes")
else:
print("No") |
s300802255 | p04012 | u448659077 | 2,000 | 262,144 | Wrong Answer | 21 | 3,316 | 213 | Let w be a string consisting of lowercase letters. We will call w _beautiful_ if the following condition is satisfied: * Each lowercase letter of the English alphabet occurs even number of times in w. You are given the string w. Determine if w is beautiful. | #ABC044
import collections
w = input()
a = list(collections.Counter(w).values())
b = [a[i] for i in range(len(a)) if int(a[i]) % 2 == 0]
print(a,b)
if len(a) == len(b):
print("Yes")
else:
print("No")
| s726814228 | Accepted | 21 | 3,316 | 203 | #ABC044
import collections
w = input()
a = list(collections.Counter(w).values())
b = [a[i] for i in range(len(a)) if int(a[i]) % 2 == 0]
if len(a) == len(b):
print("Yes")
else:
print("No")
|
s118142694 | p03546 | u506287026 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 9 | Joisino the magical girl has decided to turn every single digit that exists on this world into 1. Rewriting a digit i with j (0≤i,j≤9) costs c_{i,j} MP (Magic Points). She is now standing before a wall. The wall is divided into HW squares in H rows and W columns, and at least one square contains a digit between 0 and... | s079869073 | Accepted | 33 | 3,316 | 373 | h, _ = map(int, input().split())
d = [list(map(int, input().split())) for _ in range(10)]
A = [list(map(int, input().split())) for _ in range(h)]
N = 10
for k in range(N):
for i in range(N):
for j in range(N):
d[i][j] = min(d[i][j], d[i][k]+d[k][j])
ans = 0
for aa in A:
for a in aa:
... | |
s469272006 | p02398 | u731896389 | 1,000 | 131,072 | Wrong Answer | 20 | 7,652 | 122 | Write a program which reads three integers a, b and c, and prints the number of divisors of c between a and b. | a,b,c = map(int,input().split())
count=0
for i in range(a,b+1):
if i%c==0:
count+=1
print(count)
| s776146102 | Accepted | 20 | 7,660 | 105 | a,b,c=map(int,input().split())
cnt=0
for i in range(a,b+1):
if c%i == 0:
cnt += 1
print(cnt) |
s483821783 | p03861 | u586639900 | 2,000 | 262,144 | Wrong Answer | 30 | 9,140 | 142 | You are given nonnegative integers a and b (a ≤ b), and a positive integer x. Among the integers between a and b, inclusive, how many are divisible by x? | a, b, x = map(int, input().split())
p = a // x
q = b // x
res = p - q
print(res)
| s152683334 | Accepted | 29 | 9,160 | 153 | a, b, x = map(int, input().split())
p = a // x
r = a % x
q = b // x
s = b % x
res = q - p
if r == 0:
res += 1
print(res) |
s090870806 | p03657 | u982591663 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 133 | Snuke is giving cookies to his three goats. He has two cookie tins. One contains A cookies, and the other contains B cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he cannot open the tins). Your task is to determine whether Snuke can give cookies to his three goats so that each of them ca... | A, B = map(int, input().split())
if A % 3 == 0 or B % 3 == 0 or (A+B) & 3 == 0:
print("Possible")
else:
print("Impossible")
| s582494500 | Accepted | 17 | 2,940 | 133 | A, B = map(int, input().split())
if A % 3 == 0 or B % 3 == 0 or (A+B) % 3 == 0:
print("Possible")
else:
print("Impossible")
|
s261207964 | p04012 | u656120612 | 2,000 | 262,144 | Wrong Answer | 28 | 9,000 | 189 | Let w be a string consisting of lowercase letters. We will call w _beautiful_ if the following condition is satisfied: * Each lowercase letter of the English alphabet occurs even number of times in w. You are given the string w. Determine if w is beautiful. | flag=True
a=list(input())
a.sort
while len(a)>0 and flag:
n=a.count(a[0])
if n%2==0:
a=a[n:]
else:
flag=False
if flag:
print("Yes")
else:
print("No") | s606693631 | Accepted | 26 | 8,896 | 194 | flag=True
a=list(input())
a=sorted(a)
while len(a)>0 and flag:
n=a.count(a[0])
if n%2==0:
a=a[n:]
else:
flag=False
if flag:
print("Yes")
else:
print("No") |
s002391650 | p03730 | u002459665 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 360 | We ask you to select some number of positive integers, and calculate the sum of them. It is allowed to select as many integers as you like, and as large integers as you wish. You have to follow these, however: each selected integer needs to be a multiple of A, and you need to select at least one integer. Your objecti... | def func():
pass
def main():
a, b, c = map(int, input().split())
l = []
i = 1
while True:
x = a * i
left = x % b
if left == c:
print("Yes")
return
if left in l:
print("No")
return
l.append(left)
i += 1
... | s641168955 | Accepted | 19 | 3,060 | 360 | def func():
pass
def main():
a, b, c = map(int, input().split())
l = []
i = 1
while True:
x = a * i
left = x % b
if left == c:
print("YES")
return
if left in l:
print("NO")
return
l.append(left)
i += 1
... |
s577560627 | p03471 | u136395536 | 2,000 | 262,144 | Wrong Answer | 1,864 | 3,064 | 287 | The commonly used bills in Japan are 10000-yen, 5000-yen and 1000-yen bills. Below, the word "bill" refers to only these. According to Aohashi, he received an otoshidama (New Year money gift) envelope from his grandfather that contained N bills for a total of Y yen, but he may be lying. Determine whether such a situat... | N,Y = (int(i) for i in input().split())
x = -1
y = -1
z = -1
for i in range(N+1):
for j in range(N+1):
money = Y - 10000*i - 5000*j - 1000*(N-i-j)
if (N-i-j)==0 and money == 0:
x = i
y = j
z = N-i-j
break
print(x,y,z) | s679236224 | Accepted | 1,891 | 3,064 | 287 | N,Y = (int(i) for i in input().split())
x = -1
y = -1
z = -1
for i in range(N+1):
for j in range(N+1):
money = Y - 10000*i - 5000*j - 1000*(N-i-j)
if (N-i-j)>=0 and money == 0:
x = i
y = j
z = N-i-j
break
print(x,y,z) |
s271058092 | p02239 | u659034691 | 1,000 | 131,072 | Wrong Answer | 30 | 7,724 | 594 | Write a program which reads an directed graph $G = (V, E)$, and finds the shortest distance from vertex $1$ to each vertex (the number of edges in the shortest path). Vertices are identified by IDs $1, 2, ... n$. | # your code goes here
#Breadth First Search
n=int(input())
V=[]
a=[]
for i in range(n):
V.append([int(i) for i in input().split()])
a.append(0)
V=sorted(V,key=lambda x:x[0])
print('1 0')
d=1
c=0
w=[0]
while c<n and w!=[]:
i=0
y=[]
# print(c)
while c<n and i<len(w):
j=2
while j... | s009791814 | Accepted | 20 | 7,828 | 807 | #Breadth First Search
n=int(input())
V=[]
a=[1]
for i in range(n):
V.append([int(i) for i in input().split()])
a.append(0)
V=sorted(V,key=lambda x:x[0])
print('1 0')
d=1
c=0
w=[0]
p=[]
while c<n and w!=[]:
i=0
y=[]
# print(c)
while c<n and i<len(w):
j=2
while j<2+V[w[i]][1] and c<... |
s098597689 | p03759 | u636290142 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 94 | Three poles stand evenly spaced along a line. Their heights are a, b and c meters, from left to right. We will call the arrangement of the poles _beautiful_ if the tops of the poles lie on the same line, that is, b-a = c-b. Determine whether the arrangement of the poles is beautiful. | a, b, c = map(int, input().split())
if a - b == c - b:
print('YES')
else:
print('NO')
| s788760198 | Accepted | 17 | 2,940 | 94 | a, b, c = map(int, input().split())
if b - a == c - b:
print('YES')
else:
print('NO')
|
s918653470 | p03407 | u894694822 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 79 | An elementary school student Takahashi has come to a variety store. He has two coins, A-yen and B-yen coins (yen is the currency of Japan), and wants to buy a toy that costs C yen. Can he buy it? Note that he lives in Takahashi Kingdom, and may have coins that do not exist in Japan. | a, b, c=map(int, input().split())
if a+b<=c:
print("Yes")
else:
print("No") | s603517285 | Accepted | 17 | 2,940 | 80 | a, b, c=map(int, input().split())
if a+b>=c:
print("Yes")
else:
print("No")
|
s551141753 | p02678 | u212328220 | 2,000 | 1,048,576 | Wrong Answer | 1,254 | 33,844 | 1,139 | There is a cave. The cave has N rooms and M passages. The rooms are numbered 1 to N, and the passages are numbered 1 to M. Passage i connects Room A_i and Room B_i bidirectionally. One can travel between any two rooms by traversing passages. Room 1 is a special room with an entrance from the outside. It is dark in th... | N, M = map(int,input().split())
graph = [[] for n in range(N+1)]
for _ in range(M):
a,b = map(int,input().split())
graph[a].append(b)
graph[b].append(a)
q = [1]
ans = ['No' for n in range(N+1)]
ans[1] = 1 #ans[1]
while q:
now = q.pop(0)
for edge in graph[now]:
if ans[edge] != 'N... | s621137797 | Accepted | 1,452 | 33,836 | 1,385 | N, M = map(int, input().split())
graph = [[] for n in range(N + 1)]
for _ in range(M):
a, b = map(int, input().split())
graph[a].append(b)
graph[b].append(a)
q = [1]
ans = ['No' for n in range(N + 1)]
ans[0] = 1
ans[1] = 1
while q:
now = q.pop(0)
for edge in graph[now]:
if an... |
s129354051 | p03228 | u750278664 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,060 | 383 | In the beginning, Takahashi has A cookies, and Aoki has B cookies. They will perform the following operation alternately, starting from Takahashi: * If the number of cookies in his hand is odd, eat one of those cookies; if the number is even, do nothing. Then, give one-half of the cookies in his hand to the other pe... | # -*- coding: utf-8 -*-
A, B, K = map(int, input().split())
print(A, B, K)
for i in range(K):
if i % 2 == 0:
if A % 2 != 0:
A -= 1
A //= 2
B += A
else:
if B % 2 != 0:
B -= 1
B //= 2
A += B
print("{} {}".format(A, B))
| s445386264 | Accepted | 17 | 2,940 | 368 | # -*- coding: utf-8 -*-
A, B, K = map(int, input().split())
for i in range(K):
if i % 2 == 0:
if A % 2 != 0:
A -= 1
A //= 2
B += A
else:
if B % 2 != 0:
B -= 1
B //= 2
A += B
print("{} {}".format(A, B))
|
s592237267 | p02393 | u648117624 | 1,000 | 131,072 | Wrong Answer | 20 | 5,596 | 140 | Write a program which reads three integers, and prints them in ascending order. | #coding: UTF-8
#a,b,c=[int(x) for x in input().split()]
a,b,c=[int(x) for x in input().split()]
numlist = [a,b,c]
print(numlist.sort())
| s886249449 | Accepted | 20 | 5,576 | 86 |
print(*sorted(map(int, input().split())))
|
s933358991 | p02259 | u285980122 | 1,000 | 131,072 | Wrong Answer | 20 | 5,596 | 545 | Write a program of the Bubble Sort algorithm which sorts a sequence _A_ in ascending order. The algorithm should be based on the following pseudocode: BubbleSort(A) 1 for i = 0 to A.length-1 2 for j = A.length-1 downto i+1 3 if A[j] < A[j-1] 4 swap A[j] and A[j-1] Note that, in... | def bubbleSort(A, N):
print(A)
A = list(map(int, A.split()))
flag = 1
count = 0
while flag:
flag = 0
for j in range(N-1, 0, -1):
if A[j] < A[j-1]:
tmp = A[j]
A[j] = A[j-1]
A[j-1] = tmp
fl... | s613040270 | Accepted | 20 | 5,600 | 564 | def bubbleSort(A, N):
A = list(map(int, A.split()))
flag = 1
count = 0
while flag:
flag = 0
for j in range(N-1, 0, -1):
if A[j] < A[j-1]:
tmp = A[j]
A[j] = A[j-1]
A[j-1] = tmp
flag = 1
... |
s215868105 | p03712 | u887207211 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 216 | You are given a image with a height of H pixels and a width of W pixels. Each pixel is represented by a lowercase English letter. The pixel at the i-th row from the top and j-th column from the left is a_{ij}. Put a box around this image and output the result. The box should consist of `#` and have a thickness of 1. | H, W = map(int,input().split())
A = [input() for _ in range(H)]
result = []
for a in A:
result.append('*' + a +'*')
waku = '*' * (W+2)
result.insert(0,waku)
result.insert(len(A)+1,waku)
for r in result:
print(r) | s192552617 | Accepted | 17 | 3,060 | 163 | H, W = map(int,input().split())
result = ["#"*(W+2)]
for _ in range(H):
c = input()
result.append("#"+c+"#")
result.append("#"*(W+2))
print("\n".join(result)) |
s613720979 | p02610 | u994935583 | 2,000 | 1,048,576 | Wrong Answer | 28 | 9,168 | 962 | We have N camels numbered 1,2,\ldots,N. Snuke has decided to make them line up in a row. The happiness of Camel i will be L_i if it is among the K_i frontmost camels, and R_i otherwise. Snuke wants to maximize the total happiness of the camels. Find the maximum possible total happiness of the camel. Solve this probl... |
from heapq import heappop, heappush
import sys
input = sys.stdin.readline
def resolve():
T = int(input())
for _ in range(T):
N = int(input())
ans = 0
camels0 = [[] for _ in range (n)]
camels1 = [[] for _ in range (n)]
for _ in range(N):
K,L,R = map(int, inp... | s244885776 | Accepted | 450 | 47,444 | 972 |
from heapq import heappop, heappush
import sys
input = sys.stdin.readline
def resolve():
T = int(input())
for _ in range(T):
N = int(input())
ans = 0
camels0 = [[] for _ in range (N)]
camels1 = [[] for _ in range (N)]
for _ in range(N):
K,L,R = map(int, inp... |
s829035075 | p02613 | u734197299 | 2,000 | 1,048,576 | Wrong Answer | 29 | 9,128 | 173 | Takahashi is participating in a programming contest called AXC002, and he has just submitted his code to Problem A. The problem has N test cases. For each test case i (1\leq i \leq N), you are given a string S_i representing the verdict for that test case. Find the numbers of test cases for which the verdict is `AC`,... | N=input()
c0=N.count("AC")
c1=N.count("WA")
c2=N.count("TLE")
c3=N.count("RE")
print("AC x "+str(c0))
print("WA x "+str(c1))
print("TLE x "+str(c2))
print("RE x "+str(c3)) | s886788922 | Accepted | 150 | 16,288 | 239 | N=int(input())
inp=[]
for i in range(N):
inp.append((input()))
c0=inp.count("AC")
c1=inp.count("WA")
c2=inp.count("TLE")
c3=inp.count("RE")
print("AC x "+str(c0))
print("WA x "+str(c1))
print("TLE x "+str(c2))
print("RE x "+str(c3)) |
s115559096 | p03546 | u177411511 | 2,000 | 262,144 | Wrong Answer | 203 | 38,376 | 932 | Joisino the magical girl has decided to turn every single digit that exists on this world into 1. Rewriting a digit i with j (0≤i,j≤9) costs c_{i,j} MP (Magic Points). She is now standing before a wall. The wall is divided into HW squares in H rows and W columns, and at least one square contains a digit between 0 and... | import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time, copy,bisect
from operator import itemgetter
from heapq import heappush, heappop
import numpy as np
from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson
from scipy.sparse import csr_matrix... | s071791266 | Accepted | 198 | 38,220 | 914 | import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time, copy,bisect
from operator import itemgetter
from heapq import heappush, heappop
import numpy as np
from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson
from scipy.sparse import csr_matrix... |
s943875938 | p04011 | u743354620 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 144 | 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())
if n - k <0:
print(int(n * x))
else:
print(int((k * y) + (n - k) * y)) | s100784282 | Accepted | 17 | 3,060 | 144 | n = int(input())
k = int(input())
x = int(input())
y = int(input())
if n - k <0:
print(int(n * x))
else:
print(int((k * x) + (n - k) * y)) |
s726496350 | p03711 | u992759582 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 149 | 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. | x,y = map(int,input().split())
if x ==2 and y == 2:
print('Yes')
elif x % 2 == y % 2 and x >=4 and y >= 4:
print('Yes')
else:
print('No') | s841225117 | Accepted | 17 | 3,060 | 274 | x,y = map(int,input().split())
a_group = [1,3,5,7,8,10,12]
b_group = [4,6,9,11]
c_group = [2]
if x in a_group and y in a_group:
print('Yes')
elif x in b_group and y in b_group:
print('Yes')
elif x in c_group and y in c_group:
print('Yes')
else:
print('No')
|
s870010030 | p02612 | u995062424 | 2,000 | 1,048,576 | Wrong Answer | 25 | 9,168 | 41 | 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())
print(N-(N//1000)*1000) | s162828817 | Accepted | 28 | 9,156 | 138 | N = int(input())
if(N >= 1000):
if(N%1000 != 0):
print((N//1000+1)*1000-N)
else:
print(0)
else:
print(1000-N) |
s149205130 | p04043 | u588081069 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 150 | 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 ... | input_str = ''.join(list(map(str, input())))
if input_str == '755' or input_str == '575' or input_str == '557':
print('YES')
else:
print('NO') | s532953530 | Accepted | 17 | 2,940 | 372 | input_str = list(map(int, input().split()))
if input_str == [7, 5, 5] or input_str == [5, 7, 5] or input_str == [5, 5, 7]:
print('YES')
else:
print('NO')
|
s136365922 | p02612 | u689723321 | 2,000 | 1,048,576 | Wrong Answer | 29 | 9,000 | 88 | 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. | m=int(input())
for i in range(0, 10):
if i*1000 <= m < (i+1)*1000:
print(m-i*1000) | s509148318 | Accepted | 31 | 9,008 | 99 | m=int(input())
for i in range(0, 11):
if i*1000 < m <= (i+1)*1000:
m=(i+1)*1000 - m
print(m)
|
s787641723 | p02612 | u481429249 | 2,000 | 1,048,576 | Wrong Answer | 26 | 9,152 | 72 | 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. | payment = int(input())
bucks = 1000
change = payment%bucks
print(change) | s871847570 | Accepted | 29 | 8,848 | 160 | payment = int(input())
bucks = 1000
if payment%bucks == 0:
change = 0
else:
receive = payment//bucks + 1
change = receive*bucks - payment
print(change) |
s725815365 | p03049 | u618107373 | 2,000 | 1,048,576 | Wrong Answer | 44 | 3,700 | 477 | Snuke has N strings. The i-th string is s_i. Let us concatenate these strings into one string after arranging them in some order. Find the maximum possible number of occurrences of `AB` in the resulting string. | n = int(input())
l = []
cnt = 0
te = [0,0,0]
for i in range(n):
l.append(input())
for i in l:
if i[0] == "B" and i[-1] == "A":
te[0] += 1
elif i[0] == "B":
te[1] += 1
elif i[-1] == "A":
te[2] += 1
for j in range(len(i)-1):
if i[j] == "A" and i[j+1] == "B":
... | s671722160 | Accepted | 43 | 3,700 | 501 | n = int(input())
l = []
cnt = 0
te = [0,0,0]
for i in range(n):
l.append(input())
for i in l:
if i[0] == "B" and i[-1] == "A":
te[0] += 1
elif i[0] == "B":
te[1] += 1
elif i[-1] == "A":
te[2] += 1
for j in range(len(i)-1):
if i[j] == "A" and i[j+1] == "B":
... |
s809182040 | p03698 | u571999153 | 2,000 | 262,144 | Wrong Answer | 27 | 9,028 | 133 | You are given a string S consisting of lowercase English letters. Determine whether all the characters in S are different. | s = input()
letters = []
ans = 'no'
for i in s:
if i in letters:
ans = 'yes'
break
else:
letters.append(i)
print(ans) | s708751513 | Accepted | 29 | 8,848 | 134 | s = input()
letters = []
ans = 'yes'
for i in s:
if i in letters:
ans = 'no'
break
else:
letters.append(i)
print(ans)
|
s697725266 | p02612 | u465423770 | 2,000 | 1,048,576 | Wrong Answer | 30 | 9,104 | 44 | We will buy a product for N yen (the currency of Japan) at a shop. If we use only 1000-yen bills to pay the price, how much change will we receive? Assume we use the minimum number of bills required. | payment = int(input())
print(payment%1000)
| s458613580 | Accepted | 33 | 9,104 | 109 | payment = int(input())
num = int(payment//1000)
if payment%1000 != 0:
num += 1
print((num*1000)-payment)
|
s771679673 | p03371 | u425762225 | 2,000 | 262,144 | Wrong Answer | 2,104 | 2,940 | 143 | "Pizza At", a fast food chain, offers three kinds of pizza: "A-pizza", "B-pizza" and "AB-pizza". A-pizza and B-pizza are completely different pizzas, and AB-pizza is one half of A-pizza and one half of B-pizza combined together. The prices of one A-pizza, B-pizza and AB-pizza are A yen, B yen and C yen (yen is the curr... | A, B, C, X, Y = map(int,input().split())
m = 10^9
for i in range(X):
for j in range(Y):
m = min(m,A*i+B*j+C*((X+Y)-(i+j)))
print(m) | s672032463 | Accepted | 675 | 49,716 | 200 | def solve(a,b,c,x,y):
l = []
for i in range(10**6):
s = a*max(x-i,0)+b*max(y-i,0)+c*i*2
l.append(s)
return min(l)
A,B,C,X,Y = map(int,input().split())
print(solve(A,B,C,X,Y))
|
s379075890 | p04011 | u278143034 | 2,000 | 262,144 | Wrong Answer | 26 | 9,024 | 272 | 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())
account = 0
cnt = 1
for cnt in range(1,K + 1,1):
account = account + X
for cnt in range(K + 1,N,1):
account = account + Y
print(account) | s158797486 | Accepted | 27 | 9,176 | 220 |
N = int(input())
K = int(input())
X = int(input())
Y = int(input())
if N <= K:
account = N * X
else:
account = (K * X) + (max(N - K,0) * Y)
print(account) |
s665258791 | p03962 | u857673087 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 37 | 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 migh... | x = list(input())
print(len(set(x))) | s157278783 | Accepted | 17 | 3,064 | 50 | abc = list(input().split())
print(len(set(abc)))
|
s858352911 | p03997 | u385244248 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 56 | You are given a trapezoid. The lengths of its upper base, lower base, and height are a, b, and h, respectively. An example of a trapezoid Find the area of this trapezoid. | a,b,h = map(int,open(0).read().split())
print((a+b)+h/2) | s520731405 | Accepted | 17 | 2,940 | 61 | a,b,h = map(int,open(0).read().split())
print(int((a+b)*h/2)) |
s527785520 | p03545 | u695079172 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 464 | Sitting in a station waiting room, Joisino is gazing at her train ticket. The ticket is numbered with four digits A, B, C and D in this order, each between 0 and 9 (inclusive). In the formula A op1 B op2 C op3 D = 7, replace each of the symbols op1, op2 and op3 with `+` or `-` so that the formula holds. The given in... | plus = lambda a,b:a+b
minus = lambda a,b:a-b
bit = 0
nums = [int(c) for c in input()]
for bit in range(8):
op_lst = [(plus if bit >> i & 1 else minus) for i in [2,1,0]]
temp = nums[0]
for i in range(len(op_lst)):
temp = op_lst[i](temp,nums[i+1])
if temp == 7:
break
op_strings = {plus:"+",minus:"-"}
... | s245567680 | Accepted | 17 | 3,064 | 469 | plus = lambda a,b:a+b
minus = lambda a,b:a-b
bit = 0
nums = [int(c) for c in input()]
for bit in range(8):
op_lst = [(plus if bit >> i & 1 else minus) for i in [2,1,0]]
temp = nums[0]
for i in range(len(op_lst)):
temp = op_lst[i](temp,nums[i+1])
if temp == 7:
break
op_strings = {plus:"+",minus:"-"}
... |
s493050488 | p02255 | u742013327 | 1,000 | 131,072 | Wrong Answer | 20 | 7,644 | 879 | 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 ... | #http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_1_A&lang=jp
def insertion_sort(target_list, n_list):
for focus_index in range(1, n_list):
print(*target_list)
target = target_list[focus_index]
if target < target_list[focus_index - 1]:
compare_index = focus_i... | s759976826 | Accepted | 20 | 8,044 | 883 | #http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_1_A&lang=jp
def insertion_sort(target_list, n_list):
for focus_index in range(1, n_list):
print(*target_list)
target = target_list[focus_index]
if target < target_list[focus_index - 1]:
compare_index = focus_i... |
s718199737 | p03962 | u052066895 | 2,000 | 262,144 | Wrong Answer | 20 | 3,188 | 183 | 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 migh... | A, B, C = map(int, input().split())
if A==B and B==C :
print(1)
elif A==B and B!=C :
print(2)
elif B==C and B!=A :
print(2)
elif A==C and A!=B :
print(2)
else :
print(1) | s461639993 | Accepted | 17 | 2,940 | 176 | A = input().split(" ")
a = A[0]
b = A[1]
c = A[2]
if a == b and b == c: print(1)
elif a == b or a == c and b != c : print(2)
elif b == c and a != b : print(2)
else : print(3) |
s163967833 | p03854 | u920299620 | 2,000 | 262,144 | Wrong Answer | 18 | 3,316 | 937 | You are given a string S consisting of lowercase English letters. Another string T is initially empty. Determine whether it is possible to obtain S = T by performing the following operation an arbitrary number of times: * Append one of the following at the end of T: `dream`, `dreamer`, `erase` and `eraser`. | s=input()
ind =0
len_s=len(s)
s = s+ "zzzzzzzzzz"
A = "dreamer"
B= "dream"
C= "erase"
D="eraser"
flag =True
while(1):
if(s[ind] =="d"):
if(s[ind + 7] !="a"):
if(s[ind:ind+7]!=A):
flag = False
break
else:
ind+=7
else:
... | s964610938 | Accepted | 31 | 3,316 | 1,268 | s=input()
ind =0
len_s=len(s)
s = s+ "AAAAAAAAA"
A = "dreamer"
B= "dream"
C= "erase"
D="eraser"
flag =True
while(1):
if(s[ind] =="d"):
if(s[ind + 5] =="d"):
if(s[ind:ind+5]!=B):
flag = False
break
else:
ind+=5
else:
... |
s138250984 | p03759 | u434311880 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 88 | Three poles stand evenly spaced along a line. Their heights are a, b and c meters, from left to right. We will call the arrangement of the poles _beautiful_ if the tops of the poles lie on the same line, that is, b-a = c-b. Determine whether the arrangement of the poles is beautiful. | a, b, c =map(int,input().split())
if b-a == c-b:
print("Yes")
else:
print("No")
| s223286462 | Accepted | 18 | 2,940 | 88 | a, b, c =map(int,input().split())
if b-a == c-b:
print("YES")
else:
print("NO")
|
s104266928 | p02260 | u022407960 | 1,000 | 131,072 | Wrong Answer | 30 | 7,632 | 724 | Write a program of the Selection Sort algorithm which sorts a sequence A in ascending order. The algorithm should be based on the following pseudocode: SelectionSort(A) 1 for i = 0 to A.length-1 2 mini = i 3 for j = i to A.length-1 4 if A[j] < A[mini] 5 mini = j 6 swap A[... | #!/usr/bin/env python
# encoding: utf-8
class Solution:
@staticmethod
def selection_sort():
# write your code here
array_length = int(input())
unsorted_array = [int(x) for x in input().split()]
count = 0
for i in range(array_length):
min_j = i
f... | s250335006 | Accepted | 40 | 7,704 | 755 | #!/usr/bin/env python
# encoding: utf-8
class Solution:
@staticmethod
def selection_sort():
# write your code here
array_length = int(input())
unsorted_array = [int(x) for x in input().split()]
count = 0
for i in range(array_length):
min_j = i
f... |
s100471820 | p03971 | u534308356 | 2,000 | 262,144 | Wrong Answer | 111 | 4,712 | 346 | There are N participants in the CODE FESTIVAL 2016 Qualification contests. The participants are either students in Japan, students from overseas, or neither of these. Only Japanese students or overseas students can pass the Qualification contests. The students pass when they satisfy the conditions listed below, from t... | n, a, b = map(int, input().split())
data = list(input())
for i in range(len(data)):
if data[i] == "a":
if i <= a + b:
print("Yes")
else:
print("No")
elif data[i] == "b":
if i <= a + b and i <= b:
print("Yes")
else:
print("No")
... | s469966248 | Accepted | 104 | 4,016 | 344 |
n, a, b=map(int,input().split())
for s in input():
if s=='a':
if a+b>0:
print('Yes')
a-=1
else:
print('No')
elif s=='b'and a+b>0 and b>0:
print('Yes')
b-=1
else:
print('No')
|
s281648586 | p03997 | u175217658 | 2,000 | 262,144 | Wrong Answer | 26 | 9,120 | 70 | You are given a trapezoid. The lengths of its upper base, lower base, and height are a, b, and h, respectively. An example of a trapezoid Find the area of this trapezoid. | a = int(input())
b = int(input())
h = int(input())
print(((a+b)*h)/2) | s785960825 | Accepted | 27 | 9,088 | 76 | a = int(input())
b = int(input())
h = int(input())
print(int(((a+b)*h)/2))
|
s654029187 | p03337 | u374146618 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 66 | You are given two integers A and B. Find the largest value among A+B, A-B and A \times B. | a,b = [int(x) for x in input().split()]
ans = max([a+b, a-b, a*b]) | s270178864 | Accepted | 18 | 2,940 | 77 | a,b = [int(x) for x in input().split()]
ans = max([a+b, a-b, a*b])
print(ans) |
s870259414 | p02619 | u516554284 | 2,000 | 1,048,576 | Wrong Answer | 36 | 9,500 | 313 | 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 che... | d=int(input())
a=[]
for x in range(d+1):
b=list(map(int,input().split()))
a.append(b)
print(a[1][1])
sum1=sum(a[0][1:d])
ans=[0]*d
for n in range(d):
ans[n]=(a[n+1][0])
ans[n]=int(int(ans[n])-(sum1))
try:
ans[n]=ans[n]+ans[n-1]
except:
True
for y in range(d):
print(ans[y])
| s981817429 | Accepted | 39 | 9,668 | 592 | d=int(input())
a=[]
for x in range(d+1):
b=list(map(int,input().split()))
a.append(b)
nittei=[]
for x in range(d):
nittei.append(int(input()))
sum1=sum(a[0][0:26])
ans=[0]*d
humann=a[0]*d
humann=humann+[0]*26
for n in range(d):
date=nittei[n]
ans[n]=(a[n+1][date-1])
try:
for z in range(26):
... |
s892580108 | p02612 | u317485668 | 2,000 | 1,048,576 | Wrong Answer | 27 | 9,136 | 111 | 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. | #!/usr/bin/python
# -*- Coding: utf-8 -*-
n = int(input())
if n > 1000:
print(n%1000)
else:
print(n)
| s682710599 | Accepted | 32 | 9,192 | 176 | #!/usr/bin/python
# -*- Coding: utf-8 -*-
n = int(input())
if n % 1000 == 0:
print(0)
elif n > 1000:
a = (n//1000 + 1)*1000
print(a - n)
else:
print(1000 - n) |
s602483564 | p03476 | u786020649 | 2,000 | 262,144 | Wrong Answer | 275 | 24,904 | 466 | We say that a odd number N is _similar to 2017_ when both N and (N+1)/2 are prime. You are given Q queries. In the i-th query, given two odd numbers l_i and r_i, find the number of odd numbers x similar to 2017 such that l_i ≤ x ≤ r_i. | q=int(input())
lr=[tuple(map(int,input().split())) for _ in range(q)]
def main():
n=10**5
ansl=[]
sieve=[1-i%2 for i in range(n+1)]
sieve[0]=0
for i in range(3,n,2):
if sieve[i]:
sieve[2*i::i]=[0 for _ in range(2*i,n+1,i)]
ans=[0]*(n+1)
for i in range(3,n):
if sieve[i]==1 and sieve[(i+1)//2... | s701456183 | Accepted | 133 | 32,504 | 462 | import sys
read=sys.stdin.read
def main():
q,*lr=map(int,read().split())
n=10**5
ansl=[]
sieve=[1]*(n+1)
sieve[0],sieve[1]=0,0
for i in range(2,n):
if sieve[i]:
sieve[2*i::i]=[0 for _ in range(2*i,n+1,i)]
ans=[0]*(n+1)
for i in range(3,n):
if sieve[i]==1 and sieve[(i+1)//2]==1:
ans... |
s718123662 | p03997 | u276144769 | 2,000 | 262,144 | Wrong Answer | 22 | 3,064 | 61 | You are given a trapezoid. The lengths of its upper base, lower base, and height are a, b, and h, respectively. An example of a trapezoid Find the area of this trapezoid. | a=int(input())
b=int(input())
h=int(input())
print((a+b)*h/2) | s983347293 | Accepted | 22 | 3,064 | 62 | a=int(input())
b=int(input())
h=int(input())
print((a+b)*h//2) |
s022848331 | p03556 | u382431597 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 170 | Find the largest square number not exceeding N. Here, a _square number_ is an integer that can be represented as the square of an integer. | import math
n = int(input())
print(math.floor(math.sqrt(n)))
| s783206303 | Accepted | 17 | 2,940 | 63 | import math
print(pow(math.floor(math.sqrt(int(input()))), 2))
|
s672401279 | p03130 | u562767072 | 2,000 | 1,048,576 | Wrong Answer | 30 | 3,572 | 532 | There are four towns, numbered 1,2,3 and 4. Also, there are three roads. The i-th road connects different towns a_i and b_i bidirectionally. No two roads connect the same pair of towns. Other than these roads, there is no way to travel between these towns, but any town can be reached from any other town using these roa... | L = [set(map(int,input().split())) for i in range(3)]
L += [set([1,0]),set([2,0]),set([3,0]),set([4,0])]
import copy
def dfs(left_towns, current_town):
if len(left_towns) == 0:
return 1
ret = 0
for t in left_towns:
if set([t,current_town]) in L:
new_left_towns = copy.deepcop... | s979354745 | Accepted | 31 | 3,700 | 532 | L = [set(map(int,input().split())) for i in range(3)]
L += [set([1,0]),set([2,0]),set([3,0]),set([4,0])]
import copy
def dfs(left_towns, current_town):
if len(left_towns) == 0:
return 1
ret = 0
for t in left_towns:
if set([t,current_town]) in L:
new_left_towns = copy.deepcop... |
s425861116 | p03471 | u595064211 | 2,000 | 262,144 | Wrong Answer | 1,412 | 3,064 | 321 | The commonly used bills in Japan are 10000-yen, 5000-yen and 1000-yen bills. Below, the word "bill" refers to only these. According to Aohashi, he received an otoshidama (New Year money gift) envelope from his grandfather that contained N bills for a total of Y yen, but he may be lying. Determine whether such a situat... | N , Y = map(int, input().split())
ans = []
for i in range(N):
for j in range(N):
k = N - i - j
if k >= 0:
num = i*10000 + j*5000 + (N-i-j)*1000
if num == Y:
ans.append([i, j, (N-i-j)])
if len(ans) == 0:
ans = [-1, -1, -1]
print(" ".join(map(str,ans))... | s992480785 | Accepted | 1,267 | 3,060 | 307 | N , Y = map(int, input().split())
ans = []
for i in range(N+1):
for j in range(N+1):
k = N - i - j
if k >= 0:
num = i*10000 + j*5000 + k*1000
if num == Y:
ans = [i, j, k]
if len(ans) == 0:
ans = [-1, -1, -1]
print(" ".join(map(str,ans))) |
s815210105 | p03474 | u732870425 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 222 | 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()
if s[a+1] == "-":
s2 = s[:a+1] + s[a+2:]
for i in range(a+b):
if s[i] not in range(10):
print("No")
break
else:
print("Yes") | s748830498 | Accepted | 17 | 2,940 | 144 | a, b = map(int, input().split())
s = input()
if s[:a].isdecimal() and s[a]=="-" and s[a+1:].isdecimal():
print("Yes")
else:
print("No") |
s483170601 | p03479 | u329865314 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 95 | As a token of his gratitude, Takahashi has decided to give his mother an integer sequence. The sequence A needs to satisfy the conditions below: * A consists of integers between X and Y (inclusive). * For each 1\leq i \leq |A|-1, A_{i+1} is a multiple of A_i and strictly greater than A_i. Find the maximum possibl... | from math import log
n = list(map(int,input().split()))
x, y = n[0],n[1]
print(int(log(y/x,2))) | s942119975 | Accepted | 17 | 3,064 | 140 | from math import log
n = list(map(int,input().split()))
x, y = n[0],n[1]
for i in range(0,100):
if x * 2 ** i > y:
print(i)
quit() |
s568816705 | p02613 | u551425474 | 2,000 | 1,048,576 | Wrong Answer | 165 | 9,108 | 203 | Takahashi is participating in a programming contest called AXC002, and he has just submitted his code to Problem A. The problem has N test cases. For each test case i (1\leq i \leq N), you are given a string S_i representing the verdict for that test case. Find the numbers of test cases for which the verdict is `AC`,... | n = int(input())
word_dict = {}
for _ in range(n):
word = str(input())
if word in word_dict:
word_dict[word] += 1
else:
word_dict[word] = 1
for k, v in word_dict.items():
print(k, 'x', v) | s180486543 | Accepted | 164 | 9,100 | 238 | n = int(input())
word_dict = {'AC': 0, 'WA': 0, 'TLE': 0, 'RE': 0}
for _ in range(n):
word = str(input())
if word in word_dict:
word_dict[word] += 1
else:
word_dict[word] = 1
for k, v in word_dict.items():
print(k, 'x', v) |
s698646018 | p02694 | u394352233 | 2,000 | 1,048,576 | Wrong Answer | 22 | 9,164 | 123 | Takahashi has a deposit of 100 yen (the currency of Japan) in AtCoder Bank. The bank pays an annual interest rate of 1 % compounded annually. (A fraction of less than one yen is discarded.) Assuming that nothing other than the interest affects Takahashi's balance, in how many years does the balance reach X yen or abo... | import math
X = int(input())
count = 0
res = 100
while res <= X:
count +=1
res = math.floor(1.01*res)
print(count) | s727200000 | Accepted | 23 | 9,164 | 122 | import math
X = int(input())
count = 0
res = 100
while res < X:
count +=1
res = math.floor(1.01*res)
print(count) |
s581804257 | p04012 | u496966444 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 120 | Let w be a string consisting of lowercase letters. We will call w _beautiful_ if the following condition is satisfied: * Each lowercase letter of the English alphabet occurs even number of times in w. You are given the string w. Determine if w is beautiful. | s = input()
for i in s:
count = s.count(i)
if count % 2 != 0:
print('NO')
exit()
print('YES')
| s051281140 | Accepted | 17 | 3,064 | 120 | s = input()
for i in s:
count = s.count(i)
if count % 2 != 0:
print('No')
exit()
print('Yes')
|
s545477031 | p00470 | u150984829 | 1,000 | 131,072 | Wrong Answer | 90 | 7,872 | 277 | JOIさんが住むカナダのある都市は,南北方向にまっすぐに伸びる w 本の道路と,東西方向にまっすぐに伸びる h 本の道路により,碁盤の目の形に区分けされている. 南北方向の w 本の道路には,西から順に 1, 2, ... , w の番号が付けられている.また,東西方向の h 本の道路には,南から順に 1, 2, ... , h の番号が付けられている.西から i 番目の南北方向の道路と,南から j 番目の東西方向の道路が交わる交差点を (i, j) で表す. JOIさんは,交差点 (1, 1) の近くに住んでおり,交差点 (w, h) の近くの会社に車で通っている.車は道路に沿ってのみ移動することができる.JOIさんは,通勤時... | for e in iter(input,'0 0'):
w,h=map(int,e.split())
M=[[[1,0]*2 for _ in[0]*h]for _ in[0]*w]
for i in range(1,w):
for j in range(1,h):
a,b=M[i-1][j][:2]
c,d=M[i][j-1][2:]
M[i][j]=[d,a+b,b,c+d]
for x in M:print(x)
print(sum(M[w-2][h-1][:2])+sum(M[w-1][h-2][2:]))
| s318561917 | Accepted | 50 | 7,836 | 286 | def s():
for e in iter(input,'0 0'):
w,h=map(int,e.split())
M=[[[1,0]*2 for _ in[0]*h]for _ in[0]*w]
for i in range(1,w):
for j in range(1,h):
a,b=M[i-1][j][:2]
c,d=M[i][j-1][2:]
M[i][j]=[d,a+b,b,c+d]
print((sum(M[w-2][h-1][:2])+sum(M[w-1][h-2][2:]))%10**5)
s()
|
s722601189 | p02924 | u094932051 | 2,000 | 1,048,576 | Time Limit Exceeded | 2,125 | 347,684 | 237 | For an integer N, we will choose a permutation \\{P_1, P_2, ..., P_N\\} of \\{1, 2, ..., N\\}. Then, for each i=1,2,...,N, let M_i be the remainder when i is divided by P_i. Find the maximum possible value of M_1 + M_2 + \cdots + M_N. | F = [0, 0, 1]
while True:
try:
N = int(input())
if N > len(F) - 1:
for i in range(len(F), N+1):
F.append(F[i-1] + i - 1)
print(F[N])
except:
break | s660513487 | Accepted | 17 | 2,940 | 193 | R = [0, 0, 1]
while True:
try:
N = int(input())
if N <= 2:
print(R[N])
else:
print((N-1)*(N-2)//2 + N - 1)
except:
break |
s066224244 | p03129 | u075155299 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 83 | Determine if we can choose K different integers between 1 and N (inclusive) so that no two of them differ by 1. | n,k=map(int,input().split())
if int((n+1)/2)>k:
print("YES")
else:
print("NO") | s572178111 | Accepted | 17 | 2,940 | 85 | n,k=map(int,input().split())
if int((n+1)/2)>=k:
print("YES")
else:
print("NO")
|
s742429884 | p02401 | u956645355 | 1,000 | 131,072 | Wrong Answer | 40 | 7,432 | 120 | Write a program which reads two integers a, b and an operator op, and then prints the value of a op b. The operator op is '+', '-', '*' or '/' (sum, difference, product or quotient). The division should truncate any fractional part. | while True:
a = input()
try:
i = a.index('?')
except:
print(eval(a))
else:
break | s313689540 | Accepted | 50 | 7,416 | 125 | while True:
a = input()
try:
i = a.index('?')
except:
print(int(eval(a)))
else:
break |
s585440083 | p03435 | u686036872 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 219 | We have a 3 \times 3 grid. A number c_{i, j} is written in the square (i, j), where (i, j) denotes the square at the i-th row from the top and the j-th column from the left. According to Takahashi, there are six integers a_1, a_2, a_3, b_1, b_2, b_3 whose values are fixed, and the number written in the square (i, j) ... | a, b, c = map(int, input().split())
d, e, f = map(int, input().split())
g, h, i = map(int, input().split())
if a-d==b-e==c-f and a-g==b-h==c-i and a-b--d-e==g-h and a-c==d-f==g-i:
print("Yes")
else:
print("No") | s895442442 | Accepted | 17 | 3,060 | 219 | a, b, c = map(int, input().split())
d, e, f = map(int, input().split())
g, h, i = map(int, input().split())
if a-d==b-e==c-f and a-g==b-h==c-i and a-b==d-e==g-h and a-c==d-f==g-i:
print("Yes")
else:
print("No") |
s871928343 | p03251 | u974935538 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,060 | 210 | Our world is one-dimensional, and ruled by two empires called Empire A and Empire B. The capital of Empire A is located at coordinate X, and that of Empire B is located at coordinate Y. One day, Empire A becomes inclined to put the cities at coordinates x_1, x_2, ..., x_N under its control, and Empire B becomes incli... | N,M,X,Y = map(int,input().split())
li_x = map(int,input().split())
li_y = map(int,input().split())
x1 = set(li_x)
y1 = set(li_y)
if max(x1)>=min(y1):
print("War")
elif max(x1)<min(y1):
print("No war") | s929936971 | Accepted | 17 | 3,060 | 198 | N,M,X,Y = map(int,input().split())
lx = list(map(int,input().split()))
lx.append(X)
ly = list(map(int,input().split()))
ly.append(Y)
if max(lx) < min(ly):
print('No War')
else:
print('War')
|
s654405999 | p03380 | u941438707 | 2,000 | 262,144 | Wrong Answer | 109 | 14,028 | 145 | Let {\rm comb}(n,r) be the number of ways to choose r objects from among n objects, disregarding order. From n non-negative integers a_1, a_2, ..., a_n, select two numbers a_i > a_j so that {\rm comb}(a_i,a_j) is maximized. If there are multiple pairs that maximize the value, any of them is accepted. | n,*a=map(int,open(0).read().split())
a.sort()
b=a[-1]
c=a[0]
d=b/2-c
for i in a:
if d>abs(b/2-i):
c=i
d=abs(b/2-i)
print(c,b) | s440162667 | Accepted | 68 | 14,028 | 87 | n,*a=map(int,open(0).read().split())
n=max(a)
print(n,min((abs(n/2-i),i)for i in a)[1]) |
s252131987 | p03712 | u166306121 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 180 | You are given a image with a height of H pixels and a width of W pixels. Each pixel is represented by a lowercase English letter. The pixel at the i-th row from the top and j-th column from the left is a_{ij}. Put a box around this image and output the result. The box should consist of `#` and have a thickness of 1. | H, W = map(int, input().split())
a = [""] * H
for i in range(H):
a[i] = input()
print("#" * (W * 2))
for i in range(H):
print('#', a[i], "#", sep="")
print("#" * (W * 2))
| s192172513 | Accepted | 18 | 3,060 | 180 | H, W = map(int, input().split())
a = [""] * H
for i in range(H):
a[i] = input()
print("#" * (W + 2))
for i in range(H):
print('#', a[i], "#", sep="")
print("#" * (W + 2))
|
s115293967 | p00003 | u623894175 | 1,000 | 131,072 | Wrong Answer | 40 | 7,520 | 189 | Write a program which judges wheather given length of three side form a right triangle. Print "YES" if the given sides (integers) form a right triangle, "NO" if not so. | deta_set_count = int(input())
for _ in range(deta_set_count):
k = list(map(int, input().split()))
if k[0]**2 + k[1]**2 == k[2]**2:
print(True)
else:
print(False) | s149823105 | Accepted | 40 | 7,540 | 206 | deta_set_count = int(input())
for _ in range(deta_set_count):
k = list(map(int, input().split()))
k= sorted(k)
if k[0]**2 + k[1]**2 == k[2]**2:
print('YES')
else:
print('NO') |
s674531507 | p03407 | u811528179 | 2,000 | 262,144 | Wrong Answer | 21 | 3,316 | 59 | An elementary school student Takahashi has come to a variety store. He has two coins, A-yen and B-yen coins (yen is the currency of Japan), and wants to buy a toy that costs C yen. Can he buy it? Note that he lives in Takahashi Kingdom, and may have coins that do not exist in Japan. | a,b,c=map(int,input().split())
print(['No','Yes'][a+b==c])
| s046326978 | Accepted | 17 | 2,940 | 59 | a,b,c=map(int,input().split())
print(['No','Yes'][a+b>=c])
|
s422964478 | p03129 | u036744414 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 128 | Determine if we can choose K different integers between 1 and N (inclusive) so that no two of them differ by 1. | # coding:utf-8
import math
N, K = map(int, input().split())
if math.ceil(N / 2) >= K:
print("Yes")
else:
print("No")
| s134869562 | Accepted | 17 | 2,940 | 109 | # coding:utf-8
N, K = map(int, input().split())
if -(-N // 2) >= K:
print("YES")
else:
print("NO")
|
s608402191 | p03470 | u371467115 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 72 | An _X -layered kagami mochi_ (X ≥ 1) is a pile of X round mochi (rice cake) stacked vertically where each mochi (except the bottom one) has a smaller diameter than that of the mochi directly below it. For example, if you stack three mochi with diameters of 10, 8 and 6 centimeters from bottom to top in this order, you h... | n=int(input())
d=[int(input()) for i in range(n)]
s=set(d)
print(len(d)) | s485878529 | Accepted | 18 | 2,940 | 72 | n=int(input())
d=[int(input()) for i in range(n)]
s=set(d)
print(len(s)) |
s224317219 | p02255 | u150711673 | 1,000 | 131,072 | Wrong Answer | 20 | 5,596 | 267 | Write a program of the Insertion Sort algorithm which sorts a sequence A in ascending order. The algorithm should be based on the following pseudocode: for i = 1 to A.length-1 key = A[i] /* insert A[i] into the sorted sequence A[0,...,j-1] */ j = i - 1 while j >= 0 and A[j] > key ... | N = int(input())
A_str = input()
A = []
for s in A_str.split():
A.append(int(s))
for i in range(1, len(A)):
key = A[i]
j = i - 1
while j >= 0 and A[j] > key:
A[j + 1] = A[j]
j -= 1
A[j + 1] = key
print(" ".join(map(str, A)))
| s935874957 | Accepted | 20 | 5,596 | 264 | N = int(input())
A = list(map(int, input().split()))
print(" ".join(map(str, A)))
for i in range(1, len(A)):
key = A[i]
j = i - 1
while j >= 0 and A[j] > key:
A[j + 1] = A[j]
j -= 1
A[j + 1] = key
print(" ".join(map(str, A)))
|
s490997856 | p04044 | u556589653 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 144 | Iroha has a sequence of N strings S_1, S_2, ..., S_N. The length of each string is L. She will concatenate all of the strings in some order, to produce a long string. Among all strings that she can produce in this way, find the lexicographically smallest one. Here, a string s=s_1s_2s_3...s_n is _lexicographically sm... | N,L = map(int,input().split())
S = []
ans = ""
for i in range(N):
S.append(input())
sorted(S)
for i in range(len(S)):
ans += S[i]
print(ans) | s163210481 | Accepted | 26 | 9,164 | 109 | N,L = map(int,input().split())
ls = []
for i in range(N):
ls.append(input())
ls.sort()
print("".join(ls)) |
s290034317 | p03471 | u128661070 | 2,000 | 262,144 | Wrong Answer | 792 | 3,316 | 266 | The commonly used bills in Japan are 10000-yen, 5000-yen and 1000-yen bills. Below, the word "bill" refers to only these. According to Aohashi, he received an otoshidama (New Year money gift) envelope from his grandfather that contained N bills for a total of Y yen, but he may be lying. Determine whether such a situat... | n,y = map(int, input().strip().split())
a_x, a_y, a_z = -1, -1, -1
for xi in range(n + 1):
for yi in range(n - xi + 1):
zi = n - xi - yi
if 1000*xi + 5000*yi + 10000*zi == y:
a_x = xi
a_y = yi
a_z = zi
break
print(a_x, a_y, a_z)
| s382114648 | Accepted | 833 | 3,316 | 264 | n,y = map(int, input().strip().split())
a_x, a_y, a_z = -1, -1, -1
for xi in range(n + 1):
for yi in range(n - xi + 1):
zi = n - xi - yi
if 10000*xi + 5000*yi + 1000*zi == y:
a_x = xi
a_y = yi
a_z = zi
break
print(a_x, a_y, a_z) |
s994152877 | p03408 | u668726177 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 197 | Takahashi has N blue cards and M red cards. A string is written on each card. The string written on the i-th blue card is s_i, and the string written on the i-th red card is t_i. Takahashi will now announce a string, and then check every card. Each time he finds a blue card with the string announced by him, he will ea... | d = {}
N = int(input())
for _ in range(N):
c = input()
d[c] = d.get(c, 0)+1
M = int(input())
for _ in range(M):
c = input()
d[c] = d.get(c, 0)-1
print(max(d.items(), key=lambda x: x[1])[0]) | s363653543 | Accepted | 17 | 3,060 | 205 | d = {}
N = int(input())
for _ in range(N):
c = input()
d[c] = d.get(c, 0)+1
M = int(input())
for _ in range(M):
c = input()
d[c] = d.get(c, 0)-1
print(max(max(d.items(), key=lambda x: x[1])[1], 0)) |
s221351751 | p03576 | u761320129 | 2,000 | 262,144 | Wrong Answer | 1,408 | 3,188 | 828 | We have N points in a two-dimensional plane. The coordinates of the i-th point (1 \leq i \leq N) are (x_i,y_i). Let us consider a rectangle whose sides are parallel to the coordinate axes that contains K or more of the N points in its interior. Here, points on the sides of the rectangle are considered to be in th... | N,K = map(int,input().split())
xs = []
ys = []
for i in range(N):
x,y = map(int,input().split())
xs.append((x,y,i))
ys.append((y,x,i))
xs.sort()
ys.sort()
x_order = {}
for xo,p in enumerate(xs):
x,y,i = p
x_order[i] = xo
cums = [[0 for j in range(N+1)] for i in range(N+1)]
for i in range(N):
... | s654765751 | Accepted | 1,421 | 3,188 | 815 | N,K = map(int,input().split())
xs = []
ys = []
for i in range(N):
x,y = map(int,input().split())
xs.append((x,y,i))
ys.append((y,x,i))
xs.sort()
ys.sort()
x_order = {}
for xo,p in enumerate(xs):
x,y,i = p
x_order[i] = xo
cums = [[0 for j in range(N+1)] for i in range(N+1)]
for i in range(N):
... |
s551253293 | p03644 | u969211566 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 163 | Takahashi loves numbers divisible by 2. You are given a positive integer N. Among the integers between 1 and N (inclusive), find the one that can be divisible by 2 for the most number of times. The solution is always unique. Here, the number of times an integer can be divisible by 2, is how many times the integer can... | n = int(input())
cmax = 0
imax = 0
for i in range(1,n+1):
cnt = 0
ig = i
while i % 2 == 0:
i /= 2
cnt += 1
if cnt > cmax:
imax = ig
print(imax) | s948860478 | Accepted | 17 | 3,060 | 179 | n = int(input())
cmax = 0
imax = 1
for i in range(1,n+1):
cnt = 0
ig = i
while i % 2 == 0:
i /= 2
cnt += 1
if cnt > cmax:
cmax = cnt
imax = ig
print(imax) |
s288777311 | p02396 | u208157605 | 1,000 | 131,072 | Wrong Answer | 80 | 7,884 | 153 | In the online judge system, a judge file may include multiple datasets to check whether the submitted program outputs a correct answer for each test case. This task is to practice solving a problem with multiple datasets. Write a program which reads an integer x and print it as is. Note that multiple datasets are give... | list = []
while True:
n = int(input())
if n == 0:
break
list.append(n)
for i,n in enumerate(list):
print('case %i: %i' %(i+1, n)) | s088632366 | Accepted | 80 | 7,864 | 153 | list = []
while True:
n = int(input())
if n == 0:
break
list.append(n)
for i,n in enumerate(list):
print('Case %i: %i' %(i+1, n)) |
s733071250 | p02406 | u610816226 | 1,000 | 131,072 | Wrong Answer | 30 | 5,596 | 254 | 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 ... | x = int(input())
k = []
for i in range(1, x + 1):
y = i
if i % 3 == 0:
k.append(i)
else:
while y >= 10:
y %= 10
if y == 3:
k.append(i)
for i in range(len(k)):
print(' '+ str(k[i]))
| s313260759 | Accepted | 30 | 6,116 | 373 | x = int(input())
k = []
for i in range(1, x + 1):
y = i
if i % 3 == 0:
k.append(i)
else:
while True:
if y % 10 == 3:
k.append(i)
break
else:
if y <= 10:
break
else:
... |
s463818478 | p03434 | u626337957 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 97 | 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 c... | N = int(input())
A = list(map(int, input().split()))
A.sort(key=lambda x: -x)
print(sum(A[0::2])) | s662804678 | Accepted | 17 | 2,940 | 111 | N = int(input())
A = list(map(int, input().split()))
A.sort(key=lambda x: -x)
print(sum(A[0::2])-sum(A[1::2]))
|
s885203501 | p03485 | u485566817 | 2,000 | 262,144 | Wrong Answer | 20 | 2,940 | 49 | 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 = map(int,input().split())
x = round(a*b/2)
x | s558281701 | Accepted | 17 | 2,940 | 76 | import math
a,b = map(int,input().split())
x = (a + b)/2
print(math.ceil(x)) |
s685770793 | p03455 | u476155259 | 2,000 | 262,144 | Wrong Answer | 19 | 3,316 | 190 | AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd. | # coding: utf-8
# Your code here!
input_num = input().split()
num_int = [int(i) for i in input_num]
seki = num_int[0] + num_int[1]
if seki % 2 == 0:
print("Even")
else:
print("Odd") | s311028516 | Accepted | 17 | 2,940 | 190 | # coding: utf-8
# Your code here!
input_num = input().split()
num_int = [int(i) for i in input_num]
seki = num_int[0] * num_int[1]
if seki % 2 == 0:
print("Even")
else:
print("Odd") |
s429620348 | p03854 | u196697332 | 2,000 | 262,144 | Wrong Answer | 19 | 4,796 | 448 | You are given a string S consisting of lowercase English letters. Another string T is initially empty. Determine whether it is possible to obtain S = T by performing the following operation an arbitrary number of times: * Append one of the following at the end of T: `dream`, `dreamer`, `erase` and `eraser`. | import sys
S = str(input())
while S != '':
print(S)
if (S[:5] == 'dream' and S[5:11] == 'eraser') or (S[:5] == 'dream' and S[5: 10] == 'erase') or (S[:5] == 'dream' and S[5:] == ''):
S = S[5:]
elif S[:5] == 'erase' and S[5] != 'r':
S = S[5:]
elif S[:6] == 'eraser':
S = S[6:]
... | s746649108 | Accepted | 126 | 3,188 | 536 | import sys
S = str(input())
while S != '':
if (S[:5] == 'dream' and S[5:11] == 'eraser') or (S[:5] == 'dream' and S[5: 10] == 'erase') or (S[:5] == 'dream' and S[5:] == '') or (S[:5] == 'dream' and S[5:10] == 'dream'):
S = S[5:]
elif (S[:5] == 'erase' and S[5:] != '' and S[5] != 'r') or (S[:5] == 'erase... |
s876831835 | p02416 | u292012552 | 1,000 | 131,072 | Wrong Answer | 20 | 7,308 | 162 | Write a program which reads an integer and prints sum of its digits. | n = input()
while n != "0":
ans = 0
for i in range(len(n)):
print(ord(n[i:i+1]))
ans += ord(n[i:i+1]) - 48
print(ans)
n = input() | s940080985 | Accepted | 30 | 7,420 | 133 | n = input()
while n != "0":
ans = 0
for i in range(len(n)):
ans += ord(n[i:i+1]) - 48
print(ans)
n = input() |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.