akhauriyash/Code-Regression huggingface dataset:
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author parsa bahrami
 */

#pragma GCC optimize("O2")

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

using namespace std;
using namespace __gnu_pbds;

typedef long long int ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pld;
typedef pair<string, string> pss;

template<class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define sz(x)                       (ll) x.size()
#define jjoin(x)                    for (auto i : x) cout << i << endl;
#define all(x)                      (x).begin(),(x).end()
#define F                           first
#define S                           second
#define Mp                          make_pair
#define sep                         ' '
#define error(x)                    cerr << #x << " = " << x << endl
#define fast_io                     ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define set_random                  mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
#define kill(x)                     return cout << x << endl , 0;
#define endl                        '\n'

ll poww(ll a, ll b, ll md) {
    return (!b ? 1 : (b & 1 ? a * poww(a * a % md, b / 2, md) % md : poww(a * a % md, b / 2, md) % md));
}

const ll MAXN = 2e5 + 10;
const ll MAXA = 101;
const ll INF = 8e18;
const ll MOD = 998244353; //1e9 + 7
const ld PI = 4 * atan((ld) 1);
set<ll> pos[MAXN];

int main() {
    fast_io;
    set_random;
    string s, t;
    cin >> s >> t;
    for (ll i = 0; i < sz(s); i++) {
        pos[s[i]].insert(i);
    }
    ll cnt = 0, last = 0;
    for (ll i = 0; i < sz(t); i++) {
        if (pos[t[i]].empty()) kill(-1);
        auto it = pos[t[i]].lower_bound(last);
        if (it == pos[t[i]].end())
            last = 0, cnt++;
        if (last == 0) last = *pos[t[i]].lower_bound(0) + 1;
        else
            last = *it + 1;
    }
    cout << (sz(s) * cnt + last) << endl;
    return 0;
}



Measured memory_bytes: 14544
#include<iostream>
#include<algorithm>
#include<stdlib.h>
#include<math.h>
#include<string>

using namespace std;



	
int main() {
	string str[100];
	string work;
	int n, l;
	cin >> n >> l;
	for (int i = 0;i < n;i++) {
		cin >> str[i];
	}
	for (int i = 0;i < n-1;i++) {

		for (int p =i+1;p < n;p++) {
			if (str[i] >str[p]) {
				work=str[i];
				str[i] = str[p];
				str[p] = work;;
			}
		}
	}
	for (int i = 0;i < n;i++) {
		cout << str[i];
	}
	
}




Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int D;
int len,a[10009];
ll dp[10009][130];
const ll mod=1e9+7;
ll dfs(int pos,int sum,int limit)
{
    if(pos>len) return sum?0:1;
    if(dp[pos][sum]!=-1&&!limit)return dp[pos][sum];
    ll ret=0;
    int res=limit?a[pos]:9;
    for(int i=0;i<=res;i++)
    {
        ret=(ret+dfs(pos+1,(sum+i)%D,limit&&(i==res)))%mod;
    }
    return (!limit)?dp[pos][sum]=ret:ret;
}
ll part(char s[])
{
    len=0;int lenn=strlen(s+1);
    for(int i=1;i<=lenn;i++)a[++len]=s[i]-'0';
    memset(dp,-1,sizeof dp);
    return dfs(1,0,1);
}
char str[10009];
int main()
{
    scanf("%s%d",str+1,&D);
    printf("%lld\n",(part(str)-1+mod)%mod);
    return 0;
}

Measured memory_bytes: 11264
#include<iostream>
#include<string>
#include<vector>
#include<list>
#include<cmath>
#include<algorithm>
#include<cstdio>
#include<set>
#include<map>
#include<queue>
#include<cstring>
#include<sstream>
using namespace std;

typedef long long ll;

