Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = []
for _ in range(N):
  a = int(input())
  A.append(a)

d = []
for i in range(N):
  ite = 0
  flag = True
  for j in range(len(d)):
    if d[j] < A[i]:
      ite = j
      flag = False
      break
  if flag:
    d.append(A[i])
  else:
    d[ite] = A[i]
print(len(d))

Fixed submission:
import bisect
from collections import deque

N = int(input())
A = []
for _ in range(N):
  a = int(input())
  A.append(a)

b = deque([])
for a in A:
  if len(b) == 0:
    b.append(a)
  else:
    if a <= b[0]:
      b.appendleft(a)
    else:
      b[bisect.bisect_left(b, a) - 1] = a
print(len(b))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = []
for _ in range(N):
  a = int(input())
  A.append(a)

d = []
for i in range(N):
  ite = 0
  flag = True
  for j in range(len(d)):
    if d[j] < A[i]:
      ite = j
      flag = False
      break
  if flag:
    d.append(A[i])
  else:
    d[ite] = A[i]
print(len(d))

Fixed submission:
import bisect
from collections import deque

N = int(input())
A = []
for _ in range(N):
  a = int(input())
  A.append(a)

b = deque([])
for a in A:
  if len(b) == 0:
    b.append(a)
  else:
    if a <= b[0]:
      b.appendleft(a)
    else:
      b[bisect.bisect_left(b, a) - 1] = a
print(len(b))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = []
for _ in range(N):
  a = int(input())
  A.append(a)

check = [False for _ in range(N)]
cnt = 0
for i in range(N):
  if check[i] == False:
    cnt += 1
  for j in range(i + 1, N):
    if A[j] > A[i]:
      check[j] = True
      check[i] = True
print(cnt)

Fixed submission:
import bisect
from collections import deque

N = int(input())
A = []
for _ in range(N):
  a = int(input())
  A.append(a)

b = deque([])
for a in A:
  if len(b) == 0:
    b.append(a)
  else:
    if a <= b[0]:
      b.appendleft(a)
    else:
      b[bisect.bisect_left(b, a) - 1] = a
print(len(b))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = []
for _ in range(N):
  a = int(input())
  A.append(a)

check = [False for _ in range(N)]
cnt = 0
for i in range(N):
  if check[i] == False:
    cnt += 1
  for j in range(i + 1, N):
    if A[j] > A[i]:
      check[j] = True
      check[i] = True
print(cnt)

Fixed submission:
import bisect
from collections import deque

N = int(input())
A = []
for _ in range(N):
  a = int(input())
  A.append(a)

b = deque([])
for a in A:
  if len(b) == 0:
    b.append(a)
  else:
    if a <= b[0]:
      b.appendleft(a)
    else:
      b[bisect.bisect_left(b, a) - 1] = a
print(len(b))
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())

to = [[] for _ in range(N)]
dist = [[0 for _ in range(3)] for _ in range(100005)]
for i in range(M):
  a, b = map(int, input().split())
  a -= 1
  b -= 1
  to[a].append(b)

sv, tv = map(int, input().split())
sv -= 1
tv -= 1

for i in range(N):
  for j in range(3):
    dist[i][j] = float("inf")
q = [[sv, 0]]
dist[sv][0] = 0
while len(q) != 0:
  v = q[0][0]
  l = q[0][1]
  q.pop(0)
  for u in to[v]:
    nl = (l + 1) % 3
    if dist[u][nl] != float("inf"):
      continue
    dist[u][nl] = dist[v][l] + 1
    q.append([u, nl])
ans = dist[tv][0]
if ans == float("inf"):
  ans = -1
else:
  ans //= 3
print(ans)

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

to = [[] for _ in range(N)]
dist = [[0 for _ in range(3)] for _ in range(100005)]
for i in range(M):
  a, b = map(int, input().split())
  a -= 1
  b -= 1
  to[a].append(b)

sv, tv = map(int, input().split())
sv -= 1
tv -= 1

for i in range(N):
  for j in range(3):
    dist[i][j] = float("inf")
