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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s195521290 | p02865 | u762182313 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 60 | How many ways are there to choose two distinct positive integers totaling N, disregarding the order? | a=int(input())
if a%2==1:
print(a//2)
else:
print(a/2+a) | s029614579 | Accepted | 18 | 2,940 | 61 | a=int(input())
if a%2==1:
print(a//2)
else:
print(a//2-1) |
s664957232 | p03487 | u513081876 | 2,000 | 262,144 | Wrong Answer | 110 | 21,228 | 202 | You are given a sequence of positive integers of length N, a = (a_1, a_2, ..., a_N). Your objective is to remove some of the elements in a so that a will be a **good sequence**. Here, an sequence b is a **good sequence** when the following condition holds true: * For each element x in b, the value x occurs exactly ... | import collections
N = int(input())
a = [int(i) for i in input().split()]
hint = collections.Counter(a)
b = hint.most_common()
ans = 0
for val, num in b:
if val != num:
ans += num
print(ans) | s263076941 | Accepted | 112 | 21,228 | 221 | import collections
N = int(input())
a = [int(i) for i in input().split()]
ans = 0
num = collections.Counter(a).most_common()
for a, b in num:
if b < a:
ans += b
elif a < b:
ans += b-a
print(ans) |
s682789490 | p02846 | u455533363 | 2,000 | 1,048,576 | Wrong Answer | 160 | 13,152 | 432 | Takahashi and Aoki are training for long-distance races in an infinitely long straight course running from west to east. They start simultaneously at the same point and moves as follows **towards the east** : * Takahashi runs A_1 meters per minute for the first T_1 minutes, then runs at A_2 meters per minute for th... | import numpy
t1,t2 = map(int,input().split())
a1,a2 = map(int,input().split())
b1,b2 = map(int,input().split())
v1=b1-a1
v2=b2-a2
print(v1,v2)
x1=v1*t1
x2=v2*t2
print(x1,x2)
if numpy.sign(x1)==numpy.sign(x2):
#print("one")
print(0)
elif abs(x2)-abs(x1)<0:
#print("two")
print(0)
elif -x1==x2:
print... | s604332797 | Accepted | 149 | 12,504 | 446 | import numpy
t1,t2 = map(int,input().split())
a1,a2 = map(int,input().split())
b1,b2 = map(int,input().split())
v1=b1-a1
v2=b2-a2
x1=v1*t1
x2=v2*t2
di = abs(abs(x2)-abs(x1))
if numpy.sign(x1)==numpy.sign(x2):
print(0)
elif abs(x2)<abs(x1):
print(0)
elif abs(x1)==abs(x2):
print("infinity")
else:
if ab... |
s905432690 | p02865 | u802341442 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 75 | How many ways are there to choose two distinct positive integers totaling N, disregarding the order? | n = int(input())
if n % 2 == 0:
print(n // 2)
else:
print((n-1)//2) | s886542913 | Accepted | 17 | 2,940 | 79 | n = int(input())
if n % 2 == 0:
print(n // 2 - 1)
else:
print((n-1)//2) |
s969367554 | p03505 | u846150137 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 130 | _ButCoder Inc._ runs a programming competition site called _ButCoder_. In this site, a user is given an integer value called rating that represents his/her skill, which changes each time he/she participates in a contest. The initial value of a new user's rating is 0, and a user whose rating reaches K or higher is calle... | from math import ceil
k,a,b=map(int,input().split())
k-=a
if k<=0:
print(1)
elif a>b:
print(1+ceil(k/(a-b)))
else:
print(-1) | s572959561 | Accepted | 17 | 3,060 | 128 | from math import ceil
k,a,b=map(int,input().split())
if k<=a:
print(1)
elif a>b:
print(1+(k-b-1)//(a-b)*2)
else:
print(-1) |
s206487889 | p03737 | u871841829 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 156 | 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 = input()
upper_diff = ord('A') - ord('a')
def to_upper(c: str) -> str:
return chr(ord(c) + upper_diff)
out = "".join(map(to_upper, s))
print(out) | s154990367 | Accepted | 17 | 2,940 | 189 | s = input().split()
upper_diff = ord('A') - ord('a')
def to_upper(c):
# print("c:", c)
return chr(ord(c) + upper_diff)
out = "".join(map(to_upper, [x[0] for x in s]))
print(out) |
s693282488 | p02255 | u409699893 | 1,000 | 131,072 | Wrong Answer | 20 | 7,696 | 218 | Write a program of the Insertion Sort algorithm which sorts a sequence A in ascending order. The algorithm should be based on the following pseudocode: for i = 1 to A.length-1 key = A[i] /* insert A[i] into the sorted sequence A[0,...,j-1] */ j = i - 1 while j >= 0 and A[j] > key ... | n = int(input())
x = list(map(int,input().split()))
for i in range(1,n):
v = x[i]
j = i - 1
while j >= 0:
if x[j] > v:
x[j + 1] = x[j]
x[j] = v
j += -1
print (*x) | s921844955 | Accepted | 20 | 8,000 | 229 | n = int(input())
x = list(map(int,input().split()))
print (*x)
for i in range(1,n):
v = x[i]
j = i - 1
while j >= 0:
if x[j] > v:
x[j + 1] = x[j]
x[j] = v
j += -1
print (*x) |
s802848475 | p03679 | u649558044 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 103 | Takahashi has a strong stomach. He never gets a stomachache from eating something whose "best-by" date is at most X days earlier. He gets a stomachache if the "best-by" date of the food is X+1 or more days earlier, though. Other than that, he finds the food delicious if he eats it not later than the "best-by" date. Ot... | x, a, b = map(int, input().split())
print('delicious' if b <= a else 'safe' if b <= x else 'dangerous') | s590038742 | Accepted | 17 | 2,940 | 107 | x, a, b = map(int, input().split())
print('delicious' if b <= a else 'safe' if b <= a + x else 'dangerous') |
s508346656 | p00032 | u436634575 | 1,000 | 131,072 | Wrong Answer | 40 | 6,720 | 177 | 機械に辺・対角線の長さのデータを入力し、プラスティック板の型抜きをしている工場があります。この工場では、サイズは様々ですが、平行四辺形の型のみを切り出しています。あなたは、切り出される平行四辺形のうち、長方形とひし形の製造個数を数えるように上司から命じられました。 「機械に入力するデータ」を読み込んで、長方形とひし形の製造個数を出力するプログラムを作成してください。 | import sys
c1 = c2 = 0
for line in sys.stdin:
a, b, c = map(int, line.split(','))
if a**2 + b**2 == c**2:
c1 += 1
elif a == b:
c2 += 1
print(c1, c2) | s176787409 | Accepted | 30 | 6,720 | 183 | import sys
c1 = c2 = 0
for line in sys.stdin:
a, b, c = map(int, line.split(','))
if a**2 + b**2 == c**2:
c1 += 1
elif a == b:
c2 += 1
print(c1)
print(c2) |
s229192220 | p03854 | u799479335 | 2,000 | 262,144 | Wrong Answer | 68 | 3,316 | 347 | You are given a string S consisting of lowercase English letters. Another string T is initially empty. Determine whether it is possible to obtain S = T by performing the following operation an arbitrary number of times: * Append one of the following at the end of T: `dream`, `dreamer`, `erase` and `eraser`. | S = input()
a = ['dream','dreamer','erase','eraser']
for i,ch in enumerate(a):
a[i] = ch[::-1]
T = ''
S = S[::-1]
flag = True
while flag:
if S[:5] in a:
S = S[5:]
elif S[:6] in a:
S = S[6:]
elif S[:7] in a:
S = S[7:]
elif len(S)==0:
ans = 'Yes'
flag = False
else:
ans = 'No'
... | s992650566 | Accepted | 69 | 3,316 | 339 | S = input()
a = ['dream','dreamer','erase','eraser']
for i,ch in enumerate(a):
a[i] = ch[::-1]
S = S[::-1]
flag = True
while flag:
if len(S)==0:
ans = 'YES'
flag = False
elif S[:5] in a:
S = S[5:]
elif S[:6] in a:
S = S[6:]
elif S[:7] in a:
S = S[7:]
else:
ans = 'NO'
flag = ... |
s294234620 | p02399 | u811841526 | 1,000 | 131,072 | Wrong Answer | 20 | 7,560 | 61 | 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())
d = a // b
r = a % b
f = a / b | s876119153 | Accepted | 20 | 5,608 | 97 | a, b = map(int, input().split())
d = a // b
r = a % b
f = a / b
print(d, r, '{:.5f}'.format(f))
|
s972435023 | p03478 | u062306892 | 2,000 | 262,144 | Wrong Answer | 31 | 3,060 | 130 | 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([int(c) for c in str(i)])<=b:
ans+=1
print(ans) | s449817243 | Accepted | 33 | 3,060 | 130 | n,a,b = map(int, input().split())
ans = 0
for i in range(1, n+1):
if a<=sum([int(c) for c in str(i)])<=b:
ans+=i
print(ans) |
s743808378 | p03067 | u357751375 | 2,000 | 1,048,576 | Wrong Answer | 27 | 9,084 | 127 | 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 b > a:
z = a
a = b
b = z
if a <= c <= b:
print('Yes')
else:
print('No') | s206485189 | Accepted | 25 | 9,116 | 127 | a,b,c = map(int,input().split())
if a > b:
z = a
a = b
b = z
if a <= c <= b:
print('Yes')
else:
print('No') |
s376069134 | p03129 | u029169777 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 76 | 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 N/2>K-1:
print('Yes')
else:
print('No') | s857000700 | Accepted | 17 | 2,940 | 77 | N,K=map(int,input().split())
if N/2>K-1:
print('YES')
else:
print('NO') |
s126838888 | p03150 | u674588203 | 2,000 | 1,048,576 | Wrong Answer | 18 | 3,064 | 646 | 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. | S=input()
if S=='keyence':
print('YES')
else:
pass
if S[:6]=='keyence' or S[-7:-1]=='keyence':
print('YES')
else:
pass
if S[0]=='k':
if S[-6:-1]=='eyence':
print('YES')
else:
pass
if S[:1]=='ke':
if S[-5:-1]=='yence':
print('YES')
else:
pass
if S[:2]=='key... | s267570121 | Accepted | 17 | 3,064 | 716 | S=input()
if S=='keyence' or S[0:7]=='keyence' or S[-7:]=='keyence':
print('YES')
exit()
else:
pass
if S[0]=='k':
if S[-6:]=='eyence':
print('YES')
exit()
else:
pass
if S[:2]=='ke':
if S[-5:]=='yence':
print('YES')
exit()
else:
pass
if S[:3]==... |
s917137356 | p03861 | u161318582 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 48 | 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())
print((b-a)//x) | s491148855 | Accepted | 17 | 2,940 | 79 | a,b,x = map(int,input().split())
print((b-a)//x+1 if a%x == 0 else (b//x-a//x)) |
s147900207 | p03359 | u844123804 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 88 | In AtCoder Kingdom, Gregorian calendar is used, and dates are written in the "year-month-day" order, or the "month-day" order without the year. For example, May 3, 2018 is written as 2018-5-3, or 5-3 without the year. In this country, a date is called _Takahashi_ when the month and the day are equal as numbers. For ... | num = input().split()
if int(num[1]) >=11:
print(num[0])
else:
print(int(num[0])-1) | s393778219 | Accepted | 17 | 2,940 | 98 | num = input().split()
if int(num[1]) >= int(num[0]):
print(num[0])
else:
print(int(num[0])-1) |
s252028211 | p03795 | u369338402 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 52 | 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())
x=n*800
y=(n-n%15)/15
print(int(x-y)) | s816381688 | Accepted | 17 | 2,940 | 58 | n=int(input())
x=n*800
y=((n-n%15)/15)*200
print(int(x-y)) |
s502807499 | p03563 | u488497128 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 159 | 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... | import sys
num = 1
n = int(sys.stdin.readline().strip())
k = int(sys.stdin.readline().strip())
for i in range(n):
num = min(num + k, 2 * num)
print(num) | s636307799 | Accepted | 18 | 2,940 | 103 | import sys
r = int(sys.stdin.readline().strip())
g = int(sys.stdin.readline().strip())
print(2*g - r) |
s776029437 | p03556 | u667024514 | 2,000 | 262,144 | Wrong Answer | 19 | 2,940 | 67 | 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. | a = int(input())
import math
b = math.sqrt(a)
c = float(b)
print(c) | s346498752 | Accepted | 17 | 2,940 | 57 | import math
print(math.floor(math.sqrt(int(input())))**2) |
s469903092 | p02386 | u567380442 | 1,000 | 131,072 | Wrong Answer | 30 | 6,760 | 851 | Write a program which reads $n$ dices constructed in the same way as [Dice I](description.jsp?id=ITP1_11_A), and determines whether they are all different. For the determination, use the same way as [Dice III](description.jsp?id=ITP1_11_C). | mask = [[i for i in range(6)], (1, 5, 2, 3, 0, 4), (2, 1, 5, 0, 4,3),(3, 1, 0, 5, 4, 2), (4, 0, 2, 3, 5, 1)]
mask += [[mask[1][i] for i in mask[1]]]
print(mask)
def set_top(dice, top):
return [dice[i] for i in mask[top]]
def twist(dice):
return [dice[i] for i in (0, 3, 1, 4, 2, 5)]
def equal(dice1, dice2):
... | s908206580 | Accepted | 90 | 6,756 | 881 | mask = [[i for i in range(6)], (1, 5, 2, 3, 0, 4), (2, 1, 5, 0, 4,3),(3, 1, 0, 5, 4, 2), (4, 0, 2, 3, 5, 1)]
mask += [[mask[1][i] for i in mask[1]]]
def set_top(dice, top):
return [dice[i] for i in mask[top]]
def twist(dice):
return [dice[i] for i in (0, 3, 1, 4, 2, 5)]
def equal(dice1, dice2):
if sorted... |
s459690003 | p03048 | u002459665 | 2,000 | 1,048,576 | Time Limit Exceeded | 2,104 | 2,940 | 223 | 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())
cnt = 0
for i in range(3001):
for j in range(3001):
x = n - (r * i + g * j)
if x < 0:
continue
if x % b == 0:
cnt += 1
print(cnt)
| s739644076 | Accepted | 1,728 | 3,060 | 280 | def main():
r, g, b, n = map(int, input().split())
cnt = 0
for i in range(n+1):
for j in range(n+1):
b_num = n - r*i - g*j
if b_num >= 0 and b_num % b == 0:
cnt += 1
print(cnt)
if __name__ == "__main__":
main() |
s959826301 | p03485 | u217888679 | 2,000 | 262,144 | Wrong Answer | 18 | 3,316 | 47 | You are given two positive integers a and b. Let x be the average of a and b. Print x rounded up to the nearest integer. | a,b=map(int,input().split())
print(-(-(a+b)/2)) | s245125016 | Accepted | 18 | 2,940 | 49 | a,b=map(int,input().split())
print(-(-(a+b)//2))
|
s220464612 | p03433 | u245641078 | 2,000 | 262,144 | Wrong Answer | 29 | 9,172 | 59 | 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 = map(int,open(0))
print("YES" if A>=(N%500) else "NO") | s140855928 | Accepted | 26 | 9,056 | 68 | N,A = int(input()),int(input())
print("Yes" if A>=(N%500) else "No") |
s826409647 | p02255 | u908238078 | 1,000 | 131,072 | Wrong Answer | 20 | 5,596 | 366 | Write a program of the Insertion Sort algorithm which sorts a sequence A in ascending order. The algorithm should be based on the following pseudocode: for i = 1 to A.length-1 key = A[i] /* insert A[i] into the sorted sequence A[0,...,j-1] */ j = i - 1 while j >= 0 and A[j] > key ... | N = int(input().rstrip())
A = list(map(int, input().rstrip().split()))
def insertion_sort(A, N):
for i in range(1, N):
key = A[i]
j = i - 1
while j >= 0 and A[j] > key:
A[j+1] = A[j]
j -= 1
A[j+1] = key
for a in A:
print(str(a) + ' ', end... | s535069663 | Accepted | 20 | 5,596 | 357 | N = int(input().rstrip())
A = list(map(int, input().rstrip().split()))
def insertion_sort(A, N):
for i in range(N):
key = A[i]
j = i - 1
while j >= 0 and A[j] > key:
A[j+1] = A[j]
j -= 1
A[j+1] = key
string = list(map(str, A))
print(' '.join(... |
s423653512 | p03852 | u941884460 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 154 | 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()
vow = ['a','i','u','e','o']
for i in range(len(vow)):
if i in vow:
print('vowel')
break
if i == len(vow)-1:
print('consonant') | s699609983 | Accepted | 18 | 2,940 | 96 | c = input()
vow = ['a','i','u','e','o']
if c in vow:
print('vowel')
else:
print('consonant') |
s647701039 | p03713 | u466105944 | 2,000 | 262,144 | Wrong Answer | 333 | 3,184 | 987 | There is a bar of chocolate with a height of H blocks and a width of W blocks. Snuke is dividing this bar into exactly three pieces. He can only cut the bar along borders of blocks, and the shape of each piece must be a rectangle. Snuke is trying to divide the bar as evenly as possible. More specifically, he is trying... | import time
H,W = map(int,input().split())
def calc_ans(H,W):
ans = float('inf')
halfed_w = W//2
for h in range(1,H):
a = h*W
b1 = (H-h)//2*W
c1 = (H-h-(H-h)//2)*W
b2 = (H-h)*halfed_w
c2 = (H-h)*(W-halfed_w)
result1 = max(a,b1,c1)-min... | s828051793 | Accepted | 341 | 3,064 | 864 | H,W = map(int,input().split())
def calc_ans(H,W):
ans = float('inf')
halfed_w = W//2
for h in range(1,H):
a = h*W
b1 = (H-h)//2*W
c1 = (H-h-(H-h)//2)*W
b2 = (H-h)*halfed_w
c2 = (H-h)*(W-halfed_w)
result1 = max(a,b1,c1)-min(a,b1,c1)
... |
s949424963 | p03565 | u035901835 | 2,000 | 262,144 | Wrong Answer | 18 | 3,316 | 509 | 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... | Sd=input()
T=input()
i=len(Sd)-len(T)
j=0
flag=True
while(1):
print('searching',i,j,Sd[i],T[j])
if Sd[i]==T[j] or Sd[i]=='?':
flag=True
print('find',i,j,Sd[i],T[j])
if j==len(T)-1:
print('complete')
break
j+=1
i+=1
else:
flag=False
... | s396406753 | Accepted | 17 | 3,064 | 545 | Sd=input()
T=input()
i=len(Sd)-len(T)
j=0
ans=[]
flag=False
while(1):
if i<0:
#print('not find')
break
#print('searching',i,j,Sd[i],T[j])
if Sd[i]==T[j] or Sd[i]=='?':
#print('find',i,j,Sd[i],T[j])
if j==len(T)-1:
ans.append((Sd[:i-j]+T+Sd[i-j+len(T):]).replace(... |
s034785151 | p03557 | u434872492 | 2,000 | 262,144 | Wrong Answer | 308 | 23,360 | 310 | The season for Snuke Festival has come again this year. First of all, Ringo will perform a ritual to summon Snuke. For the ritual, he needs an altar, which consists of three parts, one in each of the three categories: upper, middle and lower. He has N parts for each of the three categories. The size of the i-th upper ... | import bisect
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
A.sort()
B.sort()
C.sort(reverse=True)
ans = 0
for i in B:
a = bisect.bisect_left(A,i)
b = bisect.bisect_left(C,i)
ans += a*b
print(ans) | s412101816 | Accepted | 318 | 22,720 | 324 | import bisect
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
A.sort()
B.sort()
#C.sort(reverse=True)
C.sort()
ans = 0
for i in B:
a = bisect.bisect_left(A,i)
b = N - bisect.bisect_right(C,i)
ans += a*b
print(ans) |
s907479829 | p03549 | u159335277 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 84 | Takahashi is now competing in a programming contest, but he received TLE in a problem where the answer is `YES` or `NO`. When he checked the detailed status of the submission, there were N test cases in the problem, and the code received TLE in M of those cases. Then, he rewrote the code to correctly solve each of th... | n, m = list(map(int, input().split()))
print((m * 1800 + 100 * (n - m)) * (2 ** m)) | s590295090 | Accepted | 17 | 2,940 | 85 | n, m = list(map(int, input().split()))
print((m * 1900 + 100 * (n - m)) * (2 ** m))
|
s882581464 | p00002 | u459418423 | 1,000 | 131,072 | Wrong Answer | 20 | 7,548 | 183 | Write a program which computes the digit number of sum of two integers a and b. | import sys
tokens = []
for line in sys.stdin.readlines():
tokens.append(list(map(int, line.strip().split())))
for i in range(len(tokens)):
print(tokens[i][0] + tokens[i][1]) | s282990466 | Accepted | 30 | 7,672 | 199 | import sys
import math
while True:
line = sys.stdin.readline()
if not line:
break
token = list(map(int, line.strip().split()))
print(int(math.log10(token[0] + token[1]) + 1)) |
s164268372 | p02393 | u839008951 | 1,000 | 131,072 | Wrong Answer | 20 | 5,572 | 248 | Write a program which reads three integers, and prints them in ascending order. | def parseSpaceDivideIntArgs(arg):
tmpArr = arg.split()
ret = []
for s in tmpArr:
ret.append(int(s))
return ret
# instr = input()
instr = "3 2 4"
instrSpl = parseSpaceDivideIntArgs(instr)
instrSpl.sort()
print(instrSpl)
| s764848280 | Accepted | 20 | 5,596 | 490 | def parseSpaceDivideIntArgs(arg):
tmpArr = arg.split()
ret = []
for s in tmpArr:
ret.append(int(s))
return ret
def getArr2SpaceDivideStr(arg):
ret = ""
isFirst = True
for s in arg:
if not isFirst:
ret += ' '
else:
isFirst = False
ret ... |
s716300327 | p03477 | u771532493 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 117 | 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())
if a+b<c+d:
print('Left')
elif a+b<c+d:
print('Right')
else:
print('Balanced') | s661263657 | Accepted | 17 | 2,940 | 118 | a,b,c,d=map(int,input().split())
if a+b>c+d:
print('Left')
elif a+b<c+d:
print('Right')
else:
print('Balanced')
|
s686528986 | p02602 | u671889550 | 2,000 | 1,048,576 | Wrong Answer | 2,207 | 49,956 | 200 | 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... | import numpy as np
n, k = map(int, input().split())
a = list(map(int, input().split()))
for i in range(k, n):
if np.prod(a[i-k+1:i]) > np.prod(a[i-k:i-1]):
print('Yes')
else:
print('No') | s403578245 | Accepted | 139 | 31,568 | 154 | n, k = map(int, input().split())
a = list(map(int, input().split()))
for i in range(k, n):
if a[i - k] < a[i]:
print('Yes')
else:
print('No') |
s339725870 | p02678 | u668199686 | 2,000 | 1,048,576 | Wrong Answer | 2,207 | 46,576 | 626 | 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())
connections = [list(map(int, input().split())) for _ in range(m)]
weights = [2e5 + 10] * n
weights[0] = 1
directions = [1] * n
for _ in range(m):
for con in connections:
r1 = con[0]
r2 = con[1]
w1 = weights[r1 - 1]
w2 = weights[r2 - 1]
if w1 <... | s378755733 | Accepted | 436 | 54,516 | 594 | import sys
from collections import deque
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N, M = map(int, readline().split())
G = [[] for _ in range(N + 1)]
m = map(int, read().split())
for a, b in zip(m, m):
G[a].append(b)
G[b].append(a)
par = [0]... |
s588751032 | p03068 | u460745860 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 164 | 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 `*`. | import sys
input=sys.stdin.readline
N=int(input())
S=input()
K=int(input())-1
for s in S:
if s != S[K]:
print("*",end='')
else:
print(s,end='')
print() | s783625557 | Accepted | 17 | 2,940 | 170 | import sys
input=sys.stdin.readline
N=int(input())
S=input()[:-1]
K=int(input())-1
for s in S:
if s != S[K]:
print("*",end='')
else:
print(s,end='')
print() |
s907270595 | p03761 | u099566485 | 2,000 | 262,144 | Wrong Answer | 19 | 3,064 | 286 | Snuke loves "paper cutting": he cuts out characters from a newspaper headline and rearranges them to form another string. He will receive a headline which contains one of the strings S_1,...,S_n tomorrow. He is excited and already thinking of what string he will create. Since he does not know the string on the headlin... | n=int(input())
s=[]
for i in range(n):
s.append(list(input()))
l=''
for i in range(26):
t=n
for j in range(n):
if s[j].count(chr(97+i))<t:
t=s[j].count(chr(97+i))
for j in range(t):
l=l+chr(97+i)
list(l).sort()
for i in l:
print(i,end='') | s176878429 | Accepted | 19 | 3,060 | 224 | #058-C
n=int(input())
s=[]
for i in range(n):
s.append(list(input()))
l=''
for i in range(26):
t=n+2
for j in range(n):
t=min(t,s[j].count(chr(97+i)))
for j in range(t):
l=l+chr(97+i)
print(l) |
s729893537 | p03997 | u895918162 | 2,000 | 262,144 | Wrong Answer | 27 | 9,024 | 71 | You are given a trapezoid. The lengths of its upper base, lower base, and height are a, b, and h, respectively. An example of a trapezoid Find the area of this trapezoid. | a = int(input())
b = int(input())
h = int(input())
print((a*b*h) * 0.5) | s246213455 | Accepted | 27 | 9,100 | 76 | a = int(input())
b = int(input())
h = int(input())
print(int((a+b)*h* 0.5))
|
s139152939 | p03387 | u321008368 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 274 | 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 ... | As = [ int(i) for i in input('>> ').split()]
As.sort()
As.reverse()
o = 0
diff = As[0] - As[1]
div, mod = divmod(diff,2)
o += div
if mod == 1:
As[2] += 1
o += 1
diff = As[0] - As[2]
div, mod = divmod(diff,2)
o += div
if mod == 1:
o += 1
o += mod
print(o) | s700639732 | Accepted | 17 | 3,060 | 322 | As = [ int(i) for i in input('').split()]
#As = "2 6 3"
As.sort()
As.reverse()
o = 0
diff = As[0] - As[1]
div, mod = divmod(diff,2)
o += div
if mod == 1:
As[2] += 1
o += 1
diff = As[0] - As[2]
div, mod = divmod(diff,2)
o += div
if mod == 1:
o += 1
o += mod
print(o)
|
s087836655 | p03110 | u739362834 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 166 | 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())
m = 0
for i in range(N):
x, y = map(str, input().split())
x = float(x)
if y == "BTC":
m += x * 380000.0
else:
m += x
| s600797048 | Accepted | 17 | 2,940 | 175 | N = int(input())
m = 0
for i in range(N):
x, y = map(str, input().split())
x = float(x)
if y == "BTC":
m += x * 380000.0
else:
m += x
print(m)
|
s755071871 | p02279 | u177808190 | 2,000 | 131,072 | Wrong Answer | 30 | 6,012 | 1,275 | A graph _G_ = ( _V_ , _E_ ) is a data structure where _V_ is a finite set of vertices and _E_ is a binary relation on _V_ represented by a set of edges. Fig. 1 illustrates an example of a graph (or graphs). **Fig. 1** A free tree is a connnected, acyclic, undirected graph. A rooted tree is a free tree in which one... | import collections
def search(node, elems, tree, depth):
elems[node].append(depth)
if elems[node][0] == -1:
state = 'root'
elif not tree[node]:
state = 'leaf'
else:
state = 'internal node'
elems[node].append(state)
elems[node].append(tree[node])
depth += 1
for c ... | s098721631 | Accepted | 1,250 | 51,720 | 1,283 | import collections
def search(node, elems, tree, depth):
elems[node].append(depth)
if elems[node][0] == -1:
state = 'root'
elif not tree[node]:
state = 'leaf'
else:
state = 'internal node'
elems[node].append(state)
elems[node].append(tree[node])
depth += 1
for c ... |
s658459092 | p03693 | u666608435 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 101 | 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())
if (r + g + b) % 4 == 0:
print("YES")
else:
print("NO")
| s714273399 | Accepted | 17 | 2,940 | 94 | r, g, b = input().split()
if int(r + g + b) % 4 == 0:
print("YES")
else:
print("NO")
|
s393494230 | p04011 | u457901067 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 119 | There is a hotel with the following accommodation fee: * X yen (the currency of Japan) per night, for the first K nights * Y yen per night, for the (K+1)-th and subsequent nights Tak is staying at this hotel for N consecutive nights. Find his total accommodation fee. | N = int(input())
K = int(input())
X = int(input())
Y = int(input())
if N<=K:
print(N*X)
else:
print(N*X + (N-K)*Y) | s361658336 | Accepted | 17 | 2,940 | 120 | N = int(input())
K = int(input())
X = int(input())
Y = int(input())
if N<=K:
print(N*X)
else:
print(K*X + (N-K)*Y)
|
s301378993 | p03853 | u901582103 | 2,000 | 262,144 | Wrong Answer | 24 | 3,828 | 151 | There is an image with a height of H pixels and a width of W pixels. Each of the pixels is represented by either `.` or `*`. The character representing the pixel at the i-th row from the top and the j-th column from the left, is denoted by C_{i,j}. Extend this image vertically so that its height is doubled. That is, p... | h,w=map(int,input().split())
L=[list(input()) for i in range(h)]
for i in range(h,0,-1):
L.insert(i-1,L[i-1])
for j in range(2*h):
print(*L[j]) | s959977243 | Accepted | 18 | 3,060 | 159 | h,w=map(int,input().split())
L=[list(input()) for i in range(h)]
for i in range(h,0,-1):
L.insert(i-1,L[i-1])
for j in range(2*h):
print(''.join(L[j])) |
s383185783 | p03860 | u436110200 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 29 | 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("A"+s[0]+"C") | s816730454 | Accepted | 18 | 2,940 | 29 | s=input()
print("A"+s[8]+"C") |
s065412787 | p03493 | u893048163 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 56 | 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
for s in input():
count += 1
print(count) | s263812803 | Accepted | 20 | 3,060 | 77 | count = 0
for s in input():
if s == '1':
count += 1
print(count) |
s952007895 | p02393 | u721103753 | 1,000 | 131,072 | Wrong Answer | 30 | 7,612 | 82 | Write a program which reads three integers, and prints them in ascending order. | [a,b,c] = [int(_) for _ in input().split()]
list = [a,b,c]
list.sort()
print(list) | s396033056 | Accepted | 20 | 7,452 | 71 | a = list(i for i in input().split())
a.sort()
b = " ".join(a)
print(b) |
s058063352 | p00028 | u518711553 | 1,000 | 131,072 | Wrong Answer | 30 | 7,692 | 206 | Your task is to write a program which reads a sequence of integers and prints mode values of the sequence. The mode value is the element which occurs most frequently. | import sys
from collections import defaultdict
d = defaultdict(int)
for i in sys.stdin:
d[i] +=1
l = sorted([(k, v) for k, v in d.items()], key=lambda x:x[1], reverse=True)
print(l[0][0])
print(l[1][0]) | s722797976 | Accepted | 40 | 7,860 | 203 | import sys
from collections import defaultdict
d = defaultdict(int)
for i in sys.stdin:
d[int(i)] +=1
m = max(v for v in d.values())
for i in sorted([k for k, v in d.items() if v == m]):
print(i) |
s062305154 | p03760 | u066455063 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 166 | Snuke signed up for a new website which holds programming competitions. He worried that he might forget his password, and he took notes of it. Since directly recording his password would cause him trouble if stolen, he took two notes: one contains the characters at the odd-numbered positions, and the other contains the... | O = input()
E = input()
ans = []
for i in range(len(O)-1):
ans.append(O[i])
ans.append(E[i])
if len(O) > len(E):
ans.append(E[-1])
print("".join(ans))
| s985586160 | Accepted | 17 | 2,940 | 202 | O = input()
E = input()
ans = ""
if len(O) == len(E):
for i in range(len(O)):
ans += O[i] + E[i]
else:
for i in range(len(E)):
ans += O[i] + E[i]
ans += O[i+1]
print(ans)
|
s316505092 | p03712 | u732870425 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 216 | You are given a image with a height of H pixels and a width of W pixels. Each pixel is represented by a lowercase English letter. The pixel at the i-th row from the top and j-th column from the left is a_{ij}. Put a box around this image and output the result. The box should consist of `#` and have a thickness of 1. | H, W = map(int,input().split())
A = [list(input()) for _ in range(H)]
for i in range(H):
if i in (0, H):
print('#' * W)
else:
A[i][0] = '#'
A[i][-1] = '#'
print("".join(A[i])) | s585244126 | Accepted | 17 | 3,060 | 145 | H, W = map(int,input().split())
A = [input() for _ in range(H)]
print('#' * (W+2))
for ai in A:
print('#' + ai + '#')
print('#' * (W+2)) |
s952792436 | p02397 | u213265973 | 1,000 | 131,072 | Wrong Answer | 50 | 7,540 | 236 | Write a program which reads two integers x and y, and prints them in ascending order. | while True:
a = [int(i) for i in input().split(" ")]
num1 = a[0]
num2 = a[1]
if num1 <= num2:
print(num1,num2)
elif num1 > num2:
print(num2,num1)
if num1 == 0 and num2 == 0:
break
| s510045862 | Accepted | 60 | 7,584 | 235 | while True:
a = [int(i) for i in input().split(" ")]
num1 = a[0]
num2 = a[1]
if num1 == 0 and num2 == 0:
break
elif num1 <= num2:
print(num1,num2)
elif num1 > num2:
print(num2,num1)
|
s150332546 | p02271 | u027872723 | 5,000 | 131,072 | Wrong Answer | 40 | 7,752 | 472 | Write a program which reads a sequence _A_ of _n_ elements and an integer _M_ , and outputs "yes" if you can make _M_ by adding elements in _A_ , otherwise "no". You can use an element only once. You are given the sequence _A_ and _q_ questions where each question contains _M i_. | # -*- coding: utf_8 -*-
from itertools import repeat
def rec(s, i, total, m):
if total == m:
return 1
if len(s) - 1 == i or total > m:
return 0
return rec(s, i + 1, total, m) + rec(s, i + 1, total + s[i], m)
if __name__ == "__main__":
n = int(input())
a = [int (x) for x in input... | s263696799 | Accepted | 480 | 58,240 | 979 | # -*- coding: utf_8 -*-
from itertools import repeat
from itertools import combinations
def rec(s, i, total, m):
if total == m:
return 1
if len(s) == i or total > m:
return 0
return rec(s, i + 1, total, m) + rec(s, i + 1, total + s[i], m)
def makeCache(s):
cache = {}
for i in r... |
s476773651 | p03545 | u411858517 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 525 | 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... | import itertools
def solve(S):
bit_list = list(itertools.product([0, 1], repeat=3))
for pattern in bit_list:
count = int(S[0])
ans = S[0]
for i in range(3):
if pattern[i] == 0:
count += int(S[i+1])
ans += "+" + S[i+1]
else:
... | s358257998 | Accepted | 18 | 3,064 | 532 | import itertools
def solve(S):
bit_list = list(itertools.product([0, 1], repeat=3))
for pattern in bit_list:
count = int(S[0])
ans = S[0]
for i in range(3):
if pattern[i] == 0:
count += int(S[i+1])
ans += "+" + S[i+1]
else:
... |
s045323210 | p03377 | u500376440 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 85 | 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 B>=X-A and A<X:
print("Yes")
else:
print("No")
| s916724667 | Accepted | 17 | 2,940 | 86 | A,B,X=map(int,input().split())
if B>=X-A and A<=X:
print("YES")
else:
print("NO")
|
s680806308 | p03447 | u350997995 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 63 | 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) | s839033886 | Accepted | 18 | 2,940 | 65 | x = int(input())
a = int(input())
b = int(input())
print((x-a)%b) |
s511756681 | p03944 | u070423038 | 2,000 | 262,144 | Wrong Answer | 77 | 9,180 | 676 | 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... | X, Y, N = map(int, input().split())
lst = [[0 for i in range(X)] for j in range(Y)]
for i in (range(N)):
x, y, a = map(int, input().split())
if a == 1:
for j in range(Y):
for k in range(x):
lst[j][k] = 1
elif a == 2:
for j in range(Y):
for k in range(... | s669997199 | Accepted | 76 | 9,172 | 649 | X, Y, N = map(int, input().split())
lst = [[0 for i in range(X)] for j in range(Y)]
for i in (range(N)):
x, y, a = map(int, input().split())
if a == 1:
for j in range(Y):
for k in range(x):
lst[j][k] = 1
elif a == 2:
for j in range(Y):
for k in range(... |
s723301355 | p03760 | u459697504 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 670 | Snuke signed up for a new website which holds programming competitions. He worried that he might forget his password, and he took notes of it. Since directly recording his password would cause him trouble if stolen, he took two notes: one contains the characters at the odd-numbered positions, and the other contains the... | #!/usr/bin/python3
# ABC058_B
test = True
def restore():
O = input()
E = input()
password = ''
len_O = len(O)
if test:
print(len_O)
for i in range(len_O):
password += O[i]
try:
password += E[i]
except IndexError:
pass
re... | s795124474 | Accepted | 17 | 3,064 | 671 | #!/usr/bin/python3
# ABC058_B
test = False
def restore():
O = input()
E = input()
password = ''
len_O = len(O)
if test:
print(len_O)
for i in range(len_O):
password += O[i]
try:
password += E[i]
except IndexError:
pass
r... |
s890825606 | p03494 | u729119068 | 2,000 | 262,144 | Time Limit Exceeded | 2,206 | 9,028 | 168 | 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
while True:
if [a%2 for a in A]==[0]*N:
A=[a//2 for a in A]
cnt+=1
print(cnt)
| s570305675 | Accepted | 24 | 9,148 | 166 | N=int(input())
A=list(map(int,input().split()))
cnt=0
while True:
if [a%2 for a in A]==[0]*N:
A=[a//2 for a in A]
cnt+=1
else:break
print(cnt) |
s862518982 | p03129 | u539517139 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 60 | 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())
print('NO' if n<2*k else 'YES') | s320376985 | Accepted | 17 | 2,940 | 62 | n,k=map(int,input().split())
print('NO' if n<2*k-1 else 'YES') |
s342665275 | p03829 | u321623101 | 2,000 | 262,144 | Wrong Answer | 78 | 15,020 | 190 | There are N towns on a line running east-west. The towns are numbered 1 through N, in order from west to east. Each point on the line has a one- dimensional coordinate, and a point that is farther east has a greater coordinate value. The coordinate of town i is X_i. You are now at town 1, and you want to visit all the... | N,A,B=(int(i) for i in input().split())
X=list(map(int,input().split()))
count=0
for i in range(N-1):
M=X[i+1]-X[i]
if M>=B:
count+=M
else:
count+=B
print(count) | s394057516 | Accepted | 81 | 14,252 | 204 | N,A,B=(int(i) for i in input().split())
X=list(map(int,input().split()))
count=0
for i in range(N-1):
M=(X[i+1]-X[i])*A
if M<=B:
count=count+M
else:
count=count+B
print(count) |
s441395254 | p03623 | u771167374 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 76 | Snuke lives at position x on a number line. On this line, there are two stores A and B, respectively at position a and b, that offer food for delivery. Snuke decided to get food delivery from the closer of stores A and B. Find out which store is closer to Snuke's residence. Here, the distance between two points s and... | x, a, b = map(int, input().split())
print('A' if abs(x-a)>abs(x-b) else 'B') | s774174855 | Accepted | 17 | 2,940 | 76 | x, a, b = map(int, input().split())
print('A' if abs(x-a)<abs(x-b) else 'B') |
s144047399 | p03623 | u484856305 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 90 | Snuke lives at position x on a number line. On this line, there are two stores A and B, respectively at position a and b, that offer food for delivery. Snuke decided to get food delivery from the closer of stores A and B. Find out which store is closer to Snuke's residence. Here, the distance between two points s and... | x,a,b=map(int,input().split())
c=abs(x-a)
d=abs(x-b)
if c > d:
print(d)
else:
print(c) | s861893430 | Accepted | 17 | 2,940 | 95 | x,a,b=map(int,input().split())
c=abs(x-a)
d=abs(x-b)
if c > d:
print("B")
else:
print("A")
|
s020439998 | p03129 | u802963389 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 89 | 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 (n - 1) // k >= 2:
print("YES")
else:
print("NO") | s598565247 | Accepted | 19 | 2,940 | 90 | n, k = map(int, input().split())
if (n + 1) // k >= 2:
print("YES")
else:
print("NO")
|
s173727149 | p03909 | u823885866 | 2,000 | 262,144 | Wrong Answer | 118 | 27,128 | 633 | There is a grid with H rows and W columns. The square at the i-th row and j-th column contains a string S_{i,j} of length 5. The rows are labeled with the numbers from 1 through H, and the columns are labeled with the uppercase English letters from `A` through the W-th letter of the alphabet. Exactly one of the sq... | import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np
from functools import reduce
rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rf = lambda: ... | s814481278 | Accepted | 117 | 27,132 | 633 | import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np
from functools import reduce
rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rf = lambda: ... |
s456299335 | p03007 | u690536347 | 2,000 | 1,048,576 | Wrong Answer | 295 | 19,328 | 292 | There are N integers, A_1, A_2, ..., A_N, written on a blackboard. We will repeat the following operation N-1 times so that we have only one integer on the blackboard. * Choose two integers x and y on the blackboard and erase these two integers. Then, write a new integer x-y. Find the maximum possible value of the... | N = int(input())
*A, = map(int, input().split())
A.sort()
r = 1
a, b = A[0], A[1]
t = []
while 1:
x, y = (a, b) if a<b else (b, a)
t.append((x, y))
r += 1
if not r<N:
break
a, b = x-y, A[r]
a, b = t[-1]
t[-1] = (b, a)
print(len(t))
for i in t:
print(*i) | s842938015 | Accepted | 272 | 20,844 | 998 | from bisect import bisect_left
N = int(input())
*A, = map(int, input().split())
A.sort()
if A[0]<=0 and A[-1]<=0:
ans = sum(map(abs, A[:-1]))+A[-1]
A.reverse()
r = 1
a, b = A[0], A[1]
t = []
while 1:
x, y = (a, b) if a>b else (b, a)
t.append((x, y))
r += 1
... |
s825251777 | p03435 | u572142121 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 185 | 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) ... | C=[list(map(int,input().split())) for i in range(3)]
print(C)
print(C[1][0])
if C[0][1]-C[0][0]==C[1][1]-C[1][0] and C[1][1]-C[1][0]==C[2][1]-C[2][0]:
print('Yes')
else:
print('No') | s074652945 | Accepted | 17 | 3,064 | 201 | C=[list(map(int,input().split())) for i in range(3)]
for n in range(0,2):
x=C[0][2]-C[0][n]
y=C[1][2]-C[1][n]
z=C[2][2]-C[2][n]
if x!=y or y!=z :
print('No')
exit()
else:
print('Yes') |
s466639352 | p02601 | u875756191 | 2,000 | 1,048,576 | Wrong Answer | 29 | 9,028 | 275 | M-kun has the following three cards: * A red card with the integer A. * A green card with the integer B. * A blue card with the integer C. He is a genius magician who can do the following operation at most K times: * Choose one of the three cards and multiply the written integer by 2. His magic is successfu... | a, b, c = map(int, input().split())
k = int(input())
m = 0
n = 1
while a > b:
m = m + 1
b = b * 2
if a < b:
break
while b > c:
n = n + 1
c = c * 2
if b < c:
break
if m + n <= k:
print('Yes')
elif m + n > k:
print('No')
| s678305949 | Accepted | 28 | 9,172 | 203 | a, b, c = map(int, input().split())
k = int(input())
times = 0
while a >= b:
b *= 2
times += 1
while b >= c:
c *= 2
times += 1
if times <= k:
print('Yes')
else:
print('No')
|
s652169678 | p03435 | u593567568 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 348 | We have a 3 \times 3 grid. A number c_{i, j} is written in the square (i, j), where (i, j) denotes the square at the i-th row from the top and the j-th column from the left. According to Takahashi, there are six integers a_1, a_2, a_3, b_1, b_2, b_3 whose values are fixed, and the number written in the square (i, j) ... | A = [list(map(int,input().split())) for _ in range(3)]
ok = True
for i in range(3):
if A[i][1] - A[i][0] == A[i][2] - A[i][1]:
continue
else:
ok = False
break
for i in range(3):
if A[1][i] - A[0][i] == A[2][i] - A[1][i]:
continue
else:
ok = False
break
if not ok:
print('No')
els... | s012822452 | Accepted | 18 | 3,064 | 372 | A = [list(map(int,input().split())) for _ in range(3)]
R1 = [A[i][1] - A[i][0] for i in range(3)]
R2 = [A[i][2] - A[i][1] for i in range(3)]
C1 = [A[1][i] - A[0][i] for i in range(3)]
C2 = [A[2][i] - A[1][i] for i in range(3)]
ok = True
for x in [R1,R2,C1,C2]:
if len(set(x)) != 1:
ok = False
break
if n... |
s102043532 | p02646 | u042497514 | 2,000 | 1,048,576 | Wrong Answer | 25 | 9,188 | 242 | Two children are playing tag on a number line. (In the game of tag, the child called "it" tries to catch the other child.) The child who is "it" is now at coordinate A, and he can travel the distance of V per second. The other child is now at coordinate B, and she can travel the distance of W per second. He can catch ... | A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())
ans = "No"
if A < B:
x = A + V * T
y = B + W * T
if x >= y:
ans = "Yes"
else:
x = A - V * T
y = B - W * T
if x <= y:
ans = "Yes"
print(ans) | s455308737 | Accepted | 24 | 9,188 | 242 | A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())
ans = "NO"
if A < B:
x = A + V * T
y = B + W * T
if x >= y:
ans = "YES"
else:
x = A - V * T
y = B - W * T
if x <= y:
ans = "YES"
print(ans) |
s069702672 | p04029 | u648452607 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 31 | There are N children in AtCoder Kindergarten. Mr. Evi will arrange the children in a line, then give 1 candy to the first child in the line, 2 candies to the second child, ..., N candies to the N-th child. How many candies will be necessary in total? | n=int(input())
print((1+n)*n/2) | s233967575 | Accepted | 17 | 2,940 | 36 | n=int(input())
print(int((1+n)*n/2)) |
s319044169 | p03493 | u533344362 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 227 | 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. | # -*- coding: utf-8 -*-
s = input()
a = [int(c) for c in s]
count = 0
#
for i in range(1, 3):
if a[i] == 1:
count = count + 1
print(count) | s201059755 | Accepted | 17 | 2,940 | 32 | s = input()
print(s.count('1'))
|
s990523832 | p02400 | u477464845 | 1,000 | 131,072 | Wrong Answer | 20 | 5,576 | 89 | Write a program which calculates the area and circumference of a circle for given radius r. | r = float(input())
x = 3.141592653589
print("{0:.5f} {1:.5f}".format((r*2*x),(r**2*x)))
| s914932717 | Accepted | 20 | 5,576 | 82 | r = float(input())
n = 3.141592653589
print("{:.6f} {:.6f}".format(r**2*n,r*2*n))
|
s610311957 | p03047 | u902380746 | 2,000 | 1,048,576 | Wrong Answer | 23 | 3,060 | 348 | Snuke has N integers: 1,2,\ldots,N. He will choose K of them and give those to Takahashi. How many ways are there to choose K consecutive integers? | import sys
import math
import bisect
def main():
n, k = map(int, input().split())
A = [0] * (k + 1)
A[0] = 1
for _ in range(n):
for i in range(k, -1, -1):
if i - 1 >= 0:
A[i] += A[i-1]
#print('n: %d, k: %d, A: %s' % (n, k, str(A)))
print(A[k])
if __name_... | s988159614 | Accepted | 18 | 2,940 | 151 | import sys
import math
import bisect
def main():
n, k = map(int, input().split())
print(n - k + 1)
if __name__ == "__main__":
main()
|
s349861811 | p02388 | u117140447 | 1,000 | 131,072 | Wrong Answer | 20 | 5,600 | 230 | Write a program which calculates the cube of a given integer x. | import sys
numbers = []
max = 0
for line in sys.stdin:
numbers.append(int(line))
for i in range(0, len(numbers)):
for j in range(i,len(numbers)):
if numbers[j] - numbers[i] > max :
max = numbers[j] - numbers[i]
print(max)
| s587093527 | Accepted | 20 | 5,584 | 100 | import sys
input_number = int(input())
if __name__ == '__main__':
print(str(input_number ** 3))
|
s332555962 | p03337 | u345483150 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 51 | You are given two integers A and B. Find the largest value among A+B, A-B and A \times B. | a, b=map(int, input().split())
print(a+b, a-b, a*b) | s941572206 | Accepted | 17 | 2,940 | 56 | a, b=map(int, input().split())
print(max(a+b, a-b, a*b)) |
s770809499 | p02419 | u283452598 | 1,000 | 131,072 | Wrong Answer | 20 | 7,332 | 187 | 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. | y = input().lower()
cnt = 0
s=""
while True:
x = input().lower()
if x == "end_of_text":
break
s += x
for i in x:
if i == y:
cnt += 1
print(cnt) | s826818615 | Accepted | 20 | 7,412 | 194 | W = input()
num = 0
while True:
line = input()
if line == 'END_OF_TEXT':
break
for word in line.split():
if word.lower() == W.lower():
num += 1
print(num) |
s544158395 | p03433 | u801512570 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 86 | 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-A)%500==0:
print('Yes')
else:
print('No') | s629329127 | Accepted | 18 | 2,940 | 83 | N = int(input())
A = int(input())
if N%500<=A:
print('Yes')
else:
print('No')
|
s834649318 | p02422 | u494314211 | 1,000 | 131,072 | Wrong Answer | 20 | 7,688 | 275 | Write a program which performs a sequence of commands to a given string $str$. The command is one of: * print a b: print from the a-th character to the b-th character of $str$ * reverse a b: reverse from the a-th character to the b-th character of $str$ * replace a b p: replace from the a-th character to the b-t... | s=list(input())
n=int(input())
for i in range(n):
l=input().split()
if l[0]=="replace":
a=int(l[1])
b=int(l[2])
s[a:b+1]=list(l[3])
elif l[0]=="reverse":
a=int(l[1])
b=int(l[2])
s[a:b+1]=s[a:b+1:-1]
else:
a=int(l[1])
b=int(l[2])
print("".join(s[a:b+1])) | s821231728 | Accepted | 30 | 7,636 | 284 | s=list(input())
n=int(input())
for i in range(n):
l=input().split()
if l[0]=="replace":
a=int(l[1])
b=int(l[2])
s[a:b+1]=list(l[3])
elif l[0]=="reverse":
a=int(l[1])
b=int(l[2])
c=s[a:b+1][::-1]
s[a:b+1]=c
else:
a=int(l[1])
b=int(l[2])
print("".join(s[a:b+1])) |
s746086804 | p03644 | u492030100 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 150 | 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())
ans = [i * i for i in range(1, 9)]
for i in range(len(ans)):
if ans[i] > N:
print(ans[i] - 1)
exit(0)
print(64)
| s440052292 | Accepted | 17 | 2,940 | 149 | N = int(input())
ans = [2 ** i for i in range(0, 7)]
for i in range(len(ans)):
if ans[i] > N:
print(ans[i-1])
exit(0)
print(64)
|
s749728188 | p02401 | u400765446 | 1,000 | 131,072 | Wrong Answer | 20 | 5,612 | 408 | Write a program which reads two integers a, b and an operator op, and then prints the value of a op b. The operator op is '+', '-', '*' or '/' (sum, difference, product or quotient). The division should truncate any fractional part. | def main():
while True:
a, op, b = input().split()
a = int(a)
b = int(b)
if op == '?':
break
elif op == '+':
print(a + b)
elif op == '-':
print(a - b)
elif op == '*':
print(a * b)
elif op == '/':
... | s870286889 | Accepted | 20 | 5,604 | 323 | while True:
x, op, y = input().split()
a = int(x)
b = int(y)
if op == '?':
break
elif op == '+':
print("{:d}".format(a+b))
elif op == '-':
print("{:d}".format(a-b))
elif op == '*':
print("{:d}".format(a*b))
elif op == '/':
print("{:d}".format(a//b)... |
s158564022 | p04045 | u878138257 | 2,000 | 262,144 | Wrong Answer | 520 | 3,060 | 200 | 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 ... | n,k = map(int, input().split())
a = list(map(int, input().split()))
d=0
e=0
for i in range(100000):
d=str(n+i)
for j in range(k):
e=e+d.count(str(a[j]))
if e==0:
print(d)
break
d=0 | s315710569 | Accepted | 374 | 3,060 | 206 | n,k = map(int, input().split())
a = list(map(int, input().split()))
d=""
e=0
for i in range(100000):
d=str(n+i)
for j in range(k):
e=e+d.count(str(a[j]))
if e==0:
print(int(d))
break
e=0 |
s613614311 | p03359 | u309018392 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 59 | In AtCoder Kingdom, Gregorian calendar is used, and dates are written in the "year-month-day" order, or the "month-day" order without the year. For example, May 3, 2018 is written as 2018-5-3, or 5-3 without the year. In this country, a date is called _Takahashi_ when the month and the day are equal as numbers. For ... | a,b = map(int,input().split())
print(a-1) if a > b else (a) | s409172683 | Accepted | 19 | 2,940 | 64 | a,b = map(int,input().split())
print(a-1) if a > b else print(a) |
s149382918 | p02612 | u768219634 | 2,000 | 1,048,576 | Wrong Answer | 29 | 9,152 | 67 | 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. | x = int(input())
if x >= 30:
print("Yes")
else:
print("No") | s299035608 | Accepted | 29 | 9,152 | 76 | n = int(input())
if n%1000 == 0:
print (0)
else:
print (1000-n%1000) |
s785791065 | p03501 | u933214067 | 2,000 | 262,144 | Wrong Answer | 51 | 5,724 | 209 | You are parking at a parking lot. You can choose from the following two fee plans: * Plan 1: The fee will be A×T yen (the currency of Japan) when you park for T hours. * Plan 2: The fee will be B yen, regardless of the duration. Find the minimum fee when you park for N hours. | from statistics import mean, median,variance,stdev
import sys
import math
n=input().split()
a = []
for i in range(len(n)):
a.append(int(n[i]))
if (a[0]*a[1]) > a[2]:
print(a[0]*a[1])
else: print(a[2]) | s137599098 | Accepted | 36 | 5,084 | 209 | from statistics import mean, median,variance,stdev
import sys
import math
n=input().split()
a = []
for i in range(len(n)):
a.append(int(n[i]))
if (a[0]*a[1]) < a[2]:
print(a[0]*a[1])
else: print(a[2]) |
s233779528 | p03139 | u358051561 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 75 | 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())
print('{} {}'.format(max(a, b), a+b-n)) | s001349139 | Accepted | 17 | 2,940 | 82 | n, a, b = map(int, input().split())
print('{} {}'.format(min(a, b), max(a+b-n,0))) |
s199304096 | p02578 | u097852911 | 2,000 | 1,048,576 | Wrong Answer | 158 | 32,308 | 173 | N persons are standing in a row. The height of the i-th person from the front is A_i. We want to have each person stand on a stool of some heights - at least zero - so that the following condition is satisfied for every person: Condition: Nobody in front of the person is taller than the person. Here, the height of a ... | n = int(input())
lis = list(map(int,input().split()))
sum = 0
for i in range(n-1):
if int(lis[i])>int(lis[i+1]):
sum += lis[i]-lis[i+1]
else:
continue
print(sum) | s065107364 | Accepted | 194 | 32,308 | 195 | n = int(input())
lis = list(map(int,input().split()))
sum = 0
for i in range(n-1):
if int(lis[i])>int(lis[i+1]):
sum += lis[i]-lis[i+1]
lis[i+1] = lis[i]
else:
continue
print(sum) |
s001128576 | p02261 | u784787519 | 1,000 | 131,072 | Wrong Answer | 20 | 7,892 | 1,252 | 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... | def bubbleSort(A,N):
flag = 1
i = 0
while flag:
flag = 0
for j in range(N-1,i,-1):
if int(A[j][1]) < int(A[j-1][1]):
tmp = A[j]
A[j] = A[j-1]
A[j-1] = tmp
flag = 1
i += 1
return A
def selectionSort(A,... | s038428820 | Accepted | 120 | 7,896 | 1,405 | def bubbleSort(A,N):
flag = 1
i = 0
while flag:
flag = 0
for j in range(N-1,i,-1):
if int(A[j][1]) < int(A[j-1][1]):
tmp = A[j]
A[j] = A[j-1]
A[j-1] = tmp
flag = 1
i += 1
return A
def selectionSort(A,... |
s507643260 | p03469 | u544050502 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 52 | On some day in January 2018, Takaki is writing a document. The document has a column where the current date is written in `yyyy/mm/dd` format. For example, January 23, 2018 should be written as `2018/01/23`. After finishing the document, she noticed that she had mistakenly wrote `2017` at the beginning of the date col... | S=input().split("/")
S[0]=="2018"
print("/".join(S)) | s306539244 | Accepted | 17 | 2,940 | 51 | S=input().split("/")
S[0]="2018"
print("/".join(S)) |
s035043068 | p02389 | u487330611 | 1,000 | 131,072 | Wrong Answer | 20 | 5,576 | 55 | Write a program which calculates the area and perimeter of a given rectangle. | a,b=map(int,input().split())
print(a*b)
print(2*(a+b))
| s669241159 | Accepted | 20 | 5,580 | 49 | a,b=map(int,input().split())
print(a*b,2*(a+b))
|
s307709562 | p03556 | u190405389 | 2,000 | 262,144 | Wrong Answer | 29 | 3,064 | 63 | 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())
a = 1
while a**2 < N:
a+=1
print(a**2)
| s006244323 | Accepted | 28 | 2,940 | 67 | N = int(input())
a = 1
while a**2 <= N:
a+=1
print((a-1)**2) |
s794056327 | p03386 | u823044869 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 176 | Print all the integers that satisfies the following in ascending order: * Among the integers between A and B (inclusive), it is either within the K smallest integers or within the K largest integers. | a, b, k = map(int,input().split())
if abs(a-b)+1 <= 2*k:
for i in range(a,b+1):
print(i)
else:
for i in range(k):
print(a+i)
for i in range(k):
print(b-i)
| s298276799 | Accepted | 17 | 3,060 | 221 | a, b, k = map(int,input().split())
if abs(a-b)+1 <= 2*k:
for i in range(a,b+1):
print(i)
else:
nList = []
for i in range(k):
nList.append(a+i)
nList.append(b-i)
for i in sorted(nList):
print(i)
|
s204980186 | p03477 | u174536291 | 2,000 | 262,144 | Wrong Answer | 32 | 9,184 | 146 | 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 = list(map(int, input().split()))
l = a + b
r = c + d
if l > r:
print('Right')
elif l == r:
print('Balanced')
else:
print('Left') | s503445657 | Accepted | 29 | 9,052 | 146 | a, b, c, d = list(map(int, input().split()))
l = a + b
r = c + d
if l > r:
print('Left')
elif l == r:
print('Balanced')
else:
print('Right') |
s695016193 | p03474 | u503228842 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 213 | 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()
ans = True
for s in range(a+b+1):
if s == a:
if S[s] != "-":
ans = False
if s != a:
if S[s] == "-":
ans = False
print(ans) | s591115879 | Accepted | 17 | 3,064 | 239 | a,b = map(int,input().split())
S = input()
ans = True
for s in range(a+b+1):
if s == a:
if S[s] != "-":
ans = False
if s != a:
if S[s] == "-":
ans = False
if ans:print("Yes")
else:print("No") |
s422438921 | p03455 | u304209389 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 148 | AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd. | # -*- coding: utf-8 -*-
a, b = map(int, input().split())
print(a,b) | s947053813 | Accepted | 18 | 2,940 | 89 | a,b = map(int, input().split())
if a*b % 2 == 0:
print('Even')
else:
print('Odd') |
s591447541 | p03251 | u696444274 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,064 | 319 | 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 = list(map(int, input().split()))
x = list(map(int, input().split()))
y = list(map(int, input().split()))
#s = int(input())
z_min = X+1
z_max = Y
print(z_max)
print(z_min)
if Y-X > 0:
if z_min <= max(x) and z_max >= min(y) and min(y)-max(x)>0:
print("No War")
exit()
print("War") | s707206681 | Accepted | 39 | 5,276 | 360 |
import math
import itertools
import statistics
#import collections
n, m, X, Y = list(map(int, input().split()))
x = list(map(int, input().split()))
y = list(map(int, input().split()))
#s = int(input())
z_min = X+1
z_max = Y
if Y-X > 0:
if z_min <= max(x) and z_max >= min(y) and min(y)-max(x)>0:
print(... |
s807100920 | p00137 | u314932236 | 1,000 | 131,072 | Wrong Answer | 30 | 5,608 | 295 | 古典的な乱数生成方法の一つである平方採中法のプログラムを作成します。平方採中法は、フォンノイマンによって 1940 年代半ばに提案された方法です。 平方採中法は、生成する乱数の桁数を n としたとき、初期値 s の2乗を計算し、その数値を 2n 桁の数値とみて、(下の例のように 2 乗した桁数が足りないときは、0 を補います。)その中央にある n 個の数字を最初の乱数とします。次にこの乱数を 2 乗して、同じ様に、中央にある n 個の数字をとって、次の乱数とします。例えば、123 を初期値とすると 1232 = 00015129 → 0151 1512 = 00022801 → 0228 2282... | import os
import sys
def main():
n = int(input())
for i in range(1,n+1):
x = int(input())
print("Case {}:".format(i))
for j in range(10):
x = x**2
out = '{0:08d}'.format(x)
print(out[2:6])
x = int(out[2:6])
main() | s660718464 | Accepted | 20 | 5,612 | 300 | import os
import sys
def main():
n = int(input())
for i in range(1,n+1):
x = int(input())
print("Case {}:".format(i))
for j in range(10):
x = x**2
out = '{0:08d}'.format(x)
print(int(out[2:6]))
x = int(out[2:6])
main() |
s927044821 | p02399 | u766693979 | 1,000 | 131,072 | Wrong Answer | 20 | 5,596 | 86 | 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 = input().split()
a = int( a )
b = int( b )
print( int( a / b ), a % b, a / b )
| s602207194 | Accepted | 20 | 5,604 | 97 | a, b = input().split()
a = int( a )
b = int( b )
print( int( a / b ), a % b, "%.5f"%( a / b ) )
|
s491879148 | p03359 | u663438907 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 78 | In AtCoder Kingdom, Gregorian calendar is used, and dates are written in the "year-month-day" order, or the "month-day" order without the year. For example, May 3, 2018 is written as 2018-5-3, or 5-3 without the year. In this country, a date is called _Takahashi_ when the month and the day are equal as numbers. For ... | a, b = map(int, input().split())
ans = a - 1
if a < b:
ans += 1
print(ans) | s282343199 | Accepted | 18 | 2,940 | 81 | a, b = map(int, input().split())
ans = a - 1
if a <= b:
ans += 1
print(ans) |
s116070350 | p03698 | u782685137 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 54 | You are given a string S consisting of lowercase English letters. Determine whether all the characters in S are different. | S=input();print('YNeos'[len(S)!=len(set(list(S)))::2]) | s835058201 | Accepted | 17 | 2,940 | 54 | S=input();print('yneos'[len(S)!=len(set(list(S)))::2]) |
s888390384 | p03992 | u782654209 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 39 | This contest is `CODE FESTIVAL`. However, Mr. Takahashi always writes it `CODEFESTIVAL`, omitting the single space between `CODE` and `FESTIVAL`. So he has decided to make a program that puts the single space he omitted. You are given a string s with 12 letters. Output the string putting a single space between the fi... | s = input()
print(s[:4]+' '+s[4:]+'\n') | s433965675 | Accepted | 17 | 2,940 | 34 | s = input()
print(s[:4]+' '+s[4:]) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.