Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
s=input()
ans=0
for x in range(1,len(s)+1):
	for left in range(s-x+1):
		z=s[left:left+x]
		flag=True
		for i in range(x):
			if z[i]!="A" and z[i]!="G" and z[i]!="C" and z[i]!="T":
				flag=False
				break
		if flag==True:
			ans+=1
			break
print(ans)

Fixed submission:
s=input()
ans=0
for x in range(1,len(s)+1):
	for left in range(len(s)-x+1):
		z=s[left:left+x]
		flag=True
		for i in range(x):
			if z[i]!="A" and z[i]!="G" and z[i]!="C" and z[i]!="T":
				flag=False
				break
		if flag==True:
			ans+=1
			break
print(ans)

Buggy python submission (verdict: Runtime Error):
s=input()
ans=0
for x in range(1,len(s)+1):
	for left in range(s-x+1):
		z=s[left:left+x]
		flag=True
		for i in range(x):
			if z[i]!="A" and z[i]!="G" and z[i]!="C" and z[i]!="T":
				flag=False
				break
		if flag:
			ans+=1
			break
print(ans)

Fixed submission:
s=input()
ans=0
for x in range(1,len(s)+1):
	for left in range(len(s)-x+1):
		z=s[left:left+x]
		flag=True
		for i in range(x):
			if z[i]!="A" and z[i]!="G" and z[i]!="C" and z[i]!="T":
				flag=False
				break
		if flag==True:
			ans+=1
			break
print(ans)

Buggy python submission (verdict: Runtime Error):
s=input()
ans=0
for length in range(1,len(s)+1):
	for left in range(s-length+1):
		z=s[left:left+length]
		flag=True
		for i in range (length):
			if z[i]!="A" and z[i]!="G" and z[i]!="C" and z[i]!="T":
				flag=False
				break
		if flag:
			ans+=1
			break
print(ans)
				
				
				
		
		
	


Fixed submission:
s=input()
ans=0
for x in range(1,len(s)+1):
	for left in range(len(s)-x+1):
		z=s[left:left+x]
		flag=True
		for i in range(x):
			if z[i]!="A" and z[i]!="G" and z[i]!="C" and z[i]!="T":
				flag=False
				break
		if flag==True:
			ans+=1
			break
print(ans)

Buggy python submission (verdict: Runtime Error):
s=input()
ans=0
for length in range(1,len(s)+1):
	for left in range(s-length+1):
		z=s[left:left+length]
		flag=True
		for i in range (length):
			if z[i]!="A" and z[i]!="G" and z[i]!="C" and z[i]!="T":
				flag=False
				break
		if flag:
			ans+=1
			break
print(ans)
				
				
				
		
		
	


Fixed submission:
s=input()
ans=0
for x in range(1,len(s)+1):
	for left in range(len(s)-x+1):
		z=s[left:left+x]
		flag=True
		for i in range(x):
			if z[i]!="A" and z[i]!="G" and z[i]!="C" and z[i]!="T":
				flag=False
				break
		if flag==True:
			ans+=1
			break
print(ans)
Buggy python submission (verdict: Runtime Error):
N=int(input())
l=list(map(int,input().split()))
if max(l)<sum(l)-max(l):
	print("Yes")
else:
	print("No")

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

Buggy python submission (verdict: Runtime Error):
N=int(input())
l=list(map(int,input().split()))
if max(l)<sum(l)-max(l):
	print("Yes")
else:
	print("NO")

