akhauriyash/Code-Regression huggingface dataset:
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
//#include <cstdio>
//#include <iomanip>//"cout<<fixed<<setprecision(n)<<sth<<endl;"
//#include <string>//"reverse(s's it,s's it)"
//#include <functional>//"greater<T>" "sort(a,a+n,greater<int>());""
//#include <cmath>//"abs" "sqrt"
//#include <numeric>//"accumulate(inputit,inputit,init,(optional) object)"
//#include <algorithm>//"lower_bound(it,it,v)" "next_permutation(a,a+n)"
//"reverse(v's it,v's it)"(v: vector)
using namespace std;
#define pb push_back//also for STRING
#define fi first
#define sc second
#define mp make_pair
#define is insert
#define ps push//TMP//stack,(priority) queue,
#define fr front//TMP//queue//for priority, use top().
typedef long long ll;//not necessarily

#define MAX_N 100000

int n,color[MAX_N];
vector<int> g[MAX_N];

bool dfs(int v,int c){
	color[v]=c;
	for(int j=0;j<g[v].size();++j){
		if(color[g[v][j]]==c) return false;
		if(color[g[v][j]]==0&&!dfs(g[v][j],-c)) return false;
	}
	return true;
}

int main(){
	int m;
	cin>>n>>m;
	fill(color,color+n,0);
	for(int j=0;j<m;++j){
		int a,b;
		cin>>a>>b;
		g[--a].pb(--b);
		g[b].pb(a);
	}
	for(int v=0;v<n;++v){
		if(color[v]==0){
			if(!dfs(v,1)){
				cout<<(((ll)n*(ll)(n-1))/2)-(ll)m<<endl;
				return 0;
			}
		}
	}
	int a=0;
	for(int v=0;v<n;++v){
		if(color[v]==1) ++a;
	}
	cout<<((ll)a*(ll)(n-a))-(ll)m<<endl;
}

Measured memory_bytes: 6528
// template version 1.15
using namespace std;
#include <bits/stdc++.h>

// varibable settings
#define int long long
const int INF=1e18;

// define basic macro {{{
#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 _rrep(i,n) rrepi(i,0,n)
#define rrepi(i,a,b) for(int i=(int)((b)-1);i>=(int)(a);--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define each(i,a) for (auto&& i : a)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define mt(a, b, c) make_tuple(a, b, c)
#define ub upper_bound
#define lb lower_bound
#define posl(A, x) (lower_bound(all(A), x)-A.begin())
#define posu(A, x) (upper_bound(all(A),x)-A.begin())
template<class T> inline void chmax(T &a, const T &b) { if((a) < (b)) (a) = (b); }
template<class T> inline void chmin(T &a, const T &b) { if((a) > (b)) (a) = (b); }

#define divceil(a,b) ((a)+(b)-1)/(b)
#define is_in(x, a, b) ((a)<=(x) && (x)<(b))
#define uni(x) sort(all(x));x.erase(unique(all(x)),x.end())
#define slice(l, r) substr(l, r-l)

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> iii;

template<typename T> using PQ = priority_queue<T, vector<T>, greater<T>>;
struct Fast { Fast(){ std::cin.tie(0); ios::sync_with_stdio(false); } } fast;

#if defined(PCM) || defined(LOCAL)
    #include "lib/dump.hpp"
#else
    #define dump(...) 42
    #define dump_1d(...) 42
    #define dump_2d(...) 42
    #define cerrendl 42
#endif
//}}}

signed main() {
    int x,k;cin>>x>>k;

    set<int> st;
    st.insert(x);
    int ans = x;
    while(true){
        if (x>k) x %= k;
        else x = abs(x-k);
        chmin(ans, x);
        dump(x);
        if (st.find(x) != st.end()) break;
        else st.insert(x);
    }
    cout << ans << endl;

    return 0;
}


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


long long dev(long long base,long long num){
    if (num == 0){
        return base;
    } else {
        return dev(num,base % num);
    }
    return base;
}

int main(void){
    int N;
    cin >> N;
    vector<unsigned long long> T(N);

    for(int i = 0;i < N;i++){
        cin >> T[i];
    }
    unsigned long long ans = 1;
    for(int i = 0;i < N;i++){
        if(ans % T[i] == 0 || T[i] % ans == 0){
            ans = max(ans, T[i]);
        } else {
            // 互除法
            long long hi,low;
            hi = max(ans,T[i]);
            low = min(ans,T[i]);
            ans = hi / dev(hi,low) * low;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
using System;

class Program {
    const int mod = 1000000007;

    static void Main() {
#if USE_IDE
        var exStdIn = new System.IO.StreamReader("./../../TestStdin.txt");
        Console.SetIn(exStdIn);
#endif
        var ints = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
        var many = ints[1] < ints[2] ? ints[2] : ints[1];
        var few = ints[1] < ints[2] ? ints[1] : ints[2];
        var ansMin = ints[0] - many - few;
        if (ansMin > 0) {
            ansMin = 0;
        } else {
            ansMin *= -1;
        }

        Console.WriteLine(few + " " + ansMin);
    }
}

Measured memory_bytes: 13140
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>
#include <utility>
#include <tuple>

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
using namespace std;
using ll = long long int;
using P = pair<ll, ll>;

// clang-format off
#ifdef _DEBUG_
#define dump(...) do{ cerr << __LINE__ << ":\t" << #__VA_ARGS__ << " = "; PPPPP(__VA_ARGS__); cerr << endl; } while(false)
template<typename T> void PPPPP(T t) { cerr << t; }
template<typename T, typename... S> void PPPPP(T t, S... s) { cerr << t << ", "; PPPPP(s...); }
#else
#define dump(...) do{ } while(false)
#endif
template<typename T> vector<T> make_v(size_t a, T b) { return vector<T>(a, b); }
template<typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v(ts...))>(a, make_v(ts...)); }
template<typename T> bool chmin(T &a, T b) { if (a > b) {a = b; return true; } return false; }
template<typename T> bool chmax(T &a, T b) { if (a < b) {a = b; return true; } return false; }
template<typename T> void print(T a) { cout << a << endl; }
template<typename T, typename... Ts> void print(T a, Ts... ts) { cout << a << ' '; print(ts...); }
template<typename T> istream &operator,(istream &in, T &t) { return in >> t; }
// clang-format on

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    cin, n;
    int ac = 0, wa = 0, tle = 0, re = 0;
    REP(i, 0, n) {
        string s;
        cin, s;
        if (s == "AC") {
            ac++;
        } else if (s == "WA") {
            wa++;
        } else if (s == "TLE") {
            tle++;
        } else {
            re++;
        }
    }
    cout << "AC x " << ac << endl;
    cout << "WA x " << wa << endl;
    cout << "TLE x " << tle << endl;
    cout << "RE x " << re << endl;

    return 0;
}


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

