akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define endl "\n"
#define se second
#define ls( s) (s&(-s))
#define ll long long
#define inf 0x3f3f3f3f
#define fast    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const ll N = 200030;
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
const ll mod =    998244353;
string s;
int n;
int dp[2<<17][30];
int main()
{  fast
cin>>s;
n=s.size();
for(int i=s.size();i--;)
{
	int mx=1e9;
	for(int j=0;j<26;j++)
	{

	if(mx>dp[i+1][j])
	mx=dp[i+1][j];
	dp[i][j]=dp[i+1][j];
}
dp[i][s[i]-'a']=mx+1;
}
int idx=0;
string ans="";
while(idx<n)
{
	int mn=0;
	for(int i=0;i<26;i++)
	if(dp[idx][i]<dp[idx][mn])mn=i;
	ans+=char(mn+'a');
	while(idx<n&&s[idx]!=char(mn+'a'))idx++;
	idx++;
}
cout<<ans;
}




Measured memory_bytes: 25108
#include<bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define lper(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};
int main() {

  string S;
  cin >>S;
  int x=S.size();
  repl(i,1,x) {
    if((x-i)%2!=0) {
      continue;
    }
    else {
      int count=0;
      repl(j,1,(x-i)/2+1) {
        
        if(S.at(j-1)==S.at(j-1+(x-i)/2) ) {
          count++;
          //cout<<count<< " "<<x-i<<endl;
        }
      }
      //cout<<"ASA"<< endl;
      //cout<<(x-i)<<" "<<"WWW"<< endl;
      if(count==(x-i)/2) {
        cout<<x-i<< endl;
        break;
      }
        if(count!=(x-i)/2) {
        continue;
      }
    
    
    }
    
  }
  
  
  
  
}
  

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e5+5,M=1e6+5,inf=0x3f3f3f3f,mod=1e9+7;
#define mst(a) memset(a,0,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
ll num[15];
int main(){
	string a;
	cin>>a;
	int n=a.size();
	for(int i=1;i<=n;i++) num[i]=a[i-1]-'0';
	ll s=0;
	for(int i=0;i<(1<<(n-1));i++){
		ll x=num[1];
		for(int j=0;j<n-1;j++){
			if(i&(1<<j)){
				s+=x,x=num[j+2];
			}
			else x=x*10+num[j+2];
		}
		if(x) s+=x,x=0;
	}
	printf("%lld\n",s);
	return 0;
}


Measured memory_bytes: 3652
N, K = map(int, input().split())
R, S, P = map(int, input().split())
T = list(input())
ans = 0
for i in range(K, N):
    if T[i] == T[i - K]:
        T[i] = 'x'
for i in range(N):
    if T[i] == 'x':
        continue
    elif T[i] == 'r':
        ans += P
    elif T[i] == 's':
        ans += R
    else:
        ans += S
print(ans)

Measured memory_bytes: 4084
package main
import "fmt"
func main() {
  var s,t string
  fmt.Scan(&s,&t)
  n := len(s)
  m := len(t)
  nxt := make([][]int,n)
  for i:=0;i<n;i++ { nxt[i] = make([]int,26) }
  idx := make([]int,26)
  for i:=0;i<26;i++ { idx[i] = -1 }
  for i:=n-1;i>=0;i-- { idx[ord(s[i:i+1])] = n+i }
  for i:=0;i<m;i++ {
    if idx[ord(t[i:i+1])] < 0 { fmt.Println(-1);return }
  }
  now := int64(-1)
  for i:=n-1;i>=0;i-- {
    for j:=0;j<26;j++ {
      if idx[j] < 0 { continue }
      nxt[i][j] = idx[j]-i
    }
    idx[ord(s[i:i+1])] = i
    if s[i:i+1] == t[0:1] { now = int64(i) }
  }
  for i:=1;i<m;i++ {
    now += int64(nxt[(now)%int64(n)][ord(t[i:i+1])])
  }
  fmt.Println(now+1)
}
func ord(s string) int {
  return int([]rune(s)[0])-97
}

Measured memory_bytes: 24704
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin >> n;
    int l[n];
    for(int i = 0;i < n;i++)
    {
        cin >> l[i];
    }
    sort(l,l + n);
    int sum = 0;
    for(int i = 0;i < n - 1;i++)
    {
        sum += l[i];
    }
    if(sum > l[n - 1])
    {
        cout << "Yes";
    }
    else
    {
        cout << "No";
    }
    
    return 0;
}

Measured memory_bytes: 256
//
#include <bits/stdc++.h>
using namespace std;
#define INF 1000000000
#define PI 3.14159265
#define EPS 1e-9
#define Pi acos(-1.0)
typedef pair<int, int> ii;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<ll,ll> pll;
#define forr(i,a,b) for(int i=(a); i<(b); i++)
#define clean(arr,val) memset(arr,val,sizeof(arr))
#define forn(i,n) forr(i,0,n)
#define PB push_back
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<pll> vpll;

/*CODE START HERE*/

string s;
char turn;

