akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>

int * vec;
int n;
long long ans = 0;

bool check_mon_up(int * start, int * end)
{
	if (end - start <= 1)
		return true;
	
	for (auto i = start; i < end - 1; i++)
		if (*i >= *(i + 1))
			return false;
	return true;
}

bool chec_mon_do(int * start, int * end)
{
	if (end - start <= 1)
		return true;

	for (auto i = start; i < end - 1; i++)
		if (*i <= *(i + 1))
			return false;
	return true;
}

int * m_find_max(int * start, int * end)
{
	int max = -1;
	int * numb = nullptr;
	for (int * i = start; i < end; i++)
		if (max < *i) max = *i, numb = i;
	return numb;
}

void m_find_two_max(int * start, int * end, int *& max, int *& tax)
{
	int mm = -1, mt = -1;
	for (int * i = start; i < end; i++)
	{
		if (*i > mm)
		{
			mt = mm;
			mm = *i;
			tax = max;
			max = i;
		}
		else if (*i > mt)
		{
			mt = *i;
			tax = i;
		}
	}
}

void m_find_tax(int * start, int * end, int * max, int *& tax)
{
	int mm = *max, mt = -1;
	for (int * i = start; i < end; i++)
		if (*i > mt)
			if (i != max)
			{
				tax = i;
				mt = *i;
			}
}

void fu(int * start, int * end, int * max)
{
	if (end - start == 1)
		return;
	int * tax = 0;
	m_find_tax(start, end, max, tax);
	if (tax == max)
		return;
	if (tax > max)
	{
		ans += (long long)(*tax) * (max - start + 1) * (end - tax);
		fu(start, tax, max);
	}
	else
	{
		ans += (long long)(*tax) * (tax - start + 1) * (end - max);
		fu(tax + 1, end, max);
	}
	return;
}

void func(int * start, int * end)
{
	if (end - start <= 1)
		return;
	if (end - start == 2)
	{
		ans += (long long)std::min(*(end - 1), *start);
		return;
	}
	if (check_mon_up(start, end))
	{
		for (int i = 0; i < end - start - 1; i++)
			ans += (long long)(*(start + i)) * (i + 1);
		return;
	}
	if (chec_mon_do(start, end))
	{
		for (int i = 1; i < end - start; i++)
			ans += (long long)(*(start + i)) * (end - start - i);
		return;
	}
	int * max = m_find_max(start, end);
	fu(start, end, max);
	func(start, max);
	func(max + 1, end);
	return;
}

