Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    N = int(input())
    A = [int(i) for i in input().split()]
    
#    print(A)
    result = 0
    s = [A[0]]
    for i in range(1, N):
        s.append(s[i - 1] + A[i])
#    print(s)
    
    for i in range(N):
        if(s[i] == 0):
            result += 1
        for j in range(i):
#            print(s[i] - s[j])
            if((s[i] - s[j]) == 0):
                result += 1
                
#    for nc_len in range(1, N + 1):
#        for i in range(N - nc_len + 1):
##            print(A[i : i + nc_len])
#            if(sum(A[i : i + nc_len]) == 0):
#                result += 1
    
    print(result)
    
if __name__=="__main__":
    main()

Fixed submission:
def main():
    N = int(input())
    A = [int(i) for i in input().split()]
    
    result = 0
    s = [0]
    for i in range(N):
        s.append(s[-1] + A[i])
        
    s.sort()
#    print(s)
    
    count = 1
    for i in range(N):
        if(s[i] == s[i+1]):
            count += 1
        else:
            result += count * (count -1 ) // 2
            count = 1
    result += count * (count -1 ) // 2
    print(result)
    
if __name__=="__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    N = int(input())
    A = [int(i) for i in input().split()]
    
#    print(A)
    result = 0
    for nc_len in range(1, N + 1):
        for i in range(N - nc_len + 1):
#            print(A[i : i + nc_len])
            if(sum(A[i : i + nc_len]) == 0):
                result += 1
    
    print(result)
    
if __name__=="__main__":
    main()

Fixed submission:
def main():
    N = int(input())
    A = [int(i) for i in input().split()]
    
    result = 0
    s = [0]
    for i in range(N):
        s.append(s[-1] + A[i])
        
    s.sort()
#    print(s)
    
    count = 1
    for i in range(N):
        if(s[i] == s[i+1]):
            count += 1
        else:
            result += count * (count -1 ) // 2
            count = 1
    result += count * (count -1 ) // 2
    print(result)
    
if __name__=="__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    N = int(input())
    X = [int(i) for i in input().split()]
    
    sorted_X = sorted(X)
    median_1 = sorted_X[int(N/2)-1]
    median_2 = sorted_X[int(N/2)]
    
    for i in range(N):
        remove_num = X[i]
        if(sorted_X.index(remove_num) > (N/2 - 1)):
            print(median_1)
        else:
            print(median_2)
    
if __name__=="__main__":
    main()

Fixed submission:
def main():
    N = int(input())
    X = [int(i) for i in input().split()]
    
    sorted_X = sorted(X)
    median_1 = sorted_X[int(N/2)-1]
    median_2 = sorted_X[int(N/2)]
    
    for i in range(N):
        remove_num = X[i]
        if(remove_num > median_1):
            print(median_1)
        else:
            print(median_2)
    
if __name__=="__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    N = int(input())
    X = [int(i) for i in input().split()]
    
    sorted_X = sorted(X)
    for i in range(N):
        remove_sorted_X = sorted_X[:]
        remove_num = X[i]
        
        remove_sorted_X.remove(remove_num)
        print(remove_sorted_X[int((N-1)/2)])
    
if __name__=="__main__":
    main()

Fixed submission:
def main():
    N = int(input())
    X = [int(i) for i in input().split()]
    
    sorted_X = sorted(X)
    median_1 = sorted_X[int(N/2)-1]
    median_2 = sorted_X[int(N/2)]
    
    for i in range(N):
        remove_num = X[i]
        if(remove_num > median_1):
            print(median_1)
        else:
            print(median_2)
    
if __name__=="__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    N = int(input())
    X = [int(i) for i in input().split()]
    
    for i in range(N):
        remove_X = X[:i]+ X[i+1:]
        
        sorted_remove_X = sorted(remove_X)
        print(sorted_remove_X[int((N-1)/2)])
    
if __name__=="__main__":
    main()

Fixed submission:
def main():
    N = int(input())
    X = [int(i) for i in input().split()]
    
    sorted_X = sorted(X)
    median_1 = sorted_X[int(N/2)-1]
    median_2 = sorted_X[int(N/2)]
    
    for i in range(N):
        remove_num = X[i]
        if(remove_num > median_1):
            print(median_1)
        else:
            print(median_2)
    
if __name__=="__main__":
    main()
