akhauriyash/Code-Regression huggingface dataset:
from collections import defaultdict
from collections import deque
mod = int(1e9+7)
N = int(input())
S1 = input()
S2 = input()

if N == 1:
    print(3)
    exit()

if S1[0] == S1[1]:
    ans = 6
    for i in range(2, N):
        if S1[i-1] == S1[i]:
            continue
        if S1[i] == S2[i]:
            if S1[i-1] == S2[i-1]:
                ans *= 2
                ans %= mod
            else:
                continue
        else:
            if S1[i-1] == S2[i-1]:
                ans *= 2
                ans %= mod
            else:
                ans *= 3
                ans %= mod
else:
    ans = 3
    for i in range(1, N):
        if S1[i-1] == S1[i]:
            continue
        if S1[i] == S2[i]:
            if S1[i-1] == S2[i-1]:
                ans *= 2
                ans %= mod
            else:
                continue
        else:
            if S1[i-1] == S2[i-1]:
                ans *= 2
                ans %= mod
            else:
                ans *= 3
                ans %= mod

print(ans)


Measured memory_bytes: 38384
#include <iostream>
#include <vector>
#include <list>
#include <set>
#include <queue>
#include <map>
#include <algorithm>
#include <functional>
#include <string>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
using namespace std;

#define REP(i,p,n) for(int i=p;i<n;++i)
#define rep(i,n) REP(i,0,n)

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

ll N, K;

const ll MAXN = 50;
ll D[MAXN];

ll DL[MAXN];
ll DR[MAXN];

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

    rep (i, N) { cin >> D[i]; }

    // DL[i] = 0;
    // DR[i] = 0;
    // rep (i, N - 1) { DL[i + 1] = DL[i] + D[i]; }
    // rep (i, N - 1) { DR[i + 1] = DR[i] + D[N - i - 1]; }

    ll ans = 0;

    const ll NK = min(N, K);

    for (ll lnum=0;lnum<=NK;++lnum)
    for (ll rnum=0;lnum+rnum<=NK;++rnum)
    {
        const ll dnum = K - (lnum + rnum);

        ll res = 0;

        priority_queue< ll, vector<ll>, greater<ll> > Q;

        rep (i, lnum) { res += D[i]; Q.push(D[i]); }
        rep (i, rnum) { res += D[N - i - 1]; Q.push(D[N - i - 1]); }

        rep (i, dnum)
        {
            if (!Q.empty() && Q.top()<0) { res -= Q.top(); Q.pop(); }
        }

        // printf("(%lld, %lld, %lld)=%lld | %lld\n", lnum, rnum, dnum, res, ans);

        ans = max(ans, res);
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))

P = []
m = A[0]
for i in range(1, N):
    if A[i] < A[i - 1]:
        if m != A[i - 1]:
            P.append((m, A[i - 1]))
        m = A[i]
if m < A[N - 1]:
    P.append((m, A[N - 1]))