int main(){
    ios::sync_with_stdio(0);
    queue<char>a,b,c;

    cin >> s;
    forn(i,s.size()){
        a.push(s[i]);
    }

    cin >> s;
    forn(i,s.size()){
        b.push(s[i]);
    }

    cin >> s;
    forn(i,s.size()){
        c.push(s[i]);
    }

    turn = 'a';

    while(true){
        if(turn == 'a'){
            if(a.empty()){
                cout << "A\n";
                break;
            }
            turn = a.front();
            a.pop();
        }else if(turn == 'b'){
            if(b.empty()){
                cout << "B\n";
                break;
            }
            turn = b.front();
            b.pop();
        }else{
            if(c.empty()){
                cout << "C\n";
                break;
            }
            turn = c.front();
            c.pop();
        }
    }
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define INF 10000000000000000
#define mod 998244353

vector<ll> f(200005);
ll modpow(ll a,ll n){//繰り返し二乗法
    if(n==0) return 1;
    if(n==1) return a%mod;
    if(n%2==1) return (a*modpow(a,n-1))%mod;
    ll t=modpow(a,n/2);
    return (t*t)%mod;
}
 
ll combi(ll n,ll r){
    return f[n]*modpow(f[n-r],mod-2)%mod*modpow(f[r],mod-2)%mod;
}
/*mainに

f[0]=1;
for(ll i=1;i<=200000;i++){f[i]=(f[i-1]*i)%mod;}を入れる

*/
int main(){
    ll n,m,k,i;//m:色の種類 k:同色で隣接可能な数
    cin>>n>>m>>k;

    f[0]=1;
    for(ll i=1;i<=200000;i++){f[i]=(f[i-1]*i)%mod;}

    ll ans=0;
    for(i=0;i<=k;i++){
        ans+=((combi(n-1,i)*m)%mod)*modpow(m-1,n-1-i)%mod;
        ans%=mod;
    }
    //combi(n-1,i):分け方
    //m*modpow(m-1,n):色の割り当て方

    cout<<ans<<endl;

    return 0;
}

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

int main(){
  int n,i = 0;
  cin >> n;
  for(int x =1; x<10; x++){
    if(n%x != 0)
      continue;
    else if(n/x >9)
      continue;
    else{
      cout << "Yes" << endl;
      i= 1;
      break;
    }
  }
  if (i==0)
    cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;
using namespace std;
 
#define ff                  first
#define ss                  second
#define endl                "\n"
#define loop(i,s,e)         for(int i=s;i<e;i++)
#define int                 long long
#define vi                  vector<int> 
#define S(v)                sort(v.begin(),v.end())
#define RS(v)               sort(v.rbegin(),v.rend())
#define R(v)                reverse(v.begin(),v.end())
#define mxpq(T)             priority_queue <T>
#define mnpq(T)             priority_queue<T,vector<T>,greater<T>>
#define prv(v)              for(auto &x : v)cout << x << " ";
#define piirv(v)            for(auto &x : v)cout << x.ff << " " << x.ss << endl;
#define prvv(v)             for(auto &x : v)for(auto &y : x.ss)cout << y << " ";
#define mp                  make_pair
#define pii                 pair<int,int>
#define mset(a,f)           memset(a , f , sizeof(a))
#define pb                  push_back
#define inf                 INT_MAX
#define INF                 LLONG_MAX
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> oset;
 
const int N = 2e6 + 6;
const int M = 1e9+7;
int A[N];
int dp[N][2][2];
int n , m;

// int alpha(int i , int f1 ,int f2)
// {
// 	if(i >= n)
// 	{
// 		if(f1 && f2)return 1;
// 		return 0;
// 	}
// 	int &abs = dp[i][f1][f2];
// 	if(abs != -1)return abs;
// 	int ans = 0;
// 	loop(j,0,10)
// 	{
// 		if(j == 0)ans += alpha(i+1 , 1, f2);
// 		if(j == 9)ans += alpha(i+1 , f1, 1);
// 		if(j > 0 && j < 9)ans += alpha(i+1 , f1, f2);
// 		ans %= M;
// 	}

// 	return abs = ans%M;
// }

void solve()
{
	cin >> n;
	// mset(dp,-1);
	// int ans = alpha(0 ,0 , 0);
	// cout << ans;

	dp[0][1][1] = 1;

	loop(i,1,n+1)
	{
		loop(j,0,2)
		{
			loop(k,0,2)
			{
				loop(l,0,10)
				{
					if(l == 0)dp[i][j][k] += dp[i-1][1][k];
					if(l == 9)dp[i][j][k] += dp[i-1][j][1];
					if(l > 0 && l < 9)dp[i][j][k] += dp[i-1][j][k];
					dp[i][j][k] %= M;
				}
			}
		}
	}

	cout << dp[n][0][0];
}			
 
int32_t main()
{
 
cout<<fixed<<setprecision(16);
 
ios_base:: sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
 	
 
 	int t = 1;
 	// cin >> t;
 	while(t--)solve();
  
}

Measured memory_bytes: 34824
K=int(input())
A=list(map(int, input().split()))

mx=2
mn=2
for i in range(K-1,-1,-1):
    a = A[i]
    a_mn = ((mn+a-1)//a)*a
    a_mx = mx - mx%a
    if a_mn > a_mx:
        print(-1)
        exit()
    mn=a_mn
    mx=a_mx+a-1
print("{} {}".format(mn,mx))

Measured memory_bytes: 14224
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> mp;
#define inf 1e9


int main(){
	int a,b,c;
	cin>>a>>b>>c;
	if(min(a,b)<c&&c<max(a,b) ){
		cout<<"Yes"<<endl;
	}else{
		cout<<"No"<<endl;
	}


	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
int main()
{
	int N, X, temp, i;
	vector<int> L;
	cin >> N >> X;
	for (int i = 0; i < N; i++) {
		cin >> temp;
		L.push_back(temp);
	}
	for (i = 0, temp = 0; i < N; i++) {
		if (temp > X) {
			break;
		}
		temp += L[i];
	}
	if (temp <= X) i++;
	cout << i << endl;
	return 0;
}


Measured memory_bytes: 256
import queue

N, M = map( int, input().split() )
L = [[] for _ in range( N ) ] 

for i in range( M ):
  A, B = map( int, input().split() )
  A, B = A - 1, B - 1
  L[ min( A, B ) ].append( max( A, B ))
  L[ max( A, B ) ].append( min( A, B ))
  
R = [ -1 ] * N
Q = queue.Queue()
Q.put( 0 )
while not Q.empty():
  n = Q.get()
  for l in L[ n ]:
    if R[ l ] == -1:
      R[ l ] = n + 1
      Q.put( l )

is_Flag = True 
for i in R:
  if i < 0:
    is_Flag = False
if is_Flag:
  print( "Yes" )
else:
  print("No")

for i in range( 1, N ):
  print( R[ i ] )

Measured memory_bytes: 37008
n, k = [int(i) for i in input().split()]
s = input()

l = []
if s[0] == "0":
    l.append(0)
one = []
cnt_0 = 0
cnt_1 = 0

for i in s:
    if i == '0':
        if cnt_1 != 0:
            l.append(cnt_1)
            one.append((cnt_1))
            cnt_1 = 0
        cnt_0 += 1
    if i =='1':
        if cnt_0 != 0:
            l.append(cnt_0)
            cnt_0 = 0
        cnt_1 += 1

if cnt_1 != 0:
    l.append(cnt_1)
    one.append(cnt_1)
if cnt_0 != 0:
    l.append(cnt_0)
    l.append(0)

#print(l)
ans = 0
Sum = [0]
for i in range(len(l)):
    Sum.append(l[i]+Sum[i])
#print(Sum)

for i in range(1,len(Sum),2):
    left = i-1
    if i+k*2 > len(Sum)-1:
        right = len(Sum)-1
    else:
        right = i+k*2
    #print(left,right)
    temp = Sum[right] - Sum[left]
    if ans < temp:
        ans = temp
print(ans)


Measured memory_bytes: 8340
#include <bits/stdc++.h>
#define SORT(a) sort(a.begin(), a.end())
#define RSORT(a) sort(a.rbegin(), a.rend())
#define REP(i, n) for (long long i = 0; i < n; i++)
#define RREP(i, n) for (long long i = n - 1, 0 <= i; i--)
#define FOR(i, start, end) for (long long i = start; i < end; i++)
#define RFOR(i, start, end) for (long long i = start - 1; 0 <= i; i--)
#define ALL(a) a.begin(), a.end()
#define MOD(a) a %= 1'000'000'007
using ll = long long;
using namespace std;
const int INF32       = 1'050'000'000;
const long long INF64 = 4'000'000'000'000'000'000;
const int MOD7        = 1'000'000'007;
const int MOD9        = 1'000'000'009;
template <class T> inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
void print() { std::cout << '\n'; }
template <class H, class... T> void print(H &&head, T &&... args) {
    std::cout << head;
    sizeof...(args) == 0 ? std::cout << "" : std::cout << ' ';
    print(std::forward<T>(args)...);
}
template <class T> void print(std::vector<T> &v) {
    for (int i = 0; i < v.size(); i++) {
        std::cout << v[i];
        i == v.size() - 1 ? std::cout << '\n' : std::cout << ' ';
    }
}
template <class T> void print(std::vector<std::vector<T>> &v) {
    for (int i = 0; i < v.size(); i++) {
        for (int j = 0; j < v[i].size(); j++) {
            std::cout << v[i][j];
            j == v[i].size() - 1 ? std::cout << '\n' : std::cout << ' ';
        }
    }
}

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

    int N, W;
    cin >> N >> W;
    vector<int> w(N), v(N);
    REP(i, N) cin >> w[i] >> v[i];

    vector<vector<ll>> dp(N + 1, vector<ll>(W + 1));
    REP(i, N) {
        REP(j, W + 1) {
            if (0 <= j - w[i]) {
                chmax(dp[i + 1][j], dp[i][j - w[i]] + v[i]);
            }
            chmax(dp[i + 1][j], dp[i][j]);
        }
    }
    print(dp[N][W]);

    return 0;
}

Measured memory_bytes: 80256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())
#define ll long long
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;
//typedef vector<unsigned int>vec;
//typedef vector<ll>vec;
//typedef vector<vec> mat;
typedef vector<vector<int>> Graph;

//const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
//const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int INF = 1000000000;
const ll LINF = 1000000000000000000;//1e18
const ll  MOD = 1000000007;
const double PI = acos(-1.0);
const double EPS = 1e-10;

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; }
template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};