Buggy python submission (verdict: Runtime Error):
def main():
    n = int(input())
    a = [int(i) for i in input().split()]
    
    max_num = max(a)
    dif = 99999.
    for num in a:
        if(num != max_num and dif > abs((max_num/2) - num)):
            dif = abs((max_num/2) - num)
            ansnum = num
            
    print("{} {}".format(max_num, ansnum))
        
if __name__=="__main__":
    main()

Fixed submission:
def main():
    n = int(input())
    a = [int(i) for i in input().split()]
    
    max_num = max(a)
    dif = 10**10
    ansnum = 0
    for num in a:
        if(num != max_num and dif > abs((max_num/2) - num)):
            dif = abs((max_num/2) - num)
            ansnum = num
            
    print("{} {}".format(max_num, ansnum))
        
if __name__=="__main__":
    main()

Buggy python submission (verdict: Runtime Error):
def main():
    n = int(input())
    a = [int(i) for i in input().split()]
    
    max_num = max(a)
    dif = 99999
    for num in a:
        if(num != max_num and dif > abs((max_num/2) - num)):
            dif = abs((max_num/2) - num)
            ansnum = num
            
    print("{} {}".format(max_num, ansnum))
        
if __name__=="__main__":
    main()

Fixed submission:
def main():
    n = int(input())
    a = [int(i) for i in input().split()]
    
    max_num = max(a)
    dif = 10**10
    ansnum = 0
    for num in a:
        if(num != max_num and dif > abs((max_num/2) - num)):
            dif = abs((max_num/2) - num)
            ansnum = num
            
    print("{} {}".format(max_num, ansnum))
        
if __name__=="__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    a, b, c, d, e, f = [int(i) for i in input().split()]
    #print(a, b, c, d, e, f)
    
    L_UNIT = 100
    result_sw, result_s = 0, 0
    ans = -10000.

    water_list = []
    sugar_list = []

    for t_a in range( int( f / (a * L_UNIT) ) + 1 ):
        #print("a")
        for t_b in range( int( f / (b * L_UNIT) ) + 1 ):
            #print("b")
            #sugar_lim = e * (a * t_a + b * t_b)
            water_list.append(a * t_a * L_UNIT + b * t_b * L_UNIT)
            
    for t_c in range( int( f / c ) + 1 ):
        #print("c")
        for t_d in range( int( f / d ) + 1 ):
            #print("d")
            sugar_list.append( c * t_c + d * t_d )
            
    for water in water_list:
        for sugar in sugar_list:
            sugar_lim = e * (water / L_UNIT)
            if( sugar <= sugar_lim  and 0 < (water + sugar) and (water + sugar) <= f):
                noudo = 100 * sugar / (water + sugar)
                #print(noudo)
                if(ans < noudo):
                    ans = noudo
                    result_sw = sugar + water
                    result_s = sugar
    #print(ans)                    
    print( "{} {}".format(result_sw, result_s) )
    
if __name__=="__main__":
    main()

Fixed submission:
def main():
    a, b, c, d, e, f = [int(i) for i in input().split()]
    #print(a, b, c, d, e, f)
    
    L_UNIT = 100
    result_sw, result_s = 0, 0
    ans = -10000.

    water_list = []
    sugar_list = []

    for t_a in range( int( f / (a * L_UNIT) ) + 1 ):
        #print("a")
        for t_b in range( int( f / (b * L_UNIT) ) + 1 ):
            #print("b")
            #sugar_lim = e * (a * t_a + b * t_b)
            if( (a * t_a * L_UNIT + b * t_b * L_UNIT) <= f ):
                water_list.append(a * t_a * L_UNIT + b * t_b * L_UNIT)
            
    for t_c in range( int( f / c ) + 1 ):
        #print("c")
        for t_d in range( int( f / d ) + 1 ):
            #print("d")
            if( (c * t_c + d * t_d) <= f):
                sugar_list.append( c * t_c + d * t_d )
            
    for water in water_list:
        for sugar in sugar_list:
            sugar_lim = e * (water / L_UNIT)
            if( sugar <= sugar_lim  and 0 < (water + sugar) and (water + sugar) <= f):
                noudo = 100 * sugar / (water + sugar)
                #print(noudo)
                if(ans < noudo):
                    ans = noudo
                    result_sw = sugar + water
                    result_s = sugar
    #print(ans)                    
    print( "{} {}".format(result_sw, result_s) )
    
