TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: The window of Takahashi's room has a width of A. There are two curtains hung over the window, each of which has a horizontal length of B. (Vertically, the curtains are long enough to cover the whole window.)  We will close the window so as to minimize the total horizontal length of the uncovered part of the window. Find the total horizontal length of the uncovered parts of the window then.

Submission attempts (in order):
a = int(input())
b = int(input())

ans = a // (b * 2)

if ans <= 0:
    ans = 0

print(ans)


a, b = map(int, input().split())
ans = a - (b * 2)

if ans <= 0:
    ans = 0

print(ans)


Verdicts: Runtime Error

Accepted
Problem: The window of Takahashi's room has a width of A. There are two curtains hung over the window, each of which has a horizontal length of B. (Vertically, the curtains are long enough to cover the whole window.)  We will close the window so as to minimize the total horizontal length of the uncovered part of the window. Find the total horizontal length of the uncovered parts of the window then.

Submission attempts (in order):
    a,b = map(int,input().split())
     
    if a >= b*2:
        print(a-b*2)
    else:
        print(0)

    a,b = map(int,input().split())
     
    if a >= b*2:
        print(a-b*2)
    else:
        print(0)

a = input()
b = input()
c = 2*b
if a>c:
  print(a-c)
elif a<c:
  print(0)

a,b = map(int,input().split())
if a<=b*2:
  print(0)
else:
  print(a-b*2)

Verdicts: Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: The window of Takahashi's room has a width of A. There are two curtains hung over the window, each of which has a horizontal length of B. (Vertically, the curtains are long enough to cover the whole window.)  We will close the window so as to minimize the total horizontal length of the uncovered part of the window. Find the total horizontal length of the uncovered parts of the window then.

Submission attempts (in order):
a, b = map(int, input(),split())

print(max(0, a-2*b))

a, b = map(int, input().split())
 
print(max(0, a-2*b))

Verdicts: Runtime Error

Accepted
Problem: The window of Takahashi's room has a width of A. There are two curtains hung over the window, each of which has a horizontal length of B. (Vertically, the curtains are long enough to cover the whole window.)  We will close the window so as to minimize the total horizontal length of the uncovered part of the window. Find the total horizontal length of the uncovered parts of the window then.

Submission attempts (in order):
a, b = map(int, input().split(" "))
if a > 2*b :
    print(a-2*b)
print(0)

a,b = map(int, inpout().split())
if a > b:
  print(a-b)
print(0)

a,b = input().split(',')
if a > b:
  print(a-b)
print(0)


a, b = map(int, input().split(","))
if a > 2*b :
    print(a-2*b)
print(0)

a, b = map(int, input().split(","))
if a > b :
    print(a-b)
print(0)

a, b = map(int, input().split(" "))
if a > 2*b :
    print(a-2*b)
else:
    print(0)

Verdicts: Wrong Answer

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: The window of Takahashi's room has a width of A. There are two curtains hung over the window, each of which has a horizontal length of B. (Vertically, the curtains are long enough to cover the whole window.)  We will close the window so as to minimize the total horizontal length of the uncovered part of the window. Find the total horizontal length of the uncovered parts of the window then.

Submission attempts (in order):
A=input()
B=input()
A=int(A)
B=int(A)

if A>2*B:
    print(A-2*B)
else:
    print(0)

A,B=input().split()
A=int(A)
B=int(B)
if A>2*B:
  print(A-2*B)
else:
  print(0)

Verdicts: Runtime Error

Accepted
Problem: The window of Takahashi's room has a width of A. There are two curtains hung over the window, each of which has a horizontal length of B. (Vertically, the curtains are long enough to cover the whole window.)  We will close the window so as to minimize the total horizontal length of the uncovered part of the window. Find the total horizontal length of the uncovered parts of the window then.

Submission attempts (in order):
import bisect
n = int(input())
 
l = list(map(int, input().split()))
l.sort()
a = 0
print(l)
for i in range(n):
    for j in range(i+1,n):
        s = bisect.bisect_left(l,l[i]+l[j])-j-1
        a+=s


print(a)

a, b = map(int, input().split())

w = 0

if a<2*b :
    w = 0
    print(w)

else:
    w = a-2*b
    print(w)


Verdicts: Runtime Error

Accepted
Problem: The window of Takahashi's room has a width of A. There are two curtains hung over the window, each of which has a horizontal length of B. (Vertically, the curtains are long enough to cover the whole window.)  We will close the window so as to minimize the total horizontal length of the uncovered part of the window. Find the total horizontal length of the uncovered parts of the window then.

Submission attempts (in order):
a, b = map(int, input().split())
if a <= 2b:
  print(0)
else:
  print(a-2b)

a, b = map(int, input().split())
if a <= 2b:
  print("0")
else:
  print(a-2b)


a, b = map(int, input().split())
if a <= 2*b:
  print(0)
else:
  print(a-2*b)


Verdicts: Runtime Error

Runtime Error

Accepted
Problem: The window of Takahashi's room has a width of A. There are two curtains hung over the window, each of which has a horizontal length of B. (Vertically, the curtains are long enough to cover the whole window.)  We will close the window so as to minimize the total horizontal length of the uncovered part of the window. Find the total horizontal length of the uncovered parts of the window then.

Submission attempts (in order):
a,b = map(int, input().split())
c = a-2*b
d = c if c > 0 else 0
print d


N = input()
a,b = [int(x) for x in N.split()]
c = a-2*b
d = c if c > 0 else 0
print d

N = input()
a,b = [int(x) for x in N.split()]
c = a-2*b
d = c if c > 0 else 0
print(d)


Verdicts: Runtime Error

Runtime Error

