akhauriyash/Code-Regression huggingface dataset:
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <math.h> // sqrt
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <iomanip> // setprecision
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vb = vector<bool>;
using vll = vector<long long>;
using pii = pair<int, int>;
using psi = pair<string, int>;

int main() {
    int N;
    string data;
    cin >> N >> data;
    int left = 0;
    int right = N - 1;
    int ans = 0;
    while (true) {
        if (left == right) {
            break;
        }
        if (data[left] == 'R') {
            left++;
            continue;
        }
        if (data[right] == 'W') {
            right--;
            continue;
        }
        ans++;
        if (right - left == 1) {
            break;
        }
        left++;
        right--;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3728
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;

int N;
int M[101][101] = {};

int main(void) {

    cin >> N;

    for (int i = 0; i < N; ++i) {
        int v;
        int degree;
        cin >> v >> degree;

        for (int k = 0; k < degree; ++k) {
            int adj;
            cin >> adj;

            M[v][adj] = 1;
        }

    }

    for (int i = 1; i <= N; ++i) {
        for (int k = 1; k <= N; ++k) {
            cout << M[i][k];
            if (k != N) cout << " ";
        }
        cout << endl;
    }

    return 0;
}


Measured memory_bytes: 3116
a=list(map(int,input().split()))
if (a[0]+a[1]>a[0]-a[1])&(a[0]+a[1]>a[0]*a[1]):
    print(a[0]+a[1])
elif (a[0]*a[1]>a[0]+a[1])&(a[0]*a[1]>a[0]-a[1]):
    print(a[0]*a[1])
else :
    print(a[0]-a[1])

Measured memory_bytes: 3064
//by rng_59
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <memory.h>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
using namespace std;

#define REP(i,n) for(int (i)=0; i<(int)(n); i++)

const int MAXN = 10;
int a[MAXN][MAXN];
int b[MAXN];

int main(void) {
	REP(i,3) REP(j,3) cin >> a[i][j];
	int N;
	cin >> N;
	REP(i,N) cin >> b[i];
	REP(i,3) REP(j,3) REP(k,N)
		if(b[k] == a[i][j]) {
			a[i][j] = -1;
			break;
		}
	if(a[0][0]==-1 && a[0][1]==-1 && a[0][2]==-1) {
		cout << "Yes" << endl;
		return 0;
	}
	if(a[1][0]==-1 && a[1][1]==-1 && a[1][2]==-1) {
		cout << "Yes" << endl;
		return 0;
	}
	if(a[2][0]==-1 && a[2][1]==-1 && a[2][2]==-1) {
		cout << "Yes" << endl;
		return 0;
	}
	if(a[0][0]==-1 && a[1][0]==-1 && a[2][0]==-1) {
		cout << "Yes" << endl;
		return 0;
	}
	if(a[0][1]==-1 && a[1][1]==-1 && a[2][1]==-1) {
		cout << "Yes" << endl;
		return 0;
	}
	if(a[0][2]==-1 && a[1][2]==-1 && a[2][2]==-1) {
		cout << "Yes" << endl;
		return 0;
	}
	if(a[0][0]==-1 && a[1][1]==-1 && a[2][2]==-1) {
		cout << "Yes" << endl;
		return 0;
	}
	if(a[0][2]==-1 && a[1][1]==-1 && a[2][0]==-1) {
		cout << "Yes" << endl;
		return 0;
	}
	cout << "No" << endl;
	return 0;
}



Measured memory_bytes: 256
# https://atcoder.jp/contests/abc128/tasks/abc128_d


# 単純なアイデアとしては、ほぼ愚直に操作を行う。
# K個のViを取って一番合計の大きいもの
# K-1のViを取って価値の引くものを1つ詰めるとしたときに一番合計の大きくなるもの
# K-iのViを取って価値の低いものをiつ詰めるとしたときに一番合計が大きくなるもの

# 最大N個とるのを最大N回ずらして、最大N個の手持ちのソートするので、オーダーはO(N^3 logN)
import sys
read = sys.stdin.readline


def read_ints():
    return list(map(int, read().split()))


N, K = read_ints()
V = read_ints()
V = V + V

ans = 0
for i in range(K):
    n_pick = K - i
    n_back = i
    if n_pick > N:
        n_back = n_pick - N
        n_pick = N

    for j in range(n_pick + 1):  # スライドよう
        v = V[N - j:N + n_pick - j]
        v.sort()
        # print(v)
        if n_back < len(v) and v[n_back] < 0:
            ans = max(ans, sum(v[n_back:]))  # ここでは最大n_back個まで捨てることができる
        else:
            ans = max(ans, sum([max(0, x) for x in v]))
print(ans)


Measured memory_bytes: 3064
while (n = gets.to_i) != 0
scores = gets.split.map(&:to_i)
n = scores.size

sum1 = 0
scores.each {|s| sum1 += s}
m = sum1 / n.to_f

sum2 = 0
scores.each {|s| sum2 += (s - m)**2}
a = Math::sqrt(sum2 / n)

p a
end


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

int main()
{
	int a, b, c, d;
  	cin >> a >> b >> c >> d;
  	int count = 0;
  	count = (a+d-1)/d;
  	if(b * count >= c)
    {
    	cout << "Yes" << endl;
    }
  	else
    {
    	cout << "No" << endl;
    }
}


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

int main(){
    int N;
    cin >> N;
    vector<int> x(N);
    vector<int> y(N);
    for (int i = 0; i < N; i++) cin >> x[i] >> y[i];
    double ans = 0;
    for (int i = 0; i <= N-2; i++) {
        for (int j = i+1; j <= N-1; j++) {
            ans += sqrt((double)(x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j]));
        }
    }
    ans *= 2;
    ans /= N;
    printf("%.10lf", ans);
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

int main(int argc, char const* argv[])
{
	int h, w;
	do {
		std::cin >> h >> w;
		for (size_t i = 0; i < h; i++)
		{
			for (size_t j = 0; j < w; j++)
				if (( j == 0 || j == w - 1) || ( i == 0 || i == h - 1))
					std::cout << "#";
				else
					std::cout << ".";

			std::cout <<  std::endl;
		}

		if(h != 0 && w != 0)
			std::cout <<  std::endl;
	} while(h != 0 && w != 0);

	return 0;
}

Measured memory_bytes: 1152
#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <cmath>
#include <queue>
#include <stack>
#include <list>
#include <functional>
#include <numeric>
#include <iostream>
#include <string>
#include <time.h>

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

int M, K;

int main() {

	scanf("%d%d", &M, &K);

	int maxim = pow(2, M);
	if (K == 0) {
		rep(i,maxim)
		printf("%lld %lld ", i, i);
		return 0;	
	}

	if (K >= maxim) {
		printf("-1\n");
		return 0;
	}

	int t = 0;
	rep(i, maxim) {
		if(i != K ) t ^= (int)i;
	}

	if (t != K) {
		printf("-1\n");
		return 0;
	}

	printf("%d ", K);
	rep(i, maxim) {
		if (i != K) {
			printf("%lld ", i);
		}
	}
	printf("%d ", K);
	rep(i, maxim) {
		if (maxim - i - 1 != K) {
			printf("%lld ", maxim - i - 1);
		}
	}

	return 0;
}


Measured memory_bytes: 1792
#include <algorithm>
#include <cassert>
#include <iostream>
#include <map>
#include <vector>

static const int IINF = 1 << 30;
static const long long LINF = 1LL << 60;
static const long long MOD = 1.0e+9 + 7;

template <typename T> std::vector<T> vectors(std::size_t n, T val) {
  return std::vector<T>(n, val);
}

template <typename T, typename... Args>
auto vectors(std::size_t n, Args... args) {
  return std::vector<decltype(vectors<T>(args...))>(n, vectors<T>(args...));
}

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

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

template <class T> inline void chadd(T &a, const T &b) {
  a += b, a %= MOD;
  // TODO minus case
}

template <class T>
std::ostream &operator<<(std::ostream &s, const std::vector<T> &v) {
  if (v.empty())
    return s;
  s << *v.begin();
  for (auto iter = v.begin() + 1; iter != v.end(); ++iter)
    if (std::is_fundamental<T>::value)
      s << " " << *iter;
    else
      s << std::endl << *iter;
  return s;
}

int main() {
  // Input
  int P, Q, R;
  std::cin >> P >> Q >> R;

  // Main
  int res = IINF;
  chmin(res, P + Q);
  chmin(res, Q + R);
  chmin(res, R + P);

  // Output
  std::cout << res << std::endl;

  return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        if (n <=111) {
            System.out.println(111);
        } else if (n <=222) {
            System.out.println(222);
        } else if (n <=333) {
            System.out.println(333);
        } else if (n <=444) {
            System.out.println(444);
        } else if (n <=555) {
            System.out.println(555);
        } else if (n <=666) {
            System.out.println(666);
        } else if (n <=777) {
            System.out.println(777);
        } else if (n <=888) {
            System.out.println(888);
        } else if (n <=999) {
            System.out.println(999);
        }
    }
}


Measured memory_bytes: 21716
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++)
typedef long long ll;
typedef vector<vector<ll>> vvl;
typedef vector<ll> vl;
typedef vector<vector<char>> vvc;
typedef vector<char> vc;
typedef pair<ll,ll> pll;
ll max(ll x,ll y){
if(x>y)return x;
else return y;
}
ll min(ll x,ll y){
  return x+y-max(x,y);
}

