Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
a=int(input()) # N
b=input().split(" ") # A
c=int(input()) # Q

final=[]
for i in range(c):
    t=0 # total
    d=input().split(" ")
    for i in range(len(b)):
        if int(d[0]) == int(b[i]): # replace
            b[i]=d[1]
        t+=int(b[i]) #sum
    final.append(t)
for j in range(c): # print result
    print (final[j])

Fixed submission:
# collect input N integers
# replace every element whose value is Bi with Ci
# get input x and y and compute them to display output 
from collections import Counter
n=input()
a=list(map(int,input().split()))
b=Counter(a)
n=int(input())
ans=sum(a)
for i in range(n):
    x,y=map(int,input().split())
    ans+=b[x]*(y-x)
    print(ans)
    b[y]+=b[x]
    b[x]=0
Buggy python submission (verdict: Runtime Error):
x, *y = map(int, input().split())
C= 2
T= 4
ans="No"
for i in range(x+1):
    b=x-i
    if Ci + Tb == y:
        answer = "Yes"
print(answer)

Fixed submission:
X,Y = map(int,input().split()) #input number of animals and legs

crane_legs = 2
turtle_legs = 4

answer = "No"

for i in range(X+1): #X+1 because it will only consider 0,1,2
    remaining = X-i
    if crane_legs*i + turtle_legs*remaining == Y:
        answer = "Yes"
#Loop to check combinations of animals is correct

print(answer)

Buggy python submission (verdict: Runtime Error):
#define number of animals and legs
#function for the question can be understood as x=crane+turtles and y=2cranes+4turtles
def equation(numLeg, numAnim):
    for numCrane in range(0, numAnim):
        numTurt=numAnim-numCrane
        totalLeg=4*numTurt+2*numCrane
        if totalLeg==numLeg:
            return[numTurt,numCrane]
    return[None,None]
#input x and y
if __name__ == '__main__':
    x,y=int(input()).split()
    cranes,turtles=equation(y,x)
    if turtles==0:
        print("No")
    else:
        print("Yes")


Fixed submission:
X,Y = map(int,input().split()) #input number of animals and legs

crane_legs = 2
turtle_legs = 4

answer = "No"

for i in range(X+1): #X+1 because it will only consider 0,1,2
    remaining = X-i
    if crane_legs*i + turtle_legs*remaining == Y:
        answer = "Yes"
#Loop to check combinations of animals is correct

print(answer)
Buggy python submission (verdict: Runtime Error):
#input an interget
K=int(input())
#input an string
S=str(input())
#get the length of the string
x=int(len(str1))
#get the difference in length between k and s
i=x-k

#make a second string for the appending
S2="..."

#if statement about how the string will function
#if the string is the same length as k then print it
if i==0:
    print(S)
#if not, delete the last character of the string
else:
    while i>0:
        S=S[i]
        i+=1
#and then join the two strings together
    newstr="".join((S,S2))
    print(newstr)


Fixed submission:
num=int(input()) #ask integer for limitation
s=input() #ask string
if len(s) > num:    #check if the length s exceeded num
    print(s[:num] + "...")  #print s with the limit "num"
else:   #if the string not exceeded num
    print(s)

Buggy python submission (verdict: Runtime Error):

while True:
     k = input()
     if 1 <= int(k) <= 100:
         break;
     print ('Error Invalid Input for K')


while True:
     s = input().lower()
     if 1 <= len(s) <= 100:
         break;
     print ('Error Invalid Input for s')


if len(s) > k:
    print(s[:k] + "...")
else:
    print(s)

Fixed submission:
num=int(input()) #ask integer for limitation
s=input() #ask string
if len(s) > num:    #check if the length s exceeded num
    print(s[:num] + "...")  #print s with the limit "num"
else:   #if the string not exceeded num
    print(s)

Buggy python submission (verdict: Runtime Error):
def convert(S): 
  
    
    str1 = ""  # initialization of string to "" 
    return(str1.join(S))    # using join function join the list s by  
                            # separating words by str1


K = int(input())    # take K from user
readtext= str(input())  # take the input string 

S = list(readtext)   #split the string into charactrers and put them to list
list1=[]  #list 1 

for i in range (0 , K): # for looop to append the charachters to the new list
   
    list1.append(S[i]) # appending the charachters to the list
if len(S) > K:  # condition when number of charachters is big than K
    b = "..."
    list1.append(b) # append the 3 dots 

print(convert(list1)) # convert the list of characters back to the string format

