akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
inline int rd(char c[]){
  int i, sz=0;
  for(;;){
    i = getchar_unlocked();
    if(i!=' '&&i!='\n'&&i!='\r'&&i!='\t'&&i!=EOF){
      break;
    }
  }
  c[sz++] = i;
  for(;;){
    i = getchar_unlocked();
    if(i==' '||i=='\n'||i=='\r'||i=='\t'||i==EOF){
      break;
    }
    c[sz++] = i;
  }
  c[sz]='\0';
  return sz;
}
inline void wt_L(char a){
  putchar_unlocked(a);
}
inline void wt_L(const char c[]){
  int i=0;
  for(i=0;c[i]!='\0';i++){
    putchar_unlocked(c[i]);
  }
}
int N;
char S[28];
int main(){
  int i;
  N = rd(S);
  sort(S, S+N);
  for(i=1;i<N;i++){
    if(S[i]==S[i-1]){
      break;
    }
  }
  if(i<N){
    wt_L("no");
    wt_L('\n');
  }
  else{
    wt_L("yes");
    wt_L('\n');
  }
  return 0;
}
// cLay varsion 20190721-1

// --- original code ---
// int N;
// char S[28];
// {
//   int i;
//   rd(S@N);
//   sort(S, S+N);
//   rep(i,1,N) if(S[i]==S[i-1]) break;
//   wt( if[i<N, "no", "yes"] );
// }


Measured memory_bytes: 256
using System;
using System.Linq;

namespace ProgramingStydying
{
    class Program
    {
        static void Main(string[] args)
        {
            var ks = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var k = ks[0];
            var s = ks[1];
            var ans = 0;

            for(int x = 0; x <= k; x++)
            {
                for (int y = x; y <= k; y++)
                {
                    for (int z = y; z <= k; z++)
                    {
                        if(x + y + z == s)
                        {
                            if(x == y && y == z)
                            {
                                ans += 1;
                            }
                            else if(x == y && y < z)
                            {
                                ans += 3;
                            }
                            else if (x < y && y == z)
                            {
                                ans += 3;
                            }
                            else
                            {
                                ans += 6;
                            }
                        }
                    }
                }
            }
            Console.WriteLine(ans);
        }
    }
}

Measured memory_bytes: 28208
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
template<class T> istream& operator >> (istream& s, vector<T>& v)
{ for (T& x: v) { s >> x; } return s;}
void yes(){ cout << "Yes" << endl; }
void no(){ cout << "No" << endl; }
int SIZE(string s){ return (int)s.size(); }

int main(){
    cout << setprecision(16);
    int n; cin >> n;
    map<int,int> m;
    int ans = 0;
    rep(i,n){
        int x; cin >> x;
        if(m[x] == 0){
            m[x]++;
            ans++;
        } else {
            m[x]--;
            ans--;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4992
#include<stdio.h>



int main( void )
{
	char abc[] = { "ABCDEFGHIJKLMNOPQRSTUVWXYZ" } ;
	char cae[] = { "DEFGHIJKLMNOPQRSTUVWXYZABC" } ;

	char put[ 128 ] ;

	int i ;
	for( i = 0 ; i < 26 ;++i )
	{
		put[ cae[ i ] ] = abc[ i ] ;
	}


	char c ;
	while( ( c = getchar() ) != '\n' )
	{
		printf( "%c" ,put[ c ] ) ;
	}

	puts( "" ) ;


	return 0 ;
}

Measured memory_bytes: 1796
<?php
    fscanf(STDIN, '%d %d %d %d',$a,$b,$c,$d);
    while(true){
        if(($c -= $b) <= 0){
            $ans = 'Yes';
            break;
        }
        if (($a -= $d) <= 0) {
            $ans = 'No';
            break;
        }
    }
    echo $ans.PHP_EOL;
?>

Measured memory_bytes: 16120
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <bits/stdc++.h>
/*#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")*/

using namespace __gnu_pbds;
using namespace std;

#define ll long long
#define ld long double
#define mp make_pair
#define what_is(x) cerr << #x << " is " << x << endl;

typedef tree<
        int,
        null_type,
        less<int>,
        rb_tree_tag,
        tree_order_statistics_node_update>
        ordered_set;


const int p = 1e9 + 7;


int mul(int a, int b) {
    return (1LL * a * b) % p;
}

int add(int a, int b) {
    int s = (a+b);
    if (s>=p) s-=p;
    return s;
}

int sub(int a, int b) {
    int s = (a+p-b);
    if (s>=p) s-=p;
    return s;
}

int po(int a, int deg)
{
    if (deg==0) return 1;
    if (deg%2==1) return mul(a, po(a, deg-1));
    int t = po(a, deg/2);
    return mul(t, t);
}

int inv(int n)
{
    return po(n, p-2);
}

vector<int> Z(vector<int> s)
{
    int n = s.size();
    vector<int> z(n);
    int L = 0, R = 0;
    for (int i = 1; i < n; i++) {
        if (i > R) {
            L = R = i;
            while (R < n && s[R-L] == s[R]) R++;
            z[i] = R-L; R--;
        } else {
            int k = i-L;
            if (z[k] < R-i+1) z[i] = z[k];
            else {
                L = i;
                while (R < n && s[R-L] == s[R]) R++;
                z[i] = R-L; R--;
            }
        }
    }
    return z;
}

mt19937 rnd(time(0));
/*
struct Line {
    mutable ll k, m, p;
    bool operator<(const Line& o) const { return k < o.k; }
    bool operator<(ll x) const { return p < x; }
};

struct CHT : multiset<Line, less<>> {
    // (for doubles, use inf = 1/.0, div(a,b) = a/b)
    const ll inf = LLONG_MAX;
    ll div(ll a, ll b) { // floored division
        return a / b - ((a ^ b) < 0 && a % b); }
    bool isect(iterator x, iterator y) {
        if (y == end()) { x->p = inf; return false; }
        if (x->k == y->k) x->p = x->m > y->m ? inf : -inf;
        else x->p = div(y->m - x->m, x->k - y->k);
        return x->p >= y->p;
    }
    void add(ll k, ll m) {
        auto z = insert({k, m, 0}), y = z++, x = y;
        while (isect(y, z)) z = erase(z);
        if (x != begin() && isect(--x, y)) isect(x, y = erase(y));
        while ((y = x) != begin() && (--x)->p >= y->p)
            isect(x, erase(y));
    }
    ll query(ll x) {
        assert(!empty());
        auto l = *lower_bound(x);
        return l.k * x + l.m;
    }
};
*/

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(nullptr);
    
    int n;
    cin>>n;
    cout<<n*n*n;


}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
string a,b;
int main(){
    cin>>a;
    cin>>b;
    int x=a.size(),y=b.size();
    for(int i=0;i<y;i++)
	{
        cout<<a[i]<<b[i];
    }
    if(x>y)
	{
        cout<<a[x-1];
    }
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
	bool flag = false;
	int N, tmp;
	cin >> N;
	if (N < 82)
	{
		for (int count = 1; count < 10; count++)
		{
			if (N % count == 0)
			{
				for (int index = 1; index < 10; index++)
				{
					if (count * index == N)
					{
						flag = true;
					}
				}
			}
		}
	}
	if (flag)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}

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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repi(i, a, b) for (int i = (a); i < int(b); i++)
#define all(a) (a).begin(), (a).end()
#define bit(b) (1ull << (b))
#define uniq(v) (v).erase(unique(all(v)), (v).end())

using namespace std;
using i32 = int;
using i64 = long long;
using f64 = double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vf64 = vector<f64>;
using vstr = vector<string>;

template<typename T, typename S> void amax(T &x, S y) { if (x < y) x = y; }
template<typename T, typename S> void amin(T &x, S y) { if (y < x) x = y; }

const int MOD = 1000000007;

struct mint {
  int x;
  mint(): x(0) {}
  mint(int a) { x = a % MOD; if (x < 0) x += MOD; }
  mint &operator+=(mint that) { x = (x + that.x) % MOD; return *this; }
  mint &operator-=(mint that) { x = (x + MOD - that.x) % MOD; return *this; }
  mint &operator*=(mint that) { x = (i64) x * that.x % MOD; return *this; }
  mint &operator/=(mint that) { return *this *= that.inverse(); }
  mint operator-() { return mint(-this->x); }
  friend ostream& operator<<(ostream &out, mint m) { return out << m.x; }
  mint inverse() {
    int a = x, b = MOD, u = 1, v = 0;
    while (b) { int t = a / b; a -= t * b; u -= t * v; swap(a, b); swap(u, v); }
    return mint(u);
  }
  #define op(o, p) mint operator o(mint that) { return mint(*this) p that; }
    op(+, +=) op(-, -=) op(*, *=) op(/, /=)
  #undef op
  #define op(o) bool operator o(mint that) const { return x o that.x; }
    op(==) op(!=) op(<) op(<=) op(>) op(>=)
  #undef op
};

mint dp[41][bit(16)];

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(16);
  i32 n, x, y, z;
  cin >> n >> x >> y >> z;
  z--;
  dp[0][0] = 1;
  rep(i, n) rep(j, bit(16)) reps(k, 10) {
    i32 sum = (j << k) + bit(k - 1);
    if ((sum & bit(z)) && (sum & bit(z + y)) && (sum & bit(z + y + x)))
      continue;
    dp[i + 1][sum & (bit(16) - 1)] += dp[i][j];
  }
  mint ans = 1;
  rep(i, n) ans *= 10;
  rep(j, bit(16)) ans -= dp[n][j];
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 10752
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		try(Scanner sc = new Scanner(System.in)) {

			int n = sc.nextInt();

			int count = 0;
			for(int i = 1 ; i <= n ; i++ ) {
				if (String.valueOf(i).length() % 2 == 1) {
					count++;
				}
			}
			
			System.out.println(count);
			
		}
	}
}


