akhauriyash/Code-Regression huggingface dataset:
#include<algorithm>
#include<cstdio>
#include<sstream>
#include<cstdlib>
#include<cctype>
#include<cmath>
#include<set>
#include<queue>
#include<stack>
#include<list>
#include<iostream>
#include<fstream>
#include<numeric>
#include<string>
#include<vector>
#include<cstring>
#include<map>
#include<iterator>
#include<deque>
#include<climits>
#include<complex>
#include <ctime>

using namespace std;
//-------------------------------------

#define ll long long
#define ull unsigned long long
#define sc(x) scanf("%lld",&x)
#define sc2(x,y) scanf("%lld%lld",&x,&y)
#define sci(x) scanf("%d",&x)
#define sci2(x,y) scanf("%d%d",&x,&y)

#define F(i,a,b) for(i=a;i<b;i++)
#define rep(i,a,b) for(i=a;i<b;i++)
#define mem(x) memset(x,0,sizeof x)
#define all(x) x.begin(),x.end()
#define pb(x)  push_back(x);
#define xx first
#define yy second
#define inf 999999999999999
#define mkp(x,y) make_pair(x,y)
#define pii pair<ll,ll>
#define unq(x) x.resize(unique(x.begin(),x.end())-x.begin())
#define db(x) cerr<<#x<<" "<<x<<endl
#define db2(x,y) cerr<<#x<<" "<<x<<endl<<#y<<" "<<y<<endl<<endl


//---------------------------------------

#define MX 1000007
#define pi 2*acos(0.00)

#define open       freopen("input.txt","r",stdin)
#define close      freopen ("output.txt","w",stdout)


ll tot[MX],inp[MX];
int main()
{
    ll i, j, l, u, v, w, x, y, z, a, b, c, d, e, f, t = 1, tc;
    ll flg, sz, cnt, gt, ans, mx, mn;
    ll m, k, n;
    ll low, hi, md, sm, ff;
   vector<int>tk;
   map<int,int> mp;

   sc(n);
   rep(i,0,n)
   {
      sc(x);
//      st.insert(x)
      tk.pb(x);
      mp[x]++;
   }
   sort(all(tk));
   sz= tk.size();
   a=b=0;
   for(i=sz-1;i>=0;i--)
   {
      if(tk[i]==tk[i-1])
      {
         a = tk[i];
         i-=2;
         break;
      }
   }
   for(;i>=0;i--)
   {
      if(tk[i]==tk[i-1])
      {
         b = tk[i];
         i-=2;
         break;
      }
   }
   cout<<a*b<<endl;

//
//   unq(tk);
//
//   reverse(all(tk));
//   sz = tk.size();
//
//   ll ls = -1;
////   db(tk[0]);
//   ull aa = 1;
//   rep(i,0,sz)
//   {
//      x = tk[i];
//      if(mp[x]>=4)
//      {
//         aa = x;
//         aa *=x;
//         cout<<aa<<endl;
//         return 0;
//      }
//      else if(mp[x]>=2 && ls==-1) ls = x;
//      else if(mp[x]>=2 && ls!=-1)
//      {
//         aa=x;
//         aa*=ls;
//         cout<<aa<<endl;
//         return 0;
//      }
//   }
//   cout<<0<<endl;



    return 0;
}
/*
6
2 1 2 1 2 2
*/


Measured memory_bytes: 6648
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;
#define INF 1000000000000000LL

int main(){
  int N;
  ll A, B, C, D;
  cin >> N >> A >> B >> C >> D;
  if(A>B) swap(A,B);

  bool ret = false;
  rep(y,N){
    ll x = N-1-y;
    ll mn = A+x*C, mx = A+x*D;
    if(mn-y*D <= B && B <= mx-y*C){
      ret = true;
    }
  }
  
  if(ret) cout << "YES" << endl;
  else cout << "NO" << endl;
  
  return 0;
}


Measured memory_bytes: 256
from collections import deque
import sys
input = sys.stdin.readline

H, W, K = map(int, input().split())
A = [input().rstrip() for _ in range(H)]
si = sj = -1
for i in range(H):
    for j in range(W):
        if A[i][j] == 'S':
            si, sj = i, j
            break
    if si != -1:
        break
# ans = (min(si, H - si - 1, sj, W - sj - 1) + K - 1) // K
queue = deque([(si, sj)])
INF = 10**18
dist = [[INF] * W for _ in range(H)]
dist[si][sj] = 0
ans = INF
while queue:
    i, j = queue.popleft()
    ans = min(ans, 1 + (min(i, H - i - 1, j, W - j - 1) + K - 1) // K)
    if dist[i][j] == K:
        continue
    for di, dj in [(1, 0), (0, 1), (-1, 0), (0, -1)]:
        ni, nj = i + di, j + dj
        if 0 <= ni < H and 0 <= nj < W and A[ni][nj] == '.' and dist[ni][nj] == INF:
            dist[ni][nj] = dist[i][j] + 1
            queue.append((ni, nj))
print(ans)



Measured memory_bytes: 61532
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    for(int i = 0; i < n; i++) cin >> a[i];
    bitset<100001> dp;
    dp[0] = false;
    for(int i = 1; i <= k; i++)
    {
        dp[i] = false;
        for(int j = 0; j < n; j++)
        {
            dp[i] = dp[i] | (a[j] <= i && !dp[i-a[j]]);
        }
    }
    if(dp[k]) cout << "First" << endl;
    else cout << "Second" << endl;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  string a;
  cin>>a;
  int n=a.size();
  int ans1=0;
  int ans2=0;
  for(int i=0;i<n;i++){
    if(i%2==0){
      if(a[i]=='0'){
        ans1++;
      }
      else{
        ans2++;
      }
    }
    else{
      if(a[i]=='0'){
        ans2++;
      }
      else{
        ans1++;
      }
    }
  }
  cout<<min(ans1,ans2)<<endl;
}

Measured memory_bytes: 512
#include <iostream>
#include <vector>
bool isprime(int n){
    if(n == 1) return false;
    if(n == 2) return true;
    if(n % 2 == 0) return false;
    for(int i = 3; i * i <= n; i+= 2){
        if(n % i == 0) return false;
    }
    return true;
}
int main(){
    int Q;
    std::cin >> Q;
    std::vector<int> sum(100100, 0);
    for(int i = 3; i < 100100; i+= 2){
        if(isprime(i) && isprime((i + 1) / 2)){
            sum[i] = sum[i - 2] + 1;
        }
        else sum[i] = sum[i - 2];

    }
    for(int i = 0; i < Q; i++) {
        int l, r;
        std::cin >> l >> r;
        std::cout << sum[r] - sum[l - 2] << std::endl;
    }
}

Measured memory_bytes: 1024
/*input
5 7 3
*/

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

