akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll, ll> Pll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repn(i, n) for (int i = 0; i <= (int)(n); i++)
#define srep(i, l, n) for (int i = l; i < (int)(n); i++)
#define srepn(i, l, n) for (int i = l; i <= (int)(n); i++)
#define pb push_back 
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

const int MOD = 1000000007;
const int INF = 1e9;
#define PI 3.14159265369;
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};
int ddx[8] = {1,1,1,-1,-1,-1,0,0};
int ddy[8] = {0,1,-1,0,1,-1,1,-1};

const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }
 
  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

int main(){
	int n;
	string s;
	cin >> n >> s;
	int num[26];
	fill(num, num+26, 0);
	rep(i,n){
		int now = s[i]-'a';
		num[now]++;
	}
	mint ans = 1;
	rep(i,26){
		ans *= (num[i]+1);
	}
	ans-=1;
	cout << ans.x << endl;

}

Measured memory_bytes: 512
n,m=map(int,input().split())
if m==0:
    print(10**(n-1) if n>1 else 0)
    exit()
d=[-1]*(n+1)
for i in range(m):
    s,c=map(int,input().split())
    if s==1 and c==0:
        if n==1:
            pass
        else:
            print(-1)
            exit()

    if d[s]==c:
        continue
    elif d[s]!=c and d[s]==-1:
        d[s]=c
    else:
        print(-1)
        exit()
for i in range(n+1):
    if d[i]==-1:
        d[i]=0
if all(d[i]==0 for i in range(1,n+1)):
    print(10**(n-1) if n>1 else 0)
    exit()
if d[1]==0:
    d[1]=1
print("".join(list(map(str,d[1:]))))


Measured memory_bytes: 38492
import numpy as np
N, M, Q, *X = map(int, open(0).read().split())
sheet = [[0]*N for i in range(N)]
for l, r in zip(*[iter(X[:2*M])]*2):
  sheet[N-l][r-1] += 1

sheet = np.cumsum(np.cumsum(sheet,axis=1),axis=0)
for p,q in zip(*[iter(X[2*M:])]*2):
  print(sheet[N-p][q-1])

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

int main(){
    string a,b;
    cin >> a >> b;
    if(a.size() > b.size()){
        cout << "GREATER" << endl;
    }else if(b.size() > a.size()){
        cout << "LESS" << endl;
    }else if(a.size() == b.size()){
        for(int i = 0; i < a.size(); i++){
            if(int(a[i]-'0') > int(b[i]-'0')){
                cout << "GREATER" << endl;
                return 0;
            }else if(int(a[i]-'0') < int(b[i]-'0')){
                cout << "LESS" << endl;
                return 0;
            }
        }
        cout << "EQUAL" << endl;
    }
}

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

using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
#include <string>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <cmath>
#include <climits>
#include <bitset>
#include <array>
#include <deque>
#include <queue>
#include <map>
#include <limits>
#define all(x) (x).begin(),(x).end()

void solve(){

}
bool pls_comp(pair<int,int> a, pair<int,int> b) {
    return a.first < b.first; // 0, 1, 2, ...
    // return strcmp(a.second.c_str(), b.second.c_str()) < 0; // a, b, c, ...
}
int main(){
    int N,M;
    cin >> N >> M;
    vector<pair<int,int>> a;
    int x,y;
    for (int i = 0; i < M; i++){
        cin >> x >> y;
        a.push_back(make_pair(x,y));
    }
    sort(all(a));
    //cout << binary_search(all(a), make_pair(1,8), pls_comp) << endl;
    /*
    auto c = lower_bound(all(a),make_pair(2,0),pls_comp);
    cout << c - a.begin() << endl;
    cout << c -> first << ' ' << c -> second << endl;
    c++;
    cout << c -> first << ' ' << c -> second << endl;
    */

    //pair<int,int> c =  lower_bound(all(a),a[0], [](pair<int,int> lhs, pair<int,int> rhs) -> bool { return lhs.second < rhs.second; });
    //cout << c.second << endl;
    bool ans = false;
    for (int i = 0; i < M; i++){
        if (a[i].first == 1){
            if (binary_search(all(a),make_pair(a[i].second,0), pls_comp)) {
                auto c = lower_bound(all(a),make_pair(a[i].second,0),pls_comp);
                auto tmp = c;
                while (tmp -> first == c -> first){
                    if (c -> second == N){
                        ans = true;
                    }
                    c++;
                }
            }
        }
    }
    if (ans){
        cout << "POSSIBLE" << endl;
    } else {
        cout << "IMPOSSIBLE" << endl;
    }




    return 0;
}


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

int main(){
  int N; cin >> N;
  
  int page = N / 2;
  
  if(N % 2 == 0){
    cout << page << endl;
  }
  
  if(N % 2 == 1){
    cout << page + 1 << endl;
  }
  
}

Measured memory_bytes: 3588
#include <algorithm>
#include <deque>
#include <iostream>
#include <map>
#include <vector>

using namespace std;

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

  bool is_reverse = false;
  deque<int> deq;
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    if (is_reverse) {
      deq.push_front(a);
    } else {
      deq.push_back(a);
    }
    is_reverse = !is_reverse;
  }
  vector<int> ans(n);
  int i = 0;
  for (auto it = deq.begin(); it != deq.end(); it++) {
    ans[i++] = *it;
  }

  if (is_reverse) {
    reverse(ans.begin(), ans.end());
  }
  for (int i = 0; i < n; i++) {
    cout << ans[i];
    cout << (i == n - 1 ? "\n" : " ");
  }
  return 0;
}

Measured memory_bytes: 3840
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <iostream>

using namespace std;

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

    return 0;
}


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

