akhauriyash/Code-Regression huggingface dataset:
#include <vector>
#include <math.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <queue>
#include <iomanip>
#include <deque>
#include <map>

typedef long long ll;
#define rep(i, a, n) for(int i = a; i<n; i++)
#define ALL(a) begin(a), end(a)
#define mii map<int, int>
#define msi map<string, int>
#define vi vector<int>
#define vl vector<ll>
#define MOD 1000000007
#define INF 1e9
#define showVector(v) rep(i,0,v.size()){p(v[i]);p(" ")} pl("")
#define p(s) std::cout << s ;
#define pl(s)  std::cout << s << endl;
using namespace std;

#define NIL -1
struct Node {
    int parent;
    int left;
    int right;
};

Node T[100001];
int D[100001];
int H[100001];
int getSibling(int u) {
    if (T[u].parent == NIL) return NIL;
    if (T[T[u].parent].left != u && T[T[u].parent].left != NIL) {
        return T[T[u].parent].left;
    }
    if (T[T[u].parent].right != u && T[T[u].parent].right != NIL) {
        return T[T[u].parent].right;
    }
    return NIL;
}
void print(int i) {
    cout << "node " << i << ": ";
    cout << "parent = " << T[i].parent;
    cout << ", sibling = " << getSibling(i);

    // 子の数
    int deg = 0;
    if (T[i].left != NIL) deg++;
    if (T[i].right != NIL) deg++;
    cout << ", degree = " << deg;

    //別配列で管理して求めていることがめちゃくちゃ覚えにくいというか、よくわからない。
    //とりあえずそれで丸暗記。

    // setDepthで別配列ですでに求めている
    cout << ", depth = " << D[i];

    // setHeightで別配列ですでに求めている
    cout << ", height = " << H[i];

    // rootの定義、leafの定義、internalの定義
    if (T[i].parent == NIL) {
        cout << ", root" << endl;
    } else if (T[i].left == NIL && T[i].right == NIL) {
        cout << ", leaf" << endl;
    } else {
        cout << ", internal node" << endl;
    }
}

void preParse(int u) {
    if (u == NIL) return;
    cout << " ";
    cout << u;
    preParse(T[u].left);
    preParse(T[u].right);
}

void inParse(int u) {
    if (u == NIL) return;
    inParse(T[u].left);
    cout << " ";
    cout << u;
    inParse(T[u].right);
}

void postParse(int u) {
    if (u == NIL) return;
    postParse(T[u].left);
    postParse(T[u].right);
    cout << " ";
    cout << u;
}

void setDepth(int u, int d) {
    if (u == NIL) return;
    D[u] = d;
    setDepth(T[u].left, d+1);
    setDepth(T[u].right, d+1);
}

int setHeight(int u) {
    int h1 = 0;
    int h2 = 0;
    if (T[u].left != NIL) {
        h1 = setHeight(T[u].left) + 1;
    }

    if (T[u].right != NIL) {
        h2 = setHeight(T[u].right) + 1;
    }
    return H[u] = max(h1, h2);
}


int n;
int main() {
    int v, l, r, root = 0;
    
    //節点の個数
    cin >> n;
    rep(i, 0, n) {
        T[i].parent = NIL;
    }
    rep(i, 0, n) {
        cin >> v >> l >> r;
        T[v].left = l;
        T[v].right = r;
        if (l != NIL) {
            T[l].parent = v;
        }
        if (r != NIL) {
            T[r].parent = v;
        }
    }
    rep(i, 0, n) {
        if (T[i].parent == NIL) {
            root = i;
        }
    }
    cout << "Preorder" << endl;
    preParse(root);
    cout << endl;
    cout << "Inorder" << endl;
    inParse(root);
    cout << endl;
    cout << "Postorder" << endl;
    postParse(root);
    cout << endl;

    return 0;
}


Measured memory_bytes: 3104
import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv, std.math,
    std.functional, std.numeric, std.range, std.stdio, std.string, std.random,
    std.typecons, std.container, std.format;

// dfmt off
T lread(T = long)(){return readln.chomp.to!T();}
T[] lreads(T = long)(long n){return generate(()=>readln.chomp.to!T()).take(n).array();}
T[] aryread(T = long)(){return readln.split.to!(T[])();}
void scan(TList...)(ref TList Args){auto line = readln.split();
foreach (i, T; TList){T val = line[i].to!(T);Args[i] = val;}}
alias sread = () => readln.chomp();enum MOD = 10 ^^ 9 + 7;
alias PQueue(T, alias less = "a<b") = BinaryHeap!(Array!T, less);
// dfmt on

void main()
{
    long N = lread();
    auto A = aryread();
    long ans = long.max;
    {
        auto B = A.dup;
        long sum = B[0];
        long cost;
        if (B[0] <= 0)
        {
            cost += 1 - B[0];
            B[0] += (1 - B[0]);
            sum = B[0];
        }
        foreach (i; 1 .. N)
        {
            if (0 < sum)
            {
                if (sum + B[i] < 0)
                {
                    sum += B[i];
                    continue;
                }
                long x = -1 - B[i] - sum;
                cost += abs(x);
                B[i] += x;
                sum += B[i];
            }
            else
            {
                if (0 < sum + B[i])
                {
                    sum += B[i];
                    continue;
                }
                long x = 1 - B[i] - sum;
                cost += abs(x);
                B[i] += x;
                sum += B[i];
            }
        }
        // writeln(cost);
        // writeln(B);
        ans = ans.min(cost);
    }
    {
        auto B = A.dup;
        long cost;
        long sum = B[0];
        if (0 <= B[0])
        {
            cost += B[0] + 1;
            B[0] -= (B[0] + 1);
            sum = B[0];
        }
        foreach (i; 1 .. N)
        {
            if (0 < sum)
            {
                if (sum + B[i] < 0)
                {
                    sum += B[i];
                    continue;
                }
                long x = -1 - B[i] - sum;
                cost += abs(x);
                B[i] += x;
                sum += B[i];
            }
            else
            {
                if (0 < sum + B[i])
                {
                    sum += B[i];
                    continue;
                }
                long x = 1 - B[i] - sum;
                cost += abs(x);
                B[i] += x;
                sum += B[i];
            }
        }
        // writeln(cost);
        // writeln(B);
        ans = ans.min(cost);
    }
    writeln(ans);
}


