akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
    #include<ext/pb_ds/assoc_container.hpp>
    #define int long long
    #define pb emplace_back
    #define mp make_pair
    #define tci(v,i) for(auto i=v.begin();i!=v.end();i++)
    #define all(v) v.begin(),v.end()
    #define rep(i,start,lim) for(long long (i)=(start);i<(lim);i++)
    #define boost ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
    #define osit ostream_iterator<int> output (cout," ")
    #define pv(x) copy(all(x),output)
    #define pa(a) rep(i,0,sizeof(a)/sizeof(a[0]))cout<<a[i]<<" "
    #define endl '\n'
    #define f first
    #define s second
    #define PI 3.141592653589793
    #define set0(x) memset(x,0,sizeof(x))
    #define sort_uniq(c) (sort(c.begin(), c.end()), c.resize(distance(c.begin(), unique(c.begin(), c.end()))))
    #define uniq(a) a.resize(distance(a.begin(), unique(a.begin(), a.end())))
    #define dg(x) cout<<#x<<':'<<x<<endl;
    #define dg2(x,y) cout<<#x<<':'<<x<<' '<<#y<<':'<<y<<endl;
    #define dg3(x,y,z) cout<<#x<<':'<<x<<' '<<#y<<':'<<y<<' '<<#z<<':'<<z<<endl;
    #define dg4(x,y,z,zz) cout<<#x<<':'<<x<<' '<<#y<<':'<<y<<' '<<#z<<':'<<z<<' '<<#zz<<':'<<zz<<endl;
    using namespace __gnu_pbds;
    using namespace std;
    typedef vector<int> vi;
    typedef pair<int,int> ii;
    typedef vector<ii> vii;
    typedef tree<pair<int,int>,null_type,less<pair<int,int>>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
    template<typename T> T gcd(T a,T b){if(a==0) return b; return gcd(b%a,a);}
    int isPowerof2(int x) { return (x && !(x & x-1)); }

    int32_t main(){
        boost;
        int n,m;
        cin>>n>>m;
        int ans=0;
        rep(i,0,m){
            int x;
            cin>>x;
            ans+=x;
        }
        cout<<max(-1ll,n-ans);
        return 0;
    }

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

int main(){
	int n;
	cin>>n;
	long long s=0;
	for(int i=1;i<=n;i++){
		if(i%3!=0&&i%5!=0){
			s+=i;
		}
	}
	cout<<s<<endl;
	return 0;
}


Measured memory_bytes: 3636
import java.util.Scanner;

class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);

    int time = scanner.nextInt();
    int h = time / 60 / 60;
    int m = (time / 60) % 60;
    int s = time % 60;

    System.out.println(h+":"+m+":"+s);
  }
}

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

using namespace std;
typedef long long ll;

bool finish(vector<ll> &la) {
  int n = la.size();
  for (ll a: la) {
    if (a >= n) return false;
  }
  return true;
}

