Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque

H,W = map(int,input().split())
A = [input() for _ in range(H)]
check = [[-1]*W for _ in range(H)]

def bfs(l):
    ans = 0
    q = deque(l)
    for l_ in l:
        check[l_[0]][l_[1]] = 0
    while q:
        y,x = q.popleft()
        for dy,dx in [[1,0],[-1,0],[0,1],[0,-1]]:
            ny,nx = y+dy,x+dx
            if 0 <= ny < H and 0<= nx < W:
                if check[ny][nx] == -1 and A[ny][nx] == '.':
                    check[ny][nx] = check[y][x] + 1
                    ans = max(ans,check[ny][nx])
                    q.append([ny,nx])
    return ans 

L = []
for h,a in enumerate(A):
    for w,a_ in enumerate(a):
        if a_ == '#':
            L.append([h,w])
print(bfs(L))

Fixed submission:
from collections import deque

H,W = map(int,input().split())
A = [input() for _ in range(H)]
check = [[-1]*W for _ in range(H)]

def bfs(l):
    ans = 0
    q = deque(l)
    for l_ in l:
        check[l_[0]][l_[1]] = 0
    while q:
        y,x = q.popleft()
        for dy,dx in [[1,0],[-1,0],[0,1],[0,-1]]:
            ny,nx = y+dy,x+dx
            if 0 <= ny < H and 0<= nx < W:
                if check[ny][nx] == -1 and A[ny][nx] == '.':
                    check[ny][nx] = check[y][x] + 1
                    ans = max(ans,check[ny][nx])
                    q.append([ny,nx])
    return ans 

L = []
for h,a in enumerate(A):
    for w,a_ in enumerate(a):
        if a_ == '#':
            L.append([h,w])
print(bfs(L))

Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque

H,W = map(int,input().split())
A = [input() for _ in range(H)]
check = [[-1]*W for _ in range(H)]

def bfs(l):
    q = deque(l)
    for l_ in l:
        check[l_[0]][l_[1]] = 0
    while q:
        y,x = q.popleft()
        for dy,dx in [[1,0],[-1,0],[0,1],[0,-1]]:
            ny,nx = y+dy,x+dx
            if 0 <= ny < H and 0<= nx < W:
                if check[ny][nx] == -1 and A[ny][nx] == '.':
                    check[ny][nx] = check[y][x] + 1
                    q.append([ny,nx])

L = []
for h in range(H):
    for w in range(W):
        if A[h][w] == '#':
            L.append([h,w])
bfs(L)
ans = 0
for c in check:
    ans = max(ans,max(c))
print(ans)

Fixed submission:
from collections import deque

H,W = map(int,input().split())
A = [input() for _ in range(H)]
check = [[-1]*W for _ in range(H)]

def bfs(l):
    ans = 0
    q = deque(l)
    for l_ in l:
        check[l_[0]][l_[1]] = 0
    while q:
        y,x = q.popleft()
        for dy,dx in [[1,0],[-1,0],[0,1],[0,-1]]:
            ny,nx = y+dy,x+dx
            if 0 <= ny < H and 0<= nx < W:
                if check[ny][nx] == -1 and A[ny][nx] == '.':
                    check[ny][nx] = check[y][x] + 1
                    ans = max(ans,check[ny][nx])
                    q.append([ny,nx])
    return ans 

L = []
for h,a in enumerate(A):
    for w,a_ in enumerate(a):
        if a_ == '#':
            L.append([h,w])
print(bfs(L))
Buggy python submission (verdict: Time Limit Exceeded):
X,Y,Z,K = map(int,(input().split()))
A = list(map(int,(input().split())))
B = list(map(int,(input().split())))
C = list(map(int,(input().split())))

D = []
for a in A:
    for b in B:
        D.append(a+b)
D = sorted(D,reverse=True)[:3000]

E = []
for d in D:
    for c in C:
        E.append(c+d)
E = sorted(E,reverse=True)[:K]

for e in E:
    print(e)

Fixed submission:
X,Y,Z,K = map(int,input().split())
A = sorted(list(map(int,input().split())),reverse=True)
B = sorted(list(map(int,input().split())),reverse=True)
C = sorted(list(map(int,input().split())),reverse=True)

L = []
for i in range(X):
    for j in range(Y):
        for k in range(Z):
            if (i+1)*(j+1)*(k+1) <= K:
                L.append(A[i]+B[j]+C[k])
            else:
                break