q = [[sv, 0]]
dist[sv][0] = 0
while len(q) != 0:
  v = q[0][0]
  l = q[0][1]
  q.pop(0)
  for u in to[v]:
    nl = (l + 1) % 3
    if dist[u][nl] != float("inf"):
      continue
    dist[u][nl] = dist[v][l] + 1
    q.append([u, nl])
ans = dist[tv][0]
if ans == float("inf"):
  ans = -1
else:
  ans //= 3
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
S = list(map(int, input().split()))
T = list(map(int, input().split()))
S.append(0)
T.append(0)
MOD = 10 ** 9 + 7

dp0 = [[0 for _ in range(2005)] for _ in range(2005)]
dp1 = [[0 for _ in range(2005)] for _ in range(2005)]

dp0[0][0] = 1
for i in range(N + 1):
  for j in range(M + 1):
    dp0[i + 1][j] += dp0[i][j]
    dp1[i][j] += dp0[i][j]
    dp1[i][j + 1] += dp1[i][j]

    if S[i] == T[j]:
      dp0[i + 1][j + 1] += dp1[i][j]
ans = dp1[N][M]
print(ans % MOD)

Fixed submission:
N, M = map(int, input().split())
S = list(map(int, input().split()))
T = list(map(int, input().split()))
S.append(0)
T.append(0)
MOD = 1000000007

dp0 = [[0 for _ in range(2005)] for _ in range(2005)]
dp1 = [[0 for _ in range(2005)] for _ in range(2005)]

dp0[0][0] = 1
for i in range(N + 1):
  for j in range(M + 1):
    dp0[i + 1][j] += dp0[i][j] % MOD
    dp1[i][j] += dp0[i][j] % MOD
    dp1[i][j + 1] += dp1[i][j] % MOD

    if S[i] == T[j]:
      dp0[i + 1][j + 1] += dp1[i][j] % MOD
ans = dp1[N][M]
print(ans % MOD)

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
S = list(map(int, input().split()))
T = list(map(int, input().split()))
S.append(0)
T.append(0)
MOD = 10 ** 9 + 7

dp0 = [[0 for _ in range(2005)] for _ in range(2005)]
dp1 = [[0 for _ in range(2005)] for _ in range(2005)]

dp0[0][0] = 1
for i in range(N + 1):
  for j in range(M + 1):
    dp0[i + 1][j] += dp0[i][j]
    dp1[i][j] += dp0[i][j]
    dp1[i][j + 1] += dp1[i][j]

    if S[i] == T[j]:
      dp0[i + 1][j + 1] += dp1[i][j]
ans = dp1[N][M]
print(ans % MOD)

Fixed submission:
N, M = map(int, input().split())
S = list(map(int, input().split()))
T = list(map(int, input().split()))
S.append(0)
T.append(0)
MOD = 1000000007

dp0 = [[0 for _ in range(2005)] for _ in range(2005)]
dp1 = [[0 for _ in range(2005)] for _ in range(2005)]

dp0[0][0] = 1
for i in range(N + 1):
  for j in range(M + 1):
    dp0[i + 1][j] += dp0[i][j] % MOD
    dp1[i][j] += dp0[i][j] % MOD
    dp1[i][j + 1] += dp1[i][j] % MOD

    if S[i] == T[j]:
      dp0[i + 1][j + 1] += dp1[i][j] % MOD
ans = dp1[N][M]
print(ans % MOD)
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
V = list(map(int, input().split()))

def opA(D, v):
  ret = True
  if len(v) != 0:
    D.append(v.pop(0))
  else:
    ret = False
  return D, v, ret

def opB(D, v):
  ret = True
  if len(v) != 0:
    D.append(v.pop(-1))
  else:
    ret = False
  return D, v, ret

def opC(D, v):
  ret = True
  if len(D) != 0:
    v.insert(0, min(D))
    D.remove(min(D))
  else:
    ret = False
  return D, v, ret

