akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
int main()
{
	string s;
	cin>>s;
	for(int i=0;i<3;i++)
	{
		
		if(s[i]=='1')
		cout<<9;
		else
		cout<<1;
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef map<int, int> mi;
typedef set<int> si;
#define VV(T) vector<vector< T > >
#define dump(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) << endl

#define rep(i, n) REP(i, 0, n)                              // 0, 1, ..., n-1
#define REP(i, x, n) for(int i = x; i < n; i++)             // x, x + 1, ..., n-1
#define invrep(i, n) for(int i = (n)-1; i >= 0; i--)        // n-1, n-2, ..., 0
#define invREP(i, x, n) for(int i = (n)-1; i >= (x; i--)    // n-1, n-2, ..., x
#define FOREACH(x,a) for(auto& (x) : (a) )

#define ALL(v) (v).begin() , (v).end()
#define RALL(v) (v).rbegin(), (v).rend()

#define PB push_back

#define COUT(x) cout << (x) << endl
#define VECCIN(x) for(auto&youso_: (x) )cin>>youso_
#define VECCOUT(x) for(auto&youso_: (x) )cout<<youso_<<" ";cout<<endl

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


int main(){
    int N; cin >> N;
    vi ans;
    rep(i, N){
        int a; cin >> a; a--;
        if(a <= i) ans.insert(ans.begin() + a, a + 1);
        else {
            cout << -1 << endl;
            return 0;
        }
    }
    for(int it: ans) printf("%d\n", it);
}

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

const int MAXN = 1e5 + 5;
const int MOD = 1e9 + 7;

inline int add(int x, int y) {
	x += y;
	if (x >= MOD)
		x -= MOD;
	else if (x < 0)
		x += MOD;
	return x;
}

inline int mul(int x, int y) {
	return (long long)x * y % MOD;
}

struct matrix {
	int m[3][3];
	int* operator [](int x) {
		return m[x];
	}
};

const matrix Z = {0, 0, 0, 0, 0, 0, 0, 0, 0};
const matrix I = {1, 0, 0, 0, 1, 0, 0, 0, 1};
const matrix T1 = {2, 2, 1, 1, 1, 0, 1, 2, 1};
const matrix T2 = {1, 0, 0, 1, 1, 0, 1, 2, 1};

matrix operator *(matrix A, matrix B) {
	matrix C = Z;
	for (int i = 0; i < 3; i++)
		for (int j = 0; j < 3; j++)
			for (int k = 0; k < 3; k++)
				C[i][j] = add(C[i][j], mul(A[i][k], B[k][j]));
	return C;
}

matrix operator ^(matrix A, int x) {
	matrix C = I;
	for (; x; x /= 2) {
		if (x % 2)
			C = C * A;
		A = A * A;
	}
	return C;
}

int N, M;
int mark[MAXN];

void load() {
	scanf("%d%d", &N, &M);
	for (int i = 1; i <= M; i++)
		scanf("%d", mark + i);
}

int solve() {
	mark[M + 1] = N;
	matrix sol = I;
	for (int i = M + 1; i; i--) {
		matrix curr = i <= M ? T2 : T1;
		curr = curr * (T1 ^ (mark[i] - mark[i - 1] - 1));
		sol = sol * curr;
	}
	return sol[2][0];
}

int main() {
	load();
	printf("%d\n", solve());
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define MAXN 510
#define MAXC 40
#define MAXB 3
using namespace std;

int N, C, D[MAXC][MAXC], c[MAXN][MAXN];
long long cost[MAXB][MAXC], ans = 0x3f3f3f3f;

int main() {
    scanf("%d%d", &N, &C);
    for (register int i = 1; i <= C; ++i)
        for (register int j = 1; j <= C; ++j)
            scanf("%d", &D[i][j]);
    for (register int i = 1; i <= N; ++i)
        for (register int j = 1; j <= N; ++j)
            scanf("%d", &c[i][j]);
    for (register int i = 1; i <= N; ++i)
        for (register int j = 1; j <= N; ++j)
            for (register int k = 1; k <= C; ++k)
                cost[(i + j) % 3][k] += D[c[i][j]][k];
    for (register int i = 1; i <= C; ++i)
        for (register int j = 1; j <= C; ++j)
            for (register int k = 1; k <= C; ++k) {
                if (i == j || i == k || j == k)
                    continue;
                ans = min(ans, cost[0][i] + cost[1][j] + cost[2][k]);
            }
    printf("%lld", ans);
    return 0;
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
template <class T> void chmin(T &a, const T &b) noexcept { if (b < a) a = b; }
template <class T> void chmax(T &a, const T &b) noexcept { if (a < b) a = b; }
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) { cout << H << " "; debug_out(T...); }
#ifdef _DEBUG
  #define debug(...) debug_out(__VA_ARGS__)
#else
  #define debug(...) 
#endif

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  int n;
  cin >> n;
  vector<ll> a(n);
  unordered_map<ll, int> mp;
  rep(i,n) {
    cin >> a[i];
    if (mp.count(a[i]) == 0) mp[a[i]] = 1;
    else mp[a[i]]++;
  }
  auto no = [&]() {
    cout << "No\n";
  };
  auto yes = [&]() {
    cout << "Yes\n";
  };
  debug(mp.size());
  if (mp.size() == 1) {
    if (mp[0] == n) yes(); //全部0
    else no();
  }
  else if (mp.size() > 3 || n % 3 != 0) no();
  else if (mp.size() == 2) {
    if (mp[0] == n/3) yes(); //2つの整数が同じで1つが0
    else no();
  }
  else {
    bool ok = true;
    ll temp = 0;
    for (auto p : mp) {
      if (p.second != n/3) ok = false;
      temp = temp ^ p.first;
    }
    if (temp != 0) ok = false; // a^b^c != 0
    if (ok) yes(); //3種類の整数で、それぞれの個数がn/3
    else no();
  }
  return 0;
}

Measured memory_bytes: 4260
#include <bits/stdc++.h>
using namespace std;
int main(){
int N, i, j, k, A[3][3], C[3][3]={}, b;
for(i=0; i<3; i++){ for(j=0; j<3; j++){ cin >> A[i][j]; } }  
cin >> N;
for(k=0; k<N; k++){ cin >> b; 
for(i=0; i<3; i++){ for(j=0; j<3; j++){ if(A[i][j]==b){ C[i][j]=1; } } }              
}
string ans="No";  
if(C[0][0]*C[0][1]*C[0][2]||C[1][0]*C[1][1]*C[1][2]||C[2][0]*C[2][1]*C[2][2]){ ans="Yes"; }
if(C[0][0]*C[1][0]*C[2][0]||C[0][1]*C[1][1]*C[2][1]||C[0][2]*C[1][2]*C[2][2]){ ans="Yes"; }
if(C[0][0]*C[1][1]*C[2][2]||C[0][2]*C[1][1]*C[2][0]){ ans="Yes"; }
cout << ans << "\n";
}

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

int gcd(int a, int b) //最大公約数
{
    if(b==0) return a;
    return gcd(b,a%b);
}

int main(){
    int n,k;
    cin >> n >> k;
    int a[n];
    int g;
    int amax=0;
    rep(i,n){
        cin >> a[i];
        if(a[i]==k){
            printf("POSSIBLE\n");
            return 0;
        }
        if(i==0) g=a[0];
        amax=max(amax,a[i]);
        g = gcd(g,a[i]);
    }
    
    if(amax<k){
        printf("IMPOSSIBLE\n");
        return 0;
    }
    if(k%g==0){
        printf("POSSIBLE\n");
        return 0;
    }

    printf("IMPOSSIBLE\n");


}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int const nax = 3e5 + 10;

struct cam {
    int k, l, r;

    bool operator < (const cam &x) const {
        return k < x.k;
    }
};

void solve() {
    int n;
    cin >> n;
    vector <cam> lft, rgh;

    for (int i = 0 ; i < n ; ++ i) {
        cam v;
        cin >> v.k >> v.l >> v.r;
        if (v.l > v.r) lft.push_back(v);
        else rgh.push_back(v);
    }

    long long v = 0;

    vector <cam> keep[n + 3];

    for (cam &c : lft) {
        keep[c.k].push_back(c);
    }

    multiset < pair <int, cam>> setik;
    vector <cam> out;
    int to_setik = 0;

    for (int i = 1 ; i <= int(lft.size()) ; ++ i) {
        for (cam c : keep[i]) {
            setik.emplace(c.l - c.r, c);
            ++ to_setik;
        }

        while (int(setik.size() > i)) {
            out.push_back(setik.begin()->second);
            setik.erase(setik.begin());
        }
    }

    long long ans = 0;

    for (int i = lft.size() + 1 ; i <= n ; ++ i)
        for (cam c : keep[i])
            setik.emplace(0, c), ++ to_setik;

    for (auto &c : setik) ans += c.second.l;
    for (cam &c : out) {
            ans += c.r;
    }
    for (int i = 0 ; i <= n ; ++ i)
        keep[i].clear();
    setik.clear(), out.clear();


    for (cam c : rgh)
        keep[c.k + 1].push_back(c);

    int now = 0;

    for (int i = n ; i > int(lft.size()) ; -- i) {
        ++ now;
        for (cam c : keep[i])
            setik.emplace(c.r - c.l, c);

        while (int(setik.size()) > now) {
            out.push_back(setik.begin()->second);
            setik.erase(setik.begin());
        }
    }

    for (int i = 1 ; i <= lft.size() ; ++ i)
        for (cam c : keep[i]) setik.emplace(0, c);
    for (cam c : keep[n + 1]) out.push_back(c);
    for (auto &c : setik) ans += c.second.r;
    for (auto &c : out) ans += c.l;

    cout << ans << '\n';
}


int main () {
    int T;
    cin.tie(0)->sync_with_stdio(false);

    for (cin >> T ; T --  ;) {
        solve();
    }
}
/*
    Good Luck
        -Lucina
*/


Measured memory_bytes: 20340
import math
N=int(input())
for i in range(int(math.sqrt(N)) , int(math.sqrt(2*N+1))+100):
    if (i*(i+1))//2 >= N:
        ansmax=i
        dif=(i*(i+1))//2 - N
        break

for j in range(1,ansmax+1):
    if j!=dif:
        print(j)

Measured memory_bytes: 3408
import java.util.*;

public class Main {

  public static void main (String[] args) {

    Scanner sc = new Scanner(System.in);
    
    int N = sc.nextInt();

    int S = 0;
    int Aodd = 0;

    int[] A = new int[N]; 
    for (int i = 0; i < N; i++) {
      A[i] = sc.nextInt();
      S += A[i];
      if (i % 2 == 1) {
        Aodd += A[i];
      }
    }
    sc.close();

    int[] X = new int[N];

    X[0] = S - 2 * Aodd;

    System.out.print(X[0] + " ");

    for (int i = 1; i < N; i++) {
      X[i] = 2 * A[i-1] - X[i-1];
      System.out.print(X[i]);
      if (i == N-1) {
        System.out.println("");
      } else {
        System.out.print(" ");
      }
    }

  }
}

Measured memory_bytes: 64264
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<regex>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
typedef int long long ll;
using namespace std;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int main(){
    int n;
    cin>>n;
    int x=n*800;
    int y=(n/15)*200;
    cout<<x-y<<endl;
return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 1; i < (int)(n); i++)
using ll = long long;
using pll = pair<ll,ll>;
using vvll = vector<vector<ll>>;
using vll = vector<ll>;
using vstr = vector<string>;
const ll MOD=1000000007;
vll dx{0,1,0,-1};
vll dy{1,0,-1,0};

void solve()
{
    int N;
    cin>>N;
    int res=0;
    for(int c=1;c<N;c++){
        int ab = N - c;
        for(int a=1;a*a<=ab;a++)
        {
            if(ab%a==0){
                res++; 
                if(ab/a!=a){
                    res++;
                }
            }
        }
    }
    cout<<res<<endl;
}

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

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int N, count = 1;
  cin >> N;
  vector<int> P(N);
  
  for(int i = 0; i < N; i++)
    cin >> P.at(i);
  
  for(int i = 1; i < N; i++){
    if(P.at(0) >= P.at(i)){
      count++;
      P.at(0) = P.at(i);
    }
  }
  
  cout << count << endl;
}

Measured memory_bytes: 1024
#include<iostream>
#include<cstdint>
#include<algorithm>

int64_t calc(int64_t a1, int64_t a2, int64_t b1, int64_t b2, int lv, int64_t L) {
  if(lv == 0) return 0;
  int64_t Lb = L/3;
  int64_t bi_a1 = a1/Lb;
  int64_t bi_a2 = a2/Lb;
  int64_t bi_b1 = b1/Lb;
  int64_t bi_b2 = b2/Lb;
  if(bi_a1 == bi_b1 && bi_a2 == bi_b2) {
    return calc(a1%Lb, a2%Lb, b1%Lb, b2%Lb, lv-1, Lb); // same block
  }
  if(bi_a2 == bi_b2) { std::swap(a1, a2); std::swap(b1, b2); }
  // bi_a2 != bi_b2
  while(L > 1) {
    Lb = L/3;
    bi_a1 = a1/Lb;
    bi_b1 = b1/Lb;
    if(bi_a1 != bi_b1) return std::abs(a1-b1) + std::abs(a2-b2);
    if(bi_a1 == 1 && std::abs(a2/Lb - b2/Lb) > 1) {
      a1 %= Lb;
      b1 %= Lb;
      return std::abs(a2 - b2) + std::min(a1+b1+2, Lb*2-a1-b1);
    }
    a1 %= Lb;
    b1 %= Lb;
    L = Lb;
  }
  return std::abs(a2 - b2);
}

int main() {
  int64_t L = 1;
  for(int i = 0; i < 30; ++i) L *= 3;
  int Q; std::cin >> Q;
  for(int i = 0; i < Q; ++i) {
    int64_t a, b, c, d; std::cin >> a >> b >> c >> d;
    std::cout << calc(a-1, b-1, c-1, d-1, 30, L) << std::endl;
  }
  return 0;
}


Measured memory_bytes: 384
N = input()

length = len(N)

ans1 = ''
ans2 = ''

for i in range(length):
    if i % 2 == 0:
        ans1 = ans1 + "1"
        ans2 = ans2 + "0"
    else:
        ans1 = ans1 + "0"
        ans2 = ans2 + "1"

count1 = 0
count2 = 0



for i in range(length):
    if N[i] != ans1[i]:
        count1 = count1 + 1

    if N[i] != ans2[i]:
        count2 = count2 + 1

print(min(count1,count2))

Measured memory_bytes: 3316
import math
N, M = map(int, input().split())
mx = 0
for i in range(1, math.floor(math.sqrt(M))+1):
    if M % i == 0 and M // i >= N:
        mx = max(mx, i)
    if M % i == 0 and i >= N:
        mx = max(mx, M//i)
print(mx)

Measured memory_bytes: 3060
#include "bits/stdc++.h"
// Custom Header {{{
#define all(x)      x.begin(), x.end()
#define rep(i,n)    for (i64 i = 0; i < (n); ++i)
#define reps(i,s,t) for (i64 i = (s); i <= (t); ++i)
#define repr(i,s,t) for (i64 i = (s); i >= (t); --i)
#define LF          '\n'

#ifdef DBG
#define trace(...) _trace(#__VA_ARGS__, __VA_ARGS__);
#else
#define trace(...)
#endif

using namespace std;
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template<class T, class U>inline bool chmax(T &a, const U &b){return b>a ? (a=b,1) : 0;}
template<class T, class U>inline bool chmin(T &a, const U &b){return b<a ? (a=b,1) : 0;}
constexpr int INF  = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;

template<class T>
ostream& operator<< (ostream &os, const vector<T> &vec) {
    rep(i, vec.size()) os << vec[i] << (i+1 == vec.size() ? "" : " ");
    return os;
}

template<class T, class U>
ostream& operator<< (ostream &os, const pair<T, U> &p) {
    return os << p.first << ' ' << p.second;
}

template <class T>
void _trace(const char *s, T&& x)
{
    clog << '{';
    while(*s != '\0' && *s != ',') clog << *(s++);
    clog << ":" << setw(3) << x << '}' << endl;
}

template <class Head, class... Tail>
void _trace(const char *s, Head&& head, Tail&&... tail)
{
    clog << '{';
    while(*s != ',') clog << *(s++);
    clog << ":" << setw(3) << head << "}, ";
    for (++s; !isgraph(*s); ++s);
    _trace(s, std::forward<Tail>(tail)...);
}
// }}}

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

    int n, k;
    cin >> n >> k;

    cout << (n % k ? 1 : 0) << endl;

    return 0;
}



Measured memory_bytes: 256
#define TEST_MODE true

#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep2(i, a, b) for (int i = (a); i < (int)(b); ++i)
#define rrep(i, n) for (int i = (n)-1; i >= 0; --i)
#define rrep2(i, a, b) for (int i = (a)-1; i >= (int)b; --i)
#define range(i, a, b, c) for (int i = a;             \
                                   c > 0 ? i < b : i > b; \
                                   i += c)