Measured memory_bytes: 7244
using System;
using System.IO;

class Solve {
    static void Main(string[] args) {
        var max = int.Parse(Console.ReadLine()) + 1;
        var dp = new int[max];
        for (int i = 0; i < max; i++) {
            dp[i] = max;
        }
        dp[0] = 0;
        for (int i = 0; i < max; i++) {
            for (int m_nine = 1; i + m_nine < max; m_nine *= 9) {
                dp[i + m_nine] = Math.Min(dp[i + m_nine], dp[i] + 1);
            }

            for (int m_six = 1; i + m_six < max; m_six *= 6) {
                dp[i + m_six] = Math.Min(dp[i + m_six], dp[i] + 1);
            }
        }
        var answer = dp[^1];
        var writer = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
        Console.SetOut(writer);
        Console.WriteLine(answer);
        Console.Out.Flush();
    }
}

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

int main()
{
	std::string s;
	std::cin >> s;
	int counter = 0;
	if (s[0] == '1') ++counter;
	if (s[1] == '1') ++counter;
	if (s[2] == '1') ++counter;

	std::cout << counter << std::endl;
}

Measured memory_bytes: 760
#include <bits/stdc++.h>
#define INF LLONG_MAX
#define Int long long
#define rep(i,n) for(int i=0; i<n; ++i)
using namespace std;
template<class T> inline bool chmin(T& a, T b) { if(a>b) {a=b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) { if(a<b) {a=b; return true;} return false;}
char a[26];
int main() {
  string s; cin >> s;
  for(char c:s) {
    a[c-'a']++;
  }
  rep(i,26) {
    if(a[i] == 0) {
      printf("%c\n", 'a'+i);
      return 0;
    }
  }
  cout << "None" << endl;
}


Measured memory_bytes: 512
import re  # 正規表現, findall('正規表現', 文字列), search('正規表現', 文字列)
import sys # プログラム終了：sys.exit()
# sys.setrecursionlimit(10**6) # 再帰呼び出しの上限を上げる

def i_input(): return int(input())
def s_input(): return map(int,input().split())
def l_input(): return list(map(int, input().split()))
# 文字列のまま受け取りたいときはinput()

def check(x, a, b, c):
    diff = x - 500 * a - 100 * b
    if diff >= 0 and diff % 50 == 0 and diff // 50 <= c:
        return True
    else:
        return False

def main():
    a = i_input() # 500
    b = i_input() # 100
    c = i_input() # 50
    x = i_input() # sum

    count = 0
    for i in range(a + 1):
        for j in range(b + 1):
            if check(x, i, j, c):
                count += 1

    print(count)

if __name__ == "__main__":
    main()


Measured memory_bytes: 3188
import sys
import math
from collections import defaultdict
from bisect import bisect_left, bisect_right

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def LI(): return list(map(int, input().split()))
def LIR(row,col):
    if row <= 0:
        return [[] for _ in range(col)]
    elif col == 1:
        return [I() for _ in range(row)]
    else:
        read_all = [LI() for _ in range(row)]
        return map(list, zip(*read_all))

#################

A,B = LI()

print(A*B)

Measured memory_bytes: 65492
import sys
sys.setrecursionlimit(10 ** 5 + 10)


def input(): return sys.stdin.readline().strip()


def resolve():
    """
    https://qiita.com/drken/items/4a7869c5e304883f539b#3-3-dfs-%E3%81%AE%E5%86%8D%E5%B8%B0%E9%96%A2%E6%95%B0%E3%82%92%E7%94%A8%E3%81%84%E3%81%9F%E5%AE%9F%E8%A3%85
    cf. https://atcoder.jp/contests/abc138/submissions/13273052
    """

    from collections import deque

    N = int(input())
    M = N-1  # 頂点数，辺数
    # グラフ入力受取 (ここでは無向グラフを想定)
    G = [[] for _ in range(N)]
    for i in range(M):
        a, b = map(int, input().split())
        a -= 1
        b -= 1
        G[a].append((b, i))
        G[b].append((a, i))

    seen = [False]*N
    res = [0]*M

    def dfs(G, v):
        col = 1
        parent_col = -1
        if col == parent_col:
            col += 1
        seen[v] = True
        stack = deque([(v, -1)])
        while stack:
            v, parent_col = stack.pop()
            col = 1
            for next_v, edge_ind in G[v]:
                if seen[next_v]:
                    continue
                if col == parent_col:
                    col += 1
                res[edge_ind] = col
                seen[next_v] = True
                stack.append((next_v, col))
                col += 1

    # 頂点 0 をスタートとした探索
    dfs(G, 0)
    print(max(res))
    for i in res:
        print(i)


resolve()

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

using namespace std;

typedef long long ll;
typedef long double ld;
#define F first 
#define S second

int main(){
	int n, m;
	cin >> n >> m;
	cout << (n * (n - 1)) / 2 + (m * (m - 1)) / 2; 
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(ll i=0; i<(n); ++i)
#define rep1(i,n) for(ll i=1; i<=(n); ++i)
#define repi(i,a,b) for(ll i=a; i<=(b); ++i)
#define rrep(i,n) for(ll i=(n-1); i>=0; --i)
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define pb push_back
#define mp make_pair
#define to_s to_string
#define sz(v) (int)v.size()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )
#define print(x) cout<<(x)<<'\n'
#define debug(x) cout << #x << ": " << (x) << '\n'
using namespace std;
using ll = long long;
using Edge = pair<ll,ll>;
using Graph = vector<vector<Edge>>;
typedef pair<ll,ll> P;
struct aaa{aaa(){ cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);};}aaaaaaa;
ll MOD = 1e9 + 7;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return (a*b)/gcd(a,b);}
ll devc(ll x, ll y){return 1 + (x-1)/y;}
ll modpow(ll x, ll y, ll m) {
    if (y == 0) return 1;
    ll res = modpow(x, y / 2, m);
    return res * res % m * (y & 1 ? x : 1) % m;
}
ll modinv(ll x) { return modpow(x, MOD - 2, MOD); }