int main() {
  ll n;
  cin >> n;
  vector<ll> la(n);
  for (ll &a: la) cin >> a;
  ll ans = 0;
  while (!finish(la)) {
    ll sum = 0;
    for (ll a: la) {
      sum += a/n;
    }
    for (ll &a: la) {
      ll diff = -(a/n)*n;
      diff += sum-a/n;
      a += diff;
    }
    ans += sum;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
a = int(raw_input())
b = int(raw_input())
c = int(raw_input())
x = int(raw_input())
ans = 0

for aa in range(a+1):
  if 500*aa > x:
    break
  for bb in range(b+1):
    if 500*aa + 100*bb > x:
      break
    for cc in range(c+1):
      if 500*aa + 100*bb + 50*cc == x:
        ans = ans + 1
      if 500*aa + 100*bb + 50*cc > x:
        break

print ans


Measured memory_bytes: 2568
using System.Linq;
using System.Collections.Generic;
using System;

public class Hello
{
    public static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var a = int.Parse(line[0]);
        var b = int.Parse(line[1]);
        var ret = new List<int>();
        ret.Add(a + b);
        ret.Add(a - b);
        ret.Add(a * b);
        Console.WriteLine(ret.Max());
    }
}


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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
using namespace std;


int main() {
    ll n, ans = 1;
    cin >> n;
    ll tmp;
    bool flag = true;
    bool isZero = false;

    vector<ll> A(n);
    rep(i, n) {
        cin >> A[i];
        if (A[i] == 0) isZero = true;
    }

    if (isZero) {
        cout << 0 << endl;
        return 0;
    }

    ll tmp1;
    ll li = 1e+18;
    rep(i, n) {
        if (A[i] == 0) continue;

        if (li / ans >= A[i]) {
            ans *= A[i];
        } else {
            flag = false;
        }
    }


    if (flag) {
        cout << ans << endl;
    } else {
        cout << "-1" << endl;
    }

    return 0;
}

Measured memory_bytes: 3972
#include <bits/stdc++.h>
using namespace std;
#define rep(i,i1,n) for(int i=(int)(i1);i<(int)(n);i++)
#define ll long long
#define vi vector<int>
#define vll vector<long long>

int main() {
  int n=0;
  cin>>n;
  vi vec(n);
  rep(i,0,n){
    cin>>vec.at(i);
  }
  sort(vec.begin(), vec.end());
  
  if(n==1||n==2){
    cout<<0;
    return 0;
  }
  
  int count=0;
  
  rep(i,0,n-2){
    rep(j,i+1,n-1){
      rep(k,j+1,n){
        //cout<<"a";
        if(vec.at(i)==vec.at(j)||vec.at(j)==vec.at(k)){
          continue;
          //cout<<"a";
        }
        if(vec.at(k)<vec.at(i)+vec.at(j)){
          if(vec.at(j)<vec.at(k)+vec.at(i)){
            if(vec.at(i)<vec.at(j)+vec.at(k)){
              count++;
            }
          }
        }
      }
    }
  }
  cout<<count;
}

Measured memory_bytes: 3628
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define P pair<long,long>
#define INF 1000000000000000000
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long MOD = 1000000007;
using namespace std;
typedef long long ll;
map<int, int> mp;
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
class Union_Find {
private:
	vector<int> par;
	vector<int> rank;
public:
	Union_Find(int n) {
		rep(i, n) {
			par.push_back(i);
			rank.push_back(0);
		}
	}
	int find(int x) {
		if (par.at(x) == x) return x;
		else return par.at(x) = find(par.at(x));
	}
	void unite(int x, int y) {
		x = find(x);
		y = find(y);
		if (x == y) return;
		if (rank.at(x) < rank.at(y)) {
			par.at(x) = y;
		}
		else {
			par.at(y) = x;
			if (rank.at(x) == rank.at(y)) rank.at(x)++;
		}
	}
	bool same(int x, int y) {
		return find(x) == find(y);
	}
};

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n, k; cin >> n >> k;
	n--;
	int ans = 0;
	while (n > 0) {
		n = n - k + 1;
		ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
class BIT:
    def __init__(self, n):
        #A1 ... AnのBIT(1-indexed)
        self.BIT = [0] * (n + 1)
        self.n = n

    #A1 ~ Aiまでの和 O(logN)
    def query(self, idx):
        res_sum = 0
        while idx > 0:
            res_sum += self.BIT[idx]
            idx -= idx & (-idx)
        return res_sum

    #Ai += x O(logN)
    def add(self, idx, x):
        while idx <= self.n:
            self.BIT[idx] += x
            idx += idx&(-idx)
        return
def get_int(f):
    if "." not in f:
        return int(f),0
    return int(f.replace(".","")),len(f)-f.index(".")-1
n = int(input())
p = [0] * n
for i in range(n):
    a, b = get_int(input())
    c, d = 0, 0
    while a % 2 == 0:
        c += 1
        a //= 2
    while a % 5 == 0:
        d += 1
        a //= 5
    c -= b
    d -= b
    p[i] = (c, d)
p.sort()

now = n - 1
t = BIT(50)
ans = 0
for i in range(n):
    for j in range(now, i, -1):
        if p[i][0] + p[j][0] >= 0:
            t.add(-p[j][1] + 25, 1)
            now -= 1
        else:
            break
    if now < i:
        t.add(-p[i][1] + 25, -1)
    ans += max(0, t.query(25 + p[i][1]))

print(ans)

Measured memory_bytes: 87420
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<limits>
#include<set>
#include<deque>
#include<queue>
#include<stack>
using namespace std;
#define int long long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define dup(x,y) (((x)+(y)-1)/(y))
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
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; }
typedef pair<int, int>P;
const int MOD = 1e9 + 7;
//const int MOD = 998244353;
const int INF = 1e18;
const long double PI = (acos(-1));


signed main() {
	string S;
	cin >> S;
	if (S.back() == 's') {
		cout << S << "es";
	}
	else {
		cout << S << "s";
	}
}

Measured memory_bytes: 3620
path = [list(map(int, input().split())) for _ in range(3)]
cnt = [0, 0, 0, 0]
for i in range(3):
    cnt[path[i][0] - 1] += 1
    cnt[path[i][1] - 1] += 1
if 3 in cnt:
    print("NO")
else:
    print("YES")

Measured memory_bytes: 3060
<?php
fscanf(STDIN, "%d%d", $num, $k);

if($num == $k){
    echo 0;
}elseif($num < $k){
    echo min($num, abs($k - $num));
}else{
    $last = $num % $k;
    echo min($last, abs($k - $last));
}


Measured memory_bytes: 4604
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
using namespace std;
typedef long long int ll;

// clang-format off
#ifdef _DEBUG_
#define dump(...) do{ cerr << __LINE__ << ":\t" << #__VA_ARGS__ << " = "; PPPPP(__VA_ARGS__); cerr << endl; } while(false)
template<typename T> void PPPPP(T t) { cerr << t; }
template<typename T, typename... S> void PPPPP(T t, S... s) { cerr << t << ", "; PPPPP(s...); }
#else
#define dump(...)
#endif
template<typename T> vector<T> make_v(size_t a, T b) { return vector<T>(a, b); }
template<typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v(ts...))>(a, make_v(ts...)); }
template<typename T>
bool chmin(T &a, T b) { if (a > b) {a = b; return true; } return false;}
template<typename T>
bool chmax(T &a, T b) { if (a < b) {a = b; return true; } return false;}
// clang-format on

#include <iomanip>

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    double ans = 0;
    REP (i, 0, n) {
        double a;
        cin >> a;
        ans += 1 / a;
    }
    cout << fixed << setprecision(10) << 1 / ans << endl;
    return 0;
}


Measured memory_bytes: 256
def gcd(a, b):
    while b: a, b = b, a % b
    return a
def isPrimeMR(n):
    d = n - 1
    d = d // (d & -d)
    L = [2]
    for a in L:
        t = d
        y = pow(a, t, n)
        if y == 1: continue
        while y != n - 1:
            y = (y * y) % n
            if y == 1 or t == n - 1: return 0
            t <<= 1
    return 1
