akhauriyash/Code-Regression huggingface dataset:
/*****Here we go again!******/

#include<bits/stdc++.h>
using namespace std;

#define pi 3.1415926535
#define endl "\n"
#define yes cout << "YES\n"
#define no cout << "NO\n"
#define ll long long
#define llu unsigned long long
#define pb push_back
#define mp make_pair
#define sz(x) (int)x.size()
#define tc int test_case; cin >> test_case; while(test_case--)
#define f(i,a,n) for(int i = a ; i < n ; i++)
#define rf(i,n,a) for(int i = n-1 ; i >= a ; i--)
#define F first
#define S second
#define all(c) (c).begin(),(c).end()
#define get(a,n) f(i,0,n) cin >> a[i];
#define show(a,n) f(i,0,n) cout << a[i] << " "; cout << endl;
#define fast ios:: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define trace(x) cerr << '>' << #x << ':' << (x) << "\n"
#define trace2(x,y) cerr<< '>' << #x << ':' << (x) << " | " << #y << ':' << (y) << "\n"
#define trace3(a,b,c) cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<"\n"
#define trace4(a,b,c,d) cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<", "<<#d<<"="<<(d)<<"\n"

typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<pii,int> ppi;
typedef vector<pii> vpi;
typedef map<int,int> mii;
typedef map<ll,ll> mll;

const int inf = 1e9;
const ll inf64 = 1e18;
const int mod = inf + 7;
const int N = 3e5 + 10;

int main()
{
    fast;
    int h, w, m;
    cin >> h >> w >> m;
    map<pii,int> mapp;
    vi a(N), b(N);

    f(i,0,m)
    {
        int x, y;
        cin >> x >> y;
        a[x]++;
        b[y]++;
        mapp.insert(mp(mp(x,y),1));
    }

    int rmax = *max_element(all(a));
    int cmax = *max_element(all(b));

    vi rows, cols;
    f(i,0,N)
    {
        if(a[i] == rmax)
            rows.pb(i);
    }
    f(i,0,N)
    {
        if(b[i] == cmax)
            cols.pb(i);
    }

    bool inter = true;
    f(i,0,sz(rows))
    {
        f(j,0,sz(cols))
        {
            if(!mapp[mp(rows[i],cols[j])])
            {
                inter = false;
                break;
            }
        }
    }
    if(!inter)
        cout << rmax + cmax;
    else
        cout << rmax + cmax - 1;
}


Measured memory_bytes: 45516
///Bismillahir Rahmanir Rahim
#include<bits/stdc++.h>

#define                           int                         long long
#define                           fi                          first
#define                           si                          second
#define                           mp                          make_pair
#define                           pb                          push_back
#define                           pi                          pair<int,int>
#define                           f(i,l,r)                    for(int i=l;i<=r;i++)
#define                           rf(i,r,l)                   for(int i=r;i>=l;i--)
#define                           done(i)                     cout<<"done = "<<i<<endl;
#define                           fast                        ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);




using namespace std;

const int inf=1e18;
const int mod=1e9+7;
const int M=100009;

inline int bigmod(int B,int P){int R=1;while(P>0){if(P&1){R=(R*B)%mod;}P>>=1;B=(B*B)%mod;}return R;}
inline int ad(int x,int y){int ret=(x%mod+y%mod)%mod;if(ret<0){ret+=mod,ret=ret%mod;}return ret;}
inline int sub(int x,int y){int ret=((x%mod)-(y%mod)+mod)%mod;if(ret<0){ret+=mod,ret=ret%mod;}return ret;}
inline int gun(int x,int y){int ret=((x%mod)*(y%mod))%mod;if(ret<0){ret+=mod,ret=ret%mod;}return ret;}


 main()

{
    fast
    int n;
    cin>>n;
    string s,t;
    cin>>s>>t;
    int cnt=0,ses=0;
    f(i,0,n-1)
    {
       string suf=s.substr(i);
       int len=suf.size();
       string pre=t.substr(0,len);
       if(suf==pre)
       {
           ses=2*i+len;
           cout<<ses<<endl;
           return 0;
       }
    }
    ses=2*n;
    cout<<ses<<endl;
    return 0;

}





































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

void solve(int N, int K)
{
    if (K > (N - 1) * (N - 2) / 2)
    {
        cout << -1 << endl;
        return;
    }
    int M = (N - 1) + ((N - 1) * (N - 2) / 2 - K);
    cout << M << endl;
    for (int i = 2; i <= N; i++)
    {
        cout << 1 << " " << i << endl;
        M--;
    }
    for (int i = 2; i <= N; i++)
    {
        if (M == 0)
            break;
        for (int j = i + 1; j <= N; j++)
        {
            if (M == 0)
                break;
            cout << i << " " << j << endl;
            M--;
        }
    }
}

int main()
{
    int N, K;
    cin >> N >> K;
    solve(N, K);
    return 0;
}


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

int main(void)
{
    // sin -> radian. sin(M_PI/6) = 0.5
    // cout << sin(30) << ", " << sin(M_PI /6) << endl;

    int BottomLength, Height, Mass;
    cin >> BottomLength >> Height >> Mass;
    long double Area = 1.0 * Mass / BottomLength;
    cout.precision(14);

    if(Area <= BottomLength * Height /2 )
    {
        // Small Area
        long double BottomLength_WaterLevel = Area * 2.0/ Height;
        long double TangentTheta = Height / BottomLength_WaterLevel;
        cout << atan(TangentTheta) * 180.0 / M_PI << endl;

    }
    else
    {
        long double Area_Margin = 1.0 * BottomLength * Height - Area;
        long double Height_DistFromTopToWaterLevel = Area_Margin * 2.0 / BottomLength;
        long double TangentTheta = Height_DistFromTopToWaterLevel / BottomLength;
        cout << atan(TangentTheta) * 180.0 / M_PI << endl;
    }


    return 0;
}