const int MAX = 5100000;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main(){
    ll N, K; cin >> N >> K;
    COMinit();
    
    if(K >= N-1) print(COM(2*N-1,N));
    else{
        ll ans = 0;
        for(ll i = 0; i <= K; ++i){
            ans += COM(N-1,i)*COM(N,i);
            ans %= MOD;
        }
        print(ans);
    }
    
    return 0;
}

Measured memory_bytes: 119808
#include <iostream>
#include <vector>
#include <algorithm>
#include <string.h>
#include <iomanip>
using namespace std;
int main()
{
    int a, b;
    cin >> a >> b;
    int wa, sa, seki;
    wa = a + b;
    sa = a - b;
    seki = a * b;
    cout << max(wa, max(sa, seki)) << endl;
    return 0;
}

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

typedef long long ll;

#define int ll
#define all(v) v.begin(), v.end()
#define reps(__i, a, b) for (int __i = a; i < b; i++)
#define rep(__i, n) reps(__i, 0, n)

const ll INF = (1ll << 60);
const ll MOD = (ll)1e9 + 7;

signed main()
{
    int a, b;
    cin >> a >> b;
    if (a < 0 && b < 0)
    {
        ((b - a + 1) % 2) ? cout << "Negative" << endl : cout << "Positive" << endl;
    }
    else if (a <= 0 && b >= 0)
    {
        cout << "Zero" << endl;
    }
    else
    {
        cout << "Positive" << endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fi first
#define se second
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define rrep(i, n) for (int (i) = 1; (i) <= (n); (i++))
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define pb push_back
#define eb emplace_back
#define yn {puts("Yes");}else {puts("No");}
#define printd(x) printf("%.12f\n", ans);
template<class T> bool chmin(T& a, const T& b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> bool chmax(T& a, const T& b) {if (a < b) {a = b; return 1;} return 0;}
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main(void) {
	int n;
	cin >> n;
	string a, b, c;
	cin >> a >> b >> c;

	map<char, int> mp[n];
	int ans = 0;
	rep (i, n) {
		mp[i][a[i]]++;
		mp[i][b[i]]++;
		mp[i][c[i]]++;
		if (mp[i][a[i]] == 3) {
			continue;
		}
		if (mp[i][a[i]] == 1 && mp[i][b[i]] == 1 && mp[i][c[i]] == 1) {
			ans += 2;
			continue;
		}
		ans += 1;
	}

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

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fi first
#define se second
#define IOS ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define endl '\n'
#define ld long double
#define mid (l+r)/2
typedef pair<int,int> pii;
typedef pair<double,double> pdd;
const int maxn=100005;
struct edge
{
    int u,v,w;
};
vector<edge>ans;
void addedge(int x,int y,int w,int c)
{
    x=c-x+1,y=c-y+1;
    ans.push_back({x,y,w});
}
int getup(int x)
{
    int now=1;
    int c=0;
    while(x>=now)
    {
        c++;
        now*=2;
    }
    return c;
}
int main()
{
    #ifdef local
    freopen("in.txt","r",stdin);
    #endif
    int n;
    cin>>n;
    --n;
    int now=1;
    int c=0;
    while(now*2-1<=n)
    {
        now*=2;
        c++;
    }
    int tp=now;
    now=1;
    for(int i=0;i<=c-1;i++)
    {
        addedge(i+1,i,0,c);
        addedge(i+1,i,now,c);
        now*=2;
    }
    n-=tp;
    if(n!=-1)
    {
        if(n==0) addedge(c,0,tp,c);
        while(n)
        {
            int cn=getup(n);
            addedge(c,cn-1,tp,c);
            int ad=(1<<(cn-1));
            n-=ad;
            tp+=ad;
            if(n==0) addedge(c,0,tp,c);
        }
    }
    assert(ans.size()<=60);
    cout<<c+1<<' '<<ans.size()<<endl;
    for(auto it:ans) cout<<it.u<<' '<<it.v<<' '<<it.w<<endl;
}


Measured memory_bytes: 256
from collections import deque

s = deque(input())
q = int(input())

rev = False
for _ in range(q):
    query = list(input().split())
    t = query[0]
    if t == "1":
        rev = not rev
    else:
        f = int(query[1])
        c = query[2]
        if rev:
            f = 3 - f
        if f == 1:
            s.appendleft(c)
        else:
            s.append(c)
if rev:
    s.reverse()
print(''.join(s))

Measured memory_bytes: 8692
N,M=map(int,input().split())
S=[list(input()) for i in range(N)]
V=N*M+2
INF=10**16
G=[[] for i in range(V)]
D=[INF]*V
PV,PE=[0]*V,[0]*V
def ae(fr,to,ca,co):
  global G
  G[fr].append([to,ca,co,len(G[to])])
  G[to].append([fr,0,-co,len(G[fr])-1])

def mcf(s,t,f):
  global G,V,INF,D,PV,PE
  r=0
  z=f
  while z>0:
    D=[INF]*V
    D[s]=0
    ud=True
    while ud:
      ud=False
      for x in range(V):
        if D[x]==INF:
          continue
        for i in range(len(G[x])):
          if G[x][i][1]>0 and D[G[x][i][0]]>D[x]+G[x][i][2]:
            D[G[x][i][0]]=D[x]+G[x][i][2]
            PV[G[x][i][0]]=x
            PE[G[x][i][0]]=i
            ud=True
    if D[t]==INF:
      return -(10**30)
    d=z
    x=t
    while x!=s:
      d=min(d,G[PV[x]][PE[x]][1])
      x=PV[x]
    z-=d
    r+=d*D[t]
    x=t
    while x!=s:
      G[PV[x]][PE[x]][1]-=d
      G[x][G[PV[x]][PE[x]][3]][1]+=d
      x=PV[x]
  return r

X=0
C=0
for i in range(N):
  for j in range(M):
    if S[i][j]=='#':
      continue
    ae(i*M+j,V-1,1,N+M-i-j)
    if S[i][j]=='o':
      C+=1
      X+=(N+M-i-j)
      ae(V-2,i*M+j,1,0)
    if i<N-1:
      if S[i+1][j]!='#':
        ae(i*M+j,i*M+M+j,INF,0)
    if j<M-1:
      if S[i][j+1]!='#':
        ae(i*M+j,i*M+1+j,INF,0)
print(X-mcf(V-2,V-1,C))

Measured memory_bytes: 77716
n,m=map(int, input().split())
s=[list(map(int, input().split())) for i in range(m)]
x=max(a for a,b in s)
dp=[0]*(n+x)
for i in range(0,n+x):
  if i>0:
    dp[i]=min(dp[i-a]+b for a,b in s)
print(min(dp[n:]))


Measured memory_bytes: 3644
def main():
    h, w = map(int, input().split())
    board = []

    cddt = []
    omission_line = 0
    for i in range(h):
        line = input()
        if line == "." * w:
            omission_line += 1
        else:
            cells = list(line)
            for n, c in enumerate(cells):
                if c == ".":
                    cddt.append(n)
            board.append(cells)

    for line in board:
        for i, c in enumerate(line):
            if (cddt.count(i) + omission_line) != h:
                print(c, end="")
        print("")


if __name__ == '__main__':
    main()


Measured memory_bytes: 4596
// 見せてやるぜ、奇跡ってやつをよぉ……
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
#include <functional>
#include <cassert>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
#define ALL(v) v.begin(),v.end()
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; }
#define DEBUG_VLL(vec) REP(sz, vec.size()) cerr<<vec[sz]<<(sz==vec.size()-1?'\n':' ');

const ll MOD = 1000000007;
const ll HIGHINF = (ll)1e18;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s; cin >> s;
    
    vll numk(s.size() + 2, 0); numk[s.size() + 1]++;
    vvll chidx(26);  // 各文字の index
    REP(i, 26) chidx[i].push_back(0);
    REP(i, s.size()) chidx[s[i] - 'a'].push_back(i + 1);
    REP(i, 26) chidx[i].push_back(s.size() + 1);

    set<char> chs;
    for (ll i = s.size() - 1; i >= 0; i--) {
        chs.insert(s[i]);
        if (chs.size() == 26) {
            numk[i + 1]++;
            chs.clear();
        }
    }
    REP(i, s.size() + 1) numk[i + 1] += numk[i];

    string t = "";
    ll now = 0;
    REP(i, numk[s.size() + 1]) {
        REP(j, 26) {
            ll idx = upper_bound(ALL(chidx[j]), now) - chidx[j].begin();
            if (numk[chidx[j][idx]] == numk[now] + 1) {
                t.push_back('a' + j);
                now = chidx[j][idx];
                break;
            }
        }
    }
    cout << t << '\n';
    return 0;
}


Measured memory_bytes: 3988
#include <iostream>
#include <vector>
using namespace std;
int main()
{
  int N;
  cin >> N;
  vector<int> h(N);
  for (int i = 0; i < N; i++)
    cin >> h[i];
  vector<int> dp(N + 10);
  for (int i = 0; i < N + 10; i++)
    dp[i] = INT32_MAX;
  dp[0] = 0;
  for (int i = 0; i < N; i++)
  {
    dp[i + 1] = min(dp[i + 1], dp[i] + abs(h[i] - h[i + 1]));
    dp[i + 2] = min(dp[i + 2], dp[i] + abs(h[i] - h[i + 2]));
  }
  cout << dp[N - 1] << endl;
  return 0;
}

Measured memory_bytes: 1024
#include<iostream>
using namespace std;
int main()
{
    string s;
    cin>>s;
    int cnt=0;
    for(int i=0;i<3;i++)
    {
         if(s[i]=='R'&& s[i+1]=='S'&& s[i+2]=='R')
        {
            cnt++;
            break;
        }
        else if(s[i]=='R')
        {
            cnt++;
        }
    }
    cout<<cnt<<endl;
    return 0;
}


Measured memory_bytes: 3584
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    ios_base:: sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    ll x,y;cin>>x>>y;

    for(ll i=0;i<=100;i++){
        for(ll j=0;j<=100;j++){
            if(i+j!=x)continue;
            if(i*2 + j*4==y)return cout<<"Yes" , 0;
        }
    }

    cout<<"No";
}



Measured memory_bytes: 3624
#define lp(i,n) for(int i=0;i<n;i++)
#define pau system("pause")
#include<bits/stdc++.h>

using namespace std;
int main(){
    char s[3],t[3];
    int c;
    lp(i,3)
        cin>>s[i];
    lp(i,3)
        cin>>t[i];
    lp(i,3){
        if(s[i]==t[i])
            c++;
    }
    cout<<c<<endl;
}


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

using namespace std;

#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define endl			"\n"

int32_t main(){
	
	unsigned long long  n, s = 0;
	cin>>n;

	for(int i = 1; i <= n; i++)
		if(i%3 && i%5)
			s += i;

	cout<<s;

	return 0;
}

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

#define F first
#define S second
#define prev azaza
#define MP make_pair
#define PB push_back

using namespace std;
typedef long long ll;
typedef long double ld;

const int max_n = 15, inf = 1000111222;

vector<int> v[max_n];

int main()
{
    //freopen("input.txt", "r", stdin);
    int n, d;
    cin >> n >> d;
    for (int i = 0; i < n; ++i){
        for (int j = 0; j < d; ++j) {
            int a;
            cin >> a;
            v[i].PB(a);
        }
    }
    int ans = 0;
    for (int i = 0; i < n; ++i) {
        for (int j = i + 1; j < n; ++j) {
            ll dst = 0;
            for (int k = 0; k < d; ++k) {
                dst += (v[i][k] - v[j][k]) * (v[i][k] - v[j][k]);
            }
            ll res = sqrtl(dst);
            if (res * res == dst) {
                ++ans;
            }
        }
    }
    cout << ans << endl;
    return 0;
}




Measured memory_bytes: 256
#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))
    puts("Yes");
  else
    puts("No");
}