Measured memory_bytes: 27732
#include<iostream>
using namespace std;
int main()
{
    int x,y,a,b;
    cin>>x>>y;
    if(x==1 || x==3 || x==5 || x==7 || x==8 || x==10 || x==12)
    {
        a=1;
    }
    else if(x==4 || x==6 || x==9 || x==11)
    {
        a=2;
    }
    else if(x==2)
    {
        a=3;
    }
    if(a==1)
    {
        if(y==1 || y==3 || y==5 || y==7 || y==8 || y==10 || y==12)
        {
            b=1;
        }
        else
        {
            b=0;
        }
    }
    else if(a==2)
    {
        if(y==4 || y==6 || y==9 || y==11)
        {
            b=1;
        }
        else
        {
            b=0;
        }
    }
    else if(a==3)
    {
        if(y==2)
        {
            b=1;
        }
        else
        {
            b=0;
        }
    }
    if(b==1)
    {
        cout<<"Yes"<<endl;
    }
    else if(b==0)
    {
        cout<<"No"<<endl;
    }
    return 0;
}


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

int main()
{
	int num;
    std::cin>>num;
  int num2=0;
  for(int i=1;i<=num;i++)
  {
    for(int j =1; j<=num;j++)
    {
    	for(int s=1;s<=num;s++)
        {
			num2+= std::gcd(std::gcd(i,j),s);
        }
    }
  }
  std::cout<<num2;
  return 0;
}

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