Accepted
Problem: The window of Takahashi's room has a width of A. There are two curtains hung over the window, each of which has a horizontal length of B. (Vertically, the curtains are long enough to cover the whole window.)  We will close the window so as to minimize the total horizontal length of the uncovered part of the window. Find the total horizontal length of the uncovered parts of the window then.

Submission attempts (in order):



N = int(input())

line = input()
#N = 3
#line = '2 1 2'
lines = line.split(' ')


dic = {}
for item in lines:
    n = int(item)

    if n in dic.keys():
        dic[n] += 1
    else:
        dic[n] = 1

lis = []
for item in dic.keys():
    lis += [dic[item]]


lis.sort(reverse=True)


sublis = []
sublis = lis[:]

def cal(k,lis):
    ans = 0
    if (len(lis)<k): return 0
    while True:
        for k_i in range(k):
            if lis[k_i] == 0:
                return ans
            else:
                lis[k_i] -= 1
        else:
            ans = ans + 1

        lis.sort(reverse=True)

    

for i in range(N):

    k = i + 1

    print(cal(k,lis))
    




    


[a,b] = input().split()

print(max(0,int(a)-(int(b)*2)))

Verdicts: Runtime Error

Accepted
Problem: The window of Takahashi's room has a width of A. There are two curtains hung over the window, each of which has a horizontal length of B. (Vertically, the curtains are long enough to cover the whole window.)  We will close the window so as to minimize the total horizontal length of the uncovered part of the window. Find the total horizontal length of the uncovered parts of the window then.

Submission attempts (in order):
    w,c = map(int,input().split())
     
    res = w - (c+c)
    if res < 0:
      res =0
    print(res)

w,c = map(int,input().split())

res = w-c+c
if res < 0:
  res =0
print(res)

w,c = map(int,input().split())
         
res = w - (2*c)

if res < 0:
    res =0
print(res)

Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: The window of Takahashi's room has a width of A. There are two curtains hung over the window, each of which has a horizontal length of B. (Vertically, the curtains are long enough to cover the whole window.)  We will close the window so as to minimize the total horizontal length of the uncovered part of the window. Find the total horizontal length of the uncovered parts of the window then.

Submission attempts (in order):
a, b = map(int, input().split())
 
ans = max([a - 2*b, 0])
 
	
for num in range(100000000):

print(ans)

a = int(input())
b = int(input())

ans = max(a - 2*b, 0)

print(ans)


a, b = map(int, input().split())
 
ans = max([a - 2*b, 0])

print(ans)

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: The window of Takahashi's room has a width of A. There are two curtains hung over the window, each of which has a horizontal length of B. (Vertically, the curtains are long enough to cover the whole window.)  We will close the window so as to minimize the total horizontal length of the uncovered part of the window. Find the total horizontal length of the uncovered parts of the window then.

Submission attempts (in order):
a,b = map(int,input().split())
print(max(0,int(a-2b)))

a,b = map(int,input().split())
print(max(0,int(a-2*b)))

Verdicts: Runtime Error

Accepted
Problem: The window of Takahashi's room has a width of A. There are two curtains hung over the window, each of which has a horizontal length of B. (Vertically, the curtains are long enough to cover the whole window.)  We will close the window so as to minimize the total horizontal length of the uncovered part of the window. Find the total horizontal length of the uncovered parts of the window then.

Submission attempts (in order):
res = A - 2 * B
if res <= 0: res = 0
print(res)

A, B = map(int, input().split())
res = A - 2*B
if res < 0: res = 0
print(res)

Verdicts: Runtime Error

Accepted
Problem: The window of Takahashi's room has a width of A. There are two curtains hung over the window, each of which has a horizontal length of B. (Vertically, the curtains are long enough to cover the whole window.)  We will close the window so as to minimize the total horizontal length of the uncovered part of the window. Find the total horizontal length of the uncovered parts of the window then.

Submission attempts (in order):
 n, k = list(map( int , input().split()))
 print( max( 0 , n - 2*k))

n, k = list(map( int , input().split()))
print( max( 0 , n - 2*k))

Verdicts: Runtime Error

Accepted
Problem: The window of Takahashi's room has a width of A. There are two curtains hung over the window, each of which has a horizontal length of B. (Vertically, the curtains are long enough to cover the whole window.)  We will close the window so as to minimize the total horizontal length of the uncovered part of the window. Find the total horizontal length of the uncovered parts of the window then.

Submission attempts (in order):
A, B = map(int, input().split())
print(max(A- 2*b, 0))

A, B = map(int, input().split())
print(max(A- 2*B, 0))

Verdicts: Runtime Error

Accepted
Problem: The window of Takahashi's room has a width of A. There are two curtains hung over the window, each of which has a horizontal length of B. (Vertically, the curtains are long enough to cover the whole window.)  We will close the window so as to minimize the total horizontal length of the uncovered part of the window. Find the total horizontal length of the uncovered parts of the window then.

Submission attempts (in order):
a=int(input())
b=int(input())
c=b*2
if a-c>0:
  print(a-c)
else:
  print("0")

A,B=map(int,input().split())
c=A-2*B
print(max(0,c))

Verdicts: Runtime Error

Accepted
Problem: The window of Takahashi's room has a width of A. There are two curtains hung over the window, each of which has a horizontal length of B. (Vertically, the curtains are long enough to cover the whole window.)  We will close the window so as to minimize the total horizontal length of the uncovered part of the window. Find the total horizontal length of the uncovered parts of the window then.

Submission attempts (in order):
import bisect

N = int(input())
L = list(map(int, input().split()))
L = sorted(L)
ans = 0
for i in range(N):
  for j in range(i+1, N):
    min_sum = L[i]+L[j]
    more_than = bisect.bisect_left(L[j+1:], min_sum)
    ans += more_than
print(ans)

