Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import math
from functools import reduce

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

for i in range(len(a)):
	a[i] = abs(a[i] - x)

print(reduce(math.gcd, a))

Fixed submission:
import fractions
from functools import reduce

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

for i in range(len(a)):
	a[i] = abs(a[i] - x)

print(reduce(fractions.gcd, a))

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

N, X = map(int, input().split())
x = list(map(int, input().split()))

ans = []
for i in x:
	ans.append(abs(i - X))

print(reduce(math.gcd, ans))

Fixed submission:
import fractions
from functools import reduce

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

for i in range(len(a)):
	a[i] = abs(a[i] - x)

print(reduce(fractions.gcd, a))

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

N, X = map(int,input().split())
arr = list(map(int,input().split()))

for i in range(len(arr)):
    arr[i] -= X
    
df = []
for i in range(1, len(arr)):
    df.append(arr[i] - arr[i-1])

if(N == 1):
    df.append(arr[0])

ans = 0
for num in df:
    ans = math.gcd(ans, num)
    
print(ans)

Fixed submission:
import fractions
from functools import reduce

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

for i in range(len(a)):
	a[i] = abs(a[i] - x)

print(reduce(fractions.gcd, a))

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

N, X = map(int,input().split())
arr = list(map(int,input().split()))

for i in range(len(arr)):
    arr[i] -= X
    
df = []
for i in range(1, len(arr)):
    df.append(arr[i] - arr[i-1])

if(N == 1):
    df.append(arr[0])

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

print(gcd_list(df))

Fixed submission:
import fractions
from functools import reduce

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

for i in range(len(a)):
	a[i] = abs(a[i] - x)

print(reduce(fractions.gcd, a))
Buggy python submission (verdict: Runtime Error):
N = int(input())

import collections
l = []
for n in range(N):
  S = input()
  l.append(S)

c = collections.Counter(l)


print("AC x " + c['AC'])
print("WA x " + c['WA'])
print("TLE x " + c['TLE'])
print("RE x " + c['RE'])

Fixed submission:
N = int(input())

import collections
l = []
for n in range(N):
  S = input()
  l.append(S)

c = collections.Counter(l)


print("AC x " + str(c['AC']))
print("WA x " + str(c['WA']))
print("TLE x " + str(c['TLE']))
print("RE x " + str(c['RE']))

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

import collections
l = []
for n in range(N):
  S = input()
  l.append(S)

c = collections.Counter(l)


print("AC x " c['AC'])
print("WA x " c['WA'])
print("TLE x " c['TLE'])
print("RE x " c['RE'])

Fixed submission:
N = int(input())

import collections
l = []
for n in range(N):
  S = input()
  l.append(S)

c = collections.Counter(l)


print("AC x " + str(c['AC']))
print("WA x " + str(c['WA']))
print("TLE x " + str(c['TLE']))
print("RE x " + str(c['RE']))

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

import collections
l = []
for n in range(N):
  S = input()
  l.append(S)

c = collections.Counter(l)


print("AC x "c['AC'])
print("WA x "c['WA'])
print("TLE x "c['TLE'])
print("RE x "c['RE'])

Fixed submission:
N = int(input())

import collections
l = []
for n in range(N):
  S = input()
  l.append(S)

c = collections.Counter(l)


print("AC x " + str(c['AC']))
print("WA x " + str(c['WA']))
print("TLE x " + str(c['TLE']))
print("RE x " + str(c['RE']))
Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int,input().split())
A = list(map(int, input().split()))

for k in range(K):
  imos = [0] * (N+1)
  for i, a in enumerate(A):
    l = max(0, i-a)
    r = min(N, i+1+a)
    imos[l] += 1
    imos[r] -= 1
  imos[0] = min(N, imos[0])
  for i in range(N):
    imos[i+1] = min(N, imos[i] + imos[i+1])
  A = imos[:-1]
  if all(a==N for a in A):
    break

print(*A)
  


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

for k in range(K):
  imos = [0] * (N+1)
  for i, a in enumerate(A):
    l = max(0, i-a)
    r = min(N, i+1+a)
    imos[l] += 1
    imos[r] -= 1
  imos[0] = min(N, imos[0])
  for i in range(N):
    imos[i+1] = min(N, imos[i] + imos[i+1])
  A = imos[:-1]
  if all(a==N for a in A):
    break