#define chmax(a, b) (a = (a) < (b) ? (b) : (a))
#define chmin(a, b) (a = (a) > (b) ? (b) : (a))
using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define all(a) begin(a), end(a)
#define ifnot(a) if (not(a))
#define int long long

#ifdef LOCAL_ENV

#if TEST_MODE == true
const bool test = true;
#define dump(x) cerr << #x << " = " << (x)
#define dumpl(x) dump(x) << endl
#else
const bool test = false;
#define dump(x) 
#define dumpl(x)
#endif

#else
const bool test = false;
#define dump(x) 
#define dumpl(x)
#endif

int dx[] = { 1, 0, -1, 0 };
int dy[] = { 0, 1, 0, -1 };
const int INF = (int)1 << 60;
const ll INFL = (ll)1 << 60;
ll mod_n = (int)1e9 + 7;
const double eps = 1e-10;
typedef long double Real;
// return -1, 0, 1
int sgn(const Real &r) { return (r > eps) - (r < -eps); }
int sgn(const Real &a, const Real &b) { return sgn(a - b); }

//.....................
const int MAX = (int)2e5 + 5;

vector<string> split(const string &str, char sep)
{
	vector<string> v;
	stringstream ss(str);
	string buffer;
	while (getline(ss, buffer, sep))
	{
		v.push_back(buffer);
	}
	return v;
}

