akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
int input(int[]);
int isMatch(int[], int[], int, int);
int binarySearch(int, int[], int);
int S[100000], T[50000];

main(){
  int n, q;

  n = input(S);
  q = input(T);
 
  printf("%d\n", isMatch(S, T, n, q));
  return 0;
}

int input(int array[]){
  int i, e;
  scanf("%d", &e);
  for(i = 0; i < e; i++){
    scanf("%d", &array[i]);
  } 
  return e;
}

int isMatch(int S[], int T[], int n, int q){
  int count = 0, i;

  for(i = 0; i < q; i++){
    count += binarySearch(T[i], S, n);
  }
  return count;
}

int binarySearch(int key, int S[], int right){
  int mid, left;
  left = 0;
  while(left < right){
    mid = (right + left) / 2;
    if(key == S[mid]){
      return 1;
    } else if(key > S[mid]){
      left = mid + 1;
    } else {
      right = mid;
    }
  }
  return 0;
}

Measured memory_bytes: 1184
#!/usr/bin/env python
from collections import deque

def main():
    n, q = map(int, input().split())
    link = [[] for _ in range(n+1)]
    for _ in range(n-1):
        a, b = map(int, input().split())
        link[a].append(b)
        link[b].append(a)
    manip = [list(map(int, input().split())) for _ in range(q)]

    cnt = [0 for _ in range(n+1)]
    for m in manip:
        node, x = m
        cnt[node] += x

    parent = [0 for _ in range(n+1)]
    unchecked = [True for _ in range(n+1)]
    unchecked[1] = False
    que = deque([1])
    while que:
        node = que.pop()
        for l in link[node]:
            if unchecked[l]:
                unchecked[l] = False
                cnt[l] += cnt[node]
                que.append(l)

    print(' '.join(map(str, cnt[1:])))

if __name__ == '__main__':
    main()


Measured memory_bytes: 117084
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
using namespace std;
typedef long long ll;
ll t,a,b,c,i,j,k,n,m,arr[100005],flag[100005];
int main(){
	string s;
	cin>>s;
	if(s[0]=='M')
		printf("6");
	else if(s[0]=='T'&&s[1]=='U')
		printf("5");
	else if(s[0]=='W')
		printf("4");
	else if(s[0]=='T'&&s[1]=='H')
		printf("3");
	else if(s[0]=='F')
		printf("2");
	else if(s[0]=='S'&&s[1]=='A')
		printf("1");
	else
		printf("7");
	return 0;
}


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

#define int             long long int
#define ld              long double
#define ff              first
#define ss              second
#define mp              make_pair
#define pb              push_back
#define si              set <int>
#define vi              vector <int>
#define pii             pair <int, int>
#define vpii            vector <pii>
#define vpp             vector <pair<int, pii>>
#define mii             map <int, int>
#define mpi             map <pii, int>
#define msi             map < string, int >
#define loop(i,s,e)     for(int i=s;i<e;i++)
#define rloop(i,e,s)    for(int i=e;i>=s;i--)
#define mset(a,f)       memset(a,f,sizeof(a))
#define spi             set <pii>
#define endl            "\n"
#define M               1000000007
#define sz(x)           ((int) x.size())
#define all(p)          p.begin(), p.end()
#define que_max         priority_queue <int>
#define que_min         priority_queue <int, vi, greater<int>>
#define bug(...)        __f (#__VA_ARGS__, __VA_ARGS__)
#define print(a)        for (auto x : a) cout << x << " "; cout << endl
#define Print(a,x,y)    for (int i=x; i<y; i++) cout<< a[i]<< " "; cout << endl

inline int power(int a, int b)
{
	int x = 1;
	while (b)
	{
		if (b & 1) x *= a;
		a *= a;
		b >>= 1;
	}
	return x;
}

template <typename Arg1>
void __f (const char* name, Arg1&& arg1) { cout << name << " : " << arg1 << endl; }
template <typename Arg1, typename... Args>
void __f (const char* names, Arg1&& arg1, Args&&... args)
{
	const char* comma = strchr (names + 1, ',');
	cout.write (names, comma - names) << " : " << arg1 << " | "; __f (comma + 1, args...);
}

const int N = 200005;
int arr[N];

void solve()
{
	int h, n;
	cin >> h >> n;
	int a[n];
	int sum = 0;
	loop(i, 0, n)
	{
		cin >> a[i];
		sum += a[i];
	}
	if (sum < h)
	{
		cout << "No";
	}
	else cout << "Yes";
	return;
}

int32_t main()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);


	clock_t z = clock();
	int t = 1;
	//cin >> t;
	while (t--)
	{
		solve();
	}
	cerr << "Total Time : " << ((double)(clock() - z) / CLOCKS_PER_SEC);

	return 0;
}

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

#define LL long long
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ALL(x) (x).begin(),(x).end()
const int IINF = 1e9;
const LL LINF = 1e18;
const LL mod = 1e9+7;

int main() {
    int N;
    cin >> N;
    double s = 0;
    REP(i, N) {
        double x;
        cin >> x;
        s += 1/x;
    }
    double res = 1/s;
    cout << res << endl;
    return 0;
}



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

public class Main {

    private static Scanner sc;

    public static void main(String[] args) {
        Main instance = new Main();
        sc = instance.new Scanner();
        instance.solve();
    }

