Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p03014 (python)

Fixed submission:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import numpy


def main():
  r, c = map(int, input().split())
  g = numpy.array([[1 if v == '.' else 0 for v in input().strip()] for _ in range(r)])
  g = numpy.array([g, g])

  for x in range(1, c):
    g[0, :, x] += g[0, :, x] * g[0, :, x - 1]

  for x in range(c - 2, -1, -1):
    g[0, :, x] = (g[0, :, x] != 0) * numpy.maximum(g[0, :, x], g[0, :, x + 1])

  for y in range(1, r):
    g[1, y] += g[1, y] * g[1, y - 1]

  for y in range(r - 2, -1, -1):
    g[1, y] = (g[1, y] != 0) * numpy.maximum(g[1, y], g[1, y + 1])

  g = g[0] + g[1]

  print(numpy.max(g) - 1)


if __name__ == '__main__':
  main()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import numpy


def main():
  r, c = map(int, input().split())
  g = numpy.array([[1 if v == '.' else 0 for v in input().strip()] for _ in range(r)])
  g = numpy.stack([g, g])

  for x in range(1, c):
    g[0, :, x] += g[0, :, x] * g[0, :, x - 1]

  for x in range(c - 2, -1, -1):
    g[0, :, x] = (g[0, :, x] != 0) * numpy.maximum(g[0, :, x], g[0, :, x + 1])

  for y in range(1, r):
    g[1, y] += g[1, y] * g[1, y - 1]

  for y in range(r - 2, -1, -1):
    g[1, y] = (g[1, y] != 0) * numpy.maximum(g[1, y], g[1, y + 1])

  g = g[0] + g[1]

  print(numpy.max(g) - 1)


if __name__ == '__main__':
  main()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import numpy


def main():
  r, c = map(int, input().split())
  g = numpy.array([[1 if v == '.' else 0 for v in input().strip()] for _ in range(r)])
  g = numpy.stack([g, g])

  print(g[0])

  for x in range(1, c):
    g[0, :, x] += g[0, :, x] * g[0, :, x - 1]

  for x in range(c - 2, -1, -1):
    g[0, :, x] = (g[0, :, x] != 0) * numpy.maximum(g[0, :, x], g[0, :, x + 1])

  for y in range(1, r):
    g[1, y] += g[1, y] * g[1, y - 1]

  for y in range(r - 2, -1, -1):
    g[1, y] = (g[1, y] != 0) * numpy.maximum(g[1, y], g[1, y + 1])

  g = g[0] + g[1]

  print(numpy.max(g) - 1)


if __name__ == '__main__':
  main()
Problem p03095 (python)

Fixed submission:
#!/usr/bin/env python
# -*- coding: utf-8 -*-


def main():
  input()
  string = input().strip()

  count = [0] * 26

  for c in string:
    count[ord(c) - 97] += 1

  table = count[:]
  value = sum(count)

  for _ in range(len(count) - 1):
    for i in range(len(count)):
      table[i] = count[i] * sum(table[i + 1:])

    value = (value + sum(table)) % int(1.0e+9 + 7)

  print(value, flush=True)


if __name__ == '__main__':
  main()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python
# -*- coding: utf-8 -*-


def main():
  n = int(input())
  prev = -1
  nums = []
  table = {}

  for _ in range(n):
    v = int(input())

    if v != prev:
      nums.append(v)
      prev = v

  for i, n in enumerate(nums):
    if n not in table:
      table[n] = []

    table[n].append(i)

  values = [0] * len(nums)
  value = 1

  for i in range(len(nums)):
    values[i] += value

    for j in table[nums[i]]:
      if j <= i:
        continue

      values[j] += value

    value = values[i]

  print(value % int(1e+9 + 7), flush=True)


if __name__ == '__main__':
  main()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python
# -*- coding: utf-8 -*-


