Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
s = input()
t = 0
d = {t:0}
for i in (ord(x)-ord('a') for x in s) :
	t ^= 1 << i
	c = d[t] if t in d else 1000000
	for j in range(26) :
		if t^(1<<j) in d :
			c = min(c,d[t^(1<<j)]+1)
	d[t] = c
print(d[t] if d[t] else 1)


Fixed submission:
#!/usr/bin/env python3
s = input()
t = 0
d = {t:0}
for i in (ord(x)-ord('a') for x in s) :
	t ^= 1 << i
	d[t] = min(d[t] if t in d else 1000000, min((d[t^(1<<j)] for j in range(26) if t^(1<<j) in d))+1)
print(d[t] if d[t] else 1)

Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
s = input()
t = 0
d = [1000000] * (1<<26)
d[0] = 0
for i in s :
	t ^= 1 << (ord(i)-ord('a'))
	for j in range(26) :
		d[t] = min(d[t],d[t^(1<<j)]+1)
print(d[t] if d[t] else 1)


Fixed submission:
#!/usr/bin/env python3
s = input()
t = 0
d = {t:0}
for i in (ord(x)-ord('a') for x in s) :
	t ^= 1 << i
	d[t] = min(d[t] if t in d else 1000000, min((d[t^(1<<j)] for j in range(26) if t^(1<<j) in d))+1)
print(d[t] if d[t] else 1)

Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
s = input()
t = 0
d = {t:0}
for i in s :
	t ^= 1 << (ord(i)-ord('a'))
	for j in range(26) :
		d[t] = min(d.get(t,1000000),d.get(t^(1<<j),1000000)+1)
print(d[t] if d[t] else 1)


Fixed submission:
#!/usr/bin/env python3
s = input()
t = 0
d = {t:0}
for i in (ord(x)-ord('a') for x in s) :
	t ^= 1 << i
	d[t] = min(d[t] if t in d else 1000000, min((d[t^(1<<j)] for j in range(26) if t^(1<<j) in d))+1)
print(d[t] if d[t] else 1)

Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
s = input()
t = 0
d = {t:0}
for i in s :
	t ^= 1 << (ord(i)-ord('a'))
	for j in range(26) :
		if (t^(1<<j)) in d :
			d[t] = min(d[t] if t in d else int(1e9),d[t^(1<<j)]+1)
print(d[t] if d[t] else 1)


Fixed submission:
#!/usr/bin/env python3
s = input()
t = 0
d = {t:0}
for i in (ord(x)-ord('a') for x in s) :
	t ^= 1 << i
	d[t] = min(d[t] if t in d else 1000000, min((d[t^(1<<j)] for j in range(26) if t^(1<<j) in d))+1)
print(d[t] if d[t] else 1)
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3
import collections

def dfs(n, pre, T, dist, d) :
	dist[n] = d
	for i in T[n] :
		if i[0] != pre :
			dfs(i[0], n, T, dist, d + i[1])


N = int(input())
T = collections.defaultdict(lambda : [])
for i in range(N-1) :
	a, b, c = map(int, input().split())
	T[a].append((b, c))
	T[b].append((a, c))
Q, K = map(int, input().split())

d = {}
dfs(K, -1, T, d, 0)

for i in range(Q) :
	x, y = map(int, input().split())
	print(d[x]+d[y])


Fixed submission:
#!/usr/bin/env python3
import collections
import sys
sys.setrecursionlimit(int(1e7))

def dfs(n, pre, T, dist, d) :
	dist[n] = d
	for i in T[n] :
		if i[0] != pre :
			dfs(i[0], n, T, dist, d + i[1])


N = int(input())
T = collections.defaultdict(lambda : [])
for i in range(N-1) :
	a, b, c = map(int, input().split())
	T[a].append((b, c))
	T[b].append((a, c))
Q, K = map(int, input().split())

d = {}
dfs(K, -1, T, d, 0)

for i in range(Q) :
	x, y = map(int, input().split())
	print(d[x]+d[y])
