akhauriyash/Code-Regression huggingface dataset:
def argsort(arr, reverse=False, shift=20):
    N = len(arr)
    tmp=[0]*N
    for i in range(N):
        tmp[i] = (arr[i] << shift) | i
    tmp = sorted(tmp,reverse=reverse)
    out=[0]*N
    mask = (1<<shift) - 1
    for j in range(N):
        i = tmp[j] & mask
        out[j] = i
    return out

def dfs(G1,a0,seen,postorder,order):
    todo = [~a0, a0]
    while todo:
        a = todo.pop()
        if a >= 0:
            seen[a] = 1
            for b in G1[a]:
                if seen[b]: continue
                todo.append(~b)
                todo.append(b)
        else:
          if postorder[~a] == -1:
            postorder[~a] = order
            order += 1
    return seen,postorder,order
  
def dfs2(G2,v,seen):
    todo = [v]
    seen[v] = 1
    cc = [v]
    while todo:
        v = todo.pop()
        for next_v in G2[v]:
            if seen[next_v]: continue
            seen[next_v] = 1
            todo.append(next_v)
            cc.append(next_v)
    return cc,seen
  
def scc(G1,G2):
  N = len(G1)
  seen = [0]*N
  postorder=[-1]*N
  order = 0
  for i in range(N):
    if seen[i]:continue
    seen,postorder,order = dfs(G1,i,seen,postorder,order)

  seen = [0]*N
  scclist = []
  for i in argsort(postorder,reverse=True):
    if seen[i]:continue
    cc,seen = dfs2(G2,i,seen)
    scclist.append(cc)
  return scclist

def main():
  N,M = map(int,input().split())
  G1 = [[] for _ in range(N)]
  G2 = [[] for _ in range(N)]
  for i in range(M):
    a,b=map(int,input().split())
    G1[a].append(b)
    G2[b].append(a)
  scclist = scc(G1,G2)
  print(len(scclist))
  for cc in scclist:
    print(len(cc),*cc)
    
if __name__=="__main__":
  main()

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

constexpr int MaxN = 200000;

int main()
{
	int N;
	int* A = new(int[MaxN]);

	cin >> N;

	for (int i = 0; i < N; ++i)
	{
		A[i] = 0;
	}

	int j;
	for (int i = 0; i < N - 1; ++i)
	{
		cin >> j;
		A[j - 1] += 1;
	}

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

	return 0;
}

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

int ans[4][110];

int main(){
	int n;
	cin >> n;
	int a[4][110];
	rep(i,2){
		rep(j,n){
			cin >> a[i][j];
		}
	}
	
	ans[0][0] = a[0][0];
	
	rep(i,2){
		rep(j,n){
			if(i == 0 && j == 0){
				continue;
			} else if (i == 0){
				ans[i][j] = ans[i][j-1] + a[i][j];
			} else if (j == 0){
				ans[i][j] = ans[i-1][j] + a[i][j];
			} else{
				ans[i][j] = max(ans[i-1][j] + a[i][j], ans[i][j-1] + a[i][j]);
			}
		}
	}
	
	cout << ans[1][n-1] << endl;
	
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi=vector<int>;
using pii=pair<int,int>;
#define pb push_back
#define fi first
#define se second
#define rep(i,a,b) for(int i=int(a);i<=(int)(b);i++)
#define per(i,a,b) for(int i=int(a);i>=(int)(b);i--)
const int mod = 1e9+7;
const int maxn = 2e3+10;
const int inf = 0x3f3f3f3f;
ll dp[maxn][maxn];
int main() {
    ios::sync_with_stdio(false);cin.tie(nullptr);
    int n;
    cin>>n;
    dp[0][0]=1;
    ll ans=0;
    rep(i,1,2000) {
        ll sum=0;
        rep(j,3,2000) {
            sum+=dp[i-1][j-3];
            sum%=mod;
            dp[i][j]=sum;
            if(j==n) ans+=dp[i][j],ans%=mod;;
        }
    }
    cout<<ans<<'\n';
    return 0;
}


Measured memory_bytes: 35056
#include<bits/stdc++.h>
using namespace std;
const int N=2e5+2;
const int LIM=1e6+2;
int ar[N],ans[LIM];
deque<int> lis,dp,lis1;
signed main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n,i,j,k,l,sum=0,q;
	cin>>n;
	for(i=1;i<n;i++){
		cin>>ar[i];
		if(i>2){
			sum+=ar[i];
		}
	}
	for(i=0;i<LIM;i++){
		dp.push_back(i);
	}
	for(i=3;i<n;i++){
		for(j=0;j<=ar[i];j++){
			lis.push_back(dp.front());
			lis1.push_back(dp.front());
			dp.pop_front();
		}
		for(j=0;j<=ar[i];j++){
			dp.push_front(lis1.back());
			lis1.pop_back();
		}
		for(j=0;j<ar[i];j++){
			dp.pop_back();
		}
		lis.pop_front();
		for(j=ar[i];j>0;j--){
			dp.push_front(lis.front());
			lis.pop_front();
		}
	}
	for(i=0;i<LIM;i++){
		ans[i]=dp.front()+ar[1]-ar[2];
		dp.pop_front();
	}
	cin>>q;
	for(i=1;i<=q;i++){
		cin>>j;
		if(j>=sum){
			cout<<j-sum+ar[1]-ar[2]<<'\n';
		}
		else{
			cout<<ans[j]<<'\n';
		}
	}
}

Measured memory_bytes: 12528
A, B, C = map(int, input().split())

K = int(input())

cnt = 0

while True:
    if A >= B:
        B *= 2
        cnt += 1

    if B >= C:
        C *= 2
        cnt += 1

    if (A < B) & (B < C):
        break

    
print("Yes" if cnt <= K else "No")

