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

Fixed submission:
n,k = map(int,input().split())
a = [0]+list(map(int,input().split()))

def bin(arr,val):
    left,right = 0,len(arr)-1
    while left<=right:
        mid = (left+right)//2
        if arr[mid]==val: return 1
        elif arr[mid]<val: left = mid + 1
        else: right = mid - 1
    return 0

know = []
now = 1
while not bin(know, now):
    know.append(now)
    now = a[now]

start = a[know[-1]]
for i,num in enumerate(know):
    if num == start: loop = know[i:] ; break

#print(know,start,loop)

if k < len(know):
    ans = know[k]
else:
    k -= len(know)
    ans = loop[k%len(loop)]

print(ans)

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
a = [0]+list(map(int,input().split()))

def bin(arr,val):
    left,right = 0,len(arr)-1
    while left<=right:
        mid = (left+right)//2
        if arr[mid]==val: return 1
        elif arr[mid]<val: left = mid + 1
        else: right = mid - 1
    return 0

know = []
now = 1
while not bin(know, now):
    know.append(now)
    now = a[now]

start = a[know[-1]]
for i,num in enumerate(know):
    if num == start: loop = know[i:] ; break

#print(know,start,loop)

if k < len(know):
    ans = know[k]
else:
    k - = len(know)
    ans = know[k%len(loop)]


print(ans)

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
a = [0]+list(map(int,input().split()))

def bin(arr,val):
    left,right = 0,len(arr)-1
    while left<=right:
        mid = (left+right)//2
        if arr[mid]==val: return 1
        elif arr[mid]<val: left = mid + 1
        else: right = mid - 1
    return 0

know = []
now = 1
while not bin(know, now):
    know.append(now)
    now = a[now]

start = a[know[-1]]
for i,num in enumerate(know):
    if num == start: loop = know[i:] ; break

print(know,start,loop)

if k < len(know):
    ans = know[k]
else:
    k - = len(know)
    ans = know[k%len(loop)]


print(ans)
Problem p02900 (python)

Fixed submission:
import collections as col

def prime(n):
    ans = []
    num = n
    for i in range(2,int(n**0.5)+1):
        if i%2==0 and i!=2: continue
        while num%i == 0: num //= i ; ans.append(i)
    if num != 1: ans.append(num)
    return ans

def gcd(a,b): return gcd(b,a%b) if a%b else b

a,b = map(int,input().split())
primes = prime(gcd(a,b))
cnt = col.Counter(primes)
ans = len(cnt) + 1
print(ans)

Buggy submission (verdict: Runtime Error):
import collections as col
import math

def prime(n):
    ans = []
    num = n
    for i in range(2,int(n**0.5)+1):
        if i%2==0 and i!=2: continue
        while num%i == 0: num //= i ; ans.append(i)
    if num != 1: ans.append(num)
    return ans

def gcd(a,b): return gcd(b,a%b) if a%b else b

a,b = map(int,input().split())
primes = prime(math.gcd(a,b))
cnt = col.Counter(primes)
ans = len(cnt) + 1
print(ans)

Buggy submission (verdict: Runtime Error):
import collections as col
import math as ma

def prime(n):
    ans = []
    num = n
    for i in range(2,int(n**0.5)+1):
        if i%2==0 and i!=2: continue
        while num%i == 0: num //= i ; ans.append(i)
    if num != 1: ans.append(num)
    return ans

a,b = map(int,input().split())
gcd = ma.gcd(a,b)
primes = prime(gcd)
cnt = col.Counter(primes)
ans = len(cnt) + 1
print(ans)

Buggy submission (verdict: Runtime Error):
import collections as col
import math as ma

def prime(n):
    ans = []
    num = n
    for i in range(2,int(n**0.5)+1):
        if i%2==0 and i!=2: continue
        while num%i == 0: num //= i ; ans.append(i)
    if num != 1: ans.append(num)
    return ans

a,b = map(int,input().split())
gcd = ma.gcd(a,b)
primes = prime(gcd)
cnt = col.Counter(primes)
ans = len(cnt) + 1
print(ans)
Problem p02921 (python)

Fixed submission:
s = input()
t = input()
ans = 0
for i in range(3):
  if s[i] == t[i]: ans += 1

print(ans)

Buggy submission (verdict: Runtime Error):
あ
Problem p02923 (python)

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