Fixed submission:
num=int(input()) #ask integer for limitation
s=input() #ask string
if len(s) > num:    #check if the length s exceeded num
    print(s[:num] + "...")  #print s with the limit "num"
else:   #if the string not exceeded num
    print(s)
Buggy python submission (verdict: Runtime Error):
K = int(input())
A = int(input())
B = int(input())
i = A
while A <= i <= B :
    if str(K) in str(i) :
        print("OK")
        break
    i = i + 1
else :
    print("NG")

Fixed submission:
from sys import stdin, stdout
import math
import bisect
import queue

k = int(stdin.readline().strip())
a, b = map(int, stdin.readline().strip().split())

flag = 0

for i in range(a, b + 1):
    if i % k == 0:
        flag = 1
        break

stdout.writelines('OK\n' if flag == 1 else 'NG\n')
Buggy python submission (verdict: Runtime Error):
x=input()
p=2*3.14*x
A="dlfnsdfjsdjfsdfjsdfnksdkjnfjksndfkjnskjfkjsdkjfnskjdfknsdkjfskdnfkjsdn"
print(p)

Fixed submission:
pi = 3.141592653589793
r = float(input())
ans = pi*r*2
print(ans)
Buggy python submission (verdict: Runtime Error):
# In peace, in love, in war, everything is the same

import math

deg = [0] * 100005
n=int(input())
ar = list(map(int, input().split()))

for i in range(n-1):
    deg[ar[i]] = deg[ar[i]] + 1

for i in range(1, n+1, 1):
    print(deg[i])

Fixed submission:
# In peace, in love, in war, everything is the same

import math

deg = [0] * 200005
n=int(input())
ar = list(map(int, input().split()))

for i in range(n-1):
    deg[ar[i]] = deg[ar[i]] + 1

for i in range(1, n+1, 1):
    print(deg[i])

Buggy python submission (verdict: Time Limit Exceeded):
a=int(input())
b=list(map(int,input().split()))
c=[]
for q in range(a):
    c.append(0)
x=int(1)
j=max(b)
while x<=j:
    for xx in b:
        if xx==x:
            c[x-1]=c[x-1]+1
    x=x+1
for t in range(a):
    print(c[t])

Fixed submission:
# In peace, in love, in war, everything is the same

import math

deg = [0] * 200005
n=int(input())
ar = list(map(int, input().split()))

for i in range(n-1):
    deg[ar[i]] = deg[ar[i]] + 1

for i in range(1, n+1, 1):
    print(deg[i])
Buggy python submission (verdict: Runtime Error):
N = int(input())
nn = N
K = int(input())
n = 1
st = []
m = min(N, K)
while N >= abs(nn - n * m) :
    N = abs(N - K)
    n = n + 1
print(min(m, N))

Fixed submission:
a = list(map(int,input().split()))
n,k = a
ans = 0
if n > k:
    ans = n % k
    if k - ans < ans:
        ans = k - ans
else:
    ans = k - n
    if ans > n:
        ans = n
print (ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())
nn = N
K = int(input())
n = 1
st = []
m = min(N, K)
while N >= abs(nn - n * m) :
    N = abs(N - K)
    n = n + 1
    st.append(N)
    a = min(st)
print(min(m, a))


Fixed submission:
a = list(map(int,input().split()))
n,k = a
ans = 0
if n > k:
    ans = n % k
    if k - ans < ans:
        ans = k - ans
else:
    ans = k - n
    if ans > n:
        ans = n
print (ans)
Buggy python submission (verdict: Runtime Error):
r,c = int(input().split())
ans = r*c/2
if(r%2==0 and c%2==0):
    print(ans)
else
    print(ans+1) 

Fixed submission:
import math
h,w = map(int,input().split())
if h==1 or w==1:
  print(1)
else:
  nos = math.ceil(w/2)*math.ceil(h/2) + math.floor(w/2)*math.floor(h/2)
  print(nos)
Buggy python submission (verdict: Time Limit Exceeded):
x=input().split(" ")
n=int(x[0])
a=int(x[1])
b=int(x[2])
t=0
i=0
while t<=n:
    if t+a>n:
        i+=n-t
        break
    i+=a
    t+=a
    t+=b
print(i)


