akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
using namespace std;

//ループマクロ
#define FOR(i , a , b)  for(int i = (a) ; i < (b) ; i++)
#define REP(i , n)      for(int i = 0 ; i < n ; i++)
#define REPR(i , n)     for(int i = n ; 0 <= i ; i--)
#define ROP(i, n)       for(int i = 1 ; i <= n ; i++)

//入出力
#define SCOUT(x) cout << (x) << " "
#define VECCIN(x) for(auto& ele : (x) ) cin >> ele
#define VECOUT(x) for(auto& ele : (x) ) cout << ele << " "; cout << endl;

//その他
#define ALL(obj) (obj).begin() , (obj).end() 
#define SORT(obj) sort(ALL(obj))
#define GSORT(obj) sort(ALL(obj) , greater<int>())
#define P pair<int , int>
#define V vector<int>
#define VLL vector<long long>
#define M map<int, int>
#define S set<int>
#define PQ priority_queue<int>
#define PQG priority_queue<int , V , greater<int>>
#define ROUNDUP(a , b) (a + (b - 1)) / b

int main(void) {

	ios::sync_with_stdio(false);	cin.tie(0);
	// Y = 10000x + 5000y + 1000z = 1000(10x + 5y + z)
	// y' = 10x + 5y + z
	// x + y + z = N
	// y' - N = 9x + 4y
	
	int N, Y;  cin >> N >> Y;   Y /= 1000;
	
	int x = -1, y = -1, z = -1;
	for(int i = 0 ; i <= 2 * 10000 ; i++)
			for(int j = 0 ; j <= 2 * 10000 ; j++)
					if(Y - N == 9 * i + 4 * j && N - i - j >= 0){
							x = i, y = j;
							break;
					}

	z = N - x - y;
  	if(Y - N < 0 || x == -1 || y == -1 || z == -1){
			cout << -1 << " " << -1 << " " << -1 << endl;
			return 0;
	}
	cout << x << " " << y << " " << z << endl;

	return 0;
}

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

using namespace std;

#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rrep(i, n) for (ll i = (n - 1); i >= 0; --i)
#define blank(ans) cout << (ans) << " ";
#define mp(p, q) make_pair(p, q)
#define mt(p, q, r) make_tuple(p, q, r)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef string str;

typedef vector<ll> vll;
typedef vector<ld> vd;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<str> vs;
typedef vector<vector<ll>> vvll;
typedef vector<vector<ld>> vvd;
typedef vector<vector<bool>> vvb;
typedef vector<vector<char>> vvc;
typedef vector<vector<str>> vvs;
typedef vector<pair<ll, ll>> vpll;
typedef vector<tuple<ll, ll, ll>> vtlll;

const ld PI = acos(-1.0);
const ll MAX = 9000000000000000000;
const ll MIN = -9000000000000000000;
const ld DMAX = 4500;
const ld DMIN = -4500;
const ll MOD = 1000000007;

template <typename T>
void fin(T a)
{
  cout << a << endl;
  exit(0);
}

//実行部
void Main()
{
  ll n; cin >> n;
  vll a(n); rep(i, n) cin >> a[i];
  ll ans = MAX;
  for(ll i = -100;i <= 100;i++)
  {
    ll L = 0;
    for(ll j = 0;j < n;j++)
    {
      L += (a[j] - i) * (a[j] - i);
    }
    ans = min(ans, L);
  }
  fin(ans);
}

//前処理
int main()
{
  ifstream in("text.txt");
  cin.rdbuf(in.rdbuf());
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(20); //高精度少数表示
  Main();
  return 0;
}

/*
//test時
  g++ test.cpp -o test;./test
*/


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <set>
#include <string>
#include <vector>

int main(void){
    char x,y;
    std::cin >> x >> y;

    if(x > y){
        std::cout << ">";
        return 0;
    }
    else if(x < y){
        std::cout << "<";
        return 0;
    }
    else{
        std::cout << "=";
        return 0;
    }
    
}




Measured memory_bytes: 760
#include <bits/stdc++.h>
#include <vector>
#include <cmath>
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP2(i, m, n) for (int i = (m); i < (int)(n); ++i)
#define REPR(i, n) for (int i = (n)-1; i >= 0; --i)
#define REPR2(i, m, n) for (int i = (n)-1; i >= (m); --i)
#define REPx(x, a) for(auto x : a)
#define ALL(a) a.begin(), a.end()
#define SORT(a) sort(ALL(a))
#define SORTR(a) sort(ALL(a), greater<int>())
#define REVERSE(a) reverse(ALL(a))
#define bit_search(bit, n) REP(bit, 1<<(n))
#define bit_check(bit, i) (bit>>(i)) & 1
#define setpre(n) fixed << setprecision((n))
#define UNIQUE(a) do {SORT(a); (a).erase(unique(ALL(a)), (a).end());} while(0)
#define MAX(a) *max_element(ALL(a))
#define MIN(a) *min_element(ALL(a))
#define bisect_left(a, x) lower_bound(ALL(a), (x)) - a.begin()
#define bisect_right(a, x) upper_bound(ALL(a), (x)) - a.begin()
#define INPUT(a) REP(i, a.size()) cin >> a[i];
#define INPUTP(a) REP(i, a.size()) cin >> a[i].first >> a[i].second;
#define ENDL cout << endl;
using namespace std;
using LL = long long;
using LD = long double;
using PII = pair<int, int>;
using VPII = vector<PII>;
using PLL = pair<LL, LL>;
using VPLL = vector<PLL>;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VC = vector<char>;
using VS = vector<string>;
using VB = vector<bool>;
const int INF = 1e9;
const LL MOD = 1e9 + 7;

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()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  string n;
  cin >> n;
  int l = n.size();
  int ans = 9 * (l-1);
  bool flg = true;
  REP2(i, 1, l) if (n[i] != '9') flg = false;
  if (flg) ans += n[0] - '0';
  else ans += n[0] - '1';
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
// Java program For handling Input/Output 
import java.io.*;
import java.util.*;
import java.math.*;
//import java.awt.*;

public class Main {
    BufferedReader br;
    StringTokenizer st;

    int max = -1;
    final long P = 998244353;
    final long P2 = 1000000007;

    HashSet<String> set = new HashSet<>();
    HashMap<Character, List<Integer>> map = new HashMap<>();

    // actual logic
    void solve() throws IOException {
        // int t = ni();
        // while (--t >= 0) {
        long a = nl();
        pl(a + a * a + a * a * a);
        // }

    }