int main() {
  int N; cin >> N;
  int L[210];
  for ( int i = 0; i < 2* N; i++ ) cin >> L[i];
  sort(L,L+2*N);
  int ans =  0;
  for ( int i = 0; i < 2*N; i+=2 ) {
    ans += min(L[i],L[i+1]);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
//#define int long long
typedef long long ll;
using namespace std;
const int MOD = 1000000007;
const int INF = 1010000000;
const double EPS = 1e-10;
const pair<int,int> fd[] = {make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 


signed main(){
  int n;cin>>n;int mint = INF, ans = 0;
  rep(i,n){
    int s;cin>>s;
    ans += s;
    if(mint > s && s % 10 != 0)mint = s;
  }
  cout << max(0, (ans % 10 ? ans : ans - mint)) << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
int main()
{
    int n,i,t=0;
    scanf("%d",&n);
    getchar();
    char s[n];
    gets(s);
    for(i=0;i<n;i++){
        if(s[i+1]!=s[i]){
            t+=1;
        }
    }
    printf("%d",t);
}


Measured memory_bytes: 256
#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 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;
    map<string, int> mp;
    set<string> st;
    for(int i = 0; i < N; ++i) {
        string s;
        cin >> s;
        st.insert(s);
        mp[s]++;

    }

    int M;
    cin >> M;
    for(int i = 0; i < M; ++i) {
        string s;
        cin >> s;
        mp[s]--;

    }

    int res = 0;
    for(auto it = st.begin(); it != st.end(); ++it) {
        res = max(res, mp[*it]);

    }
    cout << res << endl;

    return 0;
}


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

using namespace std;

int main() {
    int h, n;
    cin >> h >> n;
    
    vector<int> v(n);
    for(int i =0 ; i < n; i++) {
        cin >> v[i];
    }
    
    int sum = 0;
    for(int i = 0; i < n; i++) {
        sum += v[i];
    }
    
    if(h <= sum) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
    
    return 0;
}


Measured memory_bytes: 640
#include "bits/stdc++.h"
using namespace std;
#define int long long
#define endl '\n'


int32_t main() {
    ios_base::sync_with_stdio(NULL);
    cin.tie(nullptr), cout.tie(nullptr);
    
    int n;
    cin >> n;
    map<string, int> m;
    for (int i = 0; i < n; i++) {
        string s; cin >> s;
        m[s]++;
    }
    cout << "AC x " << m["AC"] << endl; 
    cout << "WA x " << m["WA"] << endl; 
    cout << "TLE x " << m["TLE"] << endl; 
    cout << "RE x " << m["RE"] << endl; 
}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
int n,k,a[1<<17],cnt;vector<int>x[1<<17];
int D(int p) {
	int M=0;
	for(int i=0;i<x[p].size();i++){
		M=max(M,D(x[p][i])+1);
	}
	if(M==k-1&&p!=1&&a[p]!=1){M=-1;cnt++;}
	return M;
}
main(){
	cin>>n>>k;for(int i=1;i<=n;i++){cin>>a[i];if(i>=2){x[a[i]].push_back(i);}}
	if(a[1]!=1){a[1]=1;cnt++;}
	D(1);
	cout<<cnt<<endl;
}

Measured memory_bytes: 13056
#include <math.h>
#include <iostream>
#include <algorithm>
#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;

int main()
{
int n,m,l;
cin >> n >> m >> l;
vector<vector<int>> A(n,vector<int>(m));
vector<vector<int>> B(m,vector<int>(l));
vector<vector<long long>> C(n,vector<long long>(l));
for(int i=0;i<n;i++){for(int j=0;j<m;j++){cin >> A.at(i).at(j);}}
for(int i=0;i<m;i++){for(int j=0;j<l;j++){cin >> B.at(i).at(j);}}
for(int i=0;i<n;i++)
{
for(int j=0;j<l;j++)
{
C.at(i).at(j)=0;
for(int k=0;k<m;k++)
{
C.at(i).at(j)+=A.at(i).at(k)*B.at(k).at(j);
}
cout << C.at(i).at(j);
if(j!=l-1)cout << " ";
}
cout << endl;
}
}


Measured memory_bytes: 3272
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int> > vii;
typedef pair<int, int> pii;
#define rep(i, n) for(ll i = 0; i < (ll)(n); ++i)
#define all(a) (a).begin(), (a).end()
#define msg(a) cout << #a << " " << a << endl
#define eb emplace_back

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

    int ans = 0;
    rep(i, a+1) {
        rep(j, b+1) {
            rep (k, c+1) {
                if ((500*(i) + 100*(j) + 50*(k)) == x) {
                    ++ans;
                }
            }
        }
    }
    cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
/**
 *      ABC 72 B
 *      author  : kyomukyomupurin
 *      created : 2018-09-04 22:38:22
**/

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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    string s; cin >> s;
    int sizes = s.size();
    for (int i = 0; i < sizes; i += 2) {
        cout << s[i];    
    }

    return 0;
}

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

string S;

int main(){
	cin >> S;
	int sisa_hari = 15 - S.length();
	int cnt = 0;
	for(int i = 0 ; i < 15 - sisa_hari ; i++){
		if(S[i] == 'o') cnt++;
	}
	//printf("%d\n",cnt);
	cnt += sisa_hari;
	//printf("%d\n",cnt);
	if(cnt >= 8) printf("YES\n");
	else printf("NO\n");
	return 0;
}


Measured memory_bytes: 256
#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 main() {
	string s;
	cin >> s;

	int a = 0, b = 0;
	for (int i = 0; i < s.size(); i += 2) {
		if (s.at(i) == '0') b++;
		else a++;
	}
	for (int i = 1; i < s.size(); i += 2) {
		if (s.at(i) == '1') b++;
		else a++;
	}
	cout << min(a, b) << endl;
	return 0;
}


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

using ll = long long int;
using bigint = int64_t;

#define pll pair<ll, ll>
#define vll vector<ll>
#define vpll vector<pll>
#define lob lower_bound
#define upb upper_bound
#define ff first
#define ss second
#define pb push_back
#define eb emplace_back
#define pf push_front
#define ins insert
#define mp make_pair
#define w(t) cin >> t;while(t--)
#define bitcount __builtin_popcount
#define endl "\n"
#define sz(s) (int)s.size()
#define mem(n,m) memset(n,m,sizeof(n))
#define deb(x) cout << #x << " = " << x << endl;
#define rep(i,n) for(ll i = 0; i < n; i++)
#define ren(i,n) for(ll i = n-1; i >= 0; i--)
#define all(x) x.begin(),x.end()
#define fo(i, a, b) for(ll i = a; i <= b; i++)
#define ffo(i, a, b) for(ll i = a; i >= b; i--)
#define ffi(i,a,b,c) for(ll i = a ; i <= b ; i += c)
#define IOS ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
const int MOD = 1000000007;

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

void solve(){
    ll n;
    cin >> n;
    ll c = 1, ans = 0;
    while(n){
    	n /= 2;
    	ans += c;
    	c *= 2;
    }
    cout << ans << endl;
}

int main(){
    IOS;
    //io_set();
    ll tt = 1;
    //cin >> tt;
    while(tt--){
        solve();
    }
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {

        Scanner sc = new Scanner(System.in);
        
        String S = sc.next();
        String T = sc.next();
        boolean isOK = false;
        
        for(int i = S.length(); i >= 0; i--){
            
            String left = S.substring(0, i);
            String right =S.substring(i, S.length());
            if( T.equals(right + left) ){
                isOK = true;
                break;
            }
        }
        
        System.out.println( isOK ? "Yes" : "No");
        
        
        
    }
}


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

// Problem https://atcoder.jp/contests/abc051/tasks/abc051_b
// Reference editrial

int solver(int eachMax,int sumNum){
    int result;
    int sumPat=0;
    for(int x=0;x <= eachMax;x++){
        for(int y=0;y<= eachMax;y++){
                int diffSumNum=sumNum-x-y;// zの替わりに調査
                if(0 <= diffSumNum and diffSumNum <= eachMax){
                    sumPat = sumPat + 1;
                }

        }
    }

    result = sumPat;
    return result;
}

int main(void){
    int K,S,answer;
    cin >> K >> S ;
    answer = solver(K,S);
    cout << answer << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#ifdef _WIN32
#include "debug.hpp"
#endif
using namespace std;

#define rep(i, N)  for(int i = 0; i < (N); i++)
#define reps(i, N) for(int i = 1; i <= (N); i++)
#define repr(i, N) for(int i = (N) - 1; i >= 0; i--)
#define pub push_back

template<typename T> 
void chmax(T &a, T b){ a = max(a, b); };
template<typename T> 
void chmin(T &a, T b){ a = min(a, b); };

typedef long long ll;
typedef pair<int, int> P;
const int INF = 100000000;
const ll LINF = 10000000000000000;
const int MOD = 1000000007;
const int dx[9] = { 0, 1,  0, -1, 1,  1, -1, -1, 0};
const int dy[9] = { 1, 0, -1,  0, 1, -1, -1,  1, 0};
//--------------------------------------//
int a[4];

void solve(){
	rep(i,8){
		int c=a[0];
		int b=1;
		reps(j,3){
			if(i&b)
				c+=a[j];
			else
				c-=a[j];
			b<<=1;
		}
		if(c==7){
			b=1;
			rep(j,4){
				cout<<a[j];
				if(j==3) break;
				if(i&b)
					cout<<'+';
				else
					cout<<'-';
				b<<=1;
			}
			break;
		}
	}
	cout<<"=7\n";
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int c;
	cin>>c;
	repr(i,4){
		a[i]=c%10;
		c/=10;
	}
		solve();
	return 0;
}


Measured memory_bytes: 256
import java.io.*;
 
class Main {
    public static void main(String[] arg)throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String str = br.readLine();
        String[] div = str.split(" ");
        int s =  Integer.parseInt(div[0]);
        int l =  Integer.parseInt(div[1]);
        System.out.println(s*l + " "+ 2*(s+l));
    }   
}

Measured memory_bytes: 16896
/*
これを入れて実行
g++ code.cpp
./a.out
 */
 
#include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include <cstring>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>
#include <bitset>
#include <functional>

#define all(x) (x).begin(),(x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
using namespace std;
typedef long long ll;
typedef long double ld;
 
int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
 
const long long INF = 1LL << 62;
const ll MOD = 1e9 + 7;
 
bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}
 