int main()
{
	std::ios::sync_with_stdio(false);
	std::cin >> n;
	vec = new int[n];
	int * const start = vec;
	int * const end = vec + n;
	for (int * i = start; i < end; i++)
		std::cin >> *i;
	func(start, end);
	std::cout << ans;
	//system("pause");
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define prtd(var, i) cout << fixed << setprecision(i) << var << endl;
#define ll long long
using namespace std;

int main(){
    int n;
    cin >> n;
    vector<int> cnt(n+1);
    for(int i = 1; i <= n; i++){
        for(int j = i; j <= n; j += i){
            cnt[j]++;
        }
    }
    ll ans = 0;
    for(int i = 1; i <= n; i++){
        ans += (ll)i * cnt[i];
    }
    cout << ans << endl;
}

Measured memory_bytes: 42304
from bisect import bisect_left
import sys
input = sys.stdin.readline
N, C = map(int, input().split())
stc = [[int(i) for i in input().split()] for _ in range(N)]
stc.sort()
stc.sort(key=lambda x: x[2])
a = []
S, T, C = stc[0]
for s, t, c in stc[1:]:
    if c == C and T == s:
        T = t
    else:
        a.append((S, T, C))
        S, T, C = s, t, c
a.append((S, T, C))

a.sort(key=lambda x: x[1])
l = [a[0][1]]
for s, t, c in a[1:]:
    i = bisect_left(l, s)
    if 0 < i and l[i - 1] < s:
        l.pop(i - 1)
    l.append(t)
print(len(l))

Measured memory_bytes: 78812
#include<bits/stdc++.h>
using namespace std;
 
int main() {
  string A;
  cin>>A;
  int cnt=0;
  if(A[0]=='o')cnt+=100;
  if(A[1]=='o')cnt+=100;
  if(A[2]=='o')cnt+=100;
  cout << 700+cnt;
}

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

int n,a,b,now,B;
int bitcount(int a){
  int tmp=0;
  while(a)tmp+=a&1,a>>=1;
  return tmp;
}
vector<int> ans;
vector<int> fans;
int rev(int x,int y){
  int res=0;
  for(int i=0;i<y;i++){
    res<<=1;
    res+=x&1;
    x>>=1;
  }
  return res;
}
void gray(int s,bool f){
  if(f){
    stack<int> sta;
    for(int i=0;i<(1<<s);i++)sta.push(rev(i^(i>>1),s)+now);
    while(sta.size()){
      ans.push_back(sta.top());
      sta.pop();
    }
  }
  else{
    queue<int> que;
    for(int i=0;i<(1<<s);i++)que.push(rev(i^(i>>1),s)+now);
    while(que.size()){
      ans.push_back(que.front());
      que.pop();
    }
  }
}
template<typename T>
void fin(T a){
  cout<<a<<endl;
  exit(0);
}
vector<int> t(20);//t[i]:pの(1<<i)の部分がbの1<<t[i]を表している
//pは1<<(n-B)が黒くするから、1<<(n-B)~1<<(n-1)がbの黒い部分にあたるはず
int nowb,noww;
void make_change(){
  nowb=n-B;
  int tmp=b;
  for(int i=0;i<n;i++){
    if(tmp&1)t[nowb++]=i;
    else t[noww++]=i;
    tmp>>=1;
  }
}
int change(int p){
  int tmp=0;
  for(int i=0;i<n;i++){
    if(p&1)tmp+=1<<t[i];
    p>>=1;
  }
  return tmp^a;
}

signed main(){
  cin>>n>>a>>b;
  b^=a;
  if((bitcount(b)&1)==0)fin("NO");
  cout<<"YES"<<endl;
  B=bitcount(b);
  //cout<<B<<endl;
  make_change();
  int d=1<<(n-1);
  for(int i=0;i<B;i+=2){
    gray(n-i-1,0);
    now+=d;d>>=1;
    if(i<B-1)gray(n-i-2,1);
    else gray(n-i-1,1);
    now+=d;d>>=1;
  }
  //for(int p:ans)cout<<bitset<5>(p)<<endl;
  for(int p:ans)fans.push_back(change(p));
  //cout<<(1<<n)<<" "<<fans.size()<<endl;
  assert(fans.size()==1<<n);
  //for(int p:fans)cout<<bitset<5>(p)<<endl;
  for(int i=1;i<fans.size();i++)assert(bitcount(fans[i-1]^fans[i])==1);
  for(int p:fans)cout<<p<<" ";
  cout<<endl;
}

/*
解説AC
グレイコードを知らなかったのはまぁ仕方ないとして、そこからの実装面でバグらせすぎた
考察はそんなに難しくないかな？アルメリアさんの記事の図がわかりやすい
辛かった
*/

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

unsigned long long gcd(unsigned long long  a,unsigned long long b)
{
	if(a%b==0)
	{
		return(b);
	}else{
		return(gcd(b,a%b));
	}
}

unsigned long long lcm(unsigned long long a,unsigned long long b)
{
	return a/gcd(a,b)*b;
}

int main()
{
	int N;cin >> N;
	vector<unsigned long long> T(N);
	for(int i=0;i<N;++i)cin>>T[i];


	sort(T.begin(),T.end());

	for(int i=1;i<N;i++)
	{

/*
		if(T[i]*>1000000000000000000)
		{
			cout<<T[i]<<endl;
			return 0;
		}
*/
		T[i]=lcm(T[i-1],T[i]);
		
				  
	}

	cout<<T[N-1]<<endl;
	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
#define speedX ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
using namespace std;
// #define ONLINE_JUDGE
#ifndef ONLINE_JUDGE
template<typename T>
void __p(T a) { cout << a << " "; }
template<typename T, typename F>
void __p(pair<T, F> a) { cout << "{ "; __p(a.first); __p(a.second); cout << "}"; }
template<typename T>
void __f(const char* s, T t) { cout << s << " : "; __p(t); }
template<typename T>
void __t(const char* s, const T &x) { cout << s << " : { "; for (auto it : x) __p(it); cout << "} ";}
template<typename T, typename ... F>
void __f(const char* s, T t, F ... f) {
	int i = 0; for (;; ++i) if (s[i] == ',') break;
	cout.write(s, i) << " : "; __p(t); cout << " | "; __f(s + i + 1, f...);
}
#define trace(...) { cout<<"LINE: "<<__LINE__<<" || "; __f(#__VA_ARGS__,__VA_ARGS__); cout<<"\n\n"; }
#define debug(...) { cout<<"LINE: "<<__LINE__<<" || "; __t(#__VA_ARGS__,__VA_ARGS__); cout<<"\n\n"; }
int begtime = clock();
#define end_time() cout << "\n\nTime of execution: " << (clock() - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n";
#else
#define trace(...)
#define debug(...) 
#define end_time()
#endif
 
 
#define int long long 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<pii, int> piii;
typedef vector<int> vi;
typedef vector<pii> vii;

inline bool equals(ld a, ld b) {return fabs(a - b) < 1e-9;}
inline int gcd(int a, int b) { a=abs(a); b=abs(b); while(a>0 && b>0) (a>b?a%=b:b%=a); return (a==0?b:a); } 
inline int power(int x, int n, int m = LLONG_MAX)
    {  int res=1; x = (x%m + m)%m;
       while(n) { if(n&1) res=(res*x)%m;  x=(x*x)%m;  n >>= 1; }  return res;
    }
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define ff first
#define ss second
#define uset unordered_set
#define umap unordered_map
#define all(x) x.begin(), x.end()
#define mod 1000000007
set<int> adj[200005];
int vis[200005];
int dfs(int node){
	int cnt = 1;
	vis[node] = 1;
	for(auto x : adj[node]){
		if(!vis[x]) cnt+=dfs(x);
	}
	return cnt;
}
void solve(){
	memset(vis,0,sizeof(vis));
	int n,m;
	cin>>n>>m;
	for(int i = 0; i<m; i++){
		int u,v;
		cin>>u>>v;
		adj[u].insert(v);
		adj[v].insert(u);
	}
	int ans = 0;
	for(int i = 1; i<=n; i++){
		if(!vis[i]) ans = max(ans,dfs(i));
	}
	cout<<ans<<"\n";
}
signed main(){
	speedX;
	#ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
	int t=1;
	//cin>>t;
	for(int i=1;i<=t;++i) {
		//cout<<"Case #"<<i<<": ";
		solve();
	}
	end_time();
	return 0;
}


Measured memory_bytes: 42604
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<int> vi;
typedef pair<int,int> ii;
int main()
{
	int n,m,i,j;
	scanf("%d %d",&n,&m);
	int a[n],b[n];
	for(i=0;i<n;i++)
	{
		scanf("%d",&a[i]);
	}
	for(i=1;i<=min(50,m);i++)
	{
		for(j=0;j<n;j++)	b[j]=0;
		for(j=0;j<n;j++)
		{
			int l = max(0,j-a[j]);
			int r = min(n-1,j+a[j]);
			b[l]++;
			if(r+1<n)	b[r+1]--;	
		}
		for(j=1;j<n;j++)	b[j]+=b[j-1];
		for(j=0;j<n;j++)	a[j]=b[j];
	}
	for(i=0;i<n;i++)	printf("%d ",a[i]);
}


Measured memory_bytes: 5352
#include <cstdio>
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <map>
#include <set>

#define ll long long
#define pll pair<ll, ll>

#define reps(i, f, n) for (int i = (f); i < (int)(n); i++)
#define rep(i, n) reps(i, 0, n)

const int INF = 1111111111;
const double EPS = 1e-9;

using namespace std;

void init()
{
}

void solve()
{
	int x, n;
	cin >> x >> n;

	bool p[111];
	rep(i, 111) p[i] = false;

	rep(i, n)
	{
		int a;
		cin >> a;
		p[a] = true;
	}

	int ans = -1;

	reps(i, -1, 111)
	{
		if (i >= 0 && p[i])
		{
			continue;
		}

		int a = abs(ans - x);
		int b = abs(i - x);
		if (a > b)
		{
			ans = i;
		}
	}
	cout << ans << endl;
}

int main()
{
	init();
	solve();
}


Measured memory_bytes: 3160
#include <bits/stdc++.h>
#define ll long long int
#define sd(x) scanf("%d",&x)
#define F first
#define S second
#define sd2(x,y) scanf("%d%d",&x,&y);
#define mp make_pair
#define pb push_back
#define pi pair <int, int > 
#define pl pair <ll, int >
#define infl (1ll << 60)
#define inf (1 << 30)
#define nax  200020
#define MOD 1000000007
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;

ll fact[nax];

ll exp(ll a, ll b)
{
    if(b == 0)
        return 1ll;
    if(b == 1)
        return a;
    if(b % 2 == 1)
        return a * exp(a, b - 1) % MOD;
    return exp(a * a % MOD, b/2);
}

int main()
{
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    int n,m,k;
    sd2(n, m);
    sd(k);
    int p = n * m;
    ll i2 = exp(2, MOD - 2);
    fact[0] = 1;
    for(int i = 1; i <= p; i++)
        fact[i] = fact[i - 1] * i % MOD;

    ll mul = (fact[p - 2] * exp(fact[k - 2], MOD - 2) % MOD) * exp(fact[p - k], MOD - 2) % MOD;

    mul = mul * i2 % MOD;

    ll fx = 0;
    ll fy = 0;
    ll CN = n * 1ll * (n + 1);
    CN /= 2;
    ll CM = m * 1ll * (m + 1);
    CM /= 2;
    for(int i = 1; i <= n; i++)
    {
        for(int j = 1; j <= m; j++)
        {
            fx = (fx + CN - i * 1ll * (i + 1) - n * 1ll * i + 2ll * i * i + MOD * 1ll * MOD) % MOD;
            fy = (fy + CM - j * 1ll * (j + 1) - m * 1ll * j + 2ll * j * j + MOD * 1ll * MOD) % MOD;
        }
    }
    fx = fx * m % MOD;
    fy = fy * n % MOD;
    ll fans = (fx + fy) % MOD;
    fans = fans * mul % MOD;
    printf("%lld\n", fans);
    return 0;
}


Measured memory_bytes: 1792
#define _USE_MATH_DEFINES
#include <array>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;
mt19937 mrand(random_device{}());
int rnd(int x) { return mrand() % x; }

const int N = 1e5 + 10;
char s[N], t[N];

int main() {
  int n, k;
  int R, S, P;
  scanf("%d%d", &n, &k);
  scanf("%d%d%d", &R, &S, &P);
  scanf("%s", s);
  int ret = 0;
  for (int i = 0; i < k; ++i) {
    int len = 0;
    for (int j = i; j < n; j += k) t[len++] = s[j];
    for (int j = 0, k; j < len; j = k) {
      for (k = j + 1; k < len && t[k] == t[j]; ++k);
      int cnt = k - j;
      cnt = (cnt + 1) / 2;
      if (t[j] == 'r') {
        ret += P * cnt;
      } else if (t[j] == 's') {
        ret += R * cnt;
      } else {
        ret += S * cnt;
      }
    }
  }
  printf("%d\n", ret);
  return 0;
}


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

using namespace std;

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

  int n; 
  cin >> n;
  string x, u;
  double res = 0.;
  double b2y = 380000.;
  while (n--) {
    cin >> x >> u;
    if (u == "JPY") {
      res += stod(x);
    } else {
      res += stod(x) * b2y;
    }
  }
  cout << setprecision(20) << res << endl;

  return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <cstring>
#include <set>
#include <algorithm>
#include <cstdio>
using namespace std;
typedef long long ll;
long long d[100005];
ll cmp(ll a,ll b)
{
    return a>b;
}
int main()
{
    int n ;
    while(scanf("%d",&n)!=EOF)
    {
        for(int i=0;i<n;i++)
            scanf("%lld",&d[i]);
            sort(d,d+n,cmp);
        ll b[3];
        int t=0;
        for(int i=1;i<n;)
        {
            if(d[i]==d[i-1])
            {
                b[t++]=d[i];
                i+=2;
                if(t==2)
                    break;
            }
           else i++;
        }
        if(t==2)
        {
              ll ans=b[0]*b[1];
              printf("%lld\n",ans);
        }
        else cout<<0<<endl;
    }

    return 0;
}


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

using namespace std;

typedef long long ll;

#ifdef RED
  mt19937 rnd(228);
#else
  mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());
#endif

const int N = 1005;
const int inf = (int)1e9 + 7;

int n, m;
int a[N], b[N], c[N][N];
int bit[N];
int dp[(1 << 17)];

int main() {
#ifdef RED
  freopen("a.in", "r", stdin);
#endif
  ios_base :: sync_with_stdio(0);
  cin.tie(0);
  scanf("%d %d", &n, &m);
  int all = 0;
  int mask_all = (1 << n) - 1;
  for (int i = 1; i <= m; ++i) {
    scanf("%d %d", &a[i], &b[i]);
    for (int j = 1; j <= b[i]; ++j) {
      scanf("%d", &c[i][j]);
      bit[i] |= (1 << (c[i][j] - 1));
    }
    all |= bit[i];
  }
  if (all != mask_all) {
    cout << -1;
    return 0;
  }
  for (int mask = 0; mask < (1 << n); ++mask) {
    dp[mask] = inf;
  }
  for (int i = 1; i <= m; ++i) {
    dp[bit[i]] = min(dp[bit[i]], a[i]);
  }
  for (int mask = 0; mask < (1 << n); ++mask) {
    for (int i = 1; i <= m; ++i) {
      for (int j = 1; j <= b[i]; ++j) {
        if (!((mask >> (c[i][j] - 1)) & 1)) {
          int uni = bit[i] | mask;
          dp[uni] = min(dp[uni], dp[mask] + a[i]);
        }
      }
    }
  }
  cout << dp[mask_all];
  return 0;
}


Measured memory_bytes: 4224
#include <iomanip>
#include <iostream>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;

int main(void) {
  ios::sync_with_stdio(false);
  int64_t N, A, B;
  cin >> N >> A >> B;
  int64_t AB = A + B;
  int64_t answer = 0;
  if (A == 0) {
    cout << 0 << endl;
    return 0;
  }
  answer += (N / AB) * A;
  N = N % AB;
  answer += (N > A) ? A : N;
  cout << answer << endl;
  return 0;
}


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

int main() {
    int n, m, k, t;
    int a[40] = {};
    cin >> n >> m;

    for (int i = 0; i < n; i++) {
        cin >> k;
        for (int j = 0; j < k; j++) {
            cin >> t;
            a[t-1]++;
        }
    }


    int ans = 0;
    for (int i = 0; i < m; i++) {
        if (a[i] == n) ans++;
    }

    cout << ans << endl;
}

Measured memory_bytes: 3556
#include<stdio.h>
void Swap(int x[ ], int i, int j)
{
    int temp;
    
    temp = x[i];
    x[i] = x[j];
    x[j] = temp;
}

/* クイックソートを行う */
void QSort(int x[ ], int left, int right)
{
    int i, j;
    int pivot;
    
    i = left;                      /* ソートする配列の一番小さい要素の添字 */
    j = right;                     /* ソートする配列の一番大きい要素の添字 */
    
    pivot = x[(left + right) / 2]; /* 基準値を配列の中央付近にとる */
    
    while (1) {                    /* 無限ループ */
        
        while (x[i] < pivot)       /* pivot より大きい値が */
            i++;                   /* 出るまで i を増加させる */
        
        while (pivot < x[j])       /* pivot より小さい値が */
            j--;                   /*  出るまで j を減少させる */
        if (i >= j)                /* i >= j なら */
            break;                 /* 無限ループから抜ける */
        
        Swap(x, i, j);             /* x[i] と x[j]を交換 */
        i++;                       /* 次のデータ */
        j--;
    }
    //ShowData(x, 10);               /* 途中経過を表示 */
    
    if (left < i - 1)              /* 基準値の左に 2 以上要素があれば */
        QSort(x, left, i - 1);     /* 左の配列を Q ソートする */
    if (j + 1 <  right)            /* 基準値の右に 2 以上要素があれば */
        QSort(x, j + 1, right);    /* 右の配列を Q ソートする */
}

int main(){
    int n,i,j;
    int a[200000];
    
    scanf("%d",&n);
    for(i = 0 ; i < n ; i++) scanf("%d",&a[i]);
    QSort(a,0,n-1);
    for(i = 0 ; i < n-1 ; i++){
        if(a[i] == a[i+1]){
            printf("NO\n");
            return 0;
        }
    }
    printf("YES\n");
    return 0;
    
}


Measured memory_bytes: 896
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <functional>
#define FI first
#define SE second
#define PB push_back
#define MT make_tuple
#define int long long
using namespace std;

int N,K;
int fld[105][105][105];
int X1[55],X2[55],Y1[55],Y2[55],Z1[55],Z2[55];
vector<int> X,Y,Z;

vector<int> compress(int *x1,int *x2){
    vector<int> xs;
    for(int i=0;i<N;++i){
        xs.PB(x1[i]);
        xs.PB(x2[i]);
    }
    sort(xs.begin(),xs.end());
    xs.erase(unique(xs.begin(),xs.end()),xs.end());
    for(int i=0;i<N;++i){
        x1[i]=lower_bound(xs.begin(),xs.end(),x1[i])-xs.begin();
        x2[i]=lower_bound(xs.begin(),xs.end(),x2[i])-xs.begin();
    }
    vector<int> length;
    for(int i=0;i<xs.size()-1;++i){
        length.PB(xs[i+1]-xs[i]);
    }
    return length;
}


signed main(){
    cin>>N>>K;
    for(int i=0;i<N;++i)cin>>X1[i]>>Y1[i]>>Z1[i]>>X2[i]>>Y2[i]>>Z2[i];
    X=compress(X1,X2);
    Y=compress(Y1,Y2);
    Z=compress(Z1,Z2);
    for(int i=0;i<N;++i){
        for(int x=X1[i];x<X2[i];++x){
            for(int y=Y1[i];y<Y2[i];++y){
                for(int z=Z1[i];z<Z2[i];++z){
                    fld[x][y][z]++;
                }
            }
        }
    }
    int ans=0;
    for(int x=0;x<X.size();++x){
        for(int y=0;y<Y.size();++y){
            for(int z=0;z<Z.size();++z){
                if(fld[x][y][z]>=K)ans+=X[x]*Y[y]*Z[z];
            }
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 10640
#include <iostream>
using namespace std;
int a[2][105], d[105];
int main()
{
    int b;
    cin >> b;
    for ( int i = 0; i <= 1; i++ )
    {
        for ( int j = 1; j <= b; j++ )
        {
            cin >> a[i][j];
        }
    }
    for ( int i = 2; i <= b; i++ )
    {
        a[0][i] = a[0][i] + a[0][i-1];
    }
    for ( int i = b-1; i >= 1; i-- )
    {
        a[1][i] = a[1][i] + a[1][i+1];
    }
    for ( int i = 1; i <= b; i++ )
    {
        d[i] = a[0][i] + a[1][i];
    }
    int max = d[1];
    for ( int i = 1; i <= b; i++ )
    {
        if ( d[i] >= max )
        {
            max = d[i];
        }
    }
    cout << max;
}

Measured memory_bytes: 256
#define lp(i,n) for(int i=0;i<n;i++)
#define pau system("pause")
#include<bits/stdc++.h>

using namespace std;
int main() {
    int a,b,t,ans;
    cin>>a>>b>>t;
    ans=(int((t+0.5)/a))*b;
    cout<<ans<<endl;
}


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

using namespace std;

#define all(x) (x).begin(), (x).end()

typedef long long ll;

ll n, s;
ll ans = 1e18;
const int N = 317000;

void check(ll b) {
  ll v = n, sum = 0;
  while (v) {
    sum += v % b; v /= b;
  }
  if (sum == s) {
    ans = min(ans, b);
  }
}

void relax(ll a) {
  ll b = s - a;
  ll B = (n - s) / a + 1;
  if (a < B && b < B && 0 <= b && 2 <= B && a * B + b == n) {
    ans = min(ans, B);
  }
}

void twoDigits() {
  if (n - s <= 0) return;
  ll v = n - s;
  for (ll mul = 1; mul * mul <= v; mul++) {
     if (v % mul == 0) {
       relax(mul);
       relax(v / mul);
     }
  }
}

void solve() {
  cin >> n >> s;
  if (s == 1 && n != 1) {
    ans = n;
  }
  if (n == s) {
    ans = min(ans, n + 1);
  }
  for (int b = 2; b < N; b++) {
    check(b);
  }
  twoDigits();
  cout << (ans == 1e18 ? -1 : ans);
}

// CHECK LIMITS (n <= 10^5)
// CHECK CORNER CASES (n == 1)

int main() {
  ios::sync_with_stdio(NULL), cin.tie(0), cout.tie(0);
  cout.setf(ios::fixed), cout.precision(20);
  //cout << 1.0 * clock() / CLOCKS_PER_SEC << endl;
  solve();
}


Measured memory_bytes: 3656
#include<bits/stdc++.h>
#define two(a) (1<<(a))
#define LINF (1ll<<61)
#define EPS (1e-14)
#define Lshift(a,b) ((a)<<(b))
#define Rshift(a,b) ((a)>>(b))
#define rep(a,b) for(a=0 ; a<b ; a++)
#define xrep(a,b,c) for(a=b ; a<c ; a++)
#define INF (1<<29)
#define sz(a) int(a.size())
#define swap(a,b) ( (a^=b) , (b^=a) , (a^=b) )
#define GET(x) (mark[x>>5]>>(x&31)&1)
#define SET(x) (mark[x>>5]|=1<<(x&31))
#define maxL (10000000>>5)+1
#define mod 1000000007
#define vi vector<int>
#define pii pair<int, int>
#define mii map<int, int>
#define si set<int>
#define pb push_back
typedef long long ll;
using namespace std;


ll in[300010];

int main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    int n;
    cin >> n;
    int i;
    rep(i, n) cin >> in[i];
    ll ans(0);
    map<ll, ll> xmap;
    rep(i, n) {
        ans += xmap[i-in[i]];
        xmap[i + in[i]]+=1;
    }
    cout << ans << endl;
}


Measured memory_bytes: 27964
#include <iostream>
#include <string>

using namespace std;
class Dice{
public:
int dice[6];

int getAns(){return dice[0];}

int getAns2(){return dice[1];}

int getAns3(){return dice[2];}

void input(){
	for (int i = 0;i < 6;i++ ){
		cin >> dice[i];
	}
}

void moveS(){
	int dice2[6];
	int index_list[6] = {4,0,2,3,5,1};
	for (int i = 0 ; i < 6 ; i++ ){
		int idx = index_list[i];
		dice2[i] = dice[idx];
	}
	for (int i = 0 ; i < 6 ; ++i){
		dice[i] = dice2[i];
	}
}


void moveW(){
	int dice2[6];
	int index_list[6] = {2,1,5,0,4,3};
	for (int i = 0 ; i < 6 ; i++ ){
		int idx = index_list[i];
		dice2[i] = dice[idx];
	}
	for (int i = 0 ; i < 6 ; ++i ){
		dice[i] = dice2[i];
	}
}

void moveX(){
	int dice2[6];
	int index_list[6] = {0,3,1,4,2,5};
	for (int i = 0 ; i < 6 ; i++ ){
		int idx = index_list[i];
		dice2[i] = dice[idx];
	}
	for(int i = 0 ; i < 6 ; i++ ){
		dice[i] = dice2[i];
	}
}


};

int main(){
	Dice dice;
	dice.input();
	int p,a,b;
	cin >> p;
	for (int i = 0 ; i < p ; i++ ){
		cin >> a >> b;
		for (int j = 0 ; j < 4 ; j++ ){
			if(dice.getAns() == a)break;
			dice.moveS();
		}

		for (int k = 0 ; k < 4 ; k++ ){
			if (dice.getAns() == a)break;
			dice.moveW();
		}

		for (int l = 0 ; l < 4 ; l++ ){
			if (dice.getAns2() == b)break;
			dice.moveX();
			}
		cout << dice.getAns3() << endl;
		}
return 0;
}

	

Measured memory_bytes: 3012
N = int(input())
A = list(map(int, input().split()))
answer = "APPROVED"
for i in range(N):
  if A[i] % 2 == 0:
    if A[i] % 3 != 0 and A[i] % 5 != 0 :
      answer = "DENIED"
print(answer)

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

template <std::uint_fast64_t Modulus> class modint {
  using u64 = std::uint_fast64_t;
 
public:
  u64 a;
 
  constexpr modint(const u64 x = 0) noexcept : a(x % Modulus) {}
  constexpr u64 &value() noexcept { return a; }
  constexpr const u64 &value() const noexcept { return a; }
  constexpr modint operator+(const modint rhs) const noexcept {
    return modint(*this) += rhs;
  }
  constexpr modint operator-(const modint rhs) const noexcept {
    return modint(*this) -= rhs;
  }
  constexpr modint operator*(const modint rhs) const noexcept {
    return modint(*this) *= rhs;
  }
  constexpr modint operator/(const modint rhs) const noexcept {
    return modint(*this) /= rhs;
  }
  constexpr modint &operator+=(const modint rhs) noexcept {
    a += rhs.a;
    if (a >= Modulus) {
      a -= Modulus;
    }
    return *this;
  }
  constexpr modint &operator-=(const modint rhs) noexcept {
    if (a < rhs.a) {
      a += Modulus;
    }
    a -= rhs.a;
    return *this;
  }
  constexpr modint &operator*=(const modint rhs) noexcept {
    a = a * rhs.a % Modulus;
    return *this;
  }
  constexpr modint &operator/=(modint rhs) noexcept {
    u64 exp = Modulus - 2;
    while (exp) {
      if (exp % 2) {
        *this *= rhs;
      }
      rhs *= rhs;
      exp /= 2;
    }
    return *this;
  }
};

typedef long long ll;
typedef long double ld;
const int INF=1e9,MOD=1e9+7,ohara=1e6+10;
const ll LINF=1e18;
using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl
#define doublecout(a) cout<<fixed<<setprecision(15)<<a<<endl;
#define Cerr(x) cerr<<(x)<<endl
#define fi first
#define se second
#define P pair<ll,ll> 
#define m_p make_pair
#define V vector<ll> 
#define U_MAP unordered_map<ll,ll>

ll n,cnt,ans,a,b,c,d,tmp,tmpp,m,h,w,x,y,sum,pos,k;
ld doua;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl;
struct edge{int to,cost;};

//-------------------------↓↓↓↓↓↓------------------------

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

    using mint=modint<MOD>;

    cin>>n>>k;

    vector<mint> fa(ohara);
    fa[0]=1;
    rrep(i,1,ohara){
    fa[i]=fa[i-1]*i;
    }
    const auto comb = [&fa](int n,int r) {
        return fa[n]/fa[r]/fa[n-r];
    };

    rep(i,k){
        if(n-k+1<i+1){
            Cout(0);
        }
        else{
            Cout((comb(n-k+1,i+1)*comb(k-1,i)).value());
        }
    }
    return 0;
}


Measured memory_bytes: 8064
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Pld = pair<ld, ld>;
using Vec = vector<ll>;
using VecP = vector<P>;
using VecB = vector<bool>;
using VecC = vector<char>;
using VecD = vector<ld>;
using VecS = vector<string>;
using Graph = vector<VecP>;
#define REP(i, m, n) for(ll (i) = (m); (i) < (n); ++(i))
#define REPR(i, m, n) for(ll (i) = (m); (i) > (n); --(i))
#define rep(i, n) REP(i, 0, n)
#define R cin>>
#define repr(i, n) REPR(i, n, 0)
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define in(a) insert(a)
#define P(p) cout<<(p)<<endl;
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define SORT(a) sort((a).begin(), (a).end())
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<long long int> vll;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
typedef pair<ll, ll> pll;
void sonic(){ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);}
void setp(const ll n){cout << fixed << setprecision(n);}
const ll INF = 1e9+1;
const ll LINF = 1e18+1;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const ld PI = acos(-1);
const ld EPS = 1e-11;
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}
template<typename T> void co(T e){cout << e << "\n";}
template<typename T> void co(const vector<T>& v){for(const auto& e : v)
    { cout << e << " "; } cout << "\n";}
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;
}

