akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define int           long long
#define pb            push_back
#define all(a)        (a).begin(),(a).end()
#define sz(x)         (int)x.size()
#define F             first
#define S             second
#define endl          "\n"
#define inf           (long long)1000000007
#define FOR(i, a, b)  for(int i=a; i<b; i++)
#define bigint        1e18
mt19937 RNG(chrono::steady_clock::now().time_since_epoch().count()); 
#define SHUF(v) shuffle(aint(v), RNG);
// Use mt19937_64 for 64 bit random numbers. 

template <typename T>
T ceil(T a, T b){ return (a+b-1)/b; }


template<typename T>
T binpow(T a, T b, T m) {
    a %= m;
    T res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}
class Solution {
public:    
    Solution() {
        
    }
    void solve() {
        int n; cin>>n;
        int p = binpow(10LL, n, inf);
        int q = binpow(9LL, n, inf);
        int r = binpow(8LL, n, inf);
        cout<<((p+r)%inf-(2*q)%inf+inf)%inf;
    }
};

void solve(){
    Solution sol;
    sol.solve();
}

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);     
    int t=1;
    //cin>>t;
    FOR(i, 1, t+1){ 
        //cout<<"Case #"<<i<<": ";
        solve();
    }
    cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
    return 0;
 
}

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

int prime[10000],size;

bool isPrime(int x){
	for(int i=0;i<size && prime[i]<=sqrt(x);i++){
		if(x % prime[i] == 0) return false;
	}
	return true;
}

void mkPrime(void){
	prime[0] = 2;
	size = 1;
	for(int i=3;i<101500;i++){
		if(isPrime(i)) prime[size++] = i;
	}
}

int main(void){
	int i,j,n,p,from,to;
	int sum[5100],len;

	mkPrime();

	while(cin>>n>>p && n+1){
		for(from=0;prime[from]<=n;from++);
		to = from+p;
		len = 0;

		for(i=from;i<to;i++){
			for(j=i;j<to;j++){
				sum[len++] = prime[i] + prime[j];
			}
		}
		sort(sum,sum+len);
		cout<<sum[p-1]<<endl;
	}

	return 0;
}

Measured memory_bytes: 920
#include <stdio.h>