ans = 1000
for p in P:
    ans += (p[1] - p[0]) * (ans // p[0])
print(ans)


Measured memory_bytes: 9240
fun main(args: Array<String>) = abc161b()

fun abc161b() {
    val (n, m) = readLine()!!.split(' ').map { it.toInt() }
    val aList = readLine()!!.split(' ').map { it.toInt() }

    val sum = aList.sum()
    val answer = if (aList.count { it * 4 * m >= sum } >= m) "Yes" else "No"

    println(answer)
}


Measured memory_bytes: 38240
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define int ll
#define double long double
#define YES {cout<<"YES"<<'\n';}
#define NO {cout<<"NO"<<'\n';}
#define Yes {cout<<"Yes"<<'\n';}
#define No {cout<<"No"<<'\n';}
#define yes {cout<<"yes"<<'\n';}
#define no {cout<<"no"<<'\n';}
void YN(bool flg){cout<<(flg?"YES":"NO")<<'\n';}
void Yn(bool flg){cout<<(flg?"Yes":"No")<<'\n';}
void yn(bool flg){cout<<(flg?"yes":"no")<<'\n';}
#define SORT(a) sort(a.begin(),a.end())
#define REVERSE(a) reverse(a.begin(),a.end())
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define out(n) {cout << n << '\n';}
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<VI> VVI;
const int MOD = 1000000007;
const long long INF = 10e10;
const double PI = acos(-1.0);
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T>auto MAX(const T& a) { return *max_element(a.begin(),a.end()); }
template<class T>auto MIN(const T& a) { return *min_element(a.begin(),a.end()); }
int ABS(int a) {if(a<0) a = -a; return a;}
template<class T, class U>U SUM(const T& a, const U& v) { return accumulate(a.begin(),a.end(), v); }
template<class T, class U>U COUNT(const T& a, const U& v) { return count(a.begin(),a.end(), v); }
template<class T, class U>int LOWER(const T& a, const U& v) { return lower_bound(a.begin(),a.end(), v) - a.begin(); }
template<class T, class U>int UPPER(const T& a, const U& v) { return upper_bound(a.begin(),a.end(), v) - a.begin(); }
int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { int g = GCD(a, b); return a / g * b; }
int POW(int a, int n) { int r = 1; while (n > 0) { if (n & 1)r *= a; a *= a; n /= 2; }return r; }
int isPrime(int n){if(n<2){return 0;}for(int i=2; i*i<=n; i++){if(n%i==0){return 0;}}return 1;}
/*素因数分解*/map< int, int >prime_factor(int n){map< int, int > ret;for(int i = 2; i * i <= n; i++) {while(n % i == 0) {ret[i]++;n /= i;}}if(n != 1) ret[n] = 1;return ret;}
/*約数の個数*/int divisor_number(int n){auto p = prime_factor(n); int res = 1; for(auto x:p)res*=(x.second+1); return res;}
/*約数列挙*/vector<int> divisor(int n){vector<int> v; for(int i=1; i*i<=n; i++){if(n%i==0){v.push_back(i);if(i!=n/i){v.push_back(n/i);}}}sort(v.begin(),v.end()); return v;}
//----------------ライブラリとか----------------

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout<<fixed<<setprecision(15);

    string s; cin >> s; string t = s; REVERSE(t);
    Yn(s==t);

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <climits>
#include <string>
#define rep(i,a) for(i=0;i<a;i++)
using namespace std;

typedef pair<string,int> card;
 
int partition(vector<card> &qs, int p, int r) {
    int i,j,x;
    x = qs[r].second;
    i = p-1;
 
    for(j=p; j <= r-1; j++) {
        if(qs[j].second <= x){
            i = i+1;
            swap(qs[i],qs[j]);
        }
    }
    swap(qs[i+1],qs[r]);
    return i+1;
}

void quicksort(vector<card> &qs, int p, int r) {
    if(p < r) {
        int q = partition(qs,p,r);
        quicksort(qs, p, q-1);
        quicksort(qs, q+1, r);
    }
}

void merge(vector<card> &ms, int l, int m, int r){
    int n1 = m-l;
    int n2 = r-m;
    int i,j;
    vector<card> L(n1+1);
    vector<card> R(n2+2);
    rep(i,n1){
        L[i] = ms[l+i];
    }
    rep(i,n2) {
        R[i] = ms[m+i];
    }
    L[n1].second = INT_MAX;
    R[n2].second = INT_MAX;
    i = 0;
    j = 0;
    for(int k = l; k < r; k++) {
        if(L[i].second <= R[j].second) {
            ms[k] = L[i];
            i++;
        } else {
            ms[k] = R[j];
            j++;
        }
    }
}

void mergesort(vector<card> &ms, int l, int r) {
    if (l+1 < r) {
        int m = (l+r)/2;
        mergesort(ms,l,m);
        mergesort(ms,m,r);
        merge(ms,l,m,r);
    }
}

bool check(vector<card> &qs, vector<card> &ms, int n)
{
    int i;
    rep(i,n){
        if(qs[i].first != ms[i].first || qs[i].second != ms[i].second){
            return false;
        }
    }
    return true;
}
 
int main(void) {
    int n,i;
    card c1;
    vector<card> qs;
     
    cin >> n;
    rep(i,n) {
        cin >> c1.first >> c1.second;
        qs.push_back(c1);
    }
    vector<card> ms(qs.begin(),qs.end());

    quicksort(qs,0,n-1);
    mergesort(ms,0,n);

    if(check(qs,ms,n)) {
        cout << "Stable" << endl;
    } else {
        cout << "Not stable" << endl;
    }

    rep(i,n) {
        cout << qs[i].first << " " << qs[i].second << endl;
    }
    return 0;
}

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

// 各桁の和を算出
int kakuketa(int x){
  int sum = 0;
  while(true){
    int amari = x%10;
    x = x/10;
    sum += amari;
    
    if (x==0){
      break;
    }
  }
  return sum;
}

int main(){
  int n, a, b;
  cin >> n >> a >> b;
  
  int result = 0;
  for (int i=1; i<=n; i++){
    int tmp = kakuketa(i);
    // cout << "i: " << i << " tmp: " << tmp << endl;
    if ((tmp>=a) && (tmp<=b)){
      result += i;
    }
  }
  
  cout << result << endl;
  
}

Measured memory_bytes: 256
n = int(input())
h = list(map(int, input().split()))
h = h[::-1]
for i in range(n-1):
    if h[i+1] - h[i] >= 1:
        h[i+1] -= 1
    else:
        pass
for i in range(n):
    if i == n-1:
        print('Yes')
    elif h[i] < h[i+1]:
        print('No')
        break
    else:
        pass


Measured memory_bytes: 14228
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
 
// #include <bits/stdc++.h>
#include <vector>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <iostream>
#include <random>
#include <queue>
#include <algorithm>
#include <climits>
#include <map>
#include <set>
#include <stack>
#include <sstream>
#include <cstring>
#include <deque>

 
using namespace std;

typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<pd> vpd;
typedef vector<cd> vcd;
typedef vector<string> vs;
typedef vector<vi> vvi;
typedef vector<vl> vvl;


#define FOR(i,a,b) for (int i=a; i<b; i++)
#define F0R(i,a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = b; i > a; i--)
#define F0Rd(i,a) for (int i = a; i > -1; i--)
 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define pob pop_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert
#define que queue
#define pa pair
#define ex(m,i) m.find(i)!=m.end()
#define nex(m,i) m.find(i)==m.end()


#define uniq(x) x.resize(unique(all(x))-x.begin())
 
// mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy
const double epsilon = 1e-12;
const int ds[4][2] = {
    {-1,0},
    {1,0},
    {0,-1},
    {0,1}
};
 

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

    // freopen("in.txt", "r", stdin);
    // freopen("out.txt", "w", stdout);
    
    int n; cin >> n;

    vl vc, orig;
    FOR(i,0,n){
        ll k; cin >> k; vc.pb(k);
        orig.pb(k);
        orig[i] %= MOD;
    }

    FOR(i,0,n){
        if(i) vc[i] = vc[i-1] + vc[i];
        vc[i] %= MOD;
    }

    ll ret = 0;
    FOR(i,0,n){
        ret += (vc[n-1]-vc[i] < 0 ?  vc[n-1]-vc[i]  + MOD: vc[n-1]-vc[i])*orig[i];
        ret %= MOD;
    }

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

    return 0;
}
 
// read the question correctly (ll vs int)
// template by bqi343

Measured memory_bytes: 6212
#include <iostream>

using namespace std;

int main()
{
    int a[9];
    int dig=0;
    int n;
    cin >> n;
    int t=n;
    while(n>0){
        dig++;
        a[dig]=n%10;
        n=n/10;
    }
    int sum=0;
    for(int i=1;i<=dig;i++){
        sum+=a[i];
    }
    if(t%sum==0){
        cout << "Yes";
    }else{
    cout << "No";}


    return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
    public static void main(String args[]) {
       Scanner sc=new Scanner(System.in);
       int n=sc.nextInt();
       int k=sc.nextInt();
       int a[]=new int[n];
       for(int i=0;i<n;i++)
       a[i]=sc.nextInt();
       boolean[] win = new boolean[k + 1];
        for (int i = 1; i <= k; i++) {
         for (int x : a) {
            win[i] |= x <= i && !win[i - x];
            }
        }
    System.out.println(win[k] ? "First" : "Second");
    }
}

