Language: Java

//Compete against Yourself.
#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long
#define pb push_back
#define sz(i) (int)(i.size())
#define F first
#define S second
#define L long double
#define P pair<int, int>
const int inf = 0x3f3f3f3f3f3f3f3LL;
const int mod = (int)1e9 + 7;
using namespace std;
#if LOCAL
#include "../../tr.h"
#else
#define tr(...)
#define endl '\n'
#endif
template<class T> void smin(T& a, T val) {if (a > val) a = val;}template<class T> void smax(T& a, T val) {if (a < val) a = val;}
const int N = 5*(int)1e5 + 10;

int n, a[N], k;
int32_t main(){_

   cin>>n>>k;

   map<int, int> M;
   M[0]++;

   vector<int> pref;
   pref.push_back(0);
   for (int i = 1; i <= n; ++i)
   {
      cin>>a[i];
      pref.push_back(pref.back() + a[i]);
   }

   int sum = 0, ans = 0;
   for (int i = 1; i <= n; ++i)
   {
      sum = pref[i];
      int tt = (sum - i) % k;
      tt += k;
      tt %= k;
      ans += M[tt];
      M[tt]++;
      if(i-k+1 >= 0){
         int yy = pref[i-k+1] - (i-k+1);
         yy %= k;
         yy += k; 
         yy %= k;
         M[yy]--;
      }
   }
   
   cout<<ans;

   return 0;
}

Compiler output:
Main.java:2: error: illegal character: '#'
#include <bits/stdc++.h>
^
Main.java:2: error: class, interface, enum, or record expected
#include <bits/stdc++.h>
         ^
Main.java:3: error: illegal character: '#'
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
^
Main.java:3: error: class, interface, enum, or record expected
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
                                           ^
Main.java:3: error: class, interface, enum, or record expected
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
                                                         ^
Main.java:4: error: illegal character: '#'
#define int long long
^
Main.java:4: error: class, interface, enum, or record expected
#define int long long
        ^
Main.java:5: error: illegal character: '#'
#define pb push_back
^
Main.java:6: error: illegal character: '#'
#define sz(i) (int)(i.size())
^
Main.java:7: error: illegal character: '#'
#define F first
^
Main.java:8: error: illegal character: '#'
#define S second
^
Main.java:9: error: illegal character: '#'
#define L long double
^
Main.java:10: error: illegal character: '#'
#define P pair<int, int>
^
Main.java:12: error: class, interface, enum, or record expected
const int mod = (int)1e9 + 7;
^
Main.java:13: error: class, interface, enum, or record expected
using namespace std;
^
Main.java:14: error: illegal character: '#'
#if LOCAL
^
Main.java:15: error: illegal character: '#'
#include "../../tr.h"
^
Main.java:16: error: illegal character: '#'
#else
^
Main.java:17: error: illegal character: '#'
#define tr(...)
^
Main.java:18: error: illegal character: '#'
#define endl '\n'
^
Main.java:19: error: illegal character: '#'
#endif
^
Main.java:20: error: '{' expected
template<class T> void smin(T& a, T val) {if (a > val) a = val;}template<class T> void smax(T& a, T val) {if (a < val) a = val;}
                ^
Main.java:20: error: unnamed classes are a preview feature and are disabled by default.
template<class T> void smin(T& a, T val) {if (a > val) a = val;}template<class T> void smax(T& a, T val) {if (a < val) a = val;}
                  ^
  (use --enable-preview to enable unnamed classes)
Main.java:20: error: <identifier> expected
template<class T> void smin(T& a, T val) {if (a > val) a = val;}template<class T> void smax(T& a, T val) {if (a < val) a = val;}
                             ^
Main.java:20: error: class, interface, enum, or record expected
template<class T> void smin(T& a, T val) {if (a > val) a = val;}template<class T> void smax(T& a, T val) {if (a < val) a = val;}
                                                                ^
Main.java:20: error: '{' expected
template<class T> void smin(T& a, T val) {if (a > val) a = val;}template<class T> void smax(T& a, T val) {if (a < val) a = val;}
                                                                                ^
Main.java:20: error: <identifier> expected
template<class T> void smin(T& a, T val) {if (a > val) a = val;}template<class T> void smax(T& a, T val) {if (a < val) a = val;}
                                                                                             ^
Main.java:21: error: class, interface, enum, or record expected
const int N = 5*(int)1e5 + 10;
^
Main.java:23: error: class, interface, enum, or record expected
int n, a[N], k;
^
Main.java:24: error: as of release 9, '_' is a keyword, and may not be used as an identifier
int32_t main(){_
               ^
Main.java:26: error: not a statement
   cin>>n>>k;
         ^
Main.java:35: error: not a statement
      cin>>a[i];
         ^
Main.java:57: error: not a statement
   cout<<ans;
       ^
Main.java:26: error: ';' expected
   cin>>n>>k;
      ^
34 errors