ll gcd(ll a, ll b){
	if (b == 0)return a;
	return gcd(b, a % b);
}
 
ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}

ll conbinationMemo[100][100];

void cmemoInit(){
    rep(i, 100){
        rep(j, 100){
            conbinationMemo[i][j] = -1;
        }
    }
}
 
ll nCr(ll n, ll r){
    if(conbinationMemo[n][r] != -1) return conbinationMemo[n][r];
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return conbinationMemo[n][r] = (nCr(n - 1, r) + nCr(n - 1, r - 1));
}
 
ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}
//-----------------------ここから-----------
int main(void){
    ll n, m;
    cin >> n >> m;

    int now = m;
    vector<bool> used(n + 1, false);
    for(int i = 1; i <= n; i++){
        if(used[i + now]) break;
        cout << i << " " << i + now << endl;
        used[i] = true;
        used[i + now] = true;
        now -= 2;
        if(now < 1) break;
    }
    now = m - 1;
    for(int i = m + 2; i <= n; i++){
        if(now < 1) break;
        if(used[i + now]) break;
        cout << i << " " << i + now << endl;
        used[i] = true;
        used[i + now] = true;
        now -= 2;
    }
}


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

#define int long long
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define REP(i, n) for (int i = 0; i < n; ++i)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x) cout << #x << " = " << (x) << endl;
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define SP << " " <<

typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
typedef vector<int> vec;
typedef vector<P> pvec;
typedef vector<vector<int>> vvec;
typedef vector<vector<P>> pvvec;
typedef priority_queue<int> PQI;
typedef priority_queue<P> PQP;
typedef priority_queue<int,vector<int>,greater<int>> PQIG;
typedef priority_queue<P,vector<P>,greater<P>> PQPG;

const vector<int> DX = {0, -1, 0, 1, 1, 1, -1, -1};
const vector<int> DY = {1, 0, -1, 0, 1, -1, 1, -1};
constexpr int MOD = (1000000007);
// const int MOD = (998244353);
// const int INF = (1 << 30); // 1073741824
const ll INF = (1LL << 60); // 1152921504606846976
const double PI = (3.141592653589794);
const double EPS = (0.0000000001); // 10^(-10)

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return 1;} return 0;}
template<class T> inline T ceil(T a, T b) {return T((a + b - 1) / b);}
template<class T> inline T round(T a, T b) {return T(a / b);}
template< typename T1, typename T2 > istream &operator>>(istream &is, pair< T1, T2 > &p) { is >> p.first >> p.second; return is; }
template <class T> inline void out(T &a) { bool flag=true; for(auto&x:a){if(flag) {flag=false;} else{ cout << ' '; } cout<<x; } cout << endl; }



//----------------------------------------------------------------
int nmax=200000; // 2*(10^5)
vvec G(nmax);





void solve4ts()
{
  
  int k;
  cin>>k;
  int x=7;
  rep(i,100000000){
    x%=k;
    if(x==0){
      cout<<i+1<<endl;
      return;
    }
    x=x*10+7;
  }
  cout<<-1<<endl;
}
//-----------------------------------------------------------------

signed main(){ ios::sync_with_stdio(false); cin.tie(0); cout << fixed << setprecision(15);
    int repeat = 1;
    // cin >> repeat;
    while(repeat--) solve4ts();
}

/*

g++ -std=c++1z code.cpp
./a.out

*/

Measured memory_bytes: 7816
using System;
using System.Collections.Generic;
using System.Linq;

namespace AizuOnlineJudge {
    class Program {
        static void Main() {
            var nq = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var queue = Enumerable.Range(0, nq[0]).Select(_ => new Queue<string>()).ToArray();
            for (var i = 0; i < nq[1]; ++i) {
                var query = Console.ReadLine().Split();
                var index = int.Parse(query[1]);
                switch (query[0]) {
                    case "0":
                        queue[index].Enqueue(query[2]);
                        break;

                    case "1":
                        if (queue[index].Any()) {
                            Console.WriteLine(queue[index].Peek());
                        }
                        break;

                    case "2":
                        if (queue[index].Any()) {
                            queue[index].Dequeue();
                        }
                        break;
                }
            }
        }
    }
}



Measured memory_bytes: 31608
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stdio.h>
#include <cstring>
#include <queue>
#include <stack>
#include <functional>
#include <math.h>
#include <iomanip>
using namespace std;
#define Would
#define you
const int INF = 999999999;
const int MOD = 1e9 + 7;
const double pi = 3.141592653589793238;