def findFactorRho(n):
    m = 1 << n.bit_length() // 8
    for c in range(1, 99):
        f = lambda x: (x * x + c) % n
        y, r, q, g = 2, 1, 1, 1
        while g == 1:
            x = y
            for i in range(r):
                y = f(y)
            k = 0
            while k < r and g == 1:
                ys = y
                for i in range(min(m, r - k)):
                    y = f(y)
                    q = q * abs(x - y) % n
                g = gcd(q, n)
                k += m
            r <<= 1
        if g == n:
            g = 1
            while g == 1:
                ys = f(ys)
                g = gcd(abs(x - ys), n)
        if g < n:
            if isPrimeMR(g): return g
            elif isPrimeMR(n // g): return n // g
            return findFactorRho(g)
def primeFactor(n):
    i = 2
    ret = {}
    rhoFlg = 0
    while i*i <= n:
        k = 0
        while n % i == 0:
            n //= i
            k += 1
        if k: ret[i] = k
        i += 1 + i % 2
        if i == 101 and n >= 2 ** 20:
            while n > 1:
                if isPrimeMR(n):
                    ret[n], n = 1, 1
                else:
                    rhoFlg = 1
                    j = findFactorRho(n)
                    k = 0
                    while n % j == 0:
                        n //= j
                        k += 1
                    ret[j] = k

    if n > 1: ret[n] = 1
    if rhoFlg: ret = {x: ret[x] for x in sorted(ret)}
    return ret
def gcd(a, b):
    while b: a, b = b, a % b
    return a

N = int(input())
A = list(map(int, input().split()))
# N = 10 ** 6
# A = [10 ** 6] * N
pairwise = False
prime_key = set(primeFactor(A[-1]).keys())
break_flag = False
prime_flags = [False] * (10 ** 6 + 1)
for i in range(N):
    for key in primeFactor(A[i]).keys():
        if prime_flags[key]:
            break_flag = True
            break
        else:
            prime_flags[key] = True
    if break_flag:
        break
else:
    pairwise = True
if pairwise:
    print('pairwise coprime')
    exit()
work = gcd(A[0], A[1])
for i in range(2, N):
    work = gcd(work, A[i])
if work != 1:
    print('not coprime')
else:
    print('setwise coprime')

Measured memory_bytes: 188012
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
using namespace std;

int h, w, n; 

template < typename T >
inline T read()
{
	T x = 0, w = 1; char c = getchar();
	while(c < '0' || c > '9') { if(c == '-') w = -1; c = getchar(); }
	while(c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
	return x * w; 
}

int main()
{
	h = read <int> (), w = read <int> (), n = read <int> ();
	if(h >= w)
		printf("%d\n", (n + h - 1) / h);
	else
		printf("%d\n", (n + w - 1) / w); 
	return 0; 
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
#define MAX 100005
#define NIL -1

struct Node { int p, l, r; };

Node T[MAX];
int n,D[MAX];

void print(int u)
{
  int i,c;
  cout << "node " << u << ": ";
  cout << "parent = " << T[u].p << ", ";
  cout << "depth = " << D[u] << ", ";

  if( T[u].p == NIL ) cout << "root, ";
  else if(T[u].l == NIL) cout << "leaf, ";
  else cout << "internal node, ";

  cout << "[";

  for(i=0,c=T[u].l;c !=NIL;i++,c=T[c].r)
    {
      if(i) cout << ", ";
      cout << c;
    }
  cout << "]" << endl;
}

int rec(int u, int p)
{
  D[u]=p;
  if(T[u].r != NIL) rec(T[u].r,p);
  if(T[u].l != NIL) rec(T[u].l,p+1);
}

int main ()
{
  int i,j,d,v,c,l,r;
  cin >> n;
  for(i=0;i<n;i++) T[i].p=T[i].l=T[i].r=NIL;

  for(i=0;i<n;i++)
    {
      cin >> v >> d;
      for (j=0;j<d;j++)
	{
	  cin >> c;
	  if (j==0) T[v].l=c;
	  else T[l].r = c;
	  l=c;
	  T[c].p=v;
	}
    }
  for (i=0;i<n;i++)
    {
      if(T[i].p==NIL) r=i;
    }

  rec(r,0);

  for(i=0;i<n;i++) print(i);

  return 0;
}



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

#define int long long
const double PI = 3.14159265358979323846;
typedef vector<int> vint;
typedef pair<int, int> pint;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
// cout << fixed << setprecision(20);

int N;
int p[110000];
signed main() {
    cin>>N;
    int sum=0,m=0;
    for(int i=0;i<N;i++){
        cin>>p[i];
        sum+=p[i];
        m=max(m,p[i]);
    }
    cout<<sum-m/2<<endl;

}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <utility>
#include <iomanip>
#include <functional>
#include <queue>
#include <stack>
#include <map>
#include <vector>
#include <cmath>
#include <cctype>
#define ll long long
#define INF 1e+18
#define MOD 998244353
using namespace std;


int main(){
    string S,T;
    cin >> S >> T;
    
    int l=S.length();
    
    int num1[26]={};
    int num2[26]={};
    
    for(int i=0; i<l; i++){
        num1[S[i]-'a']++;
        num2[T[i]-'a']++;
    }
    
    sort(num1,num1+26);
    sort(num2,num2+26);
    
    for(int i=0; i<26; i++){
        if(num1[i]!=num2[i]){
            cout<<"No"<<endl;
            return 0;
        }
    }
    
    
    cout<<"Yes"<<endl;
    return 0;
}


Measured memory_bytes: 776
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define INF (int)1e9
using namespace std;
typedef long long ll;

const int MAX_N = 10010;
const int MAX_H = 10010;
int dp[MAX_N][MAX_H];
int main(void)
{
	int h, n;
	int a[1001], b[1001];
	int ans;
	
	cin >> h >> n;
	for (int i = 1; i <= n; i++)
		cin >> a[i] >> b[i];
	rep(i, MAX_N) rep(j, MAX_H) dp[i][j] = INF;
	rep(i, MAX_N) dp[i][0] = 0;
	for(int i = 1; i <= n; i++)
	{
		for(int j = 1; j < MAX_H; j++)
		{
			if (j - a[i] >= 0)
				dp[i][j] = min(dp[i][j], dp[i][j - a[i]] + b[i]);
			dp[i][j] = min(dp[i][j], dp[i - 1][j]);
		}
	}
	/*rep(i, n+1)
	{
		rep(j, h+1)
		{
			if (dp[i][j] == INF)
				cout << "INF" << " ";
			else
			cout << dp[i][j] << " ";
		}
		cout << endl;
	}*/
	ans = INF;
	for(int i = h; i < MAX_H; i++)
	{
		ans = min(dp[n][i], ans);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 391680
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define si(x) int(x.size())
const int mod=1000000007,MAX=200005,INF=1<<29;

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N,K;cin>>N>>K;
    ll ans=0;
    for(ll i=K;i<=N+1;i++){
        ll left=(0+i-1)*i/2,right=(N-i+1+N)*i/2;
        ans+=right-left+1;
        ans%=mod;
    }
    
    cout<<ans<<endl;
}



Measured memory_bytes: 3664
while gets
    puts case $_.to_f
    when 0.0..48.0
        "light fly"
    when 48.0..51.0
        "fly"
    when 51.0..54.0
        "bantam"  
    when 54.0..57.0
        "feather" 
    when 57.0..60.0
        "light"
    when 60.0..64.0
        "light welter"    
    when 64.0..69.0
        "welter"
    when 69.0..75.0
        "light middle"
    when 75.0..81.0
        "middle"
    when 81.0..91.0
        "light heavy" 
    else
        "heavy" 
    end
end

Measured memory_bytes: 6104
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long ll;

int main() {
    int N;
    cin >> N;
    vector<int> A(N+1);
    vector<int> B(N);
    for (int i = 0; i < N+1; ++i) cin >> A[i];
    for (int i = 0; i < N; ++i) cin >> B[i];
    
    ll ans = 0;
    for (int i = 0; i < N; ++i) {
        int left = min(A[i], B[i]);
        ans += left;
        A[i] -= left;
        B[i] -= left;

        int right = min(A[i+1], B[i]);
        ans += right;
        A[i+1] -= right; 
        B[i] -= right; 
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
open System

let [|n; m|] = Console.ReadLine().Split(' ') |> Array.map int

let P = 1000000007L
let mutable fac : int64 array = Array.zeroCreate(m+1)
let mutable inv : int64 array = Array.zeroCreate(m+1)
let mutable facinv : int64 array = Array.zeroCreate(m+1)
fac.[0] <- 1L
inv.[0] <- 1L
facinv.[0] <- 1L
fac.[1] <- 1L
inv.[1] <- 1L
facinv.[1] <- 1L
for i = 2 to m do
    fac.[i] <- fac.[i-1]*int64(i)%P
    inv.[i] <- (-(((P/int64(i))*inv.[int(P)%i])%P)+P)%P
    facinv.[i] <- facinv.[i-1]*inv.[i]%P
let C n m = fac.[n]*facinv.[m]%P*facinv.[n-m]%P
let mutable Ans = 0L
for i = 0 to n do
    Ans <- (Ans+C(n)(i)*C(m-i)(n-i)%P*fac.[n-i]%P*int64(1-(i&&&1)*2)+P)%P
Console.Write(Ans*C(m)(n)%P*fac.[n]%P)

Measured memory_bytes: 40176
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,n) for(int i=0;i<n;i++)
#define why(n,x) int n;while(cin >>n,n!=x)
#define iFOR(i,x,n)for(int i=x;i<n;i++)
#define unless(flg) if ( !(flg) )
#define read cin<<
#define echo cout<<
#define fin <<'\n'
#define __ <<" "<<
#define ___ <<" "
#define bash push_back
#define ALL(x) x.begin(),x.end()
#define SWAP(a,b) ((a != b) && (a += b,b = a - b,a -= b))
#define cinf(n,x) for(int UNCH=0;UNCH<(n);UNCH++) cin >> x[UNCH];
#define fcin(n,x) for(int UNCH=1;UNCH<=(n);UNCH++) cin>> x[UNCH];
#define memmin(x) memset((x),-1,sizeof((x)))
#define memzer(x) memset((x), 0,sizeof((x)))
#define meminf(x) memset((x),0x3f,sizeof((x)))
#define int long long
typedef long long ll;
typedef pair < int , int >  pii;
typedef vector < int > vit;
typedef map < string , int > mstit;
typedef vector < pii > vpi ;
typedef greater < pii > gpi;
typedef priority_queue < pii , vpi , gpi > dijk ;
static const signed int INF = 0x3f3f3f3f;
static const signed long long LINF = 0x3f3f3f3f3f3f3f3fLL;
static const signed int SMOD = 1000000007;
static const signed int NMOD = 1000000009;
static const signed int dx[]={1,0,-1,0,1,1,-1,-1};
static const signed int dy[]={0,-1,0,1,-1,1,-1,1};

bool inside(int x,int y,int w,int h){return (x>=0 && y>=0 && x<w && y<h);}
template<class T>T abs(T &x){return x<0 ? -x : x;}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
int qp(int a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}



signed main(){

  int n,a,b;
  string str;
  int x[3];
  cinf(3,x);
  sort(x,x+3);
  cout <<x[0]+x[1] fin;

  return 0;
}



struct xyz{ xyz(){ cin.tie(0), ios::sync_with_stdio(false); cout <<fixed<<setprecision(12);};}xyzzy;



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
typedef long long ll;
typedef pair<int,int> P;
using vi=vector<int>;
using vvi=vector<vector<int>>;
using vc=vector<char>;
using vvc=vector<vector<char>>;
void chmin(int a,int b){if(b<a)a=b;}
void chmax(int a,int b){if(a<b)a=b;}

int main(){
  string s,t;
  cin>>s>>t;
  int n=s.size(),m=t.size();
  bool c=false;
  for(int i=n-m;i>=0;i--){
    bool b=true;
    rep(j,m){
      if(s[i+j]!=t[j]&&s[i+j]!='?'){
        b=false;
        break;
      }
    }
    if(b){
      rep(j,m){
        s[j+i]=t[j];
      }
      c=true;
      break;
    }
  }
  if(!c){
    cout<<"UNRESTORABLE"<<endl;
    return 0;
  }
  rep(i,n){
    if(s[i]=='?')s[i]='a';
  }
  cout<<s<<endl;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void) {
int H,W;
int x,y;

while(scanf("%d %d", &H, &W), (H+W) != 0) {
for (x = 0; x < H; x++) {
for (y = 0; y < W; y++) {
if (x == 0 || x == H-1 || y == 0 || y == W-1) {
printf("#");
} else {
printf(".");
}
}
printf("\n");
}
printf("\n");
}

return (0);
}

Measured memory_bytes: 572
#include <iostream>
#include <algorithm>
#include <cstdio>
using namespace std;
int n;
int a[205];
int mx,mn=1e9;
int ans=1e9;
int main(){
	cin>>n;
	for (int i=1;i<=n;i++){
		cin>>a[i];
		mx=max(mx,a[i]);
		mn=min(mn,a[i]);
	}
	for (int k=mn;k<=mx;k++){
		int t=0;
		for (int i=1;i<=n;i++){
			t+=(a[i]-k)*(a[i]-k);
		}
		ans=min(ans,t);
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template<class T,class U> using P = pair<T,U>;
template<class T> using vec = vector<T>;
template<class T> using vvec = vector<vec<T>>;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)

struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2
    vector<ll> sz;

    UnionFind(int N) : par(N), sz(N){ //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
        for(int i = 0; i < N; i++) sz[i] = 1;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    ll size_(int x) {
        if (par[x] == x) return sz[x];
        return sz[x] = size_(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        ll tmp = sz[rx] + sz[ry];
        sz[rx] = tmp;
        sz[ry] = tmp;
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

int main(){
    int n, m;
    cin >> n >> m;
    vec<int> a(m), b(m);
    rep(i, m) {
        int aa, bb; cin >> aa >> bb;
        aa--, bb--;
        a[i] = aa, b[i] = bb;
    }
    vec<ll> ans(m+1);
    UnionFind tree(n);
    ans[m] = (ll) n * (n-1) / 2;
    rep(i, m) {
        if (tree.same(a[m-i-1], b[m-i-1])==true) {
            ans[m-i-1] = ans[m-i];
        } else {
            ans[m-i-1] = ans[m-i] - (ll)tree.size_(a[m-i-1]) * tree.size_(b[m-i-1]);
            tree.unite(a[m-i-1], b[m-i-1]);
        }
    }
    rep(i, m) cout << ans[i+1] << endl;
}

Measured memory_bytes: 4096
#include <stdio.h>

int main(){
	int a[3];
	int i,j,x;
	scanf("%d %d %d",&a[0],&a[1],&a[2]);
	for(i=0; i<3; i++){
		for(j=i+1; j<3; j++){
			if(a[i] > a[j]){
				x=a[j];
				a[j]=a[i];
				a[i]=x;
			}
		}
	}
	printf("%d %d %d\n",a[0],a[1],a[2]);
	return 0;
}

Measured memory_bytes: 596
//http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0353

#include<bits/stdc++.h>
const int N = 2e5 + 5;
using namespace std;

typedef priority_queue <int, vector <int>, greater <int> > PQ;
PQ mq[2*N];
int l, r, n, a[N], p[N];
long long ans;

void Union(PQ&a, PQ&b){
    if (a.size() < b.size()) a.swap(b);
    while (b.size()){
        a.push(b.top()); b.pop();
    }
}

signed main(){
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    cin >> n; l = 1; r = n;
    for (int i = 1; i <= n; i++) cin >> a[i];
    for (int i = 1; i <= n; i++) p[i] = i;
    sort(p+1, p+1+n, [](int x, int y){return a[x] < a[y];});
    for (int i = 1; i <= n; i++) a[p[i]] = i;
    for (int i = 1; i <= n; i++) mq[i].push(a[i]);
    for (int i = 1; i <= n; i++){
        for (; l <= r; l++){
            if (mq[l].top() == i) break;
            Union(mq[l+1], mq[l]);
        }
        if (mq[l].size() != 1){
            r++;
            mq[r].swap(mq[l]);
            mq[r].pop();
            ans += mq[r].size();
        }
        l++;
    }
    cout << ans << "\n";
}



Measured memory_bytes: 24684
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define vvi vector<vector<int>> 
#define vi vector<int> 
#define vpii vector<pair<int,int>> 
#define ff first
#define ss second
#define all(x) x.begin(),x.end()
#define ffor(i,n) for(int i = 0; i < n; ++i)

vi a;
int n;
vvi dp;

int solve(int l,int r)
{
    if(l == r) return a[l];
    if(r == l + 1) return max(a[l],a[r]);
    if(dp[l][r] != -1) return dp[l][r];
    dp[l][r] = max(a[l] + min(solve(l + 1,r - 1),solve(l + 2,r)),a[r] + min(solve(l,r - 2),solve(l + 1,r - 1)));
    return dp[l][r];
}
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin >> n;
    a.resize(n);
    ffor(i,n) cin >> a[i];
    dp.resize(n,vi(n,-1));
    int x = solve(0,n - 1);
    int y = accumulate(all(a),0LL);
    int z = y - x;
    cout << (x - z);
}

Measured memory_bytes: 70912
import java.io.*;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        MyScanner sc = new MyScanner();

        char[] s = sc.next().toCharArray();
        long k = sc.nextLong();

        List<Integer> list = new ArrayList<>();
        int cnt = 1;
        for (int i = 1; i < s.length; i++) {
            if (s[i-1] == s[i]) {
                cnt++;
            } else {
                list.add(cnt);
                cnt = 1;
            }
        }
        list.add(cnt);

        long ans = 0;
        if (list.size() == 1) {
            ans = s.length * k / 2;
        } else {
            for (Integer i : list) {
                if (i > 1)
                    ans += i / 2 * k;
            }

            if (s[0] == s[s.length-1]) {
                long tmp = list.get(0) / 2 + list.get(list.size()-1) / 2;
                tmp -= (list.get(0) + list.get(list.size()-1)) / 2;
                ans -= tmp * (k-1);
            }
        }

        System.out.println(ans);
    }

    static class MyScanner {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in), 1 << 15);
        StringTokenizer tokenizer;

        String next() {
            try {
                while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                    tokenizer = new StringTokenizer(reader.readLine());
                }
            } catch (IOException ignored) {
            }
            return tokenizer.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }
    }
}

Measured memory_bytes: 22740
#include<iostream>
using namespace std;
int main(){
int a,b;
cin>>a>>b;
if(a<b){
	cout<<"a < b"<<endl;
}
else if(a>b){
	cout<<"a > b"<<endl;
}
else{
	cout<<"a == b"<<endl;
}
return 0;
}


Measured memory_bytes: 3016
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String str=sc.nextLine();
		String[] s=str.split("");
		int[] X =new int[s.length];
		int cnt=0;
		for(int i=0;i<s.length;i++){
			X[i]=Integer.parseInt(s[i]);
			cnt=cnt+X[i];

		}
		int waru=1;
		for(int i=0;i<s.length-1;i++){
			waru=waru*10;
		}
		
			if(s.length>1 && Integer.parseInt(str)%waru==0){
				cnt=cnt+9;
			}		
		
		System.out.println(cnt);
	}
}


Measured memory_bytes: 22996
#pragma GCC optimize("O4")
#include <bits/stdc++.h>
#define For(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define all(x) x.begin(),x.end()
#define sz(x) ((int)x.size())
//#define MOD (ll)(998244353)
#define MOD (ll)(1e9+7)
#define INF (1e17)
#define int ll
#define EPS (1e-6)
using namespace std;
using ll=long long;
using pii=pair<int,int>;

int gcd(int a,int b) { return b==0?a:gcd(b,a%b); }
int lcm(int a,int b) { return a/gcd(a,b)*b; }
int fpow(int b,int p){
	if(p==0) return 1;
	int h=fpow(b,p/2);
	if(p%2) return h*b%MOD*h%MOD;
	return h*h%MOD;
}

int dp[3050][3050][2];
//  dp[dish][time][choose?]

int32_t main() {
#ifdef LOCAL_TEST
	freopen("E:\\Jimmy\\2 Coding\\1 C++\\input.in","r",stdin);
	freopen("E:\\Jimmy\\2 Coding\\1 C++\\output.out","w",stdout);
	freopen("E:\\Jimmy\\2 Coding\\1 C++\\error.out","w",stderr);
#endif
	ios::sync_with_stdio(false);
	cin.tie(0);

	//code...
	int n; cin>>n;
	string s; cin>>s;
	bool f=true;
	For(i,0,n/2-1) if(s[i]!=s[i+n/2]) f=false;
	if(!f || n%2) cout<<"No\n";
	else cout<<"Yes\n";
	return 0;
}

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

int main()
{
	int a, b, c, out = 0;

	cin >> a >> b >> c;

	for (int i = a; i <= b; i++)
	{
		if (c % i == 0) out++;
	}
	cout << out << endl;

	return(0);
}

Measured memory_bytes: 1164
#-*-coding:utf-8-*-

def main():
    a, b, k = list(map(int, input().split()))
    ab_set = set()
    cnt1 = 1
    cnt2 = 1
    
    for i in range(a, b+1):
        if cnt1 <= k:
            ab_set.add(i)
        else:
            break
        cnt1 += 1
        
    for j in range(b, a-1, -1):
        if cnt2 <= k:
            ab_set.add(j)
        else:
            break
        cnt2 += 1
    
    ab_list = list(ab_set)
    ab_list.sort()
    for i in ab_list:
        print(i)


if __name__ == '__main__':
    main()

Measured memory_bytes: 3064
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <queue>
using namespace std;

typedef long long ll;

string s;
ll ans = 0;
void  f(int k, ll current, ll sum) {

   if (k == s.length() )
        ans += current + sum;
   else {

        //+ is include
        f(k + 1, s[k]-'0', sum + current);
        //+ is not include
        f(k + 1, current*10 + (s[k] -'0') ,sum);

   }
}

int main() {

    cin >> s;

    f(1, s[0]-'0', 0);
    cout << ans;
    return 0;
}

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

using namespace std;

int n;
vector<int> lis[100100];

vector<int> st, res;
void dfs(int here, int p) {
	st.push_back(here);
	if (here==n-1) {
		res.assign(st.begin(),st.end());
	}
	for (auto &there : lis[here]) {
		if (there==p) continue;
		dfs(there,here);
	}
	st.pop_back();
}

int getsz(int here, int p) {
	int sz = 1;
	for (auto &there : lis[here]) {
		if (there==p) continue;
		sz += getsz(there,here);
	}
	return sz;
}

int main(){
    int i;

    scanf("%d",&n);
    for (i=0;i<n-1;i++) {
		int a, b;
		scanf("%d%d",&a,&b); --a; --b;
		lis[a].push_back(b);
		lis[b].push_back(a);
    }
    dfs(0,-1);
    int ms = res.size(), ress = 0;
    for (i=0;i<res.size();i++) {
		if (i<(ms+1)/2) {
			int here = res[i]; ress++;
			for (auto &there:lis[here]) {
				if ((i!=0&&there==res[i-1])||(i+1!=res.size()&&there==res[i+1])) continue;
				ress += getsz(there,here);
			}
		}
		else {
			int here = res[i]; ress--;
			for (auto &there:lis[here]) {
				if ((i!=0&&there==res[i-1])||(i+1!=res.size()&&there==res[i+1])) continue;
				ress -= getsz(there,here);
			}
		}
    }
    if (ress<=0) printf("Snuke\n");
    else printf("Fennec\n");

    return 0;
}


Measured memory_bytes: 14456
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>   
using namespace std;
using namespace __gnu_pbds;
typedef long long ll; 
#define int long long
typedef unsigned long long lu;
typedef vector<ll> v;
typedef vector<vector<ll> > vv;
typedef vector<string>  vs;
typedef vector<pair<ll,ll>> vpr;
typedef long double ld;
#define f(i,n) for(ll i = 0; i < n; i++)
#define ff(i,n) for(ll i=1;i<=n;i++)
#define pb push_back
#define mp make_pair
#define endl "\n"
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define amax(x,y) if(y>x) x=y;
#define amin(x,y) if(y<x)x=y;
#define bg(x) x.begin()
#define sz(x) (ll)x.size()
#define in(x,n) for(ll i=0;i<n;i++)cin>>x[i]
#define out(x,n) for(ll i=0;i<n;i++)cout<<x[i]<<" " 
#define mxt(a) *(max_element(a.begin(),a.end()))
#define mnt(a) *(min_element(a.begin(),a.end())
#define tc ll t;cin>>t;while(t--)
typedef pair<ll,ll> pi;
#define yes cout<<"YES\n";
#define no cout<<"NO\n";
#define yesno(f) if(f) yes else no
const v dx = {1, -1, 0, 0};
const v dy = {0, 0, 1, -1};
const ld PI = 2 * acos(0.0);
ll cel(ll x1,ll y1){if((x1%y1)==0)return x1/y1;else return x1/y1+1;}
ll power(ll a,ll b,ll m)
{
    if(b==0)
        return 1;
    ll d=power(a,b/2,m);
    d=(d*d)%m;
    if(b&1)
        d=(d*a)%m;
    return d;
}
const ll mod= 998244353;
int MOD(int a)
{
    if(a<0)
        a+=mod;
    if(a>=mod)
        a%=mod;
    return a;
}
// set_name.find_by_order(k) It returns to an iterator to the kth element (counting from zero) in the set in O(logn) time
// set_name.order_of_key(k) It returns to the number of items that are strictly smaller than our item k in O(logn) time.
/*string operations :
str.substr (x,y) : returns a substring str[x],str[x+1],...str[x+y-1]
str.substr (x) : returns a substring str[x],... end of string
str.find(qtr) : returns the first occurenece of qtr in str */
int32_t main()
{
    ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
    int n,s;cin>>n>>s;
    v a(n);in(a,n);
    vv dp(n+1,v(s+1,0));
    dp[n][0]=1;
    for(int i=n-1;i>=0;i--)
    {
    	for(int j=0;j<=s;j++){
    		if(j>=a[i])
    		dp[i][j]=MOD(2*dp[i+1][j]+dp[i+1][j-a[i]]);
    		else
    			dp[i][j]=MOD(2*dp[i+1][j]);

    	}
    }
    cout<<dp[0][s]<<endl;
    return 0;
}

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

int main(){
    int n;
    cin >> n;
    int p[n];

    for(int i=0;i<n;i++){
        cin >> p[i];
    }

    int counter=0;

    for(int i=0;i<n-2;i++){
        if((p[i]-p[i+1])*(p[i+1]-p[i+2])>0){
            counter++;
        }
    }

    cout << counter;

    return 0;
}

Measured memory_bytes: 256
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>
  
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
  
using namespace std;
  
typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;
  
const int INF=1<<29;
const double EPS=1e-9;
  
const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};