int main() {
    ll A, B, N;
    cin >> A >> B >> N;
    ll ans = (A*N)/B-A*(N/B);
    if (N >= B) {
        ll a = B-1;
        ans = max(ans, (A*a)/B-A*(a/B));
    }
    cout << ans << endl;
}

Measured memory_bytes: 3596
#include <iostream>
#include <algorithm>
#include <map>

using namespace std;

typedef pair<int, int> P;

const int N = 1000;
const int M = 100000;

int n, m, h, k, score[N], num[N];
P input[M], data[2][M];

main(){
  while(cin >> n >> m >> h >> k && (n|m|h|k)){
    for(int i=0;i<n;i++){
      cin >> score[i];
      num[i] = i;
    }
    for(int i=0;i<m;i++) cin >> input[i].second >> input[i].first;
    sort(input, input+m);
    for(int i=0;i<m;i++){
      data[0][i].first = num[input[i].second-1];
      data[1][i].first = num[input[i].second];
      swap(num[input[i].second-1], num[input[i].second]);
      data[0][m-i-1].second = score[input[m-i-1].second-1];
      data[1][m-i-1].second = score[input[m-i-1].second];
      swap(score[input[m-i-1].second-1], score[input[m-i-1].second]);
    }
    int sum = 0;
    for(int i=0;i<k;i++) sum += score[i];
    int ans = sum;
    for(int i=0;i<m;i++){
      int tmp = sum;
      if(data[0][i].first < k) tmp = tmp - score[data[0][i].first] + data[0][i].second;
      if(data[1][i].first < k) tmp = tmp - score[data[1][i].first] + data[1][i].second;;
      ans = min(ans, tmp);
    }
    cout << ans << endl;
  }
}

Measured memory_bytes: 3516
#include<bits/stdc++.h>
using namespace std;
const long long MOD = 1e9+7;
#define rep(i,n) for(int i=0;i<n;++i)
typedef long long int ll;
typedef unsigned long long ull;
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;}
typedef pair<ll,ll> P;


int main()
{
    int n;
    cin >> n;
    vector<int>x(n);
    int cnt=0;
    rep(i,n)
    {
        cin>>x[i];
        //if(p[i]==i+1)cnt++;
    }
    rep(i,n)
    {
        if(x[i]==i+1)
        {
            if(i==0)swap(x[0],x[1]);
            else if(i==n-1)swap(x[n-1],x[n-2]);
            else
            {
                int a = abs(x[i-1]-i);
                int b = abs(x[i+1]-(i+2));
                if(a<b)swap(x[i-1],x[i]);
                else swap(x[i+1],x[i]);
            }
            cnt++;
        }
    }
    cout<<cnt<<endl;
    return 0;
}

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

using namespace std;

typedef unsigned uint;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ldbl;
typedef pair<int, int> pii;
typedef pair<uint, uint> puu;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pull;
typedef pair<double, double> pdd;
typedef vector<int> vi;
typedef vector<uint> vu;
typedef vector<ll> vll;
typedef vector<ull> vull;
typedef vector<pii> vpii;
typedef vector<puu> vpuu;
typedef vector<pll> vpll;
typedef vector<pull> vpull;
typedef vector<string> vstr;
typedef vector<double> vdbl;
typedef vector<ldbl> vldbl;
#define pb push_back
#define ppb pop_back
#define pfr push_front
#define ppfr pop_front
#define emp emplace
#define empb emplace_back
#define be begin
#define rbe rbegin
#define all(x) (x).be(), (x).end()
#define rall(x) (x).rbe(), (x).rend()
#define fir first
#define sec second
#define mkp make_pair
#define brif(cond) if (cond) break
#define ctif(cond) if (cond) continue
#define retif(cond) if (cond) return
void canhazfast() {ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);}
template<typename T> T gcd(T a, T b) {return b ? gcd(b, a%b) : a;}
template<typename T> T extgcd(T a, T b, T &x, T &y)
{
    T x0 = 1, y0 = 0, x1 = 0, y1 = 1;
    while (b) {
        T q = a/b; a %= b; swap(a, b);
        x0 -= q*x1; swap(x0, x1);
        y0 -= q*y1; swap(y0, y1);
    }
    x = x0; y = y0; return a;
}
int ctz(uint x) {return __builtin_ctz(x);}
int ctzll(ull x) {return __builtin_ctzll(x);}
int clz(uint x) {return __builtin_clz(x);}
int clzll(ull x) {return __builtin_clzll(x);}
int popcnt(uint x) {return __builtin_popcount(x);}
int popcntll(ull x) {return __builtin_popcountll(x);}
int bsr(uint x) {return 31^clz(x);}
int bsrll(ull x) {return 63^clzll(x);}

#define MX 100000

int cx, cy;
bool vis[2*MX];
vi adj[2*MX];

void dfs(int u)
{
    vis[u] = true;
    if (u < MX) ++cx;
    else ++cy;
    for (int v : adj[u]) {
        ctif(vis[v]);
        dfs(v);
    }
}

int main()
{
    canhazfast();

    int n;
    ll cnt = 0;

    cin >> n;
    for (int i = 0; i < n; ++i) {
        int x, y;
        cin >> x >> y;
        --x; --y;
        adj[x].pb(y+MX);
        adj[y+MX].pb(x);
    }
    for (int i = 0; i < MX; ++i) {
        ctif(vis[i] || adj[i].empty());
        cx = cy = 0;
        dfs(i);
        cnt += (ll)cx*cy;
    }
    cout << cnt-n << '\n';

    return 0;
}


Measured memory_bytes: 10240
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <string>
#include <cmath>
#include <vector>                                                                                                         
#include <bits/stdc++.h>         

using namespace std;
typedef long long ll;
#define forn(i,n) for (int i = 0; i < (n); i++)
int main(){
	double t,x;
	cout.precision(10);
	cout << fixed;
	cin >> t >> x;
	double ans = t / x;
	cout << ans << endl;
	
}


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

