Problem:


Score : 300 points

Problem Statement

Given are N integers A_1,\ldots,A_N.

Find the sum of A_i \times A_j over all pairs (i,j) such that 1\leq i < j \leq N, modulo (10^9+7).

Constraints

2 \leq N \leq 2\times 10^5

0 \leq A_i \leq 10^9

All values in input are integers.

Input

Input is given from Standard Input in the following format:

N
A_1 \ldots A_N

Output

Print \sum_{i=1}^{N-1}\sum_{j=i+1}^{N} A_i A_j, modulo (10^9+7).

Sample Input 1

3
1 2 3

Sample Output 1

11

We have 1 \times 2 + 1 \times 3 + 2 \times 3 = 11.

Sample Input 2

4
141421356 17320508 22360679 244949

Sample Output 2

437235829



Sample input:
3
1 2 3


Sample output:
11

Submission status: Wrong Answer

Solution code:
import base64
import subprocess


exe_bin = "e??420s#R400000000000{}h%0RR91;0*u(00000KmY&$000007%u<-0000000000Kma%Z2>?I<9snHx1^@s61ONa4KmY&$00000KmY&$00000KmY&$00000_yGU_00000_yGU_000002mk;8000000{{R31ONa4I066w00000I066w00000I066w000008~^|S000008~^|S000000RR91000000RR911poj5000000000000000000000000000000EENC%00000EENC%00000001BW000000RR911^@s6ARPbz00000ARQn800000ARQn800000_yPa`00000U<CjG00000001BW000000ssI21^@s6I2`~000000I2|AW00000I2|AW000005CQ-I000005CQ-I000002mk;8000001ONa41ONa4R004100000R004100000R004100000L;wH)00000L;wH)000001ONa400000P~~)F1ONa4pb`K800000pb`K800000pb`K800000TmS$700000TmS$7000001ONa400000QRQ@G1^@s6000000000000000000000000000000000000000000000000005C8xG00000Qss1H1ONa4ARPbz00000ARQn800000ARQn800000-~s>u00000-~s>u000000RR9100000FKlUIHZ(76WG!rIZgqGqcsMpKHZ(4CZ!R(b1ONa45C8xG0RR91M^04$000000{{R30ssI2000001ONa46aWAK0{{R3M^04$rWn4p%AW)TJAibCOU(Z>2CnnK0ssI2761SM0RR911^@s6000mI0RRL5761SM000006qpP{bCw4J000000000000000000000000000000xBvhE5&!@I00000000000000000000p8x;=5&!@I00000000000000000000*Z=?k5&!@I00000000000000000000<^cczA^-pY00000000000000000000RR9105&!@I00000000000000000000a{vGU5&!@I00000000000000000000*#Q6m5&!@I00000000000000000000(EtDd5&!@I00000000000000000000c>w?b5&!@I00000000000000000000$N>NV5&!@I00000000000000000000D**ri5&!@I000000000000000000004*>uG5&!@I00000000000000000000e*pjh5&!@I00000000000000000000^#K3?5&!@I00000000000000000000`Tzg`5&!@I000000000000000000009{>OVAOHXW00000000000000000000uK@r65&!@I00000000000000000000{Q&>~5&!@I000000000000000000005C8xGAOHXW00000000000000000000I{*LxAOHXW00000000000000000000hX4Qo5&!@I00000000000000000000mjM6(5dawgKp-Fh000005CH%H00000egFUf5dawgU?Cs?000007y$qP000000BmVub97{5D=RK@Z!R_fUtec!Z*E_6bYXIIUta)UNmNZ=WMy(?XK8bEWpY$aLu_wuWmI8eY-IpnNmNZ=a%E>}b97~LR82!{Z*FB&VPb4$0AE^DbTTksUvy}4Z+Bm8Wo~D5XkTS=a&K}_OJe|ET251Ga&tveX#ihZQ*<+9X>I^tT251RIB9QlUt(c%Wi&}{X>>#}MRovRT251MIbTg*X>N06a&$>}MMY9mZ&Y6ZUs_XiF*jddbZByKcVA**WM5%yY;R+B0AE^UY*2OpUs_I6bU0~mb6;X%b7e6#b9ruKUw3JAXkT-5WNB|jVgO%XXLxvDaAk6HZ*F01X>@sCb}#^6T251GF)&|EUuAf7a$#e1Nq9v?Qd4PCR9^sJT2pi}HeX+Fb98cLVQpV&ZgXXFbV*}VbTKhwXkl_+baG*7baP2#MMY9mbTKnxVRLC?UvG1Ca%Ev{NmO4{FkeMeHeXOnQ!`&|0AE^ecWnS)T251RIB9QlUt(c%Wi&}{X>>y|MRovRT2pj1V{dhI0BmVuXJcbub1rjlE-?UKRc?1_Ze(9lWpj0HWdLkxVq-3IZ!R_fUte={VPk7wV`yt%W?^Y;0AF8Ycwt{*bY*yHbO2vpV|Za-W@&C=Y-xIB0BvP$ZEtpE0AF8hX<}nvb97;HbYE>@X>I^VLqlIPE-(N`Oi4mRUotK<07pzoLPK9NE;24P07F<<K|)DiF)lLzM@&gVLs(c}GcGhPIRHmYNkT(dSYI<PGynhq0ssR50ssU60ssO41ONg60ssX70{{a60ssU61^@s62LJ>B000000ssO40ssI2000000RRC2p#cB@5C8xGAOHXWP$qc`000L74*~!H000000RRF3z5xIL5C8xGFaQ7m6lrM<000F57XknP5C8xGbsA|2000C4Ap!sZ000000RRI40RR915C8xG00000)30j<000I6Edl@l5C8xGiGL{q00093I066w5C8xGbSaVu00062Mgjl;00000ARQn8000002mk;800000;0^!)00000C><aG000002mk;800000unhnJ00000FdZNO000002mk;800000pbh{4000002p}K;000002mk;8000002p}K;00000&>tWG000001^@s61ONa40000000000*dHJO000001^@s65C8xG0000000000;2$6W000001^@s65&!@I0000000000=pP^e000001^@s66951J0000000000@E;%m000001^@s66aWAK0000000000_#Yqu000001^@s66#xJL00000000005Fj7`000000RR914*&oF0000000000Kp-Fh000001poj5761SM0000000000U?Cs?000001poj57XSbN0000000000U>_g=000002LJ#70RR910000000000XdfT|000002LJ#70ssI20000000000a33H5000002LJ#70{{R30000000000cpo4D000002LJ#71poj50000000000fFB?L000002LJ#71^@s60000000000h#w#T000002LJ#72LJ#70000000000kRKob000002LJ#72mk;80000000000m>(bj000002LJ#72><{90000000000pdTOr000002LJ#73IG5A0000000000s2?Bz000002LJ#73jhEB0000000000upb}*000002LJ#73;+NC0000000000xE~+@000002LJ#74FCWD0000000000z#kw0000002LJ#74gdfE0000000000$R8j8000002LJ#75dZ)H0000000000NQ3MMNQ(tM6(9geg}`(I|IkQ-#0bLx0000000000|22vfAOQa*j1(XM4<A4P|0RkPAOL6p0002#;Q#;s|0RMHAOL6q0002#(EtDc|0Q}9AOL6r0002#!2kdM|0Qx1AOL6s0002#u>b%6|0QY^AOL6t0002#p#T5>|0QA+AOL6u0002#kpKVx|0P-!AOL6v0002#fdBvh|0PlsAOL6w0002#aR2}R|0PNkAOL6x0002#VE_OB|0O~cAOL6y0002#Q2+n`|0OyUAOL6z0002#K>z>$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Cd800000Oo{qTiS|T^??L|*+(?7N0Z2LBb?Qii#0XnmL0myyL0&;$!;oe!4<Cd800000^TPlDNQ3MMNQ1-(!vFvP0RRF3c4cF9Z*n?1Urk?RWoBV@Y;<2?aByXAWB>pF0UHB5TmS$73IG5AAo&0Pr~m)}5c&WA&;S4cAo>6Qr~v=~5c~iC<N*KxK>PpycmMzZQ2hV@=l}o!fc*de2mt^90RI2~bO8VWVE_OB00IC2(EtDcNCE%=000006aWAK000000eVsZ0eBDr8w>{skO2n}6aWAK8~^|S!219HD*ylh00000000006aWAK000000eVsZ0eBDr8w>{skO2SyBme*a8~^|SaQFZJ@Bjb+01gmF4j4)g3wH>B06!W#Dl;S^000006aWAKL;wH)IQakn2mk;800000000008~^|STmS$7VEh07A^-pY06`8Ag92I#4hTgHK@JE2NB{r;d;kCdaQpxNb^!nY00L4D5RU>v4j7IDOb#H81VRodj0HpvFop&}4mg7cO%6~3y$TLEK@KoM4k$tnAVLlpLJkl@4hTgH8~^|S000000eVnOQUC#X5C@wH3?Kj-8w>{skO2SyFaQ7mBme*ag#7>iRRI711ls@r074EBi~>Op7={Bw4j_XB0{jXN7(osYLJkN^3jhEBH~;_uSO5S3aQFZJ=m7u#1iAnK074EBi~>Op7={Bw4j_XBL=KPv1Ec{84j@4e7(osYLJkN)3jhEB7ytkOSOEY4B>DgUE&u=k080)KUJeKV00000L;wH)bO8VWSpEP1WdHyG074EBj{-st7>)x)4j_#LLJla51xOAsh6YFuID-dG4nT4aI6)3DK@KQF4j@7f7(xyZLJkN35C8xGya50Jfc^jf0ssI20000000000|Nj9GOa%Y{lmZ2>0syK4D*yoh{{a;mX#fDm0U*Hx0ObN4+XDc+10MhY0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000;0^!)00000unhnJ00000pbh{4000000RR91000000RR91000000RR9100000p#cB@000000RR9100000z5xIL000003;+NC00000pb7v0000004FCWD00000bP@mn0000082|tP00000ARQn8000008vp<R000005C8xG000008UO$Q00000FdZNO000008~^|S000002mk;800000_5S~F00000m;wL*000001poj50000000jU5000001^@s600000zybgO000003IG5A00000QUU+~000003jhEB000007ytkO000006#xJL0000000000000000{{R300000NFN{o000000ssI200000Pyqk{000006aWAK000002LJ#7000007XSbN00000PzeA4000002LJ#7000007zh9W000002mk;800000H~|0v000002><{9000007ytkO000009smFU000002mk;800000`~UxM000000RR9900000{{R1P00000hz9@w00000|NsAQ000000{{R300000@c;jB00000QU?G400000`TzfK000001ONa4000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000I2|AW0000000000000000000000000)(QXs00000<_Z7+00000_6h(1000001`7ZH0000077G9X00000CJO)n00000HVXg%00000MhgG{00000Rto?C00000W(xoS00000b_)Oi00000h6?}y00000mJ0v?00000rV9W70000000000000000000000000000000000000000000000000000000000000000000000000002p}K;000000000000000M?*t8AShL0b#8QZAU7^GE-)=Kbz*gHbagR)F*q(TG$|lAE;TMN0000000000000000000000000000000000000000000000{{U4I066w000000000000000000000{{X5R0041000000000000000000000{{a6bOHbX000000000000000000000{{d7m;wL*000000000000000000000{{g8zybgO000000000000000000000{{j900jU5000000000000000000000{{mAQU?G4000000000000000000000{{pBhz9@w000000000000000000000{{sC7zh9W000000000000000000000{{vDPzeA4000000000000000000000{{yEpb7v0000000000000000000000{{#FzzP5W000000000000000000000{{&GunPbH000000000000000000000{{*HzzYBX000000000000000000000{{;IbP@mn000000000000000000000{{>JfD!-z000000000000000000000{{^Kpb`K8000000000000000000000{{{L022TJ000000000000000000000{{~M02KfL000000000000000000000{|2NARQn8000000000000000000000{|5OFdZNO000000000000000000000{|8PI2|AW000000000000000000000{|BQNFN{o000000000000000000000{|ER03aX$000000000000000000000{|HSKp-Fh000000000000000000000{|KT000000000000000000000RR911OV~>000000000000000000009{>OV0ssyGunhnJ00000E&u=k00000GXMYp0RR~Qc_JVH000000RR9100000LI3~&1OV~>00000000000000000000O#lD@0ssyG5DowU000000000000000PXGV_0ssyGP!0e9000000000000000VgLXD0ssyGpbh{4000000000000000cmMzZ0RR~Qcp@MG000000RR9100000hX4Qo0RR;MFdZNO000000000000000t^fc40ssyG;0^!)000000000000000x&QzG0RR*LARQn8000000000000000LI3~&1OV~>00000000000000000000*#H0l0RR#J{1gBH000000000000000000001OV~>00000000000000000000=Kufz000pHpb`K8000000000000000`Tzg`0RR>NI2|AW0000000000000000|5X4000yKFdZNO0000000000000006afGL000yKARQn8000000000000000CjkHe0RR^ONFN{o000000000000000Jplj!A^;8mAP)cl00000b^!nY00000X8`~J5C9ke7$6`3000000000000000ZUF!QA^;8mpb!8600000RRI7100000rvm^0AOIKu03aX$000000000000000ngIX+5daVXfD!-z000001ONa400000sQ~~05&!@I00000000000000000000&jA1c5&!@I00000000000000000000_W=L^5&!@I00000000000000000000CISEeA^-pY00000000000000000000E&u=k5&#YWzzYBX00000=m7u#00000LIMB)5&!@I00000000000000000000Z2|xQ5ds(h2p}K;000000000000000dIA6d5&!@I00000000000000000000k^%q#Ap#fx5Fj7`000002mk;800000z61aO5&#bXbP@mn000000000000000t^xo65&!@I00000000000000000000$N~TW5&!@I00000000000000000000s{;T45&#YW;0*u(00000D*ylh00000+yVdq5&!@I00000000000000000000?*ae-5&!@I00000000000000000000L<9f;5&#PTpb7v00000000000000003j+WE5ds(h7$6`30000000000000007XttQ5&!@I00000000000000000000bOQhY5dawgKp-Fh000005CH%H00000ivs`vA^;8m@D2a~00000A^-pY00000r2_x}5C9ke03aX$0000000000000004*>uG5C9nffFd9O000000000000000vI77B5&!@I00000000000000000000-2(ssA^;8mpb!8600000RRI71000002?PKD5C9nf7$6`30000000000000006$AhP5&!@I00000000000000000000Is^a!5&#YW01^NI00000WdHyG00000N(2A^5&!@I00000000000000000000UjzUE5&!@I00000000000000000000fCK;lAOHXW00000000000000000000oCE*>5&!@I00000000000000000000v;+VE5&#YWa1sCj000000ssI200000!~_5U5dawgU?Cs?000007y$qP00000+5`Xq5&!@I00000000000000000000`2+v}AOHXW000000000000000000002n7HDAOHXW00000000000000000000A_V{dA^;8m@D2a~00000A^-pY00000JOuy%5&!@I0000000000000000000007G9>b!}g7W?yh}Z)A02bYE{~UvOb*a&s<YaBu)$M@&ybK}=s?b9G{0NndSYX>I^tT2pjPIA33BZ)t96bO2*=baQldW@av90AyuyWoKz~bY*g1bZuW_Y;SI5a{ymoWN%+*Y;R&=Y+qz_Z*p^AVRd)_V{dJ6Y-Mz1WG**0IXD1cUu17zXKZg`VQg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QVPkYjctu50Q)yCEUqC=dOi4mRSXf^(E;KGV0AE^8F*8GTZFOv6bZK^FQ*~`gctt}oMN&&sbT)QnV{~tFNqAFXNq9v?0AF8Xb8}yFbYXII0AE^8Q*=0KZ*yN_VRL0PNp5L$Lor2mKtM-KNkT(dSYI<PGyq>;Y-wU+Ut@E1UukY>bO3E-ZEbIMWk5hjOi4mRUotK-E;RsOUuSrDUvOn|b8l{8Y-x0PUv@A+KtotqK|)DiF)lLzUrAI=Uu0!+WoKz~bY*f>O+##NZe>(qVr*pqUsY~*X>Md+Qe|^>ZDl|}M?*tjGcGUyUter#Vq;%pb9G;4X>Mr%Us_XiGh=CPKtM-KNkT(dSYI<PGyq>;Y-wU+UvqR}a&%v9VQFqaKu1hTLPK9NE;24P0AF8cZEtR0b97;HbYEWpUrAI=Uvgz<X>)XCa#T%2Y;SI5RAFLlWdL7VPBAk>b!~NQVRUJBWm9!+Nq9v>F-3L&Us_I6bU0~mb6;X%b7eG1ZfSHxF-3MjKu1hTLPJ<sUo$Q=001s?d2MuIVgN34baHfIVgN34XmfOObYWruE@^IbWpZ!;E^cphWiCNNNiB3?X8<m4Z**lYXKr;aVs&Y3WG!iA04`^4buMUOb7%lAWO;6Ld2IkLWO;6LbaDVLXKr;ac4cyNX>V=-E@y6aE_P*db7^mGUvdC0a%F5`E@XLb04{Q6Y+){NY;*uFX>MtB04{KBbS`IabO0`NWq5P|E@o+NX#g&AZ)9O~VE`^=XkTV>VQpn!Xk>B#E@fz6W^!R|WdJT`V`E=scw=R7bYFB~Vr*pqE@^IQbYEd|a$$J@E@o+NX<uP-a$$J@E@XLbVQpz+04`)<bYTE4Vsmo<E@N+PZDnqB0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008vp<R0RR910ssI200000I066w00000I066w000008~^|S0000000000000000RR91000000000000000BLDyZ2LJ#70ssI200000R004100000R004100000AOHXW0000000000000001ONa4000000000000000F#rGn2LJ#70ssI200000bOHbX00000bOHbX00000Bme*a0000000000000001ONa4000000000000000L;wH)_W%EH0ssI200000m;wL*00000m;wL*00000C;$Ke000001poj5000002mk;8000000000000000P5=M^3jhEB0ssI200000zybgO00000zybgO00000Kmq^&000001^@s60RR912mk;8000007ytkO00000RsaA10{{R30ssI20000000jU50000000jU500000QUU+~0000000000000000RR91000000000000000UH||9|NsAQ0ssI200000QU?G400000QU?G400000FaQ7m000001poj5000000ssI2000000ssI200000YXATM{{R1P0ssI200000hz9@w00000hz9@w00000kN^Mx000001^@s60{{R32mk;8000000000000000dH?_b1ONa40ssI2000007zh9W000007zh9W00000H~|0v000001poj5000002mk;8000007ytkO00000ga7~l1ONa4LI3~&00000PzeA400000PzeA400000Pyqk{000001poj57XSbN2mk;8000007ytkO00000jsO4v0RR911^@s600000pb7v000000pb7v0000007XSbN0000000000000001ONa4000000000000000i2wiq0RR911^@s600000zzP5W00000zzP5W00000@Bjb+0000000000000005C8xG000005C8xG00000lmGw#0RR911^@s600000unPbH00000unPbH000002mk;80000000000000002mk;8000002mk;800000od5s;0RR911^@s600000zzYBX00000zzYBX00000vIYPE0000000000000005C8xG000000000000000qW}N^0RR911^@s600000bP@mn00000bP@mn000002><{90000000000000001ONa4000000000000000sQ>@~0RR910ssI200000fD!-z00000fD!-z000009smFU0000000000000001ONa4000000000000000u>b%70RR910ssI200000pb`K800000pb`K800000TmS$70000000000000001ONa4000000000000000zW@LL0RR910ssI200000022TJ00000022TJ0000000IC20000000000000002mk;8000000000000000$p8QV0RR910ssI20000002KfL0000002KfL00000EC2ui0000000000000000RR91000000000000000+W-In4gdfE0{{R300000ARQn800000ARPbz000005C8xG0000000000000002mk;8000002mk;800000=Kufz4*&oF0{{R300000FdZNO00000FdYB@000002mk;80000000000000002mk;8000002mk;800000^8f$<1^@s60{{R300000I2|AW00000I2`~0000005CQ-I000001^@s6000002mk;8000005C8xG00000m;e9(0RR910{{R300000NFN{o00000NFM+I00000xBvhE0000000000000002mk;8000002mk;800000`~Uy|0RR910{{R30000003aX$0000003ZMW000007ytkO0000000000000002mk;80000000000000000s#O32mk;80{{R300000Kp-Fh000007$5)u00000Kmq^&000000000000000KmY&$0000000000000002LS*80RR91FaQ7m0000000000000007$5)u00000DF6Tf0000000000000000RR91000000RR91000000RR910ssI200000000000000000000NFV?J00000SO@?B000008~^|SE&u=k2mk;8000007ytkO000002><{90{{R300000000000000000000peO(U00000VFdsH0000000000000000RR910000000000000005dZ)H0{{R3000000000000000000000WJUl000005CH%H0000000000000000RR91000000000000000"

