akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <array>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>

// MARK: - header
namespace {
using namespace std;
using ll = long long;
using ull = unsigned long long;
template<ull MOD>
struct Mod {
    ull v = 0;
    Mod() {};
    Mod(ull val) : v(val) {}
    operator ull() const {return v;}
    ull operator=(ll x) {return v = x % MOD;}
    ull operator+=(ll x) {return operator=(v + x);}
    ull operator*=(ll x) {return operator=(v * x);}
};
}

// MARK: - answer

vector<ll> menu;

void input() {
    menu.resize(5);
    for (auto& m : menu)
        cin >> m;
}

void solve() {
    ll time = 0;
    ll min1 = 10;
    for (auto m : menu) {
        time += ceil(double(m)/10);
        ll cm1 = m%10;
        if (cm1 == 0)
            cm1 = 10;
        min1 = min(min1, cm1);
    }
    cout << (time * 10) - 10 + min1 << endl;;
}

int main() {
    input();
//    cout << solve() << endl;
    solve();
    
    return 0;
}



Measured memory_bytes: 256
n = int(input())

mod = 998244353

d = [int(i) for i in input().split()]

if d[0] != 0:
    print(0)
    exit()

del d[0]

d.sort()

if d[0] != 1:
    print(0)
    exit()

ans = 0
li = []
tmp = d[0]
cnt = 1
#print(d,len(d))

for i in range(len(d)-1):
    #print(i)
    if tmp == d[i+1]:
        cnt += 1
    else:
        li.append(cnt)
        tmp += 1
        if i+1 == len(d)-1:
            cnt = 1
            if d[i+1] != tmp:
                print(0)
                exit()
            break
        else:
            if d[i+1] != tmp:
                print(0)
                exit()
        cnt = 1

li.append(cnt)

ans = 1

for i in range(len(li)-1):
    ans = ans * li[i] ** li[i+1]
    ans %= mod

print(ans)

Measured memory_bytes: 56428
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;
import java.io.IOException;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        while (true){
            final int times = Integer.parseInt(br.readLine());
            if (times == 0) { break; }
            
            Map<String, Long> data = new LinkedHashMap<>();
            for (int i=1; i <= times; i++) {
                String[] e = br.readLine().split(" ");
                data.merge(e[0], Long.parseLong(e[1]) * Long.parseLong(e[2]), Long::sum);
            }
            
            long count = data.entrySet().stream()
                .filter(e -> e.getValue() >= 1_000_000)
                .peek(e -> System.out.println(e.getKey()))
                .count();
            if (count == 0) { System.out.println("NA"); }
        }
    }
}

Measured memory_bytes: 31968
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vs = vector<string>;
using pll = pair<ll, ll>;
using vp = vector<pll>;
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, a, b) for (ll i = (a); i < (b); i++)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((int)(x).size())
#define PRINT(V) for (auto v:(V)) {cerr << v << " ";} cerr << endl
#define dump(x) cerr << #x << " : " << (x) << endl
#define dump2(x, y) cerr << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")" << endl
inline ll GCD(ll a, ll b){return b ? GCD(b, a % b) : a;}
const ll MOD = 1000000007;
const ll INF = 100000000000000000LL;
/* END OF TEMPLATE */