    // constructor
    Main() {
        try {
            br = new BufferedReader(new InputStreamReader(System.in));
            try {
                st = new StringTokenizer(br.readLine());
            } catch (Exception e) {
                System.out.println(e);
            }
        } catch (Exception e) {
            System.out.println(e);
        }
    }

    Main(String s) {
        try {
            br = new BufferedReader(new FileReader(s));
            st = new StringTokenizer(br.readLine());
        } catch (Exception e) {
            System.out.println(e);
        }
    }

    // main metohd
    public static void main(String[] args) throws IOException {
        new Main().solve();
    }

    // Utility methods

    String ns() {
        if (!st.hasMoreTokens()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (Exception e) {
                System.out.println(e);
            }
        }
        return st.nextToken();

    }

    int ni() {
        return Integer.parseInt(ns());
    }

    long nl() {
        return Long.parseLong(ns());
    }

    double nd() {
        return Double.parseDouble(ns());
    }

    void pl(String s) {
        System.out.println(s);
    }

    void pl(long s) {
        System.out.println(s);
    }

    void pl(double s) {
        System.out.println(s);
    }
}


Measured memory_bytes: 32648
#include<bits/stdc++.h>
using namespace std;
int main(){
  string S;
  int N,K;
  cin>>N>>K>>S;
  if(S.at(K-1)=='A'){
    S.at(K-1)='a';
  }
  else if(S.at(K-1)=='B'){
    S.at(K-1)='b';
  }
  else{
    S.at(K-1)='c';
  }
  cout<<S<<endl;
}

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

int main() {
    int x, ans = 0;
    cin >> x;
  	if(x<600) ans = 8;
	else if(x<800) ans = 7;
	else if(x<1000) ans = 6;
	else if(x<1200) ans = 5;
    else if(x<1400) ans = 4;
  	else if(x<1600) ans = 3;
  	else if(x<1800) ans = 2;
    else ans = 1;
    cout << ans << endl;
}


Measured memory_bytes: 3632
#include<iostream>
#include<stack>
#include<string>
#include<cstdlib>
using namespace std;

int main(){
    stack<int> S;
    string s;
    int a,b;
    while(cin>>s){
        if(s[0]=='+'){
            a=S.top();S.pop();
            b=S.top();S.pop();
            S.push(a+b);
        }
        else if(s[0]=='-'){
            b=S.top();S.pop();
            a=S.top();S.pop();
            S.push(a-b);
        }
        else if(s[0]=='*'){
            a=S.top();S.pop();
            b=S.top();S.pop();
            S.push(a*b);
        }
        else{
            S.push(atoi(s.c_str()));
        }
    }
    cout<<S.top()<<endl;
    return 0;
}


Measured memory_bytes: 3224
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define ld long double
#define fi first
#define se second
#define mp make_pair
#define pb push_back
using namespace std;

int main()
{
	
    ll arr[3];
    cin>>arr[0]>>arr[1]>>arr[2];
 
    ll temp;
    temp=arr[2];
    // arr[2]=2;
    for(ll i=2;i>0;i--)
    {
    	arr[i]=arr[i-1];
    }
    arr[0]=temp;

    for(ll i=0;i<3;i++)
    {
    	cout<<arr[i]<<" ";
    }


}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
using namespace std;

signed main() {
	int H, W, h, w, ans;
	cin >> H >> W;
	cin >> h >> w;
	ans = (H-h)*(W-w);
	cout << ans << endl;
}

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

// in-short-use macros

#define all(c) (c).begin(),(c).end()
#define ll long long int
#define ld long double
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define mod 1000000007
#define PI 3.14159265
#define sizes 1000010

# define M_PI           3.14159265358979323846

//main function here

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
   
    ld n;
    cin>>n;
    cout<<2*n*M_PI<<"\n";
    return 0;
}

Measured memory_bytes: 3796
#include <stdio.h>



int main(){
	int x,a,b;
	scanf("%d %d %d\n",&x,&a,&b);
	int diff=b-a;
	if(diff<=0){
		puts("delicious");
	}else if(diff<=x){
		puts("safe");
	}else{
		puts("dangerous");
	}
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
template<class T> inline bool chmin(T&x,T y){if(x>y){x=y;return true;}return false;}
template<class T> inline bool chmax(T&x,T y){if(x<y){x=y;return true;}return false;}
#define fr(i,n) for(int i=0;i<(n);++i)
#define Fr(i,n) for(int i=1;i<=(n);++i)
#define ifr(i,n) for(int i=(n)-1;i>=0;--i)
#define iFr(i,n) for(int i=(n);i>0;--i)

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    string s;
    cin>>s;
    int n=s.length();
    vector<int> a(n+1);
    int tmp=1;
    ll c[2019]={1};
    ifr(i,n){
        a[i]=a[i+1];
        a[i]+=(s[i]-'0')*tmp;
        a[i]%=2019;
        tmp*=10;
        tmp%=2019;
        c[a[i]]++;
    }
    ll ans{};
    fr(i,2019) ans+=c[i]*(c[i]-1)/2;
    cout<<ans<<endl;
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
 
#define in cin
#define out cout
 
#define REP(i,n) for(int i=0; i<n; i++)
#define REP2(i,s,e) for(int i=s; i<e; i++)
#define REPE(i,s,e) for(int i=s; i<=e; i++)
#define REPR(i,s,e) for(int i=s; i>=e; i--)
 
#define all(v) v.begin(), v.end()
#define pb push_back
 
#define ll long long
#define pii pair<int, int>
#define rd(n) scanf("%d", &n)
 
#define x first
#define y second
#define intINF 2147483647
#define llINF 9223372036854775807LL
#define MOD 1000000007
#define EPS (1e-9)
 
#define pdd pair<double, double>
 
int main()
{
    int n; in >> n;
    vector<int> d(n);
    REP(i, n) in >> d[i];
 
    //
    int rMX = -MOD;
    int rMN = MOD;
 
    vector<int> r[505];
    REP(i, d.size())
    {
        r[d[i]].pb(i);
        rMX = max(rMX, d[i]);
        rMN = min(rMN, d[i]);
    }
 
    int p[505];
    int c = 0;
    REPR(i, rMX, rMN+((rMX+1)%2))
    {
        if(r[i].size() == 0)
        {
            out << "Impossible\n";
            return 0;
        }
 
        p[c++] = r[i].back();
        r[i].pop_back();
    }
 
    REPE(i, rMN, rMX)
    {
        if(r[i].size() == 0)
        {
            out << "Impossible\n";
            return 0;
        }
 
        p[c++] = r[i].back();
        r[i].pop_back();
    }
 
    vector<pii> res;
 
    if(r[rMN].size() > 0)
    {
        out << "Impossible\n";
        return 0;
    }
 
    REPE(i, rMN, rMX)
    {
        for(int v : r[i])
        {
            res.pb({p[i-rMX+1], v});
        }
    }
 
    REP(i, c-1)
    {
        res.pb({p[i], p[i+1]});
    }
 
    out << "Possible\n";
 
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

class Main {
    public static void main(String[] args) {
        final long MOD = 1_000_000_007L;
        final Scanner sc = new Scanner(System.in);
        final int N = Integer.parseInt(sc.next());
        int B[] = new int[60];
        for (int i = 0; i < N; i++) {
            long A = Long.parseLong(sc.next());
            for (int j = 0; j < 60; j++) {
                B[j] += (int) (A & 1);
                A >>= 1;
                if (A == 0)
                    break;
            }
        }
        sc.close();

        long sum = 0L;
        for (int j = 0; j < 60; j++) {
            sum += (long) B[j] * (N - B[j]) * Math.pow((double) 2, (double) j) % MOD;
            sum %= MOD;
        }
        System.out.println(sum);
    }
}

Measured memory_bytes: 65660
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
  int x,y;
  cin>>x>>y;
  if(x<y) swap(x,y);
  while(x%y){
    int tmp=x%y;
    x=y;
    y=tmp;
  }
  cout<<y<<endl;
  return 0;
}

Measured memory_bytes: 3092
import sys
def input(): return sys.stdin.readline().strip()


def main():
    x = int(input())
    time, rem = x // 11, x % 11
    if 0 < rem <= 6:
        print(time * 2 + 1)
    elif 6 < rem:
        print(time * 2 + 2)
    else:
        print(time * 2)


if __name__ == "__main__":
    main()


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

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s;
  cin >> s;
  if(s[0] == s[1] && s[1] == s[2])
    cout << "No\n";
  else
    cout << "Yes\n";

  return 0;
}