Measured memory_bytes: 9180
#include <bits/stdc++.h>
using namespace std;
// type alias
typedef long long LL;
typedef pair<int,int> II;
typedef tuple<int,int,int> III;
typedef vector<int> VI;
typedef vector<string> VS;
typedef unordered_map<int,int> MAPII;
typedef unordered_set<int> SETI;
template<class T> using VV=vector<vector<T>>;
// minmax
template<class T> inline T SMIN(T& a, const T b) { return a=(a>b)?b:a; }
template<class T> inline T SMAX(T& a, const T b) { return a=(a<b)?b:a; }
// repetition
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)
#define REPE(i,n)  for(int i=0;i<=(n);++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define FORR(x,arr) for(auto& x:arr)
#define SZ(a) int((a).size())
// collection
#define ALL(c) (c).begin(),(c).end()
// DP
#define MINUS(dp) memset(dp, -1, sizeof(dp))
#define ZERO(dp) memset(dp, 0, sizeof(dp))
// stdout
#define println(args...) fprintf(stdout, ##args),putchar('\n');
// debug cerr
template<class Iter> void __kumaerrc(Iter begin, Iter end) { for(; begin!=end; ++begin) { cerr<<*begin<<','; } cerr<<endl; }
void __kumaerr(istream_iterator<string> it) { (void)it; cerr<<endl; }
template<typename T, typename... Args> void __kumaerr(istream_iterator<string> it, T a, Args... args) { cerr<<*it<<"="<<a<<", ",__kumaerr(++it, args...); }
template<typename S, typename T> std::ostream& operator<<(std::ostream& _os, const std::pair<S,T>& _p) { return _os<<"{"<<_p.first<<','<<_p.second<<"}"; }
#define __KUMATRACE__ true
#ifdef __KUMATRACE__
#define dump(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); __kumaerr(_it, args); }
#define dumpc(ar) { cerr<<#ar<<": "; FORR(x,(ar)) { cerr << x << ','; } cerr << endl; }
#define dumpC(beg,end) { cerr<<"~"<<#end<<": "; __kumaerrc(beg,end); }
#else
#define dump(args...)
#define dumpc(ar)
#define dumpC(beg,end)
#endif

// $ cp-batch GoodDistance | diff GoodDistance.out -
// $ g++ -std=c++14 -Wall -O2 -D_GLIBCXX_DEBUG -fsanitize=address GoodDistance.cpp && ./a.out

/*
 
 7/7/2019
 
 5:02-5:06 AC
 
 https://img.atcoder.jp/abc133/editorial.pdf
 
 */

const int MAX_N=15+1;
LL A[MAX_N][MAX_N];
int N,D;

void solve() {
  int res=0;
  REP(j,N)REP(i,j) {
    int x=0;
    REP(k,D) x+=(A[i][k]-A[j][k])*(A[i][k]-A[j][k]);
    int y=sqrt(x)+0.5;
    res+=(y*y==x);
  }
  cout<<res<<endl;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout<<setprecision(12)<<fixed;
  
  cin>>N>>D;
  REP(i,N)REP(j,D) {
    cin>>A[i][j];
  }
  solve();
  
  return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define veci vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define vec2(a,b) vector<vec>(a,vec(b))
#define vec2ll(a,b) vector<vec>(a,vecll(b))
#define vec3(a,b,c) vector<vector<vec>>(a,vec2(b,c))
#define vec3ll(a,b,c) vector<vector<vecll>>(a,vec2ll(b,c))
#define fi first
#define se second
#define all(c) begin(c),end(c)
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))


using namespace std;
int in() {int x;cin>>x;return x;}
ll lin() {ll x;cin>>x;return x;}
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 T> inline void print(pair<T,T> p){cout<<"("<<p.first<<","<<p.second<<") ";}
template<class T> inline void print(vector<pair<T,T>> v){for(auto e:v)print(e); cout<<endl;}
template<class T> inline void print(T v){for(auto e:v)cout<<e<<" ";cout<<endl;}
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
    for(T& x:vec) is >> x;
    return is;
}
const ll INF=1e9+100;

int main()
{
    string s,t,u;
    ll a,b;
    cin >> s >> t >> a >> b >> u;
    if(u==s){
        cout << a-1 <<" "<< b << endl;
    }
    else{
        cout << a <<" " << b-1 << endl;
    }
    return 0;
} 

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define inf 1e9
#define ll long long 
#define M 1000000007
#define P pair<int,int>
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define rep(i,n) FOR(i,0,n)
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define PI 3.14159265

int n,d,x;
ll sum;

int main(){
  cin>>n>>d>>x;
  rep(i,n){
    int a;
    cin>>a;
    sum+=d/a;
    if(d%a)
      sum++;
  }
  sum+=x;

  cout<<sum<<endl;

  return 0;
}




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

#define ll long long
#define fore(i, n) for(i=0;i<n;i++)

template<typename T>
void output_vector(const vector<T>&v, int start=-1, int end=-1)
{
	if(start<0)start=0;
	if(end<0)end=v.size();
	
	for (int i = start; i < end; i++)
        cout << v[i]<<"\n";
}

int main() {
	
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	string s; cin>>s;
	ll i, ctr=0, mx=0;
	fore(i, s.length())
	{
	    if(s[i]=='R') ctr++;
	    else{
	        mx=max(mx, ctr);
	        ctr=0;
	    }
	}
	if(ctr>0)
	    mx=max(mx, ctr);
	cout<<mx<<endl;
	return 0;
}

Measured memory_bytes: 3648
#include <iostream>

using namespace std;

int main(void) {
	int R, G, B, N;
	cin >> R >> G >> B >> N;

	int count = 0;
	for (int r = 0; r <= N; r+=R)
	{
		for (int g = 0; g <= N; g+=G)
		{
			int b = N - r - g;
			if (b >= 0 && b%B == 0)
			{
				count++;
			}
		}
	}

	cout << count << endl;
	return 0;
}

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

