akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)

int main()
{
    long long int N,M,k,allb=0,ans=0;
    cin>>N>>M>>k;
    long long int j=M;
    vector<int> a(N);
    vector<int> b(M);
    rep(i,N) cin>>a[i]; rep(i,M) cin>>b[i];
    rep(i,M) allb+=b[i];
    
    rep(i,N+1)
    {
        while(allb>k&&j>0)
        {
            allb-=b[j-1];
            j--;
        }
        if(allb>k) break;
        ans=max(ans,i+j);
        if(i==N) break;
        allb+=a[i];
    }
    cout<<ans;
}


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

int main (){
	int D;cin>>D;
	if(D==22)cout<<"Christmas Eve Eve Eve"<<endl;
	else if(D==23)cout<<"Christmas Eve Eve"<<endl;
	else if(D==24)cout<<"Christmas Eve"<<endl;
	else if(D==25)cout<<"Christmas"<<endl;
    return 0;
}

Measured memory_bytes: 256
N,M,X = map(int,input().split())
data = [[] for i in range(N)]
for i in range(N): data[i] = list(map(int,input().split()))

ans = []
def read(n,last,*under):
    if n == 0:
        ans.append(list(under))
    else:
        for i in range(last+1, N):
            ui = list(under)
            for m in range(M+1):
                ui[m] += data[i][m]
            read(n-1,i,*ui)

for n in range(1,N+1):
    read(n,-1,*[0]*(M+1))

ans = sorted(ans)
for item in ans:
    flag_m = True
    for m in range(1,M+1):
        if item[m] < X: flag_m = False
    if flag_m:
        print(item[0])
        break

if not flag_m: print(-1)

Measured memory_bytes: 11240
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

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

    int ret = 1, now = 0;
    for (int i = 0; i < n; i++) {
        int l;
        cin >> l;
        now += l;
        if (now <= x)ret++;
    }

    cout << ret << endl;
    return 0;
}

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

int main(){
    int n;
    cin >> n;
    vector<int> v;
    for(int i = 0; i < n; i++)  v.push_back(i);
    vector<double> x(n), y(n);
    for(int i = 0; i < n; i++)  cin >> x[i] >> y[i];
    double ans = 0;
    do{
        double tmp = 0;
        for(int i = 1; i < n; i++){
            tmp += sqrt(pow(x[v[i]]-x[v[i-1]], 2.0) + pow(y[v[i]]-y[v[i-1]], 2.0));
        }
        ans += tmp;
    }while(next_permutation(v.begin(),v.end()));
    for(int i = 1; i <= n; i++) ans /= i;
    cout << fixed << setprecision(12) << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const ll mod = 1e9 + 7;
const ll MAXX = 1e18;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	//freopen("INP.txt", "r", stdin);
	//freopen("OUT.txt", "w", stdout);
	ll n;
	cin >> n;
	vector<ll> hold;
	for (ll i = 0; i < n; i++) {
		ll x;
		cin >> x;
		hold.push_back(x);
	}
	double res = 0;
	for (ll i = 0; i < n; i++) {
		res += (1.0 / hold[i]);
	}
	res = 1.0 / res;
	cout << setprecision(15) << res << '\n';
	return 0;
}

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

using namespace std;

vector<int> g[200000];
bool from1[200000];
bool fromn[200000];
int main(){
  int n,m;
  cin >> n >> m;

  for(int i=0;i<m;++i){
    int a,b;
    cin >> a >> b;
    g[a-1].push_back(b-1);
    g[b-1].push_back(a-1);
  }
  
  for(int i=0;i<g[0].size();++i){
    from1[g[0][i]] = true;
  }

  for(int i=0;i<g[n-1].size();++i){
    fromn[g[n-1][i]] = true;
  }
  
  for(int i=0;i<200000;++i){
    if(from1[i]&&fromn[i]){
      cout << "POSSIBLE" << endl;
      return 0;
    }
  }
  cout << "IMPOSSIBLE" << endl;
  return 0;
}

Measured memory_bytes: 12400
x,y,z,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)

l=[]
for s in range(x):
    for t in range(y):
        for u in range(z):
            if (s+1)*(t+1)*(u+1)<= k:
                l.append(a[s]+b[t]+c[u])
            else:
                break
l.sort(reverse=True)
for i in range(k):
    print(l[i])


Measured memory_bytes: 8708
#include <stdio.h>
#include <iostream>
#include <string>
using namespace std;
#define MAX 25
#define NIL -1

struct Node
{
  int parent, left, right;
};

Node T[MAX];
int cnt, n;

int sibling(int u)
{
  if (T[u].parent == NIL)
    return NIL;
  if ((T[T[u].parent].left != u) && (T[T[u].parent].left != NIL))
  {
    return T[T[u].parent].left;
  }
  if ((T[T[u].parent].right != u) && (T[T[u].parent].right != NIL))
  {
    return T[T[u].parent].right;
  }
  return NIL;
}

int degree(int u)
{
  int cnt = 0;
  if ((T[u].left != NIL))
  {
    cnt++;
  }
  if ((T[u].right != NIL))
  {
    cnt++;
  }
  return cnt;
}

int depth(int u)
{
  if (T[u].parent == NIL)
    return 0;
  return depth(T[u].parent) + 1;
}
int height(int u)
{
  if (u == NIL)
  {
    return -1;
  }
  return max(height(T[u].left), height(T[u].right)) + 1;
}

string type_string(int u)
{
  if (T[u].parent == NIL)
  {
    return "root";
  }
  else if (T[u].left == NIL && T[u].right == NIL)
  {
    return "leaf";
  }
  else
  {
    return "internal node";
  }
}

void print(int u)
{
  int i, c;
  printf("node %d: ", u);
  printf("parent = %d, ", T[u].parent);
  printf("sibling = %d, ", sibling(u));
  printf("degree = %d, ", degree(u));
  printf("depth = %d, ", depth(u));
  printf("height = %d, ", height(u));
  cout << type_string(u) << endl;
}

void preorder(int u)
{
  cnt++;
  if (cnt != n)
    printf("%d ", u);
  else
    printf("%d\n", u);
  if (T[u].left != NIL)
    preorder(T[u].left);
  if (T[u].right != NIL)
    preorder(T[u].right);
}