Measured memory_bytes: 888
#include<bits/stdc++.h>
//g++ -std=c++11 

using namespace std;
typedef long long ll;

#define rep(i,n) for (long long i = 0; i < (n); ++i)
#define DIV 1000000007 //10^9+7

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

	ll ans = 0;
	for(long long A = 1; A < N; A++) {
		if(N%A == 0) {
			ans += N/A - 1;
		} else {
			ans += N/A;
		}
	}
	cout << ans << endl;

}

Measured memory_bytes: 3632
#include <iostream>
#include <bits/stdc++.h>
#include <cmath>
#include <vector>
#define ll long long int
#define mp make_pair
#define pb push_back
#define vi vector<int>
using namespace std;
vector<vector<int>> edge(200007);
vector<pair<ll,int>> dp(200007,mp(-1,0));
vector<ll> ans(200007);
vector<int> euler(400007);
vector<bool> vis(200007,0); 
const ll p =1e9 + 7;
ll modpower(ll base, ll power, ll mod=p){
    ll ans =1;
    base%=p;
    while(power){
        if(power&1){
            ans*=base;
            ans%=p;
        }
        base*=base;
        base%=p;
        power>>=1;
    }
    return ans;
}
ll fact[200007];
ll invfact[200007];
void computefactorial(){
    fact[0]=1;
    for(int i=1;i<200007;i++){
        fact[i]=i*fact[i-1];
        fact[i]%=p;
    }
    invfact[200006]=modpower(fact[200006],p-2);
    for(int i=200005;i>=0;i--){
        invfact[i]=(i+1)*invfact[i+1];
        invfact[i]%=p;
    }
}
void eulerTree(int u, int &indx) 
{ 
    vis[u] = 1; 
    euler[indx++] = u; 
    for (auto it : edge[u]) { 
        if (!vis[it]) { 
            eulerTree(it, indx); 
            euler[indx++] = u; 
        } 
    } 
}
void solve(int u, int v){
    if(dp[u].first!=-1){
        return;
    }
    if(u!=v && edge[u].size()==1){
        dp[u]=mp(1,1);
        return;
    }
    ll ans=1;
    int size=0;
    for(int i=0;i<edge[u].size();i++){
        if(edge[u][i]==v){
            continue;
        }
        solve(edge[u][i],u);
        ans*=dp[edge[u][i]].first;
        ans%=p;
        ans*=invfact[dp[edge[u][i]].second];
        ans%=p;
        size+=dp[edge[u][i]].second;
    }
    ans*=fact[size];
    ans%=p;
    dp[u]=mp(ans,size+1);
    return;
}
ll solve(){
    int n;
    cin>>n;
    for(int i=0;i<n-1;i++){
        int u,v;
        cin>>u>>v;
        edge[--u].pb(--v);
        edge[v].pb(u);
    }
    solve(0,0);
    ans[0]=dp[0].first;
    int idx=0;
    eulerTree(0,idx);
    for(int i=1;i<idx;i++){
        dp[euler[i-1]].first*=invfact[dp[euler[i-1]].second - 1];
        dp[euler[i-1]].first%=p;
        dp[euler[i-1]].second-=dp[euler[i]].second;
        dp[euler[i-1]].first*=fact[dp[euler[i-1]].second - 1];
        dp[euler[i-1]].first%=p;
        dp[euler[i-1]].first*=modpower(dp[euler[i]].first,p-2);
        dp[euler[i-1]].first%=p;
        dp[euler[i-1]].first*=fact[dp[euler[i]].second];
        dp[euler[i-1]].first%=p;
        dp[euler[i]].first*=invfact[dp[euler[i]].second - 1];
        dp[euler[i]].second+=dp[euler[i-1]].second;
        dp[euler[i]].first%=p;
        dp[euler[i]].first*=fact[dp[euler[i]].second - 1];
        dp[euler[i]].first%=p;
        dp[euler[i]].first*=invfact[dp[euler[i-1]].second];
        dp[euler[i]].first%=p;
        dp[euler[i]].first*=dp[euler[i-1]].first;
        dp[euler[i]].first%=p;
        ans[euler[i]]=dp[euler[i]].first;
    }
    for(int i=0;i<n;i++){
        cout<<ans[i]<<"\n";
    }
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    computefactorial();
    solve();
}