template <class InputIterator>
int sum(InputIterator begin, InputIterator end)
{
	return accumulate(begin, end, 0ll);
}

template<typename T>
T gcd(T a, T b)
{
	T c;
	while (a != 0) {
		c = a; a = b%a;  b = c;
	}
	return b;
}

template<typename T>
T bit_count(T N) {
	T cnt = 0;
	while (N) {
		if (N & 1) cnt++;
		N >>= 1;
	}
	return cnt;
}

struct Point {
	int y, x;
	bool operator < (const Point& r) {
		if (x < r.x) return true;
		else return false;
	}
};

class Solver {
public:
	vector<vector<int>> c;
	int a[3], b[3];

	bool dfs(int i) {
		if (i == 3) {
			rep(j, 3) rep(k, 3) {
				if (c[j][k] != a[j] + b[k]) return false;
			}
			return true;
		}
		rep(v, c[i][i] + 1) {
			a[i] = v;
			b[i] = c[i][i] - v;
			bool res = dfs(i + 1);
			if (res == true) return true;
		}
		return false;
	}

	void solve() {
		c.resize(3);
		rep(i, 3) {
			c[i].resize(3);
			rep(j, 3) cin >> c[i][j];
		}

		cout << (dfs(0) ? "Yes" : "No") << endl;
	}
};