def main():
  n = int(input())
  prev = -1
  nums = []
  table = {}

  for _ in range(n):
    v = int(input())

    if v != prev:
      nums.append(v)
      prev = v

  for i, n in enumerate(nums):
    if n not in table:
      table[n] = []

    table[n].append(i)

  values = [0] * len(nums)
  value = 1

  for i in range(len(nums)):
    values[i] += value

    for j in table[nums[i]]:
      if j <= i:
        continue

      values[j] += value

    value = values[i] % int(1e+9 + 7)

  print(value, flush=True)


if __name__ == '__main__':
  main()
Problem p02642 (python)

Fixed submission:
import sys
from collections import Counter

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n = ni()
a = na()
a.sort()
cnt = Counter(a)
elem = [True]*(a[-1]+1)

for i in a:
  for j in range(i*2,a[-1]+1,i):
    elem[j] = False
ans = 0
for v in a:
  if elem[v] == True and cnt[v] == 1:
    ans += 1
    
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
from collections import Counter

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n = ni()
a = na()
a.sort()
cnt = Counter(a)
elem = [True]*(a[-1]+1)

for i in a:
  j = i*2
  while j <= a[-1]+1:
    elem[j] = False
    j += i
ans = 0
for v in a:
  if elem[v] == True and cnt[v] == 1:
    ans += 1
    
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
import collections

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n = ni()
a = na()
a.sort()
cnt = collections.Counter(a)


elem = [True]*(a[-1]+1)
for i in a:
  for j in range(i*2,len(elem)+1,i):
    elem[j] = False
ans = 0
for v in a:
  if elem[v] == True and cnt[v] == 1:
    ans += 1
    
print(ans)
Problem p02705 (python)

Fixed submission:
R = int(input())
import math
print(2*R*math.pi)

Buggy submission (verdict: Runtime Error):
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n,k = na()
mod = 10**9 + 7
ans = 1
for i in range(k, n+1):
  ans += (2*n-i+1)*i//2-i*(i-1)//2+1
  ans %= mod

print(ans)
Problem p02848 (python)

Fixed submission:
N = int(input())
S = list(input())

result = ''
for i in range(0,len(S)):
  num = ord(S[i])
  if num + N > 90:
    p = num + N - 90 + 64
  else:
    p = num + N
  new = chr(p)
  result += new

print(result)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = list(input())

result = ''
for i in range(0,N):
  num = ord(S[i])
  new = chr(num+2)
  result += new

print(result)
Problem p04043 (python)

Fixed submission:
a = list(map(int, input().split()))
print("YES" if a.count(5) == 2 and a.count(7) == 1 else "NO")

Buggy submission (verdict: Runtime Error):
A B C = list(map(int, input().split()))
a = A B C
print("Yes" if a[0]== a[2] == 5 and a[1] == 7 else "No")
Problem p02705 (python)

Fixed submission:
import math
r = int(input())
s = 2 * r * math.pi
print(s)

Buggy submission (verdict: Runtime Error):
n = int(input())
A = list(map(int, input().split()))
ans = [0 for i in range(n)]
for i in range(n-1):
    ans[A[i]-1] += 1

print(ans)

Buggy submission (verdict: Runtime Error):
import.math
x= int(input())
y = 2*math.pi*x
print(y)
Problem p02885 (python)

Fixed submission:
a, b = map(int, input().split())
if a - 2*b < 0:
    print("0")
else:
    print(a-2*b)

Buggy submission (verdict: Runtime Error):
import itertools
n = int(input())
d = list(map(int, input().split()))
a = 0
for x in itertools.combinations(d, 2):
    a += x[0]*x[1]
print(a)
Problem p02934 (python)

Fixed submission:
n = int(input())
A = list(map(int, input().split()))
ans = 0
for x in A:
    ans += 1/x
print(1/ans)

Buggy submission (verdict: Runtime Error):
import math
import numpy as np 
n = int(input())
A = list(map(int, input().split()))
gcd = 0
if n == 1:
    print(A[0])

