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


using namespace std;


int main() {
    int a, b; cin >> a >> b;
    for (int k=0; k<1e9; ++k) {
        if (abs(a-k) == abs(b-k)) {
            cout << k << endl;
            return 0;
        }
    }

    cout << "IMPOSSIBLE" << endl;
    return 0;
}



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

using i64 = int64_t;
i64 INF = 1ll << 60;

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

int main(){
  int n, k;
  cin >> n >> k;
  vector<int> h(110000);
  for(int i = 0; i < n; i++)
    cin >> h[i];
  
  vector<i64> cost(110000);
  for(int i = 0; i < cost.size(); i++)
    cost[i] = INF;
  cost[0] = 0;
  
  for(int i = 0; i < n; i++){
    for(int j = 1; j <= k; j++)
      chmin(cost[i+j], cost[i]+abs(h[i]-h[i+j]));
  }
  
  cout << cost[n-1] << endl;
  
  return 0;
  
}

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

int main(){

    string o, e;
    cin >> o >> e;

    int num = o.size() + e.size(), o_idx = 0, e_idx = 0;
    string ans;
    for (int i=0; i<num; i++){
        int temp = i + 1;
        if (temp%2 == 0){
            ans += e.at(e_idx);
            e_idx++;
        }
        else {
            ans += o.at(e_idx);
            o_idx++;
        }
    }
    cout << ans << endl;
    return 0;
}

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

int main() {
    int n; cin >> n;
    vector<int> a(n);
    for(int i = 0; i < n; i++) cin >> a[i];
    bool flag = 1;
    int count = 0;
    while(flag) {
        flag = 0;
        for(int i = n-1; i > 0; i --) {
            if(a[i]<a[i-1]) {
                swap(a[i], a[i-1]);
                count ++;
                flag = 1;
            }
        }
    }
    for(int i = 0; i < n; i ++) {
        if(i==n-1) cout << a[i] << endl;
        else cout << a[i] << " ";
    }
    cout << count << endl;
    return 0;
}


Measured memory_bytes: 3124
#abc135c

n=int(raw_input())
a=map(int,raw_input().split())
b=map(int,raw_input().split())
res=0
for i in xrange(n):
 x=min(a[i],b[i])
 res+=x
 a[i]-=x
 b[i]-=x
 x=min(a[i+1],b[i])
 res+=x
 a[i+1]-=x
 b[i]-=x
print res


Measured memory_bytes: 14520
from collections import Counter


def mapt(fn, *args):
    return tuple(map(fn, *args))


def Input():
    return mapt(int, input().split(" "))


def main():
    n, m = Input()
    data = [Input()[1:] for _ in range(n)]
    d = Counter(num for row in data for num in row)
    print(sum(value == n for value in d.values()))


main()

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


int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int t;
	t=1;
    while(t--)
    {
		int a,b,c;
		cin>>a>>b>>c;
		if(b-a==c-b)
			cout<<"YES";
		else
			cout<<"NO";
	}
    return 0;
}

Measured memory_bytes: 256
#include <cmath>
#include <iostream>
#include <map>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  int x;
  cin >> x;
  if (x >= 30) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 3600
// Author: πα

#include <bits/stdc++.h>
using namespace std;
#define long int64_t