void inorder(int u)
{
  if (T[u].left != NIL)
    inorder(T[u].left);

  cnt++;
  if (cnt != n)
    printf("%d ", u);
  else
    printf("%d\n", u);

  if (T[u].right != NIL)
    inorder(T[u].right);
}

void postorder(int u)
{
  if (T[u].left != NIL)
    postorder(T[u].left);

  if (T[u].right != NIL)
    postorder(T[u].right);

  cnt++;
  if (cnt != n)
    printf("%d ", u);
  else
    printf("%d\n", u);
}

int main()
{
  int id, left, right;
  scanf("%d", &n);
  for (int i = 0; i < n; i++)
    T[i].parent = T[i].left = T[i].right = NIL;
  for (int i = 0; i < n; i++)
  {
    scanf("%d %d %d", &id, &left, &right);
    T[id].left = left;
    T[id].right = right;
    if (left != NIL)
      T[left].parent = id;
    if (right != NIL)
      T[right].parent = id;
  }
  int root_no = 0;
  for (int i = 0; i < n; i++)
  {
    if (type_string(i) == "root")
    {
      root_no = i;
    }
  }

  cnt = 0;
  printf("Preorder\n ");
  preorder(root_no);
  cnt = 0;
  printf("Inorder\n ");
  inorder(root_no);
  cnt = 0;
  printf("Postorder\n ");
  postorder(root_no);

  return 0;
}


Measured memory_bytes: 3344
#pragma warning(disable:4996)

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <float.h>

#pragma region 定義
#define i_cin(X) scanf("%d", &X)
#define i_cin2(X,Y) scanf("%d %d",&X,&Y)
#define i_cin4(X,Y,Z,W) scanf("%d %d %d %d",&X,&Y,&Z,&W)
#define i_cin3(X,Y,Z) scanf("%d %d %d",&X,&Y,&Z)
#define l_cin(X) scanf("%ld",&X)
#define f_cin(X) scanf("%f",&X)
#define l_cin2(X,Y) scanf("%ld %ld",&X,&Y)
#define s_cin(X) scanf("%s",&X)
#define ll_cin(X) scanf("%lld", &X)

#define  i_cout(X) printf("%d\n",X)
#define  f_cout(X) printf("%g\n",X)
#define  i_cout2(X,Y) printf("%d %d\n",X,Y)
#define  l_cout(X) printf("%ld\n",X)
#define  s_cout(X) printf("%s\n",X)
#define  ll_cout(X) printf("%lld\n",X)

typedef long long  ll;
#define rept(x, s, n) for (int x = s; x < n; x++)

#define S_RTN(S)  s_cout(S);return 0


#define _itoa(A,N) sprintf(A, "%d", N);

int i_cins(int n, int* A);
int l_cins2(int n, long* A, long* B);
int s_dsort(const void* a, const void* b);
int s_asort(const void* a, const void* b);

int  _gcd(int a, int b);
int  _swp(int* a, int* b);
int _cknum(char* a, int n);
int _atoi(char* s, int len);


int s_asorts(const void* a, const void* b);

//昇順
int s_asorts(const void* a, const void* b) {
	return(strcmp((char*)a, (char*)b));
}
int s_dsort(const void* a, const void* b) {
	return(*(int*)b - *(int*)a);
}
int s_asort(const void* a, const void* b) {
	return(*(int*)a - *(int*)b);
}
int l_cins2(int n, long* a, long* b) {
	int i;
	rept(i, 0, n) {
		l_cin2(*(a + i), *(b + i));
	}
	return 0;
}
int i_cins(int n, int* a) {
	int i;
	for (i = 0; i < n; i++) {
		i_cin(*(a + i));
	}

	return 0;
}
int _gcd(int a, int b) {
	int r, tmp;
	if (a < b) { tmp = a; a = b; b = tmp; }
	r = a % b;
	while (r) {
		if (!r) break;
		a = b; b = r;
		r = a % b;
	}
	return(b);
}

long _max(long a, long b) {
	return a > b ? a : b;
}
long _min(long a, long b) {
	return a < b ? a : b;
}
int _swp(int* a, int* b)
{
	int tmp;
	tmp = *b; *b = *a; *a = tmp;
	return 0;
}

int _cknum(char* a, int n) {
	int i;
	char t = '0';

	for (i = 0; i < n; i++) {
		if (a[i] < '0' || a[i]>'9') return 1;
	}
	return 0;
}


int _atoi(char* s, int len) {
	char tmp[20];
	memcpy(tmp, s, len);
	tmp[len] = 0x00;
	return (atoi(tmp));
}
#pragma endregion

static int a[100001];
static int p[100001];

int main(void)
{
	int  n, k, q;
	int  i;

	i_cin3(n, k, q);
	i_cins(q, a);

	for (i = 0; i < q; i++)
		p[a[i]-1]++;


	printf("\n");
	for (i = 0; i < n; i++) {
		if (p[i]+k-q <= 0)
			printf("%s\n", "No");
		else
			printf("%s\n", "Yes");
	}
	
}



Measured memory_bytes: 1280
// 問題の URL を書いておく
// 

#include <algorithm>
#include <array>
#include <bitset>
#include <cmath>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>

using namespace std;

//#define ENABLE_PRINT

#if defined(ENABLE_PRINT)

#define Print(v) \
do {\
    cout << #v << ": " << v << endl; \
}while(0)

#define PrintVec(v) \
do {\
    for(int __i = 0; __i < v.size(); ++__i) \
    { \
        cout << #v << "[" << __i << "]: " << v[__i] << endl; \
    }\
}while(0)

#else

#define Print(v) ((void)0)
#define PrintVec(v) ((void)0)

#endif

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

using ll = int64_t;

int main(int, const char**)
{
    int n;
    cin >> n;
    vector<ll> a(n), b(n);
    rep(i, n)
    {
        cin >> a[i] >> b[i];
    }
    sort(a.begin(), a.end());
    sort(b.begin(), b.end());

    auto calcMedian = [](vector<ll>& v) -> ll
    {
        sort(v.begin(), v.end());
        auto s = v.size();
        if(s % 2 == 0)
        {
            return v[s / 2 - 1] + v[s / 2];
        }
        return v[s / 2];
    };

    auto mMin = calcMedian(a);
    auto mMax = calcMedian(b);
    cout << mMax - mMin + 1 << endl;

    return 0;
}