import bisect
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
 
 
def solve2():
    N = int(input())
    L = list(map(int, input().split()))
    L = sorted(L)
    ans = 0
    for i in range(N):
        for j in range(i+1, N):
            min_sum = L[i]+L[j]
            more_than = bisect.bisect_left(L[j+1:], min_sum)
            ans += more_than
    print(ans)
 
 
solve2()

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

if A <= 2*B:
  print(int(0))
else:
  print(A-2*B)

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: The window of Takahashi's room has a width of A. There are two curtains hung over the window, each of which has a horizontal length of B. (Vertically, the curtains are long enough to cover the whole window.)  We will close the window so as to minimize the total horizontal length of the uncovered part of the window. Find the total horizontal length of the uncovered parts of the window then.

Submission attempts (in order):
N = int(input())
d_list = list(map(int, input().split()))

sum_num = 0
for i in range(N-1):
    for j in range(i+1, N):
        sum_num += d_list[i] * d_list[j]

print(sum_num)

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

if (B*2) >= A:
    print(0)
else:
    print(A-(B*2))

Verdicts: Runtime Error

Accepted
Problem: The window of Takahashi's room has a width of A. There are two curtains hung over the window, each of which has a horizontal length of B. (Vertically, the curtains are long enough to cover the whole window.)  We will close the window so as to minimize the total horizontal length of the uncovered part of the window. Find the total horizontal length of the uncovered parts of the window then.

Submission attempts (in order):
a, b = map(int,input().split())
if a >= 2*b:
  print(0)
else:
  print(a-2*b)

a, b = map(int,input().split())
if a <= 2*b:
  print(0)
else:
  print(a-2*b)

Verdicts: Wrong Answer

Accepted
Problem: The window of Takahashi's room has a width of A. There are two curtains hung over the window, each of which has a horizontal length of B. (Vertically, the curtains are long enough to cover the whole window.)  We will close the window so as to minimize the total horizontal length of the uncovered part of the window. Find the total horizontal length of the uncovered parts of the window then.

Submission attempts (in order):
n = int(input())
s = list(input())

i = 0
while i<len(s)-1:
  if s[i] == s[i+1]:
    del s[i]
  else:
    i += 1
print(len(s))

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

num = A - 2*B
if num >= 0:
	print(num)
else:
	print("0")


Verdicts: Runtime Error

Accepted
Problem: The window of Takahashi's room has a width of A. There are two curtains hung over the window, each of which has a horizontal length of B. (Vertically, the curtains are long enough to cover the whole window.)  We will close the window so as to minimize the total horizontal length of the uncovered part of the window. Find the total horizontal length of the uncovered parts of the window then.

Submission attempts (in order):
A,B = int(input())

if 2*B >= A:
  print(0)
else:
  print(A-2*B)

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

if 2*B >= A:
  print(0)
else:
  print(A-2*B)


Verdicts: Runtime Error

Accepted
Problem: The window of Takahashi's room has a width of A. There are two curtains hung over the window, each of which has a horizontal length of B. (Vertically, the curtains are long enough to cover the whole window.)  We will close the window so as to minimize the total horizontal length of the uncovered part of the window. Find the total horizontal length of the uncovered parts of the window then.

Submission attempts (in order):
int(input()) = A
int(input()) = B
c =2*A-B
if c>=0:
  print(c)
else:
  print(0)

a,b=int(input()).split()
c = 2*a-b
if c >=0:
  print(c)
else:
  print(0)

a,b =(int(x) for x in input().split())
c=2*a-b
if c>=0:
  print(c)
else:
  print(0)

a,b =(int(x) for x in input().split())
c=a-b*2
if c>=0:
  print(c)
else:
  print(0)


Verdicts: Runtime Error

Runtime Error

Wrong Answer

Accepted
Problem: The window of Takahashi's room has a width of A. There are two curtains hung over the window, each of which has a horizontal length of B. (Vertically, the curtains are long enough to cover the whole window.)  We will close the window so as to minimize the total horizontal length of the uncovered part of the window. Find the total horizontal length of the uncovered parts of the window then.

Submission attempts (in order):
N = int(input())
lst = list(map(int, input().split()))
ret = 0
for idx_a, a in enumerate(lst[:-2]):
    for idx_b, b in enumerate(lst[idx_a + 1:-1]):
        for idx_c, c in enumerate(lst[idx_a + idx_b + 2:]):
            if a < b + c and b < c + a and c < a + b:
                ret += 1
print(ret)

N = int(input())
lst = list(map(int, input().split()))
ret = 0
for idx_a, a in enumerate(lst[:-2]):
    for idx_b, b in enumerate(lst[idx_a + 1:-1]):
        for idx_c, c in enumerate(lst[idx_a + idx_b + 2:]):
            if a < b + c and b < c + a and c < a + b:
                ret += 1
print(ret)

A, B = map(int, input().split())
print(max(0, A - B * 2))

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: The window of Takahashi's room has a width of A. There are two curtains hung over the window, each of which has a horizontal length of B. (Vertically, the curtains are long enough to cover the whole window.)  We will close the window so as to minimize the total horizontal length of the uncovered part of the window. Find the total horizontal length of the uncovered parts of the window then.

Submission attempts (in order):
a,b = int(input())
s = a-b*2
if s <= 0:
    print(0)
else:
    print(s)

a,b = map(int,input().split())
s = a-b*2
if s <= 0:
    print(0)
else:
    print(s)

Verdicts: Runtime Error

Accepted
Problem: The window of Takahashi's room has a width of A. There are two curtains hung over the window, each of which has a horizontal length of B. (Vertically, the curtains are long enough to cover the whole window.)  We will close the window so as to minimize the total horizontal length of the uncovered part of the window. Find the total horizontal length of the uncovered parts of the window then.

Submission attempts (in order):
a,b = map(lambda x : int(x), input().split())
print(max(a - b * 2),0)