int main()
{
  int n, k;
  cin >> n;
  k = n;
  int sum = 0;
  while (n > 0) {
    sum += n%10;
    n /= 10;
  }
  if (k % sum)
    cout << "No" << endl;
  else
    cout << "Yes" << endl;
}


Measured memory_bytes: 256
# coding: utf-8
# Your code here!
import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline #文字列入力のときは注意

#n = int(input())
#a = [int(i) for i in readline().split()]

k = int(input())

q,r = divmod(k,50)
c =q+49
a = [c-r]*(50-r) + [c+50-(r-1)]*r

print(50)
print(*a)






Measured memory_bytes: 2940
import java.util.Arrays;
import java.util.Scanner;
public class Main
{
	public static void main(String arg[])
	{
		Scanner in=new Scanner(System.in);
		for(;;)
		{
			int n=in.nextInt();
			if(n==0)
				return;
			int  c[][]=new int[n][2];
			String str[]=new String[n];
			for(int i=0;i<n;i++)
			{
				str[i]=in.next();
				for(int j=0;j<n-1;j++)
				{
					int p=in.nextInt();
					if(p==0)
						c[i][0]++;
					else if(p==1)
						c[i][1]++;
				}
			}
			boolean a[]=new boolean[n];
			Arrays.fill(a, true);
			int ansc=0;
			while(true)
			{				
				int maxinde;
				int i=0;
				while(true)
				{
					if(a[i])
					{
						maxinde=i;
						break;
					}
					i++;
				}
				for(int j=0;j<n;j++)
				{
					if(!a[j])
						continue;
					if(c[maxinde][0]<c[j][0])
						maxinde=j;
					else if(c[maxinde][0]==c[j][0])
					{
						if(c[maxinde][1]>c[j][1])
							maxinde=j;
					}
				}
				System.out.println(str[maxinde]);
				a[maxinde]=false;
				ansc++;
				if(ansc==n)
					break;
			}
		}
	}
}

Measured memory_bytes: 12000
function Main(input) {
	var data = input.split(" ")
	var i = 0;
	while(1){
		if(data[1] <= data[0] * i - (i-1)) break;
		i++;
	}
	console.log(i)
}
 
// Don't edit this line!
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 8332
#include <stdio.h>
  
int main(){
    int a,b;
    while(scanf("%d %d",&a,&b) != EOF){
        printf("%d %d\n",gcd(a,b),lcm(a,b));
    }
    return 0;
}
 
int gcd(int m, int n){
    if(m == 0 || n == 0) return 0;
    while(n != m){
        if (m > n) m -= n;
        else n -= m;
    }
    return n;
}
 
int lcm(int m, int n){
    return m / gcd(m, n) * n;
}


Measured memory_bytes: 2040
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
#define all(x) (x).begin(), (x).end()
#define endl '\n'
#define fsp(x) cout << fixed << setprecision(x)
const ll inf = LLONG_MAX;
const long double pi = M_PI;
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}

int main() {
  ll s;
  cin >> s;
  ll a, b, c, d, e, f;
  a = 0;
  b = 0;
  c = 1e9;
  d = 1;
  e = s % c * (-1) + 1e9;
  f = s / c + 1;
  if (s == 1e18) {
    f--;
    e = 0;
  }
  cout << a << " " << b << " " << c << " " << d << " " << e << " " << f << endl;
}

Measured memory_bytes: 256
#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <numeric>
#include <algorithm>

using namespace std;
using lint = long long;
constexpr int MOD = 1000000007, INF = 1010101010;
constexpr lint LINF = 1LL << 60;

template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
	for (const auto &e : vec) os << e << (&e == &vec.back() ? "\n" : " ");
	return os;
}

#ifdef _DEBUG
template <class T>
void dump(const char* str, T &&h) { cerr << str << " = " << h << "\n"; };
template <class Head, class... Tail>
void dump(const char* str, Head &&h, Tail &&... t) {
	while (*str != ',') cerr << *str++; cerr << " = " << h << "\n";
	dump(str + (*(str + 1) == ' ' ? 2 : 1), t...);
}
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else 
#define DMP(...) ((void)0)
#endif

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int x, a, b;
	cin >> x >> a >> b;

	cout << min(a, b) << ' ' << max(0, a + b - x) << endl;

	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
    #include<string.h>
    int main()
    {
        int i,j,p,plag;
        char ch[105];
        scanf("%s",ch);
        p= strlen(ch);
        if(p%2!=0)
        {
            printf("No\n");
        }
        else
        {
            for(i=0; i<p; i++)
            {
                plag=0;
                for(j=0; j<p; j++)
                {
                    if(ch[i]==ch[j])
                    {
                        plag++;
                    }
                }
                 if(plag%2!=0)
                {
                    printf("No\n");
                    break;
                }
            }
            if(plag%2==0)
            {
                printf("Yes\n");

            }
        }
        return 0;
    }


Measured memory_bytes: 128
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define per(i,a,b) for(int i =(b)-1;i>=(a);--i)
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define sz(x) (int) (x).size()
#define mp make_pair
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef double db;
typedef vector<int> vi;
const int mod = 1e9 + 7;
const int maxn = 2e6 + 10;
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll a,b,n;
	cin >> a >> b >> n;
	if(b > n){
		cout << a*n/b - a*(n/b); 
	}
	else{
		cout << a*(b-1)/b;
	}
	return 0;
}


Measured memory_bytes: 3652
#include <iostream>
#include <string>
#include <algorithm>
#include <set>