Buggy python submission (verdict: Runtime Error):

N=int(input())

a=0
if N>81:
  print('No')
elif N<1:
  print('No')
else:
  for i in range(1,9):
    if N%i==0:
      if N/i<=9:
	    print('Yes')
      	a=1
      	break
  if a==0:
    print('No')

Fixed submission:
N=int(input())

a=0
if N>81:
  print('No')
elif N<1:
  print('No')
else:
  for i in range(1,10):
    if N%i==0:
      if N/i<=9:
          print('Yes')
          a=1
          break
  if a==0:
    print('No')
Buggy python submission (verdict: Runtime Error):
N,K=map(int,input().split())

H=list(input())

cnt=0

for h in H:
  if h>K:
    cnt+=1
print(cnt)

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

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

cnt=0

for h in H:
  if h>=K:
    cnt+=1
print(cnt)

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

H=list(input())

cnt=0

for h in H:
  if h>K:
    cnt+=1
print(cnt)

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

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

cnt=0

for h in H:
  if h>=K:
    cnt+=1
print(cnt)
Buggy python submission (verdict: Runtime Error):
N=int(input())

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

B=[[0]*N]
for i in range(N):
  B[A[i]]=i+1

for i in range(N);
	print(B[i],end=" ")
       

Fixed submission:
N=int(input())

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

B=[0]*N
for i in range(N):
  B[A[i]-1]=i+1

for i in range(N):
	print(B[i],end=" ")

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

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

B=[[0]*N]
for i in range(N):
  B[A[i]]=i

for i in range(N);
	print(B[i],end=" ")
       

Fixed submission:
N=int(input())

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

B=[0]*N
for i in range(N):
  B[A[i]-1]=i+1

for i in range(N):
	print(B[i],end=" ")
Buggy python submission (verdict: Time Limit Exceeded):

N,Q=map(int,input().split())
AB = [list(map(int,input().split())) for _ in range(N-1)]
PQ = [list(map(int,input().split())) for _ in range(Q)]
AB.sort()
PQ.sort()
l=[[] for _ in range(N)]
ans=[0]*N
for a,b in AB:
	l[a-1].append(b-1)
for p,q in PQ:
	ans[p-1]+=q
for i in range(N-1):
	for j in l[i]:
		ans[j]+=ans[i]
	
print(*ans)

Fixed submission:

N,Q=map(int,input().split())
AB = [list(map(int,input().split())) for _ in range(N-1)]
PQ = [list(map(int,input().split())) for _ in range(Q)]
#AB.sort()
#PQ.sort()
l=[[] for _ in range(N)]
ans=[0]*N
for a,b in AB:
	l[a-1].append(b-1)
for p,q in PQ:
	ans[p-1]+=q
for i in range(N-1):
	for j in l[i]:
		ans[j]+=ans[i]
	
print(*ans)

Buggy python submission (verdict: Time Limit Exceeded):

N,Q=map(int,input().split())
AB = [list(map(int,input().split())) for _ in range(N-1)]
PQ = [list(map(int,input().split())) for _ in range(Q)]
AB.sort()
PQ.sort()
l=[[] for _ in range(N)]
ans=[0]*N
for a,b in reversed(AB):
	l[a-1].append(b)
	l[a-1].extend(l[b-1])
for p,q in PQ:
	ans[p-1]+=q
	for i in l[p-1]:
		ans[i-1]+=q
print(*ans)

Fixed submission:

N,Q=map(int,input().split())
AB = [list(map(int,input().split())) for _ in range(N-1)]
PQ = [list(map(int,input().split())) for _ in range(Q)]
#AB.sort()
#PQ.sort()
l=[[] for _ in range(N)]
ans=[0]*N
for a,b in AB:
	l[a-1].append(b-1)
for p,q in PQ:
	ans[p-1]+=q
for i in range(N-1):
	for j in l[i]:
		ans[j]+=ans[i]
	
print(*ans)

