akhauriyash/Code-Regression huggingface dataset:
// Original macro is in https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = || -> String {
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}
 
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};
 
    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
    
    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}
 
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };
 
    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [$t:tt]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };
 
    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };
 
    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };
 
    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

// for adhoc read (ex. https://atcoder.jp/contests/abc112/tasks/abc112_a)
#[allow(dead_code)]
fn read_line() -> String {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}
fn main() {
    input!{ n: usize, mut a: [i32;n] }
    a.sort();
    let size = a.len();
    let diff = a[size/2] - a[size/2-1];
    println!("{}", diff);
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i <(n); ++i)
#define ALL(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int,int>;


int main() {
  int n;
  cin >> n;
  double ans = double(n - n/2);
  ans /= double(n);
  //cout.precision(10);
  cout << ans << endl;

}

Measured memory_bytes: 3732
#include<stdio.h>

int main(void){
	double x,w,h,s,b,X,W,H;
	while(scanf("%lf,%lf,%lf",&x,&w,&h)!=EOF){
		if(w/(h*h)>=25){
			printf("%d\n",(int)x);
		}
	}
	return 0;
}

Measured memory_bytes: 628
#include<iostream>
#include<string>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<vector>
#include<tgmath.h>
using namespace std;

#define lld long long

int main(){
    int n;
    cin >> n;
    lld v;
    lld maxv = -10000000000;
    lld minv = 10000000000;
    cin >> v;
    minv = v;
    for (int i = 1; i < n; i++) {
        cin >> v;
        maxv = max(maxv,v-minv);
        minv = min(minv,v);
    }
    cout << maxv << endl;
}


Measured memory_bytes: 3116
#include<iostream>
#include <stdio.h>
#include<string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <cstdint>
#include <queue> 
#include <map>
#include <set>
#define MOD 1000000007
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n)  FOR(i,0,n)
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
typedef long long ll;
using namespace std;

int main(){

  int a,b,n;
  cin >> n >> a >> b;
  
  int ans = 0;
  FOR(i,1,n+1){
    int sum = 0;
    if(i < 10) sum += i;
    else if(i < 100) sum += (i/10) + (i%10);
    else if(i < 1000) sum += (i/100) +((i/10)%10) + i%10;
    else if(i < 10000) sum += (i/1000) + ((i/100)%10) +((i/10)%10) + i%10;
    else sum = 1;
    
    if(sum >= a && sum <= b) ans += i;
    
  }
  
  cout << ans << endl;

 return 0;
}

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

#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define repi(i,a,b) for(int i = (a); i < (b); i++)

using namespace std;

typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;

const int INF=1<<29;
const double EPS=1e-9;

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

