Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
def culc(s,c,l,b,x,y):
    if s == l-1:
        return s
    if x+y >b[c]:
        s = c
        c = int((c+l)/2)
        return culc(s,c,l,b,x,y)
    else:
        l = c
        c = int((c+s)/2)
        return culc(s,c,l,b,x,y)
    
    
N = int(input())
b = list(int(i) for i in input().split())
b.sort()
sum_N = 0
for i,x in enumerate(b):
    s = i+1
    for y in range(i+1,N,1):
        c = int((i+N)/2)
        lim_num =culc(s,c,N,b,x,b[y])
        sum_N += lim_num-y
        s=lim_num
print(sum_N)

Fixed submission:
import bisect    
    
N = int(input())
b = list(int(i) for i in input().split())
b.sort()
sum_N = 0
for i,x in enumerate(b):
    s = i+1
    for y in range(i+1,N,1):
        index = bisect.bisect_left(b,x+b[y])
        sum_N += max(0,index - y -1)
print(sum_N)

Buggy python submission (verdict: Time Limit Exceeded):
def culc(s,c,l,b,x,y):
    if s == l-1:
        return s
    if x+y >b[c]:
        s = c
        c = int((c+l)/2)
        return culc(s,c,l,b,x,y)
    else:
        l = c
        c = int((c+s)/2)
        return culc(s,c,l,b,x,y)
N = int(input())
b = list(int(i) for i in input().split())
b.sort()
sum_N = 0
for i,x in enumerate(b):
    for y in range(i+1,N,1):
        c = int((i+N)/2)
        lim_num =culc(i+1,c,N,b,x,b[y])
        sum_N += lim_num-y
print(sum_N)

Fixed submission:
import bisect    
    
N = int(input())
b = list(int(i) for i in input().split())
b.sort()
sum_N = 0
for i,x in enumerate(b):
    s = i+1
    for y in range(i+1,N,1):
        index = bisect.bisect_left(b,x+b[y])
        sum_N += max(0,index - y -1)
print(sum_N)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
b = list(int(i) for i in input().split())
b.sort(reverse=True)
sum_N = 0
for i,x in enumerate(b):
    for y in range(i+1,N,1):
        for z in range(y+1,N,1):
            if x>=b[y]+b[z]:
                break
            else:
                sum_N +=1
print(sum_N)

Fixed submission:
import bisect    
    
N = int(input())
b = list(int(i) for i in input().split())
b.sort()
sum_N = 0
for i,x in enumerate(b):
    s = i+1
    for y in range(i+1,N,1):
        index = bisect.bisect_left(b,x+b[y])
        sum_N += max(0,index - y -1)
print(sum_N)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
b = list(int(i) for i in input().split())
b.sort(reverse=True)
sum_N = 0
for i,x in enumerate(b):
    for y in range(i+1,N,1):
        for z in range(y+1,N,1):
            if x>=b[y]+b[z]:
                break
            else:
                sum_N +=1
print(sum_N)

Fixed submission:
import bisect    
    
N = int(input())
b = list(int(i) for i in input().split())
b.sort()
sum_N = 0
for i,x in enumerate(b):
    s = i+1
    for y in range(i+1,N,1):
        index = bisect.bisect_left(b,x+b[y])
        sum_N += max(0,index - y -1)
print(sum_N)
Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())
A =list(map(int,input().split()))
A.sort(reverse=True)
A_len =len(A)
count =0
for l in range(0,M):
    comp = A[0]/2
    for i in range(0,A_len-1,1):
        if count >= M:
            break
        if A[i+1]<comp:
            break
        while True:
            count +=1
            if A[i]/2 > A[i+1]:
                A[i] = A[i]/2
            else:
                A[i] = A[i]/2
                break
    A.sort(reverse=True)
    if count>=M:
        break
A = [int(i) for i in A]
sumN =sum(A)
print(sumN)


Fixed submission:
S = input()
if S =="Sunny":
    print("Cloudy")
if S =="Rainy":
    print("Sunny")