Buggy python submission (verdict: Time Limit Exceeded):
N,Q=map(int,input().split())
AB = [list(map(int,input().split())) for _ in range(N-1)]
PQ = [list(map(int,input().split())) for _ in range(Q)]
AB.sort()
PQ.sort()
l=[[] for _ in range(N)]
ans=[0]*N
for a,b in reversed(AB):
	l[a-1].append(b)
	l[a-1].extend(l[b-1])
for p,q in PQ:
	ans[p-1]+=q
	for i in l[p-1]:
		ans[i-1]+=q
print(*ans)

Fixed submission:

N,Q=map(int,input().split())
AB = [list(map(int,input().split())) for _ in range(N-1)]
PQ = [list(map(int,input().split())) for _ in range(Q)]
#AB.sort()
#PQ.sort()
l=[[] for _ in range(N)]
ans=[0]*N
for a,b in AB:
	l[a-1].append(b-1)
for p,q in PQ:
	ans[p-1]+=q
for i in range(N-1):
	for j in l[i]:
		ans[j]+=ans[i]
	
print(*ans)
Buggy python submission (verdict: Runtime Error):
  while b!=0:
    a,b=b,a%b
  return a

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

c1=B//C
c2=(A-1)//C

cd1=B//((C*D)/gcd(C,D))
cd2=(A-1)//((C*D)/gcd(C,D))

d1=B//D
d2=(A-1)//D


print(int(B-A+1-(c1-c2)-(d1-d2)+(cd1-cd2)))


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

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

c1=B//C
c2=(A-1)//C

cd1=B//((C*D)//gcd(C,D))
cd2=(A-1)//((C*D)//gcd(C,D))

d1=B//D
d2=(A-1)//D


print(str(int(B-A+1-(c1-c2)-(d1-d2)+(cd1-cd2))))

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

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

c1=B//C
c2=(A-1)//C

cd1=B//((C*D)/math.gcd(C,D))
cd2=(A-1)//((C*D)/math.gcd(C,D))

d1=B//D
d2=(A-1)//D


print(int(B-A+1-(c1-c2)-(d1-d2)+(cd1-cd2)))

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

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

c1=B//C
c2=(A-1)//C

cd1=B//((C*D)//gcd(C,D))
cd2=(A-1)//((C*D)//gcd(C,D))

d1=B//D
d2=(A-1)//D


print(str(int(B-A+1-(c1-c2)-(d1-d2)+(cd1-cd2))))
Buggy python submission (verdict: Runtime Error):
N=int(input())

SP = [list(input().split()) for _ in range(N)]

sp=[]
count=1
for s,p in SP:
    sp.append([s,int(p),count])
    count+=1
    
#sp.sort(key=lambda x:x[1],reverse=True)
sp.sort(key=lambda x:(x[0],-x[1]))

for i in len(sp):
    print(sp[i][2])

Fixed submission:
N=int(input())

SP = [list(input().split()) for _ in range(N)]

sp=[]
count=1
for s,p in SP:
    sp.append([s,int(p),count])
    count+=1
    
#sp.sort(key=lambda x:x[1],reverse=True)
sp.sort(key=lambda x:(x[0],-x[1]))

for i,j,k in sp:
    print(k)
Buggy python submission (verdict: Runtime Error):
N,M=map(int,input().split())


A=[int(i) for i in (input().split(" "))]

A.sort()

BC = [list(map(int,input().split())) for _ in range(M)]

BC.sort(key=lambda x:x[1],reverse=True)

for b,c in BC:
    A.expend([c]*b)
    if len(A)>2*N:
        break

A.sort(reverse=True)
suma=0
#for i in A:
#    suma+=i

print(sum(A[:N]))

Fixed submission:

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

if A>=13:
    print(str(B))
elif A>=6 and A<13:
    print(str(int(B/2)))
else:
    print(str(0))
Buggy python submission (verdict: Time Limit Exceeded):
N,M=map(int,input().split())

LR = [list(map(int,input().split())) for _ in range(M)]

IDlist=[i for i in range(N)]