int main(){
  ll x,y,z,k;cin >> x >> y >> z >> k;
  vl a(x),b(y),c(z);
  rep(i,x)cin >> a[i];
  rep(i,y)cin >> b[i];
  rep(i,z)cin >> c[i];

  sort(c.begin(),c.end());
  
  vl ab(x*y);
  rep(i,x)rep(j,x)ab[x*i+j]=a[i]+b[j];
  sort(ab.rbegin(),ab.rend());
  priority_queue<ll> ans;
  rep(i,min(k,x*y))rep(j,min(k,z)){
    ans.push(ab[i]+c[j]);
  }
  rep(i,k){printf("%lld\n",ans.top());ans.pop();}
}

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

ll n, k, dp[100010], mod=1e9+7;

ll p(ll a, ll b) {
	if (b==0) return 1;
	ll ans=p(a, b/2)%mod;
	ans*=ans;
	ans%=mod;
	if (b%2==1) ans*=a;
	return ans%mod;
}

int main() {
	cin>>n>>k;
	for (int i=k; i>0; i--) {
		dp[i]=p((k/i), n);
		for (int j=2*i; j<=k; j+=i) {
			dp[i]-=dp[j];
			if (dp[i]<0) dp[i]+=mod;
		}
	}
	ll jwb=0;
	for (int i=1; i<=k; i++) {
		jwb+=(i*dp[i])%mod;
		jwb%=mod;
	}
	cout<<jwb<<endl;
}



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

using ll = long long;
using namespace std;

/* initialize */
int lcs(string A, string B){
    int m = A.length(), n = B.length();
    int c[m+1][n+1];
    int maxl = 0;
    A = ' ' + A;
    B = ' ' + B;
    for (int i = 0; i <= m; ++i) c[i][0]=0;
    for (int i = 1; i <= n; ++i) c[0][i]=0;
    for (int i = 1; i <= m; ++i) {
        for (int j = 1; j <= n; ++j) {
            if (A[i]==B[j]) c[i][j] = c[i-1][j-1]+1;
            else c[i][j] = max(c[i-1][j], c[i][j-1]);
            maxl = max(maxl, c[i][j]);
        }
    }
    return maxl;
};
/* main */
int main() {
    int n;
    cin >> n;
    string s1, s2;
    for (int i = 0; i < n; ++i) {
        cin >> s1 >> s2;
        int s = lcs(s1, s2);
        cout << s << "\n";
    }
    return 0;
}


Measured memory_bytes: 7072
#include <bits/stdc++.h>
using namespace std;
 
int main(void) {
    string S,T;
    cin >> S;
    cin >> T;

    int cnt = ((S[0]==T[0])?1:0)
          +((S[1]==T[1])?1:0)
          +((S[2]==T[2])?1:0);

    cout << cnt << endl;
    return 0;
}


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

#define FOR(i,a,b)  for(ll i=a;(i)<(b);++(i))
#define RFOR(i,a,b) for(ll i=a;(i)>=(b);--(i))
#define REP(i,n)    FOR(i,0,n)
#define RREP(i,n)   RFOR(i,n,0)
#define ALL(v)      v.begin(), v.end()
#define UNIQ(v)     sort(ALL(v)); v.erase(unique(ALL(v)), v.end())
#define BIT(n)      (1LL<<(n))
#define DEBUG(a)    cerr << #a << " = " << a << endl

