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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s411607127 | p03644 | u790877102 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 77 | 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())
a = 0
while N%(2**a)==0:
a += 1
b = 2**(a-1)
print(b) | s060038973 | Accepted | 21 | 3,444 | 72 | import math
N = int(input())
M = math.floor(math.log2(N))
print(2**M) |
s977999044 | p03543 | u203995947 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 127 | 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 = list(input())
print(n)
if n[1] != n[2]:
print('No')
elif n[0] == n[1] or n[2] == n[3]:
print('Yes')
else:
print('No') | s705429025 | Accepted | 17 | 2,940 | 128 | n = list(input())
#print(n)
if n[1] != n[2]:
print('No')
elif n[0] == n[1] or n[2] == n[3]:
print('Yes')
else:
print('No') |
s862620787 | p03719 | u708211626 | 2,000 | 262,144 | Wrong Answer | 27 | 9,144 | 101 | You are given three integers A, B and C. Determine whether C is not less than A and not greater than B. | a=list(map(int,input().split()))
if a[2]>=a[0] and a[2]<=a[1]:
print('YES')
else:
print('NO') | s628556772 | Accepted | 28 | 9,144 | 105 | a=list(map(int,input().split()))
if (a[2]>=a[0]) and (a[2]<=a[1]):
print('Yes')
else:
print('No') |
s944056482 | p03434 | u602158689 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 268 | 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())
alice = 0
bob = 0
cards = [int(val) for val in input().split()]
cards = sorted(cards, reverse=True)
print(cards)
for i in range(n):
if i % 2 == 0:
alice += int(cards[i])
else:
bob += int(cards[i])
print(alice - bob) | s341894914 | Accepted | 17 | 3,060 | 226 | n = int(input())
a,b = 0,0
cards = [int(val) for val in input().split()]
cards = sorted(cards, reverse=True)
for i in range(n):
if i % 2 == 0:
a += cards[i]
else:
b += cards[i]
print(a - b) |
s275170279 | p02613 | u304590784 | 2,000 | 1,048,576 | Wrong Answer | 137 | 16,288 | 194 | 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())
S = [input() for i in range(N)]
print("AC × "+str( S.count("AC")))
print("WA × "+str( S.count("WA")))
print("TLE × "+str( S.count("TLE")))
print("RE × "+str( S.count("RE"))) | s156505191 | Accepted | 144 | 16,220 | 190 | N = int(input())
S = [input() for i in range(N)]
print("AC x "+str( S.count("AC")))
print("WA x "+str( S.count("WA")))
print("TLE x "+str( S.count("TLE")))
print("RE x "+str( S.count("RE"))) |
s624222019 | p03606 | u136090046 | 2,000 | 262,144 | Wrong Answer | 19 | 3,316 | 243 | Joisino is working as a receptionist at a theater. The theater has 100000 seats, numbered from 1 to 100000. According to her memo, N groups of audiences have come so far, and the i-th group occupies the consecutive seats from Seat l_i to Seat r_i (inclusive). How many people are sitting at the theater now? |
value = int(input())
seat_list = []
people = 0
while True:
try:
seat = input()
seat_list.append(seat.split(" "))
except EOFError:
break
def aaa(seat_list, people):
people = seat_list[len(seat_list)-1] - seat_list[0]
print(people)
| s606517915 | Accepted | 20 | 3,060 | 110 | n = int(input())
cnt = 0
for i in range(n):
l, r = map(int, input().split())
cnt += (r-l+1)
print(cnt) |
s716679984 | p03438 | u619819312 | 2,000 | 262,144 | Wrong Answer | 28 | 4,596 | 300 | You are given two integer sequences of length N: a_1,a_2,..,a_N and b_1,b_2,..,b_N. Determine if we can repeat the following operation zero or more times so that the sequences a and b become equal. Operation: Choose two integers i and j (possibly the same) between 1 and N (inclusive), then perform the following two ac... | n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=0
d=0
for i in range(n):
if b[i]<a[i]:
d+=b[i]-a[i]
else:
k=b[i]-a[i]
if k%2==1:
d+=1
c+=(k+1)//2
else:
c+=k//2
print("Yes" if d>=c else"No") | s078957168 | Accepted | 29 | 4,596 | 301 | n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=0
d=0
for i in range(n):
if b[i]<=a[i]:
d+=a[i]-b[i]
else:
k=b[i]-a[i]
if k%2==1:
d+=1
c+=(k+1)//2
else:
c+=k//2
print("Yes" if c>=d else"No") |
s660741282 | p03673 | u839857256 | 2,000 | 262,144 | Wrong Answer | 2,108 | 26,020 | 200 | You are given an integer sequence of length n, a_1, ..., a_n. Let us consider performing the following n operations on an empty sequence b. The i-th operation is as follows: 1. Append a_i to the end of b. 2. Reverse the order of the elements in b. Find the sequence b obtained after these n operations. | n = int(input())
n_list = list(map(int, input().split()))
new_list = []
for i in range(n):
tmp = int(n_list[0])
n_list.pop(0)
new_list.append(tmp)
new_list.reverse()
print(new_list)
| s304503678 | Accepted | 161 | 30,660 | 415 | from collections import deque
n = int(input())
a_list = list(map(int, input().split()))
q = deque([])
if n%2 == 0:
for i in range(n):
if i%2 == 0:
q.append(a_list[i])
else:
q.appendleft(a_list[i])
else:
for i in range(n):
if i%2 == 1:
q.append(a_list[... |
s481346288 | p03338 | u172873334 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,064 | 219 | You are given a string S of length N consisting of lowercase English letters. We will cut this string at one position into two strings X and Y. Here, we would like to maximize the number of different letters contained in both X and Y. Find the largest possible number of different letters contained in both X and Y when ... | alpha = [chr(i) for i in range(97,97 + 26)]
def Count(s,t):
ret = 0
for i in alpha:
if i in s and i in t:ret+=1
return ret
n = int(input())
s = input()
ans = 0
for i in range(1,n):
print(s[:i],s[i:])
print(ans) | s645351200 | Accepted | 18 | 3,064 | 234 | alpha = [chr(i) for i in range(97,97 + 26)]
def Count(s,t):
ret = 0
for i in alpha:
if i in s and i in t:ret+=1
return ret
n = int(input())
s = input()
ans = 0
for i in range(1,n):
ans = max(ans,Count(s[:i],s[i:]))
print(ans) |
s964209386 | p03605 | u734485933 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 83 | It is September 9 in Japan now. You are given a two-digit integer N. Answer the question: Is 9 contained in the decimal notation of N? | s = input()
pos = s.find('9')
if pos != -1:
print("YES")
else:
print("NO")
| s323080794 | Accepted | 17 | 2,940 | 83 | s = input()
pos = s.find('9')
if pos != -1:
print("Yes")
else:
print("No")
|
s953576678 | p03455 | u371702445 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 87 | AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd. | a, b = [int(x) for x in input().split()]
c = a * b
print("Yes" if c % 2 == 0 else "No") | s595938342 | Accepted | 17 | 2,940 | 89 | a, b = [int(x) for x in input().split()]
c = a * b
print("Even" if c % 2 == 0 else "Odd") |
s223728136 | p03478 | u808259266 | 2,000 | 262,144 | Wrong Answer | 37 | 3,060 | 144 | Find the sum of the integers between 1 and N (inclusive), whose sum of digits written in base 10 is between A and B (inclusive). | n, a, b = map(int, input().split())
ans = 0
for i in range(n):
if a <= sum(list(map(int, list(str(i+1))))) <= b:
ans += 1
print(ans) | s499086683 | Accepted | 37 | 3,060 | 144 | n, a, b = map(int, input().split())
ans = 0
for i in range(n+1):
if a <= sum(list(map(int, list(str(i))))) <= b:
ans += i
print(ans) |
s004989911 | p03337 | u341543478 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 58 | You are given two integers A and B. Find the largest value among A+B, A-B and A \times B. | a, b = map(int, input().split())
max(a + b, a - b, a * b)
| s170415572 | Accepted | 17 | 2,940 | 65 | a, b = map(int, input().split())
print(max(a + b, a - b, a * b))
|
s598789668 | p03140 | u550943777 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,060 | 237 | You are given three strings A, B and C. Each of these is a string of length N consisting of lowercase English letters. Our objective is to make all these three strings equal. For that, you can repeatedly perform the following operation: * Operation: Choose one of the strings A, B and C, and specify an integer i bet... | n = int(input())
a = input()
b = input()
c = input()
count = 0
for i in range(n):
if a[i] == b[i] and b[i] == c[i]:
continue
elif a[i] == b[i] or b[i] == c[i]:
count += 1
else:
count += 2
print(count)
| s616655739 | Accepted | 17 | 3,060 | 252 | n = int(input())
a = input()
b = input()
c = input()
count = 0
for i in range(n):
if a[i] == b[i] and b[i] == c[i]:
continue
elif a[i] == b[i] or b[i] == c[i] or a[i] == c[i]:
count += 1
else:
count += 2
print(count) |
s743812310 | p03861 | u027675217 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 62 | 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())
ans=(b-a+1)/x
print(round(ans)) | s562266973 | Accepted | 17 | 2,940 | 76 | a,b,x=map(int,input().split())
ans_a=(a-1)//x
ans_b=b//x
print(ans_b-ans_a)
|
s321675133 | p03456 | u674588203 | 2,000 | 262,144 | Wrong Answer | 18 | 3,188 | 122 | AtCoDeer the deer has found two positive integers, a and b. Determine whether the concatenation of a and b in this order is a square number. | a,b=map(str,input().split())
num=int(a+b)
print(num)
ans=num**0.5
if ans//1==ans:
print('Yes')
else:
print('No') | s243881504 | Accepted | 17 | 2,940 | 116 | a,b=map(str,input().split())
num=int(a+b)
ans=num**0.5
if (ans//1)**2==num:
print('Yes')
else:
print('No') |
s423859812 | p03471 | u405832869 | 2,000 | 262,144 | Wrong Answer | 761 | 3,064 | 254 | 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 = 0
for a in range(N+1):
for b in range(N+1-a):
c = N-a-b
if a*10000+b*5000+c*1000 == Y:
z = a
y = b
x = c
ans = 1
break
if ans == 1:
print(x,y,z)
else:
print(-1,-1,-1) | s495492115 | Accepted | 776 | 3,064 | 254 | N,Y = map(int,input().split())
ans = 0
for a in range(N+1):
for b in range(N+1-a):
c = N-a-b
if a*10000+b*5000+c*1000 == Y:
z = a
y = b
x = c
ans = 1
break
if ans == 1:
print(z,y,x)
else:
print(-1,-1,-1) |
s127103004 | p03555 | u278143034 | 2,000 | 262,144 | Wrong Answer | 28 | 9,076 | 277 | You are given a grid with 2 rows and 3 columns of squares. The color of the square at the i-th row and j-th column is represented by the character C_{ij}. Write a program that prints `YES` if this grid remains the same when rotated 180 degrees, and prints `NO` otherwise. |
C1 = str(input())
C2 = str(input())
ori_str = C1 + C2
rev_str = ori_str[-1::-1]
if ori_str == rev_str:
print("Yes")
else:
print("No")
| s167958170 | Accepted | 30 | 9,000 | 277 |
C1 = str(input())
C2 = str(input())
ori_str = C1 + C2
rev_str = ori_str[-1::-1]
if ori_str == rev_str:
print("YES")
else:
print("NO")
|
s058139683 | p03475 | u047197186 | 3,000 | 262,144 | Wrong Answer | 84 | 3,064 | 322 | A railroad running from west to east in Atcoder Kingdom is now complete. There are N stations on the railroad, numbered 1 through N from west to east. Tomorrow, the opening ceremony of the railroad will take place. On this railroad, for each integer i such that 1≤i≤N-1, there will be trains that run from Station i t... | n = int(input())
res = [0] * n
for i in range(1, n):
c, s, f = map(int, input().split())
res[i-1] += s + c
for j in range(i-1):
if res[j] < s:
res[j] = s + c
elif res[j] == s:
res[j] += c
else:
if (res[j] - s) % f == 0:
res[j] += c
else:
res[j] += f + c
print(re... | s078360143 | Accepted | 107 | 3,064 | 373 | n = int(input())
res = [0] * n
for i in range(1, n):
c, s, f = map(int, input().split())
res[i-1] += s + c
for j in range(i-1):
if res[j] < s:
res[j] = s + c
elif res[j] == s:
res[j] += c
else:
if (res[j] - s) % f == 0:
res[j] += c
else:
res[j] = s + (((res[j] -... |
s628930874 | p03474 | u794910686 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 141 | 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].isdecimal()==True and s[-b:]==True and s[a]=='-':
print("Yes")
else:
print("No") | s671285478 | Accepted | 17 | 2,940 | 197 | a,b=map(int,input().split())
s=input()
if 1<=a<=5 and 1<=b<=5:
if s[a]=="-":
if s[0:a].isdecimal() and s[a+1:a+b+1].isdecimal():
print("Yes")
exit()
print("No")
|
s098360747 | p03568 | u103902792 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 162 | We will say that two integer sequences of length N, x_1, x_2, ..., x_N and y_1, y_2, ..., y_N, are _similar_ when |x_i - y_i| \leq 1 holds for all i (1 \leq i \leq N). In particular, any integer sequence is similar to itself. You are given an integer N and an integer sequence of length N, A_1, A_2, ..., A_N. How man... | n = int(input())
A = list(map(int,input().split()))
even = odd = 0
for a in A:
if a%2:
odd += 1
else:
even += 1
print(3**n - (odd+(even*2)**n)) | s588296033 | Accepted | 17 | 2,940 | 154 | n = int(input())
A = list(map(int,input().split()))
even = odd = 0
for a in A:
if a%2:
odd += 1
else:
even += 1
print(3**n - 2**even)
|
s856218283 | p03556 | u835482198 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 38 | Find the largest square number not exceeding N. Here, a _square number_ is an integer that can be represented as the square of an integer. | n = int(input())
print(int(n ** 0.5))
| s075257427 | Accepted | 17 | 2,940 | 43 | n = int(input())
print(int(n ** 0.5) ** 2)
|
s166846640 | p03999 | u521696407 | 2,000 | 262,144 | Wrong Answer | 25 | 3,060 | 453 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. ... | import itertools
def sum_strlong(strlong):
ans = int(strlong)
for i in range(1, len(strlong)):
for comb in itertools.combinations(range(len(strlong)-1), i):
integer = ''
for j, digit in enumerate(strlong):
integer += digit
if j in comb:
... | s819525342 | Accepted | 25 | 3,060 | 448 | import itertools
def sum_strlong(strlong):
ans = int(strlong)
for i in range(1, len(strlong)):
for comb in itertools.combinations(range(len(strlong)-1), i):
integer = ''
for j, digit in enumerate(strlong):
integer += digit
if j in comb:
... |
s178327913 | p03457 | u400596590 | 2,000 | 262,144 | Wrong Answer | 313 | 3,060 | 154 | 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... | n = int(input())
for i in range(n):
t, x, y = map(int, input().split())
if x+y>t or (x+y-t)%2 !=0:
print('NO')
exit()
print('YES') | s174307773 | Accepted | 320 | 3,060 | 154 | n = int(input())
for i in range(n):
t, x, y = map(int, input().split())
if x+y>t or (x+y-t)%2 ==1:
print('No')
exit()
print('Yes') |
s938366292 | p03564 | u417798683 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 214 | Square1001 has seen an electric bulletin board displaying the integer 1. He can perform the following operations A and B to change this value: * Operation A: The displayed value is doubled. * Operation B: The displayed value increases by K. Square1001 needs to perform these operations N times in total. Find the m... | def bin(a):
return 2*a
def ten(a):
return a+10
N = int(input())
K = int(input())
value = 1
for i in range(N):
if bin(value) <= ten(value) :
value = bin(value)
else:
value = ten(value)
print(value) | s308799827 | Accepted | 18 | 3,060 | 213 | def bin(a):
return 2*a
def ten(a):
return a+K
N = int(input())
K = int(input())
value = 1
for i in range(N):
if bin(value) <= ten(value) :
value = bin(value)
else:
value = ten(value)
print(value) |
s280492310 | p03110 | u033606236 | 2,000 | 1,048,576 | Wrong Answer | 18 | 3,188 | 228 | 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())
result= 0
a = [input().split() for _ in range(n)]
print(float(a[1][0]))
for i in range(n):
if "JPY" in a[i]:
result += float(a[i][0])
else:
result += float(a[i][0]) * 380000
print(result) | s187606138 | Accepted | 19 | 3,060 | 149 | n = int(input())
result = 0
for i in range(n):
x,y = input().split()
if y == "BTC":x = float(x) * 380000
result += float(x)
print(result) |
s730654242 | p00006 | u071010747 | 1,000 | 131,072 | Wrong Answer | 30 | 7,392 | 171 | Write a program which reverses a given string str. | def main():
while True:
try:
IN=input()
if IN=='':
break
print(IN[::-1])
except:
break | s813130997 | Accepted | 20 | 7,296 | 26 | IN=input()
print(IN[::-1]) |
s288918350 | p03555 | u093033848 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 124 | You are given a grid with 2 rows and 3 columns of squares. The color of the square at the i-th row and j-th column is represented by the character C_{ij}. Write a program that prints `YES` if this grid remains the same when rotated 180 degrees, and prints `NO` otherwise. | c1 = input()
c2 = input()
if c1[0] == c2[2] and c1[1] == c2[1] and c1[2] == c2[0] :
print("Yes")
else :
print("No") | s375880879 | Accepted | 18 | 2,940 | 124 | c1 = input()
c2 = input()
if c1[0] == c2[2] and c1[1] == c2[1] and c1[2] == c2[0] :
print("YES")
else :
print("NO") |
s447862250 | p03399 | u518556834 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 69 | You planned a trip using trains and buses. The train fare will be A yen (the currency of Japan) if you buy ordinary tickets along the way, and B yen if you buy an unlimited ticket. Similarly, the bus fare will be C yen if you buy ordinary tickets along the way, and D yen if you buy an unlimited ticket. Find the minimu... | s = [input() for i in range(4)]
print(min(s[0],s[1])+min(s[2],s[3]))
| s773206553 | Accepted | 17 | 2,940 | 92 | a = int(input())
b = int(input())
c = int(input())
d = int(input())
print(min(a,b)+min(c,d)) |
s903021633 | p03131 | u858428199 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,060 | 167 | Snuke has one biscuit and zero Japanese yen (the currency) in his pocket. He will perform the following operations exactly K times in total, in the order he likes: * Hit his pocket, which magically increases the number of biscuits by one. * Exchange A biscuits to 1 yen. * Exchange 1 yen to B biscuits. Find the ... | k,a,b = map(int, input().split())
ans1 = k + 1
ans2 = (k + 1) // (a + 2)
print(ans2)
ans2 *= b
print(ans2)
ans2 += (k + 1) % (a + 2)
print(ans2)
print(max(ans1,ans2)) | s438139671 | Accepted | 17 | 2,940 | 140 | k,a,b = map(int, input().split())
ans1 = k+1
cnt = (k-(a-1)) // 2
mod = (k-(a-1)) % 2
ans2 = cnt * (b - a) + a + mod
print(max(ans1,ans2)) |
s148336356 | p03997 | u749770850 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 113 | 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()) for _ in range(3)]
if a[0] == a[1]:
print(a[0] ** 2)
else:
print((a[0] + a[1]) * a[2] / 2)
| s513798411 | Accepted | 17 | 2,940 | 76 | a = [int(input()) for _ in range(3)]
print(int((a[0] + a[1]) * a[2] / 2))
|
s039569358 | p02416 | u966110132 | 1,000 | 131,072 | Wrong Answer | 20 | 5,600 | 327 | Write a program which reads an integer and prints sum of its digits. | a = int(input())
alist = []
if a/1000 >=1:
alist.append(int(a/1000))
if (a-int(a/1000)*1000) / 100 >= 1:
alist.append(int((a-int(a/1000)*1000) / 100))
if (a-int(a/100)) / 10 >= 1:
alist.append(int((a-(int(a/100)*100)) / 10))
alist.append(a-(int(a/10)*10))
a2 = 0
for i in alist:
a2 += i
print(i)
pri... | s574642041 | Accepted | 20 | 5,604 | 211 | go = 1
while go == 1:
a = str(input())
alist = list(a)
if a == "0":
go = 0
exit
sum = 0
for i in alist:
i = int(i)
sum += i
if go == 1:
print(sum)
|
s299921707 | p03110 | u788137651 | 2,000 | 1,048,576 | Wrong Answer | 18 | 2,940 | 201 | 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())
yen = []
for i in range(N):
xi, ui = input().split()
xi = float(xi)
if ui == "BTC":
ui = 380000
else:
ui = 1
yen.append(xi*ui)
print(int(sum(yen)))
| s557194346 | Accepted | 17 | 2,940 | 196 | N = int(input())
yen = []
for i in range(N):
xi, ui = input().split()
xi = float(xi)
if ui == "BTC":
ui = 380000
else:
ui = 1
yen.append(xi*ui)
print(sum(yen))
|
s673504504 | p02618 | u583285098 | 2,000 | 1,048,576 | Wrong Answer | 139 | 27,580 | 381 | AtCoder currently hosts three types of contests: ABC, ARC, and AGC. As the number of users has grown, in order to meet the needs of more users, AtCoder has decided to increase the number of contests to 26 types, from AAC to AZC. For convenience, we number these 26 types as type 1 through type 26. AtCoder wants to sched... | import numpy as np
D = int(input())
c = np.array(list(map(int, input().split())))
s = [list(map(int, input().split())) for _ in range(D)]
last_d = np.array([0]*len(c))
ans = 0
for i in range(D):
cc = c*(last_d+i+1)
max_c = max(cc)
index = np.argmax(cc)
print(index + 1)
last_d[index] = -(i+1)
ans += s[i][i... | s750930236 | Accepted | 136 | 27,644 | 504 | import numpy as np
D = int(input())
c = np.array(list(map(int, input().split())))
s = [list(map(int, input().split())) for _ in range(D)]
last_d = np.array([0] * len(c))
ans = 0
for i in range(D):
cc = c * (last_d + i + 1)
most = 0
index = 0
for j in range(len(c)):
tmp = s[i][j] + cc[j]*(D-i-1)... |
s741226565 | p03448 | u390793752 | 2,000 | 262,144 | Wrong Answer | 45 | 3,064 | 480 | You have A 500-yen coins, B 100-yen coins and C 50-yen coins (yen is the currency of Japan). In how many ways can we select some of these coins so that they are X yen in total? Coins of the same kind cannot be distinguished. Two ways to select coins are distinguished when, for some kind of coin, the numbers of that co... |
def coins():
fivehund = int(input())
onehund = int(input())
fifty = int(input())
target = int(input())
result_count = 0
for count500 in range(0,fivehund):
for count100 in range(0,onehund):
for count50 in range(0,fifty):
current = 500*count500 + 100*count100... | s614790179 | Accepted | 44 | 3,064 | 486 |
def coins():
fivehund = int(input())
onehund = int(input())
fifty = int(input())
target = int(input())
result_count = 0
for count500 in range(0,fivehund+1):
for count100 in range(0,onehund+1):
for count50 in range(0,fifty+1):
current = 500*count500 + 100*co... |
s842396216 | p03455 | u255943004 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 101 | AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd. | N = [int(i) for i in input().split()]
if N[0]%2==1 or N[1]%2==1:
print("Odd")
else:
print("Even") | s699067789 | Accepted | 17 | 2,940 | 102 | N = [int(i) for i in input().split()]
if N[0]%2==1 and N[1]%2==1:
print("Odd")
else:
print("Even") |
s665388782 | p03719 | u692632484 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 112 | You are given three integers A, B and C. Determine whether C is not less than A and not greater than B. | temp=input().split()
A=int(temp[0])
B=int(temp[1])
C=int(temp[2])
if(A<=B<=C):
print("Yes")
else:
print("No") | s858908336 | Accepted | 17 | 3,060 | 112 | temp=input().split()
A=int(temp[0])
B=int(temp[1])
C=int(temp[2])
if(A<=C<=B):
print("Yes")
else:
print("No") |
s068151679 | p03635 | u860002137 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 45 | In _K-city_ , there are n streets running east-west, and m streets running north-south. Each street running east-west and each street running north-south cross each other. We will call the smallest area that is surrounded by four streets a block. How many blocks there are in K-city? | n, m = map(int, input().split())
print(n * m) | s399795326 | Accepted | 17 | 2,940 | 57 | n, m = map(int, input().split())
print((n - 1) * (m - 1)) |
s059279341 | p03494 | u113255362 | 2,000 | 262,144 | Time Limit Exceeded | 2,205 | 9,080 | 202 | 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())
List = list(map(int, input().split()))
flag = True
res = 0
while flag:
for i in range(N):
if List[i] & 2 == 1:
flag = False
break
if not flag:
res += 1
print(res) | s151348591 | Accepted | 31 | 9,064 | 235 | N =int(input())
List = list(map(int, input().split()))
flag = True
res = 0
while flag:
for i in range(N):
if List[i] % 2 == 1:
flag = False
break
else:
List[i] = List[i]//2
if flag:
res += 1
print(res) |
s090944047 | p03494 | u626468554 | 2,000 | 262,144 | Time Limit Exceeded | 2,104 | 2,940 | 184 | 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 = list(map(int,input().split()))
cnt = 0
for i in range(n):
memo = 0
while(a[i]%2==0):
a[i]%=2
memo += 1
cnt = max(memo,cnt)
print(cnt)
| s920344181 | Accepted | 21 | 3,060 | 188 | n = int(input())
a = list(map(int,input().split()))
cnt = 10**10
for i in range(n):
memo = 0
while(a[i]%2==0):
a[i]/=2
memo += 1
cnt = min(memo,cnt)
print(cnt) |
s185991979 | p03131 | u908662255 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,060 | 583 | Snuke has one biscuit and zero Japanese yen (the currency) in his pocket. He will perform the following operations exactly K times in total, in the order he likes: * Hit his pocket, which magically increases the number of biscuits by one. * Exchange A biscuits to 1 yen. * Exchange 1 yen to B biscuits. Find the ... | k, a, b = [int(i) for i in input().split()]
sum = 0
if a >= b:
sum = k + 1
else:
diff = b - a
if diff == 1:
sum = k + 1
elif diff == 2:
sum = k + 1
else:
print("a")
k = 1 + k - a
if k % 2 == 0:
sum = a + ((diff) * (k / 2))
... | s125218044 | Accepted | 18 | 3,064 | 1,018 | k, a, b = [int(i) for i in input().split()]
sum = 0
if a >= b:
sum = k + 1
else:
diff = b - a
if diff == 1:
sum = k + 1
elif diff == 2:
sum = k + 1
elif diff >= 3:
rest = 1 + k - a
# print("K:{}".format(rest))
if rest >= 0:
... |
s209955512 | p03485 | u835482198 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 61 | 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(int((a + b - 1) / 2))
| s759302736 | Accepted | 17 | 2,940 | 64 | a, b = map(int, input().split())
print(int((a + b + 2 - 1) / 2)) |
s716627556 | p03067 | u864273141 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 100 | There are three houses on a number line: House 1, 2 and 3, with coordinates A, B and C, respectively. Print `Yes` if we pass the coordinate of House 3 on the straight way from House 1 to House 2 without making a detour, and print `No` otherwise. | a,b,c=map(int,input().split())
if (a<c and c<b) or (a>c and c>b):
print("yes")
else:
print("no") | s433047998 | Accepted | 17 | 2,940 | 100 | a,b,c=map(int,input().split())
if (a<c and c<b) or (a>c and c>b):
print("Yes")
else:
print("No") |
s170582449 | p03673 | u077003677 | 2,000 | 262,144 | Wrong Answer | 2,109 | 26,020 | 424 | You are given an integer sequence of length n, a_1, ..., a_n. Let us consider performing the following n operations on an empty sequence b. The i-th operation is as follows: 1. Append a_i to the end of b. 2. Reverse the order of the elements in b. Find the sequence b obtained after these n operations. | import sys
import os
def file_input():
f = open('ABC066/input.txt', 'r')
sys.stdin = f
def main():
#file_input()
n=int(input())
a=list(map(int, input().split()))
out=[]
for i in range(n):
if i%2==0:
out.append(str(a[i]))
else:
out.insert(0,str(a[i]... | s847174963 | Accepted | 230 | 31,268 | 430 | import sys
import os
def file_input():
f = open('ABC066/input.txt', 'r')
sys.stdin = f
def main():
#file_input()
n=int(input())
a=list(map(int, input().split()))
out=[""]*n
for i in range(n):
if i%2==0:
out[n//2+i//2]=str(a[i])
else:
out[n//2-(-(-i... |
s001431315 | p03546 | u309141201 | 2,000 | 262,144 | Wrong Answer | 310 | 19,308 | 448 | 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... | from scipy.sparse.csgraph import floyd_warshall
H, W = map(int, input().split())
c = [list(map(int, input().split())) for _ in range(10)]
A = [list(map(int, input().split())) for _ in range(H)]
ans = 0
# print(*c, sep='\n')
# print(*A, sep='\n')
cost = floyd_warshall(c)
# print(*cost, sep='\n')
for i in range(H):
f... | s231621836 | Accepted | 316 | 17,848 | 453 | from scipy.sparse.csgraph import floyd_warshall
H, W = map(int, input().split())
c = [list(map(int, input().split())) for _ in range(10)]
A = [list(map(int, input().split())) for _ in range(H)]
ans = 0
# print(*c, sep='\n')
# print(*A, sep='\n')
cost = floyd_warshall(c)
# print(*cost, sep='\n')
for i in range(H):
f... |
s392410427 | p03387 | u487594898 | 2,000 | 262,144 | Wrong Answer | 149 | 12,396 | 183 | You are given three integers A, B and C. Find the minimum number of operations required to make A, B and C all equal by repeatedly performing the following two kinds of operations in any order: * Choose two among A, B and C, then increase both by 1. * Choose one among A, B and C, then increase it by 2. It can be ... | import numpy as np
A =np.array(sorted(list(map(int,input().split()))))
a = max(A)
b = a -A
print(A,a,b)
if abs(b[1]-b[0]) %2 == 0:
print(sum(b)//2)
else :
print(sum(b)//2 + 1) | s406673437 | Accepted | 149 | 12,396 | 173 | import numpy as np
A =np.array(sorted(list(map(int,input().split()))))
a = max(A)
b = a -A
if abs(b[1]-b[0]) %2 == 0:
print(sum(b)//2)
else :
print(sum(b)//2 + 2)
|
s804934162 | p03721 | u593063683 | 2,000 | 262,144 | Wrong Answer | 2,117 | 172,636 | 213 | There is an empty array. The following N operations will be performed to insert integers into the array. In the i-th operation (1≤i≤N), b_i copies of an integer a_i are inserted into the array. Find the K-th smallest integer in the array after the N operations. For example, the 4-th smallest integer in the array \\{1,2... | import numpy as np
N, K = [int(x) for x in input().split()]
list = []
for i in range(N):
a,b = [int(x) for x in input().split()]
for j in range(b): list.append(a)
list.sort()
print(list)
print(list[K-1])
| s453945367 | Accepted | 623 | 29,156 | 361 | import numpy as np
N, K = [int(x) for x in input().split()]
list = []
for i in range(N):
a,b = [int(x) for x in input().split()]
list.append([a, b])
list.sort()
#print(list)
nth = 0
for i in range(N):
a,b = list[i]
nth += b
if K<=nth:
break
# elif nth==K:
# a,b = list[i-1]
# ... |
s434005987 | p03417 | u940102677 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 108 | There is a grid with infinitely many rows and columns. In this grid, there is a rectangular region with consecutive N rows and M columns, and a card is placed in each square in this region. The front and back sides of these cards can be distinguished, and initially every card faces up. We will perform the following op... | n,m = map(int, input().split())
if n == 1:
s = abs(m-2)
elif m == 1:
s = abs(n-2)
else:
s = 4
print(s) | s870376801 | Accepted | 17 | 3,064 | 55 | n,m = map(int, input().split())
print(abs((n-2)*(m-2))) |
s427963513 | p03005 | u003501233 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 39 | Takahashi is distributing N balls to K persons. If each person has to receive at least one ball, what is the maximum possible difference in the number of balls received between the person with the most balls and the person with the fewest balls? | x,y=map(int,input().split())
print(y-x) | s368675166 | Accepted | 17 | 2,940 | 69 | n,k=map(int,input().split())
if k == 1:
print(0)
else:
print(n-k) |
s403007897 | p03048 | u196697332 | 2,000 | 1,048,576 | Time Limit Exceeded | 2,104 | 3,064 | 443 | Snuke has come to a store that sells boxes containing balls. The store sells the following three kinds of boxes: * Red boxes, each containing R red balls * Green boxes, each containing G green balls * Blue boxes, each containing B blue balls Snuke wants to get a total of exactly N balls by buying r red boxes, g... | def combinations(R, G, B, N):
R, G, B, N = int(R), int(G), int(B), int(N)
number_combos = 0
for x in range(N + 1):
N_modified_x = N - R * x
for y in range(N_modified_x + 1):
N_modified_y = N_modified_x - G * y
for z in range(N_modified_y + 1):
if ... | s142337341 | Accepted | 1,011 | 3,064 | 480 | def combinations(R, G, B, N):
R, G, B, N = int(R), int(G), int(B), int(N)
sorted_tuple = sorted((R, G, B), reverse=True)
R = sorted_tuple[0]
G = sorted_tuple[1]
B = sorted_tuple[2]
number_combos = 0
for x in range(N // R + 1):
for y in range((N - R * x) // G + 1):
if (N ... |
s261314213 | p03080 | u070753468 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 249 | There are N people numbered 1 to N. Each person wears a red hat or a blue hat. You are given a string s representing the colors of the people. Person i wears a red hat if s_i is `R`, and a blue hat if s_i is `B`. Determine if there are more people wearing a red hat than people wearing a blue hat. | n = int(input())
k = input()
p = 0
r_count = 0
b_count = 0
for l in range(n):
if str(k[p]) == "R":
r_count += 1
p += 1
elif str(k[p]) == "B":
b_count += 1
p += 1
else:
pass
print(r_count,b_count)
| s824435629 | Accepted | 17 | 3,060 | 288 | n = int(input())
k = input()
p = 0
r_count = 0
b_count = 0
for l in range(n):
if str(k[p]) == "R":
r_count += 1
p += 1
elif str(k[p]) == "B":
b_count += 1
p += 1
else:
pass
if r_count > b_count:
print("Yes")
else:
print("No")
|
s832666678 | p03049 | u581511366 | 2,000 | 1,048,576 | Wrong Answer | 35 | 3,700 | 592 | 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. | def c(strs):
count = 0
count_a = 0
count_b = 0
flag = 1
for s in strs:
count += s.count('AB')
if s[0]=='B' and s[-1]=='A':
count_a += 1
count_b += 1
elif s[0]=='B':
count_b += 1
flag = 0
elif s[-1]=='A':
coun... | s210867412 | Accepted | 35 | 3,700 | 559 | def c(strs):
count = 0
count_a = 0
count_b = 0
flag = 1
for s in strs:
count += s.count('AB')
if s[0]=='B' and s[-1]=='A':
count_a += 1
count_b += 1
elif s[0]=='B':
count_b += 1
flag = 0
elif s[-1]=='A':
coun... |
s053046278 | p03971 | u987164499 | 2,000 | 262,144 | Wrong Answer | 114 | 4,016 | 435 | 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())
S = input()
pass_human = 0
overseas = 0
for i in S:
if i == "a":
if pass_human < A+B:
print("YES")
pass_human += 1
else:
print("NO")
elif i == "b":
if pass_human < A+B and overseas < B:
print("YES")
... | s408710782 | Accepted | 101 | 4,016 | 435 | N,A,B = map(int,input().split())
S = input()
pass_human = 0
overseas = 0
for i in S:
if i == "a":
if pass_human < A+B:
print("Yes")
pass_human += 1
else:
print("No")
elif i == "b":
if pass_human < A+B and overseas < B:
print("Yes")
... |
s565159949 | p03698 | u244836567 | 2,000 | 262,144 | Wrong Answer | 30 | 8,952 | 123 | You are given a string S consisting of lowercase English letters. Determine whether all the characters in S are different. | a=input()
count=0
for i in range(len(a)):
if a[i] in a:
count=count+1
if count==0:
print("yes")
else:
print("no") | s029627762 | Accepted | 26 | 9,024 | 167 | a=input()
b=[]
c=0
for i in range(len(a)):
b.append(a[i])
b.sort()
for i in range(len(a)-1):
if b[i]==b[i+1]:
c=c+1
if c==0:
print("yes")
else:
print("no") |
s477615631 | p03852 | u845937249 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 178 | 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()
s = s.replace("eraser","")
s = s.replace("erase","")
s = s.replace("dreamer","")
s = s.replace("dream","")
if len(s) == 0:
print("YES")
else:
print("NO")
| s530837240 | Accepted | 18 | 3,060 | 338 |
s = input()
check = 0
if s == 'a':
print('vowel')
check = check + 1
if s == 'i':
print('vowel')
check = check + 1
if s == 'u':
print('vowel')
check = check + 1
if s == 'e':
print('vowel')
check = check + 1
if s == 'o':
print('vowel')
check = check + 1
if check == 0:
p... |
s350173100 | p02612 | u569989096 | 2,000 | 1,048,576 | Wrong Answer | 28 | 9,180 | 101 | 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/env python
if __name__ == "__main__":
a = input()
a = int(a)
print(a%1000) | s520556155 | Accepted | 32 | 9,164 | 154 | #!/usr/bin/env python
if __name__ == "__main__":
a = input()
a = int(a)
if a%1000 == 0:
print(0)
else:
print(1000-a%1000) |
s381939135 | p02394 | u982618289 | 1,000 | 131,072 | Wrong Answer | 20 | 7,652 | 118 | Write a program which reads a rectangle and a circle, and determines whether the circle is arranged inside the rectangle. As shown in the following figures, the upper right coordinate $(W, H)$ of the rectangle and the central coordinate $(x, y)$ and radius $r$ of the circle are given. | a = list(map(int, input().split()))
w,h,x,y,r = a
if(r<=x<=w-r and r<=y<=h-r):
print("YES")
else:
print("NO") | s653161209 | Accepted | 30 | 7,668 | 118 | a = list(map(int, input().split()))
w,h,x,y,r = a
if(r<=x<=w-r and r<=y<=h-r):
print("Yes")
else:
print("No") |
s370675557 | p02742 | u220114950 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 67 | We have a board with H horizontal rows and W vertical columns of squares. There is a bishop at the top-left square on this board. How many squares can this bishop reach by zero or more movements? Here the bishop can only move diagonally. More formally, the bishop can move from the square at the r_1-th row (from the to... | h,w=map(int,input().split())
print((w+1)//2*(h+1)//2+(w//2)*(h//2)) | s237086304 | Accepted | 17 | 2,940 | 108 | h,w=map(int,input().split())
if(h==1 or w==1):
print(1)
else:
print(((w+1)//2)*((h+1)//2)+(w//2)*(h//2)) |
s268357616 | p03399 | u490992416 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 78 | You planned a trip using trains and buses. The train fare will be A yen (the currency of Japan) if you buy ordinary tickets along the way, and B yen if you buy an unlimited ticket. Similarly, the bus fare will be C yen if you buy ordinary tickets along the way, and D yen if you buy an unlimited ticket. Find the minimu... | x = int(input())
a = int(input())
b = int(input())
print(x - a - (x-a)//b * b) | s847441582 | Accepted | 20 | 3,060 | 94 | a = int(input())
b = int(input())
c = int(input())
d = int(input())
print(min(a,b) + min(c,d)) |
s966374627 | p03997 | u203962828 | 2,000 | 262,144 | Wrong Answer | 29 | 9,012 | 74 | 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) / 2 * h) | s191488263 | Accepted | 33 | 9,040 | 81 | a = int(input())
b = int(input())
h = int(input())
print(int(((a + b) / 2 * h))) |
s602797319 | p02936 | u485319545 | 2,000 | 1,048,576 | Wrong Answer | 2,109 | 21,516 | 370 | Given is a rooted tree with N vertices numbered 1 to N. The root is Vertex 1, and the i-th edge (1 \leq i \leq N - 1) connects Vertex a_i and b_i. Each of the vertices has a counter installed. Initially, the counters on all the vertices have the value 0. Now, the following Q operations will be performed: * Operati... | N,Q=map(int,input().split())
import numpy as np
tree = np.array([-1]*N)
cnt = np.array([0]*N)
for i in range(N-1):
a,b = map(int,input().split())
a-=1
b-=1
tree[b]=a
for j in range(Q):
p,x=map(int,input().split())
p-=1
if p!=0:
cnt[p]+=x
cnt[np.where(tree == p)] +=x... | s762431165 | Accepted | 1,441 | 223,284 | 490 | import sys
sys.setrecursionlimit(500*500)
n,q=map(int,input().split())
cost=[0]*n
edge = [[] for _ in range(n)]
for _ in range(n-1):
a,b=map(int,input().split())
a,b=a-1,b-1
edge[a].append(b)
edge[b].append(a)
for _ in range(q):
p,x=map(int,input().split())
cost[p-1]+=x
visited=[-1]*n
d... |
s471188583 | p03369 | u054717609 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 94 | 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()
ct=0
if "o" in s:
ct=ct+1
if(ct>0):
f=700+100*ct
else:
f=700
print(f)
| s798992893 | Accepted | 17 | 2,940 | 134 | s=input()
ct=0
for i in range(0,len(s)):
if(s[i]=="o"):
ct=ct+1
if(ct>0):
f=700+100*ct
else:
f=700
print(f)
|
s827620279 | p03997 | u778348725 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 118 | You are given a trapezoid. The lengths of its upper base, lower base, and height are a, b, and h, respectively. An example of a trapezoid Find the area of this trapezoid. |
a = float(input())
b = float(input())
h = float(input())
area = (a+b)*h/2
print(area)
| s584222582 | Accepted | 17 | 2,940 | 117 |
a = int(input())
b = int(input())
h = int(input())
area = (a+b)*h/2
print(int(area))
|
s444798983 | p03447 | u201082459 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 68 | You went shopping to buy cakes and donuts with X yen (the currency of Japan). First, you bought one cake for A yen at a cake shop. Then, you bought as many donuts as possible for B yen each, at a donut shop. How much do you have left after shopping? | x = int(input())
a = int(input())
b = int(input())
print((x-a) // b) | s228395489 | Accepted | 17 | 2,940 | 67 | x = int(input())
a = int(input())
b = int(input())
print((x-a) % b) |
s173197449 | p03448 | u680183386 | 2,000 | 262,144 | Wrong Answer | 51 | 3,060 | 204 | You have A 500-yen coins, B 100-yen coins and C 50-yen coins (yen is the currency of Japan). In how many ways can we select some of these coins so that they are X yen in total? Coins of the same kind cannot be distinguished. Two ways to select coins are distinguished when, for some kind of coin, the numbers of that co... | li = [int(input()) for i in range(4)]
counter = 0
for p in range(li[0]+1):
for q in range(li[1]+1):
for r in range(li[2]+1):
if 500*p+100*q+r == li[3]:
counter+=1
print(counter) | s584092785 | Accepted | 51 | 2,940 | 208 | li = [int(input()) for i in range(4)]
counter = 0
for p in range(li[0]+1):
for q in range(li[1]+1):
for r in range(li[2]+1):
if 500*p+100*q+50*r == li[3]:
counter+=1
print(counter)
|
s786847378 | p03360 | u186426563 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 80 | There are three positive integers A, B and C written on a blackboard. E869120 performs the following operation K times: * Choose one integer written on the blackboard and let the chosen integer be n. Replace the chosen integer with 2n. What is the largest possible sum of the integers written on the blackboard after... | a = list(map(int, input().split()))
k = int(input())
print(sum(a) + max(a)*2**k) | s783644169 | Accepted | 17 | 2,940 | 86 | a = list(map(int, input().split()))
k = int(input())
print(sum(a) + max(a)*(2**k - 1)) |
s268786377 | p03407 | u740284863 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 84 | 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")
| s496772515 | Accepted | 18 | 2,940 | 86 | a,b, c = map(int,input().split())
if a+b >= c:
print("Yes")
else:
print("No")
|
s161590947 | p02406 | u623827446 | 1,000 | 131,072 | Wrong Answer | 20 | 7,492 | 162 | 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 ... | n=int(input())
for i in range(n+1):
I=str(i)
if i % 3 == 0:
print(' {0}'.format(i), end='')
elif I[len(I)-1] == '3':
print(' {0}'.format(i), end='') | s160767861 | Accepted | 30 | 7,892 | 118 | n=int(input())
for i in range(1,n+1):
if i % 3 == 0 or '3' in str(i):
print(' {0}'.format(i), end='')
print('') |
s721659395 | p03730 | u655761160 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 128 | We ask you to select some number of positive integers, and calculate the sum of them. It is allowed to select as many integers as you like, and as large integers as you wish. You have to follow these, however: each selected integer needs to be a multiple of A, and you need to select at least one integer. Your objecti... | A, B, C = map(int, input().split())
ans = 'No'
for k in range(1, B + 1):
if (k * A % B == C):
ans = 'Yes'
print(ans) | s251057273 | Accepted | 17 | 2,940 | 219 | def f(A, B, C):
ans = 'NO'
for k in range(1, B + 1):
if (k * A % B == C):
ans = 'YES'
return ans
if __name__ == "__main__":
A, B, C = map(int, input().split())
print(f(A, B, C)) |
s857719076 | p03493 | u731436822 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 97 | Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble. | S = list(map(int,input().split()))
count = 0
for s in S:
if s == 0:
count += 1
print(count) | s740370920 | Accepted | 17 | 2,940 | 76 | S = input()
count = 0
for s in S:
if s == "1":
count += 1
print(count) |
s746285162 | p03448 | u410201501 | 2,000 | 262,144 | Wrong Answer | 48 | 3,060 | 217 | You have A 500-yen coins, B 100-yen coins and C 50-yen coins (yen is the currency of Japan). In how many ways can we select some of these coins so that they are X yen in total? Coins of the same kind cannot be distinguished. Two ways to select coins are distinguished when, for some kind of coin, the numbers of that co... | a, b, c, x = map(int, [input() for i in range(4)])
ans = 0
for i in range(a+1):
for k in range(b+1):
for j in range(c+1):
if i * 500 + j * 100 + j * 50 == x:
ans += 1
print(ans) | s892283582 | Accepted | 48 | 2,940 | 217 | a, b, c, x = map(int, [input() for i in range(4)])
ans = 0
for i in range(a+1):
for j in range(b+1):
for k in range(c+1):
if i * 500 + j * 100 + k * 50 == x:
ans += 1
print(ans) |
s575666519 | p02833 | u952669998 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 112 | For an integer n not less than 0, let us define f(n) as follows: * f(n) = 1 (if n < 2) * f(n) = n f(n-2) (if n \geq 2) Given is an integer N. Find the number of trailing zeros in the decimal notation of f(N). | N = int(input())
if N%2!=0:
print(0)
else:
b = 0
n = N/2
while(n):
b += n//5
n //= 5
print(b) | s477204232 | Accepted | 17 | 2,940 | 132 | N = int(input())
if N%2!=0:
print(0)
else:
cnt = 0
n = N//2
k = 5
while(n//k != 0):
cnt += n//k
k*=5
print(cnt) |
s558890010 | p03435 | u696197059 | 2,000 | 262,144 | Wrong Answer | 28 | 9,204 | 415 | 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) ... | y1_list = list(map(int,input().split()))
y2_list = list(map(int,input().split()))
y3_list = list(map(int,input().split()))
a1 = list()
a2 = list()
for i in range(3):
a1.append(y1_list[i] - y2_list[i])
a2.append(y2_list[i] - y3_list[i])
if a1[0] == a1[1] and a1[2] == a1[0]:
if a2[0] == a1[1] and a2[2] ==... | s689525204 | Accepted | 30 | 9,224 | 472 | y1_list = list(map(int,input().split()))
y2_list = list(map(int,input().split()))
y3_list = list(map(int,input().split()))
L = [y1_list,y2_list,y3_list]
a1 = list()
a2 = list()
b1 = list()
b2 = list()
for i in range(3):
a1.append(y1_list[i] - y2_list[i])
a2.append(y2_list[i] - y3_list[i])
if (a1[0] == ... |
s811496877 | p03227 | u970809473 | 2,000 | 1,048,576 | Wrong Answer | 18 | 2,940 | 63 | You are given a string S of length 2 or 3 consisting of lowercase English letters. If the length of the string is 2, print it as is; if the length is 3, print the string after reversing it. | s=input()
if len(s) == 2:
print(s)
else:
print(reversed(s)) | s222806907 | Accepted | 17 | 2,940 | 78 | s=input()
if len(s) == 2:
print(s)
else:
print(''.join(list(reversed(s)))) |
s399385820 | p01554 | u775586391 | 2,000 | 131,072 | Wrong Answer | 20 | 7,640 | 215 | ある部屋ではICカードを用いて鍵を開け閉めする電子錠システムを用いている。 このシステムは以下のように動作する。 各ユーザーが持つICカードを扉にかざすと、そのICカードのIDがシステムに渡される。 システムはIDが登録されている時、施錠されているなら開錠し、そうでないのなら施錠し、それぞれメッセージが出力される。 IDが登録されていない場合は、登録されていないというメッセージを出力し、開錠及び施錠はおこなわれない。 さて、現在システムにはN個のID(U1, U2, ……, UN)が登録されており、施錠されている。 M回ICカードが扉にかざされ、そのIDはそれぞれ順番にT1, T2, ……, TMであるとする。 この時のシステム... | n = int(input())
l1 = [input() for i in range(n)]
m = int(input())
c = 0
l = ["Opend","Closed"]
for i in range(m):
s = input()
if s in l1:
print(l[c%2]+" by "+ s)
c += 1
else:
print("Unknown "+ s) | s338005818 | Accepted | 30 | 7,732 | 216 | n = int(input())
l1 = [input() for i in range(n)]
m = int(input())
c = 0
l = ["Opened","Closed"]
for i in range(m):
s = input()
if s in l1:
print(l[c%2]+" by "+ s)
c += 1
else:
print("Unknown "+ s) |
s802004708 | p03494 | u063614215 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 336 | 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())
num_list = [int(i) for i in input().split(' ')]
even_counter = 0
for n in range(N):
if num_list[n]%2 != 0:
print('0')
break
else:
even_counter += 1
if even_counter == N:
num_min = min(num_list)
counter = 0
while num_min%2 == 0:
counter += 1
num_min //= 2
... | s496801647 | Accepted | 18 | 3,064 | 489 | N = int(input())
num_list = [int(i) for i in input().split(' ')]
even_counter = 0
for n in range(N):
if num_list[n]%2 != 0:
print('0')
break
else:
even_counter += 1
if even_counter == N:
min_counter = float('inf')
for i in range(N):
num = num_list[i]
counter = 0
... |
s040559901 | p03477 | u143492911 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 160 | A balance scale tips to the left if L>R, where L is the total weight of the masses on the left pan and R is the total weight of the masses on the right pan. Similarly, it balances if L=R, and tips to the right if L<R. Takahashi placed a mass of weight A and a mass of weight B on the left pan of a balance scale, and pl... | a,b,c,d=map(int,input().split())
right=a+b
left=c+d
if right==left:
print("Balanced")
elif right<left:
print("Left")
elif left<right:
print("Right") | s500823779 | Accepted | 17 | 3,060 | 160 | a,b,c,d=map(int,input().split())
left=a+b
right=c+d
if right==left:
print("Balanced")
elif right<left:
print("Left")
elif left<right:
print("Right") |
s703393622 | p02678 | u654590131 | 2,000 | 1,048,576 | Wrong Answer | 2,210 | 52,044 | 595 | 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())
AB = []
for _ in range(M):
AB.append(list(map(int, input().split())))
list = [0] * (N+1)
print(AB)
print(list)
saitan = [1]
for _ in range(M):
next = []
for i in range(len(AB)):
if AB[i][0] in saitan:
if list[AB[i][1]] == 0:
list[AB[i][... | s866079163 | Accepted | 670 | 36,464 | 496 | from collections import deque
N, M = map(int, input().split())
graph = [[] for _ in range(N+1)]
for i in range(M):
a, b = map(int, input().split())
graph[a].append(b)
graph[b].append(a)
dist = [-1] * (N+1)
dist[0] = 0
dist[1] = 0
d = deque()
d.append(1)
ans = [0] * (N+1)
while d:
v = d.popleft()
... |
s345302504 | p03597 | u136090046 | 2,000 | 262,144 | Wrong Answer | 19 | 3,316 | 132 | We have an N \times N square grid. We will paint each square in the grid either black or white. If we paint exactly A squares white, how many squares will be painted black? | value_list = []
number_of_test = int(input())
number_of_test2 = int(input())
print((number_of_test*number_of_test)-number_of_test)
| s222041685 | Accepted | 17 | 2,940 | 117 | number_of_test = int(input())
number_of_test2 = int(input())
print((number_of_test*number_of_test)-number_of_test2)
|
s960123259 | p02614 | u934119021 | 1,000 | 1,048,576 | Wrong Answer | 128 | 9,304 | 579 | We have a grid of H rows and W columns of squares. The color of the square at the i-th row from the top and the j-th column from the left (1 \leq i \leq H, 1 \leq j \leq W) is given to you as a character c_{i,j}: the square is white if c_{i,j} is `.`, and black if c_{i,j} is `#`. Consider doing the following operation... | import itertools
import copy
h, w, k = map(int, input().split())
c = []
for i in range(h):
s = input()
c.append(list(s))
f = ['0', '1']
c2 = []
ans = 0
for i in itertools.product(f, repeat=h):
c2.clear()
c2 += c
for x in range(h):
if i[x] == '1':
c2[x] = ['x'] * w
c3 = []
for j in itertools.pro... | s283688358 | Accepted | 46 | 9,224 | 609 | import itertools
h, w, k = map(int, input().split())
c = []
ans = 0
for i in range(h):
c.append(list(input()))
for i in range(2 ** h - 1):
c2 = []
x = str(bin(i))[2:].zfill(h)
for a in range(h):
if x[a] == '0':
c2.append(c[a])
elif x[a] == '1':
c2.append(['*'] * w)
black = list(itertools.... |
s990296399 | p04044 | u467177102 | 2,000 | 262,144 | Wrong Answer | 25 | 8,976 | 102 | 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... | i = input().split()
if i.count("7") == 1 and i.count("5") == 2:
print("YES")
else:
print("NO") | s982915285 | Accepted | 25 | 9,000 | 120 | N,L = map(int, input().split())
string_list = [input() for i in range(N)]
string_list.sort()
print(''.join(string_list)) |
s145795519 | p03067 | u089142196 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,060 | 124 | There are three houses on a number line: House 1, 2 and 3, with coordinates A, B and C, respectively. Print `Yes` if we pass the coordinate of House 3 on the straight way from House 1 to House 2 without making a detour, and print `No` otherwise. | A,B,C = map(int,input().split())
maxi=max(A,B,C)
mini=min(A,B,C)
if B!=maxi and B!=mini:
print("Yes")
else:
print("No") | s512905518 | Accepted | 17 | 2,940 | 124 | A,B,C = map(int,input().split())
maxi=max(A,B,C)
mini=min(A,B,C)
if C!=maxi and C!=mini:
print("Yes")
else:
print("No") |
s667899634 | p02268 | u912143677 | 1,000 | 131,072 | Wrong Answer | 20 | 5,588 | 399 | You are given a sequence of _n_ integers S and a sequence of different _q_ integers T. Write a program which outputs C, the number of integers in T which are also in the set S. | n = int(input())
s = list(map(int, input().split()))
q = int(input())
t = list(map(int, input().split()))
count = 0
for i in range(q):
left = 0
right = n-1
while left < right:
mid = (right + left) // 2
if t[i] == s[mid]:
count += 1
break
elif t[i] < s[mid]:... | s013382918 | Accepted | 570 | 16,708 | 410 | n = int(input())
s = list(map(int, input().split()))
q = int(input())
t = list(map(int, input().split()))
count = 0
for i in range(q):
left = 0
right = n
while left < right:
mid = (right + left) // 2
if t[i] == s[mid]:
count += 1
break
elif t[i] < s[mid]:
... |
s265078719 | p03048 | u311636831 | 2,000 | 1,048,576 | Wrong Answer | 2,104 | 13,256 | 301 | Snuke has come to a store that sells boxes containing balls. The store sells the following three kinds of boxes: * Red boxes, each containing R red balls * Green boxes, each containing G green balls * Blue boxes, each containing B blue balls Snuke wants to get a total of exactly N balls by buying r red boxes, g... | r,g,b,n=map(int,input().split())
tmp=0
for i in range(3000):
if(r*i>3000):break
for j in range(3000):
if(r*i+g*j>3000):break
if((n-r*i-g*j)<0):break
if((((n-r*i-g*j)%b)==0)&(((n-r*i-g*j)/b)<3000)):
print(i,j,((n-r*i-g*j)/b))
tmp+=1
print(tmp) | s072702103 | Accepted | 1,624 | 2,940 | 186 | R, G, B, N = map(int, input().split())
ans = 0
for r in range(N//R + 1):
for g in range((N - (R*r))//G + 1):
if(N - (R*r) - (G*g)) % B == 0:
ans += 1
print(ans) |
s322487514 | p03854 | u848654125 | 2,000 | 262,144 | Wrong Answer | 17 | 3,188 | 559 | 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`. | def erase_end(string):
if string.endswith("dream"):
string = string.rstrip("dream")
elif string.endswith("dreamer"):
string = string.rstrip("dreamer")
elif string.endswith("erase"):
string = string.rstrip("erase")
elif string.endswith("eraser"):
string = string.rstrip("er... | s892558546 | Accepted | 68 | 3,316 | 513 |
def erase_end(string):
if string.endswith("dream"):
string = string[:-5]
elif string.endswith("dreamer"):
string = string[:-7]
elif string.endswith("erase"):
string = string[:-5]
elif string.endswith("eraser"):
string = string[:-6]
elif string == "":
string =... |
s713571002 | p03150 | u794173881 | 2,000 | 1,048,576 | Wrong Answer | 25 | 3,828 | 377 | A string is called a KEYENCE string when it can be changed to `keyence` by removing its contiguous substring (possibly empty) only once. Given a string S consisting of lowercase English letters, determine if S is a KEYENCE string. | import fnmatch
S=[]
S.append(input())
if S == fnmatch.filter(S, "*keyence") or S == fnmatch.filter(S, "k*eyence") or S == fnmatch.filter(S, "ke*yence") or S == fnmatch.filter(S, "key*ence") or S == fnmatch.filter(S, "keye*nce") or S == fnmatch.filter(S, "keyen*ce") or S == fnmatch.filter(S, "keyenc*e") or S == fnmatch.... | s724834013 | Accepted | 27 | 3,828 | 302 | import fnmatch
S=[]
S.append(input())
if S == fnmatch.filter(S, "k*eyence") or S == fnmatch.filter(S, "ke*yence") or S == fnmatch.filter(S, "key*ence") or S == fnmatch.filter(S, "keye*nce") or S == fnmatch.filter(S, "keyen*ce") or S == fnmatch.filter(S, "keyenc*e") :
print("YES")
else:
print("NO") |
s253370132 | p02690 | u729133443 | 2,000 | 1,048,576 | Wrong Answer | 49 | 11,532 | 79 | Give a pair of integers (A, B) such that A^5-B^5 = X. It is guaranteed that there exists such a pair for the given integer X. | x,r=int(input()),range(-99,130);[i**5-x-j**5or print(i,j)for i in r for j in r] | s917989472 | Accepted | 35 | 9,060 | 67 | i=j=x=int(input())
while(i:=-~i%127)**5-j**5-x:j=j%257-i
print(i,j) |
s484744518 | p02841 | u399779657 | 2,000 | 1,048,576 | Wrong Answer | 18 | 3,060 | 172 | In this problem, a date is written as Y-M-D. For example, 2019-11-30 means November 30, 2019. Integers M_1, D_1, M_2, and D_2 will be given as input. It is known that the date 2019-M_2-D_2 follows 2019-M_1-D_1. Determine whether the date 2019-M_1-D_1 is the last day of a month. | import itertools
N = input()
S = input()
l = []
l = [i for i in S]
answer = []
answer = [i for i in itertools.combinations(l,3)]
answer = set(answer)
print(len(answer)) | s455926362 | Accepted | 17 | 2,940 | 95 | M1, D1 = input().split()
M2, D2 = input().split()
if M1 == M2:
print(0)
else:
print(1) |
s411870536 | p04043 | u989326345 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 102 | 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 ... | s=str(input())
n5=s.count('5')
n7=s.count('7')
if n5==2 and n7==1:
print('Yes')
else:
print('No')
| s106379845 | Accepted | 17 | 2,940 | 101 | s=str(input())
n5=s.count('5')
n7=s.count('7')
if n5==2 and n7==1:
print('YES')
else:
print('NO') |
s373409873 | p03503 | u437068347 | 2,000 | 262,144 | Wrong Answer | 151 | 3,188 | 638 | Joisino is planning to open a shop in a shopping street. Each of the five weekdays is divided into two periods, the morning and the evening. For each of those ten periods, a shop must be either open during the whole period, or closed during the whole period. Naturally, a shop must be open during at least one of those ... | # -*- coding: utf-8 -*-
import itertools
def to_bool(i):
if i == '1':
return True
return False
n = int(input())
f = []
for i in range(n):
f.append(list(to_bool(i) for i in input().split()))
p = []
for i in range(n):
p.append(list(int(i) for i in input().split()))
print(f)
print(p)
result = ... | s726649212 | Accepted | 155 | 3,064 | 782 | # -*- coding: utf-8 -*-
import itertools
def to_bool(i):
if i == '1':
return True
return False
n = int(input())
f = []
for i in range(n):
f.append(list(to_bool(i) for i in input().split()))
p = []
for i in range(n):
p.append(list(int(i) for i in input().split()))
result = None
for eigyou in ... |
s753521715 | p03139 | u833543158 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 106 | We conducted a survey on newspaper subscriptions. More specifically, we asked each of the N respondents the following two questions: * Question 1: Are you subscribing to Newspaper X? * Question 2: Are you subscribing to Newspaper Y? As the result, A respondents answered "yes" to Question 1, and B respondents answ... | N, A, B = map(int, input().split())
maxAns = min(A, B)
minAns = max(0, abs(A+B-N))
print(maxAns, minAns)
| s887822399 | Accepted | 17 | 2,940 | 101 | N, A, B = map(int, input().split())
maxAns = min(A, B)
minAns = max(0, A+B-N)
print(maxAns, minAns)
|
s180828395 | p03635 | u879870653 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 157 | In _K-city_ , there are n streets running east-west, and m streets running north-south. Each street running east-west and each street running north-south cross each other. We will call the smallest area that is surrounded by four streets a block. How many blocks there are in K-city? | n,m = map(int,input().split())
if n > 2 and m > 2 :
print((n-2)*(m-2))
elif n == 2 and m == 2 :
print(1)
else :
print(max(n,m)-1)
| s557697877 | Accepted | 17 | 2,940 | 66 | n,m = map(int,input().split())
print((n-1)*(m-1))
|
s720263721 | p02261 | u766163292 | 1,000 | 131,072 | Wrong Answer | 20 | 7,708 | 1,078 | 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 Bubbl... | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
class Card(object):
def __init__(self, card):
self.card = card
self.suit = card[0]
self.value = int(card[1:])
def __str__(self):
return str(self.card)
def print_array(a):
print(" ".join(map(str, a)))
def bubblesort(cards,... | s540425072 | Accepted | 70 | 7,796 | 1,076 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
class Card(object):
def __init__(self, card):
self.card = card
self.suit = card[0]
self.value = int(card[1:])
def __str__(self):
return str(self.card)
def print_array(a):
print(" ".join(map(str, a)))
def bubblesort(cards,... |
s416218792 | p03149 | u768896740 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,064 | 367 | You are given four digits N_1, N_2, N_3 and N_4. Determine if these can be arranged into the sequence of digits "1974". | a = list(map(int, input().split()))
count_a = 0
count_b = 0
count_c = 0
count_d = 0
for i in range(4):
if a[i] == 1:
count_a += 1
if a[i] == 4:
count_b += 1
if a[i] == 7:
count_c += 1
if a[i] == 9:
count_d += 1
if count_a == 1 and count_b == 1 and count_c == 1 and count... | s106400741 | Accepted | 18 | 3,060 | 368 | a = list(map(int, input().split()))
count_a = 0
count_b = 0
count_c = 0
count_d = 0
for i in range(4):
if a[i] == 1:
count_a += 1
if a[i] == 4:
count_b += 1
if a[i] == 7:
count_c += 1
if a[i] == 9:
count_d += 1
if count_a == 1 and count_b == 1 and count_c == 1 and count... |
s505696631 | p03658 | u200239931 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 766 | 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. | import math
import sys
def getinputdata():
array_result = []
data = input()
array_result.append(data.split(" "))
flg = 1
try:
while flg:
data = input()
array_temp = []
if(data != ""):
array_result.a... | s979404321 | Accepted | 23 | 3,064 | 767 | import math
import sys
def getinputdata():
array_result = []
data = input()
array_result.append(data.split(" "))
flg = 1
try:
while flg:
data = input()
array_temp = []
if(data != ""):
array_result.a... |
s771228892 | p02399 | u315329386 | 1,000 | 131,072 | Wrong Answer | 20 | 7,692 | 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) | s348908161 | Accepted | 40 | 7,700 | 83 | a, b = map(int, input().split())
print("{} {} {:.5f}".format(a // b, a % b, a / b)) |
s675044897 | p04043 | u799751074 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 322 | 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 ... | from sys import stdin
lis = stdin.readline().rstrip().split()
a = lis[0]
b = lis[1]
c = lis[2]
if a == 5:
if b == 5 and c ==7:
print("YES")
elif b == 7 and c ==5:
print("YES")
else:
print("NO")
elif a == 7:
if b == 5 and c == 5:
print("YES")
else:
print("NO")... | s878180230 | Accepted | 17 | 3,064 | 427 | from sys import stdin
lis = stdin.readline().rstrip().split()
a = int(lis[0])
b = int(lis[1])
c = int(lis[2])
if a == 5 or a == 7:
if a == 5:
if b == 5 and c ==7:
print("YES")
elif b == 7 and c ==5:
print("YES")
else:
print("NO")
elif a == 7:
... |
s716108796 | p03694 | u780475861 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 67 | It is only six months until Christmas, and AtCoDeer the reindeer is now planning his travel to deliver gifts. There are N houses along _TopCoDeer street_. The i-th house is located at coordinate a_i. He has decided to deliver gifts to all these houses. Find the minimum distance to be traveled when AtCoDeer can star... | lst = [int(i) for i in input().split()]
print(max(lst) - min(lst)) | s434596876 | Accepted | 17 | 2,940 | 79 | _ = input()
lst = [int(i) for i in input().split()]
print(max(lst) - min(lst)) |
s793339048 | p03361 | u919633157 | 2,000 | 262,144 | Wrong Answer | 22 | 3,572 | 464 | We have a canvas divided into a grid with H rows and W columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Initially, all the squares are white. square1001 wants to draw a picture with black paint. His specific objective is to make Square (i, j) black when s_{i... | h,w=map(int,input().split())
s=[['.']*(w+2)]
for i in range(h):
s+=[['.']+list(input())+['.']]
s+=[['.']*(w+2)]
for i in s:
print(*i)
dset=((-1,0),(0,1),(1,0),(0,-1))
for i in range(1,h+1):
for j in range(1,w+2):
if s[i][j]=='.':continue
flag=False
for y,x in dset:
i... | s882261258 | Accepted | 19 | 3,064 | 435 | h,w=map(int,input().split())
s=[['.']*(w+2)]
for i in range(h):
s+=[['.']+list(input())+['.']]
s+=[['.']*(w+2)]
dset=((-1,0),(0,1),(1,0),(0,-1))
for i in range(1,h+1):
for j in range(1,w+2):
if s[i][j]=='.':continue
flag=False
for y,x in dset:
if s[i+y][j+x]=='#':
... |
s552244182 | p03696 | u133936772 | 2,000 | 262,144 | Wrong Answer | 27 | 9,264 | 91 | You are given a string S of length N consisting of `(` and `)`. Your task is to insert some number of `(` and `)` into S to obtain a _correct bracket sequence_. Here, a correct bracket sequence is defined as follows: * `()` is a correct bracket sequence. * If X is a correct bracket sequence, the concatenation of... | input()
s=t=input()
l,r=p='()'
exec("t.replace(p,'');"*50)
c=t.count
print(l*c(r)+s+r*c(l)) | s206269588 | Accepted | 31 | 9,284 | 93 | input()
s=t=input()
l,r=p='()'
exec("t=t.replace(p,'');"*50)
c=t.count
print(l*c(r)+s+r*c(l)) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.