for l,r in LR:
    LRlist=[i for i in range(l-1,r)]
    IDlist=set(IDlist)&set(LRlist)
print(len(IDlist))

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

LR = [list(map(int,input().split())) for _ in range(M)]

L=0
R=N
for l,r in LR:
    if L<l:
        L=l
    if R>r:
        R=r
    #print(str(L)+str(R))

if R-L+1<0:
    print(0)
else:
    
    print(str(R-L+1))

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

LR = [list(map(int,input().split())) for _ in range(M)]

IDlist=[0]*N

for l,r in LR:
    for i in range(l-1,r):
        IDlist[i]+=1

print(IDlist.count(M))

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

LR = [list(map(int,input().split())) for _ in range(M)]

L=0
R=N
for l,r in LR:
    if L<l:
        L=l
    if R>r:
        R=r
    #print(str(L)+str(R))

if R-L+1<0:
    print(0)
else:
    
    print(str(R-L+1))
Buggy python submission (verdict: Runtime Error):
N,M=map(int,input().split())


A=[int(i) for i in (input().split(" "))]

A.sort()

BC = [list(map(int,input().split())) for _ in range(M)]

BC.sort(key=lambda x:x[1],reverse=True)

for b,c in BC:
    A.expend([c]*b)
    if len(A)>2*N:
        break

A.sort(reverse=True)
suma=0
#for i in A:
#    suma+=i

print(sum(A[:N]))

Fixed submission:

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


A=[int(i) for i in (input().split(" "))]

A.sort()

BC = [list(map(int,input().split())) for _ in range(M)]

BC.sort(key=lambda x:x[1],reverse=True)

for b,c in BC:
    A.extend([c]*b)
    if len(A)>2*N:
        break

A.sort(reverse=True)
suma=0
#for i in A:
#    suma+=i

print(sum(A[:N]))

Buggy python submission (verdict: Time Limit Exceeded):

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


A=[int(i) for i in (input().split(" "))]



BC = [list(map(int,input().split())) for _ in range(M)]

for b,c in BC:
    count=0
    A.sort()
    for i in range(b):
        if c<A[i]:
            break
        else:
            A[i]=c
    
suma=0
#for i in A:
#    suma+=i

print(sum(A))

Fixed submission:

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


A=[int(i) for i in (input().split(" "))]

A.sort()

BC = [list(map(int,input().split())) for _ in range(M)]

BC.sort(key=lambda x:x[1],reverse=True)

for b,c in BC:
    A.extend([c]*b)
    if len(A)>2*N:
        break

A.sort(reverse=True)
suma=0
#for i in A:
#    suma+=i

print(sum(A[:N]))

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


A=[int(i) for i in (input().split(" "))]



BC = [list(map(int,input().split())) for _ in range(M)]

for b,c in BC:
    count=0
    A.sort()
    for i in range(b):
        if c<A[i]:
            break
        else:
            A[i]=c
    
suma=0
for i in A:
    suma+=i

print(suma)

Fixed submission:

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


A=[int(i) for i in (input().split(" "))]

A.sort()

BC = [list(map(int,input().split())) for _ in range(M)]

BC.sort(key=lambda x:x[1],reverse=True)

for b,c in BC:
    A.extend([c]*b)
    if len(A)>2*N:
        break

A.sort(reverse=True)
suma=0
#for i in A:
#    suma+=i

print(sum(A[:N]))

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


A=[int(i) for i in (input().split(" "))]
A.sort()


BC = [list(map(int,input().split())) for _ in range(M)]

for b,c in BC:
    count=0
    A.sort()
    for (i,a) in enumerate(A):
        if count==b or c<a:
            break
        else:
            A[i]=c
            count+=1
    
suma=0
for i in A:
    suma+=i

print(suma)

Fixed submission:

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


A=[int(i) for i in (input().split(" "))]

A.sort()

BC = [list(map(int,input().split())) for _ in range(M)]

BC.sort(key=lambda x:x[1],reverse=True)

