akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include <algorithm>   
#include <functional>
#include<string>
using namespace std;

int main() {
    int N,tmp,ans=1;
    int cnt1=0,cnt2=-1;
    cin >> N;
    for(int i=1;i<=N;i++){
        tmp=i;
        while(tmp%2==0){
            tmp/=2;
            ++cnt1;
        }
        if(cnt2<cnt1){
            ans=i;
            cnt2=cnt1;
        }
        cnt1=0;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
import java.awt.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
import java.util.List;

public class Main {
    public static void main(String args[]) throws IOException {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int cnt=0;
        for (int i=1;i<=n;i++){
            if (String.valueOf(i).length()%2==1){
                cnt++;
            }
        }
        System.out.println(cnt);
    }

}



Measured memory_bytes: 27092
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define forin(in, n) for(int i=0; i<n; i++) cin>>in[i]
#define forout(out) for(int i=0; i<(int)out.size(); i++) cout<<out[i]<<" "
#define rep(i, n) for(int i=0; i<(n); i++)

int main(){
    int n; cin>>n;
    int n2=n;
    int ans=0;
    while(1 == 1){
        ans += n%10;
        n/=10;
        if(n==0) break;
    }
    if(n2 % ans == 0){
        cout<< "Yes" <<endl;
    }else{
        cout<<"No" <<endl;
    }
}


Measured memory_bytes: 3644
import numpy as np
from math import sqrt
N = int(input())
xy = [list(map(int, input().split())) for _ in range(N)]
seki = 1
for i in range(N):
    seki *= (i + 1)


graph = np.zeros((N, N))
for i in range(N):
    for j in range(N):
        graph[i][j] = sqrt((xy[i][0] - xy[j][0])**2 + (xy[i][1] - xy[j][1])**2)

print(np.sum(graph) / N)


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

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int a,b,c; cin >> a >> b >> c;
	cout << (a+b+c-max({a,b,c})) << endl;
	return 0;
}


Measured memory_bytes: 256
#if 1
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <array>
#include <deque>
#include <algorithm>
#include <utility>
#include <cstdint>
#include <functional>
#include <iomanip>
#include <numeric>
#include <assert.h>
#include <bitset>
#include <list>
#include <cmath>

auto& in = std::cin;
auto& out = std::cout;
#define all_range(C) std::begin(C), std::end(C)
const double PI = 3.141592653589793238462643383279502884197169399375105820974944;

int32_t N,Q;

std::string s;
char T[200010];
char D[200010];

int main()
{
	using std::endl;
	in.sync_with_stdio(false);
	out.sync_with_stdio(false);
	in.tie(nullptr);
	out.tie(nullptr);

	in >>N>> Q;
	in >> s;
	for (int32_t i = 0; i < Q; i++)
	{
		in >> T[i] >> D[i];
	}
	
	using BS_INT = int64_t;
	BS_INT ok_range = -1, ng_range = N;
	while (std::abs(ok_range - ng_range) > 1) {
		BS_INT mid = (ok_range + ng_range) / 2;
		bool is_ok = false;

		//ここに書く
		int32_t now = mid;
		for (int32_t i = 0; i < Q; i++)
		{
			if (T[i] == s[now]) {
				if (D[i] == 'R') {
					++now;
				}
				else {
					--now;
				}
				if (now < 0) { is_ok = true; break; }
				if (now >= N) { is_ok = false; break; }
			}
		}

		if (is_ok) {
			ok_range = mid;
		}
		else {
			ng_range = mid;
		}
	}
	int32_t lrange_r = ok_range+1;

	ok_range = N, ng_range = -1;
	while (std::abs(ok_range - ng_range) > 1) {
		BS_INT mid = (ok_range + ng_range) / 2;
		bool is_ok = false;

		//ここに書く
		int32_t now = mid;
		for (int32_t i = 0; i < Q; i++)
		{
			if (T[i] == s[now]) {
				if (D[i] == 'R') {
					++now;
				}
				else {
					--now;
				}
				if (now >= N) { is_ok = true; break; }
				if (now < 0) { is_ok = false; break; }
			}
		}

		if (is_ok) {
			ok_range = mid;
		}
		else {
			ng_range = mid;
		}
	}
	int32_t rrange_l = ok_range;

	out << N-std::min(N, lrange_r + (N - rrange_l)) << endl;

	return 0;
}
#endif


Measured memory_bytes: 1020
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(300000)


def solve(S: str, T: str):
    ret = 0
    for i in range(3):
        if S[i] == T[i]:
            ret += 1
    print(ret)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    T = next(tokens)  # type: str
    solve(S, T)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
#include <stdio.h>
#define N_MAX 200
#define GAME 3

short n,p[N_MAX][GAME];

void solve(void){
	short i,j,k,flag,answer;
	for(j=0;j<GAME;j++){
		for(i=0;i<n;i++){
			if(!p[i][j])continue;
			flag = 0;
			for(k=i+1;k<n;k++){
				if(p[i][j]==p[k][j])flag=1,p[k][j]=0;
			}
			if(flag)p[i][j]=0;
		}
	}
	for(i=0;i<n;i++){
		answer=0;
		for(j=0;j<GAME;j++)answer+=p[i][j];
		printf("%hd\n",answer);
	}
	return;
}

int main(void){
	short i;
	scanf("%hd",&n);
	for(i=0;i<n*GAME;i++){
		scanf("%hd",&p[i/GAME][i%GAME]);
	}
	solve();
	return 0;
}

Measured memory_bytes: 596
#include <iostream>
#include <set>
#include <map>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>
#include <string.h>

using namespace std;

// #define for(i,a,b) for (int i=(a);i<(b);++i)
typedef long long ll;
typedef pair<ll,ll> P;
#define REP(i,n) for(long long i = 0; i < (long long)(n); i++)
#define pb push_back // vectorに要素追加
#define INF (ll)1e18

ll mod = 1e9+7;

bool is_kaibun(string a){
	bool ans = true;
	REP(i, a.size()){
		// printf("%c, %c\n", a[i], a[a.size()-i-1]);
		if (a[i]!=a[a.size()-i-1]) ans = false;
	}
	return ans;
}


// 検索タグ
int main() {
	// 入力
	ll X;cin>>X;
	
	// 解法
	ll ans = 0;
	ans += (X/500)*1000;
	X = X%500;
	ans += (X/5) * 5;
	
	//出力
	printf("%lld\n", ans);
}


Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <vector>
using namespace std;

const int MAXN = 200005;
const int LOG = 18;

int N, X, Y;
vector <int> red[MAXN], blue[MAXN];
int anc[MAXN][LOG];
int disc[MAXN], fin[MAXN];
int depth[MAXN];
int timer = 1;
int sol;

void load() {
	scanf("%d%d%d", &N, &X, &Y);
	for (int i = 1; i < N; i++) {
		int a, b;
		scanf("%d%d", &a, &b);
		red[a].push_back(b);
		red[b].push_back(a);
	}
	for (int i = 1; i < N; i++) {
		int c, d;
		scanf("%d%d", &c, &d);
		blue[c].push_back(d);
		blue[d].push_back(c);
	}
}

void dfs(int x, int p) {
	disc[x] = timer++;
	depth[x] = depth[p] + 1;
	anc[x][0] = p;
	for (auto it : blue[x])
		if (it != p)
			dfs(it, x);
	fin[x] = timer;
}

int jmp(int x, int k) {
	for (int i = 0; i < LOG; i++)
		if (k >> i & 1)
			x = anc[x][i];
	return x;
}

int lca(int x, int y) {
	if (depth[x] < depth[y])
		swap(x, y);
	x = jmp(x, depth[x] - depth[y]);
	if (x == y)
		return x;
	for (int i = LOG - 1; i >= 0; i--)
		if (anc[x][i] != anc[y][i]) {
			x = anc[x][i];
			y = anc[y][i];
		}
	return anc[x][0];
}

int dist(int x, int y) {
	return depth[x] + depth[y] - 2 * depth[lca(x, y)];
}

int get_nxt(int x, int y) {
	if (x == y)
		return x;
	if (disc[y] < disc[x] || disc[y] >= fin[x])
		return anc[x][0];
	return jmp(y, depth[y] - depth[x] - 1);
}

void go(int x, int p, int pos, int steps) {
	sol = max(sol, steps + dist(pos, x));
	for (auto it : red[x]) 
		if (it != p) {
			int tmp = get_nxt(pos, it);
			if (tmp == it)
				continue;
			if (dist(x, it) >= 3)
				sol = MAXN;
			go(it, x, tmp, steps + 1);
		}
}

int solve() {
	dfs(1, 0);	
	
	for (int j = 1; j < LOG; j++)
		for (int i = 1; i <= N; i++)
			anc[i][j] = anc[anc[i][j - 1]][j - 1];
	
	go(X, 0, Y, 0);
	
	return sol < MAXN ? 2 * sol : -1;
}

int main() {
	load();
	printf("%d\n", solve());
	return 0;
}

Measured memory_bytes: 48384
#ABC042D
H, W, A, B = map(int, input().split())
mod=10**9+7
N=H+W+1
bikkuri=[0 for i in range(N)]
bikkuri[0]=1
for i in range(1,N):
    bikkuri[i] = (i * bikkuri[i-1])%mod
gyaku=[0 for i in range(N)]
gyaku[0]=1
for i in range(1, N):
    gyaku[i]=pow(bikkuri[i], mod-2, mod)
def comb(n,r):
    return bikkuri[n]*gyaku[n-r]*gyaku[r]%mod
def homb(n,r):
    return comb(n+r,r)%mod
dame = []
for i in range(B):
    dame.append(homb(H-A-1, i) * homb(W-1-i,A-1))
ans = homb(W-1, H-1) - sum(dame)
print(ans%mod)

Measured memory_bytes: 22864
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.AbstractMap;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) {
		FastScanner sc = new FastScanner(System.in);
		PrintWriter out = new PrintWriter(System.out);

		solve(sc, out);

		out.flush();
	}
	
	public static void solve(FastScanner sc, PrintWriter out) {
		int n = sc.nextInt();
		int k = sc.nextInt();
		
		int res = 1;
		
		for(int i = 0; i < n; i++) {
			res = Math.min(res*2, res+k);
		}
		out.println(res);
	}
	
	public static int gcd(int a, int b) {
		if(a < b) return gcd(b, a);
		if(b == 0) return a;
		return gcd(b, a % b);
	}
}