int main(){
	int n;
	while(cin>>n,n){
		vector<int> ans;
		for(int i =0;i < n;i++){
			int x;
			cin>>x;
			ans.push_back(x);
		}
		if(n==1){
			cout <<ans[0]<<endl;
			continue;
		}
		int pre = ans[0];
		int j = 0;
		vector<string> data;
		for(int i =1;i < n;i++){
			if(pre+1 ==ans[i]){
				j++;
				if(i==n-1){
					pre = ans[i];
					int fis = pre -j;
					int sec = pre;
					j = 0;
					if(fis !=sec){
						stringstream ss1,ss2;
						ss1 <<fis;
						ss2 <<sec;
						string tmp = ss1.str() +"-"+ss2.str();
						//cout <<pre <<" "<<tmp<<endl;
						data.push_back(tmp);
					}else{
						stringstream ss;
						ss <<pre;
						data.push_back(ss.str());
					}
				}
			}else{
				int fis = pre -j;
				int sec = pre;
				j = 0;
				if(fis !=sec){
					stringstream ss1,ss2;
					ss1 <<fis;
					ss2 <<sec;
					string tmp = ss1.str() +"-"+ss2.str();
					data.push_back(tmp);
					if(i==n-1){
						stringstream ss;
						ss <<ans[i];
						data.push_back(ss.str());
					}
				}else if(fis==sec||i==n-1){
					stringstream ss;
					ss <<pre;
					data.push_back(ss.str());
					if(i==n-1){
						stringstream ss;
						ss <<ans[i];
						data.push_back(ss.str());
					}
				}
			}
			pre = ans[i];
		}
		for(int i =0;i < data.size();i++){
			if(i!=data.size()-1){
				cout <<data[i]<<" ";
			}else{
				cout <<data[i]<<endl;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 1260
#include <iostream>
#include <cstdio>
#include <cmath>
#include <climits>
using namespace std;

int main(){
  int n,x;
  while(1){
    cin>>n>>x;
    if(n==0) break;

    int counter = 0;
    for(int i = 1 ; i <= n; i++){
      for(int j = i+1; j <= n; j++){
        for(int k = j+1; k <= n; k++){
          if(i+j+k==x){
            counter++;
            //cout<<"find:"<<i<<' '<<j<<' '<<k<<endl;
          }
        }
      }
    }
    cout<<counter<<endl;
  }

  return 0;
}

Measured memory_bytes: 3064
import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.10f";

static string[] s_rd;
T RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
string RDR()() { return readln.chomp; }
T[] ARR(T = long)(in string str, T fix = 0) { auto r = str.split.to!(T[]); r[] += fix; return r; }
size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
long lcm(long x, long y) { return x * y / gcd(x, y); }

long mod = 10^^9 + 7;
//long mod = 998244353;
//long mod = 1_000_003;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }

void main()
{
	auto A = RDR.ARR;
	A.sort();

	writeln((A[2] - A[1]) + (A[1] - A[0]));
	stdout.flush();
	debug readln();
}


Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))
Q = int(input())
li = [0]*100001
for a in A:
    li[a] += 1
ans = sum(A)
# print(dict_A)
for i in range(Q):
    b, c = map(int, input().split())
    ans += (c-b)*li[b]
    li[c] += li[b]
    li[b] = 0
    print(ans)


Measured memory_bytes: 21120
import sys
input = sys.stdin.buffer.readline

class UnionFind:
    __slots__ = ["data"]
    
    def __init__(self, n=0):
        self.data = [-1]*(n+1)
    
    def root(self, x):
        if self.data[x] < 0:
            return x
        self.data[x] = self.root(self.data[x])
        return self.data[x]
    
    def unite(self, x, y):
        x = self.root(x)
        y = self.root(y)
        if x != y:
            if self.data[x] < self.data[y]:
                self.data[x] += self.data[y]
                self.data[y] = x
            else:
                self.data[y] += self.data[x]
                self.data[x] = y
    
    def same(self, x, y):
        return self.root(x) == self.root(y)
    
    def size(self, x):
        return -self.data[self.root(x)]
                


def main():
    n, m, k = map(int, input().split())
    friends = [0]*(n+1)
    blocks = [[] for _ in range(n+1)]
    uf = UnionFind(n)
    ans = ""
    for _ in range(m):
        a, b = map(int, input().split())
        friends[a] += 1
        friends[b] += 1
        uf.unite(a, b)
    for _ in range(k):
        c, d = map(int, input().split())
        blocks[c].append(d)
        blocks[d].append(c)
    for i in range(1, n+1):
        nf = friends[i]
        nb = 0
        for b in blocks[i]:
            if uf.same(i, b):
                nb += 1
        ans += "{} ".format(uf.size(i) - 1 - nf - nb)
    print(ans)


if __name__ == "__main__":
    main()

Measured memory_bytes: 24872
def cmb(n, r, mod):
    if r < 0 or r > n:
        return 0
    r = min(r, n - r)
    return g1[n] * g2[r] * g2[n - r] % mod


mod = 10 ** 9 + 7  # 出力の制限
N = 10 ** 6
g1 = [1, 1]  # 元テーブル
g2 = [1, 1]  # 逆元テーブル
inverse = [0, 1]  # 逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )


x, y = map(int, input().split())


if (x+y) % 3 != 0:
    print(0)
    exit()

count = (x+y)//3
x -= count
y -= count

ans = cmb(x+y, min(x, y), mod)
print(ans)

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

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 (a>b) { a=b; return 1; } return 0; }

#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

//-------------------------------------------------
//--MP Algorithm
//-------------------------------------------------
template <class T>
class MP
{
private:
    int n;
    const T p;
    vector<int> M;
public:
    MP(const T &s):p(s),n(s.size()){
        M.resize(n+1); M[0]=-1;
        int j=-1;
        rep(i,n){
            while(j>-1 && p[i]!=p[j]) j=M[j];
            M[i+1] = ++j;
        }
    }
    vector<int> matches(const T &s){
        vector<int> ret;
        int j=0;
        rep(i,s.size()){
            while(j>-1 && s[i]!=p[j]) j=M[j];
            if (++j == n){
                ret.push_back(i-j+1);
                j = M[j];
            }
        }
        return ret;
    }
};

//-------------------------------------------------

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin>>n;
    vi a(n),b(n);
    rep(i,n) cin>>a[i];
    rep(i,n) cin>>b[i];
    vi S(2*n-1), T(n);
    rep(i,2*n-1) S[i] = a[i%n]^a[(i+1)%n];
    rep(i,n) T[i] = b[i]^b[(i+1)%n];
    MP<vi> mp(T);
    auto ms = mp.matches(S);
    for(auto e:ms){
        cout<<e<<" "<<(b[0]^a[e])<<"\n";
    }
    return 0;
}


Measured memory_bytes: 9844
#include "bits/stdc++.h"

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define LOOP(i) while(i--)
#define PRINTALL(c) for(auto pitr=c.begin();pitr!=c.end();++pitr){cout<<*pitr;if(next(pitr,1)!=c.end())cout<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);

	int N=in();
	REP(k,N){
		cout << "Case " << k+1 << ":" << endl;
		int S=in();
		REP(i,10){
			int V=S*S;
			V %= 1000000;
			S = V/100;
			out(S);
		}
	}
	return 0;
}



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

typedef long long int ll;

int main()
{
    ll t=1;
    //cin>>t;
    while(t--)
    {
       ll n;
       cin>>n;
       ll a[n];
       std::vector<ll> b;
       ll req=1;
       for(ll i=0;i<n;i++)
       {
           cin>>a[i];
           if(a[i]==req)
           {
               b.push_back(a[i]);
               req++;
           }
       }
       ll ans = -1;
       if(b.size())
        ans = n - b.size();
       std::cout << ans << std::endl;
    }
    return 0;
}

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

