akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
string a,b,c;
int main(){
  cin >> a >> b;
  c=a+b;
  double num=stoi(c);
  if(ceil(sqrt(num))==floor(sqrt(num))){
    cout << "Yes" << endl;
    return 0;
  }
  cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
	using namespace std;
	#define mp make_pair
	#define ll long long
	#define pb push_back
	#define mp make_pair
	#define M LONG_LONG_MAX
	#define IM INT_MAX
	#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int32_t main()
    {
		IOS;
		ll n,m,i,j,k;
      cin>>n;
      ll a[n];
      for(i=0;i<n;i++)
      cin>>a[i];
      ll c=0;
      for(i=1;i<n-1;i++)
      {
          if((a[i]>a[i+1]&&a[i]<=a[i-1])||(a[i]<=a[i+1]&&a[i]>a[i-1]))
          {
              ++c;
              //cout<<a[i];
          }
      }
      cout<<c;
	}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define P pair<ll, ll>
#define Graph vector<vector<ll>>
#define fi first
#define se second
constexpr ll mod = 1000000007;
constexpr ll INF = (1ll << 60);
constexpr double pi = 3.14159265358979323846;
template <typename T>
inline bool chmax(T &a, T b){if (a < b){a = b;return 1;}return 0;}
template <typename T>
inline bool chmin(T &a, T b){if (a > b){a = b;return 1;}return 0;}

int main(){
    ll n;cin>>n;
    vector<ll> a(n);
    rep(i,n) cin>>a[i];

    ll sum=0;
    for(ll i=0;i<n-1;i++){
        if(a[i+1]<a[i]){
            sum += abs(a[i+1]-a[i]);
            a[i+1]=a[i];
        }
    }

    cout<<sum<<endl;

    return 0;
}

Measured memory_bytes: 4836
n,y=map(int,input().split())
y //= 1000
for i in range(n+1):
    for j in range(n-i+1):
        if 10*i+5*j+n-(i+j)==y:
            print(i,j,n-i-j)
            exit()
print("-1 -1 -1")

Measured memory_bytes: 2940
A,B=map(int, input().split())
S=list(str(input()))
s1=''
s2=''
for i in range(A):
    if S[0] in ['1','2','3','4','5','6','7','8','9','0']:
        s1+=S.pop(0)
    else:
        print('No')
        exit()
t=S.pop(0)
if t!='-':
    print('No')
    exit()
for i in range(B):
    if S[0] in ['1','2','3','4','5','6','7','8','9','0']:
        s2+=S.pop(0)
    else:
        print('No')
        exit()
print('Yes')

Measured memory_bytes: 3064
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long INF = 1000000009LL;
#define all(x) (x).begin(),(x).end()
#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 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


int main() {
    string s; cin >> s;
    reverse(all(s));

    bool fg = true; int p = 0;
    while(p<s.size()){
        string t = s.substr(p, 5);
        string u = s.substr(p, 6);
        string v = s.substr(p, 7);
        if(t == "maerd") p += 5;
        else if(t == "esare") p += 5;
        else if (t == "remae" && v == "remaerd") p += 7;
        else if(t == "resar" && u == "resare") p += 6;
        else {
            fg = false;
            break;
        }
    }

    if(fg) cout << "YES" << ln;
    else cout << "NO" << ln;
}


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

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

  if (a.size() > b.size()) {
    cout << "GREATER" << endl;
    return 0;
  } else if (a.size() < b.size()) {
    cout << "LESS" << endl;
    return 0;
  } else {
    for (int i = 0; i < a.size(); i ++) {
      if (a.at(i) == b.at(i)) {
        continue;
      } else if (a.at(i) > b.at(i)) {
        cout << "GREATER" << endl;
        return 0;
      } else if (a.at(i) < b.at(i)) {
        cout << "LESS" << endl;
        return 0;
      }
    }
  }

  cout << "EQUAL" << endl;
}


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

#define repfrom(i, from, n) for (ll i = (from); i < (n); i++)
#define rep(i, n) repfrom(i, 0, n)
#define reps(i, n) for (ll i = 1; i <= (n); i++)
#define rrep(i, n) for (ll i = (n) - 1; i >= 0; i--)

using namespace std;

using ll = long long;
using p  = pair<ll, ll>;
using uc = unsigned char;
constexpr ll INF = 1LL << 62;
constexpr ll MOD = 1e9 + 7;

int main(void) {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll N, L;
    cin >> N >> L;
    
    vector<ll> A(N);
    for (auto&& a : A) {
        cin >> a;
    }
    
    ll idx = -1;
    rep(i, N - 1) {
        if (A[i] + A[i + 1] >= L) {
            idx = i;
            break;
        }
    }
    
    if (idx == -1) {
        cout << "Impossible" << endl;
        return 0;
    }
    
    cout << "Possible" << endl;
    
    rep (i, idx) {
        cout << i + 1 << endl;
    }
    
    for (ll i = N - 2; i >= idx; i--) {
        cout << i + 1 << endl;
    }
    
    return 0;
}


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

bool isPrime(int n) {
    if (n==2) return true;
    if (n%2==0) return false;
    
    for(int i=3; i<=sqrt(n); i+=2) {
        if(n%i==0) return false;
    }
    return true;
}