Vec fac, finv;

ll PowMod(ll a, ll n){
    if(n == 1) return a;
    if(n%2 == 0) return PowMod(a*a%MOD, n/2);
    return a*PowMod(a*a%MOD, n/2)%MOD;
}

ll combi(ll n, ll k){
    if(k>n) return 0;
    return fac[n]*finv[k]%MOD*finv[n-k]%MOD;
}

int main(){
    int ans = 0, n;
    R n;
    set<string>s;
    rep(i, n){
        string ss;
        R ss;
        s.insert(ss);
    }
    co(s.size());
}


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

#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define st first
#define nd second
#define endl '\n'
#define what_is(x) cerr << #x << " is " << x << endl;
#define what_is_v(x) cerr << #x << " is "; for(auto&e: (x)) cerr << e << ' '; cerr << '\n'; //vector, set
#define what_is_a(x, n) cerr << #x << " is "; for(int i=0;i<n;i++) cerr << x[i] << ' '; cerr <<  '\n'; //n first element of array
#define cerr_pair(x) '{' << x.st << ", " << x.nd << '}'
#define pwhat_is(x) cerr << #x << " is " << cerr_pair(x) << endl;
#define pwhat_is_v(x) cerr << #x << " is "; for(auto&e: (x)) cerr << cerr_pair(e) << ' '; cerr << '\n'; //vector, set
#define pwhat_is_a(x, n) cerr << #x << " is "; for(int i=0;i<n;i++) cerr << cerr_pair(x[i]) << ' '; cerr <<  '\n'; //n first element of array
#define int long long