Measured memory_bytes: 256
#!/usr/bin/env python
# -*- coding: utf-8 -*-


import sys


class Node(object):
    __slots__ = ('parent', 'depth', 'type', 'children')

    def __init__(self):
        self.parent = -1
        self.type = ''
        self.depth = 0
        self.children = []


def dfs(node_idx, node_list, depth=0):
    node_list[node_idx].depth = depth
    for child in node_list[node_idx].children:
        dfs(child, node_list, depth=depth + 1)
    return None


def print_result(_node):
    print('parent = ' + str(_node.parent) + ',', end=' ')
    print('depth = ' + str(_node.depth) + ',', end=' ')
    print(_node.type + ',', end=' ')
    print(_node.children)
    return None


def generate_tree(_array, node_list):
    for each in _array:
        idx, k, *children = [int(x) for x in each]
        node_list[idx].children = children
        if k:
            node_list[idx].type = 'internal node'
        else:
            node_list[idx].type = 'leaf'
        for child_idx in children:
            node_list[child_idx].parent = idx
    root_idx = [i for i, x in enumerate(node_list) if x.parent == -1][0]
    node_list[root_idx].type = 'root'
    dfs(node_idx=root_idx, node_list=node_list)
    return node_list


if __name__ == '__main__':
    _input = sys.stdin.readlines()
    array_length = int(_input[0])
    array = list(map(lambda x: x.split(), _input[1:]))
    # assert len(array) == array_length

    init_node_list = [Node() for _ in range(array_length)]
    ans = generate_tree(_array=array, node_list=init_node_list)
    for key, node in enumerate(ans):
        print('node ' + str(key) + ':', end=' ')
        print_result(_node=node)

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

