akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main()
{
	long long A,V,B,W,T;
	cin >> A >> V >> B >> W >> T;

	//int A[5]
	//sort(A, A + 5);

	long long a, b;
	a = A; b = B;
	
	if (A > B)
	{
		for (long long i = 0; i < T; i++)
		{
			a += -V;
			b += -W;
		}
		if (a <= b)
		{
			cout << "YES" << endl;
		}
		else
		{
			cout << "NO" << endl;
		}
	}
	else
	{
		for (long long i = 0; i < T; i++)
		{
			a += V;
			b += W;
		}

		if (a >= b)
		{
			cout << "YES" << endl;
		}
		else
		{
			cout << "NO" << endl;
		}
	}

}

Measured memory_bytes: 3628
use std::io::stdin;

fn main() {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    let c = buf.chars().next().unwrap();
    if 'a' <= c && c <= 'z' {
        println!("a");
    }
    else {
        println!("A");
    }
}


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

using namespace std;

#define EACH(i,a) for (auto& i : a)
#define FOR(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define RFOR(i,a,b) for(int i=(int)b-1;i>=(int)a;--i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define debug(x) cerr << #x << ":" << x << endl;
#define OK(ok) cout << (ok ? "Yes" : "No") << endl;
typedef long long ll;

void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail) {
  cin >> head; CINT(move(tail)...);
}
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)

const int INF = 1e9 + 1;
const int MOD = 1e9 + 7;
const int MAX_N = 1e5 + 1;

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

  ll a, b, c, k;
  cin >> a >> b >> c >> k;

  if (min(a, b) + 1e18 < max(a, b)) {
    cout << "Unfair" << endl;
    return 0;
  }
  
  ll dist = a - b;
  if (k % 2 == 0) {
    cout << dist << endl;
  } else {
    cout << -dist << endl;
  }
  
  return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <map>
#include <vector>
using namespace std;

int main()
{
    int n;
    while(cin>>n)
    {
        vector<int> one(7,0),two(7,0);
        for(int c=0;c<n;c++)
        {
            int z;
            cin>>z;
            int g=z%10,d=z/10;
            if(g==d) two[g]++;
            else
            {
                one[g]++;
                one[d]++;
            }
        }
        int alone = 0;
        for(int c=0;c<7;c++)
        {
            if(two[c] && !one[c] && n > 1)
            {
                cout<<"No"<<endl;
                goto end;
            }
            if(one[c]&1) alone++;
        }
        cout<<(alone<=2?"Yes":"No")<<endl;
        end:;
    }
}

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

using namespace std;

using uint = unsigned int;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define dbg(...) cerr << #__VA_ARGS__ << " ->", debug_out(__VA_ARGS__)
#define dbg_p(x) cerr<<#x": "<<(x).first<<' '<<(x).second<<endl
#define dbg_v(x, n) {cerr<<#x"[]: ";for(long long _=0;_<n;++_)cerr<<(x)[_]<<' ';cerr<<endl;}
#define all(v) v.begin(), v.end()
#define fi first
#define se second
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) { cerr << " " << H; debug_out(T...);}
 
template<typename T1, typename T2>
ostream& operator <<(ostream &out, const pair<T1, T2> &item) {
	out << '(' << item.first << ", " << item.second << ')';
	return out;
}
 
template <typename T>
ostream& operator <<(ostream &out, const vector<T>& v) {
	for(const auto &item : v) out << item << ' ';
	return out;
}

long long n, m;

int main()
{
	ios_base::sync_with_stdio(false);

	cin>>n>>m;
	if (n == 1 || m == 1)
	{
		cout<<1;
		return 0;
	}
	ll x = (n/2+n%2)*(m/2+m%2);
	ll y = (n/2) * (m/2);
	cout<<x+y<<'\n';
	return 0;
}

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

int main()
{
    long int n, m;
    cin >> n >> m;
    long int a, b, chk = 0;
    vector<long int>cnct_a;
    vector<long int>cnct_b;
    for(long int i = 0; i < m; i++){
        cin >> a >> b;
        if(a == 1 && b == n){
            chk = 1;
            break;
        }
        else{
            if(a == 1)
                cnct_a.push_back(b);
            if( b == n)
                cnct_b.push_back(a);
        }
    }
    sort(cnct_a.begin(), cnct_a.end());
    sort(cnct_b.begin(), cnct_b.end());

    if(chk == 0){
        if(cnct_a.size() == 0 || cnct_b.size() == 0)
            chk = 0;
        else{
            vector<long int>v(cnct_a.size() + cnct_b.size());
            vector<long int>::iterator it, st;
            it = set_intersection(cnct_a.begin(), cnct_a.end(), cnct_b.begin(), cnct_b.end(), v.begin());

            for (st = v.begin(); st != it; ++st){
                chk = 1;
                break;
            }
        }
    }
    if(chk == 0)
        cout << "IMPOSSIBLE";
    else if(chk == 1)
        cout << "POSSIBLE";

    return 0;
}


Measured memory_bytes: 6344
#include <bits/stdc++.h>
using namespace std;
 
template <typename T> void print(T t) { cout<<t<<endl; }
template<typename T, typename... Args> void print(T t, Args... args) { cout<<t<<" "; print(args...); }
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl '\n'
#define int long long
#define double long double

int32_t main() 
{
    IOS;
    int n;
    vector<int>a,b;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        int a1,b1;
        cin>>a1>>b1;
        a.push_back(a1);
        b.push_back(b1);
    }
    sort(a.begin(),a.end());
    sort(b.begin(),b.end());
    if(n%2)
        print(b[n/2]-a[n/2]+1);
    else
        print(b[n/2]+b[n/2-1]-a[n/2]-a[n/2-1]+1);
}   

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

#define REP(i,n) for(ll i=0; i<(ll)(n); i++)
#define FOR(i,n,m) for (ll i=n; i<(ll)(m); i++)
#define pb push_back
#define INF 1000000007LL
#define all(a) (a).begin(),(a).end()
#define chmin(a,b) a=min(a,b)
#define chmax(a,b) a=max(a,b)

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

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

bool is_753(string &s) {
    bool is7 = false;
    bool is5 = false;
    bool is3 = false;
    REP(i, s.size()) {
        is7 = is7 || s[i] == '7';
        is5 = is5 || s[i] == '5';
        is3 = is3 || s[i] == '3';
    }
    
    return is7 && is5 && is3;
}