int main(){
	int D;
	int a;

	scanf("%d",&D);
	if (D == 25) printf("Christmas\n");
	if (22 <= D && D <= 24){
		printf("Christmas ");
		a = 25 - D;
		for( int i = 0; i < a; i++){
			printf("Eve ");
		}
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 128
#include<algorithm>
#include<complex>
#include<ctype.h>
#include<iomanip>
#include<iostream>
#include<map>
#include<math.h>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<stdio.h>
#include<string>
#include<string>
#include<vector>

using namespace std;
typedef long long ll;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define pn(s) cout << (#s) << " " << (s) << endl
#define p_yes() p("YES")
#define p_no() p("NO")

template < typename T >
void vprint(T &V){
	for(auto v : V){
    	cout << v << " ";
	}
	cout << endl;
}

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

const ll mod = 1e9 + 7;
const ll inf = 1e18;

ll how_many_swap(string s, char replace_char){
    ll count = 0;
    while(true){
        map<char, int> mp;
        for(char c : s){
            mp[c]++;
        }
        // 文字が1種類
        if(mp.size()==1){
            return count;
        }
        else{
            // 置き換えが必要
            count++;
        }

        // その文字をできるだけ広げる
        ll L = s.size();
        FOR(i, 1, L){
            if(s[i]==replace_char){
                s[i-1] = s[i];
            }
        }
        s = s.substr(0, L-1);
    }
}

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

    // input
    string s;
    cin >> s;

    map<char, int> temp;
    for(char c : s){
        temp[c]++;
    }
    vector<char> chars;
    for(auto p : temp){
        chars.push_back(p.first);
    }

    ll min_count = inf;

    for(char replace_char : chars){
        ll count = how_many_swap(s, replace_char);
        min_count = min(min_count, count);
    }
    
    p(min_count);
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define ALL(A) A.begin(), A.end()
#define INF ((int)(1e9))

using namespace std;

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

const int MAX_N = 44;
const int MAX_Q = 404;

int dp[MAX_N][MAX_Q][MAX_Q]; // i 番目をみて タイプAの物質 j[g] タイプBの物質 k[g] が存在するときの最小の値段
int a[MAX_N], b[MAX_N], c[MAX_N];

int main()
{
	rep (i, MAX_N) rep (j, MAX_Q) rep (k, MAX_Q) dp[i][j][k] = INF;
	memset(a, 0, sizeof(a));
	memset(b, 0, sizeof(b));
	memset(c, 0, sizeof(c));

	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int N, Ma, Mb; cin >> N >> Ma >> Mb;
	rep (i, N){
		cin >> a[i] >> b[i] >> c[i];
	} // end rep

	dp[0][0][0] = 0;
	rep (i, N){
		for (int j = 0; j < MAX_Q; ++j){
			for (int k = 0; k < MAX_Q; ++k){
				if (dp[i][j][k] != INF){
					dp[i+1][j + a[i]][k + b[i]] = min(dp[i+1][j + a[i]][k + b[i]], dp[i][j][k] + c[i]);
					dp[i+1][j][k] = min(dp[i+1][j][k], dp[i][j][k]);
				} // end if
			} // end for
		} // end for
	} // end rep

	int res = INF;
	for (int i = 1; i <= N; ++i){
		for (int j = 1; j < MAX_Q; ++j){
			for (int k = 1; k < MAX_Q; ++k){
				if (dp[i][j][k] != INF){
					if (Ma * k == Mb * j){	// Ma : Mb == a : b
						res = min(res, dp[i][j][k]);
					} // end if
				} // en if
			} // end for
		} // end for
	} // end for

	cout << (res == INF ? -1 : res) << endl;

	return 0;
}

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

using namespace std;

int main(){
    int n, k;
    cin >> n >> k;
    vector<int> P(n);
    copy_n(istream_iterator<int>(cin), n, P.begin());
    double ans = 0;
    double S = 0;
    for (int i = 0; i < k; i++)
        S += double(P[i] + 1) / 2;
    ans = S;
    for (int i = k; i < n; i++){
        S -= double(P[i - k] + 1) / 2;
        S += double(P[i] + 1) / 2;
        ans = max(ans, S);
    }
    cout << setprecision(20) << ans << endl;
}

Measured memory_bytes: 1024
#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;

int main(){
	int n;
	cin >> n;
	bool exist = false;
	rep(i,n){
		char c;
		cin >> c;
		if(c == 'Y') exist = true;
	}
	if(exist){
		cout << "Four" << endl;
	}else{
		cout << "Three" << endl;
	}
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_multi_set;

#define mod         1000000007
#define pi          acos(-1.0)
#define eps         1e-9


#define fast       ios::sync_with_stdio(0); cin.tie(0);cout.tie(0)
#define fs          first
#define sc          second
#define pb         push_back
#define sp          printf(" ")
#define nl          '\n'
#define all(a) a.begin(),a.end()
#define unique(c) (c).resize(unique(all(c)) - (c).begin())
#define itn int

#define set0(a)     memset(a,0,sizeof(a))
#define setneg(a)   memset(a,-1,sizeof(a))
#define setinf(a)   memset(a,126,sizeof(a))

#define REP(i,start,end) for (int i = start; i <=end; i++)
#define RREP(i,end,start) for (int i=end; i>=start ;i--)

typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
typedef pair<int, int> pii;
typedef pair<LL, LL> pll;
typedef pair<double, double> pdd;
typedef vector<int> vi;
typedef vector<LL> vll;
typedef vector<double> vd;
typedef vector<vector<LL> > matrix;
typedef vector<vector<int> > graph;
LL INF=1e9;


void solve()
{
    int n;
    cin>>n;
    int a[n],b[n],c[n];
    REP(i,0,n-1)
        cin>>a[i]>>b[i]>>c[i];
    int dp[n][3];
    dp[0][0]=a[0];
    dp[0][1]=b[0];
    dp[0][2]=c[0];
    REP(i,1,n-1)
    {
        dp[i][0]=a[i]+max(dp[i-1][1],dp[i-1][2]);
        dp[i][1]=b[i]+max(dp[i-1][0],dp[i-1][2]);
        dp[i][2]=c[i]+max(dp[i-1][0],dp[i-1][1]);
    }
    cout<<max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]))<<nl;
}
int main()
{
    fast;
        solve();
}


Measured memory_bytes: 2560
import math
(a, b, x) = map(int, input().split(' '))
if x >= a*a*b/2:
    print(180 * math.atan(2*b/a-2*x/(a*a*a)) / math.pi)
else:
    print(180 * math.atan(a*b*b/(2*x)) / math.pi)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
int main(){
  string S,T;
  cin>>S>>T;
  int flag=0;
  for(int i=0;i<S.length();i++){
  if(S[i]!=T[i]){
    flag=1;
   }
  }
  if(flag){
    cout<<"No"<<endl;
  }else{
    cout<<"Yes"<<endl;
  }
 return 0; 
}

Measured memory_bytes: 3624
#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 N;
  cin >> N;
  vector<int> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  int ans = INF;
  for (int i = -100; i <= 100; i++) {
    int sum = 0;
    for (int j = 0; j < N; j++) {
      sum += (A[j] - i) * (A[j] - i);  
    }
    ans = min(ans, sum);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<(b);i++)
#define erep(i,a,b) for(int i=a;i<=(int)(b);i++)
#define per(i,a,b) for(int i=(b)-1;i>(a);i--)
#define eper(i,a,b) for(int i=((int)(a));i>=b;i--)
#define pb push_back
#define mp make_pair
#define INF (1<<30)-1
#define MOD 1000000007
using namespace std;
typedef long long ll;
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int a, b;
int main() {
 ios::sync_with_stdio ( false );
 cin.tie ( 0 );
    cin >> a >> b;
    if ((a*b)%2 == 0) cout << "Even" << endl;
    else cout << "Odd" << endl;
    return 0;
}


Measured memory_bytes: 256
package main

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

// I/O
type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func (s *Scanner) nextFloatSlice(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextFloat()
	}
	return res
}

// Arithmetic
func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

func abs(x int) int {
	if x > 0 {
		return x
	}
	return -x
}

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

// Sort
type RuneSlice []rune

func (a RuneSlice) Len() int           { return len(a) }
func (a RuneSlice) Less(i, j int) bool { return a[i] < a[j] }
func (a RuneSlice) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }

func main() {
	sc := NewScanner()
	wtr := bufio.NewWriter(os.Stdout)
	N := sc.nextInt()
	T := sc.nextIntSlice(N)
	sum := 0
	for i := 0; i < N; i++ {
		sum += T[i]
	}
	M := sc.nextInt()
	for i := 0; i < M; i++ {
		p, x := sc.nextInt(), sc.nextInt()
		ans := sum - T[p-1] + x
		fmt.Fprintln(wtr, ans)
	}

	wtr.Flush()
}


Measured memory_bytes: 640
n = int(input())
l = list(map(int, input().split()))
l1 = [0]*n
l1[1] = abs(l[0] - l[1])
for i in range(2, n):
    l1[i] = min(l1[i - 2] + abs(l[i] - l[i - 2]), l1[i - 1] + abs(l[i] - l[i - 1]))
print(l1[n - 1])

Measured memory_bytes: 20680
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>

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;
}

using namespace std;
#define int long long
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repr(i,n) for(ll i=n;i>=0;i--)
#define P pair<ll, ll>
#define sz(x) (ll)x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<ll>
#define COUT(x) cout<<(x)<<endl
#define MA map<ll,ll>
#define SE set<ll>
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,VE,greater<ll>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define EPS (1e-10)
#define pb push_back

const long long MOD = 1000000007;
//const long long MOD = 998244353;
const long long INF = 1LL << 60;
const double PI = acos(-1.0);