exe_bin = base64.b85decode(exe_bin)

with open("./kyomu", 'wb') as f:
    f.write(exe_bin)

subprocess.run(["chmod +x ./kyomu"], shell=True)
subprocess.run(["./kyomu"], shell=True)

Submission status: Wrong Answer

Solution code:
n,*l=map(int,open(0).read().split())

# n = stdin.readline().rstrip().split()[0]
# A = [int(x) for x in stdin.readline().rstrip().split()]

print(int((sum(l)**2 - sum([a**2 for a in l])) / 2) % (10**9 + 7))

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int, input().split()))
c=0
d=sum(A)
for i in range(0,N-1):
    c-=A[i]
    c+=A[i]*d
    if(c>10**9+7):
        c%=(10**9+7)
print(c)

Submission status: Wrong Answer

Solution code:
import numpy as np

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

A = np.array(A)
MOD = 10**9 + 7

ruisekiwa = np.zeros(N, dtype='int')
for i in range(1, N):
    ruisekiwa[i] = ruisekiwa[i-1] + A[i]

res = 0
for i in range(N-1):
    # res += np.sum(np.mod(A[i] * A[i+1:], MOD))
    res += (ruisekiwa[N-1] - ruisekiwa[i]) * A[i]
    res = res % MOD
print(res % MOD)