class Pair<K, V> extends AbstractMap.SimpleEntry<K, V> {

    public Pair(final K key, final V value) {
        super(key, value);
    }
 }

class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;

    public FastScanner(InputStream in) {
        reader = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }

    public String next() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public String nextLine() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }

        return tokenizer.nextToken("\n");
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    public double nextDouble() {
         return Double.parseDouble(next());
     }

    public int[] nextIntArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = nextInt();
        return a;
    }

    public long[] nextLongArray(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++)
            a[i] = nextLong();
        return a;
    }
}

Measured memory_bytes: 22228
a,b = map(int, input().split())
ans = 0
flag = True

if b == 1:
    ans = 0
elif a >= b:
    ans = 1
else:
    ans += 1
    while(True):
        b = b - a
        if b <= 0:
            break
        else:
            ans += 1
            b += 1

print(ans)

Measured memory_bytes: 3060
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
using namespace std;
bool w[30010];
inline int gcd(int x,int y) {return y?gcd(y,x%y):x;}
int main() {
    int n,s=0;
    cin>>n;
    for(int i=1;n>1;i++)
	if(i%2==0||i%3==0)
	    w[i]=1,printf("%d ",i),s+=i,--n;
    for(int i=1;;i++)
	if(!w[i]&&(s+i)%6==0&&gcd(s,i)>1) return cout<<i,0;
    return 0;
}

Measured memory_bytes: 384
#include <algorithm>
#include <bitset>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/range/irange.hpp>
#include <cmath>
#include <map>
#include <numeric>
#include <iostream>
#include <string>
#include <vector>

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

using namespace std;
namespace mp = boost::multiprecision;
typedef long long ll;
const ll M = 1000000007;

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

	if (a <= b) {
		cout << 1;
		return 0;
	} 

	if (a % b == 0) {
		cout << a / b;
		return 0;
	}

	cout << a / b + 1;

	return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys

YES = "Yes"  # type: str
NO = "No"  # type: str


def solve(N: int, K: int, Q: int, A: "List[int]"):
    win_point = [0 for i in range(N)]
    for winner in A:
        win_point[winner - 1] += 1

    result = [K for i in range(N)]
    for i in range(N):
        result[i] = result[i] - Q + win_point[i]
    for i in result:
        if i > 0:
            print('Yes')
        else:
            print('No')
    return


# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    Q = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(Q)]  # type: "List[int]"
    solve(N, K, Q, A)

if __name__ == '__main__':
    main()


Measured memory_bytes: 12540
h,w,K = map(int, input().split())

