message stringlengths 2 44.5k | message_type stringclasses 2 values | message_id int64 0 1 | conversation_id int64 276 109k | cluster float64 23 23 | __index_level_0__ int64 552 217k |
|---|---|---|---|---|---|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Peter had a cube with non-zero length of a side. He put the cube into three-dimensional space in such a way that its vertices lay at integer points (it is possible that the cube's sides are not parallel to the coordinate axes). Then he took a piece of paper and wrote down eight lines, each containing three integers — coordinates of cube's vertex (a single line contains coordinates of a single vertex, each vertex is written exactly once), put the paper on the table and left. While Peter was away, his little brother Nick decided to play with the numbers on the paper. In one operation Nick could swap some numbers inside a single line (Nick didn't swap numbers from distinct lines). Nick could have performed any number of such operations.
When Peter returned and found out about Nick's mischief, he started recollecting the original coordinates. Help Peter restore the original position of the points or else state that this is impossible and the numbers were initially recorded incorrectly.
Input
Each of the eight lines contains three space-separated integers — the numbers written on the piece of paper after Nick's mischief. All numbers do not exceed 106 in their absolute value.
Output
If there is a way to restore the cube, then print in the first line "YES". In each of the next eight lines print three integers — the restored coordinates of the points. The numbers in the i-th output line must be a permutation of the numbers in i-th input line. The numbers should represent the vertices of a cube with non-zero length of a side. If there are multiple possible ways, print any of them.
If there is no valid way, print "NO" (without the quotes) in the first line. Do not print anything else.
Examples
Input
0 0 0
0 0 1
0 0 1
0 0 1
0 1 1
0 1 1
0 1 1
1 1 1
Output
YES
0 0 0
0 0 1
0 1 0
1 0 0
0 1 1
1 0 1
1 1 0
1 1 1
Input
0 0 0
0 0 0
0 0 0
0 0 0
1 1 1
1 1 1
1 1 1
1 1 1
Output
NO
Submitted Solution:
```
perm = [[0, 1, 2],
[0, 2, 1],
[1, 0, 2],
[1, 2, 0],
[2, 0, 1],
[2, 1, 0]]
coords = []
flag = False
def check():
global flag
lens = []
for i in range(8):
lens.append({})
alls = []
for i in range(8):
for j in range(8):
if i != j:
d = 0
for k in range(3):
d += (coords[i][k] - coords[j][k]) ** 2
if (d not in lens[i]):
lens[i][d] = 0
lens[i][d] += 1
lns = list(lens[i])
if len(lns) != 3:
break
lns.sort()
if not (lens[i][lns[0]] == 3 and lens[i][lns[1]] == 3 and lens[i][lns[2]] == 1):
break
if not (lens[i][lns[0]] * 3 != lens[i][lns[2]]):
break
if not (lens[i][lns[0]] * 2 != lens[i][lns[1]]):
break
alls.append(lns)
mflag = True
if len(alls) == 8:
for i in range(8):
for j in range(8):
for k in range(3):
if alls[i][k] != alls[j][k]:
mflag = False
break
if mflag:
print('YES')
flag = True
for i in range(8):
print(' '.join(map(str, coords[i])))
pass
def rec(n):
global flag
if flag:
return
if n == 8:
check()
else:
oldcor = coords[n][0], coords[n][1], coords[n][2]
for p in perm:
coords[n] = [oldcor[p[0]], oldcor[p[1]], oldcor[p[2]]]
pflag = True
for j in range(n):
if coords[n][0] == coords[j][0] and coords[n][1] == coords[j][1] and coords[n][2] == coords[j][2]:
pflag = False
if pflag:
rec(n + 1)
if flag:
return
coords[n] = [oldcor[0], oldcor[1], oldcor[2]]
for i in range(8):
coords.append(list(map(int, input().split())))
rec(0)
if not flag:
print('NO')
``` | instruction | 0 | 33,762 | 23 | 67,524 |
No | output | 1 | 33,762 | 23 | 67,525 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Peter had a cube with non-zero length of a side. He put the cube into three-dimensional space in such a way that its vertices lay at integer points (it is possible that the cube's sides are not parallel to the coordinate axes). Then he took a piece of paper and wrote down eight lines, each containing three integers — coordinates of cube's vertex (a single line contains coordinates of a single vertex, each vertex is written exactly once), put the paper on the table and left. While Peter was away, his little brother Nick decided to play with the numbers on the paper. In one operation Nick could swap some numbers inside a single line (Nick didn't swap numbers from distinct lines). Nick could have performed any number of such operations.
When Peter returned and found out about Nick's mischief, he started recollecting the original coordinates. Help Peter restore the original position of the points or else state that this is impossible and the numbers were initially recorded incorrectly.
Input
Each of the eight lines contains three space-separated integers — the numbers written on the piece of paper after Nick's mischief. All numbers do not exceed 106 in their absolute value.
Output
If there is a way to restore the cube, then print in the first line "YES". In each of the next eight lines print three integers — the restored coordinates of the points. The numbers in the i-th output line must be a permutation of the numbers in i-th input line. The numbers should represent the vertices of a cube with non-zero length of a side. If there are multiple possible ways, print any of them.
If there is no valid way, print "NO" (without the quotes) in the first line. Do not print anything else.
Examples
Input
0 0 0
0 0 1
0 0 1
0 0 1
0 1 1
0 1 1
0 1 1
1 1 1
Output
YES
0 0 0
0 0 1
0 1 0
1 0 0
0 1 1
1 0 1
1 1 0
1 1 1
Input
0 0 0
0 0 0
0 0 0
0 0 0
1 1 1
1 1 1
1 1 1
1 1 1
Output
NO
Submitted Solution:
```
perm = [[0, 1, 2],
[0, 2, 1],
[1, 0, 2],
[1, 2, 0],
[2, 0, 1],
[2, 1, 0]]
coords = []
flag = False
def check():
global flag
lens = []
for i in range(8):
lens.append({})
alls = []
for i in range(8):
for j in range(8):
if i != j:
d = 0
for k in range(3):
d += (coords[i][k] - coords[j][k]) ** 2
if (d not in lens[i]):
lens[i][d] = 0
lens[i][d] += 1
lns = list(lens[i])
if len(lns) != 3:
break
lns.sort()
if not (lens[i][lns[0]] == 3 and lens[i][lns[1]] == 3 and lens[i][lns[2]] == 1):
break
alls.append(lns)
mflag = True
if len(alls) == 8:
for i in range(8):
for j in range(8):
for k in range(3):
if alls[i][k] != alls[j][k]:
mflag = False
break
if mflag:
print('YES')
flag = True
for i in range(8):
print(' '.join(map(str, coords[i])))
pass
def rec(n):
global flag
if flag:
return
if n == 8:
check()
else:
oldcor = coords[n][0], coords[n][1], coords[n][2]
for p in perm:
coords[n] = [oldcor[p[0]], oldcor[p[1]], oldcor[p[2]]]
pflag = True
for j in range(n):
if coords[n][0] == coords[j][0] and coords[n][1] == coords[j][1] and coords[n][2] == coords[j][2]:
pflag = False
if pflag:
rec(n + 1)
if flag:
return
coords[n] = [oldcor[0], oldcor[1], oldcor[2]]
for i in range(8):
coords.append(list(map(int, input().split())))
rec(0)
if not flag:
print('NO')
``` | instruction | 0 | 33,763 | 23 | 67,526 |
No | output | 1 | 33,763 | 23 | 67,527 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Peter had a cube with non-zero length of a side. He put the cube into three-dimensional space in such a way that its vertices lay at integer points (it is possible that the cube's sides are not parallel to the coordinate axes). Then he took a piece of paper and wrote down eight lines, each containing three integers — coordinates of cube's vertex (a single line contains coordinates of a single vertex, each vertex is written exactly once), put the paper on the table and left. While Peter was away, his little brother Nick decided to play with the numbers on the paper. In one operation Nick could swap some numbers inside a single line (Nick didn't swap numbers from distinct lines). Nick could have performed any number of such operations.
When Peter returned and found out about Nick's mischief, he started recollecting the original coordinates. Help Peter restore the original position of the points or else state that this is impossible and the numbers were initially recorded incorrectly.
Input
Each of the eight lines contains three space-separated integers — the numbers written on the piece of paper after Nick's mischief. All numbers do not exceed 106 in their absolute value.
Output
If there is a way to restore the cube, then print in the first line "YES". In each of the next eight lines print three integers — the restored coordinates of the points. The numbers in the i-th output line must be a permutation of the numbers in i-th input line. The numbers should represent the vertices of a cube with non-zero length of a side. If there are multiple possible ways, print any of them.
If there is no valid way, print "NO" (without the quotes) in the first line. Do not print anything else.
Examples
Input
0 0 0
0 0 1
0 0 1
0 0 1
0 1 1
0 1 1
0 1 1
1 1 1
Output
YES
0 0 0
0 0 1
0 1 0
1 0 0
0 1 1
1 0 1
1 1 0
1 1 1
Input
0 0 0
0 0 0
0 0 0
0 0 0
1 1 1
1 1 1
1 1 1
1 1 1
Output
NO
Submitted Solution:
```
from itertools import permutations as p
d = lambda a, b: sum((i - j) ** 2 for i, j in zip(a, b))
f = lambda a, b: [i + j - k for i, j, k in zip(a, b, q)]
g = lambda t: sorted(sorted(q) for q in t)
v = [sorted(map(int, input().split())) for i in range(8)]
q = v.pop()
def yes(t):
print('YES')
d = {}
for q in t:
s = str(sorted(q))
d[s] = d.get(s, []) + [q]
for q in v:
i, j, k = d[str(q)].pop()
print(i, j, k)
exit()
u = g(v)
for a, b, c in p(v, 3):
for x in p(a):
s = 2 * d(q, x)
if s == 0: continue
for y in p(b):
if not 2 * d(q, y) == d(x, y) == s: continue
for z in p(c):
if not 2 * d(q, z) == d(x, z) == d(y, z) == s: continue
t = [x, y, z] + [f(x, y), f(x, z), f(y, z), f(f(x, y), z)]
if g(t) == u: yes(t + [q])
print('NO')
``` | instruction | 0 | 33,764 | 23 | 67,528 |
No | output | 1 | 33,764 | 23 | 67,529 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Gerald bought two very rare paintings at the Sotheby's auction and he now wants to hang them on the wall. For that he bought a special board to attach it to the wall and place the paintings on the board. The board has shape of an a1 × b1 rectangle, the paintings have shape of a a2 × b2 and a3 × b3 rectangles.
Since the paintings are painted in the style of abstract art, it does not matter exactly how they will be rotated, but still, one side of both the board, and each of the paintings must be parallel to the floor. The paintings can touch each other and the edges of the board, but can not overlap or go beyond the edge of the board. Gerald asks whether it is possible to place the paintings on the board, or is the board he bought not large enough?
Input
The first line contains two space-separated numbers a1 and b1 — the sides of the board. Next two lines contain numbers a2, b2, a3 and b3 — the sides of the paintings. All numbers ai, bi in the input are integers and fit into the range from 1 to 1000.
Output
If the paintings can be placed on the wall, print "YES" (without the quotes), and if they cannot, print "NO" (without the quotes).
Examples
Input
3 2
1 3
2 1
Output
YES
Input
5 5
3 3
3 3
Output
NO
Input
4 2
2 3
1 2
Output
YES
Note
That's how we can place the pictures in the first test:
<image>
And that's how we can do it in the third one.
<image>
Submitted Solution:
```
I=lambda:[*map(int,input().split())]
z,u,v=I(),I(),I()
r=0
for x,y in (z,z[::-1]):
for a,b in (u,u[::-1]):
for c,d in (v,v[::-1]):
r|=a+c<=x and max(b,d)<=y
print('YNEOS'[1-r::2])
``` | instruction | 0 | 33,810 | 23 | 67,620 |
Yes | output | 1 | 33,810 | 23 | 67,621 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Gerald bought two very rare paintings at the Sotheby's auction and he now wants to hang them on the wall. For that he bought a special board to attach it to the wall and place the paintings on the board. The board has shape of an a1 × b1 rectangle, the paintings have shape of a a2 × b2 and a3 × b3 rectangles.
Since the paintings are painted in the style of abstract art, it does not matter exactly how they will be rotated, but still, one side of both the board, and each of the paintings must be parallel to the floor. The paintings can touch each other and the edges of the board, but can not overlap or go beyond the edge of the board. Gerald asks whether it is possible to place the paintings on the board, or is the board he bought not large enough?
Input
The first line contains two space-separated numbers a1 and b1 — the sides of the board. Next two lines contain numbers a2, b2, a3 and b3 — the sides of the paintings. All numbers ai, bi in the input are integers and fit into the range from 1 to 1000.
Output
If the paintings can be placed on the wall, print "YES" (without the quotes), and if they cannot, print "NO" (without the quotes).
Examples
Input
3 2
1 3
2 1
Output
YES
Input
5 5
3 3
3 3
Output
NO
Input
4 2
2 3
1 2
Output
YES
Note
That's how we can place the pictures in the first test:
<image>
And that's how we can do it in the third one.
<image>
Submitted Solution:
```
I=lambda:list(map(int,input().split()))
q=I()
w=I()
e=I()
print(['NO','YES'][any(a+c<=x and y>=max(b,d)for x,y in(q,q[::-1])for a,b in(w,w[::-1])for c,d in(e,e[::-1]))])
``` | instruction | 0 | 33,811 | 23 | 67,622 |
Yes | output | 1 | 33,811 | 23 | 67,623 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Gerald bought two very rare paintings at the Sotheby's auction and he now wants to hang them on the wall. For that he bought a special board to attach it to the wall and place the paintings on the board. The board has shape of an a1 × b1 rectangle, the paintings have shape of a a2 × b2 and a3 × b3 rectangles.
Since the paintings are painted in the style of abstract art, it does not matter exactly how they will be rotated, but still, one side of both the board, and each of the paintings must be parallel to the floor. The paintings can touch each other and the edges of the board, but can not overlap or go beyond the edge of the board. Gerald asks whether it is possible to place the paintings on the board, or is the board he bought not large enough?
Input
The first line contains two space-separated numbers a1 and b1 — the sides of the board. Next two lines contain numbers a2, b2, a3 and b3 — the sides of the paintings. All numbers ai, bi in the input are integers and fit into the range from 1 to 1000.
Output
If the paintings can be placed on the wall, print "YES" (without the quotes), and if they cannot, print "NO" (without the quotes).
Examples
Input
3 2
1 3
2 1
Output
YES
Input
5 5
3 3
3 3
Output
NO
Input
4 2
2 3
1 2
Output
YES
Note
That's how we can place the pictures in the first test:
<image>
And that's how we can do it in the third one.
<image>
Submitted Solution:
```
r = lambda: map(int, input().split())
a1, b1 = r()
a2, b2 = r()
a3, b3 = r()
f = lambda x1, y1, x2, y2: a1 >= x1 + x2 and b1 >= max(y1, y2) or b1 >= y1 + y2 and a1 >= max(x1, x2)
print("YES" if f(a2, b2, a3, b3) or f(a2, b2, b3, a3) or f(b2, a2, a3, b3) or f(b2, a2, b3, a3) else "NO")
``` | instruction | 0 | 33,812 | 23 | 67,624 |
Yes | output | 1 | 33,812 | 23 | 67,625 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Gerald bought two very rare paintings at the Sotheby's auction and he now wants to hang them on the wall. For that he bought a special board to attach it to the wall and place the paintings on the board. The board has shape of an a1 × b1 rectangle, the paintings have shape of a a2 × b2 and a3 × b3 rectangles.
Since the paintings are painted in the style of abstract art, it does not matter exactly how they will be rotated, but still, one side of both the board, and each of the paintings must be parallel to the floor. The paintings can touch each other and the edges of the board, but can not overlap or go beyond the edge of the board. Gerald asks whether it is possible to place the paintings on the board, or is the board he bought not large enough?
Input
The first line contains two space-separated numbers a1 and b1 — the sides of the board. Next two lines contain numbers a2, b2, a3 and b3 — the sides of the paintings. All numbers ai, bi in the input are integers and fit into the range from 1 to 1000.
Output
If the paintings can be placed on the wall, print "YES" (without the quotes), and if they cannot, print "NO" (without the quotes).
Examples
Input
3 2
1 3
2 1
Output
YES
Input
5 5
3 3
3 3
Output
NO
Input
4 2
2 3
1 2
Output
YES
Note
That's how we can place the pictures in the first test:
<image>
And that's how we can do it in the third one.
<image>
Submitted Solution:
```
def solve(a, b, c):
return a[0] >= b[0] + c[0] and a[1] >= max(b[1], c[1])
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
c = [int(x) for x in input().split()]
for i in (1, -1):
for j in (1, -1):
for k in (1, -1):
if solve(a[::i], b[::j], c[::k]):
print('YES')
exit()
print('NO')
``` | instruction | 0 | 33,813 | 23 | 67,626 |
Yes | output | 1 | 33,813 | 23 | 67,627 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Gerald bought two very rare paintings at the Sotheby's auction and he now wants to hang them on the wall. For that he bought a special board to attach it to the wall and place the paintings on the board. The board has shape of an a1 × b1 rectangle, the paintings have shape of a a2 × b2 and a3 × b3 rectangles.
Since the paintings are painted in the style of abstract art, it does not matter exactly how they will be rotated, but still, one side of both the board, and each of the paintings must be parallel to the floor. The paintings can touch each other and the edges of the board, but can not overlap or go beyond the edge of the board. Gerald asks whether it is possible to place the paintings on the board, or is the board he bought not large enough?
Input
The first line contains two space-separated numbers a1 and b1 — the sides of the board. Next two lines contain numbers a2, b2, a3 and b3 — the sides of the paintings. All numbers ai, bi in the input are integers and fit into the range from 1 to 1000.
Output
If the paintings can be placed on the wall, print "YES" (without the quotes), and if they cannot, print "NO" (without the quotes).
Examples
Input
3 2
1 3
2 1
Output
YES
Input
5 5
3 3
3 3
Output
NO
Input
4 2
2 3
1 2
Output
YES
Note
That's how we can place the pictures in the first test:
<image>
And that's how we can do it in the third one.
<image>
Submitted Solution:
```
n,m=map(int,input().split())
a1,b1=map(int,input().split())
a2,b2=map(int,input().split())
z=n*m
p=max(n,m)
ar=(a1*b1)+(a2*b2)
mi=min(a1,b1)+min(a2,b2)
ma=max(a1,b1)+max(a2,b2)
t=0
if(a1<=p and a2<=p and b1<=p and b2<=p):
t=1
if(mi<=max(n,m) and ar<=z and t==1):
print("YES")
else:
print("NO")
``` | instruction | 0 | 33,814 | 23 | 67,628 |
No | output | 1 | 33,814 | 23 | 67,629 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Gerald bought two very rare paintings at the Sotheby's auction and he now wants to hang them on the wall. For that he bought a special board to attach it to the wall and place the paintings on the board. The board has shape of an a1 × b1 rectangle, the paintings have shape of a a2 × b2 and a3 × b3 rectangles.
Since the paintings are painted in the style of abstract art, it does not matter exactly how they will be rotated, but still, one side of both the board, and each of the paintings must be parallel to the floor. The paintings can touch each other and the edges of the board, but can not overlap or go beyond the edge of the board. Gerald asks whether it is possible to place the paintings on the board, or is the board he bought not large enough?
Input
The first line contains two space-separated numbers a1 and b1 — the sides of the board. Next two lines contain numbers a2, b2, a3 and b3 — the sides of the paintings. All numbers ai, bi in the input are integers and fit into the range from 1 to 1000.
Output
If the paintings can be placed on the wall, print "YES" (without the quotes), and if they cannot, print "NO" (without the quotes).
Examples
Input
3 2
1 3
2 1
Output
YES
Input
5 5
3 3
3 3
Output
NO
Input
4 2
2 3
1 2
Output
YES
Note
That's how we can place the pictures in the first test:
<image>
And that's how we can do it in the third one.
<image>
Submitted Solution:
```
ab = list(map(int,input().split()))
ab1 = list(map(int,input().split()))
ab2 = list(map(int,input().split()))
if ((ab1[0] + ab2[0] <= ab[0] and max(ab1[1],ab2[0]) <= ab[1]) or
(ab1[0] + ab2[1] <= ab[0] and max(ab1[1],ab2[0]) <= ab[1]) or
(ab1[1] + ab2[0] <= ab[0] and max(ab1[0],ab2[1]) <= ab[1]) or
(ab1[1] + ab2[1] <= ab[0] and max(ab1[0],ab2[0]) <= ab[1]) or
(ab1[0] + ab2[0] <= ab[1] and max(ab1[1],ab2[0]) <= ab[0]) or
(ab1[0] + ab2[1] <= ab[1] and max(ab1[1],ab2[0]) <= ab[0]) or
(ab1[1] + ab2[0] <= ab[1] and max(ab1[0],ab2[1]) <= ab[0]) or
(ab1[1] + ab2[1] <= ab[1] and max(ab1[0],ab2[0]) <= ab[0]) ):
print("YES")
else:
print("NO")
``` | instruction | 0 | 33,815 | 23 | 67,630 |
No | output | 1 | 33,815 | 23 | 67,631 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Gerald bought two very rare paintings at the Sotheby's auction and he now wants to hang them on the wall. For that he bought a special board to attach it to the wall and place the paintings on the board. The board has shape of an a1 × b1 rectangle, the paintings have shape of a a2 × b2 and a3 × b3 rectangles.
Since the paintings are painted in the style of abstract art, it does not matter exactly how they will be rotated, but still, one side of both the board, and each of the paintings must be parallel to the floor. The paintings can touch each other and the edges of the board, but can not overlap or go beyond the edge of the board. Gerald asks whether it is possible to place the paintings on the board, or is the board he bought not large enough?
Input
The first line contains two space-separated numbers a1 and b1 — the sides of the board. Next two lines contain numbers a2, b2, a3 and b3 — the sides of the paintings. All numbers ai, bi in the input are integers and fit into the range from 1 to 1000.
Output
If the paintings can be placed on the wall, print "YES" (without the quotes), and if they cannot, print "NO" (without the quotes).
Examples
Input
3 2
1 3
2 1
Output
YES
Input
5 5
3 3
3 3
Output
NO
Input
4 2
2 3
1 2
Output
YES
Note
That's how we can place the pictures in the first test:
<image>
And that's how we can do it in the third one.
<image>
Submitted Solution:
```
n,m=map(int,input().split())
a1,b1=map(int,input().split())
a2,b2=map(int,input().split())
z=n*m
mi=min(a1,b1)+min(a2,b2)
ma=max(a1,b1)+max(a2,b2)
if(mi<=min(n,m)):
print("YES")
else:
print("NO")
``` | instruction | 0 | 33,816 | 23 | 67,632 |
No | output | 1 | 33,816 | 23 | 67,633 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Gerald bought two very rare paintings at the Sotheby's auction and he now wants to hang them on the wall. For that he bought a special board to attach it to the wall and place the paintings on the board. The board has shape of an a1 × b1 rectangle, the paintings have shape of a a2 × b2 and a3 × b3 rectangles.
Since the paintings are painted in the style of abstract art, it does not matter exactly how they will be rotated, but still, one side of both the board, and each of the paintings must be parallel to the floor. The paintings can touch each other and the edges of the board, but can not overlap or go beyond the edge of the board. Gerald asks whether it is possible to place the paintings on the board, or is the board he bought not large enough?
Input
The first line contains two space-separated numbers a1 and b1 — the sides of the board. Next two lines contain numbers a2, b2, a3 and b3 — the sides of the paintings. All numbers ai, bi in the input are integers and fit into the range from 1 to 1000.
Output
If the paintings can be placed on the wall, print "YES" (without the quotes), and if they cannot, print "NO" (without the quotes).
Examples
Input
3 2
1 3
2 1
Output
YES
Input
5 5
3 3
3 3
Output
NO
Input
4 2
2 3
1 2
Output
YES
Note
That's how we can place the pictures in the first test:
<image>
And that's how we can do it in the third one.
<image>
Submitted Solution:
```
n,m=map(int,input().split())
a1,b1=map(int,input().split())
a2,b2=map(int,input().split())
z=n*m
ar=(a1*b1)+(a2*b2)
mi=min(a1,b1)+min(a2,b2)
ma=max(a1,b1)+max(a2,b2)
if(ar<=z):
print("YES")
else:
print("NO")
``` | instruction | 0 | 33,817 | 23 | 67,634 |
No | output | 1 | 33,817 | 23 | 67,635 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given n points on the straight line — the positions (x-coordinates) of the cities and m points on the same line — the positions (x-coordinates) of the cellular towers. All towers work in the same way — they provide cellular network for all cities, which are located at the distance which is no more than r from this tower.
Your task is to find minimal r that each city has been provided by cellular network, i.e. for each city there is at least one cellular tower at the distance which is no more than r.
If r = 0 then a tower provides cellular network only for the point where it is located. One tower can provide cellular network for any number of cities, but all these cities must be at the distance which is no more than r from this tower.
Input
The first line contains two positive integers n and m (1 ≤ n, m ≤ 105) — the number of cities and the number of cellular towers.
The second line contains a sequence of n integers a1, a2, ..., an ( - 109 ≤ ai ≤ 109) — the coordinates of cities. It is allowed that there are any number of cities in the same point. All coordinates ai are given in non-decreasing order.
The third line contains a sequence of m integers b1, b2, ..., bm ( - 109 ≤ bj ≤ 109) — the coordinates of cellular towers. It is allowed that there are any number of towers in the same point. All coordinates bj are given in non-decreasing order.
Output
Print minimal r so that each city will be covered by cellular network.
Examples
Input
3 2
-2 2 4
-3 0
Output
4
Input
5 3
1 5 10 14 17
4 11 15
Output
3
Submitted Solution:
```
d=input()
d1=input().split()
d2=input().split()
d1=[int(x) for x in d1]
d2=[int(x) for x in d2]
r=0
for i in d1:
if len(d2)==1:
r=abs(i-d2[0])
elif len(d2)>1:
if abs(i-d2[0])>abs(i-d2[1]):
if abs(i-d2[1])>r:
r=abs(i-d2[1])
d2.pop(0)
else:
r=abs(i-d2[0])
print(r)
``` | instruction | 0 | 33,873 | 23 | 67,746 |
No | output | 1 | 33,873 | 23 | 67,747 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given an integer N. Consider all possible segments on the coordinate axis with endpoints at integer points with coordinates between 0 and N, inclusive; there will be <image> of them.
You want to draw these segments in several layers so that in each layer the segments don't overlap (they might touch at the endpoints though). You can not move the segments to a different location on the coordinate axis.
Find the minimal number of layers you have to use for the given N.
Input
The only input line contains a single integer N (1 ≤ N ≤ 100).
Output
Output a single integer - the minimal number of layers required to draw the segments for the given N.
Examples
Input
2
Output
2
Input
3
Output
4
Input
4
Output
6
Note
As an example, here are the segments and their optimal arrangement into layers for N = 4.
<image> | instruction | 0 | 33,968 | 23 | 67,936 |
Tags: constructive algorithms, math
Correct Solution:
```
n = int(input())
f = [0] * (n + 1)
f[1] = 1
for i in range(2, n + 1):
f[i] = i + f[i - 2]
print(f[n])
``` | output | 1 | 33,968 | 23 | 67,937 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given an integer N. Consider all possible segments on the coordinate axis with endpoints at integer points with coordinates between 0 and N, inclusive; there will be <image> of them.
You want to draw these segments in several layers so that in each layer the segments don't overlap (they might touch at the endpoints though). You can not move the segments to a different location on the coordinate axis.
Find the minimal number of layers you have to use for the given N.
Input
The only input line contains a single integer N (1 ≤ N ≤ 100).
Output
Output a single integer - the minimal number of layers required to draw the segments for the given N.
Examples
Input
2
Output
2
Input
3
Output
4
Input
4
Output
6
Note
As an example, here are the segments and their optimal arrangement into layers for N = 4.
<image> | instruction | 0 | 33,969 | 23 | 67,938 |
Tags: constructive algorithms, math
Correct Solution:
```
a = int(input())
b = a // 2
b = b*(b+1)
if a % 2 == 1:
b += a // 2 + 1
print(b)
``` | output | 1 | 33,969 | 23 | 67,939 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given an integer N. Consider all possible segments on the coordinate axis with endpoints at integer points with coordinates between 0 and N, inclusive; there will be <image> of them.
You want to draw these segments in several layers so that in each layer the segments don't overlap (they might touch at the endpoints though). You can not move the segments to a different location on the coordinate axis.
Find the minimal number of layers you have to use for the given N.
Input
The only input line contains a single integer N (1 ≤ N ≤ 100).
Output
Output a single integer - the minimal number of layers required to draw the segments for the given N.
Examples
Input
2
Output
2
Input
3
Output
4
Input
4
Output
6
Note
As an example, here are the segments and their optimal arrangement into layers for N = 4.
<image> | instruction | 0 | 33,970 | 23 | 67,940 |
Tags: constructive algorithms, math
Correct Solution:
```
n = int(input())
cnt = 0
cur_cnt = 1
for i in range(n, 0, -1):
cnt += min(cur_cnt, i)
cur_cnt += 1
print(cnt)
``` | output | 1 | 33,970 | 23 | 67,941 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given an integer N. Consider all possible segments on the coordinate axis with endpoints at integer points with coordinates between 0 and N, inclusive; there will be <image> of them.
You want to draw these segments in several layers so that in each layer the segments don't overlap (they might touch at the endpoints though). You can not move the segments to a different location on the coordinate axis.
Find the minimal number of layers you have to use for the given N.
Input
The only input line contains a single integer N (1 ≤ N ≤ 100).
Output
Output a single integer - the minimal number of layers required to draw the segments for the given N.
Examples
Input
2
Output
2
Input
3
Output
4
Input
4
Output
6
Note
As an example, here are the segments and their optimal arrangement into layers for N = 4.
<image> | instruction | 0 | 33,971 | 23 | 67,942 |
Tags: constructive algorithms, math
Correct Solution:
```
n = int(input())
print(round((n/2+1)*n/2))
``` | output | 1 | 33,971 | 23 | 67,943 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given an integer N. Consider all possible segments on the coordinate axis with endpoints at integer points with coordinates between 0 and N, inclusive; there will be <image> of them.
You want to draw these segments in several layers so that in each layer the segments don't overlap (they might touch at the endpoints though). You can not move the segments to a different location on the coordinate axis.
Find the minimal number of layers you have to use for the given N.
Input
The only input line contains a single integer N (1 ≤ N ≤ 100).
Output
Output a single integer - the minimal number of layers required to draw the segments for the given N.
Examples
Input
2
Output
2
Input
3
Output
4
Input
4
Output
6
Note
As an example, here are the segments and their optimal arrangement into layers for N = 4.
<image> | instruction | 0 | 33,972 | 23 | 67,944 |
Tags: constructive algorithms, math
Correct Solution:
```
n = int(input());
if n % 2 == 0:
print((n // 2) * (n // 2 + 1));
else:
print((n // 2 + 1) * (n // 2 + 1));
``` | output | 1 | 33,972 | 23 | 67,945 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given an integer N. Consider all possible segments on the coordinate axis with endpoints at integer points with coordinates between 0 and N, inclusive; there will be <image> of them.
You want to draw these segments in several layers so that in each layer the segments don't overlap (they might touch at the endpoints though). You can not move the segments to a different location on the coordinate axis.
Find the minimal number of layers you have to use for the given N.
Input
The only input line contains a single integer N (1 ≤ N ≤ 100).
Output
Output a single integer - the minimal number of layers required to draw the segments for the given N.
Examples
Input
2
Output
2
Input
3
Output
4
Input
4
Output
6
Note
As an example, here are the segments and their optimal arrangement into layers for N = 4.
<image> | instruction | 0 | 33,973 | 23 | 67,946 |
Tags: constructive algorithms, math
Correct Solution:
```
# B.py
n = int(input())
i = (n + 1) // 2
print(i * (n + 1 - i))
``` | output | 1 | 33,973 | 23 | 67,947 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given an integer N. Consider all possible segments on the coordinate axis with endpoints at integer points with coordinates between 0 and N, inclusive; there will be <image> of them.
You want to draw these segments in several layers so that in each layer the segments don't overlap (they might touch at the endpoints though). You can not move the segments to a different location on the coordinate axis.
Find the minimal number of layers you have to use for the given N.
Input
The only input line contains a single integer N (1 ≤ N ≤ 100).
Output
Output a single integer - the minimal number of layers required to draw the segments for the given N.
Examples
Input
2
Output
2
Input
3
Output
4
Input
4
Output
6
Note
As an example, here are the segments and their optimal arrangement into layers for N = 4.
<image> | instruction | 0 | 33,974 | 23 | 67,948 |
Tags: constructive algorithms, math
Correct Solution:
```
n=int(input())
r=0
for i in range(1,n+1):
start=i
say=n-i+1
if say >=i:
say=i
r+=say
print(r)
``` | output | 1 | 33,974 | 23 | 67,949 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given an integer N. Consider all possible segments on the coordinate axis with endpoints at integer points with coordinates between 0 and N, inclusive; there will be <image> of them.
You want to draw these segments in several layers so that in each layer the segments don't overlap (they might touch at the endpoints though). You can not move the segments to a different location on the coordinate axis.
Find the minimal number of layers you have to use for the given N.
Input
The only input line contains a single integer N (1 ≤ N ≤ 100).
Output
Output a single integer - the minimal number of layers required to draw the segments for the given N.
Examples
Input
2
Output
2
Input
3
Output
4
Input
4
Output
6
Note
As an example, here are the segments and their optimal arrangement into layers for N = 4.
<image> | instruction | 0 | 33,975 | 23 | 67,950 |
Tags: constructive algorithms, math
Correct Solution:
```
from math import ceil
N = int(input())
S = (N * (N + 1)) / 2
F = int(ceil(N /2.0))
ans = int((S + F) / 2)
print(ans)
``` | output | 1 | 33,975 | 23 | 67,951 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given an integer N. Consider all possible segments on the coordinate axis with endpoints at integer points with coordinates between 0 and N, inclusive; there will be <image> of them.
You want to draw these segments in several layers so that in each layer the segments don't overlap (they might touch at the endpoints though). You can not move the segments to a different location on the coordinate axis.
Find the minimal number of layers you have to use for the given N.
Input
The only input line contains a single integer N (1 ≤ N ≤ 100).
Output
Output a single integer - the minimal number of layers required to draw the segments for the given N.
Examples
Input
2
Output
2
Input
3
Output
4
Input
4
Output
6
Note
As an example, here are the segments and their optimal arrangement into layers for N = 4.
<image>
Submitted Solution:
```
import math
a=int(input())
if(a==1):
print(1)
elif(a==2):
print(2)
elif(a==3):
print(4)
elif(a==4):
print(6)
else:
b=a
d=a-2
e=1
while(d>0):
if(d>=e):
b+=e
else:
b+=d
d-=1
e+=1
print(b)
``` | instruction | 0 | 33,976 | 23 | 67,952 |
Yes | output | 1 | 33,976 | 23 | 67,953 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given an integer N. Consider all possible segments on the coordinate axis with endpoints at integer points with coordinates between 0 and N, inclusive; there will be <image> of them.
You want to draw these segments in several layers so that in each layer the segments don't overlap (they might touch at the endpoints though). You can not move the segments to a different location on the coordinate axis.
Find the minimal number of layers you have to use for the given N.
Input
The only input line contains a single integer N (1 ≤ N ≤ 100).
Output
Output a single integer - the minimal number of layers required to draw the segments for the given N.
Examples
Input
2
Output
2
Input
3
Output
4
Input
4
Output
6
Note
As an example, here are the segments and their optimal arrangement into layers for N = 4.
<image>
Submitted Solution:
```
#!/usr/bin/env python3
#! -*- coding: utf-8 -*-
def main():
n = int(input())
print((n // 2 + 1) * ((n + 1) // 2))
if __name__ == '__main__':
main()
``` | instruction | 0 | 33,977 | 23 | 67,954 |
Yes | output | 1 | 33,977 | 23 | 67,955 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given an integer N. Consider all possible segments on the coordinate axis with endpoints at integer points with coordinates between 0 and N, inclusive; there will be <image> of them.
You want to draw these segments in several layers so that in each layer the segments don't overlap (they might touch at the endpoints though). You can not move the segments to a different location on the coordinate axis.
Find the minimal number of layers you have to use for the given N.
Input
The only input line contains a single integer N (1 ≤ N ≤ 100).
Output
Output a single integer - the minimal number of layers required to draw the segments for the given N.
Examples
Input
2
Output
2
Input
3
Output
4
Input
4
Output
6
Note
As an example, here are the segments and their optimal arrangement into layers for N = 4.
<image>
Submitted Solution:
```
n = int(input())
def count(n):
if n==0: return 0
if n==1: return 1
elif n<1: return 0
return n+count(n-2)
print(count(n))
``` | instruction | 0 | 33,978 | 23 | 67,956 |
Yes | output | 1 | 33,978 | 23 | 67,957 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given an integer N. Consider all possible segments on the coordinate axis with endpoints at integer points with coordinates between 0 and N, inclusive; there will be <image> of them.
You want to draw these segments in several layers so that in each layer the segments don't overlap (they might touch at the endpoints though). You can not move the segments to a different location on the coordinate axis.
Find the minimal number of layers you have to use for the given N.
Input
The only input line contains a single integer N (1 ≤ N ≤ 100).
Output
Output a single integer - the minimal number of layers required to draw the segments for the given N.
Examples
Input
2
Output
2
Input
3
Output
4
Input
4
Output
6
Note
As an example, here are the segments and their optimal arrangement into layers for N = 4.
<image>
Submitted Solution:
```
from sys import stdin, stdout
from gc import disable
disable()
def f(n:int) -> int:
if (n <= 1):
return n
else:
return f(n-2) + n
n = int(stdin.readline())
stdout.write("%i"%(f(n)))
``` | instruction | 0 | 33,979 | 23 | 67,958 |
Yes | output | 1 | 33,979 | 23 | 67,959 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given an integer N. Consider all possible segments on the coordinate axis with endpoints at integer points with coordinates between 0 and N, inclusive; there will be <image> of them.
You want to draw these segments in several layers so that in each layer the segments don't overlap (they might touch at the endpoints though). You can not move the segments to a different location on the coordinate axis.
Find the minimal number of layers you have to use for the given N.
Input
The only input line contains a single integer N (1 ≤ N ≤ 100).
Output
Output a single integer - the minimal number of layers required to draw the segments for the given N.
Examples
Input
2
Output
2
Input
3
Output
4
Input
4
Output
6
Note
As an example, here are the segments and their optimal arrangement into layers for N = 4.
<image>
Submitted Solution:
```
def main():
x = eval(input())
if (x == 1):
print(1)
else:
print(x*2-2)
main()
``` | instruction | 0 | 33,980 | 23 | 67,960 |
No | output | 1 | 33,980 | 23 | 67,961 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given an integer N. Consider all possible segments on the coordinate axis with endpoints at integer points with coordinates between 0 and N, inclusive; there will be <image> of them.
You want to draw these segments in several layers so that in each layer the segments don't overlap (they might touch at the endpoints though). You can not move the segments to a different location on the coordinate axis.
Find the minimal number of layers you have to use for the given N.
Input
The only input line contains a single integer N (1 ≤ N ≤ 100).
Output
Output a single integer - the minimal number of layers required to draw the segments for the given N.
Examples
Input
2
Output
2
Input
3
Output
4
Input
4
Output
6
Note
As an example, here are the segments and their optimal arrangement into layers for N = 4.
<image>
Submitted Solution:
```
n = int(input())
dic = {}
curr = n
for i in range(1,n+1):
dic[i] = curr
curr -= 1
print(((n//2)+1) * (n//2))
``` | instruction | 0 | 33,981 | 23 | 67,962 |
No | output | 1 | 33,981 | 23 | 67,963 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given an integer N. Consider all possible segments on the coordinate axis with endpoints at integer points with coordinates between 0 and N, inclusive; there will be <image> of them.
You want to draw these segments in several layers so that in each layer the segments don't overlap (they might touch at the endpoints though). You can not move the segments to a different location on the coordinate axis.
Find the minimal number of layers you have to use for the given N.
Input
The only input line contains a single integer N (1 ≤ N ≤ 100).
Output
Output a single integer - the minimal number of layers required to draw the segments for the given N.
Examples
Input
2
Output
2
Input
3
Output
4
Input
4
Output
6
Note
As an example, here are the segments and their optimal arrangement into layers for N = 4.
<image>
Submitted Solution:
```
n=int(input())
l=[]
x=n
for i in range(1,n+1):
for j in range(0,i):
l.append(x)
x=x-1
#print(l)
del l[0]
count=1
i=j=0
while i<len(l):
j=i+1
while j<len(l):
if (l[i]+l[j]==n):
count=count+1
del l[j]
del l[i]
j=i+1
elif (l[i]+l[j]<n):
count=count+1
del l[j]
del l[i]
j=i+1
else:
j=j+1
#print('i=',i,'j=',j)
i=i+1
#print(l)
print(count+len(l))
``` | instruction | 0 | 33,982 | 23 | 67,964 |
No | output | 1 | 33,982 | 23 | 67,965 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given an integer N. Consider all possible segments on the coordinate axis with endpoints at integer points with coordinates between 0 and N, inclusive; there will be <image> of them.
You want to draw these segments in several layers so that in each layer the segments don't overlap (they might touch at the endpoints though). You can not move the segments to a different location on the coordinate axis.
Find the minimal number of layers you have to use for the given N.
Input
The only input line contains a single integer N (1 ≤ N ≤ 100).
Output
Output a single integer - the minimal number of layers required to draw the segments for the given N.
Examples
Input
2
Output
2
Input
3
Output
4
Input
4
Output
6
Note
As an example, here are the segments and their optimal arrangement into layers for N = 4.
<image>
Submitted Solution:
```
n = int(input())
subs = [0] * n
subs[0] = n
for i in range(1, n):
subs[i] = subs[i - 1] - 1
ans = 0
if n == 1:
print(1)
exit()
if n == 2:
print(2)
exit()
for i in range(n - 1, (n - 1) // 2 - 1, -1):
if i == (n - 1) // 2 and n % 2 == 0:
ans += subs[i] // 2
subs[i] -= subs[i] // 2
else:
ans += subs[i]
subs[n - i - 2] -= subs[i]
subs[i] = 0
i = (n - 1) // 2
cur = 0
while i >= 0:
cur += subs[i] * (i + 1)
ans += cur // n
cur %= n
i -= 1
if cur != 0:
ans += 1
print(ans)
``` | instruction | 0 | 33,983 | 23 | 67,966 |
No | output | 1 | 33,983 | 23 | 67,967 |
Provide a correct Python 3 solution for this coding contest problem.
It is known that the area of a regular dodecagon inscribed in a circle of radius a is 3a^2.
Given an integer r, find the area of a regular dodecagon inscribed in a circle of radius r.
Constraints
* 1 \leq r \leq 100
* r is an integer.
Input
Input is given from Standard Input in the following format:
r
Output
Print an integer representing the area of the regular dodecagon.
Examples
Input
4
Output
48
Input
15
Output
675
Input
80
Output
19200 | instruction | 0 | 34,050 | 23 | 68,100 |
"Correct Solution:
```
a=int(input())
print(3*a*a)
``` | output | 1 | 34,050 | 23 | 68,101 |
Provide a correct Python 3 solution for this coding contest problem.
It is known that the area of a regular dodecagon inscribed in a circle of radius a is 3a^2.
Given an integer r, find the area of a regular dodecagon inscribed in a circle of radius r.
Constraints
* 1 \leq r \leq 100
* r is an integer.
Input
Input is given from Standard Input in the following format:
r
Output
Print an integer representing the area of the regular dodecagon.
Examples
Input
4
Output
48
Input
15
Output
675
Input
80
Output
19200 | instruction | 0 | 34,051 | 23 | 68,102 |
"Correct Solution:
```
a = int(input())
print((a**2)*3)
``` | output | 1 | 34,051 | 23 | 68,103 |
Provide a correct Python 3 solution for this coding contest problem.
It is known that the area of a regular dodecagon inscribed in a circle of radius a is 3a^2.
Given an integer r, find the area of a regular dodecagon inscribed in a circle of radius r.
Constraints
* 1 \leq r \leq 100
* r is an integer.
Input
Input is given from Standard Input in the following format:
r
Output
Print an integer representing the area of the regular dodecagon.
Examples
Input
4
Output
48
Input
15
Output
675
Input
80
Output
19200 | instruction | 0 | 34,052 | 23 | 68,104 |
"Correct Solution:
```
r = int(input())
print(int((r**2)*3))
``` | output | 1 | 34,052 | 23 | 68,105 |
Provide a correct Python 3 solution for this coding contest problem.
It is known that the area of a regular dodecagon inscribed in a circle of radius a is 3a^2.
Given an integer r, find the area of a regular dodecagon inscribed in a circle of radius r.
Constraints
* 1 \leq r \leq 100
* r is an integer.
Input
Input is given from Standard Input in the following format:
r
Output
Print an integer representing the area of the regular dodecagon.
Examples
Input
4
Output
48
Input
15
Output
675
Input
80
Output
19200 | instruction | 0 | 34,053 | 23 | 68,106 |
"Correct Solution:
```
r = int(input())
print((r ** 2) * 3)
``` | output | 1 | 34,053 | 23 | 68,107 |
Provide a correct Python 3 solution for this coding contest problem.
It is known that the area of a regular dodecagon inscribed in a circle of radius a is 3a^2.
Given an integer r, find the area of a regular dodecagon inscribed in a circle of radius r.
Constraints
* 1 \leq r \leq 100
* r is an integer.
Input
Input is given from Standard Input in the following format:
r
Output
Print an integer representing the area of the regular dodecagon.
Examples
Input
4
Output
48
Input
15
Output
675
Input
80
Output
19200 | instruction | 0 | 34,054 | 23 | 68,108 |
"Correct Solution:
```
S = int(input())
print(S * S * 3)
``` | output | 1 | 34,054 | 23 | 68,109 |
Provide a correct Python 3 solution for this coding contest problem.
It is known that the area of a regular dodecagon inscribed in a circle of radius a is 3a^2.
Given an integer r, find the area of a regular dodecagon inscribed in a circle of radius r.
Constraints
* 1 \leq r \leq 100
* r is an integer.
Input
Input is given from Standard Input in the following format:
r
Output
Print an integer representing the area of the regular dodecagon.
Examples
Input
4
Output
48
Input
15
Output
675
Input
80
Output
19200 | instruction | 0 | 34,055 | 23 | 68,110 |
"Correct Solution:
```
n=int(input())
n=n*n*3
print(n)
``` | output | 1 | 34,055 | 23 | 68,111 |
Provide a correct Python 3 solution for this coding contest problem.
It is known that the area of a regular dodecagon inscribed in a circle of radius a is 3a^2.
Given an integer r, find the area of a regular dodecagon inscribed in a circle of radius r.
Constraints
* 1 \leq r \leq 100
* r is an integer.
Input
Input is given from Standard Input in the following format:
r
Output
Print an integer representing the area of the regular dodecagon.
Examples
Input
4
Output
48
Input
15
Output
675
Input
80
Output
19200 | instruction | 0 | 34,056 | 23 | 68,112 |
"Correct Solution:
```
n=int(input())
print(n**2*3)
``` | output | 1 | 34,056 | 23 | 68,113 |
Provide a correct Python 3 solution for this coding contest problem.
It is known that the area of a regular dodecagon inscribed in a circle of radius a is 3a^2.
Given an integer r, find the area of a regular dodecagon inscribed in a circle of radius r.
Constraints
* 1 \leq r \leq 100
* r is an integer.
Input
Input is given from Standard Input in the following format:
r
Output
Print an integer representing the area of the regular dodecagon.
Examples
Input
4
Output
48
Input
15
Output
675
Input
80
Output
19200 | instruction | 0 | 34,057 | 23 | 68,114 |
"Correct Solution:
```
r=int(input())
a=3*r**2
print(int(a))
``` | output | 1 | 34,057 | 23 | 68,115 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
It is known that the area of a regular dodecagon inscribed in a circle of radius a is 3a^2.
Given an integer r, find the area of a regular dodecagon inscribed in a circle of radius r.
Constraints
* 1 \leq r \leq 100
* r is an integer.
Input
Input is given from Standard Input in the following format:
r
Output
Print an integer representing the area of the regular dodecagon.
Examples
Input
4
Output
48
Input
15
Output
675
Input
80
Output
19200
Submitted Solution:
```
i = int(input())
print(3*i*i)
``` | instruction | 0 | 34,058 | 23 | 68,116 |
Yes | output | 1 | 34,058 | 23 | 68,117 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
It is known that the area of a regular dodecagon inscribed in a circle of radius a is 3a^2.
Given an integer r, find the area of a regular dodecagon inscribed in a circle of radius r.
Constraints
* 1 \leq r \leq 100
* r is an integer.
Input
Input is given from Standard Input in the following format:
r
Output
Print an integer representing the area of the regular dodecagon.
Examples
Input
4
Output
48
Input
15
Output
675
Input
80
Output
19200
Submitted Solution:
```
N = int(input())
print(N**2*3)
``` | instruction | 0 | 34,059 | 23 | 68,118 |
Yes | output | 1 | 34,059 | 23 | 68,119 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
It is known that the area of a regular dodecagon inscribed in a circle of radius a is 3a^2.
Given an integer r, find the area of a regular dodecagon inscribed in a circle of radius r.
Constraints
* 1 \leq r \leq 100
* r is an integer.
Input
Input is given from Standard Input in the following format:
r
Output
Print an integer representing the area of the regular dodecagon.
Examples
Input
4
Output
48
Input
15
Output
675
Input
80
Output
19200
Submitted Solution:
```
a=int(input())
print(a*a*3)
``` | instruction | 0 | 34,060 | 23 | 68,120 |
Yes | output | 1 | 34,060 | 23 | 68,121 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
It is known that the area of a regular dodecagon inscribed in a circle of radius a is 3a^2.
Given an integer r, find the area of a regular dodecagon inscribed in a circle of radius r.
Constraints
* 1 \leq r \leq 100
* r is an integer.
Input
Input is given from Standard Input in the following format:
r
Output
Print an integer representing the area of the regular dodecagon.
Examples
Input
4
Output
48
Input
15
Output
675
Input
80
Output
19200
Submitted Solution:
```
t = int(input())
print(3*t*t)
``` | instruction | 0 | 34,061 | 23 | 68,122 |
Yes | output | 1 | 34,061 | 23 | 68,123 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
It is known that the area of a regular dodecagon inscribed in a circle of radius a is 3a^2.
Given an integer r, find the area of a regular dodecagon inscribed in a circle of radius r.
Constraints
* 1 \leq r \leq 100
* r is an integer.
Input
Input is given from Standard Input in the following format:
r
Output
Print an integer representing the area of the regular dodecagon.
Examples
Input
4
Output
48
Input
15
Output
675
Input
80
Output
19200
Submitted Solution:
```
import copy
N = int(input())
a = [input() for i in range(N)]
b = copy.deepcopy(a)
for i in b:
del b[i]
print(max(b))
b = copy.deepcopy(a)
``` | instruction | 0 | 34,062 | 23 | 68,124 |
No | output | 1 | 34,062 | 23 | 68,125 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
It is known that the area of a regular dodecagon inscribed in a circle of radius a is 3a^2.
Given an integer r, find the area of a regular dodecagon inscribed in a circle of radius r.
Constraints
* 1 \leq r \leq 100
* r is an integer.
Input
Input is given from Standard Input in the following format:
r
Output
Print an integer representing the area of the regular dodecagon.
Examples
Input
4
Output
48
Input
15
Output
675
Input
80
Output
19200
Submitted Solution:
```
a = int(input())
print("{}".Format(3*a*a))
``` | instruction | 0 | 34,063 | 23 | 68,126 |
No | output | 1 | 34,063 | 23 | 68,127 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
It is known that the area of a regular dodecagon inscribed in a circle of radius a is 3a^2.
Given an integer r, find the area of a regular dodecagon inscribed in a circle of radius r.
Constraints
* 1 \leq r \leq 100
* r is an integer.
Input
Input is given from Standard Input in the following format:
r
Output
Print an integer representing the area of the regular dodecagon.
Examples
Input
4
Output
48
Input
15
Output
675
Input
80
Output
19200
Submitted Solution:
```
a = int(input())
print(3a^2)
``` | instruction | 0 | 34,064 | 23 | 68,128 |
No | output | 1 | 34,064 | 23 | 68,129 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
It is known that the area of a regular dodecagon inscribed in a circle of radius a is 3a^2.
Given an integer r, find the area of a regular dodecagon inscribed in a circle of radius r.
Constraints
* 1 \leq r \leq 100
* r is an integer.
Input
Input is given from Standard Input in the following format:
r
Output
Print an integer representing the area of the regular dodecagon.
Examples
Input
4
Output
48
Input
15
Output
675
Input
80
Output
19200
Submitted Solution:
```
r = float(input())
print(3*r*r)
``` | instruction | 0 | 34,065 | 23 | 68,130 |
No | output | 1 | 34,065 | 23 | 68,131 |
Provide a correct Python 3 solution for this coding contest problem.
Construct an N-gon that satisfies the following conditions:
* The polygon is simple (see notes for the definition).
* Each edge of the polygon is parallel to one of the coordinate axes.
* Each coordinate is an integer between 0 and 10^9, inclusive.
* The vertices are numbered 1 through N in counter-clockwise order.
* The internal angle at the i-th vertex is exactly a_i degrees.
In case there are multiple possible answers, you can output any.
Constraints
* 3 ≤ N ≤ 1000
* a_i is either 90 or 270.
Input
The input is given from Standard Input in the following format:
N
a_1
:
a_N
Output
In case the answer exists, print the answer in the following format:
x_1 y_1
:
x_N y_N
Here (x_i, y_i) are the coordinates of the i-th vertex.
In case the answer doesn't exist, print a single `-1`.
Examples
Input
8
90
90
270
90
90
90
270
90
Output
0 0
2 0
2 1
3 1
3 2
1 2
1 1
0 1
Input
3
90
90
90
Output
-1 | instruction | 0 | 34,144 | 23 | 68,288 |
"Correct Solution:
```
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import itertools
from heapq import heappop, heapify
N,*A = map(int,read().split())
n90 = sum(x == 90 for x in A)
if n90 - (N-n90) != 4:
print(-1)
exit()
x = 0
temp = list(itertools.accumulate(1 if x == 90 else -1 for x in A))
slide = temp.index(min(temp)) + 1
A = A[slide:] + A[:slide]
def F(left_node, right_node, R, depth):
step = 1<<depth
# L:左に曲がるインデックス集合
# R:右に曲がるインデックスのヒープ
if not R:
n1,n2,n3,n4 = [i for i,x in enumerate(left_node) if x is not None]
X = [None] * N
Y = [None] * N
X[n1] = step; Y[n1] = 0
X[n2] = step; Y[n2] = step
X[n3] = 0; Y[n3] = step
X[n4] = 0; Y[n4] = 0
return X,Y
r = heappop(R); l = left_node[r]
# l番:90度、r番:270度 を消し飛ばす
ll = left_node[l]; rr = right_node[r]
left_node[rr] = ll; right_node[ll] = rr
left_node[l] = None; left_node[r] = None
right_node[l] = None; right_node[r] = None
X,Y = F(left_node,right_node,R,depth+1)
# 90,270を追加する
dx = X[rr] - X[ll]; dy = Y[rr] - Y[ll]
if dx > 0:
Y[rr] += step
X[l] = X[rr] - step; Y[l] = Y[ll]
X[r] = X[l]; Y[r] = Y[rr]
elif dx < 0:
Y[rr] -= step
X[l] = X[rr] + step; Y[l] = Y[ll]
X[r] = X[l]; Y[r] = Y[rr]
elif dy > 0:
X[rr] -= step
X[l] = X[ll]; Y[l] = Y[rr] - step
X[r] = X[rr]; Y[r] = Y[l]
elif dy < 0:
X[rr] += step
X[l] = X[ll]; Y[l] = Y[rr] + step
X[r] = X[rr]; Y[r] = Y[l]
return X,Y
R = [i for i,x in enumerate(A) if x == 270]
heapify(R)
X,Y = F(list(range(-1,N-1)),list(range(1,N))+[0],R,0)
# 最初にずらしていた分
X = X[N-slide:] + X[:N-slide]
Y = Y[N-slide:] + Y[:N-slide]
# 最後に座圧して完成
x_to_i = {x:i for i,x in enumerate(sorted(set(X)))}
y_to_i = {y:i for i,y in enumerate(sorted(set(Y)))}
X = [x_to_i[x] for x in X]
Y = [y_to_i[y] for y in Y]
print('\n'.join('{} {}'.format(x,y) for x,y in zip(X,Y)))
``` | output | 1 | 34,144 | 23 | 68,289 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Construct an N-gon that satisfies the following conditions:
* The polygon is simple (see notes for the definition).
* Each edge of the polygon is parallel to one of the coordinate axes.
* Each coordinate is an integer between 0 and 10^9, inclusive.
* The vertices are numbered 1 through N in counter-clockwise order.
* The internal angle at the i-th vertex is exactly a_i degrees.
In case there are multiple possible answers, you can output any.
Constraints
* 3 ≤ N ≤ 1000
* a_i is either 90 or 270.
Input
The input is given from Standard Input in the following format:
N
a_1
:
a_N
Output
In case the answer exists, print the answer in the following format:
x_1 y_1
:
x_N y_N
Here (x_i, y_i) are the coordinates of the i-th vertex.
In case the answer doesn't exist, print a single `-1`.
Examples
Input
8
90
90
270
90
90
90
270
90
Output
0 0
2 0
2 1
3 1
3 2
1 2
1 1
0 1
Input
3
90
90
90
Output
-1
Submitted Solution:
```
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import itertools
from heapq import heappop, heapify
N,*A = map(int,read().split())
n90 = sum(x == 90 for x in A)
if n90 - (N-n90) != 4:
print(-1)
exit()
x = 0
temp = list(itertools.accumulate(1 if x == 90 else -1 for x in A))
slide = temp.index(min(temp)) + 1
A = A[slide:] + A[:slide]
def F(left_node, right_node, R, depth):
step = 1<<depth
# L:左に曲がるインデックス集合
# R:右に曲がるインデックスのヒープ
if not R:
n1,n2,n3,n4 = [i for i,x in enumerate(left_node) if x is not None]
X = [None] * N
Y = [None] * N
X[n1] = step; Y[n1] = 0
X[n2] = step; Y[n2] = step
X[n3] = 0; Y[n3] = step
X[n4] = 0; Y[n4] = 0
return X,Y
r = heappop(R); l = left_node[r]
# l番:90度、r番:270度 を消し飛ばす
ll = left_node[l]; rr = right_node[r]
left_node[rr] = ll; right_node[ll] = rr
left_node[l] = None; left_node[r] = None
right_node[l] = None; right_node[r] = None
X,Y = F(left_node,right_node,R,depth+1)
# 90,270を追加する
dx = X[rr] - X[ll]; dy = Y[rr] - Y[ll]
if dx > 0:
Y[rr] += step
X[l] = X[rr] - step; Y[l] = Y[ll]
X[r] = X[l]; Y[r] = Y[rr]
elif dx < 0:
Y[rr] -= step
X[l] = X[rr] + step; Y[l] = Y[ll]
X[r] = X[l]; Y[r] = Y[rr]
elif dy > 0:
X[rr] -= step
X[l] = X[ll]; Y[l] = Y[rr] - step
X[r] = X[rr]; Y[r] = Y[l]
elif dy < 0:
X[rr] += step
X[l] = X[ll]; Y[l] = Y[rr] + step
X[r] = X[rr]; Y[r] = Y[l]
return X,Y
R = [i for i,x in enumerate(A) if x == 270]
heapify(R)
X,Y = F(list(range(-1,N-1)),list(range(1,N+1)),R,0)
# 最初にずらしていた分
X = X[N-slide:] + X[:N-slide]
Y = Y[N-slide:] + Y[:N-slide]
# 最後に座圧して完成
x_to_i = {x:i for i,x in enumerate(sorted(set(X)))}
y_to_i = {y:i for i,y in enumerate(sorted(set(Y)))}
X = [x_to_i[x] for x in X]
Y = [y_to_i[y] for y in Y]
print('\n'.join('{} {}'.format(x,y) for x,y in zip(X,Y)))
``` | instruction | 0 | 34,145 | 23 | 68,290 |
No | output | 1 | 34,145 | 23 | 68,291 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This problem is same as the next one, but has smaller constraints.
It was a Sunday morning when the three friends Selena, Shiro and Katie decided to have a trip to the nearby power station (do not try this at home). After arriving at the power station, the cats got impressed with a large power transmission system consisting of many chimneys, electric poles, and wires. Since they are cats, they found those things gigantic.
At the entrance of the station, there is a map describing the complicated wiring system. Selena is the best at math among three friends. He decided to draw the map on the Cartesian plane. Each pole is now a point at some coordinates (x_i, y_i). Since every pole is different, all of the points representing these poles are distinct. Also, every two poles are connected with each other by wires. A wire is a straight line on the plane infinite in both directions. If there are more than two poles lying on the same line, they are connected by a single common wire.
Selena thinks, that whenever two different electric wires intersect, they may interfere with each other and cause damage. So he wonders, how many pairs are intersecting? Could you help him with this problem?
Input
The first line contains a single integer n (2 ≤ n ≤ 50) — the number of electric poles.
Each of the following n lines contains two integers x_i, y_i (-10^4 ≤ x_i, y_i ≤ 10^4) — the coordinates of the poles.
It is guaranteed that all of these n points are distinct.
Output
Print a single integer — the number of pairs of wires that are intersecting.
Examples
Input
4
0 0
1 1
0 3
1 2
Output
14
Input
4
0 0
0 2
0 4
2 0
Output
6
Input
3
-1 -1
1 0
3 1
Output
0
Note
In the first example:
<image>
In the second example:
<image>
Note that the three poles (0, 0), (0, 2) and (0, 4) are connected by a single wire.
In the third example:
<image> | instruction | 0 | 34,320 | 23 | 68,640 |
Tags: brute force, geometry
Correct Solution:
```
from math import gcd
n = int(input())
m = [tuple(map(int, input().split())) for i in range(n)]
s = dict()
r = set()
for i in range(n - 1):
for j in range(i + 1, n):
a = m[i][1] - m[j][1]
b = m[i][0] - m[j][0]
c = m[i][1] * m[j][0] - m[j][1] * m[i][0]
t = gcd(a, gcd(b, c))
a //= t
b //= t
c //= t
if a < 0:
a, b, c = -a, -b, -c
elif a == 0 and b < 0:
b, c = -b, -c
if (a, b, c) not in r:
s[(a, b)] = s.get((a, b), 0) + 1
r.add((a, b, c))
ans = len(r) * (len(r) - 1) // 2
for el in s:
ans -= s[el] * (s[el] - 1) // 2
print(ans)
``` | output | 1 | 34,320 | 23 | 68,641 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Kiwon's favorite video game is now holding a new year event to motivate the users! The game is about building and defending a castle, which led Kiwon to think about the following puzzle.
In a 2-dimension plane, you have a set s = \{(x_1, y_1), (x_2, y_2), …, (x_n, y_n)\} consisting of n distinct points. In the set s, no three distinct points lie on a single line. For a point p ∈ s, we can protect this point by building a castle. A castle is a simple quadrilateral (polygon with 4 vertices) that strictly encloses the point p (i.e. the point p is strictly inside a quadrilateral).
Kiwon is interested in the number of 4-point subsets of s that can be used to build a castle protecting p. Note that, if a single subset can be connected in more than one way to enclose a point, it is counted only once.
Let f(p) be the number of 4-point subsets that can enclose the point p. Please compute the sum of f(p) for all points p ∈ s.
Input
The first line contains a single integer n (5 ≤ n ≤ 2 500).
In the next n lines, two integers x_i and y_i (-10^9 ≤ x_i, y_i ≤ 10^9) denoting the position of points are given.
It is guaranteed that all points are distinct, and there are no three collinear points.
Output
Print the sum of f(p) for all points p ∈ s.
Examples
Input
5
-1 0
1 0
-10 -1
10 -1
0 3
Output
2
Input
8
0 1
1 2
2 2
1 3
0 -1
-1 -2
-2 -2
-1 -3
Output
40
Input
10
588634631 265299215
-257682751 342279997
527377039 82412729
145077145 702473706
276067232 912883502
822614418 -514698233
280281434 -41461635
65985059 -827653144
188538640 592896147
-857422304 -529223472
Output
213
Submitted Solution:
```
import sys
input = sys.stdin.readline
from math import atan2
from math import pi
n=int(input())
P=[tuple(map(int,input().split())) for i in range(n)]
sc=(n-1)*(n-2)*(n-3)*(n-4)//24
ANS=0
def calc3(x):
return x*(x-1)*(x-2)//6
for i in range(n):
x,y=P[i]
score=0
Q=[]
for z,w in P[:i]:
Q.append(atan2(w-y,z-x))
for z,w in P[i+1:]:
Q.append(atan2(w-y,z-x))
Q.sort()
Q=Q+[q+2*pi for q in Q]+[100]
#print(Q)
ind=0
for j in range(n-1):
now=Q[j]
while Q[ind]-Q[j]<pi:
ind+=1
if ind-j>=4:
#print(j,ind)
score+=calc3(ind-j-1)
ANS+=sc-score
print(ANS)
``` | instruction | 0 | 34,414 | 23 | 68,828 |
No | output | 1 | 34,414 | 23 | 68,829 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Kiwon's favorite video game is now holding a new year event to motivate the users! The game is about building and defending a castle, which led Kiwon to think about the following puzzle.
In a 2-dimension plane, you have a set s = \{(x_1, y_1), (x_2, y_2), …, (x_n, y_n)\} consisting of n distinct points. In the set s, no three distinct points lie on a single line. For a point p ∈ s, we can protect this point by building a castle. A castle is a simple quadrilateral (polygon with 4 vertices) that strictly encloses the point p (i.e. the point p is strictly inside a quadrilateral).
Kiwon is interested in the number of 4-point subsets of s that can be used to build a castle protecting p. Note that, if a single subset can be connected in more than one way to enclose a point, it is counted only once.
Let f(p) be the number of 4-point subsets that can enclose the point p. Please compute the sum of f(p) for all points p ∈ s.
Input
The first line contains a single integer n (5 ≤ n ≤ 2 500).
In the next n lines, two integers x_i and y_i (-10^9 ≤ x_i, y_i ≤ 10^9) denoting the position of points are given.
It is guaranteed that all points are distinct, and there are no three collinear points.
Output
Print the sum of f(p) for all points p ∈ s.
Examples
Input
5
-1 0
1 0
-10 -1
10 -1
0 3
Output
2
Input
8
0 1
1 2
2 2
1 3
0 -1
-1 -2
-2 -2
-1 -3
Output
40
Input
10
588634631 265299215
-257682751 342279997
527377039 82412729
145077145 702473706
276067232 912883502
822614418 -514698233
280281434 -41461635
65985059 -827653144
188538640 592896147
-857422304 -529223472
Output
213
Submitted Solution:
```
import sys
input = sys.stdin.readline
from functools import cmp_to_key
def cmp(a,b):
if a[0]*b[1]-b[0]*a[1]<0:
return 1
return -1
n=int(input())
P=[tuple(map(int,input().split())) for i in range(n)]
sc=(n-1)*(n-2)*(n-3)*(n-4)//24
ANS=0
def calc3(x):
return x*(x-1)*(x-2)//6
for i in range(n):
x,y=P[i]
score=0
Q=[(z-x,w-y) for z,w in P[:i]]+[(z-x,w-y) for z,w in P[i+1:]]
Q.sort(key=cmp_to_key(cmp))
ind=-n+1
for j in range(-n+1,0):
if ind==j:
ind+=1
nowx,nowy=Q[j]
while nowx*Q[ind][1]-nowy*Q[ind][0]>0:
ind+=1
#print(j,ind)
if ind-j>=4:
#print(j,ind)
score+=calc3(ind-j-1)
ANS+=sc-score
print(ANS)
``` | instruction | 0 | 34,415 | 23 | 68,830 |
No | output | 1 | 34,415 | 23 | 68,831 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Kiwon's favorite video game is now holding a new year event to motivate the users! The game is about building and defending a castle, which led Kiwon to think about the following puzzle.
In a 2-dimension plane, you have a set s = \{(x_1, y_1), (x_2, y_2), …, (x_n, y_n)\} consisting of n distinct points. In the set s, no three distinct points lie on a single line. For a point p ∈ s, we can protect this point by building a castle. A castle is a simple quadrilateral (polygon with 4 vertices) that strictly encloses the point p (i.e. the point p is strictly inside a quadrilateral).
Kiwon is interested in the number of 4-point subsets of s that can be used to build a castle protecting p. Note that, if a single subset can be connected in more than one way to enclose a point, it is counted only once.
Let f(p) be the number of 4-point subsets that can enclose the point p. Please compute the sum of f(p) for all points p ∈ s.
Input
The first line contains a single integer n (5 ≤ n ≤ 2 500).
In the next n lines, two integers x_i and y_i (-10^9 ≤ x_i, y_i ≤ 10^9) denoting the position of points are given.
It is guaranteed that all points are distinct, and there are no three collinear points.
Output
Print the sum of f(p) for all points p ∈ s.
Examples
Input
5
-1 0
1 0
-10 -1
10 -1
0 3
Output
2
Input
8
0 1
1 2
2 2
1 3
0 -1
-1 -2
-2 -2
-1 -3
Output
40
Input
10
588634631 265299215
-257682751 342279997
527377039 82412729
145077145 702473706
276067232 912883502
822614418 -514698233
280281434 -41461635
65985059 -827653144
188538640 592896147
-857422304 -529223472
Output
213
Submitted Solution:
```
import sys
input = sys.stdin.readline
from math import atan2
pi=3.14159265358979323846264338327950288419716939937510582097494459230
n=int(input())
P=[tuple(map(int,input().split())) for i in range(n)]
sc=(n-1)*(n-2)*(n-3)*(n-4)//24
ANS=0
def calc3(x):
return x*(x-1)*(x-2)//6
for i in range(n):
x,y=P[i]
score=0
Q_p=[]
Q_m=[]
Q_zp=[]
Q_zm=[]
for z,w in P[:i]:
u=z-x
v=w-y
if u>0:
Q_p.append((u,v))
elif u==0 and v>0:
Q_zp.append((u,v))
elif u==0 and v<0:
Q_zm.append((u,v))
else:
Q_m.append((u,v))
for z,w in P[i+1:]:
u=z-x
v=w-y
if u>0:
Q_p.append((u,v))
elif u==0 and v>0:
Q_zp.append((u,v))
elif u==0 and v<0:
Q_zm.append((u,v))
else:
Q_m.append((u,v))
Q_p.sort(key=lambda x:x[1]/x[0])
Q_m.sort(key=lambda x:x[1]/x[0])
Q=(Q_p+Q_zp+Q_m+Q_zm)*2
Q.append(Q[0])
#print(Q)
ind=1
for j in range(n-1):
if ind==j:
ind+=1
nowx,nowy=Q[j]
while nowx*Q[ind][1]-nowy*Q[ind][0]>0:
ind+=1
#print(j,ind)
if ind-j>=4:
#print(j,ind)
score+=calc3(ind-j-1)
ANS+=sc-score
print(ANS)
``` | instruction | 0 | 34,416 | 23 | 68,832 |
No | output | 1 | 34,416 | 23 | 68,833 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.