Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
T = list(input())

num = T.count('?')
for _ in range(num):
    tmp = T.index('?')
    T[tmp] = 'D'

print(''.join(T))

Fixed submission:
T = input()
print(T.replace('?', 'D'))

Buggy python submission (verdict: Runtime Error):
T = list(input())

num = T.count('?')
for _ in range(num):
    T[num] = 'D'

print(''.join(T))

Fixed submission:
T = input()
print(T.replace('?', 'D'))

Buggy python submission (verdict: Time Limit Exceeded):
import copy

T = input()
copy_T = copy.copy(T)
ans, ans_T = 0, ''

def do_T():
    global ans_T, T
    if '?' in T:
        tmp = T.index('?')
        T = change_T(T, tmp, 'P')
        do_T()
        T = change_T(T, tmp, 'D')
        do_T()
    else:
        var = count_T()
        if len(var) > 0:
            ans_T = var

def change_T(s, index, char):
    var = list(s)
    var[index] = char
    return ''.join(var)

def count_T():
    global ans, T
    var = T.count('PD') + T.count('D')
    if ans < var: 
        ans = max(ans, var)
        return T
    else: return ''


do_T()
print(ans_T)

Fixed submission:
T = input()
print(T.replace('?', 'D'))

Buggy python submission (verdict: Runtime Error):
import copy

T = input()
copy_T = copy.copy(T)
ans, ans_T = 0, ''

def do_T():
    global ans, ans_T, T
    tmp = T.index('?')

    T = change_T(T, tmp, 'P')
    if '?' in T: do_T()
    if not '?' in T:
        var = T.count('PD') + T.count('D')
        if ans < var: 
            ans_T = copy.copy(T)
            ans = max(ans, var)

    T = change_T(T, tmp, 'D')
    if '?' in T: do_T()
    if not '?' in T:
        var = T.count('PD') + T.count('D')
        if ans < var: 
            ans_T = copy.copy(T)
            ans = max(ans, var)

def change_T(s, index, char):
    var = list(s)
    var[index] = char
    return ''.join(var)

do_T()
print(ans_T)

Fixed submission:
T = input()
print(T.replace('?', 'D'))
Buggy python submission (verdict: Runtime Error):
S = input()

if S = 'ABC':
  print('ARC')
else:
  print('ABC')

Fixed submission:
S = input()

if S == 'ABC':
  print('ARC')
else:
  print('ABC')
Buggy python submission (verdict: Runtime Error):
N = int(input())

ans = {}
for i in range(N):
    ans.add(input())

print(len(ans))

Fixed submission:
N = int(input())

ans = set()
for i in range(N):
    ans.add(input())

print(len(ans))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

for i in range(1, N+1):
    print(A.count(i))

Fixed submission:
N = int(input())
A = list(map(int, input().split()))

C = [0] * (N+1)
for i in range(N-1):
    C[A[i]] += 1

for i in range(1, N+1):
    print(C[i])
Buggy python submission (verdict: Time Limit Exceeded):
import math
N, K = map(int, input().split())

var = N % K
if var == 0:
        print(0)
elif var == K-1 or var == 1:
        print(1)