else:
    #最大公約数を求める
    for i in range(n-1):
        if i == 0:
            gcd = math.gcd(A[i], A[i+1])
        else:
            gcd = math.gcd(gcd, A[i+1])

    prod = np.prod(A)

    #最小公倍数
    lcm = prod / gcd

    #逆数
    ans = 0
    #分子の総和を求める
    for i in range(n):
        ans += lcm/A[i]
    ans /= lcm
    ans = 1 / ans

    print(ans)
Problem p02760 (python)

Fixed submission:
b = [0] * 9


def hantei():
    for i in range(3):
        if b[i * 3] == 1 and b[i * 3 + 1] == 1 and b[i * 3 + 2] == 1:
            return True
    for i in range(3):
        if b[i] == 1 and b[i + 3] == 1 and b[i + 6] == 1:
            return True
    if b[0] == 1 and b[4] == 1 and b[8] == 1:
        return True
    if b[2] == 1 and b[4] == 1 and b[6] == 1:
        return True
    return False


a = [0] * 9
[a[0], a[1], a[2]] = input().split()
[a[3], a[4], a[5]] = input().split()
[a[6], a[7], a[8]] = input().split()
a = [int(i) for i in a]

n = int(input())

for i in range(n):
    c = int(input())
    for j in range(len(a)):
        if a[j] == c:
            b[j] = 1

if (hantei()):
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
b = [0] * 9


def hantei():
    for i in range(3):
        if b[i * 3] == 1 and b[i * 3 + 1] == 1 and b[i * 3 + 2] == 1:
            return True
    for i in range(3):
        if b[i * 3] == 1 and b[(i+1) * 3 ] == 1 and b[(i+2) * 3 ] == 1:
            return True
    if b[0] == 1 and b[4] == 1 and b[8] == 1:
        return True
    if b[2] == 1 and b[5] == 1 and b[6] == 1:
        return True
    return False


a = [0] * 9
[a[0], a[1], a[2]] = input().split()
[a[3], a[4], a[5]] = input().split()
[a[6], a[7], a[8]] = input().split()
a = [int(i) for i in a]

n = int(input())

for i in range(n):
    c = int(input())
    for j in range(len(a)):
        if a[j] == c:
            b[j] = 1

if (hantei()):
    print("Yes")
else:
    print("No")
Problem p03001 (python)

Fixed submission:
w, h, x, y = map(int, input().split())
print(float(w) * float(h) / 2, 1 if (w/2 == x) & (h / 2 == y) else 0)

Buggy submission (verdict: Runtime Error):
w, h, x, y = map(int, input().split())
print(float(w) * float(h) / 2, 1 if w/2 == x & h / 2 == y else 0)
Problem p03262 (python)

Fixed submission:
from fractions import gcd
from functools import reduce


def gcd_list(numbers):
    return reduce(gcd, numbers)


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

x_arr = [0] * n

x_arr = list(map(int, input().split()))

for i in range(len(x_arr)):
    x_arr[i] = abs(x_arr[i] - x)
print(gcd_list(x_arr))

Buggy submission (verdict: Runtime Error):
from math import gcd
from functools import reduce


def gcd_list(numbers):
    return reduce(gcd, numbers)


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

x_arr = [0] * n

x_arr = list(map(int, input().split()))

for i in range(len(x_arr)):
    x_arr[i] = abs(x_arr[i] - x)
print(gcd_list(x_arr))
Problem p02630 (python)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
q = int(input())
query = [list(map(int,input().split())) for _ in range(q)]

all_sum  = sum(a)

cnt = {}
for i in a:
    if i not in cnt:
        cnt[i] = 0
    cnt[i] += 1

for (b, c) in query:
    if b in cnt:
        all_sum -= b * cnt[b]
        all_sum += c * cnt[b]
        if c not in cnt:
            cnt[c]=0 
        cnt[c] += cnt[b]
        cnt[b] = 0
    print(all_sum)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
q = int(input())
query = [list(map(int,input().split())) for _ in range(q)]

all_sum  = sum(a)