const int inf = 1001001001;
const int mod = (int)1e9+7;
//const ll inf = 1e15;
//const ll mod = 1e9+7;

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

int main() {
    int K, A, B;
    cin >> K >> A >> B;
    FOR(i, A, B+1) {
        if (i%K == 0) {
            cout << "OK" << endl;
            return 0;
        }
    }
    cout << "NG" << endl;
    return 0;
}


Measured memory_bytes: 3640
import java.util.*;
class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int s = sc.nextInt();
        ArrayList<Integer> list = new ArrayList<Integer>();
        boolean loop = false;
        list.add(s);
        int i = 1;
        while(!loop){
            int j = list.get(i-1);
            if(j%2==0){
                if(list.contains(j/2)){
                    break;
                }
                list.add(j/2);
            } else {
                if(list.contains(j*3+1)){
                    break;
                }
                list.add(j*3+1);
            }
            i ++;
        }
        System.out.println(i+1);
    }
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define LLINF 9223372036854775807
#define MOD ll(1e9+7)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cerr<<#x<<": "<<x<<endl

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

    int ans = 0;
    for(int i = 1; i <= m; i++){
        for(int j = 1; j <= d; j++){
            int d1 = j%10;
            int d2 = j/10;
            if(d1>=2 && d2>=2 && d1*d2==i){
                ans++;
            }

        }
    }
    cout << ans << endl;
    return 0;
}


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

int main(){
	// sengen
	LL a,b,k;
	// nyuryoku
	cin >> a >> b >> k;
	// keisan
	if(a+b <= k){
		cout << '0' << ' ' << '0' << endl;
		return 0;
	}
	if(a >= k){
		cout << a-k << ' ' << b << endl;
		return 0;
	}
	cout << '0' << ' ' << b-(k-a) << endl;
	// syutsuryoku
}

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

void solve(){
  ll n, ans = 0; cin >> n;
  vector<ll> v, v2;
  set<ll> st;
  for(ll i = 2; i <= sqrt(n) + 1; i++){
    if(n % i == 0){
      v.push_back(i);
      ll x = n;
      while(x % i == 0){
        x /= i;
      }
      if(x % i == 1) st.insert(i);
    }
    else if(n % i == 1){
      v2.push_back(i);
      //ans += 2;
      st.insert(i);
      st.insert((n - 1) / i);
    }
  }
  //ans += 2;
  st.insert(n - 1);
  st.insert(n);
  if(st.find(1) != st.end()) cout << st.size() - 1 << endl;
  else cout << st.size() << endl;

  /*for(int i = 0; i < v.size(); i++){
    cout << v[i] << " ";
  }
  cout << endl;
  for(int i = 0; i < v2.size(); i++){
    cout << v2[i] << "," << (n - 1) / v2[i] << " ";
  }
  cout << endl;*/
  //cout << ans << endl;
  return;
}

int main(){
  solve();
  return 0;
}


Measured memory_bytes: 3632
#include <stdio.h>
main(){
 
  int a,b,tmp;
 
  scanf("%d %d",&a,&b);
 
  while(b > 0){
 
    tmp = a % b;
    a = b;
    b = tmp; 
 
  }
 
  printf("%d\n",a);
 
  return 0;
 
}
 

Measured memory_bytes: 592
//g++ -std=c++14 test.cpp -o test.out

#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <iomanip>
#include <vector>
#include <queue>
#include <stack>
#include <map> 
#include <unordered_map> 
#include <utility>
#include <limits.h>
#include <bitset>
#include <set>
using namespace std;
 
#define LL long long int
const LL INF = (1LL<<60);
const int INF_INT = 2147483647-1e6-1;
const LL mod = 1000000007ll;
const int mod_int = 1000000007;

LL N;

LL ans[4] = {};

void solve(){
}

int main(){
    cin >> N;
    for(int i=0;i<N;i++){
    	string s;cin >> s;
    	if(s=="AC") ans[0]++;
    	if(s=="WA") ans[1]++;
    	if(s=="TLE") ans[2]++;
    	if(s=="RE") ans[3]++;
    }

    solve();

	cout << "AC x " << ans[0] << endl;
	cout << "WA x " << ans[1] << endl;
	cout << "TLE x " << ans[2] << endl;
	cout << "RE x " << ans[3] << endl;
    return 0;
}

Measured memory_bytes: 3224
import heapq
from collections import deque
from enum import Enum
import sys
import math
from _heapq import heappush, heappop

BIG_NUM = 2000000000
MOD = 1000000007
EPS = 0.000000001


N,K = map(int,input().split())
W = []
for _ in range(N):
    W.append(int(input()))


def is_OK(P):
    track_index = 0
    w_index = 0
    while w_index < N and track_index < K:
        tmp_sum = 0
        while  w_index < N and tmp_sum+W[w_index] <= P:
            tmp_sum += W[w_index]
            w_index += 1
        track_index += 1
    return w_index == N

L = 0
R = 100000*100000
mid = (L+R)//2
ans = R

while L <= R:
    if is_OK(mid):
        ans = mid
        R = mid-1
    else:
        L = mid+1
    mid = (L+R)//2

print("%d"%ans)




Measured memory_bytes: 10112
#include <iostream>
#include <vector>
#include <algorithm>
#include <tuple>
using namespace std;

long long N, X[1009], Y[1009], H[1009]; 
vector<tuple<long long, long long, long long>>vec;

int main() {
	cin >> N; 
	tuple<long long, long long, long long>G = make_tuple(-1, -1, -1);
	for (int i = 1; i <= N; i++) {
		cin >> X[i] >> Y[i] >> H[i];
		if (H[i] >= 1) G = make_tuple(X[i], Y[i], H[i]);
	}
	for (int i = 0; i <= 100; i++) {
		for (int j = 0; j <= 100; j++) {
			long long V = get<2>(G) + abs(get<0>(G) - i) + abs(get<1>(G) - j);
			V = max(V, 0LL); 
			bool flag = true;
			for (int k = 1; k <= N; k++) {
				long long VV = V - abs(X[k] - i) - abs(Y[k] - j); VV = max(VV, 0LL);
				if (H[k] != VV) flag = false;
			}
			if (flag == true) vec.push_back(make_tuple(i, j, V));
		}
	}
	if (vec.size() == 1) {
		cout << get<0>(vec[0]) << " " << get<1>(vec[0]) << " " << get<2>(vec[0]) << endl;
	}
	return 0;
}

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