int main()
{
    string s;
    cin >> s;
    sort(s.begin(), s.end());
    cout << (s[0] == s[1] and s[2] == s[3] and s[1] != s[2] ? "Yes" : "No");
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <string>
#include <cstring>
#include <cstdlib>
using namespace std;

#define REP(i,n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef pair<int, int> pint;
template <class T> inline void chmax(T &a, const T b) { a = max(a, b); }
template <class T> inline void chmin(T &a, const T b) { a = min(a, b); }
template <class T> void pp(T v, int n) { REP(i,n) cout<<v[i]<< ' '; cout << endl; }

void inline TorF(bool tf, const string &trueMessage, const string &falseMessage) { 
  cout << (tf ? trueMessage : falseMessage) << endl;
}
void inline YESNO(bool tf) { TorF(tf, "YES", "NO"); }
void inline YesNo(bool tf) { TorF(tf, "Yes", "No"); }

ll solve(ll a, ll b) {
  ll ans = a ;
  ans++;
  b -= a;
  b --;
  ans += (b / 2LL);
  return ans;
}

int main() {
  ll N; cin>>N;
  ll A, B; cin>>A>>B;
  ll ans = abs(B-A) / 2LL;
  if(abs(B-A) % 2LL == 0) {

  } else {
    ll tmp1 = solve(min(A, B)-1, max(A, B)-1);
    ll tmp2 = solve(N-(max(A, B)), N-min(A, B));
    ans = min(tmp1, tmp2);
  }
  cout << ans << endl;
  return 0;
}


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

int main() {
  int n, m;
  cin >> n;
  vector<pair<string, int>> a(0);
  string s;
  for (int i = 0; i < n; i++) {
    cin >> s;
    a.push_back(make_pair(s, 1));
  }
  cin >> m;
  for (int i = 0; i < m; i++) {
    cin >> s;
    a.push_back(make_pair(s, - 1));
  }
  sort(a.begin(), a.end());
  int cnt, maxy = 0, x = 0;
  for (int i = 0; i < n + m; i++) {
    cnt = 0;
    for (int j = i; j < n + m; j++) {
      if (a.at(i).first == a.at(j).first) cnt += a.at(j).second;
      else {
        maxy = max(maxy, cnt);
        i = j - 1;
        break;
      }
      if (j == n + m - 1) {
        maxy = max(maxy, cnt);
        x = 1;
      }
    }
    if (x == 1) break;
  }
  cout << maxy << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>

int main(){
	int n;
	scanf("%d",&n);
	for(;n--;){
		double a,b,r1,d,e,r2;
		scanf("%lf%lf%lf%lf%lf%lf",&a,&b,&r1,&d,&e,&r2);
		
		double di=sqrt((a-d)*(a-d)+(b-e)*(b-e));
		
		if(di+r1<r2)printf("-2\n");
		else if(di+r2<r1)printf("2\n");
		else if(di>r2+r1)printf("0\n");
		else printf("1\n");
	}
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
 
#define ll long long
 
#define fr(i,a,b) for (ll i = (a), _b = (b); i <= _b; i++)
#define frr(i,a,b) for (ll i = (a), _b = (b); i >= _b; i--)
#define rep(i,n) for (ll i = 0, _n = (n); i < _n; i++)
#define repr(i,n) for (ll i = n - 1; i >= 0; i--)
#define fill(ar,val) memset(ar, val, sizeof(ar))
#define fill0(ar) fill((ar), 0)
#define debug(x) cout<<#x<<": "<<x<<endl
 
#define ld double
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
 
typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef vector<ii> vii;
typedef vector<int> vi;
 
#define INF 1000000000000000000

ll n;
ll a[3001];
ll dp[3001][3001][2];

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

    cin >> n;

    fr(i,1,n)
    {
        cin >> a[i];
    }

    fr(i,1,n)
    {
        if(n%2)
            dp[i][i][1] = a[i];
        else
            dp[i][i][0] = a[i];
    }

    fr(i,2,n)
    {
        fr(j,1,n-i+1)
        {
            ll x = j;
            ll y = i+j-1;

            ll xx1 = dp[x][y-1][0];
            ll xx2 = dp[x][y-1][1];
            ll xx3 = dp[x+1][y][0];
            ll xx4 = dp[x+1][y][1];

            if(n%2 == i%2)
            {
                ll yy1 = xx2+a[y];
                ll yy2 = xx1;

                ll zz1 = xx4+a[x];
                ll zz2 = xx3;

                if(yy1-yy2 > zz1-zz2)
                {
                    dp[x][y][0] = yy2;
                    dp[x][y][1] = yy1;
                }
                else
                {
                    dp[x][y][0] = zz2;
                    dp[x][y][1] = zz1;
                }
            }
            else
            {
                ll yy1 = xx2;
                ll yy2 = xx1+a[y];

                ll zz1 = xx4;
                ll zz2 = xx3+a[x];

                if(yy1-yy2 > zz1-zz2)
                {
                    dp[x][y][0] = zz2;
                    dp[x][y][1] = zz1;
                }
                else
                {
                    dp[x][y][0] = yy2;
                    dp[x][y][1] = yy1;
                }
            }
        }
    }

    cout << dp[1][n][1]-dp[1][n][0] << endl;
}

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

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef vector <int> vi;
typedef vector <ll> vll;
typedef vector <vector <int>> vvi;
typedef pair <int, int> pii;
typedef pair<ll , ll> pll;
typedef vector <pair <int, int>> vpii;
typedef vector <vvi> _3dveci;


int main()
{
    int n; cin >> n;
    vvi a(n, vi (3));

    for(int i = 0; i < n; i++)
    {
        for(int j = 0; j < 3; j++)
            cin >> a[i][j];
    }

    vvi state(n, vi (3, INT_MIN));
    state[0][0] = a[0][0]; state[0][1] = a[0][1]; state[0][2] = a[0][2];
    for(int i = 1; i < n; i++)
    {
        state[i][0] = a[i][0] + max(state[i-1][1], state[i-1][2]);
        state[i][1] = a[i][1] + max(state[i-1][0], state[i-1][2]);
        state[i][2] = a[i][2] + max(state[i-1][1], state[i-1][0]);
    }

    cout << max({state[n-1][0], state[n-1][1], state[n-1][2]}) << endl;
}


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

int main() {
	int n;
	scanf("%d",&n);
	int arr[n];
	for(int i=0;i<n;i++)scanf("%d",&arr[i]);
	int ans=0,idx=1;
	for(int i=0;i<n;i++){
		if(arr[i]==idx){
			idx++;
		}else{
			ans++;
		}
	}
	if(ans==n)printf("-1");
	else printf("%d",ans);
}


Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#define _USE_MATH_DEFINES
#include<math.h>
#include<algorithm>
#include<memory>
#include<string>
#define Rep(i,n) for(int i = 0;i < (n);i++)	
typedef long long ll;

int gcd(int a, int b) { if (b == 0)  return a;  else  return gcd(b, a % b);  }
int lcm(int a, int b) { return a * b / gcd(a, b); }
void swap(int& a, int& b) { int temp = a; a = b; b = temp; return; }
int ncr(int n, int r) { int a = 1; Rep(i, r) a = (a * (n - i)) / (i + 1); return a; }
int npr(int n, int r) { int a = 1; Rep(i, r) a *= n - i; return a; }
int mod(int a, int b) { return a % b; }

class list {
public:
	class element {
	public:
		char data;
		element* next;
		element(element* _next, char item) :
			next(_next), data(item) {}
	};
	std::vector<element*> elements;
	void insert(element* l, int k, char item) {
		element* p;
		if (k > 1) { insert(l->next, k - 1, item); }
		else {
			elements.emplace_back(new element(l->next, item));
			l->next = elements.back();
		}
	}
	void erase(element* l, int k) {
		if (k > 1) { erase(l->next, k - 1); }
		else { l->next = l->next->next; }
	}
	char access(element* l, int k) {
		if (k > 1) { return access(l->next, k - 1); }
		else { return l->next->data; }
	}
	list() {elements.emplace_back(new element(NULL, NULL));}
};

class stack {
public:
	std::vector<char> box;
	int top;
	stack():top(0){}
	void push(char item) {}
};


int main() {
	std::string s;
	std::string t;
	std::cin >> s >> t;
	t = t.substr(0, t.size() - 1);
	if (s == t) {
		std::cout << "Yes";
	}
	else {
		std::cout << "No";
	}
	return 0;
}

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

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

using namespace std;
typedef unsigned long ul;
typedef pair<ul, ul> P;

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

    int h, a;
    cin >> h >> a;
    cout << (h / a) + int(bool(h % a)) << endl;


    return 0;
}


Measured memory_bytes: 256
//ABC100C
#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <numeric>
#include <math.h>
#include<stdio.h>
#include<climits>
#include<cfloat>
using namespace std;

int main(){
	int n;
	cin >> n;
	vector<int> a(n);
	int count;
	int sigma = 0;
	for(int i=0;i<n;i++){
		cin >> a.at(i);
		count = 0;
		while(1){
			if(a.at(i)%2 == 0){
				a.at(i) /= 2;
				count++;
			}else{
				break;
			}
		}
		sigma += count;
	}
	cout << sigma << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
    REP(i,v.size()){if(i)os<<" ";os<<v[i];}return os;}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
    REP(i,v.size()){if(i)os<<endl;os<<v[i];}return os;}

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