signed main()
{
	srand((unsigned int)time(NULL));
	cout << fixed << setprecision(20);
	auto ptr = new Solver();
	ptr->solve();
	delete ptr;
	//while (true) {
	//	if (cin.eof() == true) break;
	//	auto ptr = new Solver();
	//	ptr->solve();
	//	delete ptr;
	//}
	return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
public static void main(String[] args){
	Scanner kb=new Scanner(System.in);
	int n=kb.nextInt();
	double hs[]=new double[n];
	int count[]=new int[6];
	for(int i=0;i<n;i++){
		hs[i]=kb.nextDouble();
	}
	for(int i=0;i<n;i++){
		if(hs[i]<165){
			count[0]++;
		}else if(hs[i]>=165&&hs[i]<170){
			count[1]++;
		}else if(hs[i]>=170&&hs[i]<175){
			count[2]++;
		}else if(hs[i]>=175&&hs[i]<180){
			count[3]++;
		}else if(hs[i]>=180&&hs[i]<185){
			count[4]++;
		}else if(hs[i]>=185){
			count[5]++;
		}
		
	}
	
	for(int i=0;i<6;i++){
		System.out.print(i+1+":");
		for(int j=0;j<count[i];j++){
			System.out.print("*");
		}
		System.out.println();
	}
}
}

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

using ll = long long int;

const int MAX = (int)(1e5 + 5);
const ll INF = (ll)(1e10 + 5);

ll a, b;

vector<ll> store;

ll ans = 0;

/////////////////////////////////////////////////////////////
ll mypow_core(ll x, int n, ll result) {
  if (n == 0) {
    return result;
  }

  if (n % 2 == 0) {
    return mypow_core(x * x, n / 2, result);
  }
  else {
    return mypow_core(x, n - 1, x * result);
  }
}

ll mypow(ll x, int n) {
  return mypow_core(x, n, 1);
}
/////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////
// 0-indexed
ll digit_bit_count(int digit, ll t) {
  t += 1LL;
  ll window = 1LL << (digit + 1);

  ll div = t / window;
  ll mod = t % window;

  ll ret = 0LL;

  ret += div * window / 2;

  if (mod * 2 > window) {
    ret += mod - (window / 2);
  }

  return ret;
}
/////////////////////////////////////////////////////////////

int main(void) {
  // Here your code !
  scanf("%lld %lld", &a, &b);

  int size = log2(b) + 1;

  for (int i = 0; i <= size; ++i) {
    ll bottom = digit_bit_count(i, a - 1);
    ll top = digit_bit_count(i, b);

    ll num_one = top - bottom;

    if (num_one % 2 == 0) {
      store.push_back(0);
    }
    else {
      store.push_back(1);
    }
  }

  for (int i = 0; i < store.size(); ++i) {
    ans += mypow(2, i) * store[i];
  }

  printf("%lld\n", ans);

  return 0;
}


Measured memory_bytes: 384
#include<iostream>
#include<math.h>

using namespace std;

#define ll long long
#define INF 1e18+1
int n,k;

int main(){
  cin >> n >> k;
  long long ans = 0;
  for(int i = 0; i < n-1 ; i++){
    ll p = (ans) / (k-1) + 1;
    ans += p;
  }
  cout << ans << endl;
}

// int a[30] = {};
//
// int main(){
//   cin >> n >> k;
//   for(int i = 0; i < n ; i++){
//     int cnt = k;
//     for(int j = 0; j < 50; j++){
//       if(a[j] == 0 && cnt == k){
//         a[j] = i+1;
//         cnt = 1;
//       }
//       else if(a[j] == 0){
//         cnt++;
//       }
//     }
//   }
//   for(int i = 0; i < 50; i++){
//     cout << a[i] << " ";
//   }
//   cout << endl;
// }



Measured memory_bytes: 3120
def main():
    A = [int(i) for i in input().split()]
    if abs(A[0] - A[2]) <= A[3] or (abs(A[0] - A[1]) <= A[3] and abs(A[1] - A[2]) <= A[3]):
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()


Measured memory_bytes: 38256
#include<bits/stdc++.h>
using namespace std;
#define NL            "\n"
#define _SAD()        ios::sync_with_stdio(0),cin.tie(0), cout.tie(0);
#define SZ(s)         s.size()
#define SRT(x,y)      sort(x,x+y)
#define REV(a,b)      reverse(a,a+b)
#define VSRT(x)       sort(x.begin(),x.end())
#define VREV(x)       reverse(x.begin(),x.end())
int main()
{
    _SAD()
    int n,m;
    cin>>n>>m;
    cout<<(n*n)-m<<NL;
    return 0;
}


Measured memory_bytes: 256
(let* ((n (read))
       (m (read))
       (as (loop :repeat n :collect (read)))
       (sum (loop :as i :in as :sum i)))
    (if (<= m (length (remove-if (lambda (x) (< x (/ sum (* 4 m)))) as)))
        (princ "Yes")
        (princ "No")))


Measured memory_bytes: 16104
n = int(input())
aw = [[0,0] for i in range(n)]
for i, a in enumerate(map(int, input().split())): aw[i][0] = a
for i, w in enumerate(map(int, input().split())): aw[i][1] = w
migimin = 1001
hidarimin = 1001
for a,w in aw:
    if a: hidarimin = min(hidarimin, w)
    else: migimin = min(migimin, w)
if hidarimin>1000 or migimin>1000: print(0)
else: print(hidarimin+migimin)


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

namespace Sample
{
  class Sample
  {
    static void Main(string[] args)
    {
    string[] str=Console.ReadLine().Split(' ');
      int N=int.Parse(str[0]);
      int M=int.Parse(str[1]);
      
      string[] str2=Console.ReadLine().Split(' ');
      int[] tokuhyo=new int[N];
      for(int i=0;i<N;i++){
        tokuhyo[i]=int.Parse(str2[i]);
      }
      int count=0;
      for(int j=0;j<N;j++){
        if(tokuhyo[j]>=((double)tokuhyo.Sum()/(4*M))){
          count++;
      }
        
      }
       if(count>=M){
         Console.WriteLine("Yes");
       }else{
         Console.WriteLine("No");
       }

           }
  }

}

Measured memory_bytes: 27916
#include<bits/stdc++.h>
using namespace std;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort(ALL(V))

vector<string> split(string,string);

//template<typename T>
//void swap(T*,T*);
//char ToUpper (char cX) { return toupper(cX); }

int main()
{
    int x,y;
    cin >> x >> y;
    if(x+y >= 10)
    {
        cout << "error";
    }
    else
    {
        cout << x+y;
    }
}


Measured memory_bytes: 256
n,k,s=map(int,input().split())
if k==0:
 if s>=2:
  l=[s-1]*n
  print(*l)
  exit()
 else:
  l=[s+1]*n
  print(*l)
  exit()
l=[s]*k
if s>=2:
 l+=[s-1]*(n-k)