long long n, k[100005], ans, cou, cou2;
int main() {
	cin >> n;
	for (int i = 0; i < n; ++i) { cin >> k[i]; }
	//[0]=minus
	for (int i = 0; i < n; ++i) {
		ans += k[i];
		if (i % 2 == 0 && ans <= 0) {
			cou += 1 - ans;
			ans = 1;
		}
		if (i % 2 == 1 && ans >= 0) {
			cou += ans + 1;
			ans = -1;
		}
	}
	ans = 0;
	//[0]=plus
	for (int i = 0; i < n; ++i) {
		ans += k[i];
		if (i % 2 == 1 && ans <= 0) {
			cou2 += 1 - ans;
			ans = 1;
		}
		if (i % 2 == 0 && ans >= 0) {
			cou2 += ans + 1;
			ans = -1;
		}
	}
	cout << min(cou, cou2) << endl;
}

Measured memory_bytes: 1024
#include <string>
#include <iostream>

int main() {
    std::string N;
    std::cin >> N;
    for (auto c : N) {
        if (c == '7') {
            std::cout << "Yes" << std::endl;
            return 0;
        }
    }
    std::cout << "No" << std::endl;
}


Measured memory_bytes: 3128
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <vector>
#include <math.h>
#include <queue>
#include <deque>
#include <stack>
#include <map>
const int MOD = 1e9+7;
const int MOOD = 998244353;
#define PI 3.14159265359
typedef long long ll;
using namespace std;


int main(){
	int x;
	cin >> x;
	for (int i = 1; ; i++){
		if (i*x % 360 == 0){
			cout << i << endl;
			return 0;
		}
	}
	return 0;
}



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

int main() {
  string S;
  cin >> S;
  bool A[26] = {false};
  for (int i = 0; i < S.size(); i++) {
    A[S[i] - 'a'] = true;
  }
  for (int i = 0; i < 26; i++) {
    if(A[i] == false) {
      char ans = i + 'a';
      cout << ans << endl;
      return 0;
    }
  }
  cout << "None" << endl;
return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<functional>
#include<map>
#include<cstdlib>
#include<complex>
#include<numeric>
#include<set>
#include<deque>
#include<queue>

using namespace std;
using Int = long long;
Int INF = 1LL << 60;
const Int MOD = 1000000000 + 7;

template<int Modulo = MOD> struct Mint {
	Int val;
	constexpr Mint(Int v = 0) noexcept : val(v% Modulo) {
		if (val < 0) v += Modulo;
	}
	constexpr int getmod() { return Modulo; }
	constexpr Mint operator - () const noexcept { return val ? Modulo - val : 0; }
	constexpr Mint operator + (const Mint& r) const noexcept { return Mint(*this) += r; }
	constexpr Mint operator - (const Mint& r) const noexcept { return Mint(*this) -= r; }
	constexpr Mint operator * (const Mint& r) const noexcept { return Mint(*this) *= r; }
	constexpr Mint operator / (const Mint& r) const noexcept { return Mint(*this) /= r; }
	constexpr Mint& operator += (const Mint& r) noexcept {
		val += r.val;
		if (val >= Modulo) val -= Modulo;
		return *this;
	}
	constexpr Mint& operator -= (const Mint& r) noexcept {
		val -= r.val;
		if (val < 0) val += Modulo;
		return *this;
	}
	constexpr Mint& operator *= (const Mint& r) noexcept {
		val = val * r.val % Modulo;
		return *this;
	}
	constexpr Mint& operator /= (const Mint& r) noexcept {
		Int a = r.val, b = Modulo, u = 1, v = 0;
		while (b) {
			Int t = a / b;
			a -= t * b; swap(a, b);
			u -= t * v; swap(u, v);
		}
		val = val * u % Modulo;
		if (val < 0) val += Modulo;
		return *this;
	}
	constexpr bool operator == (const Mint& r) const noexcept {
		return this->val == r.val;
	}
	constexpr bool operator != (const Mint& r) const noexcept {
		return this->val != r.val;
	}
	friend ostream& operator << (ostream& os, const Mint<Modulo>& x) noexcept {
		return os << x.val;
	}
	friend istream& operator >> (istream& is, Mint<Modulo>& x) noexcept {
		Int tmp; is >> tmp;
		x = Mint<Modulo>(tmp);
		return is;
	}
	friend constexpr Mint<Modulo> modpow(const Mint<Modulo>& a, Int n) noexcept {
		Mint res(1), tmp = a;
		while (n > 0) {
			if (n & 1) res *= tmp;
			tmp *= tmp;
			n >>= 1;
		}
		return res;
	}
};

using mint = Mint<>;

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

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	Int N, M;
	cin >> N >> M;

	vector<Int> a(M);
	vector<Int> c(M);

	Int temp, b;
	for (Int i = 0; i < M; i++) {
		cin >> a[i] >> b;
		for (Int j = 0; j < b; j++) {
			cin >> temp;
			temp--;
			c[i] += (1LL << temp);
		}
	}

	vector<vector<Int>> dp(M + 1, vector<Int>(1 << N, INF));
	dp[0][0] = 0;


	for (Int i = 0; i < M; i++) {
		for (Int j = 0; j < (1LL<<N); j++) {
			//鍵をとらない
			chmin(dp[i + 1][j], dp[i][j]);
			//i番目の鍵を取る
			chmin(dp[i + 1][j|c[i]], dp[i][j] + a[i]);
		}
	}

	if (dp[M][(1 << N) - 1] == INF)cout << -1 << "\n";
	else	cout << dp[M][(1 << N) - 1] << "\n";
}

Measured memory_bytes: 32384
#include <bits/stdc++.h>
using namespace std;
int A,B,C,D;
int main() {
  cin >> A >> B >> C >> D;
  if(A+B > C+D){
    cout << "Left" << endl;
  }
  else if(A+B < C+D){
    cout << "Right" << endl;
  }
  else
    cout << "Balanced"<< endl;
}