const int MAX = 1110000;
long long fac[MAX], finv[MAX], inv[MAX];

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

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

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, k;
    cin >> n >> k;
    comb_init();
    if(n > k) cout << 0 << endl;
    else cout << comb(k, n) << endl;
}


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

struct UnionFind {
    vector<int> d;
    UnionFind(int n = 0): d(n, -1) {}
    int find(int x) {
        if (d[x] < 0) return x;
        return d[x] = find(d[x]); 
    }
    bool unite(int x, int y) {
        x = find(x); y = find(y);
        if (x == y) return false;
        if (d[x] > d[y]) swap(x, y);
        d[x] += d[y];
        d[y] = x;
        return true;
    }
    bool same(int x, int y) { return find(x) == find(y); }
    int size(int x) { return -d[find(x)]; }
};
 
int main() {
    int N, M, K; cin >> N >> M >> K;
    UnionFind uf(N);
    
    vector<int> ng1(N);
    for (int i = 0; i < M; i++) {
        int A, B; cin >> A >> B;
        A--, B--;
        uf.unite(A, B);
        ng1[A]++;
        ng1[B]++;
    }

    vector<int> ng2[N];
    for (int i = 0; i < K; i++) {
        int C, D; cin >> C >> D;
        C--, D--;
        ng2[C].push_back(D);
        ng2[D].push_back(C);
    }

    for (int i = 0; i < N; i++) {
        int ans = uf.size(i) - 1 - ng1[i];
        for (int j : ng2[i]) {
            if (uf.same(i, j)) ans--;
        }
        printf("%d%c", ans, i == N-1 ? '\n' : ' ');
    }
    return 0;
}