L = sorted(L,reverse=True)[:K]
for l in L:
    print(l)
Buggy python submission (verdict: Time Limit Exceeded):
N,Q = map(int,input().split())
S = input()
X = [list(map(int,input().split())) for _ in range(Q)]

L = [0]
for i,s in enumerate(S[1:]):
    if s == 'C' and S[i] == 'A':
        L.append(1)
    else:
        L.append(0)

for x in X:
    print(sum(L[x[0]:x[1]]))


Fixed submission:
N,Q = map(int,input().split())
S = input()
X = [list(map(int,input().split())) for _ in range(Q)]

L = [0]
for i,s in enumerate(S[1:]):
    if s == 'C' and S[i] == 'A':
        L.append(L[i]+1)
    else:
        L.append(L[i])

for x in X:
    print(L[x[1]-1]-L[x[0]-1])
Buggy python submission (verdict: Time Limit Exceeded):
import itertools

N = int(input())
S = input()
D = 10**9+7

d = {}
for i,n in enumerate(S):
    if n in d.keys():
        d[n] += 1
    else:
        d[n] = 1

count = 0
for i in range(1,len(d.keys())+1):
    for p in list(itertools.combinations(d.keys(),i)):
        tmp = 1
        for c in p:
            tmp *= d[c]
        count += tmp
        count %= D
print(count)

Fixed submission:
N = int(input())
S = input()
D = 10**9+7

d = {}
for i,n in enumerate(S):
    if n in d.keys():
        d[n] += 1
    else:
        d[n] = 1

ans = 1
for i in d.values():
    ans *= i+1
print((ans-1)%D)

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

N = int(input())
S = input()
D = 10**9+7

d = {}
for i,n in enumerate(S):
    if n in d.keys():
        d[n] += 1
    else:
        d[n] = 1

count = 0
for i in range(1,len(d.keys())+1):
    for p in list(itertools.combinations(d.keys(),i)):
        tmp = 1
        for c in p:
            tmp *= d[c]
        count += tmp
print(count%D)

Fixed submission:
N = int(input())
S = input()
D = 10**9+7

d = {}
for i,n in enumerate(S):
    if n in d.keys():
        d[n] += 1
    else:
        d[n] = 1

ans = 1
for i in d.values():
    ans *= i+1
print((ans-1)%D)
Buggy python submission (verdict: Time Limit Exceeded):
A,B = map(int,input().split())

X = []
for i in range(A,B+1):
    X.append(bin(i)[2:].zfill(40))

ans = ''
for i in range(40):
    tmp = 0
    for x in X:
        tmp += int(x[i])
    if tmp%2 == 0:
        ans += '0'
    else:
        ans += '1'

print(int(ans,2))

Fixed submission:
def count(X,n):
    l = []
    for i in range(n):
        l.append((X+1)//(2**(i+1))*2**i + max(0,(X+1)%(2**(i+1))-2**i))
    return l

A,B = map(int,input().split())
n = len(bin(B)[2:])
la = count(A-1,n)
lb = count(B,n)

xor = ''
for a,b in zip(la[::-1],lb[::-1]):
    if (b-a)%2 == 0:
        xor += '0'
    else:
        xor += '1'

print(int(xor,2))
Buggy python submission (verdict: Runtime Error):
N = int(input())
h = list(map(int,input().split()))

def dfs(L):
    for i,l in enumerate(L):
        if l != 0:
            break
    L = L[i:N]
    s = 0
    res = 0
    for i,l in enumerate(L):
        if l == 0:
            L_ = [l_-1 for l_ in L[s:i]]
            if len(L_) != 0:
                res += 1
                s = i+1
                if sum(L_) != 0:
                    res += dfs(L_)
        elif i == len(L)-1:
            L_ = [l_-1 for l_ in L[s:len(L)]]
            if len(L_) != 0:
                res += 1
                s = i+1
                if sum(L_) != 0:
                    res += dfs(L_)
    return res

if sum(h) == 0:
    print(0)
else:
    print(dfs(h))

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

def dfs(L):
    for i,l in enumerate(L):
        if l != 0:
            break
    L = L[i:N]
    s = 0
    res = 0
    for i,l in enumerate(L):
        if l == 0:
            L_ = [l_-1 for l_ in L[s:i]]
            s = i+1
            if len(L_) != 0:
                res += 1
                res += dfs(L_)
        elif i == len(L)-1:
            L_ = [l_-1 for l_ in L[s:len(L)]]
            s = i+1
            if len(L_) != 0:
                res += 1
                res += dfs(L_)
    return res

if sum(h) == 0:
    print(0)
else:
    print(dfs(h))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

if sum(B) > sum(A):
    print(-1)
else:
    diff = [a-b for a,b in zip(A,B)]
    plus = []
    minus = []
    equal = []
    for d in diff:
        if d >= 0:
            plus.append(d)
        elif d < 0:
            minus.append(d)
    lack = sum(minus)
    while lack < 0:
        lack += max(plus)
        plus.remove(max(plus))
    print(N-len(plus))

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

if sum(B) > sum(A):
    print(-1)
else:
    diff = [a-b for a,b in zip(A,B)]
    plus = []
    minus_num = 0
    lack = 0
    for d in diff:
        if d >= 0:
            plus.append(d)
        elif d < 0:
            minus_num += 1
            lack += d
    plus.sort(reverse=True)
    i = 0
    while lack < 0:
        lack += plus[i]
        i += 1
        
    print(N-len(plus)+i)
Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int,input().split())
h = list(map(int,input().split()))
INF = 10**10