# FIXME TLE

Submission status: Wrong Answer

Solution code:
N = int(input())
A = map(int, input().split())

ans = 0
mod = 10**9+7

S = sum(A)
S2 = sum(map(lambda x: x*x, A))

print((S*S-S2)//2 % mod)

Submission status: Wrong Answer

Solution code:

n = int(input())
item = [int(i) for i in input().split()]
mod = 10**9+7
ans = sum(item)**2/2 - sum([i**2/2 for i in item])
print(int(ans) % mod)

Submission status: Wrong Answer

Solution code:
from itertools import accumulate
mod = 1e9 +7
def main():
    n = int(input())
    a = list(map(int,input().split()))
    ans =0
    ac = list(accumulate(a))
    
    for i in range(n):
        ans += a[i]* (ac[-1]-ac[i])
        ans %=mod
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
mod = 1e9 + 7

n = int(input())
a = list(map(int, input().split()))
pref = [0 for x in range(n)]
pref[0] = a[0]
for i in range(1, n):
    pref[i] += ((pref[i - 1] + a[i]))

ans = 0
for i in range(n - 1, 0, -1):
    ans = (ans + a[i] * pref[i - 1]) % mod

print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))
s = 0
ans = 0
for i in range(len(a)):
  s += a[i]
for i in range(len(a)-1):
  s -= a[i]
  if s<0:
    s += 1e9+7
  ans += s*a[i]
  ans %= 1e9+7