int main() {
	//input
	int64_t N, A, B;
	cin >> N >> A >> B;

	//calculation
	int64_t sum = A + B;
	int64_t rem = N % sum;
	int64_t quo = N / sum;
	int64_t output = quo * A;

	if (rem <= A) {
		output += rem;
	}else{
		output += A;
	}

	//output
	cout << output << endl;


	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <complex>
#include <utility>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <tuple>
#include <cmath>
#include <bitset>
#include <cctype>
#include <set>
#include <map>
#include <unordered_map>
#include <numeric>
#include <functional>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
inline void Yes(bool condition){ if(condition) PRINT("Yes"); else PRINT("No"); }
template<class itr> void cins(itr first,itr last){
    for (auto i = first;i != last;i++){
        cin >> (*i);
    }
}
template<class itr> void array_output(itr start,itr goal){
    string ans = "",k = " ";
    for (auto i = start;i != goal;i++) ans += to_string(*i)+k;
    if (!ans.empty()) ans.pop_back();
    PRINT(ans);
}
ll gcd(ll a, ll b) {
    return a ? gcd(b%a,a) : b;
}
const ll INF = 1e9;
const ll MOD = 1000000007;
const ll MOD2 = 998244353;
typedef pair<ll,ll> P;
typedef pair<double,double> point;
const ll MAX = 200005;
constexpr ll nx[8] = {1,0,-1,0,1,-1,1,-1};
constexpr ll ny[8] = {0,1,0,-1,1,1,-1,-1};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,m;
    cin >> n >> m;
    string s;
    cin >> s;
    reverse(all(s));
    ll now = 0;
    vector<ll> ans;
    while(now < n){
        ll nxt = -1;
        rep(i,1,min(n-now,m)+1){
            if (s[now+i] == '0') nxt = now+i;
        }
        if (nxt == -1){
            PRINT(-1);
            return 0;
        }
        ans.push_back(nxt-now);
        now = nxt;
    }
    reverse(all(ans));
    array_output(all(ans));
}


Measured memory_bytes: 1732
import java.util.*;
public class Main{
public static void main(String[]a){
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
int m=sc.nextInt();
int s[]=new int[m];
for(int i=0;i<m;i++)s[i]=sc.nextInt();
boolean check=false;
while(!check){
check=true;
String p=n+"";
String ss[]=p.split("",0);
for(int i=0;i<ss.length;i++){
for(int j=0;j<m;j++){
if(ss[i].equals(s[j]+"")){n++;check=false;break;}
}if(!check){break;}
}}
System.out.println(n);

}
}


Measured memory_bytes: 63008
#include <iostream>

int count(int &counter, int n, int x,int t){
    if(n >= x){
        counter += t;
        return count(counter, n-x,x,t);
    }else if((n < x) && (n != 0)){
        counter += t;
        return counter;
    }else{
        return counter;
    }
}

int main() {
    int n,x,t;
    int counter;
    std::cin >> n >> x >>t;

    std::cout << count(counter,n,x,t) << std::endl;
    return 0;
}


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

int main()
{
	double value;
	
	while(cin >> value)
	{
		double min_t = value/9.8;
		double just = 4.9*min_t*min_t;
		int number = (just+10)/5.0;
		cout << number << endl;
	}
	return 0;
}

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

int main(){
  int H, W, N;
  cin >> H >> W >> N;
  
  int k = max(H, W);
  int ans;
  
  if (N % k == 0){
    ans = N / k;
  }
  else {
    ans = (N / k) + 1;
  }
  
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#include <algorithm>
#include <string>
using namespace std;
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    int H, W, h, w;
    cin >> H >> W >> h >> w;
    cout << ((H - h) * (W - w)) << endl;
    return 0;
}

Measured memory_bytes: 256
i,a[100],k,m,t;main(n){while(scanf("%d%d",&n,&m),n|m){for(i=0;i<n*m;scanf("%d",&t),a[i++%m]+=t);n=m;while(n--){for(t=i=0;i<m;++i)t=t<a[i]?a[k=i]:t;printf("%d%c",k+1,n?32:10),a[k]=0;}}}

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

#define rep(i,x,y) for(ll i=(x);i<(y);i++)
#define rrep(i,x,y) for(ll i=(ll)(y)-1;i>=(x);i--)
#define all(x) (x).begin(),(x).end()
#ifdef LOCAL
#define dump(x)  cerr << #x << " = " << (x) << endl
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl
#define dassert(...) assert(__VA_ARGS__)
#else
#define dump(x)
#define debug(x)
#define dassert(...)
#endif
//#define int long long

typedef long long ll;
const ll MOD = 1e9 + 7;
const long double EPS = 1e-8;

void solve(long long L){
    cout << fixed << setprecision(16) << pow((double)L / 3, 3) << endl;
}

signed main(){
    // ios_base::sync_with_stdio(false);
    // cin.tie(NULL);
    long long L;
    scanf("%lld",&L);
    solve(L);
    return 0;
}


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

int main() {
  int N;
  cin >> N;
  
  string A = "Three";
  
  for (int i = 0; i < N; i++) {
    string x;
    cin >> x;
    if (x == "Y") {
      A = "Four";
    }
  }
  cout << A << endl;
}

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

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

Measured memory_bytes: 256
def solve():
    a, b = read()
    result = think(a, b)
    write(result)


def read():
    return read_int(2)

def read_int(n):
    return list(map(lambda x: int(x), read_line().split(' ')))[:n]


def read_float(n):
    return list(map(lambda x: float(x), read_line().split(' ')))[:n]


def read_line(n=0):
    if n == 0:
        return input().rstrip()
    else:
        return input().rstrip()[:n]


def think(a, b):
    if a < 2 * b:
        return 0
    return a - 2 * b


def write(result):
    print(result)


if __name__ == '__main__':
    # import doctest
    # doctest.testmod()
    # import sys
    # sys.setrecursionlimit(10000)
    solve()


Measured memory_bytes: 3064
#include<iostream>
#include<math.h>
#include<cstdio>
using namespace std;
int main(){
	while(1){
		int a,b,c,d,e,f;
		cin>>a>>b>>c>>d>>e>>f;
		if(cin.eof()) {break;}
		double d1,d2,d3;
		d1=a*e-b*d;
		d2=c*e-b*f;
		d3=a*f-c*d;
                double x=d2/d1,y=d3/d1;
		if(x<0&&y<0)
		    printf("-%.3f -%.3f\n",fabs(x),fabs(y));
                if(x<0&&y>=0)
		    printf("-%.3f %.3f\n",fabs(x),fabs(y));
		if (x>=0&&y<0)
		    printf("%.3f -%.3f\n",fabs(x),fabs(y));
		if (x>=0&&y>=0)
		    printf("%.3f %.3f\n",fabs(x),fabs(y));
	}
	return 0;	
}