int main() {
  string s, t, u;
  int a, b;
  cin >> s >> t;
  cin >> a >> b;
  cin >> u;
  if(u == s){
    a--;
  }else if(u == t){
    b--;
  }
  cout << a << ' ' << b << endl;
  
}


Measured memory_bytes: 256
ABC = list(map(int, input().split()))

cnt = 0

if (ABC[0] == ABC[1] == ABC[2]) and (ABC[0]%2 == ABC[1]%2 == ABC[2]%2 == 0):
    print(-1)
    exit()
else:
    while True:
        if ABC[0]%2 == ABC[1]%2 == ABC[2]%2 == 0:
            ABC[0], ABC[1], ABC[2] = (ABC[1]+ABC[2])//2, (ABC[0]+ABC[2])//2, (ABC[0]+ABC[1])//2
            cnt += 1
        else:
            break
 
print(cnt)

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

#define ff first
#define ss second
#define pb push_back

using namespace std;
using ll = long long;
using ii = pair<int, int>;

const int N = 100005;
const ll oo = 2e18;

int main() {
	ll n;
	scanf("%lld", &n);
	if(n&1){
		printf("0\n");
	}
	else{
		ll ans2 = 0;
		n /= 2;
		ll d = 5;
		while(n / d > 0){
			ans2 += n / d;
			if(5 > oo / d) break;
			d *= 5;
		}
		printf("%lld\n", ans2);
	}

	return 0;
}


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

using namespace std;

class Solution {
public:
	void solve() {
		int a, b, c, k;
		cin >> a >> b >> c >> k;
		int ans = min(a, k);
		k -= min(a, k);
		k -= min(b, k);
		ans -= min(c, k);
		cout << ans << "\n";

		return;
	};
};

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	Solution solution;
	solution.solve();
	return 0;
}

Measured memory_bytes: 3640
#include <iostream>

template <int MOD>
struct ModInt {
    using lint = long long;
    int val;

    // constructor
    ModInt(lint v = 0) : val(v % MOD) {
        if (val < 0) val += MOD;
    };

    // unary operator
    ModInt operator+() const { return ModInt(val); }
    ModInt operator-() const { return ModInt(MOD - val); }
    ModInt inv() const { return this->pow(MOD - 2); }

    // arithmetic
    ModInt operator+(const ModInt& x) const { return ModInt(*this) += x; }
    ModInt operator-(const ModInt& x) const { return ModInt(*this) -= x; }
    ModInt operator*(const ModInt& x) const { return ModInt(*this) *= x; }
    ModInt operator/(const ModInt& x) const { return ModInt(*this) /= x; }
    ModInt pow(lint n) const {
        auto x = ModInt(1);
        auto b = *this;
        while (n > 0) {
            if (n & 1) x *= b;
            n >>= 1;
            b *= b;
        }
        return x;
    }

    // compound assignment
    ModInt& operator+=(const ModInt& x) {
        if ((val += x.val) >= MOD) val -= MOD;
        return *this;
    }
    ModInt& operator-=(const ModInt& x) {
        if ((val -= x.val) < 0) val += MOD;
        return *this;
    }
    ModInt& operator*=(const ModInt& x) {
        val = lint(val) * x.val % MOD;
        return *this;
    }
    ModInt& operator/=(const ModInt& x) { return *this *= x.inv(); }

    // compare
    bool operator==(const ModInt& b) const { return val == b.val; }
    bool operator!=(const ModInt& b) const { return val != b.val; }

    // I/O
    friend std::istream& operator>>(std::istream& is, ModInt& x) noexcept { return is >> x.val; }
    friend std::ostream& operator<<(std::ostream& os, const ModInt& x) noexcept { return os << x.val; }
};

constexpr int MOD = 1e9 + 7;
using mint = ModInt<MOD>;

using lint = long long;

void solve() {
    lint n, kmin;
    std::cin >> n >> kmin;

    mint ans = 0;
    for (lint k = kmin; k <= n + 1; ++k) {
        lint l = k * (k - 1) / 2;
        lint r = n * k - k * (k - 1) / 2;
        ans += r - l + 1;
    }

    std::cout << ans << std::endl;
}

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

    solve();

    return 0;
}


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