print(int(ans))

Submission status: Wrong Answer

Solution code:
n = int(input())
A = list(map(int, input().split()))
ans = 0
sumA = sum(A)
for i in A:
    ans += i*((sumA-i)%(10**9+7))
ans = ans % (10**9+7)
print(int(ans/2))

Submission status: Wrong Answer

Solution code:
import numpy as np
N = int(input())
A = np.asarray(input().split()).astype(np.int)
 
ans = 0
mod = 10**9 + 7
for i in range(N):
    pA = (A[i] % mod) * (A[i+1:].sum() % mod)
    ans += pA
 
print(int(ans % mod))

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))

sum_sq_a = 0
for i in range(n):
    sum_sq_a += a[i]**2

ans = ((sum(a)) - sum_sq_a) // 2

print(ans % (10**9 + 7))

Submission status: Wrong Answer

Solution code:
import functools
from operator import mul
import itertools

n=int(input())
a=list(map(int,input().split()))
B=sum(a)

A=list(itertools.accumulate(a))

ans=0
for i in range(len(a)) :
    ans+=((a[i]%100000007)*((B-A[i])%1000000007))%100000007

print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))
s = 0
ans = 0
for i in range(len(a)):
  s += a[i]
for i in range(len(a)-1):
  s -= a[i]
  if s<0:
    s += 1e9+7
  ans += s*a[i]
  ans %= 1e9+7
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int, input().split()))
ans=0
for i in range(N):
    ans+=(sum(A)-A[i])*A[i]