Fixed submission:
T,X=map(int,input().split())
print(T/X)
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
n=b-a
print(n*(n+1)//2-b)



	
	

Fixed submission:
n=int(input())
if 0<n<1000:
	print("ABC")
else:
	print("ABD")
Buggy python submission (verdict: Runtime Error):
n=int(input())
s=list(input().split())
if "Y" in s:
	print("Four")
else:
	print("Three")

Fixed submission:
n=int(input())
print(n//3)
Buggy python submission (verdict: Runtime Error):
x,a,b=map(int,input().split())
if b>a and b-a<x:
	print("safe")
elif b=a and b-a=x:
	print("delicious")
elif b<a and a-b<x:
	print("delicious")
else:
	print("dangerous")
	


Fixed submission:
x,a,b=map(int,input().split())
if b>a and b-a<=x:
	print("safe")
elif b<=a and a-b<=x:
	print("delicious")
else:
	print("dangerous")

Buggy python submission (verdict: Runtime Error):
x,a,b=map(int,input().split())
if b>a and b-a<x:
	print("safe")
elif b=a and b-a=X:
	print("delicious")
elif b<a and a-b<x:
	print("delicious")
else:
	print("dangerous")
	


Fixed submission:
x,a,b=map(int,input().split())
if b>a and b-a<=x:
	print("safe")
elif b<=a and a-b<=x:
	print("delicious")
else:
	print("dangerous")

Buggy python submission (verdict: Runtime Error):
x,a,b=map(int,input().split())
if b>a and b-a<x:
	print("safe")
elif b=a and b-a=X
	print("delicious")
elif b<a and a-b<x:
	print("delicious")
else:
	print("dangerous")
	


Fixed submission:
x,a,b=map(int,input().split())
if b>a and b-a<=x:
	print("safe")
elif b<=a and a-b<=x:
	print("delicious")
else:
	print("dangerous")
Buggy python submission (verdict: Runtime Error):
a,b,c=input()
komoji=a[0]+b[0]+c[0]
print(komoji.upper())

Fixed submission:
a,b,c=input().split()
komoji=a[0]+b[0]+c[0]
print(komoji.upper())
Buggy python submission (verdict: Runtime Error):
n = input()

a = int(n / 2)
b = n % 2

c = a + b

print(c)


Fixed submission:
n = int(input())

a = int(n / 2)
b = n % 2

c = a + b

print(c/n)

Buggy python submission (verdict: Runtime Error):
n = input()

a = n / 2
b = n % 2

c = a + b

print(c)

Fixed submission:
n = int(input())

a = int(n / 2)
b = n % 2

c = a + b

print(c/n)
Buggy python submission (verdict: Runtime Error):
import numpy as np

n = int(input())
records= np.array([int(i) for i in input().split()])

enrolled = np.argsort(records)

attendance_num = [i+1 for i in range(len(records))]

attendance_order = attendance_num[enrolled]

print(attendance_order)

Fixed submission:
import numpy as np

n = int(input())
records= np.array([int(i) for i in input().split()])

enrolled = np.argsort(records)

attendance_list = np.array([i+1 for i in range(n)])

attendance_order = np.array(attendance_list[enrolled]).tolist()

for i in attendance_order:
  print('{} '.format(i), end="")
print()

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

n = int(input())
records= np.array([int(i) for i in input().split()])

enrolled = np.argsort(a)

attendance_num = [i+1 for i in range(len(a))]

attendance_order = attendance_num[enrolled]

print(attendance_order)

Fixed submission:
import numpy as np

n = int(input())
records= np.array([int(i) for i in input().split()])

enrolled = np.argsort(records)

attendance_list = np.array([i+1 for i in range(n)])

attendance_order = np.array(attendance_list[enrolled]).tolist()

for i in attendance_order:
  print('{} '.format(i), end="")
print()

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

n, k=[int(i) for i in input().split()]
records= np.array([int(i) for i in input().split()])

enrolled = np.argsort(a)

attendance_num = [i+1 for i in range(len(a))]

attendance_order = attendance_num[enrolled]

print(attendance_order)

Fixed submission:
import numpy as np

n = int(input())
records= np.array([int(i) for i in input().split()])

enrolled = np.argsort(records)

attendance_list = np.array([i+1 for i in range(n)])

attendance_order = np.array(attendance_list[enrolled]).tolist()

for i in attendance_order:
  print('{} '.format(i), end="")
print()

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [ int(i) for i in input().split()]
b = []

for i in range(1,n+1):
    j = a.index(i)
    b.append(str(j+1))

print(" ".join(b))

Fixed submission:
n = int(input())
a = [ int(i) for i in input().split()]
b = [""] * n

for i, ai in enumerate(a):
    b[ai-1] = str(i+1)

print(" ".join(b))
Buggy python submission (verdict: Runtime Error):
n = int(input())
if n > 1:
    ans = n*(n-1)/2
else:
    ans = 0
print(ans)

Fixed submission:
s = input()
t = input()
c = 0
for i in range(3):
    if s[i] == t[i]:
        c+=1
print(c)
Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**7)
 
N,Q = (int(i) for i in input().split())
hen = {}
value = [0] * N

for _ in range(0,N-1):
    a,b = (int(i) for i in input().split())
    if a in hen:
        hen[a].append(b)
    else:
        hen[a] = [b]

for _ in range(0,Q):
    p,x = (int(i) for i in input().split())
    value[p-1] = value[p-1] + x

def add(p,x):
        for node in hen[p]:
            value[node-1] = value[node-1] + x
            if node in hen:
                add(node,value[node-1])

#add(1,value[0])
for i in range(0,n):
    if i+1 in hen:
        for node in hen[i+1]:
            value[node-1] += value[i]

print(' '.join(map(str,value)))
    


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

Buggy python submission (verdict: Runtime Error):

N,Q = (int(i) for i in input().split())
hen = {}
value = [0] * N
flag = [0] * N
for i in range(0,N-1):
    a,b = (int(i) for i in input().split())
    if a in hen:
        hen[a].append(b)
    else:
        hen[a] = [b]
#print(hen)

def add(p,x):
    if p in hen:
        for i in hen[p]:
            value[i-1] = value[i-1] + x
            add(i,value[i-1])

for i in range(0,Q):
    p,x = (int(i) for i in input().split())
    value[p-1] = value[p-1] + x


add(1,value[0])
print(' '.join(map(str,value)))
    


Fixed submission:
a = int(input())
s=input()
if a < 3200:
    print('red')
else:
    print(s)
Buggy python submission (verdict: Time Limit Exceeded):
#n = (int(i) for i in input().split())  
n=int(input())
prime = [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101]
num=[1] * n
count = 0
for i in range(0,n):
    S = input()
    for s in S:
        num[i] = num[i] * prime[ord(s)-ord('a')]
    for j in range(0,i):
        if num[i] == num[j]:
            count = count + 1
print(count)    

Fixed submission:
import collections
#n = (int(i) for i in input().split())  
n=int(input())
prime = [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101]
num=[1] * n
count = 0
for i in range(0,n):
    S = input()
    for s in S:
        num[i] = num[i] * prime[ord(s)-97]
#    for j in range(0,i):
#        if num[i] == num[j]:
#            count = count + 1
c = collections.Counter(num)
for v in c.values():
    if v > 1:
        count = count + v*(v-1)/2
#print(c)
print(int(count))
Buggy python submission (verdict: Runtime Error):
def main():
    N, Q = input().split()
    N = int(N)
    Q = int(Q)
    G = [1] * N
    S = input()
    for _ in range(Q):
        t, d = input().split()
        if d == "L":
            # for i in range(0,N):
            for i in range(0,Q):
                if S[i] == t and G[i] > 0:
                    if i == 0:
                        G[i] = 0
                    else:
                        G[i-1] = G[i-1] + G[i]
                        G[i] = 0

        else: # "R"
            # for i in range(N-1,-1,-1):
            for i in range(N-1,N-Q-1,-1):
                if S[i] == t and G[i] > 0:
                    if i == N-1:
                        G[i] = 0
                    else:
                        G[i+1] = G[i+1] + G[i]
                        G[i] = 0
        #print(G)
    print(sum(G))

if __name__ == '__main__':
    main()


Fixed submission:
import sys

def main():
	A,B,C = input().split()

	if A == B and B == C:
  		print("Yes")
	else:
  		print("No")

if __name__ == '__main__':
	main()

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

def main():
    args = sys.argv
    if args[1] == args[2] and args[2] == args[3]:
        print("Yes")
	else:
        print("No")

if __name__ == '__main__':
    main()


Fixed submission:
import sys

def main():
	A,B,C = input().split()

	if A == B and B == C:
  		print("Yes")
	else:
  		print("No")

if __name__ == '__main__':
	main()

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

def main():
	args = sys.argv

	if args[1] == args[2] and args[2] == args[3]:
  		print("Yes")
	else:
  		print("No")

if __name__ == '__main__':
	main()

Fixed submission:
import sys

def main():
	A,B,C = input().split()

	if A == B and B == C:
  		print("Yes")
	else:
  		print("No")

if __name__ == '__main__':
	main()

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

args = sys.argv

if args[1] == args[2] and args[2] == args[3]:
  print("Yes")
else:
  print("No")


Fixed submission:
import sys

def main():
	A,B,C = input().split()

	if A == B and B == C:
  		print("Yes")
	else:
  		print("No")

if __name__ == '__main__':
	main()

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

args = sys.argv

if args[1] == args[2] and args[2] == args[3]:
  print("Yes")
else:
  print("No")

Fixed submission:
import sys

def main():
	A,B,C = input().split()

	if A == B and B == C:
  		print("Yes")
	else:
  		print("No")

if __name__ == '__main__':
	main()
Buggy python submission (verdict: Runtime Error):
def main():
  N = int(input())
  S = input()
  R = 0
  B = 0
  for i in range(0,N):
    if S[i] == "R":
      R = R + 1
    else:
      B = B + 1
	if R > N/2:
      print("Yes")
      return
    elif B > N/2:
      print("No")
      return
    
if __name__ == '__main__':
  main()


Fixed submission:
def main():
    N = int(input())
    S = input()
    R = 0
    B = 0
    for i in range(0,N):
        if S[i] == "R":
            R = R + 1
        else:
            B = B + 1
        if R > N/2:
            print("Yes")
            return
        elif B > N/2:
            print("No")
            return
    print("No")
    
if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
def main():
  N = int(input())
  S = input()
  R = 0
  B = 0
  for i in range(0,N):
    if S[i] == "R":
      R = R + 1
    else:
      B = B + 1
	if R > N/2:
      print("Yes")
      return
    elif B > N/2:
      print("No")
      return
    
if __name__ == '__main__':
  main()


Fixed submission:
def main():
    N = int(input())
    S = input()
    R = 0
    B = 0
    for i in range(0,N):
        if S[i] == "R":
            R = R + 1
        else:
            B = B + 1
        if R > N/2:
            print("Yes")
            return
        elif B > N/2:
            print("No")
            return
    print("No")
    
if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
def main():
  N = int(input())
  S = input()
  R = 0
  B = 0
  for i in range(0,N):
    if S[i] == "R":
      R = R + 1
    else:
      B = B + 1
	if R > N/2:
      print("Yes")
      return
    elif B > N/2:
      print("No")
      return
    
if __name__ == '__main__':
  main()


Fixed submission:
def main():
    N = int(input())
    S = input()
    R = 0
    B = 0
    for i in range(0,N):
        if S[i] == "R":
            R = R + 1
        else:
            B = B + 1
        if R > N/2:
            print("Yes")
            return
        elif B > N/2:
            print("No")
            return
    print("No")
    
if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
def main():
  N = int(input())
  S = input()
  R = 0
  B = 0
  for i in range(0,N):
    if S[i] == "R":
      R = R + 1
    else:
      B = B + 1
	if R > N/2:
      print("Yes")
      return
    elif B > N/2:
      print("No")
      return
      
  
if __name__ == '__main__':
  main()

Fixed submission:
def main():
    N = int(input())
    S = input()
    R = 0
    B = 0
    for i in range(0,N):
        if S[i] == "R":
            R = R + 1
        else:
            B = B + 1
        if R > N/2:
            print("Yes")
            return
        elif B > N/2:
            print("No")
            return
    print("No")
    
if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
b = sum(map(int,input().split()))
c = kist(map(int,input().split()))
for i in range(n-1):
  if a[i+1] == a[i] + 1:
    b += a[i+1]
print(b)
  

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
b=sum(map(int,input().split()))
c=list(map(int,input().split()))
for i in range(n-1):
    if a[i]+1==a[i+1]:
        b+=c[a[i]-1]
print(b)
Buggy python submission (verdict: Runtime Error):
N = int(input())
for i in range(N):
  t,x,y = map(int,input().split())
  if (x + y) > t or (x + y + t)%2 != 0:
    print("No")
    exit()
print("Yes")

Fixed submission:
numbers = input().split()
a = int(numbers[0])
b = int(numbers[1])
if (a*b)%2==0:
  print("Even")
else:
  print("Odd")

Buggy python submission (verdict: Runtime Error):
N = int(input())
for i in range(N):
  t,x,y = map(int,input().split())
  if (x + y) > t or (x + y + t)%2 != 0:
    print("No")
    exit()
print("Yes")

Fixed submission:
numbers = input().split()
a = int(numbers[0])
b = int(numbers[1])
if (a*b)%2==0:
  print("Even")
else:
  print("Odd")
Buggy python submission (verdict: Runtime Error):
N = int(input())
for i in range(N):
  t,x,y = map(int,input().split())
  if (x + y) > t or (x + y + t)%2 != 0:
    print("No")
    exit()
print("Yes"

Fixed submission:
N = int(input())
for i in range(N):
  t,x,y = map(int,input().split())
  if (x + y) > t or (x + y + t)%2 != 0:
    print("No")
    exit()
print("Yes")
Buggy python submission (verdict: Runtime Error):
for i in S[::2]:
  if i == "L":
    A = False   
for x in S[1::2]:
  if x == "R":
    A = False

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

Fixed submission:
S = input()

lst = []

for ( i , j ) in enumerate(S) :
  if i % 2 == 1:
    if j not in ["L","U","D"]:      
      print("No")
      exit()
  else:
    if j not in ["R","U","D"]:      
      print("No")
      exit()
print("Yes")
Buggy python submission (verdict: Runtime Error):
A,B = map(int,input().split())

if A >= B:
  print(1)
  
else:
 
  for i in list(range(1,21)):
    if (A-1) * i + A >= B:
      print(i+1)
      break
      

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

sat = 0
for a,b in zip(A,A[1:]):
  if b == a+1:
    sat += C[a-1]
    
print( sum(B) + sat )
Buggy python submission (verdict: Runtime Error):
    A,B = map(int,input().split())
     
    if A >= B:
      print(1)
      
    else:
     
      for i in range(1,21):
        if ((A-1) * i + A ) >=  B:
          print(i+1)
          break

Fixed submission:
A,B = map(int,input().split())
 
if B == 1:
  print(0)
  
elif A >= B:
  print(1)
  
else:
 
  for i in range(1,21):
    if (A-1) * i + A >= B:
      print(i+1)
      break
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
As = list(map(int, input().split()))

for i in range(N):
  print(As.index(i+1) + 1, end = " ")

Fixed submission:
import numpy as np

N = int(input())
As = list(map(int, input().split()))

# for i in range(N):
#   print(As.index(i+1) + 1, end = " ")

for item in np.argsort(As):
  print(item+1, end=" ")
Buggy python submission (verdict: Time Limit Exceeded):
import fractions

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

# 公約数の中の素数の数を考えれば良いのではないか？

n = fractions.gcd(A, B)

data = [i + 1 for i in range(1, n)]
ans = []

while data != []:
  p = data[0]
  if A % p == 0 and B % p == 0:
    ans.append(p)
  data = [e for e in data if e % p != 0]

ans.insert(0, 1)

print(len(ans))


Fixed submission:
import fractions

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

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a
  
a = set(prime_factorize(A))
b = set(prime_factorize(B))
c = a & b

print(len(c) + 1)
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
As = list(map(int, input().split()))

for i in range(M):
  tmp = max(As)
  As.remove(tmp)
  tmp = tmp // 2
  As.append(tmp)
  
print(sum(As))


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

As = list(map(lambda x : -1 * int(x), input().split()))

heapq.heapify(As)

for i in range(M):
  tmp = heapq.heappop(As)
  tmp = (-1 * tmp) // 2 * (-1) 
  heapq.heappush(As, tmp)
  
print(-1 * sum(As))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()

# len 取り得る最大の長さは N / 2

for i in range(N//2, 0, -1):
  for j in range(0, N-2*i+1):
    left = S[j:j+i]
    if left in S[j+i:]:
        print(len(left))
        exit()
        
print(0)

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


r = 0
ans = 0
for l in range(N):

    while True:
        # print(S.rfind(S[l:r+1]), S[l:r+1], l, r)
        
        if S.rfind(S[l:r+1]) >= r+1:
            r += 1
            ans = max(ans, r-l)
        else:
            break

print(ans)

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

# len 取り得る最大の長さは N / 2

for i in range(N//2, 0, -1):
  for j in range(0, N-2*i+1):
    left = S[j:j+i]
    if S[j+i:].count(left) >= 1:
        print(len(left))
        exit()
        
print(0)

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


r = 0
ans = 0
for l in range(N):

    while True:
        # print(S.rfind(S[l:r+1]), S[l:r+1], l, r)
        
        if S.rfind(S[l:r+1]) >= r+1:
            r += 1
            ans = max(ans, r-l)
        else:
            break

print(ans)

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

# len 取り得る最大の長さは N / 2

for i in range(N//2, 0, -1):
  for j in range(0, N-2*i+1):
    left = S[j:j+i]
    for k in range(j+i, N-i+1):
      right = S[k:k+i]
      
      # print(i, j, k)
      # print("left : ", left)
      # print("right: ", right)
      
      if left == right:
        print(len(left))
        exit()
        
print(0)

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


r = 0
ans = 0
for l in range(N):

    while True:
        # print(S.rfind(S[l:r+1]), S[l:r+1], l, r)
        
        if S.rfind(S[l:r+1]) >= r+1:
            r += 1
            ans = max(ans, r-l)
        else:
            break

print(ans)

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

# len 取り得る最大の長さは N / 2

for i in range(N//2, 0, -1):
  for j in range(0, N-2*i+1):
    left = S[j:j+i]
    for k in range(j+i, N-i+1):
      right = S[k:k+i]
      
      # print(i, j, k)
      # print("left : ", left)
      # print("right: ", right)
      
      if left == right:
        print(len(left))
        exit()
        
print(0)

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


r = 0
ans = 0
for l in range(N):

    while True:
        # print(S.rfind(S[l:r+1]), S[l:r+1], l, r)
        
        if S.rfind(S[l:r+1]) >= r+1:
            r += 1
            ans = max(ans, r-l)
        else:
            break

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

# {1, 2, ..., N}
# {P1, P2, ..., Pn}　として {2, 3, ..., N, 1} を選べる

count = 0
for i in range(N):
  count += i
  
print(count)

Fixed submission:
N = int(input())

# {1, 2, ..., N}
# {P1, P2, ..., Pn}　として {2, 3, ..., N, 1} を選べる

print((N-1) * N // 2)

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

# {1, 2, ..., N}
# {P1, P2, ..., Pn}　として {2, 3, ..., N, 1} を選べる

count = 0
for i in range(N):
  count += i
  
print(count)

Fixed submission:
N = int(input())

# {1, 2, ..., N}
# {P1, P2, ..., Pn}　として {2, 3, ..., N, 1} を選べる

print((N-1) * N // 2)

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

# {1, 2, ..., N}
# {P1, P2, ..., Pn}　として {2, 3, ..., N, 1} を選べる

print(sum([i for i in range(N)]))
  



Fixed submission:
N = int(input())

# {1, 2, ..., N}
# {P1, P2, ..., Pn}　として {2, 3, ..., N, 1} を選べる

print((N-1) * N // 2)