int main(){
  int N;
  cin >> N;
  
  vector<int> t(N+1), x(N+1), y(N+1);
  t.at(0) = 0;
  x.at(0) = 0;
  y.at(0) = 0;
  for (int i = 1; i < N+1; i++) {
    cin >> t.at(i) >> x.at(i) >> y.at(i);
  }
  
  bool flag = true;
  for (int i = 1; i < N+1; i++) {
    int dt = t.at(i) - t.at(i-1);
    int dx = x.at(i) - x.at(i-1);
    int dy = y.at(i) - y.at(i-1); 
    int dl = (abs(dx) + abs(dy));
    
    if(!(dl <= dt && dt%2 == dl%2)) {
      flag = false;
      break;
    }
  }
  
  if(flag) 
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

Measured memory_bytes: 1408
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;

void main()
{
    int a, b, c;
    foreach (s; readln.chomp) {
        switch (s) {
            case 'a': ++a; break;
            case 'b': ++b; break;
            case 'c': ++c; break;
            default:
        }
    }
    writeln(abs(a-b) < 2 && abs(b-c) < 2 && abs(c-a) < 2 ? "YES" : "NO");
}

Measured memory_bytes: 508
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  int sum = 0;
  
  cin >> n;
  vector<int> vec(n);
  for(int i=0; i<n; i++) {
    cin >> vec.at(i);
    
  }
  for(int i=0; i<n; i++) {
    for(int j=1; i+j<n; j++) {
      sum += vec.at(i) * vec.at(i+j);
    }
  }
  cout << sum << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
using namespace std;
int main(){
    int n;
    cin >> n;
    int s=0;
    while(n){
        for(int i=2;i<(int)sqrt(n);i++){
            if(n%i==0){
                s=1;
                break;
            }
        }
        if(s==0){
            cout << n;
            break;
        }
        n++;
        s=0;
    }
    return 0;
}

Measured memory_bytes: 256
n, k = list(map(int, input().split()))
sunuke = {x: 0 for x in range(1, n + 1)}
for i in range(k):
    d = int(input())
    a = list(map(int, input().split()))
    for x in a:
        sunuke[x] += 1
print(len([k for k, v in sunuke.items() if v == 0]))


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

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

bool check(string &s, string &t, int ind){
	if(ind + t.size() > s.size())return false;
	for(int i = 0; i < t.size(); i++){
		if(s[i + ind] == '?')continue;
		if(s[i + ind] != t[i])return false;
	}
	return true;
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cout<<setprecision(32);

	string s, t;
	cin>>s>>t;
	int n = s.size();
	for(int i = n - 1; i >= 0; i--){
		if(check(s, t, i)){
			for(int j = 0; j < t.size(); j++){
				s[j + i] = t[j];
			}
			for(int j = 0; j < s.size(); j++){
				if(s[j] == '?')s[j] = 'a';
			}
			cout<<s<<endl;
			exit(0);
		}
	}
	cout<<"UNRESTORABLE"<<endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <set>
#include <map>
#include <iomanip>
#include <cassert>
#include <stack>
#include <queue>
#include <deque>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
//using namespace __gnu_pbds;

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

// template<typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
//  order_of_key (k) : Number of items strictly smaller than k .
//  find_by_order(k) : K-th element in a set (counting from zero).
#define sz(a) (int)a.size()
#define all(a) a.begin(), a.end()
#define pb push_back
#define ppb pop_back
#define mkp make_pair
#define F first
#define S second
#define show(a) cerr << #a <<" -> "<< a <<"\n"
#define fo(a, b, c, d) for(int (a) = (b); (a) <= (c); (a) += (d))
#define foo(a, b, c ,d) for(int (a) = (b); (a) >= (c); (a) -= (d))
//#define int ll

const int N = 2e5 + 5;
const int oo = 1e9 + 5;

int n;
string s;
set <string> all;

void rec(int pos, int mx) {
	if (pos == n) {
		all.insert(s);
		return;
	}
	for (int i = 'a'-0; i <= min('z'-0, mx+1); ++i) {
		s.pb(char(i));
		rec(pos+1, max(mx, i));
		s.ppb();
	}
}

void solve() {
	cin >> n;
	s.pb('a');
	rec(1, 'a'-0);
	for (string t : all)
		cout << t <<'\n';
}

int main () {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int tt = 1;
	while (tt --) {
		solve();
	}
	return 0;
}
/*
	If you only do what you can do, 
	You will never be more than you are now!
*/

Measured memory_bytes: 14208
import java.util.Arrays;
import java.util.Scanner;

class Main {
	public static void main(String[] $) {
		Scanner sc = new Scanner(System.in);
		int na=sc.nextInt(),nb=sc.nextInt(),nm=sc.nextInt();
		long[] a=new long[na];
		long[] b=new long[nb];
		long[][] m=new long[nm][3];
		long[] buffa=new long[na];
		long[] buffb=new long[nb];
		
		for(int i=0;i<na;i++) {
			a[i]=sc.nextLong();
			buffa[i]=a[i];
		}
		for(int i=0;i<nb;i++) {
			b[i]=sc.nextLong();
			buffb[i]=b[i];
		}
		for(int i=0;i<nm;i++) {
			for(int j=0;j<3;j++) {
				m[i][j]=sc.nextLong();
			}
		}
		
		Arrays.sort(buffa);
		Arrays.sort(buffb);
		long min=(long)(buffa[0]+buffb[0]);
		for(int i=0;i<nm;i++) {
			int x=(int)m[i][0]-1,y=(int)m[i][1]-1,c=(int)m[i][2];
			min=Math.min(min, (long)(a[x]+b[y]-c));
			//System.out.println(a[x]+b[y]-c);
		}
		System.out.println(min);
	}
}


Measured memory_bytes: 163056
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
ll GetDigit(ll num){ return log10(num)+1; } //numの桁数を求める

int main()
{
    string s;
    cin >> s;
    int n = s.length();
    int a,z;
    bool flag = true;
    rep(i,n){
        if(flag && s[i] == 'A'){
            a = i;
            flag = false;
        }
        if(!flag && s[i] == 'Z'){
            z = i;
        }
    }
    cout << z - a + 1 << endl;
    return 0;
}

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

#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(a) (int)(a.size())
#define ALL(a) a.begin(),a.end()
#define SET(a,b) memset(a,b,sizeof(a))
#define off ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
typedef pair<int,int>   II;
typedef vector< II >      VII;
typedef vector<int>     VI;
typedef vector< VI > 	VVI;
typedef long long int 	LL;
typedef vector<LL> 		VL;
#define si(n) cin>>n
#define dout(n) cout<<n<<"\n"
#define DRT() int t; si(t); while(t--)
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
//# define M_PI           3.14159265358979323846264338327950288
// DSU
void IO(){
	#ifndef ONLINE_JUDGE
    freopen("../input.txt", "r", stdin);
    freopen("../output.txt", "w", stdout);
	#endif
	srand(chrono::steady_clock::now().time_since_epoch().count());
	off;
}

int main(){
	IO();
	LL n;
	cin>>n;
	VL arr(n+1, 0);
	for(LL i=1;i<101;i++){
		for(LL y=1;y <101;y++){
			for(LL z=1; z<101;z++){
				LL a = i*i + y*y + z*z + i*y + i*z + y*z;
				if(a <= n)
					arr[a]++;
			}
		}
	}
	rep(i,1,n+1){
		dout(arr[i]);
	}
	return 0;
}

Measured memory_bytes: 3664
#include<stdio.h>
#include<algorithm>
#include<string>
#include<set>
using namespace std;
char in[2100];
char str[2100];
int len[2100];
int main(){
	while(gets(in)!=NULL){
		int at=0;
		for(int i=0;in[i];i++){
			if('a'<=in[i]&&in[i]<='z')str[at++]=in[i]-32;
			if('A'<=in[i]&&in[i]<='Z')str[at++]=in[i];
		}
		set<string>S;
		for(int i=0;i<at;i++){
			int j;
			for(j=0;j<at;j++){
				if(i-j<0||i+j>=at)break;
				if(str[i-j]!=str[i+j])break;
			}j--;
			len[i]=j;
			if(j){
				string tmp="";
				for(int k=i-j;k<=i+j;k++)tmp+=str[k];
				S.insert(tmp);
			}
		}
		for(int i=0;i<at-1;i++){
			int j;
			for(j=0;j<at;j++){
				if(i-j<0||i+j+1>=at)break;
				if(str[i-j]!=str[i+j+1])break;
			}j--;
			if(j>0){
				string tmp="";
				for(int k=i-j;k<=i+j+1;k++)tmp+=str[k];
				S.insert(tmp);
			}
		}
		for(set<string>::iterator it=S.begin();it!=S.end();it++){
			string v=*it;
			for(int i=1;i<v.size()/2;i++){
				S.erase(v.substr(i,v.size()-i*2));
			}
		}
		bool sp=false;
		for(set<string>::iterator it=S.begin();it!=S.end();it++){
			if(sp)printf(" ");
			sp=true;
			printf("%s",(*it).c_str());
		}
		printf("\n");
	}
}

Measured memory_bytes: 1048
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, n) for (int i = (a); i < (n); i++)
#define repb(i, n) for (int i = (n - 1); i >= 0; i--)
#define repb2(i, a, n) for (int i = (n - 1); i >= (a); i--)
#define all(x) x.begin(), x.end()
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
inline void fastio() { ios_base::sync_with_stdio(false), cin.tie(NULL); }

const int cm = 1 << 17;
char cn[cm], *ci = cn + cm, ct;
inline char getcha() {
    if (ci - cn == cm) {
        fread_unlocked(cn, 1, cm, stdin);
        ci = cn;
    }
    return *ci++;
}
inline int getint() {
    int A = 0;
    if (ci - cn + 16 > cm)
        while ((ct = getcha()) >= '0')
            A = A * 10 + ct - '0';
    else
        while ((ct = *ci++) >= '0')
            A = A * 10 + ct - '0';
    return A;
}

int main() {
    fastio();

    int N = getint();

    int kotae = getint();
    rep(i, N - 1) { kotae = __gcd(getint(), kotae); }
    co(kotae);
}

Measured memory_bytes: 384
#include <iostream>
#include <iomanip> //! for setprecision(10)
#include <math.h>
#include <algorithm>
#include <functional> 
#include <string>
#include <vector>

#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <utility>

using namespace std;

typedef long long LL;

#define dump(c) { for (auto it = c.begin(); it != c.end(); ++it) if (it == c.begin()) cout << *it; else cout << ' ' << *it; cout << endl; } 
#define rep(i,n) for (int i = 0; i < (n); ++i)

const int MOD = 1000000007;

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

    int X, N;
    cin >> X >> N;
    if (N == 0) {
        cout << X << endl;
        return 0;
    }
    vector<int> p(N);
    rep(i, N) cin >> p[i];
    sort(p.begin(), p.end());
    if (X < p[0] || p[N-1] < X) {
        cout << X << endl;
        return 0;
    }
    p.push_back(1000000);

    int best = -1000000;
    int minDist = 1000000;

    int index = 0;
    for (int x = p[0]-1; x <= p[N-1]+1; ++x) {
        if (p[index] == x) {
            ++index;
            continue;
        }
        int dist = abs(x-X);
        if (dist < minDist) {
            minDist = dist;
            best = x;
        }
    }

    cout << best << endl;

    return 0;
}