int main(){
    int k,n; cin >> k >> n;
    vector<int> v;
    for(int i=0;i<n;i++){
        int a; cin >> a;
        v.push_back(a);
    }
    sort(v.begin(),v.end());
    int ans=1e9;
    for(int i=0;i<n;i++){
        int bigger=v[(i+n-1)%n];
        int smaller=v[i];
        if(bigger<smaller) bigger+=k;
        ans=min(ans,bigger-smaller);
    }
    cout << ans << endl;
    return 0;
}

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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a.at(i);
  vector<int> b(n);
  rep(i,n) cin >> b.at(i);
  vector<int> c(n-1);
  rep(i,n-1) cin >> c.at(i);
  rep(i,n) a.at(i)--;
  // a.at(i) = a.at(i) - 1;

  int ans = 0;
  rep (i,n) {
    ans += b.at(a.at(i));
  }

  rep (i,n-1) {
    if (a.at(i) + 1 == a.at(i + 1)) {
      ans += c.at(a.at(i));
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

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

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

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

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define Rep(i, n,m) for (int i = (int)(n); i < (int)(m); i++)

#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort(ALL(V))

typedef long long ll;

//vector<string> split(string,string);

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

bool isR(string s);

int main()
{
    int N;
    cin >> N;
    string s;
    cin >> s;
    int count = 0;
    rep(i,N-2)
    {
        if(s[i] == 'A')
        {
            if(s[i+1] == 'B')
            {
                if(s[i+2] == 'C')
                    count++;
            }
        }
    }
    cout << count;
}

Measured memory_bytes: 384
import sys
input = sys.stdin.readline
n,m=map(int,input().split())
g=[[]for _ in range(n)]
for _ in range(m):
    a,b=map(int,input().split())
    g[a-1].append(b-1)
    g[b-1].append(a-1)

u=g[0]
for v in u:
    if n-1 in g[v]:
        print("POSSIBLE")
        exit()
print("IMPOSSIBLE")


Measured memory_bytes: 74956
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;
 

//result = Math.pow(num1, num3)
//StringBuffer str = new StringBuffer(hoge1);
//String hoge2 = str.reverse().toString();
//map.containsKey(A)

//Map<String, Integer> map = new HashMap<String, Integer>(n);
/*for ( キーのデータ型 key : マップの名前.keySet() ) {
	データのデータ型 data = マップの名前.get( key );
	
	// keyやdataを使った処理;
}*/
//int i = Integer.parseInt(s);

//ArrayList<String> cc = new ArrayList<>(n);
//Collections.sort(list);
//Array.sort(list);
//Arrays.asList(c).contains("a")
//list.set(1,"walk");
public class Main {
	private static Scanner sc = new Scanner(System.in);
	static void p(String ans) {System.out.println(ans);};
	static void p(int ans) {System.out.println(ans);};
	static void p(long ans) {System.out.println(ans);};
	static void p(double ans) {System.out.println(ans);};
	static String s;
	public static void main(String[] args) {
		int N=sc.nextInt();
		long memo[]=new long[100];
		for(int i=0;i<=N;i++) {
			if(i==0) {
				memo[i]=2;
				continue;
			}else if(i==1) {
				memo[i]=1;
				continue;
			}
			memo[i]=memo[i-1]+memo[i-2];	
		}
		p(memo[N]);
		
		
		
	}
	
	

	
	
	
}


Measured memory_bytes: 22868
n = int(input())
s = input()


ans = 0
for i in range(n-1):
    x = s[:i+1];y = s[i+1:]
    xs = set();ys = set()
    for v in x:
        xs.add(v)
    for v in y:
        ys.add(v)
    ans = max(len(xs & ys),ans)
print(ans)

Measured memory_bytes: 3060
#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>
#include <unordered_map>
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; }


long long N, A, B, X[110000];

int main() {
  while (cin >> N >> A >> B) {
	long long res = 0;
	for (int i = 0; i < N; ++i) cin >> X[i];
	for (int i = 0; i+1 < N; ++i) {
	  long long tmp = min(A * (X[i+1] - X[i]), B);
	  res += tmp;
	}
	cout << res << endl;
  }
}
  





Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define endl '\n'
#define INF (1 << 21)
const int MOD = 1000000009;
using namespace std;
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  int m, e, j;
  
  cin >> n;
  while(n != 0){
    for(int i = 0;i < n;i++){
      cin >> m >> e >> j;
      if(m == 100 || e == 100 || j == 100 || (m + e) / 2 >= 90 || (m + e + j) / 3 >= 80){
	cout << "A" << endl;
      }else if((m + e + j) / 3 >= 70 || ((m + e + j) / 3 >= 50 && m >= 80 || e >= 80)){
	cout << "B" << endl;
      }else{
	cout << "C" << endl;
      }
    }
    cin >> n;
  }
  return 0;
}




Measured memory_bytes: 3164
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll int
using namespace __gnu_pbds;
using namespace std;
#define mod 1000000007
#define endl "\n"
#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define lb lower_bound
#define f(i,p,n) for(ll i=p;i<n;i++)
#define debug(x) cout<<"["<<#x<<": "<<x<<"]"<<endl
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;

ll exp(ll a,ll b,ll m);

ll dp[100005]={0};
vector<ll> tr[100005];

ll dfs(ll a)
{	
	if(dp[a]!=0) return dp[a];
	ll ma = 0;
	f(i,0,tr[a].size())
	{
		ma = max(ma,dfs(tr[a][i]));
	}
	dp[a] = ma+1;
	return ma+1;
}
int main()
{
 ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
 		/*
 	#ifndef ONLINE_JUDGE
        freopen("/home/savish/Desktop/2019/io/input.txt", "r", stdin);
        freopen("/home/savish/Desktop/2019/io/output.txt", "w", stdout);
    #endif
        */
    ll n,m;
    cin>>n>>m;
    f(i,1,n+1) dp[i] = 0;
    ll x,y;
    f(i,0,m)
    {
    	cin>>x>>y;
    	tr[x].pb(y);
    }
    ll ans = 0;
    f(i,1,n+1) if(dp[i]==0) ans = max(ans,dfs(i));
    cout<<ans-1<<endl;
    
return 0;
}

ll exp(ll a,ll b,ll m)
{
	if(b==0)
	{
		return 1;
	}
	ll temp =exp(a,b/2,m);
	temp=(temp*temp)%m;
	if(b&1)
	{
		return (temp*(a%m))%m;
	}
	return temp;
}


Measured memory_bytes: 8192
N,M = map(int,raw_input().split())

edge= [[] for i in range(N)]

for i in range(M):
    a,b = map(int,raw_input().split())
    edge[a-1].append(b)
    edge[b-1].append(a)

def search(v,edge,cl,count):
    come_list = cl[:]
    come_list[v-1]=1
    if sum(come_list)==N:
         return count+1
    else:
        for e in edge[v-1]:
            if come_list[e-1]==0:
                count=search(e,edge,come_list,count)
    return count
            
cl = [0 for i in range(N)]
print search(1,edge,cl,0)

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


void solve(int n) {
  int mod = (int)pow(8.0,10.0);
  bool start = false;
  while(mod != 0) {
    int x = n / mod;
    if(x != 0) start = true;
    if(start) {
      int res = x;
      if(res >= 4) res++;
      if(res >= 6) res++;
      cout << res;
      n -= x * mod;
    }
    mod /= 8;
  }
  cout << endl;
}

int main() {
  int n;
  while(cin >> n,n) {
    solve(n);
  }
}