cnt = {}
for i in a:
    if i not in cnt:
        cnt[a] = 0
    cnt[a] += 1

for (b, c) in query:
    if b in cnt:
        all_sum -= b * cnt[b]
        all_sum += c * cnt[b]
        if c not in cnt:
            cnt[c]=0 
        cnt[c] += cnt[b]
        cnt[b] = 0
    print(all_sum)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
q = int(input())
query = [list(map(int,input().split())) for _ in range(q)]

all_sum  = sum(a)

cnt = {}
for i in a:
    if i not in cnt:
        cnt[a] = 0
    cnt[a] += 1

for (b, c) in query:
    if b in cnt:
        all_sum -= b*cnt[b]
        all_sum += c * cnt[b]
        if c not in cnt:
            cnt[c]=0 
    print(all_sum)
Problem p02705 (python)

Fixed submission:
import math
R = int(input())
print(R * 2 * math.pi)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
ans = [0]*N

for i in A:
    ans[i-1] += 1

for j in ans:
    print(j)
Problem p02713 (python)

Fixed submission:
from math import gcd

K = int(input())
cnt = 0

for i in range(1,K+1):
    for j in range(1,K+1):
        for k in range(1,K+1):
            cnt += gcd(gcd(i,j),k)
print(cnt)

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

K = int(input())
cnt = 0

for i in range(1,K+1):
    for j in range(1,K+1):
        for k in range(1,K+1):
            cnt += gcd(gcd(i,j),k)
print(cnt)
Problem p02756 (python)

Fixed submission:
from collections import deque
S = str(input())
Q = int(input())
query = [ input().split() for _ in range(Q) ]

tag = False
que = deque([S])

for i in range(Q):
    if query[i][0] == str(1):
        if tag == False:
            tag = True
        else:
            tag = False
    elif query[i][0] == str(2):
        if query[i][1] == str(1):
            if tag == False:
                que.appendleft(query[i][2])
            else:
                que.append(query[i][2])
        else:
            if tag == False:
                que.append(query[i][2])
            else:
                que.appendleft(query[i][2])
ans = "".join(que)
if tag == True:
    ans = ans[::-1]
print(ans)

Buggy submission (verdict: Runtime Error):
import collections
N = int(input())
A = list(map(int,input().split()))
C = collections.Counter(A)

ans = 0
for i in C.values():
    ans += int(0.5* i * (i-1))
for j in A:
    print(ans-C[j]+1)
Problem p02761 (python)

Fixed submission:
N,M=map(int,input().split())
li=[0]*N
for i in range(M):
    si,ci=map(int,input().split())
    if li[si-1] != 0 and li[si-1] !=ci:
        print(-1)
        exit(0)
    if si==1 and ci==0:
        if N>1:
            print(-1)
            exit(0)
    li[si-1]=ci
if N>1 and li[0]==0:
    li[0]=1
for i in range(N):
    print(li[i],end="")

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
li=[0]*n
for i in range(M):
    si,ci=map(int,input().split())
    if li[si-1] != 0 and li[si-1] !=ci:
        print(-1)
        exit(0)
    if si==1 and ci==0:
        if N>1:
            print(-1)
            exit(0)
    li[si-1]=ci
if N>1 and li[0]==0:
    li[0]=1
for i in range(N):
    print(li[i],end="")
Problem p02848 (python)

Fixed submission:
N = int(input())
S = str(input())
ans = []
lst = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']

for i in range(len(S)):
    tmp = lst.index(S[i])
    tmp += N
    if tmp > 25:
        tmp -= 26
    ans.append(lst[tmp])
print(''.join(ans))

Buggy submission (verdict: Runtime Error):
N = int(input())
S = str(input())
ans = []
lst = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']

for i in range(len(S)):
    tmp = lst.index(S[i])
    tmp += N
    if tmp > 25:
        tmp -= 25
    ans.append(lst[tmp])
print(''.join(ans))
Problem p02909 (python)