int main() {
  int H, W;
  cin >> H >> W;
  vector<string> C(H);
  for (int i = 0; i < H; i++) {
    cin >> C[i];
  }
  vector<string> ans(H * 2);
  for (int i = 0; i < 2 * H; i++) {
    for (int j = 0; j < W; j++) {
      ans[i] = C[i / 2];
    }
  }
  for (int i = 0; i < 2 * H; i++) {
    cout << ans[i] << endl;
  }
  return 0;
}

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

const int p = 100003;


int main(){
    int x;cin>>x;
    vector<int> plist(100005,1);
    plist[0]=0;
    plist[1]=0;
    for(int i=2;i<350;i++){
        if(plist[i]==1){
            for(int j=2;i*j<p+2;j++){
                plist[i*j]=0;
            }
        }
    }
    for(int i=x;i<p+2;i++){
        if(plist[i]==1){
            cout<<i<<endl;
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 640
# -*- coding: utf-8 -*-
# スペース区切りの整数の入力
#N, K = map(int, input().split())
# 文字列の入力
S = input()
T = input()
#開業されたN個要素を受け付ける
#list = [input() for i in range(N)]

if S == T[:-1]:
    print("Yes")
else:
    print("No")


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

#define rep(i, a, b) for (int i = int(a); i < int(b); i++)
#define rrep(i, a, b) for (int i = int(a) - 1; i >= b; i--)
#define sz(x) (int)(x).size()

using namespace std;
using ll = long long;

const ll INF = 1e18;
const ll MOD = 1e9 + 7;

double calc(int n) {
  return (double)(n + 1) / 2;
}
int main() {
  ll n, k;
  cin >> n >> k;
  vector<ll> p(n);
  vector<double> a(n);
  rep(i, 0, n) {
    cin >> p[i];
    a[i] = calc(p[i]);
  }
  rep(i, 1, n) a[i] += a[i - 1];
  double ans = 0;

  rep(i, 0, n) {
    if (i - k == -1) {
      ans = max(ans, a[i]);
    } else if (i - k >= 0) {
      ans = max(ans, a[i] - a[i - k]);
    }
  }
  printf("%.10f\n", ans);
}


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

int main() {
    int a,b;
    cin >> a >> b;
    if((a-b)%2) cout << "IMPOSSIBLE" << endl;
    else cout << (a+b)/2 << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cmath>
#include <unordered_map>

#define likely(x)   __builtin_expect(!!(x), 1)
#define unlikely(x) __builtin_expect(!!(x), 0)

using LL = int;
inline LL R(){
    char c='!';LL x=0,z=1;
    for( ; c>'9'||c<'0';c=getchar()) if(c=='-')z=-1;
    for(;c>='0'&&c<='9';c=getchar()) x=x*10+c-'0';
    return x*z;
}

int main(void) {
  int n;

  std::cin >> n; /* 1 to 3*10^5 */

  size_t A[n];

  //int* A = new int[n];
  for (size_t i = 0; i < n; i++) {
    A[i] = R();
    //std::cin >> A[i];
  }

  size_t count = 0;

  size_t lsum = 0;
  size_t rsum = 0;
  size_t l, r;
  size_t offset = 0;
  size_t i = 0;
  for (size_t i = 0; i < n; ++i) {
    size_t lcount = 0;
    for (size_t j = i + offset; j < n; ++j) {
      l = lsum ^ A[j];
      r = rsum + A[j];
      if (likely(l != r)) {
        break;
      }
      lcount++;
      lsum = l;
      rsum = r;
    }

    count += lcount + offset;

    offset += lcount;
    if (unlikely(offset)) {
      --offset;
    }

    lsum ^= A[i];
    rsum -= A[i];
  }

  std::cout << count << std::endl;;

  return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>

#define rep(i,j) REP((i), 0, (j))
#define REP(i,j,k) for(int i=(j);(i)<(k);++i)
#define between(a,x,b) ((a)<=(x)&&(x)<=(b))
using namespace std;
int t, n, k;
int first, last, x[2];
int main(){
  scanf("%d", &t);
  while(t--){
    vector<int>diff;
    scanf("%d%d", &n, &k);
    scanf("%d", &x[0]);
    first = x[0];
    rep(i, n-1){
      scanf("%d", &x[1]);
      diff.push_back(x[1]-x[0]);
      x[0] = x[1];
    }
    last = x[0];

    if(n > k){
      int res = last - first;
      sort(diff.begin(), diff.end(), greater<int>());
      rep(j, k-1) res -= diff[j];
      printf("%d\n", res);
    }else puts("0");
  }
  return 0;
}

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

int main() {
    int n;
    cin >> n;
    bool f[n][10];
    int p[n][11];
    rep(i,n) rep(j,10) cin >> f[i][j];
    rep(i,n) rep(j,11) cin >> p[i][j];
        
    int64_t ans = -100100100100;
    for (int bit = 1; bit < (1<<10); bit++) {
        int64_t benefit = 0;
        rep(shop, n) {
            int cnt = 0;
            rep(i,10) {
                if (bit & (1 << i) && f[shop][i]) cnt++;
            }
        benefit += p[shop][cnt];
        }
        ans = max(ans, benefit);
    }
    cout << ans << endl;
}


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

int main() {
  int x,a,b,c,s=0;
  cin>>a>>b>>c>>x;
  for(int i=0;i<=a;i++)
  {
      for(int j=0;j<=b;j++)
      {
          for(int k=0;k<=c;k++)
          {
              if(500*i+100*j+50*k==x)s++;
          }
      }
  }
  cout<<s;
}

Measured memory_bytes: 3568
# for内をご丁寧に書いていたらTLEを食らった
# PyPyだとそのままで通った、すごい
# for内の冗長な部分を排除しまくったらPythonでも通った

# N=6とかで実験して、横で見ていたのを縦から眺めてみると良い（伝われ）
# (1+2+...+6) + (2+4+6) + ... + (6)と見る
# 結局何を足したいのか考えて約数のところを書き換える（伝われ）

N = int(input())
ans = 0

for i in range(1, N + 1):

    n = N // i
    temp = (n * (n + 1) * i) // 2
    ans += temp

print(ans)


Measured memory_bytes: 9020
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val s = readLine()!!
    var rCount = 0L
    var gCount = 0L
    var bCount = 0L
    for(i in 0 until n) {
        when (s[i]) {
            'R' -> rCount++
            'G' -> gCount++
            'B' -> bCount++
        }
    }

    var patternCount = rCount * gCount * bCount
    for (i in 0 until n) {
        for (j in (i + 1) until n) {
            val k = (2 * j) - i
            if (k >= n) continue
            if (s[i] != s[j] && s[i] != s[k] && s[j] != s[k]) patternCount--
        }
    }

    println(patternCount)
}

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

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
const int INF_N = 1e+9;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//typedef vector<vector<ll>> mat;
typedef vector<int> vec;

//繰り返し二乗法
ll mod_pow(ll a, ll n, ll m) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * a%m;
		a = a * a%m; n >>= 1;
	}
	return res;
}

struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n%mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint &a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint &a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint &a, modint b) { a.n = ((ll)a.n*b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
	if (n == 0)return modint(1);
	modint res = (a*a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

//逆元(Eucledean algorithm)
ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1 << 18;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}
using mP = pair<modint, modint>;

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




void solve() {
    int x; cin >> x;
    if(x < 1200) cout << "ABC" << endl;
    else cout << "ARC" << endl;
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  //cout << fixed << setprecision(10);
  //init_f();
  //init();
  //int t; cin >> t; rep(i, t)solve();
  solve();
//   stop
    return 0;
}


Measured memory_bytes: 7668
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <queue>
#include <cmath>
#include <map>
#include <set>

#define pii pair <int, int>
#define pb push_back
#define ll long long
#define ss second
#define ff first
#define N 500010

using namespace std;

ll n;
int mn = 1e9;

int main()
{
	cin >> n;
	
	int sq = sqrt(n);
	for(int i=1; i <= sq; i++) {
		if(n%i == 0) {
			ll j = n/i;
			int sum = 0;
			
			while(j != 0)
				sum++, j/=10;
			
			mn = min(sum, mn);
		}
	}
	cout << mn;
}


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


int main() {
  double r;
  double men,syu;

  cin >> r;

  men = r * r * M_PI;
  syu = (2 * r) * M_PI;

  cout << fixed << setprecision(6) << men << " " << fixed << setprecision(6) << syu << endl;
}



Measured memory_bytes: 3276
#include <bits/stdc++.h>
using namespace std;
 
#define rep(i, n) for (int i=0; i<(n); ++i)
using ll = long long;
using P = pair<int, int>;
 
int main() {
  int k;
  cin >> k;
  string s;
  cin >> s;

  if (s.size() <= k) {
    cout << s << endl;
  } else {
    cout << s.substr(0, k) + "..." << endl;
  }
  return 0;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define F first
#define S second
#define ll long long
#define ld long double
#define pb push_back
#define sz size

using namespace std;

const ll N=1e5+5;

ll n,m,p[N],SZ[N],u,v,ans;

vector<pair<ll,ll> >edge;

vector<ll>ANS;

ll get(ll x)
{
    if (p[x]==x)return x;
    return p[x]=get(p[x]);
}

void join(ll u,ll v)
{
    u=get(u),v=get(v);
    if (rand()&1)swap(u,v);
    p[u]=p[v];
    ans-=SZ[v]*SZ[u];
    SZ[v]+=SZ[u];
    SZ[u]=0;
}

int main()
{
    cin >> n >> m;
    ans=n*(n-1)/2;
    for (ll i=1;i<=n;i++){p[i]=i;SZ[i]=1;}
    for (ll i=0;i<m;i++)
    {
        cin >> u >> v;
        edge.pb({u,v});
    }
    for (ll i=edge.sz()-1;i>-1;i--)
    {
        ANS.pb(ans);
        if (get(edge[i].F)!=get(edge[i].S))
        {
            join(edge[i].F,edge[i].S);
        }
    }
    for (ll i=ANS.sz()-1;i>-1;i--)
    {
        cout << ANS[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 6256
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
using ll = long long;
using P = pair<ll, ll>;
const long double PI = acos(-1.0L);
ll GCD(ll a, ll b) { return b?GCD(b, a%b):a; }
ll LCM(ll a, ll b) { return a/GCD(a, b)*b; }

int n;

int main() {
    while(1) {
        cin >> n;
        if(n == 0) break;
        int sum = 1;
        int cnt = 0;
        for(int i = 2; i <= 50; ++i) {
            sum += i;
            int ch = n-sum;
            if(ch >= 0 && ch%i == 0) cnt++;
        }
        cout << cnt << endl;
    }
}


Measured memory_bytes: 3032