Measured memory_bytes: 1192
#include<iostream>
#include<vector>
#include <cmath>
#include <map>
using namespace std;
int main(void){
    int N;
    cin>>N;
    vector<int> a(4,0);
    a[0]=N/1000;
    N=N-1000*a[0];
    a[1]=N/100;
    N=N-100*a[1];
    a[2]=N/10;
    a[3]=N%10;

    bool b=false;
    for(int i=0;i<3;i++){
        if(a[i]==a[i+1]){
            b=true;
        }
    }

        if(b==true){
           cout<<"Bad"<<endl;
        }else{
            cout<<"Good"<<endl;
        }
    
    return 0;
}

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

const ll INF = 1001001001;


int main(){
  string s;
  cin>>s;
  rep(i,s.size()){
    cout<<'x';
  }
}

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

int main()
{

  int sum = 0 , com = 0;

  while(1)
    {
      int th = 0;

      cin >> sum >> com;
      if( sum == 0 && com ==0 ) break;
      
      for( int i = 1; i <= sum; i++ )
	{
	  for( int j = 1; j <= sum; j++ )
	    {  
	      for( int k = 1; k <= sum; k++ )
		{
		  if( i + j + k == com && i != j && i != k && j != k )
		    {
		      th++;
		     
		    }

		}
	    }
	}

 cout << th / 6 << "\n";

    }

  return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=3e5+5,mod1=998244353,mod2=1000000007,mod3=2333;
int n,x=799633,invx1,invx2,invx3;
ll sum1=1,sum2=1,sum3=1;
ll s1[N],s2[N],s3[N];
char s[N];
ll inv(ll x,ll mod){return x==1?x:(mod-mod/x)*inv(mod%x,mod)%mod;}
struct node
{
    ll s1,s2,s3;
    node(ll s1=0,ll s2=0,ll s3=0):s1(s1),s2(s2),s3(s3){}
    void add()
    { s1=(s1+sum1)%mod1;s2=(s2+sum2)%mod2;s3=(s3+sum3)%mod3;}
    void sub()
    { s1=(s1+mod1-sum1)%mod1;s2=(s2+mod2-sum2)%mod2;s3=(s3+mod3-sum3)%mod3;}
    bool operator<(const node&o)const
    {
        if(s1==o.s1&&s2==o.s2) return s3<o.s3;
        if(s1==o.s1) return s2<o.s2;
        return s1<o.s1;
    }
};
void div()
{
    sum1=sum1*invx1%mod1;
    sum2=sum2*invx2%mod2;
    sum3=sum3*invx3%mod3;
}
void mul()
{
    sum1=sum1*x%mod1;
    sum2=sum2*x%mod2;
    sum3=sum3*x%mod3;
}
node f[N];
map<node,int>mp;
int main()
{
    invx1=inv(x%mod1,mod1);
    invx2=inv(x%mod2,mod2);
    invx3=inv(x%mod3,mod3);
    scanf("%d",&n);
    scanf("%s",s+1);
    for(int i=1;i<=n;i++)
    {
        f[i]=f[i-1];
        if(s[i]=='>') div();
        if(s[i]=='<') mul();
        if(s[i]=='+') f[i].add();
        if(s[i]=='-') f[i].sub();
        mp[f[i]]++;
    }
    sum1=sum2=sum3=1;
    node now;
    ll ans=mp[f[n]];
    for(int i=1;i<=n;i++)
    {
        mp[f[i]]--;
        if(s[i]=='>') div();
        if(s[i]=='<') mul();
        if(s[i]=='+') now.add();
        if(s[i]=='-') now.sub();
        node p=now;
        p.s1=(p.s1+f[n].s1*sum1)%mod1;
        p.s2=(p.s2+f[n].s2*sum2)%mod2;
        p.s3=(p.s3+f[n].s3*sum3)%mod3;
        ans+=mp[p];
    }
    printf("%lld\n",ans);
}


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

using namespace std;
int main(){
  string str,str2;
  int okisa,omozi=0;
  cin >> str;
  okisa=str.size();
  str2=str.substr(2, okisa-3);
  for(int i=0;i!=okisa;i++){
    if((str[i]>='A') && (str[i]<='Z')) omozi++;
  }
  if(str.front()!='A'){
    cout << "WA" << endl;
  }
  else if(str2.find("C")==-1){
    cout << "WA" << endl;
  }
  else if(omozi!=2){
    cout << "WA" << endl;
  }
  else{
    cout << "AC" << endl;
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int i,j;
int main (){
  bool w=true;
 string s,t;
  cin >> s >> t;
  for(i=0;i<s.size();i++)
  {
    if(s.at(i)!=t.at(i)) 
    {
      w=false;
      break;
    }
  }
  if(w) 
  {
    cout << "Yes" << endl;
  }
  else
  {
    cout << "No" << endl;
  }
  
    
}
  

Measured memory_bytes: 3624
import std.algorithm,
       std.string,
       std.range,
       std.stdio,
       std.conv;

void chmax(T)(ref T a, ref T b) {
  if (a < b) {
    a = b;
  }
}

void main() {
  int   N = readln.chomp.to!int;
  int[] s = N.iota.map!(_ => readln.chomp.to!int).array;
  bool[10010][110] dp;
  dp[0][0] = true;
  dp[0][s[0]] = true;

  foreach (i; 1..N) {
    foreach (j; 10010.iota) {
      if (dp[i - 1][j]) {
        dp[i][j+s[i]] = true;
        dp[i][j]      = true;
      }
    }
  }

  int ans;

  foreach (i; 10010.iota) {
    if (dp[N-1][i]) {
      if (i % 10) {
        chmax(ans, i);
      }
    }
  }

  writeln(ans);
}

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

const int INF = 0x3f3f3f3f;

typedef complex<double> P;

int main(){
    int N, W, D;
    cin >> N >> W >> D;
    int L = 2 * (W + D);
    P p1 = P(W, 0);
    P p2 = P(W, D);
    P p3 = P(0, D);
    P C = P(0, -1);
    
    //end, start
    vector<pair<int, int>> lines;
    
    for(int i=0; i<N; i++){
        int x, y; string f;
        cin >> x >> y >> f;
        P p = P(x, y);
        
        switch (f[0]) {
            case 'W':
                p = (p - p3) * C + p3;
            case 'N':
                p = (p - p2) * C + p2;
            case 'E':
                p = (p - p1) * C + p1;
            default:
                break;
        }
        lines.emplace_back(p.real()+p.imag(), p.real()-p.imag());
    }
    sort(lines.begin(), lines.end());
    
    int ans = INF;
    for(int s=0; s<N; s++){
        int tans = 0;
        int p = lines[0].first;
        for(int i=0; i<N; ){
            while(i<N && lines[i].second <= p) i++;
            p = lines[i].first;
            tans++;
        }
        ans = min(ans, tans);
        
        lines[0].first += L;
        lines[0].second += L;
        sort(lines.begin(), lines.end());
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3172
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <iomanip>
#include <stack>
#include <queue>
#include <numeric>
#include <map>
#include <unordered_map>
#include <set>
#define rep(i,n) for(ll i=0;i<(n);i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define pb push_back
#define mod 1000000007
using ll = long long;
using namespace std;

int main(){
  string s,t;
  cin >> s >> t;
  ll ssize = (ll)s.size();
  ll tsize = (ll)t.size();
  // -1  check
  ll s__ [26] = {0};
  rep(i,ssize) s__[(ll)(s[i]-'a')]++;
  rep(i,tsize){
    if(s__[(ll)(t[i]-'a')] == 0){
      cout << -1 << endl;
      return 0;
    }
  }
  ll tpos = 0;
  ll lasts=0;
  rep(i,ssize){
    if(t[tpos]==s[i]){
      tpos++;
      lasts = i ;
    }
    if(tpos==tsize){
      cout << lasts+1 << endl;
      return 0;
    }
  }

  ll ans = 0;
  vector<vector<ll>> pos(26);
  rep(i,ssize){
    pos[(ll)(s[i]-'a')].pb(i);
  }
  rep(i,26){ pos[i].pb(1e9);}
  ll nowpos = 0;//pos[t[0]-'a'][0];
  bool flag = true;
  if(t[0]==s[0])flag= false;

  for(ll i=0;i<tsize;i++){

    ll lastpos = nowpos;
    //cout << nowpos << " ";
    ll dst;
    ll next = *upper_bound(all(pos[t[i]-'a']),nowpos);
    //cout << next << " ";
    if(next==1e9) {
      next = pos[t[i]-'a'][0];
      nowpos = next;
      dst = ssize-lastpos+nowpos;
    }
    else{
      nowpos = next;
      dst = nowpos-lastpos;

    }
    //cout << dst << endl;
    if(!flag && i==0){dst = 1;}
    ans += dst;
  }
  if(flag)cout << ans+1 << endl;
  else cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1724
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    ios_base::sync_with_stdio(false);
    int a,b,c;
    cin>>a>>b>>c;
    if(a-b>=c)cout<<0;
    else cout<<c-(a-b);
    return 0;
}


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

// #define ANS  //for answer
#define CMP  //for compe
#ifdef CMP
using namespace std;
#else
#endif

#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
#define nv(x) #x, (x)
#define ncv(x) #x, ":", (x)
#define ncvc(x) #x, ":", (x), ","
using ll = long long;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
void pPRINT(std::ostream& ost) {}
template <class T, class... U>
void pPRINT(std::ostream& ost, const T t, const U... u) {
  ost << t << " ";
  pPRINT(ost, u...);
}
template <class... T>
void PRINT(const T... t) { pPRINT(std::cout, t...); }
template <class... T>
void PRINTl(const T... t) {
  pPRINT(std::cout, t...);
  std::cout << "\n";
}
template <class T>
void PRINTa(const T* const t, const ll size) {
  REP(i, size)
  PRINT(t[i]);
  PRINTl();
}
template <class T>
void PRINTal(const T* const t, const ll size) {
  REP(i, size)
  PRINTl(i, ":", t[i]);
}
#ifndef DBG
#define DEBUG(...)
void init() {}
#else
#define DEBUG(...)                                                     \
  {                                                                    \
    PRINT("##DEBUG##", "file :", __FILE__, ", line :", __LINE__, "["); \
    PRINT(__VA_ARGS__);                                                \
    PRINTl("]");                                                       \
  }
void init() {
  DEBUG("INIT");
  cin.tie(0);
  ios::sync_with_stdio(false);
}
#endif
#ifdef ANS
#else
#endif

void solve();

int main(int argc, char* argv[]) {
  DEBUG("MAIN");
  init();
  solve();

  return 0;
}

void solve() {
  DEBUG("SOLVE START");

  ll a, b;
  cin >> a >> b;
  if (a > 9 || b > 9)
    PRINT(-1);
  else
    PRINT(a * b);

  return;
}

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

#define REP(i,num) for(int i=0;i<(num);++i)
#define LOOP(i) while(i--)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto pitr=c.begin();pitr!=c.end();++pitr){cout<<*pitr;if(next(pitr,1)!=c.end())cout<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);
	
	string S=in<string>();
	int N=S.size();

	vector<vector<short>> dp(N+1,vector<short>(2019,0));
	dp[0][0] = 0;
	REP(i,N){
		int M=S[i]-'0';
		dp[i+1][M] += 1;
		REP(j,2019){
			int V=j*10+(S[i]-'0');
			M=V%2019;
			dp[i+1][M] += dp[i][j];
		}
	}
	
	int sum=0;
	REP(i,N+1){
		sum+=dp[i][0];
	}
	out(sum);
	return 0;
}


Measured memory_bytes: 798748
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class Program
{
    static void Main(string[] args)
    {
        int n = int.Parse(Console.ReadLine());
        int[] arr = Console.ReadLine().Split(' ').Select(v => int.Parse(v)).ToArray();
        int[] ansArr = new int[n];
        foreach(int element in arr)ansArr[element - 1]++;
        foreach (int ans in ansArr) Console.WriteLine(ans);
        


    }

  

 
   



}



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

using namespace std;
typedef long long ll;
const int MAXN = 200100;

int N, Q;
vector <int> edge[MAXN];
int ans[MAXN];

void flood (int cloc, int last)
{
    if (last != -1)
        ans[cloc] += ans[last];
    for (int neigh : edge[cloc])
        if (neigh != last)
            flood (neigh, cloc);
}

int main()
{
    ios_base::sync_with_stdio(0);
    
    cin >> N >> Q;
    for (int i = 0; i < N - 1; i++)
    {
        int x, y;
        cin >> x >> y;
        x--, y--;
        edge[x].push_back(y);
        edge[y].push_back(x);
    }

    for (int i = 0; i < N; i++)
        ans[i] = 0;
    for (int i = 0; i < Q; i++)
    {
        int p, x;
        cin >> p >> x;
        ans[p-1] += x;
    }

    flood (0, -1);
    for (int i = 0; i < N; i++)
    {
        if (i) cout << " ";
        cout << ans[i];
    }
    cout << "\n";
}

Measured memory_bytes: 23552
// This is the start of  template//
#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
#define int long long int
#define vll vector<int>
#define pb push_back
#define pll pair<int,int>
#define mp(a,b) make_pair(a,b)
#define ff first
#define ss second
void input(){
#ifndef ONLINE_JUDGE 
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout); 
#endif
}
#define INF LONG_LONG_MAX
#define mod 1000000007
#define array(a,n) vll a(n); rep(i,0,n) cin>>a[i];
#define all(x) x.begin(),x.end()
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define cases int t; cin>>t; while(t--)
#define printall(a) rep(i,0,a.size()) cout<<a[i]<<" "; cout<<endl;
int power(int a,int n)
{
    if(n==0)
        return 1;
    if(n%2!=0)
    {
        return (a*power((a*a),n/2));
    }
    return power((a*a),n/2);
}
int lcm(int a,int b)
{
  return (a*b)/__gcd(a,b);
}


int32_t main()
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);
//  input();
  int n;
  cin>>n;
  string a = "ACL";
  for(int i = 0;i<n ;i++)
    cout<<a;
}

//

Measured memory_bytes: 3620
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text.RegularExpressions;
using System.Diagnostics;

//var input = Console.ReadLine().Split().Select(int.Parse).ToArray();
namespace AtCoderSolve
{
    
    class Solve
    {
        const int mod = 1000000007;
        
        
        static void Main(string[] args)
        {

            //var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            //Console.SetOut(sw);

            
            var input = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int M = input[0];
            int D = input[1];


            long ans = 0;
            for(var i = 1; i <= M; i++)
            {
                for(var j = 1; j <= D; j++)
                {
                    if (j < 10) { continue; }
                    int d10 = (j - j % 10) / 10;
                    int d1 = j % 10;
                    if (d1 >= 2 && d10 >= 2 && d1 * d10 == i) 
                    {
                        ans++;
                    }
                }
            }

            Console.WriteLine(ans);


            //Console.Out.Flush();

        }

        
    }

    public class Calculation
    {

    }

    public class Graph
    {
        
    }
}



Measured memory_bytes: 13268
#include <bits/stdc++.h>
#define endl '\n'
#define pb push_back
#define mp make_pair
#define int long long
#define INF 0x3f3f3f3f
#define Inf 1000000000000000000LL
#define F first
#define S second
using namespace std;
typedef pair<int,int>pii;
const int mod=1e9+7;
const int inv=500000004;
int n,sum;
int a[200010];
signed main(){
	cin>>n;
	for(int i=1;i<=n;i++)cin>>a[i],sum=(sum+a[i])%mod;
	int ans=0;
	for(int i=1;i<=n;i++){
		ans=(ans+a[i]*(sum+mod-a[i])%mod)%mod;
	}
	cout<<ans*inv%mod<<endl;
	return 0;
}


Measured memory_bytes: 5184
#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <string>
#include <sstream>
#include <algorithm>
#include <random>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#include <cassert>
#include <climits>
#include <bitset>
#include <functional>

#define FOR_LT(i, beg, end) for (int i = beg; i < end; i++)
#define FOR_LE(i, beg, end) for (int i = beg; i <= end; i++)
#define FOR_DW(i, beg, end) for (int i = beg; end <= i; i--)

using namespace std;

template <class T>
class UnionFind
{
public:
	struct Elem {
		int i;
		int num; // root 以外は無効
		T   val;
	};

	UnionFind(int min, int max)
		: elems_(max - min + 1)
		, min_(min)
		, rank_(max - min + 1)
	{
		for (int i = min; i <= max; i++) {
			Elem& elem = this->elems_[i - min];
			elem.i = i;
			elem.num = 1;
		}
	}

	Elem& find(int i) {
		vector<int> res_idxs;

		while (true) {
			int idx = i - this->min_;
			if (this->elems_[idx].i == i) {
				// 簡略化
				for (int res_idx : res_idxs) {
					this->elems_[res_idx].i = i;
				}

				return this->elems_[idx];
			}

			res_idxs.push_back(idx);
			i = this->elems_[idx].i;
		}
	}

	int size(int i) {
		Elem& root = this->find(i);
		int idx = root.i - this->min_;
		return this->elems_[idx].num;
	}

	int rank() {
		return rank_;
	}

	void merge(int i, int j) {
		Elem& i_root = this->find(i);
		Elem& j_root = this->find(j);
		if (i_root.i == j_root.i) return;

		int i_idx = i_root.i - this->min_;
		int j_idx = j_root.i - this->min_;

		int i_size = this->elems_[i_idx].num;
		int j_size = this->elems_[j_idx].num;

		if (i_size < j_size) {
			this->elems_[i_idx].i = j_root.i;
			this->elems_[j_idx].num += this->elems_[i_idx].num;
		}
		else {
			this->elems_[j_idx].i = i_root.i;
			this->elems_[i_idx].num += this->elems_[j_idx].num;
		}
		this->rank_--;
	}

private:
	vector<Elem> elems_;
	int          min_;
	int          rank_;
};


int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	uint32_t n, m, q; cin >> n >> m >> q;

	UnionFind<int> uf1 = UnionFind<int>(0, n - 1);
	vector<pair<int, int>> us;

	FOR_LT(i, 0, q) {
		int a, b, c; cin >> a >> b >> c;
		if (c == 0) uf1.merge(a, b);
		else        us.push_back({ a,b });
	}

	if (m == n - 1) {
		if (us.size() != 0) {
			cout << "No" << endl;
		}
		else {
			cout << "Yes" << endl;
		}
		return 0;
	}

	{
		for (const auto& s : us) {
			if (uf1.find(s.first).i == uf1.find(s.second).i) {
				cout << "No" << endl;
				return 0;
			}
		}
	}

	int64_t k   =  uf1.rank();
	int64_t mmax = (n - k) + k * (k - 1) / 2;
	if (m <= mmax) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;
}

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