print(*A)
Buggy python submission (verdict: Runtime Error):
print(A*B)

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

print(A*B)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

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

ans = 1
for x in A:
  ans *= x
  if ans < 0:
    print(-1)
    exit()

if ans > 1000000000000000000:
  print(-1)
  exit()


print(ans)


Fixed submission:
N = int(input())

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

ans = 1
keta = 0
if 0 in A:
  print(0)
  exit()

for x in A:
  ans *= x
  keta += len(str(x))
  if ans > 1000000000000000000:
    print(-1)
    exit()

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

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

ans = 1
for x in A:
  ans *= x

if ans > 1000000000000000000:
  print(-1)
  exit()

if ans < 0:
  print(-1)
  exit()

print(ans)


Fixed submission:
N = int(input())

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

ans = 1
keta = 0
if 0 in A:
  print(0)
  exit()

for x in A:
  ans *= x
  keta += len(str(x))
  if ans > 1000000000000000000:
    print(-1)
    exit()

print(ans)
Buggy python submission (verdict: Runtime Error):
S = int(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):
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):
S = int(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):
S = int(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):
K = int(input())

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

flag = false
for x in range(A, B+1):
  if x % K == 0:
    flag = True


if flag:
  print("OK")
else: 
  print("NG")

Fixed submission:
K = int(input())

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

flag = False
for x in range(A, B+1):
  if x % K == 0:
    flag = True


if flag:
  print("OK")
else: 
  print("NG")
Buggy python submission (verdict: Runtime Error):
S = input()

r = 1
arr = [0]
for c in S[::-1]:
  arr.append((arr[-1] + int(c) * r) % 2019)
  r *= 10
  r %= 2019
from collections import Counter
ctr = Counter(arr)
ans = 0
for v in ctr.values():
  ans += v*v(v-1)//2
print(ans)

Fixed submission:
S = input()
r = 1
arr = [0]

for c in S[::-1]:
  arr.append((arr[-1] + int(c) * r) % 2019)
  r *= 10
  r %= 2019
from collections import Counter
ctr = Counter(arr)
ans = 0
for v in ctr.values():
  ans += v*(v-1)//2
print(ans)

Buggy python submission (verdict: Runtime Error):
S = input()

r = 1
 arr = [0]
 for c in S[::-1]:
   arr.append((arr[-1] + int(c) * r) % 2019)
   r *= 10
   r %= 2019
from collections import Counter
ctr = Counter(arr)
ans = 0
for v in ctr.values():
  ans += v*v(v-1)//2
print(ans)

Fixed submission:
S = input()
r = 1
arr = [0]

for c in S[::-1]:
  arr.append((arr[-1] + int(c) * r) % 2019)
  r *= 10
  r %= 2019
from collections import Counter
ctr = Counter(arr)
ans = 0
for v in ctr.values():
  ans += v*(v-1)//2
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import itertools
S = input()

l = len(S)

ans = 0
for s, e in itertools.combinations(range(l+1), 2):
  if int(S[s:e]) % 2019 == 0:
    ans += 1

print(ans)


Fixed submission:
S = input()
r = 1
arr = [0]

for c in S[::-1]:
  arr.append((arr[-1] + int(c) * r) % 2019)
  r *= 10
  r %= 2019
from collections import Counter
ctr = Counter(arr)
ans = 0
for v in ctr.values():
  ans += v*(v-1)//2
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import itertools
S = input()

l = len(S)

ans = 0
for s, e in itertools.combinations(range(l+1), 2):
  if int(S[s:e]) % 2019 == 0:
    ans += 1

print(ans)

Fixed submission:
S = input()
r = 1
arr = [0]

for c in S[::-1]:
  arr.append((arr[-1] + int(c) * r) % 2019)
  r *= 10
  r %= 2019
from collections import Counter
ctr = Counter(arr)
ans = 0
for v in ctr.values():
  ans += v*(v-1)//2
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
S = input()

ans = 0
for i in range(len(S)):
  s = S[i]
  for k in range(i+1, len(S)):
    s += S[k]
    if int(s) % 2019 == 0:
      ans += 1

print(ans)


Fixed submission:
S = input()
r = 1
arr = [0]

for c in S[::-1]:
  arr.append((arr[-1] + int(c) * r) % 2019)
  r *= 10
  r %= 2019