int main(){
  int A,B,ans=0;
  cin>>A>>B;
  
  if (A<B){
    ans+=B;
    B--;
  }else{
    ans+=A;
    A--;
  }
  
  
  if (A<B){
    ans+=B;
    B--;
  }else{
    ans+=A;
    A--;
  }
  
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;
long long n, k;
long long moves[100];
long long dp[100001];
//1 for first, 0 for secoind
long long recurse(long long stones)
{
    if(dp[stones]!=-1)
    {
        return dp[stones];
    }
    //cout<<stones<<endl;
    if(stones==0)
    {
        dp[0]=0;
        return 0;
    }
    for(int i=0;i<n;i++)
    {
        //cout<<stones-moves[i]<<endl;
        if(stones-moves[i]>=0&&recurse(stones-moves[i])==0)
        {
            //cout<<stones-moves[i]<<endl;
            dp[stones]=1;
            return 1;
        }
    }
    dp[stones]=0;
    return 0;

}
int main()
{

    cin>>n>>k;
    for(int i=0;i<n;i++)
    {
        cin>>moves[i];
    }
    for(int i=0;i<=100000;i++)
    {
        dp[i]=-1;
    }
    if(recurse(k)==1)
    {
        cout<<"First"<<endl;
    }
    else
    {
        cout<<"Second"<<endl;
    }
}


Measured memory_bytes: 4096
n=int(input())
s=[input().split() for i in range(n)]
ans=0
for j in s:
    a=int(j[0])
    b=int(j[1])
    c=int(j[2])
    if a>=b+c:
        if a%2==0 and (b+c)%2==0 or a%2!=0 and (b+c)%2!=0:
            ans+=1
if ans==n:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 32144
import sys
input=sys.stdin.readline
n,m,k=map(int,input().split())
INF=998244353
def modinv(a,m):
    b=m
    (x,lastx)=(0,1)
    (y,lasty)=(1,0)
    while not b==0:
        q=a//b
        (a,b)=(b,a%b)
        (x, lastx) = (lastx - q * x, x)
        (y, lasty) = (lasty - q * y, y)
    return lastx%m
ans=0
if m==1:
    if k==n-1:
        print(m)
    else:
        print(0)
    sys.exit()
for i in range(k+1):
    if i==0:
        c=1
        temp=(m*pow(m-1,n-1))%INF
    else:
        x=modinv(i,INF)
        c=(c*x*(n-i))%INF
        temp=(temp*modinv(m-1,INF))%INF
    ans=(ans+c*temp)%INF
print(ans)





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

using namespace std;
typedef long long int LL;
typedef long long int LLint;

//Faster Coding
#define ED return 0
#define GET(a) int a;cin >> a
#define SGET(a) string a;cin >> a
#define CGET(a) char a;cin >> a
#define PRINT(a) cout << a << endl
#define ANS(a,b) int a;cin >> a;cout << b << endl
#define SORT(vec) sort(vec.begin(),vec.end())
#define REV(vec) reverse(vec.begin(),vec.end())

//Difficult Syntax
#define DOUBLECHANGE(count) cout << setprecision(count)

//As Function
#define UP(a,b) ((a+(b-1))/b)
#define ipow(x,y) LL(pow(x,y))

//Debug
#define TEST cout << "OK" << endl

const long long INF = 999999999;
const long long mod = 1000000007;

int main(){
      cin.tie(0);
      ios::sync_with_stdio(false);
      GET(A);
      SGET(S);
      PRINT(((A>=3200)?S:"red"));
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue> 
#include <stack>
#include <set>

using namespace std;
typedef long long ll;
#define rep(i, s, e) for (int(i) = (s); (i) <= (e); ++(i))
#define all(x) x.begin(),x.end()


int main()
{
	int n; cin >> n;
	deque<int> b;
	rep(i, 0, n - 1)
	{
		int a; cin >> a;
		int pos = lower_bound(all(b), a) - b.begin();
		if (pos == 0)b.push_front(a);
		else b[pos - 1] = a;
	}
	cout << b.size() << endl;
}

Measured memory_bytes: 640
// AUTHOR: ROSHAN SRIVASTAVA
// WEBSITE: https://www.youtube.com/channel/UC6uQdd7kLLOdlHSVklhV7Cw

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007

int n; 

ll arr[89];

int main(){

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	cin>>n;

	for(int i = 0; i < n; i++)
		cin>>arr[i];

	ll s = 0;
	ll m = 1000;
	for(int i = 0; i < n; i++) {
		if(arr[i + 1] > arr[i]) {
			s = m / arr[i];
			m += (arr[i + 1] - arr[i]) * s;
		}
	}
	cout<<m<<endl;

	return 0;
}

Measured memory_bytes: 3608
// inputに入力データ全体が入る
function Main(input) {
  
   input = input.split("\n");
  var n = input[0];
  var n= parseInt(input[0], 10);
// console.log(n);
	
  
  var tmp = input[1].split(" ");
 // console.log(tmp);
  
  var i = 0;
   var a = [];
for (var i = 0; i < n ; i++){
  var r= parseInt(tmp[i], 10);
 // console.log(tmp[i]);
  a[i] = r;}
//  console.log(a);
  var cnt = 0;
  for (t = 0;t<n;t++){if (a[t] != t+1){cnt =cnt +1;
                                      
                                      }
                      }
                                       
  
  
  if (cnt >=3){console.log("NO")}
               else{console.log("YES")}
 
  	   }    //    1    
     
  //*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
  
  


Measured memory_bytes: 7372
import java.util.Scanner;
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        List<String> temp = new ArrayList<>();
        int sLength = s.length();
        for (int i = 0; i < sLength; i++) {
            temp.add(s.substring(i,i+1));
        }
        int min = 999;
        int tempInt = 0;
        for (int i = 0; i < sLength - 2; i++) {
            tempInt = Integer.parseInt(temp.get(i)+temp.get(i+1)+temp.get(i+2));
            int res = 753-tempInt;
            
            res = res<0?res*-1:res;
            min = min<res?min:res;
        }
        
        
        System.out.println(min);
    }
}


