Source Code
#include <bits/stdc++.h>
#include <chrono>
#include <random>
#define ll long long
#define ld long double
#define pb push_back
#define pii pair<int,int>
#define pll pair<long long,long long>
#define F first
#define S second
#define all(a) a.begin(),a.end()

using namespace std;

const ll Mod=1e9+7 ;

ll poww(ll a,ll b,ll mod){
    ll res=1;if(b<0)b=(b%(mod-1)+mod-1)%(mod-1);
    for(;b;b>>=1,a=1ll*a*a%mod)
      if(b&1)res=1ll*res*a%mod;
    return res;
}

void Max(ll& x,ll y){
x=max(x,y);
}
void Min(ll& x,ll y){
x=min(x,y);
}
void OK(bool yes){
    cout<<(yes?"Yes\n":"No\n");
}

const ll N=200500,M=2010,LN=(1<<24),K=17,Mx=4e6+50,inf=3e18,Mod1=1e9+7,Mod2=999997457;
const ld pi=acos(-1),eps=1e-12;

ll Fact[N];
void init(){
Fact[0]=1ll;
for(int i=1;i<N;i++)Fact[i]=(1ll*Fact[i-1]*i)%Mod;
}
int Cnk(ll x,ll y){
if(y > x)return 0;
return (  ((Fact[x]*poww(Fact[y],-1,Mod))%Mod)  *poww(Fact[x-y],-1,Mod))%Mod;
}


void Add(ll& x,ll y,int j=0){
ll mod=Mod;
if(j==1)mod=Mod1;
if(j==2)mod=Mod2;
x%=mod;
y%=mod;
if(x<0)x+=mod;
if(y<0)y+=mod;
x=(x+y>=mod?x+y-mod:x+y);
}
/*
void init(){
Fact[0]=iFact[0]=1ll;
for(int i=1;i<N;i++)Fact[i]=(Fact[i-1]*i)%Mod;
for(int i=1;i<N;i++)iFact[i]=(iFact[i-1]*poww(i,-1,Mod))%Mod;
}
*/

ll a[N];

int main()
{
    //ios::sync_with_stdio(0);
    //cin.tie(0);
    //cout.tie(0);

    mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

    //freopen("heinto.in","r",stdin);


    int T=1;
    int Case=1;
    //init();
    //cin>>T;
    while(T--){
        ll n,x,t;
        cin>>n>>x>>t;
        ll Sum=x;
        for(int i=1;i<=n;i++){
            cin>>a[i];
            Sum+=a[i];
        }
        t%=Sum;
        ll Ans=(t<=x);
        ll Pre=0;
        for(int i=1;i<=n;i++){
            Pre+=a[i];
            if(Pre<t&&Pre+x>=t)Ans++;
        }
        cout<<Ans<<'\n';
        //OK(ok);
    }

    return 0;
}
/*
6
2 1 4 2 2 4
6
4 1 1 2 1 2
8
3 1 1 2 1 2 1 2
*/