def opD(D, v):
  ret = True
  if len(D) != 0:
    v.append(min(D))
    D.remove(min(D))
  else:
    ret = False
  return D, v, ret

def dp(n, D, v, op):
  if n == K:
    return sum(D)
  
  if op == 0:
    D, v, ret = opA(D, v)
  elif op == 1:
    D, v, ret = opB(D, v)
  elif op == 2:
    D, v, ret = opC(D, v)
  else:
    D, v, ret = opD(D, v)
  
  if ret == False:
    return sum(D)

  return max(dp(n + 1, D.copy(), v.copy(), 0), dp(n + 1, D.copy(), v.copy(), 1), dp(n + 1, D.copy(), v.copy(), 2), dp(n + 1, D.copy(), v.copy(), 3))

print(max(dp(0, [], V.copy(), 0), dp(0, [], V.copy(), 1), dp(0, [], V.copy(), 2), dp(0, [], V.copy(), 3)))

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

R = min(N, K)
l = []
ans = 0
for a in range(R + 1):
  for b in range(R + 1 - a):
    l = V[:a] + V[N - b:]
    l.sort()
    for i in range(K - a - b + 1):
      ans = max(ans, sum(l[i:]))
print(max(ans, 0))

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

def opA(D, v):
  if len(v) != 0:
    D.append(v.pop(0))
  return D, v

def opB(D, v):
  if len(v) != 0:
    D.append(v.pop(-1))
  return D, v

def opC(D, v):
  if len(D) != 0:
    v.insert(0, min(D))
    D.remove(min(D))
  return D, v

def opD(D, v):
  if len(D) != 0:
    v.append(min(D))
    D.remove(min(D))
  return D, v

def dp(n, D, v, op):
  if n == K:
    return sum(D)
  
  if op == 0:
    D, v = opA(D, v)
  elif op == 1:
    D, v = opB(D, v)
  elif op == 2:
    D, v = opC(D, v)
  else:
    D, v = opD(D, v)
  return max(dp(n + 1, D.copy(), v.copy(), 0), dp(n + 1, D.copy(), v.copy(), 1), dp(n + 1, D.copy(), v.copy(), 2), dp(n + 1, D.copy(), v.copy(), 3))

print(max(dp(0, [], V.copy(), 0), dp(0, [], V.copy(), 1), dp(0, [], V.copy(), 2), dp(0, [], V.copy(), 3)))

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

R = min(N, K)
l = []
ans = 0
for a in range(R + 1):
  for b in range(R + 1 - a):
    l = V[:a] + V[N - b:]
    l.sort()
    for i in range(K - a - b + 1):
      ans = max(ans, sum(l[i:]))
print(max(ans, 0))
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())

s = set()
for i in range(M):
  L, R = map(int, input().split())
  tmp = set()
  for j in range(L, R + 1):
    tmp |= {j}
  if i == 0:
    s |= tmp
  else:
    s &= tmp

print(len(s))

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

tmpL = 0
tmpR = float("inf")
for i in range(M):
  L, R = map(int, input().split())
  tmpL = max(tmpL, L)
  tmpR = min(tmpR, R)

if tmpR - tmpL < 0:
  print(0)
else:
  print(tmpR - tmpL + 1)
Buggy python submission (verdict: Runtime Error):
N = int(input())