Measured memory_bytes: 20820
#include<iostream>
using namespace std;
int main(){
  int i,u=0,maxi=0;
  string s;cin>>s;
  int start=0,end=0;
  for(i=0;i<s.size();i++){
    if(s[i]=='A' or s[i]=='G' or s[i]=='T' or s[i]=='C'){
      u++;
    }
    else{
      maxi=max(maxi,u);
      u=0;
    }
  }
  cout<<max(maxi,u);
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long int
using namespace std;

int main() {
    fast();
    // ll t;
    // cin>>t;
    // while(t--)			
    // {
         
    // }
    ll x;
    cin>>x;
    if(x==0)
    cout<<1<<endl;
    else
    cout<<0<<endl;
}



Measured memory_bytes: 3608
#include <iostream>
#include <algorithm>
#include <map>
#define flush fflush(stdout)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pl;
const int mod = (int)1e9 + 7, INF = (int)1e9;
const int di[4] = { 1,0,-1,0 }, dj[4] = { 0,1,0,-1 };


int main(void) {
	int n, i, a[200003], d1[200003], d2[200003];
	map<int, ll> m1, m2;
	ll ans;

	scanf("%d", &n);
	for (i = 0; i < n; i++) {
		scanf("%d", &a[i]);
	}

	for (i = 0; i < n; i++) {
		d1[i] = a[i] + i;
		d2[i] = i - a[i];
	}

	for (i = 0; i < n; i++) {
		m1[d1[i]]++;
		m2[d2[i]]++;
	}

	ans = 0ll;
	for (auto& it : m1) {
		ans += m2[it.first] * it.second;
	}

	printf("%lld\n", ans);

	return 0;
}

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

#ifdef LOCAL
#define debug(var) cerr << #var << " = " << var;
#else
#define debug(var)
#endif

void init() {
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
}

const int mod = 1e9+7;
const int N = 1e5+234;
int a[N], h[N];

void solve() {
	int n; scanf("%d", &n);
	for (int i = 0; i < n; ++i) {
		scanf("%d", a+i);
		if (++h[a[i]] > 2) {
			puts("0");
			return;
		}
	}
	if (n%2 && h[0] != 1) {
		puts("0");
		return;
	}
	if (n%2==0 && h[0] != 0) {
		puts("0");
		return;
	}
	long long ans = 1;
	for (int i = 0; i < n/2; ++i) {
		ans = (ans*2)%mod;
	}
	printf("%lld", ans);
}

int main() {
	init();
	int t = 1; //scanf("%d", &t);
	while (t--) {
		solve();
	}
	return 0;
}


Measured memory_bytes: 1024
package main

import (
    "fmt"
)

type dice struct {
    t, s, e, w, n, b int
}

func main() {
    var t, s, e, w, n, b, u, f, q int
    fmt.Scan(&t, &s, &e, &w, &n, &b)
	d := dice{t: t, s: s, e: e, w: w, n: n, b: b}
	fmt.Scan(&q)
	for i:=0; i<q; i++{
		fmt.Scan(&u, &f)
		for j:=0; j<4; j++{
			if d.t == u{
				break
			}
			d.t, d.e, d.w, d.b = d.w, d.t, d.b, d.e
		}
		for j:=0; j<4; j++{
			if d.t == u{
				break
			}
			d.t, d.s, d.b, d.n = d.n, d.t, d.s, d.b
		}
		for j:=0; j<4; j++{
			if d.s == f{
				break
			}
			d.s, d.e, d.n, d.w = d.e, d.n, d.w, d.s
		}
		fmt.Println(d.e)
	}
}


Measured memory_bytes: 1120
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef pair<int, int> P;
typedef long long ll;
int main(){
    string s,t;
    cin >> s >> t;
    int mx = 0;
    int mn = 30;
    for(auto i:s){
        mn = min(i-'a',mn);
    }
    for(auto i:t){
        mx = max(i-'a',mx);
    }
    if(mn<mx){
        cout << "Yes" << endl;
        return 0;
    }
    if(s.length()<t.length()){
        rep(i,s.length()){
            if(s[i]!=t[i]){
                cout << "No" << endl;
                return 0;
            }
        }
        cout << "Yes" << endl;
        return 0;
    }
    cout << "No" << endl;
    
    return 0;
}

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

using namespace std;

int gcd(int a, int b)
{
	return b ? gcd(b, a % b) : a;
}

void solve()
{
	int n, a, b;
	cin >> n >> a >> b;
	string str;
	cin >> str;
	int passed = 0, passedB = 0;
	for(int i = 0; i < n; i++)
	{
		if(str[i] == 'c')
		{
			cout << "No\n";
			continue;
		}
		if(str[i] == 'b')
		{
			if(passed < a + b && passedB < b)
			{
				passed++;
				passedB++;
				cout << "Yes\n";
			}else
			{
				cout << "No\n";
			}
			continue;
		}
		if(passed < a + b)
		{
			passed++;
			cout << "Yes\n";
			continue;
		}
		cout << "No\n";
	}
}

int main()
{
	solve();
}


Measured memory_bytes: 896
#include <bits/stdc++.h>
#define FOR(I,X,Y) for(int I=X;I<Y;I++)
#define REP(I,X,Y) for(int I=Y-1;I>=X;I--)
#define INF 1000000007
using namespace std;

int main(){
  long long N,M,ans=0;
  cin >> N >> M;
  long long A[N];
  FOR(i,0,N)cin >> A[i];
  FOR(i,1,N)A[i] += A[i-1];
  vector<long long> v;
  set<long long> s;
  FOR(i,0,N){
    v.push_back(A[i]%M);
    s.insert(A[i]%M);
  }
  v.push_back(0);
  s.insert(0);
  sort(v.begin(),v.end());
  for(auto x:s){
    long long n = upper_bound(v.begin(),v.end(),x) - lower_bound(v.begin(),v.end(),x);
    if(n > 1){
      ans += n*(n-1)/2;
    }
  }
  cout << ans << endl;
}


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

using namespace std;

typedef long long ll;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int a, p;
    cin >> a >> p;
    int x = a * 3;
    x += p;
    cout << x / 2 << '\n';
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(void){

  string a, b;

  cin >> a >> b;

  if(a.length() > b.length()) cout << "GREATER" << endl;
  else if(a.length() < b.length()) cout << "LESS" << endl;
  else {
    if(a == b){
      cout << "EQUAL" << endl;
      return 0;
    }
    for(int i = 0; i < a.length(); i++){
      if(a[i] > b[i]){
        cout << "GREATER" << endl;
        return 0;
      }else if(a[i] < b[i]){
        cout << "LESS" << endl;
        return 0;
      }
    }
  }

  return 0;

}


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

#define MAX 100000

int main() {
	long long N, A[MAX];
	long long sum = 0;
	cin >> N;
	long long cntnve = 0, cntpve = 0, cntzero = 0;
	for (int i = 0; i < N; i++) {
		cin >> A[i];
		if (A[i] < 0)
			cntnve++;
		else if (A[i] == 0)
			cntzero++;
		else
			cntpve++;
		A[i] = abs(A[i]);
		sum += A[i];
	}
	sort(A, A + N);
	if (cntzero > 0) {
		cout << sum << endl;
	} else if (cntnve % 2 == 0) {
		cout << sum << endl;
	} else if (cntnve % 2 == 1) {
		cout << sum - 2 * A[0] << endl;
	}
	return 0;
}


Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {
	
	public static void main(String[]args) {
		try(Scanner scan = new Scanner(System.in)){
			
			long MOD = (long)1e9+7;
			
			long N = scan.nextLong();
			long K = scan.nextLong();
			
			long goukei = 0;
			
			for(long i = K;i<=N+1;i++) {
				
				long sento = i*(i-1)/2;
				long kouho = N*(N+1)/2-(N-i)*(N-i+1)/2;
				long touri = kouho-sento+1;
				/*System.out.print(sento);
				System.out.print(" ");
				System.out.print(kouho);
				System.out.print(" ");
				System.out.println(touri);*/
				
				goukei = (goukei+touri)%MOD;
				
				
			}
			
			
			System.out.println(goukei);
			
			
			
			
		}
		
		
	}
		

}

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

#define all(x) (x).begin(), (x).end()
#define itn int
#define make_unique(x) sort((x).begin(), (x).end()); (x).erase(unique((x).begin(), (x).end()), (x).end())

using namespace std;

inline int nxt() {
	int x;
	scanf("%d", &x);
	return x;
}

const int N = 222222;
vector<int> a[N];

int sz[N];
int level[N];
int tin[N], tout[N];
int timer = 0;
int ans[N];

void dfs_tin(int v, int p = -1) {
	tin[v] = timer++;
	for (int x : a[v]) {
		if (x == p) {
			continue;
		}
		dfs_tin(x, v);
	}
	tout[v] = timer;
}

void dfs_sz(int v, int p = -1) {
	for (int x : a[v]) {
		if (x == p) {
			continue;
		}
		level[x] = level[v] + 1;
		dfs_sz(x, v);
		sz[v] += sz[x];
	}
	++sz[v];
}

void remax(pair<int, int>& p, int v) {
	if (v > p.first) {
		p = {v, p.first};
	} else if (v > p.second) {
		p.second = v;
	}
}

vector<int> st;

void dfs(int v, pair<int, int> cur_mx, int p = -1) {
	st.push_back(v);
	remax(cur_mx, v);
	if (v > 0) {
		int tmp = cur_mx.first;
		if (level[cur_mx.second] > level[tmp]) {
			tmp = st[level[tmp] + 1];
		}
		ans[tin[tmp]] += 1;
		ans[tout[tmp]] -= 1;
	}
	for (int x : a[v]) {
		if (x == p) {
			continue;
		}
		dfs(x, cur_mx, v);
	}
	st.pop_back();
}

int main() {
	itn n = nxt();
	for (int i = 1; i < n; ++i) {
		int u = nxt() - 1, v = nxt() - 1;
		a[u].push_back(v);
		a[v].push_back(u);
	}

	dfs_tin(0);
	dfs_sz(0);
	dfs(0, {0, 0});
	for (int i = 1; i < n; ++i) {
		ans[i] += ans[i - 1];
	}
	for (int i = 1; i < n; ++i) {
		printf("%d ", ans[tin[i]]);
	}
	printf("\n");

	return 0;
}


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

typedef long long ll;
using namespace std;
const int N = 200000 + 10;
ll a[N], sum[N];
ll arr[N], b[N];
ll n, k;
int lowbit(int x)
{
    return x & (-x);
}
ll get(int x)
{
    ll res = 0;
    while(x >= 1)
        res += a[x], x -= lowbit(x);
    return res;
}
void update(int x, ll v)
{
    while(x<=n+1)
        a[x] += v, x += lowbit(x);
}
int main()
{
    while(cin>>n>>k)
    {
        memset(a, 0, sizeof(a));
        arr[0] = 0;
        arr[0] = b[0] = -k;
        for(int i = 1; i<=n; i++)
        {
            scanf("%I64d", &arr[i]);
            arr[i] -= k;
            arr[i] += arr[i-1];
            b[i] = arr[i];
        }
        sort(b, b+1+n);
        for(int i = 0; i<=n; i++)
            arr[i] = lower_bound(b, b+1+n, arr[i]) - b + 1;
        ll ans = 0;
        for(int i = 0; i<=n; i++)
            ans += get(arr[i]), update(arr[i], 1);
        cout<<ans<<endl;
    }
    return 0;
}


Measured memory_bytes: 6528
/* 
	Author: ankrypt
*/


#include <bits/stdc++.h>

using namespace std;

#define MOD 1000000007
#define ll long long int
#define u64 unsigned long long int

vector<ll> times, costs;
map<ll, ll> costs1, times1;
ll cost, tTime;
ll N, totTime;

int main() {
	scanf("%lld %lld", &N, &totTime);
	for(int i = 0; i < N; i++) {
		scanf("%lld %lld", &cost, &tTime);
		times.push_back(tTime);
		costs.push_back(cost);
		costs1[tTime] = cost;
		times1[cost] = tTime;

	}
	int flag = 0;
	sort(costs.begin(), costs.end());
	for(int i = 0; i < costs.size(); i++) {
		if(times1[costs[i]] <= totTime) {
			printf("%lld\n", costs[i]);
			flag = 1;
			break;
		}
	}
	if(!flag) {
		printf("TLE\n");
	}
	return 0;
}
/*
	Powered by Buggy Plugin
*/


Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>

int check_prime(int n)
{
  int i;
  int x = (int)sqrt(n);

  if (n == 1) return 0;
  if (n == 2 || n == 3) return 1;
  
  for (i = 2; i <= x; i++) {
    if (!(n % i)) return 0;
  }
  return 1;
}

int main()
{
  int i;
  int n;
  int input;
  int count = 0;
  
  scanf("%d", &n);

  for (i = 0; i < n; i++) {
    scanf("%d", &input);
    count += check_prime(input);
  }

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

  return 0;
}



Measured memory_bytes: 2100
import java.util.*;
public class Main {
	Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		new Main().doIt();
	}
	void doIt() {
		solveD();
	}
	long [] h, all;
	long fd(int n, long x) {
		//System.out.println(n + " " + x);
		int c = 0;
		long ans = 0;
		if(n == 0) ans = 0L;
		else if(x <= 1) {
			c = 1;
			ans = 0L;
		}
		else if(x < 1L + h[n-1]) {
			ans = fd(n-1, x-1);
			c = 2;
		}
		else if(x <= 1L + h[n-1]) {
			ans = all[n-1];
			c = 3;
		}
		else if(x <= 2L + h[n-1]) {
			ans = 1L + all[n-1];
			c = 4;
		}
		else if(x < 2L + 2L * h[n-1]) {
			long d = x - (2L + h[n-1]);
			ans = 1L + all[n-1] + fd(n-1, d);
			c = 5;
			
		} else {
			ans = 1L + 2L * all[n-1];
			c = 6;
			
		}
		//System.out.println("Case" + c + " " + n + " " + x);
		return ans;
	}
	void solveD() {
		int N = sc.nextInt();
		long X = sc.nextLong();
		h = new long[N+1];
		all = new long[N+1];
		h[0] = 1; all[0] = 1;
		for(int i = 1; i <= N; i++) {
			h[i] = 2L * h[i-1] + 3L;
			all[i] = 2L * all[i-1] + 1L;
		}
		//System.out.println(Arrays.toString(all));
		//System.out.println(Arrays.toString(h));

		long ans = fd(N, X);
		System.out.println(ans);
	}
	void solveC() {
		int N = sc.nextInt();
		int K = sc.nextInt();
		long [] h = new long[N];
		for(int i = 0; i < N; i++) {
			h[i] = sc.nextLong();
		}
		Arrays.sort(h);
		long ans = Long.MAX_VALUE;
		for(int i = K-1; i < N; i++) {
			long d = h[i] - h[i-K+1];
			ans = Math.min(ans, d);
		}
		System.out.println(ans);
		
	}
	void solveA() {
		int N = sc.nextInt();
		String ans = "Christmas";
		for(int i = N; i < 25; i++) {
			ans += " Eve";
		}
		System.out.println(ans);
	}
	void solveB() {
		int N = sc.nextInt();
		int [] p = new int[N];
		for(int i = 0; i < N; i++) {
			p[i] = sc.nextInt();
		}
		Arrays.sort(p);
		int ans = 0;
		for(int i = 0; i < N-1; i++) {
			ans +=p[i];
		}
		ans += p[N-1]/2;
		System.out.println(ans);
		
	}
}


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