if __name__=="__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    N = int(input())
    a = [int(i) for i in input().split()]
    area = 0
    u_len = []

    #sort_a = sorted(set(a), reverse=True)
    #print(sort_a)
    max_num = max(a)
    for num in range(max_num, 0, -1):
        #print(num)
        c_num = a.count(num)
        if(c_num >= 4):
            area = num**2
            break
        elif(c_num >= 2):
            u_len.append(num)
            if(len(u_len) >= 2):
                area = u_len[0] * u_len[1]
                break
    
    print(area)
    
if __name__=="__main__":
    main()

Fixed submission:
def main():
    N = int(input())
    a = [int(i) for i in input().split()]
    area = 0
    
    b = 0
    tmp = 0

    sort_a = sorted(a, reverse=True)
    for num in sort_a:
        if(num == tmp):
            if(b > 0):
                area = num * b
                break
            else:
                b = num
                tmp = 0
        else:
            tmp = num
    
    print(area)
    
if __name__=="__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque

if(__name__ == "__main__"):
    N = int(input())
    a = [int(i) for i in input().split()]
    #print(a,b)
    
    #print(maxlist)
    sunuke = a[:1]
    arai = a[1:]
    darai = deque(arai)
    #print(sunuke)
    #print(darai)
    distmin = abs(sum(sunuke) - sum(darai))
    
    for i in range(1,N-1):
        sunuke.append(a[i])
        darai.popleft()
        #print(sunuke)
        #print(darai)
        dist = abs(sum(sunuke) - sum(darai))
        if(distmin > dist):
            distmin = dist
    
    print(distmin)

Fixed submission:
if(__name__ == "__main__"):
    N = int(input())
    a = [int(i) for i in input().split()]
    #print(a,b)
    
    #print(maxlist)
    sumsunuke = a[0]
    arai = a[1:]
    sumarai = sum(arai)
    #darai = deque(arai)
    #print(sumsunuke)
    #print(sumarai)
    distmin = abs(sumsunuke - sumarai)
    
    for i in range(1,N-1):
        sumsunuke += a[i]
        sumarai -= a[i]
        #print(sunuke)
        #print(darai)
        dist = abs(sumsunuke - sumarai)
        if(distmin > dist):
            distmin = dist
    
    print(distmin)
Buggy python submission (verdict: Time Limit Exceeded):
if(__name__ =="__main__"):
    N = int(input())
    a =[int(i) for i in input().split()]
    b = []
    for i in range(N):
        if(i % 2 == (N-1) % 2):
            b.insert(0,a[i])
        else:
            b.append(a[i])
        #print(b)
        # b = b[::-1] TLE:O(N)    
        #print(b)
    #b.extend(a)
    print(' '.join(map(str,b)))

Fixed submission:
if(__name__ =="__main__"):
    N = int(input())
    a =[int(i) for i in input().split()]
    b = []
    for i in range(N-1,-1,-2):
        b.append(a.pop(i))
        #print(b)
        # b = b[::-1] TLE:O(N)    
        #print(b)
    b.extend(a)
    print(' '.join(map(str,b)))

Buggy python submission (verdict: Time Limit Exceeded):
if(__name__ =="__main__"):
    N = int(input())
    a =[int(i) for i in input().split()]
    b = []
    for i in range(N):
        b.append(a[i])
        #print(b)
        b = b[::-1]
        #print(b)
    print(' '.join(map(str,b)))

Fixed submission:
if(__name__ =="__main__"):
    N = int(input())
    a =[int(i) for i in input().split()]
    b = []
    for i in range(N-1,-1,-2):
        b.append(a.pop(i))
        #print(b)
        # b = b[::-1] TLE:O(N)    
        #print(b)
    b.extend(a)
    print(' '.join(map(str,b)))
Buggy python submission (verdict: Runtime Error):
import numpy as np
N=int(input())
def gcd(N,2):
  c=int(np.floor(N%2))
  return N-2*c
if gcd(N,2)==0:
  print(N)
else:
  print(2*N)

Fixed submission:
import numpy as np
N=int(input())
def gcd(a,b):
    c=int(np.floor(a/b))
    return a-b*c
if gcd(N,2)==0:
    print(N)
else:
    print(2*N)
Buggy python submission (verdict: Runtime Error):
N=int(input())
a=[0]*N
for i in range(N):
    a[i]=int(input())
print(a)   
a_max=max(a)
a_min=min(a)
print(a_max-a_min)

Fixed submission:
N=int(input())
a=list(map(int,input().split())) 
a_max=max(a)
a_min=min(a)
print(a_max-a_min)

