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
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s220121753
|
p03624
|
u411544692
| 2,000
| 262,144
|
Wrong Answer
| 20
| 3,188
| 165
|
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 = input()
alphabets = [chr(i) for i in range(97,97+26)]
setS = sorted(set(S))
for A in alphabets:
if A not in setS:
print(A)
else: continue
print('None')
|
s980506490
|
Accepted
| 19
| 3,188
| 191
|
import sys
S = input()
alphabets = [chr(i) for i in range(97,97+26)]
setS = sorted(set(S))
for A in alphabets:
if A not in setS:
print(A)
sys.exit()
else: continue
print('None')
|
s353595292
|
p03545
|
u538808095
| 2,000
| 262,144
|
Wrong Answer
| 17
| 3,064
| 661
|
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()
n = len(S)
S_list = [int(S[0]), int(S[1]), int(S[2]), int(S[3])]
#1... - 0...+
def bit_to_notation(bit):
bitlist = [0 for i in range(n-1)]
for i in range(n-1):
if ((bit >> i) == 1):
bitlist[n-2-i] = "-"
else:
bitlist[n-2-i] = "+"
return bitlist
notation = 2 ** (n-1)
for bit in range(notation):
sum4 = 0
for j in range(n):
if((bit >> j) & 1):
sum4 -= S_list[n-1-j]
else:
sum4 += S_list[n-1-j]
if(sum4 == 7):
bitlist = bit_to_notation(bit)
print(str(S_list[0]) + bitlist[0] + str(S_list[1]) + bitlist[1]
+ str(S_list[2]) + bitlist[2] + str(S_list[3]))
break
|
s558216015
|
Accepted
| 17
| 3,064
| 679
|
S = input()
n = len(S)
S_list = [int(S[0]), int(S[1]), int(S[2]), int(S[3])]
#1... - 0...+
def bit_to_notation(bit):
bitlist = [0 for i in range(n-1)]
for i in range(n-1):
if ((bit >> i) & 1):
bitlist[n-2-i] = "+"
else:
bitlist[n-2-i] = "-"
return bitlist
notation = 2 ** (n-1)
for bit in range(notation):
sum4 = S_list[0]
for j in range(n-1):
if((bit >> j) & 1):
sum4 += S_list[n-1-j]
else:
sum4 -= S_list[n-1-j]
if(sum4 == 7):
bitlist = bit_to_notation(bit)
print(str(S_list[0]) + bitlist[0] + str(S_list[1]) + bitlist[1]
+ str(S_list[2]) + bitlist[2] + str(S_list[3]) + "=7")
break
|
s597284168
|
p03798
|
u941884460
| 2,000
| 262,144
|
Wrong Answer
| 172
| 4,212
| 846
|
Snuke, who loves animals, built a zoo. There are N animals in this zoo. They are conveniently numbered 1 through N, and arranged in a circle. The animal numbered i (2≤i≤N-1) is adjacent to the animals numbered i-1 and i+1. Also, the animal numbered 1 is adjacent to the animals numbered 2 and N, and the animal numbered N is adjacent to the animals numbered N-1 and 1. There are two kinds of animals in this zoo: honest sheep that only speak the truth, and lying wolves that only tell lies. Snuke cannot tell the difference between these two species, and asked each animal the following question: "Are your neighbors of the same species?" The animal numbered i answered s_i. Here, if s_i is `o`, the animal said that the two neighboring animals are of the same species, and if s_i is `x`, the animal said that the two neighboring animals are of different species. More formally, a sheep answered `o` if the two neighboring animals are both sheep or both wolves, and answered `x` otherwise. Similarly, a wolf answered `x` if the two neighboring animals are both sheep or both wolves, and answered `o` otherwise. Snuke is wondering whether there is a valid assignment of species to the animals that is consistent with these responses. If there is such an assignment, show one such assignment. Otherwise, print `-1`.
|
n =int(input())
s = input()
cir = ['']*n
judge = ''
def convertSW(x):
if x == 'S':
return 'W'
elif x == 'W':
return 'S'
for i in range(4):
if i == 0:
cir[0],cir[1] = 'S','S'
if i == 1:
cir[0],cir[1] = 'S','W'
if i == 2:
cir[0],cir[1] = 'W','W'
else:
cir[0],cir[1] = 'W','S'
if s[0] == 'o' and cir[0] == 'S' or s[0] == 'x' and cir[0] == 'W':
judge = cir[1]
else:
judge = convertSW(cir[1])
for j in range(2,n):
if s[j-1] == 'o' and cir[j-1] == 'S' or s[j-1] == 'x' and cir[j-1] == 'W':
cir[j] = cir[j-2]
else:
cir[j] = convertSW(cir[j-2])
if (s[-1] == 'o' and cir[-1] == 'S') or (s[-1] == 'x' and cir[-1] == 'W'):
if cir[0] == cir[-2]:
print(''.join(cir))
exit()
else:
if cir[0] == convertSW(cir[-2]):
print(''.join(cir))
exit()
print(-1)
|
s333057071
|
Accepted
| 221
| 4,212
| 902
|
n =int(input())
s = input()
cir = ['']*n
judge = ''
def convertSW(x):
if x == 'S':
return 'W'
elif x == 'W':
return 'S'
for i in range(4):
if i == 0:
cir[0],cir[1] = 'S','S'
elif i == 1:
cir[0],cir[1] = 'S','W'
elif i == 2:
cir[0],cir[1] = 'W','W'
else:
cir[0],cir[1] = 'W','S'
if (s[0] == 'o' and cir[0] == 'S') or (s[0] == 'x' and cir[0] == 'W'):
judge = cir[1]
else:
judge = convertSW(cir[1])
for j in range(2,n):
if (s[j-1] == 'o' and cir[j-1] == 'S') or (s[j-1] == 'x' and cir[j-1] == 'W'):
cir[j] = cir[j-2]
else:
cir[j] = convertSW(cir[j-2])
if (s[-1] == 'o' and cir[-1] == 'S') or (s[-1] == 'x' and cir[-1] == 'W'):
if (cir[0] == cir[-2]) and (judge == cir[-1]):
print(''.join(cir))
exit()
else:
if cir[0] == convertSW(cir[-2]) and (judge == cir[-1]):
print(''.join(cir))
exit()
print(-1)
|
s213298383
|
p03386
|
u591779169
| 2,000
| 262,144
|
Wrong Answer
| 17
| 3,060
| 188
|
Print all the integers that satisfies the following in ascending order: * Among the integers between A and B (inclusive), it is either within the K smallest integers or within the K largest integers.
|
a, b, k = map(int, input().split())
ans = []
for i in range(k):
if i+a <= b:
ans.append(i+a)
if b-i >= a:
ans.append(b-i)
ans.sort()
for i in set(ans):
print(i)
|
s489764668
|
Accepted
| 18
| 3,060
| 204
|
a, b, k = map(int, input().split())
ans = []
if b-a < 2*k:
for i in range(a, b+1):
print(i)
else:
for i in range(a, a+k):
print(i)
for i in range(b-k+1, b+1):
print(i)
|
s959380591
|
p03494
|
u534308356
| 2,000
| 262,144
|
Wrong Answer
| 18
| 2,940
| 216
|
There are N positive integers written on a blackboard: A_1, ..., A_N. Snuke can perform the following operation when all integers on the blackboard are even: * Replace each integer X on the blackboard by X divided by 2. Find the maximum possible number of operations that Snuke can perform.
|
N = int(input())
data = list(map(int, input().split()))
count = 0
while sum(data) % 2 == 0:
for i in range(len(data)):
data[i] = data[i] / 2
if sum(data) % 2 == 0:
count += 1
print(count)
|
s200161175
|
Accepted
| 18
| 2,940
| 216
|
# B - Shift only
N = int(input())
data = list(map(int, input().split()))
def div(n):
count = 0
while n %2 == 0:
n /= 2
count += 1
return count
ans = min(list(map(div, data)))
print(ans)
|
s215886138
|
p03813
|
u686713618
| 2,000
| 262,144
|
Wrong Answer
| 16
| 2,940
| 46
|
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.rfind("Z")-s.find('A')+1)
|
s883113919
|
Accepted
| 17
| 2,940
| 67
|
i = int(input())
if i >= 1200:
print("ARC")
else:
print("ABC")
|
s231863299
|
p03473
|
u732870425
| 2,000
| 262,144
|
Wrong Answer
| 17
| 2,940
| 24
|
How many hours do we have until New Year at M o'clock (24-hour notation) on 30th, December?
|
print(24 - int(input()))
|
s554476969
|
Accepted
| 17
| 2,940
| 24
|
print(48 - int(input()))
|
s833527175
|
p03565
|
u912862653
| 2,000
| 262,144
|
Wrong Answer
| 18
| 3,064
| 568
|
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`.
|
import heapq
import sys
input = sys.stdin.readline
def main():
S = input()
T = input()
unrestorable = True
for i in reversed(range(len(S)-len(T)+1)):
flg = True
for j in range(len(T)):
if S[i+j:i+j+1] not in [T[j:j+1], '?']:
flg = False
if flg:
S = S[:i] + T + S[i+len(T):]
unrestorable = False
break
if unrestorable:
print('UNRESTORABLE')
return
S = S.replace('?', 'a')
print(S)
if __name__ == '__main__':
main()
|
s570821928
|
Accepted
| 18
| 3,064
| 537
|
import heapq
import sys
input = sys.stdin.readline
def main():
S = input()[:-1]
T = input()[:-1]
A = []
for i in range(len(S)-len(T)+1):
flg = True
for j in range(len(T)):
if S[i+j:i+j+1] not in [T[j:j+1], '?']:
flg = False
if flg:
K = S[:i] + T + S[i+len(T):]
A.append(K.replace('?', 'a'))
if len(A)==0 or len(S)<len(T):
print('UNRESTORABLE')
return
print(min(A))
if __name__ == '__main__':
main()
|
s037281364
|
p04043
|
u901180556
| 2,000
| 262,144
|
Wrong Answer
| 17
| 3,060
| 193
|
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, B, C = input().split()
if A == 5 and B == 5 and C == 7:
print('YES')
elif A == 5 and B == 7 and C == 5:
print('YES')
elif A == 7 and B == 5 and C == 5:
print('YES')
else:
print('NO')
|
s924966982
|
Accepted
| 17
| 2,940
| 118
|
A, B, C = input().split()
x = A + B + C
if x.count('5') == 2 and x.count('7') == 1:
print('YES')
else:
print('NO')
|
s577686808
|
p03478
|
u103341055
| 2,000
| 262,144
|
Wrong Answer
| 40
| 9,124
| 180
|
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
while N > 0:
n = N
t = 0
while n > 0:
t += n % 10
n //= 10
if A <= t <= B:
ans += N
N -= 1
|
s698604745
|
Accepted
| 35
| 9,196
| 191
|
N,A,B = map(int,input().split())
ans =0
while N > 0:
n = N
t = 0
while n > 0:
t += n % 10
n //= 10
if A <= t <= B:
ans += N
N -= 1
print(ans)
|
s646449738
|
p02416
|
u226888928
| 1,000
| 131,072
|
Wrong Answer
| 20
| 7,644
| 100
|
Write a program which reads an integer and prints sum of its digits.
|
while 1:
str = input()
if(str == '0'): break
print(sum([int(c) for c in list(input())]))
|
s739275394
|
Accepted
| 20
| 7,636
| 96
|
while 1:
str = input()
if(str == '0'): break
print(sum([int(c) for c in list(str)]))
|
s935053631
|
p03545
|
u072964737
| 2,000
| 262,144
|
Wrong Answer
| 24
| 9,144
| 292
|
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.
|
x = list(map(int,input()))
for i in range(2**3):
ans = x[0]
list = []
for j in range(3):
if (i >> j) & 1:
ans += x[j+1]
list.append("+")
else:
ans -= x[j+1]
list.append("-")
if ans == 7:
print(x[0],list[0],x[1],list[1],x[2],list[2],x[3])
exit()
|
s198354326
|
Accepted
| 27
| 9,164
| 466
|
X = str(input())
for i in range(2**3):
ans = int(X[0])
list = []
for j in range(3):
if (i>>j & 1) == 1:
ans += int(X[j+1])
list.append("+")
else:
ans -= int(X[j+1])
list.append("-")
if ans == 7:
break
ans = X[0]
for i in range(3):
ans += list[i]
ans += X[i+1]
print(ans+"=7")
|
s022774432
|
p03501
|
u836737505
| 2,000
| 262,144
|
Wrong Answer
| 17
| 2,940
| 51
|
You are parking at a parking lot. You can choose from the following two fee plans: * Plan 1: The fee will be A×T yen (the currency of Japan) when you park for T hours. * Plan 2: The fee will be B yen, regardless of the duration. Find the minimum fee when you park for N hours.
|
n,a,b = map(int, input().split())
print(max(n*a,b))
|
s377638311
|
Accepted
| 17
| 2,940
| 51
|
n,a,b = map(int, input().split())
print(min(n*a,b))
|
s933376632
|
p00031
|
u711765449
| 1,000
| 131,072
|
Wrong Answer
| 30
| 7,752
| 351
|
祖母が天秤を使っています。天秤は、二つの皿の両方に同じ目方のものを載せると釣合い、そうでない場合には、重い方に傾きます。10 個の分銅の重さは、軽い順に 1g, 2g, 4g, 8g, 16g, 32g, 64g, 128g, 256g, 512g です。 祖母は、「1kg くらいまでグラム単位で量れるのよ。」と言います。「じゃあ、試しに、ここにあるジュースの重さを量ってよ」と言ってみると、祖母は左の皿にジュースを、右の皿に 8g と64g と128g の分銅を載せて釣合わせてから、「分銅の目方の合計は 200g だから、ジュースの目方は 200g ね。どう、正しいでしょう?」と答えました。 左の皿に載せる品物の重さを与えるので、天秤で与えられた重みの品物と釣合わせるときに、右の皿に載せる分銅を軽い順に出力するプログラムを作成して下さい。ただし、量るべき品物の重さは、すべての分銅の重さの合計 (=1023g) 以下とします。
|
w = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512]
w.reverse()
def weight(x):
res = []
for i in range(len(w)):
if w[i] <= x:
res.append(i)
x = x-w[i]
return res
x = int(input())
res = weight(x)
res.reverse()
print(w[res[0]],end = '')
for i in range(1,len(res)):
print(' ',w[res[i]],sep = '',end = '')
print('')
|
s060129896
|
Accepted
| 20
| 7,664
| 461
|
w = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512]
w.reverse()
def weight(x):
res = []
for i in range(len(w)):
if w[i] <= x:
res.append(i)
x = x-w[i]
return res
while True:
try:
x = int(input())
res = weight(x)
res.reverse()
print(w[res[0]],end = '')
for i in range(1,len(res)):
print(' ',w[res[i]],sep = '',end = '')
print('')
except EOFError:
break
|
s523296522
|
p03658
|
u037221289
| 2,000
| 262,144
|
Wrong Answer
| 18
| 2,940
| 87
|
Snuke has N sticks. The length of the i-th stick is l_i. Snuke is making a snake toy by joining K of the sticks together. The length of the toy is represented by the sum of the individual sticks that compose it. Find the maximum possible length of the toy.
|
N,K = map(int,input().split(' '))
L = sorted(map(int,input().split(' ')))
print(L[:-K])
|
s331194294
|
Accepted
| 17
| 2,940
| 94
|
N,K = map(int,input().split(' '))
L = sorted(map(int,input().split(' ')))
print(sum(L[N-K:]))
|
s098652472
|
p03759
|
u729133443
| 2,000
| 262,144
|
Wrong Answer
| 17
| 2,940
| 58
|
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());print('YNEOS'[b-a!=c-a::2])
|
s971293554
|
Accepted
| 32
| 9,028
| 58
|
a,b,c=map(int,input().split())
print('YNEOS'[a+c!=b+b::2])
|
s417171797
|
p03485
|
u256464928
| 2,000
| 262,144
|
Wrong Answer
| 17
| 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())
print(-(-(a+b)/2))
|
s113198266
|
Accepted
| 17
| 2,940
| 51
|
a,b = map(int,input().split())
print(-(-(a+b)//2))
|
s550671590
|
p00004
|
u923573620
| 1,000
| 131,072
|
Wrong Answer
| 20
| 5,508
| 15
|
Write a program which solve a simultaneous equation: ax + by = c dx + ey = f The program should print x and y for given a, b, c, d, e and f (-1,000 ≤ a, b, c, d, e, f ≤ 1,000). You can suppose that given equation has a unique solution.
|
print("hello")
|
s349184928
|
Accepted
| 20
| 5,608
| 192
|
while True:
try:
a, b, c, d, e, f = map(int, input().split())
except:
break
y = (c*d-f*a) / (b*d-e*a)
x = (c - b*y) / a
print("{:.3f} {:.3f}".format(x, y))
|
s790907255
|
p02258
|
u822165491
| 1,000
| 131,072
|
Wrong Answer
| 20
| 5,528
| 15
|
You can obtain profits from foreign exchange margin transactions. For example, if you buy 1000 dollar at a rate of 100 yen per dollar, and sell them at a rate of 108 yen per dollar, you can obtain (108 - 100) × 1000 = 8000 yen. Write a program which reads values of a currency $R_t$ at a certain time $t$ ($t = 0, 1, 2, ... n-1$), and reports the maximum value of $R_j - R_i$ where $j > i$ .
|
print(input())
|
s267509047
|
Accepted
| 520
| 14,948
| 418
|
n = int(input())
r_list = [int(input()) for i in range(n)]
score = -2000000000000000000000
minv = r_list[0]
for r in r_list[1:]:
score = max(score, r - minv)
minv = min(minv, r)
print(score)
|
s668649530
|
p02843
|
u620084012
| 2,000
| 1,048,576
|
Wrong Answer
| 18
| 2,940
| 85
|
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())
if 0 <= X%100 <= 5*(X//100):
print("Yes")
else:
print("No")
|
s914170193
|
Accepted
| 17
| 2,940
| 78
|
X = int(input())
if 0 <= X%100 <= 5*(X//100):
print(1)
else:
print(0)
|
s726796324
|
p03456
|
u236536206
| 2,000
| 262,144
|
Wrong Answer
| 17
| 2,940
| 149
|
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.
|
import sys
a,b=map(str,input().split())
s=int(a+b)
print(s)
for i in range(1100):
if s==i**2:
print("Yes")
sys.exit()
print("No")
|
s722542791
|
Accepted
| 17
| 2,940
| 150
|
import sys
a,b=map(str,input().split())
s=int(a+b)
#print(s)
for i in range(1100):
if s==i**2:
print("Yes")
sys.exit()
print("No")
|
s331553705
|
p04043
|
u564917060
| 2,000
| 262,144
|
Wrong Answer
| 39
| 3,064
| 250
|
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.
|
def is_haiku(s):
nums = s.split()
counts = {x: nums.count(x) for x in nums}
try:
if counts['5'] == 2 and counts['7'] == 1:
print("YES")
finally:
print("NO")
if __name__ == "__main__":
is_haiku(input())
|
s402856624
|
Accepted
| 39
| 3,064
| 287
|
def is_haiku(s):
nums = s.split()
counts = {x: nums.count(x) for x in nums}
try:
if counts['5'] == 2 and counts['7'] == 1:
print("YES")
else:
print("NO")
except:
print("NO")
if __name__ == "__main__":
is_haiku(input())
|
s021451120
|
p03434
|
u197968862
| 2,000
| 262,144
|
Wrong Answer
| 17
| 2,940
| 118
|
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())
A = list(map(int,input().split()))
A.sort(reverse=True)
print(A)
print((sum(A[::2])) - sum(A[1::2]))
|
s614848799
|
Accepted
| 17
| 3,060
| 199
|
n = int(input())
a = list(map(int,input().split()))
a.sort(reverse=True)
alice = 0
bob = 0
for i in range(n):
if i % 2 == 0:
alice += a[i]
else:
bob += a[i]
print(alice-bob)
|
s898437793
|
p03588
|
u732412551
| 2,000
| 262,144
|
Wrong Answer
| 321
| 16,596
| 116
|
A group of people played a game. All players had distinct scores, which are positive integers. Takahashi knows N facts on the players' scores. The i-th fact is as follows: the A_i-th highest score among the players is B_i. Find the maximum possible number of players in the game.
|
N=int(input())
AB=[tuple(map(int, input().split()))for _ in range(N)]
a, b = max(AB, key=lambda ab:ab[1])
print(a+b)
|
s424739647
|
Accepted
| 308
| 3,188
| 81
|
N=int(input())
print(sum(max(tuple(map(int, input().split()))for _ in range(N))))
|
s717837973
|
p03455
|
u335285986
| 2,000
| 262,144
|
Wrong Answer
| 18
| 2,940
| 90
|
AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd.
|
def even(a, b):
if a*b % 2 == 0:
print('Even')
else:
print('Odd')
|
s506757670
|
Accepted
| 17
| 2,940
| 91
|
a, b = map(int, input().split())
if a*b % 2 == 0:
print('Even')
else:
print('Odd')
|
s155007462
|
p03385
|
u079022116
| 2,000
| 262,144
|
Wrong Answer
| 17
| 2,940
| 57
|
You are given a string S of length 3 consisting of `a`, `b` and `c`. Determine if S can be obtained by permuting `abc`.
|
if sorted(input()) == 'abc':print('Yes')
else:print('No')
|
s304989293
|
Accepted
| 17
| 2,940
| 130
|
a=sorted(input())
abc='abc'
count=0
for i in range(3):
if a[i]==abc[i]:
count+=1
if count == 3:print('Yes')
else:print('No')
|
s608626141
|
p03737
|
u580327099
| 2,000
| 262,144
|
Wrong Answer
| 17
| 2,940
| 250
|
You are given three words s_1, s_2 and s_3, each composed of lowercase English letters, with spaces in between. Print the acronym formed from the uppercased initial letters of the words.
|
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
input = sys.stdin.readline
def main():
sp = list(input().strip())
for i, c in enumerate(sp):
print(c.upper() if i == 0 or sp[i-1] == ' ' else c, end="")
print()
main()
|
s110211212
|
Accepted
| 17
| 2,940
| 258
|
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
input = sys.stdin.readline
def main():
sp = list(input().strip())
s = ''
for i, c in enumerate(sp):
if i == 0 or sp[i-1] == ' ':
s += c.upper()
print(s)
main()
|
s378100436
|
p03379
|
u941753895
| 2,000
| 262,144
|
Wrong Answer
| 302
| 25,472
| 164
|
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())
if n==4:
exit()
l=list(map(int,input().split()))
sl=l[:]
sl.sort()
a=sl[n//2-1]
b=sl[n//2]
for i in l:
if i<=a:
print(b)
else:
print(a)
|
s980809847
|
Accepted
| 288
| 29,172
| 455
|
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time
sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
def LI(): return list(map(int,input().split()))
def I(): return int(input())
def LS(): return input().split()
def S(): return input()
def main():
n=I()
l=LI()
_l=sorted(l)
if n%2==0:
a=_l[n//2-1]
b=_l[n//2]
for x in l:
if x<=a:
print(b)
else:
print(a)
main()
|
s162913406
|
p03457
|
u914529932
| 2,000
| 262,144
|
Wrong Answer
| 17
| 3,064
| 340
|
AtCoDeer the deer is going on a trip in a two-dimensional plane. In his plan, he will depart from point (0, 0) at time 0, then for each i between 1 and N (inclusive), he will visit point (x_i,y_i) at time t_i. If AtCoDeer is at point (x, y) at time t, he can be at one of the following points at time t+1: (x+1,y), (x-1,y), (x,y+1) and (x,y-1). Note that **he cannot stay at his place**. Determine whether he can carry out his plan.
|
N = int(input())
result = 1
bt=0
bx=0
by= 0
for i in range(N):
t, x, y = map(int, input().split())
distance = abs(x-bx) + abs(y-by)
dur = t - bt
if dur - distance > 0 and (dur - distance) %2 == 0:
(bt,bx,by) = (t,x,y)
continue
else:
result = 0
break
if result:
print("Yes")
else:
print("No")
|
s921740495
|
Accepted
| 383
| 3,064
| 342
|
N = int(input())
result = 1
bt=0
bx=0
by= 0
for i in range(N):
t, x, y = map(int, input().split())
distance = abs(x-bx) + abs(y-by)
dur = t - bt
if dur - distance >= 0 and (dur - distance) %2 == 0:
(bt,bx,by) = (t,x,y)
continue
else:
result = 0
break
if result:
print("Yes")
else:
print("No")
|
s701474151
|
p02612
|
u750058957
| 2,000
| 1,048,576
|
Wrong Answer
| 32
| 9,100
| 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 = N % 1000
print(ans)
|
s225828130
|
Accepted
| 30
| 9,160
| 79
|
N = int(input())
ans = N % 1000
if ans == 0:
print(0)
else:
print(1000-ans)
|
s715356919
|
p03545
|
u653807637
| 2,000
| 262,144
|
Wrong Answer
| 17
| 3,060
| 292
|
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.
|
def main():
s = input()
ans = ''
ans = solve(s[0], s[1:])
print(ans)
def solve(left, right):
if len(right) == 0:
if eval(left) == 7:
print(left)
exit()
else:
solve(left + '-' + right[0], right[1:])
solve(left + '+' + right[0], right[1:])
if __name__ == '__main__':
main()
|
s462407456
|
Accepted
| 18
| 2,940
| 194
|
import sys
def solve(l, r):
if r == "":
if eval(l) == 7:
print(l + "=7")
sys.exit()
else:
solve(l + "+" + r[0], r[1:])
solve(l + "-" + r[0], r[1:])
s = input()
solve(s[0], s[1:])
|
s248152198
|
p03659
|
u136647933
| 2,000
| 262,144
|
Wrong Answer
| 2,104
| 23,800
| 173
|
Snuke and Raccoon have a heap of N cards. The i-th card from the top has the integer a_i written on it. They will share these cards. First, Snuke will take some number of cards from the top of the heap, then Raccoon will take all the remaining cards. Here, both Snuke and Raccoon have to take at least one card. Let the sum of the integers on Snuke's cards and Raccoon's cards be x and y, respectively. They would like to minimize |x-y|. Find the minimum possible value of |x-y|.
|
N=int(input())
number=list(map(int,input().split()))
SUM=sum(number)
number_sum=[0]*N
for i in range(N):
number_sum[i]=sum(number[0:i])*2-SUM
print(abs(max(number_sum)))
|
s664084716
|
Accepted
| 195
| 28,700
| 308
|
N=int(input())
number=list(map(int,input().split()))
Sum=sum(number)
number_sum=[0]*N
number_sum[0]=number[0]
result=[0]*(N-1)
for i in range(1,N):
number_sum[i]=number_sum[i-1]+number[i]
result[0]=abs(number_sum[0]*2-Sum)
for i in range(1,N-1):
result[i]=abs(((number_sum[i])*2-Sum))
print(min(result))
|
s490458894
|
p03377
|
u897302879
| 2,000
| 262,144
|
Wrong Answer
| 17
| 2,940
| 84
|
There are a total of A + B cats and dogs. Among them, A are known to be cats, but the remaining B are not known to be either cats or dogs. Determine if it is possible that there are exactly X cats among these A + B animals.
|
A, B, X = map(int, input().split())
print('Yes' if A <= X and X - A <= B else 'No')
|
s192334854
|
Accepted
| 17
| 2,940
| 84
|
A, B, X = map(int, input().split())
print('YES' if A <= X and X - A <= B else 'NO')
|
s043547958
|
p03971
|
u162286909
| 2,000
| 262,144
|
Wrong Answer
| 79
| 9,908
| 378
|
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 the top rank down. Participants who are not students cannot pass the Qualification contests. * A Japanese student passes the Qualification contests if the number of the participants who have already definitively passed is currently fewer than A+B. * An overseas student passes the Qualification contests if the number of the participants who have already definitively passed is currently fewer than A+B and the student ranks B-th or above among all overseas students. A string S is assigned indicating attributes of all participants. If the i-th character of string S is `a`, this means the participant ranked i-th in the Qualification contests is a Japanese student; `b` means the participant ranked i-th is an overseas student; and `c` means the participant ranked i-th is neither of these. Write a program that outputs for all the participants in descending rank either `Yes` if they passed the Qualification contests or `No` if they did not pass.
|
from sys import stdin
from math import ceil, floor
n, a, b = [int(x) for x in stdin.readline().rstrip().split()]
s = list(stdin.readline().rstrip())
c = a + b
d = 0
e = 0
for i in range(n):
if d < c and s[i] == "a":
print("YES")
d += 1
elif d < c and e < b and s[i] == "b":
print("YES")
d += 1
e += 1
else:
print("NO")
|
s265559939
|
Accepted
| 78
| 9,960
| 445
|
from sys import stdin
from math import ceil, floor
n,a,b=[int(x) for x in stdin.readline().rstrip().split()]
s=list(stdin.readline().rstrip())
c=a+b
d=e=m=0
for i in range(n):
if d<c and s[i]=="a":
print("Yes")
d+=1
elif d<c and e<b and s[i]=="b":
print("Yes")
d+=1
e+=1
else:
print("No")
if d>=c:
m=i+1
break
if m != 0:
for i in range(n-m):
print("No")
|
s693046841
|
p03228
|
u415196833
| 2,000
| 1,048,576
|
Wrong Answer
| 17
| 3,064
| 261
|
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 person. Find the numbers of cookies Takahashi and Aoki respectively have after performing K operations in total.
|
A, B, K = map(int, input().split(' '))
for i in range(K):
if i % 2 == 0:
a = b = 0
if A % 2 == 1:
A -= 1
a = A // 2
A -= a
B += a
else:
if B % 2 == 1:
B -= 1
b = B // 2
B -= b
A += b
print(A, B)
print(A, B)
|
s790559757
|
Accepted
| 17
| 3,060
| 250
|
A, B, K = map(int, input().split(' '))
for i in range(K):
if i % 2 == 0:
a = b = 0
if A % 2 == 1:
A -= 1
a = A // 2
A -= a
B += a
else:
if B % 2 == 1:
B -= 1
b = B // 2
B -= b
A += b
print(A, B)
|
s527586622
|
p03943
|
u804358525
| 2,000
| 262,144
|
Wrong Answer
| 18
| 2,940
| 138
|
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.
|
# -*- coding: utf-8 -*-
t = [int(i) for i in input().split()]
t.sort()
if(t[2] == t[1] + t[0] ):
print("YES")
else:
print("NO")
|
s332601096
|
Accepted
| 17
| 2,940
| 138
|
# -*- coding: utf-8 -*-
t = [int(i) for i in input().split()]
t.sort()
if(t[2] == t[1] + t[0] ):
print("Yes")
else:
print("No")
|
s988955917
|
p03473
|
u017415492
| 2,000
| 262,144
|
Wrong Answer
| 17
| 2,940
| 26
|
How many hours do we have until New Year at M o'clock (24-hour notation) on 30th, December?
|
m=int(input())
print(m+24)
|
s325524401
|
Accepted
| 18
| 2,940
| 31
|
m=int(input())
print((24-m)+24)
|
s685284916
|
p02613
|
u861274887
| 2,000
| 1,048,576
|
Wrong Answer
| 140
| 16,556
| 216
|
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.
|
import collections
a = input()
N = int(a)
S = [input() for i in range(N)]
c = collections.Counter(S)
print('AC × %d' % c['AC'])
print('WA × %d' % c['WA'])
print('TLE × %d' % c['TLE'])
print('RE × %d' % c['RE'])
|
s497621615
|
Accepted
| 143
| 16,440
| 212
|
import collections
a = input()
N = int(a)
S = [input() for i in range(N)]
c = collections.Counter(S)
print('AC x %d' % c['AC'])
print('WA x %d' % c['WA'])
print('TLE x %d' % c['TLE'])
print('RE x %d' % c['RE'])
|
s474288830
|
p03962
|
u748311048
| 2,000
| 262,144
|
Wrong Answer
| 18
| 3,064
| 40
|
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.
|
a,b,c=map(int, input().split())
print(1)
|
s254346246
|
Accepted
| 17
| 2,940
| 111
|
a,b,c=map(int, input().split())
if a==b==c:
print(1)
elif a==b or b==c or a==c:
print(2)
else:
print(3)
|
s461717212
|
p04044
|
u920438243
| 2,000
| 262,144
|
Time Limit Exceeded
| 2,104
| 3,064
| 383
|
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.
|
x,y = map(int,input().split())
list = [input() for i in range(x)]
left = 0
right = x-1
for i in range(x):
right = x-1
while left < right:
if list[right]<list[right-1]:
escape = list[right]
list[right] = list[right-1]
list[right-1] = escape
right-1
left += 1
answer = ""
for lis in list:
answer += lis
print(answer)
|
s391696763
|
Accepted
| 17
| 3,060
| 151
|
num,long = map(int,input().split())
lines = [input() for i in range(num)]
lines.sort()
answer = ""
for line in lines:
answer += line
print(answer)
|
s889777927
|
p02396
|
u343251190
| 1,000
| 131,072
|
Wrong Answer
| 60
| 7,728
| 92
|
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.
|
import sys
i = 1
for line in sys.stdin:
print("case %d: %d" % (i, int(line)))
i += 1
|
s293906581
|
Accepted
| 130
| 7,560
| 102
|
x = int(input())
i = 1
while x != 0:
print("Case %d: %d" % (i, x))
i += 1
x = int(input())
|
s081491960
|
p02260
|
u150984829
| 1,000
| 131,072
|
Wrong Answer
| 20
| 5,596
| 165
|
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[i] and A[mini] Note that, indices for array elements are based on 0-origin. Your program should also print the number of swap operations defined in line 6 of the pseudocode in the case where i ≠ mini.
|
n=int(input())
a=list(map(int,input().split()))
c=0
for i in range(n-1):
for j in range(n-1,i,-1):
if a[j-1]>a[j]:a[j-1],a[j]=a[j],a[j-1];c+=1
print(*a)
print(c)
|
s305227917
|
Accepted
| 20
| 5,612
| 146
|
n=int(input())
a=list(map(int,input().split()))
c=0
for i in range(n-1):
m=a.index(min(a[i:]),i)
a[i],a[m]=a[m],a[i];c+=i!=m
print(*a)
print(c)
|
s139009569
|
p03567
|
u411537765
| 2,000
| 262,144
|
Wrong Answer
| 17
| 2,940
| 174
|
Snuke built an online judge to hold a programming contest. When a program is submitted to the judge, the judge returns a verdict, which is a two-character string that appears in the string S as a contiguous substring. (The judge can return any two-character substring of S.) Determine whether the judge can return the string `AC` as the verdict to a program.
|
s = input()
found = False
for i in range(len(s)):
if s[i] == 'a' and s[i+1] == 'c':
print('Yes')
found = True
break
if not found:
print('No')
|
s072768033
|
Accepted
| 18
| 3,064
| 176
|
s = input()
found = False
for i in range(len(s)-1):
if s[i] == 'A' and s[i+1] == 'C':
print('Yes')
found = True
break
if not found:
print('No')
|
s901760752
|
p03369
|
u620945921
| 2,000
| 262,144
|
Wrong Answer
| 17
| 2,940
| 49
|
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 three characters long, and if the first character in S is `o`, it means the ramen should be topped with boiled egg; if that character is `x`, it means the ramen should not be topped with boiled egg. Similarly, the second and third characters in S mean the presence or absence of sliced pork and green onions on top of the ramen. Write a program that, when S is given, prints the price of the corresponding bowl of ramen.
|
s=input()
price=700+100*s.count('s')
print(price)
|
s729486821
|
Accepted
| 17
| 2,940
| 58
|
s=input()
num=s.count('o')
price=700+100*num
print(price)
|
s238475338
|
p03658
|
u975966195
| 2,000
| 262,144
|
Wrong Answer
| 17
| 2,940
| 113
|
Snuke has N sticks. The length of the i-th stick is l_i. Snuke is making a snake toy by joining K of the sticks together. The length of the toy is represented by the sum of the individual sticks that compose it. Find the maximum possible length of the toy.
|
n, k = map(int, input().split())
l = list(map(int, input().split()))
print(sum(sorted(l, reverse=True)[:k + 1]))
|
s868748018
|
Accepted
| 17
| 2,940
| 109
|
n, k = map(int, input().split())
l = list(map(int, input().split()))
print(sum(sorted(l, reverse=True)[:k]))
|
s537098291
|
p03455
|
u370429695
| 2,000
| 262,144
|
Wrong Answer
| 17
| 2,940
| 106
|
AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd.
|
a = list(map(int, input().split()))
if a[0] % 2 == 0 or a[1] % 2 == 10:
print("Even")
else:
print("Odd")
|
s416945509
|
Accepted
| 17
| 2,940
| 98
|
a, b = map(int, input().split())
if a % 2 == 0 or b % 2 == 0:
print('Even')
else:
print('Odd')
|
s024105510
|
p03623
|
u933214067
| 2,000
| 262,144
|
Wrong Answer
| 40
| 5,392
| 258
|
Snuke lives at position x on a number line. On this line, there are two stores A and B, respectively at position a and b, that offer food for delivery. Snuke decided to get food delivery from the closer of stores A and B. Find out which store is closer to Snuke's residence. Here, the distance between two points s and t on a number line is represented by |s-t|.
|
from statistics import mean, median,variance,stdev
import sys
import math
a = input().split()
#y = input().split()
for i in range(len(a)):
a[i] = int(a[i])
#x = int(input())
#y = int(input())
if a[2]-a[0] > a[1]-a[0]:
print(a[1])
else: print(a[2])
|
s690863373
|
Accepted
| 43
| 5,400
| 266
|
from statistics import mean, median,variance,stdev
import sys
import math
a = input().split()
#y = input().split()
for i in range(len(a)):
a[i] = int(a[i])
#x = int(input())
#y = int(input())
if abs(a[2]-a[0]) > abs(a[1]-a[0]):
print("A")
else: print("B")
|
s404032295
|
p03697
|
u848647227
| 2,000
| 262,144
|
Wrong Answer
| 17
| 2,940
| 87
|
You are given two integers A and B as the input. Output the value of A + B. However, if A + B is 10 or greater, output `error` instead.
|
a,b = map(int,input().split(" "))
if a + b <= 10:
print("error")
else:
print(a + b)
|
s892114438
|
Accepted
| 18
| 2,940
| 88
|
a,b = map(int,input().split(" "))
if a + b >= 10:
print("error")
else:
print(a + b)
|
s166686760
|
p02741
|
u373228444
| 2,000
| 1,048,576
|
Wrong Answer
| 17
| 2,940
| 137
|
Print the K-th element of the following sequence of length 32: 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51
|
k = int(input())
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(a[k % 32])
|
s243534920
|
Accepted
| 17
| 3,060
| 134
|
k = int(input())
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(a[k-1])
|
s830296296
|
p03493
|
u790876967
| 2,000
| 262,144
|
Wrong Answer
| 17
| 2,940
| 80
|
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.
|
num = input()
cnt = 0
for i in num:
if i == "1":
cnt += 0
print(cnt)
|
s354977791
|
Accepted
| 17
| 2,940
| 80
|
num = input()
cnt = 0
for i in num:
if i == "1":
cnt += 1
print(cnt)
|
s239845445
|
p02865
|
u633000076
| 2,000
| 1,048,576
|
Wrong Answer
| 17
| 2,940
| 71
|
How many ways are there to choose two distinct positive integers totaling N, disregarding the order?
|
n=int(input())
if n%2==0:
print((n/2)-1)
else:
print(int(n//2))
|
s352727076
|
Accepted
| 17
| 2,940
| 99
|
n=int(input())
if n<3:
print(0)
elif n%2==0:
print(int((n/2)-1))
else:
print(int(n//2))
|
s222997591
|
p02399
|
u238667145
| 1,000
| 131,072
|
Wrong Answer
| 30
| 7,656
| 60
|
Write a program which reads two integers a and b, and calculates the following values: * a ÷ b: d (in integer) * remainder of a ÷ b: r (in integer) * a ÷ b: f (in real number)
|
a, b = map(int, input().split())
print(a // b, a % b, a / b)
|
s134193405
|
Accepted
| 30
| 7,660
| 77
|
a, b = map(int, input().split())
print(a // b, a % b, '{:.5f}'.format(a / b))
|
s304061131
|
p03853
|
u166012301
| 2,000
| 262,144
|
Wrong Answer
| 37
| 9,016
| 250
|
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).
|
h, w = map(int, input().split())
c = []
for i in range(h):
c.append(input())
thined_c = [0] * (2 * h - 1)
for i in range(2 * h - 1):
s = ''
for j in range(w):
s += c[(i+1)//2][j]
thined_c[i] = s
for s in thined_c:
print(s)
|
s915985760
|
Accepted
| 30
| 9,088
| 241
|
h, w = map(int, input().split())
c = []
for i in range(h):
c.append(input())
thined_c = [0] * (2 * h)
for i in range(2 * h):
s = ''
for j in range(w):
s += c[i // 2][j]
thined_c[i] = s
for s in thined_c:
print(s)
|
s987809748
|
p03485
|
u506858457
| 2,000
| 262,144
|
Wrong Answer
| 18
| 2,940
| 46
|
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())
print((a+b-1)//2)
|
s618806680
|
Accepted
| 17
| 2,940
| 46
|
a,b=map(int,input().split())
print((a+b+1)//2)
|
s427502387
|
p03796
|
u488497128
| 2,000
| 262,144
|
Wrong Answer
| 29
| 2,940
| 121
|
Snuke loves working out. He is now exercising N times. Before he starts exercising, his _power_ is 1. After he exercises for the i-th time, his power gets multiplied by i. Find Snuke's power after he exercises N times. Since the answer can be extremely large, print the answer modulo 10^{9}+7.
|
import sys
M = 10**9 + 1
N = int(sys.stdin.readline().strip())
x = 1
for i in range(N):
x = (x * i) % M
print(x)
|
s536125157
|
Accepted
| 36
| 2,940
| 126
|
import sys
M = 10**9 + 7
N = int(sys.stdin.readline().strip())
x = 1
for i in range(1, N+1):
x = (x * i) % M
print(x)
|
s136302753
|
p03836
|
u380933932
| 2,000
| 262,144
|
Wrong Answer
| 19
| 3,064
| 384
|
Dolphin resides in two-dimensional Cartesian plane, with the positive x-axis pointing right and the positive y-axis pointing up. Currently, he is located at the point (sx,sy). In each second, he can move up, down, left or right by a distance of 1. Here, both the x\- and y-coordinates before and after each movement must be integers. He will first visit the point (tx,ty) where sx < tx and sy < ty, then go back to the point (sx,sy), then visit the point (tx,ty) again, and lastly go back to the point (sx,sy). Here, during the whole travel, he is not allowed to pass through the same point more than once, except the points (sx,sy) and (tx,ty). Under this condition, find a shortest path for him.
|
#n=int(input())
#d=["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"]
#import numpy as np
#import math
#li=input().split()
#S=input()
lis=list(map(int,input().split()))
S=""
x=lis[2]-lis[0]
y=lis[3]-lis[1]
S+="R"*x
S+="U"*y
S+="L"*x
S+="D"*(y+1)
S+="R"*(x+1)
S+"U"*(y+1)
S+="L"
S+="U"
S+="L"*(x+1)
S+="D"*(y+1)
S+="R"
print(S)
|
s594309903
|
Accepted
| 18
| 3,064
| 384
|
#n=int(input())
#d=["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"]
#import numpy as np
#import math
#li=input().split()
#S=input()
lis=list(map(int,input().split()))
S=""
x=lis[2]-lis[0]
y=lis[3]-lis[1]
S+="U"*y
S+="R"*x
S+="D"*y
S+="L"*(x+1)
S+="U"*(y+1)
S+="R"*(x+1)
S+="D"
S+="R"
S+="D"*(y+1)
S+="L"*(x+1)
S+="U"
print(S)
|
s951425840
|
p03738
|
u620480037
| 2,000
| 262,144
|
Wrong Answer
| 17
| 3,064
| 294
|
You are given two positive integers A and B. Compare the magnitudes of these numbers.
|
A=input()
B=input()
if len(A)>len(B):
print("GREATER")
elif len(A)<len(B):
print("LESS")
else:
for i in range(len(A)):
if int(A[i])>int(B[i]):
print("GREATER")
elif int(A[i])<int(B[i]):
print("LESS")
else:
print("EQUAL")
|
s625371134
|
Accepted
| 17
| 3,064
| 310
|
A=input()
B=input()
if len(A)>len(B):
print("GREATER")
elif len(A)<len(B):
print("LESS")
else:
for i in range(len(A)):
if int(A[i])>int(B[i]):
print("GREATER")
exit()
elif int(A[i])<int(B[i]):
print("LESS")
exit()
print("EQUAL")
|
s347210781
|
p03456
|
u658993896
| 2,000
| 262,144
|
Wrong Answer
| 17
| 3,064
| 154
|
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.
|
n = ""
for x in input().split():
n += x
n = int(x)
ans = 'No'
for i in range(1,101):
if n % i == i:
ans = 'Yes'
break
print(ans)
|
s619506553
|
Accepted
| 17
| 2,940
| 128
|
a,b = input().split()
c= int(a+b)
ans = 'No'
for i in range(1,318):
if i**2==c:
ans = 'Yes'
break
print(ans)
|
s754702757
|
p03485
|
u864667985
| 2,000
| 262,144
|
Wrong Answer
| 18
| 2,940
| 114
|
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 = list(map(int, input().split()))
if a % 2 == 0 and b % 2 == 0:
print((a+b)/2)
else:
print((a+b+1)/2)
|
s436170193
|
Accepted
| 17
| 2,940
| 121
|
a, b = list(map(int, input().split()))
sum = a + b
if sum % 2 == 0:
print(int(sum/2))
else:
print(int((sum+1)/2))
|
s473914230
|
p03679
|
u391328897
| 2,000
| 262,144
|
Wrong Answer
| 17
| 2,940
| 141
|
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())
if (b-a) > x:
print('dangerous')
elif 0 < (b-a) <= x:
print('delicious')
else:
print('safe')
|
s190563750
|
Accepted
| 17
| 2,940
| 141
|
x, a, b = map(int, input().split())
if (b-a) > x:
print('dangerous')
elif 0 < (b-a) <= x:
print('safe')
else:
print('delicious')
|
s742470853
|
p03943
|
u586563885
| 2,000
| 262,144
|
Wrong Answer
| 17
| 2,940
| 96
|
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.
|
a,b,c=map(int,input().split())
if a+b==c or a+c==b or b+c==a:
print("YES")
else:
print("NO")
|
s243804576
|
Accepted
| 17
| 2,940
| 97
|
a,b,c=map(int,input().split())
if a+b==c or a+c==b or b+c==a:
print("Yes")
else:
print("No")
|
s803173263
|
p03693
|
u048945791
| 2,000
| 262,144
|
Wrong Answer
| 17
| 2,940
| 97
|
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?
|
r, g, b = map(int, input().split())
if (10 * g + b) % 4 == 0:
print("Yes")
else:
print("No")
|
s080697404
|
Accepted
| 17
| 2,940
| 97
|
r, g, b = map(int, input().split())
if (10 * g + b) % 4 == 0:
print("YES")
else:
print("NO")
|
s387660876
|
p03997
|
u153902122
| 2,000
| 262,144
|
Wrong Answer
| 17
| 2,940
| 64
|
You are given a trapezoid. The lengths of its upper base, lower base, and height are a, b, and h, respectively. An example of a trapezoid Find the area of this trapezoid.
|
a,b,h=int(input()),int(input()),int(input())
print(((a+b)*h)/2)
|
s726405807
|
Accepted
| 17
| 2,940
| 65
|
a,b,h=int(input()),int(input()),int(input())
print(((a+b)*h)//2)
|
s262572189
|
p03943
|
u714533789
| 2,000
| 262,144
|
Wrong Answer
| 17
| 3,064
| 94
|
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.
|
a,b,c=map(int,input().split())
if a==b+c or b==a+c or c==a+b:
print('YES')
else:
print('NO')
|
s508950814
|
Accepted
| 17
| 2,940
| 94
|
a,b,c=map(int,input().split())
if a==b+c or b==a+c or c==a+b:
print('Yes')
else:
print('No')
|
s186006060
|
p03130
|
u026102659
| 2,000
| 1,048,576
|
Wrong Answer
| 17
| 3,060
| 268
|
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 roads. Determine if we can visit all the towns by traversing each of the roads exactly once.
|
import sys
input = sys.stdin.readline
nums = [0 for _ in range(4)]
for _ in range(3):
a, b = map(int, input().split())
a -= 1
b -= 1
nums[a] += 1
nums[b] += 1
nums.sort()
if nums[0] == 1 and nums[3] == 2:
print("Yes")
else:
print("NO")
|
s176382520
|
Accepted
| 18
| 3,060
| 268
|
import sys
input = sys.stdin.readline
nums = [0 for _ in range(4)]
for _ in range(3):
a, b = map(int, input().split())
a -= 1
b -= 1
nums[a] += 1
nums[b] += 1
nums.sort()
if nums[0] == 1 and nums[3] == 2:
print("YES")
else:
print("NO")
|
s338298311
|
p03798
|
u951145045
| 2,000
| 262,144
|
Wrong Answer
| 206
| 10,792
| 2,302
|
Snuke, who loves animals, built a zoo. There are N animals in this zoo. They are conveniently numbered 1 through N, and arranged in a circle. The animal numbered i (2≤i≤N-1) is adjacent to the animals numbered i-1 and i+1. Also, the animal numbered 1 is adjacent to the animals numbered 2 and N, and the animal numbered N is adjacent to the animals numbered N-1 and 1. There are two kinds of animals in this zoo: honest sheep that only speak the truth, and lying wolves that only tell lies. Snuke cannot tell the difference between these two species, and asked each animal the following question: "Are your neighbors of the same species?" The animal numbered i answered s_i. Here, if s_i is `o`, the animal said that the two neighboring animals are of the same species, and if s_i is `x`, the animal said that the two neighboring animals are of different species. More formally, a sheep answered `o` if the two neighboring animals are both sheep or both wolves, and answered `x` otherwise. Similarly, a wolf answered `x` if the two neighboring animals are both sheep or both wolves, and answered `o` otherwise. Snuke is wondering whether there is a valid assignment of species to the animals that is consistent with these responses. If there is such an assignment, show one such assignment. Otherwise, print `-1`.
|
N=int(input())
S=list(str(input()))
hyp=[["S","S"],["S","W"],["W","S"],["W","W"]]
flag=0
for i in range(4):
if flag==2:
break
flag=0
ans=[]
ans.append(hyp[i][0])
ans.append(hyp[i][1])
for j in range(1,N+1):
if j>=N-1:
if j==N:
j=0
t=1
else:
t=0
if ans[j]=="S":
if S[j]=="o":
if ans[j-1]=="S":
if ans[t]=="S":
flag=+1
else:
if ans[t]=="W":
flag=+1
else:
if ans[j-1]=="S":
if ans[t]=="W":
flag=+1
else:
if ans[t]=="S":
flag=+1
else:
if S[j]=="o":
if ans[j-1]=="S":
if ans[t]=="W":
flag=+1
else:
if ans[t]=="S":
flag=+1
else:
if ans[j-1]=="S":
if ans[t]=="S":
flag=+1
else:
if ans[t]=="W":
flag=+1
else:
if ans[j]=="S":
if S[j]=="o":
if ans[j-1]=="S":
ans.append("S")
else:
ans.append("W")
else:
if ans[j-1]=="S":
ans.append("W")
else:
ans.append("S")
else:
if S[j]=="o":
if ans[j-1]=="S":
ans.append("W")
else:
ans.append("S")
else:
if ans[j-1]=="S":
ans.append("S")
else:
ans.append("W")
if flag==0:
print(-1)
else:
for i in range(len(ans)):
if i!=len(ans)-1:
print(ans[i],end="")
else:
print(ans[i])
|
s892193142
|
Accepted
| 197
| 10,804
| 2,327
|
N=int(input())
S=list(str(input()))
hyp=[["S","S"],["S","W"],["W","S"],["W","W"]]
flag=0
for i in range(4):
if flag==2:
break
flag=0
ans=[]
ans.append(hyp[i][0])
ans.append(hyp[i][1])
for j in range(1,N+1):
if j>=N-1:
if j==N:
j=0
t=1
else:
t=0
if ans[j]=="S":
if S[j]=="o":
if ans[j-1]=="S":
if ans[t]=="S":
flag+=1
else:
if ans[t]=="W":
flag+=1
else:
if ans[j-1]=="S":
if ans[t]=="W":
flag+=1
else:
if ans[t]=="S":
flag+=1
else:
if S[j]=="o":
if ans[j-1]=="S":
if ans[t]=="W":
flag+=1
else:
if ans[t]=="S":
flag+=1
else:
if ans[j-1]=="S":
if ans[t]=="S":
flag+=1
else:
if ans[t]=="W":
flag+=1
else:
if ans[j]=="S":
if S[j]=="o":
if ans[j-1]=="S":
ans.append("S")
else:
ans.append("W")
else:
if ans[j-1]=="S":
ans.append("W")
else:
ans.append("S")
else:
if S[j]=="o":
if ans[j-1]=="S":
ans.append("W")
else:
ans.append("S")
else:
if ans[j-1]=="S":
ans.append("S")
else:
ans.append("W")
if flag!=2:
print(-1)
else:
for i in range(len(ans)):
if i!=len(ans)-1:
print(ans[i],end="")
else:
print(ans[i])
|
s420274962
|
p02401
|
u565781955
| 1,000
| 131,072
|
Wrong Answer
| 20
| 7,624
| 318
|
Write a program which reads two integers a, b and an operator op, and then prints the value of a op b. The operator op is '+', '-', '*' or '/' (sum, difference, product or quotient). The division should truncate any fractional part.
|
if __name__ == "__main__":
list = {}
i = 0
while True:
a,op,b = input().split()
a,b = map(int,[a,b])
if op == '+':
list[i] = a+b
elif op == '-':
list[i] = a - b
elif op == '*':
list[i] = a*b
elif op == '/':
list[i] = a/b
else:
break
i +=1
for i in range(len(list)):
print (list[i])
|
s887226004
|
Accepted
| 20
| 7,668
| 332
|
if __name__ == "__main__":
list = {}
i = 0
while True:
a,op,b = input().split()
a,b = map(int,[a,b])
if op == '+':
list[i] = a+b
elif op == '-':
list[i] = a - b
elif op == '*':
list[i] = a*b
elif op == '/':
c = a/b
list[i] = int(c)
else:
break
i +=1
for i in range(len(list)):
print (list[i])
|
s368866231
|
p04044
|
u780206746
| 2,000
| 262,144
|
Wrong Answer
| 17
| 2,940
| 153
|
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.
|
line = input()
five_cnt = line.count('5')
seven_cnt = line.count('7')
if five_cnt == 2 and seven_cnt == 1:
print("YES")
else:
print("NO")
|
s099453487
|
Accepted
| 17
| 3,060
| 122
|
N, _ = input().split(' ')
N = int(N)
strs = []
for _ in range(N):
strs.append(input())
print(''.join(sorted(strs)))
|
s740270289
|
p03813
|
u521323621
| 2,000
| 262,144
|
Wrong Answer
| 26
| 8,912
| 67
|
Smeke has decided to participate in AtCoder Beginner Contest (ABC) if his current rating is less than 1200, and participate in AtCoder Regular Contest (ARC) otherwise. You are given Smeke's current rating, x. Print `ABC` if Smeke will participate in ABC, and print `ARC` otherwise.
|
x = int(input())
if 1200 <= x:
print("ABC")
else:
print("ARC")
|
s792830543
|
Accepted
| 24
| 8,908
| 67
|
x = int(input())
if 1200 > x:
print("ABC")
else:
print("ARC")
|
s411202333
|
p03946
|
u596276291
| 2,000
| 262,144
|
Wrong Answer
| 86
| 14,252
| 418
|
There are N towns located in a line, conveniently numbered 1 through N. Takahashi the merchant is going on a travel from town 1 to town N, buying and selling apples. Takahashi will begin the travel at town 1, with no apple in his possession. The actions that can be performed during the travel are as follows: * _Move_ : When at town i (i < N), move to town i + 1. * _Merchandise_ : Buy or sell an arbitrary number of apples at the current town. Here, it is assumed that one apple can always be bought and sold for A_i yen (the currency of Japan) at town i (1 ≦ i ≦ N), where A_i are distinct integers. Also, you can assume that he has an infinite supply of money. For some reason, there is a constraint on merchandising apple during the travel: the sum of the number of apples bought and the number of apples sold during the whole travel, must be at most T. (Note that a single apple can be counted in both.) During the travel, Takahashi will perform actions so that the _profit_ of the travel is maximized. Here, the profit of the travel is the amount of money that is gained by selling apples, minus the amount of money that is spent on buying apples. Note that we are not interested in apples in his possession at the end of the travel. Aoki, a business rival of Takahashi, wants to trouble Takahashi by manipulating the market price of apples. Prior to the beginning of Takahashi's travel, Aoki can change A_i into another arbitrary non-negative integer A_i' for any town i, any number of times. The cost of performing this operation is |A_i - A_i'|. After performing this operation, different towns may have equal values of A_i. Aoki's objective is to decrease Takahashi's expected profit by at least 1 yen. Find the minimum total cost to achieve it. You may assume that Takahashi's expected profit is initially at least 1 yen.
|
def main():
n, t = map(int, input().split())
a = list(map(int, input().split()))
base = a[-1]
m = 10 ** 10
diff_list = []
for i in range(len(a) - 2, -1, -1):
if a[i] >= base:
diff_list.append(base - m)
base = a[i]
m = 10 ** 10
m = min(m, a[i])
ans = diff_list.count(max(diff_list))
print(ans)
if __name__ == '__main__':
main()
|
s785033901
|
Accepted
| 208
| 32,900
| 1,234
|
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]
def inside(y, x, H, W):
return 0 <= y < H and 0 <= x < W
def ceil(a, b):
return (a + b - 1) // b
def main():
N, T = map(int, input().split())
A = list(map(int, input().split()))
maxi, mini = [-1] * N, [INF] * N
mini[0] = A[0]
for i in range(1, N):
mini[i] = min(mini[i - 1], A[i])
maxi[-1] = A[-1]
for i in range(N - 2, -1, -1):
maxi[i] = max(maxi[i + 1], A[i])
a, b = defaultdict(int), defaultdict(int)
diff = -1
for i in range(N):
d1 = maxi[i] - A[i]
d2 = A[i] - mini[i]
diff = max(diff, d1, d2)
a[d1] += 1
b[d2] += 1
print(min(a[diff], b[diff]))
if __name__ == '__main__':
main()
|
s423527268
|
p03486
|
u686036872
| 2,000
| 262,144
|
Wrong Answer
| 17
| 2,940
| 124
|
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 = str(input())
T = str(input())
S=sorted(S)
T=sorted(T, reverse=True)
if S < T:
print(S)
print(T)
print("Yes")
|
s997058842
|
Accepted
| 19
| 2,940
| 114
|
s = list(input())
t = list(input())
s.sort()
t.sort(reverse=True)
if s < t:
print("Yes")
else:
print("No")
|
s261067611
|
p03795
|
u143051858
| 2,000
| 262,144
|
Wrong Answer
| 17
| 2,940
| 44
|
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.
|
N = int(input())
print((N*800)-((N//15)*20))
|
s954635382
|
Accepted
| 17
| 2,940
| 46
|
N = int(input())
print((N*800)-((N//15)*200))
|
s497410413
|
p03105
|
u857130525
| 2,000
| 1,048,576
|
Wrong Answer
| 17
| 2,940
| 66
|
Takahashi likes the sound when he buys a drink from a vending machine. That sound can be heard by spending A yen (the currency of Japan) each time. Takahashi has B yen. He will hear the sound as many times as he can with that money, but at most C times, as he would be satisfied at that time. How many times will he hear the sound?
|
import sys
for line in sys.stdin:
print(line.strip().split())
|
s508978512
|
Accepted
| 17
| 3,060
| 198
|
import sys, math
stdout_write = sys.stdout.write
for line in sys.stdin:
a, b, c = (int(i) for i in line.strip().split())
ans = min(int(math.floor(b / a)), c)
stdout_write('{}\n'.format(ans))
|
s331276681
|
p03997
|
u604655161
| 2,000
| 262,144
|
Wrong Answer
| 18
| 2,940
| 153
|
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.
|
def ABC_45_A():
a = int(input())
b = int(input())
h = int(input())
print((a+b)*h/2)
if __name__ == '__main__':
ABC_45_A()
|
s417140183
|
Accepted
| 17
| 2,940
| 158
|
def ABC_45_A():
a = int(input())
b = int(input())
h = int(input())
print(int((a+b)*h/2))
if __name__ == '__main__':
ABC_45_A()
|
s545158401
|
p04011
|
u025595730
| 2,000
| 262,144
|
Wrong Answer
| 18
| 2,940
| 310
|
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.
|
# coding: utf-8
import sys
def main(argv=sys.argv):
char_list = input()
char_set = set(char_list)
for char in char_set:
if char_list.count(char) % 2 != 0:
print('No')
return 0
print('Yes')
return 0
if __name__ == '__main__':
sys.exit(main())
|
s036202445
|
Accepted
| 18
| 3,060
| 502
|
# coding: utf-8
import sys
def main(argv=sys.argv):
actual_stay = int(input())
init_stay = int(input())
init_charge = int(input())
extra_charge = int(input())
total_charge = 0
if actual_stay > init_stay:
total_charge = init_stay * init_charge + \
(actual_stay - init_stay) * extra_charge
else:
total_charge = actual_stay * init_charge
print(total_charge)
return 0
if __name__ == '__main__':
sys.exit(main())
|
s953258966
|
p00022
|
u744114948
| 1,000
| 131,072
|
Wrong Answer
| 50
| 6,720
| 152
|
Given a sequence of numbers a1, a2, a3, ..., an, find the maximum sum of a contiguous subsequence of those numbers. Note that, a subsequence of one element is also a _contiquous_ subsequence.
|
while True:
n=int(input())
if n == 0:
break
s=0
for _ in range(n):
i = int(input())
if i > 0: s+=i
print(s)
|
s603193025
|
Accepted
| 1,500
| 6,784
| 262
|
while True:
n=int(input())
if n == 0: break
ans=-1e100
l=[]
for _ in range(n):
l.append(int(input()))
for i in range(n):
s=0
for j in range(i,n):
s+=l[j]
if ans < s: ans = s
print(ans)
|
s876775480
|
p03852
|
u044952145
| 2,000
| 262,144
|
Wrong Answer
| 17
| 2,940
| 116
|
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`.
|
import sys
Input = sys.stdin.readline
c = Input()
print("vowel" if c in ["a", "e", "i", "o", "u"] else "consonant")
|
s405807334
|
Accepted
| 19
| 2,940
| 59
|
c = input()
print("vowel" if c in "aeiou" else "consonant")
|
s072782348
|
p02694
|
u206468988
| 2,000
| 1,048,576
|
Wrong Answer
| 23
| 9,208
| 422
|
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?
|
import math
target_yen = int(input())
years = 0
current_yen = 100
message = ""
while current_yen < target_yen:
years = years + 1
current_yen = math.floor(current_yen * 1.01)
if years > 0:
message = "あなたの預金額は " + str(years) + " 年後に " + str(target_yen) + " 円以上になります。"
else:
message = "あなたの預金額はすでに目標に達しています。"
print(message)
|
s173712683
|
Accepted
| 21
| 9,128
| 189
|
import math
target_yen = int(input())
years = 0
current_yen = 100
while current_yen < target_yen:
years = years + 1
current_yen = math.floor(current_yen * 1.01)
print(str(years))
|
s866851501
|
p02663
|
u701638736
| 2,000
| 1,048,576
|
Wrong Answer
| 21
| 9,196
| 169
|
In this problem, we use the 24-hour clock. Takahashi gets up exactly at the time H_1 : M_1 and goes to bed exactly at the time H_2 : M_2. (See Sample Inputs below for clarity.) He has decided to study for K consecutive minutes while he is up. What is the length of the period in which he can start studying?
|
h1,m1,h2,m2,k=input().split()
h1 = int(h1)
m1 = int(m1)
h2 = int(h2)
m2 = int(m2)
k = int(k)
if h1 > h2:
h2 += 24
h = h1 - h2
hm = h * 60
print(hm + m1 - m2 - k)
|
s431871153
|
Accepted
| 23
| 9,188
| 169
|
h1,m1,h2,m2,k=input().split()
h1 = int(h1)
m1 = int(m1)
h2 = int(h2)
m2 = int(m2)
k = int(k)
if h1 > h2:
h2 += 24
h = h2 - h1
hm = h * 60
print(hm - m1 + m2 - k)
|
s763869072
|
p03379
|
u130900604
| 2,000
| 262,144
|
Wrong Answer
| 2,105
| 25,228
| 132
|
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()))
for i in range(1,n):
tmp=x[:i-1]+x[i:]
#print(tmp)
print(tmp[(len(tmp)-1)//2])
|
s837153293
|
Accepted
| 292
| 25,220
| 117
|
n=int(input())
a=list(map(int,input().split()))
b=sorted(a)
p,q=b[n//2-1],b[n//2]
for i in a:print(p if i>=q else q)
|
s303209119
|
p03852
|
u617515020
| 2,000
| 262,144
|
Wrong Answer
| 17
| 3,060
| 375
|
Given a lowercase English letter c, determine whether it is a vowel. Here, there are five vowels in the English alphabet: `a`, `e`, `i`, `o` and `u`.
|
S = input()
while len(S) > 0:
if "dreameraser" in S:
S = S.replace("dreameraser","")
elif "dream" in S:
S = S.replace("dreamer","")
elif "dreamer" in S:
S = S.replace("dream","")
elif "erase" in S:
S = S.replace("eraser","")
elif "eraser" in S:
S = S.replace("erase","")
else:
break
if len(S) == 0:
print("YES")
else:
print("NO")
|
s266111553
|
Accepted
| 17
| 2,940
| 66
|
c = input()
if c in 'aeiou':print('vowel')
else:print('consonant')
|
s953188834
|
p02578
|
u956318161
| 2,000
| 1,048,576
|
Wrong Answer
| 173
| 32,372
| 194
|
N persons are standing in a row. The height of the i-th person from the front is A_i. We want to have each person stand on a stool of some heights - at least zero - so that the following condition is satisfied for every person: Condition: Nobody in front of the person is taller than the person. Here, the height of a person includes the stool. Find the minimum total height of the stools needed to meet this goal.
|
n=int(input())
a = list(map(int,input().split()))
step=[0]*n
for i in range(n-1):
step[i+1]+=a[i]+step[i]-a[i+1]
if step[i+1]<0:
step[i+1]=0
total=sum(step)
print(step)
print(total)
|
s647123471
|
Accepted
| 148
| 32,236
| 182
|
n=int(input())
a = list(map(int,input().split()))
step=[0]*n
for i in range(n-1):
step[i+1]+=a[i]+step[i]-a[i+1]
if step[i+1]<0:
step[i+1]=0
total=sum(step)
print(total)
|
s037600769
|
p03543
|
u219369949
| 2,000
| 262,144
|
Wrong Answer
| 17
| 2,940
| 100
|
We call a 4-digit integer with three or more consecutive same digits, such as 1118, **good**. You are given a 4-digit integer N. Answer the question: Is N **good**?
|
N = input()
if N[0] == N[1] == N[2] or N[2] == N[2] == N[3]:
print('YES')
else:
print('NO')
|
s520387061
|
Accepted
| 17
| 2,940
| 100
|
N = input()
if N[0] == N[1] == N[2] or N[1] == N[2] == N[3]:
print('Yes')
else:
print('No')
|
s847012000
|
p03486
|
u835283937
| 2,000
| 262,144
|
Wrong Answer
| 24
| 3,060
| 300
|
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.
|
def main():
s = list(input())
t = list(input())
s = sorted(s)
t = sorted(t)
print(s)
print(t)
shrt = False
for i in range(len(t)):
if s[0] < t[i]:
shrt = True
break
if shrt :
print("Yes")
else:
print("No")
main()
|
s341331983
|
Accepted
| 17
| 3,060
| 202
|
def main():
s = list(input())
t = list(input())
s = sorted(s)
t = sorted(t)
t = t[::-1]
if "".join(s) < "".join(t):
print("Yes")
else:
print("No")
main()
|
s003442518
|
p02410
|
u042885182
| 1,000
| 131,072
|
Wrong Answer
| 20
| 7,704
| 554
|
Write a program which reads a $ n \times m$ matrix $A$ and a $m \times 1$ vector $b$, and prints their product $Ab$. A column vector with m elements is represented by the following equation. \\[ b = \left( \begin{array}{c} b_1 \\\ b_2 \\\ : \\\ b_m \\\ \end{array} \right) \\] A $n \times m$ matrix with $m$ column vectors, each of which consists of $n$ elements, is represented by the following equation. \\[ A = \left( \begin{array}{cccc} a_{11} & a_{12} & ... & a_{1m} \\\ a_{21} & a_{22} & ... & a_{2m} \\\ : & : & : & : \\\ a_{n1} & a_{n2} & ... & a_{nm} \\\ \end{array} \right) \\] $i$-th element of a $m \times 1$ column vector $b$ is represented by $b_i$ ($i = 1, 2, ..., m$), and the element in $i$-th row and $j$-th column of a matrix $A$ is represented by $a_{ij}$ ($i = 1, 2, ..., n,$ $j = 1, 2, ..., m$). The product of a $n \times m$ matrix $A$ and a $m \times 1$ column vector $b$ is a $n \times 1$ column vector $c$, and $c_i$ is obtained by the following formula: \\[ c_i = \sum_{j=1}^m a_{ij}b_j = a_{i1}b_1 + a_{i2}b_2 + ... + a_{im}b_m \\]
|
# coding: utf-8
# Here your code !
def func():
try:
(n,m) = tuple( [ int(num) for num in input().rstrip().split(" ") ] )
matrix = [ [int(num) for num in input().rstrip().split(" ")] for i in range(n) ]
vector = [ int( input().rstrip() ) for i in range(m) ]
except:
return inputError()
result = [ sum( [i*j for i in matrix[k] for j in vector] ) for k in range(n) ]
for num in result:
print(num)
def inputError():
print("input error")
return -1
func()
|
s567780037
|
Accepted
| 30
| 7,972
| 557
|
# coding: utf-8
# Here your code !
def func():
try:
(n,m) = tuple( [ int(num) for num in input().rstrip().split(" ") ] )
matrix = [ [int(num) for num in input().rstrip().split(" ")] for i in range(n) ]
vector = [ int( input().rstrip() ) for i in range(m) ]
except:
return inputError()
result = [ sum( [ matrix[j][i]*vector[i] for i in range(m) ] ) for j in range(n) ]
for num in result:
print(num)
def inputError():
print("input error")
return -1
func()
|
s493629881
|
p02613
|
u038155726
| 2,000
| 1,048,576
|
Wrong Answer
| 154
| 16,160
| 418
|
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.
|
# B - Judge Status Summary
def main(n, s):
result_table = {
'AC': 0,
'WA': 0,
'TLE': 0,
'RE': 0
}
for i in s:
result_table[i] += 1
return result_table
if __name__ == "__main__":
n = int(input())
s = []
for i in range(n):
s.append(input())
results = main(n, s)
for key, value in results.items():
print(f"{key} × {value}")
|
s782942250
|
Accepted
| 151
| 16,244
| 417
|
# B - Judge Status Summary
def main(n, s):
result_table = {
'AC': 0,
'WA': 0,
'TLE': 0,
'RE': 0
}
for i in s:
result_table[i] += 1
return result_table
if __name__ == "__main__":
n = int(input())
s = []
for i in range(n):
s.append(input())
results = main(n, s)
for key, value in results.items():
print(f"{key} x {value}")
|
s776217813
|
p03470
|
u861966572
| 2,000
| 262,144
|
Wrong Answer
| 17
| 2,940
| 33
|
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 have a 3-layered kagami mochi; if you put just one mochi, you have a 1-layered kagami mochi. Lunlun the dachshund has N round mochi, and the diameter of the i-th mochi is d_i centimeters. When we make a kagami mochi using some or all of them, at most how many layers can our kagami mochi have?
|
n=input()
n=list(n)
print(len(n))
|
s133657344
|
Accepted
| 18
| 2,940
| 70
|
n=int(input())
print(len(list(set([int(input()) for x in range(n)]))))
|
s001331497
|
p03494
|
u983934702
| 2,000
| 262,144
|
Wrong Answer
| 19
| 3,060
| 193
|
There are N positive integers written on a blackboard: A_1, ..., A_N. Snuke can perform the following operation when all integers on the blackboard are even: * Replace each integer X on the blackboard by X divided by 2. Find the maximum possible number of operations that Snuke can perform.
|
n = int(input())
a = map(int,input().split())
ans = 0
count = 0
for i in a:
while i%2 ==0:
i /= 2
count += 1
if count > ans:
ans = count
count = 0
print(ans)
|
s426212258
|
Accepted
| 19
| 2,940
| 191
|
n = int(input())
a = map(int,input().split())
ap = list()
count = 0
for i in a:
while i%2 ==0:
i /= 2
count += 1
ap.append(count)
count = 0
print(min(ap))
|
s067737747
|
p02261
|
u500396695
| 1,000
| 131,072
|
Wrong Answer
| 20
| 7,732
| 597
|
Let's arrange a deck of cards. There are totally 36 cards of 4 suits(S, H, C, D) and 9 values (1, 2, ... 9). For example, 'eight of heart' is represented by H8 and 'one of diamonds' is represented by D1. Your task is to write a program which sorts a given set of cards in ascending order by their values using the Bubble Sort algorithms and the Selection Sort algorithm respectively. These algorithms should be based on the following pseudocode: BubbleSort(C) 1 for i = 0 to C.length-1 2 for j = C.length-1 downto i+1 3 if C[j].value < C[j-1].value 4 swap C[j] and C[j-1] SelectionSort(C) 1 for i = 0 to C.length-1 2 mini = i 3 for j = i to C.length-1 4 if C[j].value < C[mini].value 5 mini = j 6 swap C[i] and C[mini] Note that, indices for array elements are based on 0-origin. For each algorithm, report the stability of the output for the given input (instance). Here, 'stability of the output' means that: cards with the same value appear in the output in the same order as they do in the input (instance).
|
def BubbleSort(a, n):
for i in range(n):
for j in range(n-1, i, -1):
if int(a[j][1]) < int(a[j - 1][1]):
a[j], a[j-1] = a[j-1], a[j]
return a
def SelectionSort(a, n):
for i in range(n):
mini = i
for j in range(i, n):
if int(a[j][1]) < int(a[mini][1]):
mini = j
a[i], a[mini] = a[mini], a[i]
return a
n = int(input())
a = input().split()
b = a
a = BubbleSort(a, n)
b = SelectionSort(b, n)
print(*a)
print("Stable")
print(*b)
if a == b:
print("Stable")
else:
print("Not Stable")
|
s613453873
|
Accepted
| 40
| 7,756
| 605
|
def BubbleSort(a, n):
for i in range(n):
for j in range(n-1, i, -1):
if int(a[j][1]) < int(a[j - 1][1]):
a[j], a[j-1] = a[j-1], a[j]
return a
def SelectionSort(a, n):
for i in range(n):
mini = i
for j in range(i, n):
if int(a[j][1]) < int(a[mini][1]):
mini = j
a[i], a[mini] = a[mini], a[i]
return a
n = int(input())
a = input().split()
b = a[:]
a = BubbleSort(a, n)
b = SelectionSort(b, n)
print(*a)
print("Stable")
print(*b)
if a == b:
print("Stable")
else:
print("Not stable")
|
s553810939
|
p03110
|
u471684875
| 2,000
| 1,048,576
|
Wrong Answer
| 18
| 3,064
| 285
|
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` and u_1 = `JPY`, the otoshidama from the first relative is 10000 Japanese yen; if x_2 = `0.10000000` and u_2 = `BTC`, the otoshidama from the second relative is 0.1 bitcoins. If we convert the bitcoins into yen at the rate of 380000.0 JPY per 1.0 BTC, how much are the gifts worth in total?
|
n=int(input())
l=[[],[]]
for i in range(n):
a,b=map(str,input().split())
if b=='JPY':
l[0].append(float(a))
else:
l[1].append(float(a))
print(l)
ans=0
for i in l[0]:
ans+=i
for j in l[1]:
ans+=j*380000
print(ans)
|
s428081853
|
Accepted
| 17
| 3,064
| 276
|
n=int(input())
l=[[],[]]
for i in range(n):
a,b=map(str,input().split())
if b=='JPY':
l[0].append(float(a))
else:
l[1].append(float(a))
ans=0
for i in l[0]:
ans+=i
for j in l[1]:
ans+=j*380000
print(ans)
|
s678254393
|
p03493
|
u556215526
| 2,000
| 262,144
|
Wrong Answer
| 17
| 2,940
| 33
|
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 = input()
s.count('1')
print(s)
|
s919844277
|
Accepted
| 17
| 2,940
| 32
|
s = input()
print(s.count('1'))
|
s639384075
|
p02613
|
u201382544
| 2,000
| 1,048,576
|
Wrong Answer
| 176
| 16,152
| 354
|
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())
s = [""]*n
ac = 0
wa = 0
tle = 0
re = 0
for i in range(n):
s[i] = str(input())
if s[i] == "AC":
ac += 1
elif s[i] == "WA":
wa += 1
elif s[i] == "TLE":
tle += 1
else:
re += 1
print("AC × " + str(ac))
print("WA × " + str(wa))
print("TLE × " + str(tle))
print("RE × " + str(re))
|
s489421397
|
Accepted
| 172
| 16,172
| 350
|
n = int(input())
s = [""]*n
ac = 0
wa = 0
tle = 0
re = 0
for i in range(n):
s[i] = str(input())
if s[i] == "AC":
ac += 1
elif s[i] == "WA":
wa += 1
elif s[i] == "TLE":
tle += 1
else:
re += 1
print("AC x " + str(ac))
print("WA x " + str(wa))
print("TLE x " + str(tle))
print("RE x " + str(re))
|
s741896865
|
p04043
|
u806084713
| 2,000
| 262,144
|
Wrong Answer
| 17
| 2,940
| 152
|
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.
|
i = list(map(int, input().split()))
if 7 in i:
i.remove(7)
if i[0] == 5 and i[1] == 5:
print('Yes')
else:
print('No')
else:
print('No')
|
s225254286
|
Accepted
| 17
| 2,940
| 152
|
i = list(map(int, input().split()))
if 7 in i:
i.remove(7)
if i[0] == 5 and i[1] == 5:
print('YES')
else:
print('NO')
else:
print('NO')
|
s488337050
|
p03814
|
u181709987
| 2,000
| 262,144
|
Wrong Answer
| 72
| 8,840
| 207
|
Snuke has decided to construct a string that starts with `A` and ends with `Z`, by taking out a substring of a string s (that is, a consecutive part of s). Find the greatest length of the string Snuke can construct. Here, the test set guarantees that there always exists a substring of s that starts with `A` and ends with `Z`.
|
s = list(input())
cnt = 0
on = False
result = []
for a in s:
if a is 'A':
on = True
elif a is 'Z':
result.append(cnt)
cnt += 1
if on:
cnt += 1
print(max(result))
|
s625878839
|
Accepted
| 66
| 8,852
| 188
|
s = list(input())
cnt = 0
on = False
result = []
for a in s:
if a is 'A':
on = True
if on:
cnt += 1
if a is 'Z':
result.append(cnt)
print(max(result))
|
s204375149
|
p03494
|
u983181637
| 2,000
| 262,144
|
Wrong Answer
| 17
| 2,940
| 141
|
There are N positive integers written on a blackboard: A_1, ..., A_N. Snuke can perform the following operation when all integers on the blackboard are even: * Replace each integer X on the blackboard by X divided by 2. Find the maximum possible number of operations that Snuke can perform.
|
n = int(input())
a = [int(x) for x in input().split()]
ans = 0
for i in a:
if not i%2:
break
else:
ans += 1
print(ans)
|
s428313930
|
Accepted
| 150
| 12,444
| 149
|
import numpy as np
N = int(input())
A = np.array([int(x) for x in input().split()])
ans = 0
while np.all(A%2 == 0):
A = A/2
ans += 1
print(ans)
|
s287590594
|
p02613
|
u217303170
| 2,000
| 1,048,576
|
Wrong Answer
| 49
| 16,304
| 247
|
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.
|
import sys
input = sys.stdin.readline
n = int(input())
s = [input() for _ in range(n)]
print('AC x {}'.format(s.count('AC')))
print('WA x {}'.format(s.count('WA')))
print('TLE x {}'.format(s.count('TLE')))
print('RE x {}'.format(s.count('RE')))
|
s885506438
|
Accepted
| 141
| 16,288
| 208
|
n = int(input())
s = [input() for _ in range(n)]
print('AC x {}'.format(s.count('AC')))
print('WA x {}'.format(s.count('WA')))
print('TLE x {}'.format(s.count('TLE')))
print('RE x {}'.format(s.count('RE')))
|
s389564240
|
p02613
|
u448922807
| 2,000
| 1,048,576
|
Wrong Answer
| 159
| 16,124
| 319
|
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())
s = []
ac = 0
wa = 0
tle = 0
re = 0
for _ in range(n):
s.append(input())
for i in range(n):
if(s[i]=='AC'):
ac+=1
elif(s[i]=='WA'):
wa+=1
elif(s[i]=='TLE'):
tle+=1
else:
re+=1
print('AC ×',ac)
print('WA ×',wa)
print('TLE ×',tle)
print('RE ×',re)
|
s167672206
|
Accepted
| 163
| 16,140
| 315
|
n = int(input())
s = []
ac = 0
wa = 0
tle = 0
re = 0
for _ in range(n):
s.append(input())
for i in range(n):
if(s[i]=='AC'):
ac+=1
elif(s[i]=='WA'):
wa+=1
elif(s[i]=='TLE'):
tle+=1
else:
re+=1
print('AC x',ac)
print('WA x',wa)
print('TLE x',tle)
print('RE x',re)
|
s890074471
|
p02399
|
u229478139
| 1,000
| 131,072
|
Wrong Answer
| 20
| 5,604
| 135
|
Write a program which reads two integers a and b, and calculates the following values: * a ÷ b: d (in integer) * remainder of a ÷ b: r (in integer) * a ÷ b: f (in real number)
|
def division(a,b):
print("{} {} {}".format(a // b, a % b, 3 /2))
tmp=list(map(int,input().split()))
division(tmp[0], tmp[1])
|
s755820956
|
Accepted
| 20
| 5,600
| 91
|
a, b = list(map(int, input().split()))
print('{} {} {:.5f}'.format(a // b, a % b, a / b))
|
s307905005
|
p03625
|
u086503932
| 2,000
| 262,144
|
Wrong Answer
| 139
| 22,436
| 216
|
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.
|
from collections import Counter
N = int(input())
A = list(map(int, input().split()))
l = sorted(Counter(A).items(), key=lambda x:x[0],reverse=True)
#print(l)
if l[1][1] < 2:
print(0)
else:
print(l[0][0]*l[1][0])
|
s049813363
|
Accepted
| 100
| 18,600
| 270
|
from collections import Counter
N = int(input())
A = list(map(int, input().split()))
c = Counter(A)
l = sorted(filter(lambda x:x[1] > 1,c.items()),reverse=True)
if len(l) == 0:
print(0)
else:
if l[0][1] >= 4:
print(l[0][0]**2)
else:
print(l[0][0]*l[1][0])
|
s014851052
|
p02743
|
u323045245
| 2,000
| 1,048,576
|
Wrong Answer
| 17
| 2,940
| 167
|
Does \sqrt{a} + \sqrt{b} < \sqrt{c} hold?
|
import math
a, b, c = map(int, input().split())
A, B, C = math.sqrt(a), math.sqrt(b), math.sqrt(c)
print(A, B, C)
if a + b < c:
print("Yes")
else:
print("No")
|
s873126126
|
Accepted
| 17
| 2,940
| 311
|
a, b, c = map(int, input().split())
if c > a+b and 4*a*b < (c-a-b)**2:
print("Yes")
else:
print("No")
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.