typedef pair<int,int> pii;
const int N = 2e5+5;
const int INF = 1e9;
const int MOD = 1e9+7;

int n, k, h[N];
int32_t main()
{
	IOS
	//freopen("input.txt", "r", stdin);
	cin >> n >> k;
	for(int i=0; i<n; i++) cin >> h[i];
	sort(h, h+n);
	int ans = 0;
	for(int i=0; i+k < n; i++){
		ans += h[i];
	}
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <functional>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
using namespace std;
using llong = long long;

string s;
deque<char> st;
int rev;

int main() {
    cin >> s;
    for (auto ch:s) {
        st.push_back(ch);
    }

    llong q;
    llong t, f;
    char c;
    cin >> q;

    while (q--) {
        cin >> t;

        if (t == 1) {
            rev = rev ^ 1;
        }
        else {
            cin >> f >> c;
            f--;
            f = f ^ rev;

            if (f) {
                st.push_back(c);
            }
            else {
                st.push_front(c);
            }
        }
    }

    if (rev) {
        for (auto itr = st.rbegin(); itr != st.rend(); itr++) {
            cout << *itr;
        }
        cout << endl;
    }
    else {
        for (auto ch:st) {
            cout << ch;
        }
        cout << endl;
    }

    return 0;
}


Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (k); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
#define D10 fixed<<setprecision(10)
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
typedef long double ld;
const ll MOD = 1000000009;
const int INF = MOD + 1;
const ld EPS = 1e-10;
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }
typedef int Weight;
struct Edge
{
	int from, to; Weight cost;
	bool operator < (const Edge& e) const { return cost < e.cost; }
	bool operator >(const Edge& e) const { return cost > e.cost; }
};