int main() {
  // 入力
  int n, m;
  cin >> n >> m;
  vector<vector<int>> path(n, vector<int>());
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    path[a].push_back(b);
    path[b].push_back(a);
  }

  // BFSで大きさの最大を求める
  //// DFSでもよい
  int ans = 0;
  vector<int> visited(n);
  queue<int> que;
  for (int i = 0; i < n; i++) {
    if (visited[i]) continue;
    int now = i;
    que.push(now);
    visited[now] = 1;
    int size = 0;
    while (!que.empty()) {
      now = que.front();
      que.pop();
      size += 1;
      for (const int& nxt : path[now]) {
        if (visited[nxt]) continue;
        que.push(nxt);
        visited[nxt] = 1;
      }
    }
    ans = max(ans, size);
  }

  // 出力
  cout << ans << endl;
}

Measured memory_bytes: 15504
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.*;
import java.awt.Point;

public class Main {
    // static int INF = (1 << 30) - 1;
    static long L_INF = (1L << 62) - 1;
    // static long MOD = (long) 1e9 + 7;

    static class Solver {
        int N, K;
        long[] A;

        // write your code
        void solve(InputReader in, PrintWriter out) {
            N = in.nextInt();
            K = in.nextInt();
            A = new long[N];
            for (int i = 0; i < N; i++) {
                A[i] = in.nextLong();
            }

            long[] maxes = new long[N + 1];
            for (int i = 0; i < N; i++) {
                maxes[i + 1] = Math.max(maxes[i], A[i]);
            }

            long ans = L_INF;
            for (int i = 0; i < (1 << N); i++) {
                if (Integer.bitCount(i) != K) {
                    continue;
                }
                ArrayList<Integer> al = new ArrayList<>();
                int bit = i;
                int d = 0;
                while (bit > 0) {
                    if ((bit & 1) == 1) {
                        al.add(d);
                    }
                    bit /= 2;
                    d++;
                }
                long cost = 0;
                long before = 0;
                for (int j = 0; j < al.size(); j++) {
                    int idx = al.get(j);
                    long v = A[idx];
                    if (v <= Math.max(before, maxes[idx])) {
                        cost += Math.max(before, maxes[idx]) - v + 1;
                        before = Math.max(before, maxes[idx]) + 1;
                    }
                }
                ans = Math.min(ans, cost);
            }
            out.println(ans);
        }