Measured memory_bytes: 3640
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		long l = sc.nextLong();
		long r = sc.nextLong();
		
		int l2 = (int) (l % 2019);
		int r2 = (int) (r % 2019);

		if(r - l > 2019) {
			System.out.println(0);
		}
		else if(l2 <= r2) {
			int min = l2 * r2 % 2019;
			for (int i = l2; i <= r2; i++) {
				for (int j = i+1; j <= r2; j++) {
					int mod = i * j % 2019;
					if(min > mod) {
						min = mod;
					}
				}
			}
			System.out.println(min);
		}else {
			System.out.println(0);
		}
	}
}


Measured memory_bytes: 21844
N,Y = map(int,input().split())
for i in range(N+1):
  for j in range(N-i+1):
    k = N-i-j
    if i*10000 + j*5000 + k*1000 == Y:
      print(i,j,k)
      exit()
print("-1 -1 -1")


Measured memory_bytes: 2940
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < n; i++)
typedef long long ll;
using namespace std;
#define llMAX numeric_limits<long long>::max()
#define intMAX numeric_limits<int>::max()
#define d_5 100000
#define d9_7 1000000007
#define vll vector<vector<long long>>
#define vl vector<long long>
#define vi vector<int>
#define vii vector<vector<int>>
#define pb push_back
#define pf push_front
int main(void){
  ll n,k,q;
  cin>>n>>k>>q;
  vl a(q);
  rep(i,q){
    cin>>a[i];
    a[i]--;
  }
  vl ans(n,k);
  rep(i,q){
    ans[a[i]]++;
  }
  rep(i,n){
    ans[i]-=q;
  }
  rep(i,n){
    if(ans[i]>0){
      cout<<"Yes"<<endl;
    }else{
      cout<<"No"<<endl;
    }
  }
  return 0;
}

Measured memory_bytes: 2176
#include <stdio.h>

int abs(int a) {
  return a > 0 ? a : -a;
}

int main(void) {
  int n, x = 0, y = 0, i, t = 0;
  scanf("%d", &n);
  int nt, nx, ny;
  for(i = 0; i < n;++i) {
    scanf("%d%d%d", &nt, &nx, &ny);
    if((abs(nx - x) + abs(ny - y) + abs(t - nt)) % 2 || abs(nx - x) + abs(ny - y) > (nt - t)){
      printf("No");
      return 0;
    }
    x = nx, y = ny, t = nt;
  }
  printf("Yes");
  return 0;
}

Measured memory_bytes: 128
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cstring>
#include <iterator>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <utility>
#include <memory>
#include <functional>
#include <deque>
#include <cctype>
#include <ctime>
#include <numeric>
#include <list>
#include <iomanip>

#if __cplusplus >= 201103L
#include <array>
#include <tuple>
#include <initializer_list>
#include <forward_list>

#define cauto const auto&
#else

#endif