/*--------------------template--------------------*/
#define array Array
#define matrix Matrix
typedef ll number;
typedef vector<number> array;
typedef vector<array> matrix;

// O( n )
matrix ident(int n) {
	matrix A(n, array(n));
	for (int i = 0; i < n; ++i) A[i][i] = 1;
	return A;
}
// O( n )
number inner_product(const array &a, const array &b) {
	number ans = 0;
	for (int i = 0; i < a.size(); ++i)
		ans += (a[i] * b[i]) % MOD;
	return ans;
}
// O( n^2 )
array mul(const matrix &A, const array &x) {
	array y(A.size());
	for (int i = 0; i < A.size(); ++i)
		for (int j = 0; j < A[0].size(); ++j)
		{
			y[i] += A[i][j] * x[j];
			y[i] %= MOD;
		}
	return y;
}
// O( n^3 )
matrix mul(const matrix &A, const matrix &B) {
	matrix C(A.size(), array(B[0].size()));
	for (int i = 0; i < C.size(); ++i)
		for (int j = 0; j < C[i].size(); ++j)
			for (int k = 0; k < A[i].size(); ++k)
			{
				C[i][j] += A[i][k] * B[k][j];
				C[i][j] %= MOD;
			}
	return C;
}
// O( n^3 log e )
matrix pow(const matrix &A, ll e) {
	return e == 0 ? ident(A.size()) :
		e % 2 == 0 ? pow(mul(A, A), e / 2) : mul(A, pow(A, e - 1));
}
int main()
{
	ll w, h, n;
	for (int cs = 0; cin >> w >> h >> n&&w; cs++)
	{
		vector<pair<ll,ll>> v;
		REP(i, n)
		{
			ll x, y; cin >> x >> y;
			x--; y--;
			if (y == 0) continue;
			v.emplace_back(y, x);
		}
		n = v.size();
		sort(ALL(v));
		Array ary(w); ary[0] = 1;
		Matrix mat(w, Array(w));
		REP(i, w)REP(j, w)
		{
			if (abs(i - j) <= 1) mat[i][j] = 1;
		}
		ll tmp = 0, p = 0;
		while (1)
		{
			ll next;
			if (p < n) next = v[p].first;
			else next = h;
			ary = mul(pow(mat, (next - tmp - 1)), ary);
			if (next == h) break;
			vi obj; obj.push_back(v[p].second);
			p++;
			while (p < n && v[p].first == v[p-1].first)
			{
				obj.push_back(v[p].second);
				p++;
			}
			Array zero(w);
			Matrix objmat = mat;
			REP(i, obj.size()) objmat[obj[i]] = zero;
			ary = mul(objmat, ary);
			tmp = next;
		}
		cout << "Case " << cs+1 << ": " << ary.back() << endl;
	}
	return 0;
}