Measured memory_bytes: 22228
n, a, b = map(int, input().split())
if n == 1:
    if a == b:
        print(1)
        exit()
    else:
        print(0)
        exit()

if a <= b:
    print((b*(n-1)+a) - (a*(n-1)+b) + 1)
else:
    print(0)


Measured memory_bytes: 2940
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <array>
#include <queue>
#include <deque>
#include <set>
#include <list>
#include <map>
#include <stack>
#include <utility>
#include <algorithm>
#include <numeric>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <climits>
#include <bitset>
#include <random>
#include <functional>
#include <sstream>
#include <iomanip>

using namespace std;

#define _CRT_SECURE_NO_WARNINGS
#define rep(i, n) for(int i=0; i<(n); i++)
#define FOR(i, m, n) for(int i=(m);i<(n);i++)
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()
#define SORT(x) sort((x).begin(),(x).end())
#define REVE(x) reverse((x).begin(),(x).end())
#define MP make_pair
#define PB push_back

typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
typedef long long LL;

int main() {
	int r, c;
	cin >> r >> c;
	vector<VI> a(109, VI(109));
	rep(i, r) {
		rep(j, c) {
			cin >> a[i][j];
		}
	}

	rep(i, r) {
		int sum = accumulate(ALL(a[i]), 0);
		a[i][c] = sum;
	}
	rep(i, c) {
		int sum = 0;
		rep(j, r) {
			sum += a[j][i];
		}
		a[r][i] = sum;
	}
	a[r][c] = accumulate(ALL(a[r]), 0);
	rep(i, r + 1) {
		rep(j, c + 1) {
			cout << a[i][j];
			if (j != c)cout << " ";
		}
		puts("");
	}
}


Measured memory_bytes: 3172
//#include <bits/stdc++.h>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <iomanip>
#include <iostream>
#include <vector>    
#include <cstdlib>
#include <set>
#define fast_io()                \
    ios::sync_with_stdio(false); \
    std::cin.tie(0);
#define mod 998244353
typedef long long ll;
typedef long double ld;
using namespace std;
bool is(string s,int a,int b)
{
    for (int i = a-1; i < (b-a)/2-1; i++)
        if(s[i]!=s[b-i-1])
            return false;
    return true;
}
int main()
{
    fast_io();
    string s;
    cin >> s;
    bool flag = true;
    for(int i = 0,j=s.length()-1; i < j;i++,j--)
        if(s[i]!=s[j])
        {
            flag = false;
            break;
        }
    for(int i = 0,j=(s.length()-1)/2-1; i < j;i++,j--)
        if(s[i]!=s[j])
        {
            flag = false;
            break;
        }
    for(int i = (s.length()+3)/2-1,j=s.length()-1; i < j;i++,j--)
        if(s[i]!=s[j])
        {
            flag = false;
            break;
        }
    if(flag)
        cout << "Yes";
    else
        cout << "No";
            return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int i64;
i64  mod= 1000000007;
void inline solve(int tt){

    i64 n;
    cin>>n;
    for(int i=1;i<=9;i++)
    {
        if((n%i)==0)
        {
            int q=n/i;
            if(q>=1 and q<=9)
            {
                cout<<"Yes"<<endl;
                return;
            }
        }
    }
    cout<<"No"<<endl;

}
int main()
{
    int tt=0,t=1;
    //cin>>t;

    while(t--){solve(++tt);}
}



Measured memory_bytes: 3636
#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

void print() {
    cout << endl;
}

// template <class Head, class... Tail>
// void print(Head&& head, Tail&&... tail) {
//     cout << head;
//     if (sizeof...(tail) != 0) cout << " ";
//     print(forward<Tail>(tail)...);
// }

template <class T>
void print(vector<T> &vec) {
    for (auto& a : vec) {
        cout << a;
        if (&a != &vec.back()) cout << " ";
    }
    cout << endl;
}

template <class T>
void print(vector<T> &vec, ll k){
   ll n = vec.size();
   k = min(k, n);
   rep(i,k-1)cout << vec[i] << " ";
   cout << vec[k-1] << endl;
}

template <class T>
void print(vector<vector<T>> &df) {
    for (auto& vec : df) {
        print(vec);
    }
}

template<class T, class U>
void print(pair<T,U> &p){
    cout << p.first << " " << p.second << "\n";
}

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll n,k; cin >> n >> k;
    vector<ll> a(n);
    rep(i,n) {
        cin >> a[i];
        a[i]--;
    }
    ll LOG = 64;
    vvl table(LOG, vl(n));
    rep(i,n)table[0][i] = a[i];
    rep(j,LOG-1){
        rep(i,n){
            table[j+1][i] = table[j][table[j][i]];
        }
    }
    ll id = 0;
    rrep(i,LOG){
        if((k >> i) & 1){
            id = table[i][id];
        }
    }

    cout << id + 1 << endl;
}


Measured memory_bytes: 106436
#include<bits/stdc++.h>
#define mp make_pair
#define ff first
#define ss second
#define pb push_back
#define w(x) scanf("%d",&x);while(x--)
#define rep(i,a,b) for(i=a;i<=b;i++)
#define ios ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pi 2*acos(0.0)
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
typedef vector<int> vi;

long long int mod=1e9+9;
const int N=100000;
int t,i,j,cs=0,n,a,b;
string s;

int main()
{
    cin>>s;
    n=s.size();
    int ans[n+1]={};
    for(i=0;i<n;i++){
        if(s[i]=='A' || s[i]=='C' || s[i]=='T' || s[i]=='G'){
            ans[i+1]=ans[i]+1;
        }
        else
            ans[i+1]=0;
    }
    cout<<*max_element(ans,ans+n+1)<<endl;
}