int main(){
    ios::sync_with_stdio(false);
    ll N;
    stringstream ss;
    cin >> N;
    ss << N;
    ll ans = 0;
    string s[3] = {"3", "5", "7"};
    set<int> num753;
    REP(j, pow(3, 10)) {
        ll num = j;
        string str_num = "";
        
        bool is7 = false;
        bool is5 = false;
        bool is3 = false;
        while(num != 0) {
            str_num = s[num%3] + str_num;
            is7 = is7 || s[num%3] == "7";
            is5 = is5 || s[num%3] == "5";
            is3 = is3 || s[num%3] == "3";
            num /= 3;
        }
        if (is7 && is5 && is3) {
            stringstream ss1;
            ss1 << str_num;
            int nn1;
            ss1 >> nn1;
            num753.insert(nn1);
        }
        if (is7 && is5) {
            int loop = (int)str_num.size();
            REP(i, 9 - loop) {
                str_num = "3" + str_num;
                stringstream ss1;
                ss1 << str_num;
                int nn1;
                ss1 >> nn1;
                num753.insert(nn1);
            }
        }
    }
    
    for (auto x: num753) {
        if (x <= N) {
            // cout << x << endl;
            ans++;
        } else {
            break;
        }
    }
    
    cout << ans << endl;

    
    return 0;
}


Measured memory_bytes: 1536
#include<bits/stdc++.h>
using namespace std;
#define  ft  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define  ll  long long
#define  pi  pair<int,int>
#define  pb  push_back
#define  F   first
#define  S   second
const int N=1e5+3;
int c[N];
int main()
{
    ft
    int t,i,j,n,m,l=0,r=0,s=0;
    cin>>n;
    for(i=0;i<n;i++)
    {
        cin>>m;
        c[m]++;
    }
    for(i=1;i<N;i++)
    {
        if(c[i]>0)
        {
            if(c[i]%2==1)
            {
                l++;
            }
            else
            {
                r++;
            }
        }
    }
    if(r%2==0)
    {
        cout<<(l+r)<<"\n";
    }
    else
    {
        cout<<(l+r-1)<<"\n";
    }
    return 0;
}



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

#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <algorithm>

#include <bits/stdc++.h>
#include <cmath>
#include <limits>

using namespace std;
typedef long long LL;