if S =="Cloudy": 
    print("Rainy")
Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())
A =list(map(int,input().split()))
A.sort(reverse=True)
A_len =len(A)
count =0
for l in range(0,M):
    comp = A[0]/2
    for i in range(0,A_len-1,1):
        if count => M:
            break
        if A[i+1]<comp:
            break
        while True:
            count +=1
            if A[i]/2 > A[i+1]:
                A[i] = A[i]/2
            else:
                A[i] = A[i]/2
                break
    A.sort(reverse=True)
    if count=>M:
        break
A = [int(i) for i in A]
sumN =sum(A)
print(sumN)

Fixed submission:
N,M = map(int,input().split())
A =list(map(int,input().split()))
A.sort(reverse=True)
A_len =len(A)
count =0
if A_len ==1:
    for l in range(0,M):
        A[0]=A[0]/2
else:
    for l in range(0,M):
        comp = A[0]/2
        for i in range(0,A_len-1,1):
            if count >= M:
                break
            if A[i+1]<comp:
                break
            while True:
                count +=1
                if A[i]/2 > A[i+1]:
                    A[i] = A[i]/2
                else:
                    A[i] = A[i]/2
                    break
        A.sort(reverse=True)
        if count>=M:
            break
A = [int(i) for i in A]
sumN =sum(A)
print(sumN)

Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())
A =list(map(int,input().split()))
A.sort(reverse=True)
A_len =len(A)
count =0
for l in range(0,M):
    comp = A[0]/2
    for i in range(0,A_len,1):
        if count => M:
            break
        if A[i+1]<comp:
            break
        while True:
            count +=1
            if A[i]/2 > A[i+1]:
                A[i] = A[i]/2
            else:
                A[i] = A[i]/2
                break
    A.sort(reverse=True)
    if count=>M:
        break
A = [int(i) for i in A]
sumN =sum(A)
print(sumN)

Fixed submission:
N,M = map(int,input().split())
A =list(map(int,input().split()))
A.sort(reverse=True)
A_len =len(A)
count =0
if A_len ==1:
    for l in range(0,M):
        A[0]=A[0]/2
else:
    for l in range(0,M):
        comp = A[0]/2
        for i in range(0,A_len-1,1):
            if count >= M:
                break
            if A[i+1]<comp:
                break
            while True:
                count +=1
                if A[i]/2 > A[i+1]:
                    A[i] = A[i]/2
                else:
                    A[i] = A[i]/2
                    break
        A.sort(reverse=True)
        if count>=M:
            break
A = [int(i) for i in A]
sumN =sum(A)
print(sumN)
Buggy python submission (verdict: Runtime Error):
import itertools
N = int(input())
SK = {"M":0,"A":1,"R":2,"C":3,"H":4}
SD = [0]*5
del_list = []
A = ["M","A","R","C","H"]
for x in range(N):
    tmp = str(input())
    if tmp[0] in A:
        SD[SK[tmp[0]]] +=1
C = 0
for x in range(5)
    if SD[x] == 0 :
        del_list.append(x)
        C +=1
del_list.reverse()
for x in del_list:
    SD.pop(x)
    
if C >2:
    print(0)
else:
    Z = 5-C
    k = itertools.combinations(range(Z), 3)
    ans = 0
    for x in k:
        ans += SD[x[0]]*SD[x[1]]*SD[x[2]]
    print(ans)

Fixed submission:
import itertools
N = int(input())
SK = {"M":0,"A":1,"R":2,"C":3,"H":4}
SD = [0]*5
del_list = []
A = ["M","A","R","C","H"]
for x in range(N):
    tmp = str(input())
    if tmp[0] in A:
        SD[SK[tmp[0]]] +=1
C = 0
for x in range(5):
    if SD[x] == 0 :
        del_list.append(x)
        C +=1
del_list.reverse()
for x in del_list:
    SD.pop(x)
    
if C >2:
    print(0)