print((ans/2)%(10**9+7))

Submission status: Wrong Answer

Solution code:
N = int(input())
a = list(map(int, input().split(" ")))
s = 0
for i in range(0,N):
  s += a[i]

s = s*s

for i in range(0,N):
  s -= a[i]*a[i]

while s >= 2*(10**9 +7):
  s = int(s % 2*(10**9 +7))
s = s/2
 
print(int(s))

Submission status: Wrong Answer

Solution code:
def solve():
  N = int(input())
  AA = list(map(int,input().split()))
 
  ans = 0
  for a in AA:
    ans += a
  ans = ans**2
  for a in AA:
    ans -= a**2
  ans = (ans+(10**9+7)**2//2) % (10**9+7)
  print(ans)
solve()

Submission status: Wrong Answer

Solution code:
n = int(input())
m = 1e9 + 7
a = list(map(int, input().split()))
s = sum(a)
s *= s
r = sum([x*x for x in a])
ans = (s - r) / 2
ans %= m
print(int(ans))

Submission status: Wrong Answer

Solution code:
import itertools

def mod(x):
  return x%((10**9)+7)
n=int(input())
a_list=list(map(int,input().split()))
sum_list=[]
for i in itertools.combinations(a_list,2):
  sum_list.append((i[0]*i[1]))
  
  
print(sum_list)
s=sum(sum_list)
s=mod(s)
print(s)

Submission status: Wrong Answer

Solution code:
from sys import stdin

n = stdin.readline().rstrip().split()[0]
A = [int(x) for x in stdin.readline().rstrip().split()]

print(int((sum(A)**2 - sum([a**2 for a in A])) / 2) % (10**9 + 7))

Submission status: Wrong Answer

Solution code:
N = int(input())
A = [int(x) for x in input().split()]

partial_sum = A.copy()
sum_now = A[N-1]
for j in range(N-2,-1,-1):
    sum_now = int((sum_now+A[j])%(1e9+7))
    partial_sum[j] = sum_now
res = 0
for i in range(N-1):
    res = (res + (A[i]*partial_sum[i+1])%(1e9+7)) %(1e9+7)
print(int(res))

Submission status: Wrong Answer

Solution code:
import numpy as np

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

A = np.array(A)
MOD = 10**9 + 7

ruisekiwa = np.zeros(N, dtype='int')
for i in range(1, N):
    ruisekiwa[i] = ruisekiwa[i-1] + A[i]

res = 0
for i in range(N-1):
    # res += np.sum(np.mod(A[i] * A[i+1:], MOD))
    res += (ruisekiwa[N-1] - ruisekiwa[i]) * A[i] % MOD
print(res % MOD)

# FIXME TLE

Submission status: Wrong Answer

Solution code:
import numpy as np

N = int(input())
A = [int(i) for i in input().rstrip().split()]
A = np.array(A)

B = np.array([])
for i in range(N):
  B = np.append(B, A[i]*np.sum(A[i+1:N]))

ans = np.sum(B) % (10**9+7)
print(int(ans))

Submission status: Wrong Answer

Solution code:
n = int(input())
m = 1e9 + 7
a = list(map(int, input().split()))
s = sum(a)
s *= s
r = sum([x*x for x in a])
ans = (s - r) / 2
ans %= m
print(ans)

Submission status: Wrong Answer

Solution code:
ans = 0
N = int(input())
array = list(map(int, input().split()))
x = sum(array)
for i in range(N):
    ans += array[i] * (x -array[i])
    ans = ans%(10**9+7) 
print(int(ans/2)%(10**9+7))

Submission status: Wrong Answer

Solution code:
n = int(input())
x = list(map(int, input().strip().split()))
sum=0
minsum=0
for i in range(0,n):
    minsum += x[i]
for i in range(0,n-1):
    minsum-=x[i]
    sum += x[i]*minsum
    print(sum)
    if(sum>10**9+7):
        sum%=(10**9+7)
print(sum)

Submission status: Wrong Answer

Solution code:
N = int(input())
a = list(map(int, input().split(" ")))
s = 0
for i in range(0,N):
  s += a[i]

s = s*s

for i in range(0,N):
  s -= a[i]*a[i]

while s >= 2*(10**9 +7):
  s = int(s % (10**9 +7))
s = s/2
 
print(int(s))

Submission status: Wrong Answer

Solution code:
import numpy as np

N = int(input())
A = list(map(int, input().split()))
A_array = np.array(A)

# i = j

Acum = np.sum(A_array) % (10**9 + 7)

temp = 0
for i in A:
    temp += (i*Acum - i**2) % ((10**9 + 7)*2)

print(int(temp/2) % (10**9 + 7))

Submission status: Wrong Answer

Solution code:

N = int(input())
li = list(map(int, input().split()))
MOD_NUMBER = 10**9+7
nizyo_list = [i**2 for i in li]
ans = int((sum(li)**2-sum(nizyo_list))/2)
print(ans % MOD_NUMBER)

Submission status: Wrong Answer

Solution code:
import numpy as np
 
N = int(input())
A = np.asarray(input().split()).astype(np.int)
 
ans = 0
for i in range(N):
    pA = A[i] * A[i+1:].sum()
    ans += pA
 
print(int(ans % (10e9+7)))

Submission status: Wrong Answer

Solution code:
S=list(str(input()))
T=list(str(input()))
ans=10000
for i in range(len(S)-len(T)+1):
    s=0
    for u in range(len(T)):
        if S[i+u]==T[u]:
            s+=1
            #print(s)
    s=len(T)-s
    ans=min(ans,s)
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int,input().split()))
h = sum(a)
ans = 0
for i in range(n):
  h -= a[i]
  ans += (a[i]*(h)%(10**9+7))