Measured memory_bytes: 9012
#include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;
const int sz=1e5+7;
int main()
{
	int n,i,A=0,B=0,C=0,x;
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{	scanf("%d",&x);
		if(x%4==0) B++;
		else if(x%2==0) C++;
		else A++;
	}
	if(B==A-1&&C==0||B>=A) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;

public class Main {
    public static final long mod = (long)1e9+7;
    public static final long INF = Long.MAX_VALUE/4;
    public static final int inf = Integer.MAX_VALUE/4;

    static void solve(InputReader in, PrintWriter out){
        String a = in.ns(), b = in.ns(),c = in.ns();
        boolean flag = (a.charAt(a.length()-1)==b.charAt(0))&&(b.charAt(b.length()-1)==c.charAt(0));
        out.println(flag?"YES":"NO");
    }

    public static void main(String[] args){
        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(System.out);
        solve(in, out);
        out.close();
    }
    public static class InputReader{
        private BufferedReader br;
        private StringTokenizer st;
        public InputReader(InputStream is){
            br = new BufferedReader(new InputStreamReader(is));
            st = null;
        }
        public String ns(){
            if(st == null || !st.hasMoreTokens()){
                try{
                    st = new StringTokenizer(br.readLine());
                }catch (Exception e){
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }
        public int ni(){
            return Integer.parseInt(ns());
        }
        public long nl(){
            return Long.parseLong(ns());
        }
        public Double nd(){
            return Double.parseDouble(ns());
        }
        public int[] ni(int n){
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = ni();
            }
            return a;
        }
        public long[] nl(int n){
            long[] a = new long[n];
            for (int i = 0; i < n; i++) {
                a[i] = nl();
            }
            return a;
        }
        public double[] nd(int n){
            double[] a = new double[n];
            for (int i = 0; i < n; i++) {
                a[i] = nd();
            }
            return a;
        }
    }
}

Measured memory_bytes: 21204
#include<stdio.h>
using namespace std;
int main(void)
{
	int c[5],cnt[15],i,j,yaku,flg,flg2,n;
	char yak[8][11]={"","null","one pair","two pair","three card",
						"straight","full house","four card"};
						
	while(scanf("%d,%d,%d,%d,%d",&c[0],&c[1],&c[2],&c[3],&c[4])!=EOF)	{
		for(i=1;i<=14;i++)	cnt[i]=0;
		for(i=0;i<5;i++)	{
			if(c[i]==1)	cnt[14]++;
			cnt[c[i]]++;
		}
//		for(i=2;i<=14;i++)	{
//			printf(" kazu=%d\n",cnt[i]);
//		}
		yaku=1;
		for(i=2;i<=14;i++)	{
			if(cnt[i]==4)	{
				yaku=7;
				break;
			}
		}
		if(yaku==1)	{
			flg=0;	flg2=0;
			for(i=2;i<=14;i++)	{
				if(cnt[i]==3)	{
					flg=1;
				}
				if(cnt[i]==2)	{
					flg2=1;
				}
			}
			if(flg==1 && flg2==1)	{
				yaku=6;
			}
		}
		if(yaku==1)	{
			for(i=1;i<=10;i++)	{
				flg=1;
				for(j=0;j<5;j++)	{
					if(cnt[i+j]!=1)	{
						flg=0;
						break;
					}
				}
				if(flg==1)	{
					yaku=5;
					break;
				}
			}
		}
		if(yaku==1)	{
			for(i=2;i<=14;i++)	{
				if(cnt[i]==3)	{
					yaku=4;
					break;
				}
			}
		}
		if(yaku==1)	{
			n=0;
			for(i=2;i<=14;i++)	{
				if(cnt[i]==2)	{
					n++;
				}
			}
			if(n==2)	{
				yaku=3;
			}
			else if(n==1)	{
				yaku=2;
			}
		}
		printf("%s\n",yak[yaku]);
	}
	return 0;
}


Measured memory_bytes: 1012
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<stack>
#include<cstdio>
#include<sstream>
#include<iomanip>
#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 all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<int,pii> pip;
typedef vector<pip>vip;
const double PI=acos(-1);
const double EPS=1e-7;
const int inf=1e8;
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
string s;
int f(int a){
	if(s[a]=='+')return 1;
	if(s[a]=='-')return -1;
	bool h=false;
	while(a&&isdigit(s[a]))a--;
	if(s[a]=='-')h=true;
	a++;
	int t=0;
	while(a!=s.size()&&isdigit(s[a])){
		t*=10;
		t+=s[a]-'0';
		a++;
	}
	if(h)t*=-1;
	return t;
}
int main(){
	cin>>s;
	s="+1"+s;
	vi in(6);
	int n=s.size();
	rep(i,n)if(s[i]=='x'){
		if(s[i+1]=='^')in[s[i+2]-'0']=f(i-1);
		else in[1]=f(i-1);
	}
	in[0]=f(n-1);
	vi out;
	for(int i=-2000;i<=2000;i++){
		ll sum=0;
		rep(j,6){
			sum*=i;
			sum+=in[5-j];
		}
		if(sum==0)out.pb(-i);
	}
	sort(all(out));
	rep(i,out.size())printf("(x%+d)",out[i]);cout<<endl;
}

Measured memory_bytes: 3268
#pragma region template 2.4
#include <bits/stdc++.h>
using namespace std;
template <typename T>
using pq_asc = priority_queue<T, vector<T>, greater<T>>;
typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> ii;
typedef vector<ii> vii;
typedef vector<string> vs;
#define REP(i, n) for (ll i = 0; i < (n); ++i)
#define REP1(i, n) for (ll i = 1; i <= (n); ++i)
#define FOR(i, a) for (auto &i : a)
#define CH(f, x, y) x = f(x, y)
#define IN(T, x) \
    T x;         \
    cin >> x;
#define AIN(T, a, n) \
    vector<T> a(n);  \
    FOR(i, a)        \
    cin >> i;
#define A2IN(T1, a, T2, b, n) \
    vector<T1> a(n);          \
    vector<T2> b(n);          \
    REP(i, n)                 \
    cin >> a[i] >> b[i];
#define OUT(x) cout << (x) << endl;
#define FOUT(x) cout << fixed << setprecision(15) << (x) << endl;
#define ALL(a) (a).begin(), (a).end()
#define SORT(a) sort(ALL(a))
#define RSORT(a) \
    SORT(a);     \
    reverse(ALL(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define DUMPA(a)          \
    cout << #a << " = {"; \
    JOUT(ALL(a), ", ", cout) << "}" << endl;

template <typename T>
ostream &JOUT(T s, T e, string sep = " ", ostream &os = cout)
{
    if (s != e)
    {
        os << *s;
        ++s;
    }
    while (s != e)
    {
        os << sep << *s;
        ++s;
    }
    return os;
}

ostream &YES(bool cond, string yes = "Yes", string no = "No", ostream &os = cout)
{
    if (cond)
    {
        os << yes << endl;
    }
    else
    {
        os << no << endl;
    }
    return os;
}

template <typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p)
{
    os << '(' << p.first << ", " << p.second << ')';
    return os;
}

template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v)
{
    os << '[';
    JOUT(ALL(v), ", ", os) << ']';
    return os;
}

const ll INF = 1e18;
const ll MOD = 1e9 + 7;
#pragma endregion template

int main()
{
    IN(ll, N);
    IN(ll, K);
    ll ans = 0;
    while (N > 0)
    {
        N /= K;
        ++ans;
    }
    OUT(ans);
}

Measured memory_bytes: 256
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

def main():
    A = [[int(i) for i in input().split()] for j in range(3)]
    N = int(readline())

    ans = [[0]*3 for _ in range(3)]
    for i in range(N):
        b = int(readline())
        for j, a in enumerate(A):
            for k, a_ in enumerate(a):
                if b == a_:
                    ans[j][k] = 1

    #print(ans)
    for a in ans:
        if sum(a) == 3:
            print("Yes")
            exit()
    
    for i in range(3):
        if ans[0][i] + ans[1][i] + ans[2][i] == 3:
            print("Yes")
            exit()
    
    if ans[0][0] + ans[1][1] + ans[2][2] == 3:
        print("Yes")
        exit()
    
    if ans[0][2] + ans[1][1] + ans[2][0] == 3:
        print("Yes")
        exit()

    print("No")

if __name__ == "__main__":
    main()


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,n) for(int i = 0; i < n; ++i)
#define rep2(i,st,ed) for(int i = st; i < ed; ++i)
#define mk(x,y) make_pair(x,y)
#define pb(x) push_back(x)
const ll mod = 1e9+7;
const ll N = 1e6 + 200;
const ll INF = 9999999999999;
const double eps = 1e-7;

int a[] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
int main(){
     int n;
     cin>>n;
    cout<<a[n-1]<<endl;

    return 0;
}

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

int W,H,x,y;

void solve(){
    cin>>W>>H>>x>>y;
    cout <<W*H/2.0<<" ";
    if(W/2.0==x&&H/2.0==y){
        cout<<1<<endl;
    }
    else{
        cout<<0<<endl;
    }
}

signed main(){
    solve();
}

Measured memory_bytes: 256
from sys import stdin

def counting_sort(nums, k):
    out = [0] * len(nums)
    cnts = [0] * (k + 1)
    offsets = [0] * (k + 1)
    for n in nums:
        cnts[n] = cnts[n] + 1
    
    for i in range(len(cnts)):
        if i > 0:
            offsets[i] = offsets[i - 1] + cnts[i - 1]
    
    for n in nums:
        out[offsets[n]] = n
        offsets[n] = offsets[n] + 1
    return out

def main():
    lines = stdin.readlines()
    nums = list(map(int, lines[1].split(' ')))
    n_max = max(nums)
    sorted_nums = counting_sort(nums, n_max)
    print(' '.join(map(str, sorted_nums)))

if __name__ == '__main__':
    main()


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

template<typename T>
T gcd(T a,T b){return b==0?a:gcd(b,a%b);}

int main()
{
	int T; scanf("%d",&T);
	unsigned long int A,B,C,D;
	for(;0<T;T--)
	{
		scanf("%ld%ld%ld%ld",&A,&B,&C,&D);
		if(A<B||D<B||C<A%B||C<B-gcd(B,D)) puts("No");
		else puts("Yes");
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define LL long long
#define pa pair<int,int>
const int Maxn=4010;
const int mod=998244353;
const int inf=2147483647;
int read()
{
	int x=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9')x=(x<<3)+(x<<1)+(ch^48),ch=getchar();
	return x*f;
}
void upd(int &x,int y){x+=y;if(x>=mod)x-=mod;}
int k,n,C[Maxn][Maxn];
void pre()
{
	C[0][0]=1;
	for(int i=1;i<=4000;i++)
	{
		C[i][0]=1;
		for(int j=1;j<=i;j++)
		C[i][j]=(C[i-1][j-1]+C[i-1][j])%mod;
	}
	
}
int main()
{
	int ans=0;
	pre();
	k=read(),n=read();
	for(int i=2;i<=(k<<1);i++)
	{
		int t,tmp=0;
		if(i<=k+1)t=(i>>1);
		else t=(i>>1)-(i-k)+1;
		for(int j=0;(j<<1)<=n&&j<=t;j++)
		{
			if(!(j&1))upd(tmp,(LL)C[t][j]*C[n-(j<<1)+k-1][k-1]%mod);
			else upd(tmp,(LL)mod-(LL)C[t][j]*C[n-(j<<1)+k-1][k-1]%mod);
		}
		printf("%d\n",tmp);
//		upd(ans,tmp);
	}
//	printf("%d",ans);
}

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

int main()
{
  int w, a, b;
  cin >> w >> a >> b;
  int ans;
  if(b>a+w)
  {
    ans = b-(a+w);
  }
  else if(a>b+w)
  {
    ans = a-(b+w);
  }
  else
  {
    ans = 0;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int A, B, C, X;

int main()
{
  cin >> A >> B >> C >> X;
  int res = 0;
  for(int a = 0; a <= A; ++a){
    for(int b = 0; b <= B; ++b){
      for(int c = 0; c <= C; ++c){
        int total = 500*a + 100*b + 50*c;
        if(total == X)++res;
      }
    }
  }
  cout << res << endl;
}

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

int main() {
    char a;
    cin >> a;
    
    if ('a' <= a && a <= 'z')
        cout << 'a' << endl;
    else
        cout << 'A' << endl;
    
    return 0;
}


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

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

  int ans = 0;
  while (true) {
    if (*max_element(h.begin(), h.end()) == 0) break;

    int i = 0;
    while (i < n) {
      if (h[i] == 0) i++;
      else {
        ans++;
        while (i < n && h[i] > 0) {
          h[i]--;
          i++;
        }
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3624
#include<iostream>
using namespace std;
int main()
{
	int n,i1,i2,sum = 0;
	cin>>n;
	while(n != 0)
	{
		cin>>i1>>i2;
		sum += i2 - i1 + 1;
		n--;
	}
	cout<<sum<<endl;
	return 0;
 }

Measured memory_bytes: 256
import java.util.*; 

class Main{
public static void main(String[] args){
	Scanner sc=new Scanner(System.in);
        String s=sc.next();
   		String[] a=s.split("");
  		int ans=0;

		for(int c=0;c<a.length-1;c++){
    		if(a[c].equals("0")&&a[c+1].equals("0")){
              a[c+1]="1";
              ans++;
            }else if(a[c].equals("1")&&a[c+1].equals("1")){
              a[c+1]="0";
              ans++;
            }
    	}
  
    	System.out.println(ans);
    }
}


Measured memory_bytes: 46540
# -*- encoding: utf-8 -*-
import sys
import re
import random
import numpy as np
from math import sqrt,log
from fractions import gcd  # python<=3.4
from collections import Counter, defaultdict

MOD=1000000007

def lcm(a,b):
  return a/gcd(a,b)*b

def read_int():
  return int(raw_input())
# N = read_int()

def read_ints():
  return map(int,raw_input().split())
# a,b,c,d=read_ints()

def read_field():
  return raw_input()

def read_fields():
  return raw_input().split()

def print_array(ar):
  n = len(ar)
  for i in range(n-1):
    print ar[i],
  print ar[-1]

def say_bool(val, strs=['Yes','No']):
  print strs[int(val)]


N=read_int()
s=raw_input().rstrip()
#assert N==len(s)
st = Counter(s)
#print st
if st['R'] > st['B']:
  print 'Yes'
else:
  print 'No'

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

typedef long long llong;

const int maxn=2*1e3+10;
const llong mod=1e9+7;

llong n,k;
int a[maxn],b[maxn];
llong num1[maxn],num2[maxn];

int main()
{
    scanf("%I64d%I64d",&n,&k);
    for(int i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
        b[i]=a[i];
    }
    sort(b,b+n);
    for(int i=0;i<n;i++)
    {
        num2[i]=lower_bound(b,b+n,a[i])-b;
        for(int j=i+1;j<n;j++)
            if(a[j]<a[i]) num1[i]++;
    }
    llong ans=0;
    for(int i=0;i<n;i++)
    {
        //cout<<num1[i]<<' '<<num2[i]<<endl;
        ans=(ans+k*num1[i])%mod;
        ans=(ans+k*(k-1)/2%mod*num2[i]%mod)%mod;
    }
    cout<<ans%mod<<endl;
}


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

int main() {
  int a, b, c, x, s, rem1, rem2;
  std::cin >> a >> b >> c >> x;

  int mfh, moh, mft;
  mfh = (x / 500 > a) ? a : x / 500;

  s = 0;
  for (int fh = mfh; fh >= 0; fh--) {
    rem1 = x - 500*fh;
    moh = (rem1 / 100 > b) ? b : rem1 / 100;
    for (int oh = moh; oh >= 0; oh--) {
      rem2 = rem1 - 100*oh;
      if (rem2 / 50 <= c && rem2 - 50 * (rem2 / 50) == 0) {
        s += 1;
      }
    }
  }
  
  std::cout << s << std::endl;
  return 0;
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#include<algorithm>//next_permutation
#define rep(i,n) for (int i = 0;i < (n);i++)
#define all(v) v.begin(),v.end()
#define dec(n) cout << fixed << setprecision(n);
#define large "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
#define small "abcdefghijklmnopqrstuvwxyz"
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using vvl = vector<vl>;

ll gcd(ll a,ll b){
  if(b == 0) return a;
  return gcd(b , a % b);
}

ll mod(ll a){
  return (a % 1000000007);
}

ll lcm(ll a,ll b){
  return (a*b)/gcd(a,b);
}

ll nCr(ll n,ll r){
  if(r == 1) return n;
  else if(r == 0) return 1;
  else return nCr(n-1,r-1)*n/r;
}

int main(){
  ll a,b,c,x,y; cin >> a >> b >> c >> x >> y;
  ll ans = 1e13;
  
  for(ll i=0; i <= 2*max(x,y); i+=2){
    ans = min(ans,a*max(0LL,(x-i/2))+b*max(0LL,(y-i/2))+c*i);
  }
  
  cout << ans << endl;
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0;i < (int)(n);i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n);i++)
#define ALL(vec)  (vec).begin(),(vec).end()
#define lli long long int
#define pi 3.1415926535897932384626433832795
#define MAX_INF 9223372036854775807
#define MIN_INF 9223372036854775807+1

int main() 
{int A,B;
 cin >>A>>B;
 vector<int> L(A);
 rep(i, A)
   cin >>L[i];
 int ans=0;
 rep(i, A)
 {if(B<0){
   cout <<ans<<endl;
    return 0;
   }
   ans++;
   
B-=L[i]; 
 }
 if(B<0){
   cout <<ans<<endl;
    return 0;
   }
   ans++;
   
  cout <<ans<<endl;
    return 0;
}


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

struct mint{
    // 自動的にmodを取ってくれるクラスです。
    ll x;
    mint(ll x = 0):x(x%mod){}
    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 b = pow(t/2);
        b *= b;
        if(t%2 == 1) b *= *this;
        return b;
    }

    mint inv() const{
        return pow(mod-2);
    }
    mint& operator/=(const mint a){
        (*this) *= a.inv();
        return *this;
    }
    mint operator/(const mint a) const{
        mint res(*this);
        return res/=a;
    }
};

int main(){
    int s;
    cin >> s;
    vector<mint> dp(s+1,0);
    dp.at(0) = mint(1);
    mint mx;
    for(int i = 1; i <= s;i++){
        if(i >= 3) mx+=dp.at(i-3);
        dp.at(i) = mx;
    }
    // rep(i,2005){
    //     rep(j,i-2){
    //         dp.at(i) += dp.at(j);
    //     }
    // }
    cout << dp.at(s).x << endl;
}

Measured memory_bytes: 3608
using System;

namespace _168
{
    class Program
    {
        static void Main(string[] args)
        {

            B();
        }

        public static void A()
        {
            int x = int.Parse(Console.ReadLine()) % 10;
            if (x == 2 || x == 4 || x == 5 || x == 7 || x == 9)
            {
                Console.WriteLine("hon");
            }
            if (x == 0 || x == 6 || x == 1 || x == 8)
            {
                Console.WriteLine("pon");
            }
            if (x == 3)
            {
                Console.WriteLine("bon");
            }
        }

        public static void B()
        {
            int k = int.Parse(Console.ReadLine());
            string s = Console.ReadLine();

            if(s.Length > k)
            {
                Console.WriteLine(s.Substring(0,k) + "...");
            }
            else
            {
                Console.WriteLine(s);
            }
        }
    }
}


Measured memory_bytes: 27532
import java.io.IOException;
import java.util.Scanner;
public class Main {

	public static void main(String[] args) throws IOException{
		// TODO ?????????????????????????????????????????????
          Scanner sc = new Scanner(System.in);
          int a = sc.nextInt();
          int b = sc.nextInt();
          int c = sc.nextInt();
          int d;
          d=0;
          while(a<=b){
        	  if(c%a == 0){
        		d=d+1;  
        	  }
        	  a=a+1;
          }
          System.out.println(d);
	}

}

Measured memory_bytes: 26348
#!python3

iim = lambda: map(int, input().rstrip().split())

def resolve():
    N, X, Y = iim()
    ans = [N-i-1 for i in range(N-1)]
    X1, Y1 = X-1, Y -1

    xy2 = (X+Y)  // 2
    for i in range(N):
        x1 = X1 - i
        if x1 < 0: x1 = -x1
        for j in range(i+1, N):
            d1 = j - i - 1
            y1 = Y1-j
            if y1 < 0: y1 = -y1
            d2 = x1 + y1
            if d1 > d2:
                #print((i+1, j+1), d1+1, d2+1, x1, y1)
                ans[d1] -= 1
                ans[d2] += 1

    print(*ans, sep="\n")

if __name__ == "__main__":
    resolve()


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

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

  int flag = 0;

  vector<int> p(n);

  rep(i, n)
  {
    cin >> p.at(i);
  }

  vector<int> p_tmp(n);

  p_tmp = p;

  sort(p_tmp.begin(), p_tmp.end());

  rep(i, n)
  {
    if (p_tmp.at(i) != p.at(i))
      flag++;
  }

  if (flag == 2 || flag == 0)
    cout << "YES" << endl;
  else
  {
    cout << "NO" << endl;
  }
}


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

int main(){
  int i,n,array[100001],array2[100001],array3[100001];
  cin>>n;
  
  for(i=0;i<n;i++){
    cin>>array[i]>>array2[i]>>array3[i];
  }
  if(array2[0]+array3[0]>array[0]||(array[0]-array2[0]-array3[0])%2==1){
    cout<<"No"<<endl;
    return 0;
  }
  for(i=0;i<n-1;i++){
    if((array2[i+1]-array2[i]+array3[i+1]-array3[i])<=array[i+1]&&(array[i+1]-array[i]-(array2[i+1]-array2[i]+array3[i+1]-array3[i]))%2==0){
      continue;
    }else{
      cout<<"No"<<endl;
      return 0;
    }
  }
  cout<<"Yes"<<endl;
}

Measured memory_bytes: 1408
def main():
    import sys
    input = sys.stdin.readline

    h,w,m = map(int, input().split())
    h_count = [0 for _ in range(h)]
    w_count = [0 for _ in range(w)]
    pairs = set()

    for i in range (m):
        hi, wi = map(int, input().split())
        hi -= 1
        wi -= 1

        h_count[hi] += 1
        w_count[wi] += 1

        pairs.add((hi,wi))

    h_max = max(h_count)
    w_max = max(w_count)
    hk = list()
    wk = list()

    for index , hj in enumerate(h_count):
        if hj == h_max:
            hk.append(index)
    
    for index, wj in enumerate(w_count):
        if wj == w_max:
            wk.append(index)

    ans = h_max + w_max

    for _h in hk:
        for _w in wk:
            hw = (_h, _w)

            if hw in pairs:
                continue

            print(ans)
            exit()
    print(ans -1)

if __name__ == '__main__':
    main()



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

int main()
{
	ll n;
	cin>>n;
	char arr[11];
	vector<string> s;
	for(ll i=0;i<n;i++)
	{
		cin>>arr;
		sort(arr,arr+10);
		s.push_back(arr);	
	}
	ll cnt=1,ans=0;
	sort(s.begin(),s.end());
	for(ll i=1;i<n;i++)
	{
		
		if(s[i]==s[i-1])
			cnt++;
		else
			{
				ans+=cnt*(cnt-1)/2;
				cnt=1;
			}
		
		
	}
	ans+=cnt*(cnt-1)/2;
	cout<<ans;

}

Measured memory_bytes: 7796
A = [int(input()) for _ in range(5)]

ans = float('inf')

for i in range(5):
	cur = 0
	for j in range(5):
		if i == j: continue
		cur += A[j]
		cur = (cur + 9) // 10 * 10
	cur += A[i]
	
	ans = min(ans, cur)

print(ans)


Measured memory_bytes: 3060
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws FileNotFoundException {
		new Main().run();
	}

	class Edge implements Comparable<Edge> {
		int[] id;
		int cost;

		public Edge(int id1_, int id2_, int cost_) {
			id = new int[] { id1_, id2_ };
			cost = cost_;
		}

		@Override
		public int compareTo(Edge o) {
			return Integer.compare(cost, o.cost);
		}
	}

	int NIL = Integer.MAX_VALUE;

	void run() {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		DJSet ds = new DJSet(n);
		int[][][] lis = new int[2][n][];
		for (int i = 0; i < n; ++i) {
			int x = sc.nextInt();
			int y = sc.nextInt();
			lis[0][i] = new int[] { x, i };
			lis[1][i] = new int[] { y, i };
		}
		int[][] ref = new int[2][n];
		Arrays.sort(lis[0], new Comparator<int[]>() {
			@Override
			public int compare(int[] o1, int[] o2) {
				return Integer.compare(o1[0], o2[0]);
			}
		});
		Arrays.sort(lis[1], new Comparator<int[]>() {
			@Override
			public int compare(int[] o1, int[] o2) {
				return Integer.compare(o1[0], o2[0]);
			}
		});
		PriorityQueue<Edge> pq = new PriorityQueue<>();
		for (int t = 0; t < 2; ++t) {
			for (int i = 0; i + 1 < n; ++i) {
				pq.add(new Edge(lis[t][i][1], lis[t][i + 1][1], lis[t][i + 1][0] - lis[t][i][0]));
			}
		}

		long ans = 0;
		while (!pq.isEmpty()) {
			Edge e = pq.poll();
			if (ds.equiv(e.id[0], e.id[1])) {
				continue;
			}
			ans += e.cost;
			ds.setUnion(e.id[0], e.id[1]);
		}
		System.out.println(ans);
	}

	class DJSet {
		int n;
		int[] upper;

		public DJSet(int n_) {
			n = n_;
			upper = new int[n];
			Arrays.fill(upper, -1);
		}

		boolean equiv(int x, int y) {
			return root(x) == root(y);
		}

		int root(int x) {
			return upper[x] < 0 ? x : (upper[x] = root(upper[x]));
		}

		void setUnion(int x, int y) {
			x = root(x);
			y = root(y);
			if (x != y) {
				if (upper[x] < upper[y]) {
					int tmp = x;
					x = y;
					y = tmp;
				}
				upper[y] += upper[x];
				upper[x] = y;
			}
		}
	}

	void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}
}

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

const ll maxs = 1e5+5;
const ll lmaxs = 20;
ll mod = 1e9+7;
ll oo = 1e15;

#define IOS ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define I insert
#define endl '\n'

void pre(){

}

const ll N = 2003;

ll dp[N][2*N];
bool vis[N][2*N];
pair<ll,ll> a[N];
ll n;

ll go(ll ind,ll i,ll j){
    if(ind >= n )
        return 0;
    ll& ans = dp[i][j];
    if(vis[i][j])
        return dp[i][j];
    vis[i][j] = true;
    ans = a[ind].ff*abs(i - a[ind].ss) + go(ind+1,i+1,j);
    ans = max( ans , a[ind].ff*abs(j - a[ind].ss) + go(ind+1,i,j-1) );
    return ans;
}

void solve(){ 
    cin >> n;
    for(ll i=0;i<n;i++){
        ll val;
        cin >> val;
        a[i].ff = val;
        a[i].ss = i;
    }
    sort(a,a+n);
    reverse(a,a+n);
    ll ans = go(0,0,n-1);
    cout << ans << endl;
}


int main(){
    // #ifndef ONLINE_JUDGE
    // freopen("input00.txt","r",stdin);
    // #endif
    IOS;
    pre();
    ll T = 1;   
    //cin>>T;
    while(T--){  
        solve();
    }
    return 0;
}

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

int c,d,e,n,m;
int a[101][101]={};
int b[101]={};
e=0;

scanf("%d %d",&n,&m);

//=====================
//printf("n=%d  m=%d\n",n,m);
//=====================

for(c=1;c<=n;c++){
	for(d=1;d<=m;d++){
	scanf("%d",&a[c][d]);
	
	//=================
	//printf("%d ",a[c][d]);
	//=================
	
	}
	
	//=================
	//printf("\n");
	//=================
	
}

/*//=====================
for(c=1;c<=n;c++){
	for(d=1;d<=m;d++){
	printf("%d ",a[c][d]);
	}
	printf("\n");
}
//=====================*/

for(d=1;d<=m;d++){
scanf("%d",&b[d]);
}

for(c=1;c<=n;c++){
	for(d=1;d<=100;d++){
	e=e+a[c][d]*b[d];
	
	//=============
	//printf("%d\n",e);
	//=============
	}
	printf("%d\n",e);
	e=0;
}

return 0;
}

Measured memory_bytes: 648
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cstring>
#include<string>
#include<cmath>
#include<vector>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
using namespace std;
const int inf=2147483647,dx[]={-1,0,1,0},dy[]={0,-1,0,1};// 上 左 下 右
const int N=100005,M=1000005,mod=1000000007;
const long long llinf=9223372036854775807ll;
int n,k;
string s;
int main(){
	cin>>n>>s>>k;
	for(int i=0;i<s.size();i++)
	{
		if(s[i]!=s[k-1])
			cout<<'*';
		else
			cout<<s[i];
	}
	return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);		
		String s = sc.next();
        if(s.equals("Sunny")){System.out.println("Cloudy");}
        if(s.equals("Cloudy")){System.out.println("Rainy");}
		if(s.equals("Rainy")){System.out.println("Sunny");}
	}
}


Measured memory_bytes: 20820
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pie 3.141592653589793238462643383279
#define mod 1000000007
#define INF LLONG_MAX/5
#define all(v) v.begin(),v.end()
#define P pair<int,int>
#define S second
#define F first
#define f(i,n) for(int i=0;i<n;i++)
int mypow(int a,int b,int c){
	if(b==0)return 1;
	if(b%2)return mypow(a,b-1,c)*a%c;
	int z=mypow(a,b/2,c);
	return z*z%c;
}
int gcd(int a,int b){
	if(b==0)return a;
	return gcd(b,a%b);
}
int lcm(int a,int b){
	return a/gcd(a,b)*b;
}
int x[100000],y[100000],z[100000];
signed main(){
	int n,ans=0;
	cin>>n;
	f(i,n)cin>>x[i];
	z[0]=1;
	f(i,n-1){
		z[i+1]=z[i]*(i+1)%mod;
		y[i+1]=(y[i]*(i+1)+z[i])%mod;
	}
	f(i,n-1){
		ans+=(x[i+1]-x[i])*(z[n-1]*mypow(z[i+1],mod-2,mod)%mod)%mod*y[i+1]%mod;
		ans%=mod;
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 2560
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n=sc.nextInt();
        double output=0;
        for(int i=0;i<n;i++){
            output+=sc.nextDouble()*(sc.next().equals("JPY")?1: 380000);
        }
        System.out.println(output);
    }

}


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

int main() {
  char b;
  cin >> b;
  if (b == 'A') cout << 'T' << endl;
  if (b == 'C') cout << 'G' << endl;
  if (b == 'G') cout << 'C' << endl;
  if (b == 'T') cout << 'A' << endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
  int a, b, c, d, x, y, sum;

  scanf("%d",&a);
  scanf("%d",&b);
  scanf("%d",&c);
  scanf("%d",&d);
  sum = a + b + c + d;
  x = sum / 60;
  y = sum % 60;
  printf("%d\n",x);
  printf("%d\n",y);

  return 0;

}

Measured memory_bytes: 596
import java.util.Scanner;

public class Main {

	static int n;
	static long counter;

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		n = in.nextInt();
		count(0, 0);
		System.out.println(counter);
		in.close();
	}

	static void count(long cur, int use) {
		if (cur > n)
			return;
		if (use == 0b111)
			++counter;

		count(cur * 10 + 7, use | 0b001);

		count(cur * 10 + 5, use | 0b010);

		count(cur * 10 + 3, use | 0b100);
	}
}