else:
    Z = 5-C
    k = itertools.combinations(range(Z), 3)
    ans = 0
    for x in k:
        ans += SD[x[0]]*SD[x[1]]*SD[x[2]]
    print(ans)
Buggy python submission (verdict: Runtime Error):
a, v = [int(i) for i in input().split()]
b, w = [int(i) for i in input().split()]
t = int(input())
if abs(a-b)/abs(v-w) <= t:
  print("YES")
else:
  print("NO")a, v = [int(i) for i in input().split()]
b, w = [int(i) for i in input().split()]
t = int(input())
if (v-w) > 0 and abs(a-b)/abs(v-w) <= t:
  print("YES")
else:
  print("NO")

Fixed submission:
a, v = [int(i) for i in input().split()]
b, w = [int(i) for i in input().split()]
t = int(input())
if (v-w) > 0 and abs(a-b)/abs(v-w) <= t:
  print("YES")
else:
  print("NO")
Buggy python submission (verdict: Time Limit Exceeded):
import sys
n = int(input())
a = [int(i) for i in input().split()]
tmp = 10**18
if 0 in a:
    print(0)
    sys.exit()
else:
    acc = 1
    for i in a:
        acc *= i
    if len(str(i)) + len(str(acc)) < 19:
        pass
    elif acc > tmp:
        print(-1)
        sys.exit()
print(acc)


Fixed submission:
import sys
n = int(input())
a = [int(i) for i in input().split()]
tmp = 10**18
if 0 in a:
    print(0)
    sys.exit()
else:
    acc = 1
    for i in a:
        acc *= i
        if acc > tmp:
            print(-1)
            sys.exit()
print(acc)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
n = int(input())
a = [int(i) for i in input().split()]
if 0 in a:
    print(0)
    sys.exit()
else:
    acc = 1
    for i in a:
        acc *= i
    if acc > 10**18:
        print(-1)
        sys.exit()
print(acc)


Fixed submission:
import sys
n = int(input())
a = [int(i) for i in input().split()]
tmp = 10**18
if 0 in a:
    print(0)
    sys.exit()
else:
    acc = 1
    for i in a:
        acc *= i
        if acc > tmp:
            print(-1)
            sys.exit()
print(acc)
Buggy python submission (verdict: Runtime Error):
import math
k = int(input())
a, b = [int(i) for i in input().split()]

if math.abs(a-b)+1 >= k:
    print("OK")
else:
    print("NG")

Fixed submission:
k = int(input())
a, b = [int(i) for i in input().split()]

flg = False
for i in range(a, b+1):
  if i % k == 0:
    flg = True
    break
if flg:
  print("OK")
else:
  print("NG")
Buggy python submission (verdict: Runtime Error):
A, B = [int(i) for i in input().split()]
if B >= A and 4*(B-A) == A and 5*(B-A) == B:
  print(50(B-A))
else:
  print(-1)
  