anss = []
cnt = 0
for i in range(n):
    if i == 0: continue
    if h[i] <= h[i-1]: cnt += 1
    else: anss.append(cnt); cnt = 0
    if i == n-1 : anss.append(cnt)

try: print(max(anss))
except: print(0)

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

anss = []
cnt = 0
for i in range(n):
    if i == 0: continue
    if h[i] <= h[i-1]: cnt += 1
    else: anss.append(cnt); cnt = 0
    if i == n-1 : anss.append(cnt)

print(max(anss))
Problem p02926 (python)

Fixed submission:
import numpy as np

n = int(input())
x,y = np.array([list(map(int,input().split())) for _ in range(n)]).T

# 内積が0以上かどうか
def isin90deg(v1, v2):
    if np.dot(v1, v2) >= 0 : return 1
    else: return 0

# 内積が0かどうか
def is90deg(v1, v2):
    if np.dot(v1, v2) == 0 : return 1
    else: return 0

ans = []
for i in range(n):
    # tangent-vector, normal-vector
    tv, nv1 = np.array([x[i],y[i]]), np.array([y[i],-x[i]])
    nv2 = - nv1
    # tvから時計回り180度エリアにおけるベクトル和を考える
    # ただし、tvに平行なベクトル群（posi/nega）だけ例外処理
    for nv in [nv1, nv2]:
        sum,posi,nega = np.array([0,0]), np.array([0,0]), np.array([0,0])
        for j in range(n):
            v = np.array([x[j],y[j]])
            if isin90deg(v,nv): sum += v
            if is90deg(v,nv) and isin90deg(v,tv): posi += v
            if is90deg(v,nv) and not isin90deg(v,tv): nega += v
        # ユークリッド距離
        ans.append(np.linalg.norm(sum, ord=2))
        ans.append(np.linalg.norm(sum - posi, ord=2))
        ans.append(np.linalg.norm(sum - nega, ord=2))

print(max(ans))

Buggy submission (verdict: Runtime Error):
import numpy as np

n = int(input())
x,y = np.array([list(map(int,input().split())) for _ in range(n)]).T


# 内積が0以上かを判定する
def isin90deg(v1, v2):
    if np.dot(v1, v2) >= 0 : return 1
    else: return 0

ans = []
for i in range(n):
    v1 = np.array([y[i], - x[i]]) # 法線ベクトル
    if i < n-1 : v2 = np.array([(y[i]+y[i+1])/2, (x[i]+x[i+1])/2])
    else: v2 = v1
    total1,total2 = np.array([0, 0]), np.array([0, 0])
    tmp1,tmp2,v3 = [],[],[]
    for j in range(n):
        v3.append(np.array([x[j], y[j]]))
        if isin90deg(v1, v3[j]): total1 += v3[j] ; tmp1.append(j)
        if isin90deg(v2, v3[j]): total2 += v3[j] ; tmp2.append(j)
    start1, end1 = min(tmp1), max(tmp1)
    start2, end2 = min(tmp2), max(tmp2)
    ans.append(np.linalg.norm(total1, ord=2)) # ord2でユークリッド距離
    ans.append(np.linalg.norm(total1 - v3[start1], ord=2))
    ans.append(np.linalg.norm(total1 - v3[end1], ord=2))
    ans.append(np.linalg.norm(total2, ord=2))
    ans.append(np.linalg.norm(total2 - v3[start2], ord=2))
    ans.append(np.linalg.norm(total2 - v3[end2], ord=2))

print(max(ans))
Problem p02972 (python)

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

ans = [0 for i in range(n+1)]
for i in range(n,0,-1):
    s = 0
    for j in range(i*2,n+1,i): s += ans[j]
    if (s - a[i-1])%2 == 0: pass
    else: ans[i] = 1

print(sum(ans))
anss = []
for i in range(n+1):
    if ans[i] == 1: anss.append(i)
print(*anss)

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

ans = [1 for i in range(n+1)]; ans[0] = 0
for i in range(n+1):
    s = 0
    for j in range(i,n+1,i): s += ans[j]
    if (s - a[i-1])%2 == 0: pass
    else: ans[i] = 0

print(sum(ans))
anss = []
for i in range(n+1):
    if ans[i] == 1: anss.append(i)
print(*anss)

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

ans = [0 for i in range(n+1)]
for i in range(n+1):
    s = 0
    for j in range(i*2,n+1,i): s += ans[j]
    if (s - a[i-1])%2 == 0: pass
    else: ans[i] = 1