a,b=map(lambda x:int(x),input().split())
print(max([0,a-b*2]))

Verdicts: Runtime Error

Accepted
Problem: The window of Takahashi's room has a width of A. There are two curtains hung over the window, each of which has a horizontal length of B. (Vertically, the curtains are long enough to cover the whole window.)  We will close the window so as to minimize the total horizontal length of the uncovered part of the window. Find the total horizontal length of the uncovered parts of the window then.

Submission attempts (in order):
a,b = map(int,int().split())
print(0 if b*2>=a else a-b*2)

a,b = map(int,input().split())

print(0 if b*2>=a else a-b*2)

Verdicts: Runtime Error

Accepted
Problem: The window of Takahashi's room has a width of A. There are two curtains hung over the window, each of which has a horizontal length of B. (Vertically, the curtains are long enough to cover the whole window.)  We will close the window so as to minimize the total horizontal length of the uncovered part of the window. Find the total horizontal length of the uncovered parts of the window then.

Submission attempts (in order):
a,b=map(int,input().split())
print(max(0,2*a-b))

a, b = map(int, input().split())
print(max(0, a - 2 * b))



Verdicts: Wrong Answer

Accepted
Problem: The window of Takahashi's room has a width of A. There are two curtains hung over the window, each of which has a horizontal length of B. (Vertically, the curtains are long enough to cover the whole window.)  We will close the window so as to minimize the total horizontal length of the uncovered part of the window. Find the total horizontal length of the uncovered parts of the window then.

Submission attempts (in order):
import sys


def main():
    ret = window_len - cartain_len*2
    if ret >= 0:
        return ret
    else:
        return 0


if __name__ == "__main__":
    args = sys.argv
    window_len = args[1]
    cartain_len = args[2]
    main(window_len, cartain_len)


import sys


def main(window_len, cartain_len):
    ret = int(window_len) - int(cartain_len)*2
    if ret >= 0:
        return ret
    else:
        return 0


if __name__ == "__main__":
    args = sys.argv
    window_len = args[1]
    cartain_len = args[2]
    print(main(window_len, cartain_len))


window, cartain = map(int, input().split())

print(window - cartain*2 if window - cartain*2 > 0 else 0)

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: The window of Takahashi's room has a width of A. There are two curtains hung over the window, each of which has a horizontal length of B. (Vertically, the curtains are long enough to cover the whole window.)  We will close the window so as to minimize the total horizontal length of the uncovered part of the window. Find the total horizontal length of the uncovered parts of the window then.

Submission attempts (in order):
a,b=map(int,input().split(" "))
print(max(0a-*b))

a,b=map(int,input().split(" "))
print(max(0,a-2*b))


Verdicts: Runtime Error

Accepted
Problem: The window of Takahashi's room has a width of A. There are two curtains hung over the window, each of which has a horizontal length of B. (Vertically, the curtains are long enough to cover the whole window.)  We will close the window so as to minimize the total horizontal length of the uncovered part of the window. Find the total horizontal length of the uncovered parts of the window then.

Submission attempts (in order):
a, b = input().split()
print(max(0, int(b) - 2*int(a)))