int main(int argc, char* argv[]){
	cin.tie(0);
	ios::sync_with_stdio(false);

	LL N; cin >> N;
	string S; cin >> S;
	int ans = 0;
	for(int i=0; i<N-1; i++){
		int u = 0;
		map<char, int> m;
		for(int j=0; j<=i; j++){
			char s = S[j];
			if(m.count(s) == 0){
				m[s] = 1;
			}
		}
		for(int j=i+1; j<N; j++){
			char s = S[j];
			if(m.count(s) !=0 && m[s] == 1){
				m[s]++;
				u++;
			}
		}
		if(ans < u){
			ans = u;
		}
	}
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 3724
#include<iostream>
#include<string.h>
using namespace std;
int main()
{
    // 整数の入力
    int a,b;
    cin >> a >> b  ;
    // 出力
    int sum = a+b;
    int ave;
    if(sum%2==1){
	ave = (a+b+1)/2;
    }
    else{
        ave = (a+b)/2;
    }
    cout << ave << endl;

    return 0;
}


Measured memory_bytes: 256
def get_input():
    while True:
        try:
            yield ''.join(input())
        except EOFError:
            break

def bomb(table, x, y):

    table[x][y] = False
    for i in range(1, 4):
        if x + i >= 8:
            break
        if table[x+i][y]:
            bomb(table, x+i, y)

    for i in range(1, 4):
        if x - i < 0:
            break
        if table[x-i][y]:
            bomb(table, x-i, y)

    for i in range(1, 4):
        if y + i >= 8:
            break
        if table[x][y+i]:
            bomb(table, x, y+i)

    for i in range(1, 4):
        if y - i < 0:
            break
        if table[x][y-i]:
            bomb(table, x, y-i)

    return

N = int(input())
for l in range(N):
    input()
    table = [[False for i in range(8)] for j in range(8)]
    for i in range(8):
        L = input()
        for j in range(8):
            if int(L[j]) == 1:
                table[i][j] = True

    a = int(input())
    b = int(input())
    bomb(table, b-1, a-1)

    print("Data " + str(l+1) + ":")
    for i in range(8):
        for j in range(8):
            if table[i][j]:
                print("1", end="")
            else:
                print("0", end="")
        print("")




Measured memory_bytes: 5620
import numpy as np

N, K = map(int, input().split())
E = list(map(lambda x: (int(x) + 1) / 2, input().split()))

res = np.cumsum(E)

ans = res[K - 1]
for i in range(K, N):
    if ans < res[i] - res[i - K]:
        ans = res[i] - res[i - K]
print(ans)


Measured memory_bytes: 34348
#include <bits/stdc++.h>
#define ll long long
#define db long double
#define x first
#define y second
#define mp make_pair
#define pb push_back
#define all(a) a.begin(), a.end()

using namespace std;

const int MOD = 1e9 + 7;
int N;

vector <int> p;
vector <int> sums;

int res = 0;

void add(int &x, int y) {
	x += y;
	if (x >= MOD) {
		x -= MOD;
	}
	if (x < 0) {
		x += MOD;
	}
}

void mult(int& x, int y) {
	x = x * (ll) y % MOD;
}

void dfs(int v, int w, int type) {
	mult(w, v);
	if (v >= N / 2) {
		int u = p[v - N / 2];
		int ww = 0;
		while (u) {
			if (type == 1) {
				mult(ww, u);
				int now = sums[u];
				add(now, -ww);
				//cout << v << " " << u << " " << w << " " << sums[u] << endl;
				add(res, now * (ll) w % MOD);
				add(ww, now);
				mult(w, u);
			} else {
				mult(w, u);
				add(sums[u], (type ? -1 : 1) * w);
			}
			u /= 2;
		}
	} else {
		dfs(2 * v, w, type);
		dfs(2 * v + 1, w, type);
	}
}

void iterate(int v) {
	if (v >= N / 2) {
		return;
	}
	iterate(2 * v);
	iterate(2 * v + 1);

	/*cout << "LCA: " << v << endl;
	cout << "WAS_RES : " << res << endl;*/

	dfs(2 * v, 1, 0);
	dfs(2 * v + 1, v, 1);
	dfs(2 * v, 1, 2);
}

int main(){
#ifdef LOCAL
	freopen("D_input.txt", "r", stdin);
	//freopen("D_output.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(0);
	cin.tie(0);

	int n;
	cin >> n;
	N = (1 << n);
	sums.resize(N, 0);
	for (int i = 0; i < N / 2; ++i) {
		int x;
		cin >> x;
		x += N / 2 - 1;
		p.pb(x);
	}
	/*for (int x : p) {
		cout << x << " ";
	}
	cout << endl;*/

	iterate(1);
	cout << res << "\n";
}


Measured memory_bytes: 4788
#include <bits/stdc++.h>
// statics
using namespace std;
using int64 = int_fast64_t;
using PAIR = pair<int64, int64>;
constexpr int INF = 1 << 30;
constexpr int64 LINF = 1LL << 60;
constexpr int MOD = 1e9 + 7;
constexpr int MAX_N = 3e5 + 1;

// init/input
#define int int64
#define INIT ios::sync_with_stdio(false);cin.tie(0);
#define VAR(type, ...) type __VA_ARGS__;MACRO_VAR_Scan(__VA_ARGS__);
template<typename T> void MACRO_VAR_Scan(T &t) {cin>>t;}
template<typename First, typename...Rest> void MACRO_VAR_Scan(First &first, Rest&...rest) {cin>>first;MACRO_VAR_Scan(rest...);}
#define VEC(type, c, n) vector<type> c(n);for(auto &&i:c)cin>>i;

// out
#define OUT(dist) cout<<(dist);
#define FOUT(n, dist) cout<<fixed<<setprecision(n)<<(dist);
#define SP cout<<" ";
#define BR cout<<endl;
#define zero(n) cout<<setfill('0')<<right<<setw(n)
#define debug(x) cerr<<#x<<":"<< (x);BR;

// utility
#define ALL(a) (a).begin(), (a).end()
#define EACH(i, a) for(auto &&i:(a))
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RFOR(i, a, b) for(int i=(b)-1;i>=0;--i)
#define REP(i, n) for(int i=0;i<(n);++i)
#define RREP(i, n) for(int i=(n)-1;i>=0;--i)

signed main() {
  INIT;
	VAR(int,x,y);
	int ans = LINF;
	REP(i,2){
		REP(j,2){
			int fr=x*(i&1?-1:1);
			int to=y*(j&1?-1:1);
			if(to<fr) continue;
			int tmp=max(fr,to)-min(fr,to);
			tmp += (i&1?1:0) + (j&1?1:0);
			ans=min(ans,tmp);
		}
	}
	OUT(ans)BR;
  
  return 0;
}


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

int main() {
  int n, q;
  cin >> n;
  map<ll, ll> mp;
  ll s = 0;
  for (int i = 0; i < n; i++) {
    ll a;
    cin >> a;
    mp[a]++;
    s += a;
  }

  cin >> q;
  for (int i = 0; i < q; i++) {
    ll b, c;
    cin >> b >> c;
    if (mp.count(b) && mp[b] > 0) {
      s -= (mp[b] * b);
      s += (mp[b] * c);
      mp[c] += mp[b];
      mp[b] = 0;
    }
    cout << s << endl;
  }

  return 0;
}


Measured memory_bytes: 8448
fun main(args: Array<String>) {
  val (N, R) = readInts()
  if (N >= 10) {
    println(R)
  } else {
    println(R + (100 * (10 - N)))
  }
}

fun readString() = readLine()!!
fun readStrings() = readString().split(" ")
fun readInt() = readString().toInt()
fun readInts() = readStrings().map { it.toInt() }
fun readLong() = readString().toLong()
fun readLongs() = readStrings().map { it.toLong() }


Measured memory_bytes: 37900
#include <bits/stdc++.h>
using namespace std;
int main(){
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  if(abs(a-c)<=d || (abs(a-b)<=d && abs(b-c)<=d)){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define rng(x) x.begin(), x.end()
#define pb push_back
#define F first
#define S second
#define el '\n'
template<class L, class R> ostream& operator<<(ostream &os, pair<L,R> P) {
    return os << "(" << P.F << "," << P.S << ")"; }
template<class T> ostream& operator<<(ostream &os, vector<T> V) {
    os << "[ "; for(auto v : V) os << v << " "; return os << "]"; }
template<class T> ostream& operator<<(ostream &os, set<T> S){
    os << "{ "; for(auto s:S) os<<s<<" "; return os<<"}"; }
template<class L, class R> ostream& operator<<(ostream &os, map<L,R> M) {
    os << "{ "; for(auto m:M) os<<"("<<m.F<<":"<<m.S<<") "; return os<<"}";}
#define db(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) { cout<<name<<" : "<<arg1<<'\n';}
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...);}
typedef long long ll; typedef pair<int,int> pi; 
typedef vector<int> vi; typedef vector<ll> vl; typedef vector<vi> vvi;
 
/*-----------------------------Code begins----------------------------------*/

const int N = 1<<18, mod = 998244353;
vl ST(2*N), lazy(2*N, -1), ones(N);
int n;

void update(int si, int ss, int se, int dig){
    lazy[si] = dig;
    ST[si] = ((ones[se] - (ss ? ones[ss - 1] : 0) + mod)*dig) % mod;
}

void shift(int si, int ss, int se){
    if(lazy[si] == -1)  return;
    int mid = (ss+se)/2;
    update(si*2 + 1, ss, mid, lazy[si]);
    update(si*2 + 2, mid+1, se, lazy[si]);
    lazy[si] = -1;
}

void updateUtil(int si, int ss, int se, int qs, int qe, int dig){
    if (se < qs || ss > qe) return;

    if (qs <= ss && qe >= se) return update(si, ss, se, dig); 

    shift(si, ss, se);
    int mid = (ss+se)/2;
    updateUtil(2*si + 1, ss, mid, qs, qe, dig);
    updateUtil(2*si + 2, mid+1, se, qs, qe, dig);
    ST[si] = (ST[si*2 + 1] +  ST[si*2 + 2]) % mod;
}

void update(int qs, int qe, int dig){
    return updateUtil(0, 0, n-1, qs, qe, dig);
}

int construct(int si = 0, int ss = 0, int se = n-1){
    if(ss == se) return ST[si] = ones[ss];
    int mid = (ss + se)/2;
    return ST[si] = (construct(2*si + 1, ss, mid) + 
                    construct(2*si + 2, mid + 1, se)) % mod;
}

void solve(){
    int q; cin>>n>>q;
    ones[0] = 1;
    for (int i = 1; i < n; ++i){
        ones[i] = (ones[i-1]*10) % mod;
    }

    construct();
    for (int i = 1; i < n; ++i){
        ones[i] += ones[i-1];
        ones[i] %= mod;
    }

    while(q--){
        int l, r; cin>>l>>r;
        l = n-l, r = n-r;
        char dig; cin>>dig;
        update(r, l, dig-'0');
        cout<<ST[0]<<el;
    }
}
 
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int T=1, tc = 1;
    // cin>>T; 
    while(T--){
        solve();
    }
    return 0; 
}