Measured memory_bytes: 256
/**
*    created: 01.07.2020 12:44:21
**/
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
// #include <boost/multiprecision/cpp_int.hpp>
// using bint = boost::multiprecision::cpp_int;
using namespace std;
#define int long long
#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(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define pcnt(bit) __builtin_popcountll(bit)
template<class T> bool chmax(T &a, const T &b) {if (a < b) {a = b; return 1;} return 0;}
template<class T> bool chmin(T &a, const T &b) {if (b < a) {a = b; return 1;} return 0;}
const int mod = 1000000007;
// const int MOD = 998244353;
const long double pi = acos(-1.0);
const int inf = 1LL << 60;

signed main() {

    cin.tie(0);
    ios_base::sync_with_stdio(false);

    int a, b, x;
    cin >> a >> b >> x;
    if (a <= x && x <= a+b) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 3576
n, m, x, y = gets.chomp.split.map(&:to_i)

xs = gets.chomp.split.map(&:to_i)
ys = gets.chomp.split.map(&:to_i)

x_max = (xs + [x]).max
y_min = (ys + [y]).min

if x_max < y_min
  puts 'No War'
else
  puts 'War'
end


Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i, n) for (ll i = 0; i < n; i++)
#define REPR(i, n) for (ll i = n; i >= 0; i--)
#define FOR(i, m, n) for (ll i = m; i < n; i++)
#define FORR(i, m, n) for (ll i = m; i >= n; i--)
#define REPO(i, n) for (ll i = 1; i <= n; i++)
#define ll long long
#define INF (ll)1 << 60
#define MINF (-1 * INF)
#define ALL(n) n.begin(), n.end()
#define MOD 1000000007
#define P pair<ll, ll>

vector<ll> s;
bool bx[110000];
int main() {
    ll n, ax = 0;
    cin >> n;
    s.resize(n);
    REP(i, n){
        cin >> s[i];
        if(i >= 2) ax ^= s[i];
    }
    ll x = (s[1] + s[0] - ax) / 2;
    ll a = 0, b = 0;
    ll t = s[0] + s[1] - 2 * x;
    ll need[80] = {};
    REP(i, 60){
        if ((x & (1ll << i))) need[i] += 1ll << i;
        need[i + 1] += need[i];
    }
    REPR(i, 60){
        if((x & (1ll << i))){
            a += 1ll << i;
            b += 1ll << i;
        }
        else if((t & (1ll << i))){
            if(a + need[i] + (1ll << i) <= s[0]) a += 1ll << i;
            else b += 1ll << i;
        }
    }
    bool ok = true;
    if (a + b != s[0] + s[1]) ok = false;
    if (a > s[0]) ok = false;
    if (a <= 0) ok = false;
    if (b < 0) ok = false;
    if ((a xor b xor ax) != 0) ok = false;
    cout << (ok ? s[0] - a : -1) << endl;
}


Measured memory_bytes: 3640
#include <iostream>
using namespace std;
int n,s,c;
void f(int m,int a,int t){
        if(a == n){
                if(t == s) ++c;
        }
        else {
                for(int i = m;i < 10;++i){
                        f(i + 1,a + 1,t + i);
                }
        }
        return;
}
int main(){
        while(cin >> n >> s && (n != 0 || s != 0)){
                c = 0;
                f(0,0,0);
                cout << c << endl;
        }
        return 0;
}
 

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

#define REP(i, a, b) for (int i = (int)(a); i < (int)(b); ++i)
#define RREP(i, a, b) for (int i = (int)(a)-1; i >= (int)(b); --i)
#define rep(i, n) REP(i, 0, n)
#define rrep(i, n) RREP(i, n, 0)
#define ALL(r) (r).begin(), (r).end()

void Main();

int main()
{
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}

void Main() {
    int a; cin >> a;
    cout << (a >= 30 ? "Yes" : "No") << endl;
}


Measured memory_bytes: 3644
(defun check (a b)
  (cond ((and (null a) (null b)) nil)
        ((null a) t)
        ((null b) nil)
        ((char< (car a) (car b)) t)
        ((char= (car a) (car b)) (check (cdr a) (cdr b)))))

(let* ((a (read-line))
       (b (read-line)))
  (if (check (concatenate 'list (sort a #'char<))
             (concatenate 'list (sort b #'char>)))
      (princ "Yes")
      (princ "No")))


Measured memory_bytes: 3556
#include <iostream>

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

int A[4][3][10] = {0};

int* b = new int[n];
int* f = new int[n];
int* r = new int[n];
int* v = new int[n];

for(int i = 0; i < n; i++){
std::cin >> b[i] >> f[i] >> r[i] >> v[i];
}

for(int j = 0; j < n; j++){
A[b[j]-1][f[j]-1][r[j]-1] += v[j];
}

for(int k = 0; k < 4; k++){
for(int l = 0; l < 3; l++){
for(int m = 0; m < 10; m++){
std::cout << ' ' << A[k][l][m];
}
std::cout << std::endl;
}
if(k != 3){
for(int o = 0; o < 20; o++){
std::cout << '#';
}
std::cout << std::endl;
}
}

}

Measured memory_bytes: 3092
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vi;
typedef vector<string> vs;
typedef pair<ll,ll> P;
typedef vector<P> vp;
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define REPR(i,n) for(int i=n-1;i>=0;i--)
#define FORR(i,n,m) for(int i=n-1;i>=m;i--)
#define all(in) in.begin(),in.end()
#define ALL(in,K) in,in+K
#define INF 1e18
#define MOD 100000007
#define SIZE 105005
#define PI 	3.14159265358979323846

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin >> n;
    ll a[SIZE],b[SIZE],c[SIZE];
    REP(i,n){
        cin >> a[i] >> b[i] >> c[i];
    }
    ll ans[3][SIZE];
    ans[0][0] = a[0];
    ans[1][0] = b[0];
    ans[2][0] = c[0];
    FOR(i,1,n){
        ans[0][i] = max(ans[1][i-1],ans[2][i-1]) + a[i];
        ans[1][i] = max(ans[0][i-1],ans[2][i-1]) + b[i];
        ans[2][i] = max(ans[0][i-1],ans[1][i-1]) + c[i];
    }
    cout << max(max(ans[0][n-1],ans[1][n-1]),ans[2][n-1]) << endl;
    return 0;
}