def make_divisors(n):
  divisors = []
  for i in range(1, int(n ** 0.5) + 1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i:
        divisors.append(n // i)
  return divisors

div = make_divisors(N)
ans = 0
for d in div:
  if N // (d - 1) == N % (d - 1):
    ans += d - 1

print(ans)

Fixed submission:
import math

N = int(input())

ans = 0
for i in range(1, int(math.sqrt(N)) + 1):
  if i > N / 2:
    continue
  tmp = int((N - i) / i)
  if (N - i) % i == 0 and N % tmp != 0 and tmp >= math.sqrt(N):
    ans += tmp

print(ans)

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

N = int(input())

ans = 0
for i in range(1, int(math.sqrt(N)) + 1):
  tmp = int((N - i) / i)
  if (N - i) % i == 0 and N % tmp != 0 and tmp >= math.sqrt(N):
    ans += tmp

print(ans)

Fixed submission:
import math

N = int(input())

ans = 0
for i in range(1, int(math.sqrt(N)) + 1):
  if i > N / 2:
    continue
  tmp = int((N - i) / i)
  if (N - i) % i == 0 and N % tmp != 0 and tmp >= math.sqrt(N):
    ans += tmp

print(ans)

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

N = int(input())

ans = 0
for i in range(1, int(math.sqrt(N)) + 1):
  tmp = int((N - i) / i)
  if (N - i) % i == 0 and N % tmp != 0 and tmp >= math.sqrt(N):
    ans += tmp

print(ans)

Fixed submission:
import math

N = int(input())

ans = 0
for i in range(1, int(math.sqrt(N)) + 1):
  if i > N / 2:
    continue
  tmp = int((N - i) / i)
  if (N - i) % i == 0 and N % tmp != 0 and tmp >= math.sqrt(N):
    ans += tmp

print(ans)
Buggy python submission (verdict: Runtime Error):
menu = [int(input()) for _ in range(5)]

cnt = 0
l = []
for m in menu:
  cnt += m
  mod = cnt % 10
  if mod != 0:
    cnt += 10 - mod
    l.append(mod)

if l.count != 0:
  cnt -= 10 - min(l)
print(cnt)

Fixed submission:
menu = [int(input()) for _ in range(5)]

cnt = 0
l = [10]
for m in menu:
  cnt += m
  mod = cnt % 10
  if mod != 0:
    cnt += 10 - mod
    l.append(mod)

cnt -= 10 - min(l)
print(cnt)

Buggy python submission (verdict: Runtime Error):
menu = [int(input()) for _ in range(5)]

cnt = 0
l = []
for m in menu:
  cnt += m
  mod = cnt % 10
  if mod != 0:
    cnt += 10 - mod
    l.append(mod)

cnt -= 10 - min(l)
print(cnt)

Fixed submission:
menu = [int(input()) for _ in range(5)]

cnt = 0
l = [10]
for m in menu:
  cnt += m
  mod = cnt % 10
  if mod != 0:
    cnt += 10 - mod
    l.append(mod)

cnt -= 10 - min(l)
print(cnt)
Buggy python submission (verdict: Runtime Error):
N = int(input())
memo = [{} for _ in range(N + 1)]

def ok(last4):
  for i in range(4):
    s = list(last4)
    if i >= 1:
      s[i - 1]. s[i] = s[i], s[i - 1]
    if "".join(s).count("AGC") >= 1:
      return False
    return True

def dfs(last3, n):
  if last3 in memo[n]:
    return memo[n][last3]
  if n == N:
    return 1
  ret = 0
  for c in "AGCT":
    if ok(last3 + c):
      ret += dfs(last3[1:] + c, n + 1) % (10 ** 9 + 7)
  memo[n][last3] = ret
  return ret

print(dfs("TTT", 0))

Fixed submission:
b = input()
if b == "A":
  print("T")
elif b == "C":
  print("G")
elif b == "G":
  print("C")
else:
  print("A")

Buggy python submission (verdict: Runtime Error):
N, Q = map(int, input().split())
S = input()

AC_list = []
cnt = 0
for i in range(N):
  if i != 0 and S[i - 1] == "A" and S[i] == "C":
    cnt += 1
  AC_list.append(cnt)

for _ in range(Q):
  l, r = map(int, input().split())
  print(AC_list[r - 1] - AC_list[l - 1])

Fixed submission:
b = input()
if b == "A":
  print("T")
elif b == "C":
  print("G")
elif b == "G":
  print("C")
else:
  print("A")
Buggy python submission (verdict: Time Limit Exceeded):
N, Q = map(int, input().split())
S = input()

for _ in range(Q):
  l, r = map(int, input().split())
  cnt = 0
  for i in range(l - 1, r):
    if i != r - 1 and S[i] == "A" and S[i + 1] == "C":
      cnt += 1
  print(cnt)

Fixed submission:
N, Q = map(int, input().split())
S = input()

AC_list = []
cnt = 0
for i in range(N):
  if i != 0 and S[i - 1] == "A" and S[i] == "C":
    cnt += 1
  AC_list.append(cnt)

for _ in range(Q):
  l, r = map(int, input().split())
  print(AC_list[r - 1] - AC_list[l - 1])
Buggy python submission (verdict: Time Limit Exceeded):
A, B = map(int, input().split())
ans = A
for i in range(A + 1, B + 1):
  ans = ans ^ i
print(ans)

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

def xor(n):
  if n % 2 == 0:
    if int(n / 2) % 2 == 0:
      return n
    else:
      return n ^ 1
  else:
    if int((n + 1) / 2) % 2 == 0:
      return 0
    else:
      return 1

if A == B:
  print(A)
else:
  print(xor(A - 1) ^ xor(B))
Buggy python submission (verdict: Runtime Error):
S = map(int, input().split("/"))
if S[1] > 4:
  print("TBD")
else:
  print("Heisei")

Fixed submission:
S = list(map(int, input().split("/")))
if S[1] > 4:
  print("TBD")
else:
  print("Heisei")
Buggy python submission (verdict: Time Limit Exceeded):
def game(n, m, x_list):
  if n >= m:
    return 0
  
  x_list.sort()
  interval = []
  for i in range(m - 1):
    interval.append(x_list[i + 1] - x_list[i])
    interval.sort(reverse = True)
    if len(interval) > n - 1:
      del(interval[n - 1])
  
  return abs(x_list[m - 1] - x_list[0]) - sum(interval)

n, m = map(int, input().split())
x = list(map(int, input().split()))

print(game(n, m, x))

Fixed submission:
def game(n, m, x_list):
  if n >= m:
    return 0
  
  x_list.sort()
  interval = []
  for i in range(m - 1):
    interval.append(x_list[i + 1] - x_list[i])
  interval.sort(reverse = True)
  sum_interval = 0
  for i in range(n - 1):
    sum_interval += interval[i]
  return x_list[m - 1] - x_list[0] - sum_interval

n, m = map(int, input().split())
x = list(map(int, input().split()))

print(game(n, m, x))

Buggy python submission (verdict: Runtime Error):
def game(n, m, x_list):
  if n >= m:
    return 0
  x_list.sort()
  count = 0
  stone = [x_list[0]]
  
  interval = []
  for i in range(m - 1):
    interval.append(x_list[i + 1] - x_list[i])
    interval.sort(reverse = True)
    if len(interval) > n - 1:
      del(interval[n - 1])
  tmp = 0
  for i in range(n - 1):
    for j in range(tmp, m - 1):
      if x_list[j + 1] - x_list[j] == interval[i]:
        stone.append(x_list[j + 1])
        tmp = j + 1
        break
  stone.sort()

  tmp = 1
  for i in range(n):
    for j in range(tmp, m):
      if i == n - 1:
        if x_list[j] == stone[n - 1]:
          count += abs(x_list[m - 1] - x_list[j])
          break
      elif x_list[j] == stone[i + 1]:
        count += abs(x_list[j - 1] - stone[i])
        tmp = j + 1
        break
  return count

n, m = map(int, input().split())
x = list(map(int, input().split()))

print(game(n, m, x))

Fixed submission:
def game(n, m, x_list):
  if n >= m:
    return 0
  
  x_list.sort()
  interval = []
  for i in range(m - 1):
    interval.append(x_list[i + 1] - x_list[i])
  interval.sort(reverse = True)
  sum_interval = 0
  for i in range(n - 1):
    sum_interval += interval[i]
  return x_list[m - 1] - x_list[0] - sum_interval

n, m = map(int, input().split())
x = list(map(int, input().split()))

print(game(n, m, x))
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
a = list(map(int, input().split()))
a_copy = [] + a
a_digit = [0 for i in range(n)]
digit = []
k_bin = list(map(int, str(bin(k)).replace("0b", "")))

same = True
for _ in range(len(k_bin)):
  for i in range(n):
    a_digit[i] = a[i] % 2
    a[i] = int(a[i] / 2)
  if a_digit.count(0) >= n / 2:
    if same:
      if k_bin[i] == 0:
        digit.append(0)
      else:
        digit.append(1)
    else:
      digit.append(1)
  else:
    digit.append(0)
    if k_bin[i] == 1:
      same = False

x = 0
for i in range(len(digit)):
  x += 2 ** i * digit[i]
ans = 0
for ai in a_copy:
  ans += ai ^ x
print(ans)

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

X = 0
k = 1 << 41
for _ in range(41):
  k = k >> 1
  if X + k > K:
    continue
  
  count = 0
  for i in range(N):
    if A[i] & k:
      count += 1
  
  if count < N / 2:
    X += k
    
ans = 0
for i in range(N):
  ans += A[i] ^ X
  
print(ans)
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
PYI = []
for i in range(M):
  pi, yi = map(int, input().split())
  PYI.append("{:06}{:06}{:06}".format(pi, yi, i))
  
ID = ["" for i in range(M)]
PYI.sort()
count = 0
for i in range(M):
  y = int(PYI[i][6 : 12])
  if i == 0 or PYI[i][0 : 6] != PYI[i - 1][0 : 6]:
    count = 1
  else:
    count += 1
  ID[int(PYI[i][12 :])] = "{}{:06}".format(PYI[i][0 : 6], count)

for i in range(M):
  print(ID[i])

Fixed submission:
N, M = map(int, input().split())
iPYx = []
for i in range(M):
  P, Y = map(int, input().split())
  iPYx.append([i, P, Y])

iPYx.sort(key = lambda x: (x[1], x[2]))
cnt = 0
for i in range(M):
  if i == 0 or iPYx[i][1] != iPYx[i - 1][1]:
    cnt = 1
  else:
    cnt += 1
  iPYx[i].append(cnt)
iPYx.sort(key = lambda x: x[0])
for i in range(M):
  print("{:06}{:06}".format(iPYx[i][1], iPYx[i][3]))

Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
PYI = []
for i in range(M):
  pi, yi = map(int, input().split())
  PYI.append("{:06}{:06}{:06}".format(pi, yi, i))
ID = ["" for i in range(M)]
PYI.sort()
count = 0
for i in range(M):
  y = int(PYI[i][6 : 12])
  if i == 0 or PYI[i][0 : 6] != PYI[i - 1][0 : 6]:
    count = 1
  else:
    count += 1
  ID[int(PYI[i][12 :])] = "{}{:06}".format(PYI[i][0 : 6], count)
for i in range(M):
  print(ID[i])

Fixed submission:
N, M = map(int, input().split())
iPYx = []
for i in range(M):
  P, Y = map(int, input().split())
  iPYx.append([i, P, Y])

iPYx.sort(key = lambda x: (x[1], x[2]))
cnt = 0
for i in range(M):
  if i == 0 or iPYx[i][1] != iPYx[i - 1][1]:
    cnt = 1
  else:
    cnt += 1
  iPYx[i].append(cnt)
iPYx.sort(key = lambda x: x[0])
for i in range(M):
  print("{:06}{:06}".format(iPYx[i][1], iPYx[i][3]))
Buggy python submission (verdict: Time Limit Exceeded):
S = input()
T = input()

def trans(c1, c2):
  tmp = ","
  return S.replace(c1, tmp).replace(c2, c1).replace(tmp, c2)

for i in range(len(S)):
  if S[i] != T[i]:
    S = trans(S[i], T[i])
if S == T:
  print("Yes")
else:
  print("No")

Fixed submission:
S = input()
T = input()

R = {chr(i) : -1 for i in range(97, 97 + 26)}
Rd = {chr(i) : -1 for i in range(97, 97 + 26)}

def check(i):
  ret = True
  if R[S[i]] >= 0 and R[S[i]] != ord(T[i]):
    ret = False
  if Rd[T[i]] >= 0 and Rd[T[i]] != ord(S[i]):
    ret = False
  if R[S[i]] < 0:
    R[S[i]] = ord(T[i])
  if Rd[T[i]] < 0:
    Rd[T[i]] = ord(S[i])
  return ret

ans = "Yes"
for i in range(len(S)):
  if not check(i):
    ans = "No"
    break
print(ans)
Buggy python submission (verdict: Runtime Error):
x1, y1, x2, y2 = map(int, input().split())

a = x2 - x1
b = y2 - y1

x3 = x2 - b
y3 = y2 + a
x4 = x1 - b
y4 = y1 + a

print("{} {} {} {}".format(x3, y3, x4, y4))

Fixed submission:
K = int(input())
print((K - int(K / 2)) * int(K / 2))
Buggy python submission (verdict: Runtime Error):
from fractions import gcd
A,B,C,D=map(int, input().split())
A -= 1

cc = B//C - A//C
dd = B//D - A//D

E = C*D//fractions.gcd(C, D)
ee = B//E - A//E

print(B - A - cc - dd + ee)

Fixed submission:
from fractions import gcd
A,B,C,D=map(int, input().split())
A -= 1

cc = B//C - A//C
dd = B//D - A//D

E = C*D//gcd(C, D)
ee = B//E - A//E

print(B - A - cc - dd + ee)
Buggy python submission (verdict: Runtime Error):
W, H, x, y = map(int, input().split())

if (x == 0 and y == 0) or (x == W and y == H) or (x == 0 and y == H) or (x == W and y == 0):
    print((W*H)/2, 0)
elif x = W/2 and y = H/2:
    print((W*H)/2, 1)
else:
    A = W*y
    B = W*(H-y)
    C = H*x
    D = H*(W-x)
    dup = 0
    if min(A,B) == min(C,D):
        dup = 1
    print(max(min(A,B), min(C,D)), dup)

Fixed submission:
W, H, x, y = map(int, input().split())

if x == W/2 and y == H/2:
    print((W*H)/2, 1)
else:
    print((W*H)/2, 0)

Buggy python submission (verdict: Runtime Error):
W, H, x, y = map(int, input().split())

if (x == 0 and y == 0) or (x == W and y == H) or (x == 0 and y == H) or (x == W and y == 0):
    print((W*H)/2, 0)
elif (x/y == W/H) or (y/x == H/W):
    print((W*H)/2, 0)
elif abs(W/2-x) > abs(H/2-y):
    A = W*y
    B = W*(H-y)
    print(min(A,B), 0)
elif abs(H/2-y) > abs(W/2-x):
    A = H*x
    B = H*(W-x)
    print(min(A,B), 0)
else:
    print((W*H)/2, 1)

Fixed submission:
W, H, x, y = map(int, input().split())

if x == W/2 and y == H/2:
    print((W*H)/2, 1)
else:
    print((W*H)/2, 0)
Buggy python submission (verdict: Runtime Error):
N = int(input())
xy = [0] * N
for i in range(N):
    xy[i] = tuple(map(int, input().split()))

case = []
for x,y in xy:
    for xx, yy in xy:
        if x == xx and y == yy:
            continue
        score = N
        xs = xx - x
        ys = yy - y
        for xxx,yyy in xy:
            if x == xxx and y == yyy:
                continue
            if (xxx - xs,yyy - ys) in xy:
                score -= 1
        case.append(score)
print(min(case))

Fixed submission:
N = int(input())
xy = [0] * N
for i in range(N):
    xy[i] = tuple(map(int, input().split()))

case = [N]
for x,y in xy:
    for xx, yy in xy:
        if x == xx and y == yy:
            continue
        score = N
        xs = xx - x
        ys = yy - y
        for xxx,yyy in xy:
            if x == xxx and y == yyy:
                continue
            if (xxx - xs,yyy - ys) in xy:
                score -= 1
        case.append(score)
print(min(case))