from collections import Counter
ctr = Counter(arr)
ans = 0
for v in ctr.values():
  ans += v*(v-1)//2
print(ans)
Buggy python submission (verdict: Runtime Error):
import math

def gcd(*numbers):
    return reduce(math.gcd, numbers)

K = int(input())

ans = 0
for a in range(1, K+1):
  for b in range(1, K+1):
    for c in range(1, K+1):
      ans += gcd(a, b, c)

print(ans)

Fixed submission:
import math

def gcd(*numbers):
    return reduce(math.gcd, numbers)

K = int(input())

ans = 0
for a in range(1, K+1):
  for b in range(1, K+1):
    for c in range(1, K+1):
      ans += math.gcd(math.gcd(a, b), c)

print(ans)

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

def gcd(*numbers):
    return reduce(math.gcd, numbers)

K = int(input())

ans = 0
for a in range(1, K+1):
  for b in range(1, K+1):
    for c in range(1, K+1):
      ans += math.gcd(math.gcd(a, b), c)

print(ans)

Fixed submission:
import math

def gcd(*numbers):
    return reduce(math.gcd, numbers)

K = int(input())

ans = 0
for a in range(1, K+1):
  for b in range(1, K+1):
    for c in range(1, K+1):
      ans += math.gcd(math.gcd(a, b), c)

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

K = int(input())

ans = 0
for a in range(1, K+1):
  for b in range(1, K+1):
    for c in range(1, K+1):
      ans += gcd(a, b, c)

print(ans)

Fixed submission:
import math

def gcd(*numbers):
    return reduce(math.gcd, numbers)

K = int(input())

ans = 0
for a in range(1, K+1):
  for b in range(1, K+1):
    for c in range(1, K+1):
      ans += math.gcd(math.gcd(a, b), c)

print(ans)
Buggy python submission (verdict: Runtime Error):
N, X, Y = map(int, input().split())
X,Y = X-1, Y-1

ans = [0] * N
 
for i in range(N-1):
  for j in range(i+1, N):
    d = min(j-i, abs(i-X) + abs(j-Y) + 1)
    ans[d] += 1

print(*ans([1:], sep='\n'))

Fixed submission:
N, X, Y = map(int, input().split())
X,Y = X-1, Y-1

ans = [0] * N
 
for i in range(N-1):
  for j in range(i+1, N):
    d = min(j-i, abs(i-X) + abs(j-Y) + 1)
    ans[d] += 1

print(*ans[1:], sep='\n')
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
A = list(map(int, input().split()))

for x in range(0, M):
  index = A.index(max(A))
  A[index] = A[index] // 2

print(sum(A))

Fixed submission:
import heapq

N, M = map(int, input().split())
A = [-int(A) for A in input().split()]
heapq.heapify(A)

for x in range(M):
  most = -heapq.heappop(A)
  most //= 2
  heapq.heappush(A, -most)

print(-sum(A))

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

for x in range(0, M):
  A.sort()
  A[len(A)-1] = A[len(A)-1]//2

print(sum(A))

Fixed submission:
import heapq

N, M = map(int, input().split())
A = [-int(A) for A in input().split()]
heapq.heapify(A)

for x in range(M):
  most = -heapq.heappop(A)
  most //= 2
  heapq.heappush(A, -most)

print(-sum(A))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
sum = 0
for i in range(1, N):
  sum += i

print(sum)