Measured memory_bytes: 5120
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    h,w=map(int,input().split())
    for i in range(h):
        s=[_ for _ in input().split()]
        for j in range(w):
            if s[j]=="snuke":
                print(chr(ord('A')+j)+str(i+1))
                sys.exit()

if __name__=='__main__':
    main()

Measured memory_bytes: 3060
def main():
    from sys import stdin, setrecursionlimit
    #setrecursionlimit(10**9)
    #n = int(stdin.readline()[:-1])   
    #r = stdin.readline()[:-1]
    #r = [stdin.readline() for i in range(n)]
    #t = [int(stdin.readline()) for i in range(n)]
    #n = int(r)
    #a = r.split()
    #a,b,c = r.split()
    #a = list(map(int, r.split()))
    #a,b,c,d = map(int, r.split())
    #a = list(map(int, r.split()))
    #a = [int(s[i]) for i in range(1, n+1)]
    #a = [list(map(int, r.split())) for i in range(1,n+1)]
    #a = [list(map(int, input().split())) for i in range(1,n+1)]
    #res = 0

    n=int(input())
    a= list(map(int, input().split()))
    for i in a:
        if i%2 != 0:
            continue
        else:
            if i%3 ==0 or i%5==0:
                continue
            else:
                print('DENIED')
                exit()
    print('APPROVED')


if __name__ == '__main__':
    main()


Measured memory_bytes: 38384
//
//  main.cpp
//  AOJ
//
//  Created by 佐々木勇星 on 2018/09/29.
//  Copyright © 2018年 佐々木勇星. All rights reserved.
//

#include <iostream>
#include <stdio.h>
#include <vector>
using namespace std;

int main(int argc, const char * argv[]) {
    int a, b;
    cin >> a;
    //a個のベクターを用意
    vector<int> num(a);
    
    for(int i = 0; i < a; i++){
        cin >> b;
        num[i] = b;
        //cout << num[i] << " " << endl;
    }
    
    for(int j = a-1; j > -1; j--){
        cout << num[j];
        if(j != 0){
            cout << " ";
        }
    }
    
    cout << endl;
    return 0;
}



Measured memory_bytes: 3124
#include<vector>
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
const ll MOD=1000000007LL;
const ll INF=1000000000LL;
const int MAX=100001;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int q;
    cin>>q;
    for(int i=0;i<q;i++){
        ll a,b;
        cin>>a>>b;
        if(a>b){
            swap(a,b);
        }
        ll c=a*b;c=sqrt(c);if(c*c==a*b)c--;
        ll ans;
        if(b-a<2){
            ans=2*a-2;
        }else if(c*(c+1)>=a*b){
            ans=2*c-2;
        }else{
            ans=2*c-1;
        }
        cout<<ans<<endl;
    }
}

                           


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <functional>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
using namespace std;
template<class T, class Compare = less<T> >
using MaxHeap = priority_queue<T, vector<T>, Compare>;
template<class T, class Compare = greater<T> >
using MinHeap = priority_queue<T, vector<T>, Compare>;
using llong = long long;

llong n;
llong b[105];
llong a[105];

