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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s915163148 | p03487 | u780962115 | 2,000 | 262,144 | Wrong Answer | 122 | 21,744 | 431 | 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 ... | from collections import Counter as ct
n=int(input())
lists=list(map(int,input().split()))
wanted=dict(ct(lists))
print(wanted)
if n>=2:
numbers=0
for i in wanted.keys():
a=i-wanted[i]
if a<0:
numbers+=abs(a)
elif a==0:
numbers+=0
if a>0:
numbe... | s700442920 | Accepted | 103 | 21,740 | 419 | from collections import Counter as ct
n=int(input())
lists=list(map(int,input().split()))
wanted=dict(ct(lists))
if n>=2:
numbers=0
for i in wanted.keys():
a=i-wanted[i]
if a<0:
numbers+=abs(a)
elif a==0:
numbers+=0
if a>0:
numbers+=wanted[i]
... |
s356246198 | p04029 | u680851063 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 59 | 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? | a=int(input())
b=1
for i in range(a+1):
b = b+i
print(b)
| s328835743 | Accepted | 18 | 2,940 | 59 | a=int(input())
b=0
for i in range(a+1):
b=b+i
print(b)
|
s774042132 | p03852 | u874741582 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 54 | 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`. | a="abcde"
c = input()
print("Yes" if c in a else "No") | s810413550 | Accepted | 17 | 2,940 | 63 | a="aeiou"
c = input()
print("vowel" if c in a else "consonant") |
s738362727 | p03407 | u535659144 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 96 | An elementary school student Takahashi has come to a variety store. He has two coins, A-yen and B-yen coins (yen is the currency of Japan), and wants to buy a toy that costs C yen. Can he buy it? Note that he lives in Takahashi Kingdom, and may have coins that do not exist in Japan. | a,b,c=map(int,input().split())
if a==c or b==c or a+b==c:
print("Yes")
else:
print("No") | s149617432 | Accepted | 17 | 2,940 | 80 | a,b,c=map(int,input().split())
if a+b>=c:
print("Yes")
else:
print("No") |
s108115393 | p03693 | u382303205 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 97 | AtCoDeer has three cards, one red, one green and one blue. An integer between 1 and 9 (inclusive) is written on each card: r on the red card, g on the green card and b on the blue card. We will arrange the cards in the order red, green and blue from left to right, and read them as a three-digit integer. Is this i... | r,g,b=map(int,input().split())
if (r*100+g*10+b) % 4 == 0:
print("Yes")
else:
print("No") | s044207202 | Accepted | 17 | 2,940 | 82 | if (int(input().replace(" ",""))) % 4 == 0:
print("YES")
else:
print("NO") |
s461920751 | p03720 | u842388336 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 138 | There are N cities and M roads. The i-th road (1≤i≤M) connects two cities a_i and b_i (1≤a_i,b_i≤N) bidirectionally. There may be more than one road that connects the same pair of two cities. For each city, how many roads are connected to the city? | a,b = map(int,input().split())
road_list=[]
for _ in range(b):
road_list+=list(input())
for i in range(a+1):
print(road_list.count(i)) | s923385003 | Accepted | 17 | 2,940 | 197 | n,m = map(int,input().split())
road_list=[0 for _ in range(n)]
for _ in range(m):
a,b = map(int,input().split())
road_list[a-1]+=1
road_list[b-1]+=1
for i in range(n):
print(road_list[i])
|
s437424386 | p03829 | u905582793 | 2,000 | 262,144 | Wrong Answer | 86 | 15,020 | 189 | 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=map(int,input().split())
x=list(map(int,input().split()))
ans = 0
maxwalk = b//a
for i in range(n-1):
if x[i+1]-x[i]>=maxwalk:
ans+=b
else:
ans+=(x[i+1]-x[i])*a
print(ans) | s195653957 | Accepted | 90 | 14,252 | 188 | n,a,b=map(int,input().split())
x=list(map(int,input().split()))
ans = 0
maxwalk = b//a
for i in range(n-1):
if x[i+1]-x[i]>maxwalk:
ans+=b
else:
ans+=(x[i+1]-x[i])*a
print(ans) |
s434135827 | p02972 | u739843002 | 2,000 | 1,048,576 | Wrong Answer | 429 | 22,768 | 388 | 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... | import math
def main():
N = int(input())
A = [int(a) for a in input().split(" ")]
B = [0] * N
for i in range(1, N):
for j in range(math.ceil(N / (i + 1)), math.floor(N / i) + 1):
ball = 0
for k in range(2 * j, N, j):
if B[k - 1] == 1:
ball += 1
B[j - 1] = (ball % 2 + A[j - 1]) % 2
ans = [str(x... | s753296344 | Accepted | 426 | 22,824 | 499 | import math
def main():
N = int(input())
A = [int(a) for a in input().split(" ")]
B = [0] * N
if N == 1:
if A[0] == 1:
print(1)
print(1)
else:
print(0)
return 0
for i in range(1, N):
for j in range(math.ceil(N / (i + 1)), math.floor(N / i) + 1):
ball = 0
for k in range(2 * j, N + 1, j):
... |
s783221744 | p03711 | u500297289 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 215 | Based on some criterion, Snuke divided the integers from 1 through 12 into three groups as shown in the figure below. Given two integers x and y (1 ≤ x < y ≤ 12), determine whether they belong to the same group. | """ AtCoder """
x, y = map(int, input().split())
a = [1, 3, 5, 7, 8, 10, 12]
b = [4, 6, 9, 11]
c = [2]
if (x in a and y in b) or (x in b and y in b) or (x in c and y in c):
print("Yes")
else:
print("No")
| s301333303 | Accepted | 17 | 2,940 | 215 | """ AtCoder """
x, y = map(int, input().split())
a = [1, 3, 5, 7, 8, 10, 12]
b = [4, 6, 9, 11]
c = [2]
if (x in a and y in a) or (x in b and y in b) or (x in c and y in c):
print("Yes")
else:
print("No")
|
s340657908 | p03636 | u282277161 | 2,000 | 262,144 | Wrong Answer | 25 | 8,952 | 23 | The word `internationalization` is sometimes abbreviated to `i18n`. This comes from the fact that there are 18 letters between the first `i` and the last `n`. You are given a string s of length at least 3 consisting of lowercase English letters. Abbreviate s in the same way. | #!/usr/bin/env python3
| s770303654 | Accepted | 26 | 9,020 | 43 | s = input()
print(s[0]+str(len(s)-2)+s[-1]) |
s226808208 | p03796 | u313103408 | 2,000 | 262,144 | Wrong Answer | 2,206 | 9,400 | 83 | 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())
M = 10**9+7
sum = 1
for i in range(1,n):
sum *= i%M
print(sum%M) | s387957925 | Accepted | 40 | 9,160 | 76 | n = int(input())
d = 1
for i in range(1,n+1):
d = (d*i)%(10**9+7)
print(d) |
s735728748 | p03719 | u125269142 | 2,000 | 262,144 | Wrong Answer | 29 | 9,136 | 103 | You are given three integers A, B and C. Determine whether C is not less than A and not greater than B. | a, b, c = map(int, input().split())
if a <= c and c <= b:
ans = 'YES'
else:
ans = 'NO'
print(ans) | s482575251 | Accepted | 28 | 9,000 | 104 | a, b, c = map(int, input().split())
if a <= c and c <= b:
ans = 'Yes'
else:
ans = 'No'
print(ans)
|
s603731585 | p03997 | u399721252 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 50 | 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. | print((int(input())+int(input()))//2*int(input())) | s095564623 | Accepted | 17 | 2,940 | 69 | a = int(input())
b = int(input())
c = int(input())
print((a+b)*c//2) |
s304836342 | p02401 | u467711590 | 1,000 | 131,072 | Wrong Answer | 20 | 5,596 | 197 | Write a program which reads two integers a, b and an operator op, and then prints the value of a op b. The operator op is '+', '-', '*' or '/' (sum, difference, product or quotient). The division should truncate any fractional part. | while True:
a, op, b = map(str, input().split())
a = int(a)
b = int(b)
if op == '?':
break
if op == '+':
print(a+b)
if op == '-':
print(a*b)
if op == '*':
print(a//b)
| s298252202 | Accepted | 20 | 5,596 | 228 | while True:
a, op, b = map(str, input().split())
a = int(a)
b = int(b)
if op == '?':
break
if op == '+':
print(a+b)
if op == '-':
print(a-b)
if op == '*':
print(a*b)
if op == '/':
print(a//b)
|
s596245737 | p03601 | u941753895 | 3,000 | 262,144 | Wrong Answer | 3,156 | 5,464 | 987 | Snuke is making sugar water in a beaker. Initially, the beaker is empty. Snuke can perform the following four types of operations any number of times. He may choose not to perform some types of operations. * Operation 1: Pour 100A grams of water into the beaker. * Operation 2: Pour 100B grams of water into the bea... | import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,queue,copy
sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): ... | s677724142 | Accepted | 2,675 | 5,840 | 1,023 | import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,queue,copy
sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): ... |
s239539795 | p04044 | u893931781 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 150 | 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=[]
for i in range(N):
s.append(input())
s.sort()
print(s)
result=""
for i in range(N):
result+=s[i]
print(result) | s218139386 | Accepted | 17 | 3,060 | 142 | N,L=map(int,input().split())
s=[]
for i in range(N):
s.append(input())
s.sort()
result=""
for i in range(N):
result+=s[i]
print(result)
|
s516466661 | p00015 | u058433718 | 1,000 | 131,072 | Wrong Answer | 20 | 7,740 | 286 | 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... |
import sys
def main():
n = int(sys.stdin.readline().strip())
for _ in range(n):
x = int(sys.stdin.readline().strip())
y = int(sys.stdin.readline().strip())
print(x + y)
if __name__ == '__main__':
main() | s843142556 | Accepted | 20 | 7,660 | 487 |
import sys
def main():
n = int(sys.stdin.readline().strip())
for _ in range(n):
x = sys.stdin.readline().strip()
y = sys.stdin.readline().strip()
if len(x) > 80 or len(y) > 80:
print('overflow')
else:
ans = int(x) + int(y)
if len(str(ans)) ... |
s692040234 | p03140 | u077337864 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,060 | 232 | You are given three strings A, B and C. Each of these is a string of length N consisting of lowercase English letters. Our objective is to make all these three strings equal. For that, you can repeatedly perform the following operation: * Operation: Choose one of the strings A, B and C, and specify an integer i bet... | n = int(input())
a = input().strip()
b = input().strip()
c = input().strip()
ans = 0
for _a, _b, _c in zip(a, b, c):
if _a != _b and _b != _c:
ans += 2
elif _a == _b and _b == _c:
continue
else:
ans += 1
print(ans) | s275874011 | Accepted | 17 | 3,064 | 245 | n = int(input())
a = input().strip()
b = input().strip()
c = input().strip()
ans = 0
for _a, _b, _c in zip(a, b, c):
if _a != _b and _b != _c and _a != _c:
ans += 2
elif _a == _b and _b == _c:
continue
else:
ans += 1
print(ans) |
s487705287 | p03814 | u405256066 | 2,000 | 262,144 | Wrong Answer | 62 | 3,516 | 204 | Snuke has decided to construct a string that starts with `A` and ends with `Z`, by taking out a substring of a string s (that is, a consecutive part of s). Find the greatest length of the string Snuke can construct. Here, the test set guarantees that there always exists a substring of s that starts with `A` and ends w... | from sys import stdin
s = (stdin.readline().rstrip())
A = 10**9
Z = -10**9
for ind,i in enumerate(s):
if i == "A" and ind < A:
A = ind
if i == "Z" and ind > Z:
A = ind
print(Z-A+1) | s591673289 | Accepted | 59 | 3,500 | 204 | from sys import stdin
s = (stdin.readline().rstrip())
A = 10**9
Z = -10**9
for ind,i in enumerate(s):
if i == "A" and ind < A:
A = ind
if i == "Z" and ind > Z:
Z = ind
print(Z-A+1) |
s736531549 | p02612 | u396210538 | 2,000 | 1,048,576 | Wrong Answer | 31 | 9,084 | 189 | 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. | from sys import stdin
import sys
import math
# A, B, C = [int(x) for x in stdin.readline().rstrip().split()]
# A = list(map(int, input().split()))
s = int(input())
print(s-(s//1000)*1000)
| s532848173 | Accepted | 24 | 9,148 | 241 | from sys import stdin
import sys
import math
# A, B, C = [int(x) for x in stdin.readline().rstrip().split()]
# A = list(map(int, input().split()))
s = int(input())
if s % 1000 == 0:
print('0')
sys.exit()
print(((s//1000)+1)*1000-s)
|
s756439126 | p03067 | u743164083 | 2,000 | 1,048,576 | Wrong Answer | 18 | 2,940 | 111 | 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. | *s, t = map(int, input().split())
s.sort()
for i in range(s[0],s[1]):
if i == t:
print("Yes")
print("No") | s188868289 | Accepted | 17 | 2,940 | 142 | *s, t = map(int, input().split())
s.sort()
f = False
for i in range(s[0],s[1]+1):
if i == t:
f = True
print("Yes") if f else print("No") |
s799209047 | p03556 | u488178971 | 2,000 | 262,144 | Wrong Answer | 19 | 3,060 | 45 | 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())
n = (N**0.5) //1
print(n**2) | s584613913 | Accepted | 18 | 3,060 | 45 | N = int(input())
n = int(N**0.5)
print(n**2) |
s269428549 | p03624 | u968649733 | 2,000 | 262,144 | Wrong Answer | 45 | 4,404 | 245 | You are given a string S consisting of lowercase English letters. Find the lexicographically (alphabetically) smallest lowercase English letter that does not occur in S. If every lowercase English letter occurs in S, print `None` instead. | S = input()
S = sorted(S)
S_dict = {}
cnt = 0
for s in S:
if s not in S_dict:
S_dict[s] = 1
print(S_dict)
ALL = 'abcdefghijklmnopqrstuvwxyz'
answer= None
for c in ALL:
if c not in S_dict:
answer = c
break
print(answer)
| s189489713 | Accepted | 79 | 4,408 | 352 | S = input()
S = sorted(S)
S_dict = {}
cnt = 0
#ord : return number of character based on character
#chr : return character based on number of character
for i in range(ord("a"), ord("z") +1):
S_dict[i] = S.count(chr(i))
#print(S_dict)
ans =None
for i in range(ord("a"), ord("z") +1):
if S_dict[i] == 0:
ans = ... |
s084629762 | p03386 | u279493135 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 235 | 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. | import sys
A, B, K = map(int, input().split())
if B-A+1 <= K:
for i in range(A, B+1):
print(i)
sys.exit()
ans = set()
for i in range(A, A+K):
ans.add(i)
for i in range(B, B-K, -1):
ans.add(i)
for x in ans:
print(x) | s243751316 | Accepted | 17 | 3,064 | 243 | import sys
A, B, K = map(int, input().split())
if B-A+1 <= K:
for i in range(A, B+1):
print(i)
sys.exit()
ans = set()
for i in range(A, A+K):
ans.add(i)
for i in range(B, B-K, -1):
ans.add(i)
for x in sorted(ans):
print(x) |
s353618654 | p02646 | u401810884 | 2,000 | 1,048,576 | Wrong Answer | 24 | 9,196 | 300 | 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())
if (V-W)<=0:
print ("NO")
exit(0)
if A > B:
if (A-B) // (V-W) <= T:
print("YES")
else:
print("NO")
else:
if (B-A) // (V-W) <= T:
print("YEs")
else:
print("NO") | s637811266 | Accepted | 21 | 9,200 | 298 | A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())
if (V-W)<=0:
print ("NO")
exit(0)
if A > B:
if (A-B) / (V-W) <= T:
print("YES")
else:
print("NO")
else:
if (B-A) / (V-W) <= T:
print("YES")
else:
print("NO") |
s838497838 | p03964 | u179169725 | 2,000 | 262,144 | Wrong Answer | 20 | 3,060 | 186 | AtCoDeer the deer is seeing a quick report of election results on TV. Two candidates are standing for the election: Takahashi and Aoki. The report shows the ratio of the current numbers of votes the two candidates have obtained, but not the actual numbers of votes. AtCoDeer has checked the report N times, and when he c... | N=int(input())
ans=1
def retsmlst(s,n):
tmp=s
while s+tmp<n:
tmp+=s
return tmp
for _ in range(N):
a,b=map(int,input().split())
s=a+b
ans=retsmlst(s,ans)
print(ans)
| s814021294 | Accepted | 21 | 3,060 | 882 |
N = int(input())
ans = 1
def ret_nm(t, a, n, m):
times_t = (n - 1) // t + 1
times_a = (m - 1) // a + 1
times = max(times_t, times_a)
return times * t, times * a
n = m = 1
for _ in range(N):
t, a = map(int, input().split())
n, m = ret_nm(t, a, n, m)
print(n + m)
|
s062869810 | p03846 | u943004959 | 2,000 | 262,144 | Wrong Answer | 95 | 16,480 | 1,240 | There are N people, conveniently numbered 1 through N. They were standing in a row yesterday, but now they are unsure of the order in which they were standing. However, each person remembered the following fact: the absolute difference of the number of the people who were standing to the left of that person, and the nu... | from collections import Counter
def solve():
while 1:
try:
N = int(input())
A = list(map(int, input().split(" ")))
MOD = 10 ** 9 + 7
counter = Counter(A)
checker = [0 for _ in range(N)]
for word, cnt in counter.most_common():
... | s652150420 | Accepted | 98 | 16,480 | 1,283 | #!/usr/bin/python
# -*- coding: utf-8 -*-
from collections import Counter
def solve():
while 1:
try:
N = int(input())
A = list(map(int, input().split(" ")))
MOD = 10 ** 9 + 7
counter = Counter(A)
checker = [0 for _ in range(N)]
for wo... |
s058444490 | p02612 | u371409687 | 2,000 | 1,048,576 | Wrong Answer | 30 | 9,144 | 24 | 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. | print(int(input())%1000) | s031567983 | Accepted | 33 | 9,144 | 40 | n=int(input())
print(-(-n//1000)*1000-n) |
s028725715 | p02927 | u527261492 | 2,000 | 1,048,576 | Wrong Answer | 19 | 2,940 | 153 | Today is August 24, one of the five Product Days in a year. A date m-d (m is the month, d is the date) is called a Product Day when d is a two-digit number, and all of the following conditions are satisfied (here d_{10} is the tens digit of the day and d_1 is the ones digit of the day): * d_1 \geq 2 * d_{10} \geq... | m,d=map(int,input().split())
cnt=0
for j in range(1,m+1):
for i in range(1,d+1):
a=i//10
b=i%10
if a*b==j:
cnt+=1
print(cnt)
| s061542317 | Accepted | 19 | 2,940 | 177 | m,d=map(int,input().split())
cnt=0
for j in range(1,m+1):
for i in range(1,d+1):
a=i//10
b=i%10
if a>1 and b>1:
if a*b==j:
cnt+=1
print(cnt)
|
s415345184 | p03854 | u314089899 | 2,000 | 262,144 | Wrong Answer | 63 | 3,740 | 978 | 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`. | #49c
S = str(input())
i = len(S) - 5
if i < 0:
print("NO")
else:
while i >= 0:
end_5_char = S[i:i+5]
print(i,end_5_char)
if end_5_char == "eamer":
print(i,S[i-2:i])
if i < 2 or S[i-2:i] != "dr":
print("NO")
break
... | s877835051 | Accepted | 28 | 3,188 | 982 | #49c
S = str(input())
i = len(S) - 5
if i < 0:
print("NO")
else:
while i >= 0:
end_5_char = S[i:i+5]
#print(i,end_5_char)
if end_5_char == "eamer":
#print(i,S[i-2:i])
if i < 2 or S[i-2:i] != "dr":
print("NO")
break
... |
s970278349 | p03576 | u802963389 | 2,000 | 262,144 | Wrong Answer | 1,258 | 3,320 | 2,253 | We have N points in a two-dimensional plane. The coordinates of the i-th point (1 \leq i \leq N) are (x_i,y_i). Let us consider a rectangle whose sides are parallel to the coordinate axes that contains K or more of the N points in its interior. Here, points on the sides of the rectangle are considered to be in th... | n, k = map(int, input().split())
XY = [list(map(int, input().split())) for _ in range(n)]
XY.sort(key=lambda x: x[0])
XY = [xy + [x] for x, xy in enumerate(XY)]
XY.sort(key=lambda x: x[1])
XY = [xy + [y] for y, xy in enumerate(XY)]
gr = [[0] * n for _ in range(n)]
for _, _, i, j in XY:
gr[i][j] = 1
rui = [[0] * (n ... | s343353346 | Accepted | 1,438 | 3,320 | 2,307 | n, k = map(int, input().split())
XY = [list(map(int, input().split())) for _ in range(n)]
XY.sort(key=lambda x: x[0])
XY = [xy + [x] for x, xy in enumerate(XY)]
XY.sort(key=lambda x: x[1])
XY = [xy + [y] for y, xy in enumerate(XY)]
gr = [[0] * n for _ in range(n)]
for _, _, i, j in XY:
gr[i][j] = 1
rui = [[0] * (... |
s333245903 | p03456 | u940652437 | 2,000 | 262,144 | Wrong Answer | 23 | 9,040 | 141 | AtCoDeer the deer has found two positive integers, a and b. Determine whether the concatenation of a and b in this order is a square number. | import math
a,b=input().split()
c = a + b
n_c = int(c)
if math.sqrt(n_c).is_integer == True :
print("Yes")
else:
print("No")
| s100314176 | Accepted | 32 | 9,452 | 136 | import math
a,b=input().split()
c = a + b
n_c = int(c)
if((n_c ** 0.5).is_integer()==True):
print("Yes")
else:
print('No') |
s850316930 | p03339 | u839188633 | 2,000 | 1,048,576 | Wrong Answer | 2,104 | 3,676 | 199 | There are N people standing in a row from west to east. Each person is facing east or west. The directions of the people is given as a string S of length N. The i-th person from the west is facing east if S_i = `E`, and west if S_i = `W`. You will appoint one of the N people as the leader, then command the rest of the... | n = int(input())
s = input()
ans = n
for i in range(0, n):
kaeru = sum(s[j] == 'W' for j in range(i)) + sum(s[j] == 'E' for j in range(i+1,n))
print(kaeru)
ans = min(kaeru, ans)
print(ans) | s363402571 | Accepted | 296 | 27,128 | 233 | n = int(input())
s = input()
w = [0] * n
for i in range(n-1):
w[i+1] = w[i] + int(s[i] == 'W')
e = [0] * n
for i in reversed(range(1, n)):
e[i-1] = e[i] + int(s[i] == 'E')
print(min(ww+ee for ww, ee in zip(w, e))) |
s598434972 | p02241 | u370086573 | 1,000 | 131,072 | Wrong Answer | 30 | 7,644 | 998 | For a given weighted graph $G = (V, E)$, find the minimum spanning tree (MST) of $G$ and print total weight of edges belong to the MST. | INF = 9999
def prim(G):
n = len(G)
color = ['White' for _ in range(n)]
d = [INF for _ in range(n)]
p = [-1 for _ in range(n)]
d[0] = 0
while True:
mincost = INF
u = -1
for i in range(n):
if color[i] != 'Black' and d[i] < mincost:
mincost = d... | s155295131 | Accepted | 40 | 7,860 | 728 | INF = 9999
def prim(M):
n = len(M)
color = [0] * n
d = [INF] * n
d[0] = 0
while True:
minv = INF
u = -1
for i in range(n):
# Black:2
if minv > d[i] and color[i] != 2:
u = i
minv = d[i]
if u == -1: break
... |
s102823781 | p03471 | u222841610 | 2,000 | 262,144 | Wrong Answer | 2,104 | 3,064 | 725 | The commonly used bills in Japan are 10000-yen, 5000-yen and 1000-yen bills. Below, the word "bill" refers to only these. According to Aohashi, he received an otoshidama (New Year money gift) envelope from his grandfather that contained N bills for a total of Y yen, but he may be lying. Determine whether such a situat... | n,y = list(map(int,input().split()))
if y/10000 > n:
print('-1 -1 -1')
else:
b = False
YY =[]
Y10=1+int(y/10000)
Y5 =1+int((y%10000)/5000)
Y1 =1+int((y%5000)/1000)
for i in range(Y10):
if b== True:
break
if i <= n:
YY.append(i)
for j in range(Y... | s714959217 | Accepted | 1,110 | 3,064 | 700 | n,y = list(map(int,input().split()))
if y/10000 > n:
print('-1 -1 -1')
if y/10000 ==n:
print('%d %d %d' % (y/10000, 0, 0))
else:
b = False
YY =[]
Y10=int(y/10000)
Y5 =int(y/5000)
Y1 =int(y/1000)
for i in range(Y10,-1,-1):
if b== True or i > n:
break
for j in r... |
s324283617 | p02747 | u165200006 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 76 | A Hitachi string is a concatenation of one or more copies of the string `hi`. For example, `hi` and `hihi` are Hitachi strings, while `ha` and `hii` are not. Given a string S, determine whether S is a Hitachi string. | s = input()
s = s.replace("hi", "")
if s:
print("Yes")
else:
print("No") | s802898137 | Accepted | 17 | 2,940 | 83 | s = input()
s = s.replace("hi", "")
if s == "":
print("Yes")
else:
print("No")
|
s732544845 | p03738 | u018679195 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 104 | You are given two positive integers A and B. Compare the magnitudes of these numbers. | a=int(input())
b=int(input())
if a>b:
print("GRATER")
elif a<b:
print("LESS")
else:
print("EQUAL") | s360508245 | Accepted | 17 | 3,064 | 134 |
A = int(input())
B = int(input())
if (A > B):
print("GREATER")
elif (A < B):
print("LESS")
elif (A == B):
print("EQUAL") |
s376256678 | p02600 | u679817762 | 2,000 | 1,048,576 | Wrong Answer | 32 | 9,208 | 277 | M-kun is a competitor in AtCoder, whose highest rating is X. In this site, a competitor is given a _kyu_ (class) according to his/her highest rating. For ratings from 400 through 1999, the following kyus are given: * From 400 through 599: 8-kyu * From 600 through 799: 7-kyu * From 800 through 999: 6-kyu * Fr... | X = int(input())
lst = [ [400, 599, 8], [600, 799, 7], [800, 999, 6], [1000, 1199, 5], [1200, 1399, 4], [1400, 1599, 3], [1600, 1799, 2], [1800, 1999, 1] ]
def Kyu(X):
for i in lst:
if i[0] <= X <= i[1]:
result = i[2]
break
print(result) | s734959959 | Accepted | 26 | 9,192 | 281 | X = int(input())
lst = [ [400, 599, 8], [600, 799, 7], [800, 999, 6], [1000, 1199, 5], [1200, 1399, 4], [1400, 1599, 3], [1600, 1799, 2], [1800, 1999, 1] ]
def Kyu(X):
for i in lst:
if i[0] <= X <= i[1]:
result = i[2]
break
print(result)
Kyu(X) |
s313506002 | p02612 | u432453907 | 2,000 | 1,048,576 | Wrong Answer | 31 | 9,152 | 42 | We will buy a product for N yen (the currency of Japan) at a shop. If we use only 1000-yen bills to pay the price, how much change will we receive? Assume we use the minimum number of bills required. | n = int(input())
ans = n % 1000
print(ans) | s942050105 | Accepted | 29 | 9,156 | 74 | n = int(input())
ans = n % 1000
if ans != 0:
ans = 1000-ans
print(ans) |
s050976971 | p02432 | u682153677 | 2,000 | 262,144 | Wrong Answer | 30 | 6,000 | 486 | For a dynamic array $A = \\{a_0, a_1, ...\\}$ of integers, perform a sequence of the following operations: * push($d$, $x$): Add element $x$ at the begining of $A$, if $d = 0$. Add element $x$ at the end of $A$, if $d = 1$. * randomAccess($p$): Print element $a_p$. * pop($d$): Delete the first element of $A$, if... | # -*- coding: utf-8 -*-
from collections import deque
n = int(input())
word = deque()
for i in range(n):
command = list(map(int, input().split()))
if command[0] == 0:
if command[1] == 0:
word.insert(0, command[1])
else:
word.append(command[1])
elif command[0] == 1:... | s615301838 | Accepted | 1,710 | 21,984 | 486 | # -*- coding: utf-8 -*-
from collections import deque
n = int(input())
word = deque()
for i in range(n):
command = list(map(int, input().split()))
if command[0] == 0:
if command[1] == 0:
word.insert(0, command[2])
else:
word.append(command[2])
elif command[0] == 1:... |
s481116635 | p02255 | u046107993 | 1,000 | 131,072 | Wrong Answer | 30 | 7,592 | 399 | 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 ... | #!/usr/bin/env python
size = int(input())
line = list(map(int, input().split()))
def insertionSort(A, N):
for i in range(1, N):
v = A[i]
j = i - 1
while j >= 0 and A[j] > v:
A[j+1] = A[j]
j -= 1
A[j+1] = v
def main():
insertionSort(line, size)
ans =... | s241480392 | Accepted | 30 | 7,752 | 456 | #!/usr/bin/env python
size = int(input())
line = list(map(int, input().split()))
def insertionSort(A, N):
ans = " ".join(map(str, line))
print(ans)
for i in range(1, N):
v = A[i]
j = i - 1
while j >= 0 and A[j] > v:
A[j+1] = A[j]
j -= 1
A[j+1] = v
... |
s359479898 | p03361 | u252883287 | 2,000 | 262,144 | Wrong Answer | 1,550 | 21,480 | 1,196 | We have a canvas divided into a grid with H rows and W columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Initially, all the squares are white. square1001 wants to draw a picture with black paint. His specific objective is to make Square (i, j) black when s_{i... | import numpy as np
na = np.array
def ii():
return int(input())
def lii():
return list(map(int, input().split(' ')))
def lvi(N):
l = []
for _ in range(N):
l.append(ii())
return l
def lv(N):
l = []
for _ in range(N):
l.append(input())
return l
def yn(b):
if b:
... | s244631356 | Accepted | 1,240 | 21,544 | 1,196 | import numpy as np
na = np.array
def ii():
return int(input())
def lii():
return list(map(int, input().split(' ')))
def lvi(N):
l = []
for _ in range(N):
l.append(ii())
return l
def lv(N):
l = []
for _ in range(N):
l.append(input())
return l
def yn(b):
if b:
... |
s856255810 | p03494 | u497326082 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 190 | 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())
p=list(map(int,input().split()))
p_=[]
b=True
c=0
while b:
p_=list(map(lambda in_:type(in_)=="int",p))
b = "False" in p_
p_=list(map(lambda in_:in_/2,p))
c+=1
print(c) | s623752836 | Accepted | 19 | 3,060 | 185 | n=int(input())
a=list(map(int,input().split()))
ans=0
flg=0
while flg==0:
for i in a:
if i%2 != 0:
flg=1
a=list(map(lambda x: x/2,a))
ans+=1
print(ans-1) |
s679299113 | p02261 | u023863700 | 1,000 | 131,072 | Wrong Answer | 40 | 6,344 | 519 | 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... | import copy
n=int(input())
num=input().split()
numa=copy.copy(num)
numb=copy.copy(num)
#buble
for i in range(0,n):
a=0
for j in range(n-1,i,-1):
if numa[j]<numa[j-1]:
a=numa[j]
numa[j]=numa[j-1]
numa[j-1]=a
print(' '.join(list(map(str,numa))))
print('Stable')
#select
for i in range(0,n):
minj=i
b=0
fo... | s721404229 | Accepted | 30 | 6,344 | 535 | import copy
n=int(input())
num=input().split()
numa=copy.copy(num)
numb=copy.copy(num)
#buble
for i in range(0,n):
a=0
for j in range(n-1,i,-1):
if numa[j][1:]<numa[j-1][1:]:
a=numa[j]
numa[j]=numa[j-1]
numa[j-1]=a
print(' '.join(list(map(str,numa))))
print('Stable')
#select
for i in range(0,n):
minj=i
... |
s391246324 | p03624 | u131634965 | 2,000 | 262,144 | Wrong Answer | 19 | 3,188 | 249 | You are given a string S consisting of lowercase English letters. Find the lexicographically (alphabetically) smallest lowercase English letter that does not occur in S. If every lowercase English letter occurs in S, print `None` instead. | alpha=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
s=input()
s_list=sorted(set(s))
print(s_list)
for x, y in zip(s_list, alpha):
if x!=y:
print(y)
exit()
print("None") | s639145987 | Accepted | 18 | 3,188 | 251 | #alpha=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
alpha= list("abcdefghijklmnopqrstuvwxyz")
s=input()
for x in alpha:
if x not in s:
print(x)
exit()
print("None") |
s545573461 | p00008 | u073709667 | 1,000 | 131,072 | Wrong Answer | 30 | 7,652 | 218 | 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). | num=int(input())
sum=0
Range=10
for a in range(Range):
for b in range(Range):
for c in range(Range):
for d in range(Range):
if num==a+b+c+d:
sum+=1
print(sum) | s308744670 | Accepted | 200 | 7,552 | 309 | while True:
try:
num=int(input())
except:
break
sum=0
Range=10
for a in range(Range):
for b in range(Range):
for c in range(Range):
for d in range(Range):
if num==a+b+c+d:
sum+=1
print(sum) |
s697587686 | p02612 | u218834617 | 2,000 | 1,048,576 | Wrong Answer | 28 | 9,028 | 48 | 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. | import sys
n=int(next(sys.stdin))
print(n%1000)
| s044174304 | Accepted | 27 | 9,008 | 62 | import sys
n=int(next(sys.stdin))
print((n+999)//1000*1000-n)
|
s102886565 | p03007 | u907223098 | 2,000 | 1,048,576 | Wrong Answer | 2,104 | 14,264 | 233 | 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=[]
r=0
for i in input().split():
a.append(int(i))
a.sort()
for i in range(n):
if i<=n//2:
r=r+a[-1-i]
else:
r=r-a[-1-i]
print(r)
while len(a)>1:
b=a.pop(-1)
c=a.pop(0)
print(b,c)
a.insert(0,c-b) | s171677235 | Accepted | 291 | 22,364 | 251 | n=int(input())
a=[]
r=[]
for i in input().split():
a.append(int(i))
a.sort()
t=a.pop(-1)
b=a.pop(0)
for i in a:
if i>=0:
r.append([b,i])
b=b-i
else:
r.append([t,i])
t=t-i
print(t-b)
r.append([t,b])
for i in r:
print(i[0],i[1])
|
s722433092 | p03693 | u920103253 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 109 | 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 = [int(x) for x in input().split()]
if (r*100+g*10+b) % 4 == 0:
print("Yes")
else:
print("No") | s023785153 | Accepted | 17 | 2,940 | 109 | r,g,b = [int(x) for x in input().split()]
if (r*100+g*10+b) % 4 == 0:
print("YES")
else:
print("NO") |
s989602771 | p02854 | u111392182 | 2,000 | 1,048,576 | Wrong Answer | 2,104 | 26,220 | 166 | Takahashi, who works at DISCO, is standing before an iron bar. The bar has N-1 notches, which divide the bar into N sections. The i-th section from the left has a length of A_i millimeters. Takahashi wanted to choose a notch and cut the bar at that point into two parts with the same length. However, this may not be po... | n = int(input())
a = list(map(int,input().split()))
l = 0
r = 0
ans = 0
for i in a:
l += i
r = sum(a)-l
if l==r:
break;
elif l>r:
ans = l-r
print(ans) | s724360670 | Accepted | 109 | 26,396 | 216 | n = int(input())
a = list(map(int,input().split()))
b = sum(a)
l = 0
r = 0
x = 0
ans = 0
for i in a:
l += i
r = b - l
if l==r:
break;
elif l>r:
ans = min(l-r,y-x)
break;
x = l
y = r
print(ans) |
s982049783 | p03251 | u099918199 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,060 | 213 | 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 = list(map(int, input().split()))
y_list = list(map(int, input().split()))
x_list.sort()
y_list.sort()
if x_list[-1]+1 < y_list[0]:
print("No War")
else:
print("War") | s922604676 | Accepted | 17 | 3,060 | 281 | n,m,x,y = map(int, input().split())
x_list = list(map(int, input().split()))
y_list = list(map(int, input().split()))
x_list.sort()
y_list.sort()
if x_list[-1] < y_list[0]:
if (y_list[0] > x) and (x_list[-1] < y):
print("No War")
else:
print("War")
else:
print("War") |
s319193136 | p02612 | u969133463 | 2,000 | 1,048,576 | Wrong Answer | 29 | 9,152 | 31 | 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. | a = int(input())
print(a%1000) | s988865002 | Accepted | 27 | 8,968 | 76 | a = int(input())
b = a%1000
if(b > 0):
print(1000-b)
else:
print(b) |
s461975616 | p02386 | u179070318 | 1,000 | 131,072 | Wrong Answer | 20 | 5,656 | 1,046 | 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). | import itertools
class dice():
def __init__(self,number):
self.number = number
def korokoro(self,com):
if com == 'E':
self.number = [self.number[i] for i in [3,1,0,5,4,2]]
if com == 'S':
self.number = [self.number[i] for i in [4,0,2,3,5,1]]
if com == 'N':... | s071088923 | Accepted | 210 | 5,996 | 1,048 | import itertools
class dice():
def __init__(self,number):
self.number = number
def korokoro(self,com):
if com == 'E':
self.number = [self.number[i] for i in [3,1,0,5,4,2]]
if com == 'S':
self.number = [self.number[i] for i in [4,0,2,3,5,1]]
if com == 'N'... |
s873822335 | p03730 | u880466014 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 136 | 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... | import sys
a, b, c = map(int, input().split())
for i in range(1, b+1):
if (a*i) % b == c:
print('Yes')
sys.exit()
print('No') | s639433802 | Accepted | 18 | 2,940 | 135 | import sys
a, b, c = map(int, input().split())
for i in range(1, b+1):
if a*i % b == c:
print('YES')
sys.exit()
print('NO')
|
s394499838 | p03433 | u137443009 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 112 | 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()) #price
A = int(input()) #number of coins
if N%500 <= A:
print('YES')
else:
print('NO') | s750567305 | Accepted | 17 | 2,940 | 88 | N = int(input())
A = int(input())
if N%500 <= A:
print('Yes')
else:
print('No') |
s484460601 | p03399 | u777607830 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 190 | You planned a trip using trains and buses. The train fare will be A yen (the currency of Japan) if you buy ordinary tickets along the way, and B yen if you buy an unlimited ticket. Similarly, the bus fare will be C yen if you buy ordinary tickets along the way, and D yen if you buy an unlimited ticket. Find the minimu... | A = int(input())
B = int(input())
C = int(input())
D = int(input())
1 <= A <= 1000
1 <= B <= 1000
1 <= C <= 1000
1 <= D <= 1000
l = [A, B]
m = [C, D]
#print(max(l))
print(min(l)*min(m))
| s321035995 | Accepted | 17 | 2,940 | 133 |
A = int(input())
B = int(input())
C = int(input())
D = int(input())
l = [A, B]
m = [C, D]
#print(max(l))
print(min(l) + min(m))
|
s866328968 | p03543 | u667024514 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 123 | 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**? | a=input()
A=a[0]
b=[1]
c=[2]
d=[3]
if A==b and b==c:
print("Yes")
elif b==c and c==d:
print("Yes")
else:
print("No")
| s125158699 | Accepted | 17 | 3,060 | 125 | a=input()
A=a[0]
b=a[1]
c=a[2]
d=a[3]
if A==b and b==c:
print("Yes")
elif b==c and c==d:
print("Yes")
else:
print("No") |
s928432647 | p04043 | u203886313 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 110 | Iroha loves _Haiku_. Haiku is a short form of Japanese poetry. A Haiku consists of three phrases with 5, 7 and 5 syllables, in this order. To create a Haiku, Iroha has come up with three different phrases. These phrases have A, B and C syllables, respectively. Determine whether she can construct a Haiku by using each ... | a, b, c = map(int, input().split());
if a == 5 and b == 7 and c == 5:
print("YES");
else:
print("NO") | s371665105 | Accepted | 17 | 3,060 | 259 | abc = list(map(int, input().split()));
five, seven = 0, 0;
for i in range(3):
if abc[i] == 5:
five += 1;
elif abc[i] == 7:
seven += 1;
else:
continue;
if five == 2 and seven == 1:
print("YES");
else:
print("NO"); |
s356255667 | p02390 | u929141425 | 1,000 | 131,072 | Wrong Answer | 20 | 5,580 | 106 | Write a program which reads an integer $S$ [second] and converts it to $h:m:s$ where $h$, $m$, $s$ denote hours, minutes (less than 60) and seconds (less than 60) respectively. | a = int(input(">>"))
h = a//3600
m = (a%3600)//60
s = (a%3600) - m*60
print(str(h)+":"+str(m)+":"+str(s))
| s438224520 | Accepted | 20 | 5,588 | 112 | S =int(input())
h = S//3600
m = (S%3600)//60
s = S - h*3600 - m*60
print(str(h) + ":" + str(m) + ":"+ str(s))
|
s782977292 | p03548 | u729119068 | 2,000 | 262,144 | Wrong Answer | 28 | 9,012 | 53 | 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... | a,b,c=map(int, input().split())
print((a-b-2*c)//2+1) | s598147556 | Accepted | 27 | 9,160 | 57 | a,b,c=map(int, input().split())
print((a-b-2*c)//(b+c)+1) |
s744581404 | p03695 | u243492642 | 2,000 | 262,144 | Wrong Answer | 310 | 5,352 | 1,136 | In AtCoder, a person who has participated in a contest receives a _color_ , which corresponds to the person's rating as follows: * Rating 1-399 : gray * Rating 400-799 : brown * Rating 800-1199 : green * Rating 1200-1599 : cyan * Rating 1600-1999 : blue * Rating 2000-2399 : yellow * Rating 2400-2799 : or... | # coding: utf-8
import array, bisect, collections, copy, heapq, itertools, math, random, re, string, sys, time
sys.setrecursionlimit(10 ** 7)
INF = 10 ** 20
MOD = 10 ** 9 + 7
def II(): return int(input())
def ILI(): return list(map(int, input().split()))
def IAI(LINE): return [ILI() for __ in range(LINE)]
def IDI(): ... | s818164653 | Accepted | 55 | 6,252 | 1,323 | # coding: utf-8
import array, bisect, collections, copy, heapq, itertools, math, random, re, string, sys, time
sys.setrecursionlimit(10 ** 7)
INF = 10 ** 20
MOD = 10 ** 9 + 7
def II(): return int(input())
def ILI(): return list(map(int, input().split()))
def IAI(LINE): return [ILI() for __ in range(LINE)]
def IDI():... |
s323761904 | p03943 | u039623862 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 74 | 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... | c = map(int, input().split())
print('Yes' if max(c)*2 == sum(c) else 'No') | s456489665 | Accepted | 17 | 2,940 | 80 | c = list(map(int, input().split()))
print('Yes' if max(c)*2 == sum(c) else 'No') |
s732247054 | p03567 | u366886346 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 140 | Snuke built an online judge to hold a programming contest. When a program is submitted to the judge, the judge returns a verdict, which is a two-character string that appears in the string S as a contiguous substring. (The judge can return any two-character substring of S.) Determine whether the judge can return the ... | s=input()
yn=0
for i in range(len(s)-1):
if s[i:i+1]=="AC":
yn=1
break
if yn==1:
print("Yes")
else:
print("No")
| s851762479 | Accepted | 17 | 2,940 | 140 | s=input()
yn=0
for i in range(len(s)-1):
if s[i:i+2]=="AC":
yn=1
break
if yn==1:
print("Yes")
else:
print("No")
|
s939617720 | p03545 | u544034775 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 762 | 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... | s = input()
ls = [int(i) for i in s]
n = len(ls)
i = 1
ans = ls[0]
def dfs(i, s, ans):
if i==n:
print(i, 'floor', s, ans)
return ans==7, s, ans
else:
#print(i, 'left', s, ans)
p = i + s.count('+') + s.count('-')
s_temp = s[:p]+'-'+s[p:]
ans_temp = ans - ls[i]
... | s203439670 | Accepted | 18 | 3,064 | 763 | s = input()
ls = [int(i) for i in s]
n = len(ls)
i = 1
ans = ls[0]
def dfs(i, s, ans):
if i==n:
#print(i, 'floor', s, ans)
return ans==7, s, ans
else:
#print(i, 'left', s, ans)
p = i + s.count('+') + s.count('-')
s_temp = s[:p]+'-'+s[p:]
ans_temp = ans - ls[i]
... |
s526075035 | p03007 | u635182517 | 2,000 | 1,048,576 | Wrong Answer | 207 | 14,144 | 879 | 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 = list(map(int, input().split()))
A.sort()
MAX = A.pop(-1)
ans = MAX
MIN = A.pop(0)
if MIN <= 0:
if N == 2:
ans -= MIN
print("{0} {1}".format(MAX, MIN))
else:
for a in A:
if a > 0:
print("{0} {1}".format(MIN, a))
MI... | s520221808 | Accepted | 215 | 14,260 | 1,421 | N = int(input())
A = list(map(int, input().split()))
A.sort()
MAX = A.pop(-1)
ans = MAX
MIN = A.pop(0)
MIN2 = MIN
MAX2 = MAX
if MIN2 <= 0:
if N == 2:
ans -= MIN2
else:
for a in A:
if a > 0:
MIN2 -= a
else:
MAX2 -= a
... |
s396736459 | p03067 | u224226076 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 114 | 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 = (int(i) for i in input().split())
a = min(A,B)
b = max(A,B)
if a<C<b:
print('YES')
else:
print('NO') | s352860535 | Accepted | 17 | 2,940 | 114 | A,B,C = (int(i) for i in input().split())
a = min(A,B)
b = max(A,B)
if a<C<b:
print('Yes')
else:
print('No') |
s024938726 | p02266 | u620998209 | 1,000 | 131,072 | Wrong Answer | 20 | 7,468 | 1,008 | Your task is to simulate a flood damage. For a given cross-section diagram, reports areas of flooded sections. Assume that rain is falling endlessly in the region and the water overflowing from the region is falling in the sea at the both sides. For example, for the above cross-section diagram, the rain will c... | def main():
sectionalview = input()
stack = []
a_surface = 0
surfaces = []
for cindex in range(len(sectionalview)):
if sectionalview[cindex] == "\\":
stack.append(cindex)
elif sectionalview[cindex] == "/" and 0 < len(stack):
if 0 < len(stack):
... | s073083544 | Accepted | 30 | 7,908 | 1,006 | def main():
sectionalview = input()
stack = []
a_surface = 0
surfaces = []
for cindex in range(len(sectionalview)):
if sectionalview[cindex] == "\\":
stack.append(cindex)
elif sectionalview[cindex] == "/" and 0 < len(stack):
if 0 < len(stack):
... |
s966673071 | p03544 | u982762220 | 2,000 | 262,144 | Wrong Answer | 20 | 2,940 | 206 | 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())
memo = dict()
def luca(n):
if n == 0:
return 2
elif n == 1:
return 1
if n in memo:
return memo[n]
tmp = luca(n-1) + luca(n-2)
memo[n] = tmp
return tmp
print(N) | s645168991 | Accepted | 18 | 3,060 | 212 | N = int(input())
memo = dict()
def luca(n):
if n == 0:
return 2
elif n == 1:
return 1
if n in memo:
return memo[n]
tmp = luca(n-1) + luca(n-2)
memo[n] = tmp
return tmp
print(luca(N)) |
s305168400 | p03579 | u033606236 | 2,000 | 262,144 | Wrong Answer | 604 | 32,524 | 502 | Rng has a connected undirected graph with N vertices. Currently, there are M edges in the graph, and the i-th edge connects Vertices A_i and B_i. Rng will add new edges to the graph by repeating the following operation: * Operation: Choose u and v (u \neq v) such that Vertex v can be reached by traversing exactly t... | import sys
sys.setrecursionlimit(500000)
def dfs(v,c):
color[v] = c
for i in a[v]:
if color[i] != -1:
if color[i] == c:return False
continue
if dfs(i,1-c) == False:return False
n,m = map(int,input().split())
a = [[]for i in range(n)]
color = [-1 for _ in range(n)]
for... | s912728288 | Accepted | 467 | 31,152 | 508 | import sys
sys.setrecursionlimit(500000)
def dfs(v,c):
color[v] = c
for i in a[v]:
if color[i] != -1:
if color[i] == c:return False
continue
if dfs(i,1-c) == False:return False
n,m = map(int,input().split())
a = [[]for i in range(n)]
color = [-1 for _ in range(n)]
for... |
s249180533 | p03080 | u319818856 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 201 | There are N people numbered 1 to N. Each person wears a red hat or a blue hat. You are given a string s representing the colors of the people. Person i wears a red hat if s_i is `R`, and a blue hat if s_i is `B`. Determine if there are more people wearing a red hat than people wearing a blue hat. | def red_or_blue(N: int, s: str)->bool:
r = sum(c == 'R' for c in s)
return r > N-r
if __name__ == "__main__":
N = int(input())
s = input()
ans = red_or_blue(N, s)
print(ans)
| s486446287 | Accepted | 17 | 2,940 | 220 | def red_or_blue(N: int, s: str)->bool:
r = sum(c == 'R' for c in s)
return r > N-r
if __name__ == "__main__":
N = int(input())
s = input()
yes = red_or_blue(N, s)
print('Yes' if yes else 'No')
|
s636488642 | p04043 | u902130170 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 241 | Iroha loves _Haiku_. Haiku is a short form of Japanese poetry. A Haiku consists of three phrases with 5, 7 and 5 syllables, in this order. To create a Haiku, Iroha has come up with three different phrases. These phrases have A, B and C syllables, respectively. Determine whether she can construct a Haiku by using each ... | a, b, c = map(str, input().split(" "))
if len(a) == 7 and len(b) == 5 and len(c) == 5 \
or len(a) == 5 and len(b) == 7 and len(c) == 5 \
or len(a) == 5 and len(b) == 5 and len(c) == 7:
print("YES")
else:
print("NO")
| s537338372 | Accepted | 18 | 2,940 | 197 | a, b, c = map(int, input().split(" "))
if a == 5 and b == 7 and c == 5 \
or a == 5 and b == 5 and c == 7 \
or a == 7 and b == 5 and c == 5:
print("YES")
else:
print("NO")
|
s637024327 | p03587 | u264681142 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 42 | Snuke prepared 6 problems for a upcoming programming contest. For each of those problems, Rng judged whether it can be used in the contest or not. You are given a string S of length 6. If the i-th character of s is `1`, it means that the i-th problem prepared by Snuke is accepted to be used; `0` means that the problem... | l = max(list(map(int, input())))
print(l) | s274538309 | Accepted | 18 | 2,940 | 42 | l = sum(list(map(int, input())))
print(l) |
s533725027 | p03474 | u431624930 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 237 | 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. | #coding:utf-8
a,b = (int(i) for i in input().split())
s = input()
print(a,b,s[0:a],s[a],s[a+1:])
a = int(a)
b = int(b)
if(len(s)==(a+b+1) and s[0:a].isdigit() and s[a]=="-" and s[a+1:].isdigit()):
print("Yes")
else:
print("No") | s951490267 | Accepted | 17 | 2,940 | 207 | #coding:utf-8
a,b = (int(i) for i in input().split())
s = input()
a = int(a)
b = int(b)
if(len(s)==(a+b+1) and s[0:a].isdigit() and s[a]=="-" and s[a+1:].isdigit()):
print("Yes")
else:
print("No")
|
s292185367 | p03379 | u598229387 | 2,000 | 262,144 | Wrong Answer | 305 | 25,224 | 187 | When l is an odd number, the median of l numbers a_1, a_2, ..., a_l is the (\frac{l+1}{2})-th largest value among a_1, a_2, ..., a_l. You are given N numbers X_1, X_2, ..., X_N, where N is an even number. For each i = 1, 2, ..., N, let the median of X_1, X_2, ..., X_N excluding X_i, that is, the median of X_1, X_2, ..... | n=int(input())
x=[int(i) for i in input().split()]
xs=sorted(x)
left=xs[n//2-1]
right=xs[n//2]
for i in range(n):
if i <= left:
print(right)
else:
print(left)
| s760917938 | Accepted | 305 | 26,772 | 180 | n=int(input())
x=[int(i) for i in input().split()]
xs=sorted(x)
left=xs[n//2-1]
right=xs[n//2]
for i in x:
if i <= left:
print(right)
else:
print(left)
|
s717943182 | p03945 | u318029285 | 2,000 | 262,144 | Wrong Answer | 20 | 4,212 | 166 | Two foxes Jiro and Saburo are playing a game called _1D Reversi_. This game is played on a board, using black and white stones. On the board, stones are placed in a row, and each player places a new stone to either end of the row. Similarly to the original game of Reversi, when a white stone is placed, all black stones... | S = input().split('B')
if 'B' not in S:
print(0)
exit()
count = 0
for i in S:
if i == '':
continue
else:
count += 1
print(2*count-1) | s981783532 | Accepted | 43 | 3,188 | 460 | S = input()
if S[0] == 'W':
count = 0
f = 0
for i in range(len(S)):
if S[i] == 'W' and f == 1:
f = 0
count += 1
elif S[i] == 'B' and f == 0:
f = 1
count += 1
else:
f = 0
count = 0
for i in range(len(S)):
if S[i] == 'B' and ... |
s890677769 | p02612 | u292349290 | 2,000 | 1,048,576 | Wrong Answer | 27 | 8,880 | 54 | 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. | def main():
N = int(input())
y = N%1000
return y | s953476484 | Accepted | 26 | 9,132 | 83 | x = int(input())
if x%1000 == 0:
y = 0
else:
y = 1000 - (x%1000)
print(y)
|
s501988313 | p03160 | u285022453 | 2,000 | 1,048,576 | Wrong Answer | 270 | 13,980 | 303 | There are N stones, numbered 1, 2, \ldots, N. For each i (1 \leq i \leq N), the height of Stone i is h_i. There is a frog who is initially on Stone 1. He will repeat the following action some number of times to reach Stone N: * If the frog is currently on Stone i, jump to Stone i + 1 or Stone i + 2. Here, a cost of... | n = int(input())
h = list(map(int, input().split()))
dp = [float('inf')] * n
dp[0] = 0
for i in range(0, n - 1):
print(i)
dp[i + 1] = min(dp[i + 1], dp[i] + abs(h[i] - h[i + 1]))
if i + 2 >= n:
continue
dp[i + 2] = min(dp[i + 2], dp[i] + abs(h[i] - h[i + 2]))
print(dp[n - 1])
| s005358603 | Accepted | 250 | 94,100 | 426 | import sys
sys.setrecursionlimit(10 ** 6)
n = int(input())
h = list(map(int, input().split()))
dp = [float('inf')] * n
def rec(i):
if i == 0:
return 0
if dp[i] < 100000000000:
return dp[i]
else:
res = min(dp[i], rec(i - 1) + abs(h[i] - h[i - 1]))
if i > 1:
re... |
s353333938 | p02853 | u285582884 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 196 | We held two competitions: Coding Contest and Robot Maneuver. In each competition, the contestants taking the 3-rd, 2-nd, and 1-st places receive 100000, 200000, and 300000 yen (the currency of Japan), respectively. Furthermore, a contestant taking the first place in both competitions receives an additional 400000 yen.... | a = 0
for x in map(int, input().split()):
if x == 1:
a += 300000
elif x == 2:
a += 200000
elif x == 3:
a += 300000
if x == 600000:
s = 1000000
print(x)
| s476741275 | Accepted | 17 | 2,940 | 186 | s = 0
for i in map(int, input().split()):
if i == 1:
s+=300000
elif i ==2 :
s+= 200000
elif i ==3 :
s+= 100000
if s== 600000:
s = 1000000
print(s) |
s577849942 | p03485 | u765815947 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 52 | 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 + 1) | s102737963 | Accepted | 17 | 2,940 | 101 | a, b = map(int, input().split())
if (a+b) % 2 == 0:
print(int((a+b)/2))
else:
print((a+b)//2 + 1) |
s151816091 | p03494 | u314350544 | 2,000 | 262,144 | Wrong Answer | 25 | 9,088 | 319 | 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())
array = list(map(int, input().split()))
def cal(value):
return value / 2
def odd_even_cal(value):
return value % 2
for i in range(n):
if 0 in list(map(odd_even_cal, array)):
print(i + 1)
break
array = list(map(cal, array))
print(array)
else:
print(i + 1)
| s691105533 | Accepted | 27 | 9,056 | 340 | n = int(input())
array = list(map(int, input().split()))
def cal(value):
return value / 2
def odd_even_cal(value):
return value % 2
flug, counter = -1, 0
while flug < 0:
if 1 in list(map(odd_even_cal, array)) or 0 in array:
flug = 1
break
counter += 1
array = list(map(cal, arra... |
s349813308 | p03719 | u310790595 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 90 | You are given three integers A, B and C. Determine whether C is not less than A and not greater than B. | A, B, C = map(int, input().split())
if C <= A <= B:
print("Yes")
else:
print("No") | s472443421 | Accepted | 17 | 2,940 | 90 | A, B, C = map(int, input().split())
if A <= C <= B:
print("Yes")
else:
print("No") |
s775465446 | p03448 | u102960641 | 2,000 | 262,144 | Wrong Answer | 54 | 2,940 | 199 | You have A 500-yen coins, B 100-yen coins and C 50-yen coins (yen is the currency of Japan). In how many ways can we select some of these coins so that they are X yen in total? Coins of the same kind cannot be distinguished. Two ways to select coins are distinguished when, for some kind of coin, the numbers of that co... | a = int(input())
b = int(input())
c = int(input())
x = int(input())
ans = 0
for i in range(a):
for j in range(b):
for k in range(c):
if (i+1)*500+(j+1)*100+(k+1)*50 == x:
ans += 1 | s415661678 | Accepted | 50 | 3,064 | 204 | a = int(input())
b = int(input())
c = int(input())
x = int(input())
ans = 0
for i in range(a+1):
for j in range(b+1):
for k in range(c+1):
if i*500+j*100+k*50 == x:
ans += 1
print(ans) |
s721445325 | p02690 | u169702930 | 2,000 | 1,048,576 | Wrong Answer | 2,206 | 9,556 | 372 | Give a pair of integers (A, B) such that A^5-B^5 = X. It is guaranteed that there exists such a pair for the given integer X. | x = int(input())
a = 0
b = 0
flag = False
for i in range(10**7):
tmp = (x + i)**(1/5)
if tmp.is_integer():
b = i
a = x + b**5
flag = True
break
if flag == False:
for i in range(-10**7,0):
tmp = (x + i)**(1/5)
if tmp.is_integer():
b = i
... | s902182192 | Accepted | 398 | 9,364 | 501 | x = int(input())
a = []
b = []
ansa = 0
ansb = 0
for i in range(10**3):
a.append(i**5)
b.append(i**5)
for i in a:
for j in b:
if i - j == x:
ansa = i**(1/5)
ansb = j**(1/5)
elif i + j == x:
ansa = i**(1/5)
ansb = -(j**(1/5))
elif -i + j... |
s805102982 | p03160 | u440161695 | 2,000 | 1,048,576 | Wrong Answer | 93 | 13,928 | 152 | There are N stones, numbered 1, 2, \ldots, N. For each i (1 \leq i \leq N), the height of Stone i is h_i. There is a frog who is initially on Stone 1. He will repeat the following action some number of times to reach Stone N: * If the frog is currently on Stone i, jump to Stone i + 1 or Stone i + 2. Here, a cost of... | N=int(input())
A=list(map(int,input().split()))
dp=[float("INF")]*(N+1)
dp[0]=0
for i in range(1,N):
dp[i]=min(dp[i],abs(A[i]-A[i-1]))
print(dp[N-1])
| s463814378 | Accepted | 136 | 13,980 | 201 | N=int(input())
A=list(map(int,input().split()))
dp=[float("INF")]*N
dp[0]=0
dp[1]=abs(A[0]-A[1])
for i in range(2,N):
dp[i]=min(dp[i],abs(A[i]-A[i-1])+dp[i-1],abs(A[i-2]-A[i])+dp[i-2])
print(dp[-1])
|
s719643528 | p03476 | u187205913 | 2,000 | 262,144 | Time Limit Exceeded | 2,105 | 28,620 | 611 | We say that a odd number N is _similar to 2017_ when both N and (N+1)/2 are prime. You are given Q queries. In the i-th query, given two odd numbers l_i and r_i, find the number of odd numbers x similar to 2017 such that l_i ≤ x ≤ r_i. | q = int(input())
l = [list(map(int,input().split())) for _ in range(q)]
def prime_table(n):
list = [True for _ in range(n+1)]
for i in range(2,int(n**0.5)+1):
if list[i]:
j = i*2
while j<=n:
list[j] = False
j += i
table = [i for i in range(n+1... | s414894778 | Accepted | 499 | 32,236 | 627 | q = int(input())
l = [list(map(int,input().split())) for _ in range(q)]
def prime_table(n):
list = [True for _ in range(n+1)]
for i in range(2,int(n**0.5)+1):
if list[i]:
j = i*2
while j<=n:
list[j] = False
j += i
table = [i for i in range(n+1... |
s565454957 | p02406 | u256256172 | 1,000 | 131,072 | Wrong Answer | 20 | 7,544 | 111 | In programming languages like C/C++, a goto statement provides an unconditional jump from the "goto" to a labeled statement. For example, a statement "goto CHECK_NUM;" is executed, control of the program jumps to CHECK_NUM. Using these constructs, you can implement, for example, loops. Note that use of goto statement ... | n = int(input())
for i in range(n):
if (i+1)%3 == 0 or (i+1)%10 == 0:
print(" " + str(i+1), end='') | s988969022 | Accepted | 30 | 7,868 | 121 | n = int(input())
for i in range(n):
if (i+1)%3 == 0 or "3" in str(i+1):
print(" " + str(i+1), end='')
print() |
s043926163 | p02393 | u230653580 | 1,000 | 131,072 | Wrong Answer | 30 | 6,720 | 298 | Write a program which reads three integers, and prints them in ascending order. | x = input().split()
a = int(x[0])
b = int(x[1])
c = int(x[2])
if a < b :
if b > c :
t = b
b = c
c = t
print(a,b,c)
else :
if a > b :
if b > c:
t = b
b = c
c = t
t = a
a = b
b = t
print(a,b,c) | s303157048 | Accepted | 30 | 6,724 | 265 | x = input().split()
a = int(x[0])
b = int(x[1])
c = int(x[2])
if a <= b <= c :
print(a,b,c)
elif a <= c <= b :
print(a,c,b)
elif b <= a <= c :
print(b,a,c)
elif b <= c <= a :
print(b,c,a)
elif c <= a <= b :
print(c,a,b)
else :
print(c,b,a) |
s716745562 | p04014 | u758815106 | 2,000 | 262,144 | Wrong Answer | 2,206 | 9,196 | 746 | For integers b (b \geq 2) and n (n \geq 1), let the function f(b,n) be defined as follows: * f(b,n) = n, when n < b * f(b,n) = f(b,\,{\rm floor}(n / b)) + (n \ {\rm mod} \ b), when n \geq b Here, {\rm floor}(n / b) denotes the largest integer not exceeding n / b, and n \ {\rm mod} \ b denotes the remainder of n d... | n = int(input())
s = int(input())
r = 0
if n < s:
print(-1)
exit()
else:
t1 = 1
t2 = n
while abs(t1-t2) != 1:
nn = n
nt = 0
t3 = (t1 + t2) // 2
while nn != 0:
nt += nn % t3
nn = nn // t3
if nt < s:
t2 = t3
elif n... | s937233258 | Accepted | 414 | 9,200 | 507 | import math
n = int(input())
s = int(input())
r = 0
if n == s:
print(n + 1)
exit()
elif n < s:
print(-1)
exit()
sq = int(math.sqrt(n))
for i in range(2, sq+1):
nt = n
st = 0
while nt > 0:
st += nt % i
nt //= i
if st == s:
print(i)
exit()
fo... |
s648904651 | p00005 | u183079216 | 1,000 | 131,072 | Wrong Answer | 20 | 5,612 | 389 | Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given a and b. | def gcd(a,b):
if a > b:
x = a
y = b
else:
x = b
y = a
while y > 0:
r = x % y
x = y
y = r
return x
def lcm(a,b,gcd):
return a*b/gcd
while 1:
try:
a,b = [int(x) for x in input().split()]
gcd = gcd(a,b)
lcm = lcm(a,b,... | s427880809 | Accepted | 20 | 5,604 | 410 | def gcd(a,b):
if a > b:
x = a
y = b
else:
x = b
y = a
while y > 0:
r = x % y
x = y
y = r
return x
def lcm(a,b,c):
return int(a*b/c)
while 1:
try:
a,b = [int(x) for x in input().split()]
res_gcd = gcd(a,b)
res_lcm =... |
s103565514 | p03658 | u260036763 | 2,000 | 262,144 | Wrong Answer | 20 | 2,940 | 97 | Snuke has N sticks. The length of the i-th stick is l_i. Snuke is making a snake toy by joining K of the sticks together. The length of the toy is represented by the sum of the individual sticks that compose it. Find the maximum possible length of the toy. | n, k = map(int, input().split())
l = sorted(map(int, input().split())) [::-1]
print(sum(l[:k+1])) | s593613766 | Accepted | 17 | 2,940 | 102 | N, K = map(int, input().split())
l = sorted(map(int, input().split()), reverse=True)
print(sum(l[:K])) |
s413141606 | p04030 | u661980786 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 226 | Sig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has 3 keys on it: the `0` key, the `1` key and the backspace key. To begin with, he is using a plain text editor with this keyboard. This editor always displays one string (possibly empty). Just after the editor is launched, this stri... | s = list(input())
len_s = len(s)
output = []
for i in range(0,len_s):
if s[i] =="b" and s[i-1] == True:
output[i-1] = "d"
output.append(s[i])
output2 = [j for j in output if j.isdigit()]
print("".join(output2)) | s912171935 | Accepted | 17 | 3,060 | 223 | s = list(input())
len_s = len(s)
output = []
for i in range(0,len_s):
if s[i] == "B":
try:
output.pop(-1)
except:
pass
else:
output.append(s[i])
print("".join(output)) |
s385107192 | p03721 | u072717685 | 2,000 | 262,144 | Wrong Answer | 2,200 | 1,798,940 | 276 | There is an empty array. The following N operations will be performed to insert integers into the array. In the i-th operation (1≤i≤N), b_i copies of an integer a_i are inserted into the array. Find the K-th smallest integer in the array after the N operations. For example, the 4-th smallest integer in the array \\{1,2... | def main():
n, k = map(int, input().split())
nums = [tuple(map(int, input().split())) for _ in range(n)]
print(nums)
l = []
for num in nums:
l += str(num[0]) * num[1]
li = [int(i) for i in l]
print(li)
l.sort()
print(l[k-1])
main()
| s003151338 | Accepted | 365 | 18,180 | 284 | def main():
n, k = map(int, input().split())
nums = [tuple(map(int, input().split())) for _ in range(n)]
nums.sort(key = lambda x:x[0])
for num in nums:
if num[1] >= k:
print(num[0])
break
else:
k -= num[1]
main()
|
s451165352 | p03635 | u216631280 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 57 | In _K-city_ , there are n streets running east-west, and m streets running north-south. Each street running east-west and each street running north-south cross each other. We will call the smallest area that is surrounded by four streets a block. How many blocks there are in K-city? | n, m = map(int, input().split())
print((n - 2) * (m - 1)) | s226747334 | Accepted | 18 | 2,940 | 57 | n, m = map(int, input().split())
print((n - 1) * (m - 1)) |
s021582660 | p02854 | u660571124 | 2,000 | 1,048,576 | Wrong Answer | 2,109 | 34,208 | 285 | Takahashi, who works at DISCO, is standing before an iron bar. The bar has N-1 notches, which divide the bar into N sections. The i-th section from the left has a length of A_i millimeters. Takahashi wanted to choose a notch and cut the bar at that point into two parts with the same length. However, this may not be po... | import numpy as np
N = int(input())
a = list(map(int, input().split()))
b=[]
for i in a:
if i!=1:
b.append(i-1)
a =b
mindif = 1e9
minidx=0
for i in range(1,N):
dif = np.abs(sum(a[:i])-sum(a[i:]))
if dif<mindif:
mindif = dif
minidx = i
print(minidx) | s280591359 | Accepted | 211 | 26,764 | 189 | N = int(input())
a = list(map(int, input().split()))
r = sum(a)
ra = 0
result = 1e30
for i in range(0,N):
ra += a[i]
r -= a[i]
result = min(result, abs(ra-r))
print(int(result)) |
s808462082 | p03605 | u027598378 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 175 | 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? | input = int(input())
first_digit = input % 10
second_digit = int((input - first_digit) / 10)
if first_digit == 9 or second_digit == 9:
print("YES")
else:
print("NO") | s647816511 | Accepted | 18 | 3,316 | 175 | input = int(input())
first_digit = input % 10
second_digit = int((input - first_digit) / 10)
if first_digit == 9 or second_digit == 9:
print("Yes")
else:
print("No") |
s187644344 | p03943 | u481026841 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 107 | 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... | a,b,c = map(int,input().split())
if a+b == c or a+c == b or b+c ==a:
print('YES')
else:
print('NO') | s254298157 | Accepted | 17 | 2,940 | 107 | a,b,c = map(int,input().split())
if a+b == c or a+c == b or b+c ==a:
print('Yes')
else:
print('No') |
s947267108 | p03478 | u248670337 | 2,000 | 262,144 | Wrong Answer | 20 | 2,940 | 100 | Find the sum of the integers between 1 and N (inclusive), whose sum of digits written in base 10 is between A and B (inclusive). | n,a,b=map(int,input().split())
ans=0
for i in range(n):
if a<=i//10+i%10<=b:
ans+=i
print(ans) | s727670443 | Accepted | 30 | 2,940 | 114 | 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) |
s574253361 | p03407 | u325264482 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 98 | An elementary school student Takahashi has come to a variety store. He has two coins, A-yen and B-yen coins (yen is the currency of Japan), and wants to buy a toy that costs C yen. Can he buy it? Note that he lives in Takahashi Kingdom, and may have coins that do not exist in Japan. | A, B, C = list(map(int, input().split()))
ans = "Yes"
if (A + B) > C:
ans = "No"
print(ans) | s755755148 | Accepted | 17 | 2,940 | 100 | A, B, C = list(map(int, input().split()))
ans = "Yes"
if ((A + B) < C):
ans = "No"
print(ans) |
s247457770 | p00004 | u036236649 | 1,000 | 131,072 | Wrong Answer | 20 | 7,432 | 224 | Write a program which solve a simultaneous equation: ax + by = c dx + ey = f The program should print x and y for given a, b, c, d, e and f (-1,000 ≤ a, b, c, d, e, f ≤ 1,000). You can suppose that given equation has a unique solution. | import sys
for line in sys.stdin:
a, b, c, d, e, f = map(float, line.split())
print(a, b, c, d, e, f)
print('{0:.3f} {1:.3f}'.format(
(e * c - f * b) / (e * a - d * b), (d * c - f * a) / (d * b - e * a))) | s019470113 | Accepted | 30 | 7,260 | 204 | import sys
for line in sys.stdin:
a, b, c, d, e, f = map(float, line.split())
print('{0:.3f} {1:.3f}'.format(
(e * c - f * b) / (e * a - d * b) + 0, (d * c - f * a) / (d * b - e * a) + 0)) |
s921805806 | p03970 | u886142147 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 122 | CODE FESTIVAL 2016 is going to be held. For the occasion, Mr. Takahashi decided to make a signboard. He intended to write `CODEFESTIVAL2016` on it, but he mistakenly wrote a different string S. Fortunately, the string he wrote was the correct length. So Mr. Takahashi decided to perform an operation that replaces a ce... | s = input()
tmp = "C0DEFESTIVAL2O16"
ans = 0
for i in range(16):
if s[i] != tmp[i]:
ans = ans + 1
print(ans) | s719948298 | Accepted | 18 | 2,940 | 122 | s = input()
tmp = "CODEFESTIVAL2016"
ans = 0
for i in range(16):
if s[i] != tmp[i]:
ans = ans + 1
print(ans) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.