message stringlengths 2 20.1k | message_type stringclasses 2
values | message_id int64 0 1 | conversation_id int64 1.95k 109k | cluster float64 17 17 | __index_level_0__ int64 3.91k 217k |
|---|---|---|---|---|---|
Provide tags and a correct Python 3 solution for this coding contest problem.
International Abbreviation Olympiad takes place annually starting from 1989. Each year the competition receives an abbreviation of form IAO'y, where y stands for some number of consequent last digits of the current year. Organizers always pi... | instruction | 0 | 26,061 | 17 | 52,122 |
Tags: constructive algorithms, greedy, implementation, math
Correct Solution:
```
#!/usr/bin/python3
delims = [0, 1989, 1999, 2099, 3099, 13099, 113099, 1113099, 11113099, 111113099, 1111113099]
n = int(input())
for i in range(n):
suf = input()[4:]
min_val = delims[len(suf)]
d = int(suf)
while d < min... | output | 1 | 26,061 | 17 | 52,123 |
Provide tags and a correct Python 3 solution for this coding contest problem.
International Abbreviation Olympiad takes place annually starting from 1989. Each year the competition receives an abbreviation of form IAO'y, where y stands for some number of consequent last digits of the current year. Organizers always pi... | instruction | 0 | 26,062 | 17 | 52,124 |
Tags: constructive algorithms, greedy, implementation, math
Correct Solution:
```
import sys
sys.stderr = sys.stdout
def iao(n, A):
d = [None] * 10
y = 1989
b = 10
for k in range(1, 10):
d[k] = y, b, y % b
y += b
b *= 10
for s in A:
y, b, a0 = d[len(s)-4]
a... | output | 1 | 26,062 | 17 | 52,125 |
Provide tags and a correct Python 3 solution for this coding contest problem.
International Abbreviation Olympiad takes place annually starting from 1989. Each year the competition receives an abbreviation of form IAO'y, where y stands for some number of consequent last digits of the current year. Organizers always pi... | instruction | 0 | 26,063 | 17 | 52,126 |
Tags: constructive algorithms, greedy, implementation, math
Correct Solution:
```
import math
def find_year(iao):
if len(iao) == 1:
year = 1980 + int(iao)
if year < 1989:
year += 10
return year
else:
pre_year = find_year(iao[1:])
pre_year_str = list(str(pre_year))
if len(iao) > len(pr... | output | 1 | 26,063 | 17 | 52,127 |
Provide tags and a correct Python 3 solution for this coding contest problem.
International Abbreviation Olympiad takes place annually starting from 1989. Each year the competition receives an abbreviation of form IAO'y, where y stands for some number of consequent last digits of the current year. Organizers always pi... | instruction | 0 | 26,064 | 17 | 52,128 |
Tags: constructive algorithms, greedy, implementation, math
Correct Solution:
```
def solve(x):
l = len(x)
if l == 1: return '19' + ('8' if x == '9' else '9') + x
if l == 2: return ('19' if x == '99' else '20') + x
if l == 3: return ('3' if int(x) <= 98 else '2') + x
if l >= 4:
y = int((l - ... | output | 1 | 26,064 | 17 | 52,129 |
Provide tags and a correct Python 3 solution for this coding contest problem.
International Abbreviation Olympiad takes place annually starting from 1989. Each year the competition receives an abbreviation of form IAO'y, where y stands for some number of consequent last digits of the current year. Organizers always pi... | instruction | 0 | 26,065 | 17 | 52,130 |
Tags: constructive algorithms, greedy, implementation, math
Correct Solution:
```
x = [0, 1989]
for i in range(1, 10):
x.append(x[-1]+10**i)
for i in range(int(input())):
k = input().split("'")[1]
lb = x[len(k):len(k)+2]
if int(k) < int(str(lb[0])[-len(k):]):
print(str(lb[1]-1)[:-(len(str(k)))]+... | output | 1 | 26,065 | 17 | 52,131 |
Provide tags and a correct Python 3 solution for this coding contest problem.
International Abbreviation Olympiad takes place annually starting from 1989. Each year the competition receives an abbreviation of form IAO'y, where y stands for some number of consequent last digits of the current year. Organizers always pi... | instruction | 0 | 26,066 | 17 | 52,132 |
Tags: constructive algorithms, greedy, implementation, math
Correct Solution:
```
def run(n):
l = len(n) - 1
b = 1989
l = 10**l
while l > 1:
b += l
l //= 10
if b <= int(n):
return n
b = str(b)
if len(b) == len(n):
return '1' + n
else:
if b[-len(n):... | output | 1 | 26,066 | 17 | 52,133 |
Provide tags and a correct Python 3 solution for this coding contest problem.
International Abbreviation Olympiad takes place annually starting from 1989. Each year the competition receives an abbreviation of form IAO'y, where y stands for some number of consequent last digits of the current year. Organizers always pi... | instruction | 0 | 26,067 | 17 | 52,134 |
Tags: constructive algorithms, greedy, implementation, math
Correct Solution:
```
n = int(input())
res = []
for i in range(n):
line = input()
year = 1989
for u in range(len(line)-1, 3, -1):
a = line[u:]
k = len(a)
while year%(10**k)!=int(a):
year = year+10**(k-1)
year += 10**(k)
res.append(year-10**k)
fo... | output | 1 | 26,067 | 17 | 52,135 |
Provide tags and a correct Python 3 solution for this coding contest problem.
International Abbreviation Olympiad takes place annually starting from 1989. Each year the competition receives an abbreviation of form IAO'y, where y stands for some number of consequent last digits of the current year. Organizers always pi... | instruction | 0 | 26,068 | 17 | 52,136 |
Tags: constructive algorithms, greedy, implementation, math
Correct Solution:
```
for i in range(int(input())):
t = input()[4:]
q, d = int(t), 10 ** len(t)
while q < 1988 + d // 9: q += d
print(q)
# Made By Mostafa_Khaled
``` | output | 1 | 26,068 | 17 | 52,137 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
International Abbreviation Olympiad takes place annually starting from 1989. Each year the competition receives an abbreviation of form IAO'y, where y stands for some number of consequent last d... | instruction | 0 | 26,069 | 17 | 52,138 |
Yes | output | 1 | 26,069 | 17 | 52,139 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
International Abbreviation Olympiad takes place annually starting from 1989. Each year the competition receives an abbreviation of form IAO'y, where y stands for some number of consequent last d... | instruction | 0 | 26,070 | 17 | 52,140 |
Yes | output | 1 | 26,070 | 17 | 52,141 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
International Abbreviation Olympiad takes place annually starting from 1989. Each year the competition receives an abbreviation of form IAO'y, where y stands for some number of consequent last d... | instruction | 0 | 26,071 | 17 | 52,142 |
Yes | output | 1 | 26,071 | 17 | 52,143 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
International Abbreviation Olympiad takes place annually starting from 1989. Each year the competition receives an abbreviation of form IAO'y, where y stands for some number of consequent last d... | instruction | 0 | 26,072 | 17 | 52,144 |
Yes | output | 1 | 26,072 | 17 | 52,145 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
International Abbreviation Olympiad takes place annually starting from 1989. Each year the competition receives an abbreviation of form IAO'y, where y stands for some number of consequent last d... | instruction | 0 | 26,073 | 17 | 52,146 |
No | output | 1 | 26,073 | 17 | 52,147 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
International Abbreviation Olympiad takes place annually starting from 1989. Each year the competition receives an abbreviation of form IAO'y, where y stands for some number of consequent last d... | instruction | 0 | 26,074 | 17 | 52,148 |
No | output | 1 | 26,074 | 17 | 52,149 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
International Abbreviation Olympiad takes place annually starting from 1989. Each year the competition receives an abbreviation of form IAO'y, where y stands for some number of consequent last d... | instruction | 0 | 26,075 | 17 | 52,150 |
No | output | 1 | 26,075 | 17 | 52,151 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
International Abbreviation Olympiad takes place annually starting from 1989. Each year the competition receives an abbreviation of form IAO'y, where y stands for some number of consequent last d... | instruction | 0 | 26,076 | 17 | 52,152 |
No | output | 1 | 26,076 | 17 | 52,153 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
PolandBall is standing in a row with Many Other Balls. More precisely, there are exactly n Balls. Balls are proud of their home land — and they want to prove that it's strong.
The Balls decided... | instruction | 0 | 26,119 | 17 | 52,238 |
No | output | 1 | 26,119 | 17 | 52,239 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This night wasn't easy on Vasya. His favorite team lost, and he didn't find himself victorious either — although he played perfectly, his teammates let him down every time. He had to win at least one more time, but the losestreak only grew l... | instruction | 0 | 26,221 | 17 | 52,442 |
Tags: brute force, combinatorics, math
Correct Solution:
```
ct=[0]*10
fact=[1]*20
ans=0
def setAns(lol):
global ans
ans=lol
def calc(k,fr):
if(k==10):
# print(fr)
tot=sum(fr)
w0=fact[tot]
# print(tot,w0)
for i in range(10):
w0//=fact[fr[i]]
wo0=0... | output | 1 | 26,221 | 17 | 52,443 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This night wasn't easy on Vasya. His favorite team lost, and he didn't find himself victorious either — although he played perfectly, his teammates let him down every time. He had to win at least one more time, but the losestreak only grew l... | instruction | 0 | 26,223 | 17 | 52,446 |
Tags: brute force, combinatorics, math
Correct Solution:
```
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import time
import math
def test(num, a, step):
if step == 10:
s = sum(a)
ans = s - a[0]
s -= 1
ans *= math.factorial(s)
for i in a:
if i!=0:
... | output | 1 | 26,223 | 17 | 52,447 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This night wasn't easy on Vasya. His favorite team lost, and he didn't find himself victorious either — although he played perfectly, his teammates let him down every time. He had to win at least one more time, but the losestreak only grew l... | instruction | 0 | 26,224 | 17 | 52,448 |
Tags: brute force, combinatorics, math
Correct Solution:
```
def fact(n):
global fa
if fa[n] != -1:
return fa[n]
else:
fa[n] = fact(n - 1) * n
return fa[n]
fa = [-1] * 20
fa[0] = 1
fa[1] = 1
fa[2] = 2
res = 0
a = int(input())
b = str(a)
s = [0] * 10
for i in range(len(b)):
s[in... | output | 1 | 26,224 | 17 | 52,449 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
This night wasn't easy on Vasya. His favorite team lost, and he didn't find himself victorious either — although he played perfectly, his teammates let him down every time. He had to win at leas... | instruction | 0 | 26,228 | 17 | 52,456 |
Yes | output | 1 | 26,228 | 17 | 52,457 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
This night wasn't easy on Vasya. His favorite team lost, and he didn't find himself victorious either — although he played perfectly, his teammates let him down every time. He had to win at leas... | instruction | 0 | 26,229 | 17 | 52,458 |
Yes | output | 1 | 26,229 | 17 | 52,459 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
This night wasn't easy on Vasya. His favorite team lost, and he didn't find himself victorious either — although he played perfectly, his teammates let him down every time. He had to win at leas... | instruction | 0 | 26,230 | 17 | 52,460 |
Yes | output | 1 | 26,230 | 17 | 52,461 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
This night wasn't easy on Vasya. His favorite team lost, and he didn't find himself victorious either — although he played perfectly, his teammates let him down every time. He had to win at leas... | instruction | 0 | 26,231 | 17 | 52,462 |
No | output | 1 | 26,231 | 17 | 52,463 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
This night wasn't easy on Vasya. His favorite team lost, and he didn't find himself victorious either — although he played perfectly, his teammates let him down every time. He had to win at leas... | instruction | 0 | 26,232 | 17 | 52,464 |
No | output | 1 | 26,232 | 17 | 52,465 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
This night wasn't easy on Vasya. His favorite team lost, and he didn't find himself victorious either — although he played perfectly, his teammates let him down every time. He had to win at leas... | instruction | 0 | 26,233 | 17 | 52,466 |
No | output | 1 | 26,233 | 17 | 52,467 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
This night wasn't easy on Vasya. His favorite team lost, and he didn't find himself victorious either — although he played perfectly, his teammates let him down every time. He had to win at leas... | instruction | 0 | 26,234 | 17 | 52,468 |
No | output | 1 | 26,234 | 17 | 52,469 |
Provide a correct Python 3 solution for this coding contest problem.
It's been a while since I played with A, B, and C. Mr. A and Mr. B became players, and Mr. C became a referee and played a badminton singles game. The rules decided by the three people are as follows.
* 3 Play the game.
* The person who gets 11 poin... | instruction | 0 | 26,399 | 17 | 52,798 |
"Correct Solution:
```
#0174
while True:
A = 0
B = 0
r = input()
if r == '0':
break
for i in range(1,len(r)):
if r[i] == 'A':
A += 1
else:
B += 1
if A > B:
A += 1
elif B > A:
B += 1
print(A,B)
``` | output | 1 | 26,399 | 17 | 52,799 |
Provide a correct Python 3 solution for this coding contest problem.
It's been a while since I played with A, B, and C. Mr. A and Mr. B became players, and Mr. C became a referee and played a badminton singles game. The rules decided by the three people are as follows.
* 3 Play the game.
* The person who gets 11 poin... | instruction | 0 | 26,400 | 17 | 52,800 |
"Correct Solution:
```
while 1:
a=input()
if a=='0':break
d,e=a[1:].count('A'),a[1:].count('B')
(b,c)=(0,1) if d<e else (1,0)
print(d+b,e+c)
``` | output | 1 | 26,400 | 17 | 52,801 |
Provide a correct Python 3 solution for this coding contest problem.
It's been a while since I played with A, B, and C. Mr. A and Mr. B became players, and Mr. C became a referee and played a badminton singles game. The rules decided by the three people are as follows.
* 3 Play the game.
* The person who gets 11 poin... | instruction | 0 | 26,401 | 17 | 52,802 |
"Correct Solution:
```
def judge(r):
pa = pb = 0
for c in r[1:]:
if c == "A":
pa += 1
else:
pb += 1
if pa < pb:
print(pa, pb + 1)
else:
print(pa + 1, pb)
while True:
r1 = input()
if r1 == "0":
break
judge(r1)
judge(input())
judge(input())
``` | output | 1 | 26,401 | 17 | 52,803 |
Provide a correct Python 3 solution for this coding contest problem.
It's been a while since I played with A, B, and C. Mr. A and Mr. B became players, and Mr. C became a referee and played a badminton singles game. The rules decided by the three people are as follows.
* 3 Play the game.
* The person who gets 11 poin... | instruction | 0 | 26,402 | 17 | 52,804 |
"Correct Solution:
```
while True:
po=input()
if po=="0":
break
A,B=0,0
for i in range(1,len(po)):
if po[i]=="A":
A+=1
else :
B+=1
if A>B:
A+=1
else :
B+=1
print(A,B)
``` | output | 1 | 26,402 | 17 | 52,805 |
Provide a correct Python 3 solution for this coding contest problem.
It's been a while since I played with A, B, and C. Mr. A and Mr. B became players, and Mr. C became a referee and played a badminton singles game. The rules decided by the three people are as follows.
* 3 Play the game.
* The person who gets 11 poin... | instruction | 0 | 26,403 | 17 | 52,806 |
"Correct Solution:
```
while True:
re=input()
if re=="0":
break
a=0
b=0
n=len(re)-1
for i in range(n):
if re[i+1]=="A":
a+=1
else:
b+=1
if a>b:
a+=1
else:
b+=1
print(a, b)
``` | output | 1 | 26,403 | 17 | 52,807 |
Provide a correct Python 3 solution for this coding contest problem.
It's been a while since I played with A, B, and C. Mr. A and Mr. B became players, and Mr. C became a referee and played a badminton singles game. The rules decided by the three people are as follows.
* 3 Play the game.
* The person who gets 11 poin... | instruction | 0 | 26,404 | 17 | 52,808 |
"Correct Solution:
```
while True:
a = input()
if a == '0':
break
b, c = a[1:].count('A'), a[1:].count('B')
if b < c:
d, e = 0, 1
else:
d, e = 1, 0
Ap = b+d
Bp = c+e
print(Ap,Bp)
``` | output | 1 | 26,404 | 17 | 52,809 |
Provide a correct Python 3 solution for this coding contest problem.
It's been a while since I played with A, B, and C. Mr. A and Mr. B became players, and Mr. C became a referee and played a badminton singles game. The rules decided by the three people are as follows.
* 3 Play the game.
* The person who gets 11 poin... | instruction | 0 | 26,405 | 17 | 52,810 |
"Correct Solution:
```
while True:
str = input();
if (str == '0'):
break;
scorea = 0;
scoreb = 0;
for i in range(1, len(str)):
if (str[i] == 'A'):
scorea += 1;
else:
scoreb += 1;
if (scorea > scoreb):
scorea += 1;
else:
scoreb += 1;
print(scorea, scoreb);
``` | output | 1 | 26,405 | 17 | 52,811 |
Provide a correct Python 3 solution for this coding contest problem.
It's been a while since I played with A, B, and C. Mr. A and Mr. B became players, and Mr. C became a referee and played a badminton singles game. The rules decided by the three people are as follows.
* 3 Play the game.
* The person who gets 11 poin... | instruction | 0 | 26,406 | 17 | 52,812 |
"Correct Solution:
```
try:
while True:
x = input()
if x=='0':
break
a = 0
b = 0
for i in range(1,len(x)):
if x[i]=='A':
a = a + 1
elif x[i]=='B':
b = b + 1
if a > b:
a = a + 1
eli... | output | 1 | 26,406 | 17 | 52,813 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
It's been a while since I played with A, B, and C. Mr. A and Mr. B became players, and Mr. C became a referee and played a badminton singles game. The rules decided by the three people are as fo... | instruction | 0 | 26,407 | 17 | 52,814 |
Yes | output | 1 | 26,407 | 17 | 52,815 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
It's been a while since I played with A, B, and C. Mr. A and Mr. B became players, and Mr. C became a referee and played a badminton singles game. The rules decided by the three people are as fo... | instruction | 0 | 26,408 | 17 | 52,816 |
Yes | output | 1 | 26,408 | 17 | 52,817 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
It's been a while since I played with A, B, and C. Mr. A and Mr. B became players, and Mr. C became a referee and played a badminton singles game. The rules decided by the three people are as fo... | instruction | 0 | 26,409 | 17 | 52,818 |
Yes | output | 1 | 26,409 | 17 | 52,819 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
It's been a while since I played with A, B, and C. Mr. A and Mr. B became players, and Mr. C became a referee and played a badminton singles game. The rules decided by the three people are as fo... | instruction | 0 | 26,410 | 17 | 52,820 |
Yes | output | 1 | 26,410 | 17 | 52,821 |
Provide a correct Python 3 solution for this coding contest problem.
Selection of Participants of an Experiment
Dr. Tsukuba has devised a new method of programming training. In order to evaluate the effectiveness of this method, he plans to carry out a control experiment. Having two students as the participants of th... | instruction | 0 | 26,447 | 17 | 52,894 |
"Correct Solution:
```
# coding: utf-8
while 1:
n=int(input())
if n==0:
break
d=sorted(list(map(int,input().split())))
mn=99999999
for i in range(1,len(d)):
mn=min(mn,d[i]-d[i-1])
print(mn)
``` | output | 1 | 26,447 | 17 | 52,895 |
Provide a correct Python 3 solution for this coding contest problem.
Selection of Participants of an Experiment
Dr. Tsukuba has devised a new method of programming training. In order to evaluate the effectiveness of this method, he plans to carry out a control experiment. Having two students as the participants of th... | instruction | 0 | 26,448 | 17 | 52,896 |
"Correct Solution:
```
from itertools import combinations
ans_list = []
while True:
n = int(input())
if n == 0:
break
A = list(map(int,input().split()))
ans = float("inf")
for (a, b) in combinations(A,2):
ans = min(ans,abs(a-b))
ans_list.append(ans)
for ans in ans_list:
pr... | output | 1 | 26,448 | 17 | 52,897 |
Provide a correct Python 3 solution for this coding contest problem.
Selection of Participants of an Experiment
Dr. Tsukuba has devised a new method of programming training. In order to evaluate the effectiveness of this method, he plans to carry out a control experiment. Having two students as the participants of th... | instruction | 0 | 26,449 | 17 | 52,898 |
"Correct Solution:
```
while True:
n=int(input())
if n==0: break
A=list(map(int,input().split()))
A.sort()
B=[]
for i in range(n-1):
B.append(A[i+1]-A[i])
print(min(B))
``` | output | 1 | 26,449 | 17 | 52,899 |
Provide a correct Python 3 solution for this coding contest problem.
Selection of Participants of an Experiment
Dr. Tsukuba has devised a new method of programming training. In order to evaluate the effectiveness of this method, he plans to carry out a control experiment. Having two students as the participants of th... | instruction | 0 | 26,450 | 17 | 52,900 |
"Correct Solution:
```
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readl... | output | 1 | 26,450 | 17 | 52,901 |
Provide a correct Python 3 solution for this coding contest problem.
Selection of Participants of an Experiment
Dr. Tsukuba has devised a new method of programming training. In order to evaluate the effectiveness of this method, he plans to carry out a control experiment. Having two students as the participants of th... | instruction | 0 | 26,451 | 17 | 52,902 |
"Correct Solution:
```
#成績の差が最も小さい 2 人を選ぶプログラム
#1 行目には学生の人数 n (2 ≤ n ≤ 1000)
#2 行目には ai(1 ≤ i ≤ n)が i 番目の学生の成績
while True:
#1行目nを読み込む
n =int(input())
#もしn==0ならbreak
if n==0:
break
else :
#配列a[i]を読み込む(1<=i<=n)
a = sorted(list(map(int, input().strip().split())))
a_sub = 1000000
for i ... | output | 1 | 26,451 | 17 | 52,903 |
Provide a correct Python 3 solution for this coding contest problem.
Selection of Participants of an Experiment
Dr. Tsukuba has devised a new method of programming training. In order to evaluate the effectiveness of this method, he plans to carry out a control experiment. Having two students as the participants of th... | instruction | 0 | 26,453 | 17 | 52,906 |
"Correct Solution:
```
def solve(n,a):
a.sort()
ans = abs(a[0]-a[1])
for i in range(n-1):
ans = min(ans,abs(a[i] - a[i+1]))
return ans
while True:
n = int(input())
if n == 0:
break
a = list(map(int,input().split()))
print(solve(n,a))
``` | output | 1 | 26,453 | 17 | 52,907 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Professor GukiZ likes programming contests. He especially likes to rate his students on the contests he prepares. Now, he has decided to prepare a new contest.
In total, n students will attend, and before the start, every one of them has s... | instruction | 0 | 26,921 | 17 | 53,842 |
Tags: brute force, implementation, sortings
Correct Solution:
```
n=int(input())
t=list(map(int,input().split()))
s=list(set(t))
s.sort()
p=[]
for i in range(len(s)):
p.append(t.count(s[i]))
for k in range(len(t)):
print(1+sum(p[s.index(t[k])+1:]),end=' ')
``` | output | 1 | 26,921 | 17 | 53,843 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Professor GukiZ likes programming contests. He especially likes to rate his students on the contests he prepares. Now, he has decided to prepare a new contest.
In total, n students will attend, and before the start, every one of them has s... | instruction | 0 | 26,922 | 17 | 53,844 |
Tags: brute force, implementation, sortings
Correct Solution:
```
n=int(input())
l=list(map(int,input().split()))
k=0
while(k<n):
p=1+sum(i>l[k] for i in l)
k+=1
print(p,end=" ")
``` | output | 1 | 26,922 | 17 | 53,845 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Professor GukiZ likes programming contests. He especially likes to rate his students on the contests he prepares. Now, he has decided to prepare a new contest.
In total, n students will attend, and before the start, every one of them has s... | instruction | 0 | 26,923 | 17 | 53,846 |
Tags: brute force, implementation, sortings
Correct Solution:
```
input()
arr = list(map(int, input().split()))
arr2 = {}
i = 1
c = 0
while c < len(arr):
max_ = max(arr)
count = arr.count(max_)
for j in range(count):
ind = arr.index(max_)
arr2[ind] = i
arr[ind] = -1
c += 1
... | output | 1 | 26,923 | 17 | 53,847 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Professor GukiZ likes programming contests. He especially likes to rate his students on the contests he prepares. Now, he has decided to prepare a new contest.
In total, n students will attend, and before the start, every one of them has s... | instruction | 0 | 26,924 | 17 | 53,848 |
Tags: brute force, implementation, sortings
Correct Solution:
```
n=int(input())
L=list(map(int,input().split()))
A=[0]*(max(L)+1)
for k in range(n):
A[L[k]-1]+=1
for k in range(1,len(A)):
A[k]+=A[k-1]
print(" ".join([str(n+1-A[L[k]-1]) for k in range(n)]))
``` | output | 1 | 26,924 | 17 | 53,849 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Professor GukiZ likes programming contests. He especially likes to rate his students on the contests he prepares. Now, he has decided to prepare a new contest.
In total, n students will attend, and before the start, every one of them has s... | instruction | 0 | 26,925 | 17 | 53,850 |
Tags: brute force, implementation, sortings
Correct Solution:
```
n = int(input())
A = list(map(int, input().split()))
B = {}
A.insert(0, 0)
res = 0
if n == 1:
print(1)
exit()
B[0] = 0
for i in range(1, n + 1):
higher = 0
for j in range(1, n + 1):
if A[i] < A[j]:
higher += 1
B[i]... | output | 1 | 26,925 | 17 | 53,851 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.