Measured memory_bytes: 5836
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

ans = -1
N = INT()
A = LIST()
C = list(combinations(A, 2))
for c in C:
    a, b = c
    if ans < abs(a - b):
        ans = max(ans, abs(a - b))
print(ans)

Measured memory_bytes: 5448
N = int(input())
P = [int(input()) for _ in range(N)]

idxs = [0] * (N+1)
for i in range(N):
    idxs[P[i]] = i

# 動かす必要のない部分の最大の長さ
max_length = 1

cnt = 1
for i,j in zip(idxs[1:], idxs[2:]):
    if i < j:
        cnt += 1
        max_length = max(max_length, cnt)
    else:
        cnt = 1

print(N - max_length)

Measured memory_bytes: 22060
#include <stdio.h>

int main(void)
{
	int S,h=0,m=0,s=0;
	scanf("%d",&S);
	while(S>=3600){
		S=S-3600;
		h++;
	}
	while(S>=60){
		S=S-60;
		m++;
	}
	s=S;
	printf("%d:%d:%d\n",h,m,s);
	return 0;
}

Measured memory_bytes: 592
import math

h, w = map(int,input().split())
a = [list(map(int,input().split())) for i in range(h)]
b = [list(map(int,input().split())) for i in range(h)]

diff = [[abs(x-y) for x,y in zip(ar,br)] for ar,br in zip (a,b)]