a, b = input().split()
print(max(0, int(b) - 2*int(a))

a, b = input().split()
print(max(0, int(a) - 2*int(b)))


Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: The window of Takahashi's room has a width of A. There are two curtains hung over the window, each of which has a horizontal length of B. (Vertically, the curtains are long enough to cover the whole window.)  We will close the window so as to minimize the total horizontal length of the uncovered part of the window. Find the total horizontal length of the uncovered parts of the window then.

Submission attempts (in order):
def o(a,b):
  if a>2*b:
    return a-2*b
  return 0
 
a=int(imput())
b=int(imput())
print(o(a,b))


def o(a,b):
  if a>2*b:
    return a-2*b
  return 0

a=imput()
b=imput()
print(a,b)

def o(a,b):
  if a>2*b:
    return a-2*b
  return 0
 
a=imput()
b=imput()
print(o(a,b))

a,b=map(int, input().split())
if a>2*b:
  print(a-2*b)
else:
  print(0)

Verdicts: Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: It's now the season of TAKOYAKI FESTIVAL!  This year, N takoyaki (a ball-shaped food with a piece of octopus inside) will be served. The _deliciousness_ of the i-th takoyaki is d_i.  As is commonly known, when you eat two takoyaki of deliciousness x and y together, you restore x \times y health points.  There are \frac{N \times (N - 1)}{2} ways to choose two from the N takoyaki served in the festival. For each of these choices, find the health points restored from eating the two takoyaki, then compute the sum of these \frac{N \times (N - 1)}{2} values.

Submission attempts (in order):
import unittest

from A02 import solve
from A02 import parse_input

class TestA02Solve(unittest.TestCase):


    def test_solve(self):
        lines_as_string = """
3
3 1 2
"""
        r = parse_input(lines_as_string)
        for i, e in enumerate(r):
            print("e[%d]=%s" % (i, e))
        print("")
        self.assertEqual(solve(*r), 11)

        lines_as_string = """
7
5 0 7 8 3 3 2
"""
        r = parse_input(lines_as_string)
        for i, e in enumerate(r):
            print("e[%d]=%s" % (i, e))
        print("")
        self.assertEqual(solve(*r), 312)

if __name__ == '__main__':
    unittest.main()
                                         

# -*- coding: utf-8 -*-

import sys

debug = False

def log(text):
    if debug:
        print(text)

def parse_input(lines_as_string = None):

    global debug
    lines = []
    if lines_as_string is None:
        debug = False
        # for line in sys.stdin:
        #     lines.append(line)
        lines.append(input())
        lines.append(input())
    else:
        debug = True
        lines = [e for e in lines_as_string.split("\n")][1:-1]

    n = [int(e) for e in lines[0].split(" ")][0]
    d = [int(e) for e in lines[1].split(" ")]

    return (n, d)


def solve(n, d):

    s = 0
    for i in range(n-1):
        for j in range(i+1, n):
            s = s + d[i]*d[j]

    return s


def main():
    
    result = solve(*parse_input())
    if isinstance(result, list):
        for r in result:
            print("%s" % r, sep='')
    else:
        print("%s" % result, sep='')

if __name__ == '__main__':

    main()
	

Verdicts: Runtime Error

Accepted
Problem: It's now the season of TAKOYAKI FESTIVAL!  This year, N takoyaki (a ball-shaped food with a piece of octopus inside) will be served. The _deliciousness_ of the i-th takoyaki is d_i.  As is commonly known, when you eat two takoyaki of deliciousness x and y together, you restore x \times y health points.  There are \frac{N \times (N - 1)}{2} ways to choose two from the N takoyaki served in the festival. For each of these choices, find the health points restored from eating the two takoyaki, then compute the sum of these \frac{N \times (N - 1)}{2} values.

Submission attempts (in order):
N=int(input())
takoyaki=list(map(int,input().split()))
print(takoyaki)
count=0
for i in range(0,N-1):
  for j in range(i+1,N):
    count+=takoyaki[i]*takoyaki[j]
print(count)

N=int(input())
takoyaki=list(map(int,input().split()))
count=0
for i in range(0,N-1):
  for j in range(i+1,N):
    count+=takoyaki[i]*takoyaki[j]
print(count)

Verdicts: Wrong Answer

Accepted
Problem: It's now the season of TAKOYAKI FESTIVAL!  This year, N takoyaki (a ball-shaped food with a piece of octopus inside) will be served. The _deliciousness_ of the i-th takoyaki is d_i.  As is commonly known, when you eat two takoyaki of deliciousness x and y together, you restore x \times y health points.  There are \frac{N \times (N - 1)}{2} ways to choose two from the N takoyaki served in the festival. For each of these choices, find the health points restored from eating the two takoyaki, then compute the sum of these \frac{N \times (N - 1)}{2} values.

Submission attempts (in order):
N = int(input())
list = list(map(int, input().split()))

ans = 0

for i in range(N):
    for j in range(N):
        ans += list[i]*list[j]

for i in range(N):
    ans += -list[i]**2
print(ans/2)


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

ans = 0

for i in range(N):
    for j in range(N):
        ans += list[i]*list[j]

for i in range(N):
    ans += -list[i]**2

print(int(ans/2))

Verdicts: Wrong Answer

Accepted
Problem: It's now the season of TAKOYAKI FESTIVAL!  This year, N takoyaki (a ball-shaped food with a piece of octopus inside) will be served. The _deliciousness_ of the i-th takoyaki is d_i.  As is commonly known, when you eat two takoyaki of deliciousness x and y together, you restore x \times y health points.  There are \frac{N \times (N - 1)}{2} ways to choose two from the N takoyaki served in the festival. For each of these choices, find the health points restored from eating the two takoyaki, then compute the sum of these \frac{N \times (N - 1)}{2} values.

Submission attempts (in order):
N = int(input())
D = list(map(int, input().split()))
s = sum(D)
square_s = sum([d ** 2 for d in D])
print((s ** 2 - square_s) / 2)

# B - TAKOYAKI FESTIVAL 2019
N = int(input())
D = list(map(int, input().split()))
s = sum(D)
square_s = sum([d ** 2 for d in D])
print((s ** 2 - square_s) // 2)

Verdicts: Wrong Answer

Accepted
Problem: It's now the season of TAKOYAKI FESTIVAL!  This year, N takoyaki (a ball-shaped food with a piece of octopus inside) will be served. The _deliciousness_ of the i-th takoyaki is d_i.  As is commonly known, when you eat two takoyaki of deliciousness x and y together, you restore x \times y health points.  There are \frac{N \times (N - 1)}{2} ways to choose two from the N takoyaki served in the festival. For each of these choices, find the health points restored from eating the two takoyaki, then compute the sum of these \frac{N \times (N - 1)}{2} values.

Submission attempts (in order):
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

n = ii()
D = iil()
ans = 0
for i in range(n):
    for j in range(i,n):
       ans += D[i]*D[j] 

def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

n = ii()
D = iil()
ans = 0
for i in range(n):
    for j in range(i,n):
       ans += D[i]*D[j] 

def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

n = ii()
D = iil()
ans = 0
for i in range(n):
    for j in range(i,n):
       ans += D[i]*D[j] 
print(ans)

def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

n = ii()
D = iil()
ans = 0
for i in range(n):
    for j in range(i+1,n):
        print(i,j)
        ans += D[i]*D[j] 
print(ans)

def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

n = ii()
D = iil()
ans = 0
for i in range(n):
    for j in range(i,n):
       ans += D[i]*D[j] 
print(ans)

def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

n = ii()
D = iil()
sumD = sum(D)
ans = 0
for i in range(n):
    ans += D[i]*(sum(D)-D[i])
print(ans//2)

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: It's now the season of TAKOYAKI FESTIVAL!  This year, N takoyaki (a ball-shaped food with a piece of octopus inside) will be served. The _deliciousness_ of the i-th takoyaki is d_i.  As is commonly known, when you eat two takoyaki of deliciousness x and y together, you restore x \times y health points.  There are \frac{N \times (N - 1)}{2} ways to choose two from the N takoyaki served in the festival. For each of these choices, find the health points restored from eating the two takoyaki, then compute the sum of these \frac{N \times (N - 1)}{2} values.

Submission attempts (in order):
N = int(input())
data = [int(x) for x in input().split()]
data_sum = 0
for i in range(N):
    for j in range(i+1,N):
        print(i,j)
        data_sum += data[i] * data[j]
print(data_sum)


N = int(input())
data = [int(x) for x in input().split()]
data_sum = 0
for i in range(N):
    for j in range(i+1,N):
        data_sum += data[i] * data[j]
print(data_sum)


Verdicts: Wrong Answer

Accepted
Problem: It's now the season of TAKOYAKI FESTIVAL!  This year, N takoyaki (a ball-shaped food with a piece of octopus inside) will be served. The _deliciousness_ of the i-th takoyaki is d_i.  As is commonly known, when you eat two takoyaki of deliciousness x and y together, you restore x \times y health points.  There are \frac{N \times (N - 1)}{2} ways to choose two from the N takoyaki served in the festival. For each of these choices, find the health points restored from eating the two takoyaki, then compute the sum of these \frac{N \times (N - 1)}{2} values.

Submission attempts (in order):
n=int(input())
A=list(map(int,input().split()))
ans=0
for i in range(n):
  for j in range(i):
    ans+=i*j
print(ans)

n=int(input())
A=list(map(int,input().split()))
ans=0
for i in range(n):
  for j in range(i):
    ans+=A[i]*A[j]
print(ans)


Verdicts: Wrong Answer

Accepted
Problem: It's now the season of TAKOYAKI FESTIVAL!  This year, N takoyaki (a ball-shaped food with a piece of octopus inside) will be served. The _deliciousness_ of the i-th takoyaki is d_i.  As is commonly known, when you eat two takoyaki of deliciousness x and y together, you restore x \times y health points.  There are \frac{N \times (N - 1)}{2} ways to choose two from the N takoyaki served in the festival. For each of these choices, find the health points restored from eating the two takoyaki, then compute the sum of these \frac{N \times (N - 1)}{2} values.

Submission attempts (in order):
N = int(input())
Xs = list(map(int, input().split()))
ans = 0
for i in range(N-1):
    s = sum(Xs[i+1:N])
    print(s)
    ans = ans + s * Xs[i]
    print(ans)
print(ans)

N = int(input())
Xs = list(map(int, input().split()))
ans = 0
for i in range(N-1):
    s = sum(Xs[i+1:N])
    ans = ans + s * Xs[i]
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: It's now the season of TAKOYAKI FESTIVAL!  This year, N takoyaki (a ball-shaped food with a piece of octopus inside) will be served. The _deliciousness_ of the i-th takoyaki is d_i.  As is commonly known, when you eat two takoyaki of deliciousness x and y together, you restore x \times y health points.  There are \frac{N \times (N - 1)}{2} ways to choose two from the N takoyaki served in the festival. For each of these choices, find the health points restored from eating the two takoyaki, then compute the sum of these \frac{N \times (N - 1)}{2} values.

Submission attempts (in order):
n = int(input())

d = map(int,input().split())

s = 0

for i in range(n):
    for j in range(i,n):
        s += d[i] * d[j]
print(s)

n = int(input())

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

s = 0

for i in range(n):
    for j in range(i+1,n):
        s += d[i] * d[j]
print(s)


Verdicts: Runtime Error

Accepted
Problem: It's now the season of TAKOYAKI FESTIVAL!  This year, N takoyaki (a ball-shaped food with a piece of octopus inside) will be served. The _deliciousness_ of the i-th takoyaki is d_i.  As is commonly known, when you eat two takoyaki of deliciousness x and y together, you restore x \times y health points.  There are \frac{N \times (N - 1)}{2} ways to choose two from the N takoyaki served in the festival. For each of these choices, find the health points restored from eating the two takoyaki, then compute the sum of these \frac{N \times (N - 1)}{2} values.

Submission attempts (in order):
n = int(input())
a = map(int,input().split())
res = 0
for i in range(n):
  if a[i] == 0:
    continue
  for j in range(i+1,n):
    res += a[i]*a[j]
print(res)

n = int(input())
a = map(int,input().split())
res = 0
for i in range(n):
  for j in range(i+1,n):
    res += a[i]*a[j]
print(res)

n = int(input())
a = list(map(int,input().split()))
res = 0
for i in range(n):
  for j in range(i+1,n):
    res += a[i]*a[j]
print(res)

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: It's now the season of TAKOYAKI FESTIVAL!  This year, N takoyaki (a ball-shaped food with a piece of octopus inside) will be served. The _deliciousness_ of the i-th takoyaki is d_i.  As is commonly known, when you eat two takoyaki of deliciousness x and y together, you restore x \times y health points.  There are \frac{N \times (N - 1)}{2} ways to choose two from the N takoyaki served in the festival. For each of these choices, find the health points restored from eating the two takoyaki, then compute the sum of these \frac{N \times (N - 1)}{2} values.

Submission attempts (in order):
num=int(input())
data=input().split()
sum=0

for a in range(num):
  for b in range(num-1-a):
    sum+=int(data[a])*int(data[-b])
print(sum)

num=int(input())
data=input().split()
sum=0
 
for a in range(num):
  for b in range(num-1-a):
    sum+=int(data[a])*int(data[-1-b])
print(sum)

Verdicts: Wrong Answer

Accepted
Problem: It's now the season of TAKOYAKI FESTIVAL!  This year, N takoyaki (a ball-shaped food with a piece of octopus inside) will be served. The _deliciousness_ of the i-th takoyaki is d_i.  As is commonly known, when you eat two takoyaki of deliciousness x and y together, you restore x \times y health points.  There are \frac{N \times (N - 1)}{2} ways to choose two from the N takoyaki served in the festival. For each of these choices, find the health points restored from eating the two takoyaki, then compute the sum of these \frac{N \times (N - 1)}{2} values.

Submission attempts (in order):
n=int(input())
S=list(map(int,input().split()))
c=0

print(n,S)

for i in range(n):
    for j in range(n):
        if i!=j:
            c+=S[i]*S[j]


print(int(c/2))

n=int(input())
S=list(map(int,input().split()))
c=0

print(n,S)

for i in range(7):
    for j in range(7):
        if i!=j:
            c+=S[i]*S[j]


print(int(c/2))

n=int(input())
S=list(map(int,input().split()))
c=0

for i in range(n):
    for j in range(n):
        if i!=j:
            c+=S[i]*S[j]


print(int(c/2))

Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: It's now the season of TAKOYAKI FESTIVAL!  This year, N takoyaki (a ball-shaped food with a piece of octopus inside) will be served. The _deliciousness_ of the i-th takoyaki is d_i.  As is commonly known, when you eat two takoyaki of deliciousness x and y together, you restore x \times y health points.  There are \frac{N \times (N - 1)}{2} ways to choose two from the N takoyaki served in the festival. For each of these choices, find the health points restored from eating the two takoyaki, then compute the sum of these \frac{N \times (N - 1)}{2} values.

Submission attempts (in order):
a=int(input())
b= list(map(int, input().split()))  # 114514 810 893
c=[]
for i in b:
  c.append(i**2)

num=(sum(b)**2-sum(c))/2
print(num)

a=int(input())
b= list(map(int, input().split()))  # 114514 810 893
c=[]
for i in b:
  c.append(i**2)

num=(sum(b)**2-sum(c))//2
print(num)

Verdicts: Wrong Answer

Accepted
Problem: It's now the season of TAKOYAKI FESTIVAL!  This year, N takoyaki (a ball-shaped food with a piece of octopus inside) will be served. The _deliciousness_ of the i-th takoyaki is d_i.  As is commonly known, when you eat two takoyaki of deliciousness x and y together, you restore x \times y health points.  There are \frac{N \times (N - 1)}{2} ways to choose two from the N takoyaki served in the festival. For each of these choices, find the health points restored from eating the two takoyaki, then compute the sum of these \frac{N \times (N - 1)}{2} values.

Submission attempts (in order):
N = int(input())
d = list(map(int,input().split()))

print((sum(d)) ** 2 - sum(x ** 2 for x in d) // 2)


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

print((sum(d)) ** 2 - sum([x ** 2 for x in d]) // 2)

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

print(((sum(d)) ** 2 - sum([x ** 2 for x in d])) // 2)

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: It's now the season of TAKOYAKI FESTIVAL!  This year, N takoyaki (a ball-shaped food with a piece of octopus inside) will be served. The _deliciousness_ of the i-th takoyaki is d_i.  As is commonly known, when you eat two takoyaki of deliciousness x and y together, you restore x \times y health points.  There are \frac{N \times (N - 1)}{2} ways to choose two from the N takoyaki served in the festival. For each of these choices, find the health points restored from eating the two takoyaki, then compute the sum of these \frac{N \times (N - 1)}{2} values.

Submission attempts (in order):
n=int(input())
d=list(map(int,input().split()))
ans=0
for i in range(n):
    for j in range(n):
        if i!=j:
            ans+=d[i]*d[j]
print(ans/2)

n=int(input())
d=list(map(int,input().split()))
ans=0
for i in range(n):
    for j in range(n):
        if i!=j:
            ans+=d[i]*d[j]
print(ans//2)

Verdicts: Wrong Answer

Accepted
Problem: It's now the season of TAKOYAKI FESTIVAL!  This year, N takoyaki (a ball-shaped food with a piece of octopus inside) will be served. The _deliciousness_ of the i-th takoyaki is d_i.  As is commonly known, when you eat two takoyaki of deliciousness x and y together, you restore x \times y health points.  There are \frac{N \times (N - 1)}{2} ways to choose two from the N takoyaki served in the festival. For each of these choices, find the health points restored from eating the two takoyaki, then compute the sum of these \frac{N \times (N - 1)}{2} values.

Submission attempts (in order):
n = int(input())
d = list(map(int, input().split()))
s = 0
for i in range(n):
  for j in range(n):
    if i == j:
      continue
    s += d[i]*d[j]
print(s)

n = int(input())
d = list(map(int, input().split()))
s = 0
for i in range(n):
  for j in range(i+1,n):
    s += d[i]*d[j]
print(s)

Verdicts: Wrong Answer

Accepted
Problem: It's now the season of TAKOYAKI FESTIVAL!  This year, N takoyaki (a ball-shaped food with a piece of octopus inside) will be served. The _deliciousness_ of the i-th takoyaki is d_i.  As is commonly known, when you eat two takoyaki of deliciousness x and y together, you restore x \times y health points.  There are \frac{N \times (N - 1)}{2} ways to choose two from the N takoyaki served in the festival. For each of these choices, find the health points restored from eating the two takoyaki, then compute the sum of these \frac{N \times (N - 1)}{2} values.

Submission attempts (in order):
N = int(input())
p = []
q = 0
p = list(map(int, input().strip().split()))
for i in range(N):
    for j in range(N):
        q += (p[i] * p[j])
    q -= p[i] * p[i]
q = q / 2
print(q)

N = int(input())
p = []
q = 0
p = list(map(int, input().strip().split()))
for i in range(N):
    for j in range(N):
        q += (p[i] * p[j])
    q -= p[i] * p[i]
q = q / 2
print(int(q))

Verdicts: Wrong Answer

Accepted
Problem: It's now the season of TAKOYAKI FESTIVAL!  This year, N takoyaki (a ball-shaped food with a piece of octopus inside) will be served. The _deliciousness_ of the i-th takoyaki is d_i.  As is commonly known, when you eat two takoyaki of deliciousness x and y together, you restore x \times y health points.  There are \frac{N \times (N - 1)}{2} ways to choose two from the N takoyaki served in the festival. For each of these choices, find the health points restored from eating the two takoyaki, then compute the sum of these \frac{N \times (N - 1)}{2} values.

Submission attempts (in order):
N = int(input())
d_list = list(map(int, input().split()))

total = 0
for i in range(0, N):
    for j in range(i+1, N):
        total += d_list[i]*d_list[j]
        print(d_list[i], d_list[j])
print(total)

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

total = 0
for i in range(0, N):
    for j in range(i+1, N):
        total += d_list[i]*d_list[j]
print(total)


Verdicts: Wrong Answer

Accepted
Problem: It's now the season of TAKOYAKI FESTIVAL!  This year, N takoyaki (a ball-shaped food with a piece of octopus inside) will be served. The _deliciousness_ of the i-th takoyaki is d_i.  As is commonly known, when you eat two takoyaki of deliciousness x and y together, you restore x \times y health points.  There are \frac{N \times (N - 1)}{2} ways to choose two from the N takoyaki served in the festival. For each of these choices, find the health points restored from eating the two takoyaki, then compute the sum of these \frac{N \times (N - 1)}{2} values.

Submission attempts (in order):
import sys

n = int(sys.stdin.readline())
xs = [int(s) for s in sys.stdin.readline().split(" ")]

result = 0

for i in range(0, n):
    x = xs[i]
    for j in range(i + 1, n):
        print(x, xs[j])
        result += x * xs[j]

print(result)

import sys

n = int(sys.stdin.readline())
xs = [int(s) for s in sys.stdin.readline().split(" ")]

result = 0

for i in range(0, n):
    x = xs[i]
    for j in range(i + 1, n):
        result += x * xs[j]

print(result)

Verdicts: Wrong Answer

Accepted
Problem: It's now the season of TAKOYAKI FESTIVAL!  This year, N takoyaki (a ball-shaped food with a piece of octopus inside) will be served. The _deliciousness_ of the i-th takoyaki is d_i.  As is commonly known, when you eat two takoyaki of deliciousness x and y together, you restore x \times y health points.  There are \frac{N \times (N - 1)}{2} ways to choose two from the N takoyaki served in the festival. For each of these choices, find the health points restored from eating the two takoyaki, then compute the sum of these \frac{N \times (N - 1)}{2} values.

Submission attempts (in order):
n = int(input())
data = [int(i) for i input().split()]
ans = 0
for i in range(n):
  for j in range(i+1,n):
    ans += data[i]*data[j]
print(ans)

n = int(input())
data = [int(i) for i in input().split()]
ans = 0
for i in range(n-1):
  for j in range(i+1,n):
    ans += data[i]*data[j]
print(ans)

Verdicts: Runtime Error

Accepted
Problem: It's now the season of TAKOYAKI FESTIVAL!  This year, N takoyaki (a ball-shaped food with a piece of octopus inside) will be served. The _deliciousness_ of the i-th takoyaki is d_i.  As is commonly known, when you eat two takoyaki of deliciousness x and y together, you restore x \times y health points.  There are \frac{N \times (N - 1)}{2} ways to choose two from the N takoyaki served in the festival. For each of these choices, find the health points restored from eating the two takoyaki, then compute the sum of these \frac{N \times (N - 1)}{2} values.

Submission attempts (in order):
n=int(input())
l=list(map(int(input())))

ans=0
s=sum(l)

for i in range(n):

    ans+=l[i]*(s-l[i])

print(ans/2)

n=int(input())
l=list(map(int,input().split()))

ans=0
s=sum(l)

for i in range(n):

    ans+=l[i]*(s-l[i])

print(ans/2)

n = int(input())
d = list(map(int,input().split()))
ans = 0
for i in range(n):
    for j in range(n):
        if i>=j:
            continue
        ans += d[i]*d[j]
print(ans)

Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: It's now the season of TAKOYAKI FESTIVAL!  This year, N takoyaki (a ball-shaped food with a piece of octopus inside) will be served. The _deliciousness_ of the i-th takoyaki is d_i.  As is commonly known, when you eat two takoyaki of deliciousness x and y together, you restore x \times y health points.  There are \frac{N \times (N - 1)}{2} ways to choose two from the N takoyaki served in the festival. For each of these choices, find the health points restored from eating the two takoyaki, then compute the sum of these \frac{N \times (N - 1)}{2} values.

Submission attempts (in order):
#!/usr/bin/env python
# coding: utf-8

# In[23]:


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


# In[24]:


ans = 0
for i in range(N):
    for j in range(i+1,N):
        ans += d[i]*d[j]
ans


# In[ ]:






#!/usr/bin/env python
# coding: utf-8

# In[25]:


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


# In[27]:


ans = 0
for i in range(N):
    for j in range(i+1,N):
        ans += d[i]*d[j]
print(ans)


# In[ ]:






Verdicts: Wrong Answer

Accepted
Problem: It's now the season of TAKOYAKI FESTIVAL!  This year, N takoyaki (a ball-shaped food with a piece of octopus inside) will be served. The _deliciousness_ of the i-th takoyaki is d_i.  As is commonly known, when you eat two takoyaki of deliciousness x and y together, you restore x \times y health points.  There are \frac{N \times (N - 1)}{2} ways to choose two from the N takoyaki served in the festival. For each of these choices, find the health points restored from eating the two takoyaki, then compute the sum of these \frac{N \times (N - 1)}{2} values.

Submission attempts (in order):
input()
foods=list(map(int,input().split()))
ans = 0
sum = 0
for i in foods:
    for j in foods:
        i<j
        ans= foods[i]*foods[j]
        sum += ans
print(sum)

n=int(input())
foods=list(map(int,input().split()))
ans = 0
sum_ans = 0
for i in range(0,n-1):
    for j in range(1,n):
        if i<j:
            ans = foods[i]*foods[j]
            sum_ans += ans
print(sum_ans)

Verdicts: Runtime Error

Accepted