int main(){
    cin.tie(0); ios::sync_with_stdio(false);
    ll n;
    cin >> n;
    vp t(n);
    rep(i, n){
        ll a, b;
        cin >> a >> b;
        t[i] = make_pair(b, a);
    }
    sort(ALL(t));
    ll sumtime = 0;
    rep(i, n){
        sumtime += t[i].second;
        if(sumtime > t[i].first){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 3456
// D.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

#include <iostream>
#include<vector>
using ll = long long;
using namespace std;

int main()
{
    int k;
    cin >> k;
    vector<ll>a;
    for (int i = 1; i <= 9; i++)a.push_back(i);
    while (1) {
        if (k <= a.size()) {
            cout << a[k - 1] << endl;
            return 0;
        }
        k -= a.size();
        vector<ll>old;
        swap(a, old);
        for (ll x : old) {
            for (int i = -1; i <= 1; i++) {
                int d = x % 10 + i;
                if (d < 0 || d>9)continue;
                ll nx = x * 10 + d;
                a.push_back(nx);
            }
        }
    }
    return 0;
}



Measured memory_bytes: 4540
#include <algorithm>
#include <iostream>
#include <string>
using namespace std;
#define PI 3.14159265359
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
  int N;
  cin >> N;
  cout << (N + 1) * N / 2 << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, s, n) for (int i = s; i < n; i++)
#define rp(i,n) for (int i=0;i<n;i++)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define all_acc(x) (x).begin(), (x).end(), 0LL
#define int long long
#define absSort(v) sort(a.begin(), a.end(), [](int i, int j) -> bool { return abs(i) < abs(j); });
using namespace std;
using P = pair<int, int>;
using Graph = vector<vector<int>>;
using ll = long long;
double pi=3.14159265359;

template <class T, class U>
void chmin(T& t, const U& u) {
    if (t > u) t = u;
}
template <class T, class U>
void chmax(T& t, const U& u) {
    if (t < u) t = u;
}

//出力するよ
void output_tate(vector<int> s){
    int n = s.size();
    for (int i = 0; i < n; i++){
        //if (i != 0)
        //    cout << " ";
        cout << s[i]<<endl;
    }
    //cout << endl;
}

void output_yoko(vector<int> s){
    int n = s.size();
    for (int i = 0; i < n; i++){
        if (i != 0)
            cout << " ";
        cout << s[i];//<<endl;
    }
    cout << endl;
}


signed main() {
    int n,x,t; cin>>n>>x>>t;

    int r = n % x;
    int num = n / x;
    if(r==0) cout<<(num*t)<<endl;
    else cout<<((num+1)*t)<<endl;
}


Measured memory_bytes: 3620
function main(input: string) {
  const X = parseInt(input);
  if (X >= 2000) { // 2000円以上はどうやったってできる
    console.log(1);
    return;
  }
  const num = Math.floor(X / 100); // 個数は上2桁に依存
  const hasuu = X - num * 100; // 端数
  console.log(hasuu / 5 <= num ? 1 : 0);
}

main(
  require("fs")
    .readFileSync("/dev/stdin", "utf8")
    .trim()
);


Measured memory_bytes: 7372
#include<bits/stdc++.h>
using namespace std;

int main()
{
  int k, n;
  cin >> k >> n;
  int a[n];
  for(int i = 0; i < n; i++)
  {
    cin >> a[i];
  }
  long long dist = a[n - 1] - a[0];
  for(int i = 1; i < n - 1; i++)
  {
    dist = min(dist, min((long long) a[i] + k - a[i + 1],(long long) k - a[i] + a[i - 1]));
  }
  cout << dist;
  
  return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <string.h>
#include <cstring>
#include <math.h>
#include <algorithm>
#include <functional>
#include <stack>
#include <queue>
#include <vector>
#include <map>
using namespace std;

#define cio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define ll long long
#define ii pair < int, int >
#define iii pair < int, ii >
#define INF 987654321
#define LINF 987654321987654321

ll ar[10000005];

int main()
{
	cio;
    ll x;
	ll n;
    vector<bool> v(101);
	cin >> x >> n;
    for (int i = 0; i < n; ++i) {
        int p; cin >> p;
        v[p] = true;
    }

    int i=x,j=x;
    while(v[i]) {
        i++;
    }
    while(v[j]) {
        j--;
    }

    cout << ((i - x) < (x - j) ? i : j) << endl;

}


Measured memory_bytes: 3124
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<string>
#include<iostream>
#include<cctype>
#include<cstdio>
#include<vector>
#include<stack>
#include<queue>
#include <algorithm>
#include<math.h>
#include<set>
#include<map>
#include<iomanip>

//#include<bits/stdc++.h>

using namespace std;

bool f[100005];
int main() {
	
	int n;
	cin >> n;
	int t = 0;
	vector<int>y;
	int r = 0;
	for (int i = 0; i < n; i++) {
		int x;
		cin >> x;
		y.push_back(x);
	}
	f[0] = 1;
	while (1) {
		r++;
		if (r >= n) {
			cout << -1 << endl; return 0;
		}
		int x;
		x = y[t];
		x--;
		if (f[x]) {
			cout << -1 << endl;
			return 0;
		}
		if (x == 1) {
			cout << r << endl;
			return 0;
		}
		t = x;
		//cout << t;
	}
	return 0;
	
}


Measured memory_bytes: 892
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using PII = pair<int, int>;
using VI = vector<int>;

int main() {
#ifdef LOCAL_EXEC
//	freopen("sample.in", "r", stdin);
//	freopen("sample.out", "w", stdout);
#else
  ios_base::sync_with_stdio(false); cin.tie(NULL);
#endif

  int n; cin >> n;
  string s; cin >> s;
  map<char, int> f;
  for (char c: s) f[c]++;
  ll ans = f['R'] * 1ll * f['B'] * 1ll * f['G'];

  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      if (s[i] == s[j]) continue;
      int d = j - i;
      int k = j + d;
      if (k < n && s[k] != s[i] && s[k] != s[j]) {
        ans--;
      }
    }
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3656
//Coded by Abhijay Mitra
#include <iostream>
#include <stdlib.h>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <numeric>
#include <vector>
#include <iterator> 
#include <map>
#include <set>
#include <climits>
#include <queue>
#include <cmath>
#include <stack>
#include <cctype>
#include <bitset>
// #include <bits/stdc++.h>
#define double long double
#define int long long int
#define ll int
#define ibs ios_base::sync_with_stdio(false)
#define cti cin.tie(0)
#define bp __builtin_popcount
#define pb push_back
#define res(v) v.resize(unique(v.begin(), v.end()) - v.begin());
#define cnt_res(v) std::distance(v.begin(),std::unique(v.begin(), v.end())); 
#define timer cerr << "Time elapsed : " << 1.0 * clock() / CLOCKS_PER_SEC << " sec \n";
using vi = std::vector<int>;
using vvi = std::vector<vi>;
using pii = std::pair<int,int>;
using vpii = std::vector<pii>;
using vvpii = std::vector<vpii>;
#define mp         make_pair
#define rep(i,a,b) for (int i = a; i <= b; i++)
#define per(i,b,a) for (int i = b; i >= a; i--)
#define all(x)     x.begin(), x.end()
using namespace std;
const int N=2e6+10;
const int inf = /*0x3f3f3f3f*/1e18+10;
// const ll M = 998244353 ; // Mulo
// const int M = 1e9+7 ; // Mulo
const double Pi = 3.14159265;
#define F first
#define S second
void solve(){
    int n,m;cin>>n>>m;
    rep(i,0,3000)
        rep(j,0,3000)
            if(i+j==n and 2*i+4*j==m){cout<<"Yes";return;}
    cout<<"No";
}
int32_t main()
{
  ibs;cti;
  solve()
  /*,cout<<"\n"*/;
  // cout<<"\n";
  int xx=0;
  // int t;cin>>t;while(t--){/*xx++;cout<<"Case "<<xx<<":\n"*/;solve();cout<<"\n";}
  return 0;
}

Measured memory_bytes: 3608
#!/usr/bin/env python3

N = int(input().split()[0])
T, A = list(map(int, input().split()))
h_list = list(map(int, input().split()))
min_diff = float("inf")
target = -1

for i, h in enumerate(h_list):
    m = T - h * 0.006
    if abs(m - A) < min_diff:
        target = i + 1
        min_diff = abs(m - A)

ans = target
print(ans)


Measured memory_bytes: 3060
func readInts() -> [Int]{
    return readLine()!.split(separator: " ").map{Int($0)!};
}
let a = readInts();
let N = a[0];
let D = a[1];
print(N / (2 * D + 1) + (N % (2 * D + 1) + 2 * D) / (2 * D + 1))

Measured memory_bytes: 8256
import sys
n=int(input())
a=[int(i) for i in sys.stdin]
a.sort()
stack=a[0]
num=1
ans=0
for i in range(1,n):
  if a[i]==stack:
    num+=1
  else:
    if num%2==1:
      ans+=1
    stack=a[i]
    num=1
if num%2==1:
  ans+=1
print(ans)

Measured memory_bytes: 7380
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T, class C> void chmax(T& a, C b){ a>b?:a=b; }
template<class T, class C> void chmin(T& a, C b){ a<b?:a=b; }
int main(){
  ll N; cin>>N;
  priority_queue<ll> R;
  priority_queue<ll, vector<ll>, greater<ll>> W;
  for( ll i=0; i<N; i++ ){
    char c; cin>>c;
    if(c=='R') R.push(i);
    else if(c=='W') W.push(i);
  }
  if(R.size() == 0 || W.size() == 0){
    cout<<"0"<<endl;
    return 0;
  }
  ll cnt=0;
  while(1){
    ll r=R.top();
    ll w=W.top();
    if(r>w){
      R.pop();
      W.pop();
      R.push(w);
      W.push(r);
      cnt++;
    }else{
      break;
    }
  }
  cout<<cnt<<endl;
}

Measured memory_bytes: 5488
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <numeric>
#include <regex>
using namespace std;

typedef long long ll;
#define modulo 1000000007 // 10^9 + 7
#define MAX 1000000000 // 10^9

int div2(int n) {
	int result = 0;
	while (n % 2 == 0) {
		n /= 2;
		result++;
	}

	return result;
}

int main() {
	int N; cin >> N;
	int ans = 0;
	for (int i = 0; i < N; i++) {
		int tmp;
		cin >> tmp;
		ans += div2(tmp);
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
//  Created by conan1024hao on 2019/11/19.
//  Copyright © 2019 conan1024hao. All rights reserved.
//  専用ライブラリです、自由にコピーして構いません。
//  感谢看我的代码！Wechat:conan1024hao QQ:810396815
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll>P;
#define INF 10e16
#define MOD 1000000007
#define rep(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define fi first
#define se second
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define PI acos(-1.0)
long long GCD(long long a, long long b) { return b ? GCD(b, a%b) : a; }
long long LCM(long long a, long long b)  {return a/GCD(a,b)*b;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
ll cmp(pair<ll,string>a,pair<ll,string> b){
        if(a.fi!=b.fi)
        return a.fi<b.fi;
        else
        return a.se<b.se;
}
//---------------------------------------------------------------------------

//---------------------------------------------------------------------------
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------
    string s;
    cin>>s;
    int cnt=0;
    int ans=-1;
    for(int i=0;i<s.length();i++){
        if(s[i]=='A'||s[i]=='T'||s[i]=='G'||s[i]=='C')
        {cnt++;
            }
        else{
            chmax(ans,cnt);
            cnt=0;
        }
    }
    chmax(ans,cnt);
    cout<<ans<<endl;
    //-------------------------------
    return 0;
}
//---------------------------------------------------------------------------


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int n,m;
int a[51],b[51];
int c[51],d[51];
int ans[51];

int main(void){
	scanf("%d %d",&n,&m);
	for(int i=0;i<n;i++){
		scanf("%d%d",&a[i],&b[i]);
	}
	for(int i=0;i<m;i++){
		scanf("%d%d",&c[i],&d[i]);
	}
	for(int i=0;i<n;i++){
		for(int j=1;j<m;j++){
			int di=abs(a[i]-c[ans[i]])+abs(b[i]-d[ans[i]]);
			int di2=abs(a[i]-c[j])+abs(b[i]-d[j]);
			if(di>di2){
				ans[i]=j;
			}
		}
	}
	for(int i=0;i<n;i++){
		printf("%d\n",ans[i]+1);
	}
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;

class ABC121_D
{
    static void Main(string[] args)
    {
        string[] input = Console.ReadLine().Split(' ');
        long A = long.Parse(input[0]);
        long B = long.Parse(input[1]);

        if(A==B)
        {
            Console.WriteLine(A);
            return;
        }

        long[] A2 = BitCountXOR(A-1);
        long[] B2 = BitCountXOR(B);

        long sum = 0;
        long exponential = 1;
        for (int i = 0; i < B2.Length; i++)
        {
            long a = i < A2.Length ? A2[i] : 0;
            long b = B2[i];

            if ((a+b) % 2 == 1)
            {
                sum += exponential;
            }
            exponential *= 2;
        }

        Console.WriteLine(sum);
    }

    static long[] BitCountXOR(long num)
    {
        List<long> digit = new List<long>();

        long quotient = num + 1;
        long exponential = 1;
        while (num > exponential/2)
        {
            long q = quotient / (exponential*2);
            long r = quotient % (exponential*2);
            long bit = r >= exponential ? r - exponential : 0;
            bit += q * exponential;
            exponential *= 2;
            digit.Add(bit);
        }

        return digit.ToArray();
    }
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;

char c[1001][1001];
int d[1001][1001];
int dx[]={-1,1,0,0};
int dy[]={0,0,-1,1};

int main() {
	 #ifndef ONLINE_JUDGE
    freopen("D:\\Codings\\CPP\\input.in", "r", stdin);
    freopen("D:\\Codings\\CPP\\output.in", "w", stdout);
    #endif
    
    int n,m,s1,s2,e1,e2;
	scanf("%d%d%d%d%d%d",&n,&m,&e1,&e2,&s1,&s2);
	s1--,s2--,e1--,e2--;
	for(int i=0; i<n; i++) scanf("%s",c[i]);

	queue<int> q, que;
	
	memset(d,-1,sizeof(d));
	que.push(s1); que.push(s2);
	q.push(s1); q.push(s2);
	d[s1][s2]=0;

	while (!q.empty() || !que.empty()) {
		if(!que.empty()) {
			while (!que.empty()) {
				int x=que.front(); que.pop();
				int y=que.front(); que.pop();
				for(int i=0; i<4; i++) {
					int nx2=dx[i]+x;
					int ny2=dy[i]+y;
					if (nx2<0 || nx2>=n || ny2<0 || ny2>=m || c[nx2][ny2]=='#') continue;
					if (d[nx2][ny2]==-1||d[nx2][ny2]>d[x][y]) {
						d[nx2][ny2]=d[x][y];
						que.push(nx2); que.push(ny2);
						q.push(nx2); q.push(ny2);
					}
				}
			}
		}
		else {
			int x=q.front(); q.pop();
			int y=q.front(); q.pop();
			for(int i=x-2; i<x+3; i++) {
				for(int j=y-2; j<y+3; j++) {
					if (i<0 || i>=n || j<0 || j>=m || (i==x && j==y) || c[i][j]=='#') continue;
					if (d[i][j]==-1||d[i][j]>d[x][y]+1) {
						d[i][j]=d[x][y]+1;
						que.push(i); que.push(j);
						q.push(i); q.push(j);
					}
				}
			}
		}
	}
	printf("%d\n", d[e1][e2]);
	return 0;
}


Measured memory_bytes: 8644
import sys
input = sys.stdin.readline


class UnionFind():
    def __init__(self, n):
        self.par = [-1] * n

    def root(self, x):
        if self.par[x] < 0:
            return x
        else:
            self.par[x] = self.root(self.par[x])  # contraction
            return self.par[x]

    def unite(self, x, y):
        x, y = self.root(x), self.root(y)
        if x != y:
            if self.par[x] > self.par[y]:  # merge technique
                x, y = y, x
            self.par[x] += self.par[y]
            self.par[y] = x

    def same(self, x, y):
        return self.root(x) == self.root(y)

    def size(self, x):
        return -self.par[self.root(x)]


def compress_coordinate(x: list, key=None, reverse=False):
    zipped = {}
    unzipped = {}
    for i, xi in enumerate(sorted(set(x), key=key, reverse=reverse)):
        zipped[xi] = i
        unzipped[i] = xi
    return zipped, unzipped


n, m = map(int, input().split())
line_v = [tuple(map(int, input().split())) for _ in range(n)]
line_h = [tuple(map(int, input().split())) for _ in range(m)]

INF = 10**9 + 10
x_list = [-INF, 0, INF]
y_list = [-INF, 0, INF]
for x1, x2, y in line_v:
    # abc
    x_list.append(x1)
    x_list.append(x2)
    y_list.append(y)
for x, y1, y2 in line_h:
    # def
    x_list.append(x)
    y_list.append(y1)
    y_list.append(y2)

x_zipped, x_unzipped = compress_coordinate(x_list)
y_zipped, y_unzipped = compress_coordinate(y_list)

nx = len(x_zipped)
ny = len(y_zipped)

v_ng = [[0] * (ny + 1) for _ in range(nx + 1)]
h_ng = [[0] * (ny + 1) for _ in range(nx + 1)]
for x1, x2, y in line_v:
    x1 = x_zipped[x1]
    x2 = x_zipped[x2]
    y = y_zipped[y]
    v_ng[x1][y] += 1
    v_ng[x2][y] -= 1
for x, y1, y2 in line_h:
    x = x_zipped[x]
    y1 = y_zipped[y1]
    y2 = y_zipped[y2]
    h_ng[x][y1] += 1
    h_ng[x][y2] -= 1

for x in range(nx):
    for y in range(ny):
        v_ng[x + 1][y] += v_ng[x][y]
        h_ng[x][y + 1] += h_ng[x][y]

# print(nx, ny)
uf = UnionFind(nx * ny)
for x in range(nx):
    for y in range(ny):
        c0 = x * ny + y
        # print(x, y, c0)
        if y + 1 < ny and v_ng[x][y + 1] == 0:
            c1 = x * ny + (y + 1)
            uf.unite(c0, c1)
        if x + 1 < nx and h_ng[x + 1][y] == 0:
            c2 = (x + 1) * ny + y
            uf.unite(c0, c2)

c_start = x_zipped[0] * ny + y_zipped[0]
if uf.same(c_start, 0):
    ans = 'INF'
else:
    ans = 0
    for x in range(nx):
        for y in range(ny):
            if uf.same(c_start, x * ny + y):
                ans += (x_unzipped[x + 1] -
                        x_unzipped[x]) * (y_unzipped[y + 1] - y_unzipped[y])

print(ans)


Measured memory_bytes: 535320
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;

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

    int d,n;
    cin >> d >> n;

    if(n == 100){
        if(d == 0){
        cout << n + 1 << endl;
        }
        if(d == 1){
            cout << (n + 1) * 100 << endl;
        }
        if(d == 2){
            cout << (n + 1) * 10000 << endl;
        }
        return 0;
    }

    if(d == 0){
        cout << n << endl;
    }
    if(d == 1){
        cout << n * 100 << endl;
    }
    if(d == 2){
        cout << n * 10000 << endl;
    }

    return 0;
}

Measured memory_bytes: 256
s = list(input())
def rle(lst):
    ans = []
    cnt = 1
    ini = lst[0]
    for i in range(1, len(lst)):
        if ini == lst[i]:
            cnt += 1
        else:
            ans.append((ini, cnt))
            cnt = 1
            ini = lst[i]
    ans.append((ini, cnt))
    return ans

sr = rle(s)
cnt = 0
for i in range(len(sr)):
    if sr[i][1] == 1:
        cnt += 1
    else:
        print(cnt+1, cnt+2)
        exit()
for i in range(len(s)-2):
    if s[i] == s[i+2]:
        print(i+1, i+3)
        exit()
print(-1,-1)





Measured memory_bytes: 84848
#include <iostream>
using namespace std;

int main(){
    int n, m;
    cin >> n >> m;

    int a[100][100];
    int b[100];
    int t;
    fill(a[0], a[100], 0);
    fill(b, b, 0);
    for(int i = 0; i < n; i++){
        for(int j = 0; j < m; j++){
            cin >> t;
            a[i][j] = t;  
        }
    }
    for(int i = 0; i < m; i++){
        cin >> t;
        b[i] = t;
    }
    for(int i = 0; i < n; i++){
        int s = 0;
        for(int j = 0; j < m; j++){
              s += a[i][j] * b[j];
        }
        cout << s << endl;
    }

    return 0;
}


Measured memory_bytes: 3156
#include<bits/stdc++.h>
#define ALL(c) (c).begin(),(c).end()
#define EACH(i,c) for(auto i=(c).begin();i!=(c).end();++i)
using namespace std;

int main(){
    string str;
    cin >>str;
    long long posc=str.size(),posf=str.size();
    for(long long i=0;i<str.size();i++){
        if(str[i]=='C' && posc==str.size()){
            posc=i;
        }
        if(str[i]=='F'){
            posf=i;
        }
    }
    if(posc <str.size() && posf < str.size() && posc<posf)
        cout <<"Yes"<<endl;
    else
        cout <<"No"<<endl;

}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
    //input
    int N;
    int Q;
    cin >> N >> Q;
    string S;
    cin >> S;
    vector<int> l(Q,0);
    vector<int> r(Q,0);
    for (int i = 0; i < Q; i++){
        cin >> l[i] >> r[i];
    }
    
    vector<int> D(S.size(),0);
    for (int i = 0; i < S.size(); i++){
        if (S[i] == 'A' && S[i+1] == 'C'){
            D[i+1] = D[i]+1;
        }
        else{
            D[i+1] = D[i];
        }
    }
    cout << endl;
    for (int i = 0; i < Q; i++){
        cout << D[r[i]-1] - D[l[i]-1] << endl;
    }


}

Measured memory_bytes: 2176
import java.util.*;

public class Main {
 
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int X = sc.nextInt();
        int A = sc.nextInt();
        if (X < A) {
            System.out.println(0);
        } else {
            System.out.println(10);
        }
    }
}

Measured memory_bytes: 35676
module Main where
-- import Debug.Trace
import Data.List
import qualified Data.Sequence as S
import qualified Data.ByteString.Char8 as B
import Data.Int
import Data.Char
import Data.Array
import Data.Maybe
-- import qualified Data.Map as M
import Data.Ord
import Control.Applicative
import Control.Monad

solve :: [(Int, Slope)] -> [Int]
solve = iter [] [] where
    iter _ lakes [] = map snd (reverse lakes)
    iter [] lakes ((_, Rising):ls) = iter [] lakes ls -- skip
    iter indexes lakes ((_, Flat):ls) = iter indexes lakes ls -- skip
    iter indexes lakes ((j, GoingDown):ls) = iter (j:indexes) lakes ls
    iter (i:indexes) lakes ((j, Rising):ls) = iter indexes (updateLakes i j lakes) ls

    updateLakes i j [] = [(i, j-i)]
    updateLakes i j lakes = (i, j-i + sumArea):others where
        (toUnite, others) = span (\(k, _) -> i < k) lakes
        sumArea = sum (map snd toUnite)

data Slope = Rising | Flat | GoingDown deriving (Eq, Show)

toList :: B.ByteString -> [(Int, Slope)]
toList = iter 0 where
    iter i s = if B.null s
                    then []
                    else (case B.head s of
                            '/'  -> (i,  Rising)
                            '_'  -> (i,  Flat)
                            '\\' -> (i,  GoingDown)):iter (i+1) (B.tail s)

print' :: [Int] -> IO ()
print' []  = putStrLn ""
print' [x] = putStrLn $ show x
print' (x:xs) = do
    putStr (show x++" ")
    print' xs

main :: IO() 
main = do
    slopes <- B.getLine
    let sl = toList slopes
        l = solve sl 
    print (sum l)
    print' $ (length l):l



Measured memory_bytes: 8632
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  int a,b,c,d;
  a = N / 1000;
  b = N / 100 - a * 10;
  c = N / 10 - a * 100 - b * 10;
  d = N % 10;
  
  if ( a == b && a == c){
    cout << "Yes" << endl;
  }else if (b == c && b == d){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
    
}

Measured memory_bytes: 256
var N,P,A,C,i:Longint;T:int64;
begin
read(N,P);
T:=1;
for i:=1 to N do begin
read(A);
inc(C,A mod 2);
T:=T*2;
end;
if C>0 then writeln(T div 2)else if P>0 then writeln(0)else writeln(T);
end.

Measured memory_bytes: 128
N = int(input())
temp = 'abcdefghijklmnopqrstuvwxyz'
t = 26
k = 1
while N > t:
    k += 1
    N -= t
    t *= 26
    
M = []
N -= 1
for n in range(k-1, -1, -1):
    d = N // (26 ** n)
    M.append(d)
    N -= (26 ** n) * d

print(''.join([temp[v]  for v in M]))

Measured memory_bytes: 9200
#include<iostream>
#include<vector>

int main(){
    int n;

    std::cin >> n;
    std::vector<int> a(n), ans(n);
    for(int i = 0; i < n; i++){
        std::cin >> a.at(i);
    }

    for(int i = 1; i <= n; i++){
        auto tmp = a.at(i - 1);
        ans.at(tmp - 1) = i;
    }

    for(int i = 0; i < n; i++){
        std::cout << ans.at(i) << " ";
    }

    return 0;
}


Measured memory_bytes: 1536
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <utility>
#include <functional>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <iomanip>
#include <numeric>

using namespace std;
using ll = long long;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
const int INF = (1<<30);
const ll INFL = (1LL<<62);
const int MOD = 1000000007;
template<class T> bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template<class T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template<class T> ll mod_pow(ll a, ll n, T mod) { mod=(ll)mod; ll res=1, p=a%mod; while(n){ if(n&1) res=res*p%mod; p=p*p%mod; n>>=1; } return res; }

int main() {
    int n; cin >> n;
    vector<int> A(n);
    for(auto &&a : A) cin >> a;
    reverse(all(A));
    rep(i, n){
        cout << A[i];
        if(i!=n-1) cout << " ";
    }
    cout << "\n";

    return 0;
}


Measured memory_bytes: 3104
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
#include<iterator>
#include<list>
using namespace std;
typedef  long long int lint;
typedef pair<int, int> IP;
typedef pair<lint, lint> LLP;
typedef pair<char, char>CP;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define llower(v,hoge) *lower_bound(v.begin(), v.end(), hoge)
#define lupper(v,hoge) *upper_bound(v.begin(), v.end(), hoge)

int main() {
	lint N;
	cin >> N;
	vector<tuple<lint, lint, char, lint, string>>A(N);
	lint a, b, d;
	char c;
	string e;
	rep(i, N) {
		cin >> a >> b >> c >> d >> e;
		A[i] = make_tuple(a, b, c, d, e);
	}
	sort(A);
	rep(i, N) {
		cout << get<0>(A[i]) << ' ' << get<1>(A[i]) << ' ' << get<2>(A[i]) << ' ' << get<3>(A[i]) << ' ' << get<4>(A[i]) << endl;
	}
}




Measured memory_bytes: 12928
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <tuple>
# include <unordered_map>
# include <numeric>
# include <complex>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
constexpr int INF = 2000000000;
constexpr int HINF = INF / 2;
constexpr double DINF = 100000000000000000.0;
constexpr long long LINF = 9223372036854775807;
constexpr long long HLINF = 4500000000000000000;
const double PI = acos(-1);
int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
# define ALL(x)     (x).begin(),(x).end()
# define UNIQ(c)    (c).erase(unique(ALL((c))), end((c)))
# define mp         make_pair
# define eb         emplace_back
# define FOR(i,a,b) for(int i=(a);i<(b);++i)
# define REP(i,n)   FOR(i,0,n)
# define INIT       std::ios::sync_with_stdio(false);std::cin.tie(0);

int n;
string s;

LL dp[100100][4], J[100100], I[100100], oi[3][100100], jo[3][100100];

int main() {
	cin >> n;
	cin >> s;
	dp[0][0] = 1;
	for (int i = 0; i<n; i++) {
		if (s[i] == 'J')dp[i + 1][1] += dp[i][0];
		else if (s[i] == 'O')dp[i + 1][2] += dp[i][1];
		else dp[i + 1][3] += dp[i][2];
		for (int j = 0; j<4; j++)dp[i + 1][j] += dp[i][j];
	}

	jo[0][0] = 1;
	for (int i = 0; i<n; i++) {
		if (s[i] == 'J') {
			J[i + 1]++;	jo[1][i + 1] += jo[0][i];
		}
		else if (s[i] == 'O')	jo[2][i + 1] += jo[1][i];
		J[i + 1] += J[i];
		jo[0][i + 1] += jo[0][i];
		jo[1][i + 1] += jo[1][i];
		jo[2][i + 1] += jo[2][i];
	}

	oi[0][n] = 1;
	for (int i = n - 1; i >= 0; i--) {
		if (s[i] == 'I') {
			I[i]++;	oi[1][i] += oi[0][i + 1];
		}
		else if (s[i] == 'O')oi[2][i] += oi[1][i + 1];
		I[i] += I[i + 1];
		oi[0][i] += oi[0][i + 1];
		oi[1][i] += oi[1][i + 1];
		oi[2][i] += oi[2][i + 1];
	}

	LL ans = max(oi[2][0], jo[2][n]);
	for (int i = 1; i<n; i++) {
		LL tmp = max(oi[2][i], jo[2][i]);
		LL med = max(J[i] * I[i], tmp);
		ans = max(ans, med);
	}
	cout << ans + dp[n][3] << endl;
}

Measured memory_bytes: 12680
#include <bits/stdc++.h>
using namespace std;

const int N = 2 * 1e5;

long long n,k, arr[N + 5], pre[N + 5];
vector<long long> v;


int main(){
	cin >> n >> k;
	for(int i = 1;i <= n;i++)
		cin >> arr[i];

	for(int i = k;i < n;i++)
		cout << (arr[i-k+1] < arr[i+1] ? "Yes\n" : "No\n"); 
	
}


Measured memory_bytes: 5192
import java.io.InputStream;
import java.io.PrintStream;
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        solve(System.in, System.out);
    }

    static void solve(InputStream is, PrintStream os) {
        // Your code here!
        Scanner scan = new Scanner(is);
        Integer M1 = scan.nextInt();
        Integer D1 = scan.nextInt();
        Integer M2 = scan.nextInt();
        Integer D2 = scan.nextInt();

        if(M1 != M2)
            os.println(1);
        else
            os.println(0);

        return;
    }
}

Measured memory_bytes: 22228
#include <stdio.h>

int z = 0;
int map[500 + 2][500 + 2] = {}, flag[500 + 2][500 + 2], p[500 * 500];
long long int ans = 0;

void f(int y, int x)
{
    if (map[y - 1][x] > map[y][x] + flag[y][x])
    {
        map[y - 1][x]--;
        f(y - 1, x);
    }
    if (map[y + 1][x] > map[y][x] + flag[y][x])
    {
        map[y + 1][x]--;
        f(y + 1, x);
    } 
    if (map[y][x - 1] > map[y][x] + flag[y][x])
    {
        map[y][x - 1]--;
        f(y, x - 1);
    }
    if (map[y][x + 1] > map[y][x] + flag[y][x])
    {
        map[y][x + 1]--;
        f(y, x + 1);
    }
}



void ff(int y, int x)
{
    ans += map[y][x];
    flag[y][x] = 0;
    z++;
    f(y, x);
}


int main(void){
    // Your code here!
    int n, i, ii, iii;
    scanf("%d", &n);
    for (i = 0; i < n * n; i++)
        scanf("%d", p + i);
    for (i = 0; i < n; i++)
        for (ii = 0; ii < n; ii++)
            flag[i + 1][ii + 1] = 1;

    for (i = 0; i < (n + 1) / 2; i++)
    {
        for (ii = i; ii < n - i; ii++)
        {
            map[i + 1][ii + 1] = i;
            map[ii + 1][i + 1] = i;
            map[n - i][ii + 1] = i;
            map[ii + 1][n - i] = i;
        }
    }
    for (i = 0; i < n * n; i++)
        ff((p[i] - 1)/n + 1, (p[i] - 1) % n + 1);
    printf("%lld", ans);

}


Measured memory_bytes: 27384
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#include <map>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
typedef long long ll;

template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}




int main() {
    int n;
    cin >> n;
    vector<int> w(n);
    REP(i, n) {
        cin >> w[i];
    }
    int sum = 0;
    REP(i, n) {
        sum += w[i];
    }
    int ans = sum;
    int smaller = 0;
    REP(i, n) {
        smaller += w[i];
        sum -= w[i];
        ans = min(ans, abs(sum - smaller));
    }
    cout << ans << endl;

}


Measured memory_bytes: 256
from collections import Counter
n=int(input())
a=list(map(int,input().split()))
c=Counter(a)
c=list(c.items())
ans=0
for k in range(len(c)):
  i=c[k][0]
  x=c[k][1]
  if i>x:
    ans+=x
  elif i<x:
    ans+=x-i
print(ans)

Measured memory_bytes: 21232
#include <bits/stdc++.h>

#define M_PI       3.14159265358979323846   // pi

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef pair<ll, ll> P;

#define rep(a,n) for(int a = 0;a < n;a++)

int main(void)
{
	ll n;
	cin >> n;
	string s;
	cin >> s;
	if (n % 2 == 1) {
		cout << "No" << endl;
		return 0;
	}
	for (int i = 0; i < n / 2; i++) {
		if (s[i] != s[i+ n / 2]) {
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace std;
using namespace __gnu_pbds;   
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
#define ll long long int
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define pll pair<ll,ll>
#define all(x) x.begin(),x.end()
#define sz(x) (ll)x.size() 

ll parent[500005],s[500005];
 
ll Root(ll i)
{
    if(parent[parent[i]]!=parent[i])
        parent[i]=Root(parent[i]);
    return parent[i];
}
void Uni(ll a,ll b)
{
    ll parent_a=Root(a),parent_b=Root(b);
    if(parent_a==parent_b)
        return;
    if(s[parent_a]>=s[parent_b])
    {
         s[parent_a]+=s[parent_b];
         parent[parent_b]=parent_a;
    }
    else
    {
         s[parent_b]+=s[parent_a];
         parent[parent_a]=parent_b;
    }
    return;
} 

int main()
{
    ios_base::sync_with_stdio(false);
    ll n,i,j,k,x,y,t,m;

    cin >> n ;
    vector<pll>v,X,Y;
    vector< pair< ll , pll > >e;

    for(i=1;i<=n;i++)
    {
        cin >> x >> y;
        v.pb({x,y});
        X.pb({x,i});
        Y.pb({y,i});
    }

    sort(all(X)),sort(all(Y));

    for(i=1;i<=n;i++)
        s[i]=1,parent[i]=i;


    for(i=0;i<sz(X);i++)
    {
        if(i+1<sz(X))
            e.pb({X[i+1].ff-X[i].ff,{X[i].ss,X[i+1].ss}});
        if(i-1>=0)
            e.pb({X[i].ff-X[i-1].ff,{X[i-1].ss,X[i].ss}});
    }
    for(i=0;i<sz(Y);i++)
    {
        if(i+1<sz(Y))
            e.pb({Y[i+1].ff-Y[i].ff,{Y[i].ss,Y[i+1].ss}});
        if(i-1>=0)
            e.pb({Y[i].ff-Y[i-1].ff,{Y[i-1].ss,Y[i].ss}});
    }

    sort(all(e));
    ll ans=0,tot=0;
    for(i=0;i<sz(e);i++)
    {
        if(tot==n-1)
            break;
        else
        {
            x=e[i].ss.ff,y=e[i].ss.ss;
            if(Root(x)==Root(y))
                continue;
            else
            {
                Uni(x,y);
                ans+=e[i].ff;
                tot++;
            }
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 23228
import math

N = int(input())

def yakusu(n):#約数列挙
    list1 = []
    list2 = []
    for i in range(1, int(math.sqrt(n)) + 1):
        if n % i == 0:
            list1.append(i)
            if i != n // i:
                list2.append(n // i)
    list2.reverse()
    return list1 + list2

def A(x):
    m = l1[len1 - i - 1]
    while m > 0:
        if m % x == 0:
            m //= x
        elif m % x == 1:
            return True
        else:
            return False
    return False

l1 = yakusu(N)
len1 = len(l1)

l2 = yakusu(N - 1)

ans = len(l2) - 1

for i in range(1, len1):
    if A(l1[i]):
        ans += 1

print(ans)

Measured memory_bytes: 39152
#Coding:Utf-8

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

check=[0 for i in range(N)]
M=0
b=[]
for j in reversed(range(1,N+1)):
    total=0
    for k in range(1,int(N/j)+1):
        total+=check[int(j*k)-1]
    if a[j-1]!=total%2:
        M+=1
        check[j-1]=1
        b.append(j)

print(M)
for l in range(len(b)):
    print(b[l],end=' ')
else:
    print()

Measured memory_bytes: 12004
import java.util.Scanner;


public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		StringBuilder stb = new StringBuilder();
		
		while(sc.hasNextLine()) {
			stb.append(sc.nextLine().toLowerCase());
		}
		String str = stb.toString();
		char cStr;
		char a = 'a';
		int[] count = new int[26];
		
		for(int i = 0; i < str.length(); i++) {
			cStr = str.charAt(i);
			for(int j = 0; j < 26; j++) {
				if(cStr == (char)(a + j)) {
					count[j]++;
					break;
				}
			}
		}
		
		for(int i = 0; i < 26; i++) {
			System.out.println((char)(a + i) + " : " + count[i]);
		}
		sc.close();
	}
}


Measured memory_bytes: 26136
#include<bits/stdc++.h>
using namespace std;


int main(){
 
  int k;
  cin>>k;
  int a,b;
  cin>>a>>b;
  int flag = 0;
  for(int i=a;i<=b;i++){
   if(i%k == 0){
    flag = 1;
     break;
   }
  }
  if(flag == 1)
    cout<<"OK"<<endl;
  else
    cout<<"NG"<<endl;
  
  return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <vector>

using namespace std;

int main(void) {
    int N;
    cin >> N;

    vector<int> A(N);
    for (int i = 0; i < N; i++) {
        cin >> A[i];
    }

    long long ans = 0;
    int r = 0;
    int t = 0;
    for (int l = 0; l < N; l++) {
        if (l == r) {
            t ^= A[l];
            r++;
        }
        while (r < N && ((t ^ A[r]) == (t + A[r]))) {
            t ^= A[r];
            r++;
        }
        ans += r-l;
        t -= A[l];
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1024
#include<iostream>
using namespace std;

int main(){
    // int x, y, maxv;
    // cin >> x >> y;

    // maxv = (x > y) ? x : y;

    // cout << maxv << endl;

    int a, b;

    cin >> a >> b;

    if(a < b){
        cout << "a < b" << endl;
    } else if(a > b) {
        cout << "a > b" << endl;
    } else if(a == b) {
        cout << "a == b" << endl;
    }

    return 0;
}


Measured memory_bytes: 3072
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/adaptor/indexed.hpp>
#define FOR(i,k,n)  for(int i = (k);i < (n);++i)
#define REP(i,n)    FOR(i,0,n)
#define ALL(x) begin(x),end(x)

using namespace std;
using namespace boost::adaptors;
using namespace std::string_literals;
using ll = int64_t;
using vecint = vector<int>;
using vecll = vector<ll>;
using boost::irange;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  set<ll> s;
  ll n,k;
  cin>>n>>k;
  n %= k;
  while (s.count(n) == 0) {
    s.insert(n);
    n = k - n;
  }
  cout<<*begin(s)<<endl;
  return 0;
}


Measured memory_bytes: 256
n,x,y = map(int,input().split())
ans = [0]*n
for i in range(1,n+1):
    for j in range(i+1,n+1):
        ans[min(abs(i-j) , abs(i-x)+1+abs(j-y), abs(i-y)+1+abs(j-x)) ]+=1
        
for i in range(1,n):
    print(ans[i])

Measured memory_bytes: 3444
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
constexpr int MOD=1000000007;
#define INF (1<<30)
#define LINF (lint)(1LL<<56)
#define endl "\n"
#define rep(i,n) for(lint (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(lint (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcount(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
#define plint pair<lint,lint>
#define fi first
#define se second
typedef long long lint;
int dx[8]={1,1,0,-1,-1,-1,0,1};
int dy[8]={0,1,1,1,0,-1,-1,-1};
const int MAX_N=2e5+5;

int main(void){
    int K,A,B;
    cin >> K >> A >> B;
    bool ans=false;
    for(int i=A;i<=B;i++){
        if(i%K==0) ans=true;
    }
    if(ans) cout << "OK" << endl;
    else cout << "NG" << endl;
}

Measured memory_bytes: 3652
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;
int main()
{
	int n;
	while(~scanf("%d",&n))
	{
		int a[100010];
		for(int i=1;i<=n;++i)
		{
			scanf("%d",&a[i]);
		}
		int ans = 0;
		for(int i=1;i<=n;++i)
		{
			if(i != n)
			{
				if(a[i] == i)
				{
					swap(a[i],a[i+1]);
					ans++;
				}
			}
			else
			{
				if(a[i] == i)
				{
					swap(a[0],a[i]);
					ans++;
				}
			}
		}
		printf("%d\n",ans);
	}
}
/*
1 4 3 5 2
1 2 3 4 5
4 1 3 5 2
4 3 1 5 2
Swap 1 and 4, then swap 1 and 3. p is now 4,3,1,5,2 and satisfies the condition. 
This is the minimum possible number, so the answer is 2.
 */

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const int MAX = 5100000;
ll gcd(ll a, ll b) {
    return (b==0) ? a : gcd(b, a%b);
}

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
ll COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

// 以下から
const int MAX_N = 100000;
struct Edge {
    int to;
    int id;
};


vector<int> to[100005];
int n;
vector<int> dist;
void dfs(int v, int d=0, int p=-1) {
    dist[v] = d;
    for (int u: to[v]) {
        if (u == p) continue;
        dfs(u, d+1, v);
    }
}

vector<int> calcDist(int s){
    dist = vector<int>(n);
    dfs(s);
    return dist;
}

int main() {
    ll n, k; cin >> n >> k;
    ll r, s, p; cin >> r >> s >> p;
    string t; cin >> t;

    ll sum = 0;
    rep(i, t.size()) {
        if ((i+k) < n) {
            if (t[i] == t[i + k]) {
                t[i + k] = 'x';
            }
        }
        switch (t[i]) {
            case 'r':
                sum += p;
                break;
            case 's':
                sum += r;
                break;
            case 'p':
                sum += s;
            default:
                break;
        }
    }
    cout << sum << endl;

}

//int main() {
//    ll n, m;
//    vector<ll> v;
//    rep(i,n) {
//        ll a; cin >> a;
//        v.push_back(a);
//    }
//}


Measured memory_bytes: 4608
program sample
    implicit none
    character(100)::s,t
    integer(8) :: i,j,k,m,n
    integer(8)::a,b,c,d
    integer(8),allocatable::x(:),y(:)
  
    read(*,*) s
    read(*,*)t
    n=len_trim(s)
    m=len_trim(t)
    if(n>m)then
        write(*,*)'GREATER'
        stop
    elseif(n<m)then
        write(*,*)'LESS'
        stop
    endif

    do i=1,n
        if(ichar(s(i:i))>ichar(t(i:i)))then
            write(*,*)'GREATER'
            stop
        elseif(ichar(s(i:i))<ichar(t(i:i)))then
            write(*,*)'LESS'
            stop
        endif
    end do
    write(*,*)'EQUAL'
    stop
end program sample
  



Measured memory_bytes: 2820
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <vector>
#include <math.h>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <map>
const int MOD = 1e9+7;
const int MOOD = 998244353;
#define PI 3.14159265359
typedef long long ll;
using namespace std;


int main(){
	int n, k;
	cin >> n >> k;
	vector<int> a(n);
	vector<ll> asum(n+1);
	for (int i = 0; i < n; i++){
		cin >> a[i];
		asum[i+1] = a[i] + asum[i];
	}
	vector<ll> asummod(n+1); 
	for (int i = 1; i <= n; i++){
		if ((asum[i]-i)%k < 0){
			asummod[i] = (asum[i]-i)%k + k;
		}else{
			asummod[i] = (asum[i]-i)%k;
		}
	}
	map<int, ll> mp;
	for (int i = 0; i < min(k, n+1); i++){
		mp[asummod[i]]++;
	} 
	ll ans = 0;
	for (auto x : mp){
		ans += x.second*(x.second-1)/2;
	}
	if (k < n){
		for (int i = 0; i <= n-k; i++){
			mp[asummod[i]]--;
			ans += mp[asummod[k+i]];
			mp[asummod[k+i]]++;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 19576
#include <bits/stdc++.h>

int main() {
  std::int_fast64_t n;
  std::cin >> n;
  std::vector<std::int_fast64_t> h(n);
  std::copy_n(std::istream_iterator<std::int_fast64_t>(std::cin), n, h.begin());

  std::int_fast64_t result = h.front();
  for (std::int_fast64_t i = 1; i < n; ++i) {
    result += std::abs(h[i] - h[i - 1]);
  }
  result += h.back();
  result /= 2;

  std::cout << result << std::endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;
using P = pair<int, int>;
long mod = (long) 1e9 + 7;

int main(){
    
    int n;
    cin >> n;
    vector<int> v(n + 1,0);
    
    rep(i,n - 1){
        int a;
        cin >> a;
        v[a]++;
    }
    
    rep(i,n){
        cout << v[i + 1] << "\n";
    }
    
    return 0;
}


Measured memory_bytes: 3708