c = []
for i in range(h):
  c.append(input())

ans = 0
for i in range(2 ** h):
  for j in range(2 ** w):
    bin_i = bin(i).replace('0b','').zfill(h)
    bin_j = bin(j).replace('0b','').zfill(w)
    
    count = 0
    for k in range(h):
      for l in range(w):
        if c[k][l] == '#' and bin_i[k] != '1' and bin_j[l] != '1':
          count += 1
          
    if K == count:
      ans += 1
          
print(ans)

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

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

    int N, M, X;
    cin >> N >> M >> X;
    vector<int> C(N);
    vector<vector<int> > A(N, vector<int>(M));
    for (int i = 0; i < N; ++i) {
        cin >> C.at(i);
        for (int j = 0; j < M; ++j) {
            cin >> A.at(i).at(j);
        }
    }

    int ans = INT_MAX;
    for (int tmp = 0; tmp < (1 << N); ++tmp) {
        bitset<20> BIT(tmp);
        vector<int> V(M, 0);
        int res = 0;
        for (int i = 0; i < N; ++i) {
            if (BIT.test(i)) {
                res += C.at(i);
                for (int j = 0; j < M; ++j) {
                    V.at(j) += A.at(i).at(j);
                }
            }
        }
        bool can = true;
        for (auto &x : V) {
            if (x < X) {
                can = false;
                break;
            }
        }
        if (can) {
            ans = min(ans, res);
        }
    }

    cout << ((ans == INT_MAX) ? -1 : ans) << endl;

    return 0;
}

Measured memory_bytes: 3664
import fractions

A, B = map(int, input().split())

f = fractions.gcd(A, B)

kouyakusuu = []

if f % 2 == 0:
    kouyakusuu.append(2)
    while f % 2 == 0:
        f = f / 2

i = 3
while i*i <= f:
    if f % i == 0:
        kouyakusuu.append(i)
        while f % i == 0:
            f = f / i
    i += 2
if f != 1:
    kouyakusuu.append(f)
print(len(kouyakusuu)+1)

Measured memory_bytes: 64492
H,W = map(int,input().split())
a = [''] * H
for i in range(H):
    a[i] = input()

row = [False] * H
col = [False] * W
for i in range(H):
    for j in range(W):
        if a[i][j] == '#':
            row[i] = True
            col[j] = True

for i in range(H):
    if row[i]:
        for j in range(W):
            if col[j]:
                print(a[i][j],end='')
        print()

Measured memory_bytes: 4468
#include<stdio.h>
int main(){
    int H,W,i,j;
    while(1){
        scanf("%d %d",&H,&W);
        if(H==0&&W==0) break;
        for(i=1;H>=i;i++){
            for(j=1;W>=j;j++){
                printf("#");
                if(W==j) printf("\n");
            }
        }
        printf("\n");
    }   
}

Measured memory_bytes: 1816
i,e,w,s=1e9,a[1<<19];char c[1<<19];main(n){for(scanf("%d\n",&n);i<n;scanf("%c",c+i),a[i]=w,w+=c[i++]==87);for(;i>0;s=s<a[--i]+e?s:a[i]+e,e+=c[i]==69);printf("%d",s);}

Measured memory_bytes: 1664
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;
typedef pair<int, int> P;

ll MOD = 1e9 + 7;