Fixed submission:
import math
import sys
A, B = [int(i) for i in input().split()]
for i in range(math.ceil(12.5 * A), math.ceil(12.5 * (A + 1))):
    if math.floor(i//10) == B:
        print(i)
        sys.exit()
print(-1)
Buggy python submission (verdict: Runtime Error):
import math
a, b = map(int, input().split())
print(a * b // math.gcd(a, b))


Fixed submission:
def gcd(x, y):
    while y != 0:
        z = x % y
        x = y
        y = z
    return x
a, b = map(int, input().split())
print(a * b // gcd(a, b))

Buggy python submission (verdict: Runtime Error):
import math
a, b = map(int, input().split())
print(a * b / math.gcd(a, b))

Fixed submission:
def gcd(x, y):
    while y != 0:
        z = x % y
        x = y
        y = z
    return x
a, b = map(int, input().split())
print(a * b // gcd(a, b))
Buggy python submission (verdict: Runtime Error):
6 5
4 7 10 6 5

Fixed submission:
X,N = list(map(int,input().split()))
if N == 0:
    print(X)
else:
    P = list(map(int,input().split()))
    for i in range(100):
        if not X - i in P:
            a = X - i
            break
        if not X + i in P:
            a = X + i
            break
    print(a)

Buggy python submission (verdict: Runtime Error):
X,N = list(map(int,input().split()))
if N == 0:
    print(X)
else:
    P = list(map(int,input().split()))
    A = []
    B = []
    for i in range(101):
        if i not in P and i <= X:
            A.append(i)
        elif i not in P and i > X:
            B.append(i)
    A = sorted(A,reverse=True)
    B = sorted(B)
    a = abs(X - A[0])
    b = (B[0] - X)
    if a <= b:
        print(A[0])
    else:
        print(B[0])

Fixed submission:
X,N = list(map(int,input().split()))
if N == 0:
    print(X)
else:
    P = list(map(int,input().split()))
    for i in range(100):
        if not X - i in P:
            a = X - i
            break
        if not X + i in P:
            a = X + i
            break
    print(a)

Buggy python submission (verdict: Runtime Error):
X,N = list(map(int,input().split()))
if N == 0:
    print(X)
else:
    P = list(map(int,input().split()))
    A = []
    B = []
    for i in range(101):
        if i not in P and i <= X:
            A.append(i)
        elif i not in P and i > X:
            B.append(i)
    A = sorted(A,reverse=True)
    B = sorted(B)
    a = X - A[0]
    b = B[0] - X
    if a <= b:
        print(A[0])
    else:
        print(B[0])

Fixed submission:
X,N = list(map(int,input().split()))
if N == 0:
    print(X)
else:
    P = list(map(int,input().split()))
    for i in range(100):
        if not X - i in P:
            a = X - i
            break
        if not X + i in P:
            a = X + i
            break
    print(a)
Buggy python submission (verdict: Time Limit Exceeded):
L = input().split()
N = int(L[0])
A = int(L[1])
B = int(L[2])
blue = 0
for i in range(N):
    if i % (A + B) >= 0 and i % (A + B) <= (A - 1):
        blue += 1
print(blue)

Fixed submission:
In = input().split()
N = int(In[0])
A = int(In[1])
B = int(In[2])
x = N // (A + B)
y = N - (A + B)*x
ans = x * A
if y <= A:
    ans += y
else:
    ans += A
print(ans)
Buggy python submission (verdict: Runtime Error):
import numpy as np
N=int(input())
A=sorted(list(map(int,input().split())))
# すべてTrueのbool配列dp
dp=np.ones(len(A),dtype=int)
for i in range(N):
	for j in range(i+1,N):
		if dp[j] == 0:
			continue
		if A[j]%A[i]==0:
			dp[j]=0
if A[0]==A[1]:
	dp[0]=0
print(sum(dp))

Fixed submission:
import numpy as np
N=int(input())
A=sorted(list(map(int,input().split())))
Amax=A[-1]+1
B=np.zeros(Amax,dtype=int)
ans=0
#1～Amaxの範囲でjがA[i]の倍数の時,B[j]+=1
for i in A:
	for j in range(i,Amax,i):
		B[j]+=1
#B[i]==1:その数でしか割り切れない→count up
for i in A:
	if B[i]==1:
		ans+=1
print(ans)

Buggy python submission (verdict: Runtime Error):
N=int(input())
A=sorted(list(map(int,input().split())))
cnt=0
a=[A[0]]
for i in range(1,len(A)):
	for val in a:
		if A[i]%val==0:
			break
	else:
		a.append(A[i])
		cnt+=1
if A[0]!=A[1]:
	cnt+=1
print(cnt)

Fixed submission:
import numpy as np
N=int(input())
A=sorted(list(map(int,input().split())))
Amax=A[-1]+1
B=np.zeros(Amax,dtype=int)
ans=0
#1～Amaxの範囲でjがA[i]の倍数の時,B[j]+=1
for i in A:
	for j in range(i,Amax,i):
		B[j]+=1
#B[i]==1:その数でしか割り切れない→count up
for i in A:
	if B[i]==1:
		ans+=1
print(ans)

Buggy python submission (verdict: Runtime Error):
N=int(input())
A=sorted(list(map(int,input().split())),reverse=True)
cnt=0
for i in range(len(A)-1):
	for j in range(i+1,len(A)):
		if A[i]%A[j]==0:
			break
	else:
		cnt+=1
if A[-2]!=A[-1]:
	cnt+=1
print(cnt)

Fixed submission:
import numpy as np
N=int(input())
A=sorted(list(map(int,input().split())))
Amax=A[-1]+1
B=np.zeros(Amax,dtype=int)
ans=0
#1～Amaxの範囲でjがA[i]の倍数の時,B[j]+=1
for i in A:
	for j in range(i,Amax,i):
		B[j]+=1
#B[i]==1:その数でしか割り切れない→count up
for i in A:
	if B[i]==1:
		ans+=1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
INF=10**18
n=int(input())
a=list(map(int,input().split()))
ans=1
for i in range(n):
	ans*=a[i]
if ans>INF:print(-1)
else:print(ans)

Fixed submission:
INF=10**18
n=int(input())
a=sorted(list(map(int,input().split())))
ans=1
for val in a:
	ans*=val
	if val==0:
		print(0)
		exit()
	if ans>INF:
		print(-1)
		exit()
else:
	print(ans)
Buggy python submission (verdict: Runtime Error):
a,b,h,m=map(int, sys.stdin.readline().rstrip().split())
m_angle = m*6
h_angle = h*30+m/2
theta=abs(h_angle-m_angle)
if theta>180:theta=360-theta
c = a**2+b**2-2*a*b*math.cos(math.radians(theta))
print(c**0.5)


Fixed submission:
import sys
import math

a,b,h,m=map(int, sys.stdin.readline().rstrip().split())
m_angle = m*6
h_angle = h*30+m/2
theta=abs(h_angle-m_angle)
if theta>180:theta=360-theta
c = a**2+b**2-2*a*b*math.cos(math.radians(theta))
print(c**0.5)
Buggy python submission (verdict: Runtime Error):
import sys
for i in range(1<<N):	#Bit All Search
	l=[0]*(M+1)
	for j in range(N):
		if((i>>j)&1)==1:
			l=[l[k]+A[j][k] for k in range(M+1)]
	for k in range(M):
		if l[k+1]<X:
			break
	else:
		cost.append(l[0])
cost.sort()
print(-1 if cost==[] else cost[0])

Fixed submission:
import sys
N, M, X=map(int, sys.stdin.readline().rstrip().split())
A = [list(map(int, sys.stdin.readline().rstrip().split())) for i in range(N)]
cost=[]
for i in range(1<<N):	#Bit All Search
	l=[0]*(M+1)
	for j in range(N):
		if((i>>j)&1)==1:
			l=[l[k]+A[j][k] for k in range(M+1)]
	for k in range(M):
		if l[k+1]<X:
			break
	else:
		cost.append(l[0])
cost.sort()
print(-1 if cost==[] else cost[0])
Buggy python submission (verdict: Runtime Error):
import sys

def ILI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def ISI(): return map(int, sys.stdin.readline().rstrip().split())

n, m = ISI()
l=ILI()
if n-sum8(l)<:print(-1)
else:print(n-sum(l))

Fixed submission:
import sys

def ILI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def ISI(): return map(int, sys.stdin.readline().rstrip().split())

n, m = ISI()
l=ILI()
if n-sum(l)<0:print(-1)
else:print(n-sum(l))

Buggy python submission (verdict: Runtime Error):
import sys
def ISI(): return map(int, sys.stdin.readline().rstrip().split())

n, m = ISI()
l=ILI()
print(n-sum(l))

Fixed submission:
import sys

def ILI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def ISI(): return map(int, sys.stdin.readline().rstrip().split())

n, m = ISI()
l=ILI()
if n-sum(l)<0:print(-1)
else:print(n-sum(l))
Buggy python submission (verdict: Time Limit Exceeded):
import math
K=int(input())
ans=0
for i in range(1,K+1):
    for j in range(1,K+1):
        for k in range(1,K+1):
            ans+=math.gcd(math.gcd(i,j),k)
print(ans)

Fixed submission:
import math
K=int(input())
ans=0
for i in range(1,K+1):
    for j in range(1,K+1):
        tmp=math.gcd(i,j)
        for k in range(1,K+1):
            ans+=math.gcd(tmp,k)         
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
def gcd(_a, _b):
	if _b==0:return _a
	return gcd(_b, _a%_b)

def lcm(_a, _b):
	return _a * _b // gcd(_a, _b)

K = int(input())
ans=0
for i in range(K):
	for j in range(K):
		for k in range(K):
			ans+=gcd(gcd(i+1,j+1), k+1)
print(ans)


Fixed submission:
import math
K=int(input())
ans=0
for i in range(1,K+1):
    for j in range(1,K+1):
        tmp=math.gcd(i,j)
        for k in range(1,K+1):
            ans+=math.gcd(tmp,k)         
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
S = [input() for i in range(N)]
S.sort()
max_count=0
ans=[]
for s in S:
	max_count= max(max_count, S.count(s))
for s in set(S):
	if S.count(s)==max_count:
		ans.append(s)
ans.sort()
for a in ans:
	print(a)


Fixed submission:
N=int(input())
dict={}
for i in range(N):
	s = input()
	if s in dict:dict[s]+=1
	else:dict[s]=1
max_count = max(dict.values())
for k,v in sorted(dict.items()):
	if v==max_count:print(k)
Buggy python submission (verdict: Runtime Error):
k, x = ISI()
if 500*k<x:print("No")
else:print("Yes")

Fixed submission:
import sys
def ISI(): return map(int, sys.stdin.readline().rstrip().split())
k, x = ISI()
if 500*k<x:print("No")
else:print("Yes")
Buggy python submission (verdict: Runtime Error):
n = int(input())
s, t = ISS()
S =""
for i in range(n):
	S+=s[i]+t[i]
print(S)


Fixed submission:
import sys

def ISS(): return sys.stdin.readline().rstrip().split()

n = int(input())
s, t = ISS()
S =""
for i in range(n):
	S+=s[i]+t[i]
print(S)
Buggy python submission (verdict: Runtime Error):
import math
A, B=map(int, input().split())
print(A*B//math.gcd(A, B))


Fixed submission:
def gcd(_a, _b):
	if _a%_b==0:return _b
	else:return gcd(_b, _a%_b)

A, B=map(int, input().split())
print(A*B//gcd(A, B))
Buggy python submission (verdict: Time Limit Exceeded):
N, K, Q = map(int, input().split())
players = [K]*N

for i in range(Q):
	A = int(input())
	for j in range(N):
		if A!=j+1:
			players[j]-=1
for p in players:
	if p<1:print("No")
	else:print("Yes")

Fixed submission:
n, k, q = map(int, input().split())
point = [0 for i in range(n)]
for i in range(q):
    point[int(input())-1] -= 1
for i in range(n):
    if q + point[i] < k:
        print("Yes")
    else:
        print("No")

Buggy python submission (verdict: Time Limit Exceeded):
N, K, Q = map(int, input().split())
A = [int(input()) for _ in range(Q)]
players = [K]*N
for i in range(Q):
	for j in range(N):
		if A[i]!=j+1:
			players[j]-=1
for p in players:
	if p<1:print("No")
	else:print("Yes")


Fixed submission:
n, k, q = map(int, input().split())
point = [0 for i in range(n)]
for i in range(q):
    point[int(input())-1] -= 1
for i in range(n):
    if q + point[i] < k:
        print("Yes")
    else:
        print("No")

Buggy python submission (verdict: Time Limit Exceeded):
n, k, q = map(int, input().split())
point = [int(input()) for i in range(q)]
for i in range(1, n+1):
    if q - point.count(i) < k:
        print("Yes")
    else:
        print("No")

Fixed submission:
n, k, q = map(int, input().split())
point = [0 for i in range(n)]
for i in range(q):
    point[int(input())-1] -= 1
for i in range(n):
    if q + point[i] < k:
        print("Yes")
    else:
        print("No")

Buggy python submission (verdict: Time Limit Exceeded):
n, k, q = map(int, input().split())
point = []
for i in range(q):
    point.append(int(input()))

for i in range(1, n+1):
    if q - point.count(i) < k:
        print("Yes")
    else:
        print("No")

Fixed submission:
n, k, q = map(int, input().split())
point = [0 for i in range(n)]
for i in range(q):
    point[int(input())-1] -= 1
for i in range(n):
    if q + point[i] < k:
        print("Yes")
    else:
        print("No")
Buggy python submission (verdict: Time Limit Exceeded):
#インポート
import sys

#入力用
def ILI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def ISI(): return map(int, sys.stdin.readline().rstrip().split())
def II(): return int(sys.stdin.readline().rstrip())
def ISS(): return sys.stdin.readline().rstrip().split()
def IS(): return sys.stdin.readline().rstrip()

N = II()
A = [i for i in range(1, N+1)]
sum = sum(A)
print(sum-N)

Fixed submission:
#インポート
import sys
 
#入力用
def ILI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def ISI(): return map(int, sys.stdin.readline().rstrip().split())
def II(): return int(sys.stdin.readline().rstrip())
def ISS(): return sys.stdin.readline().rstrip().split()
def IS(): return sys.stdin.readline().rstrip()
 
N = II()
sum = N*(1+N)//2
print(sum-N)

Buggy python submission (verdict: Time Limit Exceeded):
#インポート
import sys

#入力用
def ILI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def ISI(): return map(int, sys.stdin.readline().rstrip().split())
def II(): return int(sys.stdin.readline().rstrip())
def ISS(): return sys.stdin.readline().rstrip().split()
def IS(): return sys.stdin.readline().rstrip()

N = II()
sum = 0
for i in range(1, N+1):
    sum += i
print(sum-N)

Fixed submission:
#インポート
import sys
 
#入力用
def ILI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def ISI(): return map(int, sys.stdin.readline().rstrip().split())
def II(): return int(sys.stdin.readline().rstrip())
def ISS(): return sys.stdin.readline().rstrip().split()
def IS(): return sys.stdin.readline().rstrip()
 
N = II()
sum = N*(1+N)//2
print(sum-N)

Buggy python submission (verdict: Time Limit Exceeded):
#インポート
import sys

#入力用
def ILI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def ISI(): return map(int, sys.stdin.readline().rstrip().split())
def II(): return int(sys.stdin.readline().rstrip())
def ISS(): return sys.stdin.readline().rstrip().split()
def IS(): return sys.stdin.readline().rstrip()

N = II()
A = [i for i in range(1,N+1)]
B = [0 for i in range(N-1)]
for i in range(N-1):
    B[i] = A[i+1]
B.append(A[0])
sum = 0
for i in range(N):
    sum += (i+1)%B[i]
print(sum)

Fixed submission:
#インポート
import sys
 
#入力用
def ILI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def ISI(): return map(int, sys.stdin.readline().rstrip().split())
def II(): return int(sys.stdin.readline().rstrip())
def ISS(): return sys.stdin.readline().rstrip().split()
def IS(): return sys.stdin.readline().rstrip()
 
N = II()
sum = N*(1+N)//2
print(sum-N)
Buggy python submission (verdict: Runtime Error):
k, x = map(int, f.readline().split())
min = x - k + 1
max = x + k - 1
txt = str(min)
for i in range(max - min):
    txt = txt + " " + str(min+1)
    min += 1
print(txt)

Fixed submission:
k, x = map(int, input().split())
min = x - k + 1
max = x + k - 1
txt = str(min)
for i in range(max - min):
    txt = txt + " " + str(min+1)
    min += 1
print(txt)