Measured memory_bytes: 868
#include<iostream>
#include<string>
using namespace std;
int main(void)
{
  string S;
  cin >> S;
  int tmp=0;
  int max=0;
  for(int i=0;i<S.size();i++){
    if(S[i] =='A'||S[i]=='T'||S[i]=='C'||S[i]=='G') tmp++;
    else{
      if(max<tmp) max = tmp;
      tmp=0;
    }
  }
  max<tmp?max=tmp:tmp=0;
  
  cout << max;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
int n,k,i;
long long a[1000];
scanf("%d %d",&n,&k);
a[0]=k;
for(i=1;i<n;i++)
a[i]=(k-1)*a[i-1];
printf("%d\n",a[n-1]);
return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define rep(i,x,y) for(int i=x;i<y;i++)
#define range(a) (a).begin(),(a).end()
#define print(A,x,n) rep(i,0,n){cout<<(i ? " ":"")<<A[i]x;}cout<<endl;
#define pprint(A,y,m,n) rep(j,0,m){print(A[j],y,n);}
const long mod=998244353;
const int siz=1e5;
const long inf=1e9;
int digit(long a){
    int res = 0;
    while(a > 0){
        res += a % 10;
        a /= 10;
    }return res;
}
int main(){
	int K; cin>>K;
    long a = 1, b = 0;
    set<long> st;
	rep(i,0,16){
        long t = b; int j = 0;
		while(t <= a * digit(t)){
            if(j % 10 != 9) st.insert(t);
            t += a; j++;
		}a *= 10; (b *= 10) += 9;
	}
    /*long t = *st.rbegin() + 1;
    for(auto it = st.rbegin(); it != st.rend(); it++){
        if((*it) * digit(t) > t * digit(*it)) cout<<*it<<endl;
        t = *it;
    }*/
    int cnt = 0; st.erase(0);
    for(long v:st){
        cout<<v<<endl;
        if(++cnt == K) break;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <set>
#include <vector>
#include <utility>
#include <queue>
#include <cmath>

#define BEGIN(x) x.begin()
#define END(x) x.end()
#define ALL(x) BEGIN(x), END(x)
#define PAIR make_pair
#define VEC(type) vector<type >

using namespace std;

typedef long long lint;

void io_init()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
};

int main(int argc, char **argv)
{
    io_init();

    // Actual program code starts here.
    string S, T;
    cin >> S >> T;
    map<char, vector<int> > index;
    for (int i = 0;i < S.size(); i++) {
        index[S[i]].push_back(i);
    }

    lint i = 0;
    for (char c : T) {
        if (index[c].empty()) {
            cout << -1 << endl;
            return 0;
        }

        int n = S.size();
        int pos = lower_bound(ALL(index[c]), (int)(i % n)) - BEGIN(index[c]);
        if (pos == index[c].size()) {
            i = i + n - i % n + index[c][0] + 1;
        } else {
            i += index[c][pos] - i % n + 1;
        }
    }

    cout << i << endl;
    return 0;
};


Measured memory_bytes: 1228
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
#define F first
#define S second

ll n,m;
vector<pll> A;

bool judge(ll r){
    for(int i=0;i<n && r>0;i++){
        if(A[i].F>=r){r--;}
    }
    return r==0;
}

int main(){
    cin>>n>>m;
    A.resize(n);
    for(auto &I:A){cin>>I.F>>I.S;}
    sort(A.begin(),A.end(),greater<pll>());
    ll l=1,r=m+1;
    while(r-l>0){
        ll m=l+(r-l)/2;
        if(judge(m)){l=m+1;}
        else{r=m;}
    }
    l--;
    ll w=0;
    priority_queue<ll> Q;
    ll cnt=0;
    for(;l>0;l--){
        while(w<n && A[w].F>=l){Q.push(A[w].S); w++;}
        assert(!Q.empty());
        Q.pop();
        cnt++;
    }
    while(w<n){Q.push(A[w].S); w++;}
    w=m;
    while(!Q.empty() && w>=r){
        ll a=Q.top(); Q.pop();
        if(a<=w){w--; cnt++;}
    }
    cout<<n-cnt<<endl;
    
    
    return 0;
}


Measured memory_bytes: 5492
//
//  main.cpp
//  ABC120
//
//  Created by hiroaki on 2019/03/13.
//  Copyright © 2019年 hiroaki. All rights reserved.
//

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;

//~Qustion B~
/*int gcd(int x, int y){
    int a = max(x, y);
    int b=min(x,y);
    int r=a%b;
    
    while (r!=0) {
        a=b;
        b=r;
        r=a%b;
    }
    return b;
}
int main() {
    int a,b,k,n;
    cin >>a>>b>>k;
    vector<int> v;
     n = gcd(a, b);
    for (int i=0; i*i <= n; i++) {
        if (n%(i+1)==0) {
            if (i+1==n/(i+1)) {
                v.push_back(i+1);
            }else {
                v.push_back(i+1);
                v.push_back(n/(i+1));
                
            }
        }
    }
    sort(v.begin(), v.end());
    cout<<v[v.size()-k]<<endl;
    return 0;
}*/

int main(){
    string s;
    cin >> s;
    long l =s.size();
    int c[2]={0};
    for (int i=0; i<l; i++) {
        if (s[i]=='0') {
            c[0]++;
        }else{
            c[1]++;
        }
    }
        cout<<min(c[0],c[1])*2<<endl;
    return 0;
}



Measured memory_bytes: 512
class PriorityQueue
  def initialize(&comp)
    @heap = []
    @node_num = 0
    if !block_given?
      @comp = Proc.new { |x, y| x <= y }
    else
      @comp = comp
    end
  end
  attr_reader :heap
 
  def push(x)
    i = @node_num # 自分のノード番号
    @node_num += 1
    while i > 0
      par = (i - 1) / 2 # 親のノード番号
      break if @comp.call(@heap[par], x) # 逆転してないなら抜ける
      # 親ノードを下ろして自分を上に
      @heap[i] = @heap[par]
      i = par
    end
    @heap[i] = x
  end
 
  alias_method(:<<, :push)
 
  def pop
    # 最(小|大)値
    ret = @heap[0]
    # 根にもってくる値
    @node_num -= 1
    x = @heap[@node_num]
    # 根から下ろしていく
    i = 0
    while i * 2 + 1 < @node_num
      # 子どうしを比較
      a, b = i * 2 + 1, i * 2 + 2
      a = b if b < @node_num && @comp.call(@heap[b], @heap[a])
      break unless @comp.call(@heap[a], x)
      @heap[i] = @heap[a]
      i = a
    end
    @heap[i] = x
    ret
  end
 
  def get
    @node_num == 0 ? nil : @heap[0]
  end
 
  def empty?
    get.nil?
  end
end

n, m = gets.split.map(&:to_i)
a = gets.split.map(&:to_i)
q = PriorityQueue.new { |x, y| x > y }
a.each do |e|
  q.push e
end

m.times do
  q.push(q.pop / 2)
end
puts q.heap.inject(:+)


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

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i = 0; i < N - 1; ++i) {
    cin >> A[i];
  }

  vector<int> ans(N);
  for (int i = 0; i < N - 1; ++i) {
    ++ans[A[i] - 1];
  }

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

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

using namespace std;
using ll = long long;

//container util
#define SORT(c) sort((c).begin(),(c).end())
#define all(a) (a).begin(), (a).end()

//repetition
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//print
#define pv(val) cerr << #val << '=' << (val) << endl

const int INF = 1e9;
int ceil(int x, int y){
	return (x + y - 1) / y;
}

int main(void){

	int N; cin >> N;

	int ans = 1000 * ceil(N, 1000) - N;
	cout << ans << endl;



	return 0;

}


Measured memory_bytes: 3632
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int N = Integer.parseInt(br.readLine());
		String[] get = br.readLine().split(" ");

		List<Integer> ls = new ArrayList<Integer>();

		for(int i = 0;i<get.length;i++){
			ls.add(Integer.parseInt(get[i]));
		}

		List<Integer> sorted = new ArrayList<Integer>(ls);


		sorted.sort(null);
		int left = sorted.get(ls.size()/2-1);
		int right = sorted.get((ls.size()/2));

		for(int j = 0;j<get.length;j++){
			if(ls.get(j) > left)System.out.println(left);
			else System.out.println(right);
		}






	}

}