Fixed submission:
S = input()
if S == 'Sunny':
    print('Cloudy')
elif S == 'Cloudy':
    print('Rainy')
elif S == 'Rainy':
    print('Sunny')

Buggy submission (verdict: Runtime Error):
N = int(input())
B = list(map(int,input().split()))
ans = 0

for i in range(N):
    if i == 0:
        ans += B[0]
    elif i == N-1:
        ans += B[-1]
    else:
        ans += min(B[i-1],B[i])
print(ans)
Problem p02923 (python)

Fixed submission:
N = int(input())
H = list(map(int, input().split()))
ans = []
cnt = 0
for i in range(N-1, 0, -1):
    if H[i] <= H[i-1]:
        cnt += 1
    else:
        ans.append(cnt)
        cnt = 0
ans.append(cnt)
print(max(ans))

Buggy submission (verdict: Runtime Error):
N = int(input())
H = list(map(int,input().split()))

ans = []
cnt = 0

for i in range(N-1,0,-1):
    if H[i] <= H[i-1]:
        cnt += 1
    else:
        ans.append(cnt)
        cnt = 0
    ans.append(cnt)
print(max(ans))
Problem p02953 (python)

Fixed submission:
N = int(input())
H = list(map(int,input().split()))
for i in range(N-2,0,-1):
 if H[i]> H[i+1]:
   H[i] -=1
   if H[i] > H[i+1]:
     print('No')
     break
else:
 print('Yes')

Buggy submission (verdict: Runtime Error):
N = int(input())
H = list(map(int,input().split()))
ans = "Yes"
for i in range(1,N):
    if H[i] > H[i+1] + 1:
        ans = "No"
        break
print(ans)
Problem p02981 (python)

Fixed submission:
N, A, B = map(int, input().split())
print(min(A*N, B))

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

L,R = map(int,input().split())
lst = []

if L <= 2019 and R >= 2019:
    print(0)
else:
    for i in range(L,R+1):
        if i % 2019 == 0:
            print(0)
            break
        for j in range(i+1,R+1):
            if j % 2019 == 0:
                print(0)
                break
            lst.append((i * j) % 2019)
        else:
            continue
        break
        print(min(lst))

Buggy submission (verdict: Runtime Error):
import math

n,D = map(int,input().split())

point = []
for _ in range(n):
  x = list(map(int, input().split()))
  point.append(x)

cnt = 0
for i in range(n-1):
  for j in range(i+1, n):
    dist = 0
    for d in range(D):
      dist += (point[i][d] - point[j][d])**2
    dist = math.sqrt(dist)
    if int(dist) == dist:
      cnt += 1
print(cnt)
Problem p02982 (python)

Fixed submission:
import math

n,D = map(int,input().split())

point = []
for _ in range(n):
  x = list(map(int, input().split()))
  point.append(x)

cnt = 0
for i in range(n-1):
  for j in range(i+1, n):
    dist = 0
    for d in range(D):
      dist += (point[i][d] - point[j][d])**2
    dist = math.sqrt(dist)
    if int(dist) == dist:
      cnt += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
import math

n,D = map(int,input().split())

point = []
for _ in range(n):
  x = list(map(int, input().split()))
  point.append(x)

cnt = 0
for i in range(n-1):
  for j in range(i+1, n):
    dist = 0
    for d in range(D):
      dist += (point[i][d] - point[j][d])**2
    dist = mat.sqrt(dist)
    if int(dist) == dist:
      cnt += 1
print(cnt)
Problem p02988 (python)

Fixed submission:
n = int(input())
lst = list(map(int,input().split()))
cnt = 0

for i in range(n-2):
  if lst[i] < lst[i+1] < lst[i+2]  or \
     lst[i] > lst[i+1] > lst[i+2]:
    cnt += 1
    
print(cnt)

Buggy submission (verdict: Runtime Error):
n = int(input())
lst = [int, input().split()]
cnt = 0