Measured memory_bytes: 256
// Problem : F - Pond Skater
// Contest : AtCoder - AtCoder Beginner Contest 170
// URL : https://atcoder.jp/contests/abc170/tasks/abc170_f
// Memory Limit : 1024 MB
// Time Limit : 3000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#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 int long long
#define db double
#define mod 1000000007
#define pb insert_back
#define pp pair<int,int>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repe(i,a,b) for(int i=a;i<=b;i++)
#define repr(i,a,b) for(int i=b;i>=a;i--)
#define maxn 200005
#define ss second
#define ff first
#define all(a) a.begin(),a.end()
#define lb lower_bound
#define ub upper_bound
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
int inv(int a, int b){
 return 1<a ? b - inv(b%a,a)*b/a : 1;
}
int X[]={1,-1,0,0};
int Y[]={0,0,1,-1};
int n,m;
bool check(int x,int y)
{
	if(x>=0 and y >=0 and x<n and y < m)
	return true;
	return false;
}
void solve()
{
	int k;
	cin >> n >> m >> k;
	string s[n];
	int dist[n][m];
	int x1,x2,y1,y2;
	cin >> x1 >> y1 >> x2 >> y2;
	x1--,y1--,x2--,y2--;
	rep(i,0,n)
		cin >> s[i];
	set<pair<int,pair<int,int> > > q; 
	//cout << INT_MAX <<" ";
	rep(i,0,n)
	{
		rep(j,0,m)
		dist[i][j]=INT_MAX;
	}
	dist[x1][y1]=0;
	q.insert({0,{x1,y1}});
	while(q.size())
	{
		int x = q.begin()->ss.ff;
		int y = q.begin()->ss.ss;
		q.erase(q.begin());
		rep(i,0,4)
		{
			int l = x,r=y;
			rep(j,0,k)
			{
				l+=X[i];
				r+=Y[i];
				if(check(l,r)==false || dist[l][r] <= dist[x][y] || s[l][r]=='@')
				break;
				dist[l][r]=dist[x][y]+1;
				q.insert({dist[l][r],{l,r}});
				//cout << l <<" "<< r <<"\n";
			}
		}
	}
	
	if(dist[x2][y2] == INT_MAX)
	cout << -1;
	else
	cout << dist[x2][y2] ;	
}
signed main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t=1;
    //cin >> t;
    while(t--)
    solve();
    return 0;
}


Measured memory_bytes: 20144
fun main(args: Array<String>) {
    var input = readLine()!!
    val n = input.split(" ")[0].toInt()
    val k = input.split(" ")[1].toInt()
    val s = readLine()!!

    for (i in 0..(n-1)){
        if (i == k-1) print(s[i].toLowerCase())
        else print(s[i])
    }
}

Measured memory_bytes: 35952
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <string>
#include <bitset>
#include <cstring>
#include <map>
#include <math.h>
#include <queue>
#include <set>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i,n) for (int i = 0; i < n; i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define fi first
#define se second
#define pb push_back
#define mp make_pair
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; }
const int INF = 1<<30;
const ll LINF = 1LL<<58;
const ll mod = 1000000007;

int main(){
    int n;
    cin >> n;
    vector<int> V(n);
    rep(i,n) cin >> V[i];
    sort(rall(V));
    double ans = 0;
    rep(i,n){
        if (i!=n-1)ans += V[i] / pow(2,i+1);
        if (i==n-1) ans += V[i] / pow(2,i);
    }
    cout << fixed << setprecision(10) << ans << endl;
    return 0;
}


Measured memory_bytes: 256
n = int(input())
cha = "abcdefghijklmnopqrstuvwxyz"
ans = []
while n >= 1:
    mod = (n - 1) % 26
    ans.append(mod)
    n = (n - 1) // 26
    
ans_s = ''
for tmp in reversed(ans):
    ans_s += cha[tmp]
print(ans_s)

Measured memory_bytes: 9204
#include<bits/stdc++.h>
using namespace std;
const int INF = 1e9;
int main()
{
    int n, k, s; scanf("%d%d%d", &n, &k, &s);
    for (int i = 1; i <= k; i++) printf("%d ", s);
    for (int i = k + 1; i <= n; i++) printf("%d%c", s == INF ? INF - 1 : INF, " \n"[i == n]);
    return 0;
}

Measured memory_bytes: 1280
#include "bits/stdc++.h"
using namespace std;
#define int long long
#define FOR(i, a, b) for(int i=(a);i<(b);i++)
#define RFOR(i, a, b) for(int i=(b-1);i>=(a);i--)
#define REP(i, n) for(int i=0; i<(n); i++)
#define RREP(i, n) for(int i=(n-1); i>=0; i--)
#define REP1(i, n) for(int i=1; i<=(n); i++)
#define RREP1(i, n) for(int i=(n); i>=1; i--)
#define ALL(a) (a).begin(),(a).end()
#define UNIQUE_SORT(l) sort(ALL(l)); l.erase(unique(ALL(l)), l.end());
#define CONTAIN(a, b) find(ALL(a), (b)) != (a).end()
#define out(...) printf(__VA_ARGS__)
#if DEBUG
#define debug(...) printf(__VA_ARGS__)
#else
#define debug(...) /* ... */
#endif
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return true;}return false;}

void solve();
signed main()
{
#if DEBUG
    std::ifstream in("input.txt");
    std::cin.rdbuf(in.rdbuf());
#endif
    cin.tie(0);
    ios::sync_with_stdio(false);
    solve();
    return 0;
}
/*================================*/
#if DEBUG
#define SIZE 100
#else
#define SIZE 223450
#endif

int N,Q,K;
int A[SIZE];

const int MAX = 5e5;
const int MOD = 1e9+7;

long long fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    if (!fac[n]) COMinit();
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int P(int n, int k) {
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    if (!fac[n]) COMinit();
    return (fac[n] * finv[n-k]) % MOD;
}

struct Item {
    int x,y,p;
};
vector<Item> V;

int MI[2][15][1LL<<15];

int calc(int i, int j) {
    // コスト
    int ret = 0;
    REP(k,N) {
        ret += min(MI[0][k][i], MI[1][k][j]);
    }
    return ret;
}