print(sum(ans))
anss = []
for i in range(n+1):
    if ans[i] == 1: anss.append(i)
print(*anss)
Problem p03140 (python)

Fixed submission:

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

ans = 0
for i in range(n):
    cnt = 2
    if a[i]==b[i]: cnt -= 1
    if b[i]==c[i]: cnt -= 1
    if c[i]==a[i]: cnt -= 1
    if cnt<0: cnt = 0
    ans += cnt

print(ans)

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

ans = 0
for i in range(n):
  cnt = len(set(a[i],b[i],c[i]))-1
  ans += cnt

print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a,b,c = input(),input(),input()

ans = 0
for i in range(n):
	cnt = len(set(a[i],b[i],c[i]))-1
	ans += cnt

print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a,b,c = input(),input(),input()

ans = 0
for i in range(n):
  cnt = len(set(a[i],b[i],c[i]))-1
  ans += cnt

print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a,b,c = input(),input(),input()

ans = 0
for i in range(n):
  cnt = len(set(a[i],b[i],c[i]))-1
  ans += cnt

print(ans)
Problem p03141 (python)

Fixed submission:
n = int(input())
c = []
bs = 0
for i in range(n):
  a,b = map(int,input().split())
  bs += b
  c.append(a+b)

c.sort()

ans = -bs
for i in reversed(range(n)):
  cnt = n-1-i
  if cnt%2==0: ans += c[i]
    
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
c = []
bs = 0
for i in range(n):
  a,b = map(int,input().split())
  bs += b
  c.append(a+b)

c.sort()

ans = -bs
for i in range(n,0,-1):
  if i%2==0: ans += c[i]
    
print(ans)
Problem p03163 (python)

Fixed submission:
n,w_lim = map(int,input().split())
dp = [[0 for i in range(w_lim+1)] for i in range(n+1)]

w,v = [],[]
for i in range(n):
    ww,vv = map(int,input().split())
    w.append(ww)
    v.append(vv)

#初期条件
for ww in range(w_lim+1): dp[0][ww] = v[0] if ww>=w[0] else 0

#漸化式
for i in range(n-1):
    for ww in range(w_lim+1):
        dp[i+1][ww] = dp[i][ww] if w[i+1]>ww else max(dp[i][ww], dp[i][ww-w[i+1]]+v[i+1])

ans = dp[n-1][w_lim]
print(ans)

Buggy submission (verdict: Runtime Error):
# 常備セット
import numpy as np
import scipy.sparse as sps
import scipy.misc as spm
import collections as col
import functools as func
import itertools as ite
import fractions as frac
import math as ma
import copy as cp
import sys
def sinput(): return sys.stdin.readline()
def iinput(): return int(sinput())
def imap(): return map(int, sinput().split())
def fmap(): return map(float, sinput().split())
def iarr(): return list(imap())
def farr(): return list(fmap())
def sarr(): return sinput().split()
sys.setrecursionlimit(10**7)
MOD = 10**9 + 7; EPS = sys.float_info.epsilon
PI = np.pi; EXP = np.e; INF = np.inf

n,wmax = imap()
wv = np.array([iarr() for i in range(n)])
w,v = wv.T[0], wv.T[1]
#dp = np.zeros((n+1, wmax+1),dtype=np.int64)
dp = [[0 for ww in range(wmax+1)] for i in range(n+1)]

for i in range(n):
    for ww in range(wmax+1):
        dp[i+1][ww] = max(dp[i][ww], dp[i][ww-w[i]]+v[i]) if ww-w[i]>=0 else dp[i][ww]

ans = dp[n][wmax]
print(ans)
Problem p03262 (python)

Fixed submission:
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

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

for i in range(n):
    city[i] = abs(city[i]-x)

ans = city[0]
for num in city:
    ans = gcd(ans, num)

print(ans)

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

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

for i in range(n):
    city[i] = abs(city[i]-x)

gcd = functools.reduce(math.gcd, city)
print(gcd)

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

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

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


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

for i in range(n):
    city[i] = abs(city[i]-x)

print(gcd_list(city))

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

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

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


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

for i in range(n):
    city[i] = abs(city[i]-x)

print(gcd_list(city))
Problem p03294 (python)

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

ans = sum(a)-n

print(ans)

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

# 最小公倍数を求める関数
def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

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

lcm = lcm_list(a)

