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

Fixed submission:
import sys

N=int(input())
S=input()

flgT=["SSS","SWW","WWS","WSW"]
flgF=["SSW","WSS","SWS","WWW"]

if S[0]=='o':
  for i in range(4):
    str=flgT[i]
    for j in range(1,N):
      if (S[j]=="o" and str[-1]=="S") or (S[j]=="x" and str[-1]=="W"):
        str=str+str[-2]
      else:
        if str[-2]=="W":
          str=str+"S"
        else:
          str=str+"W"
    if str[-2]==str[0] and str[-1]==str[1]:
      str=str[1:-1]
      print(str)
      sys.exit()
else:
  for i in range(4):
    str=flgF[i]
    for j in range(1,N):
      if (S[j]=="o" and str[-1]=="S") or (S[j]=="x" and str[-1]=="W"):
        str=str+str[-2]
      else:
        if str[-2]=="W":
          str=str+"S"
        else:
          str=str+"W"
    if str[-2]==str[0] and str[-1]==str[1]:
      str=str[1:-1]
      print(str)
      sys.exit()

print(-1)

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(100001)

N=int(input())
S=input()


def solve(n,str):
  if n==N:
    if str[-2]==str[0] and str[-1]==str[1]:
      str=str[1:-1]
    else:
      str=""
    return str
  else:
    if (S[n]=="o" and str[-1]=="S") or (S[n]=="x" and str[-1]=="W"):
      str=str+str[-2]
    else:
      if str[-2]=="W":
        str=str+"S"
      else:
        str=str+"W"
    ans=solve(n+1,str)
    return ans

flgT=["SSS","SWW","WWS","WSW"]
flgF=["SSW","WSS","SWS","WWW"]
imp=True
if S[0]=='o':
  for i in range(4):
    ans=solve(1,flgT[i])
    if len(ans)>0:
      print(ans)
      imp=False
      break
else:
  for i in range(4):
    ans=solve(1,flgF[i])
    if len(ans)>0:
      print(ans)
      imp=False
      break
if imp:
  print(-1)

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

def solve(n,str):
  if n==N:
    if str[-2]==str[0] and str[-1]==str[1]:
      str=str[1:-1]
    else:
      str=""
    return str
  else:
    if (S[n]=="o" and str[-1]=="S") or (S[n]=="x" and str[-1]=="W"):
      str=str+str[-2]
    else:
      if str[-2]=="W":
        str=str+"S"
      else:
        str=str+"W"
    ans=solve(n+1,str)
    return ans

flgT=["SSS","SWW","WWS","WSW"]
flgF=["SSW","WSS","SWS","WWW"]
imp=True
if S[0]=='o':
  for i in range(4):
    ans=solve(1,flgT[i])
    if len(ans)>0:
      print(ans)
      imp=False
      break
else:
  for i in range(4):
    ans=solve(1,flgF[i])
    if len(ans)>0:
      print(ans)
      imp=False
      break
if imp:
  print(-1)
Problem p03844 (python)

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

if b=="+":
  print(int(a)+int(c))
else:
  print(int(a)-int(c))

Buggy submission (verdict: Runtime Error):
a,b,c=map(str,input().split())
if b==“+”:
  print(int(a)+int(c))
else:
  print(int(a)-int(c))
Problem p03963 (python)

Fixed submission:
N,K=map(int,input().split())
ans=K
for i in range(N-1):
  ans*=(K-1)
print(ans)

Buggy submission (verdict: Runtime Error):
N,K=int(input().split())
ans=K
for i in range(N-1):
  ans*=(K-1)
print(ans)
Problem p03997 (python)

Fixed submission:
a=int(input())
b=int(input())
c=int(input())

print(int((a+b)*c/2))

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

print(int((a+b)*c/2))
Problem p03563 (python)

Fixed submission:
import sys

a = []
for line in sys.stdin:
    a.append(int(line))
print(a[1] * 2 - a[0])

Buggy submission (verdict: Runtime Error):
def main():
    n = int(input()) 
	t = [int(input()) for i in range(n)] 
    print(t[1]*2 - t[0])