void solve() {
    cin>>N;
    V.resize(N);
    REP(i,N) {
        cin>>V[i].x>>V[i].y>>V[i].p;
    }
    REP(b,1LL<<N) {
        REP(i,N) {
            {
                // x
                int mi = abs(V[i].x);
                REP(j,N) if(b>>j&1) {
                    chmin(mi, abs(V[i].x-V[j].x));
                }
                MI[0][i][b] = mi*V[i].p;
            }
            {
                // y
                int mi = abs(V[i].y);
                REP(j,N) if(b>>j&1) {
                    chmin(mi, abs(V[i].y-V[j].y));
                }
                MI[1][i][b] = mi*V[i].p;
            }
        }
    }
    vector<int> ans(N+1,LONG_LONG_MAX/2);
    REP(i,1LL<<N) {
        int b = __builtin_popcount(i);
        int ret = calc(i,0);
        for (int j=i; j>0; j=(j-1)&i) {
            chmin(ret, calc(i^j,j));
        }
        chmin(ans[b], ret);
    }
    
    REP(i,N+1) {
        cout << ans[i] << endl;
    }
}



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

using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using ll = long long int;
using vll = vector<ll>; using vvll = vector<vll>; using vvvll = vector<vvll>;
using vd = vector<double>; using vvd = vector<vd>; using vvvd = vector<vvd>;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
using cdouble = complex<double>;

const double eps = 1e-7;
#define Loop(i, n) for(int i = 0; i < int(n); i++)
#define Loopll(i, n) for(ll i = 0; i < ll(n); i++)
#define Loop1(i, n) for(int i = 1; i <= int(n); i++)
#define Loopll1(i, n) for(ll i = 1; i <= ll(n); i++)
#define Loopr(i, n) for(int i = int(n) - 1; i >= 0; i--)
#define Looprll(i, n) for(ll i = ll(n) - 1; i >= 0; i--)
#define Loopr1(i, n) for(int i = int(n); i >= 1; i--)
#define Looprll1(i, n) for(ll i = ll(n); i >= 1; i--)
#define Foreach(buf, container) for(const auto &buf : container)
#define Loopdiag(i, j, h, w, sum) for(int i = ((sum) >= (h) ? (h) - 1 : (sum)), j = (sum) - i; i >= 0 && j < (w); i--, j++)
#define Loopdiagr(i, j, h, w, sum) for(int j = ((sum) >= (w) ? (w) - 1 : (sum)), i = (sum) - j; j >= 0 && i < (h); j--, i++)
#define Loopdiagsym(i, j, h, w, gap) for (int i = ((gap) >= 0 ? (gap) : 0), j = i - (gap); i < (h) && j < (w); i++, j++)
#define Loopdiagsymr(i, j, h, w, gap) for (int i = ((gap) > (h) - (w) - 1 ? (h) - 1 : (w) - 1 + (gap)), j = i - (gap); i >= 0 && j >= 0; i--, j--)
#define Loopitr(itr, container) for(auto itr = container.begin(); itr != container.end(); itr++)
#define printv(vector) Loop(ex_i, vector.size()) { cout << vector[ex_i] << " "; } cout << endl;
#define printmx(matrix) Loop(ex_i, matrix.size()) { Loop(ex_j, matrix[ex_i].size()) { cout << matrix[ex_i][ex_j] << " "; } cout << endl; }
#define quickio() ios::sync_with_stdio(false); cin.tie(0);
#define bitmanip(m,val) static_cast<bitset<(int)m>>(val)
#define Comp(type_t) bool operator<(const type_t &another) const
#define fst first
#define snd second
#define INF INFINITY
bool feq(double x, double y) { return abs(x - y) <= eps; }
bool inrange(ll x, ll t) { return x >= 0 && x < t; }
bool inrange(vll xs, ll t) { Foreach(x, xs) if (!(x >= 0 && x < t)) return false; return true; }
int ceillog2(ll x) { int ret = 0;	x--; while (x > 0) { ret++; x >>= 1; } return ret; }
ll rndf(double x) { return (ll)(x + (x >= 0 ? 0.5 : -0.5)); }
ll floorsqrt(ll x) { ll m = (ll)sqrt((double)x); return m + (m * m <= x ? 0 : -1); }
ll ceilsqrt(ll x) { ll m = (ll)sqrt((double)x); return m + (x <= m * m ? 0 : 1); }
ll rnddiv(ll a, ll b) { return (a / b + (a % b * 2 >= b ? 1 : 0)); }
ll ceildiv(ll a, ll b) { return (a / b + (a % b == 0 ? 0 : 1)); }
ll gcd(ll m, ll n) { if (n == 0) return m; else return gcd(n, m % n); }
ll lcm(ll m, ll n) { return m * n / gcd(m, n); }

//========================================================================//

int main() {
	int n; cin >> n;
	vll a(n); Loop(i, n) cin >> a[i];
	vll sum(n);
	Loop(i, n) {
		if (i == 0) sum[i] = a[i];
		else sum[i] = sum[i - 1] + a[i];
	}
	ll ans = LLONG_MAX;
	Loop(i, n - 1) {
		ll x = sum[i];
		ll y = sum[n - 1] - sum[i];
		ans = min(ans, abs(x - y));
	}
	cout << ans << endl;
}

Measured memory_bytes: 3456
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    int d, x;
    cin >> d >> x;
    for(int i=0; i<n; i++){
        cin >> a.at(i);
    }
    int ans=x;
    for(int i=0; i<n; i++){
        int tmp1;
        tmp1 = (d-1)/a.at(i) + 1;
        ans += tmp1;
    }
    cout << ans << endl;
}




Measured memory_bytes: 256
import math
a, b, h, m = map(int, input().split())
dh = (30 * h) + ((30 * m) / 60)
dm = (6 * m)
diff = abs(dh - dm)
d2 = (a ** 2) + (b ** 2) - (2 * a * b * math.cos((diff / 180) * math.pi))
d = (d2 ** 0.5)
print(d)


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

int main()
{
	int W, H, x, y, r;
	cin >> W >> H >> x >> y >> r;
	if (((x + r) <= W)&((x - r) >= 0)&((y - r) >= 0)&(y + r) <= H)
	{
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}
}

Measured memory_bytes: 3072
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long

int32_t main()
{
	IOS;
	vector<int> v;
	int a, b;
	cin >> a >> b;
	v.push_back(a);
	v.push_back(b);
	int ans = 0;
	for(int i = 1; i <= 2; i++)
	{
		sort(v.begin(), v.end());
		ans += v.back();	
		v[1] -= 1;
	}
	cout << ans;
	return 0;
}

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

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

  for( int i = 1; i <= n; i++ ) {
    if( i % 3 == 0 ) {
      cout << " " << i;
    }
    else {
      string buf = to_string( i );
      if( buf.find( "3" ) != string::npos) {
        cout << " " << i;
      }
    }
  }
  cout << endl;

  return 0;
}