print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np
N = input()
A = input()

#
N = int(N)
part_A = A.split(" ")
int_A = [float(i) for i in part_A]

part_sum = [sum(int_A[i+1:N]) for i in range(len(int_A)-1)]

sum0 = np.dot(np.array(part_sum), np.array(int_A[:-1]))

MOD = 1000000007
print(int(sum0%MOD))

Submission status: Wrong Answer

Solution code:

N = int(input())
A = [int(x) for x in input().split()]
partial_sum = A.copy()
sum_now = A[N-1]
for j in range(N-2,-1,-1):
    sum_now = int((sum_now+A[j])%(1e9+7))
    partial_sum[j] = sum_now
res = 0
for i in range(N-1):
    res = (res + (A[i]*partial_sum[i+1]) %(1e9+7)) %(1e9+7)
print(int(res))

Submission status: Wrong Answer

Solution code:
n = int(input())
an = list(map(int, input().split()))
Ans = 0
l = [an[i]*sum(an[i+1:len(an)]) for i in range(len(an)-1)]
Ans = sum(l)
print(Ans)

Submission status: Wrong Answer

Solution code:
N=int(input())
A=list(map(int,input().split()))
ans = 0
last = 0

for i in range(N):
    ans += A[i]
last += sum(A)
last -= ans
last //= 2
print(last % 1000000007)