int main() {
	long long n,mini = 10000000000000000,neck;
	
	vector<long long> t(5);
	cin >> n >> t[0] >> t[1] >> t[2] >> t[3] >> t[4];
	for (int i = 0; i < 5; i++) {
		if (t[i] < mini) {
			mini = t[i];
		}
	}
	neck = (n + mini - 1) / mini - 1;
	cout << 5 + neck << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <list>
#include <algorithm>
#include <cmath>

#define llong long long
#define rep(i,l,n) for(llong (i)=(l);(i)<(n);(i++))
#define _min(a,b) ((a)<(b)?(a):(b))
#define _max(a,b) ((a)>(b)?(a):(b))
#define _abs(a) ((a)>0?(a):(-(a)))

using namespace std;

int main(){
	int N;
	cin >> N;
	llong ans=0;
	rep(i,1,N){
		ans+=(N-1)/i;
	}
	cout << ans;
}


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

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

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

int n, m, s[N], t[M];
int f[N][M];

int32_t main()
{
	IOS
	// freopen("input.txt", "r", stdin);
	cin >> n >> m;
	for(int i=1; i<=n; i++) {
		cin >> s[i];
	}
	for(int i=1; i<=m; i++) {
		cin >> t[i];
	}
	for(int i=1; i<=n; i++){
		for(int j=1; j<=m; j++){
			f[i][j] = f[i-1][j] + f[i][j-1] + MOD - f[i-1][j-1];
			if (s[i] == t[j]) f[i][j] += 1 + f[i-1][j-1];
			f[i][j] %= MOD;
		}
	}
	int ans = f[n][m] + 1;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 31616
#include<bits/stdc++.h>
#define ll          long long
#define dl          double
#define pb          push_back
#define eb          emplace_back
#define mp          make_pair
#define F           first
#define S           second
#define rep(i,a,b)  for(i=a;i<b;i++)
#define all(v)      v.begin(),v.end()
#define allr(v)     v.rbegin(),v.rend()
#define mod         1e9+7
#define CIN(V,s,n)  for(int i=s;i<n;i++){cin >> V[i];}
#define COUT(V,s,n) for(int i=s;i<n;i++){cout <<  V[i] << " ";}
#define SbS         sortbysec
#define fast        ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define CLEAR(V);   for(ll i=0;i<V.size();i++) V[i] = 0;

using namespace std;

ll cal_W(vector<ll> &Caf,ll D)
{
    ll work=0,s = Caf.size();
    //for(ll j=0;j<D;j++)
    for(ll i=0;i<s;i++)
    {
        work += max(Caf[i] - i/D,0LL);
    }
    return work;
}

ll BS(vector<ll> &Caf,ll m,ll s,ll e)
{
    if(s>e)
        return s;
    ll mid = (s+e)/2;
    ll W = cal_W(Caf,mid);
    if(W==m)
    {
        return mid;
    }
    else if(W > m)
    {
        return BS(Caf,m,s,mid-1);
    }
    else
        return BS(Caf,m,mid+1,e);
}

int main()
{
ll t=1;
//cin >> t;
while(t--)
{
    ll n,m,i,j,k,h,l,w,q,u,v,c;
    cin >> n >> m ;
    if(m>1)
    cout << (n-m+1)-1;
    else
        cout << 0;


}
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(v) v.begin(),v.end()
#define len(x) (ll)(x).length()
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int INF=1e9;
const ll INFS=1e18;
const int di[] = {-1,0,1,0};
const int dj[] = {0,-1,0,1};
 
int main() {
  int n;
  cin>>n;
  vector<int> s(n);
  vector<int> m;
  rep(i,n) cin>>s[i];
  rep(i,n){
    if(s[i]%10!=0){
      m.push_back(s[i]);
    }
  }
  sort(all(m));
  sort(all(s));
  int sum=0;
  rep(i,n) sum+=s[i];
  if(sum%10!=0){
    cout<<sum<<endl;
    return 0;
  }
  else{
    if(m.size()==0){
      cout<<0<<endl;
    }
    else{
      cout<<sum-m[0]<<endl;
    }
  }
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define ll long long int
#define ff first
#define ss second
typedef tree<pair<ll,ll>,null_type,less<pair<ll,ll>>,rb_tree_tag,
              tree_order_statistics_node_update>pbds;
//order_of_key:index number if it was there in sorted array
//find_by_order:value at 3rd index in sorted array.
const ll maxs=1e6+5;
ll root[maxs];

class cmp{
  bool operator()(const ll &a,const ll &b)
  {
      return a<b;
  }
};
void init()
{
    iota(root,root+maxs,0);
}
ll find(ll u)
{
    ll f;
    if(root[u]==u)
    return u;
    else
    {
        ll f=find(root[u]);
        root[u]=f;
        return f;
    }
}
void Union(ll x,ll y)
{
    ll u=find(x);
    ll v=find(y);
    root[v]=u;
}
ll power(ll x,ll y,ll p)
{
    ll res=1;
    x=x%p;
    while(y>0)
    {
        if(y&1)
        res=(res*x)%p;
        
        y=y>>1;
        x=(x*x)%p;
    }
    return res;
}
  

int main()
{
    ll t,n,i,k,y,x,j;
   ll a,b,c,d;
   cin>>a>>b>>c>>d;
   ll op1=a*d;
   ll op2=b*c;
   ll op3=b*d;
   ll op4=a*c;
   cout<<max(op1,max(op2,max(op3,op4)));
    return 0;
    
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define ll long long
#define LEFT(a) ((a)<<1)
#define RIGHT(a) (LEFT(a) + 1)
#define MID(a,b) ((a+b)>>1)
#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
using namespace std;

const int N = 110000;

int main()
{
    ios_base::sync_with_stdio(false);
    int n;
    string a, b, c;
    cin >> n >> a >> b >> c;
    int ans = 0;
    for (int i = 0; i < n; i++){
        set < char > s;
        s.insert (a[i]);
        s.insert (b[i]);
        s.insert (c[i]);
        ans += (int)s.size() - 1;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<utility>
#include<algorithm>
#include<functional>
using namespace std;

int main(){
    int inf = 1000000;
    int n,e,t;
    cin >> n >> e >> t;
    vector<int>dp(n,inf);
    for(int i=0;i<n;i++){
        int w;
        cin >> w;
        if(w==1){
            dp[i] = 1;
        }
    }
    vector<pair<int,vector<int> > >rec;
    for(int i=0;i<e;i++){
        int g,c;
        cin >> g >> c;
        g--;
        vector<int> v(c);
        for(int j=0;j<c;j++){
            cin >> v[j];
            v[j]--;
        }
        rec.push_back(make_pair(g,v));
    }
    bool flag =1;
    while(flag){
        flag = 0;
        for(auto& x:rec){
            bool fflag = 1;
            vector<int> tt;
            for(auto& s:x.second){
                if(dp[s]!=inf){
                    tt.push_back(dp[s]);
                }else{
                    fflag = 0;
                }
            }
            if(fflag){
                sort(tt.begin(),tt.end(),greater<int>());
                int tmp =tt[0];
                int ttmp = 1;
                for(int i = 1;i<tt.size();i++){
                    if(tmp-ttmp<tt[i]){
                        tmp = ttmp+tt[i];
                        ttmp++;
                    }else{
                        ttmp++;
                    }
                }
                if(dp[x.first]>tmp){
                    flag = 1;
                    // cout << mx << endl;
                    // cout << cnt << endl;
                    dp[x.first] = tmp;
                    //cout << x.first << " " << dp[x.first] << endl;
                }
            }
        }
    }
    // for(int i=0;i<n;i++){
    //     cout << dp[i] << " ";
    // }
    // cout << endl;
    if(dp[t-1]!=inf){
        cout << dp[t-1] << endl;
    }else{
        cout << -1 << endl;
    }
    return 0;
}


Measured memory_bytes: 3220
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  int n; cin >> n;
  VV<> g(n);
  for (int i = 0; i < n - 1; ++i) {
    int u, v; cin >> u >> v, --u, --v;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  V<> d(n);
  auto dfs = [&](const auto& dfs, int v, int p) -> void {
    for (int w : g[v]) if (w != p) {
      d[w] = d[v] + 1;
      dfs(dfs, w, v);
    }
  };
  dfs(dfs, 0, -1);
  int x = max_element(begin(d), end(d)) - begin(d);
  d[x] = 0;
  dfs(dfs, x, -1);
  int k = *max_element(begin(d), end(d));
  cout << (k % 3 == 1 ? "Second" : "First") << '\n';
}

Measured memory_bytes: 18560
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

using boost::multiprecision::cpp_int;
using namespace std;

#if __has_include("print.hpp")
  #include "print.hpp"
#endif

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define MOD 1000000007

typedef long long ll;
typedef pair<ll, ll> p;


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s, t;
  cin >> s >> t;
  cout << t << s << endl;
}


Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
 
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const int MOD = 1000000007;
const char nl = '\n';
const int MX = 100001; //check the limits, dummy
 
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);    
	
    int N; cin >> N;
    int cnt[N]; F0R(i, N) cnt[i] = 0;
    F0R(i, N-1) {
        int X; cin >> X; X--; cnt[X]++;
    }
    F0R(i, N) {
        cout << cnt[i] << nl;
    }
	
	return 0;
}
 
// read the question correctly (ll vs int)
// template by bqi343



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

using namespace std;

int main(){
  string s, t;
  cin >> s >> t;
  bool ans=false;
  for(int i=0;i<s.length();i++){
    if(s.substr(s.length()-i, i)==t.substr(0, i) && s.substr(0, s.length()-i-1)==t.substr(i,s.length()-i-1)){
      ans=true;
    }
  }
  if(ans){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.Scanner;
import java.util.PriorityQueue;

class Main {
    public static void main (String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String operation;
        PriorityQueue<Integer> queue = new PriorityQueue<Integer>();
        StringBuilder sb = new StringBuilder("");
        while (true) {
            operation = br.readLine();
            if (operation.charAt(0) == 'i') {
                queue.add(Integer.parseInt(operation.substring(7)) * -1);
            } else if (operation.charAt(1) == 'x') {
                sb.append(queue.poll() * -1);
                sb.append('\n');
            } else {
                break;
            }
        }
        System.out.print(sb);
    }
}

Measured memory_bytes: 134968
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int abc[] = new int[3];
		abc[0] = sc.nextInt();
		abc[1] = sc.nextInt();
		abc[2] = sc.nextInt();
		int k = sc.nextInt();

		Arrays.sort(abc);

		for (int i = 0; i < k; i++) {
			abc[2] = abc[2] * 2;
		}
		System.out.println(abc[0]+abc[1]+abc[2]);

	}
}

Measured memory_bytes: 21844
#include<stdio.h>
int main(void)
{
	int n,m,l,array1[100][100],array2[100][100],i,j,k;
	long long int a=0;
	scanf("%d %d %d",&n,&m,&l);
	for(i=0;i<n;i++){
		for(k=0;k<m;k++){
			scanf("%d",&array1[k][i]);
		}
	}
	for(k=0;k<m;k++){
		for(j=0;j<l;j++){
			scanf("%d",&array2[j][k]);
		}
	}
	for(i=0;i<n;i++){
		for(j=0;j<l;j++){
			for(k=0;k<m;k++){
				a+=array1[k][i]*array2[j][k];
			}
			if(j!=l-1){
				printf("%lld ",a);
				a=0;
			}else{
				printf("%lld",a);
				a=0;
			}
		}
		printf("\n");
	}	
	return 0;
}

Measured memory_bytes: 2728
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define MAX(a,b) a=a>b?a:b
#define MIN(a,b) a=a<b?a:b
#define REP(i,x,n) for(int i=x;i<n;i++)
#define REPR(i,x,n) for(int i=n-1;i>=x;i--)
#define pb  push_back
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLr(obj) (obj).rbegin(), (obj).rend()
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const double PI=3.14159265358979323846;



int main(){
   ll n,k,cnt=0;;
   string s;
   ll a[202020],b[202020]={},ha=0,ma=1000;
   cin>>n;
   a[0]=40000;
   bool f=0;//1があがり
   rep(i,n){
       cin>>a[i+1];
       if(f){
           if(a[i]>a[i+1]){
               f=0;
               b[i-1]=1;
           }
       }else{
           if(a[i]<a[i+1]){
               f=1;
               b[i-1]=2;
           }
       }
   }
//    rep(i,n){
//        cout<<b[i]<<endl;
//    }
   rep(i,n){
       if(b[i]==2){
           ha+=ma/a[i+1];
           ma%=a[i+1];
           //cout<<2<<":"<<i<<ma<<endl;
       }else if(b[i]==1){
           ma+=a[i+1]*ha;
           ha=0;
           //cout<<1<<":"<<i<<ma<<endl;
       }
   }
   ma+=a[n]*ha;
   cout<<ma<<endl;
}


Measured memory_bytes: 5172
#include<iostream>
#include<string>
#include<cmath>
#include<algorithm>
using namespace std; 
int main(){
  char x,y,z;
  char P='A';
  while(cin>>x>>z>>y){
    if(x!=P&&y!=P){
      continue;
    }
    else if(x==P){
      P=y;continue;
    }
    else if(y==P){
      P=x;
    }
  }
  cout<<P<<endl;
    
return 0;
}

Measured memory_bytes: 3024
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <set>
#include <vector>
#include <map>
#include <cstdio>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <cassert>
#include <climits>
#include <numeric>
#include <sstream>
using namespace std;
typedef long long ll;
#define DEBUG
#ifdef DEBUG
	#define debug printf
#else
	#define debug(...)
#endif
int main(int argc, char const *argv[])
{
	ll n,k;
	scanf("%lld%lld",&n,&k);
	printf("%lld\n",min(n % k,k - n % k));
	return 0;
}

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

int main(){
   int n,q,C=0;
   cin >> n;
   vector<int> S(n);
   for(int i=0;i<n;i++){
       cin >> S.at(i);
   }
   cin >> q;
   vector<int> T(q);
   for(int i=0;i<q;i++){
       cin >> T.at(i);
   }
  for(int i=0;i<q;i++){
      int left=0,right=n;
      int mid;
      while(left<right){
          mid=(left+right)/2;
          if(T.at(i)==S.at(mid)){
              C++;
              break;
          }
          else if(T.at(i)<S.at(mid)){
              right=mid;
          }
          else{
              left=mid+1;
          }
      }
  }
   cout << C << endl;
}


Measured memory_bytes: 3280
ans = 0
min = 10
5.times do 
  a = gets.to_i
  ans += (a + 9) / 10 * 10
  min = a % 10 if a % 10 != 0 && min > a % 10 
end
if min == 10
  puts ans
else
  puts ans - 10 + min
end

Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (ll i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
typedef long long ll;
const long long INF = 1LL << 62;
typedef pair<ll, ll> P;
int main()
{
    ll N, K;
    cin >> N >> K;
    vector<ll> x(N), y(N), xt(N), yt(N);

    rep(i, N) {
        cin >> x[i] >> y[i];
        xt[i] = x[i];
        yt[i] = y[i];

    }

    sort(all(xt));
    sort(all(yt));

    ll ans = 1LL * (xt[N - 1] - xt[0]) * (yt[N - 1] - yt[0]);

    rep(xl, N) {
        repd(xr, xl + 1, N) {
            rep(yl, N) {
                repd(yr, yl + 1, N) {
                    int cnt = 0;
                    rep(i, N) {
                        if (x[i] >= xt[xl] && x[i] <= xt[xr] && y[i] >= yt[yl] && y[i] <= yt[yr]) cnt++;
                    }
                    if (cnt >= K) ans = min(ans, 1LL * (xt[xr] - xt[xl]) * (yt[yr] - yt[yl]));
                }
            }
        }
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main{
    public static void main(String[]args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        if(a%3==0 || b%3==0 || (a+b)%3==0){
            System.out.println("Possible");
        }else{
            System.out.println("Impossible");
        }
    }
}

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

ll mod = (1e9 + 7);
vector<vector<char> > grid;
vector<vector<ll> > ans;
int main()
{
    ll h,w;    
    cin>>h>>w;
    grid.resize(h,vector<char> (w));
    ans.resize(h,vector<ll> (w));
    for(ll i=0;i<h;i++)
    {
        for(ll j=0;j<w;j++)
        {
            cin>>grid[i][j];
        }
    }
    ans[0][0]=1;
    for(ll i=1;i<h;i++)
    {
        if(grid[i][0] == '#')
        ans[i][0]=0;
        else
        ans[i][0]=ans[i-1][0];
    }
    for(ll i=1;i<w;i++)
    {
        if(grid[0][i]=='#')
        ans[0][i]=0;
        else
        ans[0][i]=ans[0][i-1];
    }
    for(ll i=1;i<h;i++)
    {
        for(ll j=1;j<w;j++)
        {
            if(grid[i][j] == '#')
            ans[i][j]=0;
            else
            ans[i][j]=(ans[i-1][j] + ans[i][j-1])%mod;
        }
    }
    cout<<ans[h-1][w-1];
    return 0;
}

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

using namespace std;

int main() 
{
    cin.tie(0); cout.tie(0);
    ios::sync_with_stdio(false);
    
    string x;
    cin >> x;
    
    if (x[2] == x[3] && x[4] == x[5])
        cout << "Yes\n";
    else
        cout << "No\n";
}

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


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

struct edge {int to; ll cost; };

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

 
int main(){
  int n;
  cin >> n;
  vector<edge> G[n];
  ll dist[n] = {};
  for(int i=0; i<n-1; i++){
    int x, y;
    ll w;
    cin >> x >> y >> w;
    x--; y--;
    G[x].push_back({y, w});
    G[y].push_back({x, w});
  }
  dist[0] = 0;
  queue<int> que;
  que.push(0);
  while(!que.empty()){
    int now = que.front();
    que.pop();
    for(int j=0; j<G[now].size(); j++){
      edge e = G[now][j];
      if(dist[e.to]==0){
        dist[e.to] = dist[now]+e.cost;
        que.push(e.to);
      }
    }
  }
  for(int i=0; i<n; i++){
    if(dist[i]%2) cout << 0 << endl;
    else cout << 1 << endl;
  }
  return 0;
}


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

using namespace std; 
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>; 

#define INF INT_MAX;
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()

int main(){
  int N;
  cin>>N;
  vector<int>A(N);
  for(int i=0;i<N;i++)cin>>A[i];
  vector<ll>sum(N+1);
  sum[0]=0;
  for(int i=1;i<=N;i++)sum[i]+=sum[i-1]+A[i-1];
  map<ll,int>m;
  ll ans=0;
  m[0]++;
  for(int i=1;i<=N;i++){
    ans+=m[sum[i]];
    m[sum[i]]++;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 15104
while True:
    h,w = map(int, input().split())
    if (h == 0) and (w == 0):
        break
    for i in range(h):
        for j in range(w):
            if ((i % 2 == 0) and (j % 2 == 1)) or ((i % 2 == 1) and (j % 2 == 0)) :
                print('.',end='')
            else:
                print('#',end='')
        print()
    print()


Measured memory_bytes: 7000
def calc(x):
    for i in range(10):
        if 10 ** i > x:
            return i

N = int(input())
tmp = calc(N)
result = 0
for i in range(tmp):
    if i % 2 == 0:
        if 10 ** (i+1) > N:
            result = result + N - (10 ** i) + 1
            break
        result += 9 * (10 ** i)
print(result)


Measured memory_bytes: 2940
#include <cstdint>
#include <iostream>

using namespace std;

int main()
{
    int64_t a, b;
    cin >> a >> b;

    int res = 1;
    while (a * 2 <= b) {
        res += 1;
        a *= 2;
    }

    cout << res << "\n";
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); ++i)
const ll mod = 2019;
int main(void) {
  ll L, R;
  cin >> L >> R;
  if(R - L >= mod) {
    cout << 0 << endl;
    return 0;
  }
  int ans = mod;
  for(ll i = L; i <= R - 1; i++) {
    for(ll j = L + 1; j <= R; j++) {
      if(i >= j) continue;
      int now = (i * j) % mod;
      ans = min(ans, now);
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

void dfs_init(int);
void dfs(int,int);

int a[100][100],c[100],d[100],f[100],t;

int main(){
  int n,u,k,v,i,j;

  scanf("%d",&n);

  for(i=0;i<=n-1;i++){
    for(j=0;j<=n-1;j++){
      a[i][j]=0;
    }
  }
  
  for(j=0;j<=n-1;j++){
    scanf("%d%d",&u,&k);
    u--;
    for(i=0;i<=k-1;i++){
      scanf("%d",&v);
      v--;
      a[u][v]=1;
    }
  }
  dfs_init(n);
  return 0;
}

  void  dfs_init(int n){
    int i;

    for(i=0;i<=n-1;i++){
      c[i]=-1;
      t=0;
    }

    for(i=0;i<=n-1;i++){
      if(c[i]==-1)dfs(i,n);
    }

    for(i=0;i<=n-1;i++){
      printf("%d %d %d\n",i+1,d[i],f[i]);
    }
  }

  void dfs(int u,int n){
    int i;
    c[u]=0;
    d[u]=++t;
    for(i=0;i<=n-1;i++){
      if(a[u][i]&&c[i]==-1)dfs(i,n);
    }
    c[u]=1;
    f[u]=++t;
  }





















	

  
    



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

int main(){
	string s,t,u;
	int a,b;
	cin>>s>>t;
	cin>>a>>b;
	cin>>u;
	if(u==s)	a=a-1;
	if(u==t)	b-=1;
	cout<<a<<' '<<b;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#define lol(i,n) for(int i=0;i<n;i++)
#define mod 100000007
typedef long long ll;
using namespace std;

int main(){
	int a,b;cin>>a>>b;
	cout<<a*a-b<<endl;
	return 0;
}


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

int main(){
    int N,minus=0;
    long long ans = 0;
    cin>>N;
    vector<int> A(N);

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

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

    for(int i=0; i<N; i++){
        if(i == 0 ){

            if(minus % 2 == 0) ans += A[i];
            else ans -= A[i];
        }
        
        else ans += A[i];
    }

    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 640
//#pragma GCC optimize("Ofast")

#pragma GCC optimize("O3")
//#pragma GCC target("avx,avx2,fma")
#include<iostream>
#include<algorithm>
#include<string>
#include<cmath>
#include<cstdlib>
#include<set>
#include<vector>
#include<sstream>
#include<queue>
#include <iomanip>
#include<unordered_set>
#include <stack>
#include <unordered_map>
#include <map>
constexpr auto INF = 9223372036854775807;
typedef long long int ll;
typedef unsigned long long int ull;
typedef unsigned long int ul;
#define f(i,a,b) for(ll i=(ll)a;i<(ll)b;i+=1)
#define rf(i,a,b) for(ll i=(ll)a;i>=(ll)b;i-=1)
#define endl '\n'
#define N 1000000007// prime modulo value 
#define C 1000000001
#define M 998244353
#define all(x) x.begin(),x.end()
using namespace std;
// From Geeksforgeeks
inline ll gcd(ll a, ll b)
{
	if (b == 0)
		return a;
	return gcd(b, a % b);
}
// Power function took from geeksforgeeks
ll power(ll x, ll y)
{
	ll res = 1;

	x = x;
	if (x == 0) return 0;
	while (y > 0)
	{
		if (y & 1)
			res = (res * x);
		y = y >> 1;
		x = (x * x);
	}
	return res;
}
double dist(ll x1, ll y1, ll x2, ll y2)
{
	double ans = sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
	return ans;
}
int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	ll n;
	cin >> n;
	vector<ll> arr(n, 0);
	f(i, 0, n)
		cin >> arr[i];
	vector<ll> fir(n, 0);
	vector<ll> sec(n, 0);
	fir[0] = arr[0];
	f(i, 1, n)
		fir[i] = max(fir[i - 1], arr[i]);
	sec[n - 1] = arr[n - 1];
	rf(i, n -2, 0)
	{
		sec[i] = max(sec[i + 1], arr[i]);
	}
	f(i, 0, n)
	{
		if (i == 0)
		{
			cout << sec[1] << endl;
		}
		else if (i == n - 1)
		{
			cout << fir[i - 1] << endl;
		}
		else
			cout << max(fir[i - 1], sec[i + 1]) << endl;
	}
	return 0;
}


Measured memory_bytes: 6272
# Here your code !

n , m = gets.chomp.split(" ").map(&:to_i)
a = []
b = []
c = []
d = []
n.times do |i|
    a[i] , b[i] = gets.chomp.split(" ").map(&:to_i)
end
m.times do |i|
    c[i] , d[i] = gets.chomp.split(" ").map(&:to_i)
end
n.times do |i|
    x = a[i]
    y = b[i]
    ans = -1
    max = 999999999
    m.times do |j|
        mh = ((x-c[j]).abs+(y-d[j]).abs)
        if(mh < max)
            max = mh
            ans = j
        end
    end
    p ans + 1
end

Measured memory_bytes: 1916
#include <bits/stdc++.h>
#define int int64_t
using namespace std;

signed main()
{
     int x, y;
     cin >> x >> y;
     int ans = 1;
     while (x * 2 <= y) {
          x *= 2;
          ans++;
     }
     cout << ans << endl;
     return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;cin>>s;
  int n=s.size(),p=0,q=0;
  vector<int>a(1);
  for(int i=0;i<n;i++){
    char c=s.at(i);
    if(p==0){
      if(c=='A'||c=='C'||c=='G'||c=='T'){
        a.push_back(1);
        q++;
        p=1;
      }
    }
    else{
      if(c=='A'||c=='C'||c=='G'||c=='T'){a.at(q)++;}
      else p=0;
    }
  }
  sort(a.begin(),a.end());
  cout<<a.at(q)<<endl;
}

Measured memory_bytes: 256
/*
 * Author: .-O_O-.
 */
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include<bits/stdc++.h>
using namespace __gnu_pbds;
using namespace std;
#define ll long long
#define pb push_back
#define vi vector<int>
#define rep0(a,b) for(int a=0;a<b;a++)
#define rep1(a,b) for(int a=1;a<=b;a++)
#define repp(a,b,c) for(int a=b;a<c;a++)
#define in insert
#define len length()
#define si size()
#define lb lower_bound
#define ub upper_bound
#define beg begin()
#define en end()
#define f first
#define s second
#define pr(a) cout<<a
#define pr2(a,b) cout<<a<<" "<<b<<"\n"
#define nx cout<<"\n"
#define int long long
// void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
                                                     
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]"<<endl;}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define deb(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define deb(x...)
#endif
const ll mod = 1000000007;
const ll N = 200005;
const ll mm = 1e+18;
int f(string s){
    int res=0;
    int n=s.len;
    int x=1;
    for(int i=n-1;i>=0;i--){
        int r=(int)(s[i]-'0');
        res+=r*x;
        x*=10;
    }
    return res;
}
void solve()
{
    string s;
    cin>>s;
    int n=s.len;
    int ans=0;
    rep0(i,(1<<(n-1))){
        string ff="";
        ff+=s[0];
        rep0(j,n-1){
            if((i>>j)&1){
                ans+=f(ff);
                ff.clear();
            }
            ff+=s[j+1];
        }
        ans+=f(ff);
    }
    pr(ans);
}
signed main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int t=1;
    //cin>>t;
    rep1(_i,t){
        //cout<<"Case #"<<_i<<": ";
        solve();
        //nx;
    }
    return 0;
}


Measured memory_bytes: 3600
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include <cstdio>
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stdio.h>
#include <stack>
#include <queue>
using namespace std;
using ll = long long;
map <int ,int> mpa,mpb;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  ll N;
  cin >> N;
  if(N==1){
    cout << 1 << endl;
    return 0;
  }
  if(N==2){
    cout << 2 << endl;
    return 0;
  }
  ll n=0;
  ll s=0;
  for(int i=1;i<N;i++){
    s=i*(i+1)/2;
    if(s>=N){
      n=i;
      break;
    }
  }
  ll c=s-N;
  for(int i=1;i<=n;i++){
    if(i==c) continue;
    cout << i << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,m) for(long long i=0; i<m; i++)
#define per(i,m) for(long long i=m-1; i>=0; i--)
#define FOR(i,n,m) for(long long i=n; i<m; i++)
#define ROF(i,n,m) for(long long i=n-1; i>=m; i--)
#define all(x) (x).begin(),(x).end()
#define EPS (1e-7)
#define INF (1e18)
#define PI (acos(-1))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
typedef pair<ll, ll> LP;

ll POW(ll x,ll n){
  if(n==0)return 1;
  if(n%2==0)return POW(x*x%MOD,n/2);
  return x*POW(x,n-1)%MOD;
}

ll gcd(ll u, ll v) {
  ll r;
  while (0 != v) {
    r = u % v; u = v; v = r;
  }
  return u;
}
 
ll KAI(ll m)
{
  if(m<0) return 0;
  if(m==0) return 1;
  return m*KAI(m-1)%MOD;
}
 
ll extGCD(ll a, ll b, ll &x, ll &y) {
    if (b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    ll d = extGCD(b, a%b, y, x);
    y -= a / b * x;
    return d;
}
 
inline ll mod(ll a, ll m) {
    return (a % m + m) % m;
}
 
ll modinv(ll a) {
    ll x, y;
    extGCD(a, MOD, x, y);
    return mod(x, MOD);
}
 
ll COM(ll m,ll n)
{
  if(m<n) return 0;
  if(n<0) return 0;
  if(n==0) return 1;
  if(m==n) return 1;
  return KAI(m)%MOD*modinv(KAI(n)%MOD*KAI(m-n)%MOD)%MOD;
}

ll DEC(ll x,ll m,ll n)
{
  return x%POW(m,n+1)/POW(m,n);
}

ll keta(ll x,ll n)
{
  if(x==0)return 0;
  return keta(x/n,n)+1;
}

ll DIV(ll x,ll n)
{
  if(x==0)return 0;
  return x/n+DIV(x/n,n);
}


int main()
{
  ll n,a[120000],ans;
  cin >> n;
  rep(i,n)cin >> a[i];
  ans=a[0];
  rep(i,n)ans=gcd(ans,a[i]);
  printf("%lld",ans);
}

Measured memory_bytes: 1024
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AtCoder
{
    class Program
    {
        private const int MODULO = 1000000007;
        private static string Read() { return Console.ReadLine(); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }

        struct Set
        {
            public int val;
            public int pos;
            public int rank;
        }
        static int Solve(int N, int[] P)
        {
            var set1 = new Set[N];
            for (int i = 0; i < N; ++i)
            {
                set1[i].val = P[i];
                set1[i].pos = i;
            }
            var set2 = set1.OrderBy(set => set.val).ThenBy(set => set.pos).ToArray();
            for (int i = 0; i < N; ++i)
            {
                set2[i].rank = i;
            }
            var set3 = set2.OrderByDescending(set => set.rank).ToArray();
            int cnt = 1;
            int max = 1;
            for (int i = 1; i < N; ++i)
            {
                if (set3[i].pos < set3[i - 1].pos)
                {
                    max = Math.Max(++cnt, max);
                }
                else
                {
                    cnt = 1;
                }
            }
            return N - max;
        }
        static void Main(string[] args)
        {
            int N = ReadInt();
            int[] P = new int[N];
            for (int i = 0; i < N; ++i) { P[i] = ReadInt(); }
            Console.WriteLine(Solve(N, P));
        }
    }
}


Measured memory_bytes: 35260
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define fr(i,n) for(i=0;i<n;i++)
#define F first
#define S second
#define fast std::ios_base::sync_with_stdio(false)
#define mod 1000000007
#define pi 3.14159265
int main() {
	fast;
	lli n;
	cin>>n;
	lli i,j,k;
	lli ans[100000]={0};
	for(i=1;i<105;i++)
	{
		for(j=1;j<105;j++)
		{
			for(k=1;k<105;k++)
			{
				lli temp=i*i+j*j+k*k+i*j+j*k+k*i;
				if(temp<100000)
					ans[temp]++;
			}
		}
	}
	for(i=1;i<=n;i++)
	{
		cout<<ans[i]<<"\n";
	}
	
	return 0;
}

Measured memory_bytes: 4380
#include<bits/stdc++.h>
#define sf1(n) scanf("%d",&n)
#define sf2(n,q) scanf("%d %d",&n,&q)
#define f first
#define ss second
#define pb push_back
#define lli long long
#define mem(ar,false) memset(ar,false,sizeof(ar))
#define mpr make_pair
#define endl "\n"
#define mod 1000000007
#define inf 9000000000000000000LL
#define M 200005

using namespace std;



int main()
{

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

    int n;
    cin >> n;
    int d = n^1;
    cout << d << endl;

    return 0;
}


Measured memory_bytes: 3644