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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s267893890 | p03854 | u728498511 | 2,000 | 262,144 | Wrong Answer | 22 | 3,188 | 198 | 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()
i = 0
while s:
s = s.replace("eraser","").replace("erase","").replace("dreamer","").replace("dream","")
i += 1
if i>100000/22:
print("No")
exit()
print("Yes") | s219097554 | Accepted | 28 | 3,188 | 271 | s = input()[::-1]
l = ["maerd", "remaerd", "esare", "resare"]
b = 0
flag = 1
while b!=len(s):
if s[b:b+5] in ["maerd", "esare"]: b += 5
elif s[b:b+6] == "resare": b += 6
elif s[b:b+7] == "remaerd": b += 7
else: break
else: flag = 0
print("YNEOS"[flag::2]) |
s963441020 | p03796 | u334700364 | 2,000 | 262,144 | Wrong Answer | 2,205 | 9,432 | 143 | 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. | number = int(input())
result = 1
for index in range(1, number):
result = result * index
dividor = 10 ** 9 + 7
print (result % dividor) | s109452428 | Accepted | 153 | 10,000 | 111 | import math
n = int(input())
result = math.factorial(n)
dividor = 10 ** 9 + 7
print (result % dividor) |
s184862993 | p03545 | u674959776 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 295 | 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... | n=list(input())
for i in range(1<<3):
cnt=int(n[0])
l=[n[0]]
for j in range(3):
if (i>>j)%2==1:
cnt+=int(n[j+1])
l+="+"+n[j]
else:
cnt-=int(n[j+1])
l+="-"+n[j]
if cnt==7:
print("".join(l)+"=7")
break | s386894052 | Accepted | 17 | 3,064 | 299 | n=list(input())
for i in range(1<<3):
cnt=int(n[0])
l=[n[0]]
for j in range(3):
if (i>>j)%2==1:
cnt+=int(n[j+1])
l+="+"+n[j+1]
else:
cnt-=int(n[j+1])
l+="-"+n[j+1]
if cnt==7:
print("".join(l)+"=7")
break |
s900321368 | p02388 | u903579014 | 1,000 | 131,072 | Wrong Answer | 20 | 7,684 | 38 | Write a program which calculates the cube of a given integer x. | x = int(input("x="))
x = x**3
print(x) | s703757015 | Accepted | 30 | 7,680 | 40 | x = input()
x = int(x)
x = x**3
print(x) |
s822758902 | p03455 | u736788838 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 85 | AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd. | a, b = map(int, input().split())
if a*b % 2:
print("Even")
else:
print("Odd") | s534677238 | Accepted | 18 | 2,940 | 90 | a, b = map(int, input().split())
if a*b % 2 == 0:
print("Even")
else:
print("Odd") |
s639161387 | p03644 | u582817680 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 115 | 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())
now = 1
while(True):
if now>N:
print(now/2)
break
else:
now *= 2
| s264356388 | Accepted | 17 | 3,060 | 433 | x = int(input())
max_num = 0
max_count = 0
for i in range(1, x+1):
count = 0
flag =1
num = i
while flag==1:
if num%2 == 0:
count = count+1
num = num/2
continue
else:
flag=0
if count>=max_count:
max_num = i
... |
s830823861 | p03738 | u940102677 | 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. | x = int(input())-int(input())
if x>0:
print("GREATER")
if x==0:
print("EQUAL")
else:
print("LESS") | s382087486 | Accepted | 18 | 2,940 | 106 | x = int(input())-int(input())
if x>0:
print("GREATER")
elif x==0:
print("EQUAL")
else:
print("LESS") |
s559630154 | p02741 | u171821586 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 145 | Print the K-th element of the following sequence of length 32: 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51 | K=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
def q1(k):
ans = K[k-1]
return ans | s630150115 | Accepted | 17 | 3,060 | 172 | from sys import stdin
n = int(stdin.readline().rstrip())
K=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(K[n-1]) |
s976326158 | p03501 | u982762220 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 56 | You are parking at a parking lot. You can choose from the following two fee plans: * Plan 1: The fee will be A×T yen (the currency of Japan) when you park for T hours. * Plan 2: The fee will be B yen, regardless of the duration. Find the minimum fee when you park for N hours. | N, A, B = map(int, input().split())
print(max(N * A, B)) | s400310398 | Accepted | 17 | 2,940 | 56 | N, A, B = map(int, input().split())
print(min(N * A, B)) |
s610080965 | p03379 | u255943004 | 2,000 | 262,144 | Wrong Answer | 170 | 27,192 | 101 | 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, ..... | from statistics import median
N = int(input())
X = [int(i) for i in input().split()]
print(median(X)) | s830988619 | Accepted | 334 | 27,240 | 229 | from statistics import median
N = int(input())
X = [int(i) for i in input().split()]
sort_X = sorted(X)
sort_X = sort_X[N//2-1:N//2+1]
for x in X:
if sort_X[0] >= x:
print(sort_X[1])
else:
print(sort_X[0]) |
s063490616 | p03573 | u514118270 | 2,000 | 262,144 | Wrong Answer | 36 | 9,992 | 567 | You are given three integers, A, B and C. Among them, two are the same, but the remaining one is different from the rest. For example, when A=5,B=7,C=5, A and C are the same, but B is different. Find the one that is different from the rest among the given three integers. | import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): retur... | s682993283 | Accepted | 35 | 10,048 | 567 | import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): retur... |
s643723325 | p02281 | u247976584 | 1,000 | 131,072 | Wrong Answer | 30 | 8,112 | 1,279 | Binary trees are defined recursively. A binary tree _T_ is a structure defined on a finite set of nodes that either * contains no nodes, or * is composed of three disjoint sets of nodes: \- a root node. \- a binary tree called its left subtree. \- a binary tree called its right subtree. Your task is to wr... | from collections import namedtuple
class TreeWalk:
def __init__(self, t):
self.t = t
def preParse(self, u):
if u == -1:
return
print(" ", str(u), end = "")
self.preParse(self.t[u].l)
self.preParse(self.t[u].r)
def inParse(self, u):
if u == -1:
... | s606110633 | Accepted | 60 | 8,188 | 1,280 | from collections import namedtuple
class TreeWalk:
def __init__(self, t):
self.t = t
def preParse(self, u):
if u == -1:
return
print("", str(u), end = "")
self.preParse(self.t[u].l)
self.preParse(self.t[u].r)
def inParse(self, u):
if u == -1:
... |
s473388934 | p03760 | u532966492 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 124 | 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... | A=input()
B=input()
C=[]
for i in range(len(A)):
C.append(A[i])
if len(B)-1 >= i:
C.append(B[i])
"".join(C) | s071623787 | Accepted | 17 | 2,940 | 131 | A=input()
B=input()
C=[]
for i in range(len(A)):
C.append(A[i])
if len(B)-1 >= i:
C.append(B[i])
print("".join(C)) |
s313307738 | p03377 | u009348313 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 83 | There are a total of A + B cats and dogs. Among them, A are known to be cats, but the remaining B are not known to be either cats or dogs. Determine if it is possible that there are exactly X cats among these A + B animals. | A, B, X = map(int, input().split())
print('Yes' if A <= X and A + B >= X else 'No') | s636906700 | Accepted | 17 | 2,940 | 84 | A, B, X = map(int, input().split())
print('YES' if A <= X and A + B >= X else 'NO')
|
s901144917 | p00009 | u150414576 | 1,000 | 131,072 | Wrong Answer | 3,620 | 19,016 | 501 | Write a program which reads an integer n and prints the number of prime numbers which are less than or equal to n. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7. | # -*- coding;utf-8 -*-
def sieve(n):
p = 0
primes = []
is_prime = [True]*(n+1)
is_prime[0] = False
is_prime[1] = False
for i in range(2, n+1):
if(is_prime[i]):
primes.append(i)
p += 1
for j in range(i*2,n,i):
is_prime[j] = False
re... | s985304052 | Accepted | 3,800 | 19,020 | 503 | # -*- coding;utf-8 -*-
def sieve(n):
p = 0
primes = []
is_prime = [True]*(n+1)
is_prime[0] = False
is_prime[1] = False
for i in range(2, n+1):
if(is_prime[i]):
primes.append(i)
p += 1
for j in range(i*2,n+1,i):
is_prime[j] = False
... |
s530198486 | p03377 | u589726284 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 99 | 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 X <= A+B and X <= A:
print('YES')
else:
print('NO')
| s420227840 | Accepted | 17 | 2,940 | 99 | A, B, X = map(int, input().split())
if X <= A+B and X >= A:
print('YES')
else:
print('NO')
|
s520558317 | p02697 | u070201429 | 2,000 | 1,048,576 | Wrong Answer | 75 | 9,280 | 285 | You are going to hold a competition of one-to-one game called AtCoder Janken. _(Janken is the Japanese name for Rock-paper-scissors.)_ N players will participate in this competition, and they are given distinct integers from 1 through N. The arena has M playing fields for two players. You need to assign each playing fi... | n, m = map(int, input().split())
if n % 2 == 1:
a = n // 2
b = a + 1
for _ in range(m):
print(a, b)
a -= 1
b += 1
exit()
a = n // 2
b = a + 1
for i in range(m):
if i == n // 2:
a -= 1
print(a)
print(b)
a -= 1
b += 1 | s632595038 | Accepted | 77 | 9,272 | 275 | n, m = map(int, input().split())
if n % 2 == 1:
a = n // 2
b = a + 1
for _ in range(m):
print(a, b)
a -= 1
b += 1
exit()
a = n // 2
b = a + 1
for i in range(m):
if i == n // 4:
a -= 1
print(a, b)
a -= 1
b += 1 |
s279430065 | p02602 | u208285846 | 2,000 | 1,048,576 | Wrong Answer | 2,206 | 31,828 | 319 | M-kun is a student in Aoki High School, where a year is divided into N terms. There is an exam at the end of each term. According to the scores in those exams, a student is given a grade for each term, as follows: * For the first through (K-1)-th terms: not given. * For each of the K-th through N-th terms: the m... | n=list(map(int,input().strip().split()))
m=list(map(int,input().strip().split()))
a=[]
c=0
x=1
for i in range(0,n[1]):
x*=m[i]
a.append(x)
l=0
k=n[1]
for i in range(1,n[0]-n[1]):
x//=m[l]
x*=m[k]
a.append(x)
l+=1
k+=1
for i in range(1,len(a)):
if(a[i-1]<a[i]):
print("Yes")
else:
print("No")
| s333255439 | Accepted | 143 | 31,760 | 183 | n=list(map(int,input().strip().split()))
m=list(map(int,input().strip().split()))
for i in range(n[0]-n[1]):
if(m[i+n[1]]>m[i]):
print("Yes")
else:
print("No") |
s402547895 | p03494 | u642529859 | 2,000 | 262,144 | Wrong Answer | 30 | 9,164 | 243 | 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()))
ans = 0
def yo(n):
return n%2
def waru(n):
return int(n / 2)
B = list(map(yo, A))
for i in range(N):
if sum(B) == 0:
A = list(map(waru, A))
ans += 1
print(ans) | s660479348 | Accepted | 35 | 8,960 | 247 | N = int(input())
A = list(map(int, input().split()))
ans = 0
def yo(n):
return n%2
def waru(n):
return int(n / 2)
for i in range(200):
B = list(map(yo, A))
if sum(B) == 0:
A = list(map(waru, A))
ans += 1
print(ans) |
s548808791 | p03693 | u393253137 | 2,000 | 262,144 | Wrong Answer | 19 | 2,940 | 67 | 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())
print("No" if (g*10+b)%4 else "Yes") | s674231003 | Accepted | 17 | 2,940 | 67 | r,g,b=map(int,input().split())
print("NO" if (g*10+b)%4 else "YES") |
s542820855 | p02274 | u731710433 | 1,000 | 131,072 | Wrong Answer | 20 | 7,624 | 643 | For a given sequence $A = \\{a_0, a_1, ... a_{n-1}\\}$, the number of pairs $(i, j)$ where $a_i > a_j$ and $i < j$, is called the number of inversions. The number of inversions is equal to the number of swaps of Bubble Sort defined in the following program: bubbleSort(A) cnt = 0 // the number of inver... | def merge(num, left, mid, right):
global cnt
inf = 10**9 + 1
L = num[left:mid] + [inf]
R = num[mid:right] + [inf]
i, j = 0, 0
for k in range(left, right):
if L[i] <= R[j]:
num[k] = L[i]
i += 1
else:
num[k] = R[j]
j += 1
... | s291150503 | Accepted | 1,510 | 30,624 | 639 | def merge(num, left, mid, right):
global cnt
inf = 10**9 + 1
L = num[left:mid] + [inf]
R = num[mid:right] + [inf]
i = j = 0
for k in range(left, right):
if L[i] <= R[j]:
num[k] = L[i]
i += 1
else:
num[k] = R[j]
j += 1
cn... |
s766879980 | p03377 | u039623862 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 77 | There are a total of A + B cats and dogs. Among them, A are known to be cats, but the remaining B are not known to be either cats or dogs. Determine if it is possible that there are exactly X cats among these A + B animals. | a, b, x = map(int, input().split())
print('Yes' if a <= x <= a+b else 'No')
| s118613469 | Accepted | 17 | 2,940 | 77 | a, b, x = map(int, input().split())
print('YES' if a <= x <= a+b else 'NO') |
s840196939 | p03447 | u729119068 | 2,000 | 262,144 | Wrong Answer | 27 | 9,160 | 54 | 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? | a,b,c=[int(input()) for i in range(3)]
print((a-b)//c) | s723799031 | Accepted | 24 | 9,160 | 53 | a,b,c=[int(input()) for i in range(3)]
print((a-b)%c) |
s131800324 | p03417 | u891422384 | 2,000 | 262,144 | Wrong Answer | 25 | 9,120 | 135 | There is a grid with infinitely many rows and columns. In this grid, there is a rectangular region with consecutive N rows and M columns, and a card is placed in each square in this region. The front and back sides of these cards can be distinguished, and initially every card faces up. We will perform the following op... | N,M = map(int, input().split())
if min(N,M)>1:
print(N*M-N*2-M*2)
elif max(N,M)==1:
print(1)
elif min(N,M)==1:
print(max(N,M)-2) | s203688932 | Accepted | 30 | 9,104 | 145 | N,M = map(int, input().split())
if min(N,M)>1:
print(N*M-4-(N-2)*2-(M-2)*2)
elif max(N,M)==1:
print(1)
elif min(N,M)==1:
print(max(N,M)-2) |
s132973176 | p03719 | u224050758 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 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 = [int(s) for s in input().split()]
A, B = sorted([A, B])
print('YES' if A <= C <= B else 'NO') | s127177485 | Accepted | 17 | 2,940 | 81 | A, B, C = [int(s) for s in input().split()]
print('Yes' if A <= C <= B else 'No') |
s246344661 | p03433 | u035496246 | 2,000 | 262,144 | Wrong Answer | 23 | 9,044 | 83 | 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())
mod = n % 500
print("Yes" if a <= mod else "No") | s646187263 | Accepted | 24 | 9,144 | 84 | n = int(input())
a = int(input())
mod = n % 500
print("Yes" if a >= mod else "No") |
s224276783 | p02255 | u002280517 | 1,000 | 131,072 | Wrong Answer | 20 | 5,592 | 225 | 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())
a = list(map(int,input().split()))
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
print(' '.join(map(str,a)))
| s867977875 | Accepted | 20 | 5,596 | 250 | N = int(input())
a = list(map(int,input().split()))
print(' '.join(map(str,a)))
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
print(' '.join(map(str,a)))
|
s824827062 | p03607 | u807772568 | 2,000 | 262,144 | Time Limit Exceeded | 2,123 | 496,536 | 182 | You are playing the following game with Joisino. * Initially, you have a blank sheet of paper. * Joisino announces a number. If that number is written on the sheet, erase the number from the sheet; if not, write the number on the sheet. This process is repeated N times. * Then, you are asked a question: How many... | n = int(input())
a = [0 for i in range(10**9)]
for i in range(n):
k = int(input())
a[k-1] += 1
co = 0
for i in range(10**9):
if a[i] % 2 == 1:
co += 1
print(co) | s851510556 | Accepted | 206 | 16,612 | 168 | import collections
n = int(input())
co = collections.Counter([int(input()) for i in range(n)])
c =0
for i in co.values():
if i % 2 != 0:
c +=1
print(c) |
s889269904 | p03739 | u516447519 | 2,000 | 262,144 | Wrong Answer | 116 | 20,524 | 811 | You are given an integer sequence of length N. The i-th term in the sequence is a_i. In one operation, you can select a term and either increment or decrement it by one. At least how many operations are necessary to satisfy the following conditions? * For every i (1≤i≤n), the sum of the terms from the 1-st through ... | n = int(input())
a = [int(i) for i in input().split()]
count1 = 0
count2 = 0
sum = 0
for i in range(0,n-1):
if i % 2 == 0:
if sum + a[i] > 0:
continue
elif sum + a[i] <= 0:
count1 += abs(1 - sum -a[i])
sum = 1
if i % 2 == 1:
if sum + a[i] < 0:
... | s884780512 | Accepted | 122 | 20,404 | 908 | n = int(input())
a = [int(i) for i in input().split()]
count1 = 0
count2 = 0
sum = 0
for i in range(0,n):
if i % 2 == 0:
if sum + a[i] > 0:
sum += a[i]
continue
elif sum + a[i] <= 0:
count1 += abs(1 - sum -a[i])
sum = 1
elif i % 2 == 1:
i... |
s076999549 | p02694 | u453683890 | 2,000 | 1,048,576 | Wrong Answer | 23 | 9,152 | 74 | Takahashi has a deposit of 100 yen (the currency of Japan) in AtCoder Bank. The bank pays an annual interest rate of 1 % compounded annually. (A fraction of less than one yen is discarded.) Assuming that nothing other than the interest affects Takahashi's balance, in how many years does the balance reach X yen or abo... | import math
n = int(input())
i = 100
while i < n:
i += math.ceil(i*1.01) | s032281810 | Accepted | 20 | 9,096 | 111 | import math
n = int(input())
i = 100
count = 0
while i < n:
i = math.floor(i*1.01)
count += 1
print(count)
|
s178059906 | p03160 | u065578867 | 2,000 | 1,048,576 | Wrong Answer | 104 | 13,976 | 340 | 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()))
h.append(1000000007)
dp = [h[0]]
count = 0
while count < n - 1:
sgst_1 = abs(h[count + 1] - h[count])
sgst_2 = abs(h[count + 2] - h[count])
if sgst_1 <= sgst_2:
dp.append(sgst_1)
count += 1
else:
dp.append(sgst_2)
count... | s910383084 | Accepted | 130 | 13,980 | 236 | n = int(input())
h = list(map(int, input().split()))
dp = [float('inf')] * n
dp[0] = 0
dp[1] = abs(h[0] - h[1])
for i in range(2, n):
dp[i] = min((dp[i - 2] + abs(h[i - 2] - h[i])), (dp[i - 1] + abs(h[i - 1] - h[i])))
print(dp[-1])
|
s228967199 | p03470 | u281216592 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 205 | An _X -layered kagami mochi_ (X ≥ 1) is a pile of X round mochi (rice cake) stacked vertically where each mochi (except the bottom one) has a smaller diameter than that of the mochi directly below it. For example, if you stack three mochi with diameters of 10, 8 and 6 centimeters from bottom to top in this order, you h... | N = int(input())
d = [int(input()) for i in range(N)]
print(d)
d_sorted = sorted(d)
size = 0
count = 0
for i in range(N):
if(size < d_sorted[i]):
count += 1
size = d_sorted[i]
print(i)
| s835975017 | Accepted | 18 | 2,940 | 200 | N = int(input())
d = [int(input()) for i in range(N)]
d_sorted = sorted(d)
size = 0
count = 0
for i in range(N):
if(size < d_sorted[i]):
count += 1
size = d_sorted[i]
print(count)
|
s627676985 | p03140 | u859897687 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,060 | 196 | You are given three strings A, B and C. Each of these is a string of length N consisting of lowercase English letters. Our objective is to make all these three strings equal. For that, you can repeatedly perform the following operation: * Operation: Choose one of the strings A, B and C, and specify an integer i bet... | n=int(input())
a=input()
b=input()
c=input()
ans=0
for i in range(n):
if a[i]==b[i]:
if not b[i]==c[i]:
ans+=1
else:
if b[i]==c[i]:
ans+=1
else:
ans+=2
print(ans) | s332873067 | Accepted | 17 | 3,064 | 230 | n=int(input())
a=input()
b=input()
c=input()
ans=0
for i in range(n):
if a[i]==b[i]:
if not b[i]==c[i]:
ans+=1
else:
if b[i]==c[i]:
ans+=1
elif a[i]==c[i]:
ans+=1
else:
ans+=2
print(ans) |
s839279030 | p03853 | u519923151 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 179 | 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())
ab = [input() for i in range(H)]
res = [0 for i in range(H*2)]
for i in range(0,H):
res[(i+1)*2-1] = ab[i]
res[(i)*2] = ab[i]
print(res) | s078720161 | Accepted | 18 | 3,064 | 209 | H,W = map(int, input().split())
ab = [input() for i in range(H)]
res = [0 for i in range(H*2)]
for i in range(0,H):
res[(i+1)*2-1] = ab[i]
res[(i)*2] = ab[i]
for j in range(0,H*2):
print(res[j]) |
s120234074 | p03129 | u646560152 | 2,000 | 1,048,576 | Wrong Answer | 21 | 3,316 | 166 | Determine if we can choose K different integers between 1 and N (inclusive) so that no two of them differ by 1. | in_list = input().split()
n = int(in_list[0])
k = int(in_list[1])
num = 1
ans = "Yes"
for i in range(k):
num+=2
if(num>n):
ans="No"
break
print(ans) | s323894815 | Accepted | 19 | 2,940 | 121 | in_list = input().split()
n = int(in_list[0])
k = int(in_list[1])
if(1+2*(k-1)<=n):
print("YES")
else:
print("NO")
|
s718075453 | p02396 | u299257375 | 1,000 | 131,072 | Wrong Answer | 20 | 5,588 | 82 | In the online judge system, a judge file may include multiple datasets to check whether the submitted program outputs a correct answer for each test case. This task is to practice solving a problem with multiple datasets. Write a program which reads an integer x and print it as is. Note that multiple datasets are give... | for i in range(6):
num = int(input())
print("Case {}: {}".format(i, num))
| s732753729 | Accepted | 140 | 5,600 | 129 | check = 0
while True:
x = int(input())
if x == 0:
break
check += 1
print("Case {}: {}".format(check, x))
|
s160398119 | p02600 | u980161268 | 2,000 | 1,048,576 | Wrong Answer | 30 | 9,188 | 300 | 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('点数:'))
if 400 <= X <= 599:
print(8)
if 600 <= X <= 799:
print(7)
if 800 <= X <= 999:
print(6)
if 1000 <= X <= 1199:
print(5)
if 1200 <= X <= 1399:
print(4)
if 1400 <= X <= 1599:
print(3)
if 1600 <= X <= 1799:
print(2)
if 1800 <= X <= 1999:
print(1) | s542818136 | Accepted | 31 | 9,188 | 291 | X = int(input())
if 400 <= X <= 599:
print(8)
if 600 <= X <= 799:
print(7)
if 800 <= X <= 999:
print(6)
if 1000 <= X <= 1199:
print(5)
if 1200 <= X <= 1399:
print(4)
if 1400 <= X <= 1599:
print(3)
if 1600 <= X <= 1799:
print(2)
if 1800 <= X <= 1999:
print(1) |
s293569540 | p02613 | u432031819 | 2,000 | 1,048,576 | Wrong Answer | 154 | 16,284 | 228 | Takahashi is participating in a programming contest called AXC002, and he has just submitted his code to Problem A. The problem has N test cases. For each test case i (1\leq i \leq N), you are given a string S_i representing the verdict for that test case. Find the numbers of test cases for which the verdict is `AC`,... | a = int(input())
jud = []
for i in range(a):
jud.append(input().strip())
print(a)
print('AC x '+str(jud.count('AC')))
print('WA x '+str(jud.count('WA')))
print('TLE x '+str(jud.count('TLE')))
print('RE x '+str(jud.count('RE'))) | s915482711 | Accepted | 151 | 16,168 | 220 | a = int(input())
jud = []
for i in range(a):
jud.append(input().strip())
print('AC x '+str(jud.count('AC')))
print('WA x '+str(jud.count('WA')))
print('TLE x '+str(jud.count('TLE')))
print('RE x '+str(jud.count('RE'))) |
s681046455 | p02936 | u330661451 | 2,000 | 1,048,576 | Wrong Answer | 1,460 | 57,120 | 327 | Given is a rooted tree with N vertices numbered 1 to N. The root is Vertex 1, and the i-th edge (1 \leq i \leq N - 1) connects Vertex a_i and b_i. Each of the vertices has a counter installed. Initially, the counters on all the vertices have the value 0. Now, the following Q operations will be performed: * Operati... | n,q = map(int,input().split())
r = [[] for i in range(n)]
v = [0 for i in range(n)]
for i in range(n-1):
a,b = map(int,input().split())
r[a-1].append(b-1)
for i in range(q):
p,x = map(int,input().split())
v[p-1] += x
for i in range(1,n):
for y in r[i]:
v[y] += v[i]
print(" ".join(map(s... | s211834457 | Accepted | 1,728 | 55,808 | 544 | n,q = map(int,input().split())
r = [[] for i in range(n)]
v = [0 for i in range(n)]
for i in range(n-1):
a,b = map(int,input().split())
r[a-1].append(b-1)
r[b-1].append(a-1)
for i in range(q):
p,x = map(int,input().split())
v[p-1] += x
bfs = [0]
visit = [False for i in range(n)]
while len(bfs) !... |
s329276399 | p03493 | u600261652 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 39 | 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. | A = input().split()
print(A.count("1")) | s227293496 | Accepted | 17 | 2,940 | 31 | A = input()
print(A.count("1")) |
s633898954 | p02258 | u457728280 | 1,000 | 131,072 | Time Limit Exceeded | 9,990 | 5,580 | 390 | You can obtain profits from foreign exchange margin transactions. For example, if you buy 1000 dollar at a rate of 100 yen per dollar, and sell them at a rate of 108 yen per dollar, you can obtain (108 - 100) × 1000 = 8000 yen. Write a program which reads values of a currency $R_t$ at a certain time $t$ ($t = 0, 1, 2,... | intMax = -100000000
inputData = int(input())
inputList = list()
count = 0
while count < inputData:
inputList.append(int(input()))
count = count + 1
inputDataMax = intMax
inputDataMin = inputList[0]
count2 = 1
while count2 < inputData:
inputDataMax = max(inputDataMax, inputList[count2] - inputDataMin)
... | s919104740 | Accepted | 610 | 13,592 | 358 | intMax = -10000000000
inputData = int(input())
inputList = list()
for i in range(inputData):
inputList.append(int(input()))
inputDataMax = intMax
inputDataMin = inputList[0]
for i in range(inputData - 1):
inputDataMax = max(inputDataMax, inputList[i + 1] - inputDataMin)
inputDataMin = min(inputDataMin, in... |
s570555493 | p03227 | u550895180 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 317 | You are given a string S of length 2 or 3 consisting of lowercase English letters. If the length of the string is 2, print it as is; if the length is 3, print the string after reversing it. | import sys
def solve(S):
x = S
if len(S) == 2:
return S
elif len(S) == 3 :
return x[2] + x[1] + x[0]
def readQuestion():
ws = sys.stdin.readline().strip().split()
S = int(ws[0])
return (S)
def main():
print(solve(*readQuestion()))
# Uncomment before submission
# main() | s136653239 | Accepted | 17 | 2,940 | 99 | s = input()
x = s
if len(s) == 2 :
print (s)
elif len(s) == 3 :
print (x[2] + x[1] + x[0]) |
s603515931 | p03069 | u960783046 | 2,000 | 1,048,576 | Wrong Answer | 64 | 3,500 | 147 | There are N stones arranged in a row. Every stone is painted white or black. A string S represents the color of the stones. The i-th stone from the left is white if the i-th character of S is `.`, and the stone is black if the character is `#`. Takahashi wants to change the colors of some stones to black or white so t... | n = int(input())
s = input()
x = sum(1 if s[i] != "
y = sum(0 if s[i] != "
print(min(x, y)) | s242983299 | Accepted | 144 | 3,500 | 413 |
N = int(input())
S = " " + str(input()) + " "
ans = N+2
prev = ""
black = 0
white = S.count(".")
first_white = white
first_black = N - first_white
for i in range(N+2):
current = S[i]
ans = min(ans, black+white)
if current is ".":
white -= 1
elif current is "#":
black += 1
pr... |
s543553361 | p02841 | u490642448 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,068 | 33 | In this problem, a date is written as Y-M-D. For example, 2019-11-30 means November 30, 2019. Integers M_1, D_1, M_2, and D_2 will be given as input. It is known that the date 2019-M_2-D_2 follows 2019-M_1-D_1. Determine whether the date 2019-M_1-D_1 is the last day of a month. | print(input().count(input()[:2])) | s203335523 | Accepted | 21 | 3,060 | 32 | print(1-(input()[:2]in input())) |
s110511191 | p03752 | u033602950 | 1,000 | 262,144 | Wrong Answer | 59 | 3,064 | 391 | There are N buildings along the line. The i-th building from the left is colored in color i, and its height is currently a_i meters. Chokudai is a mayor of the city, and he loves colorful thigs. And now he wants to see at least K buildings from the left. You can increase height of buildings, but it costs 1 yens ... | n,k = list(map(int, input().split()))
a=list(map(int, input().split()))
ans=[]
for i in range(1<<n):
if bin(i).count("1")==k:
cst=0
use=a.copy()
for u in range(1,n):
if(i>>u&1):
left_max=max(use[:u])
cst+=left_max-use[u]+1
use... | s921594187 | Accepted | 68 | 3,064 | 416 | n,k = list(map(int, input().split()))
a=list(map(int, input().split()))
ans=[]
for i in range(1<<n):
if bin(i).count("1")==k:
cst=0
use=a.copy()
for u in range(1,n):
if(i>>u&1):
left_max=max(use[:u])
cst+=left_max-use[u]+1 if left_max>=use[u]... |
s421823273 | p02276 | u247976584 | 1,000 | 131,072 | Wrong Answer | 20 | 7,652 | 624 | Quick sort is based on the Divide-and-conquer approach. In QuickSort(A, p, r), first, a procedure Partition(A, p, r) divides an array A[p..r] into two subarrays A[p..q-1] and A[q+1..r] such that each element of A[p..q-1] is less than or equal to A[q], which is, inturn, less than or equal to each element of A[q+1..r]. I... | class Partition:
def partion(self, a, p, r):
x = a[-1]
i = p - 1
for j in range(p, r):
if a[j] <= x:
i += 1
a[i], a[j] = a[j], a[i]
a[i + 1], a[-1] = a[-1], a[i + 1]
return((a, i))
if __name__ == '__main__':
n ... | s764800124 | Accepted | 80 | 18,344 | 506 | class Partition:
def partion(self, a, p, r):
x = a[r]
i = p - 1
for j in range(p, r):
if a[j] <= x:
i += 1
a[i], a[j] = a[j], a[i]
a[i + 1], a[r] = a[r], a[i + 1]
return(i+1)
if __name__ == '__main__':
n = int(input().rstrip()... |
s920884684 | p03739 | u576432509 | 2,000 | 262,144 | Wrong Answer | 274 | 14,468 | 626 | You are given an integer sequence of length N. The i-th term in the sequence is a_i. In one operation, you can select a term and either increment or decrement it by one. At least how many operations are necessary to satisfy the following conditions? * For every i (1≤i≤n), the sum of the terms from the 1-st through ... | n=int(input())
a=list(map(int,input().split()))
kp=0
asum=0
flag=-1
for i in range(n):
asum=asum+a[i]
if flag==-1:
if asum>=0:
kp=kp+asum+1
asum=-1
else:
if asum<=0:
kp=kp+1-asum
asum=1
flag=-flag
print(asum)
print("-----",kp) ... | s472810228 | Accepted | 127 | 14,468 | 749 | n=int(input())
a=list(map(int,input().split()))
# kevn + - + - + -
# kodd - + - + - +
def kf(a,flag,n):
a0=a[0]*flag
if a0<=0:
kevn=1-a0
sevn=1
elif a0>0:
kevn=0
sevn=a0
for i in range(1,n):
ai=a[i]*flag
if i%2==0:
if sevn+ai<... |
s847627932 | p00028 | u300946041 | 1,000 | 131,072 | Wrong Answer | 20 | 7,632 | 237 | 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. | # -*- coding: utf-8 -*-
DICT = {k: 0 for k in range(0, 10)}
while True:
try:
n = int(input())
DICT[n] += 1
except:
break
tmp = None
for k, v in DICT.items():
if v != tmp:
break
print(k) | s308612529 | Accepted | 30 | 7,724 | 344 | # -*- coding: utf-8 -*-
DICT = {k: 0 for k in range(1, 101)}
def solve(d):
_max = max(d.values())
for k, v in sorted(d.items()):
if _max == v:
print(k)
if __name__ == '__main__':
while True:
try:
n = int(input())
DICT[n] += 1
except:
... |
s562202153 | p03659 | u513434790 | 2,000 | 262,144 | Wrong Answer | 127 | 24,172 | 228 | Snuke and Raccoon have a heap of N cards. The i-th card from the top has the integer a_i written on it. They will share these cards. First, Snuke will take some number of cards from the top of the heap, then Raccoon will take all the remaining cards. Here, both Snuke and Raccoon have to take at least one card. Let th... | from itertools import accumulate
N = int(input())
a = list(map(int, input().split()))
s = list(accumulate(a))
ans = abs(2 * s[0] - s[-1])
for i in range((N//2)+ N%2):
ans = min(ans, abs(2 * s[i] - s[-1]) )
print(ans) | s225941377 | Accepted | 167 | 24,168 | 220 | from itertools import accumulate
N = int(input())
a = list(map(int, input().split()))
s = list(accumulate(a))
ans = abs(2 * s[0] - s[-1])
for i in range(N-1):
ans = min(ans, abs(2 * s[i] - s[-1]) )
print(ans) |
s356287529 | p03644 | u221345507 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 120 | 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())
out=1
outbefore=1
count=0
while out<=N:
outbefore=out
out=out*2
count+=1
print(outbefore) | s917518788 | Accepted | 17 | 3,060 | 186 | N=int(input())
if N<2:
print(1)
elif N<4:
print(2)
elif N<8:
print(4)
elif N<16:
print(8)
elif N<32:
print(16)
elif N<64:
print(32)
elif N<= 100:
print (64) |
s898250062 | p02619 | u262597910 | 2,000 | 1,048,576 | Wrong Answer | 33 | 9,800 | 376 | Let's first write a program to calculate the score from a pair of input and output. You can know the total score by submitting your solution, or an official program to calculate a score is often provided for local evaluation as in this contest. Nevertheless, writing a score calculator by yourself is still useful to che... | import random
d = int(input())
c = list(map(int, input().split()))
s = [list(map(int, input().split())) for _ in range(d)]
#t = [int(input()) for _ in range(d)]
ans = 0
last = [0]*26
for i in range(1,d+1):
x = 0
#x = t[i-1]-1
last[x] = i
ans += s[i-1][x]
for j in range(26):
ans -= c[j]*... | s348263467 | Accepted | 38 | 9,804 | 375 | import random
d = int(input())
c = list(map(int, input().split()))
s = [list(map(int, input().split())) for _ in range(d)]
t = [int(input()) for _ in range(d)]
ans = 0
last = [0]*26
for i in range(1,d+1):
#x = 0
x = t[i-1]-1
last[x] = i
ans += s[i-1][x]
for j in range(26):
ans -= c[j]*(... |
s035214279 | p02608 | u189806337 | 2,000 | 1,048,576 | Wrong Answer | 2,206 | 9,072 | 311 | Let f(n) be the number of triples of integers (x,y,z) that satisfy both of the following conditions: * 1 \leq x,y,z * x^2 + y^2 + z^2 + xy + yz + zx = n Given an integer N, find each of f(1),f(2),f(3),\ldots,f(N). | import math
n = int(input())
ans = [0]*n
for i in range(n):
for x in range(1,math.floor(math.sqrt(n))):
for y in range(1,math.floor(math.sqrt(n))):
for z in range(1,math.floor(math.sqrt(n))):
if pow(x,2) + pow(y,2) + pow(z,2) + x*y + y*z + z*x == i:
ans[i] += 1
for i in range(n):
print(ans[i]) | s694458351 | Accepted | 1,098 | 9,424 | 271 | n = int(input())
ans = [0]*(n+1)
for x in range(1,100):
for y in range(1,100):
for z in range(1,100):
if pow(x,2) + pow(y,2) + pow(z,2) + x*y + y*z + z*x <= n:
ans[pow(x,2) + pow(y,2) + pow(z,2) + x*y + y*z + z*x] += 1
for i in range(1,n+1):
print(ans[i]) |
s733686672 | p03352 | u325264482 | 2,000 | 1,048,576 | Wrong Answer | 40 | 3,060 | 353 | You are given a positive integer X. Find the largest _perfect power_ that is at most X. Here, a perfect power is an integer that can be represented as b^p, where b is an integer not less than 1 and p is an integer not less than 2. | X = int(input())
def is_exponential(n,j):
tmp = 1
while (tmp < j):
tmp *= n
if tmp == j:
return 1
elif tmp > j:
return 0
j = X
while (j > 0):
res = []
for i in range(2, j):
res.append(is_exponential(i,j))
if sum(res) > 0:
print(j)
... | s212213383 | Accepted | 40 | 3,060 | 376 | X = int(input())
def is_exponential(n,j):
tmp = 1
while (tmp < j):
tmp *= n
if tmp == j:
return 1
elif tmp > j:
return 0
j = X
while (j > 0):
res = []
for i in range(2, j):
res.append(is_exponential(i,j))
if sum(res) > 0:
print(j)
... |
s316979669 | p03494 | u901687869 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 213 | 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 = input()
A = input().split()
count = 0
flg = False
for i in range(int(N)):
for Number in N:
if int(Number) % 2 != 0:
flg = True
if flg == False:
count += 1
print(count) | s640674073 | Accepted | 20 | 3,060 | 315 | N = input()
A = input().split()
count = 0
flg = False
tmp = A
while flg == False:
List = []
for Number in tmp:
if int(Number) % 2 != 0:
flg = True
else:
List.append(int(Number) / 2)
if flg == False:
count += 1
tmp = List
print(count) |
s355046957 | p03992 | u071730284 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 59 | 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()
ans = s[:4] + " " + s[4:]
print(ans)
print()
| s286998326 | Accepted | 18 | 2,940 | 51 | s = input()
ans = s[:4] + " " + s[4:]
print(ans)
|
s906704077 | p03386 | u395620499 | 2,000 | 262,144 | Wrong Answer | 26 | 9,048 | 172 | 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())
for i in range(k):
if a + i > b:
break
print(a + i)
for i in range(k):
if b - i < a:
break
print(b-i)
| s501656592 | Accepted | 30 | 9,108 | 172 | a, b, k = map(int, input().split())
for i in range(k):
if a + i > b:
break
print(a + i)
start = max(a+k, b-k+1)
for i in range(start, b+1):
print(i)
|
s862867258 | p03543 | u275934251 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 78 | We call a 4-digit integer with three or more consecutive same digits, such as 1118, **good**. You are given a 4-digit integer N. Answer the question: Is N **good**? | n=list(input())
print("YES" if n[0]==n[1]==n[2] or n[1]==n[2]==n[3] else "NO") | s365663779 | Accepted | 18 | 2,940 | 99 | n=list(input())
if (n[0]==n[1]==n[2]) or (n[3]==n[1]==n[2]):
print("Yes")
else:
print("No") |
s986329317 | p02841 | u756195685 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 125 | In this problem, a date is written as Y-M-D. For example, 2019-11-30 means November 30, 2019. Integers M_1, D_1, M_2, and D_2 will be given as input. It is known that the date 2019-M_2-D_2 follows 2019-M_1-D_1. Determine whether the date 2019-M_1-D_1 is the last day of a month. | a, _ = map(int, input().split())
c, d = map(int, input().split())
if a == c and d == 1:
print("1")
else:
print("2")
| s135120433 | Accepted | 17 | 2,940 | 125 | a, _ = map(int, input().split())
c, d = map(int, input().split())
if a != c and d == 1:
print("1")
else:
print("0")
|
s751414928 | p02646 | u638353713 | 2,000 | 1,048,576 | Wrong Answer | 21 | 9,176 | 268 | 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 ... | # -*- coding: utf-8 -*-
def main():
A,V = map(int,input().split())
B,W = map(int,input().split())
T = int(input())
d1 = V*T+A
d2 = W*T+B
if (d1 == d2):
print('YES')
else:
print('NO')
if __name__ == '__main__':
main()
| s482123745 | Accepted | 23 | 9,192 | 439 | # -*- coding: utf-8 -*-
def main():
A,V = map(int,input().split())
B,W = map(int,input().split())
T = int(input())
if B>A:
d1 = V*T+A
d2 = W*T+B
if (d1 >= d2):
print('YES')
else:
print('NO')
else:
d1 = -V*T+A
d2 = -W*T+B
... |
s847805570 | p02394 | u733159526 | 1,000 | 131,072 | Wrong Answer | 10 | 7,592 | 186 | Write a program which reads a rectangle and a circle, and determines whether the circle is arranged inside the rectangle. As shown in the following figures, the upper right coordinate $(W, H)$ of the rectangle and the central coordinate $(x, y)$ and radius $r$ of the circle are given. | w,h,x,y,r = input().split()
print(w,h,x,y,r)
if int(x) - int(r) < 0 or int(x) + int(r) > int(w) or int(y) - int(r) < 0 or int(y) + int(r) < int(h):
print('No')
else:
print('Yes') | s686937907 | Accepted | 30 | 7,652 | 128 | w,h,x,y,r = map(int,input().split())
if x - r < 0 or x + r > w or y - r < 0 or y + r > h:
print('No')
else:
print('Yes') |
s257390494 | p03110 | u023795241 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 165 | 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`... | s = int(input())
m = 0
t = 0
for i in range(s):
m, n = input().split()
m = float(m)
if n == 'JPY':
t += m
else:
t += 38000*m
print(t) | s639396184 | Accepted | 18 | 2,940 | 166 | s = int(input())
m = 0
t = 0
for i in range(s):
m, n = input().split()
m = float(m)
if n == 'JPY':
t += m
else:
t += 380000*m
print(t) |
s335435753 | p03303 | u370413678 | 2,000 | 1,048,576 | Wrong Answer | 18 | 2,940 | 213 | You are given a string S consisting of lowercase English letters. We will write down this string, starting a new line after every w letters. Print the string obtained by concatenating the letters at the beginnings of these lines from top to bottom. | def output(string, digit):
_output=""
for i in range(len(string)):
if i%digit==0:
_output= _output+string[i]
else: pass
return _output
s=input()
d=int(input())
output(s, d) | s564234427 | Accepted | 17 | 2,940 | 224 | def output(string, digit):
_output=""
for i in range(len(string)):
if i%digit==0:
_output=_output+string[i]
else: pass
return _output
s=str(input())
d=int(input())
print(output(s, d)) |
s073212894 | p04011 | u821775079 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 116 | 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:
ans=N*X
else:
ans=K*X+(K-N)*Y
print(ans) | s404660425 | Accepted | 17 | 2,940 | 116 | N=int(input())
K=int(input())
X=int(input())
Y=int(input())
if N <= K:
ans=N*X
else:
ans=K*X+(N-K)*Y
print(ans) |
s519629772 | p03068 | u375282392 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 77 | You are given a string S of length N consisting of lowercase English letters, and an integer K. Print the string obtained by replacing every character in S that differs from the K-th character of S, with `*`. | n = int(input())
s = input()
k = int(input())
print(s.replace(s[k-1],'*'))
| s999189710 | Accepted | 17 | 2,940 | 138 | n = int(input())
s = list(input())
k = int(input())
for i in range(0,n):
if s[i] != s[k-1]:
s[i] = '*'
s = "".join(s)
print(s)
|
s527793786 | p04035 | u905582793 | 2,000 | 262,144 | Wrong Answer | 101 | 14,052 | 258 | We have N pieces of ropes, numbered 1 through N. The length of piece i is a_i. At first, for each i (1≤i≤N-1), piece i and piece i+1 are tied at the ends, forming one long rope with N-1 knots. Snuke will try to untie all of the knots by performing the following operation repeatedly: * Choose a (connected) rope with... | n,k = map(int,input().split())
a = list(map(int,input().split()))
for i in range(n-1):
if a[i]+a[i+1] >= k:
print("Possible")
x = i
break
else:
print("Impossible")
exit()
ans = list(range(1,n))
ans[x:] = ans[n-1:x-1:-1]
print(*ans,sep="\n") | s200739423 | Accepted | 100 | 14,060 | 323 | n,k = map(int,input().split())
a = list(map(int,input().split()))
for i in range(n-1):
if a[i]+a[i+1] >= k:
print("Possible")
x = i
break
else:
print("Impossible")
exit()
if x == 0:
print(*list(range(1,n))[::-1],sep="\n")
else:
ans = list(range(1,n))
ans[x:] = ans[n-1:x-1:-1]
print(*ans,sep="\... |
s603797066 | p03377 | u119578112 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 95 | 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. | N = list(map(int, input().split()))
if N[0]+N[1]<=N[2]:
print('Yes')
else:
print('No')
| s092776198 | Accepted | 17 | 2,940 | 147 | N = list(map(int, input().split()))
if N[0] == N[2]:
print('YES')
elif N[0]<N[2] and N[0]+N[1]>= N[2]:
print('YES')
else :
print('NO')
|
s405020825 | p03759 | u506086925 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 93 | Three poles stand evenly spaced along a line. Their heights are a, b and c meters, from left to right. We will call the arrangement of the poles _beautiful_ if the tops of the poles lie on the same line, that is, b-a = c-b. Determine whether the arrangement of the poles is beautiful. | a, b, c = map(int, input().split())
if b - a == c - b:
print("Yes")
else:
print("No") | s763212586 | Accepted | 17 | 2,940 | 93 | a, b, c = map(int, input().split())
if b - a == c - b:
print("YES")
else:
print("NO") |
s176302766 | p03731 | u113255362 | 2,000 | 262,144 | Wrong Answer | 120 | 30,752 | 193 | In a public bath, there is a shower which emits water for T seconds when the switch is pushed. If the switch is pushed when the shower is already emitting water, from that moment it will be emitting water for T seconds. Note that it does not mean that the shower emits water for T additional seconds. N people will pus... | N,T=map(int,input().split())
List = list(map(int, input().split()))
res = 0
for i in range(1,N):
sumsum = List[i]-List[i-1]
if sumsum >= T:
res += T
else:
res += sumsum
print(res) | s835040003 | Accepted | 123 | 30,812 | 202 | N,T=map(int,input().split())
List = list(map(int, input().split()))
res = 0
for i in range(1,N):
sumsum = List[i]-List[i-1]
if sumsum >= T:
res += T
else:
res += sumsum
res += T
print(res) |
s183276596 | p03658 | u223904637 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 127 | Snuke has N sticks. The length of the i-th stick is l_i. Snuke is making a snake toy by joining K of the sticks together. The length of the toy is represented by the sum of the individual sticks that compose it. Find the maximum possible length of the toy. | n,k=map(int,input().split())
l=list(map(int,input().split()))
l.sort()
ans=0
for i in range(k):
ans+=l[k-1-i]
print(ans) | s995916182 | Accepted | 17 | 2,940 | 127 | n,k=map(int,input().split())
l=list(map(int,input().split()))
l.sort()
ans=0
for i in range(k):
ans+=l[n-1-i]
print(ans) |
s146939936 | p03962 | u923712635 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 131 | AtCoDeer the deer recently bought three paint cans. The color of the one he bought two days ago is a, the color of the one he bought yesterday is b, and the color of the one he bought today is c. Here, the color of each paint can is represented by an integer between 1 and 100, inclusive. Since he is forgetful, he migh... | li = [int(x) for x in input().split()]
li.sort()
ans = 1
ans += 1 if li[1]==li[0] else 0
ans += 1 if li[2]==li[1] else 0
print(ans) | s743460377 | Accepted | 17 | 2,940 | 131 | li = [int(x) for x in input().split()]
li.sort()
ans = 1
ans += 1 if li[1]!=li[0] else 0
ans += 1 if li[2]!=li[1] else 0
print(ans) |
s627897251 | p03387 | u417835834 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 319 | 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 ... | A, B, C = map(int,input().split())
ABC = sorted([A,B,C])
counter = 0
for i in range(ABC[1],ABC[2]):
ABC[0] += 1
ABC[1] += 1
counter += 1
while(ABC[0]+2<=ABC[1]):
ABC[0] += 2
counter += 1
if ABC[0]!=ABC[1]:
ABC[1] += 1
ABC[2] += 1
counter += 1
ABC[0] += 2
counter += 1
ABC,counter | s350262941 | Accepted | 17 | 3,064 | 322 | A, B, C = map(int,input().split())
ABC = sorted([A,B,C])
counter = 0
for i in range(ABC[1],ABC[2]):
ABC[0] += 1
ABC[1] += 1
counter += 1
while(ABC[0]+2<=ABC[1]):
ABC[0] += 2
counter += 1
if ABC[0]!=ABC[1]:
ABC[1] += 1
ABC[2] += 1
counter += 1
ABC[0] += 2
counter += 1
print(counte... |
s785739624 | p03672 | u814171899 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 240 | We will call a string that can be obtained by concatenating two equal strings an _even_ string. For example, `xyzxyz` and `aaaaaa` are even, while `ababab` and `xyzxy` are not. You are given an even string S consisting of lowercase English letters. Find the length of the longest even string that can be obtained by del... | def check(s):
if len(s)%2 !=0:
return False
i=int(len(s)/2)
s1=s[:i]
s2=s[i:]
print(s1+" "+s2)
return s1==s2
s = input()
while True:
s = s[:len(s)-1]
if check(s):
print(len(s))
break
| s581023358 | Accepted | 17 | 2,940 | 219 | def check(s):
if len(s)%2 !=0:
return False
i=int(len(s)/2)
s1=s[:i]
s2=s[i:]
return s1==s2
s = input()
while True:
s = s[:len(s)-1]
if check(s):
print(len(s))
break
|
s922215408 | p00244 | u766477342 | 1,000 | 131,072 | Wrong Answer | 90 | 6,756 | 854 | 温泉好きのたけしさんは、次の長期休暇を利用してとある温泉地への旅行を計画しています。移動は長距離バスを乗り継ぎ、なるべくお金をかけずに目的地へたどり着きたいと思っています。貯金があるとはいえ、資金に心許ないたけしさんは、おじいさんに相談することにしました。計画を聞いて感心したおじいさんは、たけしさんに特別な切符を渡しました。 その切符は、長距離バスの連続した2区間を1回だけ無料で乗れるというものでした。使いようによってはかなりの移動費削減が見込めますが、より大きな効果を発揮させるためにはしっかりした計画を練る必要があります。 出発地と目的地、及び中継地点が合わせて n 個、2つの地点を結ぶ路線が m 個与えられます。各地点にはそ... | while 1:
n,m = list(map(int,input().split()))
if n == 0:break
costs = {x:[] for x in range(1,n+1)}
min_cost = [[-1 for x in range(3)] for y in range(n+1)]
for i in range(m):
a,b,c = list(map(int,input().split()))
costs[a].append((b,c))
costs[b].append((a,c))
spam = [(0,1... | s233975855 | Accepted | 920 | 6,780 | 1,088 | MAX_V = 999999999999999999999
while 1:
n,m = list(map(int,input().split()))
if n == 0:break
costs = {x:[] for x in range(1,n+1)}
passed = [[False for x in range(2)] for y in range(n+1)]
result = [MAX_V,MAX_V]
for i in range(m):
a,b,c = list(map(int,input().split()))
costs[a].appe... |
s902722361 | p02396 | u464080148 | 1,000 | 131,072 | Wrong Answer | 90 | 6,348 | 153 | In the online judge system, a judge file may include multiple datasets to check whether the submitted program outputs a correct answer for each test case. This task is to practice solving a problem with multiple datasets. Write a program which reads an integer x and print it as is. Note that multiple datasets are give... | list =[]
i=0
index=1
while(index != 0):
index=int(input())
list.append(index)
i +=1
for i in range(0,i):
print("Case",i+1,":",list[i])
| s244709280 | Accepted | 100 | 6,432 | 206 | list =[]
i=0
index=1
while(index != 0):
index=int(input())
list.append(index)
i +=1
for i in range(0,i):
if list[i] == 0:
break
print("Case",i+1,end='')
print(":",list[i])
|
s300949891 | p03546 | u096616343 | 2,000 | 262,144 | Wrong Answer | 32 | 3,064 | 574 | Joisino the magical girl has decided to turn every single digit that exists on this world into 1. Rewriting a digit i with j (0≤i,j≤9) costs c_{i,j} MP (Magic Points). She is now standing before a wall. The wall is divided into HW squares in H rows and W columns, and at least one square contains a digit between 0 and... | from heapq import heappop, heappush
H, W = map(int,input().split())
min_cost = [float("inf")] * 10
min_cost[1] = 0
costs = [list(map(int,input().split())) for _ in range(10)]
que = [(0, 1)]
while que:
cost, v = heappop(que)
if cost != min_cost[v]:
continue
for to in range(10):
if min_cost[to... | s532320255 | Accepted | 33 | 3,064 | 574 | from heapq import heappop, heappush
H, W = map(int,input().split())
min_cost = [float("inf")] * 10
min_cost[1] = 0
costs = [list(map(int,input().split())) for _ in range(10)]
que = [(0, 1)]
while que:
cost, v = heappop(que)
if cost != min_cost[v]:
continue
for to in range(10):
if min_cost[to... |
s867379587 | p03711 | u637824361 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 163 | 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. | A = [1, 3, 5, 7, 8, 10, 12]
B = [4, 6, 9, 11]
C = [2]
x, y = input().split()
L = [A, B, C]
for i in L:
if x in i and y in i:
print("Yes")
else:
print("No") | s002923780 | Accepted | 17 | 3,060 | 159 | A = set([1,3,5,7,8,10,12])
B = set([4,6,9,11])
L = set([int(i) for i in input().split()])
if len(A&L) == 2 or len(B&L) == 2:
print("Yes")
else:
print("No") |
s914128065 | p03477 | u027675217 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 127 | 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+b:
print("Left")
elif a+b<c+b:
print("Right")
else :
print("Balanced")
| s817852550 | Accepted | 17 | 2,940 | 127 | 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")
|
s260490742 | p03352 | u940102677 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 115 | You are given a positive integer X. Find the largest _perfect power_ that is at most X. Here, a perfect power is an integer that can be represented as b^p, where b is an integer not less than 1 and p is an integer not less than 2. | x = int(input())
m = 1
b = 2
while b*b <= x:
p = 2
while b**p <= x:
m = max(m, b**p)
p += 1
b += 1
| s499883605 | Accepted | 17 | 2,940 | 124 | x = int(input())
m = 1
b = 2
while b*b <= x:
p = 2
while b**p <= x:
m = max(m, b**p)
p += 1
b += 1
print(m)
|
s751889113 | p03605 | u601082779 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 32 | 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? | print("YNeos"['9'in input()::2]) | s550249724 | Accepted | 17 | 2,940 | 34 | print(['No','Yes']['9'in input()]) |
s793075045 | p02277 | u153665391 | 1,000 | 131,072 | Wrong Answer | 40 | 6,336 | 1,018 | Let's arrange a deck of cards. Your task is to sort totally n cards. A card consists of a part of a suit (S, H, C or D) and an number. Write a program which sorts such cards based on the following pseudocode: Partition(A, p, r) 1 x = A[r] 2 i = p-1 3 for j = p to r-1 4 do if A[j] <= x 5 then ... | import copy
def partition(p, r):
i = p
for j in range(p, r):
if A[r][1] >= A[j][1]:
A[i], A[j] = A[j], A[i]
i += 1
A[r], A[i] = A[i], A[r]
return i
def quick_sort(p, r):
if p < r:
q = partition(p, r)
quick_sort(p, q-1)
quick_sort(q+1, r)
def... | s870931850 | Accepted | 1,780 | 19,152 | 1,252 | def partition(p, r):
i = p
for j in range(p, r):
if A[r][1] >= A[j][1]:
A[i], A[j] = A[j], A[i]
i += 1
A[r], A[i] = A[i], A[r]
return i
def quick_sort(p, r):
if p < r:
q = partition(p, r)
quick_sort(p, q-1)
quick_sort(q+1, r)
def merge(left, ... |
s526245816 | p02613 | u363080243 | 2,000 | 1,048,576 | Wrong Answer | 23 | 9,208 | 288 | Takahashi is participating in a programming contest called AXC002, and he has just submitted his code to Problem A. The problem has N test cases. For each test case i (1\leq i \leq N), you are given a string S_i representing the verdict for that test case. Find the numbers of test cases for which the verdict is `AC`,... | N = int(input())
n = list(map(str, input().split()))
a= 0
b=0
c=0
d=0
for i in n:
if i == "AC":
a = a+1
elif i=="WA":
b = b+1
elif i=="TLE":
c = c+1
elif i== "RE":
d = d+1
print("AC x", a)
print("WA x", b)
print("TLE x", c)
print("RE x", d) | s917268109 | Accepted | 152 | 16,160 | 288 | N = int(input())
n = list(input() for i in range(N))
a= 0
b=0
c=0
d=0
for i in n:
if i == "AC":
a = a+1
elif i=="WA":
b = b+1
elif i=="TLE":
c = c+1
elif i== "RE":
d = d+1
print("AC x", a)
print("WA x", b)
print("TLE x", c)
print("RE x", d) |
s284432977 | p03997 | u823044869 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 82 | 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())
area = (a+b)*h/2
print(area)
| s156301331 | Accepted | 17 | 2,940 | 100 | a = int(input())
b = int(input())
h = int(input())
area = (a+b)*h/2
print('{:.0f}'.format(area))
|
s126630800 | p02393 | u911624488 | 1,000 | 131,072 | Wrong Answer | 20 | 7,568 | 65 | Write a program which reads three integers, and prints them in ascending order. | nums = [int(i) for i in input().split()]
nums_sort = sorted(nums) | s108101084 | Accepted | 20 | 7,636 | 123 | nums = [int(i) for i in input().split()]
nums_sort = sorted(nums)
nums_str = map(str, nums_sort)
print (' '.join(nums_str)) |
s130542042 | p02390 | u627002197 | 1,000 | 131,072 | Wrong Answer | 30 | 7,616 | 165 | 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. | input_data = int(input())
hour=input_data/3600
input_data%=3600
min = input_data/60
input_data%=60
answer = str(hour)+":"+str(min)+":"+str(input_data)
print(answer) | s972734060 | Accepted | 30 | 7,672 | 205 | input_data = int(input())
hour=int(input_data/3600)
input_data=int(input_data%3600)
min = int(input_data/60)
input_data=int(input_data%60)
answer = str(hour)+":"+str(min)+":"+str(input_data)
print(answer) |
s603567726 | p03434 | u714533789 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 133 | We have N cards. A number a_i is written on the i-th card. Alice and Bob will play a game using these cards. In this game, Alice and Bob alternately take one card. Alice goes first. The game ends when all the cards are taken by the two players, and the score of each player is the sum of the numbers written on the c... | n = int(input())
A = sorted(list(map(int, input().split())), reverse=True)
alice = sum(A[::2])
bob = sum(A[:1:2])
print(alice - bob)
| s148177300 | Accepted | 18 | 2,940 | 133 | n = int(input())
A = sorted(list(map(int, input().split())), reverse=True)
alice = sum(A[::2])
bob = sum(A[1::2])
print(alice - bob)
|
s893361377 | p02255 | u308033440 | 1,000 | 131,072 | Wrong Answer | 20 | 5,544 | 235 | 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 ... | def insertionSort(A,N):
for i in range(N):
v = A [i]
j = i-1
while j>=0 and A[j] > v:
A[j+1] = A[j]
j = j -1
A[j+1] = v
print(A)
A = [5,2,4,6,1,3]
insertionSort(A,6)
| s626291629 | Accepted | 20 | 5,604 | 302 | def insertionSort(A,N):
for i in range(N):
v = A [i]
j = i-1
while j>=0 and A[j] > v:
A[j+1] = A[j]
j = j -1
A[j+1] = v
print(' '.join(map(str, A)))
N = input()
N = int(N)
A = input()
A = list(map(int, A.split()))
insertionSort(A,N)
|
s610389327 | p02646 | u688281605 | 2,000 | 1,048,576 | Wrong Answer | 24 | 9,200 | 296 | 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 = ''
if(a < b):
pa = a + v * t
pb = b + w * t
if(pb <= pa):
ans = 'Yes'
else:
ans = 'No'
else:
pa = a - v * t
pb = b - w * t
if(pa <= pb):
ans = 'Yes'
else:
ans = 'No'
print(ans)
| s882385359 | Accepted | 20 | 9,192 | 296 | a,v = map(int,input().split())
b,w = map(int,input().split())
t = int(input())
ans = ''
if(a < b):
pa = a + v * t
pb = b + w * t
if(pb <= pa):
ans = 'YES'
else:
ans = 'NO'
else:
pa = a - v * t
pb = b - w * t
if(pa <= pb):
ans = 'YES'
else:
ans = 'NO'
print(ans)
|
s009541891 | p03139 | u357335656 | 2,000 | 1,048,576 | Wrong Answer | 18 | 2,940 | 137 | 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 , x , y = map(int , input().split())
min = n - x - y
if x > y : print (str(x) + " " + str(min))
else : print(str(y) + " " + str(min)) | s436260516 | Accepted | 17 | 2,940 | 158 | n , x , y = map(int , input().split())
min = x + y - n
if min < 0 : min = 0
if x < y : print (str(x) + " " + str(min))
else : print(str(y) + " " + str(min)) |
s183412398 | p02850 | u024782094 | 2,000 | 1,048,576 | Wrong Answer | 793 | 59,812 | 873 | Given is a tree G with N vertices. The vertices are numbered 1 through N, and the i-th edge connects Vertex a_i and Vertex b_i. Consider painting the edges in G with some number of colors. We want to paint them so that, for each vertex, the colors of the edges incident to that vertex are all different. Among the colo... | import sys
import heapq
import math
import fractions
import bisect
import itertools
from collections import Counter
from collections import deque
from operator import itemgetter
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))
... | s176098368 | Accepted | 670 | 51,208 | 868 | import sys
import heapq
import math
import fractions
import bisect
import itertools
from collections import Counter
from collections import deque
from operator import itemgetter
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))
... |
s069649571 | p04043 | u790653524 | 2,000 | 262,144 | Wrong Answer | 29 | 9,016 | 98 | 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())
d = a + b + c
if d == 17:
print('yes')
else:
print('no') | s062467243 | Accepted | 26 | 9,124 | 98 | a, b, c = map(int, input().split())
d = a + b + c
if d == 17:
print('YES')
else:
print('NO') |
s570400684 | p03861 | u588568850 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 81 | You are given nonnegative integers a and b (a ≤ b), and a positive integer x. Among the integers between a and b, inclusive, how many are divisible by x? | a, b, x = map(int, input().split())
if a == 0:
b += x
print(b // x - a // x)
| s805863314 | Accepted | 17 | 3,064 | 113 | a, b, x = map(int, input().split())
if a == 0:
print(b // x + 1)
else:
a -= 1
print(b // x - a // x)
|
s617584341 | p03836 | u865979946 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 156 | Dolphin resides in two-dimensional Cartesian plane, with the positive x-axis pointing right and the positive y-axis pointing up. Currently, he is located at the point (sx,sy). In each second, he can move up, down, left or right by a distance of 1. Here, both the x\- and y-coordinates before and after each movement ... | sx,sy,tx,ty=map(int,input().split())
print('R'*(tx-sx)+'D'*(ty-sy)+'L'*(tx-sx)+'U'*(ty-sy)+'LD'+'D'*(ty-sy)+'R'*(tx-sx)+'RURU'+'U'*(ty-sy)+'L'*(tx-sx)+'LD') | s496347107 | Accepted | 17 | 3,060 | 156 | sx,sy,tx,ty=map(int,input().split())
print('U'*(ty-sy)+'R'*(tx-sx)+'D'*(ty-sy)+'L'*(tx-sx)+'LU'+'U'*(ty-sy)+'R'*(tx-sx)+'RDRD'+'D'*(ty-sy)+'L'*(tx-sx)+'LU') |
s060231743 | p03693 | u788856752 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 110 | 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 + b * 10 + b % 4 == 0:
print("YES")
else:
print("NO")
| s126890976 | Accepted | 18 | 2,940 | 112 | r, g, b = map(int, input().split())
if (r * 100 + g * 10 + b) % 4 == 0:
print("YES")
else:
print("NO")
|
s488981325 | p03623 | u703890795 | 2,000 | 262,144 | Wrong Answer | 22 | 3,316 | 101 | 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())
A = abs(x-a)
B = abs(x-b)
if A>B:
print("A")
else:
print("B") | s486345724 | Accepted | 17 | 2,940 | 101 | x, a, b = map(int, input().split())
A = abs(x-a)
B = abs(x-b)
if A>B:
print("B")
else:
print("A") |
s774895468 | p02612 | u977422582 | 2,000 | 1,048,576 | Wrong Answer | 32 | 9,144 | 36 | 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) | s431559703 | Accepted | 35 | 9,144 | 74 | N=int(input())
if N%1000==0:
print(0)
else:
print(1000*(N//1000+1)-N)
|
s056729616 | p02393 | u427088273 | 1,000 | 131,072 | Wrong Answer | 20 | 7,564 | 349 | Write a program which reads three integers, and prints them in ascending order. | num = list(map(int,input().split()))
count = 0
while count < 2:
for i in range(2):
j = 0
if num[i] > num[i+1]:
j = num[i]
num[i] = num[i+1]
num[i+1] = j
else:
continue
... | s237716551 | Accepted | 20 | 7,648 | 405 | num = list(map(int,input().split()))
count = 0
while count < 2:
for i in range(2):
j = 0
if num[i] > num[i+1]:
j = num[i]
num[i] = num[i+1]
num[i+1] = j
else:
continue
... |
s814195099 | p02613 | u698868214 | 2,000 | 1,048,576 | Wrong Answer | 141 | 16,288 | 144 | Takahashi is participating in a programming contest called AXC002, and he has just submitted his code to Problem A. The problem has N test cases. For each test case i (1\leq i \leq N), you are given a string S_i representing the verdict for that test case. Find the numbers of test cases for which the verdict is `AC`,... | N = int(input())
S = [input() for _ in range(N)]
ls = ["AC","WA","TLE","RE"]
for i in range(4):
print("{} × {}".format(ls[i],S.count(ls[i]))) | s987498704 | Accepted | 138 | 16,220 | 143 | N = int(input())
S = [input() for _ in range(N)]
ls = ["AC","WA","TLE","RE"]
for i in range(4):
print("{} x {}".format(ls[i],S.count(ls[i]))) |
s063983504 | p03680 | u496744988 | 2,000 | 262,144 | Wrong Answer | 224 | 8,748 | 308 | Takahashi wants to gain muscle, and decides to work out at AtCoder Gym. The exercise machine at the gym has N buttons, and exactly one of the buttons is lighten up. These buttons are numbered 1 through N. When Button i is lighten up and you press it, the light is turned off, and then Button a_i will be lighten up. It ... | import sys
n = int(input())
a = [int(input()) for _ in range(n)]
check = [0] * n
print(check)
count = 0
button = a[0]
while(True):
count += 1
if button == 2:
break
if check[button-1] == 1:
print(-1)
sys.exit()
check[button-1] = 1
button = a[button-1]
print(count)
| s947587320 | Accepted | 212 | 7,852 | 295 | import sys
n = int(input())
a = [int(input()) for _ in range(n)]
check = [0] * n
count = 0
button = a[0]
while(True):
count += 1
if button == 2:
break
if check[button-1] == 1:
print(-1)
sys.exit()
check[button-1] = 1
button = a[button-1]
print(count)
|
s160855441 | p03592 | u841222846 | 2,000 | 262,144 | Wrong Answer | 1,676 | 19,408 | 288 | We have a grid with N rows and M columns of squares. Initially, all the squares are white. There is a button attached to each row and each column. When a button attached to a row is pressed, the colors of all the squares in that row are inverted; that is, white squares become black and vice versa. When a button attach... | import numpy as np
n, m, k = map(int, input().split(" "))
flag = 0
for i in range(n + 1):
for j in range(m + 1):
print(i * n - i * j + j * m - i * j)
if(i * n - i * j + j * m - i * j == k):
flag = 1
if(flag == 1):
print("Yes")
else:
print("No") | s815901236 | Accepted | 1,933 | 16,780 | 321 | import numpy as np
n, m, k = map(int, input().split(" "))
flag = 0
for i in range(n + 1):
for j in range(m + 1):
if(i * m - i * j + j * n - i * j == k):
flag = 1
if(n * m - (i * m - i * j + j * n - i * j) == k):
flag = 1
if(flag == 1):
print("Yes")
else:
print("No"... |
s789280308 | p03456 | u074220993 | 2,000 | 262,144 | Wrong Answer | 258 | 29,972 | 111 | AtCoDeer the deer has found two positive integers, a and b. Determine whether the concatenation of a and b in this order is a square number. | a, b = map(int, input().split())
import numpy as np
n = np.sqrt(10*a + b)
print('Yes' if n == int(n) else 'No') | s085117699 | Accepted | 29 | 8,988 | 108 | from math import sqrt
a, b = input().split()
n = int(a+b)
print('Yes' if sqrt(n) == int(sqrt(n)) else 'No')
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.