dp = [INF]*N
dp[0] = 0

for i in range(N):
    for k in range(1,K+1):
        if i-k>=0:
            dp[i] = min(dp[i],dp[i-k]+abs(h[i]-h[i-k]))

print(dp[-1])

Fixed submission:
N,K = map(int,input().split())
h = list(map(int,input().split()))
INF = 10**10

dp = [INF]*N
dp[0] = 0

for i,hi in enumerate(h):
    if i == 0:
        continue
    s = i-K if i-K >= 0 else 0
    dp[i] = min([dpk + abs(hi-hk) for dpk,hk in zip(dp[s:i],h[s:i])])

print(dp[-1])
Buggy python submission (verdict: Runtime Error):
# coding : utf-8

import math

N,M = map(int,input().split())

b = M//N

l = []
for i in range(1,int(math.sqrt(M)+1)):
    if M % i == 0:
        l.append(i)

ans = 1
for l_ in l:
    if l_ <= b:
        ans = max(ans,l_)

print(ans)

Fixed submission:
# coding : utf-8

N = input()
if N == '1':
    print('Hello World')
elif N == '2':
    A = int(input())
    B = int(input())
    print(A+B)
Buggy python submission (verdict: Time Limit Exceeded):
# coding : utf-8

N,M = map(int,input().split())

b = M//N

print(max([i for i in range(1,b+1) if M%i == 0]))

Fixed submission:
from math import sqrt
 