Measured memory_bytes: 256
#include <vector>
#include <iostream>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <queue>
#include <tuple>
#include <queue>
#include <functional>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#include <complex>
#include <iterator>
#include <array>
#include <memory>
#include <stack>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
#define MAX 9999999
using namespace std;
typedef pair<int, int> pii;
typedef pair<double,double>pdd;
typedef pair<ll,ll>pll;
int main(){
    string s; cin>>s;
    rep(i,s.size())if(i==0||i%2==0)cout<<s[i];
    cout<<endl;
}

Measured memory_bytes: 512
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int[] x = new int[n];
        int sum = 0;
        for (int i = 0; i < n; i++) {
            int temp = Integer.parseInt(sc.next());
            x[i] = temp;
            sum += temp;
        }
        int ans = 0;
        int ans2 = 0;
        for (int i = 0; i < n; i++) {
            ans += Math.pow(x[i] - (int)Math.ceil(sum * 1.0 / n), 2);
            ans2 += Math.pow(x[i] - (int)Math.floor(sum * 1.0 / n), 2);
        }
        System.out.println(Math.min(ans, ans2));
    }
}

Measured memory_bytes: 23252
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)n; i++)
using ll = long long;
double pi = acos(-1);

int main(){
  double r;
  cin >> r;
  printf("%.9lf\n",2.0*r*pi);
  return 0;
}


Measured memory_bytes: 3784
def count_b(n):
    return 2 ** (n + 2) - 3

def count_p(n):
    return 2 ** (n + 1) - 1

def solve(n, x):
    if x <= 0:
        return 0
    if n == 0:
        return 1
    b = count_b(n-1)
    if x < (b + 1):
        return solve(n-1, x-1)
    return count_p(n-1) + (1 if x >= (b + 2) else 0) + solve(n-1, x-b-2)

def main():
    n, x = list(map(int, input().split()))
    print(solve(n, x))