long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	unsigned r;
	while ((r = a % b)) {
		a = b;
		b = r;
	}
	return b;
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a * b / g;
}
bool prime(ll n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}
map<ll, ll> prime_factor(ll n) {
	map<ll, ll> ret;
	for (ll i = 2; i * i <= n; i++) {
		while (n % i == 0) {
			ret[i]++;
			n /= i;
		}
	}
	if (n != 1) ret[n] = 1;
	return ret;
}
const int MAX = 510000;
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
using Graph = vector<VE>;


signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int n; cin >> n;
	VE a(n); rep(i, n)cin >> a[i];
	int tmp = 0;
	rep(i, n) {
		tmp = a[i] - tmp;
	}
	rep(i, n)a[i] *= 2;
	VE ans(n); ans[0] = tmp;
	rep(i, n) {
		if (i == 0)continue;
		ans[i] = a[i - 1] - ans[i - 1];
	}
	rep(i, n) {
		cout << ans[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 2944
#include <iostream> // cout, endl, cin
#include <cmath> //sqrt pow
#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 <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#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 <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
 
#define rep(i,n) for(int i = 0; i < n; i++)
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int, int>
#define mod 1000000007
using ll = long long;
using namespace std;
int main(){
  int a,p;
  cin >> a >> p;
  a = a * 3 + p;
  cout << a / 2 << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define all(c) begin(c),end(c)

template<typename T1, typename T2>
inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }

template<typename T1, typename T2>
inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

//改造
typedef long long int ll;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007


//ここから編集する
class Solve {
public:
    void input() {

    }

    vector<int> mul(vector<int> f, vector<int> g) {
        int n = f.size();
        vector<int> ret(n);
        rep(i, 0, n) {
            ret[i] = g[f[i]];
        }
        return ret;
    }


    void solve() {
        input();
        int N;
        cin >> N;
        vector<ll> x(N);
        rep(i, 0, N) cin >> x[i];

        int M;
        ll K;
        cin >> M >> K;
        vector<int> a(M);
        rep(i, 0, M) {
            cin >> a[i];
        }

        vector<int> base(N - 1);
        rep(i, 0, N - 1) base[i] = i;
        vector<int> f = base;

        for (int i = 0; i < M; ++i) {
            swap(base[a[i] - 2], base[a[i] - 1]);
        }


        ll rest = K;
        while (rest > 0) {
            if (rest & 1) f = mul(f, base);
            base = mul(base, base);
            rest >>= 1;
        }

        vector<ll> d(N - 1);
        vector<ll> neko(N - 1);
        for (int i = 0; i < N - 1; ++i) {
            d[i] = x[i + 1] - x[i];
        }
        for (int i = 0; i < N - 1; ++i) {
            neko[i] = d[f[i]];
        }
        vector<ll> ans(N);
        ans[0] = x[0];
        for (int i = 1; i < N; ++i) {
            ans[i] = ans[i - 1] + neko[i - 1];
        }

        for (int i = 0; i < N; ++i) {
            cout << ans[i] << endl;
        }


        return;

    }
};


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);

    Solve().solve();


    return 0;
}


Measured memory_bytes: 6104
import java.util.*;
public class Main {
	Scanner sc;
	void run() {
		sc = new Scanner(System.in);
		while (true) {
			Dice dice = new Dice();
			int n = sc.nextInt();
			if(n == 0) break;
			int cnt = 1;
			for(int i=0;i<n;i++) {
				dice.roll(sc.next());
//				System.out.println(dice.getFace(0));
				cnt += dice.getFace(0);
			}
			System.out.println(cnt);
		}
	}
	
	public static void main(String[] args) {
		new Main().run();
	}
	
	class Dice {
		int[] dice;		// {top,front,right,left,back,bottom}
		Dice() {
			dice = new int[6];
			for(int i=0;i<6;i++) dice[i] = i+1;
		}
		void roll(String d) {
			if(d.equals("North")) roll_N();
			else if(d.equals("South")) roll_S();
			else if(d.equals("West")) roll_W();
			else if(d.equals("East")) roll_E();
			else if(d.equals("Right")) roll_R();
			else roll_L();
		}
		
		void roll_N() {
			roll(0,1,5,4);
		}
		void roll_S() {
			roll(0,4,5,1);
		}
		void roll_W() {
			roll(0,2,5,3);
		}
		void roll_E() {
			roll(0,3,5,2);
		}
		void roll_R() {
			roll(1,2,4,3);
		}
		void roll_L() {
			roll(1,3,4,2);
		}
		
		void roll(int face1, int face2, int face3, int face4 ) {
			int tmp = dice[face1];
			dice[face1] = dice[face2];
			dice[face2] = dice[face3];
			dice[face3] = dice[face4];
			dice[face4] = tmp;
		}
		
		int getFace(int n ) {
			return dice[n];
		}
		
	}
	
}