vector<int> A(5);
int main(void){
    // Your code here!
    for(int i = 0; i < 5; i++){
        cin >> A[i];
    }
    
    int min = 1<<21;
    do{
        int t = 0;
        for(int i = 0; i < 5; i++){
            t += A[i];
            if(i < 4 && A[i] % 10 != 0){
                t += (10-A[i] % 10);
            }
        }
        if(t < min){
            min = t;
        }
    } while(next_permutation(A.begin(), A.end()));
    
    cout << min << endl;
}


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

int main() {
    string s;
    cin >> s;
    long long n=s.size()+1;
    long long a[n],b[n];
    for(int i=0;i<n;i++){
        a[i]=0;
    }
    a[0]=0;
    a[n-1]=0;
    for(int i=0;i<s.size();i++){
        if(s[i]=='<') a[i+1]=max(a[i]+1,a[i+1]);
    }
    for(int i=s.size()-1;i>=0;i--){
        if(s[i]=='>') a[i]=max(a[i+1]+1,a[i]);
    }
    long long ans=0;
    for(int i=0;i<n;i++){
        ans+=a[i];
    }
    cout << ans << endl;
}

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


int main(){
    int n;
    scanf("%d", &n);
    int a[n];
    int x = 0;
    for(int i = 0;  i < n; i++){
        scanf("%d", &a[i]);
        x ^= a[i];
    }
    for(int i = 0;  i < n; i++){
        int b = x^a[i];
        cout << b << " ";
    }
}


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

void main() {
    immutable long INF = 1L << 59;
    auto N = readln.chomp.to!int;
    auto A = readln.split.map!(to!long).array;
    

    Tuple!(long, int[]) solve(long[] X) {
        int n = X.length.to!int;
        int[] ans;
        long val;

        if (X.map!(x => x <= 0).all) {
            long maxv = -INF;
            int maxi = -1;
            for (int i = 0; i < X.length.to!int; i += 2) {
                if (X[i] > maxv) maxv = X[i], maxi = i;
            }
            foreach_reverse (i; maxi+1..X.length.to!int) ans ~= i+1;
            foreach (i; 0..maxi) ans ~= 1;
            return tuple(maxv, ans);
        }
        
        for (int i = n - 1; i > 0; i -= 2) {
            if (X[i] > 0) break;
            ans ~= [i+1, i];
            X.popBack;
            X.popBack;
            n -= 2;
        }

        for (int i = 0; i < n - 1; ) {
            if (X[i] > 0) break;
            ans ~= [1, 1];
            X.popFront;
            X.popFront;
            n -= 2;
        }

        while (X.length > 1) {
            if (X[2] > 0) {
                X[0] += X[2];
                X = X.remove(1);
                X = X.remove(1);
                ans ~= 2;
            } else {
                X = X.remove(1);
                X = X.remove(1);
                ans ~= 3;
             }
        }

        return tuple(X[0], ans);
    }


    auto B = A.dup;
    auto C = A.dup;
    int[] ansB, ansC;

    if (N % 2 == 0) {
        B.popBack;
        C.popFront;
        ansB ~= N;
        ansC ~= 1;
    } else {
        C.popFront;
        C.popBack;
        ansC ~= N;
        ansC ~= 1;
    }

    auto retB = solve(B);
    auto retC = solve(C);
    auto ans = retB >= retC ? retB : retC;
    if (retB >= retC) ans[1] = ansB ~ ans[1];
    else  ans[1] = ansC ~ ans[1];

    ans[0].writeln;
    ans[1].length.writeln;
    ans[1].each!writeln;
}


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

using namespace std;

int solve(int n) {
    vector<string> words(n);
    for (int i = 0; i < n; i++) {
        cin >> words[i];
    }
    int a;
    int count = 0;
    while (1) {
        int first  = 0;
        int second = 0;
        int serd   = 0;
        int forth  = 0;
        int fifth  = 0;
        for (a = count; first < 5; a++) {
            first += words[a].size();
        }
        if (first != 5) {
            count++;
            continue;
        }
        for (; second < 7; a++) {
            second += words[a].size();
        }
        if (second != 7) {
            count++;
            continue;
        }
        for (; serd < 5; a++) {
            serd += words[a].size();
        }
        if (serd != 5) {
            count++;
            continue;
        }
        for (; forth < 7; a++) {
            forth += words[a].size();
        }
        if (forth != 7) {
            count++;
            continue;
        }
        for (; fifth < 7; a++) {
            fifth += words[a].size();
        }
        if (fifth != 7) {
            count++;
            continue;
        }
        return ++count;
    }
}