Measured memory_bytes: 21844
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
        a: i64,
        mut b: i64,
        mut c: i64,
        k: usize,
    };
    let mut judge = false;
    for _ in 0..k {
        if b > a {
            if c > b {
                judge = true;
                break;
            } else {
                c *= 2;
            }
        } else {
            b *= 2;
        }
    }
    if b > a && c > b {
        judge = true;
    }
    println!("{}", if judge { "Yes" } else { "No" })
}


Measured memory_bytes: 2132
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int main()
{
	int n,m=0;
	char a[100009];
	cin>>n;
	cin>>a;
	for(int i=1;i<=n;i++)
	{
		if(a[i]!=a[i-1])
		{
			m++;
		}
	}
	cout<<m<<endl;
	return 0;
 } 

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

int main() {
    int N, W, S = 100 * 1000;
    cin >> N >> W;

    bool exists[S+1];
    long long min_weight[S+1];
    memset(exists, 0, sizeof(exists));
    memset(min_weight, 0, sizeof(min_weight));
    exists[0] = true;

    for (int n = 0, w, v; n < N; ++n) {
	cin >> w >> v;
	for (int s = S - v; s >= 0; --s) {
	    if (!exists[s])
		continue;
	    int t = s+v;
	    if (exists[t]) {
		min_weight[t] = min(min_weight[t], w + min_weight[s]);
	    }
	    else {
		exists[t] = true;
		min_weight[t] = w + min_weight[s];
	    }
	}
    }

    for (int s = S; s >= 0; --s) {
	if (!exists[s] or min_weight[s] > W)
	    continue;
	cout << s << endl;
	break;
    }
}


Measured memory_bytes: 1280