Measured memory_bytes: 12000
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define P pair<int,int>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(),v.end()
#define pb push_back
template<class T>void chmax(T &a,T b){if(a<b)a=b;}
template<class T>void chmin(T &a,T b){if(a>b)a=b;}
constexpr int INF=1000000000000000000;
constexpr int mod=1000000007;
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
int kaijo[2000010];
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;}
bool prime(int a){
    if(a==1)return false;
    for(int i=2;i*i<=a;i++){
        if(a%i==0)return false;
    }
    return true;
}
void init_fact(){
    kaijo[0]=1;
    for(int i=1;i<=2000000;i++){
        kaijo[i]=kaijo[i-1]*i;
        kaijo[i]%=mod;
    }
}
int modpow(int a,int b){
    if(b==0)return 1;
    if(b%2)return modpow(a,b-1)*a%mod;
    int memo=modpow(a,b/2);
    return memo*memo%mod;
}
int comb(int a,int b){
    if(!kaijo[0])init_fact();
    return kaijo[a]*modpow(kaijo[a-b],mod-2)%mod*modpow(kaijo[b],mod-2)%mod;
}
int inv(int x){return modpow(x,mod-2);}
bool kosa(double ax,double ay,double bx,double by,double cx,double cy,double dx,double dy){
    double ta=(cx-dx)*(ay-cy)+(cy-dy)*(cx-ax);
    double tb=(cx-dx)*(by-cy)+(cy-dy)*(cx-bx);
    double tc=(ax-bx)*(cy-ay)+(ay-by)*(ax-cx);
    double td=(ax-bx)*(dy-ay)+(ay-by)*(ax-dx);
    return tc*td<0&&ta*tb<0;
}
int n,dp[2010][2010];
P a[2010];
signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin>>n;
    rep(i,n){
        cin>>a[i].fi;
        a[i].se=i;
    }
    sort(a,a+n,greater<P>());
    rep(i,n){
        int p=a[i].se;
        for(int j=0;j<=i;j++){
            int le=j,ri=j+n-i-1;
            //dp[le][ri]
            chmax(dp[le+1][ri],dp[le][ri]+abs(p-le)*a[i].fi);
            chmax(dp[le][ri-1],dp[le][ri]+abs(p-ri)*a[i].fi);
        }
    }
    int ans=0;
    rep(i,n-1){
        chmax(ans,dp[i+1][i]);
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 26292
#include "bits/stdc++.h"
using namespace std;
#define REP(i,a) for(int i = 0; i < (a);i++)
#define ALL(a) (a).begin(),(a).end()
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const int MOD = 1e9 + 7;
using Graph = vector < vector<int>>;
long int sum[200020] = {};
int main() {
	int N;
	int max1 = 0;
	cin >> N;
	vector<int> s;
	for (int i = 0; i < N; i++) {
		int a;
		cin >> a;
		s.push_back(a);
	}
	s.push_back(MOD);
	int now = s[0];
	int cnt = 0;
	for (int i = 1; i < N; i++) {
		if (now >= s[i]) {
			cnt++;
			now = s[i];
		}
		else {
			now = s[i];
			max1 = max(cnt, max1);
			cnt = 0;
		}
	}
	cout << max (max1,cnt);
}

Measured memory_bytes: 892
package main

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

func main() {
	var sc = bufio.NewScanner(os.Stdin)
	sc.Scan()
	line := sc.Text()
	array := strings.Split(line, " ")
	x := array[0]
	y := array[1]
	xi, _ := strconv.Atoi(x)
	yi, _ := strconv.Atoi(y)
	area := xi * yi
	round := (xi + yi) * 2
	fmt.Println(strconv.Itoa(area) + " " + strconv.Itoa(round))
}

Measured memory_bytes: 1120
n = input()
A = list(map(int,input().split()))
B = list(map(int,input().split()))
nokori = 0
katsuyaku = 0
for i in range(int(n)):
    if nokori >= A[i]:
        katsuyaku += A[i]
        A[i] = 0
    else:
        A[i] = A[i] - nokori
        katsuyaku += nokori
        
    
    if B[i] >= A[i]:
        katsuyaku += A[i]
        nokori = B[i] - A[i]
    else:
        katsuyaku += B[i]
        nokori = 0
if nokori >= A[-1]:
    katsuyaku += A[-1]
else:
    katsuyaku += nokori
print(katsuyaku)

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

#define Fast           ios_base::sync_with_stdio(0);cin.tie(0),cout.tie(0)
#define FO             freopen("in.txt", "r", stdin)
#define FC             freopen("out.txt", "w", stdout)
#define aise           cout<<"aise"<<endl
#define pb             push_back
#define pf             push_front
#define ppb            pop_back
#define ppf            pop_front
#define mp             make_pair
#define ll             long long
#define all(x)         x.begin(), x.end()
#define mset(v, a)     memset(v, a, sizeof(v))
#define pll            pair< ll, ll >
#define pd             pair< double, double >
#define ff             first
#define ss             second
#define pi             acos(-1.0)
#define mxN            2010
#define inf            1e14
#define mod            1000000007
#define tc             ll tc;scanf("%lld",&tc);while(tc--)

//NCR iterative
/*voidcomb_table(intN)
{
    for(inti=0; i<=N; ++i)
    {
        for(intj=0; j<=i; ++j)
        {
            if(j==0or j==i)
            {
                C[i][j]=1LL;
            }
            else
            {
                C[i][j]=(C[i-1][j-1]+C[i-1][j]);
            }
        }
    }
}*/


//NCR recursive
/*ll dp[55][55];

ll NCR(ll n,ll r)
{

    if(n==r)
        return dp[n][r]=1;
    if(r==0)
        return dp[n][r]= 1;
    if(r==1)
        return dp[n][r]=n ;
    if(dp[n][r] != -1)
        return dp[n][r];
    return dp[n][r] = NCR(n-1,r)+NCR(n-1,r-1);
}*/

//Sieve:
/*bool Flag[1000010];
vector<ll> Prime;

void sieve()
{

    ll val=sqrt(1000010);
    for(ll i=4;i<=1000005; i+=2) Flag[i]=1;
    for(ll i=3;i <= val;i+=2)
    {

        if(Flag[i]==0)
        {

            for(ll j=i*i;j<=1000005;j+=i) Flag[j]=1;
        }
    }
    Flag[1]=1;
    for(ll i=1;i<=1000000;i++)
        if(Flag[i]==0) Prime.pb(i);
}*/


//Conversion
/*string bin(ll x)
{

    string ret;
    while(x)
    {

        ll t=x%2;
        char c;
        if(t==1)
            c='1';
        else
            c='0';
        ret.pb(c);
        x/=2;
    }
    reverse(all(ret));
    return ret;
}*/

/*ll lcm(ll x, ll y)
{

    ll ret=__gcd(x,y);
    return (x*y)/ret;
}*/

/*ll dx[]= {0,0,1,-1};
ll dy[]= {1,-1,0,0};*/

ll col[100010];
vector<pll> adj[100010];
bool vis[100010];

void dfs(ll nd, ll cl)
{

    vis[nd]=1;
    col[nd]=cl;
    ll rev;
    if(cl==1) rev=0;
    else rev=1;
    for(ll i=0;i<adj[nd].size();i++)
    {

        ll v=adj[nd][i].ff;
        ll dis=adj[nd][i].ss;
        if(vis[v]) continue;
        if(dis%2) dfs(v,rev);
        else dfs(v,cl);
    }
}

int main()
{

    ll n;
    cin >> n;
    vector<ll> v(n,0);
    for(ll i = 0; i < n; i++) cin >> v[i];
    ll ans = v[0];
    for(ll  i= 1; i < n; i++)
    {

        if(v[i-1] < v[i]) ans+=v[i]-v[i-1];
    }
    cout << ans;
}


Measured memory_bytes: 5932
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; i++ )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;
int dx[4]={1,0,-1,0} , dy[4]={0,1,0,-1} ;