int main()
{
  char s[101];
  scanf("%s",s);
  int len = strlen(s);

  int hug = 0;
  for(int i = 0; i < (len/2); i++) {
    if (s[i] != s[len-i-1]) {
      hug++;
    }
  }

  printf("%d\n",hug);

  return 0;
}


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

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

    int N; cin>>N;
    int* d_list= new int[N];
    rep(i,N){
        int d; cin>>d;
        d_list[i]=d;
    }
    sort(d_list, d_list+N);
    int ans = d_list[N/2] - d_list[N/2-1];
    cout << ans << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define f(i, k, n) for (int i = k; k < n ? i < n : i > n; k < n ? i += 1 : i -= 1)
#define ll long long
#define pb push_back
#define fr first
#define sc second
#define len(s) s.size()
#define all(v) v.begin(), v.end()
#define tr(it, v) for (auto &it : v)
#define bit(x) __builtin_popcount(x)
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef map<int, int> mii;
typedef vector<pii> vpii;
typedef vector<vi> vvi;
// =================
void impgraph(int n, int m);
void dfs(int u, int par);

const int mod = 1e9;
const int N = 3e5 + 1;

vi g[N];
int a[N];

void solve()
{
    int n, m, ans = 0, k;
    cin >> n >> k;
    vi h(n);
    tr(it, h) cin >> it;
    vi dp(n, mod);
    dp[0] = 0;
    f(i, 0, n)
        f(j, i + 1, i + k + 1) if (j < n)
    {
        dp[j] = min(dp[j], dp[i] + abs(h[j] - h[i]));
    }
    cout << dp[n-1];
}