else:
 l+=[s+1]*(n-k)
print(*l)

Measured memory_bytes: 6604
import java.util.Scanner;
public class Main {
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int w = scan.nextInt();
        int n = scan.nextInt();
        int[] values = new int[w];
        for(int i=0;i < values.length; i++){
            values[i] =i + 1;
        }
        for(int i=0;i<n;i++){
            String str = scan.next();
            String[] ab = str.split(",");
            int a = Integer.parseInt(ab[0])-1;
            int b = Integer.parseInt(ab[1])-1;
            int c = values[a];
            values[a] = values[b];
            values[b] = c;
        }
        for(int i=0;i<values.length;i++){
            System.out.println(values[i]);
        }
        scan.close();
    }
}


Measured memory_bytes: 26108
#include "bits/stdc++.h"
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a),i##_len=(b);i<i##_len;++i)
#define BUGAVOID(x) x
#define rep(...) BUGAVOID(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define sz(c) (int)(c.size())
#define all(c) c.begin(),c.end()
#define mp make_pair
#define write(x) cout<<(x)<<"\n"
using namespace std; typedef long long ll;
typedef vector<int> vi; typedef vector<ll> vll; template<class T, class U>using vp = vector<pair<T, U>>;
template<class T>using vv = vector<vector<T>>; template<class T, class U>using vvp = vv<pair<T, U>>;
template<class T>vv<T> vvec(const size_t n, const size_t m, const T v) { return vv<T>(n, vector<T>(m, v)); }
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; }return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; }return 0; }
constexpr ll pow2(const int n) { return 1ll << n; }
constexpr int INF = 1 << 28; constexpr ll LINF = 1ll << 60;
constexpr int MAX = 1e5 + 5; constexpr int MOD = 1e9 + 7; constexpr double EPS = 1e-6;
constexpr int dy[4] = { 0,1,0,-1 }; constexpr int dx[4] = { 1,0,-1,0 };
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); }; }aaaa;

int main() {
    ll X, Y;
    cin >> X >> Y;
    write(abs(X - Y) > 1 ? "Alice" : "Brown");
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;
int main()
{
    int N,a,b,c,d,A,B;
    cin>>N;
    if((100<=N)&&(N<=999)){
    for(int i=0;i<2;i++)
    {
        A=N/10;
        a=N%10;
        a=a*100;
        B=A/10;
        b=A%10;
        b=b*10;
        c=B%10;
        d=a+b+c;


        i++;
    }
    }
    if(d==N)
    {
        cout<<"Yes";
    }
 if(d!=N)
        cout<<"No";


}


Measured memory_bytes: 256
#include <iostream>
#include <list>
#include <algorithm>
#include <set>

using namespace std;

int main()
{
	int n;
	cin >> n;
	
	set<int> A;
	int a;
	while (n--)
	{
		cin >> a;
		A.insert(a);
	}
	
	
	//删除多余等值元素 
	set<int>::iterator it1 = A.begin(), it2 = ++A.begin();
//	while (it2 != A.end())
//	{
//		if (*it1 == *it2)
//		{
//			A.erase(it2++);	
//		}
//		else
//		{
//			it1++;
//			it2++;
//		}
//	}


	//法2：调用库函数
//	A.unique();	
	
	
	//输出 
	it1 = A.begin();
	cout << *it1++;	
	while (it1 != A.end())
	{
		cout << ' ' << *it1++;
	}
	cout << endl;
}


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

int main() {
    int N, A, B;
    cin >> N >> A >> B;
    string S;
    cin >> S;

    int cnt = 0;
    int bcnt = 1;
    rep(i, N) {
        char s = S[i];
        if (s == 'c') {
            cout << "No" << endl;
        } else if (s == 'a') {
            if (cnt < (A + B)) {
                cout << "Yes" << endl;
                ++cnt;
            } else {
                cout << "No" << endl;
            }
        } else {
            if (cnt < (A + B) && bcnt <= B) {
                cout << "Yes" << endl;
                ++cnt;
                ++bcnt;
            } else {
                cout << "No" << endl;
            }
        }
    }
}

Measured memory_bytes: 896
import sys

stdin = sys.stdin
inf = 1 << 60
mod = 1000000007

ni      = lambda: int(ns())
nin     = lambda y: [ni() for _ in range(y)]
na      = lambda: list(map(int, stdin.readline().split()))
nan     = lambda y: [na() for _ in range(y)]
nf      = lambda: float(ns())
nfn     = lambda y: [nf() for _ in range(y)]
nfa     = lambda: list(map(float, stdin.readline().split()))
nfan    = lambda y: [nfa() for _ in range(y)]
ns      = lambda: stdin.readline().rstrip()
nsn     = lambda y: [ns() for _ in range(y)]
ncl     = lambda y: [list(ns()) for _ in range(y)]
nas     = lambda: stdin.readline().split()

n, m = na()
ks = nan(m)
p = na()

ans = 0
for i in range(2 ** n):
    ok = True
    for j in range(m):
        k, s = ks[j][0], ks[j][1:]
        sum_on = 0
        for a in range(k):
            if (i >> (s[a] - 1)) & 1:
                sum_on += 1
        if sum_on % 2 != p[j]:
            ok = False
    if ok:
        ans += 1

print(ans)

Measured memory_bytes: 3192
#include<bits/stdc++.h>
using namespace std;
#define int long long 
#define IOS ios::sync_with_stdio(0);
signed main()
{
	//IOS
	string s;
	int a,b;
	while(cin>>a>>b)
	{
		int length=0;
		while(a>=b)
		{
			//s+=(a%b+'0');
			length++;
			a/=b;
		}
		length+=(a%b!=0);
		//s+=(a%b+'0');
		//reverse(s.begin(),s.end());
		cout<<length<<"\n";
	}
 } 

Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
    int n;
    scanf("%d", &n);
    
    int a[n], b[n];
    for(int i = 0; i < n; i++) {
        if(i == 0) {
            b[0] = 0;
            continue;
        }
        
        scanf("%d", &a[i]);
        b[i] = 0;
    }
    
    for(int i = 1; i < n; i++) {
        b[a[i]-1]++;
    }
    
    for(int i = 0; i < n; i++) {
        printf("%d\n", b[i]);
    }
}


Measured memory_bytes: 3288
#include <iostream>
#include <algorithm>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#include <vector>
#include <string>
#include <iomanip>

using namespace std;
#define M_PIl        3.141592653589793238462643383279502884
typedef long long ll;
typedef long double ld;



ll expo(ll a, ll b) {
  if (b <= 0) return 1;
  if (a == 1) return 1;
  if (a == 0) return 0;
  ll ans = 1, base = a;
  for (; b; base*=base, b >>= 1) {
    if (b&1) ans *= base;
  }
  return ans; 
}