for i in range(n-2):
  if lst[1][i] < lst[1][i+1] < lst[1][i+2] or lst[1][i] > lst[1][i+1] > lst[1][i+2] or lst[1][i] = lst[1][i+1] < lst[1][i+2] or lst[1][i] > lst[1][i+1] = lst[1][i+2]:
    cnt += 1
    
print(cnt)
Problem p02994 (python)

Fixed submission:
N, L = map(int, input().split())
lst = []

for i in range(N):
  lst.append(L + (i+1) - 1)
  
if L >= 0:
  print(sum(lst)-lst[0])
elif L+N-1 >= 0:
  print(sum(lst))
else:
  print(sum(lst) - lst[N-1])

Buggy submission (verdict: Runtime Error):
N, L = map(int, input().split())
lst = []

for i in range(N):
  lst.append(L + (i+1) - 1)
  
if L >= 0:
  print(sum(lst)-lst[0])
elif L+N-1 >= 0:
  print(sum(lst))
else:
  print(sum(lst) - lst[n-1])
Problem p02995 (python)

Fixed submission:
from fractions import gcd

def lcm(a, b):
    return a // gcd(a, b) * b

A,B,C,D = list(map(int,input().split()))
C1 = B//C
C2 = (A-1)//C
C3 = B//D
C4 = (A-1)//D
C5 = B//lcm(C,D)
C6 = (A-1)//lcm(C,D)
print((B-(A-1))-((C1-C2)+(C3-C4)-(C5-C6)))

Buggy submission (verdict: Runtime Error):
import math
def lcm(x,y):
    return (x * y) // math.gcd(x,y)

A,B,C,D = map(int,input().split())