int main(){
   ll n,k;
   cin>>n>>k;
   ll ans=k;
   rep(i,n-1)ans*=(k-1);
   cout<<ans<<endl;
   return 0;
}


Measured memory_bytes: 256
N=int(input())
S=input()


nums=set()
numsidx=[-1 for i in range(10)]
for i in range(N-1,1,-1):
    if not S[i] in nums:
        nums.add(S[i])
        numsidx[int(S[i])]=i


nunums=set()
nunumsidx=[-1 for i in range(100)]
for i in range(N-2,0,-1):
    for m in range(10):
        if i<numsidx[m]:
            s=S[i]+str(m)
            if not s in nunums:
                nunums.add(s)
                nunumsidx[int(s)]=i

nums=set()
ans=set()
for i in range(N-2):
    if not S[i] in nums:
        nums.add(S[i])
        for m in range(100):
            if i<nunumsidx[m]:
                ans.add(S[i]+str(m))

print(len(ans))


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

typedef long long ll;

const ll MOD = 1e9 + 7;

int main() {
    int X, MAXP = 100004;
    cin >> X;
    vector<bool> p(MAXP, true); 
    for (int i = 2; i * i <= MAXP; i++) {
        if (p[i]) {
            for (int j = i * 2; j <= MAXP; j += i) {
                p[j] = false;
            }
        }
    }
    for (int i = X; i <= MAXP; i++) {
        if (p[i]) {
            cout << i << endl;
            break;
        }
    }
}

Measured memory_bytes: 256
class TriangleChecker
  def initialize
    @triangles = []
  end

  # add Triangle Data
  def add(triangle)
    @triangles << triangle
  end

  # check added Triangle
  def check

    @triangles.each {|triangle|

      # sort Triangle Data
      triangle.Line.sort!

      if (triangle.Line[0] ** 2) + (triangle.Line[1] ** 2) == (triangle.Line[2] ** 2) then
        puts "YES"
      else
        puts "NO"
      end
    }
  end
end

# Rectangle Data Class
class Triangle
  attr_accessor :Line
end


inputs = gets.chomp.split(nil)
dataCount = inputs[0].to_i
checker = TriangleChecker.new

for i in 1..dataCount
  inputs = gets.chomp.split(nil)
  line1 = inputs[0].to_i
  line2 = inputs[1].to_i
  line3 = inputs[2].to_i

  triangle = Triangle.new
  triangle.Line = [line1, line2, line3];

  checker.add(triangle)
end

checker.check

Measured memory_bytes: 6120
#include<stdio.h>
#include<iostream>
#include<string.h>
#include<algorithm>
#include<queue>
#include<stack>
#include<math.h>
#include<map>
typedef long long int ll;
using namespace std;
#define maxn 0x3f3f3f3f
#define INF 0x3f3f3f3f3f3f3f3f
const int mm=2e5+100;
ll d[mm];
int main()
{
   ll n,m,i,j,t,a,b,c,p,k,kk;
     cin>>n>>m;
     cout<<n*m<<endl;

   
   	
} 

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

using namespace std;
#define ll long long
#define ld long double
#define  P pair<ll,ll>
#define FOR(i,n,m) for(ll i=n; i<(ll)m;i++)
#define FORr(i,n,m) for(ll i=n; i>=(ll)m; i--)
#define FORm(i,m) for(auto i=m.begin();i!=m.end();i++)
#define VEC2(x,a,b) vector<vector<ll>> x = vector<vector<ll>>(a,vector<ll>(b,0))
#define sortAl(v) sort(v.begin(),v.end())
#define sortAlr(v) sort(v.begin(),v.end()); reverse(v.begin(),v.end())
#define cinv(v,n,m) FOR(i,n,m) cin>>v.at(i)
#define coutv(v,n,m) FOR(i,n,m) cout<<v.at(i) <<" "; cout<<endl
#define cout(n) cout<<fixed<<setprecision(n)

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

    ll n;
    cin>>n;
    vector<ll> v(n);
    cinv(v,0,n);
    vector<ll> f(n,0);
    if(v[0]>v[1]){
      f[0]=1;
    }
    FOR(i,1,n-1){
      if(v[i-1]<=v[i] && v[i]>v[i+1]){
        f[i]=1;
      }
      if(v[i-1]>=v[i] && v[i]<v[i+1]){
        f[i]=-1;
      }
    }

    if(v[n-2]<=v[n-1]){
      f[n-1]=1;
    }
    ll down = 0;
    ll res=0;

    ll flag = 1;
    FOR(i,0,n){
      if(f[i]==1 && flag == 1){
        res += v[i] - down;
        flag = 0;
      }
      if(f[i] == -1 && flag == 0){
        down = v[i];
        flag = 1;
      }
    }
    if(n==1){
      res=v[0];
    }
    cout<<res<<endl;
}


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