int main()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    int t = 1;
    //cin >> t;
    while (t--)
        solve();
    return 0;
}

void impgraph(int n, int m)
{
    int i, u, v;
    while (m--)
    {
        cin >> u >> v;
        g[u].pb(v);
        g[v].pb(u);
    }
}

void dfs(int u, int par)
{
    for (int v : g[u])
    {
        if (a[v])
        {
        }
        dfs(v, 0);
    }
}

Measured memory_bytes: 11116
#include <cstdint>
#include <cstdio>
#include <cmath>
#include <vector>
#include <iostream>
#include <algorithm>
#include <cassert>
#include <stack>
#include <set>
#include <sstream>
using namespace std;
 
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef long long Long;




int main()
{
	
	string S;
	cin >> S;
	int f = S.find('C');
	if(f == string::npos){
		cout << "No" << endl;
		return 0;
	}
	int s = S.find('F', f);
	if(s == string::npos){
		cout << "No" << endl;
		return 0;
	}
	cout << "Yes" << endl;
	
	
}
/*

4
5 10000
3 10000
7 10000
6 6



 */


Measured memory_bytes: 256
def main():
    import sys

    def input(): return sys.stdin.readline().rstrip()
    
    h, w = map(int, input().split())
    g = [[] for _ in range(h)]
    di = [-1, 0, 1, 0, 1, 1, -1, -1]
    dj = [0, 1, 0, -1, 1, -1, -1, 1]

    for i in range(h):
        g[i] = list(input())
        
    for i in range(h):
        for j in range(w):
            if g[i][j] == '#':
                continue
            
            cnt = 0
            for k in range(8):
                ni = i + di[k]
                nj = j + dj[k]
                if ni < 0 or ni >= h or nj < 0 or nj >= w:
                    continue
                if g[ni][nj] == '#':
                    cnt += 1
            g[i][j] = str(cnt)
    
    for i in g:
        print(''.join(i))

            