cnt = 0
cnt += ((B // C) - ((A-1) // C))
cnt += ((B // D) - ((A-1) // D))

tmp = 0
tmp = ((B//lcm(C,D)) - (A//lcm(C,D)))

print(B-A+1-cnt+tmp)

Buggy submission (verdict: Runtime Error):
import math
def lcm(x,y):
    return (x * y) // math.gcd(x,y)

A,B,C,D = map(int,input().split())

cnt = 0
cnt += ((B // C) - ((A-1) // C))
cnt += ((B // D) - ((A-1) // D))

tmp = 0
tmp = ((B//lcm(C,D)) - (A//lcm(C,D)))

print(B-A+1-cnt+tmp)

Buggy submission (verdict: Runtime Error):
import math
A,B,C,D = map(int,input().split())
cnt = 0
# print(B//C)
# print(A//C)
# print(B//D)
# print(A//D)
# print()
cnt += ((B // C) - ((A-1) // C))
# print(cnt)
cnt += ((B // D) - ((A-1) // D))
# print(cnt)

# print()
# print(B-A+1-cnt)

# かぶっているのを足し戻す
tmp = 0
def lcm(x,y):
    return (x * y) // math.gcd(x,y)
# print(lcm(C,D))

# print(B//lcm(C,D))
# print(A//lcm(C,D))
tmp = ((B//lcm(C,D)) - (A//lcm(C,D)))

print(B-A+1-cnt+tmp)

Buggy submission (verdict: Runtime Error):
import math
A,B,C,D = map(int,input().split())
cnt = 0
# print(B//C)
# print(A//C)
# print(B//D)
# print(A//D)
# print()
cnt += ((B // C) - ((A-1) // C))
# print(cnt)
cnt += ((B // D) - ((A-1) // D))
# print(cnt)

# print()
# print(B-A+1-cnt)

# かぶっているのを足し戻す
tmp = 0
def lcm(x,y):
    return (x * y) // math.gcd(x,y)
# print(lcm(C,D))

# print(B//lcm(C,D))
# print(A//lcm(C,D))
tmp = ((B//lcm(C,D)) - (A//lcm(C,D)))

print(B-A+1-cnt+tmp)
Problem p03071 (python)

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

while tmp<2:
  if A > B:
    cnt+=A
    A-=1
    tmp+=1
  elif A < B:
    cnt+=B
    B-=1
    tmp+=1
  else:
    cnt+=A
    A-=1
    tmp+=1
print(cnt)

Buggy submission (verdict: Runtime Error):
A,B = map(int,input().split())
tmp=0
cnt=0

while tmp<3:
  if A > B:
    cnt+=A
    A-=1
  elif A < B:
    cnt+=B
    B-=1
  else:
    cnt+=A
   A-=1
print(cnt)

Buggy submission (verdict: Runtime Error):
A,B = map(int,input().split())
tmp=0

while tmp<3:
  if A > B:
    cnt+=A
    A-=1
  elif A < B:
    cnt+=B
    B-=1
  else:
    cnt+=A
   A-=1
print(cnt)
Problem p03085 (python)

Fixed submission:
b = input()

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

Buggy submission (verdict: Runtime Error):
b = input()
if b == "A":
  print("T")
elif b == "C":
  print("G")
elif b == "G":
  print("C")
else b == "T":
  print("A")

Buggy submission (verdict: Runtime Error):
b = input()
if b == A:
  print("T")
elif b == C:
  print("G")
elif b == G:
  print("C")
else b == T:
  print("A")
Problem p03102 (python)

Fixed submission:
import numpy as np

N,M,C = map(int,input().split())
B=np.array(list(map(int,input().split())))
ans=0

for i in range(N):
  A=np.array(list(map(int,input().split())))
  if sum(A*B)+C > 0:
    ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
#N,M,C=map(int,input().split())
#B=[int,input() for _ in range(M)]
#
#for i in range(N):
#  A=[int,input() for _ in range(M)]

import numpy as np
  
N,M,C=map(int,input().split())
B=np.array([int,input() for _ in range(M)])
ans=0

for i in range(N):
  A=np.array([int,input() for _ in range(M)])
  if sum(A-B)-10 > 0:
    ans+=1
Problem p03105 (python)

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

if B - A*C >= 0:
  print(C)
else:
  print(B//A)

Buggy submission (verdict: Runtime Error):
A,B,K = map(int,input().split())
hoge=[]

for i in range(1,101):
  if (A%i == 0 and B%i ==0):
    hoge.append(i)

print(hoge[K-1])
Problem p03109 (python)

Fixed submission:
S=input()
if (int(S.replace("/","")) - 20190430) <= 0:
  print("Heisei")
else:
  print("TBD")

Buggy submission (verdict: Runtime Error):
S=input()
S.replace("/","")
if (int(S) - "20190430") <= 0:
  print("Heisei")
else:
  print("TBD")
Problem p03219 (python)

Fixed submission:
X,Y = map(int,input().split())
price = X + Y/2
print(round(price))

Buggy submission (verdict: Runtime Error):
X,Y = map(int,input())
price = X + Y/2
Problem p03239 (python)

Fixed submission:
N,T = map(int,input().split())
c = []
t = []
hoge = []

for i in range(N):
  a,b = map(int,input().split())
  c.append(a)
  t.append(b)

for i in range(N):
  if t[i] <= T:
    hoge.append(c[i])
if hoge != []:
  print(min(hoge))
else:
  print("TLE")

Buggy submission (verdict: Runtime Error):
N,T = map(int,input().split())
c = []
t = []
hoge = []
hogehoge = []

for i in range(N):
  a,b = map(int,input().split())
  c.append(a)
  t.append(b)

for i in range(N):
  if t[i] < T:
    hoge.append(c[i])
print(min(hoge))
Problem p03370 (python)

Fixed submission:
N,X = map(int,input().split())
M = [int(input()) for i in range(N)]
X -= sum(M)
M.sort()
ans = -1
while X >= 0:
  X -= M[0]
  ans += 1
print(ans+N)

Buggy submission (verdict: Runtime Error):
N,X=map(int,input().split())
M = []
cnt = 0
for j in range(N):
  M.append(int,input())
a=X-sum(M)
cnt=a//min(M)+N
print(cnt)