message stringlengths 2 65.1k | message_type stringclasses 2
values | message_id int64 0 1 | conversation_id int64 0 108k | cluster float64 14 14 | __index_level_0__ int64 0 217k |
|---|---|---|---|---|---|
Provide tags and a correct Python 3 solution for this coding contest problem.
As you have noticed, there are lovely girls in Arpa’s land.
People in Arpa's land are numbered from 1 to n. Everyone has exactly one crush, i-th person's crush is person with the number crushi.
<image>
Someday Arpa shouted Owf loudly from... | instruction | 0 | 99,141 | 14 | 198,282 |
Tags: dfs and similar, math
Correct Solution:
```
def gcd(a, b):
return a if b == 0 else gcd(b, a % b)
def lcm(a, b):
return a * b // gcd(a, b)
n = int(input())
c = [int(v)-1 for v in input().split(' ')]
t = 1
for i in range(n):
k = i
for j in range(1, n+2):
k = c[k]
if k == i:
... | output | 1 | 99,141 | 14 | 198,283 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
As you have noticed, there are lovely girls in Arpa’s land.
People in Arpa's land are numbered from 1 to n. Everyone has exactly one crush, i-th person's crush is person with the number crushi.... | instruction | 0 | 99,142 | 14 | 198,284 |
Yes | output | 1 | 99,142 | 14 | 198,285 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
As you have noticed, there are lovely girls in Arpa’s land.
People in Arpa's land are numbered from 1 to n. Everyone has exactly one crush, i-th person's crush is person with the number crushi.... | instruction | 0 | 99,143 | 14 | 198,286 |
Yes | output | 1 | 99,143 | 14 | 198,287 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
As you have noticed, there are lovely girls in Arpa’s land.
People in Arpa's land are numbered from 1 to n. Everyone has exactly one crush, i-th person's crush is person with the number crushi.... | instruction | 0 | 99,144 | 14 | 198,288 |
Yes | output | 1 | 99,144 | 14 | 198,289 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
As you have noticed, there are lovely girls in Arpa’s land.
People in Arpa's land are numbered from 1 to n. Everyone has exactly one crush, i-th person's crush is person with the number crushi.... | instruction | 0 | 99,145 | 14 | 198,290 |
Yes | output | 1 | 99,145 | 14 | 198,291 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
As you have noticed, there are lovely girls in Arpa’s land.
People in Arpa's land are numbered from 1 to n. Everyone has exactly one crush, i-th person's crush is person with the number crushi.... | instruction | 0 | 99,146 | 14 | 198,292 |
No | output | 1 | 99,146 | 14 | 198,293 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
As you have noticed, there are lovely girls in Arpa’s land.
People in Arpa's land are numbered from 1 to n. Everyone has exactly one crush, i-th person's crush is person with the number crushi.... | instruction | 0 | 99,147 | 14 | 198,294 |
No | output | 1 | 99,147 | 14 | 198,295 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
As you have noticed, there are lovely girls in Arpa’s land.
People in Arpa's land are numbered from 1 to n. Everyone has exactly one crush, i-th person's crush is person with the number crushi.... | instruction | 0 | 99,148 | 14 | 198,296 |
No | output | 1 | 99,148 | 14 | 198,297 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
As you have noticed, there are lovely girls in Arpa’s land.
People in Arpa's land are numbered from 1 to n. Everyone has exactly one crush, i-th person's crush is person with the number crushi.... | instruction | 0 | 99,149 | 14 | 198,298 |
No | output | 1 | 99,149 | 14 | 198,299 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A necklace can be described as a string of links ('-') and pearls ('o'), with the last link or pearl connected to the first one.
<image>
You can remove a link or a pearl and insert it between two other existing links or pearls (or between ... | instruction | 0 | 99,230 | 14 | 198,460 |
Tags: implementation, math
Correct Solution:
```
s = input()
count1 = count2 = 0
for i in s:
if i =="-":
count1+=1
else:
count2+=1
if count2==0 or count1==0:
print("YES")
else:
if count1%count2==0:
print("YES")
else:
print("NO")
``` | output | 1 | 99,230 | 14 | 198,461 |
Provide a correct Python 3 solution for this coding contest problem.
Niwango-kun has \\(N\\) chickens as his pets. The chickens are identified by numbers \\(1\\) to \\(N\\), and the size of the \\(i\\)-th chicken is a positive integer \\(a_i\\).
\\(N\\) chickens decided to take each other's hand (wing) and form some ... | instruction | 0 | 99,325 | 14 | 198,650 |
"Correct Solution:
```
from math import gcd
mod=998244353
N=int(input())
a=list(map(int,input().split()))
a.sort()
ans=1
for i in range(N):
g=gcd(i,a[i])
ans=(ans*g)%mod
print(ans)
``` | output | 1 | 99,325 | 14 | 198,651 |
Provide a correct Python 3 solution for this coding contest problem.
Niwango-kun has \\(N\\) chickens as his pets. The chickens are identified by numbers \\(1\\) to \\(N\\), and the size of the \\(i\\)-th chicken is a positive integer \\(a_i\\).
\\(N\\) chickens decided to take each other's hand (wing) and form some ... | instruction | 0 | 99,326 | 14 | 198,652 |
"Correct Solution:
```
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
from fractions import gcd
from functools import reduce
MOD = 998244353
N,*A = map(int,read().split())
A.sort()
"""
安い鳥から追加していく。(サイクルの個数 -> 美しさ)が多項... | output | 1 | 99,326 | 14 | 198,653 |
Provide a correct Python 3 solution for this coding contest problem.
Niwango-kun has \\(N\\) chickens as his pets. The chickens are identified by numbers \\(1\\) to \\(N\\), and the size of the \\(i\\)-th chicken is a positive integer \\(a_i\\).
\\(N\\) chickens decided to take each other's hand (wing) and form some ... | instruction | 0 | 99,327 | 14 | 198,654 |
"Correct Solution:
```
N = int(input())
a = list(map(int,input().split()))
Mod = 998244353
def gcd(a, b):
while b:
a, b = b, a % b
return a
a.sort()
ans = 1
for i in range(N):
ans *= gcd(a[i],i)
ans %= Mod
print(ans)
``` | output | 1 | 99,327 | 14 | 198,655 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Niwango-kun has \\(N\\) chickens as his pets. The chickens are identified by numbers \\(1\\) to \\(N\\), and the size of the \\(i\\)-th chicken is a positive integer \\(a_i\\).
\\(N\\) chickens... | instruction | 0 | 99,328 | 14 | 198,656 |
No | output | 1 | 99,328 | 14 | 198,657 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Niwango-kun has \\(N\\) chickens as his pets. The chickens are identified by numbers \\(1\\) to \\(N\\), and the size of the \\(i\\)-th chicken is a positive integer \\(a_i\\).
\\(N\\) chickens... | instruction | 0 | 99,329 | 14 | 198,658 |
No | output | 1 | 99,329 | 14 | 198,659 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Niwango-kun has \\(N\\) chickens as his pets. The chickens are identified by numbers \\(1\\) to \\(N\\), and the size of the \\(i\\)-th chicken is a positive integer \\(a_i\\).
\\(N\\) chickens... | instruction | 0 | 99,330 | 14 | 198,660 |
No | output | 1 | 99,330 | 14 | 198,661 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Niwango-kun has \\(N\\) chickens as his pets. The chickens are identified by numbers \\(1\\) to \\(N\\), and the size of the \\(i\\)-th chicken is a positive integer \\(a_i\\).
\\(N\\) chickens... | instruction | 0 | 99,331 | 14 | 198,662 |
No | output | 1 | 99,331 | 14 | 198,663 |
Provide a correct Python 3 solution for this coding contest problem.
$N$ sages are sitting around a round table with $N$ seats. Each sage holds chopsticks with his dominant hand to eat his dinner. The following happens in this situation.
* If sage $i$ is right-handed and a left-handed sage sits on his right, a level ... | instruction | 0 | 99,373 | 14 | 198,746 |
"Correct Solution:
```
N = int(input())
a = [int(i) for i in input().split()]
w = [int(i) for i in input().split()]
rightMin = 1001
leftMin = 1001
for i in range(N):
if a[i] == 0:
rightMin = min(rightMin, w[i])
else:
leftMin = min(leftMin, w[i])
if rightMin == 1001 or leftMin == 1001:
pr... | output | 1 | 99,373 | 14 | 198,747 |
Provide a correct Python 3 solution for this coding contest problem.
$N$ sages are sitting around a round table with $N$ seats. Each sage holds chopsticks with his dominant hand to eat his dinner. The following happens in this situation.
* If sage $i$ is right-handed and a left-handed sage sits on his right, a level ... | instruction | 0 | 99,374 | 14 | 198,748 |
"Correct Solution:
```
n = int(input())
a = list(map(int,input().split()))
w = list(map(int,input().split()))
INF = 10**9
x = [INF]*2
for i in range(n):
x[a[i]] = min(x[a[i]], w[i])
ans = sum(x)
if ans >= INF:
ans = 0
print(ans)
``` | output | 1 | 99,374 | 14 | 198,749 |
Provide a correct Python 3 solution for this coding contest problem.
$N$ sages are sitting around a round table with $N$ seats. Each sage holds chopsticks with his dominant hand to eat his dinner. The following happens in this situation.
* If sage $i$ is right-handed and a left-handed sage sits on his right, a level ... | instruction | 0 | 99,375 | 14 | 198,750 |
"Correct Solution:
```
N = input()
a = [int(x) for x in input().split()]
w = [int(x) for x in input().split()]
R = [w for a, w in zip(a, w) if a == 0]
L = [w for a, w in zip(a, w) if a == 1]
if R and L:
print(min(R) + min(L))
else:
print(0)
``` | output | 1 | 99,375 | 14 | 198,751 |
Provide a correct Python 3 solution for this coding contest problem.
$N$ sages are sitting around a round table with $N$ seats. Each sage holds chopsticks with his dominant hand to eat his dinner. The following happens in this situation.
* If sage $i$ is right-handed and a left-handed sage sits on his right, a level ... | instruction | 0 | 99,376 | 14 | 198,752 |
"Correct Solution:
```
n = int(input())
alst = list(map(int, input().split()))
wlst = list(map(int, input().split()))
right = [w for a, w in zip(alst, wlst) if a == 0]
left = [w for a, w in zip(alst, wlst) if a == 1]
if right and left:
print(min(right) + min(left))
else:
print(0)
``` | output | 1 | 99,376 | 14 | 198,753 |
Provide a correct Python 3 solution for this coding contest problem.
$N$ sages are sitting around a round table with $N$ seats. Each sage holds chopsticks with his dominant hand to eat his dinner. The following happens in this situation.
* If sage $i$ is right-handed and a left-handed sage sits on his right, a level ... | instruction | 0 | 99,377 | 14 | 198,754 |
"Correct Solution:
```
N = int(input())
*A, = map(int, input().split())
*W, = map(int, input().split())
INF = 10**9
l = r = INF
for a, w in zip(A, W):
if a:
r = min(w, r)
else:
l = min(w, l)
if l == INF or r == INF:
print(0)
else:
print(l+r)
``` | output | 1 | 99,377 | 14 | 198,755 |
Provide a correct Python 3 solution for this coding contest problem.
$N$ sages are sitting around a round table with $N$ seats. Each sage holds chopsticks with his dominant hand to eat his dinner. The following happens in this situation.
* If sage $i$ is right-handed and a left-handed sage sits on his right, a level ... | instruction | 0 | 99,378 | 14 | 198,756 |
"Correct Solution:
```
n = int(input())
a = [int(_) for _ in input().split()]
w = [int(_) for _ in input().split()]
if sum(a) == n or sum(a) == 0:
print(0)
quit()
lia = []
lib = []
for i in range(n):
if a[i] == 0:
lia.append(w[i])
else:
lib.append(w[i])
print(min(lia)+min(lib))
``` | output | 1 | 99,378 | 14 | 198,757 |
Provide a correct Python 3 solution for this coding contest problem.
$N$ sages are sitting around a round table with $N$ seats. Each sage holds chopsticks with his dominant hand to eat his dinner. The following happens in this situation.
* If sage $i$ is right-handed and a left-handed sage sits on his right, a level ... | instruction | 0 | 99,379 | 14 | 198,758 |
"Correct Solution:
```
n = int(input())
aw = [[0,0] for i in range(n)]
for i, a in enumerate(map(int, input().split())): aw[i][0] = a
for i, w in enumerate(map(int, input().split())): aw[i][1] = w
migimin = 1001
hidarimin = 1001
for a,w in aw:
if a: hidarimin = min(hidarimin, w)
else: migimin = min(migimin, w)
... | output | 1 | 99,379 | 14 | 198,759 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Jack has become a soldier now. Unfortunately, he has trouble with the drill. Instead of marching beginning with the left foot and then changing legs with each step, as ordered, he keeps repeating a sequence of steps, in which he sometimes ma... | instruction | 0 | 99,567 | 14 | 199,134 |
Tags: binary search, dp, greedy
Correct Solution:
```
def solve():
original = input()
temp = [original[0]]
for i in range(1, len(original)):
if original[i] == original[i - 1] != 'X':
temp.append('X')
temp.append(original[i])
augmented = ''.join(temp)
answer = 0
if aug... | output | 1 | 99,567 | 14 | 199,135 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Jack has become a soldier now. Unfortunately, he has trouble with the drill. Instead of marching beginning with the left foot and then changing legs with each step, as ordered, he keeps repeating a sequence of steps, in which he sometimes ma... | instruction | 0 | 99,568 | 14 | 199,136 |
Tags: binary search, dp, greedy
Correct Solution:
```
__author__ = 'Darren'
def solve():
original = input()
temp = [original[0]]
for i in range(1, len(original)):
if original[i] == original[i-1] != 'X':
temp.append('X')
temp.append(original[i])
augmented = ''.join(temp)
... | output | 1 | 99,568 | 14 | 199,137 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This is the easy version of the problem. The difference is constraints on the number of wise men and the time limit. You can make hacks only if all versions of this task are solved.
n wise men live in a beautiful city. Some of them know eac... | instruction | 0 | 99,592 | 14 | 199,184 |
Tags: bitmasks, brute force, dp, meet-in-the-middle
Correct Solution:
```
from sys import stdout
n = int(input())
class Person:
num = n - 1
def __init__(self, rel):
self.relationship = int(rel, 2)
def __getitem__(self, k):
return (self.relationship >> Person.num - k) & 1
rel = [Perso... | output | 1 | 99,592 | 14 | 199,185 |
Provide tags and a correct Python 3 solution for this coding contest problem.
As a tradition, every year before IOI all the members of Natalia Fan Club are invited to Malek Dance Club to have a fun night together. Malek Dance Club has 2n members and coincidentally Natalia Fan Club also has 2n members. Each member of M... | instruction | 0 | 99,730 | 14 | 199,460 |
Tags: combinatorics, math
Correct Solution:
```
x = input()
n = len(x)
mod = 10 ** 9 + 7
ans = 0
for i in range(n):
if x[i] == '1':
pref = pow(2, i, mod)
suf = pow(2, n - i - 1, mod) ** 2
ans += (pref * suf) % mod
print(ans % mod)
``` | output | 1 | 99,730 | 14 | 199,461 |
Provide tags and a correct Python 3 solution for this coding contest problem.
As a tradition, every year before IOI all the members of Natalia Fan Club are invited to Malek Dance Club to have a fun night together. Malek Dance Club has 2n members and coincidentally Natalia Fan Club also has 2n members. Each member of M... | instruction | 0 | 99,731 | 14 | 199,462 |
Tags: combinatorics, math
Correct Solution:
```
#!/usr/local/bin/python3.3 -tt
import sys
if __name__ == '__main__':
for l in sys.stdin:
s = l.strip()
break
n = len(s)
d = 2 ** (n - 1)
print(d * int(s, 2) % 1000000007)
``` | output | 1 | 99,731 | 14 | 199,463 |
Provide tags and a correct Python 3 solution for this coding contest problem.
As a tradition, every year before IOI all the members of Natalia Fan Club are invited to Malek Dance Club to have a fun night together. Malek Dance Club has 2n members and coincidentally Natalia Fan Club also has 2n members. Each member of M... | instruction | 0 | 99,732 | 14 | 199,464 |
Tags: combinatorics, math
Correct Solution:
```
s = input()
s = s[::-1]
ans = 0
for i in range(len(s)):
if s[i] == '1':
ans += ((2 ** i) ** 2) * (2**(len(s) - i - 1))
print(ans % (10**9+7))
``` | output | 1 | 99,732 | 14 | 199,465 |
Provide tags and a correct Python 3 solution for this coding contest problem.
As a tradition, every year before IOI all the members of Natalia Fan Club are invited to Malek Dance Club to have a fun night together. Malek Dance Club has 2n members and coincidentally Natalia Fan Club also has 2n members. Each member of M... | instruction | 0 | 99,733 | 14 | 199,466 |
Tags: combinatorics, math
Correct Solution:
```
p = 1000000007
s = input()
print(int(s,2) * pow(2, len(s) - 1) % p)
# Made By Mostafa_Khaled
``` | output | 1 | 99,733 | 14 | 199,467 |
Provide tags and a correct Python 3 solution for this coding contest problem.
As a tradition, every year before IOI all the members of Natalia Fan Club are invited to Malek Dance Club to have a fun night together. Malek Dance Club has 2n members and coincidentally Natalia Fan Club also has 2n members. Each member of M... | instruction | 0 | 99,734 | 14 | 199,468 |
Tags: combinatorics, math
Correct Solution:
```
n = input().strip()
s = len(n)
k = int(n,2)
start = 4 **( s-1)
zib = 2**(s-1)
step = 2**(s-1)
print((start+(k-zib)*step)%(10**9+7))
``` | output | 1 | 99,734 | 14 | 199,469 |
Provide tags and a correct Python 3 solution for this coding contest problem.
As a tradition, every year before IOI all the members of Natalia Fan Club are invited to Malek Dance Club to have a fun night together. Malek Dance Club has 2n members and coincidentally Natalia Fan Club also has 2n members. Each member of M... | instruction | 0 | 99,735 | 14 | 199,470 |
Tags: combinatorics, math
Correct Solution:
```
MOD = int(1e9 + 7)
x = input()[::-1]
n = len(x)
res = 0
for i, t in enumerate(x):
if t == '1':
res = (res + (1 << (n - 1 + i))) % MOD
print(res)
``` | output | 1 | 99,735 | 14 | 199,471 |
Provide tags and a correct Python 3 solution for this coding contest problem.
As a tradition, every year before IOI all the members of Natalia Fan Club are invited to Malek Dance Club to have a fun night together. Malek Dance Club has 2n members and coincidentally Natalia Fan Club also has 2n members. Each member of M... | instruction | 0 | 99,736 | 14 | 199,472 |
Tags: combinatorics, math
Correct Solution:
```
MOD = 1000000007
ans = 0
x = input().strip()
n = len(x)
for i, v in enumerate(x):
if v == "1":
ans += pow(2, i, MOD) * pow(2, (n - i - 1) * 2, MOD) % MOD
ans %= MOD
print(ans)
``` | output | 1 | 99,736 | 14 | 199,473 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
As a tradition, every year before IOI all the members of Natalia Fan Club are invited to Malek Dance Club to have a fun night together. Malek Dance Club has 2n members and coincidentally Natalia... | instruction | 0 | 99,737 | 14 | 199,474 |
No | output | 1 | 99,737 | 14 | 199,475 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
As a tradition, every year before IOI all the members of Natalia Fan Club are invited to Malek Dance Club to have a fun night together. Malek Dance Club has 2n members and coincidentally Natalia... | instruction | 0 | 99,738 | 14 | 199,476 |
No | output | 1 | 99,738 | 14 | 199,477 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
As a tradition, every year before IOI all the members of Natalia Fan Club are invited to Malek Dance Club to have a fun night together. Malek Dance Club has 2n members and coincidentally Natalia... | instruction | 0 | 99,739 | 14 | 199,478 |
No | output | 1 | 99,739 | 14 | 199,479 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Kolya loves putting gnomes at the circle table and giving them coins, and Tanya loves studying triplets of gnomes, sitting in the vertexes of an equilateral triangle.
More formally, there are 3n gnomes sitting in a circle. Each gnome can ha... | instruction | 0 | 99,829 | 14 | 199,658 |
Tags: combinatorics
Correct Solution:
```
n=int(input())
ans=27**n-7**n
mod=10**9+7
print(ans%mod)
``` | output | 1 | 99,829 | 14 | 199,659 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Kolya loves putting gnomes at the circle table and giving them coins, and Tanya loves studying triplets of gnomes, sitting in the vertexes of an equilateral triangle.
More formally, there are 3n gnomes sitting in a circle. Each gnome can ha... | instruction | 0 | 99,830 | 14 | 199,660 |
Tags: combinatorics
Correct Solution:
```
n=int(input())
p=9**n*3**n
print((p-7**n)%1000000007)
``` | output | 1 | 99,830 | 14 | 199,661 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Kolya loves putting gnomes at the circle table and giving them coins, and Tanya loves studying triplets of gnomes, sitting in the vertexes of an equilateral triangle.
More formally, there are 3n gnomes sitting in a circle. Each gnome can ha... | instruction | 0 | 99,831 | 14 | 199,662 |
Tags: combinatorics
Correct Solution:
```
n = input()
a, b = 20, 7
for i in range(1, int(n)):
a, b = a*27+b*20, b*7
a %= 1000000007
b %= 1000000007
print(a)
``` | output | 1 | 99,831 | 14 | 199,663 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Kolya loves putting gnomes at the circle table and giving them coins, and Tanya loves studying triplets of gnomes, sitting in the vertexes of an equilateral triangle.
More formally, there are 3n gnomes sitting in a circle. Each gnome can ha... | instruction | 0 | 99,832 | 14 | 199,664 |
Tags: combinatorics
Correct Solution:
```
'''
1 1 1
1 1 2
1 2 2
1 1 3
1 3 3
1 2 3
bad combo
3**(3*n)-badcombo
'''
n=int(input())
x=pow(3,3*n)-pow(7,n)
print(x%(10**9+7))
``` | output | 1 | 99,832 | 14 | 199,665 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Kolya loves putting gnomes at the circle table and giving them coins, and Tanya loves studying triplets of gnomes, sitting in the vertexes of an equilateral triangle.
More formally, there are 3n gnomes sitting in a circle. Each gnome can ha... | instruction | 0 | 99,833 | 14 | 199,666 |
Tags: combinatorics
Correct Solution:
```
n = int(input())
print((27 ** n - 7 ** n) % (10 ** 9 + 7))
``` | output | 1 | 99,833 | 14 | 199,667 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Kolya loves putting gnomes at the circle table and giving them coins, and Tanya loves studying triplets of gnomes, sitting in the vertexes of an equilateral triangle.
More formally, there are 3n gnomes sitting in a circle. Each gnome can ha... | instruction | 0 | 99,834 | 14 | 199,668 |
Tags: combinatorics
Correct Solution:
```
n = int(input())
mod = 10 ** 9 + 7
print((27 ** n - 7 ** n) % mod)
``` | output | 1 | 99,834 | 14 | 199,669 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Kolya loves putting gnomes at the circle table and giving them coins, and Tanya loves studying triplets of gnomes, sitting in the vertexes of an equilateral triangle.
More formally, there are 3n gnomes sitting in a circle. Each gnome can ha... | instruction | 0 | 99,835 | 14 | 199,670 |
Tags: combinatorics
Correct Solution:
```
n = int(input())
res = 1
res2 = 1
for i in range(3 * n):
res = (3 * res) % 1000000007
for i in range(n):
res2 = (7 * res2) % 1000000007
print((res - res2) % 1000000007)
``` | output | 1 | 99,835 | 14 | 199,671 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Kolya loves putting gnomes at the circle table and giving them coins, and Tanya loves studying triplets of gnomes, sitting in the vertexes of an equilateral triangle.
More formally, there are 3n gnomes sitting in a circle. Each gnome can ha... | instruction | 0 | 99,836 | 14 | 199,672 |
Tags: combinatorics
Correct Solution:
```
n = int(input())
ans = 27**n - 7**n
const = 10**9 + 7
print(ans%const)
``` | output | 1 | 99,836 | 14 | 199,673 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Kolya loves putting gnomes at the circle table and giving them coins, and Tanya loves studying triplets of gnomes, sitting in the vertexes of an equilateral triangle.
More formally, there are 3... | instruction | 0 | 99,837 | 14 | 199,674 |
Yes | output | 1 | 99,837 | 14 | 199,675 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Kolya loves putting gnomes at the circle table and giving them coins, and Tanya loves studying triplets of gnomes, sitting in the vertexes of an equilateral triangle.
More formally, there are 3... | instruction | 0 | 99,838 | 14 | 199,676 |
Yes | output | 1 | 99,838 | 14 | 199,677 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Kolya loves putting gnomes at the circle table and giving them coins, and Tanya loves studying triplets of gnomes, sitting in the vertexes of an equilateral triangle.
More formally, there are 3... | instruction | 0 | 99,839 | 14 | 199,678 |
Yes | output | 1 | 99,839 | 14 | 199,679 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Kolya loves putting gnomes at the circle table and giving them coins, and Tanya loves studying triplets of gnomes, sitting in the vertexes of an equilateral triangle.
More formally, there are 3... | instruction | 0 | 99,840 | 14 | 199,680 |
Yes | output | 1 | 99,840 | 14 | 199,681 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Kolya loves putting gnomes at the circle table and giving them coins, and Tanya loves studying triplets of gnomes, sitting in the vertexes of an equilateral triangle.
More formally, there are 3... | instruction | 0 | 99,841 | 14 | 199,682 |
No | output | 1 | 99,841 | 14 | 199,683 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.