Measured memory_bytes: 3272
#include <iostream>
#include <math.h>
#include <algorithm>
#include <vector>
#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 INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;

int main(void){
    int N, T, A, H;
    
    cin >> N >> T >> A;
    //vector<int> H(N);
    vector<double> x(N);

    
    // 気温Aに近い地点 i番目
    REP(i,N) {
        cin >> H;
        double d = A - (T - H * 0.006);
        x[i] = fabs(d);
        //cout << x[i] << endl;
    }
    std::vector<double>::iterator iter = std::min_element(x.begin(), x.end());
    size_t index = std::distance(x.begin(), iter);
    //sort(ALL(x));

    cout << index + 1 << endl;

    return 0;
}

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

#define lint long long
#define P pair<int, int>
#define LLP pair<long long, long long>
#define REP(i, x, n) for(int i = (x), i##_len = (int)(n) ; i < i##_len ; ++i)
#define rep(i, n) for(int i = 0, i##_len = (int)(n) ; i < i##_len ; ++i)
#define repr(i, n) for(int i = (int)(n) - 1 ; i >= 0 ; --i)
#define SORT(x) sort((x).begin(), (x).end())

const int IINF = 1e9 + 10;
const long long LLINF = (long long)1e18 + 10;
const long long MOD = (long long)1e9 + 7;
const int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
const int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};
const double EPS = 1e-8;

int main(){
    int n, h, w;
    cin >> n >> h >> w;
    int ans = (n - h + 1) * (n - w + 1);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = ll(A); I < ll(B); ++I)
#define FORR(I,A,B) for(ll I = ll((B)-1); I >= ll(A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //xi>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //xi>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd_(ll a,ll b){if(a%b==0)return b;return gcd_(b,a%b);}
ll lcm_(ll a,ll b){ll c=gcd_(a,b);return ((a/c)*(b/c)*c);}
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=ll(1e16)+ll(7);
const ll MOD=1000000007LL;
#define out(a) cout<<fixed<<setprecision((a))
//tie(a,b,c) = make_tuple(10,9,87);
#define pop_(a) __builtin_popcount((a))
ll keta(ll a){ll r=0;while(a){a/=10;r++;}return r;}




int main(){

	ll N;
	cin >> N;
	ll ans = 0;
	FOR(i,0,N){
		ans += (N-i)*(i+1);
	}
	FOR(i,0,N-1){
		ll a,b;
		cin >> a >> b;
		if(a<b)swap(a,b);
		ans -= b*(N-a+1);
	}
	cout << ans << endl;
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define vvi vector< vector<int> >
#define vi vector<int>
#define All(X) X.begin(),X.end()
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define pii pair<int,int>
#define mp make_pair
#define shosu(X) fixed << setprecision(X)
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
 
int main(){
  int n;
  cin >> n;
  string s = to_string(n);
  ll int ans = 0;
  for(int i = 1; i <= s.size(); i++){
    if(i%2==0) continue;
    if(i != s.size()){
      ans += ((pow(10, i) - 1) - (pow(10, i - 1) ) + 1);
    }else{
      ans += (n - pow(10, i - 1) + 1);
    }
  }
  cout << ans << endl;  
}

Measured memory_bytes: 256
{-# LANGUAGE BangPatterns #-}
import           Data.List

main=readLn >>= print.solve

solve :: Int -> Int
solve 1 = 1
solve n = foldl1'(\acc x->acc*x`mod`modulus).map (succ.length).group.sort $ concatMap primeFactors [2..n]

modulus :: Int
modulus = 1000000007

smallPrimes :: [Int]
smallPrimes = 2 : [ n | n<-[3,5..46337], all ((>0).rem n) $ takeWhile (\x->x*x<=n) smallPrimes]

primeFactors :: Int -> [Int]
primeFactors n | n < 2 = []
primeFactors n = go n smallPrimes
  where
    go !n pps@(p:ps)
        | n < p * p = [n|n>1]
        | r > 0     = go n ps
        | otherwise = p : go q pps
      where
        (q, r) = quotRem n p
    go n [] = [n]

Measured memory_bytes: 1276
n, k = list(map(int, input().split(" ")))
price = list(map(int, input().split(" ")))
minimum = 0
for i in range(n):
    swap = False
    for j in range(0, n-i-1):
        if price[j]>price[j+1]:
            price[j], price[j+1] = price[j+1], price[j]
            swap = True
    if swap == False:
        break
        
for i in range(k):
    minimum += price[i]
print(minimum)
        

Measured memory_bytes: 9128
#include <bits/stdc++.h>
#include <atcoder/fenwicktree>

#ifdef DEBUG
#include <Mylib/Debug/debug.cpp>
#else
#define dump(...) ((void)0)
#endif

template <typename T, typename U>
bool chmin(T &a, const U &b){
  return (a > b ? a = b, true : false);
}

template <typename T, typename U>
bool chmax(T &a, const U &b){
  return (a < b ? a = b, true : false);
}

template <typename T, size_t N, typename U>
void fill_array(T (&a)[N], const U &v){
  std::fill((U*)a, (U*)(a + N), v);
}

template <typename T, size_t N, size_t I = N>
auto make_vector(const std::array<int, N> &a, T value = T()){
  static_assert(I >= 1);
  static_assert(N >= 1);
  if constexpr (I == 1){
    return std::vector<T>(a[N - I], value);
  }else{
    return std::vector(a[N - I], make_vector<T, N, I - 1>(a, value));
  }
}

template <typename T>
std::ostream& operator<<(std::ostream &s, const std::vector<T> &a){
  for(auto it = a.begin(); it != a.end(); ++it){
    if(it != a.begin()) s << " ";
    s << *it;
  }
  return s;
}

template <typename T>
std::istream& operator>>(std::istream &s, std::vector<T> &a){
  for(auto &x : a) s >> x;
  return s;
}



namespace solver {
  namespace ac = atcoder;
  
  void init(){
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(12);
    std::cerr << std::fixed << std::setprecision(12);
    std::cin.exceptions(std::ios_base::failbit);
  }

  void solve(){
    int N, Q; std::cin >> N >> Q;

    auto s = ac::fenwick_tree<int64_t>(N);

    std::vector<int64_t> a(N);
    for(int i = 0; i < N; ++i){
      std::cin >> a[i];
      s.add(i, a[i]);
    }

    for(int i = 0; i < Q; ++i){
      int type; std::cin >> type;
      if(type == 0){
        int p, x; std::cin >> p >> x;
        s.add(p, x);
      }else{
        int l, r; std::cin >> l >> r;
        std::cout << s.sum(l, r) << "\n";
      }
    }
  }
}

int main(){
  solver::init();
  while(true){
    try{
      solver::solve();
    }catch(const std::istream::failure &e){
      break;
    }
  }
  return 0;
}


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

#define rep(i,n) for(int i = 0; i < n; i++)
#define REP(i,n) for(int i = 1; i < n; i++)
#define repll(i,n) for(ll i = 0; i < n; i++)
#define REPll(i,n) for(ll i = 1; i < n; i++)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define yesorno(a) printf(a ? "yes\n" : "no\n")
#define YesorNo(a) printf(a ? "Yes\n" : "No\n")
#define YESorNO(a) printf(a ? "YES\n" : "NO\n") 
#define endl "\n"
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vii = vector<vi>;
using vl = vector<ll>;
using vll = vector<vl>;
const int dx[] = {0,1,0,-1,1,1,-1,-1};
const int dy[] = {1,0,-1,0,1,-1,-1,1};
const int inf = (1<<30)-1;
const ll infll = (1LL<<62)-1;
ll ceil(const ll a, const ll b){return ((a)+(b)-1)/b;}


signed main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);

  ll n, m;
  cin >> n >> m;
  m /= 2;
  ll ans = min(m, (n+m)/2);
  cout << ans << endl;
}

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