Measured memory_bytes: 23412
import core.bitop;
import std.algorithm;
import std.ascii;
import std.bigint;
import std.conv;
import std.functional;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.random;
import std.typecons;
import std.container;

alias sread = () => readln.chomp();
ulong MOD = 1_000_000_007;
ulong INF = 1_000_000_000_000;
ulong MIDDLE = 100_000;
alias Pair = Tuple!(long, "flag", long, "num");

T lread(T = long)()
{
    return readln.chomp.to!T();
}

T[] aryread(T = long)()
{
    return readln.split.to!(T[])();
}

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}

void main()
{
    auto n = lread();
    auto a = aryread();
    auto rate = [
        "Gray" : 0, "Brown" : 0, "Green" : 0, "LightB" : 0, "Blue" : 0,
        "Yellow" : 0, "Orange" : 0, "Red" : 0, "Free" : 0,
    ];
    foreach (e; a)
    {
        if (e < 400)
            rate["Gray"]++;
        else if (e < 800)
            rate["Brown"]++;
        else if (e < 1200)
            rate["Green"]++;
        else if (e < 1600)
            rate["LightB"]++;
        else if (e < 2000)
            rate["Blue"]++;
        else if (e < 2400)
            rate["Yellow"]++;
        else if (e < 2800)
            rate["Orange"]++;
        else if (e < 3200)
            rate["Red"]++;
        else
            rate["Free"]++;
    }
    // rate.writeln();
    long colorcnt;
    foreach(e; rate)
        if (e)
            colorcnt++;
        
    if(rate["Free"])
        colorcnt--;

    if (n - rate["Free"])
        writefln("%s %s", colorcnt, colorcnt + rate["Free"]);
    else
        writefln("%s %s", 1, rate["Free"]);
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <stack>
#include <string>
#include <vector>
typedef long long ll;
using namespace std;
const int MOD = (int)1e9 + 7;
const ll INF = (ll)1e18 + 7;
#define int long long
#define vint vector<int>
#define pint pair<int, int>
#define pb(a) push_back(a)
#define all(v) v.begin(), v.end()
#define dbg(x) cerr << #x << " = " << (x) << endl
#define yn(b) cout << ((b) ? "Yes" : "No") << endl
#define YN(b) cout << ((b) ? "YES" : "NO") << endl

int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};

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

    int N;

    cin>>N;

    cout<<N%2+N/2<<endl;

	return 0;
}


Measured memory_bytes: 256
import bisect
n=int(input())
a=[int(i) for i in input().split()]
a.sort()