ans = 0
for i in range(n):
    ans += (lcm-1) % a[i]

print(ans)
Problem p03386 (python)

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

n=b-a+1

if (k-1>=n-k):
    for i in range(a,b+1): print(i)

else:
    for i in range(a,a+k): print(i)
    for i in range(b-k+1,b+1): print(i)

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

nums = list(range(a,b+1))
n = len(nums)


if (k-1>=n-k):
    for ele in nums: print(ele)

else:
    for i in range(0,k): print(nums[i])
    for i in range(n-k,n): print(nums[i])

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

nums = list(range(a,b+1))
n = len(nums)
if k>n: k=n

for i in range(0,k): print(nums[i])
if (k-1<n-k):
    for i in range(n-k,n): print(nums[i])
else:
    for i in range(k,n): print(nums[i])

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

nums = list(range(a,b+1))
n = len(nums)

for i in range(0,k): print(nums[i])
if (k-1<n-k):
    for i in range(n-k,n): print(nums[i])
else:
    for i in range(k,n): print(nums[i])

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

nums = list(range(a,b+1))
rev = list(reversed(list(range(a,b+1))))

n = len(nums)
if k>n: k=n

ans = nums[0:k]+list(reversed(rev[0:k]))
for ele in list(set(ans)): print(ele)
Problem p03457 (python)

Fixed submission:
n=int(input())
ts=[]; xs=[]; ys=[]

for i in range(n):
    t,x,y = map(int,input().split())
    ts.append(t); xs.append(x); ys.append(y)

flag=1
for i in range(n):
    t = ts[i]
    d = abs(xs[i]) + abs(ys[i])
    if t>=d and (t-d)%2==0: continue
    else: flag=0; break

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

Buggy submission (verdict: Runtime Error):
import numpy as np
import scipy.sparse as sps
import scipy.misc as spm
import collections as col
import functools as func
import itertools as ite
import fractions as frac
import math as ma
import cmath as cma
import copy as cp
import sys
def sinput(): return sys.stdin.readline().strip()
def iinput(): return int(sinput())
def imap(): return map(int, sinput().split())
def fmap(): return map(float, sinput().split())
def iarr(n=0):
    if n: return [0 for _ in range(n)]
    else: return list(imap())
def farr(): return list(fmap())
def sarr(n=0):
    if n: return ["" for _ in range(n)]
    else: return sinput().split()
def barr(n): return [False for _ in range(n)]
sys.setrecursionlimit(10**7)
MOD = 10**9 + 7; EPS = sys.float_info.epsilon
PI = np.pi; EXP = np.e; INF = np.inf

n = iinput()
txy = np.array([0,0,0]) + np.array([iarr() for i in range(n)])
t,x,y = txy.T[0], txy.T[1], txy.T[2]

flag = 1
for i in range(n):
    dist = abs(x[i+1]-x[i]) + abs(y[i+1]-y[i])
    time = abs(t[i+1] - t[i])
    if time < dist: flag = 0; break
    if (time - dist)%2 == 1: flag = 0; break

ans = "Yes" if flag else "No"
print(ans)
Problem p03545 (python)

Fixed submission:
import numpy as np

abcd = input()
#a,b,c,d = [s for s in abcd]

for i in range(2**3):
    ops = ["-","-","-",""]
    for j in range(3):
        if i>>j&1: ops[j] = "+"
    equa = ""
    for s,op in zip(abcd,ops): equa += (s+op)
    if eval(equa) == 7 : break

ans = equa + "=7"
print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np

abcd = input()
#a,b,c,d = [s for s in abcd]

for i in range(2**3):
    ops = ["-","-","-",""]
    for j in range(3):
        if i>>j&1: ops[j] = "+"
    equa = ""
    for s,op in zip(abcd,ops): equa += (s+op)
    if eval(equa) == 7 : break

ans = equa + "=7"
print(ans)
Problem p03575 (python)

Fixed submission:
import numpy as np

class unionfind: #ノード数nを読み込む
    def __init__(self,n): #コンストラクタ
        self.parent = list(range(n))
    def find(self,a): #根を探す、そのつど根を更新
        if self.parent[a] == a: return a #自分が根だったら終了
        p = self.find(self.parent[a])
        self.parent[a] = p #根をダイレクトに更新
        return p
    def unite(self,a,b): #ランク度外視で根を合体する
        pa,pb = self.find(a),self.find(b)
        if pa == pb: return 0 #根が一緒なら何もせず終了
        self.parent[pa] = pb
    def same(self,a,b):
        pa,pb = self.find(a),self.find(b)
        return pa == pb