Measured memory_bytes: 109820
import operator

N = int(raw_input())

A = [int(raw_input())-1 for i in range(N)]

Dindices = [i for (i,a) in sorted(enumerate(A), key=operator.itemgetter(1))]

print sum(1 for (i,Di) in enumerate(Dindices) if (Di-i)%2 == 1) // 2

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

int main()
{
    int N;
    cin >> N;
    for(int i = 0; i <= N / 4; i++) {
        for(int j = 0; j <= N / 7; j++) {
            if(i * 4 + j * 7 == N) {
                cout << "Yes";
                return 0;
            }
        }
    }
    cout << "No";
    return 0;
}


Measured memory_bytes: 256
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>

#define int long long
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(a) (a).begin(), (a).end()
#define SZ(a) (signed)((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())

using namespace std;

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;

const int MOD = 1000000007;

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

signed main(void) {
    ios::sync_with_stdio(false);
    cout.setf(ios::fixed, ios::floatfield);
    cout.precision(10);
    cin.tie(0);

    string s;
    cin >> s;
    if(s.length()<4){
        cout << "No" << endl;
    }else if(s.substr(0,4)!="YAKI"){
        cout << "No" << endl;
    }else{
        cout << "Yes" << endl;
    }

    return 0;
}


Measured memory_bytes: 888
class Vec2:
    def __init__(self, y, x):
        self.y = y
        self.x = x

    def __add__(self, other):
        assert isinstance(other, Vec2)
        return Vec2(self.y+other.y, self.x+other.x)

    def __sub__(self, other):
        assert isinstance(other, Vec2)
        return Vec2(self.y - other.y, self.x - other.x)

    def __mul__(self, other):
        if isinstance(other, Vec2):
            return self.y * other.y + self.x * other.x
        else:
            return Vec2(self.y * other, self.x * other)

    def __str__(self):
        return str((self.y, self.x))

    def size(self):
        return (self.x**2 + self.y**2)**0.5

    def projection(self, vec):
        p = self*vec/self.size()**2
        return self*p


def main():
    x_p1, y_p1, x_p2, y_p2 = map(int, input().split())
    p1 = Vec2(y_p1, x_p1)
    p2 = Vec2(y_p2, x_p2)
    p1p2 = p2-p1
    q = int(input())
    for _ in range(q):
        x_q, y_q = map(int, input().split())
        p1q = Vec2(y_q, x_q) - p1
        p1x = p1p2.projection(p1q)
        x = p1 + p1x
        print(x.x, x.y)


if __name__ == "__main__":
    main()



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

bool pal(string s) {
  string t = s;
  reverse(t.begin(), t.end());
  return s == t;
}