vector< vector<int> > Graph;
vector< int > value;









int main(int argc, const char * argv[]) {
    
   
    
    int n,m; cin >> n >> m;
    priority_queue<int> que;
    rep(i,n) {
        int a; cin >> a;
        que.push(a);
    }
    
    rep(i,m) {
        int newa = que.top()/2;
        que.pop();
        que.push(newa);
    }
    
    ll ans = 0;
    rep(i,n) {
        ans += que.top();
        que.pop();
    }
    
    cout << ans << endl;
    
    
    
    
    
    
    
}


Measured memory_bytes: 892
// #define _CRT_SECURE_NO_WARNINGS
// #define _USE_MATH_DEFINES	// M_PI=3.1415...
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <locale>
#include <cctype>
#include <sstream>
#include <iomanip>	// 20桁出力 cout << setprecision(20) << double;
#include <queue>
#include <bitset>	// bitset<8> bs1(131uL); // 10000011 bs1[0]は1 01stringからビット集合生成可
using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<LL> VL;
typedef map<int, int> MAPII;
typedef multimap<int, char, greater<int> > MuMAPIC;
typedef vector<pair<int, int> > VPII;
typedef multimap<int, string, greater<int> > MuMIS;
typedef pair<int, int> P;
typedef pair<int, pair<P, P> > PP;

#define MP make_pair
#define FAST_IO  cin.tie(0); ios::sync_with_stdio(false);
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FOR_REV(i,a,b) for(int i=(a);i>=(b);i--)
//for gcc (未test)
// #define FOREACH_IT(it,c) for(typeof(c)::iterator it=(c).begin(); it!=(c).end(); ++it)
//for Visual Studio
#define foreach_it(type,it,c) for(type::iterator it=c.begin(),c_end=c.end();it!=c_end;++it)
#define FOR_ITR(d) for(auto itr=d.begin(),d_end=d.end();itr!=d_end;++itr)	// C++11
// for Debug.
#define DUMP_VVI(b) FOR(i,0,b.size()){FOR(j,0,b[i].size())printf("%d ",b[i][j]);puts("");}
#define D_OUT(str,value) if(dbgF){cout<<str<<" : "<<value<<endl;}
// 入力をpush_back(d)やarray[d]に使う時に1行で書ける
// int INPUT_INT() {int d;cin>>d;return d;}
template<class T>T IN() { T d; cin >> d; return d; }
// 最大公約数（Greatest Common Divisor）
LL gcd(LL a, LL b) { return (b > 0) ? gcd(b, a%b) : a; }
// 最小公倍数（Least Common Multiple）
LL lcm(LL a, LL b) { return a / gcd(a, b) * b; }
// Y年はうるう年か否か
bool uruu(LL Y) { return (((Y % 4 == 0 && Y % 100 != 0) || Y % 400 == 0) ? true : false); }

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

// vector注意
// vec[i][j]の形に入力を入れるとき、vecは初期化してある必要がある.

// ------------------- include, typedef, define END. -------------------

int main() {
	FAST_IO;
	// for D_OUT(str, value)  ... cout<< str <<" : "<< value <<endl;
	bool dbgF = true;

	//コードはここから書く.

	string s;
	int a_pos = 200001, z_pos = 0;
	cin >> s;

	FOR(i, 0, s.length()) {
		if (s[i] == 'A') {
			a_pos = min(a_pos, i + 1);
		}
		if (s[s.length() - 1 - i] == 'Z') {
			z_pos = max(z_pos, (int)s.length() - i);
		}

		if (a_pos != 200001 && z_pos != 0) {
			cout << z_pos - a_pos + 1 << endl;
			break;
		}
	}

	return 0;
}

Measured memory_bytes: 720
package main

import "fmt"

func main() {
	var A, B, K int
	fmt.Scanf("%d", &K)
	fmt.Scanf("%d %d", &A, &B)

	c := 0
	for i := A; i <= B; i++ {
		if i%K == 0 {
			c = 1
			fmt.Println("OK")
			break
		}
	}
	if c == 0 {
		fmt.Println("NG")
	}
}

Measured memory_bytes: 1820
//#pragma GCC optimize "trapv"
#include<bits/stdc++.h>
using namespace std;
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//find_by_order(k)  returns iterator to kth element starting from 0;
//order_of_key(k) returns count of elements strictly smaller than k;
//erase,insert same as normal set

//#define      ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define        fast ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define        f first
#define        s second
#define        pb push_back
#define        eb emplace_back
#define        mp  make_pair
#define        forn(i,n) for(int i=0;i<n;++i)
#define        show(b) for(auto const&x: b) cout<<x<<" "
#define        sshow(b) for(auto x:b) cout<<x<<" "
#define        fix(b,val)   memset(b,val,sizeof(b))
#define        pill(b,n,v)  fill(b,b+n,v)
#define        itn          int
#define        w(t)     int t;cin>>t;while(t--)
#define        mx(a,b,c) max(a,max(b,c))
#define        mn(a,b,c) min(a,min(b,c))
#define        intmax    INT_MAX
#define        intmin    INT_MIN
#define        nl        "\n"
#define        prt(val)  cout<<val<<"\n"
#define        all(v)    v.begin(),v.end()
#define        trace1(x)                cerr<<#x<<": "<<x<<endl
#define        trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define        trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define        trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define        trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define        trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl

typedef       long long int ll;
typedef       long double LD;
typedef       unsigned long long int LL;
typedef       pair<int,int> pii;
typedef       pair<long long int,int> pli;
typedef       pair<int,long long int> pil;
typedef       pair<long long int,long long int> pll;
const int N=1e5+5;
const int mod=1e9+7;
//mt19937 rnd(time(NULL));

/*------Global--------*/

/*-----Functions------*/
template<typename T>
void show2d(const vector<vector<T>>& adj)
{
    for(auto x:adj)
    {
        for(auto y:x)
        { 
           cout<<y<<" ";
        }
    cout<<"\n";
    }
}