Measured memory_bytes: 13404
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n,m;cin>>n>>m;
    int l[m],r[m];
    for (int i = 0; i < m; i++) {
        cin>>l[i]>>r[i];
    }
    int first=l[0],last=r[0];
    for (int i = 0; i < m; i++) {
        first=max(first,l[i]);
        last=min(last,r[i]);
    }
    int res=0;
    if(last-first+1<0)res=0;
    else res=last-first+1;
std::cout << res << '\n';


}


Measured memory_bytes: 1024
def countup(a, b):
    count = 0
    if a < b:
        return count
    else:
        while a >= b:
            b *= 2
            count += 1
        return count


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

count = countup(A, B)
B_ = B * (2 ** count)
count += countup(B_, C)

if count <= K:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 9188
# -*- coding:utf-8 -*-


def solve():
    N, K = list(map(int, input().split()))
    Ps = list(map(int, input().split()))
    Cs = list(map(int, input().split()))

    # 最低一回は移動させないといけないの忘れてた
    ans = -float("inf")
    for i in range(N):
        ans = max(ans, Cs[i])

    if K == 1:
        print(ans)
        return

    loop_list = []
    for start in range(N):
        now = start
        visited = set()
        visited.add(now)
        move = 0
        total_score = 0
        max_score = ans

        while True:  # たかだかN回
            nx = Ps[now]-1
            total_score += Cs[nx]
            max_score = max(max_score, total_score)
            move += 1
            now = nx
            if now in visited:
                # 一周した
                if total_score > 0:
                    # 一周する価値あるので、loop_listに追加
                    loop_list.append((start, total_score, move))
                break

            # 一周してない
            if move == K:
                # もう移動できないので終わり
                break
            visited.add(now)
        ans = max(ans, max_score)


    # 一周した方が得かつ、移動回数が余っているなら、ぐるぐる回る
    for start, score, move in loop_list:
        total_score = score*(K//move)
        restK = K % move
        max_score = total_score

        # K回目の最大値を探す
        now = start
        while restK != 0:
            restK -= 1
            nx = Ps[now]-1
            total_score += Cs[nx]
            max_score = max(max_score, total_score)
            now = nx
        ans = max(ans, max_score)

        # K-1回目の最大値を探す
        now = start
        total_score = score*(K//move) - score
        max_score -= total_score
        for i in range(move):
            nx = Ps[now]-1
            total_score += Cs[nx]
            max_score = max(max_score, total_score)
            now = nx
        ans = max(ans, max_score)

    print(ans)


if __name__ == "__main__":
    solve()


Measured memory_bytes: 119520
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
using ld = long double;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define all(v) (v).begin(),(v).end()
#define siz(v) (ll)(v).size()
#define rep(i,a,n) for(ll i=a;i<(ll)(n);i++)
#define repr(i,a,n) for(ll i=n-1;(ll)a<=i;i--)
#define lb lower_bound
#define ub upper_bound
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
const ll mod = 1000000007;
const ll INF = 1000000099;
const ll LINF = (ll)(1e18 +99);
vector<ll> dx={-1,1,0,0},dy={0,0,-1,1};
template<typename T,typename U> void chmin(T& t, const U& u){if(t>u)t=u;}
template<typename T,typename U> void chmax(T& t, const U& u){if(t<u)t=u;}
template<typename T>T gcd(T a,T b){return b?gcd(b,a%b):a;}
template<typename T>T mpow(T a, T n) {
   T res = 1;
   for(;n;n>>=1) {
      if (n & 1) res = res * a;
      a = a * a;
   }
   return res;
}

//cin.tie(0);ios::sync_with_stdio(false);



signed main(){
    double a,b,x;cin>>a>>b>>x;
    if(x<a*a*b/2){
        cout<<fixed<<setprecision(10)<<atan2(a*b*b,(2*x))*180/M_PI<<endl;
    }else{
        cout<<fixed<<setprecision(10)<<atan2(2*(a*a*b-x),(a*a*a))*180/M_PI<<endl;
    }
}

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

using namespace std;

int main()
{
    array<array<array<int, 10>, 3>, 4> A{};

    size_t n, b, f, r;
    int v;
    cin >> n;
    for (size_t i = 0; i < n; ++i) {
        cin >> b >> f >> r >> v;
        A.at(b-1).at(f - 1).at(r - 1) += v;
    }
    auto i = 0;
    for (auto& b : A) {
        for (auto& f : b) {
            for (auto it = f.begin(); it != f.end(); ++it) {
                cout << ' ' << *it;
            }
            cout << endl;
        }
        if (i++ != 3)
            cout << "####################" << endl;
    }
    
    return 0;
}



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

typedef long long ll;

int main(){
    int N;
    string s;
    cin>>N>>s;
    vector<ll> r(N+1,0);
    vector<ll> g(N+1,0);
    vector<ll> b(N+1,0);

    for(int i=1; i<=N; i++){
        r[i] = r[i-1];
        g[i] = g[i-1];
        b[i] = b[i-1];
        if(s[i-1] == 'R') r[i]++;
        else if(s[i-1] == 'G') g[i]++;
        else b[i]++;
    }

    ll ans = 0;

    for(int i=0; i<N-2; i++){
        
        if(s[i] == 'R'){
            ans += (g[N] - g[i+1])*(b[N] - b[i+1]);
            for(int j=i+1; j<N-1; j++){
                int k = j*2-i;
                if(k >= N) continue;
                if(s[j] == 'G'){
                    if(s[k] == 'B') ans--;
                }
                else if(s[j] == 'B'){
                    if(s[k] == 'G') ans--;
                }
            }
        }

        else if(s[i] == 'G'){
            ans += (r[N] - r[i+1])*(b[N] - b[i+1]);
            for(int j=i+1; j<N-1; j++){
                int k = j*2-i;
                if(k >= N) continue;
                if(s[j] == 'R'){
                    if(s[k] == 'B') ans--;
                }
                else if(s[j] == 'B'){
                    if(s[k] == 'R') ans--;
                }
            }
        }

        else if(s[i] == 'B'){
            ans += (r[N] - r[i+1])*(g[N] - g[i+1]);
            for(int j=i+1; j<N-1; j++){
                int k = j*2-i;
                if(k >= N) continue;
                if(s[j] == 'R'){
                    if(s[k] == 'G') ans--;
                }
                else if(s[j] == 'G'){
                    if(s[k] == 'R') ans--;
                }
            }
        }
    }

    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 3660
#include<iostream>
#include<math.h>
#include<string.h>
using namespace std;

int seiyaku_check(double i,int Min,long Max){
	if(Min <= i && i <= Max){
		return 1;
	}else{
		exit(1);
		//return 0;
	}
}

int main(){
	
	int a=0;
	string s,t;
	cin >> s;
	cin >> t;
	
	if(s.length() != 3)exit(1);
	if(t.length() != 3)exit(1);
	
	for(int i=0;i<3;i++){
		if(s[i] != 'S' && s[i] != 'C'&& s[i] != 'R')exit(1);
		if(t[i] != 'S' && t[i] != 'C'&& t[i] != 'R')exit(1);
	}
	
	for(int i=0;i<3;i++){
		if(s[i] == t[i])a++;
	}
	cout << a << endl;
	
return 0;
}


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

#define debug(x) cerr << x << " = "(x) << endl;
#define ll long long
#define rep(i,x,y) for(int i=x;i<y;i++)
#define rel(i,x,y) for(int i=x-1;i>=y;i--)
#define all(x) x.begin(),x.end()

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    char a; cin >> a;
    if(a>='a' && a<='z') cout << 'a' << endl;
    else cout << 'A' << endl;
}

Measured memory_bytes: 3648
import bisect

s = input()
t = input()

#len_s = len(s)

#alpha2num = lambda c: ord(c) - ord('a')

results = {}
for i in range(len(s)):
    results.setdefault(s[i], []).append(i+1)

#print(results)

ans = 0
cnt = 0
num = 1

for i in range(len(t)):
    #キーがない場合は-1を出力
    if not t[i] in results.keys():
        print(-1)
        exit()
    else:
        idx = bisect.bisect_right(results[t[i]],cnt)
        #print(ans, len(results[t[i]]) , idx)
        if len(results[t[i]]) <= idx:
            cnt = results[t[i]][0]
            ans = len(s)*num + cnt
            num += 1
        else:
            #print(results[t[i]][idx],results[t[i]])
            ans += results[t[i]][idx] - cnt
            cnt = results[t[i]][idx]
            
print(ans)

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

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define EPS (1e-8)

typedef complex<double> P;
typedef P Vec;

struct Line {
	P p;
	Vec v;
	
	Line() {}
	Line(P p, Vec v) : p(p), v(v) {}
	
	P getPoint(double t) {
		return p + v * t;
	}
};

struct Circle {
	P p;
	double r;
	
	Circle() {}
	Circle(P p, double r) : p(p), r(r) {}
};

double dot(Vec a, Vec b) { return a.real() * b.real() + a.imag() * b.imag(); }
double cross(Vec a, Vec b) { return a.real() * b.imag() - a.imag() * b.real(); }

bool isInCir(Circle &c, P &p) { return norm(c.p - p) <= c.r*c.r + EPS; }

bool isInSeg(Line &s, P &p) {
	Vec a = s.v, b = p - s.p;
	double l1 = abs(a), l2 = abs(b);
	
	return dot(a, b) >= l1*l2 - EPS && dot(a, b) <= l1*l2 + EPS && l1 >= l2 - EPS;
}

bool isInTri(P &a, P &b, P &c, P &d) {
	P p[4];
	p[0] = a; p[1] = b; p[2] = c; p[3] = d;
	
	int cnt = 0;
	REP(i, 3) {
		Vec v = p[3] - p[i];
		Line s(p[i], p[(i + 1) % 3] - p[i]);
		
		if (isInSeg(s, p[3])) return true;
		if (cross(s.v, v) < -EPS) cnt++;
	}
	return (cnt == 0 || cnt == 3);
}

double distanceSP(Line &s, P &p) {
	Vec a = p - s.p, b = p - s.getPoint(1.0);
	
	if (dot(s.v, a) < -EPS) return abs(a);
	if (dot(s.v, a) > dot(s.v, s.v) + EPS) return abs(b);
	return abs(cross(s.v, a)) / abs(s.v);
}

int main() {
	double x1, y1, x2, y2, x3, y3, x4, y4, r;
	while (cin >> x1 >> y1, x1 || y1) {
		cin >> x2 >> y2 >> x3 >> y3 >> x4 >> y4 >> r;
		
		P p[4] = {P(x1, y1), P(x2, y2), P(x3, y3), P(x4, y4)};
		Line seg[3] = {Line(p[0], p[1] - p[0]), Line(p[1], p[2] - p[1]), Line(p[2], p[0] - p[2])};
		Circle c(p[3], r);		
		
		double m = min(distanceSP(seg[0], c.p), min(distanceSP(seg[1], c.p), distanceSP(seg[2], c.p)));
		
		if (isInCir(c, p[0]) && isInCir(c, p[1]) && isInCir(c, p[2]))
			puts("b");
		else if (isInTri(p[0], p[1], p[2], p[3])) {
			if (c.r <= m + EPS) puts("a");
			else puts("c");
		}
		else if (c.r < m - EPS) puts("d");
		else puts("c");
	}
	return 0;
}

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

int main(){
   int a,m;
   cin >> a >> m;
   vector<int> e(m);
  rep(i,m) cin >> e[i];
   int cnt = 0;
   rep(i,m){
       cnt+=e[i];
   }
   string ans;
   if(cnt>a) cout << -1 << endl;
   else cout << (a-cnt) << endl;
    return 0;
}

Measured memory_bytes: 3660
s=input()
t=input()
dp=[[0]*(len(t)+1) for i in range(len(s)+1)]
for i in range(1,len(s)+1):
    for j in range(1,len(t)+1):
        if s[i-1]==t[j-1]:
            dp[i][j]=1+dp[i-1][j-1]
        else:
            dp[i][j]=max(dp[i-1][j],dp[i][j-1])
ans=''
i=len(s)
j=len(t)
while(i>0 and j>0):
    # print(i,j,dp[i][j-1],dp[i-1][j],s[i],t[j])
    # print(ans)
    if s[i-1]==t[j-1]:
        ans=s[i-1]+ans
        i-=1 
        j-=1 
    else:
        if dp[i][j-1]>dp[i-1][j]:
            j-=1
            # print('here')
        else:
            i-=1 
print(ans)

Measured memory_bytes: 112220
#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;

const int N = 200200;
long long p2[N];
long long gcd(long long a, long long b)
{
	return b ? gcd(b, a % b) : a;
}

int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	p2[0] = 1; 
	for (int i=1; i<N; i++){
		p2[i] = (p2[i-1]*2)%mod;
	} 
	int n;
	cin>>n;
	
	map<pair<long long, long long>, pair<int, int>> m;
	long long zeros = mod-1;
	
	for (int i=0; i<n; i++){
		long long a, b;
		cin>>a>>b;
		if (a==0 && b==0) {
			zeros++;
			continue;
		}
		
		if (make_pair(a, b) < make_pair(0LL, 0LL)) {
			a=-a;
			b=-b;
		}
		long long g = gcd(abs(a), abs(b));
		a /= g;
		b /= g;
		if (b>0) m[{a,b}].first++;
		else m[{-b, a}].second++;
	}

	long long ans = 1;
	for (auto e: m){
		pair<int, int> cnt = e.second;
		ans = ans * (p2[cnt.first] + p2[cnt.second] - 1) % mod;
	}
	ans = (ans+zeros)%mod;
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 17620
import sys
import math
def input(): return sys.stdin.readline().rstrip()

def main():
    x = int(input())
    x_sqrt = int(math.sqrt(x))

    for i in range(10000):
        for j in range(2, x_sqrt):
            if x % j == 0:
                x += 1
                break
        else:
            print(x)
            exit()

if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
#include<stdio.h>
int main(){

  int x[2][30]={999},n,i,j,temp;
  int b,ans;

  while(1){
    
    
    scanf("%d",&n);
    if(n==0) break;
    
    b=0;ans=0;
    for(i=0;i<n;i++){
      x[0][i]=0;
      x[1][i]=0;
    }
    for(i=0;i<n;i++){
      scanf("%d %d",&x[0][i],&x[1][i]);
    }
    
    for(i=0;i<n-1;i++){
      for(j=n-1;j>i;j--){
	if (x[1][j-1]>x[1][j]) {  /* 前の要素の方が大きかったら */
	  temp=x[1][j];        /* 交換する */
	  x[1][j]=x[1][j-1];
	  x[1][j-1]=temp;
	  temp=x[0][j];        /* 交換する */
	  x[0][j]=x[0][j-1];
	  x[0][j-1]=temp;
	}
      }	
    }

    //通れるか確認
    for(i=0;i<n;i++){
      b+=x[0][i];
      if(b>x[1][i]){
	ans=1; break;
      }
      if(b>x[1][i+1] && i+1<n){
	ans=1; break;
      }
    }

    if(ans==0) printf("Yes\n");
    else printf("No\n");
    
  } //while

  return 0;
}

Measured memory_bytes: 584
import numpy as np
a, b = map(int, input().split())
if b - a >= 2019:
  print(0)
  
else:
  all_ = np.mod([i for i in range(a, b+1)], 2019)
  all_ = np.outer(all_, all_)
  n = all_.shape[0]
  all_ = np.mod(all_ * (np.ones((n,n)) - np.eye(n)) + np.eye(n) * 2018, 2019)
  print(int(all_.min()))


Measured memory_bytes: 139540
import java.util.*;

public class Main {
	public static void main(String[] args) throws Exception{
		Scanner br = new Scanner(System.in);
		int t=0;
		String[] str = br.nextLine().split(" ");
		int[] a=new int[str.length];
		for (int i=0;i<str.length;i++){
			a[i]=Integer.parseInt(str[i]);
		}
		for (int i=a[0];i<=a[1];i++){
			if((a[2]%i)==0){
				++t;
			}
		}
		System.out.println(t);
	}
}

Measured memory_bytes: 26212
#include <bits/stdc++.h>
#define REP(i,a,b) for(int i=(a);i<(b);i++)
#define RREP(i,a,b) for(int i=(a);i>=(b);i--)
typedef long long ll; typedef long double ld;
using namespace std;
const int INF=1e9, MOD=1e9+7;
const int MAX_N=10000;
ll n;
set<int> st;

int digit(ll n){
	REP(i,0,11){
		if(n<pow(10,i)) return i;
	}
}

int main(){
	cin >> n;
	
	int mi=INF;
	REP(i,1,ceil(sqrt(n))+1) if(n%i==0) mi=min(mi,max(digit(i),digit(n/i)));
	
	cout << mi << endl;
	return 0;
}


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

const int maxn = 100000;
typedef long long ll;

int n, m;
int color[maxn];
vector<int> g[maxn];

int dfs1(int u) {
  color[u] = -1;
  int sz = 1;
  for (int i = 0; i < (int)g[u].size(); ++i) {
    int v = g[u][i];
    if (!color[v]) {
      sz += dfs1(v);
    }
  }
  return sz;
}

bool dfs2(int u) {
  for (int i = 0; i < (int)g[u].size(); ++i) {
    int v = g[u][i];
    if (color[v] == -1) {
      color[v] = 3 - color[u];
      if (!dfs2(v)) {
        return false;
      }
    } else if (color[v] == color[u]) {
      return false;
    }
  }
  return true;
}

int main(void) {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < m; ++i) {
    int u, v;
    scanf("%d%d", &u, &v);
    --u; --v;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  ll ans = 0;
  ll bi = 0, nbi = 0, one = 0;
  for (int i = 0; i < n; ++i) {
    if (!color[i]) {
      int sz = dfs1(i);
      color[i] = 1;
      if (sz == 1) {
        ++one;
        ans += 1;
      } else if (dfs2(i)) {
        ++bi;
        ans += 2;
      } else {
        ++nbi;
        ans += 1;
      }
    }
  }
  ans = one * (n - one) * 2 + one * one + bi * bi * 2 + nbi * bi * 2 + nbi * nbi;
  printf("%lld\n", ans);
  return 0;
}


Measured memory_bytes: 9984
#include <bits/stdc++.h>
#define ADD(a, b) a = (a + ll(b)) % mod
#define MUL(a, b) a = (a * ll(b)) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define all(a) (a).begin(), (a).end()
#define sz(v) (int)(v).size()
#define pb push_back
#define sec second
#define fst first
#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<int, pi> ppi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> mat;
typedef complex<double> comp;
void Debug() {cout << '\n'; }
template<class FIRST, class... REST>void Debug(FIRST arg, REST... rest){
	cout<<arg<<" ";Debug(rest...);}
template<class T>ostream& operator<<(ostream& out,const vector<T>& v) {
	out<<"[";if(!v.empty()){rep(i,0,sz(v)-1)out<<v[i]<<", ";out<<v.back();}out<<"]";return out;}
template<class S, class T>ostream& operator<<(ostream& out,const pair<S, T>& v){
	out<<"("<<v.first<<", "<<v.second<<")";return out;}
const int MAX_N = 200010;
const int MAX_V = 100010;
const double eps = 1e-6;
const ll mod = 1000000007;
const int inf = 1 << 29;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;
///////////////////////////////////////////////////////////////////////////////////////////////////

int N, M, Q;
int dp[510][510];

void solve() {
	cin >> N >> M >> Q;
	rep(i, 0, M) {
		int a, b; cin >> a >> b; a--; b--;
		dp[a][b]++;
	}
	rep(k, 1, N) {
		rep(i, 0, N) {
			int j = i + k;
			if(j < N) {
				dp[i][j] += dp[i + 1][j] + dp[i][j - 1] - dp[i + 1][j - 1];
			}
		}
	}
	while(Q--) {
		int a, b; cin >> a >> b; a--; b--;
		cout << dp[a][b] << "\n";
	}
}

int main() {
#ifndef LOCAL
	ios::sync_with_stdio(false);
    cin.tie(0);
#endif
    cout << fixed;
	cout.precision(20);
	srand((unsigned int)time(NULL));
#ifdef LOCAL
	//freopen("in.txt", "wt", stdout); //for tester
    freopen("in.txt", "rt", stdin);
#endif	
	solve();
#ifdef LOCAL
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}



Measured memory_bytes: 1920
#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <bitset>
#include <complex>
#include <unistd.h>
#include <cassert>
#include <cctype>
#include <random>
#include <time.h>
#define _USE_MATH_DEFINES
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<double, double, double> tddd;
typedef complex<double> xy_t;
typedef vector<ll> vll;
typedef vector< vector<ll> > matrix;
#define REP(i, x, y) for(ll i = (ll)x; i < (ll)y; i++)
#define DREP(i, x, y, d) for(ll i = (ll)x; i < (ll)y; i += (ll)d)
#define PER(i, x, y) for(ll i = (ll)x; i > (ll)y; i--)
#define DPER(i, x, y, d) for(ll i = (ll)x; i > (ll)y; i -= (ll)d)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;
int iinf = intmax / 8;
ll inf = llmax / 8;
double eps = 1e-12;

ll N;

vector<ll> solve(ll mask, ll A, ll B) {
    ll tmp = A;
    vector<ll> ans;
    ll masknum = 0;
    REP(i, 0, N) {
        if (mask & (1 << i)) {
            masknum++;
        }
    }
    ll id = -1;
    REP(i, 0, N) {
        if ((A & (1 << i)) != (B & (1 << i))) {
            id = i;
            break;
        }
    }
    if (masknum == 1) {
        ans.push_back(tmp);
        return ans;
    }
    ll difnum[masknum - 1];
    ll ind = 0;
    REP(i, 0, N) {
        if (mask & (1 << i)) {
            if (i != id) {
                difnum[ind] = i;
                ind++;
            }
        }
    }
    REP(i, 0, (1 << (masknum - 1))) {
        ans.push_back(tmp);
        if (i != (1 << (masknum - 1)) - 1) {
            ll lastbit = 0;
            REP(j, 0, N) {
                if ((i + 1) & (1 << j)) {
                    lastbit = j;
                    break;
                }
            }
            tmp ^= (1 << difnum[lastbit]);
        }
    }
    vector<ll> suf = solve(mask ^ (1 << id), tmp ^ (1 << id), B);
    ans.insert(ans.end(), suf.begin(), suf.end());
    return ans;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll A, B;
    cin >> N >> A >> B;
    ll Anum = 0;
    REP(i, 0, N) {
        if (A & (1 << i)) {
            Anum++;
        }
    }
    ll Bnum = 0;
    REP(i, 0, N) {
        if (B & (1 << i)) {
            Bnum++;
        }
    }
    if ((Anum - Bnum) % 2 == 0) {
        cout << "NO" << endl;
        return 0;
    }
    cout << "YES" << endl;
    vector<ll> ans = solve((1 << N) - 1, A, B);
    ans.push_back(B);
    REP(i, 0, ans.size()) {
        cout << ans[i];
        if (i != (ll)ans.size() - 1) {
            cout << " ";
        }
    }
    cout << endl;
}


Measured memory_bytes: 2424
import java.util.*;
public class Main {
	public static void main(String[] args){
      	//データ取り込み
		Scanner sc = new Scanner(System.in);
		//int N = sc.nextInt();
    	//int M = sc.nextInt();
      	String S = sc.next();
      System.out.println(S.matches("A[a-z]+C[a-z]+") ? "AC" : "WA");
    }
}


Measured memory_bytes: 23764
N=int(input())
A=list(map(int,input().split()))[::-1]
flag=1
count=0
while flag:
    flag=0
    for i in range(N-1):
        if A[i]<A[i+1]:
            A[i],A[i+1]=A[i+1],A[i]
            flag=1
            count+=1

print(*A[::-1])
print(count)


Measured memory_bytes: 5612
<?php
fscanf(STDIN,'%s',$S);
$W=str_split(trim($S));
$P=[];
for ($i=0; $i <count($W) ; $i++) {
  // code...
  if($W[$i]=="A" or $W[$i]=="T" or $W[$i]=="G" or $W[$i]=="C"){
    $P[]=$i;
  }
}
$cnt=0;
$cntmax=0;
for ($i=0; $i <count($P) ; $i++) {
  // code...
  if ($P[$i]+1==$P[$i+1]) {
    // code...
    $cnt++;
  }else{
    $cnt=0;
  }
  if($cntmax<$cnt){
    $cntmax=$cnt;
  }
}
if(count($P)==0){
  echo 0;
}else{
  echo $cntmax+1;
}
echo "\n";
 ?>


Measured memory_bytes: 3828
#include<iostream>
#include<string>
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int main(){
  int n;
  cin >> n;
  vector<int> vc(n);
  for(int i = 0 ; i < n ; i++ ) cin >> vc[i];
  int ans = 0,q,a;
  cin >> q;
  sort(vc.begin(),vc.end());
  while(q--){
    cin >> a;
    if(binary_search(vc.begin(),vc.end(),a)) ans++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 3152
//
// binary 行列 (行列累乗と、掃き出し法)
//
// verified:
//   みんなのプロコン 2019 E - Odd Subrectangles
//     https://atcoder.jp/contests/yahoo-procon2019-qual/tasks/yahoo_procon2019_qual_e
// 


#include <iostream>
#include <vector>
#include <bitset>
using namespace std;


const int MAX_ROW = 510; // to be set appropriately
const int MAX_COL = 510; // to be set appropriately
struct BitMatrix {
    int H, W;
    bitset<MAX_COL> val[MAX_ROW];
    BitMatrix(int m = 1, int n = 1) : H(m), W(n) {}
    inline bitset<MAX_COL>& operator [] (int i) {return val[i];}
};

template<int MOD> ostream& operator << (ostream& s, BitMatrix A) {
    s << endl; 
    for (int i = 0; i < A.H; ++i) {
        for (int j = 0; j < A.W; ++j) {
            s << A[i][j] << ", ";
        }
        s << endl;
    }
    return s;
}

inline BitMatrix operator * (BitMatrix A, BitMatrix B) {
    BitMatrix R(A.H, B.W);
    BitMatrix tB(B.W, B.H);
    for (int i = 0; i < tB.H; ++i) for (int j = 0; j < tB.W; ++j) tB[i][j] = B[j][i];
    for (int i = 0; i < R.H; ++i) for (int j = 0; j < R.W; ++j) R[i][j] = (A[i] & tB[j]).any();
    return R;
}

inline BitMatrix pow(BitMatrix A, long long n) {
    BitMatrix R(A.H, A.H);
    for (int i = 0; i < A.H; ++i) R[i][i] = 1;
    while (n > 0) {
        if (n & 1) R = R * A;
        A = A * A;
        n >>= 1;
    }
    return R;
}

int GaussJordan(BitMatrix &A, bool is_extended = false) {
    int rank = 0;
    for (int col = 0; col < A.W; ++col) {
        int pivot = -1;
        for (int row = rank; row < A.H; ++row) {
            if (A[row][col]) {
                pivot = row;
                break;
            }
        }
        if (pivot == -1) continue;
        swap(A[pivot], A[rank]);
        for (int row = 0; row < A.H; ++row) {
            if (row != rank && A[row][col]) A[row] ^= A[rank];
        }
        ++rank;
    }
    return rank;
}

int linear_equation(BitMatrix A, vector<int> b, vector<int> &res) {
    int m = A.H, n = A.W;
    BitMatrix M(m, n + 1);
    for (int i = 0; i < m; ++i) {
        for (int j = 0; j < n; ++j) M[i][j] = A[i][j];
        M[i][n] = b[i];
    }
    int rank = GaussJordan(M, true);

    // check if it has no solution
    for (int row = rank; row < m; ++row) if (M[row][n]) return -1;

    // answer
    res.assign(n, 0);
    for (int i = 0; i < rank; ++i) res[i] = M[i][n];
    return rank;
};


const int MOD = 998244353;
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

int main() { 
    int N, M; cin >> N >> M;
    BitMatrix A(N, M);
    for (int i = 0; i < N; ++i) {
        for (int j = 0; j < M; ++j) {
            int a; cin >> a;
            if (a) A[i][j] = 1;
        }
    }
    vector<int> res;
    int r = GaussJordan(A);  
    cout << (modpow(2LL, N+M-1, MOD) - modpow(2LL, N+M-r-1, MOD) + MOD) % MOD << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  char x,y;
  cin>>x;
  if(x=='A') y='T';
  else if(x=='T') y='A';
  else if(x=='C' ) y='G';
  else y='C';
  cout<<y<<endl;
  return 0;
  
} 
  


Measured memory_bytes: 256
/* https://codeforces.com/contest/1360/problem/H */
#include<bits/stdc++.h>

using namespace std;
using ll = long long;
using vs = vector<string>;
using vi = vector<int>;
using vl = vector<ll>;
using vb = vector<bool>;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
using vpi = vector<pair<int, int>>;
using vpl = vector<pair<ll, ll>>;
using ld = double;

#define f first
#define s second 
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
#define pb push_back
#define	lb lower_bound
#define	ub upper_bound
#define	sz(x) (int)(x).size()
#define all(x) x.begin(), x.end()
#define ins insert

const int MAX = INT_MAX;

int main() {
	
	char c;
	cin>>c;
	if (c >= 65 && c <= 90) {
		cout<<'A'<<endl;
	}
	else {
		cout<<'a'<<endl;
	}

	return 0;
}


Measured memory_bytes: 3604
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using System.Globalization;
using System.Diagnostics;



class Solve
{
    public Solve() { }
    public static int Main()
    {
        new Solve().calc();
        return 0;
    }


    Scanner cin;

    void calc()
    {
        cin = new Scanner();
        int N = cin.nextInt();
        string[] blueCard = new string[N];
        for(int i=0; i<N; i++)
        {
            blueCard[i] = cin.next();
        }

        int M = cin.nextInt();
        string[] redCard = new string[M];
        for (int i = 0; i < M; i++)
        {
            redCard[i] = cin.next();
        }

        
        var dic = new Dictionary<string, int>();
        for(int i=0; i<N; i++)
        {
            if (dic.ContainsKey(blueCard[i]))
            {
                dic[blueCard[i]]++;
            }
            else
            {
                dic[blueCard[i]] = 1;
            }
        }
        for (int i = 0; i < M; i++)
        {
            if (dic.ContainsKey(redCard[i]))
            {
                dic[redCard[i]]--;
            }
            else
            {
                dic[redCard[i]] = -1;
            }
        }

        int max = 0;
        foreach(KeyValuePair<string,int> pair in dic)
        {
            if(pair.Value > max)
            {
                max = pair.Value;
            }
        }

        Console.WriteLine(max.ToString());
    }
}


class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}

Measured memory_bytes: 13152