Measured memory_bytes: 6424
#include<bits/stdc++.h>
#define MAXN 100005
#define INF 1000000000
#define MOD 1000000007
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
ll N,X;
ll solve(ll N,ll X)
{
    if(X==0) return 0;
    if(X*2==N) return 3*X;
    if(X*2<N)
    {
        ll rem=N%X,cnt=(N-X)/X;
        if(rem==0) rem+=X,cnt--;
        return cnt*3*X+solve(rem+X,X);
    }
    else
    {
        ll rem=X%(N-X),cnt=X/(N-X);
        if(rem==0) rem+=N-X,cnt--;
        return 3*(N-X)*cnt+solve(rem+(N-X),rem);
    }
}
int main()
{
    scanf("%lld%lld",&N,&X);
    printf("%lld\n",solve(N,X));
    return 0;
}


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

using namespace std;

#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pair<int, int>> vpii;
typedef vector<pair<ll, ll>> vpll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

template<class T>
void print(vector<T>& V, bool spaced = true) {
    string space;
    spaced ? space = " " : space = "";
    for(int i = 0; i < V.size(); i++) {
        cout<< V[i] << space;
    }cout<< '\n';
}

template<class T>
void printendl(vector<T>& V) {
    for(int i = 0; i < V.size(); i++) {
        cout<< V[i] << '\n';
    }
}

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

template <class T>
T lcm (T a, T b) {
    return a / gcd(a, b) * b;
}

template<class T>
T Max(T a, T b) {
    return (a < b) ? b : a;
}

template<class T>
T Min(T a, T b) {
    return (a < b) ? a : b;
}

//str

bool isPalindrome(string str){
    
    int length = str.length();
 
    for (int i = 0; i < (length / 2); i++)
        if (str[i] != str[length - 1 - i])
            return false;
 
    return true;    
}

void reverseStr(string& str) 
{ 
    int n = str.length(); 
    for (int i = 0; i < n / 2; i++) 
        swap(str[i], str[n - i - 1]); 
}
 

//Read through the messages at the end when you're done

int main() {

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

    string s; cin>> s;
    int l = s.length();
    vector<char> v;
    rep(i, 0, l) {
        if(s[i] != 'B') {
            v.pb(s[i]);
        }else if(v.size() > 0){
            v.pop_back();
        }
    }

    print(v, false);
    
    

    
    

    return 0;
}

    //Use long long da5eel rabbak!
    //Dont use endl;
    //DONT SUBMIT IZA UR NOT SURE WALLAHI BTENDAM
    //Dear Amine, just because it worked for the test cases doesnt necessarily mean it is correct.
    //Dear Amine, try it on ur own test cases iza ur not SURE
    //In case u didnt use long long, CHECK FOR POTENTIAL OVERFLOWS
    //DONT FORGET TO MOD EVERYTHING IZA U NEED TO MOD



Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<string>
#include<set>
#include<vector>
#include<utility>
#include<algorithm>

using namespace std;

#define LL long long
string s;
int x, a, b, c;

int main() {
	cin >> a >> b >> c;
	cout << ((a < b && b < c) ? "Yes" : "No") << endl;

	return 0;
}


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

int main(){
    string s;cin>>s;
    string t;cin>>t;
    int t_l=t.size();
    int s_l=s.size();
    int c=-1;
    for(int i=s_l-1;i>t_l-2;i--){
        int idx=t_l-1;
        for(int j=i;j>i-t_l;j--){
            if(t[idx]==s[j] or s[j]=='?') idx--;
            else break;
            if(j==i-t_l+1) c=i-t_l+1;
        }
        if(c!=-1) break;
    }
    int idx=0;
    if(c==-1) cout<<"UNRESTORABLE"<<endl;
    else{
        for(int i=0;i<s_l;i++){
            if(c<=i and i<=c+t_l-1){
                cout<<t[idx];
                idx++;
            }
            else if(s[i]=='?') cout<<'a';
            else cout<<s[i];
        }
        cout<<endl;
    }   
}

Measured memory_bytes: 256
(let ((a (read))
    (b (read))
    (s (read-line))
    (ans "Yes"))

    (loop for i below (+ a b 1) do
        (if (string= (char s i) "-")
            (if (not (= i a))
                (progn
                    (setq ans "No")
                    (return)
                )
            )
            (if (= i a)
                (progn
                    (setq ans "No")
                    (return)
                )
            )
        )
    )
    (format t "~A~%" ans)
)

Measured memory_bytes: 23592
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,l,min;
  cin>>n>>l;
  int sum = (n*(2*l-1+n))/2; 
  min = l;
  for(int i=0;i<n;i++)
  {
     
     if(abs(l+i)<abs(min))min=l+i;
    }
  if(min>=0)
  cout<<sum-abs(min)<<endl;
  else cout<<sum+abs(min)<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;


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

	return 0;
}


Measured memory_bytes: 256
/*
貪欲
後ろから見る
DP
順位表をチェック



*/
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include <bitset>
#include <cmath>
#include <limits>
#include <iostream>
#include<set>
#include<tuple>
using namespace std;
#define INF 3e18+7
#define MAX 100000
#define MOD 1000000007
typedef long long ll;
typedef pair<int,int> P;
typedef pair<pair<int,ll>,ll> p;
#define bit(n,k) ((n>>k)&1) /*nのk bit目*/
#define rad_to_deg(rad) (((rad)/2/M_PI)*360)
struct edge{ll to,cost,val;};
template<class T,class U>bool chmin(T&a,const U&b){if(a<=b)return false;a=b;return true;}
template<class T,class U>bool chmax(T&a,const U&b){if(a>=b)return false;a=b;return true;}
//__builtin_popcount(S);