M = 80*(h+w)
dp = [[0 for j in range(w)] for i in range(h)]
dp[0][0] = 1<<(diff[0][0]+M)
for i in range(h):
    for j in range(w):
        if i > 0:
            dp[i][j] |= (dp[i-1][j]<<diff[i][j])|(dp[i-1][j]>>diff[i][j])
        if j > 0:
            dp[i][j] |= (dp[i][j-1]<<diff[i][j])|(dp[i][j-1]>>diff[i][j])
        dp[i][j] &= (1<<(M*2))-1
for k in range(M):
    if (dp[h-1][w-1]>>(k+M))&1 == 1:
        print(k)
        break

Measured memory_bytes: 19700
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef long double ld;

int dp[200010];

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin >> n;
  vector<int> p(n);
  REP(i,n){
    cin >> p[i];
  }
  int ans = 0;
  REP(i,n){
    dp[p[i]] = dp[p[i]-1] + 1;
    ans = max(ans, dp[p[i]]);
  }
  //FOR(i,1,n+1) cout << dp[i] << " ";
  //cout << '\n';
  cout << n - ans << '\n';
  return 0;
}

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

int main(){
	int n,k;
	string s;
	cin >> n >> k >> s;
	vector<int> a(1, 0);
	char curr = '1';
	for(char c: s){
		if(curr == c){
			a.back()++;
		}else{
			a.push_back(1);
			curr = c;
		}
	}
	int m = a.size();
	if(m/2 <= k){
		cout << n << endl;
		return 0;
	}
	if(m%2 == 0){
		a.push_back(0);
		m++;
	}
	for(int i=0; i<m-1; i++){
		a[i+1] += a[i];
	}
	int ans = a[2*k];
	for(int i=2; i+2*k<=m; i+=2){
		ans = max(ans, a[2*k+i]-a[i-1]);
	}
	cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1020
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using V = vector<int>;
using VV = vector<V>;
using VVV = vector<VV>;
using VL = vector<ll>;
using VVL = vector<VL>;
using VVVL = vector<VVL>;
template<class T> using VE = vector<T>;
template<class T> using P = pair<T, T>;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define REP(i,k,n) for(int i=(k);i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define output(x,y) cout << fixed << setprecision(y) << x << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
ll upper = MOD + MOD;
ll under = -upper;
ll UPPER = MOD * MOD;
ll UNDER = -UPPER;
const long double pi = 3.141592653589793;
int main() {
	char a;
	cin >> a;
	if (a >= 'a') cout << 'a' << endl;
	else cout << 'A' << endl;
	return 0;
}

Measured memory_bytes: 3588
private fun readInts() = readLine()!!.split(" ").map(String::toInt)

fun main(args: Array<out String>) {
    val (n) = readInts()
    val ymd = (0 until n).map { readInts() }

    ymd.forEach { (year, month, day) -> println(calcDays(year, month, day)) }
}

private fun calcDays(startYear: Int, startMonth: Int, startDay: Int): Int {
    if (startYear >= 1000) return 0

    return (1..10)
        .asSequence()
        .drop(startMonth - 1)
        .map { month ->
            if (startYear % 3 != 0) {
                if (month % 2 == 0) 19 else 20
            } else {
                20
            }
        }
        .sum()
        .minus(startDay - 1)
        .plus(calcDays(startYear + 1, 1, 1))
}


Measured memory_bytes: 44496
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
#define Priq priority_queue<int,vi,greater<int>>
#define pb push_back
#define mp make_pair
#define INF (1ll<<60)
signed main(){
  int M,X; cin>>M>>X;
  if(X==0) rep(i,0,(1ll<<M)) cout<<i<<" "<<i<<" ";
  else if((1ll<<M)<=X||M==1) cout<<-1<<endl;
  else{
    vector<bool> F((1ll<<M),1);
    vector<pii> A;
    rep(i,0,(1ll<<M)){
      if(F[i]){
        F[i]=0;
        int P=i^X;
        F[P]=0;
        A.pb(mp(P,i));
      }
    }
    rep(i,0,A.size()/2){
      cout<<A[i*2].first<<" "<<A[i*2].second<<" "<<A[i*2+1].first<<" "<<A[i*2+1].second<<" ";
      cout<<A[i*2].second<<" "<<A[i*2].first<<" "<<A[i*2+1].second<<" "<<A[i*2+1].first<<" ";
    }
  }
  }




Measured memory_bytes: 2936
parseInt(x)=parse(Int,x)
parseMap(x::Array{SubString{String},1})=map(parseInt,x)
function bsearch(a::Array{Int,1},x::Int);l,r=1,length(a);while l<=r;m=l+div(r-l,2);if a[m]<x;l=m+1;else;r=m-1;end;end;return(l-1);end

function main()
	n = readline() |> parseInt
	a = readline() |> split |> parseMap
	b = ones(Int,n)
	c = ones(Int, n)
	b[1] = a[1]
	c[n] = a[n]
	for i in 1:n-1
		b[i+1] = gcd(b[i],a[i+1])
		c[n-i] = gcd(c[n-i+1],a[n-i])
	end
	t = max(b[n-1],c[2])
	for i in 2:n-1
		t = max(t,gcd(b[i-1],c[i+1]))
	end
	println(t)
end
main()


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

def main():
    n, k, q = map(int, input().split())
    a_list = []

    for i in range(q):
        a_list.append(int(input()))

    participant_list = [k-q] * n


    for i in range(q):
        participant_list[a_list[i]-1] += 1

    for i in range(n):
        if(participant_list[i] > 0):
            print("Yes")
        else:
            print("No")

if __name__ == "__main__":
    main()


Measured memory_bytes: 10448
#include<bits/stdc++.h>
using namespace std;
int n,a,i,ans;
map<int,int>m;
map<int,int>::iterator it;
int main(){
	scanf("%d",&n);
	for(i=1;i<=n;++i)scanf("%d",&a),++m[a];
	for(it=m.begin();it!=m.end();++it){
		int x=it->first,y=it->second;
		ans+=y>=x?y-x:y;
	}
	return printf("%d\n",ans),0;
}

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

using namespace std;

#define ff(i, a, b) for(int i = (a); (i <= (b)); ++i)
#define FF(i, a, b) for(int i = (a); (i >= (b)); --i)
#define ll long long

const int M = 1000000000 + 7;
const int N = 200000 + 10;

struct re {
    int x, y;
//    const bool operator < (const re &a) const {
//        if (x != a.x) return x < a.x;
//        return y < a.y;
//    }
};

int n, k, a[N], res = 0, cnt0 = 0;
deque<int> qmin, qmax;

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    //freopen("", "r" , stdin);
    //freopen("", "w", stdout);
    cin >> n >> k;
    ff(i, 1, n) {
        cin >> a[i];
    }

    //qmin.push_back(0);
    ff(i, 1, n) {
        while (!qmin.empty() && a[i] < a[qmin.back()]) qmin.pop_back();
        qmin.push_back(i);
        while (!qmax.empty() && a[i] > a[qmax.back()]) qmax.pop_back();
        qmax.push_back(i);

        if (i >= k) {
            while (!qmin.empty() && qmin.front() < i - k) qmin.pop_front();
            while (!qmax.empty() && qmax.front() < i - k) qmax.pop_front();
            if (qmin.size() - (qmin.front() == i - k) == k) cnt0++; else {
                if (qmin.front() != i - k || qmax.front() != i) res++;
            }
        }
    }

    cout << res + (cnt0 > 0);
}
//This code belongs to s34vv1nd


Measured memory_bytes: 1920
#include<bits/stdc++.h>
using namespace std;
#define what_is(x) cerr<<#x <<" is "<<x<<endl;
#define ll long long 
#define gcd(a,b) __gcd(a,b)
#define pi 2*acos(0.0)
#define endl "\n"
//use emplace_back() instead of push_back()
const ll mod=1e9+7;
template<typename T>
void print(T t)
{
    for(const auto& e:t)cout<<e<<" ";
    cout<<endl;
}
ll power(ll x, ll y, ll p) 
{ 
    int res = 1;
    x = x % p;
    while (y > 0) 
    {
        if (y & 1) 
            res = (res*x) % p; 
        y = y>>1;
        x = (x*x) % p;   
    } 
    return res; 
} 
vector<int>g[1000001];
int vis[1000001];    
int in[100001];
int low[100001];
int timer=0;
vector<pair<int,int> >v;
int f;
void dfs(int n,int p)
{
    vis[n]=1;
    low[n]=in[n]=timer++;    
    if(timer!=1)v.push_back({p,n});
    for(auto ch:g[n])
    {
        if(ch==p)continue;
        if(vis[ch])
        {
            low[n]=min(low[n],in[ch]);
            if(in[n]>in[ch])v.push_back({n,ch});
        }
        else
        {
            dfs(ch,n);
            if(in[n]<low[ch]){f=1;return;}            
            low[n]=min(low[n],low[ch]);
        }
    }    
}
ll josephus(ll n) 
{
    ll p = 1; 
    while (p <= n) 
        p *= 2; 
    return (2 * n) - p + 1; 
}

bool isprime(ll n)
{
    if(n==1)return false;
    for(ll i=2;i*i<=n;i++)
    if(n%i==0)return false;
    return true;
}
vector<ll>aa;
void printallpf(ll n)
{
    for(ll i=2;i*i<=n;i++)
    {
        if(n%i==0)
        {
            while(n%i==0)
            {
                aa.push_back(i);
                if(i!=n/i)
                if(isprime(n/i))aa.push_back(n/i),n=i;
                n=n/i;
            }
            
        }
    }    
}
void primeFactors(int n)  
{
       while (n % 2 == 0)  
    {  
        cout << 2 << " ";  
        n = n/2;  
    }  
  for (int i = 3; i <= sqrt(n); i = i + 2)  
    {    
        while (n % i == 0)  
        {  
            cout << i << " ";  
            n = n/i;  
        }  
    }
    if (n > 2)  
        cout << n << " ";  
}  
int dsu[100001];
void dsuunion(int u,int v)
{
	dsu[v]+=dsu[u];
	dsu[u]=v;
}
ll find(int a)
{
	if(dsu[a]<0)return a;
	else
	return dsu[a]=find(dsu[a]);
}
ll nod(ll x)
{
	ll cnt=0;
	while(x)
	{
		x=x>>1;
		cnt++;
	}
	return cnt;
}
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll n,m,x,u,v;
    cin>>n>>m;
    ll h[n+1];
    for(ll i=1;i<=n;i++)
    cin>>h[i];
    while(m--)
    {
		cin>>u>>v;
		g[u].push_back(v);
		g[v].push_back(u);
	}
	ll ans=0;
	for(ll i=1;i<=n;i++)
	{
		ll f=0;
		for(auto ch:g[i])
		{
			if(h[ch]>=h[i])
			f=1;
		}
		if(!f)ans++;
	}
	cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 30704
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <numeric>

using namespace std;
typedef long long ll;
const ll mod = 1e9 + 7;
const int inf = 1000000;

int main(int argc, const char * argv[]) {
  string s;
  cin >> s;
  
  for (int i = 0; i + 1 < s.size(); i++) {
    if (s[i] == s[i + 1]) {
      cout << i + 1 << " " << i + 2 << endl;
      return 0;
    } else if (i + 2 < s.size() && s[i] == s[i + 2]) {
      cout << i + 1 << " " << i + 3 << endl;
      return 0;
    }
  }
  
  cout << -1 << " " << -1 << endl;
  return 0;
}


Measured memory_bytes: 512
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
using namespace std;
int main() {
	string a;
	string st;
	cin >> a;
	for (int i = 0; i < a.size(); i++) {
		if (i % 2 == 0) {
			st.push_back(a[i]);
		}
	}

	cout << st;
}

Measured memory_bytes: 512
#include<cstdio>

using namespace std;

int main()
{
	int a,b;
	scanf("%d %d", &a, &b);

	if (a > b)
	{
		printf("a > b\n");
	}
	else if (a < b)
	{
		printf("a < b\n");
	}
	else
	{
		printf("a == b\n");
	}
	return 0;
}

Measured memory_bytes: 2616
#coding:utf-8

def main():
    n = int(input())
    v = list(map(int, input().split()))
    c = list(map(int, input().split()))
    result = []

    for i in range(n):
        # 各リストのi番目の要素を引き算し、新しいリストに格納
        result.append(v[i] - c[i])

    # filter関数：条件に合った要素のみ取り出す
    # lambda：(lambda 引数:返り値)
    # sorted：リスト内の要素を昇順にソート
    print(sum(list(filter(lambda x:x>0, sorted(result)))))

if __name__ == "__main__":
    main()

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

int main() {
    string S;
    cin >> S;
    deque<char> res;
    for(char c : S) res.push_back(c);

    int inv = 0;
    int Q; cin >> Q;
    while(Q--) {
        int t; cin >> t;
        if(t == 1) {
            inv ^= 1;
        } else {
            int f; char c; cin >> f >> c;
            --f; f ^= inv;
            if(f == 0) res.push_front(c);
            else res.push_back(c);
        }
    }

    if(inv) {
        while(!res.empty()) {
            cout << res.back();
            res.pop_back();
        }
    } else {
        while(!res.empty()) {
            cout << res.front();
            res.pop_front();
        }
    }
    cout << endl;
}

Measured memory_bytes: 896