int main(){
    int N;
    cin >> N;
    int a[N];
    int mx = -1;
    for(int i = 0; i < N; i++) cin >> a[i];

    vector<int> pos[N];
    for(int i = 0; i < N; i++){
        mx = max(mx, a[i]);
        pos[a[i]].push_back(i);
    }

    /*
    for(int i = 0; i <= mx; i++){
        for(int j = 0; j < pos[i].size(); j++){
            cout << pos[i][j] << " ";
        }
        cout << endl;
    }
    */

    ll ans = 1;
    for(int i = 0; i <= mx; i++){
        vector<P> vec(0);
        if(i == 0){
            for(int j = 0; j < 3; j++){
                vec.push_back(P(-1, 0));
            }
            for(int j = 0; j < (int)pos[i].size(); j++){
                vec.push_back(P(pos[i][j], 1));
            }
        }
        else {
            for(int j = 0; j < (int)pos[i - 1].size(); j++){
                vec.push_back(P(pos[i - 1][j], 0));
            }
            for(int j = 0; j < (int)pos[i].size(); j++){
                vec.push_back(P(pos[i][j], 1));
            }
        }

        sort(vec.begin(), vec.end());
        /*
        for(int j = 0; j < (int)vec.size(); j++){
            cout << vec[j].second;
        }
        cout << endl;
        */

        ll tmp = 1;
        int sz = vec.size();
        int blue = 0;
        for(int j = 0; j < sz; j++){
            if(vec[j].second == 0) blue++;
            else{
                tmp *= blue;
                blue--;
            }
        }

        ans *= tmp;
        ans %= MOD;
    }

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

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

using ll = long long;
const ll MOD = 1e9 + 7;
const int INF = 1e9;

int main() {
    int H, W;
    cin >> H >> W;
    vector<vector<int>> A(H, vector<int>(W)), B(H, vector<int>(W));
    rep(i, H) rep(j, W) cin >> A[i][j];
    rep(i, H) rep(j, W) cin >> B[i][j];
    vector<vector<vector<int>>> s(H + 1, vector<vector<int>>(W + 1, vector<int>(12800, 0)));
    s[1][1][abs(A[0][0] - B[0][0])] = 1;
    rep(i, H) {
        rep(j, W) {
            //cout << i << j << endl;
            if (i == 0 && j == 0) continue;
            rep(k, 12800) {
                if (s[i][j + 1][k] == 0) continue;
                s[i + 1][j + 1][k + abs(A[i][j] - B[i][j])] = 1;
                s[i + 1][j + 1][abs(k - abs(A[i][j] - B[i][j]))] = 1;
            }
            rep(k, 12800) {
                if (s[i + 1][j][k] == 0) continue;
                s[i + 1][j + 1][k + abs(A[i][j] - B[i][j])] = 1;
                s[i + 1][j + 1][abs(k - abs(A[i][j] - B[i][j]))] = 1;
            }
            //cout << "30" << endl;
        }
    }
    //cout << "end" << endl;
    rep(i, 12800) {
        if (s[H][W][i] == 1) {
            cout << i << endl;
            return 0;
        }
    }
}

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

#define print(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl; 
int main()
{
    int A, B, C;
    cin >> A >> B >> C;
    if (A == B && B == C){
        cout << "No";
    } else if (A == B || B == C || C == A){
        cout << "Yes";
    } else {
        cout << "No";
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <queue>
#include <vector>
#include <cstring>
using namespace std;

class Edge{
public:
  int from, to, cost;

  Edge(){}
  Edge(int from, int to, int cost):
    from(from), to(to), cost(cost){}
};

class State{
public:
  int id, bit, cost;

  State(){}
  State(int id, int bit, int cost):
    id(id), bit(bit), cost(cost){}

  bool operator<(const State &st)const{
    return cost > st.cost;
  }
};

int N, M, L, K;
int S, G;
int B[52];
vector<Edge> t[52];
vector<int> closed[52][1 << 7];

void solve(){
  priority_queue<State> open;

  for(int i = 0; i < N; i++){
    for(int j = 0; j < (1 << L); j++){
      closed[i][j].clear();
    }
  }

  int Sbit = 0;
  if(B[S] != -1) Sbit |= (1 << B[S]);

  open.push(State(S, Sbit, 0));

  while(!open.empty()){
    State st = open.top();
    open.pop();

    if(closed[st.id][st.bit].size() >= K){
      continue;
    }
    closed[st.id][st.bit].push_back(st.cost);

    if(st.id == G && st.bit == (1 << L) - 1 && closed[st.id][st.bit].size() >= K){
      cout << closed[st.id][st.bit][K - 1] << endl;
      return;
    }

    for(int i = 0; i < t[st.id].size(); i++){
      Edge e = t[st.id][i];
      int nbit = st.bit;
      if(B[e.to] != -1) nbit |= (1 << B[e.to]);
      open.push(State(e.to, nbit, st.cost + e.cost));
    }
  }

  cout << "NA" << endl;
}

int main(){
  while(cin >> N >> M >> L >> K, N){
    for(int i = 0; i < N; i++){
      t[i].clear();
      B[i] = -1;
    }

    for(int i = 0; i < M; i++){
      int a, b, c;
      cin >> a >> b >> c;
      a--;
      b--;
      t[a].push_back(Edge(a, b, c));
      t[b].push_back(Edge(b, a, c));
    }

    cin >> S >> G;
    S--;
    G--;

    for(int i = 0; i < L; i++){
      int b;
      cin >> b;
      b--;
      B[b] = i;
    }

    solve();
  }
}

Measured memory_bytes: 80032
#include <bits/stdc++.h>
using namespace std;
#define itn int
#define nibu(K,x) binary_search(K.begin(),K.end(),x)
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) x.begin(),x.end()
#define sz(x) x.size()
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define out(x) cout<<x<<endl
#define put(x) out(x)
#define in(x) cin>>x
#define maxx(a,b,c) max(a,max(b,c))
#define minn(a,b,c) min(a,min(b,c))
using ll = long long;
using vl = vector<ll>;
using vs = vector<string>;
const double pi = 3.14159265358979;

int main() {
  ll N;
  in(N);
  string S;
  in(S);
  ll r=0;
  ll g=0;
  ll b =0;
  rep(i,N){
   if(S[i] == 'R') r++;
    else if(S[i] =='G')g++;
    else b++;
  }
  ll ans = r*g*b;
  for(ll j=1;j<N-1;j++){
    ll s =min(j,N-j-1);
   for(ll i=1;i<=s;i++){
    if(S[j] =='R'){
     if((S[j-i] =='G' &&S[j+i] == 'B') ||(S[j-i] =='B' &&S[j+i] == 'G')) ans--;
    }
     else if(S[j] =='G'){
        if((S[j-i] =='B' &&S[j+i] == 'R') ||(S[j-i] =='R' &&S[j+i] == 'B')) ans--;
     }
     else{
        if((S[j-i] =='G' &&S[j+i] == 'R') ||(S[j-i] =='R' &&S[j+i] == 'G')) ans--;
     }
   }
  }
  out(ans);
}


Measured memory_bytes: 3656
#include <bits/stdc++.h>
#include <assert.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define PB push_back
#define MP make_pair
#define MOD 1000000007LL
#define endl "\n"
#define fst first
#define snd second
const ll UNDEF = -1;
const ll INF=1e18;
template<typename T> inline bool chkmax(T &aa, T bb) { return aa < bb ? aa = bb, true : false; }
template<typename T> inline bool chkmin(T &aa, T bb) { return aa > bb ? aa = bb, true : false; }
typedef pair<ll,ll> pll;
typedef vector<ll> vll;

void solve(string s, string t){
	if ((s+s).find(t)!=-1) printf("Yes\n");
	else printf("No\n");
}

int main(){	
	ios_base::sync_with_stdio(false); cin.tie(0);
	string S;
	string T;
	cin >> S;
	cin >> T;
	solve(S, T);
	return 0;
}



Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n = read::<usize>();
    let mut k = read::<usize>() - 1;
    let mut seq = vec![(0, 0); n];
    for i in 0..n {
        seq[i].0 = read::<usize>();
        seq[i].1 = read::<usize>();
    }
    seq.sort();
    for i in 0..n {
        if k < seq[i].1 {
            println!("{}", seq[i].0);
            break;
        }
        k -= seq[i].1;
    }
}


Measured memory_bytes: 6396
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <set>
#include <map>
#define rep(i, n)   for(int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;

const int mod = 1e9+7;

int main(){
    int s;  cin>>s;
    vector<ll>dp(s+1);
    for(int i = 1; i <= s; i++){
        if(i < 3)   continue;
        dp[i] = (dp[i]+1)%mod;
        ll tmp = 0;
        for(int j = 3; j <= i-3; j++){
            (tmp += dp[i-j]) %= mod;
        }
        (dp[i] += tmp) %= mod;
    }
    cout << dp[s] << endl;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define all(x) (x).begin(), (x).end()
#define MOD 1000000007

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    if(a + b + c >= 22) {
        cout << "bust" << endl;
    } else {
        cout << "win" << endl;
    }
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,N) for(int i = 0;i < (int)(N);i++)
int main(){
  int p,q,r;
  cin>>p>>q>>r;
  int x=p+q,y=q+r,z=r+p;
 int a= min(x,y);
  int b=min(a,z);
  cout<<b<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int solve(int,int);
int n,A[20];
int main(){
  int i,q,m;
  scanf("%d",&n);
  for(i=0;i<n;i++)
    scanf("%d",&A[i]);

  scanf("%d",&q);
  for(i=0;i<q;i++){
    scanf("%d",&m);
    if(solve(0,m))printf("yes\n");
    else printf("no\n");
  }
  return 0;
}
int solve(int i,int m){
  int res;
  if(m==0)return 1;
  if(i>=n)return 0;
  res = solve(i+1,m)||solve(i+1,m-A[i]);
  return res;
}



Measured memory_bytes: 2600
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
int a,b,m;
int A[100005],B[100005],x[100005],y[100005],c[100005];
int ma=100000000,mb=100000000;
int ans;
int main(void){
    cin>>a>>b>>m;
    for(int i=0;i<a;i++){
        cin>>A[i];
        ma=min(ma,A[i]);
    }
    for(int i=0;i<b;i++){
        cin>>B[i];
        mb=min(mb,B[i]);
    }
    ans=ma+mb;
    for(int i=0;i<m;i++){
        cin>>x[i]>>y[i]>>c[i];
        ans=min(ans,A[x[i]-1]+B[y[i]-1]-c[i]);
    }
    cout<<ans<<endl;
    
}


Measured memory_bytes: 5524
while tmp = gets
  n = tmp.chomp.to_i
  count = 0
  for a in 0..9
    break if a > n
    for b in 0..9
      break if a + b > n
      for c in 0..9
        break if a + b + c > n
        for d in 0..9
          break if a + b + c + d > n
          if a + b + c + d == n
            count += 1
          end
        end
      end
    end
  end
  puts count
end


Measured memory_bytes: 6868
#include <cstdio>
#include <iostream>
#include <cstring>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <map>
#include <cstring>
#include <unordered_map>
using namespace std;
typedef long long ll;
const int maxn = 100005;

int n,m;
vector<int>e[maxn];
bool fail;
int c[maxn],cnt;

void dfs(int x,int color){
  if(fail)return;
  c[x]=color;
  if(color)cnt++;
  for(int i=0;i<(int)e[x].size();i++){
    int v=e[x][i];
    if(c[v]==-1)dfs(v,1-color);
    else if(c[v]==color){
      fail=true;return;
    }
  }
}

int main() {
#ifdef suiyuan2009
  freopen("in.cpp","r",stdin);
#endif
  cin>>n>>m;
  memset(c,-1,sizeof(c));
  for(int i=0;i<m;i++){
    int x,y;
    cin>>x>>y;
    e[x].push_back(y);
    e[y].push_back(x);
  }
  dfs(1,0);
  if(fail){
    cout<<n*(ll)(n-1)/2-m<<endl;
  }else{
    cout<<cnt*(ll)(n-cnt)-m<<endl;
  }
  return 0;
}


Measured memory_bytes: 6528
def inp():return map(int,input().split())
def ip():return int(input())

n,k=inp()
h=[]
for _ in range(n):
    h.append(ip())
h.sort()

ans=10**18
i=0
while i+k-1<n:
    ans=min(ans,h[i+k-1]-h[i])
    i+=1
print(ans)

Measured memory_bytes: 50648
d,g=gets.split.map(&:to_i)
data=[]
all=0

d.times.each do
p,c=gets.split.map(&:to_i)
all+=p
data<<[p,c]
end
result=[]





for i in 0..2**d-1
    count=0
    point=0
    i=(i<<1)
    #p i.to_s(2)
    for j in 1..d
        if (i & (1<<j))!=0
            count+=data[j-1][0]
            point+=data[j-1][1]+data[j-1][0]*j*100
          
        end
    if point>=g
        result<<count
    end
    end
            
    #p count
    #p point
end

first=0
count=0
first_count=0
i=d-1
#累積和

while first<g
    count+=1
    first_count+=1
    first+=100*(i+1)
    if count>=data[i][0]
        count=0
        first+=data[i][1]
        i-=1
    end
  
end
result<<first_count
#p result

p result.min

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

public class Main {
	static Scanner scan = new Scanner(System.in);
	public static void main(String[] a) {
		int[] list = new int[10];
		for (int i = 0; i < 10; ++i) {
			list[i] = Integer.parseInt(scan.nextLine());
		}
		Arrays.sort(list);
		print(list[9]);
		print(list[8]);
		print(list[7]);
	}
	
	public static void print(Object out) {
		System.out.println(out);
	}
}

Measured memory_bytes: 17136
#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;
const int Max_N(15);

inline void update(int &a, const int &b)
{
	a = max(a, b);
}

int N, G[Max_N][Max_N], Sum[1 << Max_N];

void init()
{
	int M;
	scanf("%d%d", &N, &M);
	int a, b, c;
	while (M--)
		scanf("%d%d%d", &a, &b, &c), --a, --b, G[a][b] = G[b][a] = c;
	for (int S = 0;S < (1 << N);++S)
		for (int i = 0;i <= N - 1;++i)
			for (int j = i + 1;j <= N - 1;++j)
				if ((S & (1 << i)) && (S & (1 << j)))
					Sum[S] += G[i][j];
}

//等价于最大化保留的边权和，使得1 ~ n的路径上所有边都是桥边
//最优方案一定是一个1 ~ n的路径上，每个点挂一些集合 
//F[S][i]表示目前dp到1 ~ i的路径，满足1 ~ i的路径上所有边都是桥边，用到的点的集合是S
//转移考虑增加一条桥边还是新挂一个集合
int F[1 << Max_N][Max_N]; 
void dp()
{
	memset(F, -0X3F, sizeof(F));
	F[1 << 0][0] = 0;
	for (int S = 0;S < (1 << N);++S)
		for (int last = 0;last <= N - 1;++last)
			if (S & (1 << last))
			{
				for (int now = 0;now <= N - 1;++now)
					if ((S & (1 << now)) == 0 && G[last][now])
						update(F[S | (1 << now)][now], F[S][last] + G[last][now]);
				for (int S0 = ((1 << N) - 1) - S;S0;S0 = ((S0 - 1) & ((1 << N) - 1 - S)))
					update(F[S | S0][last], F[S][last] + Sum[S0 + (1 << last)]);
			}
	printf("%d", Sum[(1 << N) - 1] - F[(1 << N) - 1][N - 1]);
}

int main()
{
	init();
	dp();
	return 0;
}

Measured memory_bytes: 2176
M=10^9+7;n,k=readline()|>split.|>x->parse(Int,x);j=isqrt(n);let x=c=[(i->n÷i-n÷(i+1)).(1:n÷(j+1));fill(1,j)];print((i->x=cumsum(reverse(x)).*c.%M).(1:k)[k][end])end

Measured memory_bytes: 295812
def get_num(n, m):
    ans = 0
    for x in range(n, 2, -1):
        if 3 * x - 2 < m:
            return ans
        for y in range(x - 1, 1, -1):
            if x + 2 * y - 1 < m:
                break
            for z in range(y - 1, 0, -1):
                s = x + y + z
                if s == m:
                    ans += 1
    return ans


while True:
    [n, m] = [int(x) for x in raw_input().split()]
    if [n, m] == [0, 0]:
        break
    print(get_num(n, m))

Measured memory_bytes: 6412
h,w=map(int,input().split())
n=10
dis=[list(map(int,input().split())) for _ in range(n)]
a=[list(map(int,input().split())) for _ in range(h)]
for k in range(n):
  for i in range(n):
    for j in range(n):
      dis[i][j]=min(dis[i][j],dis[i][k]+dis[k][j])
ans=0
for i in range(h):
  for j in range(w):
    if a[i][j]!=-1:ans+=dis[a[i][j]][1]
print(ans)

Measured memory_bytes: 74012
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <functional>
#include <ccomplex>
#include <unordered_map>
#include <cstring>
#include <iostream>
#include <numeric>
#include <sstream>
#include <set>
#include <map>
#include <tuple>
#include <iomanip>

using namespace std;
#define MAX 1LL << 60
#define MOD 1000000007

typedef long long ll;

#define rep(i, s, e) for(ll i = s; i < e; i++)
#define repR(i, s, e) for(ll i = s; i > e; i--)
#define reft0(i, j) setfill('0') << setw(i) << j
#define fix(i) fixed << setprecision(i)


template<class T> inline bool chMax(T& a, T b){ if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chMin(T& a, T b){ if (a > b) { a = b; return true; } return false; }
template<class T> inline ll gcd(T a, T b){ if (a % b == 0){ return b; } else{ return gcd(b, a%b); } }
template<class T> inline ll lcm(T a, T b){ return a * b / gcd(a, b); }
template<class T> inline ll fact(T a){ if (a <= 1){ return 1; } else{ return a * fact(a - 1); } }
template<class T> inline ll comb(T a, T b){ return a == 0 ? 0 : fact(a) / fact(b) / fact(a - b); }

int main(){
    ll A, B;
    cin >> A >> B;

    double AA = (double)A * 12.5;
    double BB = (double)B * 10;
    if (floor(ceil(AA) * 0.1) == B){
        cout << ceil(AA) << endl;
    }
    else{
        if (floor(ceil(BB) * 0.08) == A){
            cout << ceil(BB) << endl;
        }
        else{
            cout << -1 << endl;
        }
    }
    return 0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = ((int)(n)-1); i >= 0; i--)
#define all(x) (x).begin(),(x).end()
 
using namespace std;
using ll = long long;
 
struct edge { int to, cost; };
 
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> P;
 
const int INF = 1e9;
const double EPS = 1e-10;
const int MOD = 1e9+7;
const double PI = acos(-1.0);

const int mx4[] = {0,1,0,-1};
const int my4[] = {1,0,-1,0};
const int mx8[] = {0,1,1,1,0,-1,-1,-1};
const int my8[] = {1,1,0,-1,-1,-1,0,1};

int main()
{	
	int n;
	cin >> n;
	string s;
	cin >> s;
	int ans = 0;
	for(int i = 1; i < n; i++){
		int cnt = 0,cnt1[30] = {},cnt2[30] = {};
		for(int j = 0; j < i; j++){
			cnt1[s[j]-'a']++;
		}
		for(int j = i; j < n; j++){
			cnt2[s[j]-'a']++;
		}
		for(int j = 0; j < 26; j++){
			if(cnt1[j] && cnt2[j]) cnt++;
		}
		ans = max(ans,cnt);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 768
#include<iostream>
#include<cstdio>
#include<cmath>

double distance(double a1,double a2,double b1,double b2){
    return sqrt(pow(a1-b1,2)+pow(a2-b2,2)); 
}

int main(){
    using namespace std;
    double x1,x2,y1,y2;
    double dis;

    cin>>x1>>y1>>x2>>y2;
    //dis=sqrt(pow(x1-x2,2)+pow(y1-y2,2));
    dis=distance(x1,y1,x2,y2);

    printf(" %lf \n" , dis);
    return 0;

}


Measured memory_bytes: 3208
// #include<iostream>
// using namespace std;
// #define ll long long
//
// int main(){
//   ll n,p,ret,ans=0;cin>>n>>p;
//   for(int i=0;i<n*n;i++){
//     ll temp=p,cnt=0;
//     while(temp%i==0){
//       temp=temp/i;
//       cnt++;
//     }
//     ret=max(ans,cnt);
//   }
//   if(ret>n)ans=ret;
//   else ans=1;
//   cout<<ans<<endl;
// }

#include <bits/stdc++.h>

using namespace std;

#define inf 1<<30
#define pqueue priority_queue
#define mp make_pair
#define pb push_back
#define fn fill_n
typedef long long llong;
typedef unsigned long long ullong;
typedef pair<int, int> P;

map<llong, llong> soinsuBunkai(llong n){
	map<llong, llong> ret;
	while(n % 2 == 0){
		ret[2]++;
		n /= 2;
	}
	for(llong i = 3; i*i <= n; i += 2){
		while(n%i == 0){
			ret[i]++;
			n /= i;
		}
	}
	ret[n]++;

	return ret;
}


int main(){
	llong N, p;
	cin >> N >> p;
	auto soinsu = soinsuBunkai(p);
	llong ans = 1;
	for(auto it = soinsu.begin(); it != soinsu.end(); it++){
		cerr << it->first << " " << it->second << endl;
		for(int i = 0; i < it->second/N; i++)
			ans *= it->first;
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int parent(int);
int left(int);
int right(int);

int main()
{
  int hs, i;
  int A[260];
  
  scanf("%d", &hs);
  for(i=1; i<=hs; i++){
	scanf("%d", &A[i]);
  }
  
  for(i=1; i<=hs; i++){
	printf("node %d: key = %d, ", i, A[i]);
	
	if(parent(i) != 0){
	  printf("parent key = %d, ", A[parent(i)]);
	}
	if(left(i) <= hs){
	  printf("left key = %d, ", A[left(i)]);
	}
	if(right(i) <= hs){
	  printf("right key = %d, ", A[right(i)]);
	}
	printf("\n");
  }
  return 0;
}

int parent(int i)
{
  return i/2; 
}

int left(int i)
{
  return 2*i;
}
int right(int i)
{
  return 2*i+1;
}

Measured memory_bytes: 600
import sys
sys.setrecursionlimit(4100000)
import math
import itertools
INF = float('inf')
from heapq import heapify, heappop, heappush

def main():
    r = int(input())
    g = int(input())

    print(g*2-r)


if __name__ == '__main__':
    main()


Measured memory_bytes: 62232
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

ll h[100010];
int main() {
	ll n,a,b,sum;
	cin>>n>>a>>b;
	for(ll i=0;i<n;i++){
		cin>>h[i];
		sum+=(h[i]+b-1)/b;
	}
	ll left=0;
	ll right=sum;
	while(right -left>1){
		ll mid=left+(right -left)/2;
		ll sum=0;
		for(ll i=0;i<n;i++){
			ll now=(h[i]-b*mid+a-b-1)/(a-b);
			sum+=max(ll(0),now);
		}
		if(mid>=sum){
			right=mid;
		}
		else{
			left=mid;
		}
	}
	cout << right;
	// your code goes here
	return 0;
}

Measured memory_bytes: 1024
n, m = map(int, input().split())
ab = []
for i in range(n):
    ab.append(list(map(int, input().split())))

ab.sort()
count = 0
summ = 0
for i in range(n):
    if count + ab[i][1] >= m:
        buy = m - count
        summ += ab[i][0] * buy
        print(summ)
        exit()
    else:
        count += ab[i][1]
        summ += ab[i][0] * ab[i][1]


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

int main() {
    int n; cin >> n;
    int sum = 0;
    int x[n + 1];
    for (int i = 0; i < n; i++) {
        cin >> x[i];
        sum += x[i];
    } 
    int p = int(double(sum*1.0 / n) + 0.5);
    int ans = 0;
    for (int i = 0; i < n; i++) {
        ans += pow((x[i] - p), 2);
    }
    cout << ans << endl;
}

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

count_5 = 0
count_7 = 0

if A == 5:
  count_5 += 1
elif A == 7:
  count_7 += 1
  
if B == 5:
  count_5 += 1
elif B == 7:
  count_7 += 1
  
if C == 5:
  count_5 += 1
elif C == 7:
  count_7 += 1
  
if count_5 == 2 and count_7 == 1:
  print("YES")
else:
  print("NO") 
 


Measured memory_bytes: 61736
fn main() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };
    let n: usize = sc.read();
    let a: Vec<usize> = sc.vec(n);
    let mut b = vec![0; n + 1];
    for i in (0..n).rev() {
        let a = a[i];
        let p = i + 1;
        let mut cur = p * 2;
        let mut sum = 0;
        while cur <= n {
            sum += b[cur];
            cur += p;
        }
        if sum % 2 == a {
            b[p] = 0;
        } else if (sum + 1) % 2 == a {
            b[p] = 1;
        } else {
            println!("-1");
            return;
        }
    }

    let mut ans = vec![];
    for i in 1..(n + 1) {
        if b[i] == 1 {
            ans.push(i);
        }
    }
    println!("{}", ans.len());
    for (i, ans) in ans.into_iter().enumerate() {
        if i > 0 {
            print!(" ");
        }
        print!("{}", ans);
    }
    println!();
}

pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n')
            .take_while(|&b| b != b' ' && b != b'\n')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 9212
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int ll
#define REP(i, n) FOR(i, 0, n)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define UM unordered_map
#define ALL(a) (a).begin(), (a).end()
typedef vector<ll> vi;
typedef vector<vector<ll>> vvi;
typedef pair<ll, ll> pii;
const ll INF = 1LL << 58;
const ll MOD = 1000000007;
typedef vector<pii> vpii;
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}
template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return true;
    }
    return false;
}

signed main()
{
    int N;
    string S;
    cin >> N >> S;
    int cnt = 0;
    REP(i, N - 2)
    {
        string sub = S.substr(i, 3);
        if (sub == "ABC")
            ++cnt;
    }
    cout << cnt << endl;

    // system("pause");
    return 0;
}

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

using namespace std;

#define S scanf
#define P printf
#define G getline
#define Si size()
#define C clear()
#define B begin()
#define F front()
#define T top()
#define E end()
#define Em empty()
#define V vector
#define Q queue
#define DQ deque
#define PQ priority_queue
#define ST stack
#define Fi first
#define Se second
#define Pi acos(-1)
#define PS push
#define PP pop()
#define PSF push_front
#define PSB push_back
#define PPF pop_front()
#define PPB pop_back()
#define MP make_pair
#define LL long long int
#define ULL unsigned long long int
#define PII pair<int,int>
#define PSI pair<string,int>
#define PIS pair<int,string>
#define PLI pair<long long int,int>
#define PLL pair<long long int,long long int>
#define MII map<int,int>
#define MSI map<string,int>
#define MIS map<int,string>
#define MLI map<long long int,int>

void FAST();
LL big_mod(LL val,LL pow,LL mod);
LL mod_inverse(LL val,LL mod);









int main()
{
    FAST();

//    freopen("input.txt","r",stdin);
//    freopen("output.txt","w",stdout);

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







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

LL big_mod(LL val,LL pow,LL mod)
{
    LL res = 1;
    val = val % mod;
    while(pow > 0)
    {
        if(pow & 1)
        {
            res = (res*val) % mod;
        }
        pow = pow >> 1;
        val = (val*val) % mod;
    }
    return res;
}

LL mod_inverse(LL val,LL mod)
{
    LL mod1 = mod;
    if(mod == 1)
    {
        return 0;
    }
    LL y = 0;
    LL x = 1;
    LL quotient,temp;
    while(val > 1)
    {
        quotient = val / mod;
        temp = mod;
        mod = val % mod;
        val = temp;
        temp = y;
        y = x - quotient * y;
        x = temp;
    }
    if(x < 0)
    {
        x += mod1;
    }
    return x;
}


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

int main(){
	int count[1001][2],c,n;
	string a,b;
	for(int i = 0;i < 1001;++i){
		for(int j = 0;j < 2;++j){
			count[i][j] = 0;
		}
	}
	while(getline(cin,a)){
		if(a == "\0") break;
		c = 0;
		b = a[c];
		++c;
		n = a.find(',');
		for(;c < n;++c){
			b += a[c];
		}
		++count[atoi(b.c_str())][0];
	}
	while(getline(cin,a)){
		c = 0;
		b = a[c];
		++c;
		n = a.find(',');
		for(;c < n;++c){
			b += a[c];
		}
		++count[atoi(b.c_str())][1];
	}
	for(int i = 1;i < 1001;++i){
		if(count[i][0] > 0 && count[i][1] > 0){
			cout << i << " " << count[i][0] + count[i][1] << endl;
		}
	}
	return 0;
}

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


int main(){
    double a, b, x;
    cin >> a >> b >> x;
    
    double s = x / a;
    
    double rad;
    
    if (s >= a * b / 2){
        double h = (a*b-s) * 2 / a;
        rad = atan2(h, a);
    }
    else{
        double w = s * 2 / b;
        rad = atan2(b, w);
    }
    
    double pi = acos(-1);
    double deg = rad / (2*pi) * 360;
    
    printf("%.10lf\n", deg);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<double,LL> P;
const LL mod=1e9+7;
const LL LINF=1LL<<62;
const LL INF=1<<30;


int main(){
    LL a,b,c;
    cin >> a >> b >> c;
    for(int i=0;i<100;i++){
        LL l,m,n;
        if(a&1||b&1||c&1){
            cout << i << endl;
            return 0;
        }
        l=(b+c)/2;
        m=(a+c)/2;
        n=(a+b)/2;
        a=l,b=m,c=n;
    }
    puts("-1");
    return 0;
}


Measured memory_bytes: 256
n = int(input())
list = []
count = 0
test = 0
nums = input().split()
for i in range(0,n):
  list.append(int(nums[i]))
for i in list: 
  if(i%2==0):
    if(i%3==0 or i%5==0):
      continue
    else:
      count += 1
if count>0:
  print("DENIED")
else:
  print("APPROVED")
      

Measured memory_bytes: 3060
def kaisu(n,k):
  if n>=K:
    return k
  else:
    return kaisu(2*n,k+1)
N,K=map(int,input().split())
ans=0
for i in range(1,N+1):
  ans+=pow(2,20-kaisu(i,0))
ans=ans/(pow(2,20))
print(ans/N)

Measured memory_bytes: 9064
#include<stdio.h>
using namespace std;

int main() {
  int a,i;
  long s=0; 
  scanf("%d",&a);
  int b[a];
  int c[a];
  
  for(i=0; i<a; i++){
    scanf("%d",&b[i]);
    c[i]=b[i];
  }
  i=0;
  for(i=0; i<a; i++){
    b[i]=c[a-i-1];
  }
  i=0;
  for(i=0; i<a-1; i++){
    printf("%d ",b[i]);
  }
   printf("%d\n",b[a-1]);
}
  


Measured memory_bytes: 2724
n=int(input())

#0-9
#1-9のみ
a8=1
a9=1
a10=1
for i in range(n):
    a8=(a8*8)%(10**9+7)
    a9=(a9*9)%(10**9+7)
    a10=(a10*10)%(10**9+7)
#0-8のみ
print((a10-(2*a9-a8))%(10**9+7))


Measured memory_bytes: 9172
#include <stdio.h>
#include <stdlib.h>
#define INF 1e17
typedef long long ll;
typedef struct{
    int cnt;
    int to[1001];
    ll cost[1001];
} edge;

ll d[1001];
ll ans;
edge eg[1001];

int sol(int n,int s){
    int i;
    for(i=1;i<=n;i++){
        d[i]=INF;
    }
    d[s]=0;
    int f,t;
    for(i=0;i<n-1;i++){
        for(f=1;f<=n;f++){
            for(t=0;t<eg[f].cnt;t++){
                edge e=eg[f];
                if(d[f]!=INF&&d[e.to[t]]>d[f]+e.cost[t]){
                    d[e.to[t]]=d[f]+e.cost[t];
                }
            }
        }
    }
    ans=d[n];
    int flag[1001]={0};
    for(i=0;i<n;i++){
        for(f=1;f<=n;f++){
            for(t=0;t<eg[f].cnt;t++){
                edge e=eg[f];
                if(d[f]!=INF&&d[e.to[t]]>d[f]+e.cost[t]){
                    flag[e.to[t]]=1;
                }
                if(flag[f]){
                    flag[e.to[t]]=1;
                }
            }
        }
    }
    return flag[n];
}

int main(){
    int n,m;
    scanf("%d %d",&n,&m);

    int i,j;
    for(i=1;i<=1000;i++){
        eg[i].cnt=0;
    }
    for(i=0;i<m;i++){
        int a,b,c;
        scanf("%d %d %d",&a,&b,&c);
        eg[a].to[eg[a].cnt]=b;
        eg[a].cost[eg[a].cnt]=-c;
        eg[a].cnt++;
    }
    int flag = sol(n,1);
    if(flag){
        puts("inf");
    }else{
        printf("%lld\n",-ans);
    }
}


Measured memory_bytes: 10880
#include<iostream>
#include<cstdio>
#define mod 1000000007
using namespace std;
long long n,ans,dp[301][301][2],d[301],fac[301],invfac[301];
int read()
{
  char c=0;
  int sum=0;
  while (c<'0'||c>'9')
    c=getchar();
  while ('0'<=c&&c<='9')
    {
      sum=sum*10+c-'0';
      c=getchar();
    }
  return sum;
}
long long fast_pow(long long a,int b)
{
  if (b==0)
    return 1;
  if (b&1)
    return fast_pow(a*a%mod,b/2)*a%mod;
  else
    return fast_pow(a*a%mod,b/2);
}
int main()
{
  n=read();
  for (int i=1;i<=n;++i)
    d[i]=read();
  fac[0]=1;
  for (int i=1;i<=n;++i)
    fac[i]=fac[i-1]*i%mod;
  invfac[n]=fast_pow(fac[n],mod-2);
  for (int i=n-1;i>=0;--i)
    invfac[i]=invfac[i+1]*(i+1)%mod;
  dp[0][0][0]=1;
  for (int i=1;i<=n;++i)
    for (int j=0;j<=n;++j)
      for (int op=0;op<=1;++op)
	{
	  dp[i][j][op]=dp[i-1][j][op]*invfac[d[i]-1]%mod;
	  if (j>=1&&d[i]>=2)
	    dp[i][j][op]=(dp[i][j][op]+dp[i-1][j-1][op]*invfac[d[i]-2]%mod)%mod;
	  if (j>=1&&op&&d[i]>2)
	    dp[i][j][op]=(dp[i][j][op]+dp[i-1][j-1][0]*invfac[d[i]-3]%mod)%mod;
	}
  for (int i=3;i<=n;++i)
    ans=(ans+dp[n][i][1-(i==n)]*fac[i-1]%mod*fast_pow(2,mod-2)%mod*fac[n-i-1+(i==n)]%mod)%mod;
  printf("%lld\n",ans);
  return 0;
}

Measured memory_bytes: 5072