Buggy python submission (verdict: Runtime Error):
N=int(input())
a_list=map(int,input().split())
    
a_max=max(a_list)
a_min=min(a_list)
print(a_max-a_min)
    

Fixed submission:
N=int(input())
a=list(map(int,input().split())) 
a_max=max(a)
a_min=min(a)
print(a_max-a_min)

Buggy python submission (verdict: Runtime Error):
N=int(input())
a_list=[int(input()) for i in range(N)]
print(a_list)
    
a_max=max(a_list)
a_min=min(a_list)
print(a_max-a_min)
    

Fixed submission:
N=int(input())
a=list(map(int,input().split())) 
a_max=max(a)
a_min=min(a)
print(a_max-a_min)

Buggy python submission (verdict: Runtime Error):
N=int(input())
a_list=[]
for i in range(N):
    a_list.append(int(input()))
    
a_max=max(a_list)
a_min=min(a_list)
print(a_max-a_min)
    

Fixed submission:
N=int(input())
a=list(map(int,input().split())) 
a_max=max(a)
a_min=min(a)
print(a_max-a_min)
Buggy python submission (verdict: Runtime Error):
N=int(input())
S=str(input())
for i in range(len(S)-1):
    if S[i]==S[i+1]:
        idx=i        
idx=idx+1
sub_X=S[:idx]
sub_Y=S[idx:]
count=0
for str1 in sub_X:
    for str2 in sub_Y:
        if str1==str2:
            count+=1
            
print(int(count/2))

Fixed submission:
A,B=map(int,input().split())
print(max(A-B,A+B,A*B))
Buggy python submission (verdict: Runtime Error):
N=int(input())
S=str(input())
for i in range(len(S)-1):
    if S[i]==S[i+1]:
        idx=i        
idx=idx+1
sub_X=S[:idx]
sub_Y=S[idx:]
import collections
count_list_X=list(collections.Counter(sub_X).keys())
count_list_Y=list(collections.Counter(sub_Y).keys())
max_count=0
count=0
for str1 in count_list_X:
    for str2 in count_list_Y:
        if str1==str2:
            count+=1
if count>max_count:
    max_count=count
print(max_count)

Fixed submission:
N=int(input())
S=list(input())
a=[]

for i in range(1,N):
    x=set(S[:i-1:])
    y=set(S[i-1::])
    a.append(len(list(x&y)))
    
print(max(a))

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

for i in range(len(S)-1):
    if S[i]==S[i+1]:
        idx=i        
idx=idx+1
sub_X=S[:idx]
sub_Y=S[idx:]
count=0
for str1 in sub_X:
    for str2 in sub_Y:
        if str1==str2:
            count+=1
            
print(int(count/2))

Fixed submission:
N=int(input())
S=list(input())
a=[]

for i in range(1,N):
    x=set(S[:i-1:])
    y=set(S[i-1::])
    a.append(len(list(x&y)))
    
print(max(a))

Buggy python submission (verdict: Runtime Error):
for i in range(len(S)-1):
    if S[i]==S[i+1]:
        idx=i        
idx=idx+1
sub_X=S[:idx]
sub_Y=S[idx:]
count=0
for str1 in sub_X:
    for str2 in sub_Y:
        if str1==str2:
            count+=1
            
print(int(count/2))

Fixed submission:
N=int(input())
S=list(input())
a=[]

for i in range(1,N):
    x=set(S[:i-1:])
    y=set(S[i-1::])
    a.append(len(list(x&y)))
    
print(max(a))

Buggy python submission (verdict: Runtime Error):
N=int(input())
S=str(input())
idx_list=[]
for idx in range(len(S)-1):
    if S[idx]==S[idx+1]:
        idx_list.append(idx)

idx=max(idx_list)+1
sub_X=S[:idx]
sub_Y=S[idx:]

import collections
count_list_X=list(collections.Counter(sub_X).keys())
count_list_Y=list(collections.Counter(sub_Y).keys())


count=0
for str1 in count_list_X:
    for str2 in count_list_Y:
        if str1==str2:
            count+=1
            
print(count)

Fixed submission:
N=int(input())
S=list(input())
a=[]

for i in range(1,N):
    x=set(S[:i-1:])
    y=set(S[i-1::])
    a.append(len(list(x&y)))
    