n, m = map(int, input().split())
l = []
for i in range(1, int(sqrt(m)) + 1):
	if m % i == 0:
		l.append(i)
		l.append(m // i)
 
ans = 1
for d in l:
	if d * n <= m:
		ans = max(ans, d)
 
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
# coding : utf-8

import math

N,M = map(int,input().split(' '))

print(max([i for i in range(1,int(M/N)+1) if M%i == 0]))

Fixed submission:
from math import sqrt
 
n, m = map(int, input().split())
l = []
for i in range(1, int(sqrt(m)) + 1):
	if m % i == 0:
		l.append(i)
		l.append(m // i)
 
ans = 1
for d in l:
	if d * n <= m:
		ans = max(ans, d)
 
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
# coding : utf-8

N,M = map(int,input().split(' '))

b = M/N

print(max([i+1 for i in range(int(b)) if M%(i+1) == 0]))

Fixed submission:
from math import sqrt
 
n, m = map(int, input().split())
l = []
for i in range(1, int(sqrt(m)) + 1):
	if m % i == 0:
		l.append(i)
		l.append(m // i)
 
ans = 1
for d in l:
	if d * n <= m:
		ans = max(ans, d)
 
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
# coding : utf-8

N,M = map(int,input().split(' '))

b = M/N
y = []

for i in range(int(b)):
    if M % (i+1) == 0:
        y.append(i+1)

print(max(y))

Fixed submission:
from math import sqrt
 
n, m = map(int, input().split())
l = []
for i in range(1, int(sqrt(m)) + 1):
	if m % i == 0:
		l.append(i)
		l.append(m // i)
 
ans = 1
for d in l:
	if d * n <= m:
		ans = max(ans, d)
 
print(ans)
Buggy python submission (verdict: Runtime Error):
import math
from functools import reduce

N, X = list(map(int, input().split()))
x = [i-X for i in list(map(int, input().split()))]

def func(nums):
    return reduce(math.gcd, nums)

print(func(x))

Fixed submission:
import fractions
from functools import reduce

N, X = list(map(int, input().split()))
x = [i-X for i in list(map(int, input().split()))]

def func(nums):
    return reduce(fractions.gcd, nums)

print(abs(func(x)))
Buggy python submission (verdict: Runtime Error):
D,G = list(map(int,input().split()))
P = []
C = []

for i in range(D):
    p,c = list(map(int,input().split()))
    P.append(p)
    C.append(c)

for c in range(2**D):
    score = 0
    solved = 0
    remain = []
    for i,b in enumerate(format(c,'b').zfill(D)):
        if b == '1':
            score += P[i]*100*(i+1) + C[i]
            solved += P[i]
        else:
            remain.append(i)
    if score < G:
        R = G - score
        j = remain[-1]
        if (P[j]-1)*(j+1)*100 < R:
            continue
        solved += (R//(100*(j+1)))
    ans = min(solved, ans)

print(ans)

Fixed submission:
D,G = list(map(int,input().split()))
P = []
C = []

for i in range(D):
    p,c = list(map(int,input().split()))
    P.append(p)
    C.append(c)

ans = 10000

for c in range(2**D):
    score = 0
    solved = 0
    remain = []
    for i,b in enumerate(format(c,'b').zfill(D)):
        if b == '1':
            score += P[i]*100*(i+1) + C[i]
            solved += P[i]
        else:
            remain.append(i)
    if score < G:
        R = G - score
        j = remain[-1]
        if (P[j]-1)*(j+1)*100 < R:
            continue
        solved += -(-R//(100*(j+1)))
    ans = min(solved, ans)

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

s = []
for S_ in S:
    if S_ == 'W':
        s.append(0)
    else:
        s.append(1)

ans = N
s_total = sum(s)
for i,s_ in enumerate(s):
    diff = i - sum(s[:i])*2 - s_ + s_total
    if ans > diff:
        ans = diff

print(ans)

Fixed submission:
N = int(input())
S = [1 if l == 'E' else 0 for l in list(input())]

for i in range(1,N):
    S[i] += S[i-1]
S.insert(0,0)

ans = N
for i in range(N):
    diff = i - S[i] + S[-1] - S[i+1]
    if ans > diff:
        ans = diff

print(ans)

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

s = []
for S_ in S:
    if S_ == 'W':
        s.append(0)
    else:
        s.append(1)

ans = N
for i in range(len(s)):
    diff = i - sum(s[:i]) + sum(s[i+1:])
    if ans > diff:
        ans = diff

print(ans)

Fixed submission:
N = int(input())
S = [1 if l == 'E' else 0 for l in list(input())]

for i in range(1,N):
    S[i] += S[i-1]
S.insert(0,0)

ans = N
for i in range(N):
    diff = i - S[i] + S[-1] - S[i+1]
    if ans > diff:
        ans = diff

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
S = input()
K = int(input())

d = {}
for i in range(len(S)):
    for j in range(i+1,len(S)+1):
        s = S[i:j]
        if s in d.keys():
            pass
        else:
            d[s] = 0

d = sorted(d.keys())
print(d[K-1])

Fixed submission:
S = input()
K = int(input())

d = {}
for i in range(len(S)):
    for j in range(i+1,i+K+1):
        s = S[i:j]
        if s in d.keys():
            pass
        else:
            d[s] = 0

d = sorted(d.keys())
print(d[K-1])
Buggy python submission (verdict: Runtime Error):
#coding : utf-8

N,Y = [int(i) for i in input().split()]
flag = 0

for i in range(N+1):
    for j in range(N+1-i):
        if Y == 10000*i + 5000*j + 1000*(N-i-j) and flag == 0:
            print(i,j,N-i-j)
            flag = 1
            break
if flag == 0:
    print(-1,-1,-1)

Fixed submission:
#coding : utf-8

s = input()
s = '2018' + s[4:]
print(s)
Buggy python submission (verdict: Runtime Error):
A,B,C,D,E,F = map(int,input().split())

ans_con = 0
max_con = E/(100+E)*100

a = 0
while F > 100*A*a:
    b = 0
    while F-100*A*a > 100*B*b:
        c = 0
        while F-100*(A*a+B*b) > C*c and c:
            water = 100*(A*a+B*b)
            sugar = C*c+D*min((F-100*(A*a+B*b)-C*c)//D, (water/100*E-C*c)//D)
            mass = water + sugar
            if mass != 0:
                con = sugar/mass*100
                if ans_con < con <= max_con:
                    ans_con = con
                    ans_mass = mass
                    ans_sugar = sugar
            c += 1
        b += 1
    a += 1

print(int(ans_mass), int(ans_sugar))

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

ans_con = -1
max_con = E/(100+E)*100

a = 0
while F >= 100*A*a:
    b = 0
    while F-100*A*a >= 100*B*b:
        water = 100*(A*a+B*b)
        c = 0
        while F-water >= C*c:
            d = 0
            while F-water-C*c >= D*d:
                sugar = C*c+D*d
                mass = water + sugar
                if 0 < mass <= F:
                    con = sugar/mass*100
                    if ans_con < con <= max_con:
                        ans_con = con
                        ans_mass = mass
                        ans_sugar = sugar
                d += 1
            c += 1
        b += 1
    a += 1

print(int(ans_mass), int(ans_sugar))

Buggy python submission (verdict: Runtime Error):
A,B,C,D,E,F = map(int,input().split())

ans_con = 0
max_con = E/(100+E)*100

a = 0
while F > 100*A*a:
    b = 0
    while F-100*A*a > 100*B*b:
        c = 0
        while F-100*(A*a+B*b) > C*c and c:
            water = 100*(A*a+B*b)
            sugar = C*c+D*min((F-100*(A*a+B*b)-C*c)//D, (water/100*E-C*c)//D)
            mass = water + sugar
            if mass == 0 or mass > F:
                break
            con = sugar/mass*100
            if ans_con < con <= max_con:
                ans_con = con
                ans_mass = mass
                ans_sugar = sugar
            c += 1
        b += 1
    a += 1

print(int(ans_mass), int(ans_sugar))

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

ans_con = -1
max_con = E/(100+E)*100

a = 0
while F >= 100*A*a:
    b = 0
    while F-100*A*a >= 100*B*b:
        water = 100*(A*a+B*b)
        c = 0
        while F-water >= C*c:
            d = 0
            while F-water-C*c >= D*d:
                sugar = C*c+D*d
                mass = water + sugar
                if 0 < mass <= F:
                    con = sugar/mass*100
                    if ans_con < con <= max_con:
                        ans_con = con
                        ans_mass = mass
                        ans_sugar = sugar
                d += 1
            c += 1
        b += 1
    a += 1

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

x = 1
count = 0
while x != 2:
    x = a[x-1]
    count += 1
    if x == 1:
        print(-1)
        break
else:
    print(count)

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

x = 1
s = {1}
count = 0
while x != 2:
    x = a[x-1]
    count += 1
    if x in s:
        print(-1)
        break
    s.add(x)
else:
    print(count)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))

ans = 0
while len(A):
    for i in range(len(A)-2):
        if (A[i+2]-A[i+1]>0)!=(A[i+1]-A[i]>0) and A[i+2]-A[i+1]!=0 and A[i+1]-A[i]!=0:
            A = A[i+2:]
            ans += 1
            break
    else:
        break

print(ans+1)

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

ans = 1
d = 0
tmp = A[0]
for a in A[1:]:
    if d*(a-tmp) < 0:
        ans += 1
        d = 0
    else:
        d += a-tmp
    tmp = a

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
A.sort(reverse = True)

ans = 0
for i in range(N-1):
  ans += A[0]
  if i % 2 == 0:
    del A[0]
    
print(ans)

Fixed submission:
import math
N = int(input())
A = list(map(int,input().split()))
A.sort(reverse = True)

ans = 0
for i in range(1,N):
  a = math.floor(i/2)
  ans += A[a]
    
print(ans)
Buggy python submission (verdict: Runtime Error):
N,S = map(int,input().split())
n,s = map(int,input().split())
T = int(input())

if (N - n)%(S-s)== 0 and N + S*T >= n + s*t:
  print("Yes")
else:
  print("No")

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

dis = abs(B - A)
speed = V - W


if dis <= speed*T:
  print("YES")
else:
  print("NO")
Buggy python submission (verdict: Runtime Error):
if 0 in A:
  print(0)
  exit()

  
ans = 1
A.sort(reverse = True)
for i in range(len(A)):
  ans = ans * A[i] 
  if ans > lim:
    print(-1)
    exit()

if ans > lim:
  print(-1)
else:
  print(ans)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
lim = 10**18

if 0 in A:
  print(0)
  exit()

  
ans = 1
A.sort(reverse = True)
for i in range(len(A)):
  ans = ans * A[i] 
  if ans > lim:
    print(-1)
    exit()

if ans > lim:
  print(-1)
else:
  print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
x = list(map(int,input.split()))

ans = 100000

for i in range(100):
    result = 0
    for j in x:
        result += (j - i )**2
    ans = min(result, ans)
        
print(ans)


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

ans = 10000000

for i in range(100):
    result = 0
    for j in x:
        result += (j - i )**2
    ans = min(result, ans)
        
print(ans)

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

ans = 100000

for i in 1,101:
    result = 0
    for j in x:
        result += (j - i )**2
    ans = min(result, ans)
        
print(ans)

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

ans = 10000000

for i in range(100):
    result = 0
    for j in x:
        result += (j - i )**2
    ans = min(result, ans)
        
print(ans)

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


for i in 100:
  result = 0
  for j in x:
    result += (i - j)**2
  print(min(result))
    

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

ans = 10000000

for i in range(100):
    result = 0
    for j in x:
        result += (j - i )**2
    ans = min(result, ans)
        
print(ans)
Buggy python submission (verdict: Runtime Error):
x = int(input())
n = 2

for i in range(10^5):
  while x % n != 0 or n =< x/2:
      n += 1
  if n =< x/2:
    x += 1
    
  else:
    print(x)
    break
      


  	

Fixed submission:
x = int(input())

while True:
  n = 2
  while x % n != 0 and n <= x/2:
    n += 1
  if n < x/2:
    x += 1
    
  else:
    print(x)
    break
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
 
if b == 0:
    return 1
else:
    inpu = 1
    while b > (a -1) * inpu + a:
        inpu +=1
    print(inpu + 1)

Fixed submission:
a, b = map(int, input().split())
 
k = 1
ans = 0
 
if b == 1:
  print(0)
else:
  while k<b:
    k += a-1
    ans += 1
  print(ans)

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

if b == 0:
	return 1
else:
	inpu = 1
    while b > (a -1) * inpu + a:
    	inpu +=1
    print(inpu + 1)

Fixed submission:
a, b = map(int, input().split())
 
k = 1
ans = 0
 
if b == 1:
  print(0)
else:
  while k<b:
    k += a-1
    ans += 1
  print(ans)

Buggy python submission (verdict: Runtime Error):
k = 1
ans = 0
 
if b == 1:
  print(0)
else:
  while k<b:
    k += a-1
    ans += 1
  print(ans)

Fixed submission:
a, b = map(int, input().split())
 
k = 1
ans = 0
 
if b == 1:
  print(0)
else:
  while k<b:
    k += a-1
    ans += 1
  print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
my_list =list(range(1,N ))

print(sum(my_list))

Fixed submission:
N = int(input())

if (N -1) % 2 == 0:
  ans = N*(N-1)//2
else:
  ans = N*(N-2)//2 + N//2
  
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
R,G,B,N = map(int, input().split())
index = 0
ans = 0
for_sort = [R,G,B]
for_sort.sort()
r = for_sort[2]
g = for_sort[1]
b = for_sort[0]
while N >= r*index:
  middle = N - r*index
  index += 1
  index2 = 0
  while middle >= g*index2:
    end = middle - g*index2
    index2 += 1
    if end % b == 0:
      ans += 1
print(ans)    

Fixed submission:
R,G,B,N = map(int, input().split())
index = 0
ans = 0
for_sort = [R,G,B]
for_sort.sort()
r = for_sort[2]
g = for_sort[1]
b = for_sort[0]
while N >=0:
  mid = N
  N -= r
  while mid >= 0:
    if mid % b == 0:
      ans += 1
    mid -= g
      
print(ans)