if __name__ == "__main__":
    main()


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string N;
	cin >> N;
	for(int i = 0; i < 3; i++)
	{
		if(N[i] == '7')
		{
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
	return 0;
}

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

int main(){
  int n,k;
  cin>>n>>k;
  k=min(k,50);
  int a[n],dif[n];
  for(int i=0;i<n;i++)cin>>a[i];
  for(int j=0;j<k;j++){
    for(int i=0;i<n;i++)dif[i]=0;
    for(int i=0;i<n;i++){
      dif[max(0,i-a[i])]++;
      if(min(n-1,i+a[i])+1<n)dif[min(n-1,i+a[i])+1]--;
    }
    for(int i=0;i<n;i++)a[i]=0;
    for(int i=0;i<n;i++)a[i]=(i>0?a[i-1]:0)+dif[i];
  }
  for(int i=0;i<n;i++)cout<<a[i]<<endl;
}


Measured memory_bytes: 5184
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
LL read(){
	LL x=0,f=1;
	char ch=getchar();
	while (!isdigit(ch)&&ch!='-')
		ch=getchar();
	if (ch=='-')
		f=-1,ch=getchar();
	while (isdigit(ch))
		x=(x<<1)+(x<<3)+(ch^48),ch=getchar();
	return x*f;
}
const int N=100005;
int n,A[N],in[N];
vector <int> e[N];
vector <LL> v[N];
LL solve(int x,int pre){
	vector <LL> &a=v[x];
	for (auto y : e[x])
		if (y!=pre)
			a.push_back(solve(y,x));
	if (a.empty())
		return A[x];
	sort(a.begin(),a.end());
	if (!~*a.begin())
		return -1;
	reverse(a.begin(),a.end());
	LL tot=0;
	for (auto y : a)
		tot+=y;
	LL mx=min((LL)A[x],min(tot/2,tot-*a.begin()));
	LL Need=tot-A[x];
	return Need>mx||Need<0?-1:(A[x]-Need);
}
int main(){
	n=read();
	for (int i=1;i<=n;i++)
		A[i]=read();
	for (int i=1;i<=n;i++)
		e[i].clear();
	for (int i=1;i<n;i++){
		int a=read(),b=read();
		e[a].push_back(b);
		e[b].push_back(a);
		in[a]++,in[b]++;
	}
	if (n==2)
		return puts(A[1]==A[2]?"YES":"NO"),0;
	int rt=0;
	for (int i=1;!rt&&i<=n;i++)
		if (in[i]>1)
			rt=i;
	puts(solve(rt,0)==0?"YES":"NO");
	return 0;
}

Measured memory_bytes: 19968
import sys
input = sys.stdin.readline

d = int(input())
C = list(map(int,input().split()))
S = [list(map(int,input().split())) for i in range(d)]
# T = [int(input()) for i in range(d)]
c = 26
# m = int(input())
# Q = [list(map(int,input().split())) for i in range(m)]

ans = 0
L = [[-1] * c for i in range(d)]
T = [-1] * d  # この中には0-25を入れる
K = [[] for i in range(d)]  # この中は0-indexed
pp = 4

for i in range(d):
    ANS = [0] * c
    L[i] = L[i-1][:]
    for k in range(c):
        ANS[k] = S[i][k] + C[k] * (i - L[i][k])
    ANSS = [[ANS[j], j] for j in range(c)]
    ANSS.sort(reverse=True)
    for j in range(pp):
        # if j > 0 and ANSS[j][0] < 0:
        #     break
        K[i].append(ANSS[j][1])
    ind = ANSS[0][1]
    ans += S[i][ind]
    L[i][ind] = i
    for j in range(c):
        ans -= C[j] * (i - L[i][j])
    # print(ans)
    # print(ind + 1)
    T[i] = ind

fans = ans
# print("fans",fans)
# print(L)
# print(T)



# cp = 3
# dp = 3

# CC = [[C[i], i] for i in range(c)]
# CC.sort(reverse=True)
# for i in range(d):
#     for k in range(cp):
#         K[i].append(CC[k][1])

# for i in range(d):
#     DD = [[S[i][j], j] for j in range(c)]
#     DD.sort(reverse=True)
#     for k in range(dp):
#         K[i].append(DD[k][1])

# print("K",K)
    
from random import randint

m = 10*10**5

# Q = [[0] * 2 for i in range(m)]
# for i in range(m):
#     dd = randint(0, d-1)
#     # print("dd",dd)
#     # print(dd-1,randint(0, len(K[dd-1])-1))
#     q = K[dd][randint(0, len(K[dd])-1)]
#     Q[i][0] = dd
#     Q[i][1] = q

# print(Q)

ndd = -1
nq = -1

for i in range(m):
    # print(*T)
    # print(Q)
    dd = ndd if ndd != -1 else randint(0, d-1)
    q = nq if nq != -1 else K[dd][randint(0, len(K[dd])-1)]
    nans = ans
    # print("dd",dd)
    nans -= S[dd][T[dd]]
    nans += S[dd][q]
    for j in range(dd, d):
        # print("j",j)
        if T[j] == q:
            # print("break")
            break
        nans += C[q] * (j - L[j][q])
        nans -= C[q] * (j - dd)
        L[j][q] = dd
    
    old = T[dd]
    T[dd] = q

    for j in range(dd, d):
        # print("j",j)
        if T[j] == old:
            # print("break")
            break
        oldl = L[j-1][old] if j > 0 else -1
        nans += C[old] * (j - dd)
        nans -= C[old] * (j - oldl)
        L[j][old] = oldl

    # print(nans, ans)

    if nans < ans:
        if i != m-1:
            ndd = dd
            nq = old
        else:
            T[dd] = old
    else:
        ndd = -1
        nq = -1
    
    ans = nans

# print(max(ans,fans))
for i in T:
    print(i+1)


Measured memory_bytes: 82980
# -*- coding: utf-8 -*-
import sys
N,K,C=map(int, sys.stdin.readline().split())
S=sys.stdin.readline().strip()

#左から
L=[]
over=-1
L_cnt=0
for i,x in enumerate(S):
    if x=="o" and over<i:
        L.append(i)
        L_cnt+=1
        if L_cnt==K: break
        over=i+C

#右から
R=[]
over=-1
R_cnt=0
for i,x in enumerate(S[::-1]):
    if x=="o" and over<i:
        R.append(N-1-i)
        R_cnt+=1
        if R_cnt==K: break
        over=i+C

L.sort()
R.sort()

for x,y in zip(L,R):
    if x==y:
        print x+1

Measured memory_bytes: 56060
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{

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

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

	ll n, m, x, mn = INT_MAX;
	cin >> n >> m >> x;
	ll a[n];
	ll b[n][m];
	for (ll i = 0; i < n; i++)
	{
		cin >> a[i];
		for (ll j = 0; j < m; j++)
			cin >> b[i][j];
	}
	for (ll i = 0; i < pow(2, n); i++)
	{
		ll z[m ] = {0}, cst = 0, f = 0;
		for (ll j = 0; j <  n; j++)
		{
			if (i & (1 << j))
			{
				cst += a[j ];
				for (ll k = 0; k < m; k++)
				{

					z[k] += b[j][k];
				}
			}
		}
		for (ll k = 0; k < m; k++)
		{
			if (z[k] < x)
			{
				f = 1;
				break;
			}

		}
		if (!f)
			mn = min(mn, cst);
	}
	if (mn == INT_MAX)
		mn = -1;
	cout << mn << endl;


}


Measured memory_bytes: 4108
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#define vll vector<ll>
#define vvvl vector<vvl>
#define vvl vector<vector<ll>>
#define VV(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define VVV(a, b, c, d) vector<vvl>(a, vvl(b, vll (c, d)));
#define re(c, b) for(ll c=0;c<b;c++)
#define all(obj) (obj).begin(), (obj).end()
typedef long long int ll;
typedef long double ld;
using namespace std;

void err(){
  std::cout << -1 << '\n';
  exit(0);
}


int main(int argc, char const *argv[]) {
  ll n;std::cin >> n;
  vll a(n+1, 0);
  vll b(n+1, 0);
  re(i, n+1) scanf("%lld", &a[i]);
  for(int i=n;i>=0;i--) b[i] = (i==n?0:b[i+1]) + a[i];
  ll num = 1, ans = 1;
  if(n==0){
    std::cout << (a[0]==1?1:-1) << '\n';
    return 0;
  }

  for(int i=0;i<n;i++){
    //捻出できなければダメ
    if(num<a[i]) err();
    num -= a[i];
    if(i!=n-1&&num==0) err();

    //最小num, 最大2*num
    if(b[i+1]<num) err();
    else if(num*2 <= b[i+1]) ans += 2*num, num*=2;
    else ans += b[i+1], num = b[i+1];

    if(i==n-1&&num!=a[n]) err();
  }
  std::cout << ans << '\n';
  return 0;
}


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

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

 
typedef pair<int,int> P;
typedef long long ll;
 
const int INF = 1001001001;
const int MOD = 1000000007;
const double PI=acos(-1);
//----------------------------------------------------------------

vector<pair<long long, long long> > prime_factorize(long long n) {
    vector<pair<long long, long long> > res;
    for (long long p = 2; p * p <= n; ++p) {
        if (n % p != 0) continue;
        int num = 0;
        while (n % p == 0) { ++num; n /= p; }
        res.push_back(make_pair(p, num));
    }
    if (n != 1) res.push_back(make_pair(n, 1));
    return res;
}

int main(){
    int N;
    cin >> N;
    map<int, int> M;
    rep(i,N) {
        auto F = prime_factorize(i+1);
        for (int j=0; j<F.size(); j++) {
            M[F[j].first] += F[j].second;
        }
    }
    
    int ans = 0;
    int num[5] = {75,25,15,5,3};
    int s[5] = {};
    for (auto m:M) {
        rep(i,5) {
            if (m.second+1>=num[i]) s[i]++;
        }
    }
    
    ans += s[0];
    ans += s[1]*(s[4]-1);
    ans += s[2]*(s[3]-1);
    ans += s[3]*(s[3]-1)/2*(s[4]-2);

    cout << ans << endl;


}


Measured memory_bytes: 3556
#include <bits/stdc++.h> 
#define FOR(i,a,b) for(int i=(a);i<=(b);++i) 
#define RFOR(i,a,b) for(int i=(a);i>=(b);--i) 
#define REP(i,n) for(int i=0;i<(n);++i)
#define RREP(i,n) for(int i=(n);i>0;--i)
#define CI cin>> 
#define CO cout<<
#define EN <<endl 
#define all(x) (x).begin(),(x).end()
using namespace std;
template <typename T> istream& operator >> (istream& is, vector<T>& vec) { for (T& x : vec) is >> x; 	return is; }
using ll = long long;
using VI = vector<int>;

int main() {
	int n; CI n;
	VI line(n); CI line;
	sort(all(line));

	int ans = 0;
	REP(i, n - 1) {
		ans += line[i];
	}
	if (ans > line[n - 1]) CO "Yes" EN;
	else CO "No" EN;

	return 0;
}

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

int main() {
    int K;
    string s; cin >> K >> s;
    vector<char> a(s.size());
    for (int i = 0; i < s.size(); i++) {
        a.at(i) = s.at(i);
    }
    if (s.size() <= K) cout << s << endl;
    else {
        for (int i = 0; i < K; i++) {
            cout << a.at(i);
        }
        cout << "..." << endl;
    }
}


Measured memory_bytes: 3632
import java.math.BigDecimal;
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		while(scan.hasNext()){
			int n = scan.nextInt();
					
			int a;
			int b;
			int c;
			int d;
			int count=0;
			
			for(int i=9;i>=0;i--){
				a = i;
				for(int j=9;j>=0;j--){
					b = j;
					for(int k=9;k>=0;k--){
						c = k;
						for(int l=9;l>=0;l--){
							d = l;
							if(a+b+c+d==n && a <10 && b <10 && c <10 && d <10){
								count++;
							}
						}
					}
				}
			}
			System.out.println(count);
		}
	}
}

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