int main(){
    int N;
    string s;
    cin>>N>>s;
    for(int i=0;i<(int)s.size();i++){
        int x=s[i]-'A';
        x+=N;
        x%=26;
        cout<<(char)(x+'A');
    }
    cout<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 10e9+9
#define EPS 1e-10
#define MAX_N 100100
#define MAX_M 100100

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;
typedef pair<P, char> PC;

int n;
char c;
string s;

string changes(int i){
	string res;
	stringstream ss;
	ss << i;
	ss >> res;
	return res;
}

int main(){
	cin >> n;
	REP(i, n){
		cin >> c;
		s += c;
	}
	ll co = 0;
	while (1){
		//string t = changes(co);
		//cout << t << endl;
		//cout << s.find(t) << endl;
		if (s.find(changes(co)) == -1){
			cout << co << endl;
			break;
		}
		co++;

	}
}

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

namespace A
{
    public struct Node
    {
        public int parent;
        public int child;
        public int sibling;
        public int depth;
        public Tree tree;

        public string Type
        {
            get
            {
                if (parent == -1) return "root";
                else if (child == -1) return "leaf";
                else return "internal node";
            }
        }

        public int[] Children
        {
            get
            {
                var id = child;
                var list = new List<int>();
                while (id != -1)
                {
                    list.Add(id);
                    id = tree.At(id).sibling;
                }
                return list.ToArray();
            }
        }

        public void SetDepth(int depth)
        {
            this.depth = depth;
            foreach (var child in Children) tree.nodes[child].SetDepth(depth + 1);
        }
    }

    public class Tree
    {
        internal Node[] nodes;

        public Tree(int nodes)
        {
            this.nodes = new Node[nodes];
            for (int i = 0; i < nodes; i++)
            {
                this.nodes[i].depth = 0;
                this.nodes[i].parent = -1;
                this.nodes[i].child = -1;
                this.nodes[i].sibling = -1;
                this.nodes[i].tree = this;
            }
        }

        public void AddChilden(int id, params int[] children)
        {
            if (children.Length > 0) nodes[id].child = children[0];
            int last = -1;
            foreach (var node in children)
            {
                nodes[node].parent = id;
                nodes[node].SetDepth(nodes[id].depth + 1);
                if (last != -1) nodes[last].sibling = node;
                last = node;
            }
        }

        public Node At(int i)
        {
            return nodes[i];
        }
    }


    class Program
    {
        public static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var tree = new Tree(n);
            for (int i = 0; i < n; i++)
            {
                var strs = Console.ReadLine().Split(' ');
                var id = int.Parse(strs[0]);
                tree.AddChilden(id, Array.ConvertAll(strs.Skip(2).ToArray(), int.Parse));
            }
            for (int i = 0; i < n; i++)
            {
                Console.WriteLine("node {0}: parent = {1}, depth = {2}, {3}, [{4}]",
                                  i,
                                  tree.At(i).parent,
                                  tree.At(i).depth,
                                  tree.At(i).Type,
                                  string.Join(", ", Array.ConvertAll(tree.At(i).Children, (s) => s.ToString()))
                                 );

            }
        }
    }
}

Measured memory_bytes: 26852
input()
g = input()
a = list(map(str, g.split()))
b = list(map(int, g.split()))
if sorted(b) == b:
    print("YES")
else:
    m = 0
    for i in range(len(b)):
        if b[i] == sorted(b)[i]:
            m+=1
    if m==len(b)-2:
        print("YES")
    else:
        print("NO")

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