        void debug(Object... os) {
            System.err.println(Arrays.deepToString(os));
        }
    }

    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Solver solver = new Solver();
        solver.solve(in, out);
        out.close();
    }

    static class InputReader {
        BufferedReader reader;
        StringTokenizer tokenizer;

        InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

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

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

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


Measured memory_bytes: 21332
import Control.Applicative
import Control.Monad
import Data.List


solve :: [Float] -> Float
solve xs = foldl (\acc x -> (acc + x) / 2) acc zs
    where acc = head ys
          ys = sort xs
          zs = tail ys

main :: IO ()
main = do
    _ <- getLine
    line <- map read . words <$> getLine
    print $ solve line


Measured memory_bytes: 892
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
    int n;
    cin >> n;
    int p[100];
    vector<int> q;
    int sum = 0;

    for(int i = 0; i < n; i++){
        cin >> p[i];
        q.push_back(p[i]);
    }


    sort(q.rbegin(), q.rend());

    q[0] = q[0] / 2;

    for(int i = 0; i < n; i++){
        sum += q[i];
    }
    cout << sum;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
using ll = long long;
int n,m,q;
vector<int> a,b,c,d;
int ans = 0;

void dfs(vector<int> A){
  if(A.size() == n+1){
    int point = 0;
    for(int i = 0; i < q; i++){
      if(A[b[i]] - A[a[i]] == c[i]) point += d[i];
    }
    ans = max(ans, point);
    return;
  }
  A.push_back(A.back());
  while( A.back() <= m){
    dfs(A);
    A.back()++;
  }
}

int main(){
  cin >> n >> m >> q;
  a = b = c = d = vector<int>(q);
  for(int i = 0; i < q; i++) cin >> a[i] >> b[i] >> c[i] >> d[i];
  vector<int> x;
  x.push_back(1);
  dfs(x);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3636
use std::process;
macro_rules! get {
      ($t:ty) => {
          {
              let mut line: String = String::new();
              std::io::stdin().read_line(&mut line).unwrap();
              line.trim().parse::<$t>().unwrap()
          }
      };
      ($($t:ty),*) => {
          {
              let mut line: String = String::new();
              std::io::stdin().read_line(&mut line).unwrap();
              let mut iter = line.split_whitespace();
              (
                  $(iter.next().unwrap().parse::<$t>().unwrap(),)*
              )
          }
      };
      ($t:ty; $n:expr) => {
          (0..$n).map(|_|
              get!($t)
          ).collect::<Vec<_>>()
      };
      ($($t:ty),*; $n:expr) => {
          (0..$n).map(|_|
              get!($($t),*)
          ).collect::<Vec<_>>()
      };
      ($t:ty ;;) => {
          {
              let mut line: String = String::new();
              std::io::stdin().read_line(&mut line).unwrap();
              line.split_whitespace()
                  .map(|t| t.parse::<$t>().unwrap())
                  .collect::<Vec<_>>()
          }
      };
      ($t:ty ;; $n:expr) => {
          (0..$n).map(|_| get!($t ;;)).collect::<Vec<_>>()
      };
}
fn main() {
    let s = get!(String);
    let mut ans = 0;
    for i in 0..s.len()  {
        match s.chars().nth(i).unwrap()  {
            '+' => ans += 1,
            '-' => ans -= 1,
            _ => panic!(),
        }
    }
    println!("{}",ans);

}


Measured memory_bytes: 4352
import java.io.BufferedReader
import java.io.InputStreamReader
import java.util.*

fun main(args: Array<String>) {
    val br = BufferedReader(InputStreamReader(System.`in`))
    val (a, b) = br.readLine().split(' ').map { it.toInt() }
    val s = br.readLine()
    println(
            if (s.matches("[0-9]{$a}-[0-9]{$b}".toRegex())) "Yes" else "No"
    )
}

fun err(print: Any) {
    System.err.println(print)
}

Measured memory_bytes: 35744
#include<iostream>
#include<math.h>
#include<algorithm>
#include<stdint.h>
#include<vector>
#include<deque>
#include<string>
#include<cstring>
#include<time.h>
#include<iomanip>
#include<list>
#include<set>
#include<unordered_map>
#include<unordered_set>
#include<random>
#include<bitset>
#include <queue>
#include <map>


using namespace std;
using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
using ldouble = long double;

#define repi(i,a,b) for(ll i = (a); i < (b); i++)
#define rep(i, n) for(ll i = 0; i < (n); ++i)


int main() {
    ll X, Y, A, B, C;
    cin >> X >> Y >> A >> B >> C;
    priority_queue<ll> a;
    priority_queue<ll> b;
    priority_queue<ll> c;
    rep(i, A) {
        ll buf;
        cin >> buf;
        a.push(buf);
    }
    rep(i, B) {
        ll buf;
        cin >> buf;
        b.push(buf);
    }
    rep(i,C) {
        ll buf;
        cin >> buf;
        c.push(buf);
    }
    priority_queue<ll,std::vector<ll>, std::greater<ll>> rq;
    priority_queue<ll,std::vector<ll>, std::greater<ll>> bq;
    rep(i, X) {
        rq.push(a.top());
        a.pop();
    }
    rep(i, Y) {
        bq.push(b.top());
        b.pop();
    }
    while (!c.empty()) {
        if (rq.top() < bq.top()) {
            if (rq.top() < c.top()) {
                rq.pop();
                rq.push(c.top());
            }
        }
        else {
            if (bq.top() < c.top()) {
                bq.pop();
                bq.push(c.top());
            }
        }
        c.pop();
    }
    ll res = 0;
    rep(i, X) {
        res += rq.top();
        rq.pop();
    }
    rep(i, Y) {
        res += bq.top();
        bq.pop();
    }
    cout << res << endl;
    return 0;
}



Measured memory_bytes: 4852
#include<iostream>
#include<iomanip>
#include<string>
#include<vector>
#include<stack>
#include<deque>
#include<set>
#include<map>
#include<utility>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<climits>
using namespace std;

#define rep(i,n) for(int i=0; i<(n); i++)
typedef long long ll;
const int mod=1e9+7;

int main(){
  int n, m;
  cin >> n >> m;
  map<int, ll> mp;
  rep(i,n){
    int a;
    cin >> a;
    mp[a]++;
  }
  rep(i,m){
    int b,c;
    cin >> b >> c;
    mp[c]+=b;
  }
  ll res=0, num=0;
  for(auto itr=mp.rbegin(); num<n; itr++){
    if(num+itr->second<=n){
      res += itr->first*itr->second;
      num += itr->second;
    }else{
      res += itr->first*(n-num);
      num=n;
    }
  }
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 12800
//arc081_c.cpp
//Thu Jun  7 19:45:21 2018

#include <iostream>
#include <string>
#include <queue>
#include <unordered_map>
#include <vector>
#include <algorithm>
using namespace std;
using ll=long long;

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

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

	sort(a,a+n);

	int flag = 0;
	ll ans = 1;

	for (int i=n-2;i>=0;i--){
		if (a[i+1]==a[i]){
			ans = ans * a[i];
			i--;
			flag++;
		}
		if (flag == 2){
			break;
		}
	}

	if (flag == 2){
		cout << ans << endl;
	}else {
		cout << 0 << endl;
	}
}

Measured memory_bytes: 1024
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
?¨??????????

n ????????????????????????????????§????????°???????????°???????¨?????????£??????
????????????????????????s1, s2 ... sn??¨????????¨??????????¨??????????????±???????????????°????????????????????????

??????????????????????????¨????????°????????£?±2?????\???????????§???????????????

?±2 = (???ni=1(si - m)2)/n

?????£?????£????????????????¨???????????±??¨?????????
"""
import math
while True:
    num = int(input().strip())
    if num == 0:
        break
    s = list(map(float,input().strip().split()))
    
    # ?????????
    m = 0
    for i in range(num):
        m += s[i]
    m = m / num
    
    # ?¨??????????
    a2 = 0
    for i in range(num):
        a2 += (s[i] - m) ** 2
    a = math.sqrt(a2 / num)
    print(a)

Measured memory_bytes: 7848
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <limits.h>
#include <time.h>
int min(int a, int b) { return a < b ? a : b; }
int main(){
    int i,j,length,match=0,ans=114514;
    char s[1001]={},t[1001]={};
    scanf("%s %s",s,t);
    length=strlen(s)-strlen(t);
    for(i=0; i<=length; i++){
        for(j=0; j<strlen(t); j++){
            if(s[i+j]!=t[j])match++;
        }
        ans=min(match,ans);
        match=0;
    }
    printf("%d",ans);
    return 0;
}

Measured memory_bytes: 1732
let rec lower_bound l r p =
  if r <= 1 + l
  then r
  else let m = (l + r) / 2 in
       if p m
       then lower_bound l m p
       else lower_bound m r p

let () = Scanf.scanf "%d %d\n" @@ fun n k ->
  let as_ = Array.init n @@ fun _ -> Scanf.scanf "%d " @@ fun a -> a in
  let fs = Array.init n @@ fun _ -> Scanf.scanf "%d " @@ fun f -> f in
  Array.sort compare as_;
  Array.sort (fun f f' -> compare f' f) fs;
  Printf.printf "%d\n" @@
  lower_bound (-1) 1000000000001 @@ fun cost ->
    ( >= ) k @@
    Array.fold_left ( + ) 0 @@
    Array.init n @@ fun i ->
      max 0 (fs.(i) * as_.(i) - cost + fs.(i) - 1) / fs.(i)


Measured memory_bytes: 29356
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string S;
  cin >> S;
  
  vector<int>count(S.size(),0);
  for (int i = 0; i < S.size(); i++) {
    for (int j = i; j < S.size(); j++) {
      if (S.at(j) == 'A' || S.at(j) == 'C' || S.at(j) == 'G' || S.at(j) == 'T'){
        count.at(i)++;
      }
      else {
        break;
      }
    }
  }
  sort(count.begin(), count.end());
  cout << count.at(S.size()-1) << endl;
}
  

Measured memory_bytes: 3572
//#define DEB1 //output check function
//#define DEB2 //same output, input from input.txt

#include <iostream>
#include <algorithm>
#include <string>
#include <fstream>
#include <vector>
#include <cstdio>
#include <cmath>
#include <queue>
#include <stack>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <thread>
#include <mutex>
#include <iomanip>

#define ZERO(a) memset(a, 0, sizeof(a))
#define MINUS(a) memset(a, 0xff, sizeof(a))
#define INF(a) memset(a, 0x3f, sizeof(a))
#define ALL(t) (t).begin(),(t).end()
#define FILL(a,c) fill(a, a+ sizeof(a)/sizeof(*a),c)
#define FILL2D(A,c) fill(A[0], A[0] +sizeof(A)/sizeof(**A),c)
#define FILL3D(A,c) fill(A[0][0], A[0][0] +sizeof(A)/sizeof(***A),c)
#define REP(i,m) for(int i=0;i<(m);++i)
#define REPN(i,m,in) for(int i=(in);i<(m);++i)
#define IN(a, x, b) (a<=x && x<b)
#define PB push_back

using namespace std;

using LL = long long;
using PAIR = pair<int, int>;
using PAIRLL = pair<LL,LL>;
using VI = vector<int>;
using VVI = vector<VI>;


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;
}


#ifdef DEB1
#define DPRINT(x) cout<< #x << "=" << (x) << endl; // print at debug mode
#else
#define DPRINT(x) ;
#endif
#ifdef DEB1
#define DCHECK(x) cout<< "debug check" << #x << endl;
#else
#define DCHECK(x) ;
#endif
 


/*
constant values
*/

//const int dx[] = {1,0,-1,0};
//const int dy[] = {0,1,0,-1};
//const int MX = 31001;

//const ll INF= 1LL<<60 ;//INF = 1001001001001; //1e9


// Main program
void solve(){
    int A[5];
    int tmp = 10;
    int ans = 0;
    
    REP(i,5){
        cin >> A[i];
        ans += ((A[i]+ 9)/10 )*10 ;
        if(A[i]%10!=0) chmin(tmp,A[i]%10);
    }
    cout << ans + tmp - 10 <<endl;
}



// ----------------------------------------------
int main() {

#ifdef DEB2
    cout << "DEBUG MODE"  << endl;
	ifstream in("input.txt"); //for debug
	cin.rdbuf(in.rdbuf()); //for debug
#endif

	int T=1; 

	for (int i = 0; i < T; ++i) {
		solve();
	}
}

Measured memory_bytes: 256
readline = open(0).readline
N = int(readline())
*A, = map(int, readline().split())
Q = int(readline())
for _ in range(Q):
    b, m, e = map(int, readline().split())
    B = A[:]
    for k in range(e-b):
        A[b + ((k + (e - m)) % (e-b))] = B[b+k]
print(*A)


Measured memory_bytes: 5824
#include<iostream>
using namespace std;
int main()
{
	int a,b;
	cin>>a>>b;
	if(a==b)
	{
		for(int i=0;i<a;i++)
		{
			cout<<b;
		}
		return 0;
	}
	else if(a<b)
	{
		for(int i=0;i<b;i++)
		{
			cout<<a;
		}
		return 0;
	}
	else if(a>b)
	{
		for(int i=0;i<a;i++)
		{
			cout<<b;
		}
		return 0;
	}
	return 0;
}

Measured memory_bytes: 256
# Finding a Word
import re

word = input()
text = ""

end = 0
while end == 0:
    input_line = input()
    if input_line == 'END_OF_TEXT':
        end += 1
    else:
        text += input_line
        text += " "

blocked = text.lower().split() # この方法では記号を取り除けないという問題がある
count = 0
for a in blocked:
    if a == word:
        count += 1
print(count)



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

int main() {
  string S;
  cin >> S;
  char fir = S.at(0), sec = S.at(1), thr = S.at(2), frt = S.at(3);
  if (fir == sec) {
    if (thr == frt && fir != thr) {
      cout << "Yes" << endl;
    }
    else {
      cout << "No" << endl;
    }
  }
  else if (fir == thr) {
    if (sec == frt && fir != sec) {
      cout << "Yes" << endl;
    }
    else {
      cout << "No" << endl;
    }
  }
  else if (fir == frt) {
    if (sec == thr && fir != sec) {
      cout << "Yes" << endl;
    }
    else {
      cout << "No" << endl;
    }
  }
  else {
    cout << "No" << endl;
  }
}

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

namespace B
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine().Split(' ');
            var a = int.Parse(input[0]);
            var b = int.Parse(input[1]);
            var c = int.Parse(input[2]);
            var d = int.Parse(input[3]);

            while (true)
            {
                if (c > 0)
                {
                    c -= b;
                }
                if (c <= 0)
                {
                    Console.WriteLine("Yes");
                    return;
                }
                if (a > 0)
                {
                    a -= d;
                }
                if (a <= 0)
                {
                    Console.WriteLine("No");
                    return;
                }
            }
        }
    }
}


Measured memory_bytes: 17884
#include<cstdio>
#include<vector>
#include<algorithm>
#include<cmath>

using namespace std;

int main(void){
	int n,m;
	
	
	while(scanf("%d%d", &n, &m) != EOF){
		
		long long s[100001]={0};
		int a[100001];
		
		for(int i = 2; i <= n; i++){
			scanf("%lld", &s[i]);
			s[i] += s[i-1];
		}
		
		for(int i = 0; i < m; i++){
			scanf("%d", &a[i]);
		}
		
//		for(int i = 1; i < n; i++)printf("%2d ",s[i]);
//		puts("");
		
		int br = 1;
		int ar = 1;
		long long ans = 0;
		
		for(int i = 0; i < m; i++){
			ar = br + a[i];
			if(a[i] < 0)swap(ar,br);
			
			ans += s[ar]-s[br];
			ans%=100000;
			if(a[i] < 0)swap(ar,br);
//			printf("day %.0lf : %d km\n",i,ans);
//			printf("%d -> %d\n", br, ar);
			
			br = ar;
		}
		printf("%lld\n", ans);
	}
	return 0;
}

Measured memory_bytes: 1900
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
  int n;
  cin>>n;
  vector<int> a(n);
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  int x=0;
  for(int i=0;i<n;i++){
    if(a[i]==2){
      x++;
    }
  }
  int ans=1;
    int y=a[0];
    while(y!=2){
      y=a[y-1];
      ans++;
      if(ans>n){
        break;
      }
    }
    if(ans>n){
      cout<<-1<<endl;
    }
    else{
      cout<<ans<<endl;
    }
}

Measured memory_bytes: 3756
#include <iostream>
#include <algorithm>
using namespace std;
int main(void){
    int n, maxv = -2000000000, mina;
	cin >> n;
	int a[200000];
	for(int i = 0; i < n; i++) cin >> a[i];
	mina = a[0];
	for (int i = 1; i < n; i++) {
		maxv = max(maxv, a[i]-mina);
		mina = min(mina, a[i]);
	}
	cout << maxv <<endl;
	return 0;
}

Measured memory_bytes: 1940