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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s821714036 | p00008 | u737311644 | 1,000 | 131,072 | Wrong Answer | 30 | 5,592 | 306 | Write a program which reads an integer n and identifies the number of combinations of a, b, c and d (0 ≤ a, b, c, d ≤ 9) which meet the following equality: a + b + c + d = n For example, for n = 35, we have 4 different combinations of (a, b, c, d): (8, 9, 9, 9), (9, 8, 9, 9), (9, 9, 8, 9), and (9, 9, 9, 8). | n=int(input())
a,b,c,d=0,0,0,0
ans=0
for i in range(10):
c=0
for j in range(10):
b=0
for f in range(10):
a=0
for e in range(10):
if a+b+c+d==n:
ans+=1
a+=1
b+=1
c+=1
d+=1
print(ans)
| s825608271 | Accepted | 170 | 5,592 | 263 | while True:
try:n=int(input())
except:break
ans=0
for i in range(10):
for j in range(10):
for f in range(10):
for e in range(10):
if i+j+f+e==n:
ans+=1
print(ans)
|
s627401920 | p04039 | u021759654 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 209 | Iroha is very particular about numbers. There are K digits that she dislikes: D_1, D_2, ..., D_K. She is shopping, and now paying at the cashier. Her total is N yen (the currency of Japan), thus she has to hand at least N yen to the cashier (and possibly receive the change). However, as mentioned before, she is very ... | #1000 8
#1 3 4 5 6 7 8 9
n, k = map(int, input().split())
Ds = list(map(int, input().split()))
for i in range(n, n*10+2):
for d in Ds:
if d in list(str(i)):
break
else:
print(i)
exit(0) | s558786114 | Accepted | 346 | 3,060 | 197 | n, k = map(int, input().split())
Ds = list(map(int, input().split()))
for i in range(n, n*11):
for d in Ds:
if d in list(map(int, list(str(i)))):
break
else:
print(i)
exit(0) |
s712465002 | p03377 | u987164499 | 2,000 | 262,144 | Wrong Answer | 149 | 12,400 | 152 | 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. | from sys import stdin
import numpy as np
a,b,c= [int(x) for x in stdin.readline().rstrip().split()]
if c-a >= b:
print("YES")
else:
print("NO") | s279609437 | Accepted | 161 | 13,232 | 164 | from sys import stdin
import numpy as np
a,b,c= [int(x) for x in stdin.readline().rstrip().split()]
if c-a <= b and a <= c:
print("YES")
else:
print("NO")
|
s909930939 | p03493 | u929138803 | 2,000 | 262,144 | Wrong Answer | 2,103 | 3,060 | 208 | 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. | count = 0
flg = 0
a = list(map(int,input().split()))
while True:
for i in a:
if i%2 != 0:
flg = 1
if flg == 0:
a = list(map(lambda x: int(x/2), a))
count += 1
else:
break
print(count) | s081388009 | Accepted | 18 | 2,940 | 76 | count = 0
a = input()
for i in a:
if i == '1':
count += 1
print(count) |
s407945629 | p03993 | u982653403 | 2,000 | 262,144 | Wrong Answer | 90 | 14,008 | 157 | There are N rabbits, numbered 1 through N. The i-th (1≤i≤N) rabbit likes rabbit a_i. Note that no rabbit can like itself, that is, a_i≠i. For a pair of rabbits i and j (i<j), we call the pair (i,j) a _friendly pair_ if the following condition is met. * Rabbit i likes rabbit j and rabbit j likes rabbit i. Calculat... | n = int(input())
a = list(map(int, input().split()))
print(a)
total = 0
for i in range(n):
if a[a[i] - 1] == i + 1:
total += 1
print(total // 2)
| s272042462 | Accepted | 81 | 14,008 | 148 | n = int(input())
a = list(map(int, input().split()))
total = 0
for i in range(n):
if a[a[i] - 1] == i + 1:
total += 1
print(total // 2)
|
s742631933 | p04035 | u064408584 | 2,000 | 262,144 | Wrong Answer | 131 | 14,060 | 248 | We have N pieces of ropes, numbered 1 through N. The length of piece i is a_i. At first, for each i (1≤i≤N-1), piece i and piece i+1 are tied at the ends, forming one long rope with N-1 knots. Snuke will try to untie all of the knots by performing the following operation repeatedly: * Choose a (connected) rope with... | n,l=map(int, input().split())
a=list(map(int, input().split()))
ans=-1
for i in range(n-1):
if a[i]+a[i+1]>=l:
ans=i+1
break
if ans==-1:print('Impossible')
else:
for i in range(1,n):
if i!=ans:print(i)
print(ans) | s914486895 | Accepted | 126 | 14,060 | 276 | n,l=map(int, input().split())
a=list(map(int, input().split()))
ans=-1
for i in range(n-1):
if a[i]+a[i+1]>=l:
ans=i+1
break
if ans==-1:print('Impossible')
else:
print('Possible')
for i in range(1,ans):print(i)
for i in range(n-1,i,-1):print(i) |
s699777088 | p03151 | u243453868 | 2,000 | 1,048,576 | Wrong Answer | 343 | 27,564 | 679 | A university student, Takahashi, has to take N examinations and pass all of them. Currently, his _readiness_ for the i-th examination is A_{i}, and according to his investigation, it is known that he needs readiness of at least B_{i} in order to pass the i-th examination. Takahashi thinks that he may not be able to pa... |
import numpy
import scipy
from collections import defaultdict
from pprint import pprint
N = int(input())
A = [int(x) for x in input().split(" ")]
B = [int(x) for x in input().split(" ")]
diff = [0 for x in range(N)]
for i in range(N):
diff[i] = A[i] - B[i]
if (sum(diff) < 0):
print (-1)
else:
shakkin... | s509103718 | Accepted | 284 | 29,628 | 599 |
import numpy
import scipy
from collections import defaultdict
from pprint import pprint
N = int(input())
A = [int(x) for x in input().split(" ")]
B = [int(x) for x in input().split(" ")]
diff = [0 for x in range(N)]
for i in range(N):
diff[i] = A[i] - B[i]
if (sum(diff) < 0):
print (-1)
else:
point =... |
s252380707 | p03861 | u312025627 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 91 | 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? |
def main():
a, b, x = map(int,input().split())
print((b//x+1) - (a//x+1))
main() | s274530591 | Accepted | 18 | 2,940 | 180 | def main():
a, b, x = map(int,input().split())
re_b = (b//x)+1
if a-1 != -1:
re_a = ((a-1)//x)+1
print(re_b - re_a)
else:
print(re_b)
main() |
s936237419 | p03860 | u604231488 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 24 | Snuke is going to open a contest named "AtCoder s Contest". Here, s is a string of length 1 or greater, where the first character is an uppercase English letter, and the second and subsequent characters are lowercase English letters. Snuke has decided to abbreviate the name of the contest as "AxC". Here, x is the uppe... | s = input()
print(s[8])
| s644083639 | Accepted | 17 | 2,940 | 32 | s = input()
print('A'+s[8]+'C')
|
s444813651 | p03251 | u121161758 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,064 | 493 | Our world is one-dimensional, and ruled by two empires called Empire A and Empire B. The capital of Empire A is located at coordinate X, and that of Empire B is located at coordinate Y. One day, Empire A becomes inclined to put the cities at coordinates x_1, x_2, ..., x_N under its control, and Empire B becomes incli... | N, M , X ,Y = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
max_x = max(x)
max_y = max(y)
#print(max_x)
#print(max_y)
#print(Y-X)
XY_list = []
xy_list = []
for i in range(X+1, Y+1):
XY_list.append(i)
if max_x + 1 >= max_y:
print("War")
exit()
for i in... | s591601086 | Accepted | 17 | 3,064 | 507 | N, M , X ,Y = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
max_x = max(x)
max_y = max(y)
min_y = min(y)
#print(max_x)
#print(max_y)
#print(Y-X)
XY_list = []
xy_list = []
for i in range(X+1, Y+1):
XY_list.append(i)
if max_x >= min_y:
print("War")
exit... |
s426817798 | p03385 | u823044869 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 85 | You are given a string S of length 3 consisting of `a`, `b` and `c`. Determine if S can be obtained by permuting `abc`. | sSorted = sorted(input())
if sSorted =="abc":
print("Yes")
else:
print("No")
| s614395794 | Accepted | 17 | 3,064 | 90 | sSorted = sorted(input())
if ''.join(sSorted) =="abc":
print("Yes")
else:
print("No")
|
s677467697 | p03407 | u921830178 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 99 | 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. | #96
A,B,C = map(int,input().split())
ans= ((A+B)>=C)
if ans:
print("YES")
else:
print("NO") | s415794440 | Accepted | 17 | 2,940 | 99 | #96
A,B,C = map(int,input().split())
ans= ((A+B)>=C)
if ans:
print("Yes")
else:
print("No") |
s207873112 | p03151 | u843135954 | 2,000 | 1,048,576 | Wrong Answer | 18 | 3,064 | 319 | A university student, Takahashi, has to take N examinations and pass all of them. Currently, his _readiness_ for the i-th examination is A_{i}, and according to his investigation, it is known that he needs readiness of at least B_{i} in order to pass the i-th examination. Takahashi thinks that he may not be able to pa... | i = input()
n = int(i)
a = list(map(int, i.split()))
b = list(map(int, i.split()))
if sum(a) < sum(b):
print(-1)
exit()
c = [x-y for x,y in zip(a,b)]
p = [i for i in c if i > 0]
m = [i for i in c if i < 0]
f = sum(m)
l = len(m)
for k in sorted(p, reverse=True):
if f >= 0:
break
f += k
l += 1
print(l) | s106760084 | Accepted | 108 | 18,356 | 325 | n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
if sum(a) < sum(b):
print(-1)
exit()
c = [x-y for x,y in zip(a,b)]
p = [z for z in c if z > 0]
m = [z for z in c if z < 0]
f = sum(m)
l = len(m)
for k in sorted(p, reverse=True):
if f >= 0:
break
f += k
l += 1
pri... |
s779000607 | p03474 | u868418093 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 292 | 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 = list(map(int,input().split(" ")))
s = input()
postal_code_len = a+b+1
num_list = list(map(str, range(0,10)))
flag = True
print([c in num_list for c in list(s[:a]+s[a+1:]) ])
if s[a] == "-" and all([ c in num_list for c in list(s[:a]+s[a+1:]) ]):
print("Yes")
else:
print("No") | s053699154 | Accepted | 17 | 3,064 | 293 | a,b = list(map(int,input().split(" ")))
s = input()
postal_code_len = a+b+1
num_list = list(map(str, range(0,10)))
flag = True
#print([c in num_list for c in list(s[:a]+s[a+1:]) ])
if s[a] == "-" and all([ c in num_list for c in list(s[:a]+s[a+1:]) ]):
print("Yes")
else:
print("No") |
s430934378 | p03737 | u503901534 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 129 | 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. | a,b,c = map(str,input().split())
aa = list(a)
bb = list(b)
cc = list(c)
abc = aa[0] + bb[0] + cc[0]
abc.capitalize()
print(abc) | s388812261 | Accepted | 17 | 2,940 | 135 | a,b,c = map(str,input().split())
aa = list(a)
bb = list(b)
cc = list(c)
abc = aa[0] + bb[0] + cc[0]
abc.upper()
print(abc.upper())
|
s170682752 | p03377 | u354638986 | 2,000 | 262,144 | Wrong Answer | 96 | 2,940 | 116 | There are a total of A + B cats and dogs. Among them, A are known to be cats, but the remaining B are not known to be either cats or dogs. Determine if it is possible that there are exactly X cats among these A + B animals. | a, b, x = map(int, input().split())
if a > x:
print("No")
elif b < x-a:
print("No")
else:
print("Yes")
| s336841641 | Accepted | 17 | 2,940 | 116 | a, b, x = map(int, input().split())
if a > x:
print("NO")
elif b < x-a:
print("NO")
else:
print("YES")
|
s205044846 | p03129 | u281610856 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 110 | Determine if we can choose K different integers between 1 and N (inclusive) so that no two of them differ by 1. | import math
n, k = map(int, input().split())
if math.ceil(n / 2) >= k:
print('Yes')
else:
print('No') | s509738024 | Accepted | 17 | 2,940 | 110 | import math
n, k = map(int, input().split())
if math.ceil(n / 2) >= k:
print('YES')
else:
print('NO') |
s777836282 | p03502 | u293579463 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 147 | An integer X is called a Harshad number if X is divisible by f(X), where f(X) is the sum of the digits in X when written in base 10. Given an integer N, determine whether it is a Harshad number. | def f(X):
total = 0
while X > 0:
total += X % 10
X /= 10
return total
N = int(input())
if N / f(N) == 0:
print("Yes")
else:
print("No")
| s487676447 | Accepted | 20 | 3,316 | 151 | def f(X):
total = 0
while X > 0:
total += X % 10
X = X // 10
return total
N = int(input())
if N % f(N) == 0:
print("Yes")
else:
print("No")
|
s048260653 | p03068 | u483005329 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,060 | 138 | You are given a string S of length N consisting of lowercase English letters, and an integer K. Print the string obtained by replacing every character in S that differs from the K-th character of S, with `*`. | n=int(input())
s=list(input())
k=int(input())
t=s[k-1]
print(t)
for i in range(len(s)):
if s[i]!=t:
s[i]="*"
print("".join(s)) | s912542610 | Accepted | 17 | 2,940 | 118 | n=int(input())
s=list(input())
k=int(input())
l=s[k-1]
for i in range(n):
if s[i]!=l:
s[i]="*"
print("".join(s)) |
s368743094 | p02399 | u510829608 | 1,000 | 131,072 | Wrong Answer | 20 | 7,636 | 59 | 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) | s759144260 | Accepted | 30 | 7,636 | 85 | a,b = map(int, input().split())
print('{0} {1} {2:.5f}'.format(a // b, a % b, a / b)) |
s826021665 | p03474 | u388904130 | 2,000 | 262,144 | Wrong Answer | 22 | 3,444 | 234 | 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. | import copy
a,b = map(int, input().split())
s = list(input())
tmp = copy.copy(s)
tmp.pop(a)
if 1 <= a and b <= 5 and a + b + 1 == len(s) and s[a] == '-' and 'tmp'.join(tmp).isnumeric():
print('yes')
else:
print('No')
| s872145629 | Accepted | 17 | 2,940 | 116 | a,b = map(int, input().split())
s = input()
print('Yes' if s[a] == '-' and (s[:a] + s[a + 1:]).isdigit() else 'No')
|
s254346135 | p02419 | u130834228 | 1,000 | 131,072 | Wrong Answer | 20 | 7,364 | 221 | Write a program which reads a word W and a text T, and prints the number of word W which appears in text T T consists of string Ti separated by space characters and newlines. Count the number of Ti which equals to W. The word and text are case insensitive. | W = input()
print(W)
t=0
while(1):
char_list = list(x for x in input().split())
print(char_list)
if char_list[0] == 'END_OF_TEXT':
break
for i in range(len(char_list)):
if W == char_list[i]:
t += 1
print(t) | s682674254 | Accepted | 30 | 7,384 | 239 | W = input().lower()
#print(W)
t=0
while(1):
char_list = list(x for x in input().split())
#print(char_list)
if char_list[0] == 'END_OF_TEXT':
break
for i in range(len(char_list)):
if W == char_list[i].lower():
t += 1
print(t) |
s360946229 | p03338 | u781262926 | 2,000 | 1,048,576 | Wrong Answer | 18 | 2,940 | 98 | 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 ... | n = int(input())
S = input().strip()
print(max(len(set(S[i+1:]) & set(S[:i])) for i in range(n))) | s845301409 | Accepted | 18 | 2,940 | 101 | n = int(input())
S = input().strip()
print(max(len(set(S[:i+1]) & set(S[i+1:])) for i in range(n-1))) |
s884013294 | p03737 | u614181788 | 2,000 | 262,144 | Wrong Answer | 27 | 8,996 | 65 | 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. | s = list(map(str,input().split()))
print(s[0][0]+s[1][0]+s[2][0]) | s916205773 | Accepted | 28 | 9,088 | 75 | s = list(map(str,input().split()))
print((s[0][0]+s[1][0]+s[2][0]).upper()) |
s004636063 | p03417 | u591295155 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 188 | 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 and M == 1:
print(1)
elif N == 1 and M > 1:
print(M-2)
elif M == 1 and N > 1:
print(N-2)
elif N > 1 and M > 2:
print((N-2)*(M-2)) | s047731773 | Accepted | 17 | 2,940 | 53 | N,M= map(int,input().split())
print(abs((N-2)*(M-2))) |
s538097432 | p03573 | u347600233 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 132 | You are given three integers, A, B and C. Among them, two are the same, but the remaining one is different from the rest. For example, when A=5,B=7,C=5, A and C are the same, but B is different. Find the one that is different from the rest among the given three integers. | abc = [int(i) for i in input().split()]
if abc[0] == abc[1]:
print(abc[0])
else:
print((set(abc[:2]) & set([abc[2]])).pop()) | s162868773 | Accepted | 18 | 3,188 | 149 | abc = [int(i) for i in input().split()]
if abc[0] == abc[1]:
print(abc[2])
else:
print((set(abc[:2]) - (set(abc[:2]) & set([abc[2]]))).pop()) |
s733428506 | p03852 | u339922532 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 78 | 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`. | c = input()
print("voewl" if c in ["a", "b", "c", "d", "e"] else "consonant") | s992120563 | Accepted | 17 | 2,940 | 78 | c = input()
print("vowel" if c in ["a", "i", "u", "e", "o"] else "consonant") |
s617094843 | p03486 | u732870425 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 134 | 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 = list(input())
t = list(input())
ss = "".join(sorted(s))
tt = "".join(sorted(t))
if ss<tt:
print("Yes")
else:
print("No") | s467506014 | Accepted | 19 | 3,060 | 148 | s = list(input())
t = list(input())
ss = "".join(sorted(s))
tt = "".join(sorted(t, reverse=True))
if ss<tt:
print("Yes")
else:
print("No") |
s567322278 | p03679 | u604412462 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 159 | 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. Ot... | xab = list(map(int, input().split()))
if xab[2] <= xab[1]:
print('delicious')
elif xab[1] < xab[2] <= xab[0]:
print('safe')
else:
print('dangerou') | s277576080 | Accepted | 18 | 3,060 | 167 | xab = list(map(int, input().split()))
if xab[2] <= xab[1]:
print('delicious')
elif xab[1] < xab[2] <= xab[0]+xab[1]:
print('safe')
else:
print('dangerous') |
s363839785 | p04011 | u102960641 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 100 | There is a hotel with the following accommodation fee: * X yen (the currency of Japan) per night, for the first K nights * Y yen per night, for the (K+1)-th and subsequent nights Tak is staying at this hotel for N consecutive nights. Find his total accommodation fee. | n = int(input())
k = int(input())
x = int(input())
y = int(input())
print(min(n,k)*x + min(n-k,0)*y) | s059568409 | Accepted | 17 | 2,940 | 101 | n = int(input())
k = int(input())
x = int(input())
y = int(input())
print(min(n,k)*x + max(n-k,0)*y)
|
s415075613 | p03861 | u339199690 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 114 | 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())
if x == a:
print((b - a + 1) // x + 1)
else:
print((b - a + 1) // x)
| s797635470 | Accepted | 17 | 2,940 | 61 | a, b, x = map(int, input().split())
print(b//x - (a - 1)//x)
|
s360591564 | p03417 | u619458041 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 169 | 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... | import sys
def main():
input = sys.stdin.readline
N, M = map(int, input().split())
print(max(1, N-2) * max(1, M-2))
if __name__ == '__main__':
main()
| s867422970 | Accepted | 17 | 2,940 | 225 | import sys
def main():
input = sys.stdin.readline
N, M = map(int, input().split())
if N == 2 or M == 2:
print(0)
else:
print(max(1, N-2) * max(1, M-2))
if __name__ == '__main__':
main()
|
s198711302 | p03110 | u820052258 | 2,000 | 1,048,576 | Wrong Answer | 18 | 2,940 | 197 | 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())
s=0
for i in range(n):
x,u=map(str,input().split())
if u == "JPY":
s+=int(x)
elif u == "BTC":
s+=380000*float(x)
else:
s+=0
print(int(s))
| s369810547 | Accepted | 17 | 2,940 | 192 | n = int(input())
s=0
for i in range(n):
x,u=map(str,input().split())
if u == "JPY":
s+=int(x)
elif u == "BTC":
s+=380000*float(x)
else:
s+=0
print(s)
|
s488128775 | p03719 | u325206354 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 116 | You are given three integers A, B and C. Determine whether C is not less than A and not greater than B. | # -*- coding: utf-8 -*-
a,b,c = list(map(int,input().split()))
if a < b < c:
print("Yes")
else:
print("No")
| s334460776 | Accepted | 17 | 2,940 | 92 | a,b,c=map(int,input().split())
if a<=c and b>=c:
print("Yes")
else:
print("No")
|
s338424070 | p03433 | u051751608 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 97 | E869120 has A 1-yen coins and infinitely many 500-yen coins. Determine if he can pay exactly N yen using only these coins. | n, a = [int(input(i)) for i in range(2)]
if n % 500 <= a:
print('Yes')
else:
print('No')
| s304420453 | Accepted | 17 | 2,940 | 90 | n = int(input())
a = int(input())
if n % 500 <= a:
print('Yes')
else:
print('No')
|
s204251085 | p02615 | u655663334 | 2,000 | 1,048,576 | Wrong Answer | 196 | 32,516 | 306 | Quickly after finishing the tutorial of the online game _ATChat_ , you have decided to visit a particular place with N-1 players who happen to be there. These N players, including you, are numbered 1 through N, and the **friendliness** of Player i is A_i. The N players will arrive at the place one by one in some order... | import collections
N = int(input())
As = list(map(int, input().split()))
As.sort(reverse = True)
print(As)
circle_que = collections.deque()
circle_que.append(As[0])
ans = 0
for A in As[1:]:
circle_que.append(A)
circle_que.append(A)
ans += circle_que.popleft()
#print(ans)
print(ans) | s447051206 | Accepted | 171 | 32,352 | 307 | import collections
N = int(input())
As = list(map(int, input().split()))
As.sort(reverse = True)
#print(As)
circle_que = collections.deque()
circle_que.append(As[0])
ans = 0
for A in As[1:]:
circle_que.append(A)
circle_que.append(A)
ans += circle_que.popleft()
#print(ans)
print(ans) |
s902191655 | p02602 | u771089154 | 2,000 | 1,048,576 | Wrong Answer | 273 | 31,824 | 340 | M-kun is a student in Aoki High School, where a year is divided into N terms. There is an exam at the end of each term. According to the scores in those exams, a student is given a grade for each term, as follows: * For the first through (K-1)-th terms: not given. * For each of the K-th through N-th terms: the m... | n,k= map(int, input().split())
lst = []
lst2 = []
sum=0
j=0
lst = [int(item) for item in input().split()]
for i in range(n):
if i==0:
while i<k-1:
sum=sum+lst[i]
i=i+1
else:
sum=sum-lst[j]
sum=sum+lst[i]
j=j+1
lst2.append(sum)
x=len(lst2)
for i in range(1,x):
if lst2[i]>lst2[i-1]:
print("Yes")
... | s992892367 | Accepted | 240 | 31,568 | 343 | n,k= map(int, input().split())
lst = []
lst2 = []
sum=0
j=0
lst = [int(item) for item in input().split()]
i=0
while i<n:
if i==0:
while i<k-1:
sum=sum+lst[i]
i=i+1
else:
sum=sum-lst[j]
sum=sum+lst[i]
j=j+1
lst2.append(sum)
i=i+1
x=len(lst2)
for i in range(1,x):
if lst2[i]>lst2[i-1]:
print("Yes"... |
s452166696 | p03565 | u858523893 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 517 | E869120 found a chest which is likely to contain treasure. However, the chest is locked. In order to open it, he needs to enter a string S consisting of lowercase English letters. He also found a string S', which turns out to be the string S with some of its letters (possibly all or none) replaced with `?`. One mo... | S = input()
T = input()
search_str = ["?" for x in range(len(T))]
last_occ = -1
for i in range(len(S)) :
if i < len(S) - len(T) + 1:
ok_cnt = 0
for j in range(len(T)) :
if S[i + j] == T[j] or S[i + j] == "?" :
ok_cnt += 1
if ok_cnt == len(T) :
... | s674614508 | Accepted | 17 | 3,064 | 491 | S = input()
T = input()
search_str = ["?" for x in range(len(T))]
last_occ = -1
for i in range(len(S)) :
if i < len(S) - len(T) + 1:
ok_cnt = 0
for j in range(len(T)) :
if S[i + j] == T[j] or S[i + j] == "?" :
ok_cnt += 1
if ok_cnt == len(T) :
... |
s141397060 | p03502 | u061732150 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 193 | An integer X is called a Harshad number if X is divisible by f(X), where f(X) is the sum of the digits in X when written in base 10. Given an integer N, determine whether it is a Harshad number. | def main():
N = int(input())
f = 0
for n in str(N):
f += int(n)
if f%N == 0:
print("Yes")
else:
print("No")
if __name__ == '__main__':
main()
| s469756288 | Accepted | 17 | 2,940 | 193 | def main():
N = int(input())
f = 0
for n in str(N):
f += int(n)
if N%f == 0:
print("Yes")
else:
print("No")
if __name__ == '__main__':
main()
|
s391462517 | p03415 | u865191802 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 116 | We have a 3×3 square grid, where each square contains a lowercase English letters. The letter in the square at the i-th row from the top and j-th column from the left is c_{ij}. Print the string of length 3 that can be obtained by concatenating the letters in the squares on the diagonal connecting the top-left and bot... | data = [[i for i in input().split()] for i in range(3)]
num = 0
for i in data:
for j in i:
print(j[num])
num+=1 | s766368101 | Accepted | 18 | 2,940 | 144 | data = [[i for i in input().split()] for i in range(3)]
num = 0
answer = ""
for i in data:
for j in i:
answer+=j[num]
num+=1
print(answer) |
s392928565 | p00015 | u364509382 | 1,000 | 131,072 | Wrong Answer | 20 | 7,648 | 79 | A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. If given integers or t... | n = int(input())
for i in range(n):
a=int(input())
b=int(input())
print(a+b) | s567307563 | Accepted | 20 | 7,636 | 124 | n = int(input())
for i in range(n):
s = int(input())+int(input())
if len(str(s))>80:
print("overflow")
else:
print(s) |
s682777517 | p03023 | u336721073 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 31 | Given an integer N not less than 3, find the sum of the interior angles of a regular polygon with N sides. Print the answer in degrees, but do not print units. | N=int(input())
print((N-2)*360) | s748089493 | Accepted | 17 | 2,940 | 31 | N=int(input())
print((N-2)*180) |
s669224910 | p04011 | u243572357 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 70 | There is a hotel with the following accommodation fee: * X yen (the currency of Japan) per night, for the first K nights * Y yen per night, for the (K+1)-th and subsequent nights Tak is staying at this hotel for N consecutive nights. Find his total accommodation fee. | n, k, x, y = [int(input()) for i in range(4)]
if n < k:
print(n * x) | s659350763 | Accepted | 17 | 2,940 | 102 | n, k, x, y = [int(input()) for i in range(4)]
if n >= k:
print(k*x + (n-k) * y)
else:
print(n * x) |
s963223087 | p03433 | u062189367 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 100 | E869120 has A 1-yen coins and infinitely many 500-yen coins. Determine if he can pay exactly N yen using only these coins. | N = int(input())
A = int(input())
if N % 500 < A:
print('YES')
else:
print('NO')
| s694634914 | Accepted | 17 | 2,940 | 93 | N = int(input())
A = int(input())
if N % 500 <= A:
print('Yes')
else:
print('No')
|
s236484855 | p03730 | u136395536 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 126 | 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 = (int(i) for i in input().split())
test = (B*C)/A
if test == int(test):
print("YES")
else:
print("NO") | s762952999 | Accepted | 17 | 2,940 | 183 | A,B,C = (int(i) for i in input().split())
dividable = False
for i in range(B):
if A*(i+1) % B == C:
dividable = True
if dividable:
print("YES")
else:
print("NO") |
s593180184 | p03068 | u825115925 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 149 | You are given a string S of length N consisting of lowercase English letters, and an integer K. Print the string obtained by replacing every character in S that differs from the K-th character of S, with `*`. | N=int(input())
A=input()
x=int(input())
for i in range(N):
if A[i]!=A[x-1]:
print(A[i])
A=A.replace(A[i],"*")
print(A)
| s821176548 | Accepted | 17 | 2,940 | 129 | N=int(input())
A=input()
x=int(input())
for i in range(N):
if A[i]!=A[x-1]:
A=A.replace(A[i],"*")
print(A)
|
s321193406 | p02392 | u810591206 | 1,000 | 131,072 | Wrong Answer | 30 | 7,488 | 89 | Write a program which reads three integers a, b and c, and prints "Yes" if a < b < c, otherwise "No". | a, b, c = map(int, input().split())
if a < b < c:
print('YES')
else:
print('NO') | s322034671 | Accepted | 20 | 7,496 | 89 | a, b, c = map(int, input().split())
if a < b < c:
print('Yes')
else:
print('No') |
s332809862 | p02616 | u580273604 | 2,000 | 1,048,576 | Wrong Answer | 2,211 | 33,248 | 402 | Given are N integers A_1,\ldots,A_N. We will choose exactly K of these elements. Find the maximum possible product of the chosen elements. Then, print the maximum product modulo (10^9+7), using an integer between 0 and 10^9+6 (inclusive). | N,K=map(int, input().split())
A=list(map(int,input().split()))
A=sorted(A)
print('A:',A)
B=sorted(A, key=lambda x: abs(x), reverse=True)
print('B:',B)
ABSmax=1
ABSmin=1
for i in range(K):
ABSmax=ABSmax*B[i]
ABSmin=ABSmin*B[-1-i]
print(ABSmax,ABSmin)
C=1
for i in range(K-1):
C=C*B[0]
del B[0]
BB=sorted(B)... | s956692729 | Accepted | 795 | 65,864 | 1,163 | import numpy as np
N,K=map(int, input().split())
A =list(map(int,input().split()))
MOD = 10 ** 9 + 7
if N==K:
ans0 = 1
for a in A:
ans0 = ans0*a%MOD
print(ans0)
exit()
A=sorted(A)
if (K%2==1 and A[-1]<0):
ans1 = 1
for a in A[N-K:N]:
ans1 = ans1*a%MOD
print(ans1)
exit()
A=sorted(A, key=lambda... |
s360610654 | p03795 | u288948615 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 43 | Snuke has a favorite restaurant. The price of any meal served at the restaurant is 800 yen (the currency of Japan), and each time a customer orders 15 meals, the restaurant pays 200 yen back to the customer. So far, Snuke has ordered N meals at the restaurant. Let the amount of money Snuke has paid to the restaurant ... | N = int(input())
print(800*N - 200* 15//N) | s969122078 | Accepted | 17 | 2,940 | 45 | N = int(input())
print(800*N - 200* (N//15)) |
s197461680 | p03548 | u294385082 | 2,000 | 262,144 | Wrong Answer | 32 | 2,940 | 151 | We have a long seat of width X centimeters. There are many people who wants to sit here. A person sitting on the seat will always occupy an interval of length Y centimeters. We would like to seat as many people as possible, but they are all very shy, and there must be a gap of length at least Z centimeters between two... | x,y,z = map(int,input().split())
count = 0
t = 0
for i in range(10**6):
t += y
if t<=x:
count += 1
else:
exit()
t += z
print(count) | s584891821 | Accepted | 39 | 3,064 | 161 | x,y,z = map(int,input().split())
s = z
count = 0
for i in range(10**99):
s += y
if s <= x-z:
count += 1
elif s> x-z:
break
s+= z
print(count) |
s774976681 | p03545 | u190406011 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 768 | Sitting in a station waiting room, Joisino is gazing at her train ticket. The ticket is numbered with four digits A, B, C and D in this order, each between 0 and 9 (inclusive). In the formula A op1 B op2 C op3 D = 7, replace each of the symbols op1, op2 and op3 with `+` or `-` so that the formula holds. The given in... | abcd = input()
def train_ticket(flg,sum,op):
if flg == 0:
if train_ticket(flg + 1, sum, op + "+"):
return True
elif train_ticket(flg + 1, sum, op + "-"):
return True
if flg >= len(abcd):
if operation(sum, op[-1], flg) == 7:
print("".join([abcd[i] + op... | s167110086 | Accepted | 17 | 3,064 | 775 | abcd = input()
def train_ticket(flg,sum,op):
if flg == 0:
if train_ticket(flg + 1, sum, op + "+"):
return True
elif train_ticket(flg + 1, sum, op + "-"):
return True
if flg >= len(abcd):
if operation(sum, op[-1], flg) == 7:
print("".join([abcd[i] + op... |
s282388728 | p03544 | u934868410 | 2,000 | 262,144 | Wrong Answer | 19 | 3,060 | 83 | It is November 18 now in Japan. By the way, 11 and 18 are adjacent Lucas numbers. You are given an integer N. Find the N-th Lucas number. Here, the i-th Lucas number L_i is defined as follows: * L_0=2 * L_1=1 * L_i=L_{i-1}+L_{i-2} (i≥2) | n = int(input())
x = 2
ans = 1
for i in range(n-1):
ans += x
x = ans
print(ans) | s750848415 | Accepted | 17 | 2,940 | 95 | n = int(input())
x = 2
ans = 1
for i in range(n-1):
tmp = ans
ans += x
x = tmp
print(ans) |
s915445819 | p03944 | u039623862 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 301 | There is a rectangle in the xy-plane, with its lower left corner at (0, 0) and its upper right corner at (W, H). Each of its sides is parallel to the x-axis or y-axis. Initially, the whole region within the rectangle is painted white. Snuke plotted N points into the rectangle. The coordinate of the i-th (1 ≦ i ≦ N) po... | w,h,n = map(int, input().split())
x_min = 0
x_max = w
y_min = 0
y_max = h
for i in range(n):
x,y,a = map(int, input().split())
if a == 1:
x_max = x
elif a == 2:
x_min = x
elif a == 3:
y_max = y
else:
y_min = y
print((y_max-y_min) * (x_max-x_min)) | s192423851 | Accepted | 17 | 3,064 | 369 | w, h, n = map(int, input().split())
x_min = 0
x_max = w
y_min = 0
y_max = h
for i in range(n):
x, y, a = map(int, input().split())
if a == 1:
x_min = max(x, x_min)
elif a == 2:
x_max = min(x, x_max)
elif a == 3:
y_min = max(y, y_min)
else:
y_max = min(y, y_max)
prin... |
s230176163 | p03485 | u791527495 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 88 | 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. | li = list(map(int,input().split()))
heikin = (li[0] + li[1] ) / 2
print(int(heikin + 1)) | s009000648 | Accepted | 17 | 2,940 | 55 | a,b = map(int,input().split())
print((a + b + 1) // 2 ) |
s490193737 | p04044 | u746849814 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 84 | Iroha has a sequence of N strings S_1, S_2, ..., S_N. The length of each string is L. She will concatenate all of the strings in some order, to produce a long string. Among all strings that she can produce in this way, find the lexicographically smallest one. Here, a string s=s_1s_2s_3...s_n is _lexicographically sm... | n, l = map(int, input().split())
s = [input() for _ in range(n)]
s.sort()
''.join(s) | s593252058 | Accepted | 17 | 3,060 | 91 | n, l = map(int, input().split())
s = [input() for _ in range(n)]
s.sort()
print(''.join(s)) |
s088328286 | p02380 | u350064373 | 1,000 | 131,072 | Wrong Answer | 20 | 7,612 | 288 | For given two sides of a triangle _a_ and _b_ and the angle _C_ between them, calculate the following properties: * S: Area of the triangle * L: The length of the circumference of the triangle * h: The height of the triangle with side a as a bottom edge | import math
a, b, C = map(int, input().split())
sin = math.sin(C)
cos = math.cos(C)
S =(a*b*sin) / 2
L = math.sqrt((a**2) + (b**2) - (2*a*b*cos))
#L**2 = (a**2) + (b**2) - (2*a*b*cos)
h = (a*b*sin/2)/(a/2)
print("{0:.8f}".format(S))
print("{0:.8f}".format(L))
print("{0:.8f}".format(h)) | s293640232 | Accepted | 30 | 7,836 | 310 | import math
a, b, C = map(int, input().split())
C2 = math.radians(C)
sin = math.sin(C2)
cos = math.cos(C2)
c = math.sqrt(a**2 + b**2 - 2*a*b*cos)
S =(a*b*sin) / 2
L = a+b+c
#L**2 = a**2 + b**2 - 2*a*b*cos
h = (a*b*sin/2)/(a/2)
print("{0:.8f}".format(S))
print("{0:.8f}".format(L))
print("{0:.8f}".format(h)) |
s120830162 | p03370 | u994988729 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 117 | Akaki, a patissier, can make N kinds of doughnut using only a certain powder called "Okashi no Moto" (literally "material of pastry", simply called Moto below) as ingredient. These doughnuts are called Doughnut 1, Doughnut 2, ..., Doughnut N. In order to make one Doughnut i (1 ≤ i ≤ N), she needs to consume m_i grams o... | n,x=map(int,input().split())
m=[]
for _ in range(n):
m.append(int(input()))
m.sort()
ans=n+(x-sum(m))//x
print(ans) | s114861544 | Accepted | 17 | 2,940 | 120 | n,x=map(int,input().split())
m=[]
for _ in range(n):
m.append(int(input()))
m.sort()
ans=n+(x-sum(m))//m[0]
print(ans) |
s804306788 | p03131 | u600402037 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,060 | 338 | 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())
answer = 1
if B - A <= 2:
answer += K
else:
time = A - 1
if time + 2 > K or B - A < 2:
answer += K
else:
answer += time
q, mod = divmod(K-time, 2)
answer += q
answer += mod
print(answer) | s020037227 | Accepted | 17 | 3,060 | 346 | K, A, B = map(int, input().split())
answer = 1
if B - A <= 2:
answer += K
else:
time = A - 1
if time + 2 > K or B - A < 2:
answer += K
else:
answer += time
q, mod = divmod(K-time, 2)
answer += q * (B-A)
answer += mod
print(answer) |
s191648689 | p00048 | u567380442 | 1,000 | 131,072 | Wrong Answer | 30 | 6,748 | 616 | ボクシングは体重によって階級が分けられています。体重を読み込んで、その階級を出力するプログラムを作成してください。階級と体重の関係は以下の表のとおりとします。 階級| 体重(kg) ---|--- light fly| 48.00kg 以下 fly| 48.00kg 超 51.00kg 以下 bantam| 51.00kg 超 54.00kg 以下 feather| 54.00kg 超 57.00kg 以下 light| 57.00kg 超 60.00kg 以下 light welter| 60.00kg 超 64.00kg 以下 welter| 64.00kg 超 69.00 kg 以下 li... | import sys
f = sys.stdin
classes = {'light fly':(00.00, 48.00),
'fly':(48.00, 51.00),
'bantam':(51.00, 54.00),
'feather':(54.00,57.00),
'light':(57.00,60.00),
'light welter':(60.00,64.00),
'welter':(64.00,69.00),
'light middle':(69.00,75.00... | s686116137 | Accepted | 30 | 6,748 | 615 | import sys
f = sys.stdin
classes = {'light fly':(00.00, 48.00),
'fly':(48.00, 51.00),
'bantam':(51.00, 54.00),
'feather':(54.00,57.00),
'light':(57.00,60.00),
'light welter':(60.00,64.00),
'welter':(64.00,69.00),
'light middle':(69.00,75.00)... |
s779584327 | p00773 | u089116225 | 8,000 | 131,072 | Wrong Answer | 210 | 5,612 | 741 | VAT (value-added tax) is a tax imposed at a certain rate proportional to the sale price. Our store uses the following rules to calculate the after-tax prices. * When the VAT rate is _x_ %, for an item with the before-tax price of _p_ yen, its after-tax price of the item is _p_ (100+ _x_ ) / 100 yen, fractions roun... | def change(before_tax,after_tax,previous_price):
#change z from taxrate x to taxrate y
tmp_original_price = previous_price * 100 / (100 + before_tax)
if tmp_original_price % 1 == 0:
original_price = tmp_original_price
else:
original_price = tmp_original_price // 1 + 1
return int(orig... | s672821513 | Accepted | 6,970 | 5,640 | 738 | def change(before_tax,after_tax,previous_price):
original_price = 0
for i in range(1, previous_price+1):
if i * (100 + before_tax) // 100 == previous_price:
original_price = i
break
else:
pass
return original_price * (100 + after_tax) // 100
ans_list = []... |
s610518239 | p03796 | u946386741 | 2,000 | 262,144 | Wrong Answer | 41 | 2,940 | 107 | 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. | n = int(input())
result = 1
for i in range(1,n):
result *= i
result %= (10**9 + 7)
print(result) | s691208706 | Accepted | 34 | 2,940 | 110 | n = int(input())
result = 1
for i in range(1, n+1):
result = (i * result) % (10 ** 9 + 7)
print(result) |
s427155805 | p03836 | u745514010 | 2,000 | 262,144 | Wrong Answer | 30 | 9,180 | 1,009 | Dolphin resides in two-dimensional Cartesian plane, with the positive x-axis pointing right and the positive y-axis pointing up. Currently, he is located at the point (sx,sy). In each second, he can move up, down, left or right by a distance of 1. Here, both the x\- and y-coordinates before and after each movement ... | sx, sy, tx, ty = map(int, input().split())
dx = tx - sx
dy = ty - sy
if dx == 0:
if dy > 0:
d1 = "U"
d2 = "D"
else:
d1 = "D"
d2 = "U"
dy = abs(dy)
ans = d1 * dy
ans += "R" + d2 * dy + "L"
ans += "L" + d1 * dy + "R"
ans += d1 + "RR" + d2 * (dy + 2) + "LL" + d1... | s691003581 | Accepted | 25 | 9,204 | 1,009 | sx, sy, tx, ty = map(int, input().split())
dx = tx - sx
dy = ty - sy
if dx == 0:
if dy > 0:
d1 = "U"
d2 = "D"
else:
d1 = "D"
d2 = "U"
dy = abs(dy)
ans = d1 * dy
ans += "R" + d2 * dy + "L"
ans += "L" + d1 * dy + "R"
ans += d1 + "RR" + d2 * (dy + 2) + "LL" + d1... |
s718331598 | p03478 | u324975917 | 2,000 | 262,144 | Wrong Answer | 35 | 3,060 | 196 | 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())
for i in range(1,n):
n1 = 0
s = str(n)
array = list(map(int, s))
s1 = sum(array)
if a <= n1 <= b:
n1 = n1+s1
print(n1)
| s880737272 | Accepted | 35 | 3,060 | 197 | n, a, b = map(int, input().split())
n1 = 0
for i in range(1,n+1):
s = str(i)
array = list(map(int, s))
s1 = sum(array)
if a <= s1 <= b:
n1 = n1+i
print(n1) |
s861427410 | p03712 | u408791346 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 203 | You are given a image with a height of H pixels and a width of W pixels. Each pixel is represented by a lowercase English letter. The pixel at the i-th row from the top and j-th column from the left is a_{ij}. Put a box around this image and output the result. The box should consist of `#` and have a thickness of 1. | h,w = map(int, input().split())
n = list(input() for _ in range(h))
tb = '#'*(w+2)
for i in range(h):
n[i] = '#'+n[i]+'#'
else:
n.insert(0, tb)
n.append(tb)
print(n[g] for g in range(h+2)) | s940686521 | Accepted | 17 | 3,060 | 208 | h,w = map(int, input().split())
n = list(input() for _ in range(h))
tb = '#'*(w+2)
for i in range(h):
n[i] = '#'+n[i]+'#'
else:
n.insert(0, tb)
n.append(tb)
for g in range(h+2):
print(n[g]) |
s855048271 | p03737 | u480138356 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 76 | 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. | a = input().split()
for s in a:
print(chr(ord(s[0]) + ord("A") -ord("a"))) | s378019215 | Accepted | 17 | 2,940 | 92 | a = input().split()
for s in a:
print(chr(ord(s[0]) + ord("A") -ord("a")), end="")
print() |
s035486429 | p03609 | u988402778 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 19 | We have a sandglass that runs for X seconds. The sand drops from the upper bulb at a rate of 1 gram per second. That is, the upper bulb initially contains X grams of sand. How many grams of sand will the upper bulb contains after t seconds? | print(input()[::2]) | s882877074 | Accepted | 21 | 3,192 | 53 | a,b=map(int,input().split())
x = max(a-b,0)
print (x) |
s427734876 | p03544 | u201660334 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 147 | It is November 18 now in Japan. By the way, 11 and 18 are adjacent Lucas numbers. You are given an integer N. Find the N-th Lucas number. Here, the i-th Lucas number L_i is defined as follows: * L_0=2 * L_1=1 * L_i=L_{i-1}+L_{i-2} (i≥2) | n = int(input())
l = [2, 1]
if n == 1:
print(2)
elif n == 2:
print(1)
else:
for i in range(n - 2):
l.append(l[-1] + l[-2])
print(l[-1]) | s945371799 | Accepted | 17 | 2,940 | 124 | n = int(input())
l = [2, 1]
if n == 1:
print(1)
else:
for i in range(n - 1):
l.append(l[-1] + l[-2])
print(l[-1])
|
s334847912 | p03049 | u172035535 | 2,000 | 1,048,576 | Wrong Answer | 30 | 3,700 | 371 | 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. | import sys
input = sys.stdin.readline
S = [input() for _ in range(int(input()))]
AB = 0
end_A = 0
start_B = 0
sB_eA = 0
for s in S:
AB += s.count('AB')
if s[0] == 'B' and s[-1] == 'A':
sB_eA += 1
elif s[0] == 'B':
start_B += 1
elif s[-1] == 'A':
end_A += 1
amari = abs(start_B-e... | s690556046 | Accepted | 34 | 3,700 | 382 | S = [input() for _ in range(int(input()))]
end_A = 0
start_B = 0
sB_eA = 0
ans = 0
for s in S:
ans += s.count('AB')
if s[0] == 'B' and s[-1] == 'A':
sB_eA += 1
elif s[0] == 'B':
start_B += 1
elif s[-1] == 'A':
end_A += 1
ans += min(start_B,end_A)
if start_B == 0 and end_A == ... |
s832933457 | p04044 | u867848444 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 95 | Iroha has a sequence of N strings S_1, S_2, ..., S_N. The length of each string is L. She will concatenate all of the strings in some order, to produce a long string. Among all strings that she can produce in this way, find the lexicographically smallest one. Here, a string s=s_1s_2s_3...s_n is _lexicographically sm... | n,l=map(int,input().split())
s=sorted([input() for i in range(n)])
s_1=''.join(s)
print('s_1')
| s337854840 | Accepted | 17 | 3,060 | 88 | n,l=map(int,input().split())
s=[input() for i in range(n)]
s=sorted(s)
print(*s,sep='') |
s951020244 | p03447 | u014322942 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 304 | 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("ケーキは1個いくら?"))
b = int(input("ドーナッツは1個いくら?"))
#print(x,a,b)
x -= a
x = x%b
print(x) | s534206537 | Accepted | 17 | 2,940 | 212 |
x = int(input())
a = int(input())
b = int(input())
#print(x,a,b)
x -= a
x = x%b
print(x) |
s373555860 | p02237 | u912143677 | 1,000 | 131,072 | Wrong Answer | 20 | 5,596 | 263 | There are two standard ways to represent a graph $G = (V, E)$, where $V$ is a set of vertices and $E$ is a set of edges; Adjacency list representation and Adjacency matrix representation. An adjacency-list representation consists of an array $Adj[|V|]$ of $|V|$ lists, one for each vertex in $V$. For each $u \in V$, th... | n = int(input())
g = [[0 for _ in range(n)] for _ in range(n)]
for i in range(n):
a = list(map(int, input().split()))
for j in range(a[1]):
g[a[0] - 1][a[j + 2] - 1] = 1
g[a[j + 2] - 1][a[0] - 1] = 1
for i in range(n):
print(*g[i])
| s666219413 | Accepted | 20 | 6,392 | 225 | n = int(input())
g = [[0 for _ in range(n)] for _ in range(n)]
for i in range(n):
a = list(map(int, input().split()))
for j in range(a[1]):
g[a[0] - 1][a[j + 2] - 1] = 1
for i in range(n):
print(*g[i])
|
s477291101 | p02972 | u392319141 | 2,000 | 1,048,576 | Wrong Answer | 2,104 | 6,488 | 213 | There are N empty boxes arranged in a row from left to right. The integer i is written on the i-th box from the left (1 \leq i \leq N). For each of these boxes, Snuke can choose either to put a ball in it or to put nothing in it. We say a set of choices to put a ball or not in the boxes is good when the following con... | N = int(input())
A = list(map(int, input().split()))
ball = [0] * N
ball[-1] = A[-1]
for i in range(N-2, -1, -1) :
bit = A[i]
for j in range(i, N) :
bit ^= ball[i]
ball[i] = bit
print(*ball) | s883274228 | Accepted | 577 | 13,112 | 314 | N = int(input())
A = list(map(int, input().split()))
ans = [0] * N
for i in range(N)[:: -1]:
a = A[i]
cnt = 0
for j in range(i, N, (i + 1)):
cnt += ans[j]
if cnt % 2 != a % 2:
ans[i] = 1
M = sum(ans)
print(M)
if M > 0:
print(*[i for i, a in enumerate(ans, start=1) if a > 0])
|
s725908666 | p02663 | u773081031 | 2,000 | 1,048,576 | Wrong Answer | 29 | 9,168 | 127 | 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 = map(int, input().split())
h = h2 - h1
if m1>m2:
h-=1
m = m2 - m1 + 60
else:
m = m2 - m1
l = h*60 + m - k | s681513019 | Accepted | 29 | 9,164 | 136 | h1, m1, h2, m2, k = map(int, input().split())
h = h2 - h1
if m1>m2:
h-=1
m = m2 - m1 + 60
else:
m = m2 - m1
l = h*60 + m - k
print(l) |
s926563035 | p03543 | u374974389 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 560 | 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**? | num = list(input())
ans = 7
for i in range(2 ** len(num)):
total = 0
ans_num = []
ans_op = []
for j in range(len(num)):
if((i >> j) & 1):
ans_num.append(num[j])
if(j >= 1):
ans_op.append('+')
total += int(num[j])
else:
ans_n... | s996911603 | Accepted | 17 | 3,060 | 137 | n = input()
if n[0] == n[1] and n[1] == n[2]:
print('Yes')
elif n[1] == n[2] and n[2] == n[3]:
print('Yes')
else:
print('No') |
s928857364 | p03177 | u193264896 | 2,000 | 1,048,576 | Wrong Answer | 190 | 17,336 | 1,229 | There is a simple directed graph G with N vertices, numbered 1, 2, \ldots, N. For each i and j (1 \leq i, j \leq N), you are given an integer a_{i, j} that represents whether there is a directed edge from Vertex i to j. If a_{i, j} = 1, there is a directed edge from Vertex i to j; if a_{i, j} = 0, there is not. Find ... | from collections import deque
from collections import Counter
from itertools import product, permutations,combinations
from operator import itemgetter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right, bisect
#from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bell... | s951130326 | Accepted | 522 | 12,520 | 730 | import sys
readline = sys.stdin.buffer.readline
import numpy as np
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7
def main():
N, K = map(int, readline().split())
A = list(list(map(int, readline().split())) for _ in range(N))
A = np.array(A)
def dot(A, B):
C = np.zeros((N, ... |
s078807952 | p02744 | u210827208 | 2,000 | 1,048,576 | Wrong Answer | 133 | 4,412 | 262 | In this problem, we only consider strings consisting of lowercase English letters. Strings s and t are said to be **isomorphic** when the following conditions are satisfied: * |s| = |t| holds. * For every pair i, j, one of the following holds: * s_i = s_j and t_i = t_j. * s_i \neq s_j and t_i \neq t_j. F... | n=int(input())
A='abcdefghijklmnopqrstuvwxyz'
def dfs(s,mx):
if len(s)==n:
print(s)
else:
for c in range(mx):
if c==mx-1:
dfs(s+A[c],mx+1)
else:
dfs(s+A[c],mx)
print(dfs('',1)) | s448464003 | Accepted | 177 | 14,532 | 415 | n=int(input())
A='abcdefghijklmnopqrstuvwxyz'
P=['a']
X=[[] for _ in range(n)]
X[0].append('a')
for i in range(n-1):
P.append(A[i+1])
for j in range(len(X[i])):
flag=False
for k in range(len(P)):
X[i+1].append(X[i][j]+P[k])
if not P[k] in X[i][j]:
flag=T... |
s800781539 | p03605 | u951601135 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 38 | It is September 9 in Japan now. You are given a two-digit integer N. Answer the question: Is 9 contained in the decimal notation of N? | N=list(map(int,input()))
print(9 in N) | s197070858 | Accepted | 18 | 2,940 | 34 | print(["No","Yes"]["9"in input()]) |
s143189374 | p03645 | u923279197 | 2,000 | 262,144 | Wrong Answer | 2,106 | 38,320 | 320 | In Takahashi Kingdom, there is an archipelago of N islands, called Takahashi Islands. For convenience, we will call them Island 1, Island 2, ..., Island N. There are M kinds of regular boat services between these islands. Each service connects two islands. The i-th service connects Island a_i and Island b_i. Cat Snuk... | n,m = map(int,input().split())
matrix = [[] for i in range(n)]
for i in range(m):
a,b = map(int,input().split())
a -= 1
b -= 1
matrix[a].append(b)
matrix[b].append(a)
for i in matrix[0]:
for j in matrix[n-1]:
if i == j:
print('possible')
exit()
print('impossible') | s223215351 | Accepted | 606 | 6,132 | 407 | n,m = map(int,input().split())
Check1 = [False]*n
Check2 = [False]*n
for i in range(m):
a,b = map(int,input().split())
if a ==1:
Check1[b-1] = True
elif a == n:
Check2[b-1] = True
elif b == 1:
Check1[a-1] = True
elif b == n:
Check2[a-1] = True
for i in range(n):
i... |
s817375973 | p04044 | u133936772 | 2,000 | 262,144 | Wrong Answer | 19 | 3,060 | 77 | Iroha has a sequence of N strings S_1, S_2, ..., S_N. The length of each string is L. She will concatenate all of the strings in some order, to produce a long string. Among all strings that she can produce in this way, find the lexicographically smallest one. Here, a string s=s_1s_2s_3...s_n is _lexicographically sm... | n,_ = map(int,input().split())
l = sorted(input() for _ in range(n))
print(l) | s322567715 | Accepted | 17 | 3,060 | 80 | n,_ = map(int,input().split())
print(''.join(sorted(input() for _ in range(n)))) |
s072902271 | p04011 | u040033078 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 91 | There is a hotel with the following accommodation fee: * X yen (the currency of Japan) per night, for the first K nights * Y yen per night, for the (K+1)-th and subsequent nights Tak is staying at this hotel for N consecutive nights. Find his total accommodation fee. | a = int(input())
b = int(input())
c = int(input())
d = int(input())
print(b * d + (a-b)*c) | s498318603 | Accepted | 17 | 2,940 | 126 | a = int(input())
b = int(input())
c = int(input())
d = int(input())
if a < b:
print(a * c)
else:
print((a-b) * d + b * c) |
s508725681 | p03607 | u100641536 | 2,000 | 262,144 | Wrong Answer | 2,206 | 16,516 | 219 | You are playing the following game with Joisino. * Initially, you have a blank sheet of paper. * Joisino announces a number. If that number is written on the sheet, erase the number from the sheet; if not, write the number on the sheet. This process is repeated N times. * Then, you are asked a question: How many... | n=int(input())
a = [input() for _ in range(n)]
a.sort()
count = 0
i=0
while i<n-1:
j=i+1
ex=1
while j<n:
if a[j]==a[i]:
ex=1-ex
j+=1
else:
i=j+1
count+=ex
break
print(count+1) | s679379254 | Accepted | 166 | 24,092 | 154 | from collections import Counter
n=int(input())
a = [input() for _ in range(n)]
c = Counter(a)
count = 0
for i in c.keys():
count += c[i]%2
print(count) |
s830435668 | p03024 | u087731474 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,060 | 177 | Takahashi is competing in a sumo tournament. The tournament lasts for 15 days, during which he performs in one match per day. If he wins 8 or more matches, he can also participate in the next tournament. The matches for the first k days have finished. You are given the results of Takahashi's matches as a string S cons... | s = input()
c=0
n = list(map(str, s))
print(n)
for i in n :
if i == 'o' :
c +=1
if c >= 8 or (8-c) == 15 - len(n) :
print('YES')
else :
print('NO') | s768296035 | Accepted | 17 | 3,060 | 168 | s = input()
c=0
n = list(map(str, s))
for i in n :
if i == 'o' :
c +=1
if c >= 8 or (8-c) <= 15 - len(n) :
print('YES')
else :
print('NO') |
s045325898 | p03131 | u247830763 | 2,000 | 1,048,576 | Wrong Answer | 28 | 9,172 | 184 | 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())
if b - a <= 1 or a >= k:
print(k+1)
else:
k -= a - 1
ans = a
ans += (b - a)*(k//2)
if k/2 % 2 == 0:
ans += 1
print(ans) | s616837833 | Accepted | 28 | 9,068 | 182 | k,a,b = map(int,input().split())
if b - a <= 1 or a >= k:
print(k+1)
else:
k -= a - 1
ans = a
ans += (b - a)*(k//2)
if k % 2 != 0:
ans += 1
print(ans) |
s670046370 | p03943 | u694370915 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 286 | 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. Not... | def main():
a, b, c = map(int, input().split())
if a + b == c:
print('YES')
return
if a + c == b:
print('YES')
return
if a == b + c:
print('YES')
return
print('NO')
return
if __name__ == '__main__':
main()
| s060992159 | Accepted | 18 | 2,940 | 288 |
def main():
a, b, c = map(int, input().split())
if a + b == c:
print('Yes')
return
if a + c == b:
print('Yes')
return
if a == b + c:
print('Yes')
return
print('No')
return
if __name__ == '__main__':
main()
|
s809765852 | p03214 | u556589653 | 2,525 | 1,048,576 | Wrong Answer | 20 | 3,064 | 538 | Niwango-kun is an employee of Dwango Co., Ltd. One day, he is asked to generate a thumbnail from a video a user submitted. To generate a thumbnail, he needs to select a frame of the video according to the following procedure: * Get an integer N and N integers a_0, a_1, ..., a_{N-1} as inputs. N denotes the numbe... | N = int(input())
P = list(map(int,input().split()))
sum = 0
ave = 0
ave_first = 99999
k = []
for i in range(N):
sum += P[i]
print(sum)
ave = sum/N
print(ave)
for i in range(0,N-1):
if abs(P[i]-ave)< ave_first:
ave_first = abs(P[i]-ave)
k.clear()
k.append(i)
elif ab... | s067811599 | Accepted | 17 | 3,064 | 512 | N = int(input())
P = list(map(int,input().split()))
sum = 0
ave = 0
ave_first = 99999
k = []
for i in range(N):
sum += P[i]
ave = sum/N
for i in range(0,N-1):
if abs(P[i]-ave)< ave_first:
ave_first = abs(P[i]-ave)
k.clear()
k.append(i)
elif abs(P[i]-ave) == ave_first:
... |
s509460982 | p03730 | u215753631 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 283 | 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... | _input = list(map(int, input().split(" ")))
a = _input[0]
b = _input[1]
c = _input[2]
check_limit = a * b
ratio = 1
remain_list = []
while (True):
remain_list.append(a * ratio % b)
ratio += 1
if ratio > b:
break
if c in remain_list:
print("Yes")
else:
print("No")
| s073908070 | Accepted | 17 | 3,060 | 283 | _input = list(map(int, input().split(" ")))
a = _input[0]
b = _input[1]
c = _input[2]
check_limit = a * b
ratio = 1
remain_list = []
while (True):
remain_list.append(a * ratio % b)
ratio += 1
if ratio > b:
break
if c in remain_list:
print("YES")
else:
print("NO")
|
s767156821 | p02795 | u836737505 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 69 | We have a grid with H rows and W columns, where all the squares are initially white. You will perform some number of painting operations on the grid. In one operation, you can do one of the following two actions: * Choose one row, then paint all the squares in that row black. * Choose one column, then paint all t... | a = int(input())
b = int(input())
c = int(input())
print(c//max(a,b)) | s023311253 | Accepted | 17 | 2,940 | 91 | import math
a = int(input())
b = int(input())
c = int(input())
print(math.ceil(c/max(a,b))) |
s455822411 | p03693 | u367373844 | 2,000 | 262,144 | Wrong Answer | 21 | 3,316 | 123 | 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 i... | r,g,b = map(int,input().split())
number = r * 100 + g * 10 + b
if number % 4 == 0:
print("Yes")
else:
print("No") | s759465256 | Accepted | 17 | 2,940 | 123 | r,g,b = map(int,input().split())
number = r * 100 + g * 10 + b
if number % 4 == 0:
print("YES")
else:
print("NO") |
s178953394 | p02694 | u549474450 | 2,000 | 1,048,576 | Wrong Answer | 25 | 9,164 | 72 | Takahashi has a deposit of 100 yen (the currency of Japan) in AtCoder Bank. The bank pays an annual interest rate of 1 % compounded annually. (A fraction of less than one yen is discarded.) Assuming that nothing other than the interest affects Takahashi's balance, in how many years does the balance reach X yen or abo... | x=int(input())
i=100
c=0
while i<=x:
i=i+(i//100)
c=c+1
print(c) | s637606925 | Accepted | 22 | 9,164 | 71 | x=int(input())
i=100
c=0
while i<x:
i=i+(i//100)
c=c+1
print(c) |
s323968472 | p03385 | u612721349 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 44 | You are given a string S of length 3 consisting of `a`, `b` and `c`. Determine if S can be obtained by permuting `abc`. | print(["No","Yes"]["".join(input())=="abc"]) | s889757943 | Accepted | 17 | 2,940 | 52 | print(["No","Yes"]["".join(sorted(input()))=="abc"]) |
s424770132 | p03563 | u894694822 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 46 | Takahashi is a user of a site that hosts programming contests. When a user competes in a contest, the _rating_ of the user (not necessarily an integer) changes according to the _performance_ of the user, as follows: * Let the current rating of the user be a. * Suppose that the performance of the user in the cont... | r=int(input())
g=int(input())
print((g-r)*2+g) | s438273713 | Accepted | 17 | 2,940 | 46 | r=int(input())
g=int(input())
print((g-r)*2+r) |
s113871164 | p03129 | u448743361 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 79 | Determine if we can choose K different integers between 1 and N (inclusive) so that no two of them differ by 1. | n,k=map(int,input().split())
if k-n>=1:
print('YES')
else:
print('NO')
| s138413439 | Accepted | 17 | 3,064 | 286 | import sys
n,k=map(int,input().split())
tmp=1
count=1
if n==1 and k==1:
print('YES')
sys.exit(0)
if k==0:
print('YES')
sys.exit(0)
for i in range(2,n+1):
if i-tmp>1:
tmp=i
count+=1
if count==k:
print('YES')
sys.exit(0)
print('NO') |
s291748410 | p02742 | u829416877 | 2,000 | 1,048,576 | Wrong Answer | 29 | 9,104 | 88 | 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())
if H*W%2 == 0:
print(H*W/2)
else:
print(H*W//2+1)
| s279498073 | Accepted | 29 | 9,044 | 120 | H,W = map(int, input().split())
if W == 1 or H == 1:
print(1)
elif H*W%2 == 0:
print(H*W//2)
else:
print(H*W//2+1) |
s270639562 | p02806 | u816637025 | 2,525 | 1,048,576 | Wrong Answer | 18 | 3,064 | 197 | Niwango created a playlist of N songs. The title and the duration of the i-th song are s_i and t_i seconds, respectively. It is guaranteed that s_1,\ldots,s_N are all distinct. Niwango was doing some work while playing this playlist. (That is, all the songs were played once, in the order they appear in the playlist, w... | n = int(input())
s = ['']*n
t = ['']*n
for i in range(n):
s[i], t[i] = input().split()
x = input()
p = s.index(x)
total = 0
for i in range(p, n):
total += int(t[i])
print(total) | s625289888 | Accepted | 17 | 3,064 | 199 | n = int(input())
s = ['']*n
t = ['']*n
for i in range(n):
s[i], t[i] = input().split()
x = input()
p = s.index(x)
total = 0
for i in range(p+1, n):
total += int(t[i])
print(total) |
s067950339 | p03478 | u336624604 | 2,000 | 262,144 | Wrong Answer | 55 | 3,636 | 177 | 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(1, n+1):
if a <= sum(map(int, str(i))) <= b:
ans += i
print(sum(list(map(int,str(i)))))
print(ans) | s485572034 | Accepted | 30 | 3,060 | 135 | n, a, b = map(int, input().split())
ans = 0
for i in range(1, n+1):
if a <= sum(map(int, str(i))) <= b:
ans += i
print(ans) |
s392106025 | p02842 | u597455618 | 2,000 | 1,048,576 | Wrong Answer | 20 | 2,940 | 87 | Takahashi bought a piece of apple pie at ABC Confiserie. According to his memory, he paid N yen (the currency of Japan) for it. The consumption tax rate for foods in this shop is 8 percent. That is, to buy an apple pie priced at X yen before tax, you have to pay X \times 1.08 yen (rounded down to the nearest integer).... | n= int(input())
if int(-(-n//1.08)*1.08) == n:
print(n//1.08)
else:
print(":(") | s845087211 | Accepted | 17 | 2,940 | 96 | n= int(input())
if int(-(-n//1.08)*1.08) == n:
print(int(-(-n//1.08)))
else:
print(":(") |
s308127276 | p03438 | u608088992 | 2,000 | 262,144 | Wrong Answer | 30 | 4,852 | 534 | 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... | import sys
def solve():
input = sys.stdin.readline
N = int(input())
A = [int(a) for a in input().split()]
B = [int(b) for b in input().split()]
A.sort()
B.sort()
C = []
for i in range(N): C.append(A[i] - B[i])
print(C)
sumA = sum(A)
sumB = sum(B)
if sumA >= sumB: print("... | s840014947 | Accepted | 27 | 4,596 | 494 | import sys
def solve():
input = sys.stdin.readline
N = int(input())
A = [int(a) for a in input().split()]
B = [int(b) for b in input().split()]
C = [A[i] - B[i] for i in range(N)]
sumA = sum(A)
sumB = sum(B)
addA, addB = 0, 0
for i, c in enumerate(C):
if c > 0: addB += c
... |
s841002052 | p02283 | u159356473 | 2,000 | 131,072 | Wrong Answer | 20 | 7,732 | 1,110 | Search trees are data structures that support dynamic set operations including insert, search, delete and so on. Thus a search tree can be used both as a dictionary and as a priority queue. Binary search tree is one of fundamental search trees. The keys in a binary search tree are always stored in such a way as to sat... | #coding:UTF-8
class Node:
def __init__(self,point):
self.n=point
self.left=None
self.right=None
def insert(t,z):
y=None
x=t
while x!=None:
y=x
if z.n<x.n:
x=x.left
else:
x=x.right
if y==None:
return z
else:
... | s856009950 | Accepted | 7,360 | 215,576 | 1,138 | #coding:UTF-8
class Node:
def __init__(self,point):
self.n=point
self.left=None
self.right=None
def insert(t,z):
y=None
x=t
while x!=None:
y=x
if z.n<x.n:
x=x.left
else:
x=x.right
if y==None:
return z
else:
... |
s249771865 | p03861 | u651803486 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 74 | 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())
c = (a-1) / x
d = b / x
print(d-c)
| s706826851 | Accepted | 17 | 2,940 | 75 | a, b, x = map(int, input().split())
c = (a-1) // x
d = b // x
print(d-c)
|
s683674206 | p02678 | u790012205 | 2,000 | 1,048,576 | Wrong Answer | 2,257 | 46,660 | 625 | 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 = [list(map(int, input().split())) for i in range(M)]
R = [0] * N
P = 0
S = [1]
Stmp = []
while True:
for i in range(M):
for s in S:
if AB[i][0] == s:
R[AB[i][1] - 1] = s
Stmp.append(AB[i][1])
AB[i] = [0, 0]
... | s753937512 | Accepted | 625 | 34,940 | 398 | from collections import deque
N, M = map(int, input().split())
R = [[] for i in range(N + 1)]
for i in range(M):
A, B = map(int, input().split())
R[A].append(B)
R[B].append(A)
P = [-1] * (N + 1)
P[1] = 0
Q = deque()
Q.append(1)
while Q:
v = Q.popleft()
for r in R[v]:
if P[r] == -1:
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.