print(max(a))
Buggy python submission (verdict: Runtime Error):
N=int(input())
L=[str(i) for i in [11,31,41,61,71,101,131,151,181,191,211,241,251,271,281,311,331,401,421,431,461,491,521,541,571,601,631,641,661,691,701,751,761,811,821,
  881,911,941,991,1021,1031,1051,1061,1091,1151,1171,1181,1201,1231,1291,1301,1321,1361,1381,1451]]

print('',join(L[:N]))

Fixed submission:
N=int(input())
L=[str(i) for i in [11,31,41,61,71,101,131,151,181,191,211,241,251,271,281,311,331,401,421,431,461,491,521,541,571,601,631,641,661,691,701,751,761,811,821,
  881,911,941,991,1021,1031,1051,1061,1091,1151,1171,1181,1201,1231,1291,1301,1321,1361,1381,1451]]

print(" ".join(L[:N]))

Buggy python submission (verdict: Runtime Error):
N=int(input())
L=[11,31,41,61,71,101,131,151,181,191,211,241,251,271,281,311,331,401,421,431,461,491,521,541,571,601,631,641,661,691,701,751,761,811,821,
  881,911,941,991,1021,1031,1051,1061,1091,1151,1171,1181,1201,1231,1291,1301,1321,1361,1381,1451]