int main()
{
  int N, C, d[30][30], t[3][30];

  cin >> N >> C;
  for(int i = 0; i < C; i++){
    for(int j = 0; j < C; j++){
      cin >> d[i][j];
    }
  }

  for(int i = 0; i < N; i++){
    for(int j = 0; j < N; j++){
      int c;
      cin >> c;
      t[(i+j)%3][c-1]++;
    }
  }

  int ans = 1e+9;
  for(int i = 0; i < C; i++){
    for(int j = 0; j < C; j++){
      if(i != j){
        for(int k = 0; k < C; k++){
          if(i != k && j != k){
            int temp = 0;
            for(int l = 0; l < C; l++) temp += d[l][i]*t[0][l];
            for(int l = 0; l < C; l++) temp += d[l][j]*t[1][l];
            for(int l = 0; l < C; l++) temp += d[l][k]*t[2][l];
            ans = min(ans, temp);
          }
        }
      }
    }
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<functional>
#include<iomanip>
#include<iostream>
#include<numeric>
#include<math.h>
#include<map>
#include<queue>
#include<set>
#include<string>
#include<utility>
#include<vector>
// 追加１
#include <fstream>



using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll mod = 2019;
#define rep(i,n) for(int i=0;i<n;i++)
#define repl(i,s,e) for(int i=s;i<e;i++)
#define reple(i,s,e) for(int i=s;i<=e;i++)
#define revrep(i,n) for(int i=n-1;i>=0;i--)
#define all(x) (x).begin(),(x).end()

int N, M, X;
vector<int> C;
vector<vector<int>> A;


int main()
{
    cin >> N >> M >> X;

    C.resize(N);
    A.resize(N);
    rep(i, N) A[i].resize(M);

    rep(i, N)
    {
        cin >> C[i];
        rep(j, M)
        {
            cin >> A[i][j];
        }
    }

    ll ans = -1;

    for (int bit = 0; bit < (1 << N); ++bit) {
        vector<int> S;
        for (int i = 0; i < N; ++i)
        {
            if (bit & (1 << i)) {
                S.push_back(i);
            }
        }

        vector<int> score(M);
        ll cost = 0;
        for (auto i : S)
        {
            cost += C[i];
            rep(j, M)
            {
                score[j] += A[i][j];
            }
        }

        bool flg = true;
        rep(i, M)
        {
            if (score[i] < X)
            {
                flg = false;
                break;
            }
        }

        if (flg)
        {
            if (ans == -1)
            {
                ans = cost;
            }
            else
            {
                ans = min(ans, cost);
            }
        }
    }

    cout << ans << endl;
}

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

#define endl '\n'

void io(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout.precision(15);
}
const int MAXN = 1e5 + 20 ;
int A[100005] ;
long long BIT1[MAXN], BIT2[MAXN] ;
void update(long long *BIT,int idx,int val){
    assert(idx > 0) ;
    while(idx < MAXN) {
        BIT[idx] += val ;
        idx += (idx & -idx) ;
    }
}
long long query(long long *BIT,int idx){
    long long ret = 0 ;
    while(idx){
        ret += BIT[idx] ;
        idx -= (idx & -idx) ;
    }
    return ret ;
}
void rangeUpdate(long long *BIT,int l,int r,int val){
    if(l <= r){
        l++ ;
        r++ ;
        update(BIT,l,val) ;
        update(BIT,r+1,-val) ;
    }
}
int main(int argc,char* argv[]) { 
    io() ;
    int n, m ; 
    cin >> n >> m ;
    for(int i = 0; i < n; i++){
        cin >> A[i] ;
        A[i]-- ;
    }  
    long long fans = 0 ; 
    for(int i = 0; (i+1) < n; i++){
        int dif = (A[(i+1)] - A[i] + m)%m ;
        fans += dif; 
        int x = A[i] ;
        int y = A[i+1] ;
        if(x < y){
            int lb = x + 1;
            int ub = y  ;
            rangeUpdate(BIT1,lb,ub,1) ;
            rangeUpdate(BIT2,lb,ub,-(x+1)) ;
        }
        else{
            rangeUpdate(BIT1,x+1,m-1,1) ;
            rangeUpdate(BIT2,x+1,m-1,-(x+1)) ;
            rangeUpdate(BIT1,0,y,1) ;
            rangeUpdate(BIT2,0,y,m-1-x) ;
        }
    }
    long long maxp = 0 ;
    for(int i = 0 ; i < m ; i++){
        long long tmp = query(BIT2,i+1) + 1ll*i*query(BIT1,i+1) ;
        maxp = max(maxp,tmp) ;
        // cout << "@tmp = " << tmp << endl ;
    }
    // cout << "maxp = " << maxp << endl ;
    fans -= maxp ;
    cout << fans << endl ;
    return 0 ; 
}

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

int main()
{
	int l,r,i,j,mi=2019;
	scanf("%d %d",&l,&r);
	if(r-l>=2019){printf("0"); return 0;}
	l=l%2019; r=r%2019; 
	//if(r<=l){r+=2019;}
	//printf("%d %d\n",l,r);
	for(i=l;i<r;i++){
	 for(j=i+1;j<=r;j++){
		mi=min(mi,(i*j)%2019); 
		//if(mi==0){printf("%d %d\n",i,j);}
	 }
		
		
		
	}
printf("%d",mi);

return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <limits>
#include <cmath>
#include <cassert>

using namespace std;
using ll = long long;

const int INF = 1<<30;
const int MOD = (int)1e9 + 7;
const int MAX_N = (int)1e5 + 5;
#define debug(x) cout << #x << ": " << x << endl

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    vector<int> A(n);
    for(int i = 0; i < n; i++) cin >> A[i];
    int f = 0, s = 0;
    int a = -1, b = -1;
    for(int i = 0; i < n; i++)
    {
        if(A[i] > f)
        {
            f = A[i];
            a = i;
        }
        else if(A[i] > s)
        {
            s = A[i];
            b = i;
        }
    }
    for(int i = 0; i < n; i++)
    {
        if(i == a)
        {
            cout << s << endl;
        }
        else cout << f << endl;
    }
    return 0;
}



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

#define int long long
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rep1(i,n) for(int i=1;i<=(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define repm(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define sperase(v,n) (v).erase(remove(all(v), n), (v).end());
#define vdelete(v) (v).erase(unique(all(v)), (v).end());
#define pb(n) push_back(n);
#define mp make_pair
#define MOD 1000000007
#define INF 9223372036854775807

int ans;
string s;

main() {
    cin >> s;
    char hoge = s[0];
    rep1(i,s.size()-1) {
        if (hoge != s[i]) ans++;
        hoge = s[i];
    }
    cout << ans << endl;
}


Measured memory_bytes: 512
#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
int x, y, s;
int m;
int p, q;
int main()
{
	while(cin >> x >> y >> s && x>0)
	{
		m=0;
		for(int i=1; i<s; i++)
		{
			p=(i+1)*100/(100+x);
			if((p*(100+x)/100)==i+1)
			{
				p-=1;
			}
			if(p*(100+x)/100<i)
			{
				p=-1;
			}
			q=(s-i+1)*100/(100+x);
			if((q*(100+x)/100)==s-i+1)
			{
				q-=1;
			}
			if(q*(100+x)/100<s-i)
			{
				q=-1;
			}
			if((p+1)*(q+1)!=0)
			{
				m=max(((p*(100+y)/100)+(q*(100+y)/100)), m);
			}
		}
		cout << m << endl;
	}
	return 0;
}

Measured memory_bytes: 1164
#include<iostream> 
using namespace std;
int main(){
    int n;
    string s;
    cin >> n >> s;
    int ans[n];
    ans[0] = 0;
    for(int i = 1;i<n;i++){
        if(s[i] != 'W') ans[0]++; 
    } 
    int anss = ans[0];
    for(int i = 1;i<n;i++){
        ans[i] = ans[i-1] + ((s[i-1]=='W') - (s[i]=='E'));
        anss = min(anss,ans[i]);
    }
    cout << anss << endl;
}

Measured memory_bytes: 1796
icase=0
if icase==0:
    s=list(input())
    p=""
    for i in range(len(s)):
        if s[i]=="0":
            p=p+"0"
        elif s[i]=="1":
            p=p+"1"
        elif s[i]=="B":
            if p!="":
                p=p[0:len(p)-1]
    print(p)
    

Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;

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

	int d;
	cin >> d;
	if (d == 22) cout << "Christmas Eve Eve Eve\n";
	if (d == 23) cout << "Christmas Eve Eve\n";
	if (d == 24) cout << "Christmas Eve\n";
	if (d == 25) cout << "Christmas\n";

	return 0;
}

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

int main(){
  int N;
  cin>>N;
  int k=1;
  while(k*(k-1)<2*N){
    k++;
  }
  if(k*(k-1)>2*N){
    cout<<"No"<<endl;
  }else{
    cout<<"Yes"<<endl;
    cout<<k<<endl;
    int number=1;
    vector<vector<int>> S(k,vector<int>(k-1));
    vector<int> index(k);
    for(int i=0;i<k;i++){
      cout<<k-1<<" ";
      for(int j=0;j<i;j++){
        cout<<S.at(j).at(index.at(j))<<" ";
        index.at(j)++;
      }
      index.at(i)=i;
      for(int j=i;j<k-1;j++){
        S.at(i).at(j)=number;
        number++;
        cout<<S.at(i).at(j)<<" ";
      }
      cout<<endl;
    }

  }
}


Measured memory_bytes: 2176
// #define int long long
// #define repeat(i, n) for (int i = 0; i < n; ++i)

#include <cmath> // cmath includes sqrt, abs
#include <iostream> // iostream includes cout, endl
#include <string> // string
#include <algorithm> // algorithm includes sort

#include <set>

using namespace std;

int main() {
  bool can = false;
  int num = 0;
  string S;
  string T = "";
  int N;
  int M;

  int a[50];
  int b[50];
  int c[50];

  cin >> N >> M;

  for (int i = 0; i < M; ++i) cin >> a[i] >> b[i];

  for (int i = 0; i < N; ++i) {
    c[i] = 0;
    for(int j = 0; j < M; ++j) {
      if (a[j] == i + 1) c[i] += 1;
      if (b[j] == i + 1) c[i] += 1;
    }
  }

  for(int i = 0; i < N; ++i) cout << c[i] << endl;
  
  // if (can) cout << "Yes" << endl;
  // else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll a[110];
int main(){
	ll n;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	sort(a,a+n);
	ll ans=0;
	for(int i=0;i<n;i++)for(int j=i+1;j<n;j++)for(int k=j+1;k<n;k++){
		if(a[i]==a[j]||a[j]==a[k])continue;
		if(a[k]<a[i]+a[j])ans++;
	}
	cout<<ans;
	return 0;
}


Measured memory_bytes: 3592
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String num = sc.next();
        String[] splitNum = num.split("", 0);
        
        int S_N = Integer.parseInt(num);
        int N = 0;
        for(int i = 0; i < num.length(); i++){
            N += Integer.parseInt(splitNum[i]);
        }
        
        System.out.println(S_N % N == 0 ? "Yes" : "No");
    }
}


Measured memory_bytes: 21716
#include<bits/stdc++.h>
using namespace std;
int dp[20001];
int a[20001];
int b[20001];
signed main()
{
	int n,k,sum=0;
	scanf("%d%d",&k,&n);
	for(int i=1;i<=n;i++)
		scanf("%d%d",&a[i],&b[i]);
	memset(dp,0x3f,sizeof(dp));
	dp[0]=0;
	for(int i=1;i<=n;i++)
		for(int j=1;j<=20000;j++)
			if(j>=a[i])
				dp[j]=min(dp[j],dp[j-a[i]]+b[i]);
	int ans=999999999;
	for(int i=k;i<=20000;i++)
		ans=min(ans,dp[i]);
	printf("%d",ans);
	return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e3+5,M=2e4+5,inf=0x3f3f3f3f,mod=1e9+7;
#define mst(a,b) memset(a,b,sizeof a)
#define lx x<<1
#define rx x<<1|1
#define reg register
#define PII pair<int,int>
#define fi first
#define se second
#define pb push_back
#define il inline
int main(){
	ll a,b,x;
	cin>>a>>b>>x;
	ll ans=b/x;
	if(a>=1) ans-=(a-1)/x;
	else ans++;
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 3752
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>

using namespace std;

int main() {
  bool ans[26];
  for(int i = 0; i < 26; i++) {
    ans[i] = false;
  }
  string s;
  cin >> s;
  bool ok = true;
  for(int i = 0; i < s.length(); i++) {
    int idx = s[i] - 'a';
    if(ans[idx]) {
      ok = false;
      break;
    } else {
      ans[idx] = true;
    }
  }
  if(ok) {
    cout << "yes" << endl;
  } else {
    cout << "no" << endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <set>
#include <vector>

using namespace std;

typedef long long ll;

void failure () {
  cout << "No" << endl;
  exit(0);
}

const int MAX_N = 1e5 + 5;

int arr [MAX_N];
set<int, greater<int>> pos [MAX_N];

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

  int n, m, qc;
  cin >> n >> m >> qc;

  for (int i = 0; i < qc; i++) {
    cin >> arr[i];
    pos[arr[i]].insert(i);
  }

  set<int> seen;
  vector<int> subseq;
  for (int i = qc - 1; i >= 0; i--) {
    if (!seen.count(arr[i])) {
      subseq.push_back(arr[i]);
      pos[arr[i]].erase(i);
      seen.insert(arr[i]);
    }
  }

  int mn = m + 1;
  for (int i = 1; i <= m; i++) {
    if (!seen.count(i)) {
      mn = min(mn, i);
    }
  }

  while (!subseq.empty() && subseq.back() < mn) {
    mn = subseq.back();
    subseq.pop_back();
  }

  int K = subseq.size();
  if ((ll) K * (ll) n > qc) failure(); // prevent TLE

  for (int i = 0; i < n - 1; i++) {
    int cur = qc + 1;
    for (int u : subseq) {
      if (pos[u].upper_bound(cur) == pos[u].end()) failure();
      cur = *pos[u].upper_bound(cur);
      pos[u].erase(cur);
    }
  }

  cout << "Yes" << endl;
}


Measured memory_bytes: 13864
#include<bits/stdc++.h>
using namespace std;
#define ll  long long
#define endl '\n'
#define FASTINOUT ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const ll mod = 998244353;
const int N=5009;
int main()
{
    FASTINOUT;
    string s;
    cin>>s;
    int x=s.length();
    for (int i=0;i<x/2;i++){
        if (s[i]!=s[x-i-1]){
            cout<<"No\n";
            return 0;
        }
    }
    for (int i=0;i<(x-1)/4;i++){
        if (s[i]!=s[(x-1)/2-i-1]){
            cout<<"No\n";
            return 0;
        }
    }
    string t=s.substr((x+3)/2-1,x-(x+3)/2+1);
  //  cout<<t<<endl;
    for (int i=0;i<t.length()/2;i++){
        if (t[i]!=t[t.length()-i-1])
        {
            cout<<"No\n";
            return 0;
        }
    }
    cout<<"Yes\n";
    return 0;
}


Measured memory_bytes: 256
def main():
    n = int(input())
    seq = tuple(map(lambda x: int(x), input().split()))

    points = []
    for i in range(n - 1):
        points.append([0] * n)

    if n == 1:
        print(seq[0])
        return

    for i in range(n - 1):
        points[i][i + 1] = (
            max(seq[i], seq[i + 1]),
            min(seq[i], seq[i + 1])
        )

    for k in range(2, n):
        for i in range(n - k):
            currLeft = seq[i] + points[i + 1][i + k][1]
            currRight = seq[i + k] + points[i][i + k - 1][1]
            nextLeft = points[i + 1][i + k][0]
            nextRight = points[i][i + k - 1][0]

            if currLeft > currRight:
                points[i][i + k] = (currLeft, nextLeft)
            else:
                points[i][i + k] = (currRight, nextRight)

        points.pop()

    print(points[0][n - 1][0] - points[0][n - 1][1])

main()


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

using namespace std;

const int MOD = 998244353;

long long fact[200005], inv[200005];

long long mypow(long long x, long long y) {
	long long res = 1;
	while (y) {
		if (y & 1) res = res * x % MOD;
		y >>= 1;
		x = x * x % MOD;
	}
	return res;
}

long long ncr(int x, int y) {
	if (y < 0 || y > x) return 0;
	return fact[x] * inv[y] % MOD * inv[x - y] % MOD;
}

int main() {
	int n, m, k;
	scanf("%d%d%d", &n, &m, &k);
	
	fact[0] = 1LL;
	for (int i = 1; i <= n; i++) fact[i] = fact[i - 1] * i % MOD;
	inv[n] = mypow(fact[n], MOD - 2);
	for (int i = n - 1; i >= 0; i--) inv[i] = inv[i + 1] * (i + 1) % MOD;
	
	long long res = 0;
	
	for (int i = 0; i <= k; i++) {
		res = (res + ncr(n - 1, i) * m % MOD * mypow(m - 1, n - 1 - i) % MOD) % MOD;
	}
	
	printf("%lld\n", res);
}


Measured memory_bytes: 6852
#include<bits/stdc++.h>
using namespace std;
int main(){
    int at;
    cin >> at;
    int i,j,k;
    long sum=0;
    for(i=1;i<=at;i++){
        for(j=1;j<=at;j++){
            for(k=1;k<=at;k++){
                int m;
                int ma=1;
                m=min({i,j,k});
                for(int l=1;l<=m;l++){
                    if((i%l==0)&&(j%l==0)&&(k%l==0))ma=l;
                }
                sum+=ma;
            }
        }
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 3596
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cstdlib>
using namespace std;
int n,m,a[100005],cnt[100005];
char te[100005];
int main(){
	int ans=0;
	cin>>n;
	for(register int i=1;i<=n;i++){
		int x,y;
		cin>>x>>y;
		for(register int i=x;i<=y;i++)a[i]=1;
	}
	for(register int i=1;i<=100000;i++){
		if(a[i])ans++;
	}
	cout<<ans<<endl;
	return 0;
}

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

int main() {
    int D, N, T[210], A[210], B[210], C[210];
    cin >> D >> N;
    for (int i = 0; i < D; ++i) cin >> T[i];
    for (int i = 0; i < N; ++i) cin >> A[i] >> B[i] >> C[i];

    int dp[D + 1][N];
    memset(dp, -1, sizeof(dp));
    for (int i = 0; i < D; ++i) {
        if (A[i] <= T[0] && T[0] <= B[i]) dp[0][i] = 0;
    }

    for (int i = 0; i < D - 1; ++i) {
        for (int j = 0; j < N; ++j) {
            if (dp[i][j] != -1) {
                for (int k = 0; k < N; ++k) {
                    if (A[k] <= T[i + 1] && T[i + 1] <= B[k]) {
                        dp[i + 1][k] = max(dp[i + 1][k], dp[i][j] + abs(C[k] - C[j]));
                    }
                }
            }
        }
    }

    int ans = 0;
    for (int i = 0; i < N; ++i) ans = max(ans, dp[D - 1][i]);
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 3244
#include <iostream>
#include <vector>
#include <chrono>
#include <random>

std::mt19937 rng((int) std::chrono::steady_clock::now().time_since_epoch().count());

int main() {
	std::ios_base::sync_with_stdio(false); std::cin.tie(NULL);
	std::string str;
	std::cin >> str;
	int n = (int) str.size();
	bool valid = false;
	for(int i = 0; i <= 7; i++) {
		// ez4ence
		std::string wut = str.substr(0, i) + str.substr(n - (7 - i), 7 - i);
		valid = valid || wut == "keyence";
	}
	std::cout << (valid ? "YES\n" : "NO\n");
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define it ::iterator
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double ESP=1e-10;
using namespace std;
int main(){
  string s;
  cin>>s;
  s=s+s;
  string out;
  cin>>out;
  if(s.find(out)!=string::npos)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

Measured memory_bytes: 3220
#include <vector>
#include <iostream>
#include <string>
#include <math.h>
#include <algorithm>

using namespace std;


int main(void){
  
  int A,B,C,K,count=0,ans=0;

  cin >> A >> B >> C >> K ;

  for(int i =0; i<A;i++){
    if(count>=K){
      break;
    }
    ans++;
    count++;
  }

  for(int i =0; i<B;i++){
    if(count>=K){
      break;
    }
    count++;
  }

  for(int i =0; i<C;i++){
    if(count>=K){
      break;
    }
    ans--;
    count++;
  } 
  cout << ans << endl;
 
  return 0;
}




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


int main() {
  int N, A, B;
  cin >> N;
  for(int i=1; i<10; i++){
  if (N%i == 0) {
    if (N/i < 10){
      cout << "Yes" << endl; return 0;
    }
  }  
  }
  cout << "No" << endl;
  return 0;
}
  

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

#define rep(i, n) for (int i = 0; i < (n); i++)
#define repr(i, n) for (int i = (n)-1; i >= 0; i--)
using namespace std;
typedef long long ll;

const int INF = 1e9;
int n;

int main() {
  cin >> n;
  vector<ll> H(n);
  rep(i, n) cin >> H[i];
  ll ans = 0;
  ll a = 0;
  for (int i = 1; i < n; i++) {
    if (H[i - 1] >= H[i]) {
      a++;
    } else {
      ans = max(a, ans);
      a = 0;
    }
    if (i == n - 1) {
      ans = max(ans, a);
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1152
require 'set'
n = gets.to_i
heights = gets.split.map(&:to_i)
plus = {}
minus = {}
plus.default = 0
minus.default = 0
heights.each_with_index{|h, i|
    if i + h < n
        plus[i + h] += 1
    end
    if i - h > 0
        minus[i - h] += 1
    end
}

ans = 0
(Set.new(plus.keys) & Set.new(minus.keys)).each{|k|
    ans += plus[k] * minus[k]
}
puts ans


Measured memory_bytes: 50852
#include <bits//stdc++.h>
using namespace std;
int in(void){int x;cin>>x;return x;}
#define rep(i,a,b) for(int i=int(a);i<int(b);i++)
#define ll long long int
long long int dx[4]={1,0,-1,0};
long long int dy[4]={0,1,0,-1};
int D[2]={1,-1};
int main() {
  int n,m,c;
  cin>>n>>m>>c;
  int b[m],a[n][m];
  int z=0;
  rep(i,0,m)cin>>b[i];
  rep(i,0,n){
    int ans=0;
    rep(j,0,m){
      cin>>a[i][j];
        ans+=a[i][j]*b[j];
        }
        if(ans+c>0)z++;
  }
  cout<<z;
return 0;
}


Measured memory_bytes: 256
//just for testing
#include <bits/stdc++.h>
#include <random>
using namespace std;
 
#define rep(i, N) for (int i = 0; i < N; i++)
#define pb push_back
 
typedef long long ll;
typedef pair<int, int> i_i;
typedef pair<double, int> d_i;
 
int main() {
	random_device rd;
	mt19937 mt(rd());
	int N, M; cin >> N >> M;
	vector<string> a(N);
	rep(i, N) cin >> a[i];
	rep(t, 100000) {
		vector<vector<bool>> b(M, vector<bool>(M, true));
		rep(j1, M) for (int j2 = j1; j2 < M; j2++)
			rep(i, N) if (a[i][j1] != a[N - 1 - i][j2]) b[j1][j2] = false;
		vector<bool> dp(1<<M);
		dp[0] = true;
		rep(S, 1<<M) if (dp[S])
			rep(j1, M) for (int j2 = j1 + 1; j2 < M; j2++)
				if (!(S>>j1 & 1) && !(S>>j2 & 1) && b[j1][j2])
					dp[S | 1<<j1 | 1<<j2] = true;
		bool ok = false;
		if (M % 2 == 0) ok = dp.back();
		else {
			rep(j, M) if (dp[(1<<M) - 1 - (1<<j)] && b[j][j]) ok = true;
		}
		if (ok) {
			cout << "YES" << endl;
			return 0;
		}
		shuffle(a.begin(), a.end(), mt);
	}
	cout << "NO" << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
 #define int long long
#define all(X) (X).begin(), (X).end()
#define reset(X) memset(X, 0, sizeof(X))
#define mp(a, b) make_pair(a, b)
#define pb push_back
#define endl '\n'
#define fi first
#define se second

 
 
using namespace __gnu_pbds;
using namespace std;
 const int mod=1e9+7;
 // const int mod=998244353;
const int INF=4e18+10;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
 
#define read(n) int n; cin>>n;
#define readv(x, n) vector<int> x(n); for(auto &i:x) cin>>i; 
int multiply(int a, int b, int in_mod){return (a*b)%in_mod;} 
int mult_identity(int a){return 1;}


auto power(auto a, int b, int in_mod)
{
    auto prod=mult_identity(a);
    auto mult=a%in_mod;
    while(b!=0)
    {
        if(b%2)
        {
            prod=multiply(prod,mult, in_mod);
        }
        mult=multiply(mult, mult,in_mod);
        b/=2;
    }
    return prod;
}
int mod_inv(int q, int in_mod)
{

    return power(q, in_mod-2,in_mod);
}


 
void solve()
{     
    string s;
    cin>>s;
    const int mod =2019;
    int n=s.size();
    reverse(all(s));
    vector<int> pref(n+1);
    int magic = power(10, n-1, mod);
    int cons = mod_inv(10, mod);
    for(int i=1;i<=n;i++)
    {
        pref[i] = (pref[i-1] + (s[i-1]-'0')*magic)%mod;
        magic = (magic*cons)%mod;
    }    

    int pairs =0;

    map<int, int> good_guys;
    int cnt=0;
    for(int i=0;i<=n;i++)
    {
        int rower = (pref[i])%mod;
        cnt += good_guys[rower];
        good_guys[pref[i]]++;

    } 
    cout<<cnt<<endl;
}

 
 
signed main()
 
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);  
    cout.tie(NULL);
    #ifndef ONLINE_JUDGE
        if(fopen("INPUT.txt","r"))
        {
            freopen ("INPUT.txt" , "r" , stdin);
            freopen ("OUTPUT.txt" , "w" , stdout);
        }
    #endif
    auto clk=clock(); 
    mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
    // -------------------------------------Code starts here---------------------------------------------------------------------     
 
    int t=1;
    // cin>>t;
    for(int test=1;test<=t;test++)
    {
        // cout<<"Case #"<<test<<": ";
        solve();
        // cout<<endl;
 
    }
 
    // -------------------------------------Code ends here------------------------------------------------------------------
 
 
    clk = clock() - clk;
    cerr << fixed << setprecision(6) << "Time: " << ((double)clk)/CLOCKS_PER_SEC << "\n";
    return 0;
 }


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

int main(){
    int n;cin >> n;
    long long int a = -1,b = -1 ,c = -1;
    int count = 0;
    int ac = 0, bc = 0, cc = 0;
    for(int i = 0 ;i<n; i++){
        int mid;cin >> mid;
        if(mid == a){ac++;}
        if(mid == b){bc++;}
        if(mid == c){cc++;}
        if(a == -1){a = mid;count++;ac++;}
        else if(b == -1 && mid != a){b = mid;count++;bc++;}
        else if(c == -1 && mid != b && mid != a){c = mid;count++;cc++;}
        else if(mid != a && mid != b && mid != c){cout << "No" << endl; count++;return 0;}
    }
    if(count == 1){
        if(a == 0){
            cout << "Yes" << endl; return 0;
        }else{
            cout << "No" << endl; return 0;
        }
    }else if(count == 2){
        if(a*b != 0){cout << "No" << endl; return 0;}
        else if(a == 0){
            if(2 * ac == bc){cout << "Yes" << endl; return 0;}
        }else if(b == 0){
            if(2 *bc == ac){cout << "Yes" << endl; return 0;}
        }
        cout << "No" << endl; return 0;
    }else if(count == 3){
        if(ac == bc && bc == cc){    
        }else{cout << "No" << endl; return 0;}
        while(a != 0 || b != 0 || c != 0){
            int a1 = a%2;
            int b1 = b%2;
            int c1 = c%2;
            a = a/2;b = b/2;c = c/2;
            if((a1 == 0 && b1 == 1 && c1 == 1)||(a1 == 1 && b1 == 1 && c1 == 0)||(a1 == 1 && b1==0 && c1 ==1) || (a1 == 0 && b1 == 0 && c1 == 0)){}
            else{cout << "No" << endl; return 0;}
        }
    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 256
n = int(input())
n1 = n
pn = []
cnt = 2
ans = 0
while cnt <= int(n ** 0.5):
    while n1 % cnt == 0:
        n1 = n1 // cnt
        pn.append(cnt)
    cnt += 1
pns = list(set(pn))
ansa = []
for i in pns:
    ansa.append(pn.count(i))
for i in ansa:
    x = 1
    while i > 0:
        i -= x
        if i < 0:
            break
        x += 1
        ans += 1
print(ans + 1 if n1 != 1 else ans)

Measured memory_bytes: 9448
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <bitset>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
#include <functional>
#include <cassert>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
#define ALL(v) v.begin(),v.end()
template < class T > inline bool chmax(T& a, T b) {if (a < b) { a=b; return true; } return false; }
template < class T > inline bool chmin(T& a, T b) {if (a > b) { a=b; return true; } return false; }
#define DEBUG_VLL(vec) REP(sz, vec.size()) std::cerr<<vec[sz]<<(sz==vec.size()-1?'\n':' ');

const long long MOD = 1000000007;
const long long HIGHINF = (long long)1e18;
const int INF = (int)1e9;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    V< P<int, P<int, int> > > wsv(n);
    for (int i = 0; i < n; i++) cin >> wsv[i].first >> wsv[i].second.first >> wsv[i].second.second;
    sort(ALL(wsv), [&](P<int, P<int, int> > i, P<int, P<int, int> > j) {
        return i.first + i.second.first < j.first + j.second.first;
    });

    vvll dp(2, vll(10002, -1));
    dp[0][0] = 0;
    for (int i = 0; i < n; i++) {
        dp[1] = vll(10002, -1);
        for (int j = 0; j < 10002; j++) {
            if (dp[0][j] == -1) continue;
            chmax(dp[1][j], dp[0][j]);
            if (j != 10001 && j <= wsv[i].second.first) chmax(dp[1][min(10001, j + wsv[i].first)], dp[0][j] + wsv[i].second.second);
        }
        swap(dp[0], dp[1]);
    }
    cout << *max_element(ALL(dp[0])) << '\n';
    return 0;
}


Measured memory_bytes: 3780
using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		int D = int.Parse(Console.ReadLine());
		int[]C = new int[26];
		string[]str = Console.ReadLine().Split();
		for(var i=0;i<26;i++){
			C[i] = int.Parse(str[i]);
		}
		int[,]A = new int[D,26];
		for(var i=0;i<D;i++){
			string[]str2 = Console.ReadLine().Split();
			for(var j=0;j<26;j++){
				A[i,j] = int.Parse(str2[j]);
			}
		}
		int[]ans = new int[D];
		int[]W = new int[26];
		for(var i=0;i<D;i++){
			int maxValue = 0;
			int maxj = 0;
			for(var j=0;j<26;j++){
				int value = A[i,j] + W[j]*(i+1-W[j])*2;
				if(value > maxValue){
					maxValue = value;
					maxj = j;
				}
			}
			ans[i] = maxj+1;
			W[maxj] = i+1;
		}
		for(var i=0;i<D;i++){
			Console.WriteLine(ans[i]);
		}
	}
}

Measured memory_bytes: 18448
#include<stdio.h>
#include<algorithm>
using namespace std;
char str[1000];
int dat[10];
int main(){
	int a;
	while(scanf("%d",&a),a){
		for(int i=0;i<10;i++)dat[i]=0;
		scanf("%s",str);
		int ba=0;
		for(int i=0;i<100;i++){
			if(str[i]=='M'){
				dat[i%a]++;
			}
			if(str[i]=='S'){
				ba+=dat[i%a]+1;
				dat[i%a]=0;
			}
			if(str[i]=='L'){
				dat[i%a]+=ba+1;
				ba=0;
			}
		}
		std::sort(dat,dat+a);
		for(int i=0;i<a;i++)printf("%d ",dat[i]);
		printf("%d\n",ba);
	}
}

Measured memory_bytes: 1048
H,W = map(int,input().split())
s = [list(input()) for i in range(H)]
def judge(h,w):
    h1 = [0,0,1,-1]
    w1 = [1,-1,0,0]
    for i in range(4):
        if 0 <= h+h1[i] <= H-1 and 0 <= w+w1[i] <= W-1:
            if s[h+h1[i]][w+w1[i]] == '#':
                return True
    return False

ans = 'Yes'
for h in range(H):
    for w in range(W):
        if s[h][w] == '#' and not judge(h,w):
            ans = 'No'
            break
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)  for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define pb emplace_back
#define eb emplace_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
#define fi first
#define se second
#define pi M_PI
#define PQ(T) priority_queue<T>
#define SPQ(T) priority_queue<T,vector<T>,greater<T>>
#define dame(a) {out(a);return 0;}
#define decimal cout<<fixed<<setprecision(15);
#define dupli(a) a.erase(unique(all(a)),a.end())
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> PP;
typedef tuple<ll,ll,ll,ll> PPP;
typedef multiset<ll> S;
using vi=vector<ll>;
using vvi=vector<vi>;
using vvvi=vector<vvi>;
using vvvvi=vector<vvvi>;
using vp=vector<P>;
using vvp=vector<vp>;
using vb=vector<bool>;
using vvb=vector<vb>;
const ll inf=1001001001001001001;
const ll INF=1001001001;
const ll mod=1000000007;
const double eps=1e-10;
template<class T> bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<class T> bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void outp(T a){cout<<'('<<a.fi<<','<<a.se<<')'<<'\n';}
template<class T> void outvp(T v){rep(i,v.size())cout<<'('<<v[i].fi<<','<<v[i].se<<')';cout<<'\n';}
template<class T> void outvvp(T v){rep(i,v.size())outvp(v[i]);}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<'\n';}
template<class T> void outvv(T v){rep(i,v.size())outv(v[i]);}
template<class T> bool isin(T x,T l,T r){return (l)<=(x)&&(x)<=(r);}
template<class T> void yesno(T b){if(b)out("yes");else out("no");}
template<class T> void YesNo(T b){if(b)out("Yes");else out("No");}
template<class T> void YESNO(T b){if(b)out("YES");else out("NO");}
template<class T> void noyes(T b){if(b)out("no");else out("yes");}
template<class T> void NoYes(T b){if(b)out("No");else out("Yes");}
template<class T> void NOYES(T b){if(b)out("NO");else out("YES");}
void outs(ll a,ll b){if(a>=inf-100)out(b);else out(a);}
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll modpow(ll a,ll b){ll res=1;a%=mod;while(b){if(b&1)res=res*a%mod;a=a*a%mod;b>>=1;}return res;}

int main(){
    ll n,k;cin>>n>>k;
    vi v(n);
    rep(i,n)cin>>v[i];
    vb dp(k+1,false);
    REP(i,1,k+1)for(ll x:v)if(i-x>=0&&!dp[i-x])dp[i]=true;
    if(dp[k])out("First");
    else out("Second");
}

Measured memory_bytes: 3592
// 20
/****************************************************
https://searleser97.gitlab.io/algorithms/template.cpp
****************************************************/

#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define forr(_, x, n) for (int _ = x; _ > n; _--)
#define fos(_, x, n, s) for (int _ = x; _ < n; _ += s)
#define forn(_, x, n) fos(_, x, n, 1)
#define rep(_, n) forn(_, 0, n)
#define fi first
#define se second
#define pb push_back
#define pairii pair<int, int>
#define all(x) x.begin(), x.end()
#define cerr(s) cerr << "\033[48;5;196m\033[38;5;15m" << s << "\033[0m"
// typedef __int128_t lli;
typedef long long int li;
typedef long double ld;
// 12
void _main(int tc) {
  string s;
  cin >> s >> s;
  cout << "A" << s[0] << "C" << endl;
}

int main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  _main(0); return 0;
  int tc;
  cin >> tc;
  rep(i, tc) _main(i + 1);
}

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

int main(){
  int N,K;
  cin >> N >> K;

  int h[N];
  for(int i = 0;i < N;i++){
    cin >> h[i];
  }
  sort(h,h+N);

  int ans = 1000000001;
  for(int i = 0;i <= N - K; i++){
    ans = min(h[i + K - 1] - h[i],ans);
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 640
#include<stdio.h>
#define N 100


int main(){
  int x[N];
  int n,i,c,flag=1,count=0;
  
  scanf("%d",&n);
  for(i=0 ; i<n ; i++){
    scanf("%d",&x[i]);
  }
  
  while(flag){
    flag=0;
    for(i=n-1 ; i>0 ; i--){
      if(x[i]<x[i-1]){
	c = x[i];
	x[i]=x[i-1];
	x[i-1]=c;
	count++;
	flag=1;
      }
    }
  }
  for(i=0 ; i<n ; i++){
    if(i<n-1) printf("%d ",x[i]);
    else printf("%d\n",x[i]);
  }
  printf("%d\n",count);
}



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

int search(int A[], int n, int key) {
  A[n] = key;
  int i = 0;
  while(A[i]!=key) {
    i++;
  }
  return i!=n;
}

int main() {
  int n, q, m, sum = 0;
  cin >> n;
  int S[n+1];
  for (int i=0; i<n; i++) {
    cin >> S[i];
  }
  cin >> q;
  for (int i=0; i<q; i++) {
    cin >> m;
    if (search(S, n, m)) {
        sum++;
    }
  }
  cout << sum << endl;
  return 0;
}



Measured memory_bytes: 3128
#include<bits/stdc++.h>
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#define rep(i,n) for(int i = 0;  i < n ; ++i)
#define REP(i,a,b) for(int i = a ; i <= b ; ++i)
#define filei freopen("input.txt", "r", stdin);
#define fileo freopen("output.txt", "w", stdout);
#define gooi cout<<"Case #"<<i+1<<" :";
#define s(n) scanf("%d",&n)
#define rev(i,n) for(int i = n ; i >= 0 ; --i)
#define REV(i,a,b) for(int i = a ; i >= b ; --i)
#define miN(a,b) (((a)<(b))?(a):(b))
#define sc(n) scanf("%c",&n)
#define tr(c,i) for(typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define INF 1000000000
#define pii pair<long long int,long long int>
#define pb(a) push_back(a)
#define F first
#define S second
typedef long long ll;
using namespace std;
void pre(){}
void solve(){
    ll n;cin>>n;
    string s;
    while(n>0){
        n--;
        s+=char( 'a' + n%26 );
        n/=26;
    }
    reverse(s.begin(),s.end());
    cout<<s<<"\n";
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    pre();
    long long int num = 1;
    //cin>>num;
    for(long long int i=0;i<num;i++){
       	solve();
    }   
}





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

using namespace std;

int main(){
  int n,k;
  cin >> n >> k;
  
  vector<int> d(k);
  vector<int> a(0);
  
  for(int i=0;i<k;i++){
    cin >> d.at(i);
    for(int j=0;j<d.at(i);j++){
      int c;
      cin >> c;
      a.push_back(c);
    }
  }
  int count=0;
  for(int i=1;i<=n;i++){
    for(int j=0;j<a.size();j++){
      if(i==a.at(j))
        break;
      if(j==a.size()-1)
        count++;
    }
  }
  cout << count << endl;
}


Measured memory_bytes: 3728
A,B=map(str,input().split())
A=int(A)
B=list(B)
if len(B)<=2:
    B.append('0')
    B.append('0')
elif B[-3]=='.':
        B.remove('.')
elif B[-2]=='.' :
    B.remove('.')
    B.append('0')
else:
    B.append('0')
    B.append('0')
n=len(B)
b=sum(10**(n-1-j)*int(B[j]) for j in range(n))
ans=list(str(A*b))
if len(ans)<=2:
    ans='0'
else:
    ans.pop(len(ans)-1)
    ans.pop(len(ans)-1)
n2=len(ans)
trueans=sum(10**(n2-1-j)*int(ans[j]) for j in range(n2))
print(trueans)


Measured memory_bytes: 9276