int main(){
    int n; cin>>n;
    int sum = 0;
    bool flag = false;

    for(int i=0; i<n; i++){
        sum += 4;
        if(sum == n) flag = true; 
    }
    sum = 0;

    for(int j=0; j<n; j++){
        sum += 7;
        if(sum == n) flag = true;
    }
    sum = 0;

    for(int i=0; i<n; i++){
        for(int j=round((double)n/7); j > 0; j-- ){
            sum = i*4+7*j;
            if(sum == n) flag = true;
        }
    }

    if(flag)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;

    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <functional>
#include <algorithm>
#include <string>
#include <vector>
#include <limits>
#include <numeric>
#include <type_traits>
#include <queue>
#include <math.h>
#include <queue>
#include <map>

using namespace std;

#define INF (1ll<<60)
#define INFint (1<<30)
#define MOD 1000000007
#define BOUND 27182818284

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

#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)

template<class T>
bool umax(T &a, const T &b){
    if (a<b) {
        a=b; return true;
    }
    return false;
}

template<class T>
bool umin(T &a, const T &b) {
    if (b<a) {
        a=b; return true;
    }
    return false;
}

// gcd
template<typename T>
T gcd(T a, T b){
    if(a==0)
        return b;
    return gcd(b%a,a);
}

int findGCD(int arr[], int n){
    int result = arr[0];
    for (int i=1; i < n; i++)
        result = gcd(arr[i], result);
    return result;
}

template<typename T>
T lcm( T m, T n ){
    // 引数に0がある場合は0を返す
    if ( ( 0 == m ) || ( 0 == n ) )
        return 0;
    return ((m/gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    fill( (T*)array, (T*)(array+N), val );
}


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

// v.front() = -BOUND;
// v.back() = BOUND;

//struct edge{
//    int cost, to;
//
//    edge(int in_cost, int in_to){
//        cost=in_cost;
//        to=in_to;
//    }
//    bool operator<(const edge &a) const
//    {
//        return cost > a.cost;
//    }
//};
vector<int>G[10010];
vector<int>c(10010,0);
int num[10010];
bool used[10010];
int now_c=0;
int dfs(int s){
    if(used[s]){
        return 0;
    }else{
        used[s]=true;
    }

    num[s]=c[now_c];
    now_c++;

    for(int i=0; i<G[s].size(); i++){
        dfs(G[s][i]);
    }
    return 0;
}

int main() {
    lli L,R; cin >> L >> R;

    if(R-L+1LL < 2019){
        lli ans=2019;
        for(lli i=L; i<R; i++){
            for(lli j=i+1; j<=R; j++){
                ans=min(i*j%2019, ans);
            }
        }
        cout << ans << endl;

    }else{
        cout << 0 << endl;
    }
    return 0;
}

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

int main(){
  long long N,K;
  cin >> N >> K;
  long long cnt;
  if(K%2==0){
	long long a=N/K;
	long long b=(N+K/2)/K;
	cnt=a*a*a+b*b*b;
  }else{
	long long a=N/K;
	cnt=a*a*a;
  }
	cout << cnt << endl;

  return 0;
}


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

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

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

    sort(A.begin(), A.end());
    double now = 0;
    for(int i = 0; i < n; i++){
        if(i == 0){
            now = (A[i] + A[i + 1]) / 2;
            i++;
        }else{
            now = (A[i] + now) / 2;
        }
    }

    cout << fixed << std::setprecision(10) << now << endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
import java.util.Arrays;
public class Main {
	public static void main(String[] args) {
		ABC054CSolve solve = new ABC054CSolve();
		solve.main();
	}
}

class ABC054CSolve {
	
	int N;
	int M;
	int[][] adj;
	
	int[] p;
	int count = 0;
	
	ABC054CSolve() {
		Scanner cin = new Scanner(System.in);
		this.N = cin.nextInt();
		this.M = cin.nextInt();
		this.adj = new int[N][N];
		for (int i = 0; i < M; i++) {
			int a = cin.nextInt() - 1;
			int b = cin.nextInt() - 1;
			adj[a][b] = 1;
			adj[b][a] = 1;
		}
	}
	
	void main() {
		this.p = new int[N];
		for (int i = 0; i < N; i++) { p[i] = i; }
		dfs(0, (1 << N) - 1);
		System.out.println(count);
	}
	
	void dfs(int pos, int mask) {
		if (pos == N) {
			if (isExistPath()) {
				count++;
			}
			return;
		} 
		for (int i = 0; i < N; i++) {
			if ((mask & 1 << i) >> i == 1) {
				p[pos] = i;
				dfs(pos + 1, (mask ^ (1 << i)));
			}
		}
	}
	
	boolean isExistPath() {
		if (p[0] != 0) return false;
		int curr = p[0];
		for (int i = 1; i < N; i++) {
			int next = p[i];
			if (adj[curr][next] != 1) {
				return false;
			}
			curr = next;
		}
		return true;
	}
}


Measured memory_bytes: 10636
#include <stdio.h>

int main() 
{
    int a, b;
    int i;
    int num;

    scanf("%d %d", &a, &b);

    num = a * 2 - 1;
    for (i = 0; i < num; i++) {
        printf("%d ", b - a + i + 1);
    }
    return 0;

}

Measured memory_bytes: 128
#include<iostream>
#include<cstdio>
#include<map>
#include<vector>
#include<set>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<queue>
#include<stack>
#define Max zhi5968
typedef long long ll;
using namespace std;
 
int main ()
{
	int i,j,n,m,k,a[12][12];
	cin>>n>>m;
	for(i=0;i<10;i++)
		for(j=0;j<10;j++)
			scanf("%d",&a[i][j]);
	for(i=0;i<10;i++)
		for(j=0;j<10;j++)
			for(k=0;k<10;k++)
				a[j][k]=min(a[j][k],a[j][i]+a[i][k]);
	/*cout<<endl;
	for(i=0;i<10;i++)
	{
		for(j=0;j<10;j++)
			printf("%d ",a[i][j]);
		cout<<endl;
	}*/
	ll b[210][210],ans=0;
	for(i=0;i<n;i++)
		for(j=0;j<m;j++)
		{
			int tmp;
			scanf("%d",&tmp);
			if(tmp==-1)
				continue;
			else
				ans+=a[tmp][1];
		}
	cout<<ans<<endl;	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void POSS(T condition){ if(condition) cout << "POSSIBLE" << endl; else cout << "IMPOSSIBLE" << endl; }
template<class T> inline void Poss(T condition){ if(condition) cout << "Possible" << endl; else cout << "Impossible" << endl; }
template<class T> inline void First(T condition){ if(condition) cout << "First" << endl; else cout << "Second" << endl; }
template<class T = string, class U = char>int character_count(T text, U character){ int ans = 0; for(U i: text){ ans += (i == character); } return ans; }
long power(long base, long exponent, long module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ long root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
struct position{ int y, x; }; position move_pattern[4] = {{-1, 0}, {0, 1}, {1, 0}, {0, -1}}; // double euclidean(position first, position second){ return sqrt((second.x - first.x) * (second.x - first.x) + (second.y - first.y) * (second.y - first.y)); }
template<class T, class U> string to_string(pair<T, U> x){ return to_string(x.first) + "," + to_string(x.second); }
template<class itr> void array_output(itr start, itr goal){ string ans; for(auto i = start; i != goal; i++){ ans += to_string(*i) + " "; } ans.pop_back(); cout << ans << endl; }
template<class itr> void cins(itr start, itr goal){ for(auto i = start; i != goal; i++){ cin >> (*i); } }
template<class T> T gcd(T a, T b){ if(a && b){ return gcd(min(a, b), max(a, b) % min(a, b)); }else{ return a; }} template<class T> T lcm(T a, T b){ return a / gcd(a, b) * b; }
#define mod long(1e9 + 7)
#define all(x) (x).begin(), (x).end()
#define bitcount(n) __builtin_popcountl(long(n))
#define fcout cout << fixed << setprecision(10)
#define highest(x) (63 - __builtin_clzl(x))

int main(){
    int D;
    cin >> D;
    cout << "Christmas";
    for(int i = D; i < 25; i++){
        cout << " Eve";
    }
    cout << endl;
}


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

//typedef
//------------------------------------------
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int MOD = 1000000007;

//MOD
//--------------------------------------------
#define MUL(a,b) (((a) % MOD) * ((b) % MOD)) % MOD

// grid
//--------------------------------------------
VL dx = {0, 1, 0, -1};
VL dy = {1, 0, -1, 0};
VL dx2 = {-1, 0, 1, -1, 1, -1, 0, 1};
VL dy2 = {-1, -1, -1, 0, 0, 1, 1, 1};

//debug
//--------------------------------------------
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//main code
int main(int argc, char const* argv[])
{
	string s;
	cin >> s;
	for (int mae = 0; mae < 7; mae++) {
		int usiro = 7 - mae;
		string st;
		st += s.substr(0,mae);
		st += s.substr(s.size() - usiro,usiro);
		if (st == "keyence") {
			cout << "YES" << endl;
			return 0;
		}
	}
	cout << "NO" << endl;
	return 0;
}



Measured memory_bytes: 256
/*#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("fast-math")*/
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>

using namespace std;

#define pb push_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define Str(x) to_string(x)
#define len(s) (int)s.size()

typedef long long ll;
typedef long double lld;
typedef string str;
typedef unsigned long long ull;

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    int n, r;
    cin >> n >> r;
    if (n <= 10) {
        cout << r + 100 * (10 - n);
    } else {
        cout << r;
    }

    return 0;
}


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

bool	CMPA(vector<int> a, vector<int> b) {
	return (a.at(1)<=b.at(1));
}

int	main() {
	int N;
	cin >>N;
	vector<int> A(N+2, 0);
	int S=0;
	for (int i=1; i<=N; i++) {
		cin >>A.at(i);
		S +=abs(A.at(i)-A.at(i-1));
	}
	S +=abs(A.at(N+1)-A.at(N));
	for (int i=1; i<=N; i++) 
		cout << S-abs(A.at(i)-A.at(i-1))-abs(A.at(i+1)-A.at(i))+abs(A.at(i+1)-A.at(i-1)) <<endl;
	return 0;
};


Measured memory_bytes: 1664
#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <string.h>
#include <ctype.h>
#include <algorithm>

using namespace std;

int main() {
  int n, k;
  cin >> n >> k;
  long ans = k;

  for(int i = 1; i < n; i++)
    ans *= k-1;
  
  cout << ans << endl;
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const double PI = 4*atan(1);
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3f;
const double EPS = 1e-6;
const string YES = "Possible";
const string NO = "Impossible";
#define pb push_back
#define mp make_pair

const int MAX_N = 1e5+12;
int A[MAX_N];
int N, K;

int gcd(int a, int b)
{
	if(b==0) return a;
	return gcd(b, a%b);
}

void solve()
{
	int g = A[0];
	for(int i=1;i<N;++i) g=gcd(g, A[i]);
	if(*max_element(A, A+N) < K){ 
		cout << "IMPOSSIBLE" << endl;
		return;
	}
	if(g<=K && K%g==0) cout << "POSSIBLE" << endl;
	else cout <<"IMPOSSIBLE" << endl;
}

int main()
{
	cin >> N >> K;
	for(int i=0;i<N;++i) cin >> A[i];
	solve();
	return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <functional>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

template<typename T> void chmin(T &a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T &a, T b) { if (a < b) a = b; }

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

const double pi = acos(-1.0);

int main(void){
    double a, b, h, m;
    cin >> a >> b >> h >> m;
    double d1 = m / 60.0 * 2 * pi;
    double d2 = (h / 12.0 + m / 720.0) * 2 * pi;
    double x1 = b * cos(d1), y1 = b * sin(d1);
    double x2 = a * cos(d2), y2 = a * sin(d2);
    double ans = sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
    printf("%.15f\n", ans);
    return 0;
}


Measured memory_bytes: 4100
import java.util.Scanner;

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

		int a1 = sc.nextInt();
		int a2 = sc.nextInt();
		int a3 = sc.nextInt();

		if (a1 + a2 + a3 >= 22) {
			System.out.println("bust");
		} else {
			System.out.println("win");
		}

		sc.close();
	}
}

Measured memory_bytes: 27080
n, m = map(int, input().split())

card = [[] for _ in range(n)]

for _ in range(m):
    x, y, _ = map(int, input().split())
    card[x-1].append(y-1)
    card[y-1].append(x-1)

checked = [False] * n

count = 0
import queue
q = queue.Queue()
for i in range(n):
    if checked[i]:
        continue
    count += 1
    q.put(i)
    while not q.empty():
        j = q.get()
        checked[j] = True
        for k in card[j]:
            if not checked[k]:
                q.put(k)

print (count)


    



Measured memory_bytes: 96756
ops = [op for op in input().split(" ")]
stack = []
for op in ops:
    if op == "+":
        stack = stack[:-2]+[stack[-2]+stack[-1]]
    elif op == "-":
        stack = stack[:-2]+[stack[-2]-stack[-1]]
    elif op == "*":
        stack = stack[:-2]+[stack[-2]*stack[-1]]
    else:
        stack.append(int(op))
print(stack[0])

Measured memory_bytes: 7732
#pragma region
#ifndef LOCAL_DEBUG
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#endif

#include <assert.h>
#include <math.h>

#include <algorithm>
#include <iomanip>
#include <iostream>
#include <set>
#include <vector>
#define pb push_back
#define f(i, a, b) for (int i = a; i < b; i++)
#define revf(i, b, a) for (int i = b; i >= a; i--)
#define all(v) v.begin(), v.end()
#define srt(v) sort(v.begin(), v.end())
#define revsrt(v) sort(v.rbegin(), v.rend())
#define sp << ' ' <<
#define en << '\n'
#define precision(x) cout << fixed << setprecision(x);
#define fio                \
  ios::sync_with_stdio(0); \
  cin.tie(0);              \
  cout.tie(0);

using namespace std;

template <typename T, typename U>
ostream &operator<<(ostream &os, pair<T, U> &v) {
  os << "{" << v.first << ", " << v.second << "}" en;
  return os;
}

template <typename T>
ostream &operator<<(ostream &os, set<T> &v) {
  for (T t : v) os << t << " ";
  os en;
  return os;
}

template <typename T>
ostream &operator<<(ostream &os, vector<T> &v) {
  for (T t : v) os << t << " ";
  os en;
  return os;
}

template <typename T>
istream &operator>>(istream &is, vector<T> &v) {
  int n = v.size();
  for (int i = 0; i < n; i++) is >> v[i];
  return is;
}

#define int long long
#define pii pair<int, int>
#define float long double
#define vi vector<int>
#define vvi vector<vi>
#define vpii vector<pii>
#define vvpii vector<vpii>
#pragma endregion

int mod = 1e9 + 7;  // 998244353;
const int MAX = 1e5 + 5;

void preprocessing() {}

class Graph {
 public:
  int n, m;
  vpii path;
  vi in_path;
  vvpii edges;
  vector<bool> vis;

  Graph(int N) {
    n = N;
    m = 0;
    edges.resize(n);
    vis.resize(n, 0);

    in_path.resize(n, 0);
    path.pb({-1, -1});
  }

  void add(int u, int v) {
    edges[u].pb({v, m});
    edges[v].pb({u, m});
    m++;
  }

  void dfs(int vertex, int parent, int edge, int g) {
    // if (in_path[vertex]) {
    //   return;
    // }
    if (vis[vertex]) return;

    vis[vertex] = 1;
    group[vertex] = g;
    // in_path[vertex] = path.size();
    // path.pb({vertex, edge});

    for (pii child : edges[vertex]) {
      if (child.first != parent) {
        dfs(child.first, vertex, child.second, g);
      }
    }

    // in_path[vertex] = 0;
    // path.pop_back();
    return;
  }

  vi group;
  int solve() {
    group.resize(n, 0);
    int count = 0;
    f(i, 0, n) {
      if (!vis[i]) {
        count++;
        dfs(i, -1, -1, count);
      }
    }
    vi freq(count, 0);
    f(i, 0, n) freq[group[i] - 1]++;
    int ans = freq[0];
    f(i, 0, count) ans = max(freq[i], ans);
    return ans;
  }
};

void solvetestcase() {
  int n, m;
  cin >> n >> m;
  Graph g(n);
  f(i, 0, m) {
    int u, v;
    cin >> u >> v;
    g.add(u - 1, v - 1);
  }
  cout << g.solve() en;
}

#undef int
int main() {
  fio;
  preprocessing();

  int t = 1;
  // UNCOMMENT FOR TESTCASES	\
	cin >> t;

  f(T, 1, t + 1) {
    // UNCOMMENT FOR CODEJAM,HACKERCUP	\
		cout << "Case #" << T << ": ";
    solvetestcase();
    cout.flush();
  }

  return 0;
};

/*
    AUTHOR:     KUNAL TAWATIA
    EDUCATION:  INDIAN INSTITUTE OF TECHNOLOGY, JODHPUR
*/


Measured memory_bytes: 36172
package main

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

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}
func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func main() {
	fp := os.Stdin
	if len(os.Args) > 1 {
		fp, _ = os.Open(os.Args[1])
	}

	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	buf := make([]byte, 500001)
	scanner.Buffer(buf, 500000)
	writer := bufio.NewWriter(os.Stdout)

	ll := getNextString(scanner)

	l := len(ll)
	dp := make([][2]int, l+1)
	dp[0][0] = 2
	dp[0][1] = 1

	for i := 1; i < l; i++ {
		for ii := 0; ii < 2; ii++ { // 未満確定かどうか
			if ii == 1 {
				dp[i][1] += dp[i-1][ii] * 3
				dp[i][1] %= 1000000007
				continue
			}
			dp[i][0] += dp[i-1][ii]

			if ll[i] == '1' {
				dp[i][0] += dp[i-1][ii]
				dp[i][1] += dp[i-1][ii]
			}
			dp[i][0] %= 1000000007
			dp[i][1] %= 1000000007
		}
	}

	fmt.Fprintln(writer, (dp[l-1][0]+dp[l-1][1])%1000000007)
	writer.Flush()
}


Measured memory_bytes: 2432
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <cmath>

using namespace std;
using ll = long long;
using ull = unsigned long long;

constexpr ll LLINF {1001002003004005006};//ll = 9*LLINF
constexpr int INTINF {1000000000};//int = 2*INTINF

#define  rep(i,n)   for(int i = 0; i < (n); ++i)
#define rrep(i,n)   for(int i = 1; i <= (n); ++i)
#define drep(i,n)   for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for(int i = s; i < t;  ++i)

template<typename T>
void maxs(T& x, T&& y) {
  x=std::max(x,y);
}
template<typename T>
void maxs(T& x, T& y) {
  x=std::max(x,y);
}

template<typename T>
void mins(T& x, T&& y) {
  x=std::min(x,y);
}
template<typename T>
void mins(T& x, T& y) {
  x=std::min(x,y);
}
bool include_atgc(char& c) {
  if (c == 'A') return true;
  if (c == 'T') return true;
  if (c == 'G') return true;
  if (c == 'C') return true;
  return false;
}

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

  int S_size = S.size();
  int answer {};
  rep(i, S_size) {
    if (!include_atgc(S[i])) continue;
    int tmp {1};
    srep(j, i+1, S_size) {
      if (!include_atgc(S[j])) break;
      ++tmp;
    }
    maxs(answer, tmp);
  }
  cout << answer << '\n';
}


Measured memory_bytes: 256
#include <cstdint>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

const string str1(
    {"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTU"
     "VWXYZ"});
const string str2(
    {"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstu"
     "vwxyz"});

int32_t main() {
  while (true) {
    uint32_t n = 0;
    cin >> n;
    if (n == 0) break;
    vector<uint32_t> keys;
    for (uint32_t i = 0; i < n; i++) {
      uint32_t key;
      cin >> key;
      keys.push_back(key);
    }

    string list;
    cin >> list;
    uint32_t key_index = 0;
    for (uint32_t i = 0; i < list.size(); i++) {
      char val;
      if ('A' <= list[i] && list[i] <= 'Z') {
        val = str1[str1.find(list[i], 26) - keys[key_index]];
      } else {
        val = str2[str2.find(list[i], 26) - keys[key_index]];
      }
      cout << val;
      key_index++;
      key_index %= keys.size();
    }
    cout << endl;
  }

  return 0;
}

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

A = [chr(i) for i in range(ord("a"), ord("a")+26)]

ans = 0
for i in range(N+1):
    S1 = S[:i]
    S2 = S[i:]
    cnt = 0
    for a in A:
        if a in S1 and a in S2:
            cnt += 1
    ans = max(ans, cnt)

print(ans)


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

count = [0]*(len(S)+1)
count[0] = S.count('.')
for i in range(1, len(S)+1):
    count[i] = count[i-1] + (1 if S[i-1]=='#' else 0) - (1 if S[i-1]=='.' else 0)

print(min(count))

Measured memory_bytes: 11144
#include<bits/stdc++.h>
#define ALL(c) (c).begin(),(c).end()
#define EACH(i,c) for(auto i=(c).begin();i!=(c).end();++i)
using namespace std;
#define int long long

signed main(){
	int H, W, N;
	cin >> H >> W >> N;
	set<pair<int,int>> st;
	for(int i = 0; i < N; ++i) {
		int a, b;
		cin >> a >> b;
		st.insert(make_pair(a,b));
	}
	vector<int> res(10);
	for(auto p: st) {
		for(int i = -2; i <= 0; ++i) for(int j = -2; j <= 0; ++j) {
			if(p.first + i <= 0 || H < p.first + i + 2) continue;
			if(p.second + j <= 0 || W < p.second + j + 2) continue;
			int cnt = 0;
			for(int k = 0; k < 3; ++k) for(int l = 0; l < 3; ++l) {
				int r = p.first + i + k, c = p.second + j + l;
				if(st.find(make_pair(r,c)) != st.end()) {
					++cnt;
				}
			}
			if(cnt > 0) {
				res[cnt]++;
			}
		}
	}
	res[0] = (H - 2) * (W - 2);
	for(int i = 1; i < 10; ++i) {
		res[i] /= i;
		res[0] -= res[i];
	}
	for(int i = 0; i < 10; ++i) {
		cout << res[i] << endl;
	}
	return 0;
}


Measured memory_bytes: 6528
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/adaptor/indexed.hpp>

using namespace std;
using namespace boost::adaptors;
using namespace std::string_literals;
using ll = int64_t;
using vecint = vector<int>;
using vecll = vector<ll>;
using boost::irange;

struct Data {
  ll num;
  Data() : num(0) {;}
  Data(ll n) : num(n) {;}
};

inline Data Merge(Data left, Data right) {
  return Data(left.num > right.num ? left.num : right.num);
}

struct SegmentTree {
  int n; vector<Data> data;
  SegmentTree(int N) : n(1 << N), data(n * 2) {}
  void update (int pos, Data value) {
    data[pos] = value;
    while (pos < 2*n-1) {
      int l = pos, r = pos^1;
      if (l > r) swap(l, r);
      pos = pos / 2 + n;
      data[pos] = Merge(data[l], data[r]);
    }
  }
  Data sub(int fr, int to, int node, int la, int ra) {
    if (ra<=fr || to<=la) return Data();
    if (fr<=la && ra<=to) return data[node];
    Data vl = sub(fr, to, (node-n)*2+0, la, (la+ra)/2);
    Data vr = sub(fr, to, (node-n)*2+1, (la+ra)/2, ra);
    return Merge(vl, vr);
  }
  Data query(int fr, int to) { return sub(fr, to, 2*n-2, 0, n); }
};

int main()
{
  ll n;
  cin>>n;
  SegmentTree st(18);
  vecint h(n);
  for(auto&& e:h)cin>>e;
  vecll a(n);
  for(auto&& e:a)cin>>e;
  for(auto&& i:irange(0l,n)) {
    ll tmp = st.query(0, h[i]).num + a[i];
    if (st.data[h[i]].num < tmp) {
      st.update(h[i], tmp);
    }
  }
  cout<<st.query(0, n+1).num<<endl;
  return 0;
}


Measured memory_bytes: 6656
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)

constexpr lint MOD = 998244353;

vector<lint> fac, facInv, inv;
void facInit(int nmax)
{
    fac = facInv = inv = vector<lint>(nmax + 1, 1);
    for (int i = 2; i <= nmax; i++)
    {
        fac[i] = fac[i-1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
        facInv[i] = facInv[i-1] * inv[i] % MOD;
    }
}
lint nCr(int n, int r)
{
    if (n<r || r<0) return 0;
    return (fac[n] * facInv[r] % MOD) * facInv[n-r] % MOD;
}

lint power(lint x, lint n)
{
    lint ans = 1;
    while (n>0)
    {
        if (n & 1) (ans *= x) %= MOD;
        (x *= x) %= MOD;
       n >>= 1;
    }
   return ans;
}



lint solve(int bind, int num, int K)
{
    lint ans = 0;
    IREP(i, bind + 1)
    {
        (ans += nCr(bind, i) * power(2, i) % MOD * nCr(num - i + i + K - 2 * bind - 1, num - i)) %= MOD;
    }
    return ans;
}

int K, N;

int main()
{
    cin >> K >> N;
    facInit(K + N);

    FOR(i, 2, 2 * K + 1)
    {
        cout << solve(min(i / 2, (2 * K + 2 - i) / 2), N, K) << endl;
    }
}


Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define SORT(x) sort((x).begin(),(x).end())
int main(void){
    
    int N;
    cin >>N;
    
    if(N%2==0){
        cout <<N;
    }else{
        cout <<N*2;
    }
    
    cout <<endl;
    
}


Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

func init() {
	const maxWord = (1 << 30)
	buf := []byte{}
	sc.Buffer(buf, maxWord)
	sc.Split(bufio.ScanWords)
}

func input() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	n, _ := strconv.Atoi(input())
	m, _ := strconv.Atoi(input())
	k := make([]int, m)
	p := make([]int, m)
	s := make([][]uint, m)
	for i := 0; i < m; i++ {
		k[i], _ = strconv.Atoi(input())
		tmp := make([]uint, k[i])
		for j := 0; j < k[i]; j++ {
			t, _ := strconv.Atoi(input())
			tmp[j] = uint(t)
		}
		s[i] = tmp
	}
	for i := 0; i < m; i++ {
		p[i], _ = strconv.Atoi(input())
	}

	ans := 0

	for onoff := 0; onoff < int(math.Pow(2, float64(n))); onoff++ {
		isLight := true
		for i := 0; i < m; i++ {
			sumv := 0
			for j := 0; j < k[i]; j++ {
				tmp := onoff >> (s[i][j] - 1)
				sumv += tmp % 2
			}
			if p[i] != sumv%2 {
				isLight = false
				break
			}
		}
		if isLight {
			ans++
		}
	}

	fmt.Println(ans)
}


Measured memory_bytes: 640