Submission status: Wrong Answer

Solution code:
from sys import stdin

n = stdin.readline().rstrip().split()[0]
A = [int(x) % (10 ** 9 + 7) for x in stdin.readline().rstrip().split()]

print(int((sum(A)**2 - sum([a**2 for a in A])) / 2) % (10**9 + 7))

Submission status: Wrong Answer

Solution code:
import numpy as np

N = int(input())
A = [int(i) for i in input().rstrip().split()]
A = np.array(A)
sum = 0

for i in range(N):
  sum += A[i]*np.sum(A[i+1:N])

ans = sum % (10**9+7)
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())

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

sigma = 0
after = sum(a[0:])
for i in range(len(a)-1):
  start = a[i]
  after = after - a[i]
  if after >= (10**9 + 7):
    after = after % (10**9+7)
  sigma = sigma + start * after
  if sigma >= (10**9 + 7):
    sigma = sigma % (10**9+7)

print(sigma)

Submission status: Wrong Answer

Solution code:
n = int(input())
l = list(map(int,input().split()))
mod=10**9+7
tot=sum(l)

ans=0
for i in range(n):
    ans+=l[i]*(tot-l[i])
    ans%=mod

print((ans//2)%mod)

Submission status: Wrong Answer

Solution code:
import numpy as np

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

A = np.array(A)
MOD = 10**9 + 7

res = 0
for i in range(N-1):
    # res += np.sum(np.mod(A[i] * A[i+1:], MOD))
    res += np.sum(A[i+1:]) * A[i] % MOD
print(res % MOD)

# FIXME TLE

Submission status: Wrong Answer

Solution code:
def sum_of_product_of_pair():
    n = int(input())
    A = list(map(int, input().split()))
    product = 0
    for i in range (n): 
        for j in range ( i+1,n): 
            product = product + A[i]*A[j] 
    return product
print(sum_of_product_of_pair())

Submission status: Wrong Answer

Solution code:
n = int(input())
li = [int(x) for x in input().split()]
li1 = li

s = 0

for i in range(len(li)-1):
  j = i+1
  for j in range(i+1,len(li)):
    print(li[i],li1[j])
    m = li[i]*li1[j]
    s = s+m
      
print(s)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = [int(x) for x in input().split()]
partial_sum = A.copy()
sum_now = A[N-1]
for j in range(N-2,-1,-1):
    sum_now = int((sum_now+A[j])%(1e9+7))
    partial_sum[j] = sum_now
res = 0
for i in range(N-1):
    res = (res + (A[i]*partial_sum[i+1]) %(1e9+7)) %(1e9+7)
print(int(res))

Submission status: Wrong Answer

Solution code:
def calc(A, N, i):
    ans = 0
    for i in range(i, N - 1):
        ai = A[i]
        aj = A[i + 1]
        ans += ai * aj
    return (ans)


def main():
    N = int(input())
    A = list(map(int, input().split()))
    mod_v = 10**9 + 7
    ans = [0] * (N + 1)
    for i in range(0, N - 1):
        if A[i] != 0:
            ans[i] = calc(A, N, i)
            break
    for j in range(i + 1, N - 1):
        if A[j] != 0:
            ans[j] = (ans[j - 1] - A[j - 1] * A[j]) // A[j - 1] * A[j]
        else:
            ans[j] = 0
    ret = 0
    for k in range(0, N):
        ret += ans[k]
    ret = ret % mod_v
    print(ret)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))
k = 0
num = sum(a)
import math

for i in range(n):
    reje = num - a[i]
    k += reje * num

x = math.floor(k / 2)
t = 10 ** 9 + 7
ans = x % t
print(ans)

Submission status: Wrong Answer

Solution code:
import itertools

N = int(input())

xlist = input().split(" ")
ylist = []

for num in xlist:
    ylist.append(int(num))


    """
pairs = itertools.combinations(ylist, 2)
answer = 0
for pair in pairs:
    answer += pair[0] * pair[1]

print(answer % (10**9 +7 ))"""


def findProductSum(A, n):
    # calculating array sum (a1 + a2 ... + an)
    array_sum = 0
    for i in range(0, n, 1):
        array_sum = array_sum + A[i]

        # calcualting square of array sum
    # (a1 + a2 + ... + an)^2
    array_sum_square = array_sum * array_sum

    # calcualting a1^2 + a2^2 + ... + an^2
    individual_square_sum = 0
    for i in range(0, n, 1):
        individual_square_sum += A[i] * A[i]

        # required sum is (array_sum_square -
    # individual_square_sum) / 2
    return (array_sum_square -
            individual_square_sum) / 2

print(int(findProductSum(ylist,N) %  (10**9 +7)))