maxi=a[-1]
midi=-(-maxi//2)
idx=bisect.bisect_left(a,midi)

ans=-1
check=float('inf')
for i in range(-1,2):
    if 0<=(idx+i)<n-1:
        check2=abs(midi-a[idx+i])
        if check >check2:
            ans=a[idx+i]
            check=check2
    
print(maxi,ans)

Measured memory_bytes: 14052
#define D(x) cout << #x " = " << x << endl
#define DD(x, y) cout << "(" #x ", " #y ") = (" << x << ", " << y << ")" << endl
#define DDD(x, y, z) cout << "(" #x ", " #y ", " #z ") = (" << x << ", " << y << ", " << z << ")" << endl
#define DV(v) for (auto __macro_vi : v){ cout << __macro_vi << " ";} cout << endl;
#define DA(a, n) for (int __macro_i = 0; __macro_i < n; ++__macro_i) { cout << a[__macro_i] << " "; } cout << endl;
#define REP(i, n) for (int i = 0; i < n; ++i)
#define ALL(v) (v).begin(), (v).end()
#include<iostream>
#include<vector>
#include<cassert>
#include<cmath>

using namespace std;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, d;
    cin >> n >> d;
    int w = 2 * d + 1;
    cout << (n + (w - 1)) / w << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
using namespace std;
#define INF 2000000007
#define LINF 100000000000000007
#define MOD 1000000007
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define repb(i, n) for (int i = n - 1; i >= 0; i--)
#define MODE 0
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define ARDEB(i,X) cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define ARDEB(i,X) {}
#define END {}
#endif
typedef long long ll;
typedef pair<int,int> P;
struct edge{int to,cost;};
int ceil2(int a,int b){if(a%b){return a/b+1;}else{return a/b;}}
using namespace std;

int n,ans;
signed main(){
	
	string s;
	cin>>s;
	if(s=="ABC")cout<<"ARC"<<endl;
	else cout<<"ABC"<<endl;
	
}


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

int main()
{
    string S, T;
    cin >> S >> T;

    int N = S.size();
    for(int i=0; i<N; i++)
    {
       S = S[N-1] + S.substr(0,N-1);
       if(S==T)
       { 
          cout << "Yes" << endl;
          return 0;
       }
    }

    cout << "No" << endl;

	return 0;
}

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

int main()
{
    int n, x;
    cin >> n >> x;
    vector<int> m(n);
    rep(i, n) cin >> m.at(i);

    int sum_m = accumulate(m.begin(), m.end(), 0);
    int min_m = *min_element(m.begin(), m.end());
    int answer = n + (int)floor((x - sum_m) / min_m);
    cout << answer << endl;
}

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

int main() {
	int A[3][3];
	for (int i = 0; i < 3; i++) {
		for (int j = 0; j < 3; j++) {
			cin >> A[i][j];
		}
	}
	int N;
	cin >> N;
	for (int i = 0; i < N; i++) {
		int tmp;
		cin >> tmp;
		for (int i = 0; i < 3; i++) {
			for (int j = 0; j < 3; j++) {
				if (A[i][j] == tmp) {
					A[i][j] = -1;
				}
			}
		}
	}

	int cnt = 0;
	for (int i = 0; i < 3; i++) {
		if (A[i][0] == -1 && A[i][1] == -1 && A[i][2] == -1) cnt++;
		if (A[0][i] == -1 && A[1][i] == -1 && A[2][i] == -1) cnt++;
	}
	if (A[0][0] == -1 && A[1][1] == -1 && A[2][2] == -1) cnt++;
	if (A[0][2] == -1 && A[1][1] == -1 && A[2][0] == -1) cnt++;

	if (cnt != 0) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
}

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

using namespace std;

typedef long long int ll;
typedef pair<ll, ll> pll;

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

struct Edge {
    ll to;
    ll cost;
    ll index;
};

struct Vertex {
    vector<Edge> node;
};

Vertex V[105];
bool U[1005];
ll C[105];

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N, M;
    cin >> N >> M;
    REP(i, M) {
        ll a, b, c;
        cin >> a >> b >> c;
        a--;
        b--;
        V[a].node.push_back(Edge{b, c, i});
        V[b].node.push_back(Edge{a, c, i});
    }

    REP(i, N) {
        priority_queue<Edge, vector<Edge>, function<bool(Edge, Edge)>> q(
                [](Edge a, Edge b) { return a.cost > b.cost; });
        q.push(Edge{i, 0, -1});
        REP(j, N) {
            C[j] = INF;
        }
        C[i] = 0;
        while (!q.empty()) {
            auto e = q.top();
            q.pop();
            if (C[e.to] < e.cost)
                continue;
            if (e.index >= 0)
                U[e.index] = true;
            REP(j, V[e.to].node.size()) {
                auto &n = V[e.to].node[j];
                ll cost = n.cost + e.cost;
                if (C[n.to] <= cost)
                    continue;
                C[n.to] = cost;
                q.push(Edge{n.to, cost, n.index});
            }
        }
    }

    ll ans = 0;
    REP(i, M) {
        if (U[i])
            continue;
        ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 384
import numpy as np

L, R = map(int, input().split(" "))
#L, R = 2020, 4000000000
if R - L > 2019:
    print(0)
else:
    arr = np.array(np.arange(L, R+1))
    mod_list = []
    min_mod_list = []
    
    if (0 in (arr % 2019)) or (0 in arr):
        print(0)
    else:
    
        for i in arr:
            mod_list = []
            index_ = np.where(arr==i)
            if i == arr[-1]:
                break
            
            for j in arr[int(index_[0])+1:]:
                mod_list.append((i * j) % 2019)
     
            min_mod_list.append(min(mod_list))
            if min(mod_list) == 0:
                break
    
    
        print(min(min_mod_list))


Measured memory_bytes: 12424
import Data.List.Split
import qualified Data.ByteString.Char8 as B
import Data.Maybe (fromJust)

main :: IO ()
main = do
    [a, b] <- map (fst . fromJust . B.readInt) . B.words <$> B.getLine
    s <- getLine
    putStrLn $ case splitOn "-" s of
        [as, bs] -> if length as == a && length bs == b then "Yes" else "No"
        _        -> "No"


Measured memory_bytes: 380
#include <bits/stdc++.h>
#define VI vector<int>
#define VVI vector<vector<int>>
#define REP(i, n) for (int i = 0; i < (n); i++)
#define MOD 1000000007
#define INF 1e18
#define All(x) (x).begin(), (x).end()
typedef long long ll;
using namespace std;

int main() {
  string s;
  int K;
  cin >> s >> K;
  for (int i = 0; i < K;i++){
    if(s[i]!='1'){
      cout << s[i] << endl;
      return 0;
    }
  }
  cout << 1 << endl;

  return 0;
}

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

int main(){
    int n;
    cin >> n;
    vector<int> v(n);
    rep(i, n){
        cin >> v.at(i);
    }
    
    vector<pair<int, int>> p1(100001), p2(100001);
    rep(i, 100001){
        p1.at(i).second = i+1;
        p2.at(i).second = i+1;
    }
    
    rep(i, n/2){
        p1.at(v.at(i*2+1)).first++;
        p2.at(v.at(i*2)).first++;
    }
    sort(p1.begin(), p1.end(), greater<pair<int, int>>());
    sort(p2.begin(), p2.end(), greater<pair<int, int>>());

    long long ans;
    if(p1.at(0).second != p2.at(0).second){
        ans = (n/2 - p1.at(0).first) + (n/2 - p2.at(0).first);
    }
    else{
        if(p1.at(0).first + p2.at(1).first > p1.at(1).first + p2.at(0).first){
            ans = (n/2 - p1.at(0).first) + (n/2 - p2.at(1).first);
        }
        else{
            ans = (n/2 - p1.at(1).first) + (n/2 - p2.at(0).first);
        }
    }
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 2176
#include<bits/stdc++.h>
#define ll long long
#define N 100005
#define M 1000000007
#define pii pair<ll,ll>
#define fast ios_base::sync_with_stdio(0);cin.tie(0);
using namespace std;
main()
{
    int n;
    cin>>n;
    int last=0;
    ll ans=0;

    for(int i=1;i<=n;i++)
    {
        int x;
        cin>>x;
        if(last==1&&x>=1)
        {
            last=0;
            ans++;
            x--;
        }
        ans+=x/2;
        last=x%2;
    }
    cout<<ans;

}


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

using namespace std;
class segment{
    public:
    int index;
    int comp;
    int other;
    segment(){

    }
    
    
};
inline bool sorter(segment a, segment b){
    return a.comp<b.comp;
}
segment* input;
segment* removal;
int main(){
    set<int> avail;
    
    int N,Q;
    scanf("%d %d", &N, &Q);
    input=new segment[N];
    removal=new segment[N];
    for(int count=0;count<N;count++){
        int from, to, at;
        scanf("%d %d %d", &from, &to, &at);
        from-=at;
        to-=at;
        input[count].index=at;
        removal[count].index=at;
        input[count].comp=from;
        input[count].other=to;
        removal[count].comp=to;
    }
    sort(&input[0], &input[N], sorter);
    sort(&removal[0], &removal[N], sorter);
    int at=0;
    int at2=0;
    for(int count=0;count<Q;count++){
        int next;
        scanf("%d", &next);
        while(at2<N&&removal[at2].comp<=next){
            avail.erase(removal[at2].index);
            // printf("removed %d\n", removal[at2].index);
            at2++;
        }
        while(at<N&&input[at].comp<=next){
            if(input[at].other>next){
                
            avail.insert(input[at].index);
            }
            // printf("added %d\n", input[at].index);
            at++;
        }
        
        if(avail.empty()){
            printf("-1\n");
        }
        else{

        printf("%d\n",*avail.begin());
        }
    }

}

Measured memory_bytes: 15360
#include <stdio.h>
#include <stdlib.h>
int main(){
  int *a,*b;
  int c[10000],n,i;

  scanf("%d",&n);

  a=malloc(sizeof(int)*n+1);
  b=malloc(sizeof(int)*n+1);

  for(i=0;i<=10000;i++){
    c[i]=0;
  }

  for(i=0;i<=n-1;i++){
    scanf("%d",&a[i+1]);
    c[a[i+1]]++;
  }

  for(i=0;i<=10000;i++){
    c[i+1]=c[i]+c[i+1];
  }
  
  for(i=n;i>=1;i--){
    b[c[a[i]]]=a[i];
    c[a[i]]--;
  }

  for(i=1;i<=n;i++){
    printf("%d",b[i]);
    if(i!=n)printf(" ");
  }

  printf("\n");

  return 0;
}



Measured memory_bytes: 17440
import math
N=int(input())
m=10**6+1
M=[0]*m
g=0
for i in map(int,input().split()):M[i]+=1;g=math.gcd(g,i)
if g>1:print('not coprime')
elif all(sum(M[i::i])<=1 for i in range(2,m)):print('pairwise coprime')
else:print('setwise coprime')


Measured memory_bytes: 187304
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
#define vi vector<int>
#define vb vector<bool>
#define pii pair<int,int>
#define mod 1000000007
int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n,k,R,S,P,i;
    string T;
    cin>>n>>k;
    cin>>R>>S>>P;
    cin>>T;
    int ans=0;
    string s;
    for(i=0;i<k;i++){
        if(T[i]=='r'){
            ans+=P;
            s+='p';
        }
        else if(T[i]=='p'){
            ans+=S;
            s+='s';
        }
        else{
            ans+=R;
            s+='r';
        }
    }
    for(i=k;i<n;i++){
        if(T[i]=='r'){
            if(s[i-k]!='p'){
                ans+=P;
                s+='p';   
            }
            else{
                s+='2';
            }
        }
        else if(T[i]=='p'){
            if(s[i-k]!='s'){
                ans+=S;
                s+='s';
            }
            else{
                s+='2';
            }
        }
        
        if(T[i]=='s'){
            if(s[i-k]!='r'){
                ans+=R;
                s+='r';    
            }
            else{
                s+='2';
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>

using namespace std;

int main(){
    int k,a,b;
    cin>>k;
    cin>>a;
    cin>>b;

    if(a/k * k >=a || a/k*k + k <=b){
        cout<<"OK"<<endl;
    }else{
        cout<<"NG"<<endl;
    }
    return 0;
}

Measured memory_bytes: 3592
#include<map>
#include<set>
#include<cmath>
#include<ctime>
#include<queue>
#include<tuple>
#include<cstdio>
#include<string>
#include<vector>
#include<cassert>
#include<iostream>
#include<algorithm>
#include<functional>
using namespace std;
string S; int dp[109][109], minx = 10000;
int main() {
	cin >> S;
	for (int i = 0; i < 26; i++) {
		for (int j = 0; j < S.size(); j++) { if (S[j] == ('a' + i))dp[0][j] = 1; else dp[0][j] = 0; }
		for (int j = 1; j < S.size(); j++) {
			for (int k = 0; k < S.size() - j; k++) {
				if (dp[j - 1][k] == 1 || dp[j - 1][k + 1] == 1)dp[j][k] = 1; else dp[j][k] = 0;
			}
		}
		for (int j = 0; j < S.size(); j++) {
			bool OK = false;
			for (int k = 0; k < S.size() - j; k++) {
				if (dp[j][k] == 0)OK = true;
			}
			if (OK == false) {
				minx = min(minx, j);
			}
		}
	}
	cout << minx << endl;
	return 0;
}

Measured memory_bytes: 764
#include<bits/stdc++.h>
using namespace std;
const int N = 1e5+5;
int A[N], n, l;
vector<int> v;
int main(){
    scanf("%d %d", &n, &l);
    for(int i=0;i<n;i++) scanf("%d", &A[i]);
    for(int i=0;i<n-1;i++){
        if(A[i]+A[i+1]>=l){
            for(int j=0;j<i;j++) v.push_back(j);
            for(int j=n-2;j>=i;j--) v.push_back(j);
            break;
        }
    }
    if(v.empty()) return !printf("Impossible");
    printf("Possible\n");
    for(int x:v) printf("%d\n", x+1);
}

Measured memory_bytes: 1784
package main

import "fmt"

func main() {
	var a, b int
	fmt.Scan(&a, &b)
	for i := 1; i <= 3; i++ {
		if a * b * i % 2 == 1 {
			fmt.Println("Yes")
			return
		}
	}
	fmt.Println("No")
}


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

int main() {	
  int a, b, x;
  double A, B, y;
  cin >> a >> b;	
  A = (double)a;
  B = (double)b;
  x = (a+b)/2;
  y = (A+B)/2;
  if (y-x > 0){
   	x =  x+1;
  }else{
    x = x;
  }	
  cout << x << endl;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func Scan() string {
	sc.Scan()
	return sc.Text()
}
func iScan() int {
	n, _ := strconv.Atoi(Scan())
	return n
}
func fScan() float64 {
	n, _ := strconv.ParseFloat(Scan(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func SScan(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scan()
	}
	return a
}
func iSScan(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = iScan()
	}
	return a
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func sum(a []int) int {
	x := 0
	for _, v := range a {
		x += v
	}
	return x
}

var mod int = 1000000007

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	n := iScan()
	p := iSScan(n)
	x := mod
	ans := 0
	for _, v := range p {
		if x > v {
			ans++
			x = v
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 4760
from itertools import combinations as c
s=input()
r=0
for j in range(1,len(s)):
  for i in c(range(1,len(s)),j):
    k=[0]+list(i)+[len(s)]
    v=sum(map(int,[s[k[i]:k[i+1]] for i in range(j+2-1)]))
    r+=v
print(r+int(s))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define all(v) (v).begin(),(v).end()
using namespace std;
using LL = long long;
// 型に合わせた値 2倍してもオーバーフローしないようにする
const int INF = 1e9;
// const LL INF = 1e17;

int main(){
    int D, G;
    cin >> D >> G;
    vector<int> p(D), c(D);
    for(int i=0; i<D; i++){
        cin >> p[i] >> c[i];
    }
    int ans = INF;
    for(int s=0; s<(1<<D); s++){
        int solve = 0, score = 0;
        int partial = -1;
        for(int i=0; i<D; i++){
            // i番目のセットをすべて解く
            if(s & (1<<i)){
                solve += p[i];
                score += 100*(i+1)*p[i] + c[i];
            }else{
                partial = i;
            }
        }
        // G点に達するまで問題を解く
        int less = G-score;
        if(less > 0){
            // 余った最高点のセットを解き切っても足りないなら、その組み合わせは不適
            if(less > 100*(partial+1)*p[partial]) continue;

            solve += min(p[partial], (less-1)/(100*(partial+1))+1);
        }
        ans = min(ans, solve);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
using namespace std;
#include <iostream>/*{{{*/
struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast;

#include <bits/stdc++.h>

#define rep(i, x) for(int i = 0; i < (int)(x); i++)
#define reps(i,x) for(int i = 1; i <= (int)(x); i++)
#define rrep(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define rreps(i,x) for(int i=((int)(x));i>0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define RFOR(i, m, n) for(int i = m;i >= n;i--)
#define foreach(x,a) for(auto& (x) : (a) )
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define fill(x,y) memset(x,y,sizeof(x))
#define pb(a) push_back(a)
// dump macro{{{
// http://www.creativ.xyz/dump-cpp-652
#define DUMPOUT cerr // 変数ダンプ先。coutかcerr
 
#define DEBUG_ // 提出時はコメントアウト
#ifdef DEBUG_
#define DEB
#else
// DEB と打つとデバッグ時以外はコメントアウトになる
#define DEB /##/
#endif
 
// 変数ダンプ用マクロ。デバッグ時以外は消滅する
// 引数はいくつでもどんな型でも可（ストリーム出力演算子があればOK）
#define dump(...) DEB DUMPOUT<<"  "; \
DUMPOUT<<#__VA_ARGS__; \
DUMPOUT<<":=> "; \
dump_func(__VA_ARGS__); DUMPOUT<<"in ["<<__LINE__<<":"<<__FUNCTION__<<"]"<<endl;
 
// デバッグ用変数ダンプ関数
void dump_func() {
}
template <class Head, class... Tail>
void dump_func(Head&& head, Tail&&... tail)
{
    DUMPOUT << head;
    if (sizeof...(Tail) == 0) {
        DUMPOUT << " ";
    }
    else {
        DUMPOUT << ", ";
    }
    dump_func(std::move(tail)...);
}
 
// vector出力
template<typename T>
ostream& operator << (ostream& os, vector<T>& vec) {
    os << "{";
    for (int i = 0; i<vec.size(); i++) {
        os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
    }
    os << "}";
    return os;
}/*}}}*/
#define debug(x)                 cerr << __LINE__ << ": " << #x << " -> " << x << '\n'
#define debug2(x, y)             cerr << __LINE__ << #x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define debug3(x, y, z)          cerr << __LINE__ << #x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define debug4(a, b, c, d)       cerr << __LINE__ << #a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define debug5(a, b, c, d, e)    cerr << __LINE__ << #a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define debug6(a, b, c, d, e, f) cerr << __LINE__ << #a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
#define db_2d(d,n,m) rep(i,n){rep(j,m){ cerr << (d)[i][j] << (((j)==(m-1))?"\n":" "); }}
#define db_1d(d,n) rep(i,n){cout << d[i] << (((i)==(n-1))?"\n":" ") << __LINE__}
#define INF 999999999
#define MOD 1000000007
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long long ll;
typedef vector<long long> vll;
typedef vector<vll> vvll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<pii> vii;
typedef vector<vii> vvii;
typedef tuple<int,int,int> iii;
typedef set<int> si;
typedef complex<double> pnt;
typedef vector<pnt> vpnt;
typedef priority_queue<pii,vii,greater<pii> > spq;
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};/*}}}*/

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

  ll res=k;

  res*=pow((k-1), (n-1));

  cout<<res<<endl;

  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
 
int main() {
	int n;
	scanf("%d", &n);
	long long a[n];
	for (int i = 0; i < n; i++) {
		scanf("%lld", &a[i]);
	}
	int l = 0, r = 0;
	int now = 0;
	long long ans = 0;
	while (l < n) {
		while (r < n && (now ^ a[r]) == now + a[r]) {
			now ^= a[r++];
		}
		now ^= a[l++];
		ans += r - l + 1;
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 1792
// Written By NewbieChd
#include <iostream>
#include <iomanip>
#include <cmath>
// #define double long double
using namespace std;

const int maxN = 100003;
const double eps = 1e-8, inf = 1e18;
inline double absolute(double x) { return x >= 0 ? x : -x; }
inline double square(double x) { return x * x; }

struct Vector {
    double x, y;
    Vector() {}
    Vector(double x, double y) : x(x), y(y) {}
    friend Vector operator+(const Vector& a, const Vector& b) { return Vector(a.x + b.x, a.y + b.y); }
    friend Vector operator-(const Vector& a, const Vector& b) { return Vector(a.x - b.x, a.y - b.y); }
    friend Vector operator*(const Vector& a, const double& b) { return Vector(a.x * b, a.y * b); }
    friend Vector operator/(const Vector& a, const double& b) { return Vector(a.x / b, a.y / b); }
    inline double length() { return sqrt(square(x) + square(y)); }
    inline void read() { cin >> x >> y; }
    inline void write() { cout << fixed << setprecision(10) << x << ' ' << y << '\n'; }
};
inline double distance(Vector a, Vector b) { return sqrt(square(b.x - a.x) + square(b.y - a.y)); }
inline double dot(Vector a, Vector b) { return a.x * b.x + a.y * b.y; }
inline double cross(Vector a, Vector b) { return a.x * b.y - a.y * b.x; }

inline Vector project(Vector a, Vector b, Vector c) {
    b = a - b;
    return b * (dot(b, c - a) / (square(b.x) + square(b.y))) + a;
}
inline Vector reflect(Vector a, Vector b, Vector c) {
    a = project(a, b, c);
    return a * 2 - c;
}

inline bool intersect(Vector a, Vector b, Vector c, Vector d) {
    if (max(min(a.x, b.x), min(c.x, d.x)) > min(max(a.x, b.x), max(c.x, d.x)) + eps || 
        max(min(a.y, b.y), min(c.y, d.y)) > min(max(a.y, b.y), max(c.y, d.y)) + eps || 
        cross(a - c, d - c) * cross(d - c, b - c) + eps < 0 || 
        cross(c - a, b - a) * cross(b - a, d - a) + eps < 0)
        return 0;
    return 1;
}

struct Line {
    double A, B, C;
    Line() {}
    Line(double A, double B, double C) : A(A), B(B), C(C) {}
};
inline Line getLine(Vector a, Vector b) { return Line(b.y - a.y, a.x - b.x, a.y * (b.x - a.x) - a.x * (b.y - a.y)); }
inline Vector crossPoint(Line a, Line b) {
    double tmp = a.A * b.B - a.B * b.A;
    return Vector((a.B * b.C - b.B * a.C) / tmp, (b.A * a.C - a.A * b.C) / tmp);
}

inline double PointSegDistance(Vector a, Vector b, Vector c) {
    Vector l = b - a;
    double tmp;
    if ((tmp = dot(c - a, l) / (square(l.x) + square(l.y))) < eps)
        return distance(c, a);
    if (tmp + eps > 1)
        return distance(c, b);
    return distance(c, project(a, b, c));
}
inline double SegSegDistance(Vector a, Vector b, Vector c, Vector d) {
    if (intersect(a, b, c, d))
        return 0;
    return min(min(PointSegDistance(a, b, c), PointSegDistance(a, b, d)),
               min(PointSegDistance(c, d, a), PointSegDistance(c, d, b)));
}

int main() {
    ios::sync_with_stdio(false);
    int Q;
    Vector a, b, c, d;
    for (cin >> Q; Q; --Q)
        a.read(), b.read(), c.read(), d.read(),
        cout << fixed << setprecision(10) << SegSegDistance(a, b, c, d) << '\n';
    return 0;
}



Measured memory_bytes: 3296
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    int arr[n];
    for(int i=0; i<n; i++)
    {
        cin>>arr[i];
    }
    sort(arr,arr+n);
    int x=arr[n/2]-arr[n/2-1];
    cout<<x<<endl;
}


Measured memory_bytes: 640
import itertools
N = int(input())
P = tuple(map(int, input().split()))
Q = tuple(map(int, input().split()))
L = [i+1 for i in range(N)]
orders =list(itertools.permutations(L))
for i, order in enumerate(orders):
    if order == P:
        a = i
    if order == Q:
        b = i
print(abs(a-b))

Measured memory_bytes: 45424
#include <iostream>
#include <algorithm>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#include <vector>
#include <string>
using namespace std;

typedef long long ll;
typedef long double ld;

int main(){
  string temp;
  cin >> temp;
  if(temp=="ABC"){
    cout << "ARC";
  }
  else{
    cout << "ABC";
  }
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
#define rep(i,l,r) for(int i=int(l);i<int(r);i++)
#define put(x) cout<<#x<<" = "<<x<<endl;
#define X first
#define Y second
#define pb push_back
#define pp pop_back
using namespace std;
typedef long long num;
typedef pair<int,int> point;
const int maxn=305;

int n,k,dp[maxn][maxn][maxn];
char s[maxn];
int32_t main(){
    scanf("%s%d",s,&k);
    n=strlen(s);
    rep(i,0,n){
	rep(l,0,k+1){
	    dp[i][i][l]=1;
	    if(i<n-1){
		dp[i][i+1][l]=(l>0 || s[i]==s[i+1])?2:1;
	    }
	}
    }
    rep(size,2,n){
	rep(i,0,n-size){
	    int j=i+size;
	    rep(l,0,k+1){
		if(s[i]==s[j]){
		    dp[i][j][l]=dp[i+1][j-1][l]+2;
		}else{
		    if(l>0) dp[i][j][l]=dp[i+1][j-1][l-1]+2;
		    dp[i][j][l]=max({dp[i][j][l],dp[i+1][j][l],dp[i][j-1][l]});
		}
	    }
	}
    }
    printf("%d\n",dp[0][n-1][k]);
}


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

using namespace std;

#define DUMP(x) std::cout << (#x) << " = " << (x) << "\n"
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP(i, k, n) for (int i = (k); i < (int)(n); ++ i)
#define ALL(r) r.begin(), r.end()
#define YES puts("YES")
#define Yes puts("Yes")
#define NO puts("NO")
#define No puts("No")
#define IMP puts("IMPOSSIBLE")
#define Imp puts("Impossible")

using ll = std::int64_t;
using vint = std::vector<int>;
using vll = std::vector<ll>;
using vstr = std::vector<std::string>;
using pint = std::pair<int, int>;

constexpr std::int32_t INF = 1001001001;

void Main() {
    int n, m, x, y;
    cin >> n >> m >> x >> y;
    vint vx(n), vy(m);
    rep(i, n)cin >> vx[i];
    rep(i, m)cin >> vy[i];

    int x_max = *max_element(ALL(vx));
    int y_min = *min_element(ALL(vy));

    if (x_max < y_min && x_max < y && y_min > x) {
        puts("No War");
    }
    else {
        puts("War");
    }
}

int main() {
    std::cin.tie(nullptr);
        std::ios_base::sync_with_stdio(false);
        std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#define end ((a&1)||(b&1)||(c&1))
using namespace std;

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    int ans = 0;
    if (end)
        cout << 0;
    else {
        while (++ans) {
            if (a == b && a == c) {
                cout << -1;
                return 0;
            }
            int ta = a, tb = b, tc = c;
            a = (tb + tc) >> 1;
            b = (ta + tc) >> 1;
            c = (ta + tb) >> 1;
            if (end)
                break;
        }
        cout << ans;
    }
    return 0;
}

Measured memory_bytes: 256
#2
def chmin(a,b):
    if a>b:
        return b
    else:
        return a

N,K=map(int,input().split())
H=[int(x) for x in input().split()]

dp=[float("inf")]*N
dp[0]=0

for i in range(N):
    for j in range(1,K+1):
        if i+j<N:
            dp[i+j]=chmin(abs(H[i+j]-H[i])+dp[i],dp[i+j])
        else:
            break
print(dp[-1])

Measured memory_bytes: 55648
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    s=STR()
    n=len(s)
    for i in range(1,len(s)):
        if (len(s)-i)%2==1:
            pass
        else:
            #print(i)
            temp1=s[0:(n-i)//2]
            temp2=s[(n-i)//2:n-i]
            #print(temp1)
            #print(temp2)
            if temp1==temp2:
                print(n-i)
                break
if __name__ == '__main__':
    do()

Measured memory_bytes: 3064
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPS(I, a, b) for (int i = (a); i < (b); ++i)
using namespace std;
using ll = long long;

int main() {
  string s;
  cin >> s;
  
  bool ok = false;
  
  if(s[2] == s[3] && s[4] == s[5]){
    ok = true;
  }
  
  
  if(ok) cout << "Yes" << endl;
  else cout << "No" << endl;
    
  
}

Measured memory_bytes: 3632