int main() {
    cin >> n;
    for (int i = 0; i < n - 1; i++) {
        cin >> b[i];
        
    }

    a[0] = b[0];
    for (int i = 1; i < n - 1; i++) {
        a[i] = min(b[i], b[i - 1]);
    }
    a[n - 1] = b[n - 2];

    llong ans = 0;
    for (int i = 0; i < n; i++) {
        ans += a[i];
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <map>
#include <algorithm>
#include <functional>
#include <vector>
using namespace std;

typedef unsigned long long ull;

map<ull,int> memo;

int dfs2(ull, int, int);

int dfs1(ull s){
	if(s <= 0xff){
		return s / 10;
	}
	if(memo.count(s)){
		return memo[s];
	}
	int k;
	for(k = 8; !(s >> ((k - 1) * 8)); --k);

	int a = dfs2(s - (1ull << ((k - 1) * 8)), 10 - k, k);
	int b = dfs1(s & ((1ull << ((k - 1) * 8)) - 1));
	int res = max(a, b);

	memo[s] = res;
	return res;
}

int dfs2(ull s, int t, int u){
	if(t != 9 && s >> ((t - 1) * 8) & 0xff){
		return dfs1(s - (1ull << ((t - 1) * 8))) + 1;
	}
	if(t == 1){
		return 0;
	}
	if(t == 2){
		if((s & 0xff) >= 2){
			return dfs1(s - 2) + 1;
		}
		return 0;
	}
	if(t == 3){
		if(s & 0xff && s & 0xff00){
			return dfs1(s - 0x101) + 1;
		}
		if((s & 0xff) >= 3){
			return dfs1(s - 3) + 1;
		}
		return 0;
	}
	
	int res = 0;
	for(u = min(t, u); u >= 1; --u){
		if(s >> ((u - 1) * 8) & 0xff){
			int a = dfs2(s - (1ull << ((u - 1) * 8)), t - u, u);
			res = max(res, a);
		}
	}
	return res;
}

int main(){
	int n, x;
	while(scanf("%d", &n), n){
		int cnt[10] = {};
		for(int i = 0; i < n; ++i){
			scanf("%d", &x);
			++cnt[x];
		}
		
		int ans = 0;
		for(int i = 1; i <= 4; ++i){
			x = min(cnt[i], cnt[10 - i]);
			ans += x;
			cnt[i] -= x;
			cnt[10 - i] -= x;
		}
		
		ans += cnt[5] / 2;
		cnt[5] &= 1;
		
		ull s = 0;
		for(int i = 1; i <= 8; ++i){
			s |= (ull)cnt[i] << ((i - 1) * 8);
		}
		
		memo.clear();
		ans += dfs1(s);
		printf("%d\n", ans);
	}
}

Measured memory_bytes: 1672
n = input()
def ok(x):
    v = []
    while x > 0:
        v.append(x % 10)
        x /= 10
    return len(set(v)) == 3

def f(x):
    if x > n:
        return 0
    res = sum(f(10*x+i) for i in [7,5,3])
    if ok(x):
        res += 1
    return res
print(f(0))

Measured memory_bytes: 2568
#include<stdio.h>
   int main(void){
       int i,j,n,card[256][14];
       int mark[4]={'S','H','C','D'};
       for(i=0;i<256;i++){
           for(j=0;j<14;j++){
               card[i][j]=0;
           }
       }
       scanf("%d\n",&n);
       for(i=0;i<n;i++){
           char c=0;
           int num=0;
           scanf("%c %d\n",&c,&num);
           card[c][num]=1;
       }
       for(j=0;j<4;j++){
           for(i=1;i<14;i++){
           if(card[mark[j]][i]==0){
               printf("%c %d\n",mark[j],i);
           }
       }
     }
    
    return 0;
}



Measured memory_bytes: 2064
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector<ll> vl;
typedef vector<vector<int, int> > vvi;
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define in insert
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int INF = 1e9 + 5;
int main(){
    int n;
    cin >> n;
    for(int i = 1; i <= n; i++){
        if(n%i==0){
            if(i>=1 && i<=9){
                if(n/i >= 1 && n/i <= 9){
                    cout << "Yes";
                    return 0;
                }
            }
        }
    }
    cout << "No";
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <map>
#include <vector>
#include <string>

using namespace std;

bool compare(const pair<int, int> &p, const pair<int, int> &q) 
{
    return (p.first != q.first) ? p.first > q.first : p.second < q.second;
}

int main()
{
    bool nl = false;
    int n;

    while (cin >> n) {
        if (!n)
            break;
        if (nl)
            cout << endl;

        vector< pair<int, int> > tourn;
        vector<string> name;

        for (int i = 0; i < n; i++) {
            int win, los, ev;
            string str;
        
            cin >> str >> win >> los >> ev;

            tourn.push_back(pair<int, int>(win * 3 + ev, i));
            name.push_back(str);
        }
        sort(tourn.begin(), tourn.end(), compare);
        
        for (int i = 0; i < tourn.size(); i++)
            cout << name[tourn[i].second] << ',' << tourn[i].first << endl;
        nl = true;
    }

    return 0;
}

Measured memory_bytes: 1216
#include<iostream>
#include<ctype.h>

using namespace std;
int main()
{

	int A,B;
	string S;
	cin >> A >> B;
	cin >> S;

	bool pass = true;


	for( int m = 0; m < A; m++ )
	{
		if( !isdigit(S[m]) )	
		{
			pass = false;

		}

	}
	if( pass && S[A] == '-' )
	{
		pass = true;
	}
	else
	{
		pass = false;
	}

	int counter = A + 1, counter1=0;
	
	if( pass )
	{

		while( counter1 < B )
		{

			if( !isdigit(S[counter]) )
			{
				pass = false;
				
			}
			counter ++;
			counter1++;
		}
	}



	if( pass )
	{
		cout << "Yes";
	}
	else
	{
		cout << "No";
	}


	return 0;

}


Measured memory_bytes: 256
#include<stdio.h>
#define N 100000
int check(int *,int,int);
int main(){
  int i,j,cnt=0,S[N],T,n,q;
  scanf("%d",&n);
  
  for(i=0;i<n;i++)
    scanf("%d",&S[i]);
  scanf("%d",&q);
  for(i=0;i<q;i++){
    scanf("%d",&T);
cnt+=check(S,T,n);
  }

  printf("%d\n",cnt);
  return 0;
}
int check(int S[],int t,int n){
  int l,m,r;
  l=0;
  r=n;
  while(l<r){
  
    m=l+r;
    m/=2;


    if(S[m]==t){
      
      return 1;
    }
    else if(S[m]<t)
      l=m+1;
    else if(S[m]>t)
      r=m;

    
  }
  return 0;

}



Measured memory_bytes: 2160
n = int(input())
p = list(map(int, input().split()))
cnt = 0
for i in range(1,n-1):
    if (p[i-1] > p[i] and p[i+1] < p[i]) or (p[i-1] < p[i] and p[i+1] > p[i]):
        cnt += 1
print(cnt)

Measured memory_bytes: 38256
#create date: 2020-07-05 18:05

import sys
stdin = sys.stdin

def ns(): return stdin.readline().rstrip()
def ni(): return int(ns())
def na(): return list(map(int, stdin.readline().split()))

def main():
    s = ns()
    l = False
    ans = [0] * len(s)
    z = [0, 0]
    for i, si in enumerate(s):

        if si =="L" and not l:
            rl = i
            l = True
        if si == "R" and l:
            if rl % 2 == 0:
                ans[rl-1] = z[1]
                ans[rl] = z[0]
            else:
                ans[rl-1] = z[0]
                ans[rl] = z[1]
            l = False
            z = [0, 0]
        if i % 2 == 0:
            z[0] += 1
        else:
            z[1] += 1
    if rl % 2 == 0:
        ans[rl-1] = z[1]
        ans[rl] = z[0]
    else:
        ans[rl-1] = z[0]
        ans[rl] = z[1]
    print(*ans)
        


if __name__ == "__main__":
    main()

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

int main() {
   // freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int n;
    cin>>n;
    int a[n];
    for(int i=0; i<n; i++) {
        cin>>a[i];
    }

    int dp[n];
    dp[0] = 0;
    dp[1] = abs(a[1]-a[0]);

    for(int i=2; i<n; i++) {
        dp[i] = min(dp[i-1]+abs(a[i]-a[i-1]), dp[i-2]+abs(a[i]-a[i-2]));
    }

    cout<<dp[n-1];
}

Measured memory_bytes: 1024
#include <stdio.h>

void dis(int *arr,int n)
{
    for(int i = 0;i<n;i++)
    {
        if(i>0)
            printf(" ");
        printf("%d",arr[i]);
    }
    printf("\n");
}

void InsertionSort(int *arr,int n)
{
    dis(arr,n);
    for(int i = 1;i<n;i++)
    {
        int v = arr[i];
        int j = i-1;
        while(j>=0 && arr[j]>v)
        {
            arr[j+1] = arr[j];
            j--;
        }
        arr[j+1] = v;

        dis(arr,n);
    }
}



int main(int argc, char *argv[])
{
//    int arr[] = {1,3,5,7,2,4,6,8};
//    int arr[] = {8,7,6,5,4,3,2,2};
//    dis(arr,8);
//    InsertionSort(arr,8);
//    dis(arr,8);
    int N;
    int A[100];

    scanf("%d",&N);
    for(int i = 0;i<N;i++)
    {
        scanf("%d",&A[i]);
    }
    InsertionSort(A,N);
    return 0;
}



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

int main() {
  int n, m;
  cin >> n >> m;
  Graph edge(m, vector<int>(2));
  Graph G(n);
  rep(i,m) {
    int a, b;
    cin >> a >> b;
    --a; --b;  // 0-indexed
    edge[i] = {a, b};
    G[a].push_back(b);
    G[b].push_back(a);
  }

  int ans = 0;

  rep(i,m) {
    queue<int> search;
    vector<bool> seen(n, false);
    int start = edge[i][0], goal = edge[i][1];
    search.push(start);
    bool bridge = true;

    while(!search.empty()) {
      int p = search.front();
      seen[p] = true;
      search.pop();
      for (auto v : G[p]) {
        if (p == start && v == goal) continue;
        if (v == goal) {
          bridge = false;
          break;
        }
        if (seen[v]) continue;
        search.push(v);
      }
      if (!bridge) break;
    }

    if (bridge) ans++;
  }

  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include <cmath>
#include <map>
#include <algorithm>
using namespace std;
int main(void){
    int a,b;
    cin >> a >> b ;
    int ans ;
    if(0 <= b && b < 10 ){
        ans = a * 10 + b ;
        //cout << ans << endl;
    }else if(b < 100){
        ans = a * 100 + b ;
        //cout << ans << endl;
    }else{
        ans = a * 1000 + b ;
        //cout << ans << endl;
    }
    
    bool flag = false ;
    for(int i = 0; i < 318 ; i++ ){
        
        if(ans == i*i){
            flag = true ;
        }
    }   

    if(flag == true){
        cout << "Yes" << endl;
    }else{
        cout <<"No" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func nextWord() string {
	sc.Scan()
	str := sc.Text()
	return str
}

func nextInt() int {
	i, e := strconv.Atoi(nextWord())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	sc.Split(bufio.ScanWords)
	a, s := nextInt(), nextWord()
	ans := isRed(a, s)
	fmt.Println(ans)
}

func isRed(a int, s string) string {
	result := s
	if a < 3200 {
		result = "red"
	}
	return result
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
#define rep(i, n) for(ll i = 0;i < n;i++)
#define all(i) i.begin(), i.end()
template<class T, class U> bool cmax(T& a, U b) { if (a<b) {a = b; return true;} else return false; }
template<class T, class U> bool cmin(T& a, U b) { if (a>b) {a = b; return true;} else return false; }

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

  int n, a, b;
  cin >> n >> a >> b;
  cout << min(a*n, b) << endl;
}


Measured memory_bytes: 892
#include <iostream>
#include <stdio.h>
#include <cstring>
#include <cstdio>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string>
#include <stdlib.h>
#include <queue>
#include <stack>
#include <utility>
#include <fstream>
#include <random>
#include <map>
#include <unordered_map>
#include <cstdlib>
#include <functional>
#include <random>
#include <time.h>
#include <chrono>
#include <sstream>
#include <iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ll long long
#define INF 1000000001
#define mod 1000000007
#define SORT(s) sort(s.begin(), s.end());
#define reverse(s) reverse(s.begin(), s.end());
#define P pair<int,int>
#define mp make_pair
#define valid(x,y,h,w) (0<=x&&x<h&&0<=y&&y<w)
int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };
using namespace std;
int POW(int x, int y) { return int(pow(double(x), double(y))); }
double log(double a, double b) { return log(b) / log(a); }




int main() {
	string s;
	cin >> s;
	int a = 0;
	int c = 0;
	rep(i,s.size()) {
		if (s[i] == 'A' || s[i] == 'G' || s[i] == 'C' || s[i] == 'T') {
			c++;
		}
		else {
			a = max(a, c);
			c = 0;
		}
	}
	a = max(a, c);
	cout << a << endl;
}



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

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

const int INF=1001001001;
int N;
int P[40],T[40];
int dp[50][3];
int main(){
    while(cin>>N,N){
        for(int i=0;i<N;i++)cin>>P[i]>>T[i];
        if(P[0]>T[0]){
            cout<<"NG 1"<<endl;
            continue;
        }
        fill_n(*dp,50*3,INF);
        dp[1][0]=P[0];
        bool ok=true;
        for(int i=1;i<N;i++){
            for(int j=1;j<3;j++){
                int t=T[i-1]+abs(P[i-1]-P[i])*(j+1);
                if(t>T[i])continue;
                chmin(dp[i+1][j],dp[i][j-1]+abs(P[i-1]-P[i]));
            }
            for(int j=0;j<3;j++){
                int t=T[i-1]+P[i-1]*(j+2)+P[i];
                if(t>T[i])continue;
                chmin(dp[i+1][0],dp[i][j]+P[i]+P[i-1]);
            }
            bool f=false;
            for(int j=0;j<3;j++)if(dp[i+1][j]!=INF)f=true;
            if(!f){
                ok=false;
                cout<<"NG "<<i+1<<endl;
                break;
            }
        }
        if(ok){
            int ans=INF;
            for(int i=0;i<3;i++){
                chmin(ans,dp[N][i]+P[N-1]);
            }
            cout<<"OK "<<ans<<endl;
        }
    }
    return 0;
}

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define LL long long
#define fr(i,x,y) for(int i=(x);i<=(y);i++)
#define rf(i,x,y) for(int i=(x);i>=(y);i--)
#define frl(i,x,y) for(int i=(x);i<(y);i++)
using namespace std;
const int N=2022;//!!!!!
char c[N],d[N],e[N];
int K,n;

void read(int &x){
	char ch=getchar();x=0;
	for(;ch<'0'||ch>'9';ch=getchar());
	for(;ch>='0'&&ch<='9';ch=getchar()) x=(x<<3)+(x<<1)+ch-'0';
}

int main(){
	//freopen("1.in","r",stdin);
	scanf("%s",c+1);
	read(K);n=strlen(c+1);
	LL ans=0,sum=0,s2=0;
	fr(i,1,n) d[i]=c[i],e[i]=c[i];
	fr(i,2,n)
	 if (c[i]==c[i-1]){
	 	c[i]='z'+1;ans++;
	 }
	d[0]=c[n];
	fr(i,1,n)
	 if (d[i]==d[i-1]){
	 	d[i]='z'+1;sum++;
	 }
	e[0]=d[n];
	fr(i,1,n)
	 if (e[i]==e[i-1]){
	 	e[i]='z'+1;s2++;
	 }
	cout<<ans+sum*(K-1-(K-1)/2)+s2*((K-1)/2)<<endl;
	return 0;
}

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

int main(void) {
  double a, b, c, d;
  scanf("%lf%lf%lf%lf", &a, &b, &c, &d);
  printf("%f\n", sqrt((a - c) * (a - c) + (b - d) * (b - d)));
  return 0;
}


Measured memory_bytes: 2748
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
typedef vector<int> VI;
ll mm=1000000000;ll MM=mm+7;
#define rep(i, n) for(int i=0;i<n;i++)
#define PI 3.141592653589793




int main(){
   int n,k;
   cin >> n >> k;
   cout << n-k+1 << endl;
}

Measured memory_bytes: 3628
#include "bits/stdc++.h"
using namespace std;
//http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2629&lang=jp
int main() {
	cin.tie(0); ios::sync_with_stdio(false);
	double d; cin >> d;
	cout << fixed << setprecision(10) <<  max(sqrt(2) * d, (int)d + 1.0) << endl;
}

Measured memory_bytes: 3276
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int MOD = pow(10, 9) + 7;
//const int MOD = 998244353;
//const int MOD = ;
int mod(int A, int M) {return (A % M + M) % M;}
const int INF = 1LL << 60;
const string ABC = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const string abc = "abcdefghijklmnopqrstuvwxyz";
template <class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template <class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
int divCeil(int A, int B) {return (A + (B - 1)) / B;}

int modpow(int a, int n, int m)
{
  int ret = 1;
  while (n > 0)
  {
    if (n % 2 == 1) ret = ret * a % m;
    a = a * a % m;
    n /= 2;
  }
  return ret;
}

signed main()
{
  string L;
  cin >> L;
  int N = L.size();
  
  vector<int> ans0;
  int ans = 1;
  bool ALLuni = true;
  for (int i = 0; i < N; i++)
  {
    if (L.at(i) == '1')
    {
      ans0.push_back(ans * modpow(3, N - i - 1, MOD));
      ans *= 2;
      ans %= MOD;
      //cerr << ans0.at(ans0.size() - 1) << endl;
    }
    else ALLuni = false;
  }
  
  if (ALLuni)
  {
    cout << modpow(3, N, MOD) << endl;
    return 0;
  }
  
  for (int i = 0; i < ans0.size(); i++)
  {
    ans += ans0.at(i);
    ans %= MOD;
  }

  cout << ans << endl;
}

Measured memory_bytes: 1528
#include <cstring>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>

#include <cmath>
#include <iomanip>

using namespace std;

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  int w;
  cin >> w;
  int weights[n];
  long long int values[n];
  long long int cur;
  for (int i = 0; i < n; i++) {
    cin >> cur;
    weights[i] = cur;
    cin >> cur;
    values[i] = cur;
  }
  long long int dp[n+1][w+1];
  // dp[n][w] represents the maximum value that can be achieved with at most w weight and only using items with number up to n.
  for (int i = 0; i < n+1; i++) {
    for (int j = 0; j < w+1; j++) {
      dp[i][j] = 0;
    }
  }
  for (int minInd = 0; minInd < n; minInd++) {
    for (int allowed = 0; allowed < w; allowed++) {
      dp[minInd+1][allowed] = max(dp[minInd+1][allowed], dp[minInd][allowed]);
      if (allowed+weights[minInd] <= w) {
	dp[minInd+1][allowed+weights[minInd]] = max(dp[minInd+1][allowed+weights[minInd]], dp[minInd][allowed]+values[minInd]);
      }
    }
  }
  long long int best = dp[n][0];
  for (int i = 1; i < w+1; i++) {
    best = max(best, dp[n][i]);
  }
  cout << best << "\n";
  return 0;
}

Measured memory_bytes: 79104
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>

using namespace std;

#define ll long long

int main(void){
    int n;
    double ans = 0.0;
    cin >> n;

    vector<double> a(n);
    for(int i = 0;i < n;i++){
        cin >> a[i];
        a[i] = 1.0/a[i];
        ans += a[i];
    }

    ans = 1.0/ans;
    cout << ans << endl;


    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define F first
#define S second
ll int dp[1000005];
ll int N,K;
vector<ll int> v;
int fun(int i)
{
  int x;
  if(i==N-1)
    return 0;
  if(i>=N)
    return 0;
  if(dp[i+1]==-1)
    dp[i+1]=fun(i+1);
  int mini=abs(v[i+1]-v[i])+dp[i+1];
  for(x=2;x<=K&&(i+x)<N;x++)
  {
    if(dp[i+x]==-1)
      dp[i+x]=fun(i+x);
   	mini=mini<=(abs(v[i+x]-v[i])+dp[i+x])?mini:(abs(v[i+x]-v[i])+dp[i+x]);
  }
  dp[i]=mini;
  return dp[i]; 
}
int main()
{
  int i,x;
  for(i=0;i<1000005;i++)
    dp[i]=-1;
  cin>>N>>K;
  for(i=0;i<N;i++)
  {
    cin>>x;
    v.pb(x);
  }
  dp[0]=fun(0);
  cout<<dp[0]<<endl;
  return 0;
}

Measured memory_bytes: 16756
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using p = pair<int,int>;
const long long INF = 1ll << 60;



int main() {
  string s,t; cin >> s >> t;
  cout << t << s << endl;

	return 0;
}



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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ALL(a)     (a).begin(),(a).end()
#define VI         vector<int>
#define MOD 1000000007

using ll = long long int;
using P = pair<int,int>;

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

const ll INF=(ll)1e19;
//const int INF=(1<<30);
//const int INF=(1<<29);

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

  if(a==b && b == c){
    cout << (a%2==0 ? -1 : 0) << endl;
    return 0;
  }

  int ans=0;
  while(a%2==0 && b%2==0 && c%2==0){
    ans++;
    int aa,bb,cc;
    aa = (b+c)/2;
    bb = (a+c)/2;
    cc = (b+a)/2;
    a = aa; b = bb; c = cc;
  }
  cout << ans << endl;
}



Measured memory_bytes: 256
#include <stdio.h>
#define N 2000

int n,A[N];
int solve(int,int);

int main(){
  int i,q,m;

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

  scanf("%d",&q);
  for(i=0;i<q;i++){
    scanf("%d",&m);
    if(solve(0,m)==1) printf("yes\n");
    else if(solve(0,m)==0) printf("no\n");
  }
  return 0;
}

int solve(int i,int m){

  int res;
  
  if(m==0) return 1;
  else if(i>=n) return 0;

  res = solve(i+1,m) || solve(i+1,m-A[i]);
  return res;
}

Measured memory_bytes: 580
/*
* @Author: _dp95
* @Date:   2020-04-14 07:42:35
*/
#include "bits/stdc++.h"
using namespace std ;

#define timesaver ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef long long ll ;
typedef long double ldb ;

#define mp make_pair
#define pb push_back
#define F first
#define S second
#define nl '\n'

#define all( x ) x.begin(),x.end() 
#define sz( x ) ( int )( x ).size( )
#define mem( a, val ) memset(a, val, sizeof( a ) )
#define deci( x ) cout<<fixed<<setprecision( x );
#define bitcount( x ) __builtin_popcountll( x )

const int dx[8] = {-1, -1, -1, 0, 1, 1, 1, 0};
const int dy[8] = {-1, 0, 1, 1, 1, 0, -1, -1};

const int MAX = 2*1000*1000 + 10 ;
const ll INF = 1e18 ;
const int MOD = 1e9 + 7 ;

signed main( ){
  timesaver ;
  int t ;
  cin >> t ;
  cout << (t<1200?"ABC":"ARC") << nl ;
  
}

Measured memory_bytes: 256
/*
ID: anonymo14
TASK: wormhole
LANG: C++                 
*/
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pair<int,int>> vpii;

#define F first
#define S second
#define PU push
#define PUF push_front
#define PUB push_back
#define PO pop
#define POF pop_front
#define POB pop_back

#define REP(i,a,b) for(int i=a; i<=b; i++)

#define MOD 1000000007

void solve(int test_case) {//227
	int n;
	cin>>n;int lt=0,lx=0,ly=0;
	while(n--) {
		int t,x,y;
		cin>>t>>x>>y;
		if((t-lt)%(abs(lx-x)+abs(ly-y))!=0) {
			cout<<"No";
			return;
		}
		lt=t;lx=x;ly=y;
	}
	cout<<"Yes";
}

int main() {
	
	////// FILE BASED IO////
	//freopen("wormhole.in", "r", stdin);
	//freopen("wormhole.out", "w", stdout);
	///////////////
	
	ios::sync_with_stdio(0);
	cin.tie(0);
	int t=1;
	//cin>>t;
	REP(i,1,t) {
		solve(i);
	}
	return 0;
}	


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

using namespace std;
using ll =long long;
typedef pair<int,int> P;
#define SORT(a) sort((a).begin(),(a).end())
#define REV(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define debug(x)  cerr << #x << " = " << (x) << endl;
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 coY() {cout <<"Yes"<<endl;}
void coN(){cout <<"No"<<endl;}
 
//Write From this Line

//const ll mod = 1e9+7;
//const ll mod = 998244353;
int main()
{
	int n;
	cin >> n;
	vector<int> a(n);
	rep(i, n)cin>>a[i];
	
	// 前の人よりも身長が低かったら、踏み台を設置する
	int bef = 0;
	ll ans = 0;
	rep(i,n){
		if(bef > a[i]){
			ans += bef - a[i];
		} else {
			bef = a[i];
		}
	}
	cout << ans << endl;
}


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

using namespace std;

int main(void) {

	int P, Q, R, sum;

	cin >> P >> Q >> R;

	if (P < Q) {
		sum = P;
		sum += min(Q, R);
	}
	else {
		sum = Q;
		sum += min(P, R);
	}

	cout << sum << endl; 

	return 0;
}

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

#define rep(i,a,b) for(int i = a;i < b;i++)

using namespace std;

int main() {
	int ans = 0;
	int N, M;
	cin >> N >> M;

	vector<pair<int, int>> a(M);
	
	//second→左端 first→右端
	rep(i, 0, M) {
		cin >> a[i].second >> a[i].first;
	}

	//rep(i, 0, M)	cout << a[i].first << a[i].second << endl;
	//cout << '\n';

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

	//rep(i, 0, M)	cout << a[i].first << a[i].second << endl;
	
	int pointer = a[0].first;
	ans++;

	rep(i, 1, M) {
		if (pointer <= a[i].second) {
			pointer = a[i].first;
			ans++;
		}
	}

	cout << ans << endl;

	return 0;
}

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

int main(){
    int n; cin >> n;
    vector<ll> l(86+1);
    l[0] = 2; l[1] = 1;

    for(int i = 2; i <= n; i++){
        l[i] = l[i-1] + l[i-2];    
    }

    cout << l[n] << endl;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <cassert>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>
#include <functional>


#ifdef _DEBUG
#define typeof(X) std::identity<decltype(X)>::type //C++0x (for vs2010)
#else
#define typeof(X) __typeof__(X) // for gcc
#endif

using namespace std;
static const double EPS = 1e-6;
typedef long long ll;
const int MODULO = 1000000007;
const int INF = 100000000; //1e8

typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
typedef complex<double> Cd;


int main(){
	int ans = 0;
	string s;
	while(cin>>s){
		for (int i = 0; i < (int)s.length(); i++){
			if('0' <= s[i] && s[i] <= '9') continue;
			s[i] = ' ';
		}
		istringstream iss(s);
		int a;
		while(iss>>a) ans += a;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 0
S = input()
T = input()

S = sorted(S)
tmp = ['','']
for s in S:
    tmp[0] += s
T = sorted(T)
for t in T[::-1]:
    tmp[1] += t
if tmp[0] == tmp[1]:
    print('No')
    exit()
tmp2 = sorted(tmp)
if tmp2[0] == tmp[0]:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

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

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

    priority_queue<int> pq;
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;
        pq.push(a);
    }
    
    for (int j = 0; j < m; j++) {
        int a = pq.top(); pq.pop();
        pq.push(a / 2);
    }

    ll s = 0;
    for (int i = 0; i < n; i++) {
        int a = pq.top(); pq.pop();
        s += a;
    }

    cout << s << endl;

    return 0;
}

Measured memory_bytes: 892
#include <algorithm>
#include <cmath>
#include <climits>
#include <functional>
#include <iostream>
#include <queue>
#include <string>
#include <vector>
#include <unordered_set>
using namespace std;
using ll  = long long;

const int T = 1;
const int F = 0;
const int X = 2;

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

    int N, A, x, y;
    cin >> N;
    vector<vector<int>> list, newList;

    list.emplace_back(vector<int>(N, X));
    for(int n = 0; n < N; n++) {
        cin >> A;
        vector<int> AisT(N, X), AisF(N, X);
        AisT[n] = T;
        AisF[n] = F;
        for(int a = 0; a < A; a++) {
            cin >> x >> y;
            AisT[x - 1] = y;
        }

        newList.clear();
       
        for(const auto &l : list) {
            bool ok = true;
            vector<int> newl(N);
            for(int nn = 0; nn < N; nn++) {
                if(l[nn] == X){
                    newl[nn] = AisT[nn];
                }
                else if(l[nn] == T && AisT[nn]!= F){
                    newl[nn] = T;
                }
                else if(l[nn] == F && AisT[nn]!=T){
                    newl[nn] = F;
                }
                else{
                    ok = false;
                }
            }
            if(ok){
                newList.emplace_back(newl);
            }
        }
        
        for(const auto &l : list) {
            bool ok = true;
            vector<int> newl(N);
            for(int nn = 0; nn < N; nn++) {
                if(l[nn] == X){
                    newl[nn] = AisF[nn];
                }
                else if(l[nn] == T && AisF[nn] != F) {
                    newl[nn] = T;
                } else if(l[nn] == F && AisF[nn] != T) {
                    newl[nn] = F;
                } 
                else {
                    ok = false;
                    break;
                }
            }
            if(ok) {
                newList.emplace_back(newl);
            }
        }
        swap(list, newList);
    }

    int ans = 0;
    for(const auto &l : list) {
        int count = 0;
        for(int nn = 0; nn < N; nn++) {
            if(l[nn] == T)
                count++;
        }

        ans = max(ans, count);
    }
    cout << ans << endl;
}

Measured memory_bytes: 5236
S = input()
n = len(S)
l1 = [0] * (n+1)
l2 = [0] * (n+1)

v = 0
for i in range(1, n+1):
    if S[i-1] == "<":
        v += 1
        l1[i] = v
    else:
        v = 0

v = 0
for i in range(n)[::-1]:
    if S[i] == ">":
        v += 1
        l2[i] = v
    else:
        v = 0

ans = 0
for i, j in zip(l1, l2):
    ans += max(i, j)

print(ans)

Measured memory_bytes: 27292
import bisect


def main():
    N = int(input())
    A = list(map(int, input().split(' ')))
    pos_scores = [i + 1 + a for i, a in enumerate(A)]
    neg_scores = [i + 1 - a for i, a in enumerate(A)]
    neg_scores.sort()
    cnt = 0
    for ps in pos_scores:
        left = bisect.bisect_left(neg_scores, ps)
        right = bisect.bisect_right(neg_scores, ps)
        cnt += right - left
    print(cnt)


if __name__ == '__main__':
    main()


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

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

int main(){
  int a,b;
  cin>>a>>b;
  if(a>8||b>8)
    cout<<":("<<endl;
  else
    cout<<"Yay!"<<endl;



  return 0;
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
#define rep(i,x) for(ll i = 0; i < (ll)(x); i++)
#define rrep(i,x) for(ll i = (ll)(x)-1;0 <= i; i--)
#define reps(i,x) for(ll i = 1; i < (ll)(x)+1; i++)
#define rreps(i,x) for(ll i = (ll)(x); 1 <= i; i--)
#define debug(x) cerr << #x << ": " << (x) << "\n";
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<ll>>> vvvl;
const ll INF = numeric_limits<ll>::max()/4;
const int n_max = 1e5+10;
#define int ll

template<class T>
bool chmax(T &a, T b){if(a < b){a = b; return true;} return false;}
template<class T>
bool chmin(T &a, T b){if(a > b){a = b; return true;} return false;}

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    ll n; cin >> n;
    vector<vector<ll>> vec(n, vector<ll>(3));
    rep(i,n)rep(j,3)cin >> vec[i][j];

    vector<vector<ll>> dp(n+1, vector<ll>(3));
    rep(i,n){
        rep(j,3){
            rep(k,3){
                if(j == k)continue;
                chmax(dp[i+1][j], dp[i][k] + vec[i][j]);
            }
        }
    }

    ll ans = 0;
    rep(i,3)chmax(ans, dp[n][i]);

    cout << ans << endl;
}

Measured memory_bytes: 17408
def main():
    I, O, T, J, L, S, Z = map(int, input().split())

    ans = 0
    for ijl in range(2):
        i = I - ijl
        j = J - ijl
        l = L - ijl

        if i < 0 or j < 0 or l < 0:
            continue

        cnt = 3 * ijl + (i // 2) * 2 + (j // 2) * 2 + (l // 2) * 2

        ans = max(ans, cnt)

    ans += O
    print(ans)


if __name__ == '__main__':
    main()

"""
II
IJL
O
JJ
LL

IJLの使用回数(偶数または奇数の2通り)それぞれで
II/JJ/LL/Oで使用する個数を求める
"""


Measured memory_bytes: 9112