for b,c in BC:
    A.extend([c]*b)
    if len(A)>2*N:
        break

A.sort(reverse=True)
suma=0
#for i in A:
#    suma+=i

print(sum(A[:N]))
Buggy python submission (verdict: Runtime Error):
n = int(input())
ans = math.ceil(n/2)-1
print(ans)

Fixed submission:
import math
n = int(input())
ans = math.ceil(n/2) - 1
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
if N>=1 and N<=81 and N!=30 and N!=50 and N!=60 and N!=70 and N!=80:
  print("Yes)
else:
  print("No")
   
  

Fixed submission:
N = int(input())

def isPrime(n) : 
  
    # Corner cases 
    if (n <= 1) : 
        return False
    if (n <= 3) : 
        return True
  
    # This is checked so that we can skip  
    # middle five numbers in below loop 
    if (n % 2 == 0 or n % 3 == 0) : 
        return False
  
    i = 5
    while(i * i <= n) : 
        if (n % i == 0 or n % (i + 2) == 0) : 
            return False
        i = i + 6
  
    return True

if N<=9:
  print("Yes")
elif ( N == 50 or N ==60 or N == 70 or N == 80 or isPrime(N) or N>81):
  print("No")
else:
  i = 2
  while(i<=9):
    if N%i == 0 and 1<=N/i <= 9:
      print("Yes")
      break
    else:
      if i == 9:
        print("No")
        break
      else:
        i = i + 1
Buggy python submission (verdict: Runtime Error):
n,k = map(int, input().split())
nums = []
for i in range(n):
    nums.append(int(input()))

count = 0
for n in nums:
  if n >= k:
    count +1
  else:
    continue
print(count)

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

count = 0
for n in nums:
  if n >= k:
    count +=1
  else:
    continue
print(count)

Buggy python submission (verdict: Runtime Error):
n,k = map(int, input().split())
nums = []
for i in range(n):
    nums.append(int(input()))

count = 0
for n in nums:
  if n > k:
    count +1
  else:
    continue
print(count)

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

count = 0
for n in nums:
  if n >= k:
    count +=1
  else:
    continue
print(count)
Buggy python submission (verdict: Runtime Error):
n,q = map(int, input().split())
a = []
for i in range(n-1):
    a.append((input()))

b = []
for j in range(q):
    b.append((input()))
    
aws = []
for k in range(n):
    aws.append(0)
    
def tree(t_num,point):
    aws[t_num - 1] +=  point
    for an in a:
        if t_num == int(an.split()[0]):
            tree(int(an.split()[1]),point)
for bn in b:
    t_num = int(bn.split()[0])
    point = int(bn.split()[1])
    tree(t_num,point)
    
aws_2 = []
for h in aws:
    str_h = str(h)
    aws_2.append(str_h)
print(" ".join(aws_2))


Fixed submission:
n = int(input())
numbers = list(map(int,input().split()))
 
def aaa(numbers):
    if len(numbers) > 1:
        numbers.sort()
        new_number = (numbers[0] + numbers[1]) / 2
        n_0 = numbers[0]
        n_1 = numbers[1]
        numbers.remove(n_0)
        numbers.remove(n_1)
        numbers.append(new_number)
        aaa(numbers)
    else:
        return numbers[0]
      
aaa(numbers)
print(aaa(numbers))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
numbers = []
for i in range(N):
    numbers.append(int(input()))
    
aaa = max(numbers)
    
for n in numbers:
    if aaa == n:
        print(sorted(numbers)[-2])
    else:
        print(aaa)

Fixed submission:
N = int(input())
numbers = []
for i in range(N):
    numbers.append(int(input()))
    
    
aaa = max(numbers)
bbb = sorted(numbers)[-2]

for n in numbers:
    if aaa == n:
        print(bbb)
    else:
        print(aaa)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
numbers = []
for i in range(N):
    numbers.append(int(input()))
    
for n in numbers:
    aaa = max(numbers)
    if aaa == n:
        print(sorted(numbers)[-2])
    else:
        print(aaa)

Fixed submission:
N = int(input())
numbers = []
for i in range(N):
    numbers.append(int(input()))
    
    
aaa = max(numbers)
bbb = sorted(numbers)[-2]

for n in numbers:
    if aaa == n:
        print(bbb)
    else:
        print(aaa)

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

N = int(input())
numbers = []
for i in range(N):
    numbers.append(int(input()))
    
for n in numbers:
    numbers_2 = copy.deepcopy(numbers)
    c = copy.deepcopy(n)
    numbers_2.remove(c)
    print(max(numbers_2))

Fixed submission:
N = int(input())
numbers = []
for i in range(N):
    numbers.append(int(input()))
    
    
aaa = max(numbers)
bbb = sorted(numbers)[-2]

for n in numbers:
    if aaa == n:
        print(bbb)
    else:
        print(aaa)
Buggy python submission (verdict: Runtime Error):
apples =str(input())
apples_list = apples.split(" ")
N = int(apples_list[0])
L = int(apples_list[-1])
pai_values = []
 
for i in range(1,N+1):
    pai_value = i + L -1
    pai_values.append(pai_value)
    
min_pai = abs(pai_values[0])
 
for j in range(N):
    if min_pai > abs(pai_values[j]):
        min_pai = abs(pai_values[j])
        target_number = j
        
pai_values.pop(target_number)
 
answer = sum(pai_values)
 
print(int(answer))

Fixed submission:
apples =str(input())
apples_list = apples.split(" ")
N = int(apples_list[0])
L = int(apples_list[-1])
pai_values = []
 
for i in range(1,N+1):
    pai_value = i + L -1
    pai_values.append(pai_value)
    
min_pai = abs(pai_values[0])
target_number = 0
 
for j in range(N):
    if min_pai > abs(pai_values[j]):
        min_pai = abs(pai_values[j])
        target_number = j
        
pai_values.pop(target_number)
 
answer = sum(pai_values)
 
print(int(answer))

Buggy python submission (verdict: Runtime Error):
apples =str(input())
apples_list = apples.split(" ")
N = int(apples_list[0])
L = int(apples_list[-1])
pai_values = []

for i in range(1,N+1):
    pai_value = i + L -1
    pai_values.append(pai_value)

min_pai = abs(pai_values[0])

for j in range(N):
    if min_pai > abs(pai_values[j]):
        min_pai = abs(pai_values[j])
        target_number = j

pai_values.pop(target_number)

answer = sum(pai_values)

print(int(answer))


Fixed submission:
apples =str(input())
apples_list = apples.split(" ")
N = int(apples_list[0])
L = int(apples_list[-1])
pai_values = []
 
for i in range(1,N+1):
    pai_value = i + L -1
    pai_values.append(pai_value)
    
min_pai = abs(pai_values[0])
target_number = 0
 
for j in range(N):
    if min_pai > abs(pai_values[j]):
        min_pai = abs(pai_values[j])
        target_number = j
        
pai_values.pop(target_number)
 
answer = sum(pai_values)
 
print(int(answer))

Buggy python submission (verdict: Runtime Error):
apples =str(input())
apples_list = apples.split(" ")
N = int(apples_list[0])
L = int(apples_list[-1])
pai_values = []

for i in range(1,N+1):
    pai_value = i + L -1
    pai_values.append(pai_value)

min_pai = abs(pai_values[0])

for j in range(N):
    if min_pai > abs(pai_values[j]):
        min_pai = abs(pai_values[j])
        target_number = j

pai_values.pop(target_number)

print(sum(pai_values))

Fixed submission:
apples =str(input())
apples_list = apples.split(" ")
N = int(apples_list[0])
L = int(apples_list[-1])
pai_values = []
 
for i in range(1,N+1):
    pai_value = i + L -1
    pai_values.append(pai_value)
    
min_pai = abs(pai_values[0])
target_number = 0
 
for j in range(N):
    if min_pai > abs(pai_values[j]):
        min_pai = abs(pai_values[j])
        target_number = j
        
pai_values.pop(target_number)
 
answer = sum(pai_values)
 
print(int(answer))
Buggy python submission (verdict: Runtime Error):
A, B, C = stdin.readline().rstrip().split()
A = int(A)
B = int(B)
C = int(C)
answer_1 = A + B
answer_2 = A + C
answer_3 = B + C

print(max(answer_1,answer_2,answer_3))

Fixed submission:
S = input().split()  

A = int(S[0])
B = int(S[1])
C = int(S[2])
answer_1 = A + B
answer_2 = A + C
answer_3 = B + C

print(min(answer_1,answer_2,answer_3))

Buggy python submission (verdict: Runtime Error):
A, B, C = stdin.readline().rstrip().split()
answer_1 = A + B
answer_2 = A + C
answer_3 = B + C

print(max(answer_1,answer_2,answer_3))

Fixed submission:
S = input().split()  

A = int(S[0])
B = int(S[1])
C = int(S[2])
answer_1 = A + B
answer_2 = A + C
answer_3 = B + C

print(min(answer_1,answer_2,answer_3))
Buggy python submission (verdict: Runtime Error):
S = input()
K = int(input())

if len(S) == 1:
    ans = S[0]
else:
    for i in S:
        if not i == "1":
            ans = i
            break
print(ans)

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

ans = 1
count = 0

if len(S) == 1:
    ans = S[0]
else:
    for i in S:
        if i == "1":
            count += 1
        if not i == "1":
            if K > count:
                ans = i
                break
            else:
                ans = 1
print(ans)
Buggy python submission (verdict: Runtime Error):
n,y = map(int,input().split())

import sys
flag = False
for i in range(n):
    for j in range(n-j):
        k = n - i - j
        if 10000 * i + 5000 * j + 1000 * k == y:
            flag = True
            print(i,j,k)
            sys.exit()
if flag == False:
    print(-1, -1, -1)

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

import sys

for i in range(n+1):
    for j in range(n+1-i):
        k = n - i - j
        if 10000 * i + 5000 * j + 1000 * k == y:
            print(i,j,k)
            sys.exit()

print(-1, -1, -1)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = 0
ans = 10000000000000000
s = 0
if N%2==0:
    for x in range(1,(N//2)+1):
        s=N//x
        if N%x==0:
            a = (s-1)+(x-1)
            if ans>a:
                ans = a
else:
    for x in range(1,((N+1)//2)):
        s =N//x
        if N%x==0:
            a = (s-1)+(x-1)
            if ans>a:
                ans = a
print(ans)


Fixed submission:
N = int(input())
a = 0
ans = N-1
s = 0
for x in range(1,1000001):
    s=N//x
    if N%x==0:
        a = (s-1)+(x-1)
        if ans>a:
             ans = a
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = 0
s = 0
ans = 10000000000000000
for x in range(1,N):
    s=N//x
    if N%x==0:
        a = (x-1)+(s-1)
        if ans > a:
            ans = a
print(ans)


Fixed submission:
N = int(input())
a = 0
ans = N-1
s = 0
for x in range(1,1000001):
    s=N//x
    if N%x==0:
        a = (s-1)+(x-1)
        if ans>a:
             ans = a
print(ans)
Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split())
ans = 1
c = a-1
while a < b:
  a += c
  ans += 1
print(ans) 


Fixed submission:
S = input()
T = input()
ans = 0
for i in range(3):
    if T[i] == S[i]:
        ans +=1
print(ans)
Buggy python submission (verdict: Runtime Error):
a,s = int(input()),input()
if a <= 3200:
  print(s)
else
  print('red')


Fixed submission:
a,s = int(input()),input()
if a >= 3200:
  print(s)
else:
  print('red')

Buggy python submission (verdict: Runtime Error):
a,s = int(input()),input()
if a >= 3200:
  print(s)
else
  print('red')

Fixed submission:
a,s = int(input()),input()
if a >= 3200:
  print(s)
else:
  print('red')