print(''.join(L[:N])）

Fixed submission:
N=int(input())
L=[str(i) for i in [11,31,41,61,71,101,131,151,181,191,211,241,251,271,281,311,331,401,421,431,461,491,521,541,571,601,631,641,661,691,701,751,761,811,821,
  881,911,941,991,1021,1031,1051,1061,1091,1151,1171,1181,1201,1231,1291,1301,1321,1361,1381,1451]]

print(" ".join(L[:N]))
Buggy python submission (verdict: Runtime Error):
N,X=map(int,input().split())
m=[int(input()) for i in range(N)]
res=X-sum(m)
num=N
while res>min(m):
    c=math.floor(res/min(m))
    num+=c
    res=res-c*min(m)
print(num)


Fixed submission:
import math
N,X=map(int,input().split())
m=[int(input()) for i in range(N)]
res=X-sum(m)
num=N
while res>min(m):
    c=math.floor(res/min(m))
    num+=c
    res=res-c*min(m)
print(num)

Buggy python submission (verdict: Runtime Error):
N,X=map(int,input().split())
res=X-sum(m)
num=N
while res>min(m):
    c=math.floor(res/min(m))
    num+=c
    res=res-c*min(m)
print(num)
m=[int(input()) for i in range(N)]

Fixed submission:
import math
N,X=map(int,input().split())
m=[int(input()) for i in range(N)]
res=X-sum(m)
num=N
while res>min(m):
    c=math.floor(res/min(m))
    num+=c
    res=res-c*min(m)
print(num)

Buggy python submission (verdict: Runtime Error):
N,X=map(int,input().split())
m=[]
for i in range(N):
    m.append(int(input()))

res=X-sum(m)
num=N
while res>min(m):
    c=math.floor(res/min(m))
    num+=c
    res=res-c*min(m)
print(num)


Fixed submission:
import math
N,X=map(int,input().split())
m=[int(input()) for i in range(N)]
res=X-sum(m)
num=N
while res>min(m):
    c=math.floor(res/min(m))
    num+=c
    res=res-c*min(m)
print(num)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
X=list(map(int,input().split()))
for i in range(N):
    X_list=X[:i]+X[i+1:]
    X_list.sort()
    print(X_list[int(N/2-1)])

Fixed submission:
N=int(input())
X=list(map(int,input().split()))
Y=X.copy()
Y.sort()
for i in range(N):
    if X[i]<Y[int(N/2)]:
        print(Y[int(N/2)])
    else:
        print(Y[int(N/2)-1])

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
X=list(map(int,input().split()))
for i in range(N):
    idx=i+1
    X_list=X[:idx-1]+X[idx:]
    X_list.sort()
    print(X_list[int(N/2-1)])

Fixed submission:
N=int(input())
X=list(map(int,input().split()))
Y=X.copy()
Y.sort()
for i in range(N):
    if X[i]<Y[int(N/2)]:
        print(Y[int(N/2)])
    else:
        print(Y[int(N/2)-1])
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
import math
b=a.copy()
b=sorted(b,reverse=True)
comb_n=max(b)
b.pop(0)
c=b
def comb(n,r):
    return math.factorial(n)//((math.factorial(r))*(math.factorial(n-r)))
        
comb_list=[]
ind_list=[]
for i in c:
    comb_list.append(comb(comb_n,i))
    ind_list.append(i)
max_num=max(comb_list)
for i in range(len(comb_list)):
    if comb_list[i]==max_num:
        print(comb_n,ind_list[i])

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
a=sorted(a,reverse=True)
comb_n=a[0]
a=a[1:]
r_ind=int(comb_n/2)

ans=0
for i in range(len(a)-1):
     if abs(a[i]-r_ind)<=abs(a[i+1]-r_ind):
          ans=a[i]
          break
print(comb_n,ans)

Buggy python submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
b=a.copy()
b=sorted(b,reverse=True)
comb_n=max(b)
b.pop(0)
c=b
comb_list=[]
ind_list=[]
for i in c:
    comb_list.append(comb(comb_n,i))
    ind_list.append(i)
max_num=max(comb_list)
for i in range(len(comb_list)):
    if comb_list[i]==max_num:
        print(comb_n,ind_list[i])

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
a=sorted(a,reverse=True)
comb_n=a[0]
a=a[1:]
r_ind=int(comb_n/2)

ans=0
for i in range(len(a)-1):
     if abs(a[i]-r_ind)<=abs(a[i+1]-r_ind):
          ans=a[i]
          break
print(comb_n,ans)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
import math
comb_list=[]
ind_list=[]
def comb(n,r):
    return math.factorial(n)//((math.factorial(r))*(math.factorial(n-r)))
        
for idx in range(n):
    for jdx in range(idx+1,n):
        if a[idx]>a[jdx]:
            comb_list.append(comb(a[idx],a[jdx]))
            ind_list.append([a[idx],a[jdx]])
        else:
            comb_list.append(comb(a[jdx],a[idx]))
            ind_list.append([a[jdx],a[idx]])

max_num=max(comb_list)
for i in range(len(comb_list)):
    if comb_list[i]==max_num:
        ans=ind_list[i]
        
print(ans[0],ans[1])

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
a=sorted(a,reverse=True)
comb_n=a[0]
a=a[1:]
r_ind=int(comb_n/2)

ans=0
for i in range(len(a)-1):
     if abs(a[i]-r_ind)<=abs(a[i+1]-r_ind):
          ans=a[i]
          break
print(comb_n,ans)
Buggy python submission (verdict: Runtime Error):
Q=int(input())
score=[map(int,input().split()) for _ in range(Q)]
import math
for i in range(Q):
    max_num=int(math.sqrt(score[i][0]*score[i][1]))
    if score[i][0]*score[i][1]==max_num:
        print(2*max_num-3)
    elif score[i][0]*score[i][1]>max_num*(max_num+1):
        print(2*max_num-1)
    elif score[i][0]==score[i][1]:
        print(2*max_num-2)
    else:
        print(2*max_num-2)


Fixed submission:
Q=int(input())
score=[list(map(int,input().split())) for _ in range(Q)]
import math
for i in range(Q):
    max_num=int(math.sqrt(score[i][0]*score[i][1]))

    if score[i][0]==score[i][1]:
        print(2*max_num-2)
    elif score[i][0]*score[i][1]==max_num**2:
        print(2*max_num-3)
    elif score[i][0]*score[i][1]>max_num*(max_num+1):
        print(2*max_num-1)
    else:
        print(2*max_num-2)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
a=list(map(int,input().split()))
a.append(0)
cost=0
for idx in range(N):
    b=a.copy()
    b.pop(idx)
    cost=0
    for i in range(len(b)):
        if i==0:
            cost+=abs(b[i])
        else:
            cost+=abs(b[i-1]-b[i])
    print(cost)

Fixed submission:
N=int(input())
a=list(map(int,input().split()))
a.insert(0,0)
a.append(0)
cost=[]
for i in range(N+1):
    if i==0:
        cost.append(abs(a[i]))
    else:
        cost.append(abs(a[i-1]-a[i]))
cost.append(abs(a[N]))
S=sum(cost)
for i in range(N):
    print(S-cost[i+1]-cost[i+2]+abs(a[i+2]-a[i]))
Buggy python submission (verdict: Runtime Error):
# http://interaction.hatenadiary.jp/entry/2018/03/25/124153
N = input()

sumN = sum(list(map(int,list(N))))

# print(N)
# print(sumN)
if int(N) % sumN == 0:
    print('Yes')
else:
    print('No')


Fixed submission:
num = 0
S = input()
S_list = list(S)
for i, S_list in enumerate(list(S)):
    if S_list == '+':
        num = num + 1
    else:
        num = num - 1
print(num)