int main() {
  string S;
  cin >> S;
  int N = S.size();
  if (!pal(S)) return cout << "No" << "\n", 0;
  string l = S.substr(0, N / 2);
  string r = S.substr(N / 2 + 1);
  cout << ((pal(l) && pal(r)) ? "Yes" : "No") << "\n";
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(int (i) = (s);(i) <= (e);(i)++)
#define all(x) x.begin(),x.end()
struct revran {
  const i64 b, e;
  struct iter {
    i64 i;
    constexpr iter(const i64 i) noexcept: i(i) {}
    void operator++() noexcept { --i; }
    constexpr i64 operator*() const noexcept { return i; }
    constexpr bool operator!=(const iter x) const noexcept { return i != x.i; }
  };
  constexpr revran(const i64 e) noexcept: b(0), e(e) {}
  constexpr revran(const i64 b, const i64 e) noexcept: b(b), e(e) {}
  constexpr iter begin() const noexcept { return iter(e - 1); }
  constexpr iter end() const noexcept { return iter(b - 1); }
};

struct ran {
  const i64 b, e;
  struct iter {
    i64 i;
    constexpr iter(const i64 i) noexcept: i(i) {}
    void operator++() noexcept { ++i; }
    constexpr i64 operator*() const noexcept { return i; }
    constexpr bool operator!=(const iter x) const noexcept { return i != x.i; }
  };
  constexpr ran(const i64 e) noexcept: b(0), e(e) {}
  constexpr ran(const i64 b, const i64 e) noexcept: b(b), e(e) {}
  constexpr iter begin() const noexcept { return iter(b); }
  constexpr iter end() const noexcept { return iter(e); }
  constexpr revran rev() const noexcept { return revran(b, e); }
};

constexpr ran rin(const i64 e) noexcept { return ran(1, e + 1); }
constexpr ran rin(const i64 b, const i64 e) noexcept { return ran(b, e + 1); }

int main() {
  i64 N;
  cin >> N;
  vector<i64> d(N), rd(N);
  for(auto& x: d) cin >> x;
  auto check = [](vector<i64>& R) {
    i64 MAX = 0;
    for(int i = 0;i < R.size();i++) {
      if(MAX < i * 10) {
        return false;
      }
      MAX = max(MAX, R[i] + i * 10);
    }
    return true;
  };
  bool A = check(d);
  reverse(all(d));
  bool B = check(d);
  if(A & B) {
    cout << "yes" << endl;
  }
  else {
    cout << "no" << endl;
  }
}



Measured memory_bytes: 7568
/*
        _            _                  _            _       _     _         _   _          _          _             _        
       / /\         / /\               / /\         / /\    / /\  /\ \      /\_\/\_\ _     /\ \       /\ \     _    /\ \      
      / /  \       / /  \             / /  \       / / /   / / /  \ \ \    / / / / //\_\   \ \ \     /  \ \   /\_\ /  \ \     
     / / /\ \__   / / /\ \           / / /\ \__   / /_/   / / /   /\ \_\  /\ \/ \ \/ / /   /\ \_\   / /\ \ \_/ / // /\ \_\    
    / / /\ \___\ / / /\ \ \         / / /\ \___\ / /\ \__/ / /   / /\/_/ /  \____\__/ /   / /\/_/  / / /\ \___/ // / /\/_/    
    \ \ \ \/___// / /  \ \ \        \ \ \ \/___// /\ \___\/ /   / / /   / /\/________/   / / /    / / /  \/____// / / ______  
     \ \ \     / / /___/ /\ \        \ \ \     / / /\/___/ /   / / /   / / /\/_// / /   / / /    / / /    / / // / / /\_____\ 
 _    \ \ \   / / /_____/ /\ \   _    \ \ \   / / /   / / /   / / /   / / /    / / /   / / /    / / /    / / // / /  \/____ / 
/_/\__/ / /  / /_________/\ \ \ /_/\__/ / /  / / /   / / /___/ / /__ / / /    / / /___/ / /__  / / /    / / // / /_____/ / /  
\ \/___/ /  / / /_       __\ \_\\ \/___/ /  / / /   / / //\__\/_/___\\/_/    / / //\__\/_/___\/ / /    / / // / /______\/ /   
 \_____\/   \_\___\     /____/_/ \_____\/   \/_/    \/_/ \/_________/        \/_/ \/_________/\/_/     \/_/ \/___________/    
                                                                                                                              
*/
#include<bits/stdc++.h>
using namespace std;
#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, n) for(int i = 0;i < (n);++i)

#define endl '\n'
#define pb emplace_back
#define mkp make_pair
#define p_q priority_queue
#define INF 2000000000
#define PI 3.1415926
#define coutdb cout << fixed << setprecision(13)

const int dx[]={1,0,-1,0}, dy[]={0,-1,0,1};
const int dx_8[]={1,1,0,-1,-1,-1,0,1}, dy_8[]={0,-1,-1,-1,0,1,1,1};
const long long MOD = 1e9+7;

typedef long long ll;
// #define int long long

template <typename T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template <typename T> inline T LCM(T a,T b){T c=GCD(a,b);a/=c;return a*b;}
template <typename T> inline T nCr(T a,T b){T i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
template <typename T> inline T nHr(T a,T b){return nCr(a+b-1,b);}

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

  int n, k; cin >> n >> k;
  double ans = 0.0;
  for(int i = 1; i <= n; i++){
    if(i < k){
      int tmp = i, cnt = 0;
      while(tmp < k){
        tmp *= 2; cnt++;
      }
      ans += (1.0 / (double)n) * (1.0 / pow(2.0, (double)cnt));
    } else {
      ans += (1.0 / (double)n);
    }
  }
  coutdb << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>

using namespace std;

inline int read()
{
	int x=0;char ch=getchar();
	while(ch<'0' || '9'<ch)ch=getchar();
	while('0'<=ch && ch<='9')x=x*10+(ch^48),ch=getchar();
	return x;
}

typedef long long ll;
const int N=400009;
const ll md=924844033;

int n,m,l;
int to[N<<1],nxt[N<<1],beg[N],tot;
int rev[N<<1],siz[N];
ll a[N<<1],b[N<<1],fac[N],inv[N];

inline void chk(ll &a){if(a<0)a+=md;}

inline ll qpow(ll a,ll b)
{
	ll ret=1ll;
	while(b)
	{
		if(b&1ll)
			ret=ret*a%md;
		a=a*a%md;
		b>>=1;
	}
	return ret;
}

inline void add(int u,int v)
{
	to[++tot]=v;
	nxt[tot]=beg[u];
	beg[u]=tot;
}

inline void dfs(int u,int fa)
{
	a[n]++;siz[u]=1;
	for(int i=beg[u];i;i=nxt[i])
		if(to[i]!=fa)
		{
			dfs(to[i],u);
			siz[u]+=siz[to[i]];
			chk(--a[siz[to[i]]]);
		}
	chk(--a[n-siz[u]]);
}

inline void NTT(ll *a,int n,bool f)
{
	for(int i=0;i<n;i++)
		if(i<rev[i])
			swap(a[i],a[rev[i]]);
	for(int h=2;h<=n;h<<=1)
	{
		ll w=qpow(5,(md-1)/h);
		if(f)w=qpow(w,md-2);
		for(int j=0;j<n;j+=h)
		{
			ll wn=1;
			for(int k=j;k<j+(h>>1);k++)
			{
				ll x=a[k],y=wn*a[k+(h>>1)]%md;
				a[k]=(x+y)%md;
				a[k+(h>>1)]=(x-y+md)%md;
				wn=wn*w%md;
			}
		}
	}

	if(f)
		for(ll i=0,invn=qpow(n,md-2);i<n;i++)
			a[i]=a[i]*invn%md;
}

inline void init()
{
	fac[0]=1;
	for(ll i=1;i<N;i++)
		fac[i]=fac[i-1]*i%md;
	inv[N-1]=qpow(fac[N-1],md-2);
	for(ll i=N-1;i>=1;i--)
		inv[i-1]=inv[i]*i%md;
}

int main()
{
	if(fopen("vj.in","r"))
	{
		freopen("vj.in","r",stdin);
		freopen("vj.out","w",stdout);
	}

	init();
	n=read();
	for(int i=1,u,v;i<n;i++)
	{
		u=read();v=read();
		add(u,v);add(v,u);
	}
	dfs(1,1);

	for(int i=1;i<=n;i++)
		a[i]=a[i]*fac[i]%md;
	for(int i=1;i<=n;i++)
		b[i]=inv[n-i];

	for(m=1,l=0;m<=(n<<1);m<<=1)l++;
	for(int i=0;i<m;i++)
		rev[i]=(rev[i>>1]>>1)|((i&1)<<(l-1));

	NTT(a,m,0);NTT(b,m,0);
	for(int i=0;i<m;i++)
		a[i]=a[i]*b[i]%md;
	NTT(a,m,1);

	for(int i=1;i<=n;i++)
		printf("%lld\n",a[n+i]*inv[i]%md);
	return 0;
}


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

#define I inline
#define fi first
#define se second
#define R register
#define LL long long
#define mp make_pair
#define reg register int
#define pii pair<int,int>
#define fo(i, a, b) for(reg i = a; i <= b; i++)
#define fd(i, a, b) for(reg i = a; i >= b; i--)
#define cr const reg&
using namespace std;
const int N = 11, mod = 998244353;

I int _max(cr x, cr y) {return x > y ? x : y;}
I int _min(cr x, cr y) {return x < y ? x : y;}
I int read() {
	reg x = 0, f = 1; char ch = getchar();
	while(ch < '0' || ch > '9') {if(ch == '-') f = -1; ch = getchar();}
	while(ch >= '0' && ch <= '9') x = (x << 3) + (x << 1) + (ch ^ 48), ch = getchar();
	return x * f;
}
I void ptt(LL x) {if(x >= 10) ptt(x / 10); putchar(x % 10 + '0');}
I void put(LL x) {x < 0 ? putchar('-'), ptt(-x) : ptt(x);}
I void pr1(LL x) {put(x), putchar(' ');}
I void pr2(LL x) {put(x), puts("");}

char ss[N][N];
int f[N][N], g[N][N], C[N][N];
int bin[N], h1[1 << 10][N], h2[1 << 10][N];

int main() {
	reg n = read(), m = read();
	fo(i, 1, n) scanf("%s", ss[i] + 1);
	C[0][0] = bin[0] = 1;
	fo(i, 1, N - 1) {
		C[i][0] = 1, bin[i] = bin[i - 1] << 1;
		fo(j, 1, i) C[i][j] = (C[i - 1][j - 1] + C[i - 1][j]) % mod;
	} f[0][0] = 1;
	fo(s, 0, 2 * N - 2) fo(i, 0, _min(s, N - 1)) {
		reg j = s - i; if(j >= N) continue;
		fo(k, 1, N - 1 - i) f[i + k][j] = (f[i + k][j] + (LL)f[j][i] * C[i + k][k]) % mod;
	} fo(i, 0, N - 1) fo(j, 0, i) f[i][j] = f[j][i] = (f[i][j] + f[j][i]) % mod; f[0][0] = 1;
	fo(i, 1, N - 1) fo(j, 1, N - 1) fo(x, 0, i) fo(y, 0, j) g[i][j] = (g[i][j] + (LL)f[x][y] * f[i - x][j - y] % mod * C[i][x] % mod * C[j][y]) % mod;
	fo(i, 1, bin[n] - 1) fo(j, 1, m){
		bool c1 = 0, c2 = 0;
		fo(k, 1, n) if(i >> k - 1 & 1) c1 |= ss[k][j] == '.', c2 |= ss[k][j] == '#';
		h1[i][j] = c1 & c2;
	} fo(i, 1, bin[m] - 1) fo(j, 1, n) {
		bool c1 = 0, c2 = 0;
		fo(k, 1, m) if(i >> k - 1 & 1) c1 |= ss[j][k] == '.', c2 |= ss[j][k] == '#';
		h2[i][j] = c1 & c2;
	} reg ans = f[n][m];
	fo(i, 1, bin[n] - 1) fo(j, 1, bin[m] - 1) {
		reg s1 = n, s2 = m;
		bool c1 = 1, c2 = 1;
		fo(k, 1, n) if(i >> k - 1 & 1) c1 &= h2[j][k], s1--;
		fo(k, 1, m) if(j >> k - 1 & 1) c2 &= h1[i][k], s2--;
		if(!c1 || !c2) continue;
		if(!s1 && !s2) ans++;
		else if(!s1 || !s2) ans = (ans + bin[s1 + s2]) % mod;
		else ans = (ans + g[s1][s2]) % mod;
	} pr2(ans);
	return 0;
}



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

int main(void){
  char *s, *t;
  s = malloc(sizeof(char*));
  t = malloc(sizeof(char*));
  scanf("%10s", s);
  scanf("%11s", t);
  if(strcmp(s,t) == 0) {
    printf("No");
  } else {
    while(*s == *t) {
      s++;
      t++;
    }
    if(*s == '\0')
      printf("Yes");
    else printf("No");
  }
  return 0;
}



Measured memory_bytes: 1720
#include <string>
#include <iostream>
#include <stack>
#include <queue> // priority_queue も入ってる
#include <set>   // 要素数は size() で取得 multisetもある
#include <map>
#include <array> // sizeはコンパイル時定数で固定
#include <vector>
#include <numeric>   // accumulate, gcd
#include <algorithm> // count_ifに必要
#include <iomanip>   // cout << setprecision(15) << x で小数の出力精度を指定
#include <tuple>
#include <utility> //pair
#include <cmath>
#include <random>

using namespace std;
// 問題が起こるまでintは使用禁止2020-04-13
using ll = long long;

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

template <class InputIterator, class T>
bool contains_itr(InputIterator iterator, const T &value)
{
    if (find(iterator.begin(), iterator.end(), value) == iterator.end())
        return false;
    else
        return true;
}

template <class T>
bool contains_set(set<T> st, const T &value)
{
    if (st.find(value) == st.end())
    {
        return false;
    }
    else
    {
        return true;
    }
}

template <class InputIterator>
auto sum(InputIterator iterator)
{
    return accumulate(iterator.begin(), iterator.end(), 0);
}

// endは排他的(exclusive)なので注意
vector<ll> range(ll begin, ll end)
{
    vector<ll> result;
    for (ll i = begin; i < end; ++i)
    {
        result.push_back(i);
    }
    return result;
}

random_device seed_gen;
mt19937 engine(seed_gen());
// 0, 1, 2 のどれかが得られる一様分布
// uniform_int_distribution<> dist(0, 2);
// cout << dist(engine) << endl;
// みたいに、先に確率分布を宣言して、そこにengineを与えて使う。

// =========ここまでテンプレ============

int main()
{
      bool aho[60000000000];
  for(ll i=0;i<60000000000;++i){
    aho[i]=true;
    }
    ll n, x, t;
    cin >> n >> x >> t;
    ll m = n / x;
    if (n % x != 0)
    {
        ++m;
    }
    cout << t * m << endl;
    return 0;
}


Measured memory_bytes: 3148
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

k=II()
seven=7%k
fin=set([seven])
for i in range(10**6):
    if seven==0:
        print(i+1)
        break
    seven=(seven*10+7)%k
    if seven in fin:
        print(-1)
        break
    fin.add(seven)


Measured memory_bytes: 77940
fun main(A: Array<String>) {
    val (n, x, y) = readLine()!!.split(" ").map { it.toInt() }
    var c = 0
    val a = Array<Int>(n) { 0 }

    for (i in 1..n) {
        for (j in i + 1..n) {
            ++a[Math.min(j - i, Math.abs(j - y) + 1 + Math.abs(x - i))]
        }
    }
    a.drop(1).forEach(::println)
}


Measured memory_bytes: 43224
#-swank
(unless (member :child-sbcl *features*)
  (quit
   :unix-status
   (process-exit-code
    (run-program *runtime-pathname*
                 `("--control-stack-size" "128MB"
                   "--noinform" "--disable-ldb" "--lose-on-corruption" "--end-runtime-options"
                   "--eval" "(push :child-sbcl *features*)"
                   "--script" ,(namestring *load-pathname*))
                 :output t :error t :input t))))
(defmacro dp (name args memo-size &body body)
  (let ((memo (gensym)))
    `(let ((,memo (make-array ,memo-size :initial-element nil)))
       (defun ,name ,args
         (or (aref ,memo ,@args)
             (setf (aref ,memo ,@args)
                   ,@body))))))

(defun split (x str)
  (let ((pos (search x str))
        (size (length x)))
    (if pos
        (cons (subseq str 0 pos)
              (split x (subseq str (+ pos size))))
        (list str))))

(defmacro collect-times (time body)
  `(loop repeat ,time collect ,body))

(defun read-times (time)
  (collect-times time (read)))

(defmacro aif (expr then else)
  `(let ((it ,expr))
     (if it ,then ,else)))

(defmacro awhen (expr &rest then)
  `(aif ,expr (progn ,@then) nil))

(defun comulative (function list &key base)
  (if base
      (comulative function (cons base list))
      (do ((lst (cdr list) (cdr lst))
           (acc (list (car list))))
          ((null lst) (reverse acc))
        (push (funcall function (car acc) (car lst)) acc))))

(defun binary-search (function left right
                      &optional
                        (eps 1)
                        (average-function (lambda (x y) (ash (+ x y) -1))))
  (if (<= (abs (- left right)) eps)
      right
      (let ((mid (funcall average-function left right)))
        (if (funcall function mid)
            (binary-search function left mid eps average-function)
            (binary-search function mid right eps average-function)))))

(defun arithmetic-mean (&rest body)
  (/ (apply #'+ body) (length body)))

(defvar +MOD+ (+ (expt 10 9) 7))

(defun mapa-b (fn a b &optional (step 1))
  (do ((i a (+ i step))
       (result nil))
      ((> i b) (nreverse result))
    (push (funcall fn i) result)))

(defun map0-n (fn n)
  (mapa-b fn 0 n))

(defun map1-n (fn n)
  (mapa-b fn 1 n))

(defun main (a b k &aux (x (1- k)))
  (let ((lst-a (mapa-b (lambda (x) x) a (min b (+ a x))))
        (lst-b (mapa-b (lambda (x) x) (max a (- b x)) b)))
    (sort (union lst-a lst-b) #'<)))

(let ((a (read))
      (b (read))
      (k (read)))
  (loop for i in (main a b k)
        do
        (format t "~a~%" i)))


Measured memory_bytes: 23352
//#include<bits/stdc++.h>
#include <stdio.h>
#include <iostream>
#include <iomanip>
#include <fstream>
#include <string.h>
#include <stdlib.h>
#include <time.h>
#include <limits.h>
#include <math.h>
#include <algorithm>
#include <deque>
#include <queue>
#include <stack>
#include <list>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <string>
#include <vector>
#include <bitset>
#include <functional>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef double db;
typedef long double ldb;
#define rep(i,a,b) for(i=a;i<b;i++)
#define repu(i,a,b) for(i=a;i<=b;i++)
#define repd(i,a,b) for(i=a;i>=b;i--)
#define repc(i,a,b,c) for(i=a;i<b;i+=c)
#define repcu(i,a,b,c) for(i=a;i<=b;i+=c)
#define repcd(i,a,b,c) for(i=a;i>=b;i-=c)
#define FIN freopen("input.in","r",stdin)
#define FOUT freopen("output.out","w",stdout)
#define CC(a) memset(a,0,sizeof(a))
#define PII pair<int,int>
#define PLL pair<LL,LL>
#define VI vector<int>
#define VII vector<PII>
#define VLL vector<PLL>
#define all(x) x.begin(),x.end()
#define mp make_pair
#define pb push_back
#define pf push_front
#define fi first
#define se second

template<typename T>inline void gn(T &x){
	x=0;T f=1;char ch=getchar();
	while(!isdigit(ch)){if(ch=='-')f=-1;ch=getchar();}
	while(isdigit(ch)){x=x*10+ch-'0';ch=getchar();}
	x*=f;
}
template<typename T>inline void gt(T x){
	if(!x)return;
	gt(x/10);putchar(x%10+'0');
}

int t,n,m,ans;
int MOD=1e9+7;
int cnt[100005],vis[100005];

int main()
{
	int i,j,k,l,r;
	gn(n);gn(m);
	repu(i,1,n)cnt[i]=1,vis[i]=0;vis[1]=1;
	repu(i,1,m){
		gn(j);gn(k);
		if(vis[j])vis[k]=1;
		cnt[j]--;
		cnt[k]++;
		if(vis[j]&&!cnt[j])vis[j]=0;
	}
	repu(i,1,n)ans+=vis[i];
	printf("%d\n",ans);
	return 0;
}



Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; --i)
#define FOR(i, m, n) for (int i = m; i < n; ++i)
#define FORR(i, m, n) for (int i = m; i >= n; --i)
#define ALL(v) (v).begin(),(v).end()
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll INF=1LL<<60;
const int inf=(1<<30)-1;
const int mod=1e9+7;
int dx[8]={1,0,-1,0,-1,-1,1,1};
int dy[8]={0,1,0,-1,-1,1,-1,1};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int l,r,d;cin >> l >> r >> d;
    cout << r/d-(l-1)/d << endl;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
const int N=110;
int n,a[N],odd[N],even[N];
int main()
{
	cin>>n;
	odd[0]=1;even[0]=0;
	for (int i=1;i<=n;i++){
		cin>>a[i];
		if (a[i]&1){
			odd[i]=odd[i-1];
			even[i]=even[i-1]*3+odd[i-1]*2;
		}
		else{
			odd[i]=odd[i-1]*2;
			even[i]=even[i-1]*3+odd[i-1];
		}
	}
	cout<<even[n]<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>

using namespace std;

int N;

int main() {
    scanf("%d", &N);
    int res = N;
    for (int i = 0; i <= N; i++) {
        int cc = 0;
        int t = i;
        while (t > 0) cc += t % 6, t /= 6;
        t = N - i;
        while (t > 0) cc += t % 9, t /= 9;
        if (res > cc) res = cc;
    }
    printf("%d\n", res);
}

Measured memory_bytes: 128