    private void solve() {
        try {
            String S = sc.next();
            String T = sc.next();
            int l = T.length();
            int cc = 0;
            for (int i = 0; i < S.length() - l + 1; i++) {
            	int c = 0;
            	for (int j = 0; j < l; j++) {
            		if (S.charAt(i + j) == T.charAt(j)) {
            			c++;
            		}
            	}
            	if (c > cc) {
            		cc = c;
            	}
            }
            System.out.println(l - cc);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    private class Scanner {
        String[] s;
        int i;
        BufferedReader br;
        String regex = " ";

        public Scanner() {
            s = new String[0];
            i = 0;
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        @Override
        protected void finalize() throws Throwable {
            try {
                super.finalize();
            } finally {
                destruction();
            }
        }

        private void destruction() throws IOException {
            if (br != null) br.close();
        }

        public String next() throws IOException {
            if (i < s.length) return s[i++];
            String st = br.readLine();
            while (st == "") st = br.readLine();
            s = st.split(regex, 0);
            i = 0;
            return s[i++];
        }

        public int nextInt() throws NumberFormatException, IOException {
            return Integer.parseInt(next());
        }

        public Long nextLong() throws NumberFormatException, IOException {
            return Long.parseLong(next());
        }

        public Double nextDouble() throws NumberFormatException, IOException {
            return Double.parseDouble(next());
        }
    }
}

Measured memory_bytes: 25864
#include <iostream>
using namespace std;
typedef long long ll;

int main()
{
        ll H, W;
        cin >> H >> W;
        char C[H][W];
        for(ll i = 0; i < H; ++i)
        {
                for(ll j = 0; j < W; ++j)
                {
                        cin >> C[i][j];
                }
        }
        bool flag = true;
        for(ll i = 0; i < H; ++i)
        {
                for(ll j = 0; j < W; ++j)
                {
                        if(C[i][j] == '#')
                        {
                                bool flag2 = false;
                                if(i > 0 and C[i-1][j] == '#') flag2 = true;
                                if(i < H-1 and C[i+1][j] == '#') flag2 = true;
                                if(j > 0 and C[i][j-1] == '#') flag2 = true;
                                if(j < W-1 and C[i][j+1] == '#') flag2 = true;
                                if(flag2 == false)
                                {
                                        flag = false;
                                        break;
                                }
                        }
                }
        }
        if(flag == true) cout << "Yes" << endl;
        else if(flag == false) cout << "No" << endl;

        return 0;
}

Measured memory_bytes: 256
// ===================================
//   author: M_sea
//   website: http://m-sea-blog.com/
// ===================================
#include <algorithm>
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <cmath>
#define re register
using namespace std;
typedef long long ll;

inline int read() {
    int X=0,w=1; char c=getchar();
    while (c<'0'||c>'9') { if (c=='-') w=-1; c=getchar(); }
    while (c>='0'&&c<='9') X=X*10+c-'0',c=getchar();
    return X*w;
}

const int N=200000+10;

int n;
struct data { int x,y; } a[N];
bool operator <(data a,data b) { return a.x<b.x; }

inline ll calc1() {
    int rmin=2e9,rmax=0,bmin=2e9,bmax=0;
    for (re int i=1;i<=n;++i) {
        rmin=min(rmin,a[i].x),rmax=max(rmax,a[i].x);
        bmin=min(bmin,a[i].y),bmax=max(bmax,a[i].y);
    }
    return 1ll*(rmax-rmin)*(bmax-bmin);
}

int miny[N],maxy[N];
inline ll calc2() {
    sort(a+1,a+n+1);
    int bmin=2e9,bmax=0;
    for (re int i=1;i<=n;++i)
        bmin=min(bmin,min(a[i].x,a[i].y)),bmax=max(bmax,a[i].y);
    miny[0]=2e9,maxy[0]=0; int ans=2e9;
    for (re int i=1;i<n;++i) {
        miny[i]=min(miny[i-1],a[i].y),maxy[i]=max(maxy[i-1],a[i].y);
        int rmin=min(a[i+1].x,miny[i]),rmax=max(a[n].x,maxy[i]);
        ans=min(ans,rmax-rmin);
    }
    return 1ll*ans*(bmax-bmin);
}

int main() {
    n=read();
    for (re int i=1;i<=n;++i) {
        a[i]=(data){read(),read()};
        if (a[i].x>a[i].y) swap(a[i].x,a[i].y);
    }
    printf("%lld\n",min(calc1(),calc2()));
    return 0;
}


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

int main() {
	int a, b,c,k;
	int sum = 0;
	int i;
	cin >> a >> b >> c >> k;
	for (i = 1 ;i <= k;i++) {
		if (i <= a) {
			sum = sum + 1;
		}
		else if(i <= a+b ) {
		}
		else if(i <= a+b+c ) {
			sum = sum - 1;
		};
	}
	cout << sum;

	return 0;
}

Measured memory_bytes: 3636
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define int ll
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a) (a).begin(),(a).end()
#define pb emplace_back


signed main(){
    int n;
    cin>>n;
    
    vector<int> a(n),b(n),c(n);
    
    rep(i,n)cin>>a[i];
    rep(i,n)cin>>b[i];
    rep(i,n)cin>>c[i];
    
    sort(all(a));
    sort(all(b));
    sort(all(c));
    
    int ans = 0;
    for(auto elm:b){
        ans += (c.end()-upper_bound(all(c),elm)) * (n-(a.end()-lower_bound(all(a),elm)));
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 2688
#include <iostream>

using namespace std;

int main()
{
	int N, K, x[100]={0}, i, ans=0;

	cin >> N; cin >> K;
	for (i = 0; i < N; i++) {
		cin >> x[i];
	}

	for (i = 0; i < N; i++) {
		if (x[i] < K - x[i])
			ans += 2 * x[i];
		else
			ans += 2 * (K-x[i]);
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<list>
#include<set>
#include<map>
#include<utility>
#include<queue>
#include<cmath>
 
#define rep(i,x) for(int i=0;i<(int)(x);i++)
#define reps(i,x) for(int i=1;i<=(int)(x);i++)
#define rrep(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define rreps(i,x) for(int i=((int)(x));i>0;i--)
 
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define INF 2e9
#define MOD 1000000007
 
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
typedef long long ll;
typedef std::pair<ll, ll> P;
int gcd(ll a,ll b){return b?gcd(b,a%b):a;}
 
 
using namespace std;

int main()
{
    ll n;
    cin >> n;
    ll ans = 0;
    vector<ll> a(n+1);
    a[0] = 0;
    reps(i, n) cin >> a[i];
    
    rep(i, n){
        if(a[i+1]>=a[i]) ans += (a[i+1] - a[i]);
    }
    cout << ans;
}

Measured memory_bytes: 256
#include <stdio.h>
 
int main(void)
{
    int dp[4][8000] = {0};
    int n;
    int i, j, k;
 
    for (i = 0; i <= 1000; i++) dp[0][i] = 1;
    for (i = 1; i < 4; i++){
        for (j = 0; j <= 4000; j++){
            if (dp[i - 1][j]){
                for (k = 0; k <= 1000; k++){
                    dp[i][j + k] += dp[i - 1][j];
                }
            }
        }
    }
 
    while (~scanf("%d", &n)){
        printf("%d\n", dp[3][n]);
    }
 
    return (0);
}

Measured memory_bytes: 732
package main

// Solution for https://atcoder.jp/contests/m-solutions2020/tasks/m_solutions2020_c

import (
	"bufio"
	"fmt"
	"io"
	"os"
)

type contest struct {
	in  io.Reader
	out io.Writer
}

func (con *contest) Scan(a ...interface{}) (int, error) {
	return fmt.Fscan(con.in, a...)
}
func (con *contest) Scanln(a ...interface{}) (int, error) {
	return fmt.Fscanln(con.in, a...)
}
func (con *contest) Scanf(f string, a ...interface{}) (int, error) {
	return fmt.Fscanf(con.in, f, a...)
}
func (con *contest) Print(a ...interface{}) (int, error) {
	return fmt.Fprint(con.out, a...)
}
func (con *contest) Println(a ...interface{}) (int, error) {
	return fmt.Fprintln(con.out, a...)
}
func (con *contest) Printf(f string, a ...interface{}) (int, error) {
	return fmt.Fprintf(con.out, f, a...)
}
func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	con := &contest{in: in, out: out}
	con.main()
}

func (con *contest) main() error {
	var N, K int
	con.Scan(&N, &K)
	A := make([]int, N)
	for i := 0; i < N; i++ {
		con.Scan(&A[i])
	}
	for i := K; i < N; i++ {
		if A[i] > A[i-K] {
			con.Println("Yes")
		} else {
			con.Println("No")
		}

	}
	return nil
}


Measured memory_bytes: 6000
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <stack>
#include <cstdlib>
#include <cstdio>
#include <string>
#include <cstring>
using namespace std;

#define INF 1000000

int main() {
    long H, W;
    long ans = INF;
    cin >> H >> W;
    
    if ( H == W && H == 2 ) {
        cout << 1 << endl;
        return 0;
    }
    
    if ( H % 3 == 0 || W % 3 == 0) {
        cout << 0 << endl;
        return 0;
    }

    for ( int i = 1; i < H; i++ ) {
        long w = W / 2;
        long h = (H - i) / 2;
        if ( h == 0 || w == 0) break;
        ans = min(max(i * W, (H - i) * (W - w)) - min(i * W, (H - i) * w), ans);
        ans = min(max(i * W, (H - i - h) * W) - min(i * W, h * W), ans);
    }
    
    for ( int i = 1; i < W; i++ ) {
        long h = H / 2;
        long w = (W - i) / 2;
        if ( w == 0 || h == 0) break;
        ans = min(max(i * H, (W - i) * (H - h)) - min(i * H, (W - i) * h), ans);
        ans = min(max(i * H, (W - i - w) * H) - min(i * H, w * H), ans);
    }

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

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

int main(){
  vector<int> A(3);
  cin >> A[0] >> A[1] >> A[2];
  if(A[0]==A[1] && A[1]!=A[2]) cout << "Yes" << endl;
  else if(A[1]==A[2] && A[1]!=A[0]) cout << "Yes" << endl;
  else if(A[0]==A[2] && A[1]!=A[0]) cout << "Yes" << endl;
  else cout << "No" << endl;
}

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

public class Main {

	public static void main(String[] args) throws IOException {
		
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String info = br.readLine();
		String[] fight = info.split(" ");
		int strikes = (int) Math.ceil((Double.parseDouble(fight[0])/Double.parseDouble(fight[1])));
		System.out.println(strikes);
	}
}

Measured memory_bytes: 22996
n=int(input())
s=input()
l,r=n//2+1,0
while l-r>1:
    t=(l+r)//2
    g=s[:t]
    q={}
    q[s[t:2*t]]=1
    d=s[t:2*t]
    for i in range(2*t,n):
        d=d[1:]+s[i]
        if d in q:
            q[d]+=1
        else:
            q[d]=1
    if g in q:
        r=t
    else:
        d=s[t:2*t]
        for i in range(t,n-t):
            q[d]-=1
            if q[d]==0:
                del q[d]
            d=d[1:]+s[i+t]
            g=g[1:]+s[i]
            if g in q:
                r=t
                break
        else:
            l=t
print(r)

Measured memory_bytes: 136924
#include <algorithm>
#include <array>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#define REP(X, Y, Z) for (ll(X) = (Y); (X) < (Z); (X)++)
#define REV(X, Y, Z) for (ll(X) = (Y); (X) > (Z); (X)--)

using namespace std;
using ll = long long;
using dll = deque<ll>;
using pll = pair<ll, ll>;
using qll = queue<ll>;
using usll = unordered_set<ll>;
using umll = unordered_map<ll, ll>;
using sll = stack<int>;
using vll = vector<ll>;
using vvll = vector<vll>;

constexpr ll kMod = 1e9 + 7;

ll gcd(ll a, ll b) {
  if (a < b) {
    return gcd(b, a);
  }
  ll c = a % b;
  while (c != 0) {
    a = b;
    b = c;
    c = a % b;
  }
  return b;
}

ll lcm(ll a, ll b) {
  return a / gcd(a, b) * b;
}

void init() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
}

int main() {
  init();

  ll N;
  cin >> N;
  vll H(N);
  vll X(N, 0);
  REP(i, 0, N) {
    cin >> H[i];
  }

  ll ans = 0;
  ll idx = 0;
  for (;;) {
    if (idx == N) {
      break;
    }
    if (X[idx] == H[idx]) {
      idx++;
    } else {
      ans++;
      REP(i, idx, N) {
        if (X[i] < H[i]) {
          X[i]++;
        } else {
          break;
        }
      }
    }
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
//#include<ext/pb_ds/assoc_container.hpp>
//#include<ext/pb_ds/tree_policy.hpp>
 
#define pb push_back
#define mp make_pair

typedef long long ll; 

#define fi first
#define se second
 
#define all(x) (x).begin(), (x).end()
 
using namespace std;             
//using namespace __gnu_pbds;

typedef vector<int> vi;
 
//template<typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
const int INF = (int)1e10;                   
const int MAXN = 300500; 

void solve() {
    int n;
    cin >> n;                                    
    string s;
    cin >> s;
    int cnt = 0;
    for (int i = 0 ; i < s.size(); i++) {
        if (s[i] == 'A' && s[i + 1] == 'B' && s[i + 2] == 'C') {
            cnt++;
        }
    }
    cout << cnt;
}

int main() {      
    ios::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);   
    int tt = 1;
    
    while (tt--) {
        solve();
    }
 
    return 0;
}

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

using namespace std;
using ll=long long;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, a, n) for(int i = (a); i < (n); i++)

int main(){
  cin.tie(nullptr);ios_base::sync_with_stdio(false);
  int n,hoge,huga=0,sum=0;cin>>n;
  rep(i,n){
    cin>>hoge;
    sum+=hoge;
    huga=max(huga,hoge);
  }
  cout<<sum-huga/2<<endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int ac = 0;
		int wa = 0;
		int tle = 0;
		int re = 0;

		for(int i = 0 ; i < n ; i++) {
			switch(sc.next()) {
			case "AC":
				ac++;
				break;
			case "WA":
				wa++;
				break;
			case "TLE":
				tle++;
				break;
			case "RE":
				re++;
				break;
			}
		}

		System.out.println("AC x " + ac);
		System.out.println("WA x " + wa);
		System.out.println("TLE x " + tle);
		System.out.println("RE x " + re);


		sc.close();


	}

}


Measured memory_bytes: 60496
N = int(input())
A = [int(input()) for _ in range(N)]
s = A.index(max(A))
x = max(A)
A.sort()
y = A[-2]
ans = []
for i in range(N):
  ans.append(x)
  
ans[s] = y

for i in ans:
  print(i)

Measured memory_bytes: 14624
#include<iostream>
#include<iomanip>
#include<string>
#include<array>
#include<cmath>
#include<vector>
#include<utility>
#include<algorithm>
#include<ctype.h>
using namespace std;


int main() {
	int n;
	cin >> n;
	if (n%2==0) {
		cout << n << endl;
	}
	else {
		cout << 2*n << endl;
	}
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
	int N;
	int x=2;
		scanf("%d",&N);
			if(N%x==0){
				printf("%d\n",N/2);
			}
	        else{
	        	printf("%d\n",(N/2)+1);
			}
	
	return 0;
}


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

using namespace std;

int main(){
    string str;
    cin >> str;
    int n = str.size();

    int ans = n;
    for(int i=1;i<n;i++){
        if(str[i-1] != str[i]){
            ans = min(ans, max(i, n-i));
        }
    }
    cout << ans << endl;
}

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

int main(){ 
  int n, k;
  cin >> n >> k;
  vector<int> cnt(n);
  rep(i,k) {
    int d;
    cin >> d;
    for (int j = 0; j < d; j++) {
      int a;
      cin >> a;
      a--;
      cnt[a]++;
    }
  }
  int res = 0;
  for (int i = 0; i < n; i++) {
    if (!cnt[i]) res++;
  }
  cout << res << endl;
  return 0;
} 

Measured memory_bytes: 3628
S = str(input().strip())

cnt = 0
for i in range(1 << len(S)-1):
    y = None
    x = 0
    for j in range(len(S)):
        x -= 1
        if x == -len(S):
            cnt += int(S[x:y])
        elif i & (1 << j):
            cnt += int(S[x:y])
            y = x

print(cnt)

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

int main()
{
    int w, h, n;
    cin >> w >> h >> n;
    int ax = 0, ay = 0;
    int x, y, a;
    int ans = 0;
    for (int i = 0; i < n; i++) {
        cin >> x >> y >> a;
        if (a == 1) { if (ax < x) ax = x; }
        else if (a == 2) { if (w > x) w = x; }
        else if (a == 3) { if (ay < y) ay = y; }
        else if (a == 4) { if (h > y) h = y; }
    }

    if (ax - w < 0) ans = (w - ax);
    if (ay - h < 0) ans *= (h - ay);
    else ans = 0;
    cout << ans << endl;

    return 0;
}




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

using namespace std;

int main()
{
	string s1; cin >> s1;
	string s2; cin >> s2;
	if (s1[0] == s2[2] && s1[1] == s2[1] && s1[2] == s2[0]) cout << "YES" << endl;
	else cout << "NO" << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<string>
#include<cmath>
#include<map>
#include<stack>
#include<vector>
#include<queue>
#include<set>
#include<algorithm>
#include<sstream>
using namespace std;
double n,m,x,y;
int ans=0; 
double a[1000000];
int main()
{
	
	while(cin >> n>>m){
		for(int i=0;i<n;i++){
			cin >> x>>y;
			a[i]=sqrt(x*x+y*y);
		}
		for(int i=0;i<n;i++){
			if(a[i]<=m) ans++;
		}
		cout << ans <<endl;
	}
	return 0;
} 

Measured memory_bytes: 5392
#include<iostream>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<cstdio>
#define MAXA 100000
#define MAX 20000000000
#define s(i) scanf("%d", &(i))
#define p(i) printf("%d", (i))
#define ps() printf(" ") 
#define rer(i,j,k) for((i)=(j);(i)<(k);++(i))
#define ret(i,j,k) for((i)=(j);(i)>(k);--(i))
using namespace std;
int main(){
	string chr[10] = {"SUN","MON", "TUE","WED", "THU", "FRI","SAT"}, a;
	int num[10] = {7,1,2,3,4,5,6};
	int i;
	cin >> a;
	rer(i,0,10){
		if(a==chr[i]){
			if(7-num[i]==0){
				cout << 7 << endl;
			}else{
				cout << 7-num[i] << endl;
			}
			break;
		}
	}
	return 0;
} 

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <cmath>
#include <algorithm>

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

typedef long long ll;

using namespace std;

const int INF = 1e9;
const int MOD = 1e9+7;
const double PI=3.14159265358979323846;

ll dp[1000100]={};

int main(){
  int H, N;  
  cin >> H >> N;

  int A[10010]={}, B[10010]={};
  rep(i,N) cin >> A[i] >> B[i];

  fill(dp,dp+1000200,1000000000);
  dp[0] = 0;
  rep(i,500000){
    rep(j,N){
      if(i-A[j]<0) continue;
      dp[i] = min(dp[i-A[j]]+B[j],dp[i]);
    }
  }

  ll ans=1000000000;
  for(int i=H; i<=1000100; i++){
    ans = min(dp[i],ans);
  }
  cout << ans << endl;
}



Measured memory_bytes: 8192
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath>
#include <limits>
#include <list>
#include <cassert>
#define ALL(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define int_INF 2147483647
#define pint_INF 2000000000
#define ll_INF 	9223372036854775807
#define MOD 1000000007
#define vi vector<int>
#define vvi vector<vector<int>>
#define vvll vector<vector<long long>>
#define vvc vector<vector<char>>
#define vll vector<long long>
#define pii pair<int,int>
#define vpii vector<pair<int,int>>
#define sysp system("PAUSE")
#define pno cout << "no" << endl
#define pyes cout << "yes" << endl
#define pYes cout << "Yes" << endl
#define pNo cout << "No" << endl
#define pNO cout << "NO" << endl
#define pYES cout << "YES" << endl
#define endl "\n"
#define pi 3.14159265358979
using namespace std;
using ll = long long;

int main(){
    int N; cin >> N;
    vector<int> a(N),b(N);
    rep(i,N) cin >> a[i] >> b[i];
    sort(ALL(a)); sort(ALL(b));
    int Amed,Bmed;
    if(N%2 == 0){
        //Here N is odd
        Amed = a[N/2-1] + a[N/2];
        Bmed = b[N/2-1] + b[N/2];
    }else{
        Amed = a[N/2];
        Bmed = b[N/2];
    }
    cout << Bmed - Amed + 1 << endl;
    sysp;
}

Measured memory_bytes: 4816
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <deque>
#include <queue>
#include <set>
#include <functional>
#include <cmath>
#include <set>
#include <map>


//マクロ
#define REP(i,n) for(int i=0; i<(int)(n); ++i)
#define REPS(i,n) for(int i=1; i<=(int)(n); ++i)
#define RREP(i,n) for(int i=(int)(n)-1; i>=0; --i)
#define RREPS(i,n) for(int i=(int)(n); i>0; --i)
#define FOR(i,s,e) for(int i=(int)(s); i<(int)(e); ++i)
#define RFOR(i,s,e) for(int i=(int)(e)-1; i>=(int)(s); --i)
#define All(a) (a).begin(),(a).end()
#define RAll(a) (a).rbegin(),(a).rend()
#define dump(x)  cerr << #x << " = " << (x) << endl;

//定数
#define INF 1e9
#define INFL 1e18
#define MOD (int)(1e9+7)

typedef long long ll;
typedef unsigned long long ull;
//typedef vector<int> vi;
//typedef vector<vi> vvi;
//typedef vector<string> vs;
//typedef pair<int, int> pii;
using namespace std;
using Graph = vector<vector<int>>;

//とりあえず書いておく変数
int dx[4] = { 1,0,-1,0 };
int dy[4] = { 0,1,0,-1 };

//今回の変数
ll cnt[2019];
ll tmp[2019];

//使用する関数
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;
}



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

	string s;
	//*
	cin >> s;
	/*/
	s = "";
	REP(i, 20000) {
		s.push_back('1');
		dump(i);
	}
	//*/
	ll ans = 0;

	REP(i, s.size()) {
		REP(j, 2019) {
			tmp[(j * 10 + (s[i] - '0')) % 2019] += cnt[j];
		}
		REP(j, 2019) {
			cnt[j] = tmp[j];
			tmp[j] = 0;
		}
		cnt[s[i] - '0']++;
		ans += cnt[0];
	}
	cout << ans << endl;
}

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

ll solve() {
    ll M, D;
    cin >> M >> D;
    ll ans = 0;
    for ( int d = 1; d <= D; d++ ) {
        if ( d % 10 <= 1 ) continue;
        if ( d / 10 <= 1 ) continue;
        ll m = d % 10 * (d / 10);
        if ( m >= 1 && m <= M ) ans++;
    }
    return ans;
}

int main() {
    auto ans = solve();
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 256
import sys
# 整数の入力
n = int(input())
x = list(map(int, input().split()))
sum = []
for y in range(min(x), max(x)+1):
  su = 0
  for m in range(n):
    su += (x[m]-y)**2
  sum.append(su)
print(min(sum))


Measured memory_bytes: 3060
#include<cstdio>
#include<bits/stdc++.h>
typedef long long int ll;
#define REP(i, n) for(int i = 0; i < (n); i++)
#define FOR_IN(i, a, b) for(int i = (a); i < (b); i++)
#define BETWEEN(x, a, b) ((x) >= (a) && (x) <= (b))
#define LOG_F 1
#define LOG(...) if(LOG_F) fprintf(stderr, __VA_ARGS__)

using namespace std;

/*
a b x

10^18
 */
ll a,b,x;

int main(){
  cin >>a>>b>>x;
  cout << (ll)floor((long double)b/(long double)x) - (ll)ceil((long double)a/(long double)x) +1 << endl;

  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){

  int a, b, c, i;

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

  int count = 0;

  for(int i = a; i <= b; i++) {

    if((c % i) == 0) {
      count++;
    }
  }
  printf("%d\n", count);
}


Measured memory_bytes: 2100
import java.util.*;

public class Main {

	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		String a = sc.next();
		String b = sc.next();
		String c = sc.next();
		
		System.out.println(a.substring(0, 1) + b.substring(1, 2) + c.substring(2, 3));
		
		
	}

}


Measured memory_bytes: 23124
import sys
input = sys.stdin.readline
from collections import deque

H,W,K=map(int,input().split())
x1,y1,x2,y2=map(int,input().split())
MAP=[list(input().strip()) for i in range(H)]

for i in range(H):
    for j in range(W):
        if MAP[i][j]==".":
            MAP[i][j]=1<<30
        else:
            MAP[i][j]=-1

Q=deque()
Q.append((x1-1,y1-1))
MAP[x1-1][y1-1]=0

while Q:
    x,y=Q.pop()

    for i in range(1,K+1):
        if 0<=x+i<H and 0<=y<W and (MAP[x+i][y]==1<<30 or MAP[x+i][y]>MAP[x][y]):
            if MAP[x+i][y]==1<<30:
                MAP[x+i][y]=MAP[x][y]+1
                Q.appendleft((x+i,y))
        else:
            break

    for i in range(1,K+1):
        if 0<=x-i<H and 0<=y<W and (MAP[x-i][y]==1<<30 or MAP[x-i][y]>MAP[x][y]):
            if MAP[x-i][y]==1<<30:
                MAP[x-i][y]=MAP[x][y]+1
                Q.appendleft((x-i,y))
        else:
            break

    for i in range(1,K+1):
        if 0<=x<H and 0<=y+i<W and (MAP[x][y+i]==1<<30 or MAP[x][y+i]>MAP[x][y]):
            if MAP[x][y+i]==1<<30:
                MAP[x][y+i]=MAP[x][y]+1
                Q.appendleft((x,y+i))
        else:
            break

    for i in range(1,K+1):
        if 0<=x<H and 0<=y-i<W and (MAP[x][y-i]==1<<30 or MAP[x][y-i]>MAP[x][y]):
            if MAP[x][y-i]==1<<30:
                MAP[x][y-i]=MAP[x][y]+1
                Q.appendleft((x,y-i))
        else:
            break
if MAP[x2-1][y2-1]==1<<30:
    print(-1)
else:
    print(MAP[x2-1][y2-1])

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

int main(){
    int N,K;
    cin >> N >> K;
    int a,i = 0;
    rep(i,N){
        cin >> a;
        if(a==1)break;
        i++;
    }

    int ans = i/(K-1)+(N-i-1)/(K-1);
    if(i%(K-1)) ans++;
    if((N-i-1)%(K-1)) ans++;
    cout << ans << endl;
}   

Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define REP(i,x,n) for(int i = (x); i < (n); ++i)
#define ll long long
#define P pair<ll,ll>
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()

const ll mod = 1e9+7;
const ll INF = 1e18;
const double pi = acos(-1);
//const ll mod = 998244353;

vector<ll> dp(440000);

int main(void)
{
    ll n, mini=INF;
    cin >> n;
    vector<ll> t(5);
    rep(i,5){
        cin >> t[i];
        mini = min(mini, t[i]);
    }
    cout << 4 + (n+mini-1)/mini << endl;
    return 0;
}


Measured memory_bytes: 6440
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
using namespace std;
const int maxx=10010;

vector<int> A[maxx],ans;
queue<int> task;
int f[maxx];
bool flag[maxx];
int v,e;

int main (){
	int x,y;
	bool xx=false;
	cin>>v>>e;
	for(int i=0;i<maxx;i++){
		f[i]=0;
		flag[i]=false;
	}
	while(e--){
		cin>>x>>y;
		A[x].push_back(y);
		f[y]++;
	}
	for(int i=0;i<v;i++) {
		if(f[i]==0&&flag[i]==false) {
			task.push(i);
			flag[i]=true;
		}
	}
	while(1){
		xx=false;
		while(task.empty()==0){
			x=task.front();
			ans.push_back(x);
			for(int k=0;k<A[x].size();k++){
				f[A[x][k]]--;
				if(f[A[x][k]]==0&&flag[A[x][k]]==false) {
					task.push(A[x][k]);
					flag[A[x][k]]=true;
					xx=true;
				}
			}
			task.pop();
		}
		if(xx==false) break;
	}
	for(int i=0;i<ans.size();i++){
		cout<<ans[i]<<endl;
	}
	return 0;
	
	
}


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


class Solver {
public:
    void solve();
};


void Solver::solve() {
    // 入力
    long long n, a[5];

    std::cin >> n >> a[0] >> a[1] >> a[2] >> a[3] >> a[4];
    long long min = 1e+16;
    for (auto t : a) {
        min = min > t ? t : min;
    }
    long long additional = n % min == 0 ? n / min - 1 : n / min;
    long long ans = min >= n ? 5 : 5 + additional;
    std::cout << ans << std::endl;    
}

int main() {
    Solver solver = Solver();
    solver.solve();
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(I,X,Y) for(int (I)=(X);(I)<(Y);(I)++)
#define REP(I,X,Y) for(int (I)=(Y)-1;(I)>=(X);(I)--)
#define ALL(X) (X).begin(),(X).end()
#define INF 1000000007
#define LINF 1000000000000000007
typedef long long ll;
using namespace std;

ll adj[100][100];

int main(){
  int N,M,a,b,c,ans=0;
  cin >> N >> M;
  vector<tuple<int,int,int>> edges;
  FOR(i,0,100)FOR(j,0,100)adj[i][j] = LINF;
  FOR(i,0,100)adj[i][i] = 0;
  FOR(i,0,M){
    cin >> a >> b >> c;
    adj[a-1][b-1] = c;
    adj[b-1][a-1] = c;
    edges.push_back(make_tuple(a-1,b-1,c));
  }
  FOR(i,0,N)FOR(j,0,N)FOR(k,0,N)if(adj[j][i] != LINF && adj[i][k] != LINF)adj[j][k] = min(adj[j][k],adj[j][i]+adj[i][k]);
  FOR(i,0,N){
    FOR(j,0,N)cerr << adj[i][j] << " ";cerr << endl;
  }
  for(auto x:edges){
    if(adj[get<0>(x)][get<1>(x)] != get<2>(x))ans++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout<< (x) << " "

int main(){
    int h,w;cin>>h>>w;
    string s[h+2];
    rep1(i,h){string tmp;cin>>tmp;s[i].push_back('.');s[i].append(tmp);s[i].push_back('.');}
    rep(i,w+2){s[0].push_back('.');s[h+1].push_back('.');}
    rep1(i,h){
        rep1(j,w){
            if(s[i][j]=='#'&&s[i-1][j]=='.'&&s[i+1][j]=='.'&&s[i][j-1]=='.'&&s[i][j+1]=='.'){co("No");return 0;}
        }
    }
    co("Yes");
}

Measured memory_bytes: 512
fun main() {
    val N = readLine()!!.toInt()
    val AN = readLine()!!.split(" ").map(String::toInt)
    val map = AN.groupBy { it }.mapValues { it.value.size }
    for (i in 1..N) {
        println(map.getOrDefault(i, 0))
    }
}





Measured memory_bytes: 118572
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define bg begin()
#define ed end()
#define all(x) x.bg,x.ed
#define pb push_back
#define eb emplace_back
using namespace std;
typedef long long ll;
template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}
template<class t> using vc=vector<t>;
template<class t> using vvc=vc<vc<t>>;
using pi=pair<int,int>;
using vi=vc<int>;
void yes(){ cout << "Yes" << endl; }
void no(){ cout << "No" << endl; }
int SIZE(string s){return (int)s.size();}
const long long INF = 1LL << 60;

int main(){
    cout << fixed << setprecision(20);
    int n; cin >> n;
    vc<ll> dp(n+1,INF);
    dp[0] = 0;
    rep(i,n){
        chmin(dp[i+1], dp[i]+1);
        int six = 6;
        while(i+six < n+1){
            chmin(dp[i+six],dp[i]+1);
            six *= 6;
        }
        int nine = 9;
        while(i+nine < n+1){
            chmin(dp[i+nine], dp[i]+1);
            nine *= 9;
        }
    }
    cout << dp[n] << endl;
    return 0;
}


Measured memory_bytes: 1024
from collections import deque
n, q = map(int, input().split())
d = [[] for i in range(n)]
for i in range(n-1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    d[a].append(b)
    d[b].append(a)
ans = [0] * n
for i in range(q):
    p, x = map(int, input().split())
    p -= 1
    ans[p] += x
# print(d)
d2 = [True] * n
 
def bfs():
    que = deque([0])
    d2[0] = False
    while len(que) != 0:
        val = que.popleft()
 
        for i in range(len(d[val])):
            if d2[d[val][i]] == True:
                que.append(d[val][i])
                ans[d[val][i]] += ans[val]
                d2[d[val][i]] = False
    return ans
print(' '.join(map(str,bfs())))

Measured memory_bytes: 132344
N = int(input())
ary_A = list(map(int, input().split()))

h_sum  = 0
temp_max = ary_A[0]

for i in range(len(ary_A) - 1):
    diff = ary_A[i + 1] - temp_max
    if diff < 0:
        h_sum += abs(diff)
    else:
        temp_max = ary_A[i + 1]

print(h_sum)

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

int main() {
	int n,a[100]={};
	cin >> n;
	rep(i,0,n){
		cin >> a[i];
	}
	rep(i,0,n){
		int v = a[i];
		int j = i-1;
		while(j>=0&&a[j]>v){
			a[j+1] = a[j];
			j--;
		}
		a[j+1] = v;
		rep(j,0,n){
			if(j==n-1) cout << a[j] << endl;
			else cout << a[j] << " ";
		}
	}
	return 0;
}


Measured memory_bytes: 3092
#![allow(unused_imports)]
use std::cmp::*;
use std::collections::*;
use itertools::Itertools;
use proconio::{input, marker::*};
use superslice::*;
fn main() {
    input! {
        n: usize, m: usize,
        hs: [i64; n],
        ab: [(Usize1, Usize1); m],
    }
    let mut roads = vec![Vec::new(); n];
    for (a, b) in ab {
        roads[a].push(b);
        roads[b].push(a);
    }

    let mut good = 0;
    'outer: for i in 0..n {
        for &other in &roads[i] {
            if hs[i] <= hs[other] {
                continue 'outer;
            }
        }
        good += 1;
    }

    println!("{}", good);

}


Measured memory_bytes: 12180
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF = 1LL << 60;
const int MAX = 1000000010;
const ll MOD = 1000000007;

int main() {
    string s, t; cin >> s >> t;
    reverse(t.begin(), t.end());
    if (s == t) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(long long int i = 0; i < n; i++)
#define print(n) std::cout << n << std::endl
#define _print(n) std::cout << n
using namespace std;
typedef long long ll;
const int N = 1000000;

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

    vector<int> count(m + 1);

    rep(i,n){
        int k; cin >> k;
        rep(j,k){
            int a; cin >> a;
            count[a]++;
        }
    }
    int ans = 0;
    rep(i,m + 1){
        if(count[i] == n)ans++;
    }
    print(ans);
}

Measured memory_bytes: 256
#include <iostream>
#define _USE_MATH_DEFINES
#include <cmath>
#include <iomanip>
#include <vector>
using namespace std;
typedef vector<int> Row;
//---------------------------------------
double keisan(Row row, int n);
//---------------------------------------

int main(void)
{
	cout << fixed <<setprecision(4);  //???????°???°????¬¬4????????§??¨?????????(iomanip)
	
	while(true){
		
		int n; //???????????°
		cin >> n;
		
		if(n == 0){
			break;
		}
		else{
			Row  row;
			for(int i = 0; i < n; i++){
				int tensu;
				cin >> tensu;
				row.push_back(tensu);
			}
			
			cout << keisan(row, n) << endl;
			//row.clear();
		}
	}
	
	return 0;
	
}

//---------------------------------------
double keisan(Row row, int n)
{
	cout << fixed <<setprecision(4);
	double gokei = 0;
	//??????????±???????
	for(int i = 0; i < n; i++){
		gokei += row[i];
	}
	double m = gokei / n;  //m????????????
	
	double a = 0.0;  //a????¨??????????
	
	for(int i = 0; i < n; i++){
		a += pow(row[i] - m, 2);
	}
	a /= n;
	
	return sqrt(a);
}

Measured memory_bytes: 3148
#include<iostream>
#include<cmath>
#include<vector>
#include<set>
#include<algorithm>
#include<tuple>
#include<utility>
#include<cctype>
#include<climits>
#include<map>
#include<queue>
#include<functional>

using namespace std;

#define REP(i,a,n) for(int i=a;i<n;++i)
#define REPL(i,a,n) for(ll i=a;i<n;++i)
#define RUP(a,b) ((a+b-1)/(b))
#define ENT "\n"
#define SRTVG(v) sort(v.begin(),v.end(),greater<>())
#define SRTV(v) sort(v.begin(),v.end())
#define SRTAG(a,n) sort(a,a+n,greater<>())
#define MOD 1000000007

typedef long long ll;
typedef tuple<int,int,bool> Tb;
typedef pair<int,int> Pii;
typedef map<string,int> si;

template<class T> void chmax(T& a, T b) {if(a < b){a=b;}}
template<class T> void chmin(T& a, T b) {if(a > b){a=b;}}
template<class T> void YesNo(T& a) {if(a){cout << "Yes" << ENT;}else{cout << "No" << ENT;}}
template<class T> void YESNO(T& a) {if(a){cout << "YES" << ENT;}else{cout << "NO" << ENT;}}


//int N,A,B,C,L[10];
//
//int dfs(int depth,int a,int b,int c){
//    if(depth==N && (a==0 || b==0 || c==0)) return INT_MAX/2;
//    if(depth==N) return abs(a-A)+abs(b-B)+abs(c-C);
//
//    int ret=INT_MAX/2;
//    if(a==0) chmin(ret,dfs(depth+1,a+L[depth],b,c));
//    else chmin(ret,dfs(depth+1,a+L[depth],b,c)+10);
//    if(b==0) chmin(ret,dfs(depth+1,a,b+L[depth],c));
//    else chmin(ret,dfs(depth+1,a,b+L[depth],c)+10);
//    if(c==0) chmin(ret,dfs(depth+1,a,b,c+L[depth]));
//    else chmin(ret,dfs(depth+1,a,b,c+L[depth])+10);
//    chmin(ret,dfs(depth+1,a,b,c));
//
//    return ret;
//}


int atcoder() {
    string s;
    cin >> s;
    int tmp=0,ans=0;
    
    REP(i,0,s.size()){
        if(s[i]=='A' || s[i]=='T' || s[i]=='G' || s[i]=='C'){
            tmp++;
        }else{
            chmax(ans,tmp);
            tmp=0;
        }
        if(i==s.size()-1) chmax(ans,tmp);
    }
    
    cout << ans << ENT;
    return 0;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    atcoder();
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
typedef long long ll;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#define ios ios_base::sync_with_stdio(0) ; cin.tie(0) ; cout.tie(0)
#define so sizeof
#define pb push_back
#define cl clear() ;
#define vl vector<ll>
#define sz size()
#define len length()
#define el endl;cout.flush()
#define be begin()
#define fi first
#define se second
#define br break
#define en end()
#define ro return 0
#define br break
#define eb emplace_back
#define con continue
#define ms(x) memset(x , 0, so x)
#define all(x) (x).be , (x).en
#define rall(x) (x).rbegin() , (x).rend()
#define acc(x) accumulate((x).be , (x).en , 0ll)
#define forn(i,a,b) for(ll i=a;i<=b;++i)
#define rng_58 mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define vll vector<pair<ll,ll> >
#define pll pair<ll,ll>
#define plll pair<ll,pair<ll,ll>>
#define plvl pair<pair<ll,ll> ,ll>
#define mp make_pair
#define trace2(a,b) cerr <<"a is " << a << " b is " << b << el;
#define trace3(a,b,c) cerr <<"a is " << a << " b is " << b << " c is " << c << el;
#define trace4(a,b,c,d) cerr <<"a is " << a << " b is " << b << " c is " << c <<" d is " << d << el ;
#define trace5(a,b,c,d,e) cerr <<"a is " << a << " b is " << b << " c is " << c <<" d is " << d << " e is " << e << el;
#define trace6(a,b,c,d,e,f) cerr <<"a is " << a << " b is " << b << " c is " << c <<" d is " << d << " e is " << e << " f is " << f << el ;
int main()
{
    ios;
    string s1 , s2 ;
    cin >> s1 >> s2 ;
    reverse(all(s2));
    if(s1 == s2){
        cout << "YES\n" ;
        ro ;
    }
    else cout << "NO\n" ;
    ro ;

}

































Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)

int main(){
    ll s, c;
    cin >> s >> c;
    if(2*s >= c){
        cout << c/2 << endl;
    }else{
        ll rem = c - 2*s;
        cout << s + (ll)(rem / 4) << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define LL long long
#define PII pair<int,int>
#define PIL pair<int,LL>
#define PLI pair<LL,int>
#define PIII pair<int,PII>
#define PLL pair<LL,LL>
#define PLII pair<LL,PII>
#define VI vector<int>
#define VVI vector<VI>
#define VL vector<LL>
#define VVL vector<VL>
#define VPII vector<PII>
#define FF first
#define SS second
#define MP make_pair
#define PB push_back
#define all(x) x.begin(),x.end()
#define watch(x) cout<<(#x)<<" = "<<(x)<<'\n'
#define mset(a,v) memset(a,v,sizeof(a))
#define setp(x) cout<<fixed<<setprecision(x)
#define EPS 0.00000000001
#define PI acos(-1)
#define loop(i,b,n) for(int i=b;i<n;++i)
#define rev_loop(i,b,n) for(int i=b;i>=n;--i)
using namespace std;

const int MOD = 1e9 + 7;
const LL MX = 1e9;
const LL INF = 1e9;

int main()
{
    //ofstream out("output.txt");
    //ifstream in("input.txt");
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

    int k;
    cin>>k;
    string s = "";
    loop(i,0,k) s += "ACL";
    cout<<s<<'\n';

    return 0;
}


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

int main()
{
  int num;
  cin >> num;

  long long int okashi;
  cin >> okashi;

  vector<long long int> vec(num);
  for(int i = 0; i < num; ++i) cin >> vec.at(i);

  // 小さい順にソートする
  sort(vec.begin(), vec.end());

  int counter = 0;
  for(int i = 0; i < num - 1; ++i){
    if(okashi - vec.at(i) >= 0){
      ++counter;
      okashi -= vec.at(i);
    }
    else if(okashi - vec.at(i) < 0) break;
    else continue;
  }

  if(okashi == vec.at(num - 1)) ++counter;

  cout << counter << endl;
  
}


Measured memory_bytes: 256
# Problem https://atcoder.jp/contests/abc102/tasks/abc102_b
# Python 2nd Try
import sys


def solver(allN, numberList):
    answer = 0
    for j in range(0, allN):
        for k in range(0, allN):
            nowAbs = (numberList[j] - numberList[k]).__abs__()
            if answer < nowAbs:
                answer = nowAbs
    return answer


if __name__ == "__main__":
    N = sys.stdin.readline().rsplit()
    Ai = list(map(int, sys.stdin.readline().split()))
    answer = solver(int(N[0]), Ai)
    print(answer)


Measured memory_bytes: 3188
#include <iostream>

using namespace std;

int main()
{
    int N;
    bool flag = false;
    cin >> N;

    for(int i=1; i<=3; i++) {
        if (N%10==7) {
            flag = true;
            break;
        }
        N /= 10;
    }

    if (flag) {
        cout << "Yes";
    }
    else {
        cout << "No";
    }

    return 0;
}


Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define FOR(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
#define MOD 1000000007
 
typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
template <class T>
void print(T& x){printf("%d\n", x);}
 
int main()
{
    ll A, B, N;
    scanf("%lld %lld %lld", &A, &B, &N);
    // printf("A=%d, B=%d, N=%d\n", A, B, N);
    double t;
    ll x;
    ll tmp1, tmp2;
    ll ans;

    if(N<B){
        x = N;
    }else{
        x = B-1;
    }
    t = (double)x/B;
    tmp1 = A * t;
    tmp2 = t;
    tmp2 *= A;
    ans = tmp1-tmp2;
    // printf("%lld, %lld, %lld, %lf\n", A, B, N, t);
    // printf("%lld, %lld, %lld\n", tmp1, tmp2, ans);
    print(ans);
    return 0;
}

Measured memory_bytes: 3812