int main(){
    string s; cin >> s;
    for(int i=0;i<2;i++){
        if(s[i]!=s[i+1]){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
}

Measured memory_bytes: 256
read B
B=${B#0}
B=${B#0}
B=${B#0}
B=${B#0}
A=$[B/100]
B=$[B%100]
if [ $A -gt 0 -a $A -lt 13 ];then
	if [ $B -gt 0 -a $B -lt 13 ];then
		echo AMBIGUOUS
	else
		echo MMYY
	fi
else
	if [ $B -gt 0 -a $B -lt 13 ];then
		echo YYMM
	else
		echo NA
	fi
fi


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

using namespace std;

#define rep(i, n) for(int i=0 ;i<(n); ++i)
#define mp(a, b) make_pair(a, b)
const int dx[] = {1, 0, 0, -1}, dy[] = {0, 1, -1, 0};

class dice{ //top, face, right, left, back, bottom
    vector<int> side;
public:
    dice():side({1, 2, 3, 4, 5, 6}){}
    dice(int t, int f){
        dice d;
        for(int i=0; i<6; (i&1? d.yroll(): d.xroll()), ++i){
            for(int j=0; j<4; d.zroll(), ++j){
                if(d[0] == t && d[1] == f){
                    *this = d;
                    return;
                }
            }
        }
    }
    int operator[](size_t pos)const{
        return side[pos];
    }
    void xroll(int k = 1){
        for(k%=4; k--; )roll(0, 4, 5, 1);
    }
    void yroll(int k = 1){
        for(k%=4; k--; )roll(0, 3, 5, 2);
    }
    void zroll(int k = 1){
        for(k%=4; k--; )roll(1, 3, 4, 2);
    }
private:
    void roll(int a, int b, int c, int d){
        swap(side[a], side[b]);
        swap(side[b], side[c]);
        swap(side[c], side[d]);
    }
};

map<pair<int, int>, pair<int, int> > plane;

void fall(dice d){
    int x = 0, y = 0;
    for(;;){
        int dir = -1;
        rep(k, 4){
            if(d[k+1] < 4 || plane[mp(x, y)].first <= plane[mp(x+dx[k], y+dy[k])].first)continue;
            if(dir < 0 || d[dir+1] < d[k+1])dir = k;
        }
        if(dir < 0){
            plane[mp(x, y)] = mp(plane[mp(x, y)].first + 1, d[0]);
            break;
        }
        if(dir == 0)d.xroll(1);
        if(dir == 1)d.yroll(1);
        if(dir == 2)d.yroll(3);
        if(dir == 3)d.xroll(3);
        x += dx[dir]; y += dy[dir];
    }
}

int main(){
    int n;
    while(cin >> n, n){
        plane.clear();
        while(n--){
            int t, f;
            cin >> t >> f;
            fall(dice(t, f));
        }
        vector<int> cnt(6);
        for(auto v: plane)if(v.second.first)cnt[v.second.second - 1]++;
        rep(i, 6)cout << cnt[i] << (i != 5? ' ': '\n');
    }
    return 0;
}

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

int main()
{
    int N;
    cin >> N;
    int A[N];
    for (int i = 1; i < N; i++)
    {
        cin >> A[i];
    }
    int ans[N];
    for (int i = 0; i < N; i++)
    {
        ans[i] = 0;
    }
    for (int i = 1; i < N; i++)
    {
        ans[A[i]-1]++;
    }
    for (int i = 0; i < N; i++)
    {
        cout << ans[i] << endl;
    }
    
}


Measured memory_bytes: 5196
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <complex>
#include <string>
#include <algorithm>
#include <numeric>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#ifndef LOCAL
#define debug(x) ;
#else
#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;

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

template <typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  out << '{';
  for (const T &item : v) out << item << ", ";
  out << "\b\b}";
  return out;
}
#endif

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 200010

/* UnionFind */

struct UnionFind{
  vector<int> data;
  vector<ll> sum, sum2, sum3;

  UnionFind(int s):data(s, -1), sum(s, 0), sum2(s), sum3(s) {}

  int root(int x){
    if(data[x] < 0) return x;
    return data[x] = root(data[x]);
  }

  bool set(int x, int y){
    x = root(x); y = root(y);
    if(x == y) return false;
    data[x] += data[y];
    sum[x] += sum[y];
    sum2[x] += sum2[y];
    sum3[x] += sum3[y];

    data[y] = x;
    sum[y] = sum2[y] = 0;
    return true;
  }

  bool check(int x, int y){
    return root(x) == root(y);
  }

  int size(int x){
    return -data[root(x)];
  }
};



int main(){
  int n, m;
  int x[SIZE];
  vector<pair<int,pair<int,int> > > vec;

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

  UnionFind uf(n);

  for(int i=0;i<n;i++){
    scanf("%d", x+i);
    uf.sum[i] = x[i];
  }

  for(int i=0;i<m;i++){
    int a, b, y;
    scanf("%d%d%d", &a, &b, &y);
    vec.push_back({y, {a-1, b-1}});
  }

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

  int ans = 0;

  for(int i=0;i<m;i++){
    int a = vec[i].second.first;
    int b = vec[i].second.second;
    int y = vec[i].first;

    uf.set(a, b);

    int r = uf.root(a);

    uf.sum3[r]++;

    if(uf.sum[r] >= y){
      ans += uf.sum3[r] - uf.sum2[r];
      uf.sum2[r] = uf.sum3[r];
    }

  }

  cout << m - ans << endl;


  return 0;
}


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

int main(){
  
  int n;
  cin >> n;
  vector<int> a(n);
  for(int i=0;i<n;i++){
    cin >> a.at(i);
  }
  sort(a.begin(),a.end());
  cout << a.at(n-1)-a.at(0) << endl;
}

Measured memory_bytes: 256
/*input
30 413
-170202098 -268409015 537203564 983211703 21608710 -443999067 -937727165 -97596546 -372334013 398994917 -972141167 798607104 -949068442 -959948616 37909651 0 886627544 -20098238 0 -948955241 0 -214720580 277222296 -18897162 834475626 0 -425610555 110117526 663621752 0
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef tree<long long, null_type, less_equal<long long>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
#pragma GCC optimize("unroll-loops,no-stack-protector")
//order_of_key #of elements less than x
// find_by_order kth element
typedef long long int ll;
#define ld double
#define pii pair<ll,ll>
#define f first
#define s second
#define pb push_back
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define FILL(n,x) memset(n,x,sizeof(n))
#define ALL(_a) _a.begin(),_a.end()
#define sz(x) (int)x.size()
const ll maxn=4e5+5;
const ll maxlg=__lg(maxn)+2;
const ll INF64=4e18;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const ld PI=acos(-1);
const ld eps=1e-9;
#define lowb(x) x&(-x)
#define MNTO(x,y) x=min(x,(__typeof__(x))y)
#define MXTO(x,y) x=max(x,(__typeof__(x))y)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
ll mult(ll a,ll b){
    return (a*b)%MOD;
}
ll mypow(ll a,ll b){
    if(b<=0) return 1;
    ll res=1LL;
    while(b){
        if(b&1) res=mult(res,a);
        a=mult(a,a);
        b>>=1;
    }
    return res;
}
#define int ll
ll arr[maxn];
int n;
ll cnt(ll x){
    ll ans=0;
    REP(i,n){
        if(i==n-1) continue;
        if(arr[i]<0){
            int l=i+1,r=n-1;
            while(l<r){
                int mid=(l+r)/2;
                if(arr[i]*arr[mid]<x){
                    r=mid;
                }
                else{
                    l=mid+1;
                }
            }
            //cout<<l<<' ';
            if(arr[i]*arr[l]<x) ans+=n-l;

        }
        else if(arr[i]==0){
            if(x>0) ans+=n-i-1;
        }
        else{
            int l=i+1,r=n-1;
            while(l<r){
                int mid=(l+r+1)/2;
                if(arr[i]*arr[mid]<x){
                    l=mid;
                }
                else{
                    r=mid-1;
                }
            }
            //cout<<r<<' ';
            if(arr[i]*arr[r]<x) ans+=r-i;
        }
        //cout<<ans<<' ';
    }
    return ans;
}
ll cnt2(ll x){
    ll ans=0;
    REP(i,n){
        REP(j,i){
            if(arr[i]*arr[j]<x){
                ++ans;
            }
        }
    }
    return ans;
}
int32_t main(){
    ios::sync_with_stdio(false),cin.tie(0);
    ll k;
    cin>>n>>k;
    --k;
    REP(i,n) cin>>arr[i];
    sort(arr,arr+n);
    ll l=-INF64,r=INF64;
    //cout<<cnt(7)<<' '<<cnt(6)<<'\n';
    
    while(l<r){
        int mid=(l+r+1)/2;
        if(cnt(mid)<=k){
            l=mid;
        }
        else{
            r=mid-1;
        }
    }
    cout<<l;
}

Measured memory_bytes: 1792
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
const int INF = (int)1e9 + 7;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main() {
    int n; cin >> n;
    vector<int> dp(n + 1, INF);
    dp[0] = 0;
    for (int i = 1; i <= n; i++) {
        for (int pow6 = 1; pow6 <= i; pow6 *= 6) {
            chmin(dp[i], dp[i - pow6] + 1);
        }
        for (int pow9 = 1; pow9 <= i; pow9 *= 9) {
            chmin(dp[i], dp[i - pow9] + 1);
        }
    }
    cout << dp[n] << endl;
    return 0;
}

Measured memory_bytes: 640
import math
import itertools
n = range(1,int(input())+1)
ppp = list(itertools.combinations(n, 3))
pp = list(itertools.combinations(n, 2))
asum,bsum,csum = 0,0,0
for p in ppp:
  asum+=math.gcd(math.gcd(p[0],p[1]),p[2])

for p in pp:
  bsum+=math.gcd(p[0],p[1])

for p in n:
  csum+=p

print(asum*6+bsum*6+csum)

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

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define LCM(a, b) (a) / __gcd((a), (b)) * (b)
#define CEIL(a, b) (a)/(b)+(((a)%(b))?1:0)
#define log_2(a) (log((a)) / log(2))
#define ln '\n'

using namespace std;
using LL = long long;
using ldouble = long double;
using P = pair<int, int>;
using LP = pair<LL, LL>;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1e9 + 7;
static const int SIZE = 200005;

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

vector<LL> Div(LL n) {
    vector<LL> ret;
    for(LL i = 1; i * i <= n; ++i) {
        if(n % i == 0) {
            ret.pb(i);
            if(i * i != n) ret.pb(n / i);
        }
    }
    sort(all(ret));
    return ret;
}

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

    int N;
    cin >> N;
    int c = 0;
    for(int i = 1; i <= N; ++i) {
        for(int j = 1; i * j < N; ++j) {
            ++c;
        }
    }
    cout << c << endl;
    return 0;
}



Measured memory_bytes: 3656
#include"bits/stdc++.h"
using namespace std;

typedef long long ll;
#define FOR(i, a, n) for (ll i=(ll)a;i<(ll)n;i++)
#define REP(i, n) FOR(i, 0, n)

int main(){
    int n, m, c; cin >> n >> m >> c;
    vector<int> b; b.resize(m);
    vector<vector<int>> a; a.resize(n);

    REP(j, m){
        cin >> b[j];
    }
    REP(i, n){
        a[i].resize(m);
        REP(j, m){
            cin >> a[i][j];
        }
    }
    
    int ans = 0;
    REP(i, n){
        int y = c;
        REP(j, m){
            y += a[i][j]*b[j];
        }
        if (y>0){
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <stack>
#include <vector>
#include <stdio.h>
#include <utility>
#include <map>
#include <set>
using namespace std;

int n, m;
int a;
int b = 100000000;
int ans;


int main() {

	cin >> n >> m;

	for (int i = 0; i < m; i++) {
		int l, r;
		cin >> l >> r;
		if (a < l)a = l;
		if (b > r)b = r;
	}

	ans = b - a + 1;
	if (ans < 0) ans = 0;

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define LL long long
#define db double
using namespace std;
 
const int MAXN = 200200;
const int MAXE = 400400;
const int INF = 0x3f3f3f3f;
 
template<typename T> inline void CheckMax(T &A, T B) {
	A < B ? A = B : A;
}
 
template<typename T> inline void CheckMin(T &A, T B) {
	A > B ? A = B : A;
}
 
template <typename T> inline void read(T &x) {
    int c = getchar();
    bool f = false;
    for (x = 0; !isdigit(c); c = getchar()) {
        if (c == '-') {
            f = true;
        }
    }
    for (; isdigit(c); c = getchar()) {
        x = x * 10 + c - '0';
    }
    if (f) {
        x = -x;
    }
}
 
int n, k;
typedef pair<int, int> pii;
typedef pair<pii, int> ppi;
#define X first
#define Y second

int ans;
int h, w;
 
signed main() {
	read(n), read(h), read(w);
	for(int i = 1 ; i <= n; i++) {
		int a, b; read(a), read(b);
		if(h <= a && w <= b) ans++;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
a = []
s = 0
for _ in range(5):
    n = int(input())
    b, c = n // 10, n % 10

    s += b * 10
    if c != 0:
        a.append(c)

if not a:
    print(s)
else:
    print(s + 10 * (len(a) - 1) + min(a))


Measured memory_bytes: 2940
#include <algorithm>
#include <cassert>
#include <cfloat>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
 
#define FOR(i,k,n) for (int (i)=(k); (i)<(n); ++(i))
#define rep(i,n) FOR(i,0,n)
#define all(v) begin(v), end(v)
#define debug(x) cerr<< #x <<": "<<x<<endl
#define debug2(x,y) cerr<< #x <<": "<< x <<", "<< #y <<": "<< y <<endl
 
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<ll> vll;
typedef vector<vector<ll> > vvll;
typedef deque<bool> db;
template<class T> using vv=vector<vector< T > >;

// cout vector
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
  int len = v.size(); s << "\n";
  for (int i = 0; i < len; ++i) {
    s << v[i]; if (i < len - 1) s << "\t";
  }
  s << "\n"; return s;
}

int main() {
  int n;
  string s;
  cin >> n;
  cin >> s;
  vi cnt_e(n+1, 0);
  FOR (i, 1, n+1) {
    cnt_e[i] = cnt_e[i-1];
    if (s[i-1] == 'E') {
      cnt_e[i] += 1;
    }
  }
  int ans = 1000000;
  rep (i, n) {
    int cnt = 0;
    cnt += (i - cnt_e[i]);
    cnt += (cnt_e[n] - cnt_e[i+1]);
    ans = min(ans, cnt);
  }
  printf("%d\n", ans);

  return 0;
}


Measured memory_bytes: 1916
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <cmath>
#include <tuple>
#include <queue>
#include <bitset>
#include <set>
#include <map>
#include <list>


using ll = long long;
using ld = long double;
using namespace std;
const int INF = 1e9+100;
const ll INF64 = 7e18l;
const int mod = 1000000007;
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(a) (a).begin(), (a).end()
#define FIN ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);


int main(){
    FIN;
    string s; cin >> s;
    ll n = s.size();
    ll ans1=0,ans2=0;


    char last = '0';
    for(int i=1;i<n;i++){
        if(s[i] == last){
            ans1++;
            if(s[i] == '0') last = '1';
            else last = '0';
        }
        else last = s[i];
    }
    if(s[0] == '1') ans1++;

    last = '1';
    for(int i=1;i<n;i++){
        if(s[i] == last){
            ans2++;
            if(s[i] == '0') last = '1';
            else last = '0';
        }
        else last = s[i];
    }
    if(s[0] == '0') ans2++;




    cout << min(ans1,ans2) << endl;
    return 0;
}

Measured memory_bytes: 512
#include <iostream>

int main() {
	std::string str; std::cin >> str;
	const auto count = std::count(str.begin(), str.end(), 'A');
	if (count != 0 && count != 3) {
		std::cout << "Yes\n";
	}
	else {
		std::cout << "No\n";
	}
}

Measured memory_bytes: 256