int main() {
    std::string s, ret;
    int k;
    std::cin >> s >> k;

    char smallest[5] = { 'z', 'z', 'z', 'z', 'z' };
    for (auto c : s) {
        for (int i = 0; i < 5; i++) {
            if (smallest[i] == c) break;
            if (smallest[i] > c) {
                for (int j = 4; j > i; j--) {
                    smallest[j] = smallest[j-1];
                }
                smallest[i] = c;
                break;
            }
        }
    }
    
    std::set<std::string> sset;
    for (int i = 0; i < 5; i++) {
        for (int j = 0; j < s.length(); j++) {
            if (s[j] == smallest[i]) {
                int limit = std::min(k, (int)s.length() - j);
                for (int l = 1; l <= limit; l++){
                    sset.insert(std::string(s, j, l));
                }
            }
        }
        if (sset.size() >= k) break;
    }

    for (auto& str : sset) {
        if (--k == 0) std::cout << str << std::endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
x,k,d=map(int,input().split())

x=abs(x)

if x>0:
    #追い越せないパターン
    if x>=d*k:
        print(x-d*k)
    #追い越せるパターン
    else:
        cnt=((-1*x)//d)*(-1)
        if cnt==k:
            print(abs(x-d*cnt))
        else:
            if (k-cnt)%2==0:
                print(abs(x-d*cnt))
            else:
                print(abs(x-d*(cnt-1)))

else:
    if k%2==0:
        print(0)
    else:
        print(abs(d))



Measured memory_bytes: 9196
def main():
    _, K = (int(i) for i in input().split())
    A = [int(i) for i in input().split()]
    if K == 0:
        print(max(A))
        return

    def is_ok(x):
        need = 0
        for a in A:
            if a % x == 0:
                need += a//x - 1
            else:
                need += a//x
        if need <= K:
            return True
        else:
            return False

    def binary_search():
        ng = 0
        ok = 10**9
        while abs(ok - ng) > 1:
            mid = ng + (ok - ng) // 2
            if is_ok(mid):
                ok = mid
            else:
                ng = mid
        return ok

    print(binary_search())


if __name__ == '__main__':
    main()


Measured memory_bytes: 104136
#include <bits/stdc++.h>
using namespace std;
long long a,b;
int main(){
    cin>>a>>b;
    if(a % 3 == 0 || b % 3 == 0 || (a+b) % 3 == 0) cout<<"Possible"<<endl;
    else cout<<"Impossible"<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(), (x).end()
#define dbg(x) cerr << #x << ": " << x << endl

ll f(ll x) {
  ll res = 0;
  res = ((x + 1) / 2) % 2;
  if(x % 2 == 0) res ^= x;
  return res;
}

ll f2(ll x) {
  if(x < 0) return 0;
  ll res = 0;
  int keta = 0;
  while(x >> keta) {
    ll loop = (1LL << (keta + 1));
    ll cnt = (x / loop) * (loop / 2);
    cnt += max(0LL, (x % loop) - (loop / 2) + 1);
    if(cnt % 2 == 1) res += (1LL << keta);
    keta++;
  }
  return res;
}

int main() {
  ll a, b;
  cin >> a >> b;
  cout << (f2(b) ^ f2(a - 1)) << endl;
  //  cout << (f(b) ^ f(a - 1)) << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#ifdef tabr
#include "library/debug.cpp"
#else
#define debug(...)
#endif

vector<int> kmp(string s, string w) {
    int n = s.size(), m = w.size();
    vector<int> t(m + 1), res;
    t[0] = -1;
    int k = -1, i = 0;
    for (int i = 0; i < m; i++) {
        while (k >= 0 && w[i] != w[k]) k = t[k];
        t[i + 1] = ++k;
    }
    k = 0;
    while (k + i < n) {
        if (w[i] == s[k + i]) {
            if (++i == m) {
                res.emplace_back(k);
                k = k + i - t[i];
                i = t[i];
            }
        } else {
            k = k + i - t[i];
            if (i > 0) {
                i = t[i];
            }
        }
    }
    return res;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s, t;
    cin >> s >> t;
    string x = s;
    int n = s.size(), m = t.size();
    x += s;
    while (x.size() < m + n) {
        x += s;
    }
    x.resize(n + m);
    vector<int> a = kmp(x, t);
    vector<int> to(n, -1);
    for (int i : a) {
        to[i] = (i + m) % n;
    }
    vector<bool> was(n);
    debug(to);
    function<void(int, int)> loop = [&](int v, int p) {
        if (to[v] == p) {
            cout << -1 << '\n';
            exit(0);
        }
        if (to[v] == -1 || was[v]) return;
        was[v] = true;
        loop(to[v], p);
    };
    for (int i = 0; i < n; i++) {
        loop(i, i);
    }
    vector<int> cnt(n);
    function<void(int)> dfs = [&](int v) {
        if (to[v] == -1 || cnt[v] != 0) return;
        dfs(to[v]);
        cnt[v] = cnt[to[v]] + 1;
    };
    for (int i = 0; i < n; i++) {
        dfs(i);
    }
    cout << *max_element(cnt.begin(), cnt.end()) << '\n';
    return 0;
    return 0;
}


Measured memory_bytes: 31016
#include<bits/stdc++.h>
using namespace std;
int n;
int m;
struct info {
    int cost,subMask;
    info() {
        cost = 0;
        subMask = 0;
    }
};
vector<info> v;
int dp[3005][(1<<12)+5];

int F(int pos,int mask) {
    if(pos==m) {
        //cout<<mask<<" " <<(1<<m)-1<<endl;
        if(mask==(1<<n)-1) return 0;
        return (int)1e9;
    }

    int res = dp[pos][mask];
    if(res!=-1) return res;
    res = (int)1e9;

    res = min(res,F(pos+1,mask));
    res = min(res,F(pos+1,mask|v[pos].subMask)+v[pos].cost);

    return dp[pos][mask]=res;
}

int main() {

    cin>>n>>m;
    v.resize(m);
    for(int i = 0;i<m;i++) {

        cin>>v[i].cost;
        int  b;
        cin>>b;
        for(int j = 0;j<b;j++) {
            int key;
            cin>>key;
            key--;
            v[i].subMask = v[i].subMask|(1<<key);
        }
    }
    memset(dp,-1,sizeof dp);
    int res = F(0,0);
    if(res>=(int)1e9) res = -1;
    cout<<res<<endl;
}


Measured memory_bytes: 48512
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int N,count;
  int button=1;
  cin>>N;
  vector<int> a(N+1);
  for(int i=1;i<=N;i++)
  {
    cin>>a.at(i);
  }
  while(button!=2)
  {
    button=a.at(button);
    count++;
    if(count>N)
    {
      break;
    }
  }
  if(count>N)
  {
    cout<<"-1"<<endl;
  }else
  {
    cout<<count<<endl;
  }
}

Measured memory_bytes: 640
dishes = []
for i in range(5):
    dishes.append(int(input()))

min_under10 = 10
min_under10_number = 100
time_10_number = []
for i in range(5):
    tmp = dishes[i] % 10
    if tmp < min_under10 and tmp != 0:
        min_under10 = tmp
        min_under10_number = i
    if tmp == 0:
        time_10_number.append(i)

sum_times = 0
for i in range(5):
    if i != min_under10_number and i not in time_10_number:
        sum_times += (dishes[i] // 10 + 1) * 10
    elif i == min_under10_number:
        sum_times += dishes[i]
    elif i in time_10_number:
        sum_times += dishes[i]

print(sum_times)

Measured memory_bytes: 3064
# coding: utf-8
# Your code here!
import sys
 
 
N = input()
num_list =  list(N)
if int(num_list[-1]) == 3:
    print('bon')
    sys.exit()
elif int(num_list[-1]) == 0 or int(num_list[-1]) == 1 or int(num_list[-1]) == 6 or int(num_list[-1]) == 8:
    print('pon')
    sys.exit()
else:
    print('hon')
    sys.exit()

Measured memory_bytes: 9192
-- fo "http://abc042.contest.atcoder.jp/tasks/arc058_a"

import Data.List
import Control.Applicative

main = do
  p <- getContents
  let n = read $ head $ words $ head $ lines p :: Int
      k = read $ last $ words $ head $ lines p :: Int
      d  =   map ( flip (!!) 0 ) $ words $last  $ lines p -- d !! i = D_i
      pre = [n..]
      result = ( find (myNotElem d )  pre )
      result' = (\(Just x) -> x) result
  putStr $  show result'


myNotElem :: [Char] -> Int -> Bool  
myNotElem  (s:st) n | s `notElem` n' = myNotElem st n
                   | otherwise = False
  where n' = show n
myNotElem [] _ = True


Measured memory_bytes: 892
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
	string S; cin >> S;
	int ans = 700;
	rep(i, 3) {
		if (S[i] == 'o') ans += 100;
	}
	cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<deque>
#include<regex>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;i++)

typedef int long long ll;
using namespace std;
typedef pair<int,int> P;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
const ll MOD=1e9+7;
static const int MAX = 100;
static const int INF = (1<<23);
template<class T> T gcd(T a, T b){return b? gcd(b,a%b) : a;}
template<class T> T lcm(T a,T b){return a / gcd(a,b)*b;}

struct UnionFind{
    vector<int> pare;
    vector<int> rank;
    vector<int> usize;

    UnionFind(int N):pare(N),rank(N),usize(N){
        rep(i,N){
            pare[i]=i;
            rank[i]=0;
            usize[i]=1;
        }
    }
    int root(int x){
        if(pare[x]==x)return x;
        return pare[x]=root(pare[x]);
    }
    void unite(int x,int y){
        int rx = root(x);
        int ry = root(y);
        if(rx==ry){
            return ;
        }
        if(rank[rx]>rank[ry]){
            pare[rx]=ry;
            usize[ry]+=usize[rx];
        }else {
            pare[ry] = rx;
            if (rank[rx] == rank[ry])rank[rx]++;
            usize[rx]+=usize[ry];
        }
    }

    bool same(int x,int y){
        return root(x)==root(y);
    }
    int tsize(int x){
        int xx=root(x);
        return usize[xx];
    }
};


int main(){

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

    vector<int> fri[n];
    vector<int> block[n];
    UnionFind uf(n);
    rep(i,m){
        int a,b;
        cin>>a>>b;
        a--,b--;
        fri[a].push_back(b);
        fri[b].push_back(a);
        uf.unite(a,b);
    }

    rep(i,k){
        int a,b;
        cin>>a>>b;
        a--;b--;
        block[a].push_back(b);
        block[b].push_back(a);
    }


    vector<int> ans(n,0);
    for(int i=0;i<n;i++){
        int f1sum = fri[i].size();
        int fsum = uf.tsize(i);
        
        fsum-=(1+f1sum);
        rep(j,block[i].size()){
            if(uf.same(i,block[i][j]))fsum--;

        }
        ans[i]=fsum;

    }
    rep(i,n){
        cout<<ans[i]<<" ";
    }
    cout<<endl;












return 0;
}


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

const long long INF = 1LL << 60;

int main() {
    string S, T; cin >> S >> T;
    vector<char> v(T.size());
    vector<char> tmp(T.size()+1);
    for (int i = 0; i < T.size(); i++) v.at(i) = T.at(i);
    for (int i = 0; i < T.size(); i++) {
        bool flag = true;
        for (int j = 0; j < T.size(); j++) {
            if (S.at(j) != v.at(j)) {
                flag = false;
                break;
            }
        }
        if (flag) {
            cout << "Yes" << endl;
            return 0;
        }
        tmp.at(0) = v.at(T.size()-1);
        for (int j = 0; j < T.size(); j++) {
            tmp.at(j+1) = v.at(j);
            v.at(j) = tmp.at(j);
        }
    }
    cout << "No" << endl;
}

Measured memory_bytes: 3592
#include <iostream>

using namespace std;

int main() {
    int n, b, f, r, v;
    cin >> n;
    int house[4][3][10] = {0};
    for(int i = 0; i < n; i++) {
        cin >> b >> f >> r >> v;
        house[b-1][f-1][r-1] += v;
    }

    for(int i = 0; i < 4; i++) {
        for(int j = 0; j < 3; j++) {
            for(int k = 0; k < 10; k++) {
                cout << ' ' << house[i][j][k];
            }
            cout << endl;
        }
        if(i != 3) cout << "####################" << endl;
        // else cout << endl;
    }
    

    return 0;
}


Measured memory_bytes: 3100
H, W, K = map(int, input().split())

S = [list(input()) for i in range(H)]

C = [-1] * H
for i, r in enumerate(S):
    C[i] = r.count('#')

ans = [[-1] * W for i in range(H)]
first_flg = False
z = []
a = 0
for i in range(H):
    if C[i] == 0:
        if first_flg is False:
            z.append(i)
        else:
            ans[i] = ans[i-1]
    else:
        a += 1
        c = 0
        for j in range(W):
            if S[i][j] == '#':
                first_flg = True
                if c == 0:
                    c += 1
                else:
                    c += 1
                    a += 1
            ans[i][j] = a

for i in z[::-1]:
    ans[i] = ans[i+1]

for i in range(H):
    print(*ans[i])


Measured memory_bytes: 48604
#include <iostream>
#include <map>
#include <vector>
#include <algorithm>
#include <map>
#include <string>
#include <queue>
#include <set>
#include <math.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll mod = 1000000007;
ll bit[100010], num;
ll par[100010];
string L;
ll dp[100010][2];

ll sum(ll i)
{
	ll s = 0;
	while (i > 0)
	{
		s += bit[i];
		i -= i & -i;
	}
	return s;
}

void add(ll i, ll x)
{
	while (i <= num)
	{
		bit[i] += x;
		i += i & -i;
	}
}

ll po(ll x, ll y)
{
	if (y == 0) return 1;
	if (y % 2)
	{
		return po(x, y - 1) * x % mod;
	}
	else
	{
		ll yyy = po(x, y / 2);
		return yyy * yyy % mod;
	}
}

ll div(ll x)
{
	return po(x, mod - 2);
}

int main(void)
{
	cin >> L;
	ll len = L.length();
	dp[0][0] = 1;
	dp[0][1] = 2;
	for (int i = 1; i < L.length(); i++)
	{
		if (L[i] == '1')
		{
			dp[i][0] = (dp[i - 1][1] % mod + (dp[i - 1][0] * 3 % mod)) % mod;
			dp[i][1] = dp[i - 1][1] * 2 % mod;
		}
		else
		{
			dp[i][0] = 3 * dp[i - 1][0] % mod;
			dp[i][1] = dp[i - 1][1];
		}
	}
	cout << (dp[len - 1][0] + dp[len - 1][1]) % mod << endl;
	int www;
	cin >> www;
}


Measured memory_bytes: 2048
n=int(input())
a=[[0]*n]*2
a[0]=list(map(int,input().split()))
a[1]=list(map(int,input().split()))
ans=0
#print(a[0][:3])
for i in range(n):
  ans=max(ans,sum(a[0][:i+1])+sum(a[1][i:]))
  
print(ans)

Measured memory_bytes: 3064
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for(int(i) = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
#define pb push_back
#define MP(a, b) make_pair((a), (b))
typedef long long ll;
const int INF = 1 << 30;
const ll LINF = 1LL << 60;
const int MOD = 1e9 + 7;

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

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


int n;
int main(){
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	cin>>n;
	if((n&-n)==n){cout<<"No\n";return 0;}
	cout<<"Yes\n";
	if(n%4==3)for(int i=1;i<2*n;++i)cout<<i<<' '<<i+1<<'\n';
	if(n%4==1&&n>1){
		for(int i=1;i<n-2;++i)cout<<i<<' '<<i+1<<'\n',cout<<n+i<<' '<<n+i+1<<'\n';
		cout<<n-2<<' '<<n+1<<'\n'
			<<1<<' '<<n-1<<'\n'
			<<1<<' '<<n<<'\n'
			<<n-1<<' '<<2*n<<'\n'
			<<n<<' '<<2*n-1<<'\n';
	}
	if(n%4==2&&n>2){
		for(int i=1;i<n-3;++i)cout<<i<<' '<<i+1<<'\n',cout<<n+i<<' '<<n+i+1<<'\n';
		cout<<n-3<<' '<<n+1<<'\n'
			<<1<<' '<<n-2<<'\n'
			<<1<<' '<<n-1<<'\n'
			<<n-2<<' '<<2*n-1<<'\n'
			<<n-1<<' '<<2*n-2<<'\n'
			<<n<<' '<<2<<'\n'
			<<2*n<<' '<<n-1<<'\n';
	}
	if(n%4==0){
		int u=n&-n,v=n^u;if(u>v)swap(u,v);
		for(int i=1;i<n-1;++i)cout<<i<<' '<<i+1<<'\n',cout<<n+i<<' '<<n+i+1<<'\n';
		cout<<n-1<<' '<<n+1<<'\n'
			<<u+1<<' '<<n<<'\n'
			<<v<<' '<<2*n<<'\n';
	}
	return 0;
}

Measured memory_bytes: 2816
#include <stdio.h>
int main(void){
  int s[30],n,i;
  s[0]=1;
  s[1]=2;
  s[2]=4;
  for(i=3;i<30;i++)
    s[i]=s[i-1]+s[i-2]+s[i-3];
  while(1){
    scanf("%d",&n);
    if(!n)break;
    printf("%d\n",s[n-1]/3650+(s[n-1]%3650?1:0));
  }
  return 0;
}

Measured memory_bytes: 600
include Math
W = 20000
B = 80
n = gets.to_i

blocks = {}
points = []
min_d = Float::INFINITY
min_d2 = 0
x0, y0 = 10*W, 10*W

n.times{|point_idx|
	x, y = gets.split.map(&:to_i)
	x += 10000
	y += 10000

	d = sqrt( (x-x0)**2 + (y-y0)**2 )
	if d < min_d
		min_d = d
		min_d2 = (x-x0)**2 + (y-y0)**2
	end

	x0, y0 = x, y

	blocks[y/B] ||= {}
	(blocks[y/B][x/B] ||= []) << point_idx
	points << x * (W+1) + y
}

(0..n-1).each{|idx0|
	x0, y0 = points[idx0] / (W+1), points[idx0] % (W+1)
	i0, j0 = y0/B, x0/B
	for i in [i0-(min_d/B).ceil, 0].max..[i0+(min_d/B).ceil, W/B].min
		dy = ((i-i0).abs-1) * B

		for j in [j0-(min_d/B).ceil, 0].max..[j0+(min_d/B).ceil, W/B].min
			next unless blocks[i]
			next unless blocks[i][j]
			dx = ((j-j0).abs-1) * B
			next if dx > 0 && dx*dx + dy*dy > min_d**2

			blocks[i][j].each{|idx1|
				next if idx0 >= idx1
				x1, y1 = points[idx1] / (W+1), points[idx1] % (W+1)
				d = sqrt( (x1-x0)**2 + (y1-y0)**2 )
				if d < min_d
					min_d = d
					min_d2 = (x1-x0)**2 + (y1-y0)**2
				end
			}
		end
	end
}

p min_d2

Measured memory_bytes: 28024
#include <bits/stdc++.h>
using namespace std;
#define modulo 998244353
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 100000000000000000



int main(){
	
	int N;
	cin>>N;
	int A,B;
	cin>>A>>B;
	
	int ans = 0;
	
	for(int i=1;i<=N;i++){
		int k = i;
		int s = 0;
		while(k!=0){
			s += k%10;
			k/=10;
		}
		if(s>=A&&s<=B){
			ans+= i;
		}
	}
	
	cout<<ans<<endl;
	
	
    return 0;
}


Measured memory_bytes: 256
#![allow(unused_imports)]
#![allow(unused_variables)]
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(deprecated)]

use std::cell::{Cell, Ref, RefCell, RefMut};
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Formatter, Write as FmtWrite};
use std::io::{stderr, stdin, BufRead, Write};
use std::mem::{replace, swap};
use std::ops::*;
use std::rc::Rc;
use std::usize;

const MOD_10_9_7: u64 = 1_000_000_007;
const INF: i64 = 1_000_000_000_000;
const MIN_INF: i64 = -1_000_000_000_000;

/// FYI: https://github.com/vain0x/scan-bench
#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($t:ty) =>
        (rl().parse::<$t>().unwrap());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

fn rl() -> String {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    buf.trim_right().to_owned()
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

fn main() {
    let (l, r) = read!(u64, u64);

    // 区間[l,r]に2019の倍数が含まれていたら最小値は0
    for x in l..(r + 1) {
        if x % 2019 == 0 {
            println!("0");
            return;
        }
    }

    let mod_l = l % 2019;
    let mod_r = r % 2019;

    // mod_l >= mod_r なら区間[l, r]には2019の倍数が含まれている
    if mod_l >= mod_r {
        println!("0");
        return;
    }

    let mut ans = INF as u64;
    // 全走査
    for x in mod_l..(mod_r + 1) {
        for y in (x + 1)..(mod_r + 1) {
            ans = min(ans, (x * y) % 2019);
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
import java.io.*;
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader buffer = new BufferedReader(new InputStreamReader(System.in));
        StringBuilder sb = new StringBuilder();
        int n = Integer.parseInt(buffer.readLine());
        String [] inp = buffer.readLine().split(" ");
        long sum = 0;
        Integer [] arr = new Integer[n];
        for (int pos = 0; pos < n; pos++) {
            sum += Integer.parseInt(inp[pos]);
            arr[pos] = Integer.parseInt(inp[pos]);
        }
        long [] frequency = new  long[100001];
        for (int num :
                arr) {
            frequency[num]++;
        }
        int q = Integer.parseInt(buffer.readLine());
        for (int pos = 0; pos < q; pos++) {
            inp = buffer.readLine().split(" ");
            int b = Integer.parseInt(inp[0]), c = Integer.parseInt(inp[1]);
            if (frequency[b]!=0 && b != c) {
                sum -= b* frequency[b];
                frequency[c] += frequency[b];
                sum += c*frequency[b];
                frequency[b] = 0;
            }
            sb.append(sum+"\n");
        }
        System.out.println(sb);
    }
}


Measured memory_bytes: 59924
min_first_digit = 10
value_list = []
value = 0
for i in range(5):
    input_lines = input().split()
    value = int(input_lines[0])
    remainder = value % 10
    if remainder == 0:
        value_list.append(value)
    elif remainder != 0:
        value_list.append(value - (value % 10) + 10)
        if remainder < min_first_digit:
            min_first_digit = remainder
            index = i
            index_value = value
            index_value_2 = value - (value % 10) + 10
if min_first_digit != 10:
    print(sum(value_list) - index_value_2 + index_value)
else:
    print(sum(value_list))


Measured memory_bytes: 3060
import math


def get_divisors(n):
    """
    n の約数をリストで返す
    :param int n:
    :rtype: list of int
    """
    ret = []
    for i in range(1, int(math.sqrt(n)) + 1):
        if n % i == 0:
            ret.append(i)
            if n // i != i:
                ret.append(n // i)
    return ret


N = int(input())
print(len([i for i in range(1, N + 1) if i % 2 == 1 and len(get_divisors(i)) == 8]))


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define vl vector<long long int>
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define all(x) x.begin(),x.end()
#define vi vector<int>
#define vb vector<bool>
#define vvl vector<vector<ll> >
#define vvi vector<vector<int> >
#define pl pair<ll,ll>
#define pb push_back
#define PI 3.14159265
#define mod 998244353
#define pb push_back
#define mp make_pair
#define fri(s,n) for(int i=s;i<n;i++)
#define frj(s,n) for(int j=s;j<n;j++)
#define T(i) int i=1;cin>>i;while(i--)
#define vsi vector<set<int> >
#define pii pair<int,int>
#define inf 1e9
#define vpii vector<pair<int,int> >


ll power(ll a,ll b){
    if(b==0)
        return 1;
    if(b&1)
        return a*power(a,b-1);
    ll temp=power(a,b/2);
    return temp*temp;
    }
ll mycompare(ll a,ll b){
    return a>b;
    }
vvi graph;
int dfs(int node,vi &depth){
    if(graph[node].size()==0)
        return 0;
    if(depth[node]!=-1)
        return depth[node];
    int gaddha=0;
    for(auto nbr:graph[node])
        gaddha=max(gaddha,1+dfs(nbr,depth));
    return depth[node]=gaddha;
    }
int main(){
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    fast;
    int n,m;
    cin>>n>>m;
    graph.resize(n+1);
    while(m--){
        int u,v;
        cin>>u>>v;
        graph[u].pb(v);
    }
    vi depth(n+1,-1);
    int ans=INT_MIN;
    fri(1,n+1){
        if(depth[i]==-1){
            ans=max(ans,dfs(i,depth));}
    }
    cout<<ans;
    }


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

#define rep(i,n) for(int i=0; i<n; i++)
#define pb push_back
#define mp make_pair
#define len(s) s.length()

typedef long long ll;

void solve() {
  int n;
  cin>>n;
  int d=n%10;
  if(d==3)  cout<<"bon";
  else if(d<=1 || d==6 || d==8) cout<<"pon";
  else  cout<<"hon";
  cout<<'\n';
}

int main() {
    int t=1;
  //  cin>>t;
    rep(i,t)  solve();
    return 0;
}


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

int main(){
  int a,b;
  cin >> a >> b;
  if(b%a == 0) cout << a+b << endl;
  else cout << b-a << endl;
  return 0;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline

N, K, Q = map(int, input().split())

A = [int(input()) for _ in range(Q)]

score = [0 for _ in range(N)]
for a in A:
    score[a-1] += 1

for n in range(N):
    if K - Q + score[n] > 0:
        print("Yes")
    else:
        print("No")


Measured memory_bytes: 8644
#include <iostream>
#include <cstring>
#include <algorithm>
#include <functional>
#include <bits/stdc++.h>
#include <cmath>
#include <limits>
#include <numeric>
#include <type_traits>
#include <stdlib.h>
#include <deque>
#include <cstdint>
using namespace std;

int main () {
  int n;
  cin >> n;
  long long int x;
  cin >> x;
  long long int a[n];
  for (int i = 0; i < n; i++){
    long long int tmp;
    cin >> tmp;
    a[i] = tmp;
  }
  sort(a, a+n);
  int c = 0;
  for (int i = 0; i < n; i++){
    if (a[i] <= x){
      x -= a[i];
      c++;
    } else {
      x -=a[i];
      break;
    }
  }
  if (x <= 0){
    cout << c;
  } else {
    cout << c-1;
  }
  return 0;
}

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

using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using vint = vector<int>;
template<typename T> using uset = unordered_set<T>;
template<typename T1, typename T2> using umap = unordered_map<T1, T2>;

constexpr int INF = (1 << 30) - 1;
constexpr ll LLINF = 1LL << 60;
constexpr int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
constexpr int dx[] = {0, 1, 0, -1, 1, 1, -1, -1};

template<typename T> T gcd(T a, T b) { return (b ? gcd(b, a % b) : a); }
template<typename T> T lcm(T a, T b) { return (a / gcd(a, b) * b); }

int main() {
        int H, W;
        string dat[305];
        int ss = 0;
        cin >> H >> W;
        for (int i = 0; i < H; i++) cin >> dat[i];
        for (int j = 0; j < W - 1; j++) {
                int sum[305][305] = {};
                int dp[305][305];
                
                for (int b = H - 1; b >= 0; b--) {
                        for (int a = H - 1; a >= 0; a--) {
                                sum[a][b] = dat[H - 1 - a][j] == dat[H - 1 - b][j + 1];
                                if (a < H - 1 && b < H - 1) sum[a][b] += sum[a + 1][b + 1];
                        }
                }
                fill_n(*dp, 305 * 305, INF);
                dp[0][0] = 0;
                for (int a = 0; a <= H; a++) {
                        for (int b = 0; b <= H; b++) {
                                if (a < H) dp[a + 1][b] = min(dp[a + 1][b], dp[a][b] + sum[a][b]);
                                if (b < H) dp[a][b + 1] = min(dp[a][b + 1], dp[a][b] + sum[a][b]);
                        }
                }
                ss += dp[H][H];
        }
        
        cout << ss << endl;

        return (0);
}

Measured memory_bytes: 1152
def bubbleSort(list_a, n):
    flag = 1
    i = 0
    while flag:
        flag = 0
        for j in list(range(i+1,n))[::-1]:
            if list_a[j][1] < list_a[j-1][1]:
                (list_a[j], list_a[j-1]) = (list_a[j-1], list_a[j])
                flag = 1
    return list_a

def selectionSort(list_a, n):
    for i in range(0, n):
        minj = i
        for j in range(i, n):
            if list_a[j][1] < list_a[minj][1]:
                minj = j
        (list_a[i], list_a[minj]) = (list_a[minj], list_a[i])
    return list_a


n = int(input())
list_a_origin = list(map(str, input().split()))
list_a = list_a_origin.copy()
bubbleSort(list_a, n)
list_a_pre = list_a.copy()
print(" ".join(list_a))
bubbleSort(list_a, n)
if list_a_pre == list_a:
    print("Stable")
else:
    print("Not stable")

list_a2 = list_a_origin.copy()
selectionSort(list_a2, n)
list_a_pre2 = list_a2.copy()
print(" ".join(list_a2))
selectionSort(list_a2, n)
if list_a_pre2 == list_a:
    print("Stable")
else:
    print("Not stable")



Measured memory_bytes: 5608
#include<stdio.h>
int main(){
    int a,b,c,s;
    scanf("%d %d %d",&a,&b,&c);
    if(a>b&&a>c) s=b*c/2;
    else if(b>a&&b>c) s=a*c/2;
    else if(c>a&&c>b) s=a*b/2;
    printf("%d",s);

    return 0;
}

Measured memory_bytes: 128
#include<stdio.h>

int main()
{
	int a[100][100];
	int b[100];
	int n,m;
	scanf("%d %d",&n,&m);
	for(int i = 0;i<n;i++)
	{
		for(int j = 0;j<m;j++)
		{
			scanf("%d",&a[i][j]);
		}
	}
	
	for(int i =0;i<m;i++)
	{
		scanf("%d",&b[i]);
	}
	
	int c[100]={0};
	for(int i = 0;i<n;i++)
	{
		for(int j = 0;j<m;j++)
		{
			c[i]+=a[i][j]*b[j];
		}
	}
	
	for(int i = 0;i<n;i++)
	{
		printf("%d\n",c[i]);
	}
	return 0;
}


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

//using ll=long long;

const int MAX = 2200000;
const long long MOD = 1000000007;
long long INF = 90000000001000;


int main() {
string s;
cin >> s;
int cnt=0;
int mx=0;

for (int i = 0; i < s.size(); ++i)
{
   if (s[i]=='A'||s[i]=='G'||s[i]=='C'||s[i]=='T')
   {
      cnt++;
   }
   else{
    mx = max(mx,cnt);
    cnt = 0;
   }
}
mx = max(mx,cnt);
cout << mx << endl;
return 0;
}




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

vector<vector<int>> G;

void solve(long long N, long long M, std::vector<long long> s, std::vector<long long> t){
    G = vector<vector<int>>(N);
    for(int i=0;i<M;++i){
        G[s[i]-1].push_back(t[i]-1);
    }
    vector<double> res(N,10 * N);
    res[N-1] = 0;
    for(int i=N-2;i>-1;--i){
        double tmp = 0, num = 0;
        for(int k:G[i]){
            tmp += res[k];
            num += 1.0;
        }
        res[i] = tmp / num + 1.0;
    }
    double ress = res[0];
    for(int i=N-2;i>-1;--i){
        if(G[i].size() <= 1)continue;
        vector<double> res2(N, 10*N);
        for(int k=i+1;k<N;++k)res2[k] = res[k];
        double tmp = 0, num = 0, tmpm = 0.0;
        for(int k:G[i]){
            tmp += res[k];
            num += 1.0;
            tmpm = max(tmpm,res[k]);
        }
        res2[i] = (tmp - tmpm) / (num - 1.0) + 1.0;
        // cout<<res2[i]<<" "<<res[i]<<endl;
        for(int l=i-1;l>-1;--l){
            tmp = 0, num = 0;
            for(int k:G[l]){
                tmp += res2[k];
                num += 1.0;
            }
            res2[l] = tmp / num + 1.0;
            // cout<<l<<" "<<res2[l]<<endl;
        }
        ress = min(ress,res2[0]);
        // cout<<res2[0]<<endl;
    }
    cout<<setprecision(20)<<ress<<endl;
}

// Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    long long M;
    scanf("%lld",&M);
    std::vector<long long> s(M);
    std::vector<long long> t(M);
    for(int i = 0 ; i < M ; i++){
        scanf("%lld",&s[i]);
        scanf("%lld",&t[i]);
    }
    solve(N, M, std::move(s), std::move(t));
    return 0;
}


Measured memory_bytes: 4224
#include <iostream>
#include <fstream>
#include <cassert>
#include <typeinfo>
#include <vector>
#include <stack>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#include <cctype>
#include <random>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<P,int> pip;
typedef vector<pip> vip;
const int inf=1<<29;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

int a,b,c;

int main(){
	cin>>a>>b>>c;
	if(a<=c&&c<=b) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int s;
  cin >> s;

  int h, m, ss;
  ss = s % 60;
  m = (s / 60) % 60;
  h = (s / 60) / 60;
  
  cout << h << ':' << m << ':' << ss << endl;
}


Measured memory_bytes: 3108
#include <stdio.h>          // printf(), scanf()
#include <stdlib.h>         // exit()
#include <stdbool.h>

#define MAX_V 10000
#define MAX_E 100000
#define QUE_SIZE 200

typedef struct list_tbl
{
	int t;
	int next;
} list_t;

int V;
int G[MAX_V];
list_t list[MAX_E];
bool visited[MAX_V];
int indeg[MAX_V];

int queue[QUE_SIZE];
int que_in;
int que_out;

void
cleanup(int ecode)
{
	exit(ecode);
}

int
que_size()
{
	if (que_in >= que_out)
		return que_in - que_out;

	return que_in + QUE_SIZE - que_out;
}

int
que_empty()
{
	return que_in == que_out;
}

void
que_push(int x)
{
	queue[que_in] = x;
	que_in = (que_in + 1) % QUE_SIZE;
	if (que_in == que_out)
	{
		fprintf(stderr, "Queue overflow. size:%d\n", QUE_SIZE);
		cleanup(1);
	}
}

void
que_pop()
{
	if (que_out == que_in)
	{
		fprintf(stderr, "Queue underflow\n");
		cleanup(1);
	}

	que_out = (que_out + 1) % QUE_SIZE;
}

int
que_front()
{
	return queue[que_out];
}

void
bfs(int s)
{
	que_in = 0;
	que_out = 0;

	que_push(s);
	visited[s] = true;
	while (!que_empty())
	{
		int u = que_front(); que_pop();
		printf("%d\n", u);
		for (int l = G[u]; l != -1; l = list[l].next)
		{
			int v = list[l].t;
			indeg[v]--;

			if (indeg[v] == 0 && !visited[v])
			{
				visited[v] = true;
				que_push(v);
			}
		}
	}
}

void
tsort()
{
	for (int u = 0; u < V; ++u)
	{
		visited[u] = false;
		indeg[u] = 0;
	}

	for (int u = 0; u < V; ++u)
	{
		for (int l = G[u]; l != -1; l = list[l].next)
		{
			int v = list[l].t;
			indeg[v]++;
		}
	}

	for (int u = 0; u < V; ++u)
	{
		if (indeg[u] == 0 && !visited[u])
			bfs(u);
	}
}

int
main(int argc, char** argv)
{
	int E;
	scanf("%d%d", &V, &E);
	for (int u = 0; u < V; ++u)
		G[u] = -1;

	int nl = 0;
	for (int i = 0; i < E; ++i)
	{
		int s, t;
		scanf("%d %d", &s, &t);

		if (nl >= MAX_E)
		{
			fprintf(stderr, "graph area overflow. size:%d\n", MAX_E);
			cleanup(1);
		}

		list[nl].t = t;
		list[nl].next = G[s];
		G[s] = nl++;
	}

	tsort();
	return 0;
}

Measured memory_bytes: 2104
#include <stdio.h>
int main()
{     
    int a,b;
    scanf("%d %d",&a,&b);
    if(a<b){
       printf("a < b\n");
    }
    if(a>b){
       printf("a > b\n");
    }
    if(a==b){
       printf("a == b\n");
    }
    return 0;
}

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

using namespace std;
typedef long long ll;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()
#define all2(a, b) (a).begin(), (a).begin() + (b)
#define debug(vari) cerr << #vari << " = " << (vari) << endl;

int main()
{
    int n;
    cin >> n;
    int h =0,t = 0;
    rep(i, n)
    {
        string a, b;
        cin >> a >> b;

        if (a > b)
        {
            h += 3;
        }
        else if (a == b)
        {
            h++;
            t++;
        }
        else
        {
            t += 3;
        }
    }

    printf("%d %d\n", h, t);
    return 0;
}



Measured memory_bytes: 3276
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <queue>
#include <functional>
#include <utility>

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)

using namespace std;

typedef long long int lli;
typedef pair<int, int> pii;

int main() {
    int K;
    cin >> K;
    const int inf = 1 << 30;
    vector<int> cost(K, inf);
    cost[1] = 1;
    vector<int> isAccess(K, 0);
    priority_queue<pii, vector<pii>, greater<pii>> pq;
    // cost, to
    pq.push({1, 1});
    while(pq.size()) {
        auto elem = pq.top();
        pq.pop();
        if (isAccess[elem.second]++) continue;
        int nxt = (elem.second + 1) % K;
        if (cost[nxt] > elem.first + 1) {
            cost[nxt] = elem.first + 1;
            pq.emplace(cost[nxt], nxt);
        }
        nxt = (elem.second * 10) % K;
        if (cost[nxt] > elem.first) {
            cost[nxt] = elem.first;
            pq.emplace(cost[nxt], nxt);
        }
    }
    cout << cost[0] << endl;
    return 0;
}

Measured memory_bytes: 1788