Buggy submission (verdict: Runtime Error):
def main:
  print(1000)
Problem p02791 (python)

Fixed submission:
n = int(input())
l = list(map(int,input().split()))
min_num = max(l) +1
ans = 0
for i in l:
  if min_num >= i:
    min_num = i
    ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
l = list(map(int,input().split()))
min_num = MAX(l) +1
ans = 0
for i in l:
  if min_num >= i:
    min_num = i
    ans += 1
print(ans)
Problem p02995 (python)

Fixed submission:
import fractions
a,b,c,d = map(int,input().split())
cd = c*d//fractions.gcd(c,d)
e = a-1
f = (b//c + b//d - b//(cd)) - (e//c + e//d - e//(cd))
print(b-e-f)

Buggy submission (verdict: Runtime Error):
import math
a,b,c,d = map(int,input().split())
cd = c*d//math.gcd(c,d)
e = a-1
f = (b//c + b//d - b//(cd)) - (e//c + e//d - e//(cd))
print(b-e-f)
Problem p02996 (python)

Fixed submission:
n = int(input())
l = []
for i in range(n):
    l += [list(map(int,input().split()))]
l = sorted(l,key=lambda x:x[1])
t = 0
for i in range(n):
    t += l[i][0]
    if t > l[i][1]:
        print('No')
        exit()
print('Yes')

Buggy submission (verdict: Runtime Error):
import fractions
a,b,c,d = map(int,input().split())
cd = c*d//fractions.gcd(c,d)
e = a-1
f = (b//c + b//d - b//(cd)) - (e//c + e//d - e//(cd))
print(b-e-f)
Problem p03030 (python)

Fixed submission:
n = int(input())
l = []
for i in range(1,n+1):
    a, b = input().split()
    l += [[a,int(b),i]]
l = sorted(sorted(l, key=lambda x:x[1], reverse=True), key=lambda x:x[0])
for i in range(len(l)):
    print(l[i][2])

Buggy submission (verdict: Runtime Error):
import pandas as pd
n = int(input())
shops = [0]*n
points = [0]*n
nums = [i for i in range(1,n+1)]
for i in range(n):
    shops[i],points[i] = input().split()
d = pd.DataFrame({'shops':shops,'points':points,'nums':nums})    
l = d.sort_values('shops').sort_values('points', ascending=False)['nums'].tolist()
for i in range(len(l)):
    print(l[i])
Problem p03047 (python)

Fixed submission:
N, K = map(int, input().split())
print(N-K+1)

Buggy submission (verdict: Runtime Error):
N, K = map(input().split())
print(N-K+1)
Problem p03050 (python)

Fixed submission:
import numpy as np
N = int(input())
cnt = 0
for i in range(1, int(np.ceil(np.sqrt(N)))):
    if (N-i)%i ==0 and (N-i)/i >i:
        cnt += int((N-i)/i)
print(cnt)

Buggy submission (verdict: Runtime Error):
import numpy as np
N = int(input())
cnt = 0
for i in range(1, int(np.ceil(np.sqrt(N)))):
    if (N-i)%i ==0:
        cnt += int((N-i)/i)
print(cnt)

Buggy submission (verdict: Runtime Error):
N = int(input())
cnt = 0
for i in range(1, int(np.sqrt(N))+1):
    cnt += (N-i)//i
print(cnt)

Buggy submission (verdict: Runtime Error):
N = map(int,input())
cnt = 0
for i in range(2, N+1):
    m = N//i
    e = N%i
    if m==e:
        cnt +=i
print(cnt)

Buggy submission (verdict: Runtime Error):
N = map(int,input())
cnt = 0
for i in range(2, len(N)+1):
    m = N//i
    e = N%i
    if m==e:
        cnt +=i
print(cnt)
Problem p03060 (python)

Fixed submission:
n = int(input())
vl = list(map(int, input().split()))
cl = list(map(int, input().split()))
ans = 0
for i in range(n):
    if vl[i] > cl[i]:
        ans += vl[i]-cl[i]
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
vl = list(map(int, input().split()))
cl = list(map(int, input().split()))
ans = 0
for i in range(n):
    if vl[i] > cl[i]:
        ans += v[i]-c[i]
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
vl = [int(input()) for _ in range(n)]
cl = [int(input()) for _ in range(n)]
ans = 0
for i in range(n):
    if vl[i] > cl[i]:
        ans += v[i]-c[i]
print(ans)
Problem p03076 (python)

Fixed submission:
import math
l = [int(input()) for i in range(5)]
e = 10
for i in l:
    re = i%10
    if re !=0:
        e = min(e, re)
l = [math.ceil(i/10)*10 for i in l]
print(sum(l)-(10-e))

Buggy submission (verdict: Runtime Error):
l = [int(input()) for i in range(5)]
l.sort()
print(max(l[0]-40, l[1]-30, [2]-20, l[3]-10, l[4]))
Problem p03086 (python)

Fixed submission:
s = input()
cnt = 0
cnt_list = [0]*len(s)
for idx,i in enumerate(s):
    if i in 'ACTG ':
        cnt +=1
    else:
        cnt = 0
    cnt_list[idx] = cnt
print(max(cnt_list))

Buggy submission (verdict: Runtime Error):
s = input()
cnt = 0
cnt_list = [0]*len(s)
for i in s:
    if s in 'ACTG ':
        cnt +=1
    else:
        cnt = 0
    cnt_list[i] = cnt
print(max(cnt_list))
Problem p03103 (python)

Fixed submission:
n,m = map(int, input().split())
l = [list(map(int,input().split())) for _ in range(n)]
cnt = 0
ans = 0
l.sort(key=lambda x:x[0])
for i in range(n):
    cnt += l[i][1]
    ans += l[i][0] * l[i][1]
    if cnt > m:
        ans -= l[i][0] * l[i][1]
        ans += l[i][0]*(m-(cnt-l[i][1]))
        break
print(ans)

Buggy submission (verdict: Runtime Error):
n,m = map(int, input().split())
l = [list(map(int,input().split)) for _ in range(n)]
cnt = 0
ans = 0
l.sort(key=lambda x:x[0])
for i in range(n):
    cnt += l[i][1]
    ans += l[i][0] * l[i][1]
    if cnt > m:
        ans -= l[i][0] * l[i][1]
        ans += l[i][0]*(m-(cnt-l[i][1]))
print(ans)
Problem p03106 (python)

Fixed submission:
a,b,k = map(int,input().split())
cnt = 0
for i in range(100,0,-1):
  if a%i ==0 and b%i==0:
    cnt +=1
    if cnt == k:
      print(i)

Buggy submission (verdict: Runtime Error):
a,b,k = map(int,input().split())
cnt = 0
for i in range(1,100):
  if a%i ==0 and b%i==0:
    cnt +=1
    if cnt = k:
      print(i)
Problem p03110 (python)

Fixed submission:
n = int(input())
ans = 0
for _ in range(n):
  x,u = input().split()
  x = float(x)
  if u == 'BTC':
    x *= 380000
  ans += x

print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
ans = 0
for _ in range(n):
  x,u = input().split()
  if u == 'BTC':
    x *= 380000
  ans += x

print(ans)
Problem p03125 (python)

Fixed submission:
a,b = map(int, input().split())
if b%a == 0:
  print(a+b)
else:
  print(b-a)

Buggy submission (verdict: Runtime Error):
a.b = map(int, input().split())
if b%a == 0:
  print(a+b)
else:
  print(b-a)
Problem p03239 (python)

Fixed submission:
n,T = map(int,input().split())
ct = [list(map(int,input().split())) for _ in range(n)]
cost = 9999
for i in range(n):
    c,t = ct[i][0],ct[i][1]
    if t<=T:
        cost = min(cost,c)
print(cost if cost != 9999 else 'TLE')

Buggy submission (verdict: Runtime Error):
n,T = map(int,input().split())
ct = [[map(int,input().split())] for _ in range(n)]
cost = 9999
for i in range(n):
    c,t = ct[i][0],ct[i][1]
    if t<=T:
        cost = min(cost,c)
print(cost if cost != 9999 else 'TLE')

Buggy submission (verdict: Runtime Error):
n,T = map(int,input().split())
ct = [[map(int,input().split())] for _ in range(n)]
cost = 9999
for i in range(n):
  c,t = ct[i][0],ct[i][1]
  if t<=T:
    cost = min(cost,c)
print(cost if cost != 9999 else 'TLE')
Problem p03288 (python)

Fixed submission:
r = int(input())
if r < 1200:
  print('ABC')
elif r < 2800:
  print('ARC')
else:
  print('AGC')

Buggy submission (verdict: Runtime Error):
r = int(input())
ans = ''
if r < 1200:
  print('ABC')
elfi r < 2800:
  print('ARC')
else:
  print('AGC')
Problem p03316 (python)

Fixed submission:
n = input()
l = map(int,list(n))
if int(n)%sum(l) == 0:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
n = input()
l = map(int,[*n])
if int(n)%sum(l) == 0:
  print('Yes')
else:
  print('No')
Problem p03339 (python)

Fixed submission:
n = int(input())
s = input()
es = s.count('E')
e_cnt = 0
l = [0]*n
for i in range(n):
    left = i-e_cnt
    if s[i] == 'E':
        e_cnt +=1
    right = es - e_cnt
    l[i] = right+left

print(min(l))

Buggy submission (verdict: Runtime Error):
n = int(input())
s = input()
l = [0]*n
for i in range(n):
    l[i] = s[0:i].count('W') + s[i+1:]count('E')
print(min(l))
Problem p03470 (python)

Fixed submission:
n = int(input())
l = []
for i in range(n):
    l.append(int(input()))
print(len(set(l)))

Buggy submission (verdict: Runtime Error):
n = int(input)
l = []
for i in range(n):
    l.append(i)
print(len(set(l)))
Problem p03573 (python)

Fixed submission:
a,b,c = map(int,input().split())
if a ==b:
    print(c)
elif a==c:
    print(b)
else: 
    print(a)

Buggy submission (verdict: Runtime Error):
a,b,c = map(int,input().split())
if a ==b:
    print(c)
elif a==c:
    print(b)
else print(a)
Problem p03963 (python)

Fixed submission:
n,k = map(int,input().split())
print(k*(k-1)**(n-1))

Buggy submission (verdict: Runtime Error):
n,k = input().split()
print(k*(k-1)**(n-1))
Problem p02791 (python)

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

counter = 0
min = N_list[0]
for i in range(N):
    if N_list[i] <= min:
        min = N_list[i]
        counter += 1
print(counter)
print()

Buggy submission (verdict: Runtime Error):
N = int(input())
N_list = [int(i) for i in input().split()]

counter = 0
for i in range(len(N_list)):
    if N_list[i] == min(N_list[:i+1]):
        couter += 1
print(counter)

Buggy submission (verdict: Runtime Error):
N = int(input())
N_list = [int(i) for i in input().split()]

counter = 0
for i in range(len(N_list)):
    if N_list[i] == min(N_list[:i+1]):
        couter += 1
print(counter)
print()
Problem p03161 (python)

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

inf = 10**20
dp = [inf] * n
dp[0] = 0

for i in range(1, n):
    for j in range(i - 1, max(0, i - k) - 1, -1):
        dp[i] = min(dp[j] + abs(hs[i] - hs[j]), dp[i])

print(dp[-1])

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

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

dp = [inf] * n
dp[0] = 0

for i in range(1, n):
    for j in range(i - 1, max(0, i - k) - 1, -1):
        dp[i] = min(dp[j] + abs(hs[i] - hs[j]), dp[i])
    # dp[i] = min(
    #     dp[i-1] + abs(hs[i] - hs[i-1]),
    #     dp[i-2] + abs(hs[i] - hs[i-2]),
    # )

print(dp[-1])
Problem p03450 (python)

Fixed submission:
class WeightedUnionFind:
    def __init__(self, n):
        self.par = [i for i in range(n+1)]
        self.rank = [0] * (n+1)
        # 根への距離を管理
        self.weight = [0] * (n+1)

    # 検索
    def find(self, x):
        if self.par[x] == x:
            return x
        else:
            y = self.find(self.par[x])
            # 親への重みを追加しながら根まで走査
            self.weight[x] += self.weight[self.par[x]]
            self.par[x] = y
            return y

    # 併合
    def union(self, x, y, w):
        rx = self.find(x)
        ry = self.find(y)
        # xの木の高さ < yの木の高さ
        if self.rank[rx] < self.rank[ry]:
            self.par[rx] = ry
            self.weight[rx] = w - self.weight[x] + self.weight[y]
        # xの木の高さ ≧ yの木の高さ
        else:
            self.par[ry] = rx
            self.weight[ry] = -w - self.weight[y] + self.weight[x]
            # 木の高さが同じだった場合の処理
            if self.rank[rx] == self.rank[ry]:
                self.rank[rx] += 1

    # 同じ集合に属するか
    def same(self, x, y):
        return self.find(x) == self.find(y)

    # xからyへのコスト
    def diff(self, x, y):
        return self.weight[x] - self.weight[y]

def main():
    n, m = map(int, input().split())
    wuf = WeightedUnionFind(n)
    for _ in range(m):
        l, r, d = map(int, input().split())
        if not wuf.same(l, r):
            wuf.union(l, r, d)
        else:
            if wuf.diff(l, r) != d:
                print('No')
                return
    print('Yes')

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
class WeightedUnionFind:
    def __init__(self, n):
        self.par = [i for i in range(n+1)]
        self.rank = [0] * (n+1)
        # 根への距離を管理
        self.weight = [0] * (n+1)

    # 検索
    def find(self, x):
        if self.par[x] == x:
            return x
        else:
            y = self.find(self.par[x])
            # 親への重みを追加しながら根まで走査
            self.weight[x] += self.weight[self.par[x]]
            self.par[x] = y
            return y

    # 併合
    def union(self, x, y, w):
        rx = self.find(x)
        ry = self.find(y)
        # xの木の高さ < yの木の高さ
        if self.rank[rx] < self.rank[ry]:
            self.par[rx] = ry
            self.weight[rx] = w - self.weight[x] + self.weight[y]
        # xの木の高さ ≧ yの木の高さ
        else:
            self.par[ry] = rx
            self.weight[ry] = -w - self.weight[y] + self.weight[x]
            # 木の高さが同じだった場合の処理
            if self.rank[rx] == self.rank[ry]:
                self.rank[rx] += 1

    # 同じ集合に属するか
    def same(self, x, y):
        return self.find(x) == self.find(y)

    # xからyへのコスト
    def diff(self, x, y):
        return self.weight[x] - self.weight[y]

def main():
    n, m = map(int, input().split())
    wuf = WeightedUnionFind(n)
    for _ in range(m:
        l, r, d = map(int, input().split())
        if not wuf.same(l, r):
            wuf.union(l, r, d)
        else:
            if wuf.diff(l, r) != d:
                print('No')
                return
    print('Yes')

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

Fixed submission:
s = input()
result_sum = 0
plus_count = len(s) - 1

for bit in range(1 << plus_count):
  splitted_string = s[0]
  for iter_plus in range(plus_count):
    if bit & (1 << iter_plus):
      splitted_string += '+'
    splitted_string += s[iter_plus+1]
  result_sum += eval(splitted_string)

print(result_sum)

Buggy submission (verdict: Runtime Error):
def dfs(splitted: "the list of integer", a: int, b: int, depth: int) -> int:
  if len(splitted) == depth:
    return a + b
  else:
    # 左のdfs() 呼び出し -> +を挿入しなかったとき
    # 右のdfs() 呼び出し -> +を挿入したとき
    return dfs(splitted, a, b * 10, depth + 1) + dfs(splitted, a + b, splitted[i], depth + 1)

s = [int(x) for x in input()]
print(dfs(s, 0, 0, 0))

Buggy submission (verdict: Runtime Error):
def dfs(splitted: "the list of integer", a: int, b: int, depth: int) -> int:
  if len(splitted) == depth:
    return a + b
  else:
    # 左のdfs() 呼び出し -> +を挿入しなかったとき
    # 右のdfs() 呼び出し -> +を挿入したとき
    return dfs(splitted, a, b * 10, depth + 1) + dfs(s, a + b, splitted[i], depth + 1)

s = [int(x) for x in input()]
print(dfs(s, 0, 0, 0))

Buggy submission (verdict: Runtime Error):
def dfs(splitted: "the list of integer", a: int, b: int, depth: int) -> int:
  if len(splitted) == depth:
    return a + b
  else:
    # 左のdfs() 呼び出し -> +を挿入しなかったとき
    # 右のdfs() 呼び出し -> +を挿入したとき
    return dfs(splitted, a, b * 10, depth + 1) + dfs(s, a + b, splitted[i], depth + 1)

s = [int(x) for x in input()]
print(dfs(s, 0, 0, 0))
Problem p02885 (python)

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

Buggy submission (verdict: Runtime Error):
n=int(input())
l=sorted([int(i) for i in input().split()],reverse=True)

#print(l)
co=0
for i in range(n-2):
    c=l[i]
    x=0
    for j in range(i+1,n-1):
        b=l[j]
        for k in range(j+1,n):
            a=l[k]
            if c<(a+b):
                co+=1
            else:
                x=1
                break
        if x==1:
            break

print(co)
Problem p02887 (python)

Fixed submission:
n = int(input())
A = list(input())
result = 1
for i in range(n-1):
  if A[i]!=A[i+1]:
  	result = result + 1
print(result)

Buggy submission (verdict: Runtime Error):
n = int(input())
A = list(map(int, input().split()))
result = 1
for i in range(n-1):
  if A[i]!=A[i+1]:
  	result = result + 1
print(result)
Problem p03415 (python)

Fixed submission:
c = [input() for i in range(3)]
print(c[0][0]+c[1][1]+c[2][2])

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
m = 0
if K == 0:
    print(N**2)
    exit()

for b in range(K+1,N+1):
    m += (b-K)*(N//b)
    if N%b-K >= 0:
        m += N%b-K+1
print(m)
Problem p03433 (python)

Fixed submission:
N = int(input())
A = int(input())
if N%500 <= A:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
C = []
for i in range(3):
    C.append(list(map(int, input().split())))
if ((C[0][0]-C[1][0])==(C[0][1]-C[1][1])==(C[0][2]-C[1][2]) and\
 (C[1][0]-C[2][0])==(C[1][1]-C[2][1])==(C[1][2]-C[2][2]) and\
 (C[2][0]-C[0][0])==(C[2][1]-C[0][1])==(C[2][2]-C[0][2]) and\
 (C[0][0]-C[0][1])==(C[1][0]-C[1][1])==(C[2][0]-C[2][1]) and\
 (C[0][1]-C[0][2])==(C[1][1]-C[1][2])==(C[2][1]-C[2][2]) and\
 (C[0][2]-C[0][0])==(C[1][2]-C[1][0])==(C[2][2]-C[2][0])):
    print('Yes')
else:
    print('No')
Problem p03485 (python)

Fixed submission:
import math
a, b = map(int, input().split())
print(int(math.ceil((a+b)/2)))

Buggy submission (verdict: Runtime Error):
import math
a, b = int(input())
print(int(math.ceil((a+b)/2)))
Problem p03651 (python)

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

A = sorted(A)
if A[N-1] < K:
    print("IMPOSSIBLE")
    exit()

min_A = A[0]
for i in range(1,N):
    if A[i]-A[i-1] != 0:
        min_A = min(min_A,A[i]-A[i-1])

for j in range(N):
    if A[j]%min_A != 0:
        print("POSSIBLE")
        exit()
if K % min_A == 0:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

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

A = sorted(A)
if A[N-1] < K:
    print("IMPOSSIBLE")
    exit()

min_A = A[0]
for i in range(1,N):
    min_A = min(min_A,A[i]-A[i-1])

for j in range(N):
    if A[j]%min_A != 0:
        print("POSSIBLE")
        exit()
if K % min_A == 0:
    print("POSSIBLE")
else:
    print("INPOSSIBLE")
Problem p02802 (python)

Fixed submission:
import numpy as np

N, M = map(int, input().split())
AC_or_not = np.array([0] * N)
n_penalty = np.array([0] * N)

for _ in range(M):
    prob, wa_ac = input().split()
    prob = int(prob) - 1
    if wa_ac == 'AC':
        AC_or_not[prob] = 1
    else:
        if not AC_or_not[prob]:
            n_penalty[prob] += 1

print(sum(AC_or_not), sum(n_penalty * AC_or_not))

Buggy submission (verdict: Runtime Error):
atcoder-tools: The pre-rendered templates are not found.import numpy as np

N, M = map(int, input().split())
AC_or_not = np.array([0] * N)
n_penalty = np.array([0] * N)

for _ in range(M):
    prob, wa_ac = input().split()
    prob = int(prob) - 1
    if wa_ac == 'AC':
        AC_or_not[prob] = 1
    else:
        if not AC_or_not[prob]:
            n_penalty[prob] += 1

print(sum(AC_or_not), sum(n_penalty * AC_or_not))
Problem p02814 (python)

Fixed submission:
from fractions import gcd
from math import ceil

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

n, M = map(int, input().split())
A = tuple(map(lambda x: int(int(x)/2), input().split()))
scm_core = 1
for a in A:
    scm_core = lcm(scm_core, a)

canmake_scm = True
for a in A:
    if scm_core // a % 2 == 0:
        canmake_scm = False

if canmake_scm:
    print(ceil(M // scm_core / 2))
else:
    print(0)

Buggy submission (verdict: Runtime Error):
from math import gcd, ceil

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

n, M = map(int, input().split())
A = tuple(map(lambda x: int(int(x)/2), input().split()))
scm_core = 1
for a in A:
    scm_core = lcm(scm_core, a)

print(ceil(M // scm_core / 2))
Problem p02898 (python)

Fixed submission:
N,K = map(int,input().split())
h = list(map(int,input().split()))
counter = 0
for ph in h:
    if ph >= K:
        counter+= 1
print(counter)

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split())
h = list(map(int,input().split))
h = [100,200,300,400,500]
counter = 0
for ph in h:
    if ph >= K:
        counter+= 1
print(counter)
Problem p02899 (python)

Fixed submission:
import numpy as np
import sys
N = int(input())
A = list(map(int,input().split()))
ans = np.argsort(A)+1
for a in ans:
    sys.stdout.write(str(a))
    sys.stdout.write(" ")

Buggy submission (verdict: Runtime Error):
import numpy as np
N = int(input())
A = list(map(int,input().split()))
ans = np.argsort(A)+1
for a in ans:
    sys.stdout.write(str(a))
    sys.stdout.write(" ")

Buggy submission (verdict: Runtime Error):
import numpy as np
N = int(input())
A = list(map(int,input().split()))
ans = np.argsort(A)+1
for a in ans:
    sys.stdout.write(str(a))
    sys.stdout.write(" ")
Problem p02973 (python)

Fixed submission:
import bisect
N = int(input())
A = [int(input()) for _ in range(N)]
first = [-1 for _ in range(N)]
for a in A:
    i = bisect.bisect_left(first,a)
    first[i-1] = a
ctr = N
for f in first:
    if f == -1:
        ctr -= 1
print(ctr)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = [int(input()) for _ in range(N)]
first = []
for a in A:
    i = bisect.bisect_left(first,a)
    if i == 0:
        first.insert(0,i)
    else:
        first[i-1] = a
print(len(first))