akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<bits/stdc++.h>
#include<string>
#include<time.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define fi first    
#define se second
#define mod 1000000007
void solve()
{
    ll n;
    cin>>n;
    vector<ll> h(n);
    ll i,j,k;
    for(i=0;i<n;i++)
        cin>>h[i];
    ll dp[n];
    dp[n-1]=1;
    for(i=n-2;i>=0;i--)
    {
        if(h[i]>=h[i+1])
            dp[i]=dp[i+1]+1;
        else
            dp[i]=1;
    }
    ll ans=INT_MIN;
    for(i=0;i<n;i++)
        ans=max(ans,dp[i]);
    cout<<ans-1;
}
int main(){ 
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    // #ifndef ONLINE_JUDGE
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    // #endif  
    clock_t tStart = clock();
    ll t;
    // cin>>t;
    // while(t--)
       solve();
    // printf("\nTime taken: %.2fs\n", (double)(clock() - tStart)/CLOCKS_PER_SEC);
    return 0;
}       

Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <numeric>
#include <vector>
#include <queue>
#include <map>
typedef unsigned long long ull;
typedef long long ll;
#define __TRUE "Yes"
#define __FALSE "No"
#define cout(x) cout << (x) << endl
#define MAX 100000
using namespace std;

int main() {
  int i,n,m;
  cin >> n >> m;
  vector<vector<pair<int,int> > > A(n+1);
  for(i=0;i<m;i++) {
    int p,y;
    cin >> p >> y;
    A[p].push_back(make_pair(y,i));
  }
  vector<pair<int,int> > B(m);
  for(int p=1;p<=n;p++) {
    sort(A[p].begin(), A[p].end());
    for(int j=0;j<A[p].size();j++) {
      B[A[p][j].second] = make_pair(p, j+1);
    }
  }
  for(i=0;i<m;i++) {
    printf("%06d", B[i].first);
    printf("%06d\n",B[i].second);
  }
  return 0;
}

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

cnt = 0
for i in range(0, N):
    mini = i
    # search for the minimum element in A[i, i+1, ..., N-1]
    for j in range(i,N):
        if A[j] < A[mini]:
            mini = j
    # swap A[i] and A[mini]
    if i != mini:
        cnt += 1
        A[i], A[mini] = A[mini], A[i]
    
print( ' '.join(map(str, A) ) )
print(cnt)


Measured memory_bytes: 5600
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int max = 0;
        for (int i = 0; i < N; i++) {
            int temp = scanner.nextInt();

            int sum = 0;
            if (temp % 2 != 0) {
                break;
            }
            while (temp % 2 == 0) {
                temp /= 2;
                sum += 1;
            }
            if (max == 0 || sum < max) {
                max = sum;
            }
        }

        System.out.println(max);
    }
}


Measured memory_bytes: 23124
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class AtCoderA
{
    static void Main()
    {
        var sc = new Scanner();

        long n = sc.NextLong();
        long k = sc.NextInt();

        long answer = 0;

        if (k == 0)
        {
            Console.WriteLine(n * n);
            return;
        }

        for (long i = k + 1; i <= n; i++)
        {
            long tmpAnswer = (n / i) * (i - k);
            tmpAnswer += Math.Max(0, n % i - k + 1);
            answer += tmpAnswer;
        }

        Console.WriteLine(answer);
    }

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}


Measured memory_bytes: 27496
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Math;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            A();
        }

        static void A()
        {
            var N = Read().Select(x => x.ToString()).ToArray();
            for (int i = N.Length-1; i > 0; i--)
            {
                if (N[i] != "9")
                {
                    N[i] = "9";
                    N[i - 1] = $"{int.Parse(N[i - 1]) - 1}";
                }
            }

            Println(N.Where(x => x != "0").Sum(x => int.Parse(x)));
        }

        static List<long> ReadLines(long n)
        {
            var l = new List<long>();
            for (long i = 0; i < n; i++)
            {
                l.Add(ReadLong());
            }
            return l;
        }

        static void YESOrNO(bool e) => Println(e ? "YES" : "NO");

        static void YesOrNo(bool e) => Println(e ? "Yes" : "No");

        static IEnumerable<int> Range(int start, int stop)
        {
            if (start < 0 || stop < 0 || start > stop || (start <= 0 && stop <= 0))
                return new List<int>();

            return Enumerable.Range(start, stop - start);
        }

        static bool IsDigit(string str)
        {
            var i = 0;
            return int.TryParse(str, out i);
        }

        static int SumDigits(long num)
        {
            return num.ToString().Select(x => x.ToString()).Sum(int.Parse);
        }

        static int[] ToIntArray(string str)
        {
            return str.Select(x => x.ToString()).Select(int.Parse).ToArray();
        }

        static long Gcd(long a, long b) => b == 0 ? a : Gcd(b, a % b);
        static long Lcm(long a, long b) => a / Gcd(a, b) * b;

        static bool IsPrime(int x)
        {
            if (x <= 1 || (x != 2 && x % 2 == 0)) return false;
            if (x == 2) return true;

            for (int i = 3; i < x; i += 2)
                if (x % i == 0) return false;

            return true;
        }

        static string Read() => Console.ReadLine();
        static int ReadInt() => int.Parse(Read());
        static long ReadLong() => long.Parse(Read());

        static List<string> ReadSplit() => Read().Split().ToList();
        static List<int> ReadSplitInt() => Read().Split().Select(int.Parse).ToList();
        static List<long> ReadSplitLong() => Read().Split().Select(long.Parse).ToList();

        static void Print(object value) => Console.Write(value.ToString());
        static void Println(object value) => Console.WriteLine(value.ToString());
        static string Join<T>(IEnumerable<T> list) => string.Join("", list);
    }

    public static class MyExtensions
    {
        public static string Slice(this string str, int start = 0, int stop = 0)
        {
            if (start > str.Length || stop > str.Length || start < 0 || stop < 0)
                return "";

            if (stop == 0) stop = str.Length;
            return str.Substring(start, stop - start);
        }
    }
}