Fixed submission:
def count_balls(n, a, b):
    if(a==0): return 0
    if(n<a): return n
    end = n % (a+b)
    if(end > a):
        return a*(n//(a+b))+a
    else:
        return a*(n//(a+b))+end
n,a,b=map(int, input().strip().split())
print(count_balls(n,a,b))

Buggy python submission (verdict: Runtime Error):
n=input()
i=0
a=input()
b=input()
c=0
while True:
    for j in range(a):
        if i >= n:break
        i+=1
        c+=1
    for j in range(b):
        i+=1
    if i > n:break
print(c)


Fixed submission:
def count_balls(n, a, b):
    if(a==0): return 0
    if(n<a): return n
    end = n % (a+b)
    if(end > a):
        return a*(n//(a+b))+a
    else:
        return a*(n//(a+b))+end
n,a,b=map(int, input().strip().split())
print(count_balls(n,a,b))

Buggy python submission (verdict: Runtime Error):
s = input()
s = s.split(" ")
n = int(s[0])
b = int(s[1])
a = int(s[2])

num = (n //(a+b))*b +(n%(a+b))%a
print(num)

Fixed submission:
def count_balls(n, a, b):
    if(a==0): return 0
    if(n<a): return n
    end = n % (a+b)
    if(end > a):
        return a*(n//(a+b))+a
    else:
        return a*(n//(a+b))+end
n,a,b=map(int, input().strip().split())
print(count_balls(n,a,b))
Buggy python submission (verdict: Time Limit Exceeded):
S = input()
Q = int(input())
for i in range(Q) :
    Query = input()
    q = Query.split(" ")
    if int(q[0]) == 1 :
        S = S[::-1]
    else:
        if int(q[1]) == 1 :
            S = str(q[2])+ S
        else:
            S = S + str(q[2])
print(S)

Fixed submission:
s = input()
n = int(input())
stat = 1
head = []
tail = []
for i in range(n):
    q = input().split()
    if len(q) == 1:
        stat = stat *(-1)
    else:
        if q[1] == "1":
            if stat == 1:
                head.append(q[2])
            else:
                tail.append(q[2])
        else:
            if stat == 1:
                tail.append(q[2])
            else:
                head.append(q[2])

if stat == 1:
    print("".join(head[::-1])+s+"".join(tail))
else:
    print("".join(tail[::-1])+s[::-1]+"".join(head))
Buggy python submission (verdict: Runtime Error):
N = int(input())
R = int(input())
if 0 <= R <= 4111:
    if 1<= N < 10:
        K = 100 * (10 - N)
        M = R + K
        print(M)
    if 10 <= N <= 100:
        print(R)


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

print (r if n >= 10 else r + 100 * (10 - n))
Buggy python submission (verdict: Runtime Error):
import math
number = int(input())
base = int(input())
converted=0
reminder=0
i=0
counter=0
while number!=0:
    reminder=number%base
    number=number//base
    converted=converted+reminder*10**i
    i+=1


#To convert integer into string
y=str(converted)
print(len(y))

Fixed submission:
import math

n, k = map(int, input().split())
print(math.floor(math.log(n, k) + 1))
Buggy python submission (verdict: Runtime Error):
c=str(input("please enter a string"))
list=list(c)
index=0
for x in list:
      list[index]='x'
      index+=1
s=''.join(list)
print(s)

Fixed submission:
s = input ()
# what stupid problem this is
print ('x' * len (s))
Buggy python submission (verdict: Runtime Error):
health = int(input())
decrease = int(input())
attack = 0
while health > 0:
    health = health - decrease
    attack += 1
print(attack)

Fixed submission:
h, a = map(int, input().split())
print((h+a-1) // a)
Buggy python submission (verdict: Runtime Error):
N=int(input("enter 1st number:"))
M=int(input("enter 2nd number:"))
if N==M:
    print("Yes\n")
else:
    print("No\n")

Fixed submission:
from sys import stdin

def main():
	N,M = map(int,stdin.readline().split())
	if(N == M):
		print("Yes")
	else:
		print("No")
main()
Buggy python submission (verdict: Time Limit Exceeded):
N, M = list(map(int, input().split()))
readline = []
ACs = []
ans1 = 0
ans2 = 0

for i in range (M):
    readline.append(input().split())
    x = readline[i][0]

    if (readline[i][1] == 'AC' and ACs.count(x) == 0):
        ACs.append(x)
        ans1 += 1
        for j in range (i):
            if (readline[j][0] == x):
                ans2 += 1

print(str(ans1) + ' ' + str(ans2))

Fixed submission:
from sys import stdin
n,m = map(int,stdin.readline().split())
prob = dict()
AC,WA = 0,0
for _ in range(m):
	p,s = stdin.readline().split()
	p = int(p)
	if p in prob:
		if s == "AC":
			if prob[p] > 0:
				AC += 1
				WA += prob[p]
				prob[p] = 0
		else:
			if prob[p] > 0: prob[p] += 1
	else:
		if s == "AC":
			prob[p] = 0
			AC += 1
		else:
			prob[p] = 1
print(AC,WA)
Buggy python submission (verdict: Runtime Error):
def stringcc(W,F):
    a = W
    b = F
    c = a+b
    return c

W,F= input().split()
a = stringcc(FW)
print(a)

Fixed submission:

a, b = input().split()

print(b,end='')
print(a,end='')

Buggy python submission (verdict: Runtime Error):
def stringconcant(S,T):
    x = S
    b = T
    c = x+b
    return c

S,T= input().split()
x = stringconcant(T,S)
print(a)

Fixed submission:

a, b = input().split()

print(b,end='')
print(a,end='')
Buggy python submission (verdict: Runtime Error):
inp = input().split()

input().split() == "" == ["", "",""]

A = int(inp[0])
B = int(inp[1])
C = int(inp[2])

if A + B + C >= 22:
	print("bust")
else:
	print("win")

Fixed submission:
a,b,c = map(int,input().split())
x = a+b+c
if x >= 22:
    print("bust")
    
else:
    print("win")
Buggy python submission (verdict: Runtime Error):
given = input()
a = int(given) // 2
count = 0
for i in range(1, a + 1):
    last = given[-i]
    first = given[i - 1]
    if last != first:
        count += 1
print(count)

Fixed submission:
s = input()
l = list(s)
i = 0
j = len(l)-1
cnt = 0
while(i < j):
    if l[i] != l[j]:
        cnt = cnt+1

    i = i+1
    j = j-1

print(cnt)

Buggy python submission (verdict: Runtime Error):
given = input()
a = given // 2
count = 0
for i in range(1, a + 1):
    last = given[-i]
    first = given[i - 1]
    if last != first:
        count += 1
print(count)

Fixed submission:
s = input()
l = list(s)
i = 0
j = len(l)-1
cnt = 0
while(i < j):
    if l[i] != l[j]:
        cnt = cnt+1

    i = i+1
    j = j-1

print(cnt)
Buggy python submission (verdict: Runtime Error):
n=int(input())
arr = map(int,input().split())
k=0
if n%2==1:
	k1=0
	k2=0
	for i in range(n//2):
		k1=k1+arr[i]-arr[n-i-1]
	print(abs(abs(k1)-arr[n//2]))
else:
	for i in range(n//2):
		k=k+arr[i]-arr[n-1-i]
	print(abs(k))

Fixed submission:
N=input()
b=input().split()
sum=0
bigsum=0
for i in b:
    sum+=eval(i)
standard=sum/2
for i in b:
    bigsum+=eval(i)
    if bigsum>standard:
        smallsum=bigsum-eval(i)
        break
if bigsum-standard>standard-smallsum:
    print(sum-2*smallsum)
else:
    print(2*bigsum-sum)
Buggy python submission (verdict: Runtime Error):
s = raw_input()
a,b = s.split('/')
a,b = int(a),int(b)

def mul(a,b):
    if a <= 9 and a >=1 and (1 <= b <= 9):
        return a * b
    else:
        return -1

print mul(a,b)

Fixed submission:
def main(a, b):
    if a>9:
        return -1
    if b>9:
        return -1
        
    return a*b

inp = input().split();
a = int(inp[0])
b = int(inp[1])
print(main(a,b))

Buggy python submission (verdict: Runtime Error):

A = int(input())
B = int(input())

C=A*B
if A <= 9 and B <= 9:
	print(C)
else:
	print(-1)

Fixed submission:
def main(a, b):
    if a>9:
        return -1
    if b>9:
        return -1
        
    return a*b

inp = input().split();
a = int(inp[0])
b = int(inp[1])
print(main(a,b))

Buggy python submission (verdict: Runtime Error):
A=variable
B=variable_2
A=9
B=9
if A*B=81;
	print("81")
else;
	print("-1")

Fixed submission:
def main(a, b):
    if a>9:
        return -1
    if b>9:
        return -1
        
    return a*b

inp = input().split();
a = int(inp[0])
b = int(inp[1])
print(main(a,b))

Buggy python submission (verdict: Runtime Error):
a=variable
b=variable_2
a=9
b=9
if a*b=81 then;
	print("81")
else;
	print("-1")

Fixed submission:
def main(a, b):
    if a>9:
        return -1
    if b>9:
        return -1
        
    return a*b

inp = input().split();
a = int(inp[0])
b = int(inp[1])
print(main(a,b))
Buggy python submission (verdict: Runtime Error):
def main(n,s):
    if n == 1:
        return 1
        
    count = 1
    for i in range(1,n):
        if s[i] != s[i-1]:
            print(s[i] + s[i-1])
            count += 1
    return count

inp = input().split("\n")
n = int(inp[0])
s = inp[1]


print(main(n,s))

Fixed submission:
length = input()
string = input()

color = 1
prev = string[0]
modified = string[0]


for c in string :
    if c == prev :
        continue
    else :
        prev = c
        color = color + 1
        modified = modified + c

print(color)

Buggy python submission (verdict: Runtime Error):
def main(n,s):
    if n == 1:
        return 1
        
    count = 1
    for i in range(1,n):
        if s[i] != s[i-1]:
            count += 1
    return count

inp = input().split("\n")
n = int(inp[0])
s = inp[1]


print(main(n,s))

Fixed submission:
length = input()
string = input()

color = 1
prev = string[0]
modified = string[0]


for c in string :
    if c == prev :
        continue
    else :
        prev = c
        color = color + 1
        modified = modified + c

print(color)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
l1=[int(x) for x in input().split()]
l2=[]
for i in range(1,len(l1)+1):
    l2.append(l1.index(i)+1)
for i in l2:
    print(i,end=' ')

Fixed submission:
n = int(input())
a = input().split(' ')
b = [''] * n
for i in range(len(a)):
    b[int(a[i]) - 1] = str(i + 1)

print(' '.join(b))
Buggy python submission (verdict: Time Limit Exceeded):
def primes(n):
    l= []
    for i in range(2,n):
        while n % i == 0:
            n = n//i
            l.append(i)
        if n == 1: 
            break
    
    if n > 1:
        l.append(n)
    return l

a,b=map(int,input().split())
sa=set(primes(a))
sb=set(primes(b))
sans=sa.intersection(sb)
print(len(sans)+1)

Fixed submission:
def primes(n):
    i = 2
    factors = []
    while i**2<= n:
        if n % i:
            i += 1
        else:
            n =n//i
            factors.append(i)
    if n > 1:
        factors.append(n)
    return factors
a,b=map(int,input().split())
sa=set(primes(a))
sb=set(primes(b))
sans=sa.intersection(sb)
print(len(sans)+1)
Buggy python submission (verdict: Time Limit Exceeded):
h,w,a,b=map(int,input().split())

m=[[0]]
for i in range(w-1):
  s=min(0,1,key=lambda x:m[0].count(x))
  x=m[0].count(s)
  m[0]+=[s if x<a else 1-s]
for i in range(h-1):
  n=list(zip(*m))
  s=min(0,1,key=lambda x:n[0].count(x))
  x=n[0].count(s)
  m+=[m[0]]
  if (x<b) ^ (s==0):
    m[-1]=[1-j for j in m[-1]]

for i in m:
  print(*i,sep="")

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

arow = '1'*A + '0'*(W-A)
brow = '0'*A + '1'*(W-A)

for i in range(1,H+1):
    if (i <= B):
        print(brow)
    else:
        print(arow)

Buggy python submission (verdict: Runtime Error):
h,w,a,b=map(int,input().split())
m=[[0]]
for i in range(w-1):
  s=min(m[0],key=lambda x:m[0].count(x))
  x=m[0].count(1-s)
  m[0]+=[1-s if x<a else s]
for i in range(h-1):
  n=[*zip(*m)]
  s=min(n[0],key=lambda x:n[0].count(x))
  x=n[0].count(1-s)
  m+=[[1-i for i in m[0]] if x<b else m[0]]

for i in m:
  print(*i)

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

arow = '1'*A + '0'*(W-A)
brow = '0'*A + '1'*(W-A)

for i in range(1,H+1):
    if (i <= B):
        print(brow)
    else:
        print(arow)
Buggy python submission (verdict: Runtime Error):
def calulate(m, n) : 
	n_adapters = 0
	if n <= m :
		n_adapters = 1
	else :
		n_adapters = n//m
		if n % m != 0:
			n_adapters += 1
	return n_adapters

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

calculate(M, N)

Fixed submission:
input1 = input()
x = []
y=[]
check=0

for i in input1:
    if i!=" " and check==0:
        x.append(i)
    elif i==" ":
        check=1
    elif i!=" " and check==1:
        check==1
        y.append(i)
xstring=''.join(x)
ystring=''.join(y)

xint=int(xstring)
yint=int(ystring)

if yint==1:
    print(0)
else:
    cnt=0
    while ((xint-1)*(cnt))+xint<yint:
        cnt=cnt+1
    cnt=cnt+1
    print(cnt)

Buggy python submission (verdict: Runtime Error):
A = int(input())
B = int(input())
socket = 0
count = 0
while socket < B :
    if socket + A < B :
        socket = socket + A - 1
        count += 1
    elif socket+A >= B :
        socket = socket + A
        count += 1
print(count)


Fixed submission:
input1 = input()
x = []
y=[]
check=0

for i in input1:
    if i!=" " and check==0:
        x.append(i)
    elif i==" ":
        check=1
    elif i!=" " and check==1:
        check==1
        y.append(i)
xstring=''.join(x)
ystring=''.join(y)

xint=int(xstring)
yint=int(ystring)

if yint==1:
    print(0)
else:
    cnt=0
    while ((xint-1)*(cnt))+xint<yint:
        cnt=cnt+1
    cnt=cnt+1
    print(cnt)

Buggy python submission (verdict: Runtime Error):
A = int(input())
B = int(input())
socket = A - 1
count=1
while (socket) < B :
    if (socket+A) < B :
        socket = socket + A - 1
        count+=1
    elif (socket+A) >= B :
        socket=socket+A
        count+=1
print(count)


Fixed submission:
input1 = input()
x = []
y=[]
check=0

for i in input1:
    if i!=" " and check==0:
        x.append(i)
    elif i==" ":
        check=1
    elif i!=" " and check==1:
        check==1
        y.append(i)
xstring=''.join(x)
ystring=''.join(y)

xint=int(xstring)
yint=int(ystring)

if yint==1:
    print(0)
else:
    cnt=0
    while ((xint-1)*(cnt))+xint<yint:
        cnt=cnt+1
    cnt=cnt+1
    print(cnt)

Buggy python submission (verdict: Runtime Error):
import math
S = input()
A = int(S[0])
B = int(S[1:])
n = math.ceil(B/A)
print(n, " power strips, each with", A , "sockets, extend the socket into", A*n, "empty sockets.")

Fixed submission:
input1 = input()
x = []
y=[]
check=0

for i in input1:
    if i!=" " and check==0:
        x.append(i)
    elif i==" ":
        check=1
    elif i!=" " and check==1:
        check==1
        y.append(i)
xstring=''.join(x)
ystring=''.join(y)

xint=int(xstring)
yint=int(ystring)

if yint==1:
    print(0)
else:
    cnt=0
    while ((xint-1)*(cnt))+xint<yint:
        cnt=cnt+1
    cnt=cnt+1
    print(cnt)
Buggy python submission (verdict: Runtime Error):
#include <iostream>

using namespace std;

int main()
{
    long long n;
    scanf("%lld",&n);
    printf("%lld\n",n*(n-1)/2);
    return 0;
}


Fixed submission:
n=int(input())
n-=1
print(n*(n+1)//2)
##############################################################################################################################################################################################################################

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
l = list()
for i in range(n):
    l.append(i)
print(sum(l))

Fixed submission:
n=int(input())
n-=1
print(n*(n+1)//2)
##############################################################################################################################################################################################################################
Buggy python submission (verdict: Runtime Error):
s = input()
res = [0] * len(s)
cnt = 0
for i in range(len(s)):
    if s[i] == "R":
        cnt += 1
    else:
        res[i-1] += (cnt+1)//2
        res[i] += cnt//2
        cnt = 0
cnt = 0
for i in range(1, len(s)+1):
    if s[-i] == "L":
        cnt += 1
    else:
        res[i] += cnt//2
        res[-i+1] += (cnt+1)//2
        cnt = 0
print(*res)

Fixed submission:
s = input()
res = [0] * len(s)
cnt = 0
for i in range(len(s)):
    if s[i] == "R":
        cnt += 1
    else:
        res[i-1] += (cnt+1)//2
        res[i] += cnt//2
        cnt = 0
cnt = 0
for i in range(1, len(s)+1):
    if s[-i] == "L":
        cnt += 1
    else:
        res[-i] += cnt//2
        res[-i+1] += (cnt+1)//2
        cnt = 0
print(*res)