else:
        while N > K // 2:
                N = abs(N-K*(N//K))
        print(N)

Fixed submission:
import math
N, K = map(int, input().split())

var = N % K
if var == 0:
        print(0)
elif var == K-1 or var == 1:
        print(1)
else:
        while N >= math.ceil(K / 2):
                N = abs(N-K*(N//K+1))
        print(N)

Buggy python submission (verdict: Time Limit Exceeded):
import math
N, K = map(int, input().split())

var = N % K
if var == 0:
        print(0)
elif var == K-1 or var == 1:
        print(1)
else:
        while N > math.ceil(K / 2):
                N = abs(N-K)
        print(N)

Fixed submission:
import math
N, K = map(int, input().split())

var = N % K
if var == 0:
        print(0)
elif var == K-1 or var == 1:
        print(1)
else:
        while N >= math.ceil(K / 2):
                N = abs(N-K*(N//K+1))
        print(N)

Buggy python submission (verdict: Time Limit Exceeded):
import math
N, K = map(int, input().split())

var = N % K
if var == 0:
        print(0)
elif var == K-1 or var == 1:
        print(1)
else:
        while N > math.ceil(K // 2):
                N = abs(N-K)
        print(N)

Fixed submission:
import math
N, K = map(int, input().split())

var = N % K
if var == 0:
        print(0)
elif var == K-1 or var == 1:
        print(1)
else:
        while N >= math.ceil(K / 2):
                N = abs(N-K*(N//K+1))
        print(N)

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())

var = N % K
if var == 0:
        print(0)
elif var == K-1 or var == 1:
        print(1)
else:
        while True:
                prev = N
                N = abs(N-K)
                if prev < N:
                        break
        print(prev)

Fixed submission:
import math
N, K = map(int, input().split())

var = N % K
if var == 0:
        print(0)
elif var == K-1 or var == 1:
        print(1)
else:
        while N >= math.ceil(K / 2):
                N = abs(N-K*(N//K+1))
        print(N)

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())

var = N % K
if var == 0:
        print(0)
elif var == K-1 or var == 1:
        print(1)
else:
        while True:
                prev = N
                N = abs(N-K)
                if prev == N:
                        break
        print(N)

Fixed submission:
import math
N, K = map(int, input().split())

var = N % K
if var == 0:
        print(0)
elif var == K-1 or var == 1:
        print(1)
else:
        while N >= math.ceil(K / 2):
                N = abs(N-K*(N//K+1))
        print(N)
Buggy python submission (verdict: Runtime Error):
import math
N, W = map(int, input().split())

if N == 1 or W == 1:
  ans = 1
else
  ans = math.ceil((N * W) / 2)
  
print(ans)


Fixed submission:
import math
N, W = map(int, input().split())

if N == 1 or W == 1:
  ans = 1
else:
  ans = math.ceil((N * W) / 2)
  
print(ans)
Buggy python submission (verdict: Runtime Error):
import math

list_8 = []
list_10 = []

for i in range(101):
  list_8.append( math.ceil((i+1) * 12.5) )
  list_10.append( (i+1) * 10 )
  
A, B = map(int, input().split())

A_ = list_8[A]
if B < 100:
  
B_ = list_10[B]
B = list_10[B-1]

if A_ < B or B_ < A:
  print(-1)
elif B <= A_:
  print(B)
else:
  print(A)

Fixed submission:
import math

list_8 = []
list_10 = []

for i in range(101):
  list_8.append( math.ceil((i+1) * 12.5) )
  list_10.append( (i+1) * 10 )
  
A, B = map(int, input().split())

A_ = list_8[A] - 1
A = list_8[A-1]
  
B_ = list_10[B] - 1
B = list_10[B-1]

if A <= B <= A_:
  print(B)
elif B <= A <= B_:
  print(A)
else:
  print(-1)

Buggy python submission (verdict: Runtime Error):
import math

list_8 = []
list_10 = []

for i in range(100):
  list_8.append( math.floor((i+1) * 12.5) )
  list_10.append( (i+1) * 10 )
  
A, B = map(int, input().split())

A_ = list_8[A]
A = list_8[A-1]

B_ = list_10[B]
B = list_10[B-1]

if A_ < B or B_ < A:
  print(-1)
elif B <= A_:
  print(B)
else:
  print(A)

Fixed submission:
import math

list_8 = []
list_10 = []

for i in range(101):
  list_8.append( math.ceil((i+1) * 12.5) )
  list_10.append( (i+1) * 10 )
  
A, B = map(int, input().split())

A_ = list_8[A] - 1
A = list_8[A-1]
  
B_ = list_10[B] - 1
B = list_10[B-1]

if A <= B <= A_:
  print(B)
elif B <= A <= B_:
  print(A)
else:
  print(-1)

Buggy python submission (verdict: Runtime Error):
import math

list_8 = []
list_10 = []

for i in range(100):
  list_8.append( math.floor((i+1) * 12.5) )
  list_10.append( (i+1) * 10 )
  
A, B = map(int, input().split())

A_ = list_8[A]
A = list_8[A-1]

B_ = list_10[B]
B = list_10[B-1]

print(A, A_, B, B_)

if A_ < B or B_ < A:
  print(-1)
elif B <= A_:
  print(B)
else:
  print(A)

Fixed submission:
import math

list_8 = []
list_10 = []

for i in range(101):
  list_8.append( math.ceil((i+1) * 12.5) )
  list_10.append( (i+1) * 10 )
  
A, B = map(int, input().split())

A_ = list_8[A] - 1
A = list_8[A-1]
  
B_ = list_10[B] - 1
B = list_10[B-1]

if A <= B <= A_:
  print(B)
elif B <= A <= B_:
  print(A)
else:
  print(-1)
Buggy python submission (verdict: Runtime Error):
n = int(input())
S = []
for _ in range(n):
    S.append(input())

d = {}
for s in S:
  if s in d:
    d[s] += 1
  else:
    d[s] = 1

ans = 0
for i in d.values():
  if ans < i:
    ans = i

sor = sorted(d.keys())
for k, v in sor.items():
  if ans == v:
    print(k)

Fixed submission:
n = int(input())
S = []
for _ in range(n):
    S.append(input())

d = {}
for s in S:
  if s in d:
    d[s] += 1
  else:
    d[s] = 1

list = []
max = max(d.values())
for k, v in d.items():
  if max == v:
    list.append(k)

list.sort()
for str in list:
  print(str)
Buggy python submission (verdict: Time Limit Exceeded):
def exp(x):
  ans = 0
  for i in range(x+1):
    ans += i
  return ans / x

n, k = map(int, input().split())
p = list(map(int, input().split()))
  
sum = 0
for i in range(k):
  sum += exp(p[i])
max = sum

for i in range(n-k):
  sum += exp(p[i+k]) - exp(p[i])
  if max < sum:
    max = sum

print(max)

Fixed submission:
def exp(x):
  return (1+x) / 2

n, k = map(int, input().split())
p = list(map(int, input().split()))
  
sum = 0
for i in range(k):
  sum += exp(p[i])
max = sum

for i in range(n-k):
  sum += exp(p[i+k]) - exp(p[i])
  if max < sum:
    max = sum

print(max)

Buggy python submission (verdict: Time Limit Exceeded):
def exp(x):
  ans = 0
  for i in range(x+1):
    ans += i
  return ans / x

n, k = map(int, input().split())
p = list(map(int, input().split()))
  
sum = 0
ans = []
for i in range(k):
  sum += exp(p[i])
ans.append(sum)

for i in range(n-k):
  sum -= exp(p[i])
  sum += exp(p[i+k])
  ans.append(sum)

print(max(ans))

Fixed submission:
def exp(x):
  return (1+x) / 2

n, k = map(int, input().split())
p = list(map(int, input().split()))
  
sum = 0
for i in range(k):
  sum += exp(p[i])
max = sum

for i in range(n-k):
  sum += exp(p[i+k]) - exp(p[i])
  if max < sum:
    max = sum

print(max)

Buggy python submission (verdict: Runtime Error):
def exp(x):
  ans = 0
  for i in range(x+1):
    ans += i
  return ans / x

n, k = map(int, input().split())
p = list(map(int, input().split()))
  
sum = 0
ans = []
for i in range(k):
  sum += exp(p[i])
ans.append(sum)

for i in range(n-k+1):
  sum -= exp(p[i])
  sum += exp(p[k])
  ans.append(sum)

print(max(ans))

Fixed submission:
def exp(x):
  return (1+x) / 2

n, k = map(int, input().split())
p = list(map(int, input().split()))
  
sum = 0
for i in range(k):
  sum += exp(p[i])
max = sum

for i in range(n-k):
  sum += exp(p[i+k]) - exp(p[i])
  if max < sum:
    max = sum

print(max)

Buggy python submission (verdict: Time Limit Exceeded):
def exp(x):
  ans = 0
  for i in range(x+1):
    ans += i
  return ans / x

n, k = map(int, input().split())
p = list(map(int, input().split()))
  
ans = []
for i in range(n-k+1):
  sum = 0
  for j in range(k):
    sum += exp(p[i+j])
  ans.append(sum)

print(max(ans))

Fixed submission:
def exp(x):
  return (1+x) / 2

n, k = map(int, input().split())
p = list(map(int, input().split()))
  
sum = 0
for i in range(k):
  sum += exp(p[i])
max = sum

for i in range(n-k):
  sum += exp(p[i+k]) - exp(p[i])
  if max < sum:
    max = sum

print(max)

Buggy python submission (verdict: Time Limit Exceeded):
def exp(x):
  ans = 0
  for i in range(x+1):
    ans += i
  return ans / x

n, k = map(int, input().split())
p = list(map(int, input().split()))

e = []
for i in range(n):
  e.append(exp(p[i]))
  
ans = []
for i in range(n-k+1):
  sum = 0
  for j in range(k):
    sum += e[i+j]
  ans.append(sum)

print(max(ans))

Fixed submission:
def exp(x):
  return (1+x) / 2

n, k = map(int, input().split())
p = list(map(int, input().split()))
  
sum = 0
for i in range(k):
  sum += exp(p[i])
max = sum

for i in range(n-k):
  sum += exp(p[i+k]) - exp(p[i])
  if max < sum:
    max = sum

print(max)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
P = list(map(int, input().split()))

sum = 0
for i in range(n):
  ans = True
  for j in range(i):
    if P[i] > P[j]:
      ans = False
  if ans:
    sum += 1
    
print(sum)

Fixed submission:
n = int(input())
P = list(map(int, input().split()))

sum = 0
min = n
for i in range(n):
  if min >= P[i]:
    min = P[i]
    sum += 1
    
print(sum)
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
P = [0] * N

wa = 0
for _ in range(M):
  p, s = input().split()
  index = int(p)-1
  if s == 'AC':
    wa += P[index]
    P[index] = -1
  elif :
    if P[index] != -1
      P[index] += 1
  
print(P.count(-1), wa)

Fixed submission:
N, M = map(int, input().split())
P = [0] * N

wa = 0
for _ in range(M):
  p, s = input().split()
  index = int(p)-1
  if s == 'WA' and P[index] != -1:
      P[index] += 1
  elif P[index] > -1:
    wa += P[index]
    P[index] = -1
  
print(P.count(-1), wa)
Buggy python submission (verdict: Runtime Error):
n, k = map(int,input().slpit())
print(k+(100*(10-k)) if n<10 else k)

Fixed submission:
n, k = map(int,input().split())
print(k+(100*(10-n)) if n<10 else k)
Buggy python submission (verdict: Runtime Error):
a, b, c = map(int,raw_input().split())
if a==b and b!=c:
  print("Yes")
elif a==c and c!=b:
  print("Yes")
elif c==b and c!=a:
  print("Yes")
else:
  print("No")


Fixed submission:
a,b,c = map(int,input().split())
if (a==b and b!=c) or (a==c and c!=b) or (c==b and c!=a):
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
a,b,c = map(int,raw_input().split())
if (a==b and b!=c) or (a==c and c!=b) or (c==b and c!=a):
  print("Yes")
else:
  print("No")

Fixed submission:
a,b,c = map(int,input().split())
if (a==b and b!=c) or (a==c and c!=b) or (c==b and c!=a):
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = input().split()
b = set(a)
if len(b)<len(a):
    print("NO")
else:
    print("YES")

Fixed submission:

s, t = input().split()
a,b = map(int, input().split())
u = input()
res = {
    s: a,
    t: b
}
res[u] -= 1
print(res[s], res[t])
Buggy python submission (verdict: Time Limit Exceeded):
import sys

k=int(input())
if k%2==0:
  print(-1)
  sys.exit(0)
c=1
m=7%k
while 1:
  if m==0:
    print(c)
    sys.exit(0)
  m=m*10+7
  m%=k
  c+=1






Fixed submission:
import sys

k=int(input())
if k%2==0:
  print(-1)
  sys.exit(0)
c=1
m=7%k
while 1:
  if m==0:
    print(c)
    sys.exit(0)
  if c>k+1:
    print(-1)
    sys.exit(0)
  m=m*10+7
  m%=k
  c+=1
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
from copy import deepcopy
from heapq import heappop, heappush
from bisect import bisect_left, bisect
from collections import Counter, defaultdict, deque
from itertools import product, permutations, combinations

N = int(input())
A = list(map(int, input().split()))

s = 0
for i in range(N):
    s += A[i] * sum(A[i+1:])

print(s % (10**9 + 7))
exit()


Fixed submission:
import numpy as np
from copy import deepcopy
from heapq import heappop, heappush
from bisect import bisect_left, bisect
from collections import Counter, defaultdict, deque
from itertools import product, permutations, combinations

N = int(input())
A = list(map(int, input().split()))

s = 0

S = [0]

for i in range(N):
    S.append(A[i] + S[i])

for i in range(N):
    s += A[i] * S[i]

print(s % (10**9 + 7))
exit()

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
from copy import deepcopy
from heapq import heappop, heappush
from bisect import bisect_left, bisect
from collections import Counter, defaultdict, deque
from itertools import product, permutations, combinations

N = int(input())
A = list(map(int, input().split()))

sum = 0
for c in combinations(A, 2):
    sum += c[0] * c[1]

print(sum % (10**9 + 7))
exit()


Fixed submission:
import numpy as np
from copy import deepcopy
from heapq import heappop, heappush
from bisect import bisect_left, bisect
from collections import Counter, defaultdict, deque
from itertools import product, permutations, combinations

N = int(input())
A = list(map(int, input().split()))

s = 0

S = [0]

for i in range(N):
    S.append(A[i] + S[i])

for i in range(N):
    s += A[i] * S[i]

print(s % (10**9 + 7))
exit()
Buggy python submission (verdict: Time Limit Exceeded):
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

nmax = 0

a, b = [0], [0]
for i in range(N):
    a.append(a[i] + A[i])
for i in range(M):
    b.append(b[i] + B[i])

ans = 0

for i in range(N + 1):
    if a[i] > K:
        break

    for j in range(M+1):
        if b[j] + a[i] > K:
            break
        ans = max(ans, i+j)

print(ans)
exit()


Fixed submission:
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

nmax = 0

a, b = [0], [0]
for i in range(N):
    a.append(a[i] + A[i])
for i in range(M):
    b.append(b[i] + B[i])

ans = 0
j = M
for i in range(N + 1):
    if a[i] > K:
        break

    while b[j] + a[i] > K:
        j -= 1
    ans = max(ans, i+j)

print(ans)
exit()

Buggy python submission (verdict: Time Limit Exceeded):
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

nmax = 0

for na in range(N-1, -2, -1):
    for nb in range(M-1, -2, -1):
        n = na + nb + 2
        if n < nmax:
            continue
        time = sum([A[i] for i in range(na+1)]) + \
            sum([B[i] for i in range(nb+1)])
        if time <= K:
            nmax = n

print(nmax)
exit()


Fixed submission:
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

nmax = 0

a, b = [0], [0]
for i in range(N):
    a.append(a[i] + A[i])
for i in range(M):
    b.append(b[i] + B[i])

ans = 0
j = M
for i in range(N + 1):
    if a[i] > K:
        break

    while b[j] + a[i] > K:
        j -= 1
    ans = max(ans, i+j)

print(ans)
exit()

Buggy python submission (verdict: Time Limit Exceeded):
from itertools import combinations_with_replacement, product, permutations, combinations

N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

nmax = 0

for na in range(-1, N):
    for nb in range(-1, M):
        n = na + nb + 2
        time = sum([A[i] for i in range(na+1)]) + \
            sum([B[i] for i in range(nb+1)])
        if nmax < n and time <= K:
            nmax = n

print(nmax)
exit()


Fixed submission:
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

nmax = 0

a, b = [0], [0]
for i in range(N):
    a.append(a[i] + A[i])
for i in range(M):
    b.append(b[i] + B[i])

ans = 0
j = M
for i in range(N + 1):
    if a[i] > K:
        break

    while b[j] + a[i] > K:
        j -= 1
    ans = max(ans, i+j)

print(ans)
exit()
Buggy python submission (verdict: Time Limit Exceeded):
from itertools import product, permutations, combinations
import math
N, K = map(int, input().split())
P = list(map(int, input().split()))

ans = math.inf
for pt in combinations(P, K):
    ans = min(ans, sum(pt))

print(ans)
exit()


Fixed submission:
from itertools import product, permutations, combinations
import math
N, K = map(int, input().split())
P = list(sorted((list(map(int, input().split())))))

print(sum([P[i] for i in range(K)]))
exit()
Buggy python submission (verdict: Runtime Error):
x,n = map(int,input().split())
if n == 0:
  ans = x
else:
  p = [int(i.strip()) for i in input().split()]
  for i in range(n):
    ch_1 = x-i
    ch_2 = x+i
    if p.count(ch_1) == 0:
      ans = ch_1
      break
    elif p.count(ch_2) == 0:
      ans = ch_2
      break
    else:
      ans = x
print(p)

Fixed submission:
x,n = map(int,input().split())
if n == 0:
  ans = x
else:
  p = [int(i.strip()) for i in input().split()]
  for i in range(n+1):
    ch_1 = x-i
    ch_2 = x+i
    if p.count(ch_1) == 0:
      ans = ch_1
      break
    elif p.count(ch_2) == 0:
      ans = ch_2
      break
print(ans)

Buggy python submission (verdict: Runtime Error):
x,n = map(int,input().split())
if n == 0:
  ans = x
else:
  p = [int(i.strip()) for i in input().split()]
  for i in range(n):
    ch_1 = x-i
    ch_2 = x+i
    if p.count(ch_1) == 0:
      ans = ch_1
      break
    elif p.count(ch_2) == 0:
      ans = ch_2
      break
print(ans)

Fixed submission:
x,n = map(int,input().split())
if n == 0:
  ans = x
else:
  p = [int(i.strip()) for i in input().split()]
  for i in range(n+1):
    ch_1 = x-i
    ch_2 = x+i
    if p.count(ch_1) == 0:
      ans = ch_1
      break
    elif p.count(ch_2) == 0:
      ans = ch_2
      break
print(ans)

Buggy python submission (verdict: Runtime Error):
x, n = map(int, input().split())
p = map(int, input().split())
p_list = sorted(list(p), reverse=False)
dist_list = list(map(lambda y: abs(y-x), p_list))
all_list = [[]]
ans = 0
for i in range(n):
  all_list.append([p_list[i], dist_list[i]])
del all_list[0] # appendは空に追加してしまうので最初の空を削除
sort_list = sorted(all_list, key=lambda z:(z[1],z[0]))
ans = int(sort_list[0][0])
print(ans)

Fixed submission:
x,n = map(int,input().split())
if n == 0:
  ans = x
else:
  p = [int(i.strip()) for i in input().split()]
  for i in range(n+1):
    ch_1 = x-i
    ch_2 = x+i
    if p.count(ch_1) == 0:
      ans = ch_1
      break
    elif p.count(ch_2) == 0:
      ans = ch_2
      break
print(ans)

Buggy python submission (verdict: Runtime Error):
x, n = map(int, input().split())
p = map(int, input().split())
p_list = sorted(list(p), reverse=False)
dist_list = list(map(lambda y: abs(y-x), p_list))
all_list = [[]]
ans = 0
for i in range(n):
  all_list.append([p_list[i], dist_list[i]])
del all_list[0] # appendは空に追加してしまうので最初の空を削除
sort_list = sorted(all_list, key=lambda z:(z[1],z[0]))
ans = int(sort_list[0][0])
print(ans)

Fixed submission:
x,n = map(int,input().split())
if n == 0:
  ans = x
else:
  p = [int(i.strip()) for i in input().split()]
  for i in range(n+1):
    ch_1 = x-i
    ch_2 = x+i
    if p.count(ch_1) == 0:
      ans = ch_1
      break
    elif p.count(ch_2) == 0:
      ans = ch_2
      break
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(x.strip()) for x in input().split()]
ans = str('')
for y in range(n):
  idx = a.index(y+1) + 1
  ans += str(idx)+' '
print(ans.rstrip())

Fixed submission:
# 回答を見て作成：一致検索はsort＋一致で時間がかかる？
n = int(input())
a = [int(x.strip()) for x in input().split()]
b = []
ans = str('')
for i in enumerate(a):
  b.append(i)
b.sort(key=lambda x:x[1])
for i in b:
  print(i[0]+1)
Buggy python submission (verdict: Runtime Error):
a,b = map(int, input().split())
c = 1
if b == 1:
  ans = 0
else:
  for i in range(11):
    c = c-1 + a
    if c >= b:
      ans = i + 1
      break
print(ans)

Fixed submission:
a,b = map(int, input().split())
c = 1
ans = 0
if b == 1:
  ans = 0
else:
  for i in range(21):
    c = c-1 + a
    if c >= b:
      ans = i + 1
      break
print(ans)

Buggy python submission (verdict: Runtime Error):
a,b = map(int, input().split())
c = 1
if b == 1:
  ans = 0
else:
  for i in range(11):
    c = c-1 + a
    if c >= b:
      ans = i
      break
print(ans)

Fixed submission:
a,b = map(int, input().split())
c = 1
ans = 0
if b == 1:
  ans = 0
else:
  for i in range(21):
    c = c-1 + a
    if c >= b:
      ans = i + 1
      break
print(ans)