ll modexp(ll a,ll b,ll mod)
{
    ll x=1;
    while(b)
    {
        if(b&1)
        x = ((x%mod) * (a%mod))%mod;
        a = ((a%mod) * (a%mod))%mod;
        b = b / 2;
    }
    return x;
}

bool ispalindrome(ll n)
{
    ll rev=0,n1=n;
    while(n1>0)
    {
       rev=rev*10+n1%10;
       n1/=10;
    }
    return (n==rev);
}

void rf()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
}

int32_t main()
{
    fast;
    //rf();
    itn n;
    cin>>n;
    if(n >= 30)
        cout<<"Yes\n";
    else
        cout<<"No\n";
}

Measured memory_bytes: 3612
package main

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

func main() {
	sc := NewScanner()

	a := sc.NextInt()
	i := sc.NextInt()
	fmt.Printf("%+v\n", a-i+1) // output for debug
	return

}

type Scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewScanner() *Scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1000)
	return &Scanner{r: rdr}
}
func (s *Scanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *Scanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *Scanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}

func (s *Scanner) NextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			result = append(result, v)
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	result = append(result, v)

	return result
}

func (s *Scanner) NextMap() map[int]bool {
	s.pre()
	start := s.p
	mp := map[int]bool{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			mp[v] = true
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	mp[v] = true

	return mp
}

func (s *Scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *Scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}


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

#define foru(i, l, r) for(int i = (l); i <= (r); ++i)
#define ford(i, l, r) for(int i = (l); i >= (r); --i)

#define maxn 3010
#define mod 998244353LL

int a, b, c, d;
ll dp[maxn][maxn];

void norm(ll &x) {
  x %= mod;
  x = (x + mod) % mod;
}

int main(){
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
//  freopen("abc.inp", "r", stdin); freopen("abc.out", "w", stdout);
  cin >> a >> b >> c >> d;
  dp[a][b] = 1;
  foru(i, a, c) foru(j, b, d) {
    if (i > a) dp[i][j] = (dp[i][j] + dp[i-1][j] * j) % mod;
    if (j > b) dp[i][j] = (dp[i][j] + dp[i][j-1] * i) % mod;
    if (i > a && j > b) dp[i][j] = dp[i][j] - dp[i-1][j-1] * (i-1) % mod * (j-1) % mod;
    norm(dp[i][j]);
//    cerr << i <<' '<< j <<' '<< dp[i][j] <<'\n';
  }
  cout << dp[c][d];
  return 0;
}
/// :D


Measured memory_bytes: 74160
#include <stdio.h>
#include<string.h>

int main(void)
{
	int i,count=0;
	char s[7];
	scanf("%s",s);
	
	for(i=0;i<6;i++){
		if(s[i]=='1'){
			count++;
		}
	}
	
	printf("%d\n",count);
	return 0;
}

Measured memory_bytes: 128
#!/usr/bin/env python3

#import
#import math
#import numpy as np
N = int(input())
P = list(map(float, input().split()))

# dp[i][j] : i枚投げてj枚表が出る確率
dp = [[0] * (N + 1) for _ in range(N + 1)]
dp[0][0] = 1
for i, p in enumerate(P, 1):
    for j in range(i + 1):
        if j == 0:
            dp[i][j] = dp[i - 1][j] * (1 - p)

        elif j == i:
            dp[i][j] = dp[i - 1][j - 1] * p
        else:
            dp[i][j] = dp[i - 1][j] * (1 - p) + dp[i - 1][j - 1] * p

ans = 0
for i in range(N // 2 + 1, N + 1):
    ans += dp[-1][i]

print(ans)

Measured memory_bytes: 204152
#!/usr/bin/env python3


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)

def main():
    
    N = int(input())
    A = list(map(int, input().split()))

    OK = True

    for a in A:
        if a % 2 == 0:
            if a % 3 == 0 or a % 5 == 0:
                pass
            else:
                OK=False
    if OK:
        print('APPROVED')
    else:
        print('DENIED')

if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
def rotate(p,comm):
    if comm==0:
        p[0],p[1],p[2],p[27],p[28],p[29]=p[27],p[28],p[29],p[0],p[1],p[2]
        p[14],p[15]=p[15],p[14]
        p[18],p[20]=p[20],p[18]
    elif comm==1:
        p[2],p[5],p[8],p[21],p[24],p[27]=p[21],p[24],p[27],p[2],p[5],p[8]
        p[11],p[18]=p[18],p[11]
        p[12],p[14]=p[14],p[12]
    elif comm==2:
        p[6],p[7],p[8],p[21],p[22],p[23]=p[21],p[22],p[23],p[6],p[7],p[8]
        p[12],p[17]=p[17],p[12]
        p[9],p[11]=p[11],p[9]
    elif comm==3:
        p[0],p[3],p[6],p[23],p[26],p[29]=p[23],p[26],p[29],p[0],p[3],p[6]
        p[9],p[20]=p[20],p[9]
        p[15],p[17]=p[17],p[15]

def all_eq(A,left,right):
    return all(A[i]==A[left] for i in xrange(left,right))
def is_correct(p):
    return all_eq(p,9,12) and all_eq(p,12,15) and all_eq(p,15,18) and all_eq(p,18,21) and all_eq(p,0,9) and all_eq(p,21,30)

ans=8
def dfs(p,cnt,f):
    global ans
    if ans<=cnt:
        return
    if is_correct(p):
        ans=cnt
        return
    for k in xrange(4):
        if ans<=cnt+1:
            break
        if k==f:
            continue
        rotate(p,k)
        dfs(p,cnt+1,k)
        rotate(p,k)
n=input()
for _ in xrange(n):
#n=int(raw_input())
    p=map(int,raw_input().split())
    ans=8
    dfs(p,0,-1)
    print ans

Measured memory_bytes: 6556
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;cin>>n;
  if(n%2==1)cout<<n*2<<endl;
  if(n%2==0)cout<<n<<endl;
  
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF (1ll << 60)
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
using vl = vector<ll>;
using vvl = vector<vl>;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
using ll = long long;
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

void print(const std::vector<int> &v) {
    std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
    std::cout << std::endl;
}

#include <bits/stdc++.h>
using namespace std;

int N, M;

struct SegmentTree {
  private:
    int n;
    vector<ll> node;

  public:
    SegmentTree(vector<ll> v) {
        int sz = v.size();
        n = 1;
        while(n < sz) {
            n *= 2;
        }
        node.resize(2 * n - 1, INF);
        for(int i = 0; i < sz; i++) {
            node[i + n - 1] = v[i];
        }
        for(int i = n - 2; i >= 0; i--) {
            node[i] = min(node[2 * i + 1], node[2 * i + 2]);
        }
    }

    void update(int x, ll val) {
        x += (n - 1);
        node[x] = val;
        while(x > 0) {
            x = (x - 1) / 2;
            node[x] = min(node[2 * x + 1], node[2 * x + 2]);
        }
    }

    ll getmin(int a, int b, int k = 0, int l = 0, int r = -1) {
        if(r < 0) {
            r = n;
        }
        if(r <= a || b <= l) {
            return INF;
        }
        if(a <= l && r <= b) {
            return node[k];
        }

        ll vl = getmin(a, b, 2 * k + 1, l, (l + r) / 2);
        ll vr = getmin(a, b, 2 * k + 2, (l + r) / 2, r);
        return min(vl, vr);
    }
};

int main() {
    cin >> N >> M;
    SegmentTree seg(vector<ll>(N, INF));
    vector<ll> L(M), R(M), C(M);
    REP(i, M) {
        cin >> L[i] >> R[i] >> C[i];
        L[i]--;
        R[i]--;
    }
    vector<tuple<int, int, ll>> edge(M);
    REP(i, M) { edge[i] = make_tuple(L[i], R[i], C[i]); }
    sort(edge.begin(), edge.end());
    vector<ll> dp(N, INF);
    dp[0] = 0;
    seg.update(0, 0);
    REP(i, M) {
        int l = get<0>(edge[i]);
        int r = get<1>(edge[i]);
        int c = get<2>(edge[i]);
        ll t = seg.getmin(l, r);
        dp[r] = min(dp[r], t + c);
        seg.update(r, dp[r]);
    }
    ll ans = dp[N - 1];
    if(ans == INF) {
        cout << -1 << endl;
        return 0;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 6912
#include <cstdio>
#include <utility>
#include <cctype>
#include <vector>
#include <functional>
#include <cmath>
using namespace std;

#ifdef __linux
#define _U(s) s##_unlocked
#else
#define _U(s) _##s##_nolock
#define _CRT_DISABLE_PERFCRIT_LOCKS
#endif
#define gcu _U(getchar)
#define pcu _U(putchar)
#define _DEF(r, n, ...) inline r n(__VA_ARGS__) noexcept
#define _T template <typename T>
#define _HT template <typename H,typename... T>
#define _OP(t) inline operator t()
struct _in {
#ifdef _GLIBCXX_STRING
	_OP(string){string s;char c;while(isspace(c = gcu()));do{s+=c;}while(c=gcu(),c!=' '&&c!='\n'&&c!=EOF);return s;}
#define _S
#endif
	_OP(char){char c=gcu();gcu();return c;}
	_OP(double){double d; scanf("%lf",&d); gcu();return d;}
	_T _OP(T){T n{},m{1},c;while(isspace(c = gcu()));if(c=='-')m=-1,c=gcu();do{n=10*n+(c-'0'),c=gcu();}while(c>='0'&&c<='9');return m*n;}
} in;
#define _SCAN(...) _DEF(bool,scan,__VA_ARGS__)
#ifdef _S
_SCAN(string &o) {int c{gcu()};if(c==EOF)return false;else{ungetc(c,stdin);string t=move(in);o=t;return true;}}
#endif
_T _SCAN(T &o) {int c{gcu()};return c==EOF?false:(ungetc(c,stdin),o=in,true);}
_HT _SCAN(H &h,T&&... t){return scan(h)&&scan(t...);}
#define _OUT(...) _DEF(void,out,__VA_ARGS__)
#define _OUTL(...) _DEF(void,outl,__VA_ARGS__)
_OUT(bool b){pcu('0'+b);}
_OUT(const char *s){while(*s)pcu(*s++);}
_OUT(char c){pcu(c);}
#ifdef _S
_OUT(string &s){for(char c:s)pcu(c);}
#endif
_T _OUT(T n){static char b[20];char *p=b;T m=n<0?pcu('-'),-1:1;
	if(!n)*p++='0';else while(n)*p++=(char)(n%10*m+'0'),n/=10;while(p!=b)pcu(*--p);}
_OUTL(){out('\n');}
#ifdef _GLIBCXX_VECTOR
	_T _OUT(vector<T> &v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);}
#endif
_HT _OUT(H &&h, T... t){out(h);out(t...);}
template <typename... T> _OUTL(T... t){out(t...);outl();}
#define dbg(...) fprintf(stderr,__VA_ARGS__);
struct range{
	int e,b=0,s=1;range(int b,int e,int s):e(e),b(b),s(s){} range(int b,int e): e(e), b(b){} range(int e):e(e){}
	struct it{int v,s; it(int v,int s):v(v),s(s){} operator int()const{return v;} operator int&(){return v;}int operator*()const{return v;}
		it& operator++(){v+=s;return *this;} }; it begin(){return {b,s};} it end(){return {e,s};}};
#define times(i,n) for(int i=n;i;i--)

_T using V = vector<T>;

inline int log2(int n) {
	return 31 - __builtin_clz(n);
}

struct RMQ {
	V<V<int>> st;
	RMQ(V<int> &v) : st(log2(v.size()) + 1, vector<int>(v.size())) {
		st[0] = v;
		for (size_t i : range(1, st.size()))
			for (size_t j {}; j + (1 << i) <= v.size(); j++)
				st[i][j] = min(st[i - 1][j], st[i - 1][j + (1 << (i - 1))]);
	}
	int query(int l, int r) {
		int a = log2(r - l);
		return min(st[a][l], st[a][r - (1 << a)]);
	}
};

int main() {
	int n {in};
	V<V<int>> t(n);
	V<int> eu(n), n_o(n), v;
	for (int i: range(n))
		times(j, in)
			t[i].push_back(in);
	int a {};
	function<void(int, int)> e = [&] (int i, int p){
		int n {a++};
		n_o[n] = i;
		eu[i] = v.size();
		v.push_back(n);
		for (int j: t[i])
			if (j != p) {
				e(j, i);
				v.push_back(n);
			}
	};
	e(0, -1);
	RMQ rmq(v);
	times(i, in) {
		int a {eu[(int) in]}, b {eu[(int) in]};
		if (a > b)
			swap(a, b);
		outl(n_o[rmq.query(a, b + 1)]);
	}
}


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

#define ll long long

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    ll t, d;
    int cnt = 0;
    cin >> t >> d;
    d *= d;
    for(int i = 0; i < (int)t; i++){
        ll x, y;
        cin >> x >> y;
        ll ans = (pow(x, 2) + pow(y, 2));
        if(ans <= d){
            cnt++;
        }

    }
    cout<<cnt<<"\n";
}


Measured memory_bytes: 3628
//inlclude前用define 
#define _USE_MATH_DEFINES

//include
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<type_traits>
#include<numeric>
//#include<deque>
#include<iomanip>
#include<set>
#include<tuple>
#include<map>

using namespace std;

//typedef
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<char> VC;
typedef long long int ll;

//define
#define INF 1e9 
#define NUM 1000000007
#define all(x) begin(x), end(x)
#define rep(i,n) for(int i=0;i<(int)(n);i++)

int main() {
    double n;
    cin>>n;

    int num=ceil(n/2);
    cout<<fixed<<setprecision(10)<<num/n<<endl;
}



Measured memory_bytes: 256
#include <iostream>
#include<bits/stdc++.h>
#define ll long long int
#define f(i,a,b) for(ll i=a;i<=b;i++)
#define g(i,a,b) for(ll i=a;i>=b;i--)
#define F first
#define vv vector
#define S second
#define mp make_pair
#define pb push_back
#define mh make_heap
#define ph push_heap
#define pq priority_queue
using namespace std;


int main()
{

ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
ll a,b;
cin>>a>>b;
cout<<max(a-2*b,(ll)0);


}







Measured memory_bytes: 256
n = int(input())
l = list(map(int,input().split()))
ans = 0
for i in range(n):
    for j in range(i+1,n):
        for k in range(j+1,n):
            s = [l[i],l[j],l[k]]
            s.sort()
            if len(set(s))==3 and s[0]+s[1]>s[2]:
                ans+=1
print(ans)

Measured memory_bytes: 68348
#include<iostream>
#include<vector>
#include<list>
#include<math.h>


using namespace std;
using vec = vector<int>;
using lst = list<int>;

bool check(int x, lst & sosu)
{
	for(auto s : sosu)
	{
		if (sqrt(x) < s)return true;
		if (x%s == 0)return false;
	}
	return true;
}


int main()
{
	vec count(123456 * 2 + 1);
	lst sosu;
	
	count[0] = 0;
	count[1] = 0;
	count[2] = 1;
	sosu.emplace_back(2);

	for (int i = 3; i < count.size(); ++i)
	{
		count[i] = count[i - 1];
		if (check(i, sosu))
		{
			++count[i];
			sosu.emplace_back(i);
		}
	}


	int n;
	while (true)
	{
		cin >> n;

		if (n == 0)return 0;
		cout << count[2 * n] - count[n] << endl;
	}
}


Measured memory_bytes: 4172
s = input()

st =''

for i in range(len(s)):
    if s[i] == '0':
        st += '0'
    elif s[i] == '1':
        st += '1'
    elif s[i] == 'B' and len(st) != 0:
        st = st[0:len(st)-1]
print(st)

Measured memory_bytes: 3060
#include<iostream>
#include<queue>
using namespace std;
long long a[100005];
int main()
{
	long long n,m,k,price,sum=0;
	priority_queue<long long>que;
	scanf("%lld%lld",&n,&m);
	for(int i=0;i<n;i++)scanf("%lld",&a[i]);
	for(int i=0;i<n;i++)que.push(a[i]);
	while(m>0)
	{
		price=que.top();
		price/=2;
		m--;
		que.pop();
		que.push(price);
	}
	while(!que.empty())
	{
	   sum+=que.top();
	   que.pop();
	}
	printf("%lld\n",sum);
}

Measured memory_bytes: 2168
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

unsigned long f(unsigned long n, unsigned long x){
	if(n == -1){
		return 0;
	}
	else{
		return n / x + 1; 
	}
}

int main(){
	unsigned long a;
	unsigned long b;
	unsigned long x;

	unsigned long s;
	unsigned long t;
	unsigned long u;

	scanf("%ld",&a);
	scanf("%ld",&b);
	scanf("%ld",&x);
 
	printf("%ld\n",f(b,x) - f(a-1,x));

	return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main() 
{
	char s[200005];
	long int n;
	cin >> n;
	long int ans = 0;
	for (int i = 0; i <n; i++)
	{
	    cin >> s[i];
		if (s[i] == 'W')
			ans++;
	}
	long long cnt = 0;
	for (int i = n - ans; i < n; i++)
	{
		if (s[i] != 'W')
			cnt++;
	}
	cout << cnt << endl;
}


Measured memory_bytes: 3764
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)

N, X, Y = map(int, readline().split())

answer = [0 for _ in range(0, N)]
for i in range(1, N+1):
    for j in range(i, N+1):
        distance1 = abs(i-j)
        distance2 = abs(X-i) + abs(Y-j) + 1
        distance3 = abs(X-j) + abs(Y-i) + 1
        min_distance = min(distance1, distance2, distance3)
        answer[min_distance] += 1
for a in answer[1:]:
    print(a)

Measured memory_bytes: 49244
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 1e5+5;
const int maxn = 2e5+5;
int dp[50];
int num[maxn];
deque<int> q;

int main() {
	string s;
	int cnt = 0;
	int k;
	cin>>s;
	for(int i=0;i<s.length();i++){
		q.push_back(s[i]-'a');
	}
	cin>>k;
	for(int i=1;i<=k;i++){
		int t;
		cin>>t;
		if(t==1) cnt++;
		else {
			int a;
			char c;
			cin>>a>>c;
			if(a==1&&cnt%2==0) q.push_front(c-'a');
			if(a==2&&cnt%2==1) q.push_front(c-'a');
			if(a==1&&cnt%2==1) q.push_back(c-'a');
			if(a==2&&cnt%2==0) q.push_back(c-'a');
		}
	}
	if(cnt%2==1) {
		while(!q.empty()){
			cout<<(char)(q.back()+'a');
			q.pop_back();
		}
	}
	else {
		while(!q.empty()){
			cout<<(char)(q.front()+'a');
			q.pop_front();
		}
	}
	return 0;
}

Measured memory_bytes: 1920
import java.util.*;import java.io.*;import java.math.*;
public class Main{
        public static void main(String[] args){
          Scanner sc = new Scanner(System.in);
          int N = sc.nextInt();
          System.out.println(0);
          sc = new Scanner(System.in);
          String mae = sc.next();
          if(mae.equals("Vacant")){
            return;
          }
          int L = 0;
          int R = N - 1;
            while(true){
              if(R - L == 1){
                System.out.println(R);
                return;
              }
              int C = (R + L) / 2;
              System.out.println(C);
              sc = new Scanner(System.in);
              String ato = sc.next();
          		if(ato.equals("Vacant")){
                  return;
                }else if((C - L) % 2 == 0){
                  if(ato.equals(mae)){
                    L = C;
                    mae = ato;
                  }else{
                    R = C - 1;
                  }
                }else{
                  if(ato.equals(mae)){
                    R = C - 1;
                  }else{
                    L = C;
                    mae = ato;
                  }
                }
            }
        }
}


Measured memory_bytes: 35952
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
#include<vector>
#include<stack>
#include<queue>
#include<math.h>
#include<complex>
using namespace std;

int main(){
	cout << fixed << setprecision(10);
	const long double EPS=1e-8;
	long double Re,Im;
	int q;
	complex<long double>p1,p2;
	
	cin>>Re>>Im;
	p1.real(Re);
	p1.imag(Im);
	cin>>Re>>Im;
	p2.real(Re);
	p2.imag(Im);
	cin>>q;
	
	for(int i=0;i<q;i++){
		cin>>Re>>Im;
		complex<long double>tmp(Re,Im),p1_copy=p1,p2_copy=p2;
		
		
		tmp-=p1_copy;
		p2_copy-=p1_copy;
		complex<long double>p1_re=p1_copy;
		p1_copy-=p1_copy;
		tmp=tmp/p2_copy;
		complex<long double>p2_re=p2_copy;
		p2_copy=p2_copy/p2_copy;
		complex<long double>res=tmp;
		res.imag(-res.imag());
		
		
		res*=p2_re;
		res+=p1_re;
		cout<<res.real()<<" "<<res.imag()<<endl;
	}
	
}


Measured memory_bytes: 3296
-- Your code here!
import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS
import Data.List
 
readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

main = do
    [a,b] <- getIntList
    
    putStrLn $ if (a+b)`mod`2==0 then show((a+b)`div`2) else "IMPOSSIBLE"
    

Measured memory_bytes: 380
#include<cstdio>
int five(int i){
    int s = i*i*i*i*i;
    return s;
}

int main(){
    int X;
    scanf("%d", &X);
    int Xhalf = X/2;
    int root = 1;
    int sam=0;
    while(sam < Xhalf){
        sam = five(root);
        root++;
    }
    root--;
    int ans_1, ans_2;
    int i=1;
    while(i <= X){
        if(X%i == 0){
            int sum = five(root) - five(root - i);
            int rroo = root;
            while(sum<X){
                rroo++;
                sum = five(rroo) - five(rroo - i);
            }
            if(sum == X){
                ans_1 = rroo;
                ans_2 = rroo - i;
                break;
            }
        }
        i++;
    }
    printf("%d %d", ans_1, ans_2);
    return 0;
}

Measured memory_bytes: 1732
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rep2(i,n) for (int i = 1; i < (n); ++i)
using namespace std;
typedef long long ll;
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    string S;
    cin >> S;
    string str = "ACGT";
    int maxsize = 0;
    for (int i = 0; i < S.size(); i++) {
        for (int j = 1; j <= S.size() - i; j++) {
            string substr = S.substr(i,j);
            bool test2 = true;
            for (int k = 0; k < substr.size(); k++) {
                bool test = false;
                for (int m = 0; m < 4; m++) {
                    if(str[m] == substr[k]) test = true;
                }
                if(test == false) test2 = false;
            }
            if(test2 == true) maxsize = max(maxsize, int(substr.size()));
        }
    }
    cout << maxsize << endl;
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int a, b, c;
int main () {
cin >> a >> b >> c;
if ((c >=  a) && (c < b)) {
	cout << "Yes" << endl;
}
else if ((a == b) && (b == c) && (a == c)){
	cout << "Yes" << endl;
}
else {
	cout << "No" << endl;
}
}


Measured memory_bytes: 256
def solve():
    a, n, m = map(int, input().split())

    max_y = len(str(m)) * 9
    count = 0
    for y in range(1, max_y + 1):
        x = (y + a) ** n
        if x <= m and y == sum([int(i) for i in str(x)]):
            # print(x, y, a)
            count += 1
    print(count)


if __name__ == '__main__':
    solve()



Measured memory_bytes: 5608
package main

import (
	"bufio"
	"fmt"
	"io"
	"math"
	"os"
	"strconv"
	"strings"

)


func main() {
	solve(os.Stdin, os.Stdout)
}

type ReaderEx struct {
	baseScanner *bufio.Scanner
	words       []string
	nextWordIdx func() int
	initWordIdx func(int)
}

func NewScannerEx(stdin io.Reader) *ReaderEx {
	var this ReaderEx
	var idx int
	var wordsCnt int
	this.baseScanner = bufio.NewScanner(stdin)
	this.baseScanner.Buffer(make([]byte, 0), 1E+11)
	this.nextWordIdx = func() int {
		cur := idx
		idx = (idx + 1) % wordsCnt
		return cur
	}
	this.initWordIdx = func(wc int) {
		idx = 0
		wordsCnt = wc
	}
	return &this
}

func (me *ReaderEx) Scan(doSplit bool) (isScanned bool) {
	isScanned = me.baseScanner.Scan()
	if doSplit {
		me.words = strings.Fields(me.baseScanner.Text())
	} else {
		me.words = []string{me.baseScanner.Text()}
	}
	me.initWordIdx(len(me.words))
	return
}

func (me *ReaderEx) nextBytes() []byte {
	return []byte(me.words[me.nextWordIdx()])
}
func (me *ReaderEx) nextString() string {
	return me.words[me.nextWordIdx()]
}

type StringArray []string

func (me *ReaderEx) nextStringArray() StringArray {
	return me.words[me.nextWordIdx():]
}

func (me StringArray) toStrings() []string {
	return me
}

func (me StringArray) toInts() []int {
	strValues := me.toStrings()
	values := make([]int, len(strValues))
	for i, v := range strValues {
		n, err := strconv.Atoi(v)
		if err != nil {
			panic(err)
		}
		values[i] = n
	}
	return values
}
func (me *ReaderEx) nextInt() int {
	n, err := strconv.Atoi(me.words[me.nextWordIdx()])

	defer func() {
		if err != nil {
			panic(fmt.Sprintf("getInt(%d)", n))
		}
	}()
	return n
}

func pow(x, y, mod int) (ans int) {

	ans = 1
	for bit := 1 << uint(math.Floor(math.Log2(float64(y)))); ; bit >>= 1 {
		if y&bit != 0 {
			ans *= x
			if mod > 0 {
				ans %= mod
			}
		}
		if bit <= 1 {
			return
		}
		ans *= ans
		if mod > 0 {
			ans %= mod
		}
	}
}

type factType struct {
	prime int
	count int
}

func fact(n int) (facts []*factType) {

	for i := 2; i*i <= n; i++ {
		if n%i == 0 {
			fa := factType{prime: i}
			for n%fa.prime == 0 {
				n /= fa.prime
				fa.count++
			}
			facts = append(facts, &fa)
		}
	}
	if n > 1 {
		facts = append(facts, &factType{prime: n, count: 1})
	}
	return facts
}
func dec2bin(n int) (ret []bool) {
	for bit := 1 << uint(math.Floor(math.Log2(float64(n)))); ; bit >>= 1 {
		ret = append(ret, n&bit != 0)

		if bit <= 1 {
			return
		}
	}

}

func abs(v int) int {
	if v < 0 {
		v = -v
	}
	return v
}

func b2i(b bool) (i int) {
	if b {
		i = 1
	} else {
		i = 0
	}
	return
}

func solve(stdin io.Reader, stdout io.Writer) {

	r := NewScannerEx(stdin)
	r.Scan(true)
	_, m := r.nextInt(), r.nextInt()
	r.Scan(true)
	h := append([]int{0}, r.nextStringArray().toInts()...)
	pt := make([]int, len(h))
	for i := 0; i < m; i++ {
		r.Scan(true)
		rt := r.nextStringArray().toInts()

		if h[rt[0]] <= h[rt[1]] {
			pt[rt[0]]--
		}
		if h[rt[1]] <= h[rt[0]] {
			pt[rt[1]]--
		}
	}

	ans := 0
	for _, v := range pt[1:] {
		if v == 0 {
			ans++
		}
	}
	fmt.Fprintln(stdout, ans)
}


Measured memory_bytes: 13088
#include <bits/stdc++.h>
#include <time.h>
//#include <random>
//#ifndef _LOCAL
//#pragma GCC optimize("-O3")
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#endif
#define sz(x) int(x.size())
#define in(x) freopen(x, "r", stdin)
#define out(x) freopen(x, "w", stdout)
#define N 2 * 100500
#define oo ll(1e16)
#define pii pair <int, int>
#define pll pair <ll, ll>
#define ft first
#define sd second
#define pb push_back
#define ppb pop_back
#define el '\n'
#define elf endl
#define base ll(1e9 + 7)
#define re return
#define nins 4294967295
using namespace std;
typedef long long ll;
typedef long double ld;

//mt19937 rnd(0);

ll n, cnt[N];

void solve() {
    cin >> n;
    for (int i = 1; i < n; i++) {
        int x; cin >> x; x--;
        cnt[x]++;
    }

    for (int i = 0; i < n; i++)
        cout << cnt[i] << el;
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    #ifdef _LOCAL
//        in("input.txt");

        int t = 1;
//        cin >> t;
        for (int i = 1; i <= t; i++) {
            cout << "Test #" << i << elf;

            clock_t start_time = clock();

            solve();

            cerr.precision(4); cerr << fixed;
            cerr << elf;
            cerr << "Time :: " << ld(clock() - start_time) / CLOCKS_PER_SEC << elf;

            cout << elf;
        }
    #else
        int t = 1;
//        cin >> t;

        while (t--) {
            solve();
            cout << el;
        }
    #endif
}


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


int main(){
    int n;
    string a,b,c;
    cin>>n>>a>>b>>c;
    int ans=0;
    for(int i=0;i<n;i++){
        if(a[i]!=b[i]&&b[i]!=c[i]&&c[i]!=a[i]) ans+=2;
        else if(a[i]==b[i]&&b[i]==c[i]) ans+=0;
        else ans++;
    }
    cout<<ans<<endl;
    return 0;
}




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

int main(){
    int A,B,C,D;
    cin >> A >> B >> C >> D;
    if ((A + B) > (C + D)){
        cout << "Left" << endl;
    }
    else if ((A + B) == (C + D)){
        cout << "Balanced" << endl;
    }
    else{
        cout << "Right" << endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = int(a); i < int(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define all(x) (x).begin(), (x).end()
template <typename T> bool chmax(T &a, const T &b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T> bool chmin(T &a, const T &b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}
const long long INFLL = 1LL << 60;
const long long MOD = 1e9 + 7;

int main() {
    ll a, b, c;
    cin >> a >> b >> c;
    ll d = c - a - b;
    cout << (((d > 0) && (d * d - 4 * a * b > 0)) ? "Yes" : "No") << endl;
}

Measured memory_bytes: 3624
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
using namespace std;

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }


string str[3];

char solve() {
    int it[3];
    it[0] = it[1] = it[2] = 0;
    int who = 0;
    while (true) {
        if (it[who] >= str[who].size()) return 'A' + who;
        char c = str[who][it[who]];
        ++it[who];
        if (c == 'a') who = 0;
        else if (c == 'b') who = 1;
        else who = 2;
    }
    
}

int main() {
    while (cin >> str[0] >> str[1] >> str[2]) {
        cout << solve() << endl;
    }
}




























Measured memory_bytes: 256