int main() {
	int N;
	cin >> N;
	int ans = 0;
	vector<int>V(N);
	for (int n = 0;n<N;++n) {
		cin >> V[n];
	}	
	vector<int>C(N);
	for (int n = 0; n < N; ++n) {
		cin >> C[n];
	}	
	for (int n = 0; n < N; ++n) {
		if (V[n]-C[n]>0) {
			ans += V[n] - C[n];
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3580
<?php
  list($n, $k) = explode(" ", trim(fgets(STDIN)));

  $ans = 0;
  for($i=$k; $i<=$n+1; $i++){
    $least = (1 + $i) * $i / 2;
    $most = (($n+1) + (($n+1)-$i+1)) * $i / 2;
    $ans = ($ans + ($most - $least + 1)) % 1000000007;
  }

  echo $ans;

Measured memory_bytes: 16116
#include<bits/stdc++.h>
using namespace std;
int main(){
  int w,a,b;
  cin>>w>>a>>b;
  if(b<=a+w && b+w>=a) cout<<0<<endl;
  else if(b>a+w) cout<<b-(a+w)<<endl;
  else cout<<a-(b+w)<<endl;
  return 0;
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

const long long MOD = 998244353;

ll next(ll a) {
    vector<int> v;
    while (a > 0) {
        v.push_back(a % 10);
        a /= 10;
    }
    reverse(v.begin(), v.end());

    int i;
    for (i = (int)v.size() - 1; i > 0; i--) {
        if (v[i - 1] - v[i] == 1) {
            v[i] = v[i - 1];
            break;
        } else if (v[i - 1] == v[i] && v[i] != 9) {
            v[i]++;
            break;
        }
    }
    ll ret = 0;
    if (i == 0) {
        if (v[i] != 9) {
            v[i]++;
        } else {
            ret = 1;
            v[i] = 0;
        }
    }
    i++;
    for (; i < (int)v.size(); i++) {
        v[i] = max(0, v[i - 1] - 1);
    }

    for (int i = 0; i < (int)v.size(); i++) {
        ret = (ret * 10) + v[i];
    }

    return ret;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    ll n;
    cin >> n;
    ll ans = 1;
    n--;
    while (n--) {
        ans = next(ans);
    }

    cout << ans;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(){
  int n,i,j,tmp;
  int a[100];
  int alice=0;
  
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
  }
  
  for(i=n-1;i>0;i--){
    for(j=0;j<i;j++){
      if(a[j]<a[j+1]){
        tmp=a[j];
        a[j]=a[j+1];
        a[j+1]=tmp;
      }
    }
  }
  
  for(i=0;i<n;i++){
    if(i%2==0){
      alice+=a[i];
    } else {
      alice-=a[i];
    }
  }
  printf("%d",alice);
}

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

int main() {
  int N;
  cin>>N;
  int D,X;
  cin>>D>>X;
  int A[N+1];
  for (int i=1; i<=N; i++) {
    cin>>A[i];
  }
  int ans=0;
  for (int i=1; i<=N; i++) {
    int j=0;
    while (true) {
      int x=j*(A[i])+1;
      if (x>D) {
        break;
      }
      j++;
      ans++;
    }
  }
  cout<<ans+X<<endl;
  return 0;
}



Measured memory_bytes: 256
//==========================================
// ABC138a 
//
// 2019/08/18
//==========================================

#include <iostream>
#include <string>
#include <cmath>
#include <vector>
#include <map>
#include <algorithm>
#include <functional>

using namespace std;

int main(int argc, char* argv[])
{
  int a;
  string s;
  cin >> a;
  cin >> s;

  if(3200<=a) cout << s << endl;
  else cout << "red" << endl;

  return 0;
}

Measured memory_bytes: 256
import itertools

n, m = [int(i) for i in input().split()]
s = []
for i in range(m):
    _, *s_ = [int(i) for i in input().split()]
    s.append(s_)
p = [int(i) for i in input().split()]

answer = 0
for i_list in itertools.product([0,1],repeat=n):

    電気点灯 = 0
    for j in range(m):
        オンになっているスイッチの個数 = 0
        for k in range(len(s[j])):
            if i_list[s[j][k]-1] == 1:
                オンになっているスイッチの個数 += 1
        if オンになっているスイッチの個数 % 2 == p[j]:
            電気点灯 += 1

    if 電気点灯 == m:
        answer += 1

print(answer)

Measured memory_bytes: 3064
#include <iostream>
#include <map>
#include <vector>

using namespace std;

int main() {
    int n;
    cin >> n;
    map<int, int> m;
    for (int i = 0; i < n; ++i) {
        int l;
        cin >> l;
        ++m[l];
    }
    vector<int> v;
    for (pair<int, int> p : m) {
        v.push_back(p.first);
    }
    int answer = 0;
    if (v.size() >= 3) {
        for (int i = 0; i < v.size() - 2; ++i) {
            for (int j = i + 1; j < v.size() - 1; ++j) {
                for (int k = j + 1; k < v.size(); ++k) {
                    if (v[i] + v[j] > v[k]) {
                        answer += m[v[i]] * m[v[j]] * m[v[k]];
                    }
                }
            }
        }
    }
    cout << answer << endl;
}


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

#define REP(i,m,n) for(int i=(m); i<(int)(n); i++)
#define RREP(i,m,n) for(int i=(int)(n-1); i>=m; i--)
#define rep(i,n) REP(i,0,n)
#define rrep(i,n) RREP(i,0,n)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aut(r,v) __typeof(v) r = (v)
#define each(it,o) for(aut(it,(o).begin()); it!=(o).end(); ++it)
#define reach(it,o) for(aut(it,(o).rbegin()); it!=(o).rend(); ++it)
#define fi first
#define se second
#define debug(...) {cerr<<"[L"<<__LINE__<<"] "; _debug(__VA_ARGS__);}

template<typename T1, typename T2> ostream& operator<<(ostream& o, const pair<T1, T2>& p)
{return o<<"("<<p.first<<", "<<p.second<<")";}
template<typename T>string join(const vector<T>&v, string del=", ")
{stringstream s;rep(i,v.size())s<<del<<v[i];return s.str().substr(del.size());}
template<typename T>ostream& operator<<(ostream& o, const vector<T>&v)
{if(v.size())o<<"["<<join(v)<<"]";return o;}
template<typename T>ostream& operator<<(ostream& o, const vector<vector<T> >&vv)
{int l=vv.size();if(l){o<<endl;rep(i,l){o<<(i==0?"[ ":",\n  ")<<vv[i]<<(i==l-1?" ]":"");}}return o;}
template<typename T>ostream& operator<<(ostream& o, const set<T>& st)
{vector<T> v(st.begin(),st.end());o<<"{ "<<join(v)<<" }";return o;}
template<typename T1, typename T2>ostream& operator<<(ostream& o, const map<T1, T2>& m)
{each(p,m){o<<(p==m.begin()?"{ ":",\n  ")<<*p<<(p==--m.end()?" }":"");}return o;}
inline void _debug(){cerr<<endl;}
template<class First, class... Rest>
void _debug(const First& first, const Rest&... rest){cerr<<first<<" ";_debug(rest...);}

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;

const double PI = (1*acos(0.0));
const double EPS = 1e-9;
const ll INF = 0x3f3f3f3f;
const ll INFL = 0x3f3f3f3f3f3f3f3fLL;
const ll mod = 1e9 + 7;

inline void finput(string filename) {
    freopen(filename.c_str(), "r", stdin);
}

struct Edge{
    int to, id;
    Edge(int to, int id): to(to), id(id) {}
};

int N, M;
vector<Edge> G[100];
vector<int> es;

bool dfs(int v, int tv, int p=-1){
    if(v == tv){
        es = vector<int>();
        return true;
    }
    for(auto e : G[v]){
        if(e.to == p) continue;
        if(dfs(e.to, tv, v)){
            es.push_back(e.id);
            return true;
        }
    }
    return false;
}

int main(){
    ios_base::sync_with_stdio(0);
    // finput("./input");

    cin >> N;
    rep(i,N-1){
        int a, b; cin >> a >> b;
        a--; b--;
        G[a].emplace_back(b, i);
        G[b].emplace_back(a, i);
    }

    cin >> M;
    vector<ll> eset(M);
    rep(i,M){
        int u, v;
        cin >> u >> v;
        u--; v--;
        dfs(u, v);
        for(auto e : es){
            eset[i] |= 1ll << e;
        }
    }
    ll ans = 0;
    rep(i,1<<M){
        ll mask = 0;
        rep(j,M){
            if((i>>j) & 1) mask |= eset[j];
        }
        ll k = __builtin_popcountll(mask);
        ll x = 1ll << (N-1-k);
        if(__builtin_popcountll(i) & 1) ans -= x;
        else ans += x;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <iomanip>
#include <cstdio>
#include <set>
#include <map>
#include <list>
#include <cstdlib>
#include <queue>
#include <stack>

using namespace std;

#define mod (1e9 + 7)
#define rep(i, n) for (int i = 0; i < n; i++)
#define all(x) x.begin(), x.end()

typedef long long ll;



void solve1()
{
  ll a, b, x; cin >> a >> b >> x;
  ll ans = b/x - (a-1)/x;
  if(a == 0 && x != 1) {
      ans ++;
  }
  cout << ans << endl;
}

int main()
{
    solve1();
}

Measured memory_bytes: 3640
#include<stdio.h>
#include<iostream>
#include<vector>
#include<math.h>
#include<queue>
#include<map>
#include<algorithm>
#include<string.h>
#include<functional>
#include<limits.h>
#include<stdlib.h>
#include<string>
#include<unordered_map>
using namespace std;

#define intmax INT_MAX
#define lmax LONG_MAX
#define uintmax UINT_MAX
#define ulmax ULONG_MAX
#define llmax LLONG_MAX
#define ll long long
#define rep(i,a,N) for((i)=(a);(i)<(N);(i)++)
#define rrp(i,N,a) for((i)=(N)-1;(i)>=(a);(i)--)
#define llfor ll i,j,k
#define sc(a) cin>>a
#define pr(a) cout<<a<<endl
#define pY puts("YES")
#define pN puts("NO")
#define py puts("Yes")
#define pn puts("No")
#define pnn printf("\n")
#define sort(a) sort(a.begin(),a.end())
#define push(a,b) (a).push_back(b)
#define llvec vector<vector<ll>>
#define charvec vector<vector<char>>
#define sizeoof(a,b) (a,vector<ll>(b))
#define llpvec vector<pair<ll,ll>>
/*繰り上げ除算*/ll cei(ll x,ll y){ll ans=x/y;if(x%y!=0)ans++;return ans;}
/*最大公約数*/ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
/*最小公倍数*/ll lcm(ll x,ll y){return x/gcd(x,y)*y;}
/*n乗*/ll llpow(ll x,ll n){ll i,ans=1;rep(i,0,n)ans*=x;return ans;}
/*階乗*/ll fact(ll x){ll i,ans=1;rep(i,0,x)ans*=(x-i);return ans;}
/*nCr*/ll ncr(ll n,ll r){return fact(n)/fact(r)/fact(n-r);}
/*nPr*/ll npr(ll n,ll r){return fact(n)/fact(n-r);}
/*primejudge*/bool prime(ll a){if(a<=1)return false;ll i;for(i=2;i*i<=a;i++){if(a%i==0)return false;}return true;}
ll ans=0;llfor;///////////////////////////////////////////////////////////
int main(){
 ll n;sc(n);
 if(n%10==n/100)py;
 else pn;
return 0;}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
#define ll long long
using namespace std;
inline int read()
{
	int x = 0, f = 1; char ch = getchar();
	while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = getchar(); }
	while (ch >= '0' && ch <= '9') { x = x * 10 + ch - '0'; ch = getchar(); }
	return x * f;
}
int a[200010], b[200010];
int main()
{
	int n = read();
	int Mx = 0;
	ll s = 0;
	for(int i = 1; i <= n; i ++)
		a[i] = read(), s += a[i];
	for(int i = 1; i <= n; i ++)
		b[i] = a[i] - a[i - 1];
	b[1] = a[1] - a[n];
	for(int i = 1; i <= n; i ++)
		Mx = max(Mx, b[i]);
	int sum = 0;
	for(int i = 1; i <= n; i ++)
	{
		int x = Mx - b[i];
		if(x % n != 0) {cout << "NO"; return 0;}
		sum += x / n;
	}
	if(sum != Mx) {cout << "NO"; return 0;}
	if(Mx != 0) if(s % ((ll)n * (n + 1) / 2 * Mx)) {cout << "NO"; return 0;}
	if(Mx == 0) if(s % ((ll)n * (n + 1) / 2 * n)) {cout << "NO"; return 0;}
	cout << "YES" << endl;
	return 0;
}


Measured memory_bytes: 1024
#![allow(unused_imports)]
use itertools::Itertools;
use proconio::{input, marker::*};
use std::cmp::*;
use std::collections::*;
use superslice::*;

fn main() {
    input! {
        k: u64
    }

    let mut ans = 0;
    let mut current = 0;

    for _ in 0..k {
        current = current * 10 + 7;
        current %= k;
        ans += 1;

        if current == 0 {
            println!("{}", ans);
            return;
        }
    }

    println!("-1");
}


Measured memory_bytes: 2112
#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>;
const int INF = INT32_MAX;
const ll INFL = INT64_MAX;
const int mod = 1e9 + 7;

template <typename T>
void print_vec(vector<T> v) {
  for (T i : v) cout << i << " ";
  cout << endl;
}

int main() {
  vector<int> v(3);
  rep(i, 3) cin >> v[i];
  sort(v.begin(), v.end());
  int ans = v[0] + v[1];
  cout << ans << endl;
  return 0;
}

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

using namespace std;

#define M 1000000007
#define pb push_back
#define f first
#define s second
#define rep(i, st, ed) for(int i=st; i<ed; i++)
#define repn(i, st, ed) for(int i=st; i<=ed; i++)
#define repb(i, ed, st) for(int i=ed; i>=st; i--)

typedef long long ll;
typedef unsigned long long int llt;
typedef long double ld;

const long double PI  =3.141592653589793238463;
const int N = 5e5 + 10;

vector<int> g[N];
bool viss[N];
int vis[N];

// Normal DFS
void dfs(int curr, int par)
{
  for(auto x: g[curr])
    if(x != par)
      dfs(x, curr);
}

// DFS with visiting status
void dfs1(int curr, int par)
{
  viss[curr] = 1;
  for(auto x: g[curr])
    if(!viss[x])
      dfs1(x, curr);
}

// DFS with strongly connected component
void dfs2(int curr, int par, int num)
{
  vis[curr] = num;
  for(auto x: g[curr])
    if(vis[x] == 0)
      dfs2(x, curr, num);
}

// XOR from 0 to n
ll fxor(ll n)
{
  if(n < 0) return 0;
  if(n % 4 == 3) return 0;
  else if(n % 4 == 0) return n;
  else if(n % 4 == 1) return n^(n-1);
  else if(n%4 == 2) return n^(n-1)^(n-2);
}

// Power in logn with mod 1000000007
llt ppow(llt x, llt y)
{
  llt res = 1;
  while(y > 0){
    if(y&1)
      res = (res * x)%M;
    y = y >> 1;
    x = (x * x)%M;
  }
  return res;
}

// Factorial with dp
llt factdp[N];
llt fact(llt x)
{
  if(x == 0) return 1;
  if(x == 1) return 1;
  if(factdp[x] != -1) return factdp[x];
  return factdp[x] = (x*fact(x-1))%M;
}

// String return to base b
string ansConv ="";
void convert10tob(llt N, int b)
{
     if (N == 0)
        return;
     int x = N % b;
     N /= b;
     if (x < 0)
        N += 1;
     convert10tob(N, b);
     ansConv += to_string(x);
     return;
}

// Convert string to num wiht base b
llt convertstrtob(string a, int b)
{
  llt aa = 0;
  llt mul = 1;
  for(int i=a.length()-1; i>=0; i--)
  {
    int curr = a[i] - '0';
    aa += (curr * mul);
    mul *= b;
  }
  return aa;
}

// Union Find algo with array
// Find()
int findpar(int curr, int arr[])
{
  while(arr[curr] != curr) curr = arr[curr];
  return curr;
}
// Union()
void Union(int b, int spa, int arr[])
{
  while(arr[b] != b)
  {
    int c = arr[b];
    arr[b] = spa;
    b = c;
  }
  arr[b] = spa;
}

// Main Code

int main()
{
  ll n;
  cin>>n;
  int ans = INT_MAX;
  for(ll i=1;(i *i) <= n; i++)
  {
    if(n%i == 0)
    {
      ll x = i;
      ll y = n / i;
      string sx = to_string(x);
      string sy = to_string(y);
      int f = max(sx.length(), sy.length());
      if(ans > f) ans = f;
    }
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 12160
N, M, X = map(int, input().split())

Alist = []
Clist = []

for i in range(N):
    tmpAlist = list(map(int, input().split()))
    Clist.append(tmpAlist.pop(0))
    Alist.append(tmpAlist)

min_money = 10 ** 5 * 12 + 1

# どの本を選ぶかのパターンのループ
for bits in range(1, 2 ** N):
    #print("bits:" + bin(bits))
    rikaido_list = [0] * M
    tmp_money = 0

    # 選ばれた本に対する処理のループ
    for bit_shift in range(N):
        if (bits >> bit_shift) & 1 != 1:
            continue
        #print("bit_shift:" ,bit_shift)
        tmp_money += Clist[bit_shift]
        for i in range(M):
            rikaido_list[i] += Alist[bit_shift][i]
    
    # 理解度が全てXを超えているかの確認
    ok_flag = True
    for i in range(M):
        if rikaido_list[i] < X:
            ok_flag = False
            break  
    if ok_flag and tmp_money < min_money:
        min_money = tmp_money

if min_money < 10 ** 5 * 12 + 1:
    print(min_money)
else:
    print(-1)             

Measured memory_bytes: 9236