int main(){
  ld a,b,h,m;
  cin >> a >> b >> h >> m;
  ld temp = ((h-(m/5))*30)+(30*(m/60));
  if(temp>180){
    temp=360-temp;
  }
  cout << setprecision(15) << sqrt(expo(a,2)+expo(b,2)-((2*a*b)*cos(temp*M_PIl/180))) << endl;
  
}

Measured memory_bytes: 3612
import java.util.Scanner;

public class Main {

	static Scanner scanner;

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

	    int N=gi();
        int[] A=new int[N];
        for (int i=0; i<N; i++) {
        	A[i]=gi();
        }
        
        int max=0;
        int t=0;
        for (int i=0; i<N; i++) {
        	if(max<=A[i]) {
        		t++;
        		max=A[i];
        	}
        }
        


        System.out.print(t);

//        if (s>L[n-2]) {
//        	System.out.println("Yes");
//        }else {
//        	System.out.println("No");
//        }
	}

	// 文字列として入力を取得
	public static String gs() {
		return scanner.next();
	}

	// intとして入力を取得
	public static int gi() {
		return Integer.parseInt(scanner.next());
	}

	// longとして入力を取得
	public static long gl() {
		return Long.parseLong(scanner.next());
	}

	// doubleとして入力を取得
	public static double gd() {
		return Double.parseDouble(scanner.next());
	}
}

Measured memory_bytes: 35520
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lf long double
#define pb push_back
#define mp make_pair
#define F first
#define S second
typedef pair <ll,ll> ii;
typedef vector <ll> vi;
typedef vector <ii> vii;
typedef vector <bool> vb;
typedef vector <vector <ll> > vv;
typedef vector <string> vs;
typedef vector <lf> vf;
#define mod 1000000007
#define inf 999999999999999ll
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n;
    cin>>n;
    bool p=false;
    for(ll i=1;i<=9;i++)
    {
        for(ll j=1;j<=9;j++)
        {
          if(i*j==n)
            p=true;
        }
    }
    if(p)
        cout<<"Yes\n";
    else
        cout<<"No\n";
}


Measured memory_bytes: 256
# coding: utf-8
import time
import re
import math

def main():
    n,k=map(int,input().split())

    print(n%k)


start=time.time()
main()
#print("処理速度 {}sec".format(time.time()-start))
#"YNeos"[True::2]
#A=list(map(int,input().split()))
#n=int(input())
# global n,A,s,memo,mx,mn,L,B


Measured memory_bytes: 3184
#include <iostream>
#include <iomanip>
#include <math.h>
#include <utility>
#include <vector>
#include <cstdlib>
#include <algorithm>
#include <climits>
using namespace std;

int main(){
	int n;
	int *a,*S;
	while(cin >> n){
		if(n==0) break;
		a = new int[n];
		S = new int[n+1];
		for(int i=0;i<n;i++){
			cin >> a[i];
		}
		
		int sum = 0;
		for(int i=0;i<n+1;i++){
			S[i]=sum;
			sum += a[i];
		}
		int ans=INT_MIN;
		for(int i=0;i<n+1;i++){
			for(int j=i+1;j<n+1;j++){
				ans = max(ans,S[j]-S[i]);
			}
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 1216
#[allow(unused_imports)]
use std::cmp;

// Input macro from https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
  (source = $s:expr, $($r:tt)*) => {
    let mut iter = $s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
  ($($r:tt)*) => {
    #[allow(unused_mut)]
    let mut s = {
      use std::io::Read;
      let mut s = String::new();
      std::io::stdin().read_to_string(&mut s).unwrap();
      s
    };
    let mut iter = s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
}

macro_rules! input_inner {
  ($iter:expr) => {};
  ($iter:expr, ) => {};

  ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
    let $var = read_value!($iter, $t);
    input_inner!{$iter $($r)*}
  };
}

macro_rules! read_value {
  ($iter:expr, ( $($t:tt),* )) => {
    ( $(read_value!($iter, $t)),* )
  };

  ($iter:expr, [ $t:tt ; $len:expr ]) => {
    (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
  };

  ($iter:expr, chars) => {
    read_value!($iter, String).chars().collect::<Vec<char>>()
  };

  ($iter:expr, usize1) => {
    read_value!($iter, usize) - 1
  };

  ($iter:expr, $t:ty) => {
    $iter.next().unwrap().parse::<$t>().expect("Parse error")
  };
}

fn main() {
  input! {
    n: usize,
    k: usize,
    hs: [i32; n]
  }
  let mut cost = vec![1 << 30; n];
  cost[0] = 0;
  for i in 1..n {
    for j in i.saturating_sub(k)..i {
      cost[i] = cmp::min(cost[i], cost[j] + (hs[i] - hs[j]).abs());
    }
  }
  println!("{}", cost[n-1]);
}


Measured memory_bytes: 6396
#include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <iomanip>

#define int long long int
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )

using namespace std;

typedef pair<int, int> P;

const int INF = 1e15;
const int MOD = 1e9+7;

template <typename T>
using vector2 = vector<vector<T>>;
template <typename T>
vector2<T> initVec2(size_t n0, size_t n1, T e = T()){
    return vector2<T>(n0, vector<T>(n1, e));
}

template <typename T>
using vector3 = vector<vector<vector<T>>>;
template <typename T>
vector3<T> initVec3(size_t n0, size_t n1, size_t n2, T e = T()){
    return vector3<T>(n0, vector2<T>(n1, vector<T>(n2, e)));
}

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

    double ans = 0;
    int n;
    cin >> n;

    rep(i, n){
        double x;
        string u;
        cin >> x >> u;

        if(u == "JPY"){
            ans += x;
        }else{
            ans += 380000.0 * x;
        }
    }
    cout << fixed << setprecision(10) << ans << endl;

    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  while(1) {
    c -= b;
    if(c <= 0) {
      cout << "Yes" << endl;
      break;
    }
    a -= d;
    if(a <= 0) {
      cout << "No" << endl;
      break;
    }
  }
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
int n,m;

const int INF = 1e9;

vector<pair<int,int> > g[100001],edge[500001];
map<int,int> M[100001];
bool visit[500001];
int stp;
int dist[500001];

void ADD(int a,int b,int x){
	edge[a].emplace_back(make_pair(b,x));
	edge[b].emplace_back(make_pair(a,x));
}

void addedge(int a,int b,int c,int d){
	ADD(a,b,1);ADD(b,c,0);ADD(c,d,1);
}

void dfs(int x){
	visit[x]=true;
	for(auto it:g[x]){
		int y=it.first,c=it.second;
		if(!M[x][c])
			M[x][c]=++stp;
		if(!M[y][c])
			M[y][c]=++stp;
		addedge(x,M[x][c],M[y][c],y);
		if(!visit[y])
			dfs(y);
	}
}

void Dijkstra(){
	memset(visit,0,sizeof visit);
	for(int i=1;i<=stp;i++)
		dist[i]=INF;
	priority_queue<pair<int,int>,vector<pair<int,int> >, greater<pair<int,int> > > pq;
	dist[1]=0;
	pq.push(make_pair(0,1));
	while(!pq.empty()){
		int from=pq.top().second;pq.pop();
		if(visit[from])	continue;
		visit[from]=true;
		for(auto it:edge[from]){
			int to=it.first,cost=it.second;
			if(dist[from]+cost<dist[to]){
				dist[to]=dist[from]+cost;
				pq.push(make_pair(dist[to],to));
			}
		}
	}

}

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cin>>n>>m;
	for(int i=1,x,y,c;i<=m;i++){
		cin>>x>>y>>c;
		g[x].emplace_back(make_pair(y,c));
		g[y].emplace_back(make_pair(x,c));
	}
	stp=n;
	dfs(1);
	Dijkstra();
	cout<<(dist[n]==INF?-1:dist[n]/2)<<endl;


}


Measured memory_bytes: 89212
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define np next_permutation
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define pi acos(-1.0)
const ll INF = 1LL<<61;
template<class T>bool chmax(T &a, const T &b) { 
  if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) {
  if (b<a) { a=b; return 1; } return 0; }
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; }
ll jou(ll N, ll P){if(P==0) return 1;
  if(P%2==0){ll t = jou(N, P/2);return t*t % mod;
  }return (N * jou(N, P-1)) % mod;}  //jou(n,mod-2)で逆元
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'大文字'+=32;    で小文字に
//  cout << fixed << setprecision (20);   小数点以下2０桁まで
//実行時間制約2秒では２×10^8回くらいまで計算できる



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

  int sum=m*1900+(n-m)*100;

  cout << sum*pow(2,m) << endl;

}