n,m = map(int,input().split())
ab = np.array([list(map(int,input().split())) for i in range(m)])
a,b = ab.T[0] -1, ab.T[1] -1

ans = 0
for i in range(m): #除外する辺を決める
    uf = unionfind(n)
    connect = 0
    for j in range(m): #i以外の辺についてuniteしていく
        if i != j and not uf.same(a[j],b[j]): uf.unite(a[j],b[j]) ; connect += 1
    ans += 0 if connect == n-1 else 1
print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np

def dfs(v1):
    if all(visited): return 1
    visited[v1] = 1
    for v2 in range(n):
        if graph[v1][v2] == 0: continue
        if visited[v2] == 1: continue
        dfs(v2)
    return 0
# nは頂点の数
n, m = MI()
ab = np.array([list(map(int,input().split()))])
a,b = ab.T[0]-1,ab.T[1]-1

#隣接行列
graph = [[0] * n for _ in range(n)]

ans = 0
for a, b in zip(a,b):
    for aa,bb in zip(a,b): graph[aa][bb],graph[bb][aa] = 1,1
    graph[a][b],graph[b][a] = 0,0
    visited = [0]*n
    if not dfs(0): ans += 1

print(ans)
Problem p03599 (python)

Fixed submission:
a,b,c,d,e,f = map(int,input().split())