Copy
Treasure Wise-ard
GNU G++17
57 ms
2.4 MB
Accepted
Test Case #1
0 ms
364 KB
Accepted
Input
2 3 10
5 4
Output
1
Judge Output
1
Checker Message
"1"
Test Case #2
0 ms
416 KB
Accepted
Input
2 1 1
1 2
Output
1
Judge Output
1
Checker Message
"1"
Test Case #3
0 ms
528 KB
Accepted
Input
3 8 57
7 3 5
Output
2
Judge Output
2
Checker Message
"2"
Test Case #4
0 ms
628 KB
Accepted
Input
3 1000000000 1000000000000000000
1000000000 1000000000 1000000000
Output
1
Judge Output
1
Checker Message
"1"
Test Case #5
0 ms
632 KB
Accepted
Input
1 1 1
1
Output
1
Judge Output
1
Checker Message
"1"
Test Case #6
0 ms
708 KB
Accepted
Input
1 1000000000 1
1
Output
1
Judge Output
1
Checker Message
"1"
Test Case #7
0 ms
708 KB
Accepted
Input
1 1 1
1000000000
Output
1
Judge Output
1
Checker Message
"1"
Test Case #8
0 ms
712 KB
Accepted
Input
7 84 318122
2 90 24 32 87 54 61
Output
1
Judge Output
1
Checker Message
"1"
Test Case #9
0 ms
712 KB
Accepted
Input
7 84 318121
2 90 24 32 87 54 61
Output
1
Judge Output
1
Checker Message
"1"
Test Case #10
0 ms
724 KB
Accepted
Input
7 84 318123
2 90 24 32 87 54 61
Output
1
Judge Output
1
Checker Message
"1"
Test Case #11
0 ms
724 KB
Accepted
Input
10 5 200
2 7 8 3 8 4 8 5 7 10
Output
1
Judge Output
1
Checker Message
"1"
Test Case #12
0 ms
732 KB
Accepted
Input
15 5 200
7 7 4 2 1 2 6 2 6 6 10 6 8 5 9
Output
1
Judge Output
1
Checker Message
"1"
Test Case #13
0 ms
736 KB
Accepted
Input
20 5 200
5 2 9 6 1 3 8 9 8 8 10 2 7 3 10 1 2 3 5 9
Output
1
Judge Output
1
Checker Message
"1"
Test Case #14
0 ms
760 KB
Accepted
Input
25 5 200
6 3 10 1 6 1 9 6 3 6 4 5 10 2 3 5 7 7 1 4 7 1 8 6 10
Output
1
Judge Output
1
Checker Message
"1"
Test Case #15
0 ms
736 KB
Accepted
Input
100 26 189712
1633 9 3 26 15 19 645 698 1704 877 977 681 21 1016 20 930 15 2 12 1703 15 1555 424 13 4 1448 21 16 619 930 1446 23 27 22 10 1122 1534 14 23 16 17 15 313 26 291 548 19 1505 22 23 20 436 3 1563 9 4 997 3 1600 1197 24 16 2 438 1319 5 628 ...
Output
0
Judge Output
0
Checker Message
"0"
Test Case #16
0 ms
744 KB
Accepted
Input
100 27618 189712
10 1205 14 818 11 1557 337 1391 834 26 3 17 458 11 1454 341 1450 1222 1719 558 27 2 1693 398 17 20 654 1349 11 562 1759 17 22 21 24 1589 1003 13 553 836 1511 570 24 467 5 1174 1143 18 1334 15 18 1032 9 4 1526 949 11 1306 688 10 722...
Output
36
Judge Output
36
Checker Message
"36"
Test Case #17
0 ms
740 KB
Accepted
Input
100 300 189712
13 2 1302 15 22 1185 9 6 1078 17 372 1535 1123 1205 6 1505 393 14 12 1410 7 25 18 25 25 1526 7 1004 17 1247 992 8 24 19 26 617 1043 11 6 17 3 1004 1397 1061 22 2 1299 27 15 13 5 1070 1187 572 19 5 27 4 26 630 733 1121 9 22 12 1226 829...
Output
0
Judge Output
0
Checker Message
"0"
Test Case #18
0 ms
764 KB
Accepted
Input
1000 8716817 1962491726412
4864 2916 16113 18385 41780310 32587783 13798 59259103 7374 14085 42321132 33302595 6552 34019331 23852058 40525874 14440 9859 26281984 59034082 11397 17874 63851243 18755 5815 6481 30603657 27474099 17561 3327 28807880 30...
Output
0
Judge Output
0
Checker Message
"0"
Test Case #19
0 ms
768 KB
Accepted
Input
1000 8716817 1962491726412
8887 7055 14211 12907 17626 9192 11752 10935 3946 9653 17313 12978 6406 17721 13924 10182 6505 18871 3444 2449 8990 14271 5283 10563 5186 3654 5434 7060 16732 4836 17288 15673 8114 2286 15317 12629 4010 9282 17707 11417 16...
Output
0
Judge Output
0
Checker Message
"0"
Test Case #20
0 ms
740 KB
Accepted
Input
1000 3 1962491726412
4128 2278 3561 15559 18469 2588 16230 9097 5111 13015 13867 3520 18845 13899 8346 4325 4301 6128 17095 15594 3979 7986 13004 9076 4215 4718 5850 13772 6429 12858 15126 11857 16935 16055 4765 4290 16440 13096 8344 4686 9069 4325 ...
Output
0
Judge Output
0
Checker Message
"0"
Test Case #21
0 ms
752 KB
Accepted
Input
1000 151287198 1962491726412
30590314 28115172 36831182 44999841 6746 67683743 47547029 23014422 54109183 59724539 74416685 64850567 42203148 46396520 41763302 27999880 61582915 15277 22602258 66806933 71309262 32017820 70750120 52768281 44048459 61...
Output
2
Judge Output
2
Checker Message
"2"
Test Case #22
18 ms
2.3 MB
Accepted
Input
200000 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...
Output
1
Judge Output
1
Checker Message
"1"
Test Case #23
57 ms
2.3 MB
Accepted
Input
200000 1000000000 1000000000000000000
1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 10...
Output
1
Judge Output
1
Checker Message
"1"
Test Case #24
53 ms
2.4 MB
Accepted
Input
200000 1 1000000000000000000
1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 ...
Output
0
Judge Output
0
Checker Message
"0"
Test Case #25
18 ms
2.3 MB
Accepted
Input
200000 1 1000000000000000000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...
Output
1
Judge Output
1
Checker Message
"1"
Test Case #26
51 ms
2.3 MB
Accepted
Input
200000 192846124 1000000000000000000
753224959 810410822 830611479 359184490 52882215 266165309 931278870 754027604 463124113 57773859 176998797 293262604 47420845 398884386 30441303 504165058 65069398 965810778 914989902 287357179 662984067 4625247...
Output
1
Judge Output
1
Checker Message
"1"
Test Case #27
35 ms
2.3 MB
Accepted
Input
200000 126318726 1827468129764812
9157 16715 5738 18502 6787 10150 13929 11088 13811 18531 3321 11685 16414 15206 4912 5161 4108 14078 7942 7772 10658 17145 8792 4885 6109 17692 5089 86583665 10111 11862 12846 17368 7614 10052 43728737 13024 14980 1...
Output
56
Judge Output
56
Checker Message
"56"
Test Case #28
35 ms
2.3 MB
Accepted
Input
200000 126318723 1827468129764817
12430 17592 18004 5132 6463 11426 13205 16706 10325 4861 17349 17920 12594 17534 8686 4944 18302 8691 4167 14999 18306 9707 4783 14006 2898 9980 6383 16298 18053 11075 13543 16206 61670886 78442264 15710 68723432 81...
Output
5
Judge Output
5
Checker Message
"5"
Test Case #29
41 ms
2.3 MB
Accepted
Input
200000 126318722 1827468129764818
5600 15776 84325608 88577828 60525924 51645756 7744 18337 46505875 68249360 4145 3038 71340160 87274103 94662303 56856540 56879459 47878122 12217 58980764 50455636 5642 10790 4174 15240 3311 10924 63711434 14280 126...
Output
8
Judge Output
8
Checker Message
"8"
Test Case #30
46 ms
2.3 MB
Accepted
Input
200000 23564234 74859535048914
17823581 17823581 17823581 17823581 17823581 17823581 17823581 17823581 17823581 17823581 17823581 17823581 17823581 17823581 17823581 17823581 17823581 17823581 17823581 17823581 17823581 17823581 17823581 17823581 17...
Output
1
Judge Output
1
Checker Message
"1"
Test Case #31
23 ms
1.6 MB
Accepted
Input
118764 82154 1825476124
143 1242077 1766347 3796709 2522225 2667377 3952330 2446477 3493679 3800562 775310 158 3362657 3282557 3482113 156 136 4050448 2208071 3085159 3806914 2929829 3845321 4109098 1109011 3230541 3145788 1373272 2307713 2525442 25...
Output
0
Judge Output
0
Checker Message
"0"
Test Case #32
23 ms
1.7 MB
Accepted
Input
118764 822154 1825476124
1737932 1581040 1638153 2608622 766562 1795299 165 2732523 3996436 3584705 2512035 2975305 764895 2692505 138 1633603 2633278 2659824 2670044 850528 1612510 4098039 143 2974947 3967106 1455717 2045446 2002238 861407 1739921 ...
Output
0
Judge Output
0
Checker Message
"0"
Test Case #33
24 ms
1.7 MB
Accepted
Input
118764 8211254 1825476124
1524141 2114630 1419914 124 3031877 1765975 2584656 897446 2443058 1935348 993290 2710881 1217160 1351537 3667908 3700356 1860885 3221993 3272389 1019384 3602814 1861589 164 165 3324383 153 3214124 158 3577483 3078259 124 1...
Output
3
Judge Output
3
Checker Message
"3"
Test Case #34
23 ms
1.7 MB
Accepted
Input
118764 82141254 1825476124
2512672 777185 3080553 776687 2130121 139 3042718 1959968 3875838 136 3012805 1127438 1391156 2433711 129 3379981 3453563 2687732 1313621 145 2963993 2490436 1582768 130 1883495 3646020 2911749 2746674 165 3532059 905746 1...
Output
44
Judge Output
44
Checker Message
"44"
Test Case #35
18 ms
2.3 MB
Accepted
Input
200000 1000000000 721864871264782
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...
Output
200001
Judge Output
200001
Checker Message
"200001"
Test Case #36
30 ms
2.3 MB
Accepted
Input
200000 2147621 721864871264782
12798 12780 246 12822 418 435 223 12791 471 12775 197 12876 12806 12862 30 340 214 407 12831 292 12816 12848 12803 542 12855 260 12801 12770 647 12798 271 12774 12825 245 12839 164 654 226 12814 12800 685 12806 12818 1...
Output
324
Judge Output
324
Checker Message
"324"
Test Case #37
30 ms
2.3 MB
Accepted
Input
200000 21476231 721864871264782
12773 707 577 540 12821 12822 535 12820 629 12837 491 322 545 580 561 12829 12832 358 12789 12843 582 12827 12841 12825 692 12864 215 12825 511 12850 324 12835 410 517 12827 12813 12808 12798 514 449 325 426 12842 128...
Output
3137
Judge Output
3137
Checker Message
"3137"
Test Case #38
26 ms
2.3 MB
Accepted
Input
200000 21476231 721864871264782
497 439 311 428 655 571 677 426 490 112 25 201 577 182 583 282 598 362 65 12801 442 41 618 143 155 519 352 477 80 207 358 231 547 188 336 174 480 184 498 306 541 404 266 469 651 12857 620 373 444 683 47 131 308 12844 ...
Output
137
Judge Output
137
Checker Message
"137"