int main(void){
    int n; cin >> n;
    int ans = 0;
    
    for(int i=0; i<n; i++){
        int tmp; cin >> tmp;
        if(isPrime(tmp)) ans++;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3088
def search(t, p):
    tn = len(t)
    i = 0
    pn = len(p)
    plist = []
    if pn <= tn:
        while i < tn:
            j = 0
            while j < pn and i+j < tn:
                if t[i+j] != p[j]: break
                j += 1
            if j == pn:
                plist.append(i)
            i += 1
    return plist

def main():
    t = input()
    p = input()
    plist = search(t, p)
    for i in plist: print(i)



if __name__ == "__main__":
    main()


Measured memory_bytes: 5572
N = int(input())
S = input()

res = ""
st = []
for s in S:
    if s == "(":
        st.append("(")
        res += "("
    else:
        if st:
            st.pop()
            res += ")"
        else:
            res = "(" + res + ")"

print(res + ")" * len(st))


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

int main() {
    int k, x, temp;
    cin >> k >> x;
    temp = x - k + 1;
    rep(i, 2 * k - 1) {
        cout << temp + i << " ";
    }

    cout << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MOD 1000000007
#define F first
#define S second
using namespace std;
typedef pair<int,int> pii;
int n,m,check[1010101],ac,wa;
main()
{
	cin>>n>>m;
	for(int i=0;i<m;i++)
	{
		int t; char arr[30];
		scanf("%d %s",&t,arr);
		if(check[t]<0) continue;
		if(arr[0]=='W') check[t]++;
		else if(arr[0]=='A') ac++, wa+=check[t], check[t]=-1;
	} printf("%d %d",ac,wa);
}

Measured memory_bytes: 640
#include<iostream>
#include<algorithm>

using namespace std;
bool cmp(int a,int b)
{
	return a > b;
}
int main()
{
    int a[52];
    int n, k,res = 0;
    cin >> n >> k;
    for(int i = 0;i < n;i++) cin >> a[i];
    sort(a,a + n,cmp);
    
    for(int j = 0; j < k;j++) res += a[j];
    cout << res <<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdint>

using namespace std;

int main()
{
    int64_t w, h, x, y;

    cin >> w >> h >> x >> y;

    double area = w * h / 2.0;

    printf("%lf ", area);

    if (2 * x == w && 2 * y == h)
    {
        cout << 1 << endl;
    }
    else
    {
        cout << 0 << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(register int i=a;i<=b;++i)
#define rpd(i,a,b) for(register int i=a;i>=b;--i)
#define rep1(i,x) for(register int i=head[x];i;i=nxt[i])
typedef long long ll;
using namespace std;
inline int read(){
    int x=0,f=1;char ch=getchar();
    while(!isdigit(ch)){if(ch=='-')f=-1;ch=getchar();}
    while(isdigit(ch)){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
ll A,B,L,R,L1,R1,ans;int k1,k2;
int main(){
	cin>>A>>B;if(A==B){puts("1");return 0;}
	rpd(i,60,1){
		ll a=A&(1LL<<i-1),b=B&(1LL<<i-1);
		if(a!=b){k1=i;break;}
		A-=a;B-=b;
	}
	rpd(i,k1-1,1){
		ll b=B&(1LL<<i-1);
		if(b){k2=i;break;}
	}
	L=A;R=(1LL<<k1-1)+(1LL<<k2)-1LL;
	L1=(1LL<<k1-1)+A;R1=(1LL<<k1)-1LL;
	ans+=(R-L+1LL)+(R1-L1+1LL);
	if(L1<=R)ans-=(R-L1+1LL);
	printf("%lld\n",ans);
	//system("pause");
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
//const ll mod=1e9+7;
const ll mod=998244353;
const ll inf=5e18;

ll mpow(ll x, ll n) {
  ll ans=1;
  while(n>0) {
    if(n&1) {
      ans=ans*x%mod;
    }
    x=x*x%mod;
    n>>=1;
  }
  return ans;
}

vec tfact(1e7+1);
void fact(ll n) {
  for(ll i=0;i<=n;i++) {
    if(i==0) {
      tfact[i]=1;
    }
    else {
      tfact[i]=tfact[i-1]*i%mod;
    }
  }
}

//nCk 繰り返し高速
ll comb(ll n, ll k) {
  return tfact.at(n)*mpow(tfact.at(k),mod-2)%mod*mpow(tfact.at(n-k),mod-2)%mod;
}

int main() {
  ll n,m,k;
  cin >> n >> m >> k;
  fact(max(n,m));
  ll ans=0;
  for(ll i=0;i<=k;i++) {
    ll tans=0;
    tans=m*mpow(m-1,n-i-1)%mod*comb(n-1,i)%mod;
    (ans+=tans)%=mod;
  }
  cout << ans << endl;
}

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

constexpr int inf = 0x3f3f3f3f;
constexpr ll linf = 0x3f3f3f3f3f3f3f3fLL;

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

    int n; cin >> n;
    deque<int> dq;
    for (int i = 0; i < n; i++) {
        int a; cin >> a;
        if (i & 1) dq.push_back(a);
        else dq.push_front(a);
    }
    if (n & 1) for (int i = 0; i < n; i++) cout << dq.front() << " \n"[i == n - 1], dq.pop_front();
    else  for (int i = 0; i < n; i++) cout << dq.back() << " \n"[i == n - 1], dq.pop_back();
    return 0;
}


Measured memory_bytes: 3072
#include <bits/stdc++.h>
#include <cassert>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ok() puts(ok?"Yes":"No");
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)
using namespace std;
using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using ii = pair<int, int>;
using vvi = vector<vi>;
using vii = vector<ii>;
using gt = greater<int>;
using minq = priority_queue<int, vector<int>, gt>;
using P = pair<ll,ll>;
const ll LINF = 1e18L + 1;
const int INF = 1e9 + 1;
//clang++ -std=c++11 -stdlib=libc++ 

int main() {
  // abc99d
  int N,C; cin >> N >> C;
  vvi d(C, vi(C));
  vvi c(N, vi(N));
  rep(i,C) rep(j, C) cin >> d[i][j];
  rep(i,N) rep(j, N) cin >> c[i][j];
  vector<map<int, int>> mps(3);
  rep(y, N) rep(x, N) {
    int md = (x+y+2) % 3;
    int color = c[y][x];
    mps[md][color]++;
  }
  int ans = INF;
  rep(i, C) {
    rep(j, C) {
      if (i==j) continue;
      rep(k, C) {
        if (j==k || i == k) continue;
        int num = 0;
        rep(mp, 3) {
          for (auto p: mps[mp]) {
            int before = p.first;
            int cnt = p.second;
            --before;
            int after = -1;
            if (mp == 0) after = i;
            if (mp == 1) after = j;
            if (mp == 2) after = k;
            num += cnt * d[before][after];
          }
        }
        chmin(ans, num);
      }
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 4600
"""
D-Friend Suggestions
BFS
"""

import sys
input = sys.stdin.readline
from collections import deque, Counter


def main():
    N, M, K = map(int, input().split())
    friend = [[] for _ in range(N)]
    block = [[] for _ in range(N)]

    for _ in range(M):
        a, b = map(int, input().split())
        friend[a - 1].append(b - 1)
        friend[b - 1].append(a - 1)

    for _ in range(K):
        c, d = map(int, input().split())
        block[c - 1].append(d - 1)
        block[d - 1].append(c - 1)

    label_list = [-1] * N
    label = 0
    for start_vertex in range(N):
        q = deque()

        def push(vertex, label):
            if label_list[vertex] != -1:
                return
            q.append(vertex)
            label_list[vertex] = label

        push(start_vertex, label)

        while len(q) != 0:
            vertex = q.popleft()
            friend_vertexes = friend[vertex]
            for f_vertex in friend_vertexes:
                push(f_vertex, label)
        label += 1

    connected_component_id = Counter(label_list)

    ans = []
    for i in range(N):
        vertex_label = label_list[i]
        connected_qty = connected_component_id[vertex_label]

        for j in block[i]:
            if label_list[i] == label_list[j]:
                connected_qty -= 1

        ans.append(connected_qty - len(friend[i]) - 1)

    print(*ans)


if __name__ == '__main__':
    main()


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

long long r[255];

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	int n; string s; cin >> n >> s;
	for (int i = 0; i < n; i++) 
		r[s[i]]++;
	long long ans = 1;
	for (int i = 'a'; i <= 'z'; i++)
		ans = (ans * (r[i] + 1)) % 1000000007LL;
	cout << (ans - 1 + 1000000007LL) % 1000000007LL << '\n';
	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define pb push_back
#define sz(a) int(a.size())
#define re return
#define all(a) a.begin(),a.end()
using namespace std;
int main()
{
	int a,b;
	cin>>a>>b;
	a-=b;
	a-=b;
	cout<<max(a , 0);
	re 0;
}

Measured memory_bytes: 256
a, b = map(int, input().split())
s = input()
l = [0] * a
c = 0

for x in range(a - 1):
    if s[x:x+2] == "AC":
        c += 1
    l[x] = c

for x in range(b):
    i, j = map(int, input().split())
    print(l[j-2] - l[i-2])

Measured memory_bytes: 6084
import std.stdio;
import std.algorithm;
import std.string;
import std.range;
import std.array;
import std.conv;
import std.complex;
import std.math;
import std.ascii;
import std.bigint;
import std.container;
import std.typecons;

auto readInts() {
	return array(map!(to!int)(readln().strip().split()));
}
auto readInt() {
	return readInts()[0];
}
auto readLongs() {
	return array(map!(to!long)(readln().strip().split()));
}
auto readLong() {
	return readLongs()[0];
}

void readlnTo(T...)(ref T t) {
    auto s = readln().split();
    assert(s.length == t.length);
    foreach(ref ti; t) {
        ti = s[0].to!(typeof(ti));
        s = s[1..$];
    }
}

const real eps = 1e-10;

void main(){
    long n, k;
    readlnTo(n, k);

    auto d = readLongs();
loop:while(true) {
        auto s = n.to!string;
        foreach(di; d) {
            foreach(si; s) {
                if(di.to!string[0] == si) {
                    ++n;
                    continue loop;
                }
            }
        }
        writeln(n);
        return;
    }
}



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

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

  int ans = a+b+c;

  int max = a < b ? b : a;
  max = max < c ? c : max;

  ans -= max;

  int num = max;
  rep(i, k) {
    num *= 2;
  }

  ans += num;

  cout << ans << endl;

  return 0;
}


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

typedef long long lint;
typedef pair<int, int> P;
#define REP(i, x, n) for(int i = x ; i < n ; ++i)
#define rep(i, n) REP(i, 0, n)
#define repr(i, n) for(int i = n - 1 ; i >= 0 ; --i)
#define ALL(x) (x).begin(), (x).end()
#define SORT(x) sort(ALL(x))

const int IINF = 1e9 + 10;
const lint LLINF = (lint)1e18 + 10;
const lint MOD = (lint)1e9 + 7;
const int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
const int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};

int main(){
    int n;
    cin >> n;
    vector<int> p(n);
    rep(i, n){
        cin >> p[i];
        --p[i];
    }
    vector<int> a(n), b(n);
    rep(i, n){
        a[p[i]] = 25000 * p[i] + 1;
        b[p[i]] = 25000 * (n - p[i]) + i + 1;
    }
    rep(i, n){
        cout << a[i] << " ";
    }
    cout << endl;
    rep(i, n){
        cout << b[i] << " ";
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define o(a) cout << a << endl
#define int long long
using namespace std;
typedef pair<int, int> P;

struct UF{
    vector<int> par;
    vector<int> sz;
    void init(int n){
        par.resize(n);
        sz.resize(n, 1);
        rep(i, 0, n) par[i] = i;
    }
    int find(int x){
        if(x == par[x]) return x;
        return par[x] = find(par[x]);
    }
    void unite(int x, int y){
        x = find(x); y = find(y);
        if(x == y) return;
        if(sz[x] < sz[y]) swap(x, y);
        sz[x] += sz[y];
        par[y] = x;
    }
    bool same(int x, int y){
        return find(x) == find(y);
    }
};

vector<int> lp[100010];//langauge id
vector<int> ls[100010];//person id
int n, m;

signed main(){
    cin >> n >> m;
    rep(i, 0, n){
        int k;
        cin >> k;
        rep(j, 0, k){
            int in;
            cin >> in;
            in--;
            lp[i]. push_back(in);
            ls[in]. push_back(i);
        }
    }
    UF uf;
    uf.init(n);
    rep(i, 0, m){
        if(ls[i].size() == 0) continue;
        rep(j, 1, ls[i].size()){
            uf.unite(ls[i][0], ls[i][j]);
        }
    }
    bool f = true;
    rep(i, 1, n){
        if(!uf.same(0, i)) f = false;
    }
    o((f ? "YES" : "NO"));
}

Measured memory_bytes: 10496
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <bits/stdc++.h>
#include<queue>
#include <numeric>
using namespace std;
 
//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
 
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
 template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
 
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
 
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define fore(i,a) for(auto &i:a)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
 
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
 
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
 



int main(){
    int N;
    cin >> N;
    int a[N];
    map<int,int>mp;
    int ans=0;
    for(int i=0;i<N;++i){
        cin >> a[i];
        mp[a[i]]++;
        mp[a[i]+1]++;
        if(a[i]>0){
        mp[a[i]-1]++;
        }
    }
    for(int i=0;i<=100000;++i){
        ans=max(ans,mp[i]);
    }
    cout << ans << endl;
    }

Measured memory_bytes: 5376
main = do
    _ <- getLine
    str <- getLine
    let cW = countFound 'W' str
    let cE = countFound 'E' $ reverse str

    let numList = zipWith (+) cW (reverse cE)
    print $ minimum numList


countFound :: Eq a => a -> [a] -> [Int]
countFound target = aux [0]
    where
        aux ac [] = ac
        aux (x:xs) (s:ss)
            | s==target = aux ((x+1):x:xs) ss
            | otherwise = aux (x:x:xs) ss

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

#define LL long long
#define VI vector<int>
#define VVI vector<vector<int>>
#define VVVI vector<vector<vector<int>>>
#define VL vector<LL>
#define VVL vector<vector<LL>>
#define VVVL vector<vector<vector<LL>>>
#define VB vector<bool>
#define FOR(i,a,b) for(int i= (a); i<((int)b); ++i)
#define RFOR(i,a) for(int i=(a); i >= 0; --i)
#define FOE(i,a) for(auto i : a)
#define ALL(c) (c).begin(), (c).end()
#define RALL(c) (c).rbegin(), (c).rend()
#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v,x) (std::find(v.begin(), v.end(), x) != v.end())
#define BIT(n) (1LL<<(n))
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define EPS 1e-14

template<class T> T ceil(T a, T b) { return (a + b - 1) / b; }
template<class T> void print(T x) { std::cout << x << std::endl; }

const std::string YES = "YES", Yes = "Yes", NO = "NO", No = "No";
const std::vector<int> dy = { 0, -1, 0, 1 }, dx = { 1, 0, -1, 0 };    // 4近傍（右, 下, 左, 上）

using namespace std;


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

    while (true) {
        int n;
        cin >> n;
        if (n == 0) { break; }
        vector<string> field;
        FOR(i, 0, n) {
            string s;
            cin >> s;
            field.emplace_back(s);
        }

        int ans = 0;
        // dp[y][x] = field[y][x]を右下としたときの最大の正方形の面積
        VVI dp(n, VI(n, 0));
        FOR(y, 0, field.size()) {
            FOR(x, 0, field[0].size()) {
                if (field[y][x] == '*') {
                    dp[y][x] = 0;
                } else {
                    if (0 < y and 0 < x) {
                        dp[y][x] = min({dp[y - 1][x], dp[y][x - 1], dp[y - 1][x - 1]}) + 1;
                    } else {
                        dp[y][x] = 1;
                    }
                }

                ans = max(ans, dp[y][x]);
            }
        }
        print(ans);
    }
}



Measured memory_bytes: 7940
import sys
import math
import random
from collections import defaultdict
input = sys.stdin.readline
def is_prime(q,k=6):
    q = abs(q)
    if q == 2: return True
    if q < 2 or q&1 == 0: return False
    d = (q-1)>>1
    while d&1 == 0:
        d >>= 1

    for i in range(k):
        a = random.randint(1,q-1)
        t = d
        y = pow(a,t,q)
        while t != q-1 and y != 1 and y != q-1: 
            y = pow(y,2,q)
            t <<= 1
        if y != q-1 and t&1 == 0:
            return False
    return True

def fact(n):
    ret = set()
    for i in range(2, math.floor(math.sqrt(n))+1):
        if n % i == 0:
            ret.add(i)
            while n % i == 0:
                n //= i
    if n != 1:
        ret.add(n)
    return ret

    
if __name__ == "__main__":
    N = int(input())
    A = list(map(int,input().split()))
    primes = set()
    i = 0
    fl=True
    g = A[0]
    while i < len(A):
        a = A[i]
        g = math.gcd(g, a)
        if is_prime(a):
            if a in primes:
                fl = False
                break
            else:
                primes.add(a)
        else:
            ret = fact(a)
            if ret.intersection(primes):
                fl = False
                break
            else:
                primes |= ret
        i += 1
    if fl:
        print("pairwise coprime")
        exit(0)

    while i < len(A):
        g = math.gcd(g, A[i])
        if g == 1:
            print("setwise coprime")
            exit(0)
        i += 1
    print("not coprime")

Measured memory_bytes: 193944
#include <iostream>
using namespace std;
int main() {
    int N;
    cin >> N;
    int answer =0;
for (int C = 1;C <= N; C += 2) {
    int num_of_divisors = 0;
    for (int X = 1;X <= C; ++X) {
        if (C % X == 0) {
            ++num_of_divisors;
        }
    }
    if (num_of_divisors == 8) {
        ++answer;
    }
        
}
cout << answer << "\n";
return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import sys
import itertools#これは色々使える組み込み関数みたいなやつ
import math#数学的計算はこれでいける。普通に0.5乗しても計算可能
#w=input()
i=0
#L=int(input())
N, L=input().split()
#S=input()
#T=input()
#S_list=list(S)
#T_list=  list(map(int, input().split(" ")))
#M=int(input())
#drink_list = [list(map(int, input().split(" ")))for i in range(M)]
#print(T_list[1])
N=int(N)
W=int(L)
#C=int(C)
#K=int(K)
T_dummy_list=[]
sentence_list=[]
total=0
mojiretu=""
#センテンスを暗記するのではなく、まずinput()を書いて、膨らます感じで記述する。すると#思考の流れ通りに書ける。素晴らしい！
#for i in range(K):
# ID_list.append(i+1)
#print(ID_list)
#for i in range(H)
#この下の行が二次元リストの読み込
#intを消して記号を読み込めるようにしたしかしこれでは文字列から読み込んでいるのと同じ
#sentence_list =  [list(input())for i in range(N)]#一文字づつばらして入れてしまう
s = [input() for i in range(N)]
#複数行に複数の入力値を取得し、出力する
#sentence_list =  (list(input())for i in range(N))
#for i in range(H):
#  ppixel_list=list(input())
#  
#print(pixel_list)
i=0
j=0
#high_pixel_list =[['' for i in range(W)]for j in range(2*H)]
#print(high_pixel_list)
#print(pixel_list[0][1])#行　列の順番にかっこが並んでいる

#整数二次元配列を読み込む時のやり方
#gate_list =  [list(map(int, input().split(" ")))for i in range(M)]
#センテンスを暗記するのではなく、まずinput()を書いて、膨らます感じで記述する。すると#思考の流れ通りに書ける。素晴らしい！
#print(s)
sentence_list=sorted(s)
#print(sentence_list)
for i in range(N):
    mojiretu += sentence_list[i]

print(mojiretu)


Measured memory_bytes: 3060
#include <stdio.h>

int n, m, q, a[50], b[50], c[50], d[50], A[10];

// 今の状態で k 番目以降を埋めたとき、答えの最大値
int dfs(int k) {
  int res = 0;
  if (k == n)
    for (int i = 0; i < q; i++)
      res += d[i] * (A[b[i]] - A[a[i]] == c[i]);
  else if (k == 0)
    for (A[0] = 1; A[0] <= m; A[0]++) {
      int r = dfs(1);
      if (r > res) res = r;
    }
  else
    for (A[k] = A[k-1]; A[k] <= m; A[k]++) {
      int r = dfs(k + 1);
      if (r > res) res = r;
    }
  return res;
}

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


Measured memory_bytes: 1704
#include<iostream>
#include<queue>
#include<map>
#include<algorithm>
#include<cstdio>
#include<string>
#define N  3
#define N2 9
using namespace std;
const int dx[4]={-1,0,1,0};
const int dy[4]={0,-1,0,1};
const char toward[4]={'l','u','r','d'};

class Block{
public:
    int A[N2];
    string trace;
    int loc;

    bool operator < (const Block & b) const {
        for(int i=0;i<N2;i++){
            if(this->A[i]>b.A[i]) return false;
            if(this->A[i]<b.A[i]) return true;
        }
        return false;
    }
};
bool right(const Block &b){
    for(int i=0;i<N2;i++){
        if(b.A[i]!=i+1) return false;
    }
    return true;
}
void show(Block b){
    for(int i=0;i<N;i++){
        for(int j=0;j<N;j++){
            cout<<b.A[i*N+j]<<' ';
        }
        cout<<endl;
    }
}
string bfs(Block b){
    queue<Block> Q;
    map<Block,bool> M;
    Block temp;
    int i,j,k;
    Q.push(b);
    M[b]=true;
    while(!Q.empty()){
        temp=Q.front();
        Block tt=temp;
        Q.pop();
        if(right(temp)){
            return temp.trace;
        }
        for(i=0;i<4;i++){
            temp=tt;
            int temploc=temp.loc;
            int sx=temp.loc%N;
            int sy=temp.loc/N;
            int ex=sx+dx[i];
            int ey=sy+dy[i];
            int eloc=ey*N+ex;
            if(ex<0 || ey<0 || ex>=N || ey>=N) continue;
            swap(temp.A[temploc],temp.A[eloc]);
            temp.loc=eloc;
            if(right(temp)){
                temp.trace+=toward[i];
                return temp.trace;
            }else
            if(!M[temp]){
                temp.trace+=toward[i];
                M[temp]=true;
                Q.push(temp);
                //show(temp);
                //cout<<endl;
            }

        }
    }
    cout<<"???"<<endl;
    return "WTF!";
}
int main(){
    int i;
    Block b;
    for(int i=0;i<N2;i++){
        cin>>b.A[i];
        if(b.A[i]==0){
            b.loc=i;
            b.A[i]=N2;
        }
    }
    b.trace="";
    string s=bfs(b);
    if(s=="WTF!") cout<<"unsolvable"<<endl;
    else cout<<s.length()<<endl;

}



Measured memory_bytes: 33508
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<queue>
#include<stack>
#include<vector>
#include<map>
using namespace std;

int read(){
	int x=0,f=1;
	char c=getchar();
	while(!isdigit(c)){if(c=='-')f=-1;c=getchar();}
	while(isdigit(c)){x=(x<<3)+(x<<1)+c-48;c=getchar();}
	return x*f;
}

int k,m,n;
int main(){
	n=read();
	double m=1.0*n/(1+0.08);
	int ans;
	for(register int i=1;i<=100000;i++){
		if(int(i*1.08)==n){
			printf("%d\n",i);
			return 0;
		}
	}
	puts(":(");
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef struct node
{
	int left,right,value;
	bool operator < (const struct node & t)const
	{
		return right<t.right;
	}
}EDGE,*PEDGE;
int cnt=0;
long long lazy[1<<19];
EDGE arr[1<<18];
long long tree[1<<19];
long long search(int index,int lb,int rb,int lq,int rq)
{
	if(lb==rb||(lb==lq&&rb==rq))
		return tree[index];
	if(lazy[index])
	{
		tree[index<<1]+=lazy[index];
		tree[index<<1|1]+=lazy[index];
		lazy[index<<1]+=lazy[index];
		lazy[index<<1|1]+=lazy[index];
		lazy[index]=0;
	}
	int mid=(lb+rb)>>1;	
	if(lq>mid)
		return search(index<<1|1,mid+1,rb,lq,rq);
	else if(rq<=mid)
		return search(index<<1,lb,mid,lq,rq);
	else
		return max(search(index<<1|1,mid+1,rb,mid+1,rq),search(index<<1,lb,mid,lq,mid));
}
void update(int index,int lb,int rb,int lq,int rq,long long value)
{
	if(lb==lq&&rb==rq)
	{
		tree[index]+=value;
		lazy[index]+=value;
		return;
	}
	if(lazy[index])
	{
		tree[index<<1]+=lazy[index];
		tree[index<<1|1]+=lazy[index];
		lazy[index<<1]+=lazy[index];
		lazy[index<<1|1]+=lazy[index];
		lazy[index]=0;
	}
	int mid=(lb+rb)>>1;
	if(lq>mid)
		update(index<<1|1,mid+1,rb,lq,rq,value);
	else if(rq<=mid)
		update(index<<1,lb,mid,lq,rq,value);
	else
	{
		update(index<<1|1,mid+1,rb,mid+1,rq,value);
		update(index<<1,lb,mid,lq,mid,value);
	}
	tree[index]=max(tree[index<<1|1],tree[index<<1]);
}
int main()
{
	int n,m,i;
	scanf("%d %d",&n,&m);
	for(i=0;i<m;i++)
	{
		scanf("%d %d %d",&arr[i].left,&arr[i].right,&arr[i].value);
	}
	sort(arr,arr+m);
	for(i=1;i<=n;i++)
	{
		update(1,0,n,i,i,search(1,0,n,0,i-1));
		while(i==arr[cnt].right&&cnt<m)
		{
			update(1,0,n,arr[cnt].left,arr[cnt].right,arr[cnt].value);
			cnt++;
		}
	}
	printf("%lld",search(1,0,n,0,n));
	return 0;
}

Measured memory_bytes: 11520
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();

        long sqrt = (long) Math.sqrt(n * 1.0) + 1;
        // System.out.println(sqrt);

        long a = -1;
        long b = -1;
        for (long i = sqrt; i > 0; i--) {
            if (n % i == 0) {
                a = i;
                b = n / a;
                break;
            }
        }

        long ans = a + b - 2;
        System.out.println(ans);

        sc.close();
    }

}


Measured memory_bytes: 23124
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <tuple>
#include <cstdio>
#include <cassert>
#include <functional>
#define _LIBCPP_DEBUG 0
using namespace std;

int main()
{

    int n;
    cin >> n;

    vector<int> d(n);
    for (int i = 0; i < n; i++)
    {
        cin >> d.at(i);
    }
    sort(d.begin(),d.end());
    reverse(d.begin(),d.end());
    
    int count=1;
    for(int i=0;i<n-1;i++){
        if(d.at(i)!=d.at(i+1)){
            count++;
        }
    }
    cout << count <<endl;
}


Measured memory_bytes: 3640
from math import factorial

N, M = map(int, input().split())


switches = []

for i in range(M):
    nyuuryoku = list(map(int, input().split()))
    switches.append(nyuuryoku[1:])

P = list(map(int, input().split()))

kumiawase = 0

# for i in range(M):
#     is_kisuu = P[i]
#     kosuu = len(switches[i])
#     for j in range(is_kisuu, kosuu, 2):
#         kumi = factorial(kosuu) // factorial(j) // factorial(kosuu - j)
#         print(kumi)
#         kumiawase += kumi

# print(kumiawase)


def kumi(lst):
    if len(lst) == N:
        # ここになんか書く
        ok = True
        for i in range(M):  # それぞれのスイッチの組
            goukei = 0
            for s in switches[i]:  # それぞれのスイッチ番号
                goukei += lst[s-1]

            if goukei % 2 != P[i]:
                ok = False
        if ok:
            return 1
        else:
            return 0
    else:
        return kumi(lst + [0]) + kumi(lst + [1])


print(kumi([]))


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

int main() {
    int64_t n;
    cin >> n;
    string ans;

    int64_t i;
    for(i = n; i > 0; i /= 26) { // aは97
        i--;
        ans += 'a' + i%26;
    }
    reverse(ans.begin(), ans.end());
    cout << ans << endl;
}


Measured memory_bytes: 3608
import sys

x=[]
y=[]
h=[]
n=int(input())
for i in range(n):
    a,b,c=list(map(int,input().split()))
    x.append(a)
    y.append(b)
    h.append(c)

for cx in range(101):
    for cy in range(101):
        for i in range(n):
            if(h[i]==0):
                continue
            else:
                H=h[i]+abs(cx-x[i])+abs(cy-y[i])
                break
        for i in range(n):
            if(h[i]!=max(H-abs(cx-x[i])-abs(cy-y[i]),0)):
                    break
        else:
            print("{} {} {}".format(cx,cy,H))
            sys.exit(0) 

Measured memory_bytes: 3192
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<iostream>
using namespace std;
#define ll long long
ll n;
ll f(ll now){return now*(now+1)/2;}
int main()
{
	scanf("%lld",&n);
	printf("%lld",f(n)-3ll*f(n/3)-5ll*f(n/5)+15ll*f(n/15));
	
	
	
	
	return 0;
} 

Measured memory_bytes: 3828
#include <cstdio>
#include <cctype>
#include <utility>
#include <vector>
#include <climits>
#include <algorithm>
using namespace std;

const auto gcu = getchar_unlocked;
const auto pcu = putchar_unlocked;
#define _T template <typename T>
#define _HT template <typename H, typename... T>
#define _il inline
#define _sc _il bool scan
_T T in(int c){T n=0;int m=1;while(isspace(c)){c=gcu();}if(c=='-')m=-1,c=gcu();
	do{n=10*n+(c-'0'),c=gcu();}while(c>='0'&&c<='9');return m*n;}
_il int in() {return in<int>(gcu());}
_T T scan(T &n){int c=gcu();return c==EOF?false:(n=in<T>(c),true);}
_sc(char &c){c=gcu();gcu();return c!=EOF;}
#ifdef _GLIBCXX_STRING
_sc(string &s){int c;s="";
	for(;;){c=gcu();if(c=='\n'||c==' ')return true;else if(c==EOF)return false;s+=c;}}
#endif
_HT _sc(H &h, T&&... t){return scan(h)&&scan(t...);}
#define _ot _il void out
#define _ol _il void outl
_ot(bool b) {pcu('0'+b);}
_ot(const char *s){while(*s)pcu(*s++);}
_ot(char c){pcu(c);}
#ifdef _GLIBCXX_STRING
_ot(string s){for(char c:s)pcu(c);}
#endif
_T _ot(T n){static char b[20];char *p=b,m=n<0?pcu('-'),-1:1;
	if(!n)*p++='0';else while(n)*p++=n%10*m+'0',n/=10;while(p!=b)pcu(*--p);}
_ol(){out('\n');}
#ifdef _GLIBCXX_VECTOR
_T _ot(vector<T> &v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);outl();}
#endif
_HT _ot(H&& h, T&&... t){out(h);out(move(t)...);}
template <typename... T> _ol(T&&... t){out(move(t)...);outl();}

int main() {
	int n = in();
	vector<int> D(in()), dp(n + 1, INT_MAX);
	for (int &d: D)
		d = in();
	sort(D.begin(), D.end());
	dp[0] = 0;
	for (int i = 1; i <= n; i++)
		for (int d: D)
			if (d <= i)
				dp[i] = min(dp[i], dp[i - d] + 1);
			else
				break;
	outl(dp[n]);
}


Measured memory_bytes: 2612
#include <bits/stdc++.h>
using namespace std;
#define dhoom ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);  
typedef long long ll;
typedef long double ld;
const ll inf = 1e18;
const int nax = 2e6 + 7;
const ll mod = 1e9 + 7;
//ll tree[4 * nax];
//9uS-22RSwk7gQqh

map< int , int > mp[nax];
int main()
{
	int n;
	cin >> n;
	int ans = 0;
	while(n != 0){
		n/=2;
		ans++;
	}
	cout << pow(2 , ans - 1) << endl;
	return 0;
} 




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

using namespace std;

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n;
	cin>>n;
	int num = n/1000;
	if (n % 1000)
		num++;
	int pro =  num*1000;
	int change = n - pro;
	cout<<abs(change)<<endl;
	return 0;
}


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

int main() {
    int64_t H, N;
    cin >> H >> N;
    vector<int64_t> A(N);
    for (int64_t& a : A) {
        cin >> a;
    }

    cout << (H <= accumulate(A.begin(), A.end(), (int64_t)0) ? "Yes" : "No") << endl;
}

Measured memory_bytes: 1024
#include<iostream>
#include<algorithm>
#include<math.h>
#include<queue>
#include<vector>
#include<climits>
#include<map>
#include<string>
#include<functional>
#include<iomanip>
#include<deque>
#include<random>
#include<set>
#include<bitset>
#include<cassert>

using namespace std;
typedef long long ll;
typedef double lldo;
#define mp make_pair
#define pub push_back
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
ll gcd(ll a, ll b) { if (a % b == 0) { return b; } else  return gcd(b, a % b); }
ll lcm(ll a, ll b) { if (a == 0) { return b; }return a / gcd(a, b) * b; }
template<class T>ll LBI(vector<T>& ar, T in) { return lower_bound(ar.begin(), ar.end(), in) - ar.begin(); }
template<class T>ll UBI(vector<T>& ar, T in) { return upper_bound(ar.begin(), ar.end(), in) - ar.begin(); }

ll x, box = 100;

int main() {
	cin >> x;
	for (int i = 1;; i++) {
		box *= 1.01;
		if (box >= x) {
			cout << i << endl;
			return 0;
		}
	}
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    else return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E17;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
long double EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
////////////////////////////////////////

ll cal(ll p,ll x,ll y){
    ll res=inf;
    Min(res,abs(p-x)+abs(x-y));
    Min(res,abs(p-y)+abs(y-x));
    return res;
}


int main(){fastio;
    ll a,b,q;cin>>a>>b>>q;
    ll s[a];rep(i,0,a-1)cin>>s[i];
    ll t[b];rep(i,0,b-1)cin>>t[i];
    while(q--){
        ll p;cin>>p;
        ll x=lower_bound(s,s+a,p)-s;
        ll y=lower_bound(t,t+b,p)-t;
        ll ans=inf;
        rep(i,-2+x,x+2){
            rep(j,-2+y,y+2){
                if(0<=i&&i<=a-1&&0<=j&&j<=b-1)Min(ans,cal(p,s[i],t[j]));
            }
        }
        cout<<ans<<endl;
    }
    return 0;
}


Measured memory_bytes: 2944
s = gets.chomp!


def judge?(s)
  return false if s.size.odd?
  half = s.size / 2 - 1
  s[0..half] == s[(half + 1)..-1]
end

i = 2
size = s.size
loop do
  if judge?(s[0..(size - i - 1)])
    puts size - i
    exit
  end

  i += 2
end


Measured memory_bytes: 1788
n = gets.to_i
te = n.times.map{ gets.split.map(&:to_i) }.sort_by!{|t,e|e}

b = 0
f = true
te.each do |t,e|
  
  b += t
  if e < b
    puts "No"
    exit
  end
end

puts "Yes"

Measured memory_bytes: 22520
#include <iostream>
#include <algorithm>
using namespace std;
int main(void){
    int N;
    cin>>N;
    int R[N];
    for(int i=0;i<N;i++){
        cin>>R[i];
    }
    int maxv=-2000000000,minv=R[0];
    for(int i=1;i<N;i++){
        maxv=max(maxv,R[i]-minv);
        minv=min(minv,R[i]);
    }
    cout<<maxv<<endl;
    
}



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

using namespace std;

//#define fr(i,s,e) for(i=s;i<e;i++)

int main() {
    int a,b;
    cin>>a>>b;
    if(b>=a)
        cout<<a;
    else
        cout<<a-1;
return 0;
}


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

while True:
    x,y,s = map(int,input().split())
    if (x,y,s) == (0,0,0):
        break
    ans = 0
    for i in range(1,s-1):
        for j in range(1,s-i + 1):
            if i*(100+x)//100 + j*(100+x)//100== s:
                ans = max(ans,i*(100+y)//100 + j*(100+y)//100)
    print(ans)

Measured memory_bytes: 6724
import java.util.*;
import java.io.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
        FastScanner sc = new FastScanner(System.in);
        char[] s = sc.next().toCharArray();
        char[] t = sc.next().toCharArray();
        ArrayList<ArrayList<Integer>> map = new ArrayList<ArrayList<Integer>>();
        for(int i = 0; i < 26; i++){
            map.add(new ArrayList<Integer>());
        }
        int i = 0;
        for(char c : s){
            map.get(c-'a').add(i);
            i++;
        }
        long ans = 0;
        int prev = -1;
        for(char c : t){
            ArrayList<Integer> li = map.get(c-'a');
            if(li.size() == 0){
                System.out.println(-1);
                return;
            }
            int index = beamSearch(li,prev);
            if(index == li.size()){
                ans += s.length+li.get(0)-prev;
                prev = li.get(0);
            }else{
                ans += li.get(index)-prev;
                prev = li.get(index);
            }
        }
        System.out.println(ans);
    }
    
    public static int beamSearch(ArrayList<Integer> li, int p){
        int left = -1;
        int right = li.size();
        while(right-left > 1){
            int mid = (right+left)/2;
            if(li.get(mid) <= p){
                left = mid;
            }else{
                right = mid;
            }
        }
        return right;
    }
}

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

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

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

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

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

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

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

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


Measured memory_bytes: 29396
#include <stdio.h>
#include <stdlib.h>

int main()
{
	int N;
	char S[300001];
	scanf("%d", &N);
	scanf("%s", S);
	
	int i, count = 0, max = 0;
	for (i = 0; S[i] != 0; i++) if (S[i] == 'W') count++;
	for (i = 0, count; S[i] != 0; i++) {
		if (S[i] == 'W') count--;
		if (count > max) max = count;
		if (S[i] == 'E') count++;
	}
	
	printf("%d\n", N - max - 1);
	fflush(stdout);
	return 0;
}

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

int main() {
  string s;
  cin >> s;
  bool res = true;
  map<char, int> ma;
  for (int i = 0; i < s.size(); i++) {
    if (ma[s[i]] != 0) {
      res = false;
      break;
    } else {
      ma[s[i]] = 1;
    }
  }
  if (res) {
    cout << "yes" << endl;
  } else {
    cout << "no" << endl;
  }
}

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

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

    ll cnt1 = 0;
    ll cnt2 = 0;
    if(k % 2 == 0){
        cnt1 = n / k;
        cnt2 = n / (k / 2) - cnt1;
    }
    else cnt1 = n / k;

    ll ans = cnt1 * cnt1 * cnt1;
    ans += cnt2 * cnt2 * cnt2;
    cout << ans << endl;
}

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

#define INF (INT64_MAX/2)

int main()
{
	int N;
	long long x;
	cin >> N >> x;
	vector<int> a( N );
	for( int i = 0; i < N; i++ ) {
		cin >> a[i];
	}

	long long ans = INF;
	vector<vector<int>> b( N, vector<int>( N ) );
	for( int k = 0; k < N; k++ ) {
		long long ans1 = 0;
		for( int i = 0; i < N; i++ ) {
			if( k == 0 ) b[k][i] = a[i];
			else {
				int n = (i - k + N) % N;
				b[k][i] = min( b[k - 1][i], a[n] );
			}
			ans1 += b[k][i];
		}
		ans1 += k * x;
		ans = min( ans, ans1 );
	}

	cout << ans << endl;
}


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

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

int f(char a) {
  if (a == 'T') return 10;
  if (a == 'J') return 11;
  if (a == 'Q') return 12;
  if (a == 'K') return 13;
  if (a == 'A') return 14;
  return a - '0';
}

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  
  char tr;
  while (cin >> tr, tr != '#') {
    vector<vector<string>> ca(4, vector<string>(13));
    for (int i = 0; i < 4; i++) {
      for (int j = 0; j < 13; j++) {
        cin >> ca[i][j];
      }
    }

    int lead = 0, NS = 0, EW = 0;
    for (int j = 0; j < 13; j++) {
      int next = -1;
      for (int i = 0; i < 4; i++) {
        if (ca[i][j][1] == tr && (next < 0 || f(ca[i][j][0]) > f(ca[next][j][0]))) next = i;
      }
      if (next < 0) {
        for (int i = 0; i < 4; i++) {
          if (ca[i][j][1] == ca[lead][j][1] && (next < 0 || f(ca[i][j][0]) > f(ca[next][j][0]))) next = i;
        }
      }
      if (next & 1) EW++;
      else NS++;
      lead = next;
    }
    cout << (NS > EW ? "NS" : "EW") << " " << max(NS, EW) - 6 << endl;
  }

  return 0;
}


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

using namespace std;

int main()
{
    int a[100000] = {0};
    int n, q;
    cin >> n >> q;

    for (int i = 0; i < q; i++) {
        int com, x, y;
        cin >> com >> x >> y;
        if (com == 0) {
            a[x] += y;
        }
        else {
            int sum=0;
            for (int j = x; j <= y; j++) {
                sum += a[j];
            }
            cout << sum << endl;
        }
    }
    return 0;
}

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

using namespace std;


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

  int x;
  int pre = 0;
  vector<bool> b(n + 1, true);

  b[0] = true;

  for (int i = 0;
       i < m;
       ++i)
    {
      cin >> x;
      for(int j = pre;
          j < x;
          ++j)
        {
          b[j] = true;
        }
      b[x] = false;
      pre = x + 1;
    }
  vector<int> dp(n + 1,0);
  dp[0] = 1;

  for (int i = 0;
       i < n + 1;
       ++i)
    {
      for(int j = i + 1;
          j <= min(n, i + 2);
          ++j)
        {
          if(b[j])
            {
              dp[j] = (dp[j] + dp[i]) % 1000000007;
            }
        }
    }
  cout << dp[n] << endl;
  return 0;
}


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

int main(void){
	char str[200], ans[100];

	cin >> str;
	cin >> ans;

	//????????°????????\
	int ansLen = strlen(ans), strLen = strlen(str);
	for (int i = 0; i < ansLen; i++){
		str[strLen + i] = str[i];
		if (i == ansLen - 1){
			str[strLen + i + 1] = '\0';
		}
	}

	//??¢?´¢
	strLen += ansLen;
	for (int i = 0, j=0; i < strLen; i++){
		j = 0;
		for (int k = i; k < strLen; k++){
			//??§???
			if (str[k] == ans[j]){
				j++;
			}
			else {
				j = (str[k] == ans[0]) ? 1 : 0;
			}

			//????????????
			if (ans[j] == '\0'){
				cout << "Yes\n";
				return 0;
			}
			else if (str[i + 1] == '\0'){
				break;
			}
		}

		//????????????
		if (str[i+1] == '\0'){
			cout << "No\n";
			break;
		}
	}

	return 0;
}

Measured memory_bytes: 1108