using namespace std;


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

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
    v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
    stringstream ss;
    ss << f;
    ss >> t;
}

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define reep(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) reep((i),0,(n))
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define F first
#define S second
#define mkp make_pair
#define RALL(v) (v).rbegin(),(v).rend()
#define DEBUG
#ifdef DEBUG
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#else
#define dump(x) 
#define debug(x) 
#endif

#define MOD 1000000007LL
#define EPS 1e-8
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
#define maxs(x,y) x=max(x,y)
#define mins(x,y) x=min(x,y)

void mainmain(){
	int n;
	cin>>n;
	vll v(3*n);
	rep(i,3*n) cin>>v[i];
	priority_queue<ll> pq1;
	priority_queue<ll> pq2;
	ll sum1 = 0;
	ll sum2 = 0;
	rep(i,n){
		pq1.push(-v[i]);
		sum1 += v[i];
	}
	vll tmp(n+1);
	rep(i,n){
		pq2.push(v[3*n-1-i]);
		sum2 += v[3*n-1-i];
	}
	tmp[0] = sum2;
	for(int i=2*n-1; i>=n; i--){
		pq2.push(v[i]);
		sum2 += v[i];
		ll t = pq2.top();
		pq2.pop();
		sum2 -= t;
		tmp[2*n-i] = sum2;
		// cout<<tmp[2*n-i]<<endl;
	}
	tmp.back() = sum2;
	ll ans = -INFL;
	maxs(ans, sum1 - tmp.back());
	reep(i,n,2*n){
		// cout<<sum1<<endl;
		pq1.push(-v[i]);
		sum1 += v[i];
		ll t = -pq1.top();
		pq1.pop();
		// cout<<sum1<<" "<<t<<endl;
		sum1 -= t;
		// cout<<tmp[i-n+1]<<endl;
		maxs(ans, sum1 - tmp[2*n-1-i]);
	}
	cout<<ans<<endl;
}


signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(20);
    mainmain();
}

Measured memory_bytes: 7284
/*
 *  author : Atul Anand   
 *  created on : Wed Apr 01 2020
 */

import java.io.*;
import java.util.*;

public class Main{

    public static void main(String[] args) throws IOException {
        int N = in.nextInt();
        int K = in.nextInt();
        int ans = 0;
        for(int i = 0; i < N; i++){
            int h = in.nextInt();
            if(h >= K){
                ans++;
            }
        }
        println(ans);
        in.close();
        out.close();
    }

    static int MIN = Integer.MIN_VALUE;
    static int MAX = Integer.MAX_VALUE;
    static Reader in = new Reader();
    static PrintWriter out = new PrintWriter(System.out);

    static void read(int arr[], int N) throws IOException { 
    	for(int i = 0; i < N; i++){ 
    		arr[i] = in.nextInt(); 
    	} 
    }
    
    static void read(long arr[], int N) throws IOException { 
    	for(int i = 0; i < N; i++){ 
    		arr[i] = in.nextLong(); 
    	} 
    }
    
    static void read(String arr[], int N) throws IOException { 
    	for(int i = 0; i < N; i++){ 
    		arr[i] = in.next(); 
    	} 
    }
    
    static void print(Object O) {  
    	out.print(O); 
    }
    
    static void println(Object O) { 
    	out.println(O); 
    }
    
    static void println(int arr[]) { 
    	for(int i = 0; i < arr.length; i++){ 
    		print(arr[i]+" "); 
    	} 
    	println(""); 
    }

    static void println(int arr[][]) { 
    	for(int i = 0; i < arr.length; i++){ 
    		println(arr[i]); 
    	}
    }
    
    static void debug(Object O) { 
    	System.out.println(O); 
    }
}

class Reader {
    BufferedReader reader;
    StringTokenizer tokenizer;

    Reader() {
        reader = new BufferedReader(new InputStreamReader(System.in));
        tokenizer = new StringTokenizer("");
    }

    String next() throws IOException {
        while (!tokenizer.hasMoreTokens() ) { 
            tokenizer = new StringTokenizer(reader.readLine()); 
        }
        return tokenizer.nextToken();
    }

    int nextInt() throws IOException { 
        return Integer.parseInt(next()); 
    }
    
    double nextDouble() throws IOException { 
        return Double.parseDouble(next());
    }
    
    long nextLong() throws IOException { 
        return Long.parseLong(next()); 
    }
    
    String nextLine() throws IOException { 
        return reader.readLine(); 
    }
    
    void close() throws IOException { 
        reader.close(); 
    }
}

Measured memory_bytes: 31216
#include <iostream>

using namespace std;