Measured memory_bytes: 13396
IDENTIFICATION DIVISION.
PROGRAM-ID. 170A.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 INP        PIC X(10).
01 TBL.
   03 X       PIC 9(1) OCCURS 5.
01 I          PIC 9(1).
*>
PROCEDURE DIVISION.
  ACCEPT INP.
  UNSTRING INP DELIMITED BY ' '
      INTO X(1) X(2) X(3) X(4) X(5).
*>
  PERFORM VARYING I FROM 1 BY 1 UNTIL X(I) = 0
  END-PERFORM.
*>
  DISPLAY I.
  STOP RUN.


Measured memory_bytes: 3792
#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;
#define ll long long int
#define pii 3.14
#define mod (ll)(1e9 + 7)
#define inf (ll)(1e18)
#define fio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ordered_set tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update>
#define pi pair<int,int>
#define N (ll)(2e5+5)

void solve()
{
    string s,t;
    cin>>s>>t;

    if(s.size() + 1 == t.size() && t.substr(0,s.size()) == s)
        cout<<"Yes\n";
    else
        cout<<"No\n";
}

int main()
{
    fio;
    ll tc = 1;
    //cin>>tc;

    while(tc--)
    {
        solve();
    }
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << endl;
#define CFYN(n) cout << ( (n) ? "YES":"NO") << endl;
#define OUT(n) cout << (n) << endl;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;

int main(void)
{
    IOS
    int n; cin >> n;
    vector<vector<int>> v(n,vector<int>(3));
    REP(i,n) REP(j,3) cin >> v[i][j];

    vector<int> ans(n);
    REP(i,n-1) REP(j,i+1) {
        if (ans[j] <= v[i][1]) ans[j] = v[i][1] + v[i][0];
        else {
            ans[j] = (ans[j]+v[i][2]-1) / v[i][2] * v[i][2] + v[i][0];
        }
    }

    REP(i,n) OUT(ans[i])

    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
template <class T>
using ordered_set = __gnu_pbds::tree<T, __gnu_pbds::null_type, less<T>, __gnu_pbds::rb_tree_tag, __gnu_pbds::tree_order_statistics_node_update>;
template <class T>
using ordered_multiset = __gnu_pbds::tree<T, __gnu_pbds::null_type, less_equal<T>, __gnu_pbds::rb_tree_tag, __gnu_pbds::tree_order_statistics_node_update>;

#define PI atan2(0, -1)
#define EPS 1e-9
#define INF 5e18
#define MOD 1000000007

#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound

int kase, N;

int main(){
    //freopen("sort.in", "r", stdin); freopen("sort.out", "w", stdout);
    ios_base::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(10);
    cin >> kase;
    for(int kk = 1; kk <= kase; kk++){
        cin >> N;
        long long ret = 0; set<int> pos;
        vector<pair<pair<long long, long long>, pair<long long, long long>>> wantFront, wantBack;
        int freelo = 0;
        for(int i = 0; i < N; i++){
            int K, L, R; cin >> K >> L >> R;
            pos.insert(-(i+1));
            if(L-R > 0){
                wantFront.pb(mp(mp(R-L, K), mp(L, R)));
            }
            else if(R-L > 0){
                wantBack.pb(mp(mp(L-R, K), mp(L, R)));
            }
            else{
                ret += L;
                freelo++;
            }
        }
        sort(wantFront.begin(), wantFront.end());
        sort(wantBack.begin(), wantBack.end());
        for(int i = 0; i < wantFront.size(); i++){
            int K = wantFront[i].f.s;
            auto it = pos.lb(-K);
            if(it == pos.end()){
                ret += min(wantFront[i].s.f, wantFront[i].s.s);
                continue;
            }
            ret += max(wantFront[i].s.f, wantFront[i].s.s);
            pos.erase(it);
        }
        pos = set<int>();
        for(int i = wantFront.size()+freelo+1; i <= N; i++) pos.insert(i);
        for(int i = 0; i < wantBack.size(); i++){
            int K = wantBack[i].f.s;
            auto it = pos.lb(K+1);
            if(it == pos.end()){
                ret += min(wantBack[i].s.f, wantBack[i].s.s);
                continue;
            }
            ret += max(wantBack[i].s.f, wantBack[i].s.s);
            pos.erase(it);
        }
        cout << ret << '\n';
    }
    return 0;
}

/******************************
Kateba ii dake no hanashi darou
Success is only a victory away
- No Game No Life Opening
******************************/

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

using ll = long long;
using namespace std;
const int INFint = 2e9+1;
const ll INFll = 2e18+1;


// modint: mod 計算を int を扱うように扱える構造体
template<int MOD> struct Fp {
    long long val;
    constexpr Fp(long long v = 0) noexcept : val(v % MOD) {
        if (val < 0) val += MOD;
    }
    constexpr int getmod() { return MOD; }
    constexpr Fp operator - () const noexcept {
        return val ? MOD - val : 0;
    }
    constexpr Fp operator + (const Fp& r) const noexcept { return Fp(*this) += r; }
    constexpr Fp operator - (const Fp& r) const noexcept { return Fp(*this) -= r; }
    constexpr Fp operator * (const Fp& r) const noexcept { return Fp(*this) *= r; }
    constexpr Fp operator / (const Fp& r) const noexcept { return Fp(*this) /= r; }
    constexpr Fp& operator += (const Fp& r) noexcept {
        val += r.val;
        if (val >= MOD) val -= MOD;
        return *this;
    }
    constexpr Fp& operator -= (const Fp& r) noexcept {
        val -= r.val;
        if (val < 0) val += MOD;
        return *this;
    }
    constexpr Fp& operator *= (const Fp& r) noexcept {
        val = val * r.val % MOD;
        return *this;
    }
    constexpr Fp& operator /= (const Fp& r) noexcept {
        long long a = r.val, b = MOD, u = 1, v = 0;
        while (b) {
            long long t = a / b;
            a -= t * b; swap(a, b);
            u -= t * v; swap(u, v);
        }
        val = val * u % MOD;
        if (val < 0) val += MOD;
        return *this;
    }
    constexpr bool operator == (const Fp& r) const noexcept {
        return this->val == r.val;
    }
    constexpr bool operator != (const Fp& r) const noexcept {
        return this->val != r.val;
    }
    friend constexpr ostream& operator << (ostream &os, const Fp<MOD>& x) noexcept {
        return os << x.val;
    }
    friend constexpr Fp<MOD> modpow(const Fp<MOD> &a, long long n) noexcept {
        if (n == 0) return 1;
        auto t = modpow(a, n / 2);
        t = t * t;
        if (n & 1) t = t * a;
        return t;
    }
};
const int MOD = 1e9+7;
using mint = Fp<MOD>;
int main(){
  int N,K;
  cin>>N>>K;
  mint ans = modpow((mint)K,N);
  mint cnt[100001] = {0};
  for(int i(K);i>=2;i--){
    mint kosuu = K/i;
    mint pa = modpow(kosuu,N);
    int tmp = i;
    while(tmp+i <= K){
      pa -= cnt[tmp+i];      
      tmp += i;
    }
    cnt[i] = pa;
    ans += pa*(i-1);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 4348
let n = Scanf.scanf " %d" (+) 0
let a_s = Array.init n @@ fun _ -> Scanf.scanf " %f" (+.) 0.
let avg = Array.fold_left (+.) 0. a_s /. float n
let ans, m = ref 0, ref max_float
let _ = Array.iteri (fun i a -> let d = abs_float (a -. avg) in if d < !m then (ans := i; m := d)) a_s; Printf.printf "%d\n" !ans

Measured memory_bytes: 384
/*** keep hungry and calm CoolGuang!***/
#pragma GCC optimize(2)
#include <bits/stdc++.h>
#include<stdio.h>
#include<algorithm>
#define debug(x) cout<<#x<<":"<<x<<endl;
using namespace std;
typedef long long ll;
typedef pair<int,int> pp;
const ll INF=1e18;
const int maxn=2e6+18;
const int mod=19260817;
inline bool read(ll &num)
{char in;bool IsN=false;in=getchar();if(in==EOF) return false;while(in!='-'&&(in<'0'||in>'9')) in=getchar();if(in=='-'){ IsN=true;num=0;}else num=in-'0';while(in=getchar(),in>='0'&&in<='9'){num*=10,num+=in-'0';}if(IsN) num=-num;return true;}
ll n,m,p;
ll num[maxn];
unordered_map<string,int>mp;
string s[maxn];
set<string>st;
int main()
{
    read(n);
    int maxl=0;
    for(int i=1;i<=n;i++){
        cin>>s[i];
        maxl=max(maxl,++mp[s[i]]);
    }
    int cnt=0;
    for(int i=1;i<=n;i++){
        int x=mp[s[i]];
        if(x==maxl)
            st.insert(s[i]);
    }
    for(string x:st){
        cout<<x;
        puts("");
    }
    return 0;
}
/***

***/


Measured memory_bytes: 49864
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for(int i=0;i<(int)n;i++)
struct edge{int from, to;};

int main(){
    int n;
    cin >> n;
    int a[n];
    rep(i,n) cin >>a[i];
    bool flag=true;
    int count=0;
    while(flag){
        rep(i,n){
            if(a[i]%2!=0) flag=false;
        }
        if(flag){
            count++;
            rep(i,n){
                a[i]/=2;
            }
        }
    }
    cout << count<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <map>
typedef long long ll;
int p[5005], tot;
bool np[5005];
std::map<ll, int> app;
std::map<ll, ll> ano;
int main()
{
	// freopen("AGC003-D.in", "r", stdin);
	for (int i = 2; i <= 5000; i++)
	{
		if (!np[i])
			p[tot++] = i;
		for (int j = 0; j < tot && p[j] * i <= 5000; j++)
		{
			np[i * p[j]] = true;
			if (!(i % p[j]))
				break;
		}
	}
	int n;
	scanf("%d", &n);
	while (n--)
	{
		ll x, a = 1, b = 1;
		scanf("%lld", &x);
		for (int j = 0; j < tot; j++)
		{
			int cnt = 0;
			while (!(x % p[j]))
			{
				x /= p[j];
				cnt++;
			}
			if (cnt % 3 == 1)
			{
				a *= p[j];
				b *= p[j] * p[j];
			}
			if (cnt % 3 == 2)
			{
				a *= p[j] * p[j];
				b *= p[j];
			}
		}
		ll l = 1, r = 1e5, res = 0;
		while (l <= r)
		{
			ll m = l + r >> 1;
			if (m * m <= x)
			{
				res = m;
				l = m + 1;
			}
			else
				r = m - 1;
		}
		if (res * res == x)
		{
			a *= x;
			b *= res;
		}
		else
		{
			a *= x;
			b *= x * x;
		}
		app[a]++;
		ano[std::min(a, b)] = std::max(a, b);
	}
	int ans = 0;
	for (auto &it : ano)
	{
		if (it.first != it.second)
			ans += std::max(app[it.first], app[it.second]);
	}
	printf("%d\n", ans + !!app[1]);
	return 0;
}


Measured memory_bytes: 18944
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; i--)
#define INF 1LL << 60;
#define LLINF 1e12
#define PI 3.14159265359
int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
int ny, nx;
typedef long long ll;
using namespace std;

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

ll lcm(ll m, ll n)
{
    if ((0 == m) || (0 == n))
        return 0;
    return ((m / gcd(m, n)) * n);
}

ll llpow(ll x, ll y)
{
    ll ans = 1;
    REP(i, y)
    ans *= x;
    return ans;
}

ll llmin(ll x, ll y) { return x < y ? x : y; }
ll llmax(ll x, ll y) { return x > y ? x : y; }

template <typename Container>
bool exist_in(const Container &c, const typename Container::value_type &v)
{
    return (c.end() != std::find(c.begin(), c.end(), v));
}

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

ll nCr(int n, int r)
{
    if (n == r or n == 0)
        return 1;
    if (n < r)
        return 0;
    if (r == 1)
        return n;
    return nCr(n - 1, r - 1) + nCr(n - 1, r);
}

//std::cout << std::defaultfloat << std::setprecision(10);
////////////////////////////////////////


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

    int N,K; cin >> N >> K;
    vector<int> hold(N);

    REP(i,K){
        int d; cin >>d;

        REP(j,d){
            int field; cin >>field;
            hold[field-1]++;
        }
    }

    int ans=0;

    REP(i,N){
        if(hold[i]!=0) ans++;
    }

    cout << N - ans << endl;

    return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ok() puts(ok?"Yes":"No");
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef set<int> si;
typedef map<string, int> msi;
typedef greater<int> gt;
typedef priority_queue<int, vector<int>, gt> minq;
typedef long long ll;
typedef pair<ll,ll> pll;
const ll LINF = 1e18L + 1;
const int INF = 1e9 + 1;
//clang++ -std=c++11 -stdlib=libc++ 
map< ll, int > prime_factor(ll n) {
  map< ll, int > ret;
  for(int64_t i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if(n != 1) ret[n] = 1;
  return ret;
}

int main() {
  ll n; cin >> n;
  auto primes = prime_factor(n);
  ll ans = 0;
  for (auto p: primes) {
    int x = p.second;
    int dif = 1;
    while (x - dif >= 0) {
      x -= dif;
      dif++;
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}

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

int main(){
	int n,a;
	cin>>n>>a;
	if(n<a){
		cout<<"0"<<endl;
		return 0;
	}
	else if(n>=a){
		cout<<"10"<<endl;
		return 0;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < b; i++)
#define all(v) v.begin(), v.end()
const int MOD = 1e9 + 7;
const int INF = 1e9;
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

int main() {
    string s;
    cin >> s;
    int ans = 0;
    int cnt = 1;
    int len = s.size();
    vector<int> v;

    if (len == 1) {
        cout << 1 << endl;
        return 0;
    }

    rep(i, 1, len) {
        if (i == len - 1) {
            if (s[i] == s[i - 1]) {
                cnt++;
                v.push_back(cnt);
            } else {
                v.push_back(cnt);
                v.push_back(1);
            }
        } else {
            if (s[i] == s[i - 1]) cnt++;
            else {
                v.push_back(cnt);
                cnt = 1;
            }
        }
    }

    int vlen = v.size();
    for (int i = 0; i < vlen; i++) {
        if (i == vlen - 1) {
            if (v[i] == 1) ans++;
            if (v[i] == 2) {
                ans++;
            }
            if (v[i] >= 3) {
                if (v[i] % 3 == 0) ans += 2 * (v[i] / 3);
                else ans += 2 * (v[i] / 3) + 1;
            }
        } else {
            if (v[i] == 1) ans++;
            if (v[i] == 2) {
                ans += 2;
                v[i + 1]--;
            }
            if (v[i] >= 3) {
                if (v[i] % 3 == 0) ans += 2 * (v[i] / 3);
                if (v[i] % 3 == 1) ans += 2 * (v[i] / 3) + 1;
                if (v[i] % 3 == 2) {
                    ans += 2 * (v[i] / 3) + 2;
                    v[i + 1]--;
                }
            }
        }

    }

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


Measured memory_bytes: 1532
///                                                     ببِسْمِ اللَّهِ الرَّحْمَنِ الرَّحِيم
#include <bits/stdc++.h>
//#define off  exit( 0 )
//#define cn   continue
#define rt   return/*
#define sc   scanf
#define pr   printf
#define pb   push_back
#define pf   push_front
#define p_f  pop_front
#define p_b  pop_back
#define ff   first
#define ss   second
#define vec  vector
#define gcd  __gcd
#define pi   acos( -1 )*/
#define ll   long long
/*#define ld   long double
#define N    2256
#define M    1000000007
#define I    1000000000000000000
#define pdd  pair < ld, ld >
#define pll  pair < ll, ll >
#define pii  pair < int, int >
#define rep( a, b, c, d )  for( int a = b; a <= c; a += d )
#define rvv( a, b, c, d )  for( int a = b; a >= c; a -= d )
#define en                 printf( "\n" )
#define sqr( a )           a * a
#define all( c )           c.begin(), c.end()
#define srt( c )           sort( all( c ) )
#define rev( c )           reverse( all( c ) )
#define srtr( c )          sort( c.rbegin(), c.rend() )
#define numcounts          __builtin_popcount
#define mxn( x, y, z )     max( x, min( y, z ) )
#define mnx( x, y, z )     min( x, max( y, z ) )
const int dx[ ] = { 1, -1, 0, 0 };
const int dy[ ] = { 0, 0, -1, 1 };*/
using namespace std;
ll ttt = 1;
ll n;
string s;
void solve()
{
    cin >> s;
    for(int i = 0; i < s.size() / 2; i ++ )
        if(s[i] != s[s.size()-i-1] )n ++;
    cout << n;
}
int main()
{
    //sc( "%I64d", &ttt );
    for(int i = 0; i < ttt; i ++ )
        solve();
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000



int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int H, W; cin >> H >> W;
    string S[51];
    rep(i, H) cin >> S[i];
    int ans[51][51] = {};
    rep(i, H) {
        rep(j, W) {
            int cnt = 0;
            rep(k, 9) {
                int x = i + k / 3 - 1;
                int y = j + k % 3 - 1;
                if (x < 0 || x >= H || y < 0 || y >= W) continue;
                if (S[x][y] == '#') ans[i][j]++;
            }
        }
    }
    rep(i, H) {
        rep(j, W) {
            if (S[i][j] == '#') cout << "#";
            else cout << ans[i][j];
        }
        cout << endl;
    }

    return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-

n = list(input())
n = list(map(int,n))

digsum = 0

for i in range(len(n)):
    digsum += n[i]

n = list(map(str,n))
n = "".join(n)
n = int(n)

if n % digsum == 0:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <limits>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <functional>

using namespace std;

#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define eprintf(...) 42
#endif
using ll = long long;
using vll = std::vector<ll>;
using vvll = std::vector<vll>;
using vvvll = std::vector<vvll>;
#define reps(i, S, E) for (ll i = (S); i <= (E); i++)
#define rep(i, N) reps(i, 0, N-1)
#define deps(i, E, S) for (ll i = (E); i >= (S); i--)
#define dep(i, N) deps(i, N-1, 0)
const ll MOD = 1000000007;
const ll INF = 1LL << 60;
const int INF_INT = 1 << 30;

//AtCoder Beginner Contest 127 - E
vector<vector<ll>> comb(ll n, ll r) {
	vector<vector<ll>> v(n + 1, vector<ll>(n + 1, 0));
	for (ll i = 0; i < (ll)v.size(); i++) {
		v[i][0] = 1;
		v[i][i] = 1;
	}
	for (ll j = 1; j < (ll)v.size(); j++) {
		for (ll k = 1; k < j; k++) {
			v[j][k] = (v[j - 1][k - 1] + v[j - 1][k]);
		}
	}
	return v;
}

//�g�p(num1 / num2) % m : (num1 * modinv(num2, m)) % m
ll modinv(ll a, ll m) {
	ll b = m, u = 1, v = 0;
	while (b) {
		ll t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}

ll combMOD(ll n, ll r, ll mod) {
	ll num = 1;
	for (ll i = 1; i <= r; i++) {
		num = num * (n - i + 1);
		num = num % mod;
		num = (num * modinv(i, mod)) % mod;
	}
	return num;
}

int main() {
	ll N;
	scanf("%lld", &N);
	ll M;
	scanf("%lld", &M);
	ll K;
	scanf("%lld", &K);

	ll sum = 0;
	rep(i, N) { 
		ll temp = 0;
		ll row = i;
		temp += (row * (row + 1) / 2);
		row = N - i - 1;
		temp += (row * (row + 1) / 2);

		rep(j, M) {
			sum += temp * M;
			sum %= MOD;
			ll col = j;
			sum += N * (col * (col + 1) / 2);
			sum %= MOD;
			col = M - j - 1;
			sum += N * (col * (col + 1) / 2);
			sum %= MOD;
		}
	}

	//�g�p(num1 / num2) % m : (num1 * modinv(num2, m)) % m
	//sum = (sum / 2) % MOD
	sum = (sum * modinv(2, MOD)) % MOD;

	//ll result = sum * combMOD(N * M, K, MOD) * combMOD(K, 2, MOD) / combMOD(N * M, 2, MOD);
	ll result = sum * combMOD(N * M, K, MOD);
	result %= MOD;
	result *= combMOD(K, 2, MOD);
	result %= MOD;
	result = (result * modinv(combMOD(N * M, 2, MOD), MOD)) % MOD;

	printf("%lld\n", result);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  long long N,M;
  cin>>N>>M;
  vector<long long>v1,vN;
  long long a,b;
  for (long long i=0;i<M;i++){
    cin>>a>>b;
    if (a==1){
      v1.push_back(b);
    }
    if (b==N){
      vN.push_back(a);
    }
  }
  //sort(v1.begin(),v1,end());
  sort(vN.begin(),vN.end());
  auto iin=vN.begin();
  for (long long i=0;i<v1.size();i++){
    iin=lower_bound(vN.begin(),vN.end(),v1[i]);
    if (iin!=vN.end() && *iin==v1[i]){
      cout<<"POSSIBLE"<<endl;
      return 0;
    }
  }
  cout<<"IMPOSSIBLE"<<endl;
}


Measured memory_bytes: 2004
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 5;
template <typename T> void chkmax(T &x, T y) {x = max(x, y); }
template <typename T> void chkmin(T &x, T y) {x = min(x, y); } 
template <typename T> void read(T &x) {
	x = 0; int f = 1;
	char c = getchar();
	for (; !isdigit(c); c = getchar()) if (c == '-') f = -f;
	for (; isdigit(c); c = getchar()) x = x * 10 + c - '0';
	x *= f;
}
template <typename T> void write(T x) {
	if (x < 0) x = -x, putchar('-');
	if (x > 9) write(x / 10);
	putchar(x % 10 + '0');
}
template <typename T> void writeln(T x) {
	write(x);
	puts("");
}
int cnt;
long long ans[MAXN];
int s(long long x) {
	int ans = 0;
	while (x != 0) {
		ans += x % 10;
		x /= 10;
	}
	return ans;
}
int main() {
	long long now = 1e15; now--;
	ans[cnt = 1] = now;
	while (now) {
		bool found = false;
		int bits = s(now);
		for (long long base = 1; !found; base *= 10) {
			for (int j = 1; j <= 9; j++) {
				long long tmp = now - base * j;
				if (tmp * bits <= now * s(tmp)) {
					found = true;
					now = tmp;
					break;
				}
			}
		}
		ans[++cnt] = now;
	}
	cnt--;
	sort(ans + 1, ans + cnt + 1);
	int T; read(T);
	for (int i = 1; i <= T; i++)
		writeln(ans[i]);
	return 0;
}

Measured memory_bytes: 256
import sys
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
 
ni      = lambda: int(ns())
nin     = lambda y: [ni() for _ in range(y)]
na      = lambda: list(map(int, stdin.readline().split()))
nan     = lambda y: [na() for _ in range(y)]
nf      = lambda: float(ns())
nfn     = lambda y: [nf() for _ in range(y)]
nfa     = lambda: list(map(float, stdin.readline().split()))
nfan    = lambda y: [nfa() for _ in range(y)]
ns      = lambda: stdin.readline().rstrip()
nsn     = lambda y: [ns() for _ in range(y)]
ncl     = lambda y: [list(ns()) for _ in range(y)]
nas     = lambda: stdin.readline().split()

n, k = na()

ans = 0
for i in range(k, n + 2):
    ans += (n * (n + 1) // 2) - ((n - i) * (n - i + 1) // 2) - (i * (i - 1) // 2) + 1
    ans %= mod

print(ans)

Measured memory_bytes: 9268
#include<bits/stdc++.h>
#define fi first
#define se second
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define rrep(i, n) for (int (i) = 1; (i) <= (n); (i++))
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define pb push_back
#define eb emplace_back
#define yn {puts("Yes");}else {puts("No");}
#define printd(x) printf("%.12f\n", x);
template<class T> bool chmin(T& a, const T& b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> bool chmax(T& a, const T& b) {if (a < b) {a = b; return 1;} return 0;}
using namespace std;
using ll = long long;
using P = pair<int, int>;


int main() {
	int r, g, b, n;
	cin >> r >> g >> b >> n;

	ll ans = 0;
	for (int i = 0; i <= 3000; i++) {
		for (int j = 0; j <= 3000; j++) {
			if (n - i * b - j * g >= 0) {
				if ((n - i * b - j * g) % r == 0) ans++;
			}
		}
	}

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int MOD = 1e9 + 7;

int main()
{
  int n;
  cin >> n;
  vector<int> s(n);
  for (auto &e : s)
    cin >> e;
  sort(s.begin(), s.end());
  int sum = accumulate(s.begin(), s.end(), 0);
  if (sum % 10 == 0)
  {
    int i = 0;
    while (i < n)
    {
      if (s[i] % 10 != 0)
      {
        break;
      }
      i++;
    }
    if (i == n)
      sum = 0;
    else
      sum -= s[i];
  }
  cout << sum << endl;

  return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public void main(Scanner sc) {
        int n = sc.nextInt();
        int a[][] = new int[29][n];
        int b[][] = new int[29][n];
        for (int i = 0; i < n; i++) {
            int ai = sc.nextInt();
            for (int j = 1; j <= 29; j++) {
                a[j - 1][i] = ai % (1 << j);
            }
        }
        for (int i = 0; i < n; i++) {
            int bi = sc.nextInt();
            for (int j = 1; j <= 29; j++) {
                b[j - 1][i] = bi % (1 << j);
            }
        }

        int ans = 0;
        int tmp = 1;
        for (int bit = 0; bit < 29; bit++) {
            Arrays.sort(b[bit]);

            int bi = 0;
            for (int i = 0; i < n; i++) {
                bi += check(a[bit][i], tmp, b[bit]);
                bi %= 2;
            }
            ans += (bi << bit);

            tmp *= 2;
        }

        System.out.println(ans);
    }

    private int check(int a, int t, int n[]) {
        int cnt1 = search(2 * t - a, n) - search(t - a, n);
        int cnt2 = search(4 * t - a, n) - search(3 * t - a, n);

        return (cnt1 + cnt2) % 2;
    }

    private int search(int t, int n[]) {
        int l = 0;
        int r = n.length - 1;
        if (t <= n[0]) {
            return 0;
        }
        if (n[r] < t) {
            return r + 1;
        }

        int c = 0;
        while (l < r) {
            c = (l + r) / 2;
            if (t < n[c]) {
                r = c;
            } else if (t > n[c]) {
                l = c + 1;
            } else {
                r = c;
            }
        }

        return l;
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        new Main().main(sc);
        sc.close();
    }
}


Measured memory_bytes: 188136
#include<iostream>
#include<climits>
#include<math.h>
#include<vector>
#include<algorithm>
#include<cstdio>
#include <string>
#include <complex>
#include <functional>
using namespace std;
typedef pair<int,int> P;
double dat[100][100];
int dp[1000001];//動的計画法
int prime[1000001];
int main(){
    prime[0]=prime[1]=-1;//作る
    for(int i=2;i<=1000000;i++){
        if(prime[i]!=-1){
            prime[i]=1;
            for(int j=i+i;j<=1000000;j+=i)prime[j]=-1;
        }
    }
    int n,x;
    int p[31];
    while(cin>>n>>x,n){
        int ans=0,cnt=0;
        for(int i=0;i<n;i++){
            cin>>p[i];
            if(p[i]%2==0) cnt++;
        }
        if(cnt==n){
            cout<<"NA"<<endl;
            continue;
        }
        dp[0]=1;
        for(int i=1;i<=x;i++) dp[i]=0;
        for(int i=0;i<n;i++){
            for(int j=0;j<=x;j++){
                if(p[i]<=j&&dp[j-p[i]])dp[j]=1;
            }
        }
        int ch=0;
        for(int j=x;j>=0;j--){
            if(prime[j]==1&&dp[j]==1){
                ch++;
                cout<<j<<endl;
                break;
            }
        }
        if(ch==0)cout<<"NA"<<endl;
    }
    return 0;
}


Measured memory_bytes: 10924
#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long
#define pb push_back
#define sz(i) (int)(i.size())
#define F first
#define S second
#define L long double
#define P pair<int, int>
#ifdef ONLINE_JUDGE
#define endl '\n'
#endif
const int inf = 0x3f3f3f3f3f3f3f3LL;
const int mod = (int)1e9 + 7;
using namespace std;
#ifndef ONLINE_JUDGE
#define tr(...) {__l(__LINE__);__f(#__VA_ARGS__, __VA_ARGS__);}
inline void __l(int line) { cerr << "#" << line << ": "; }template <typename Arg1>
void __f(const char* name, Arg1&& arg1){cerr << name << " : " << arg1 << endl;}template <typename Arg1, typename... Args>void __f(const char* names, Arg1&& arg1, Args&&... args){const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);}
#else
#define tr(...)
#endif
template<class T> void smin(T& a, T val) {if (a > val) a = val;}template<class T> void smax(T& a, T val) {if (a < val) a = val;}template<typename T>inline std::ostream &operator << (std::ostream & os,const std::vector<T>& v){bool first = true;os << "[";for(auto i: v){if(!first)os << ", ";os << i;first = false;}return os << "]";}
const int N = 5*(int)1e5 + 10;
// make sure N size is correctttt!!!!!!!!!


int n;
vector<int> h;

int32_t main(){_

   cin>>n;
   h.resize(n);

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

   int ans = 0;
   while(1){
      bool is_all_zero = 1;
      for (int i = 0; i < n; ++i)
      {
         is_all_zero &= (h[i] == 0);
      }
      if(is_all_zero){
         cout<<ans;
         return 0;
      }
      for (int start = 0; start < n; ++start)
      {
         if(h[start] == 0)continue;
         int mi = inf, ending = start+1;
         for (int i = start; i < n; ++i)
         {
            if(h[i] == 0){
               ending = i;
               break;
            }
            ending = i+1;
            smin(mi, h[i]);
         }
         for (int j = start; j < ending; ++j)
            h[j] -= mi;
         ans += mi;
         start = ending;
      }
   }

   //make sure N size is correct!!!!!!!!!
   return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <functional>
#include <ccomplex>
#include <unordered_map>
#include <cstring>
#include <iostream>
#include <numeric>
#include <sstream>
#include <set>
#include <tuple>
#include <iomanip>

using namespace std;
#define MAX 1LL << 60

typedef long long ll;

#define rep(i, s, e) for(ll i = s; i < e; i++)
#define repR(i, s, e) for(ll i = s; i > e; i--)
#define reft0(i, j) setfill('0') << setw(i) << j

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

int main(){
    ll A, B, C;

    cin >> A >> B >> C;

    if (B > A * C){
        cout << C << endl;
    }
    else{
        cout << B / A << endl;
    }

    return 0;
}

Measured memory_bytes: 256
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <queue>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define FIX(a) ((a)%mod+mod)%mod
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define fi first
#define se second
#define pb push_back
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<pair<string,int> > pq;
    string smax = "zzzzzzzzzzz";
    int pmax = -1;
    vint used(n,0);
    REP(i,n){
        string s;
        int p;
        cin >> s >> p;
        pq.pb(make_pair(s,p));
    }
    REP(i,n){
        int now = 0;
        REP(j,n){
            if(used[j]==0){
                if(pq[j].fi<smax){
                    smax = pq[j].fi;
                    pmax = pq[j].se;
                    now=j;
                }else if(pq[j].fi==smax){
                    if(pq[j].se>pmax){
                        pmax = pq[j].se;
                        now=j;
                    }
                }
            }
        }
        smax = "zzzzzzzzzzz";
        used[now]=1;
        pmax=-1;
        cout << now+1 << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
 char AFN[27]="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
  char ars[27]="abcdefghijklmnopqrstuvwxyz";
  char s1,s2[1201];
  int a=0,i,j=0,l=0;
  while(scanf("%c",&s1)!=EOF){
    if(s1>=97&&s1<=122){
      for(j=0;j<26;j++){
    if(s1==ars[j]){
      s2[l]=AFN[j];
      l++;
      a++;
    }
      }
    }
    if(s1>=65&&s1<=90){
      for(j=0;j<26;j++){
    if(s1==AFN[j]){
      s2[l]=ars[j];
      l++;
      a++;
    }
      }
    } 
    if(a==0){
      s2[l]=s1;
      l++;
    }
    a=0;
    j=0;
  }
  for(i=0;i<l;i++){
    printf("%c",s2[i]);
  }
  return(0);
}

Measured memory_bytes: 524
import java.util.Scanner;
import java.util.ArrayList;
import java.util.Comparator;

class Main {
    public static long kanacy(long b, long[] a) {
        long sum=0;
        for(int i=0; i<a.length; i++) {
            sum += Math.abs(a[i] - (b+i+1));
        }
        return sum;
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long a[] = new long[n];
        ArrayList<Long> offset = new ArrayList<>();
        for(int i=0; i<n; i++) {
            a[i] = sc.nextInt();
            offset.add(a[i] - (i+1));
        }
        sc.close();

        offset.sort(Comparator.naturalOrder());

        long b = offset.get(offset.size()/2);
        
        System.out.println(kanacy(b, a));
    }
}

Measured memory_bytes: 97844
# CODE FESTIVAL 2017 qual A
# C - Palindromic Matrix
# https://atcoder.jp/contests/code-festival-2017-quala/tasks/code_festival_2017_quala_c
from collections import Counter
import sys
input = sys.stdin.readline
H, W = map(int, input().split())
S = [input()[:-1] for _ in range(H)]
C = Counter(''.join(S))

a = H//2*W//2
b = H//2*(W % 2) + W//2*(H % 2)
c = (H % 2)*(W % 2)

for _ in range(c):
    for k, v in C.items():
        if v % 2 == 1 and v > 0:
            C[k] -= 1
            c -= 1
            break
b += c//2
for _ in range(b):
    for k, v in C.items():
        if v % 4 == 2 and v > 0:
            C[k] -= 2
            b -= 1
            break
a += b//2
for _ in range(a):
    for k, v in C.items():
        if v % 4 == 0 and v > 0:
            C[k] -= 4
            break
if sum(C.values()) == 0:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 3444
#include <bits/stdc++.h>
#include <iterator>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <math.h>
#define vi vector<int>
#define vl vector<long long>
#define vpi vector<pair<int,int> >
#define ll long long 
#define vpl vector<pair><long long,long long> > 
#define F first
#define S second
#define mp make_pair
#define ld long double
#define pb push_back
#define pii pair<int,int>
#define pll pair<long long,long long>
#define pci pair<char,int>
#define un unsigned
# define M_PI           3.14159265358979323846  /* pi */
// #define mod 998244353
#define mod 1000000007
#define MAXN  1000001
using namespace std; 
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)


/*
//------------------------------------------DSU--------------------------------------------------------//
int parent[1000001];
int ssize[1000001];


int find_set(int v) {
    if (v == parent[v])
        return v;
    return parent[v] = find_set(parent[v]);
}

void make_set(int v) {
    parent[v] = v;
    ssize[v] = 1;
}

void union_sets(int a, int b) {
    a = find_set(a);
    b = find_set(b);
    if (a != b) {
        if (ssize[a] < ssize[b])
            swap(a, b);
        parent[b] = a;
        ssize[a] += ssize[b];
    }
}
*/

//-----------------------------Sieve Of Eratosthenes--------------------------------------//

/*
v<int> primes;
void SieveOfEratosthenes(int n) 
{ 
    // Create a boolean array "prime[0..n]" and initialize 
    // all entries it as true. A value in prime[i] will 
    // finally be false if i is Not a prime, else true. 
    bool prime[n+1]; 
    memset(prime, true, sizeof(prime)); 
  
    for (int p=2; p*p<=n; p++) 
    { 
        // If prime[p] is not changed, then it is a prime 
        if (prime[p] == true) 
        { 
            // Update all multiples of p greater than or  
            // equal to the square of it 
            // numbers which are multiple of p and are 
            // less than p^2 are already been marked.  
            for (int i=p*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    } 
  
    // Print all prime numbers 
    for (int p=2; p<=n; p++) 
       if (prime[p]) 
          primes.pb(p); 
}

*/




void solve()
{
    int n;
    cin>>n;
    while(n)
    {
        if(n%10 == 7)
        {
            cout<<"Yes"<<endl;
            return;
        }
        n /= 10;
    }
    cout<<"No"<<endl;
}



int main()
{
    fast;
    int t;
    // cin>>t;
    t = 1;
    solve();
    return 0;
}

Measured memory_bytes: 3600
import heapq
class Heapq :
    def __init__(self, arr, desc=False) :
        if desc :
            arr = [-a for a in arr]
        self.sign = -1 if desc else 1
        self.hq = arr
        heapq.heapify(self.hq)
    def pop(self) :
        return heapq.heappop(self.hq) * self.sign
    def push(self, a):
        heapq.heappush(self.hq, a * self.sign)
    def top(self):
        return self.hq[0] * self.sign
    def size(self):
        return len(self.hq)

N,M = map(int,input().split())
D = {i: [] for i in range(1,M+1)}
for i in range(N) :
    a, b = map(int,input().split())
    if a > M : continue
    D[a].append(b)

q = Heapq([], True)
ans = 0

for a in range(1,M+1) :
    for b in D[a] :
        q.push(b)
    if q.size() > 0 :
        ans += q.pop()
print(ans)


Measured memory_bytes: 82020
#include <cmath>
#include <iostream>

using namespace std;

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

    long long a = (long long)ceil(sqrt(N));

    for(long long i = a; i > 0; i--) {
        if(N % i == 0) {
            cout << (N / i + i - 2) << endl;
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
string s;

bool isPal(int i, int j){
	while(i<j){
		if(s[i]!=s[j]) return false;
		i++;
		j--;
	}
	return true;
}


int main(){
	cin>>s;
	int n = (int)s.size();
	int f = (n-1)/2;
	f--;
	int g = (n+3)/2;
	g--;
	if(isPal(0,n-1) && isPal(0,f) && isPal(g,n-1)) cout<<"Yes";
	else cout<<"No";
	return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.util.Arrays;
import java.util.Set;
public class Main{
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        int H=sc.nextInt();
        int W=sc.nextInt();
        String[]C=new String[H];
        for(int i=0;i<H;i++){
            C[i]=sc.next();
        }
        for(int i=0;i<H;i++){
            System.out.println(C[i]);
            System.out.println(C[i]);
        }

        
        
}
        
        
    }


Measured memory_bytes: 23124
H, W = map(int, input().split())
M = ['.' * (W+2)]
for _ in range(H):
    M.append('.' + input() + '.')
M.append('.' * (W+2))
flag = True
for i in range(1, H+1):
    for j in range(1, W+1):
        if M[i][j] == '#':
            if '#' not in (M[i+1][j], M[i][j+1], M[i-1][j], M[i][j-1]):
                flag = False
if flag:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 39152
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#define rep(i,n) for(int i=0;i<(n);i++)
typedef long long ll;
using namespace std;

int gcd(ll x,ll y){
	if (y > 0) return gcd(y, x%y);
	else return x;
}

int main() {
	int n;
	ll x;
	cin >> n >> x;
	vector<ll> a(n);
	rep(i, n) cin >> a[i];
	vector<ll> len(n);
	rep(i, n) len[i] = abs(a[i] - x);
	ll ans = gcd(len[0], len[1]);
	for (int i = 2; i < n; i++) {
		ans = gcd(ans, len[i]);
	}
	cout << ans << endl;
}

Measured memory_bytes: 1792
import java.util.*;

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

        int N = sc.nextInt();
        String S = sc.next();
        int K = sc.nextInt();

        String newS = "";
        char target = S.charAt(K - 1);
        for (char s : S.toCharArray()) {
            if (s == target) {
                newS += s;
            } else {
                newS += '*';
            }
        }

        System.out.println(newS);
    }

}


Measured memory_bytes: 23764