int main() {
    int n;
    vector<int> ans;
    while (1) {
        cin >> n;
        if (!n) break;
        ans.push_back(solve(n));
    }
    for (int i : ans) cout << i << endl;
}


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

int main(){
  int N,K;
  cin >> N >> K;
  
  int ans = 0;
  for(int i = 0; i < N;i++){
    int h;
    cin >> h;
    if(h >= K) ans++;
  }
  cout << ans;
  return 0;
}

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

int main(int argc, const char * argv[]) {
    int happycounter = 0;
    int target;
    cin >> target;
    
    
    while (target >= 500) {
        happycounter += 1000;
        target -= 500;
    }
    while (target >= 5) {
        happycounter += 5;
        target -= 5;
    }
    cout << happycounter <<endl;
    return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<cstdlib>
#include<tuple>
#include<iomanip>
#include<stack>
#include<map>
#include<queue>
#include<set>
#define int long long
using namespace std;
const int INF = 1e10;
const int ZERO = 0;

signed main() {
	string S;
	cin >> S;
	if(S == "Sunny") {
		cout << "Cloudy" << endl;
	}
	else if(S == "Cloudy") {
		cout << "Rainy" << endl;
	}
	else {
		cout << "Sunny" << endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n, d;
    cin >> n >> d;
    int data[100][100];
    for(int i=0; i<n; i++){
        for(int j=0; j<d; j++){
            cin >> data[i][j];
        }
    }
    int ans = 0;
    for(int i=0; i<n; i++){
        for(int j=i+1; j<n; j++){
            double dis=0;
            for(int k=0; k<d; k++){
                dis += ((data[i][k]-data[j][k])*(data[i][k]-data[j][k]));
            }
            dis = sqrt(dis);
            if(dis==int(dis)){
                ans++;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#define endl "\n"

using namespace std;
using ll = long long;
using ld = long double;
using bnum = int64_t;
double n,x;
int n1,x1,t;
int main() {
    cin >> n >> x >> t;
    if(floor(n/x) < n/x){
        n1 = floor(n/x);
        cout << (n1 + 1) * t << endl;
    }else {
        n1 = floor(n/x);
        cout << n1 * t << endl;
    }
}


Measured memory_bytes: 3720
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc *bufio.Scanner

func init() {
	// 100MB
	bufsize := 100 * 1024 * 1024
	sc = bufio.NewScanner(os.Stdin)
	sc.Buffer(make([]byte, bufio.MaxScanTokenSize), bufsize)
	sc.Split(bufio.ScanWords)
}
func readInt() int              { return readIntArray(1)[0] }
func readInt2() (int, int)      { a := readIntArray(2); return a[0], a[1] }
func readInt3() (int, int, int) { a := readIntArray(3); return a[0], a[1], a[2] }
func readIntArray(n int) []int {
	s := readStringArray(n)
	a := make([]int, n)
	for i := range a {
		a[i], _ = strconv.Atoi(s[i])
	}
	return a
}
func readString() string            { return readStringArray(1)[0] }
func readString2() (string, string) { a := readStringArray(2); return a[0], a[1] }
func readStringArray(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		sc.Scan()
		a[i] = sc.Text()
	}
	return a
}
func max(ns ...int) int {
	max := ns[0]
	for _, n := range ns {
		if n > max {
			max = n
		}
	}
	return max
}
func min(ns ...int) int {
	min := ns[0]
	for _, n := range ns {
		if n < min {
			min = n
		}
	}
	return min
}
func abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

func main() {
	a := []int{1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51}
	K := readInt()
	fmt.Println(a[K-1])
}


Measured memory_bytes: 640
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC053B___A_to_Z_String
{
    class Program
    {
        static void Main(string[] args)
        {
            List<char> s = Console.ReadLine().ToCharArray().ToList();

            int indexA = s.FindIndex(n => n.ToString() == "A");
            int indexZ = s.FindLastIndex(n => n.ToString() == "Z");

            Console.WriteLine(indexZ - indexA + 1);

        }
    }
}


Measured memory_bytes: 16608
K=int(input())
import math

sum_1 = 0
for a in range(3,K+1):
    for b in range(2, a):
        for c in range(1, b):
            sum_1 += math.gcd(math.gcd(a, b), c)

sum_1 = sum_1 * 6

sum_2 = 0
for a_b in range(2, K+1):
    for c in range(1, a_b):
        sum_2 += math.gcd(a_b, c)

sum_2 = sum_2 * 6

sum_3 = 0
for i in range(1, K+1):
    sum_3 += i


print(sum_1 + sum_2 + sum_3)

Measured memory_bytes: 9212
#include <iostream>
#include <algorithm>
using namespace std;
static const int MAX = 200000;

int main(void) {
	int R[MAX], n;
	
	cin >> n;
	for(int i=0;i<n;i++) cin >> R[i];
	
	int maxv = -2000000000;
	int minv = R[0];
	
	for(int i=1; i<n; i++) {
		maxv = max(maxv, R[i] - minv);
		minv = min(minv, R[i]);
	}
	
	cout << maxv << endl;
	
	return 0;
}

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

const int N = (int)1e5;

vector<int> dat[N+5];
priority_queue<int> pq;

int main() {
    int n,m; scanf("%d %d", &n, &m);
    for (int i=1; i<=n; i++) {
        int a,b; scanf("%d %d", &a, &b);
        dat[a].push_back(b);
    }

    while (!pq.empty()) {
        pq.pop();
    }

    int res = 0;
    for (int i=0; i<=m; i++) {
        for (int x: dat[i]) {
            pq.push(x);
        }

        if (!pq.empty()) {
            res += pq.top();
            pq.pop();
        }
    }

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


Measured memory_bytes: 5632
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);
		while (true) {
			int x = scanner.nextInt();
			int h = scanner.nextInt();
			if (x == 0 && h == 0) {
				break;
			}
			System.out.println(x * Math.sqrt(4 * h * h + x * x) + x * x);
		}
	}
}

Measured memory_bytes: 17252
#include <bits/stdc++.h>
#define ll long long
#define dbg(x) cout<<#x<<"="<<x
#define nl cout<<"\n"
#define frn(i,n) for(int i = 0;i < n;i++)
#define fr(i,a,b) for(int i = a;i < b;i++)
#define pb push_back
using namespace std;

int toint(string s) {
  int ans = 0;
  for(char x: s) ans = ans*10 + (x - '0');
  return ans;
}

int main() {
  string a,b;
  cin>>a>>b;
  int x = toint(a+b);
  int s = sqrt(x);
  if(s*s == x) cout<<"Yes";
  else cout<<"No";
}

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

using namespace std;

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

    for(int i = a; i <= b; i++) {
        if(i % k == 0) {
            cout << "OK";
            return 0;
        }
    }

    cout << "NG";
}

Measured memory_bytes: 3548
#include <iostream>
#include <vector>
#include <deque>
#include <algorithm>
#include <numeric>
#include <string>
#include <cstring>
#include <list>
#include <unordered_set>
#include <tuple>
#include <cmath>
#include <limits>
#include <type_traits>
#include <iomanip>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <set>
#include <bitset>
#include <regex>
#include <random>
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
#define rep(i,n)for(ll i=0;i<n;++i)
#define exout(x) printf("%.12f\n", x)
const double pi = acos(-1.0);
const ll MOD = 1000000007;
const ll INF = 1e18;
const ll MAX_N = 1010101;

//組み合わせの余りを求める
ll fac[MAX_N], finv[MAX_N], inv[MAX_N];
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX_N; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(ll n, ll k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

//最大公約数
ll gcd(ll x, ll y) {
	return y ? gcd(y, x % y) : x;
}

ll lcm(ll x, ll y) {
	if (x == 0 || y == 0)return 0;
	return (x / gcd(x, y) * y);
}

ll dx[8] = { 1,-1,0,0,1,1,-1,-1 };
ll dy[8] = { 0,0,1,-1,1,-1,1,-1 };
ll dp[101010];
bool flag[101010];

//long longしか使わない
//素数は1より大きい
//lower_boundは指定したkey以上の要素の一番左のイテレータをかえす
//upper_boundは指定したkeyより大きい要素の一番左のイテレータをかえす
int main() {
	ll n, m;
	cin >> n >> m;
	vector<ll>a(m);
	rep(i, m) {
		cin >> a[i];
		flag[a[i]] = true;
	}
	dp[0] = 1;
	rep(i, n+1) {
		if (i - 1 >= 0 && flag[i - 1] == false)dp[i] += dp[i - 1];
		dp[i] %= MOD;
		if (i - 2 >= 0 && flag[i - 2] == false)dp[i] += dp[i - 2];
		dp[i] %= MOD;
	}
	cout << dp[n] << endl;
	return 0;
}


Measured memory_bytes: 4960
#include<iostream>
#include<iomanip>
#include<iomanip>
#include<string>
#include<vector>
#include<queue>
using namespace std;
typedef long long ll;
#define INF (1<<30)
#define INFLL (1LL << 60)
#define MOD 1000000007
#define rep(i, n) for(int i=0; i<(n); ++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; }

unsigned int dp[10001];	//[ダメージ]:=消費魔力
int main()
{
	int H, N; cin >> H >> N;
	vector<int> A(N), B(N);
	rep(i, N) cin >> A[i] >> B[i];

	memset(dp, -1, sizeof(dp));
	dp[0] = 0;
	for (int i = 0; i < N; ++i) {
		for (int m = 0; m <= H; ++m) {
			if (dp[m] != -1) {
				chmin(dp[min(H, m + A[i])], dp[m] + B[i]);
			}
		}
	}
	cout << dp[H] << endl;
	return 0;
}


Measured memory_bytes: 3240
max_bound = 10 ** 9

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

if S == max_bound:
    l = max_bound
    r = 1
else:
    l = S
    r = max_bound

ans = [l] * K + [r] * (N - K)
print(' '.join(map(str, ans)))

Measured memory_bytes: 12668
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
int main()
{
	double hjd,mjd,jd,s;
	int a,b,h,m;
	cin>>a>>b>>h>>m;
	hjd=(h*60+m)*0.5;
	mjd=m*6;
	jd=fabs(hjd-mjd);
	if(jd>180)
		jd=360-jd;
	printf("%.20f",sqrt(a*a+b*b-2*cos(jd*M_PI/180)*a*b));
	return 0;
}

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

using namespace std;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

typedef long long  ll;
#define endl '\n'


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


const int MOD = 1000000007;

int main() {

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

  ll n;

  cin >> n;

  if(n == 1) { cout << 0 << endl; return 0;}
  if(n == 2) {cout << 1 << endl; return 0;}

  ll mod_sum = 0;

  for(ll i = 2; i <= n-1; i++) {

        mod_sum += i;
  }



  cout << mod_sum + 1 << endl;

}


Measured memory_bytes: 256
import numpy as np
N,M = (int(T) for T in input().split())
A = np.zeros((N,N),dtype=bool)
B = np.zeros((M,M),dtype=bool)
for TN in range(0,N):
    A[TN,:] = [True if T=='.' else False for T in input()]
for TM in range(0,M):
    B[TM,:] = [True if T=='.' else False for T in input()]
MatchFlag = False
for TR in range(0,N-M+1):
    for TC in range(0,N-M+1):
        if np.sum(A[TR:TR+M,TC:TC+M]^B)==0:
            MatchFlag = True
print(['No','Yes'][MatchFlag])

Measured memory_bytes: 27296
a = ['A', 'C', 'G', 'T']
s = list(input())
result = 0
count = 0
for c in s:
    if c in a:
        count += 1
    else:
        if result < count:
            result = count
        count = 0
if result < count:
    result = count
print(result)

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

using namespace std;

const int MOD = 1e9 + 7;
const long long INF = 1e18;
const int MaxN = 50;
const int MaxStep = 64;

int dp[MaxN][MaxN][MaxStep];
int mainDp[MaxN];

int n;
long long k;

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

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
//    freopen("input.txt", "r", stdin);

    cin >> n >> k;

    for(int i = 0; i < n; ++i)
    {
        for(int j = 0; j < n; ++j)
        {
            cin >> dp[i][j][0];
        }
    }

    for(int step = 1; step < MaxStep; ++step)
    {
        for(int i = 0; i < n; ++i)
            for(int a = 0; a < n; ++a)
                for(int j = 0; j < n; ++j)
                    up(dp[i][j][step], (long long) dp[i][a][step - 1] * dp[a][j][step - 1] % MOD);
    }

    for(int i = 0; i < n; ++i)
        mainDp[i] = 1;

    while(k)
    {
        int curStep = 0;
        long long curLen = 1;
        while(curLen * 2 <= k)
        {
            curLen *= 2;
            curStep++;
        }

        k -= curLen;

        vector <int> nextDp(n);

        for(int i = 0; i < n; ++i)
        {
            for(int j = 0; j < n; ++j)
            {
                up(nextDp[j], (long long) mainDp[i] * dp[i][j][curStep] % MOD);
            }
        }

        for(int i = 0; i < n; ++i)
            mainDp[i] = nextDp[i];
    }

    int ans = 0;
    for(int i = 0; i < n; ++i)
        up(ans, mainDp[i]);
    cout << ans << '\n';

    return 0;
}



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

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

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

#define loop(n, i) for(int i=0;i<n;i++)
#define all(v) v.begin(),v.end()
#define HERE cout << "HERE: " << __LINE__ << endl;
#define INSP(v) cout << v << " at " << __LINE__ << endl;

using namespace std;
typedef long long ll;

int main()
{
    int q;
    cin >> q;
    loop(q,i) {
        int n;
        cin >> n;
        int org = n;
        int ans = 0;
        while (n > 10) {
            string s = to_string(n);
            int m = 0;
            loop(s.size()-1, j) {
                int f = stoi(s.substr(0,j+1));
                int l = stoi(s.substr(j+1));
                m = max(m, f*l);
            }
            n = m;
            if (n == org) {
                ans = -1;
                break;
            }
            ans++;
        }
        cout << ans << endl;
    }
}

Measured memory_bytes: 3280
H, W, K = map(int, input().split())
S = [0] * H
INF = 1000000

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


def check(divH):
    MAP = [0] * H
    BitDivH = "".join(["{:0", str(H - 1), "b}"]).format(divH)
    cnt = 0
    for i, bit in enumerate(BitDivH):
        if bit == "1":
            cnt += 1
            MAP[i + 1] = cnt
        else:
            MAP[i + 1] = cnt
    after_tmp = [0] * (MAP[-1] + 1)
    cnt = 0
    out = 0
    for w in range(W):
        for h in range(H):
            after_tmp[MAP[h]] += int(S[h][w])
        for af in after_tmp:
            if af > K:
                out = 1
                break
        else:
            after_tmp = [0] * (MAP[-1] + 1)
    if out == 1:
        return INF
    else:
        for w in range(W):
            for h in range(H):
                after_tmp[MAP[h]] += int(S[h][w])
            for af in after_tmp:
                if af > K:
                    cnt += 1
                    after_tmp = [0] * (MAP[-1] + 1)
                    for h2 in range(H):
                        after_tmp[MAP[h2]] += int(S[h2][w])
                    break
        return cnt + MAP[-1]

MIN = INF
for i in range(2**(H - 1)):
    MIN = min(MIN, check(i))

print(MIN)

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

#define endl '\n'
#define ll long long
#define int long long
#define re register
#define pb(x) push_back(x);
#define ce(x) cout << x << '\n';

#define db  long double;
using pll = pair < ll, ll >;
#define scan(a, n) 		for(int i = 0; i < n; i++)cin >> a[i];

#define rep(i,x,n,inc) for(i=x ; i<n ; i+=inc)
#define repr(i,x,n,inc) for( i=x ; i>n ; i+=inc)
#define all(a)      (a).begin(),(a).end()
#define unique_sort(x) sort(all(x)), x.resize(distance(x.begin(), unique(all(x))))

#define mp(a,b) make_pair(a,b)
#define ff first
#define ss second
#define hell 1000000007
#define infl LLONG_MAX

#define Foxen(i,s) for (i=s.begin(); i!=s.end(); i++)
#define Fill(s,v) memset(s,v,sizeof(s))
#define cout_p(x, p) cout << fixed << setprecision((p)) << x << endl     //print with precision

#define tc(tt) \
    ll tt;    \
    cin >> tt; \
    for (ll _tt = 0; _tt < tt; _tt++) // testcase 

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

 
	ll t, i, x, j, y, 	z, k, n;
	cin >> x >> y >> z;
	k = ((y + x - 1) / x);
	k++;
	k *= x;
	rep(k, 0, 10000, x)
	if (k <= z && k >= y)	return  cout << ("OK"), 0;

	// k = ((z) / x);
	// k--;
	// k *= x;
	// if (k <= z && k >= y)	return  cout << ("OK"), 0;

	ce("NG")
}


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

int main() {
  int n;
  cin >> n;
  ll ans = 0;
  int xa, bx, ba;
  xa = bx = ba = 0;
  for (int i = 0; i < n; i++) {
    string s;
    cin >> s;
    int size = s.size();
    if (s[0] == 'B' && s[size - 1] == 'A') ba++;
    else if (s[size - 1] == 'A') xa++;
    else if (s[0] == 'B') bx++;
    for (int j = 1; j < size; j++) {
      if (s[j - 1] == 'A' && s[j] == 'B') ans++;
    }
  }

  if (xa == 0 && bx == 0) {
    ans += max(0, ba - 1);
  } else {
    ans += min(xa, bx) + ba;
  }

  cout << ans << endl;
};


Measured memory_bytes: 256