Measured memory_bytes: 256
N,M,K = map(int,input().split())

ans = 0
mod = 10**9+7

def cmb(n, r, mod):
    if r<0 or r>n:
        return 0
    r = min(n, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

g1 = [1,1]
g2 = [1,1]
inverse = [0,1]
for i in range(2, N*M+1):
    g1.append((g1[-1] * i) % mod)
    inverse.append((-inverse[mod % i] * (mod//i)) % mod)
    g2.append((g2[-1] * inverse[-1]) % mod)

coef = cmb(N*M-2, K-2, mod)

for i in range(1,N):
    ans += i*(N-i)*M*M

for j in range(1,M):
    ans += j*(M-j)*N*N

ans *= coef
ans %= mod
print(ans)

Measured memory_bytes: 26868
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
using namespace std;

int w,d;
vector<int> Front,Side;
map<int,int> M;

void solve(){
	Front.clear();
	Side.clear();
	M.clear();
	for(int i=0;i<w;i++){
		int temp;
		cin>>temp;
		Front.push_back(temp);
		M[temp]++;
	}
	for(int j=0;j<d;j++){
		int temp;
		cin>>temp;
		Side.push_back(temp);
	}
	sort(Front.begin(),Front.end());
	sort(Side.begin(),Side.end());
	int res=0;
	for(int i=0;i<Front.size();i++)
		res+=Front[i];
	for(int i=0;i<Side.size();i++){
		if(M[Side[i]]>=1)
			M[Side[i]]--;
		else res+=Side[i];
	}
	cout<<res<<endl;
}

int main(){
	while(cin>>w>>d){
		if(w==0)
			break;
		solve();
	}
	return 0;
}

Measured memory_bytes: 0
import math

a,b,x=map(int,input().split())
if x<a*a*b//2:
    q=math.degrees(math.atan(a*b*b/(2*x)))
else:
    q=math.degrees(math.atan(2*(a*a*b-x)/(a**3)))
print('{:.10f}'.format(q))

Measured memory_bytes: 3060
#include<iostream>
#include<cstdio>
#include<vector>
#include<queue>
#include<map>
#include<string>
#include<algorithm>
#include<functional>
#define ll long long
#define inf  999999999
#define pa pair<int,int>

using namespace std;


struct segsum{
	//       1
	//   2        3
	// 4   5   6    7
	
	
	private:
	public:
	
	// (1<<15)=32768
	// 1<<16 = 65536
	// 1<<17 = 131072
	// 1<<18 = 262144
	
	int cor=(1<<17);
	
	vector<int> vec;
	
	void shoki1(){
		vec.resize(2*cor+3, 0);
	}
		void shoki2(){
			for(int i=cor-1;i>0;i--) vec[i]=vec[2*i]+vec[2*i+1];
		}
		
	void updadd(int x,int w){
		//x 項目に w加算
		x+=cor;
		vec[x]+=w;
		while(1){
			x/=2;
			if(x==0) break;
			vec[x]=vec[2*x]+vec[2*x+1];
		}
		
	}
	
	void updchan(int x,int w){
		//x項目をwに変更
		x+=cor;
		vec[x]=w;
		while(1){
			x/=2;
			if(x==0) break;
			vec[x]=vec[2*x]+vec[2*x+1];
		}
		
	}
	// [a,b)
	// k-th node
	// k no kukanha [l,r)
	int sum(int a,int b,int k=1,int l=0,int r=-10){
		if(r<0)r=cor;
		
	//	cout<<a<<" "<<b<<" "<<k<<" "<<l<<" "<<r<<endl;
		
		if(a<=l && r<=b){
			return vec[k];
		}
		if(r<=a || b<=l){
			return 0;
		}
		
		int v1=sum(a,b,k*2,l,(l+r)/2),v2=sum(a,b,k*2+1,(l+r)/2,r);
		return v1+v2;
	}
	
};


int main(){
segsum SE;
	
	SE.shoki1();
//	for(int i=0;i<SE.cor;i++){
//		SE.vec[i+SE.cor]=i;
//	}
	SE.shoki2();
	
	
	int n,q;
	cin>>n>>q;
	
	for(int i=0;i<q;i++){
	int a,b,c;
		cin>>a>>b>>c;
		
		if(a==0)SE.updadd(b,c);
		else cout<<SE.sum(b,c+1)<<endl;
	
	}
	return 0;
}





Measured memory_bytes: 3704
from collections import defaultdict

L = int(input())
A = list(map(int, input().split()))

cnt = defaultdict(int)
for i, a in enumerate(A):
    cnt[a] += 1

res = 0
for val, num in cnt.items():
    res += num * (num - 1) // 2

for a in A:
    ans = res
    num = cnt[a]
    ans -= num * (num - 1) // 2
    ans += max((num - 1) * (num - 2) // 2, 0)
    print(ans)

Measured memory_bytes: 26780
package main

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

const (
	m = 1000000007
)

func main() {
	L := readString()

	result := 1
	t := 1
	for i := len(L) - 1; i >= 0; i-- {
		if L[i] == '1' {
			result = result*2 + t
			result %= m
		}
		t *= 3
		t %= m
	}
	fmt.Println(result)
}

const (
	ioBufferSize = 1 * 1024 * 1024 // 1 MB
)

var stdinScanner = func() *bufio.Scanner {
	result := bufio.NewScanner(os.Stdin)
	result.Buffer(make([]byte, ioBufferSize), ioBufferSize)
	result.Split(bufio.ScanWords)
	return result
}()

func readString() string {
	stdinScanner.Scan()
	return stdinScanner.Text()
}


Measured memory_bytes: 2008
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = (0); i < (n); ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define DEBUG(val) cout << #val << " : " << val << endl
#define MOD 1000000007

int main() {
  int n;
  string s;
  cin >> n;
  cin >> s;
  // 最終状態は
  // 1. 全部黒 2.左から白が連続した後、すべて黒が連続する 3. 全部白
  // あるiに対して、左にいくつ黒があって、右にいくつ白があるかの配列を作ればO(n)で2.の最大は求められる
  vector<int> left_black(n);
  vector<int> right_white(n);

  int black = 0;
  REP(i, n) { left_black[i] = (s[i] == '#') ? ++black : black; }
  int white = 0;
  for (int i = n - 1; i >= 0; i--) {
    right_white[i] = (s[i] == '.') ? ++white : white;
  }
  /*
  REP(i, n) { cout << left_black[i] << " "; }
  cout << endl;
  REP(i, n) { cout << right_white[i] << " "; }
  */
  int middle_ans = INT_MAX;
  REP(i, n - 1) {
    middle_ans = min(middle_ans, left_black[i] + right_white[i + 1]);
  }
  int ans = min(middle_ans, min(black, white));
  cout << ans << endl;
}

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

int main() {
    int d, k;
    cin>>k>>d;
    int s = 10-k;
    if (k >=10)
    {
        cout<<d;
    }
    else 
    {
        cout<<d+ 100*s;
    }
    
	return 0;
}

Measured memory_bytes: 3636
import scala.math._

object Main extends App {
  val scanner = new java.util.Scanner(System.in)

  val n = scanner.nextInt()
  val xn = (1 to n).map(_ => scanner.nextInt())
  val yn = (1 to n).map(_ => scanner.nextInt())

  def D(xn: Seq[Int], yn: Seq[Int]): Seq[Double] = {
    val xy = (xn zip yn).map {
      case (x, y) => (x - y).abs
    }
    Seq(
      xy.sum,
      sqrt(xy.map(pow(_, 2)).sum),
      cbrt(xy.map(pow(_, 3)).sum),
      xy.max.toDouble
    )
  }

  val outputs = D(xn, yn)

  outputs.foreach(println)
}

Measured memory_bytes: 45756
#include <iostream>
#include <cstring>
#include <stdlib.h>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <math.h>
 
using namespace std;
 
int main()
{
  int i;
  bool flag = false;
  vector<char> c(6);
  
  for(i=0;i<6;i++){
  	cin >> c.at(i);
  }
  
  for(i=0;i<3;i++){
  	if(c.at(i) == c.at(5-i)) flag = true;
  	else{
    	flag = false;
    	break;
  }
 }
  
  if(flag) cout << "YES" << endl;
  else cout << "NO" << endl;
}

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

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
//#define int ll
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector< vi > vvi;
typedef vector< vvi > vvvi;
typedef vector<short> vs;
typedef vector<vs> vvs;
typedef vector<vvs> vvvs;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<ld> vld;
typedef vector<vld> vvld;
typedef vector<vvld> vvvld;
typedef vector<string> vst;
typedef vector<vst> vvst;
typedef pair<ld, ld> pld;
typedef complex<double> base;

#define inmin(a, b) a = min(a, (b))
#define inmax(a, b) a = max(a, (b))
#define mp(a,b) make_pair(a,b)
#define modsum(a, b) ((a) + (b) >= M ? (a) + (b) - M : (a) + (b))
#define modsubtract(a, b) ((a) - (b) < 0 ? (a) - (b) + M : (a) - (b))
#define modmultiply(a, b) (((a) * (b)) % M)
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define sqr(x) ((x) * (x))
#define fori(i, n) for(int i = 0; i < int(n); ++i)
#define cint const int &
#define SZ(a) ((int)(a.size()))
#define watch(x) cout << (#x) << " = " << x << endl;

const double PI = 2 * acos(0.0);

const string DIGITS = "0123456789";
const string ALPH = "abcdefghijklmnopqrstuvwxyz";


template<class T>
ostream & operator << (ostream &out, vector<T> &a) {
    out << "(";
    for (auto x : a) out << x << " ";
    return out << ")";
}

void smain();

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


#ifdef MAX_HOME
    freopen("input.txt", "r", stdin);
    clock_t start = clock();
#endif
    cout << setprecision(12) << fixed;
    smain();
#ifdef MAX_HOME
    cout << "\n\n\n\n";
    cout << "TOTAL EXECUTION TIME: " << float( clock () - start ) /  CLOCKS_PER_SEC << endl;
#endif
}



void smain() {
    int n;
    cin >> n;
    vvl a(3, vl(n, 0));
    vvl pref(3, vl(n, 0));
    fori (i, n) pref[0][i] = 1;
    fori (z, 3) {
        fori (i, n) cin >> a[z][i];
        sort(ALL(a[z]));
    }
    for (int z = 1; z < 3; ++z) {
        int j = 0;;
        ll sum = 0;
        fori (i, n) {
            while (j < n && a[z - 1][j] < a[z][i])
                sum += pref[z - 1][j++];
            pref[z][i] = sum;
        }
    }
    cout << accumulate(ALL(pref[2]), 0LL);

}

Measured memory_bytes: 5744
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????
		Scanner sc = new Scanner(System.in);
		int[] a = new int[4];
		int[] b = new int[4];
		while (sc.hasNext()) {
			for (int i=0; i < 4; i++) {
				a[i] = sc.nextInt();
			}
			for (int i=0; i < 4; i++) {
				b[i] = sc.nextInt();
			}

			int hit = 0, blow = 0;
			for (int i=0; i < 4; i++) {
				for (int j=0; j < 4; j++) {
					if (a[i] == b[j]) {
						if (i==j) hit++;
						else blow++;
					}
				}
			}

			System.out.println(hit + " " + blow);
		}
	}

}

Measured memory_bytes: 25972