Fixed submission:
N = int(input())
N -= 1
print((N*(N+1))//2)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
c = [i for i in range(1, N)]
print(sum(c))

Fixed submission:
N = int(input())
N -= 1
print((N*(N+1))//2)
Buggy python submission (verdict: Runtime Error):
S = input()
N = len(S)
left_R = [0] * N
right_L = [N-1] * N

for i, s in enumerate(S[1:], 1):
  left_R[i] = i if s == 'R' else left_R[i-1]

for i, s in enumerate(S[N-2::-1], 1):
  i = N-1-i
  right_L[i] = i if s == 'L' else right_L[i+1]

anser = [0] * N
for i, (s, R, L) in enumerate(zip(S, left_R, right_L)):
  if s == 'L':
    j = left_R[i]
    if (i+j) & 1:
      j += 1
  else:
    j = right_L[i]
    if (i+j) & 1:
      j -= 1
  answer[j] += 1
print(' '.join(map(str, answer)))
  

Fixed submission:
S = input()
N = len(S)
left_R = [0] * N
right_L = [N-1] * N

for i, s in enumerate(S[1:], 1):
  left_R[i] = i if s == 'R' else left_R[i-1]

for i, s in enumerate(S[N-2::-1], 1):
  i = N-1-i
  right_L[i] = i if s == 'L' else right_L[i+1]

answer = [0] * N
for i, (s, R, L) in enumerate(zip(S, left_R, right_L)):
  if s == 'L':
    j = left_R[i]
    if (i+j) & 1:
      j += 1
  else:
    j = right_L[i]
    if (i+j) & 1:
      j -= 1
  answer[j] += 1
print(' '.join(map(str, answer)))
Buggy python submission (verdict: Runtime Error):
import collections
s = input()
K = int(input())

res = [s[i: j] for i in range(len(s)) for j in range(i + 1, len(s) + 1)] 
  
s = list(set(res))
s.sort()
print(s[K-1])



Fixed submission:
s = input()
N = len(s)
K = int(input())

subs = set()
for i in range(N):
  for j in range(K):
    subs.add(s[i:i+1+j])
  
print(sorted(subs)[K-1])
Buggy python submission (verdict: Time Limit Exceeded):
from operator import itemgetter
import collections
N = int(input())

X = list(map(int, input().split()))
d = {} 
for x in X:
  if x in d:
    d[x] += 1
  else:
    d[x] = 1
    
keys = sorted(d.keys(), reverse = True)

for x in X:
  idx = N//2
  d[x] -= 1
  for k in keys:
    idx -= d[k]
    if idx <= 0:
      print(k)
      break
  d[x] += 1

Fixed submission:
N = int(input())
X = list(map(int,input().split()))
SX = sorted(X)
m1,m2 = SX[N//2-1],SX[N//2]

for a in X:
    print(m2 if a <= m1 else m1)

Buggy python submission (verdict: Time Limit Exceeded):
from operator import itemgetter
import collections
N = int(input())

X = list(map(int, input().split()))
d = {} 
for x in X:
  if x in d:
    d[x] += 1
  else:
    d[x] = 1
    
for x in X:
  idx = N//2
  d[x] -= 1
  for k in sorted(d.keys(), reverse = True):
    idx -= d[k]
    if idx <= 0:
      print(k)
      break
  d[x] += 1

Fixed submission:
N = int(input())
X = list(map(int,input().split()))
SX = sorted(X)
m1,m2 = SX[N//2-1],SX[N//2]

for a in X:
    print(m2 if a <= m1 else m1)

Buggy python submission (verdict: Time Limit Exceeded):
from operator import itemgetter
import collections
N = int(input())

X = list(map(int, input().split()))
d = {} 
for x in X:
  if x in d:
    d[x] += 1
  else:
    d[x] = 1
    
for x in X:
  idx = N//2
  d[x] -= 1
  for k in sorted(d.keys(), reverse = True):
    idx -= d[k]
    if idx <= 0:
      print(k)
      break
  d[x] += 1

Fixed submission:
N = int(input())
X = list(map(int,input().split()))
SX = sorted(X)
m1,m2 = SX[N//2-1],SX[N//2]

for a in X:
    print(m2 if a <= m1 else m1)
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
D = list(map(int, input(split())))

i = N
while True:
  flg = True
  for j in str(i):
    if int(j) in D:
      flg = False
      break

  if flg == True:
    print(i)
    exit()

  i += 1

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

i = N
while True:
  flg = True
  for j in str(i):
    if int(j) in D:
      flg = False
      break

  if flg == True:
    print(i)
    exit()

  i += 1

Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
D = list(map(int, input().split()))
for
ans = ""
for n in str(N):
  a = 0
  while True:
    if int(n) in D:
      n = int(n) + 1
      a = int(n)+1
    else:
      a = int(n)
      ans += str(a)
      break

print(ans)



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

i = N
while True:
  flg = True
  for j in str(i):
    if int(j) in D:
      flg = False
      break

  if flg == True:
    print(i)
    exit()

  i += 1
Buggy python submission (verdict: Runtime Error):
N = int(input())
print(1000*math.ceil(N/1000)-N)

Fixed submission:
import math
N = int(input())
print(1000*math.ceil(N/1000)-N)
Buggy python submission (verdict: Runtime Error):
def resolve():
    N,A,B = map(int,input().split())
    div,mod = divmod(N,A+B)
    pattern = "b"*A+"r"*B
    array = ''
    array+= pattern*div + pattern[:mod]
    print(array.count("b"))
resolve()

Fixed submission:
N,A,B = map(int,input().split())
div,mod = divmod(N,A+B)
print(div*A+min(mod,A))
Buggy python submission (verdict: Runtime Error):
N,S = [int(input()) for _ in range(2)]
if N%2!=0:
  print("No")
else:
  print(S[:(N/2-1)])

Fixed submission:
N = int(input())
S = input()
if N%2!=0:
  print("No")
else:
  if S[:N//2]*2 == S:print("Yes")
  else : print("No")
Buggy python submission (verdict: Runtime Error):
import itertools
    N = int(input())
    print(sum([1 for i,j,k in itertools.product(range(1,N+1),range(1,N+1),range(1,N+1))]))

Fixed submission:
print(int(input())**3)
Buggy python submission (verdict: Runtime Error):
import math
n = int(input())
l=[int(input) for i in range(5)]
print(math.ceil(n/min(l))+4)

Fixed submission:
import math
n=int(input())
l=[int(input()) for i in range(5)]
print(math.ceil(n/min(l))+4)
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())

if  (type(a)=b==int) and (-1000 <= a=b <=1000):
    print(max(a+b,a-b,a*b))


Fixed submission:
a,b=map(int,input().split())

if  (type(a)==int) and( type(b)==int) and (-1000 <= a and 1000>=a ) and (-1000 <= b and 1000>=b ):
    print(max(a+b,a-b,a*b))
Buggy python submission (verdict: Runtime Error):
a,b,c,d=map(int, input().split())

if a.isdigit() and b.isdigit() and  c.isdigit() and d.a.isdigit():
    if 1<=a<=100 and 1<=b<=100 and 1<=c<=100 and 1<=d<=100:
        if (abs(a-b))>=d and (abs(b-c))>=d:
            print("Yes")
        else:
            print("No")


Fixed submission:
a,b,c,d = map(int,input().split())
print("Yes" if abs(a-c)<=d  or  (abs(a-b)<=d and abs(b-c)<=d) else 'No')

Buggy python submission (verdict: Runtime Error):
a,b,c,d=map(int, input().split())

if a.isdigit() and b.isdigit() and  c.isdigit() and d.a.isdigit():
    if 1<=a<=100 and 1<=b<=100 and 1<=c<=100 and 1<=d<=100:
        if (abs(a-b))>=d and (abs(b-c))>=d:
            print("Yes")
        else:
            print("No")


Fixed submission:
a,b,c,d = map(int,input().split())
print("Yes" if abs(a-c)<=d  or  (abs(a-b)<=d and abs(b-c)<=d) else 'No')
Buggy python submission (verdict: Runtime Error):
heck = int(input().replace(" ",""))
print("Yes" if (check**0.5)%1==0 else "No" )

Fixed submission:
check = int(input().replace(" ",""))
print("Yes" if (check**0.5)%1==0 else "No" )
Buggy python submission (verdict: Runtime Error):
 s = input()
print("{}{}{}".format(s[0],len(s)-2,s[-1]))

Fixed submission:
s=input()
print(s[0]+str((len(s)-2))+s[-1])
Buggy python submission (verdict: Time Limit Exceeded):
def resolve():
    number=1
    for i in range(1,int(input())+1):
        number*=i
    print(number%(10**9+7))
resolve()

Fixed submission:
import math
print(math.factorial(int(input()))%(10**9+7))
Buggy python submission (verdict: Time Limit Exceeded):
import itertools
K,S = map(int,input().split())
print(sum([i+j+k==S for i,j,k in itertools.product(range(0,K+1),range(0,K+1),range(0,K+1))]))

Fixed submission:
k, s = map(int, input().split())
count = 0
for x in range(k + 1):
    for y in range(k + 1):
        z = s - x - y
        if 0 <= z <= k:
            count += 1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
K,S = map(int,input().split())
print(sum([i+j+k==S  for i in range(0,K+1) for j in range(0,K+1) for k in range(0,K+1)]))

    

    

Fixed submission:
k, s = map(int, input().split())
count = 0
for x in range(k + 1):
    for y in range(k + 1):
        z = s - x - y
        if 0 <= z <= k:
            count += 1
print(count)
Buggy python submission (verdict: Runtime Error):
record = sorted([input() for i in range(int(input().split()[1]))])
print("".join(record))

Fixed submission:
n,l = map(int,input().split())
s = sorted([input() for i in range(n)])
print(*s,sep="")
Buggy python submission (verdict: Runtime Error):
listSi = [0,0,0,0]
i = int(input())
while (i = input()):
    if i == "AC":
        listSi[0] += 1
    elif i == "WA":
        listSi[1] += 1
    elif i == "TLE":
        listSi[2] += 1
    elif i == "RE":
        listSi[3] += 1
print("AC x {listSi[0]}")
print("WA x {listSi[1]}")
print("TLE x {listSi[2]}")
print("RE x {listSi[3]}")


Fixed submission:
listSi = [0,0,0,0]
ic = int(input())
icz = 0
while True:
  icz += 1
  i = input()
  if i == "AC":
    listSi[0] += 1
  elif i == "WA":
    listSi[1] += 1
  elif i == "TLE":
    listSi[2] += 1
  elif i == "RE":
    listSi[3] += 1
  if icz == ic:
    break
print(f"AC x {listSi[0]}")
print(f"WA x {listSi[1]}")
print(f"TLE x {listSi[2]}")
print(f"RE x {listSi[3]}")
Buggy python submission (verdict: Runtime Error):
fun main(args:Array<String>) {
var a = readLine()!!.toInt()
var b = a%1000
  if (b==0) {
  println(0)
  }else{
  println(1000-b)
}
}

Fixed submission:
a=int(input())%1000
if a==0:
  print(0)
else:
  print(1000-a)

Buggy python submission (verdict: Runtime Error):
a=int(input())%1000
if a=0:
  print(0)
else:
  print(1000-a)

Fixed submission:
a=int(input())%1000
if a==0:
  print(0)
else:
  print(1000-a)
Buggy python submission (verdict: Runtime Error):
a=int(input())
b=int(input())
if a%500 =< b:
  print("YES")
else:
  print("NO")


Fixed submission:
a=int(input())
b=int(input())
if a%500 <= b:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Time Limit Exceeded):
def exp(n):
  return sum(range(n + 1)) / n

N, K = map(int, input().split())
p = list(map(int, input().split()))
a = [0.0]
for i in range(N):
  a.append(a[i] + exp(p[i]))
m = 0
for i in range(N - K + 1):
  m = max(m, a[i + K] - a[i])
print(m)

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

N, K = map(int, input().split())
p = list(map(int, input().split()))
a = [0.0]
for i in range(N):
  a.append(a[i] + exp(p[i]))
m = 0
for i in range(N - K + 1):
  m = max(m, a[i + K] - a[i])
print(m)
Buggy python submission (verdict: Runtime Error):

k=input()
s=input()

if len(s)<=k:
    print(s)
else:
    print(s+"...")

Fixed submission:

k=int(input())
s=input()

#if len(s)<=k:
    #  print(s)
    #else:
    #print(s+"...")





#########他人のコピー#########


if len(s)<=k:
      print(s)
else:
    print(s[:k] + '...')
    

#########他人のコピー#########

Buggy python submission (verdict: Runtime Error):

k=input()
s=input()

if len(s)<=k:
    print(s)
else:
    print(s+"...")

Fixed submission:

k=int(input())
s=input()

#if len(s)<=k:
    #  print(s)
    #else:
    #print(s+"...")





#########他人のコピー#########


if len(s)<=k:
      print(s)
else:
    print(s[:k] + '...')
    

#########他人のコピー#########
Buggy python submission (verdict: Runtime Error):

a=int(input())
b=int(input())
c=int(input())
d=int(input())

if abs(b-a)<d and abs(c-b)<d:
    print("Yes")
else:
    print("No")









Fixed submission:




a,b,c,d = map(int, input().split())


if abs(c-a) <= d:
    print('Yes')
elif abs(b-a)<=d and abs(c-b)<=d:
    print("Yes")
else:
    print("No")