int main (){
    int a,b,sum;
    cin>>a;
    cin>>b;
    sum = a+b;
    if(a<=8 && b<=8){
        cout<<"Yay!"<<endl;
    }else{
        cout<<":("<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define turbo cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(0);
#define ll long long
#define pii pair<int,int>
#define f first
#define pb push_back
#define mp make_pair
#define inf 999999999999999

using namespace std;

ll tab[100005];

int main(){
    turbo
    ll n,w,k,v;
    cin >> n >> w;
    tab[0]=1;
    for(ll i=1;i<=n;i++){
      cin >> k >> v;
      for(ll j=w;j>=1;j--){
        if(j-k>=0){
          if(tab[j-k]>0){
            tab[j]=max(tab[j],tab[j-k]+v);
          }
        }
      }
    }
    ll maxi = 0;
    for(ll i=0;i<=w;i++){
      maxi = max(maxi,tab[i]);
    }
    cout << maxi-1 << "\n";
    return 0;
}


Measured memory_bytes: 1024
#![allow(unused, non_snake_case, dead_code, non_upper_case_globals)]
use std::cmp::*;
use std::collections::*;
static MOD: i64 = 1000000007;

fn main() {
    let (r, w, e) = (std::io::stdin(), std::io::stdout(), std::io::stderr());
    let mut io = IO::new(r.lock(), w.lock(), e.lock());

    let N = io.chars();
    let K: usize = io.read();
    let mut dp = vec![vec![vec![0; 2]; 6]; 110];
    // keta: countK : tight
    dp[0][0][1] = 1;

    for keta in 0..N.len() {
        let now = N[keta] as u8 - b'0';
        for cntk in 0..K + 1 {
            for tight in 0..2 {
                let upper = if tight == 1 { now } else { 9 };
                for ad in 0..upper + 1 {
                    dp[keta + 1][cntk + if ad == 0 { 0 } else { 1 }]
                        [if (tight == 1) && (ad == upper) { 1 } else { 0 }] +=
                        dp[keta][cntk][tight];
                }
            }
        }
    }
    io.writeln(dp[N.len()][K][0] + dp[N.len()][K][1]);
}

// IO
use std::io::*;
struct IO<R: Read, W: Write, E: Write> {
    Read: R,
    Write: BufWriter<W>,
    Error: BufWriter<E>,
}
impl<R: Read, W: Write, E: Write> IO<R, W, E> {
    fn new(r: R, w: W, e: E) -> IO<R, W, E> {
        IO {
            Read: r,
            Write: BufWriter::new(w),
            Error: BufWriter::new(e),
        }
    }
    fn read<T>(&mut self) -> T
    where
        T: std::str::FromStr,
    {
        let next: String = self
            .Read
            .by_ref()
            .bytes()
            .map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect();
        next.parse().ok().unwrap()
    }
    fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
    fn readn<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read::<T>()).collect::<Vec<_>>()
    }
    fn readmat<T: std::str::FromStr>(&mut self, n: usize, m: usize) -> Vec<Vec<T>> {
        (0..n).map(|_| self.readn(m)).collect()
    }
    fn write<S: ToString>(&mut self, val: S) {
        self.Write.write(val.to_string().as_bytes());
    }
    fn writeln<S: ToString>(&mut self, val: S) {
        self.Write.write(val.to_string().as_bytes());
        self.Write.write(b"\n");
    }
    fn debug<S: std::fmt::Debug>(&mut self, val: S) {
        writeln!(self.Error, "(debug) {:?}", &val);
    }
    fn debug2<S: std::fmt::Debug, T: std::fmt::Debug>(&mut self, val1: S, val2: T) {
        writeln!(self.Error, "(debug2) {:?} -> {:?}", val1, val2);
    }
    fn debug3<S: std::fmt::Debug, T: std::fmt::Debug, U: std::fmt::Debug>(
        &mut self,
        val1: S,
        val2: T,
        val3: U,
    ) {
        writeln!(
            self.Error,
            "(debug3) {:?} -> {:?} -> {:?}",
            val1, val2, val3
        );
    }
}


Measured memory_bytes: 4352
#include <iostream>
#include <string>
using namespace std;
int main(int argc, char* argv[])
{
	int N,K;
	string S;
	cin>>N;
	cin>>S;
	cin>>K;
	int i;
	char ch=S[K-1];
	for (i=0;i<S.size();i++){
		if (S[i]!=ch){
			S[i]='*';
		}
	}
	cout<<S<<endl;
	return 0;
}

Measured memory_bytes: 256