if __name__ == '__main__':
    main()

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

#define int long long

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPS(i,n) for(int i=1, i##_len=(n); i<=i##_len; ++i)

#define INF (3e15)

using namespace std;

int K;

int A[55];

signed main()
{
    cin >> K;

    int N = 50;
    REP(i, N) A[i] = i+K/50;

    REP(i, K%N)
    {
        REP(j,N)
        {
            A[j] = i == j ? A[j] + 50 : A[j]-1;
        }
    }
    cout << N << endl;
    REP(i, N)
    {
        if (i != 0) cout << " ";
        cout << A[i];
    }
    cout << endl;

    return 0;
}

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

/*
 * a<=x<=b
 * n-2この中から, a<= <=bを選ぶ
 * (b-a+1)

*/

int main(){
	ll n,a,b;
	cin >> n >> a >> b;
	if(b<a) {
		cout << 0 << endl;
		return 0;
	}
	ll left = (n-1)*a+b;
	ll right = a+(n-1)*b;
	if(right-left+1<=0) cout << 0 << endl;
	else cout << right-left+1 << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#define MAX 500001

void maxHeapify(int);
void swap(int *, int *);
int N[MAX],H;

int main() {
  int i;

  scanf("%d",&H);
  for(i = 1; i <= H; i++) {
    scanf("%d", &N[i]);
  }

  for(i = H /2; i > 0; i--) {
    maxHeapify(i);
  }

  for(i = 1; i <= H; i++) {
    printf(" %d", N[i]);
  }
  printf("\n");
  return 0;
}

void maxHeapify(int n) {
  int max_i;
  max_i = n;
  if(H >= (2 * n) && N[n] < N[2*n]) {
    max_i = 2 * n;
  }
  if(H >= (2 * n + 1) && N[max_i] < N[2*n+1]) {
    max_i = 2 * n + 1;
  }

  if(max_i != n) {
    swap(&N[n],&N[max_i]); 
    maxHeapify(max_i);
  }
  return;
}

void swap(int *a, int *b) {
  int c;

  c = *a;
  *a = *b;
  *b = c;
  return;
}

Measured memory_bytes: 2552
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
using namespace std;
void dfs(vector<ll> v[],ll d[],ll p,ll &t,ll h[])
{
	d[p]=1;ll k=0;
	ll f=v[p].size();
	if(v[p].size()==0){
	t++;return;}
	for(ll i=0;i<f;i++)
	{
		if(h[p]<=h[v[p][i]]){
		k=1;
		}
		if(d[v[p][i]]==1)continue;
		dfs(v,d,v[p][i],t,h);
	}
	if(k==0)t++;
}
int main(){
	ll n,m;
	cin>>n>>m;
	ll h[n+1];
	for(ll i=1;i<=n;i++)
	{
		cin>>h[i];
	}
	vector<ll> v[n+1];
	for(ll i=0;i<m;i++)
	{
		ll a,b;
		cin>>a>>b;
		v[a].pb(b);
		v[b].pb(a);
	}
	ll x=0,d[n+1]={0};
	for(ll i=1;i<=n;i++)
	{
		if(d[i]==0){
		dfs(v,d,i,x,h);}
	}
	cout<<x;
}

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

int main(){
    int n;
    cin >> n;
    vector<int> vec(n);
    rep(i,n) cin >> vec[i];
    int cnt=0;
    for(int i=1;i<n-1;i++){
        if(min({vec[i-1],vec[i],vec[i+1]})!=vec[i] && max({vec[i-1],vec[i],vec[i+1]})!=vec[i]) ++cnt;
    }
    cout << cnt <<endl;
}

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

int main(){
    int n;
    std::cin >> n;
    std::string s;
    int ac = 0;
    int wa = 0;
    int tle = 0;
    int re = 0;

    for (int i = 0; i < n; i++)
    {
        std::cin >> s;
        if (s == "AC")
        {
            ac++;
        }
        else if (s == "WA")
        {
            wa++;
        }
        else if (s == "TLE")
        {
            tle++;
        }
        else
        {
            re++;
        }
    }
    std::cout << "AC x " << ac << std::endl;
    std::cout << "WA x " << wa << std::endl;
    std::cout << "TLE x " << tle << std::endl;
    std::cout << "RE x " << re << std::endl;
    
    return 0;
}

Measured memory_bytes: 3636
import heapq
N, M = map(int, input().split())

AB = []
for _ in range(N):
    A, B = map(int, input().split())
    AB.append((A, B))
AB = sorted(AB, key=lambda x: x[0])

hq = []
heapq.heapify(hq)  # リストhqのheap化

ans = 0
i = 0
for d in range(1, M+1):
    while i <= N-1 and AB[i][0] <= d:
        heapq.heappush(hq, -AB[i][1])  # heap化されたリストhqに要素xを追加
        i += 1
    if hq:
        ans -= heapq.heappop(hq)  # heap化されたリストhqから最小値を削除＆その最小値を出力
print(ans)


Measured memory_bytes: 20988
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = ll(A); I < ll(B); ++I)
#define FORR(I,A,B) for(ll I = ll((B)-1); I >= ll(A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //xi>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //xi>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd_(ll a,ll b){if(a%b==0)return b;return gcd_(b,a%b);}
ll lcm_(ll a,ll b){ll c=gcd_(a,b);return ((a/c)*(b/c)*c);}
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=ll(1e16)+ll(7);
const ll MOD=1000000007LL;
#define out(a) cout<<fixed<<setprecision((a))
//tie(a,b,c) = make_tuple(10,9,87);
#define pop_(a) __builtin_popcount((a))
ll keta(ll a){ll r=0;while(a){a/=10;r++;}return r;}
ll ketawa(ll a){ll r=0;while(a){r+=a%10;a/=10;}return r;}




int main(){

  ll ans = 1;
  ll n,t;
  cin >> n;
  FOR(i,0,n){
    cin >> t;
    ans = lcm_(ans,t);
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
s = input()
n = len(s)
char_cnt = [s.count('a'), s.count('b'), s.count('c')]
char_cnt.sort(reverse=True)
if n % 3 == 0:
    suitable_cnt = [n//3, n//3, n//3]
elif n % 3 == 1:
    suitable_cnt = [n//3 + 1, n//3, n//3]
else:
    suitable_cnt = [n//3 + 1, n//3 + 1, n//3]

if char_cnt == suitable_cnt:
    print('YES')
else:
    print('NO')

Measured memory_bytes: 9144
import collections
import math
import operator as op
from functools import reduce
from collections import Counter
import numpy as np
import math
import bisect
import heapq

MOD = 1000000007


def get_inputs(cast_func=None):
    if cast_func is None:
        return input().split()
    else:
        return list(map(cast_func, input().split()))


def get_input(cast_func=None):
    if cast_func is None:
        return input()
    else:
        return cast_func(input())


def main():
    X = get_input(int)
   
    # ans = math.ceil((math.log10(X) - 2) /  (math.log10(101) - 1))
    ans = 0
    money = 100 
    while money < X:
        ans += 1
        money = math.floor(money * 1.01)
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 27144
#include<bits/stdc++.h>
#define FOR0(i,n) for(int i=0;i<n;i++)
#define FOR1(i,n) for(int i=1;i<=n;i++)
#define FORl(i,l,n) for(int i=l;i<n;i++)
using namespace std;
#define pi pair<ll,ll>
#define pb push_back
#define ll long long
#define ld long double
#define ff first
#define ss second
#define mp make_pair
#define mst0(x) memset(x,0,sizeof(x));
#define vi vector<ll>
#define sync ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl '\n'
#define sp <<" "<<
#define intmax 1e14
ll mod = 1e9 + 7;

ll power(ll num,ll g,ll mod){
  if(g==0)return 1;
  if(g%2==1)return (num*power((num*num)%mod,g/2,mod))%mod;
  return power((num*num)%mod,g/2,mod);
}


int main(){
	int l,r,n;
	cin >> l >> r >> n;
	int cnt = 0;
	for(int i = l; i <= r; i++){
		if(i%n == 0){
			cnt++;
		}
	}
	cout << cnt << endl;

}

Measured memory_bytes: 3592
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int H; cin >> H;
    int cnt = 1;
    int ans = 0;
    while(H > 0) {
        ans += cnt;
        H /= 2;
        cnt *= 2;
    }
    cout << ans << endl;


    return 0;
}


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


#define MAX_N 1000000
int prime[MAX_N];
bool is_prime[MAX_N+1];
int sieve(int n){
	int p=0;
	memset(is_prime,true,sizeof(is_prime));
	is_prime[0]=is_prime[1]=false;
	for(int i=2;i<=n;i++){
		if(is_prime[i]){
			prime[p++]=i;
			for(int j=2*i;j<=n;j+=i)is_prime[j]=false;
		}
	}
	return p;
}


int main(){
	int m,a,b;
	sieve(100010);
	while(cin>>m>>a>>b,m||a||b){
		int p=0,q=0;
		for(int i=0;prime[i]*prime[i]<=m;i++){
			for(int j=i;prime[i]*prime[j]<=m;j++){
				if(a*prime[j]<=prime[i]*b && p*q<prime[i]*prime[j]){
					p=prime[i];
					q=prime[j];
				}
			}
		}
		cout<<p<<' '<<q<<endl;
	}
	return 0;
}

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

#define ll long long int
#define tinput int t; cin>>t; while(t--)
#define rep(i,n,s) for((i)=(s); (i)<(n); (i)++)

template <typename T>
T mini(T x, T y) { return (x<y)?x:y; }
template <typename T>
T maxi(T x, T y) { return (x>y)?x:y; }

int main(){
  //  freopen("input2.txt", "r", stdin);
  //  freopen("output2.txt", "w", stdout);

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    int d, t, s;
    cin>>d>>t>>s;

    int x=d/s;
    if(d%s!=0)
        x++;
    if(t>=x) cout<<"Yes";
    else cout<<"No";
   
    return 0;
}

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

typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))

string s;

int main(){
  cin >> s;
  rep(i, s.size()){
    cout << "x";
  }
  cout << endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pii;
typedef pair<double,double> pdd;
#define MEM(a, b) memset(a, (b), sizeof(a))
#define SZ(i) int(i.size())
#define FOR(i, j, k, in) for (int i=j ; i<k ; i+=in)
#define RFOR(i, j, k, in) for (int i=j ; i>=k ; i-=in)
#define REP(i, j) FOR(i, 0, j, 1)
#define REP1(i,j) FOR(i, 1, j+1, 1)
#define RREP(i, j) RFOR(i, j, 0, 1)
#define ALL(_a) _a.begin(),_a.end()
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define X first
#define Y second
#ifdef tmd
#define debug(...) do{\
    fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<" ,";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.X<<","<<_p.Y<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
    _s<<"{";
    for(It _it=_ita;_it!=_itb;_it++)
    {
        _s<<(_it==_ita?"":",")<<*_it;
    }
    _s<<"}";
    return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,deque<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
#else
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0)
#endif

const ll MOD = 1000000007;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const int iNF = 0x3f3f3f3f;
// const ll MAXN = 

int n, d;
/********** Good Luck :) **********/
int main()
{
    IOS();
    cin >> n >> d;
    d = d * 2 + 1;
    cout << (n + d-1) / d << endl;
    return 0;
}


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

#define N (int)3e2+5
#define f1 first
#define s2 second
#define pb push_back
#define ll long long
#define mod (int)1e9
#define INF 99999999
#define	ull unsigned long long
#define all(a) a.begin(),a.end()
#define fri(a) freopen((a),"r",stdin);
#define fro(a) freopen((a),"w",stdout);

int n,a;
double dp[N][N][N];

double dpf(int cnt1,int cnt2,int cnt3){
	//cout<<cnt1<<" "<<cnt2<<" "<<cnt3<<endl;
	if(dp[cnt1][cnt2][cnt3]!=-1)return dp[cnt1][cnt2][cnt3];
	if(cnt1==0 && cnt2==0 && cnt3==0)return 0;

	double ans1=0.0,ans2=0.0,ans3=0.0,bol=0.0;
	if(cnt1>0){
		ans1=cnt1*dpf(cnt1-1,cnt2,cnt3);
		bol+=1.0;
	}
	if(cnt2>0){
		ans2=cnt2*dpf(cnt1+1,cnt2-1,cnt3);
		bol+=1.0;
	}
	if(cnt3>0){
		ans3=cnt3*dpf(cnt1,cnt2+1,cnt3-1);
		bol+=1.0;
	}
	//if(bol==0)return 0;
	//cout<<cnt1<<" "<<cnt2<<" "<<cnt3<<" "<<bol<<" "<<double(n)/double(cnt1+cnt2+cnt3)<<endl;
	return dp[cnt1][cnt2][cnt3]=double(double(n)/double(cnt1+cnt2+cnt3))+(double(double((ans1+ans2+ans3))/double(cnt1+cnt2+cnt3)));
}

int main(){
	int cnt1=0,cnt2=0,cnt3=0;
	//fri("in.txt");
	//fro("out.txt");
	cin>>n;
	//cout<<"sa"<<endl;
	for(int i=0;i<n;i++){
		cin>>a;
		if(a==1)cnt1++;
		else if(a==2)cnt2++;
		else cnt3++;
	}
	//cout<<"sa"<<endl;
	for(int i=0;i<N;i++){
		for(int j=0;j<N;j++){
			for(int p=0;p<N;p++){
				dp[i][j][p]=-1;
			}
		}
	}
	//cout<<cnt1<<" "<<cnt2<<" "<<cnt3<<endl; 
	//cout<<"sa"<<endl;
	printf("%.10f",dpf(cnt1,cnt2,cnt3));
return 0;
}


Measured memory_bytes: 222080