# 作れるか判定
def check(goal,ac,bd):
    flag = 0
    for x in range(int(goal//ac)+1):
            if (goal-ac*x)%bd == 0 : flag = 1 ; break
    return flag

# 水W、砂糖Sをまわす
anss = []
for w in range(100,f+1,100):
    for s in range(1,f-w+1):
        if check(w,100*a,100*b) and check(s,c,d) and s<=((w*e)/100):
            conc = 100*s/(w+s) # concentration
            anss.append([conc,w,s])

anss.sort(reverse=1)
if anss: w,s = anss[0][1],anss[0][2]
else: w,s = 100*a,0
print(w+s,s)

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

# 作れるか判定
def check(goal,ac,bd):
    flag = 0
    for x in range(int(goal//ac)+1):
            if (goal-ac*x)%bd == 0 : flag = 1 ; break
    return flag

# 水W、砂糖Sをまわす
anss = []
for w in range(100,f+1,100):
    for s in range(1,f-w+1):
        if check(w,100*a,100*b) and check(s,c,d) and s<=((w*e)/100):
            conc = 100*s/(w+s) # concentration
            anss.append([conc,w,s])

anss.sort(reverse=1)
w,s = anss[0][1],anss[0][2]
print(w+s,s)
Problem p02742 (python)

Fixed submission:
def resolve():
    H,W = map(int,input().split())
    if H == 1 or W == 1:
        print(1)
    else:
        ans = (H * W + 1) // 2
        print(ans)
resolve()

Buggy submission (verdict: Runtime Error):
def resolve():
    H,W = map(int,input().split())
    if H = 1 or W = 1:
        print(1)
    else:
        ans = (H * W + 1) // 2
        print(ans)
resolve()
Problem p02767 (python)

Fixed submission:
import numpy as np

def resolve():
    N = int(input())
    n_array = np.array(list(map(int,input().split())))
    mea = int(np.average(n_array) + 0.5)
    ans = n_array - mea 
    print(sum(ans*ans))
resolve()

Buggy submission (verdict: Runtime Error):
def resolve():
    N = int(input())
    n_array = np.array(list(map(int,input().split())))
    mea = int(np.average(n_array) + 0.5)
    ans = n_array - mea 
    print(sum(ans*ans))
resolve()
Problem p02576 (python)

Fixed submission:
N, X, T = map(int, input().split())
 
ans = N//X

if N%X != 0:
    ans+=1
 
print(ans*T)

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

pas = 0

H, W, M = map(int, input().split())
hn = []
wn = []
tli = []
for _ in range(M):
    h, w = map(int, input().split())
    tli.append([h,w])
    hn.append(h)
    wn.append(w)

hcnt = Counter(hn)
wcnt = Counter(wn)

ha, cha = zip(*hcnt.most_common())
wa, cwa = zip(*wcnt.most_common())

hli = [int(ha[0])]
wli = [int(wa[0])]
for i in range(len(cha)-1):
    if cha[i] == cha[i+1]:
        hli.append(int(ha[i+1]))
    else:
        break
for i in range(len(cwa)-1):
    if cwa[i] == cwa[i+1]:
        wli.append(int(wa[i+1]))
    else:
        break

for i in range(len(hli)):
    if pas == 1:
        break
    for k in range(len(wli)):
        if [hli[i], wli[k]] not in tli:
            ans = cha[i] + cwa[k]
            pas = 1
            break

if pas == 0:
    print(cha[0] + cwa[0] - 1)
else:
    print(ans)
Problem p02603 (python)

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

K = 0
m = 1000

for i in range(N):
    if i == N-1:
        m += K*A[i]
        break
    for k in range(1,N-i):
        if A[i] < A[i+k]:
            if K > 0:
                m += K*A[i]
            K = m//A[i]
            m = m%A[i]
            break
        else:
            if A[i] > A[i+k]:
                m += K*A[i]
                K = 0
                break
            else:
                continue
print(m)

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

K = 0
m = 1000

for i in range(N):
    if i == N-1:
        m += K*A[i]
        break
    for k in range(N-i):
        if A[i] < A[i+k+1]:
            if K > 0:
                m += K*A[i]
            K = m//A[i]
            m = m%A[i]
            break
        else:
            if A[i] > A[i+k+1]:
                m += K*A[i]
                K = 0
                break
            else:
                continue
print(m)
Problem p02612 (python)

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

Buggy submission (verdict: Runtime Error):
N = int(input())
amari = N % 1000
if amari ==0:
  print(amari)
elif:
  print(1000-amari)
Problem p02641 (python)

Fixed submission:
x, n = map(int, input().split())
p = list(map(int, input().split()))
ans = []
sortlist = []
if n == 0:
    print(x)
else:
    p.sort()
    p1 = p[0]
    pn = p[n-1]
    new = [i for i in range(0, 102)]
    nolist = set(new) ^ set(p)
    nolist = list(nolist)

    for i in range(0, len(nolist)):
        d = abs(nolist[i] - x)
        sortlist.append(d)

        k = sortlist.index(min(sortlist))
    print(nolist[k])

Buggy submission (verdict: Runtime Error):
x, n = map(int, input().split())
p = list(map(int, input().split()))
ans = []
sortlist = []
p.sort()
p1 = p[0]
pn = p[n-1]
new = [i for i in range(p1-1, pn+1)]
nolist = set(new) ^ set(p)
nolist = list(nolist)
print(nolist)
for i in range(0, len(nolist)):
    d = abs(nolist[i] - x)
    sortlist.append(d)

k = sortlist.index(min(sortlist))
print(nolist[k])
Problem p02646 (python)

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

D = float(abs(A-B))
E = float(V - W)

if E <= 0:
	print("NO")
	exit()
time = D/E
if time <= T:
	print("YES")
else:
	print("NO")

Buggy submission (verdict: Runtime Error):
A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())

D = float(abs(A-B))
E = float(V - W)
time = int(D/E)

if E <= 0:
	print("NO")
elif time <= T:
	print("YES")
else:
	print("NO")

Buggy submission (verdict: Runtime Error):
A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())

D = float(abs(A-B))
E = float(V - W)
time = D/E

if E <= 0:
	print("NO")
else:
	if time <= T:
		print("YES")
	else:
		print("NO")

Buggy submission (verdict: Runtime Error):
A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())

D = abs(A-B)
E = abs(V - W)
time = float(D/E)
if D == 0:
  print("YES")
elif E <= 0:
	print("NO")
else:
	if time <= T:
		print("YES")
	else:
		print("NO")

Buggy submission (verdict: Runtime Error):
A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())

D = abs(A-B)
E = V - W
time = float(D/E)
if D == 0:
  print("YES")
elif E <= 0:
	print("NO")
else:
	if time <= T:
		print("YES")
	else:
		print("NO")

Buggy submission (verdict: Runtime Error):
A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())

D = abs(A-B)
E = V - W
time = float(D/E)
if E <= 0:
	print("NO")
else:
	if time <= T:
		print("YES")
	else:
		print("NO")

Buggy submission (verdict: Runtime Error):
A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())

D = abs(A-B)
E = V - W
time = float(D/E)
if E <= 0:
	print("NO")
else:
	if time <= T:
		print("YES")
	else:
		print("NO")