source stringclasses 4
values | task_type stringclasses 1
value | in_source_id stringlengths 0 138 | problem stringlengths 219 13.2k | gold_standard_solution stringlengths 0 413k | problem_id stringlengths 5 10 | metadata dict | verification_info dict |
|---|---|---|---|---|---|---|---|
codeforces | verifiable_code | 656 | Solve the following coding problem using the programming language python:
The input will be provided via standard input and looks as follows:
The input contains a single integer *a* (0<=≤<=*a*<=≤<=1<=000<=000).
You should write the solution as standard output as follows:
Output a single integer.
Here are example i... | n = int(input())
c = 0
while n:
c += n%8 == 1
n//=8
print(c) | vfc_82493 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "2000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "129",
"output": "1",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "0",
"output": "0",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "4",
"output... |
codeforces | verifiable_code | 291 | Solve the following coding problem using the programming language python:
Polycarpus is the director of a large corporation. There are *n* secretaries working for the corporation, each of them corresponds via the famous Spyke VoIP system during the day. We know that when two people call each other via Spyke, the Spyke... | def cocktail_sort(a):
n = len(a)
swapped = True
start = 0
end = n-1
while (swapped == True):
# reset the swapped flag on entering the loop,
# because it might be true from a previous
# iteration.
swapped = False
# loop from left to right same a... | vfc_82497 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "2000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "6\n0 1 7 1 7 10",
"output": "2",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "3\n1 1 1",
"output": "-1",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input"... |
codeforces | verifiable_code | 370 | Solve the following coding problem using the programming language python:
Little Petya is learning to play chess. He has already learned how to move a king, a rook and a bishop. Let us remind you the rules of moving chess pieces. A chessboard is 64 square fields organized into an 8<=×<=8 table. A field is represented ... | def stessocolore(x1,y1,x2,y2):
if (x1+y1)%2 == (x2+y2)%2:
return True
else:
return False
x1, y1, x2, y2 = map(int, input().split())
if x1 == x2 or y1 == y2:
rook = 1
else:
rook = 2
king = max([abs(x1-x2),abs(y1-y2)])
if stessocolore(x1,y1,x2,y2):
if (x1-y1) == (x2-y2) or ... | vfc_82501 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "1000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "4 3 1 6",
"output": "2 1 3",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "5 5 5 6",
"output": "1 0 1",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": ... |
codeforces | verifiable_code | 69 | Solve the following coding problem using the programming language python:
A guy named Vasya attends the final grade of a high school. One day Vasya decided to watch a match of his favorite hockey team. And, as the boy loves hockey very much, even more than physics, he forgot to do the homework. Specifically, he forgot... | n=int(input())
a_1=[]
b_1=[]
c_1=[]
for i in range(n):
a,b,c=map(int,input().split())
a_1.append(a)
b_1.append(b)
c_1.append(c)
if sum(a_1)==0 and sum(b_1)==0 and sum(c_1)==0:
print("YES")
else:
print("NO")
| vfc_82505 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "1000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "3\n4 1 7\n-2 4 -1\n1 -5 -3",
"output": "NO",
"type": "stdin_stdout"
}
]
} |
codeforces | verifiable_code | 797 | Solve the following coding problem using the programming language python:
Given a positive integer *n*, find *k* integers (not necessary distinct) such that all these integers are strictly greater than 1, and their product is equal to *n*.
The input will be provided via standard input and looks as follows:
The first ... | from math import sqrt
def eratosfen(x):
arr = [True] * (x + 1)
result = []
for i in range(2, x + 1):
if arr[i]:
result.append(i)
for j in range(2 * i, x + 1, i):
arr[j] = False
return result
n, k = map(int, input().split())
simples = erato... | vfc_82509 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "2000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "100000 2",
"output": "2 50000 ",
"type": "stdin_stdout"
}
]
} |
codeforces | verifiable_code | 600 | Solve the following coding problem using the programming language python:
You are given two arrays of integers *a* and *b*. For each element of the second array *b**j* you should find the number of elements in array *a* that are less than or equal to the value *b**j*.
The input will be provided via standard input and... | n, m = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
A.sort()
result = []
def bb(A, num):
ini = 0
final = len(A) - 1
while ini <= final:
mid = (ini + final) // 2
if A[mid] <= num:
ini = mid + 1
else:
... | vfc_82513 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "2000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "5 4\n1 3 5 7 9\n6 4 2 8",
"output": "3 2 1 4",
"type": "stdin_stdout"
}
]
} |
codeforces | verifiable_code | 451 | Solve the following coding problem using the programming language python:
After winning gold and silver in IOI 2014, Akshat and Malvika want to have some fun. Now they are playing a game on a grid made of *n* horizontal and *m* vertical sticks.
An intersection point is any point on the grid which is formed by the int... | line = list(map(int, input().strip().split()))
if(min(line)%2 == 0):
print("Malvika")
else:
print("Akshat") | vfc_82517 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "1000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "2 2",
"output": "Malvika",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "2 3",
"output": "Malvika",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "3 3... |
codeforces | verifiable_code | 120 | Solve the following coding problem using the programming language python:
As we all know, Winnie-the-Pooh just adores honey. Ones he and the Piglet found out that the Rabbit has recently gotten hold of an impressive amount of this sweet and healthy snack. As you may guess, Winnie and the Piglet asked to come at the Ra... | f=open('input.txt','r')
g=open('output.txt','w')
n,k=map(int,f.readline().split())
a=list(map(int,f.readline().split()))
s,res=sum(a),0
for val in a:
res+=int(k*min(3,val//k))
print(s-res,file=g)
| vfc_82521 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "1000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "3 3\n15 8 10",
"output": "9",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "1 3\n3",
"output": "0",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "3 4... |
codeforces | verifiable_code | 567 | Solve the following coding problem using the programming language python:
All cities of Lineland are located on the *Ox* coordinate axis. Thus, each city is associated with its position *x**i* — a coordinate on the *Ox* axis. No two cities are located at a single point.
Lineland residents love to send letters to each... | n=int(input())
a=list(map(int, input().split()))
for i in range(n):
if i==0:
print(abs(a[i+1]-a[i]),end=" ")
elif i==n-1:
print(abs(a[n-1]-a[n-2]),end=" ")
else:
print(min(abs(a[i]-a[i-1]),abs(a[i+1]-a[i])),end=" ")
print(max(abs(a[i]-a[0]),abs(a[n-1]-a[i]))) | vfc_82525 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "3000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "4\n-5 -2 2 7",
"output": "3 12\n3 9\n4 7\n5 12",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "2\n-1 1",
"output": "2 2\n2 2",
"type": "stdin_stdout"
},
{
"fn_name"... |
codeforces | verifiable_code | 159 | Solve the following coding problem using the programming language python:
One popular website developed an unusual username editing procedure. One can change the username only by deleting some characters from it: to change the current name *s*, a user can pick number *p* and character *c* and delete the *p*-th occurre... | from collections import defaultdict
k = int(input())
s = input()
d = defaultdict(list)
word = list(s*k)
for i in range(len(word)):
d[word[i]].append(i)
n = int(input())
for _ in range(n):
a,b = input().split()
a = int(a)
change = d[b].pop(a-1)
word[change] = ''
print(''.join(word)) | vfc_82533 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "3000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "2\nbac\n3\n2 a\n1 b\n2 c",
"output": "acb",
"type": "stdin_stdout"
}
]
} |
codeforces | verifiable_code | 298 | Solve the following coding problem using the programming language python:
There is a straight snowy road, divided into *n* blocks. The blocks are numbered from 1 to *n* from left to right. If one moves from the *i*-th block to the (*i*<=+<=1)-th block, he will leave a right footprint on the *i*-th block. Similarly, if... | input(); a = input()
l=a.count('L')
r=a.count('R')
if (r==0):
print(a.rindex('L')+1,a.index('L'))
elif (l==0):
print( a.index('R')+1,a.rindex('R')+2,)
else :
print(a.index('R')+1,a.index('L')) | vfc_82537 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "1000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "11\n.RRRLLLLL..",
"output": "7 5",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "4\n.RL.",
"output": "3 2",
"type": "stdin_stdout"
},
{
"fn_name": null,
"inpu... |
codeforces | verifiable_code | 11 | Solve the following coding problem using the programming language python:
A sequence *a*0,<=*a*1,<=...,<=*a**t*<=-<=1 is called increasing if *a**i*<=-<=1<=<<=*a**i* for each *i*:<=0<=<<=*i*<=<<=*t*.
You are given a sequence *b*0,<=*b*1,<=...,<=*b**n*<=-<=1 and a positive integer *d*. In each move you may ch... | n, d = map(int, input().split())
p, v = 0, 0
for b in map(int, input().split()):
if b <= p:
c = (p + d - b) // d
v += c
b += c * d
p = b
print(v) | vfc_82541 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "1000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "4 2\n1 3 3 2",
"output": "3",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "2 1\n1 1",
"output": "1",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "2... |
codeforces | verifiable_code | 873 | Solve the following coding problem using the programming language python:
Merge sort is a well-known sorting algorithm. The main function that sorts the elements of array *a* with indices from [*l*,<=*r*) can be implemented as follows:
1. If the segment [*l*,<=*r*) is already sorted in non-descending order (that is,... | n, m = list(map(int, input().split()))
solucao = []
def merge(inicio, fim, rem):
if rem < 2:
solucao.extend(range(inicio, fim))
return rem
if fim - inicio == 1:
solucao.append(inicio)
return rem
rem -= 2
mid = (inicio + fim + 1)//2
rem = merge(mid, fim, rem)
rem = merge(inicio, mid, rem)
return rem
... | vfc_82545 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "1000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "3 3",
"output": "2 1 3 ",
"type": "stdin_stdout"
}
]
} |
codeforces | verifiable_code | 624 | Solve the following coding problem using the programming language python:
You are given an alphabet consisting of *n* letters, your task is to make a string of the maximum possible length so that the following conditions are satisfied:
- the *i*-th letter occurs in the string no more than *a**i* times; - the numbe... | #!/usr/bin/env python3
if __name__ == '__main__':
N = int(input())
a = list(map(int, input().split()))
res = 0
used = set()
for c in sorted(a, reverse=True):
while c and c in used:
c -= 1
if c:
used.add(c)
res += c
print(res)
| vfc_82549 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "1000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "3\n2 5 5",
"output": "11",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "3\n1 1 2",
"output": "3",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "2\n1... |
codeforces | verifiable_code | 110 | Solve the following coding problem using the programming language python:
Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all nu... | x = str(input())
def isnearlucky(x):
count = 0
for char in x:
if char == "4" or char == "7":
count += 1
continue
count = str(count)
count = count.replace("4","")
count = count.replace("7","")
if len(count) == 0:
print("YES")
else:
... | vfc_82553 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "2000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "40047",
"output": "NO",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "7747774",
"output": "YES",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "100000... |
codeforces | verifiable_code | 139 | Solve the following coding problem using the programming language python:
One Sunday Petr went to a bookshop and bought a new book on sports programming. The book had exactly *n* pages.
Petr decided to start reading it starting from the next day, that is, from Monday. Petr's got a very tight schedule and for each day... | pages = int(input())
days = list(map(int, input().split()))
current = -1
while pages > 0:
current += 1
if current == 7:
current = 0
pages -= days[current]
print(current + 1)
| vfc_82557 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "2000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "100\n15 20 20 15 10 30 45",
"output": "6",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "2\n1 0 0 0 0 0 0",
"output": "1",
"type": "stdin_stdout"
},
{
"fn_name": nu... |
codeforces | verifiable_code | 709 | Solve the following coding problem using the programming language python:
Kolya is going to make fresh orange juice. He has *n* oranges of sizes *a*1,<=*a*2,<=...,<=*a**n*. Kolya will put them in the juicer in the fixed order, starting with orange of size *a*1, then orange of size *a*2 and so on. To be put in the juic... | cont = 0
c = 0
n,b,d = [int(i) for i in input().split()]
lis = [int(i) for i in input().split()]
for x in range(len(lis)):
if lis[x] <= b:
cont += lis[x]
if cont > d:
cont = 0
c+=1
print(c) | vfc_82561 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "1000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "2 7 10\n5 6",
"output": "1",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "1 5 10\n7",
"output": "0",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "3... |
codeforces | verifiable_code | 258 | Solve the following coding problem using the programming language python:
The Little Elephant has an integer *a*, written in the binary notation. He wants to write this number on a piece of paper.
To make sure that the number *a* fits on the piece of paper, the Little Elephant ought to delete exactly one any digit fr... | s=str(int(input()))
flag=False
for i in range(0,len(s)):
if(s[i]=='0' and flag==False):
flag=True
elif(flag==False and i==len(s)-1):
flag=True
else:
print(s[i],end='')
| vfc_82565 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "2000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "101",
"output": "11",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "110010",
"output": "11010",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "10000",... |
codeforces | verifiable_code | 546 | Solve the following coding problem using the programming language python:
A soldier wants to buy *w* bananas in the shop. He has to pay *k* dollars for the first banana, 2*k* dollars for the second one and so on (in other words, he has to pay *i*·*k* dollars for the *i*-th banana).
He has *n* dollars. How many dolla... | k,n,w=map(int,input().split())
total = k*(w*(w+1) // 2)
borrow=max(0,total - n)
print(borrow) | vfc_82569 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "3000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "3 17 4",
"output": "13",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "1 2 1",
"output": "0",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "1 1 1",
... |
codeforces | verifiable_code | 493 | Solve the following coding problem using the programming language python:
Vasya decided to learn to play chess. Classic chess doesn't seem interesting to him, so he plays his own sort of chess.
The queen is the piece that captures all squares on its vertical, horizontal and diagonal lines. If the cell is located on t... | from sys import stdin
# main starts
n = int(stdin.readline().strip())
if n% 2 == 0:
print("white")
print(1, 2)
else:
print("black") | vfc_82573 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "2000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "2",
"output": "white\n1 2",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "3",
"output": "black",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "4",
... |
codeforces | verifiable_code | 455 | Solve the following coding problem using the programming language python:
Alex doesn't like boredom. That's why whenever he gets bored, he comes up with games. One long winter evening he came up with a game and decided to play it.
Given a sequence *a* consisting of *n* integers. The player can make several steps. In ... | n = int(input())
read = list(map(int, input().split()))
read.sort()
count = {}
exist = set()
points = [[0] * 100001 for i in range(0, 2)]
for i in range(0, n):
if not read[i] in count:
count[read[i]] = 1
exist.add(read[i])
else:
count[read[i]] += 1
for i in range(0, read[n-1]... | vfc_82577 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "1000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "2\n1 2",
"output": "2",
"type": "stdin_stdout"
}
]
} |
codeforces | verifiable_code | 66 | Solve the following coding problem using the programming language python:
Little Petya often travels to his grandmother in the countryside. The grandmother has a large garden, which can be represented as a rectangle 1<=×<=*n* in size, when viewed from above. This rectangle is divided into *n* equal square sections. Th... | n = int(input())
heights = [int(x) for x in input().split()]
leftCounter = [0] * n
rightCounter = [0] * n
for i in range(1,n):
if heights[i-1] <= heights[i]:
leftCounter[i] = leftCounter[i-1] + 1
if heights[n-i-1] >= heights[n-i]:
rightCounter[n-i-1] = rightCounter[n-i] + 1
maxSections ... | vfc_82581 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "2000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "1\n2",
"output": "1",
"type": "stdin_stdout"
}
]
} |
codeforces | verifiable_code | 7 | Solve the following coding problem using the programming language python:
A famous Berland's painter Kalevitch likes to shock the public. One of his last obsessions is chess. For more than a thousand years people have been playing this old game on uninteresting, monotonous boards. Kalevitch decided to put an end to th... | d=0
c=0
for i in range (0,8):
a=input()
if a!='BBBBBBBB' and d==0:
d=1
for j in range (0,8):
if a[j]=='B':
c+=1
if a=='BBBBBBBB':
c+=1
print(c)
| vfc_82585 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "1000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "WWWBWWBW\nBBBBBBBB\nWWWBWWBW\nWWWBWWBW\nWWWBWWBW\nWWWBWWBW\nWWWBWWBW\nWWWBWWBW",
"output": "3",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "WWWWWWWW\nBBBBBBBB\nWWWWWWWW\nWWWWWWWW\nWWWWWWWW... |
codeforces | verifiable_code | 747 | Solve the following coding problem using the programming language python:
A big company decided to launch a new series of rectangular displays, and decided that the display must have exactly *n* pixels.
Your task is to determine the size of the rectangular display — the number of lines (rows) of pixels *a* and the n... | a = int(input())
b = int(a**0.5)
while a%b:
b -= 1
print(b, a//b) | vfc_82589 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "2000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "8",
"output": "2 4",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "64",
"output": "8 8",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "5",
"out... |
codeforces | verifiable_code | 260 | Solve the following coding problem using the programming language python:
Vasya has got two number: *a* and *b*. However, Vasya finds number *a* too short. So he decided to repeat the operation of lengthening number *a* *n* times.
One operation of lengthening a number means adding exactly one digit to the number (in ... | a,b,n = map(int,input().split())
check = 1
if a%b==0:
print(a*(10**n))
else:
check = 0
for y in range(10):
if (a*10+y)%b==0:
a = a*10+y
check = 1
break
else:
pass
if check==0:
print(-1)
else:
print(a*(10*... | vfc_82593 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "2000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "5 4 5",
"output": "524848",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "12 11 1",
"output": "121",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "26... |
codeforces | verifiable_code | 37 | Solve the following coding problem using the programming language python:
Little Vasya has received a young builder’s kit. The kit consists of several wooden bars, the lengths of all of them are known. The bars can be put one on the top of the other if their lengths are the same.
Vasya wants to construct the minimal ... | n=int(input())
x=list(map(int, input().split()))
y=set(x)
maxx=[]
for i in y:
maxx.append(x.count(i))
print(max(maxx), len(y)) | vfc_82597 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "2000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "3\n1 2 3",
"output": "1 3",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "4\n6 5 6 7",
"output": "2 3",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": ... |
codeforces | verifiable_code | 628 | Solve the following coding problem using the programming language python:
Limak is a little polar bear. He likes nice strings — strings of length *n*, consisting of lowercase English letters only.
The distance between two letters is defined as the difference between their positions in the alphabet. For example, , and... | n, k = map(int, input().split())
s = input()
ans = ''
for j in range(n):
a = ord(s[j]) - 97
z = 25 - a
if a > z:
v = min(a, k)
ans += chr(ord(s[j]) - v)
k -= v
else:
v = min(z, k)
ans += chr(ord(s[j]) + v)
k -= v
print(ans if k == 0 else -1) | vfc_82601 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "2000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "4 26\nbear",
"output": "zcar",
"type": "stdin_stdout"
}
]
} |
codeforces | verifiable_code | 299 | Solve the following coding problem using the programming language python:
Ksusha the Squirrel is standing at the beginning of a straight road, divided into *n* sectors. The sectors are numbered 1 to *n*, from left to right. Initially, Ksusha stands in sector 1.
Ksusha wants to walk to the end of the road, that is, g... | n,k = map(int, input().split())
print("YES" if max([len(s) for s in input().split('.')])<k else "NO") | vfc_82605 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "2000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "2 1\n..",
"output": "YES",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "5 2\n.#.#.",
"output": "YES",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "... |
codeforces | verifiable_code | 41 | Solve the following coding problem using the programming language python:
The translation from the Berland language into the Birland language is not an easy task. Those languages are very similar: a berlandish word differs from a birlandish word with the same meaning a little: it is spelled (and pronounced) reversely.... | s=input()
g=input()
r=s[::-1]
if(g==r):
print('YES')
else:
print('NO')
| vfc_82609 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "2000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "code\nedoc",
"output": "YES",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "abb\naba",
"output": "NO",
"type": "stdin_stdout"
}
]
} |
codeforces | verifiable_code | 303 | Solve the following coding problem using the programming language python:
Bike is interested in permutations. A permutation of length *n* is an integer sequence such that each integer from 0 to (*n*<=-<=1) appears exactly once in it. For example, [0,<=2,<=1] is a permutation of length 3 while both [0,<=2,<=2] and [1,<... |
n=int(input())
if n%2:
a=[i for i in range(n)]
b=[i for i in range(n)]
c=[(a[i]+b[i])%n for i in range(n)]
print(*a)
print(*b)
print(*c)
else:
print(-1) | vfc_82613 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "2000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "5",
"output": "1 4 3 2 0\n1 0 2 4 3\n2 4 0 1 3",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "2",
"output": "-1",
"type": "stdin_stdout"
},
{
"fn_name": null,
... |
codeforces | verifiable_code | 47 | Solve the following coding problem using the programming language python:
One day Vasya came across three Berland coins. They didn't have any numbers that's why Vasya didn't understand how their denominations differ. He supposed that if one coin is heavier than the other one, then it should be worth more. Vasya weighe... | a = b = c = 0
for i in range(3):
s = input()
if s[0] == "A" and s[1] == ">":
a += 1
elif s[0] == "A" and s[1] == "<" and s[2] == "B":
b += 1
elif s[0] == "A" and s[1] == "<" and s[2] == "C":
c += 1
elif s[0] == "B" and s[1] == ">":
b += 1
elif s[0] == "B" and s[1] == "<" and s[2] == "A":
a... | vfc_82617 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "5000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "A>B\nC<B\nA>C",
"output": "CBA",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "A<B\nB>C\nC>A",
"output": "ACB",
"type": "stdin_stdout"
},
{
"fn_name": null,
"... |
codeforces | verifiable_code | 12 | Solve the following coding problem using the programming language python:
The spring is coming and it means that a lot of fruits appear on the counters. One sunny day little boy Valera decided to go shopping. He made a list of *m* fruits he wanted to buy. If Valera want to buy more than one fruit of some kind, he incl... | enter1 = list(map(int, input().split()))
n = enter1[0]
m = enter1[1]
li = list(map(int, input().split()))
fruits = list()
for i in range(m):
fruits.append(input())
se = set(fruits)
kol_vo = []
li_se = list(se)
for i in range(len(li_se)):
kol_vo.append(fruits.count(li_se[i]))
kol_vo.sort()
kol_vo.reverse()
l... | vfc_82621 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "2000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "5 3\n4 2 1 10 5\napple\norange\nmango",
"output": "7 19",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "6 5\n3 5 1 6 8 1\npeach\ngrapefruit\nbanana\norange\norange",
"output": "11 30",... |
codeforces | verifiable_code | 371 | Solve the following coding problem using the programming language python:
This task will exclusively concentrate only on the arrays where all elements equal 1 and/or 2.
Array *a* is *k*-period if its length is divisible by *k* and there is such array *b* of length *k*, that *a* is represented by array *b* written exa... | n, k = map(int, input().split())
A = list(map(int, input().split()))
ans = 0
for i in range(k):
s1, s2 = 0, 0
for j in range(i, n, k):
if A[j] == 1:
s1+=1
else:
s2+=1
ans = ans + min(s1, s2)
print(ans) | vfc_82625 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "2000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "6 2\n2 1 2 2 2 1",
"output": "1",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "8 4\n1 1 2 1 1 1 2 1",
"output": "0",
"type": "stdin_stdout"
},
{
"fn_name": null,
... |
codeforces | verifiable_code | 270 | Solve the following coding problem using the programming language python:
Emuskald needs a fence around his farm, but he is too lazy to build it himself. So he purchased a fence-building robot.
He wants the fence to be a regular polygon. The robot builds the fence along a single path, but it can only make fence corne... |
t = int(input())
rj = []
for i in range(t):
a = int(input())
if a < 60:
rj.append('NO')
else:
n = 3
kut = ((n-2)*180)/n
while a >= kut:
if a == kut:
rj.append('YES')
break
n+=1
kut = ((n... | vfc_82629 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "2000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "3\n30\n60\n90",
"output": "NO\nYES\nYES",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "6\n1\n2\n3\n170\n179\n25",
"output": "NO\nNO\nNO\nYES\nYES\nNO",
"type": "stdin_stdout"
... |
codeforces | verifiable_code | 405 | Solve the following coding problem using the programming language python:
Little Chris is bored during his physics lessons (too easy), so he has built a toy box to keep himself occupied. The box is special, since it has the ability to change gravity.
There are *n* columns of toy cubes in the box arranged in a line. T... | n = int(input())
m = input().split()
x = ''
for i in range(n):
m[i] = int(m[i])
for i in sorted(m):
x += str(i)+' '
print(x) | vfc_82633 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "1000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "4\n3 2 1 2",
"output": "1 2 2 3 ",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "3\n2 3 8",
"output": "2 3 8 ",
"type": "stdin_stdout"
},
{
"fn_name": null,
"... |
codeforces | verifiable_code | 556 | Solve the following coding problem using the programming language python:
Andrewid the Android is a galaxy-famous detective. In his free time he likes to think about strings containing zeros and ones.
Once he thought about a string of length *n* consisting of zeroes and ones. Consider the following operation: we choo... | n=int(input())
str1=str(input())
a=str1.count('0')
b=str1.count('1')
print(abs(a-b))
| vfc_82637 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "1000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "4\n1100",
"output": "0",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "5\n01010",
"output": "1",
"type": "stdin_stdout"
}
]
} |
codeforces | verifiable_code | 841 | Solve the following coding problem using the programming language python:
One day Kefa found *n* baloons. For convenience, we denote color of *i*-th baloon as *s**i* — lowercase letter of the Latin alphabet. Also Kefa has *k* friends. Friend will be upset, If he get two baloons of the same color. Kefa want to give out... | import string
a , b = map(int , input().split())
s = input()
f = True
for i in string.ascii_lowercase:
if s.count(i) > b:
f = False
break
if f: print("YES")
else: print("NO") | vfc_82641 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "2000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "4 2\naabb",
"output": "YES",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "6 3\naacaab",
"output": "NO",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input":... |
codeforces | verifiable_code | 899 | Solve the following coding problem using the programming language python:
There were *n* groups of students which came to write a training contest. A group is either one person who can write the contest with anyone else, or two people who want to write the contest in the same team.
The coach decided to form teams of ... | n = int(input())
list_ = list(map(int,input().split()))
nof_2 = list_.count(2)
nof_1 = list_.count(1)
sum = 0
#print(nof_1,nof_2)
if nof_2<=nof_1:
sum+=nof_2
nof_1-=nof_2
sum+=(nof_1//3)
else:
sum+=nof_1
print(sum) | vfc_82645 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "2000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "4\n1 1 2 1",
"output": "1",
"type": "stdin_stdout"
}
]
} |
codeforces | verifiable_code | 918 | Solve the following coding problem using the programming language python:
Eleven wants to choose a new name for herself. As a bunch of geeks, her friends suggested an algorithm to choose a name for her. Eleven wants her name to have exactly *n* characters.
Her friend suggested that her name should only consist of up... | s = ""
def fibo(i):
if i == 1:
return 0
elif i == 2:
return 0
a = 0
b = 1
c = 0
while c < i:
c = a + b
a = b
b = c
if c == i:
return 0
return 1
for i in range(1,int(input())+1):
if fibo(i) == 0:
... | vfc_82649 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "1000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "8",
"output": "OOOoOooO",
"type": "stdin_stdout"
}
]
} |
codeforces | verifiable_code | 755 | Solve the following coding problem using the programming language python:
PolandBall is a young, clever Ball. He is interested in prime numbers. He has stated a following hypothesis: "There exists such a positive integer *n* that for each positive integer *m* number *n*·*m*<=+<=1 is a prime number".
Unfortunately, Po... | from math import sqrt
n=int(input())
m=1
while True:
x=(n*m)+1
flag=0
for _ in range(2,int(sqrt(x))+1):
if x%_==0:
flag=1
break
if flag==1:
print(m)
break
m+=1
| vfc_82653 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "1000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "3",
"output": "1",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "4",
"output": "2",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "10",
"output"... |
codeforces | verifiable_code | 579 | Solve the following coding problem using the programming language python:
You are a lover of bacteria. You want to raise some bacteria in a box.
Initially, the box is empty. Each morning, you can put any number of bacteria into the box. And each night, every bacterium in the box will split into two bacteria. You hop... | n=int(input())
s=1
while n!=1:
if n%2==0:
n//=2
else:
s+=1
n-=1
print(s) | vfc_82657 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "1000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "5",
"output": "2",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "8",
"output": "1",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "536870911",
"... |
codeforces | verifiable_code | 1009 | Solve the following coding problem using the programming language python:
Maxim wants to buy some games at the local game shop. There are $n$ games in the shop, the $i$-th game costs $c_i$.
Maxim has a wallet which can be represented as an array of integers. His wallet contains $m$ bills, the $j$-th bill has value $a... | n, m = [int(x) for x in input().split(' ')]
c = [int(x) for x in input().split(' ')]
a = [int(x) for x in input().split(' ')]
cnt = 0
for i in range(n):
if c[i] <= a[0]:
a.pop(0)
cnt += 1
if len(a) <= 0: break
print(cnt)
| vfc_82661 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "1500"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "5 4\n2 4 5 2 4\n5 3 4 6",
"output": "3",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "5 2\n20 40 50 20 40\n19 20",
"output": "0",
"type": "stdin_stdout"
},
{
"fn_n... |
codeforces | verifiable_code | 232 | Solve the following coding problem using the programming language python:
John Doe started thinking about graphs. After some thought he decided that he wants to paint an undirected graph, containing exactly *k* cycles of length 3.
A cycle of length 3 is an unordered group of three distinct graph vertices *a*, *b* an... | import sys
import math
c=int(input())
Ans=[]
F=[1]
for i in range(1,101):
F.append(F[-1]*i)
for i in range(100):
Ans.append([0]*100)
print(100)
cycles=1
Ans[0][1]=1
Ans[1][0]=1
Ans[1][2]=1
Ans[2][1]=1
Ans[0][2]=1
Ans[2][0]=1
m=3
while(cycles<c):
Ans[0][m]=1
Ans[m][0]=1
i... | vfc_82665 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "4000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "1",
"output": "3\n011\n101\n110",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "10",
"output": "5\n01111\n10111\n11011\n11101\n11110",
"type": "stdin_stdout"
},
{
"... |
codeforces | verifiable_code | 559 | Solve the following coding problem using the programming language python:
Gerald got a very curious hexagon for his birthday. The boy found out that all the angles of the hexagon are equal to . Then he measured the length of its sides, and found that each of them is equal to an integer number of centimeters. There the... | a = list(map(int, input().split(' ')))
print((a[0]+a[1]+a[2])**2 - (a[0]**2 + a[2]**2 +a[4]**2)) | vfc_82669 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "2000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "1 1 1 1 1 1",
"output": "6",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "1 2 1 2 1 2",
"output": "13",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input":... |
codeforces | verifiable_code | 719 | Solve the following coding problem using the programming language python:
Anatoly lives in the university dorm as many other students do. As you know, cockroaches are also living there together with students. Cockroaches might be of two colors: black and red. There are *n* cockroaches living in Anatoly's room.
Anatol... | N = int(input())
This, Ans = input(), []
for i in ['rb', 'br']:
Should = i * (N // 2) + i[:N % 2]
WasR = This.count('r')
NowR = Should.count('r')
Diff = sum(1 for i, j in zip(This, Should) if i != j)
Ans.append((Diff - abs(WasR - NowR)) // 2 + abs(WasR - NowR))
print(min(Ans))
# Hope the ... | vfc_82673 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "1000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "5\nrbbrr",
"output": "1",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "5\nbbbbb",
"output": "2",
"type": "stdin_stdout"
}
]
} |
codeforces | verifiable_code | 275 | Solve the following coding problem using the programming language python:
Lenny is playing a game on a 3<=×<=3 grid of lights. In the beginning of the game all lights are switched on. Pressing any of the lights will toggle it and all side-adjacent lights. The goal of the game is to switch all the lights off. We consid... |
arr= []
for i in range(3):
l=list(map(int,input().split()))
arr.append(l)
ans=[["1","1","1"],["1","1","1"],["1","1","1"]]
for r in range(3):
for c in range(3):
row=r
col=c
temp= arr[row][col]
if row-1>=0:
temp+=arr[row-1][col]
if row+1<=2... | vfc_82677 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "2000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "1 0 0\n0 0 0\n0 0 1",
"output": "001\n010\n100",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "1 0 1\n8 8 8\n2 0 3",
"output": "010\n011\n100",
"type": "stdin_stdout"
},
... |
codeforces | verifiable_code | 450 | Solve the following coding problem using the programming language python:
There are *n* children in Jzzhu's school. Jzzhu is going to give some candies to them. Let's number all the children from 1 to *n*. The *i*-th child wants to get at least *a**i* candies.
Jzzhu asks children to line up. Initially, the *i*-th chi... | n,m = map(int,input().split())
arr = [i for i in range(n)]
v = list(map(int,input().split()))
while len(arr)>1:
# print(arr)
v[arr[0]]-=m
if v[arr[0]]<=0:
arr.pop(0)
else:
n = arr.pop(0)
arr.append(n)
print(arr[0]+1)
| vfc_82681 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "1000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "5 2\n1 3 1 4 2",
"output": "4",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "6 4\n1 1 2 2 3 3",
"output": "6",
"type": "stdin_stdout"
},
{
"fn_name": null,
"... |
codeforces | verifiable_code | 727 | Solve the following coding problem using the programming language python:
Vasily has a number *a*, which he wants to turn into a number *b*. For this purpose, he can do two types of operations:
- multiply the current number by 2 (that is, replace the number *x* by 2·*x*); - append the digit 1 to the right of curren... | def fc(a,b,re,bl,tmp):
if(a>b):
return
if(a==b):
bl[0]=False
# tmp.append(a)
re.append(tmp)
return
if(bl[0]):
fc(a*2,b,re,bl,tmp+[a*2])
fc(a*10+1,b,re,bl,tmp+[a*10+1])
re=[]
bl=[True]
# fc(2,162,re,bl,[])
a,b=map(int,i... | vfc_82685 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "1000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "2 162",
"output": "YES\n5\n2 4 8 81 162 ",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "4 42",
"output": "NO",
"type": "stdin_stdout"
},
{
"fn_name": null,
"... |
codeforces | verifiable_code | 194 | Solve the following coding problem using the programming language python:
One day the Codeforces round author sat exams. He had *n* exams and he needed to get an integer from 2 to 5 for each exam. He will have to re-sit each failed exam, i.e. the exam that gets mark 2.
The author would need to spend too much time an... | n, m = map(int, input().split())
print(max(0, n*3-m))
# FMZJMSOMPMSL
| vfc_82689 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "2000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "4 8",
"output": "4",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "4 10",
"output": "2",
"type": "stdin_stdout"
}
]
} |
codeforces | verifiable_code | 492 | Solve the following coding problem using the programming language python:
Vanya got *n* cubes. He decided to build a pyramid from them. Vanya wants to build the pyramid as follows: the top level of the pyramid must consist of 1 cube, the second level must consist of 1<=+<=2<==<=3 cubes, the third level must have 1<=+<... | n = int(input())
levels = 0
prev, current = 0, 0
add = 0
s = 0
while True:
if levels % 2 == 1: add += 1
current = prev + 1 + 2 * add if levels % 2 == 0 else prev + 2 * add
s += current
if s > n: break
prev = current
levels += 1
print(levels) | vfc_82693 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "1000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "1",
"output": "1",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "25",
"output": "4",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "2",
"output"... |
codeforces | verifiable_code | 276 | Solve the following coding problem using the programming language python:
The little girl loves the problems on array queries very much.
One day she came across a rather well-known problem: you've got an array of $n$ elements (the elements of the array are indexed starting from 1); also, there are $q$ queries, each o... |
from sys import stdin
def get_input():
# Faster IO
input_str = stdin.read().strip().split('\n')
n, q = map(int, input_str[0].split())
arr = list(map(int, input_str[1].split()))
queries = [map(int, input_str[i].split()) for i in range(2, len(input_str))]
return arr, queries
def ... | vfc_82701 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "1000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "3 3\n5 3 2\n1 2\n2 3\n1 3",
"output": "25",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "5 3\n5 2 4 1 3\n1 5\n2 3\n2 3",
"output": "33",
"type": "stdin_stdout"
}
]
} |
codeforces | verifiable_code | 614 | Solve the following coding problem using the programming language python:
It's the year 4527 and the tanks game that we all know and love still exists. There also exists Great Gena's code, written in 2016. The problem this code solves is: given the number of tanks that go into the battle from each country, find their ... | n = int(input())
lis = input().split()
#print(lis)
ans=1
zer=0
for i in lis:
l=len(i)
k=i.count('1')
j=i.count('0')
if k+j==l:
if k>1:
ans*=int(i)
else:
if j==l:
print('0')
exit()
else:
z... | vfc_82705 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "500"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "3\n5 10 1",
"output": "50",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "4\n1 1 10 11",
"output": "110",
"type": "stdin_stdout"
}
]
} |
codeforces | verifiable_code | 731 | Solve the following coding problem using the programming language python:
Grigoriy, like the hero of one famous comedy film, found a job as a night security guard at the museum. At first night he received embosser and was to take stock of the whole exposition.
Embosser is a special devise that allows to "print" the t... | s = 'abcdefghijklmnopqrstuvwxyz';
word = input();
result = 0;
ptr = 0;
for i in range(len(word)):
from_st = s.index(word[i]);
from_end = s[::-1].index(word[i]);
if(from_st > from_end):
ptr = from_end;
start = s[26 - ptr-1::];
end = s[0:26-ptr-1];
else:
... | vfc_82709 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "2000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "zeus",
"output": "18",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "map",
"output": "35",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "ares",
... |
codeforces | verifiable_code | 735 | Solve the following coding problem using the programming language python:
On the way to Rio de Janeiro Ostap kills time playing with a grasshopper he took with him in a special box. Ostap builds a line of length *n* such that some cells of this line are empty and some contain obstacles. Then, he places his grasshopper... | n,k = map(int,input().split())
cell = list(map(str,input().strip()))
a = cell.index("G")
b = cell.index("T")
if(a>b):
if((a-b)%k != 0):
print("NO")
else:
for i in range(1,(a-b)//k + 1):
if(cell[b + k*i] == "#"):
print("NO")
break
... | vfc_82713 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "2000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "5 2\n#G#T#",
"output": "YES",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "6 1\nT....G",
"output": "YES",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input... |
codeforces | verifiable_code | 421 | Solve the following coding problem using the programming language python:
Pasha has two hamsters: Arthur and Alexander. Pasha put *n* apples in front of them. Pasha knows which apples Arthur likes. Similarly, Pasha knows which apples Alexander likes. Pasha doesn't want any conflict between the hamsters (as they may li... | n, a, b = list(map(int, input().split()))
aa = list(map(int, input().split()))
ab = list(map(int, input().split()))
ans = [0] * n
for a in aa:
ans[a - 1] = '1'
for a in ab:
ans[a - 1] = '2'
print(' '.join(ans)) | vfc_82717 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "1000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "4 2 3\n1 2\n2 3 4",
"output": "1 1 2 2",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "5 5 2\n3 4 1 2 5\n2 3",
"output": "1 1 1 1 1",
"type": "stdin_stdout"
},
{
"f... |
codeforces | verifiable_code | 271 | Solve the following coding problem using the programming language python:
It seems like the year of 2013 came only yesterday. Do you know a curious fact? The year of 2013 is the first year after the old 1987 with only distinct digits.
Now you are suggested to solve the following problem: given a year number, find the... | a = int(input()) + 1
while len(set(str(a))) != 4: a += 1
print(a) | vfc_82721 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "2000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "1987",
"output": "2013",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "2013",
"output": "2014",
"type": "stdin_stdout"
}
]
} |
codeforces | verifiable_code | 202 | Solve the following coding problem using the programming language python:
This problem's actual name, "Lexicographically Largest Palindromic Subsequence" is too long to fit into the page headline.
You are given string *s* consisting of lowercase English letters only. Find its lexicographically largest palindromic sub... | from itertools import combinations
def get_subsequences(input_str):
for length in range(1, len(input_str)+1):
for elems in combinations(input_str, length):
yield ''.join(elems)
print(sorted([s for s in get_subsequences(input()) if s[::-1] == s])[-1]) | vfc_82725 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "2000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "radar",
"output": "rr",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "bowwowwow",
"output": "wwwww",
"type": "stdin_stdout"
}
]
} |
codeforces | verifiable_code | 300 | Solve the following coding problem using the programming language python:
Vitaly is a very weird man. He's got two favorite digits *a* and *b*. Vitaly calls a positive integer good, if the decimal representation of this integer only contains digits *a* and *b*. Vitaly calls a good number excellent, if the sum of its d... | import sys, threading
import math
from os import path
from collections import deque, defaultdict, Counter
from bisect import *
from string import ascii_lowercase
from functools import cmp_to_key
from random import randint
from heapq import *
from array import array
from types import GeneratorType
def readInts():
... | vfc_82729 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "2000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "1 3 3",
"output": "1",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "2 3 10",
"output": "165",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "6 8 1421... |
codeforces | verifiable_code | 535 | Solve the following coding problem using the programming language python:
Once again Tavas started eating coffee mix without water! Keione told him that it smells awful, but he didn't stop doing that. That's why Keione told his smart friend, SaDDas to punish him! SaDDas took Tavas' headphones and told him: "If you sol... | def count_lucky_numbers(n):
d = len(n)
s = ""
for i in range(d):
if n[i] == '4':
s += '0'
else:
s += '1'
return 2*(2**(d-1)-1)+int(s,2)+1
n = input() # Input lucky number
index = count_lucky_numbers(n)
print(index)
| vfc_82737 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "2000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "4",
"output": "1",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "7",
"output": "2",
"type": "stdin_stdout"
}
]
} |
codeforces | verifiable_code | 682 | Solve the following coding problem using the programming language python:
Someone gave Alyona an array containing *n* positive integers *a*1,<=*a*2,<=...,<=*a**n*. In one operation, Alyona can choose any element of the array and decrease it, i.e. replace with any positive integer that is smaller than the current one. ... | import sys, os, io
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
n = int(input())
a = list(map(int, input().split()))
a.sort()
ans = 1
for i in a:
if ans <= i:
ans += 1
print(ans) | vfc_82741 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "2000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "5\n1 3 3 3 6",
"output": "5",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "2\n2 1",
"output": "3",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "1\n... |
codeforces | verifiable_code | 92 | Solve the following coding problem using the programming language python:
There are *n* walruses sitting in a circle. All of them are numbered in the clockwise order: the walrus number 2 sits to the left of the walrus number 1, the walrus number 3 sits to the left of the walrus number 2, ..., the walrus number 1 sits ... | m,n=map(int,input().split())
t=False
while not t:
for x in range(m):
if n>=x+1:
n-=x+1
else:
t=True
break
print(n) | vfc_82745 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "1000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "4 11",
"output": "0",
"type": "stdin_stdout"
}
]
} |
codeforces | verifiable_code | 849 | Solve the following coding problem using the programming language python:
Where do odds begin, and where do they end? Where does hope emerge, and will they ever break?
Given an integer sequence *a*1,<=*a*2,<=...,<=*a**n* of length *n*. Decide whether it is possible to divide it into an odd number of non-empty subsegm... | # coding: utf-8
# 849A - Odds and Ends (http://codeforces.com/contest/849/problem/A)
n = int(input())
arr = list(map(int, input().split()))
if n % 2 and arr[0] % 2 and arr[-1] % 2: print("Yes")
else: print("No") | vfc_82749 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "1000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "3\n1 3 5",
"output": "Yes",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "5\n1 0 1 5 1",
"output": "Yes",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input"... |
codeforces | verifiable_code | 245 | Solve the following coding problem using the programming language python:
Polycarpus is a system administrator. There are two servers under his strict guidance — *a* and *b*. To stay informed about the servers' performance, Polycarpus executes commands "ping a" and "ping b". Each ping command sends exactly ten packets... | n=int(input())
server1x = 0
server2x = 0
server1y = 0
server2y = 0
for _ in range(n):
t, x, y = list(map(int, input().split()))
if t == 1:
server1x += x
server1y += y
else:
server2x += x
server2y += y
if server1x >= server1y:
print("LIVE")
else:
pr... | vfc_82753 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "5000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "2\n1 5 5\n2 6 4",
"output": "LIVE\nLIVE",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "3\n1 0 10\n2 0 10\n1 10 0",
"output": "LIVE\nDEAD",
"type": "stdin_stdout"
},
{
... |
codeforces | verifiable_code | 884 | Solve the following coding problem using the programming language python:
A one-dimensional Japanese crossword can be represented as a binary string of length *x*. An encoding of this crossword is an array *a* of size *n*, where *n* is the number of segments formed completely of 1's, and *a**i* is the length of *i*-th... | n,x=list(map(int,input().split()))
a=list(map(int,input().split()))
if sum(a) + n - 1 == x:
print('Yes')
else:
print('No')
| vfc_82757 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "1000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "2 4\n1 3",
"output": "NO",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "3 10\n3 3 2",
"output": "YES",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": ... |
codeforces | verifiable_code | 236 | Solve the following coding problem using the programming language python:
Those days, many boys use beautiful girls' photos as avatars in forums. So it is pretty hard to tell the gender of a user at the first glance. Last year, our hero went to a forum and had a nice chat with a beauty (he thought so). After that they... | d=dict()
n=input()
for ch in n:
if(ch in d):
d[ch]=d[ch]+1
else:
d[ch]=0
count=len(d)
if(count%2==0):
print("CHAT WITH HER!")
else:
print("IGNORE HIM!") | vfc_82761 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "2000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "wjmzbmr",
"output": "CHAT WITH HER!",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "xiaodao",
"output": "IGNORE HIM!",
"type": "stdin_stdout"
}
]
} |
codeforces | verifiable_code | 334 | Solve the following coding problem using the programming language python:
Gerald has *n* younger brothers and their number happens to be even. One day he bought *n*2 candy bags. One bag has one candy, one bag has two candies, one bag has three candies and so on. In fact, for each integer *k* from 1 to *n*2 he has exac... | n=int(input())
n=n**2
for i in range (0,n//2):
print(i+1,n-i) | vfc_82765 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "1000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "2",
"output": "1 4\n2 3",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "4",
"output": "1 16 2 15\n3 14 4 13\n5 12 6 11\n7 10 8 9",
"type": "stdin_stdout"
},
{
"fn_n... |
codeforces | verifiable_code | 124 | Solve the following coding problem using the programming language python:
Petr stands in line of *n* people, but he doesn't know exactly which position he occupies. He can say that there are no less than *a* people standing in front of him and no more than *b* people standing behind him. Find the number of different p... | # cook your dish here
n,a,b = input().split()
n = int(n)
a = int(a)
b = int(b)
count = 0
for i in range(1,n+1):
if i>a and n-i<=b:
count = count + 1
print(count) | vfc_82769 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "1000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "3 1 1",
"output": "2",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "5 2 3",
"output": "3",
"type": "stdin_stdout"
}
]
} |
codeforces | verifiable_code | 115 | Solve the following coding problem using the programming language python:
A company has *n* employees numbered from 1 to *n*. Each employee either has no immediate manager or exactly one immediate manager, who is another employee with a different number. An employee *A* is said to be the superior of another employee *... | n=int(input());
maxx=-1;
a=[-1];
for i in range(n):
a.append(int(input()));
for i in range(1,n+1):
j=i;c=1;
while(a[j]!=-1):c+=1;j=a[j];
maxx=max(c,maxx);
print(maxx);
| vfc_82773 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "3000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "5\n-1\n1\n2\n1\n-1",
"output": "3",
"type": "stdin_stdout"
}
]
} |
codeforces | verifiable_code | 928 | Solve the following coding problem using the programming language python:
When registering in a social network, users are allowed to create their own convenient login to make it easier to share contacts, print it on business cards, etc.
Login is an arbitrary sequence of lower and uppercase latin letters, digits and u... | ss = input()
st = ""
for j in range(len(ss)):
c = ss[j]
if 'A' <= c <= 'Z':
c = chr(ord(c) + ord('a') - ord('A'))
if c == 'o':
c = '0'
if c == 'l' or c == 'i':
c = '1'
st += c
s = st
n = int(input())
for i in range(n):
ss = input()
st = ""
for j in... | vfc_82777 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "4000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "1_wat\n2\n2_wat\nwat_1",
"output": "Yes",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "000\n3\n00\nooA\noOo",
"output": "No",
"type": "stdin_stdout"
},
{
"fn_name"... |
codeforces | verifiable_code | 766 | Solve the following coding problem using the programming language python:
While Mahmoud and Ehab were practicing for IOI, they found a problem which name was Longest common subsequence. They solved it, and then Ehab challenged Mahmoud with another problem.
Given two strings *a* and *b*, find the length of their longe... | s1 = input()
s2 = input()
if s1 == s2:
print(-1)
elif len(s1) > len(s2):
print(len(s1))
elif len(s2) > len(s1):
print(len(s2))
else:
print(len(s1)) | vfc_82781 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "2000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "abcd\ndefgh",
"output": "5",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "a\na",
"output": "-1",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "aaaaa... |
codeforces | verifiable_code | 611 | Solve the following coding problem using the programming language python:
They say "years are like dominoes, tumbling one after the other". But would a year fit into a grid? I don't think so.
Limak is a little polar bear who loves to play. He has recently got a rectangular grid with *h* rows and *w* columns. Each cel... | read = lambda: map(int, input().split())
h, w = read()
a = [input() for i in range(h)]
N = 501
vr = [[0] * N for i in range(N)]
hr = [[0] * N for i in range(N)]
for i in range(h):
for j in range(w):
vr[j + 1][i + 1] = vr[j][i + 1] + vr[j + 1][i] - vr[j][i]
hr[j + 1][i + 1] = hr[j][i + 1] + ... | vfc_82785 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "2000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "5 8\n....#..#\n.#......\n##.#....\n##..#.##\n........\n4\n1 1 2 3\n4 1 4 1\n1 2 4 5\n2 5 5 8",
"output": "4\n0\n10\n15",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "7 39\n.................... |
codeforces | verifiable_code | 29 | Solve the following coding problem using the programming language python:
In a Berland's zoo there is an enclosure with camels. It is known that camels like to spit. Bob watched these interesting animals for the whole day and registered in his notepad where each animal spitted. Now he wants to know if in the zoo there... |
n = int(input())
A = set()
for _ in range(n):
x, d = map(int, input().split())
A.add((x, d))
found = False
for x, d in A:
if (x + d, -d) in A:
found = True
if found:
print("YES")
else:
print("NO")
| vfc_82793 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "2000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "2\n0 1\n1 -1",
"output": "YES",
"type": "stdin_stdout"
}
]
} |
codeforces | verifiable_code | 853 | Solve the following coding problem using the programming language python:
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process.
There are *n*<=+<=1 cities consecu... | g = lambda: map(int, input().split())
n, m, k = g()
F, T = [], []
e = int(3e11)
for i in range(m):
d, f, t, c = g()
if f: F.append((d, f, c))
else: T.append((-d, t, c))
for p in [F, T]:
C = [e] * (n + 1)
s = n * e
q = []
p.sort()
for d, t, c in p:
if C[t] > c:... | vfc_82805 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "1000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "2 6 5\n1 1 0 5000\n3 2 0 5500\n2 2 0 6000\n15 0 2 9000\n9 0 1 7000\n8 0 2 6500",
"output": "24500",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "2 4 5\n1 2 0 5000\n2 1 0 4500\n2 1 0 3000\n8... |
codeforces | verifiable_code | 877 | Solve the following coding problem using the programming language python:
One day Alex was creating a contest about his friends, but accidentally deleted it. Fortunately, all the problems were saved, but now he needs to find them among other problems.
But there are too many problems, to do it manually. Alex asks you ... | s=input()
cnt=s.count("Danil")+s.count("Olya")+s.count("Slava")+s.count("Nikita")+s.count("Ann")
print("YES" if cnt == 1 else "NO") | vfc_82809 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "2000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "Alex_and_broken_contest",
"output": "NO",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "NikitaAndString",
"output": "YES",
"type": "stdin_stdout"
},
{
"fn_name": nu... |
codeforces | verifiable_code | 762 | Solve the following coding problem using the programming language python:
You are given two integers *n* and *k*. Find *k*-th smallest divisor of *n*, or report that it doesn't exist.
Divisor of *n* is any such natural number, that *n* can be divided by it without remainder.
The input will be provided via standard i... | import sys
import math
from collections import Counter
# n = int(input())
# a = list(map(int, input().split()))
n, k = map(int, input().split())
less = []
more = []
i = 1
count = 0
root = int(math.sqrt(n))
while i <= root :
if n % i == 0 :
less.append(i)
if i * i != n:
... | vfc_82813 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "2000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "4 2",
"output": "2",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "5 3",
"output": "-1",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "12 5",
"... |
codeforces | verifiable_code | 220 | Solve the following coding problem using the programming language python:
The Little Elephant has got a problem — somebody has been touching his sorted by non-decreasing array *a* of length *n* and possibly swapped some elements of the array.
The Little Elephant doesn't want to call the police until he understands if... | from sys import stdin
from collections import deque,Counter,defaultdict
import sys
import math
import operator
import random
from fractions import Fraction
import functools
import bisect
import itertools
from heapq import *
import time
n = int(input())
arr = list(map(int,input().split()))
c = 0
for i,j in zip(arr,sort... | vfc_82817 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "4000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "2\n1 2",
"output": "YES",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "3\n3 2 1",
"output": "YES",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "4\n... |
codeforces | verifiable_code | 486 | Solve the following coding problem using the programming language python:
For a positive integer *n* let's define a function *f*:
*f*(*n*)<==<=<=-<=1<=+<=2<=-<=3<=+<=..<=+<=(<=-<=1)*n**n*
Your task is to calculate *f*(*n*) for a given integer *n*.
The input will be provided via standard input and looks as follows:... | S0l=int(input())
if S0l%2==0:
print(S0l//2)
else:
print(S0l//2-S0l) | vfc_82821 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "1000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "4",
"output": "2",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "5",
"output": "-3",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "1000000000",
... |
codeforces | verifiable_code | 1004 | Solve the following coding problem using the programming language python:
Sonya decided that having her own hotel business is the best way of earning money because she can profit and rest wherever she wants.
The country where Sonya lives is an endless line. There is a city in each integer coordinate on this line. She... | n, d = map(int, input().split())
li = list(map(int, input().split()))
c = 2
for i in range(1, n):
if (li[i] - li[i-1]) == 2*d:
c = c + 1
if (li[i] - li[i-1]) > 2*d:
c = c + 2
print(c) | vfc_82825 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "1000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "4 3\n-3 2 9 16",
"output": "6",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "5 2\n4 8 11 18 19",
"output": "5",
"type": "stdin_stdout"
},
{
"fn_name": null,
... |
codeforces | verifiable_code | 858 | Solve the following coding problem using the programming language python:
For a given positive integer *n* denote its *k*-rounding as the minimum positive integer *x*, such that *x* ends with *k* or more zeros in base 10 and is divisible by *n*.
For example, 4-rounding of 375 is 375·80<==<=30000. 30000 is the minimum... | import math
n,k = map(int,input().split())
m =(n * (10**k)) / math.gcd(n, (10**k))
print(int(m)) | vfc_82829 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "1000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "375 4",
"output": "30000",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "10000 1",
"output": "10000",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "3... |
codeforces | verifiable_code | 610 | Solve the following coding problem using the programming language python:
Pasha has a wooden stick of some positive integer length *n*. He wants to perform exactly three cuts to get four parts of the stick. Each part must have some positive integer length and the sum of these lengths will obviously be *n*.
Pasha lik... | n = int(input())
if n % 2 != 0 or n < 6:
print(0)
else:
k = n // 2
if n % 4 == 0:
print(k//2-1)
else:
print(k//2) | vfc_82833 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "1000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "6",
"output": "1",
"type": "stdin_stdout"
}
]
} |
codeforces | verifiable_code | 381 | Solve the following coding problem using the programming language python:
Sereja and Dima play a game. The rules of the game are very simple. The players have *n* cards in a row. Each card contains a number, all numbers on the cards are distinct. The players take turns, Sereja moves first. During his turn a player can... | n=int(input())
l=[]
Sereja , Dima, i = 0, 0, 0
t=map(int,input().split())
l+=t
y=len(l)
a=True
while(y!=0):
if(l[0]>=l[y-1]):
x=l[0]
l.pop(0)
else:
x=l[y-1]
l.pop(y-1)
if(a==True):
Sereja+=x
a=False
else:
Dima+=x
a=True
... | vfc_82837 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "1000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "4\n4 1 2 10",
"output": "12 5",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "7\n1 2 3 4 5 6 7",
"output": "16 12",
"type": "stdin_stdout"
},
{
"fn_name": null,
... |
codeforces | verifiable_code | 353 | Solve the following coding problem using the programming language python:
Valera has 2·*n* cubes, each cube contains an integer from 10 to 99. He arbitrarily chooses *n* cubes and puts them in the first heap. The remaining cubes form the second heap.
Valera decided to play with cubes. During the game he takes a cube... | from sys import stdin
n = int(stdin.readline())
a = [int(x) for x in stdin.readline().split()]
a = sorted([(a[x], x) for x in range(n*2)])
group = {}
for x,ind in a:
if x in group:
group[x].append(ind)
else:
group[x] = [ind]
g2 = []
for x in group:
g2.append([len(group[... | vfc_82841 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "1000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "1\n10 99",
"output": "1\n2 1 ",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "2\n13 24 13 45",
"output": "4\n1 2 2 1 ",
"type": "stdin_stdout"
},
{
"fn_name": null,... |
codeforces | verifiable_code | 734 | Solve the following coding problem using the programming language python:
Anton likes to play chess, and so does his friend Danik.
Once they have played *n* games in a row. For each game it's known who was the winner — Anton or Danik. None of the games ended with a tie.
Now Anton wonders, who won more games, he or D... | n=int(input())
a=d=0
s=input()
for i in range(n):
if s[i]=='A': a+=1
else: d+=1
if a==d: print('Friendship')
elif a>d: print('Anton')
else: print('Danik') | vfc_82845 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "1000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "6\nADAAAA",
"output": "Anton",
"type": "stdin_stdout"
}
]
} |
codeforces | verifiable_code | 900 | Solve the following coding problem using the programming language python:
You have *n* distinct points on a plane, none of them lie on *OY* axis. Check that there is a point after removal of which the remaining points are located on one side of the *OY* axis.
The input will be provided via standard input and looks as... | n = int(input())
p , nn = 0 ,0
for i in range(n):
x,y = map(int,input().split())
if x > 0:
p += 1
else:
nn += 1
if p > 1 and nn > 1:
print('NO')
elif p <= 1 or nn <= 1:
print('YES') | vfc_82849 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "1000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "3\n1 1\n-1 -1\n2 -1",
"output": "Yes",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "4\n1 1\n2 2\n-1 1\n-2 2",
"output": "No",
"type": "stdin_stdout"
}
]
} |
codeforces | verifiable_code | 343 | Solve the following coding problem using the programming language python:
Mad scientist Mike does not use slow hard disks. His modification of a hard drive has not one, but *n* different heads that can read data in parallel.
When viewed from the side, Mike's hard drive is an endless array of tracks. The tracks of the... | # Read Time
import sys
input = sys.stdin.buffer.readline
n, m = map(int, input().split())
h = list(map(int, input().split()))
p = list(map(int, input().split()))
# minimmum time for h_i to cover all p_s...p_e
def min_t(h_i, p_s, p_e):
return min(abs(h[h_i]-p[p_s]),abs(h[h_i]-p[p_e])) + (p[p_e]-p[p_s... | vfc_82853 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "1000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "3 4\n2 5 6\n1 3 6 8",
"output": "2",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "3 3\n1 2 3\n1 2 3",
"output": "0",
"type": "stdin_stdout"
}
]
} |
codeforces | verifiable_code | 678 | Solve the following coding problem using the programming language python:
Consider a linear function *f*(*x*)<==<=*Ax*<=+<=*B*. Let's define *g*(0)(*x*)<==<=*x* and *g*(*n*)(*x*)<==<=*f*(*g*(*n*<=-<=1)(*x*)) for *n*<=><=0. For the given integer values *A*, *B*, *n* and *x* find the value of *g*(*n*)(*x*) modulo 109... | import sys,math
def power(x, y, p):
res = 1;
x = x % p;
while (y > 0):
if (y & 1):
res = (res * x) % p;
y = y >> 1;
x = (x * x) % p;
return res;
def modInverse(b,m):
g = math.gcd(b, m)
if (g != 1):
return -1
else:
return pow(b, ... | vfc_82857 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "500"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "3 4 1 1",
"output": "7",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "3 4 2 1",
"output": "25",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "3 4 3 ... |
codeforces | verifiable_code | 424 | Solve the following coding problem using the programming language python:
Pasha has many hamsters and he makes them work out. Today, *n* hamsters (*n* is even) came to work out. The hamsters lined up and each hamster either sat down or stood up.
For another exercise, Pasha needs exactly hamsters to stand up and the ... | def main():
input()
s = input()
ta = t = (s.count('x') - s.count('X')) // 2
res = []
if t > 0:
for c in s:
if t and c == 'x':
c = 'X'
t -= 1
res.append(c)
else:
for c in s:
if t and c == 'X':
c = ... | vfc_82861 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "2000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "4\nxxXx",
"output": "1\nXxXx",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "2\nXX",
"output": "1\nxX",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": ... |
codeforces | verifiable_code | 456 | Solve the following coding problem using the programming language python:
One day Dima and Alex had an argument about the price and quality of laptops. Dima thinks that the more expensive a laptop is, the better it is. Alex disagrees. Alex thinks that there are two laptops, such that the price of the first laptop is l... | def solve():
x = int(input())
l = []
for i in range(x):
a, b = map(int, input().split())
l.append((a, b))
l.sort(key=lambda p: p[0])
for i in range(1, x):
if l[i][1]-l[i-1][1] < 0:
print('Happy Alex')
return
print('Poor Alex')
# t =... | vfc_82865 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "1000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "2\n1 2\n2 1",
"output": "Happy Alex",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "2\n1 1\n2 2",
"output": "Poor Alex",
"type": "stdin_stdout"
},
{
"fn_name": null... |
codeforces | verifiable_code | 677 | Solve the following coding problem using the programming language python:
Vanya and his friends are walking along the fence of height *h* and they do not want the guard to notice them. In order to achieve this the height of each of the friends should not exceed *h*. If the height of some person is greater than *h* he ... | friends_num, fence_height = map(int, input().split())
friends_heights = [int(height) for height in input().split()]
road_width = sum(
1
if height <= fence_height
else 2
for height in friends_heights
)
print(road_width)
| vfc_82869 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "1500"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "3 7\n4 5 14",
"output": "4",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "6 1\n1 1 1 1 1 1",
"output": "6",
"type": "stdin_stdout"
}
]
} |
codeforces | verifiable_code | 52 | Solve the following coding problem using the programming language python:
There is a given sequence of integers *a*1,<=*a*2,<=...,<=*a**n*, where every number is from 1 to 3 inclusively. You have to replace the minimum number of numbers in it so that all the numbers in the sequence are equal to each other.
The input ... | n = int(input())
s = input().split()
max_ = 0
for el in range(1,4):
if s.count(str(el)) > max_:
max_ = s.count(str(el))
print(len(s) - max_) | vfc_82873 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "2000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "9\n1 3 2 2 2 1 1 2 3",
"output": "5",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "6\n3 3 2 2 1 3",
"output": "3",
"type": "stdin_stdout"
},
{
"fn_name": null,
... |
codeforces | verifiable_code | 155 | Solve the following coding problem using the programming language python:
Vasya adores sport programming. He can't write programs but he loves to watch the contests' progress. Vasya even has a favorite coder and Vasya pays special attention to him.
One day Vasya decided to collect the results of all contests where hi... | n = int(input())
numbers = list(map(int, input().split()))
best = worst = numbers[0]
amazing = 0
for current in numbers[1:]:
if current < worst:
worst = current
amazing += 1
if current > best:
best = current
amazing += 1
print(amazing) | vfc_82877 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "2000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "5\n100 50 200 150 200",
"output": "2",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "10\n4664 6496 5814 7010 5762 5736 6944 4850 3698 7242",
"output": "4",
"type": "stdin_stdout"... |
codeforces | verifiable_code | 780 | Solve the following coding problem using the programming language python:
Andryusha is an orderly boy and likes to keep things in their place.
Today he faced a problem to put his socks in the wardrobe. He has *n* distinct pairs of socks which are initially in a bag. The pairs are numbered from 1 to *n*. Andryusha wan... | input()
k=set()
ans=0
for i in tuple(map(int,input().split())):
if i not in k:
k.add(i)
ans=max(len(k),ans)
else:
k.remove(i)
print(ans)
| vfc_82881 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "2000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "1\n1 1",
"output": "1",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "3\n2 1 1 3 2 3",
"output": "2",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "5... |
codeforces | verifiable_code | 313 | Solve the following coding problem using the programming language python:
Ilya is a very clever lion, he lives in an unusual city ZooVille. In this city all the animals have their rights and obligations. Moreover, they even have their own bank accounts. The state of a bank account is an integer. The state of a bank ac... | n=str(input())
m = n
if n[0] == '-':
if int(n[-2]) <= int(n[-1]):
m=n[:-1]
else:
m=n[:-2]+n[-1]
m=int(m)
print(m)
| vfc_82889 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "2000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "2230",
"output": "2230",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "-10",
"output": "0",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "-100003",
... |
codeforces | verifiable_code | 907 | Solve the following coding problem using the programming language python:
Two bears are playing tic-tac-toe via mail. It's boring for them to play usual tic-tac-toe game, so they are a playing modified version of this game. Here are its rules.
The game is played on the following field.
Players are making moves by tu... | field = [[""]*9 for i in range(9)]
z = 0
for i in range(3):
temp2 = input()
for z2 in range(len(temp2)):
if temp2[z2] != " ":
field[i][z] = temp2[z2]
z+= 1
z = 0
input()
for i in range(3,6):
temp2 = input()
for z2 in range(len(temp2)):
if temp2[z2... | vfc_82893 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "2000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "... ... ...\n... ... ...\n... ... ...\n\n... ... ...\n... ... ...\n... x.. ...\n\n... ... ...\n... ... ...\n... ... ...\n6 4",
"output": "... ... ... \n... ... ... \n... ... ... \n\n... ... ... \n... ... ... \n... x.. ... \n\... |
codeforces | verifiable_code | 137 | Solve the following coding problem using the programming language python:
"Hey, it's homework time" — thought Polycarpus and of course he started with his favourite subject, IT. Polycarpus managed to solve all tasks but for the last one in 20 minutes. However, as he failed to solve the last task after some considerabl... | n = int(input())
a = input().split()
d = {}
for i in a:
t = int(i)
if t in d:
d[t] += 1
else:
d[t] = 1
res = 0
for i in range(1, n+1):
if i not in d:
res += 1
print(res)
| vfc_82897 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "2000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "3\n3 1 2",
"output": "0",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "2\n2 2",
"output": "1",
"type": "stdin_stdout"
}
]
} |
codeforces | verifiable_code | 713 | Solve the following coding problem using the programming language python:
Sonya was unable to think of a story for this problem, so here comes the formal description.
You are given the array containing *n* positive integers. At one turn you can pick any element and increase or decrease it by 1. The goal is the make t... | from bisect import bisect_left as BL
n = int(input())
graph = [(-99**9, 0)] # x, slope
ans = 0
for i,a in enumerate(map(int,input().split())):
a-= i
new = []
turnj = BL(graph, (a,99**9)) - 1
if turnj != len(graph)-1:
ans+= graph[-1][0] - a
# add |x-a|
for j in range(tu... | vfc_82901 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "1000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "7\n2 1 5 11 5 9 11",
"output": "9",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "5\n5 4 3 2 1",
"output": "12",
"type": "stdin_stdout"
},
{
"fn_name": null,
... |
codeforces | verifiable_code | 348 | Solve the following coding problem using the programming language python:
One day *n* friends gathered together to play "Mafia". During each round of the game some player must be the supervisor and other *n*<=-<=1 people take part in the game. For each person we know in how many rounds he wants to be a player, not the... | from cmath import inf
import math
import sys
from os import path
#import bisect
#import math
from functools import reduce
import collections
import sys
if (path.exists('CP/input.txt')):
sys.stdout = open('CP/output.txt', 'w')
sys.stdin = open('CP/input.txt', 'r')
def ok(mid,arr,maxi):... | vfc_82905 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "2000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "3\n3 2 2",
"output": "4",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "4\n2 2 2 2",
"output": "3",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "7\n... |
codeforces | verifiable_code | 387 | Solve the following coding problem using the programming language python:
George decided to prepare a Codesecrof round, so he has prepared *m* problems for the round. Let's number the problems with integers 1 through *m*. George estimates the *i*-th problem's complexity by integer *b**i*.
To make the round good, he n... | n, m = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
jb = 0
cnt = 0
for ai in a:
while jb < m and b[jb] < ai:
jb += 1
if jb == m:
break
cnt += 1
jb += 1
print(len(a) - cnt)
| vfc_82909 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "1000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "3 5\n1 2 3\n1 2 2 3 3",
"output": "0",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "3 5\n1 2 3\n1 1 1 1 1",
"output": "2",
"type": "stdin_stdout"
},
{
"fn_name": n... |
codeforces | verifiable_code | 527 | Solve the following coding problem using the programming language python:
One day Vasya was sitting on a not so interesting Maths lesson and making an origami from a rectangular *a* mm <=×<= *b* mm sheet of paper (*a*<=><=*b*). Usually the first step in making an origami is making a square piece of paper from the r... | a,b = list(map(int,input().split()))
ans = 0
while True:
if b>a:
a,b = b,a
if a%b==0:
ans+=a//b
break
else:
ans+=a//b
a = a%b
print(ans) | vfc_82913 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "2000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "2 1",
"output": "2",
"type": "stdin_stdout"
}
]
} |
codeforces | verifiable_code | 125 | Solve the following coding problem using the programming language python:
Lengths are measures in Baden in inches and feet. To a length from centimeters it is enough to know that an inch equals three centimeters in Baden and one foot contains 12 inches.
You are given a length equal to *n* centimeters. Your task is to... | x = int(input())
x = (x+1)//3
print(x//12, x%12)
| vfc_82917 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "2000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "42",
"output": "1 2",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "5",
"output": "0 2",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "24",
"ou... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.