long long  N, A, B;
int main()
{


	cin >> N;
	cin >> A;
	cin >> B;

	long long  ans = 0;

	if ((B - A) % 2 == 0) {
		ans = (B - A) / 2;
	}
	else {
		ans = min(N - B, A - 1) +  1 + (B - A - 1) / 2;
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
using System;
using System.Linq;

class F
{
	static void Main()
	{
		var p2 = new long[60];
		for (long i = 0, v = 1; i < p2.Length; p2[i++] = v, v *= 2) ;

		var n = int.Parse(Console.ReadLine());
		var a = Console.ReadLine().Split().Select(long.Parse).ToArray();
		var s = a.Aggregate((x, y) => x ^ y);

		for (int p = 59, c = 0; p >= 0; p--)
		{
			if ((s & p2[p]) != 0) continue;
			var j = -1;
			for (int i = c; i < n; i++) if ((a[i] & p2[p]) != 0) { j = i; break; }
			if (j == -1) continue;

			Swap(a, c, j);
			for (int i = 0; i < n; i++) if ((a[i] & p2[p]) != 0 && i != c) a[i] ^= a[c];
			c++;
		}
		var r = a.Aggregate((x, y) => x ^ y);
		Console.WriteLine(r + (s ^ r));
	}

	static void Swap<T>(T[] a, int i, int j) { var o = a[i]; a[i] = a[j]; a[j] = o; }
}


Measured memory_bytes: 34268
#include <iostream>

using namespace std;
int main(int argc, char *argv[]) {
	int A,B;
	cin >> A >> B;
	if(1 <= A  && A <=9 && 1 <= B && B <= 9){
		cout << A * B << endl;
	}else{
		cout << -1 << endl;
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
	#define ll long long
	#define f   first
	#define s   second
	#define pb          push_back
	#define mod         1000000007
	#define hell        998244353
	#define inf         1000000000000000000LL
	using namespace std;
	ll n,k,m,l,mx,sum,q;
	void solve()
	{   ll x;
		ll a,b;
		cin>>a>>b>>n;
		if(n<(b-1))
		{
			cout<<(a*(n))/b;
		}
		else
		{
			cout<<(a*(b-1))/b;
		}
		
				

	}    
	int main()
	{   
	    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	    //cout<<primes.size();
	    

	    ll t=1;
	   //cin>>t;
	    for(int i=1; i<=t; i++) {
        solve();
    }

	}

Measured memory_bytes: 3652
//g++ -std=c++14 test.cpp -o test.out
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <iomanip>
#include <vector>
#include <queue>
#include <map> 
#include <utility>
#include <limits.h>
#include <bitset>
#include <set>
using namespace std;
 
#define LL long long int
const LL INF = (LL)(1e18)+1;
const int INF_INT = 2147483647-1e6;
const LL mod = 1000000007ll;

struct mint {
  LL x; 
  mint(LL x=0):x((x%mod+mod)%mod){}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(LL t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }
 
  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

string S;

LL ans = 0;
 
void solve(){
	int N = S.length();
	mint dp[N];
	dp[0] = 1 + 2*(S[N-1]-0x30);
	for(int i=1;i<N;i++){
		if(S[N-1-i]=='0'){
			dp[i] = dp[i-1];
		}
		if(S[N-1-i]=='1'){
			dp[i] = mint(3).pow(i) + dp[i-1]*2;
		}
	}
	ans = dp[N-1].x;
}
 
int main(){
	cin >> S;
 
	solve();
 
	cout << ans << endl;
	return 0;
}

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

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

  string ans = "Yes";

  for (int i = 0; i < S.size(); i++)
  {
    if ((i % 2 == 0 && S.at(i) == 'L') || (i % 2 == 1 && S.at(i) == 'R'))
    {
      ans = "No";
    }
  }

  cout << ans << endl;
}


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

using namespace std;

typedef long long ll;

int main() {
    int A, B, C, X, Y;
    cin >> A >> B >> C >> X >> Y;

    ll m = 999999999999;
    for (int c = 0;; c += 2) {
        int a = max(0, X - c / 2);
        int b = max(0, Y - c / 2);
        ll cost = a * A + b * B + c * C;
        m = min(m, cost);
        if (a == 0 && b == 0) { break; }
    }

    cout << m << endl;
}


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

int main() {
set<int> a;
rep(i,3){
  int x;
  cin >> x;
  a.insert(x);
}
cout << a.size() << endl;
 }

Measured memory_bytes: 3412
use std::cmp;
use std::fmt::Debug;
use std::str::FromStr;
#[allow(dead_code)]
fn read_as_vec<T>() -> Vec<T>
where
    T: FromStr,
    <T as FromStr>::Err: Debug,
{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim()
        .split_whitespace()
        .map(|c| T::from_str(c).unwrap())
        .collect()
}

#[allow(dead_code)]
fn read_as_string() -> String {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

fn main() {
    let n: usize = read_as_vec()[0];
    let mut a = read_as_vec::<usize>();
    if n == 1 {
        println!("1");
        return;
    }
    a.sort();
    let mut dp: Vec<bool> = vec![true; 1_000_001];
    let mut are_dups: Vec<bool> = vec![false; 1_000_001];
    for i in 0..a.len() - 1 {
        if a[i] == a[i + 1] {
            are_dups[a[i]] = true;
        }
    }
    let mut ans: usize = 0;
    let mut bias = 0;
    for elem_a in a {
        if dp[elem_a] == true {
            ans += 1;
            if are_dups[elem_a] {
                bias += 1;
            }
            let mut i = 1;
            while elem_a * i < dp.len() {
                dp[elem_a * i] = false;
                i += 1;
            }
        }
    }
    println!("{}", ans - bias);
}


Measured memory_bytes: 6088
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
const lint mod = 998244353;
#define all(x) (x).begin(), (x).end()
#define bitcount(n) __builtin_popcountl((lint)(n))
#define fcout cout << fixed << setprecision(15)
#define highest(x) (63 - __builtin_clzl(x))
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T = string, class U = char>int character_count(T text, U character){ int ans = 0; for(U i: text){ ans += (i == character); } return ans; }
lint power(lint base, lint exponent, lint module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ lint root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
struct position{ int y, x; }; position mv[4] = {{0, -1}, {1, 0}, {0, 1}, {-1, 0}}; // double euclidean(position first, position second){ return sqrt((second.x - first.x) * (second.x - first.x) + (second.y - first.y) * (second.y - first.y)); }
template<class T, class U> string to_string(pair<T, U> x){ return to_string(x.first) + "," + to_string(x.second); } string to_string(string x){ return x; }
template<class itr> void array_output(itr start, itr goal){ string ans; for(auto i = start; i != goal; i++) ans += to_string(*i) + " "; if(!ans.empty()) ans.pop_back(); cout << ans << endl; }
template<class itr> void cins(itr first, itr last){ for(auto i = first; i != last; i++){ cin >> (*i); } }
template<class T> T gcd_calc(T a, T b){ if(b){ return gcd_calc(b, a % b); }else{ return a; }}
template<class T> T gcd(T a, T b){ if(a < b) swap(a, b); return gcd_calc(a, b); }
template<class T> T lcm(T a, T b){ return a / gcd(a, b) * b; }
struct combination{ vector<lint> fact, inv; combination(int sz) : fact(sz + 1), inv(sz + 1){ fact[0] = 1; for(int i = 1; i <= sz; i++){ fact[i] = fact[i - 1] * i % mod; } inv[sz] = power(fact[sz], mod - 2, mod); for(int i = sz - 1; i >= 0; i--){ inv[i] = inv[i + 1] * (i + 1) % mod; } } lint C(int p, int q) const{ if(q < 0 || p < q) return 0; return (fact[p] * inv[q] % mod * inv[p - q] % mod); } };
template<class itr> bool next_sequence(itr first, itr last, int max_bound){ itr now = last; while(now != first){ now--; (*now)++; if((*now) == max_bound){ (*now) = 0; }else{ return true; } } return false; }
inline int at(int x, int k){ return (x >> k) & 1; }
random_device rnd;

int main(){
    string S, T;
    cin >> S >> T;
    cout << T << S << endl;
}


Measured memory_bytes: 256