akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
int main()
{
    long long int n,sum=0,T,max,min;
int i;
    scanf("%lld",&T);
    for (i=1; i<=T; i++)
    {
        scanf("%lld ",&n);
        if(i==1)
            max=min=n;
        if(max<n)
            max=n;
        else if(min>n)
            min=n;
        sum=sum+n;
    }
    printf("%d %d %lld\n",min,max,sum);
    return 0;
}


Measured memory_bytes: 2128
N, M, X = gets.chomp.split.map(&:to_i)

A = []
C = []

N.times do |i|
  c, *a = gets.chomp.split.map(&:to_i)
  C << c
  A << a
end

def satisfied?(book_numbers)
  M.times do |j|
    return false if book_numbers.sum {|i| A[i][j] } < X
  end

  true
end

cost = Float::INFINITY

BOOK_NUMBERS = (0..(N-1)).to_a

(1..N).each do |c|
  BOOK_NUMBERS.combination(c) do |book_numbers|
    if satisfied?(book_numbers)
      c = book_numbers.sum {|i| C[i] }
      cost = c if c < cost
    end
  end
end

if cost.infinite?
  puts(-1)
else
  puts cost
end


Measured memory_bytes: 14424
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <deque>
#include <list>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>

using namespace std;


#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repr(i,n) for(int (i)=(n); (i)>=(0); (i)--)
#define SIZE(x) ((int)(x).size())
#define GCD(a, b) int gcd(int a,int b){return b?gcd(b,a%b):a;}
#define QP(a, b) int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define all(v) (v).begin(),(v).end()


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);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
template<typename A, size_t N, typename T>
void FILL(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

typedef vector<int, int> vint;
typedef pair<int,int> pint;
typedef vector<pint>vpint;
typedef long long ll;

int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1LL << 60;
const ll MOD = 1000000007LL;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S; cin >> S;
    rep(i, 'z'-'a' + 1){
        if(count(all(S), 'a'+i) == 0){
            cout << char('a'+i) << endl;
            return 0;
        }
    }
    cout << "None";
    cout << endl;
    return 0;
}




Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main() {
    int k;
    cin>>k;
    string s;
    cin>>s;
    if(s.size()>k)
    {
        cout<<s.substr(0,k)<<"..."<<endl;
    }
    else
    {
        cout<<s<<endl;
    }
    return 0;
}

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

int main()
{
	int a,b,c,sum=0;
	char s[100];
    cin>>a;
    if(a==1)
        cout<<"Hello World"<<endl;
    else
    {
        cin>>b;
        cin>>c;
        cout<<b+c<<endl;
    }
	
	return 0;
}
	

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<set>
#include<map>
#include<algorithm>
#include<queue>
#include<list>
#include<stack>
#include<cstdio>
#include<fstream>
#include<numeric>
#include<functional>
#include<utility>
#include<memory>
#include<cstring>
#include<bits/stdc++.h>
using namespace std; 
  
#define CLEAN(a,b) memset(a,b,sizeof(a))
#define mp make_pair
#define pb push_back
#define rept(i,a,b) for(int i=(int)(a);i<(int)(b);i++)

typedef long long ll;
typedef pair<int, int> pii;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll,pair<ll, ll> > P3;
const ll MOD = ll(1e9 + 7);
const ll LLINF = LLONG_MAX;
const int IINF = INT_MAX;
const int MAX_N = int(2e5) + 5;
const int MAX_V = 100005;
const double EPS = 1e-8;
int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
#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++)
int n;
ll a[MAX_N]{};
 
int main() {
    cin >> n;
    REP(i,n){
        cin >> a[i+1];
        a[i+1] += a[i];
    }
    int li = 1, ri = 3;
    ll ans = LLINF;
    for(int i = 2; i < n-1;i++){
        ll lsum = a[i], rsum = a[n]-a[i];
        ll p=a[li],q=lsum-a[li] ,r = a[ri]-a[i],s = rsum-a[ri]+a[i];
        while(li<i-1 && abs(lsum - a[li+1]*2) < abs(p-q)){
            li++;
            p = a[li];
            q = lsum - p;
        }
        while(ri<n-1 && abs(rsum - (a[ri+1]-a[i])*2)<abs(r-s)){
            ri++;
            r = a[ri]-a[i];
            s = rsum - r;
        }
        ll mx = max(max(p,q),max(r,s)), mn = min(min(p,q),min(r,s));
        ans = min(ans,mx-mn);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1792
import sys
input = sys.stdin.readline
import bisect

A, B, Q = map(int, input().split())
s = [-float('inf')] + [int(input()) for _ in range(A)] + [float('inf')]
t = [-float('inf')] + [int(input()) for _ in range(B)] + [float('inf')]
x = [int(input()) for _ in range(Q)]

for i in x:
    s_point = bisect.bisect_left(s, i)
    t_point = bisect.bisect_left(t, i)
    dist1 = max(i-s[s_point-1], i-t[t_point-1])
    dist2 = max(s[s_point]-i, t[t_point]-i)
    dist3 = min(2*(i-s[s_point-1])+(t[t_point]-i), (i-s[s_point-1])+2*(t[t_point]-i))
    dist4 = min(2*(i-t[t_point-1])+(s[s_point]-i), (i-t[t_point-1])+2*(s[s_point]-i))
    print(min(dist1, dist2, dist3, dist4))

Measured memory_bytes: 16144
s=input()
a=[]
for i in range(len(s)):
    if s[i]=='0':
        a.append(0)
    elif s[i]=='1':
        a.append(1)
    else:
        if len(a)!=0:
            a.pop(-1)
for i in range(len(a)):
    print(a[i],end='')

Measured memory_bytes: 3060
#include <stdio.h>

int main () {
    
  int h,w;
  while (1) {
    scanf ("%d %d",&h,&w);
    int n,i;
    if (h == 0 && w == 0) break;
    for (i=0;i<h;i++) {
      for (n=0;n<w;n++) {
	if (i == 0 || n == 0 || n == w-1 || i == h-1) {
printf ("#");
	}else {
	  printf (".");
	}
      }
      printf ("\n");
    }
     

    printf ("\n");
  }
  return 0;
}

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

int main(){
    string in;
    vector<string> words;
    getline( cin, in );
    for(int i=0; i<in.length(); i++) {
        string w = "";
        while( i<in.length() && in[i]!=' ' && in[i]!='.' && in[i]!=',' ) {
            w += in[i];
            i++;
        }
        if( 3<=w.length() && w.length()<=6 ) {
            words.push_back(w);
        }
    }
    for(int i=0; i<words.size()-1; i++) {
        cout << words[i] << " ";
    }
    cout << words[words.size()-1] << endl;
    return 0;
}

Measured memory_bytes: 1180
#include <string.h>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits>
#include <algorithm>
#include <map>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define REP(x, n) for(int x = 0; x < (n); ++x)
#define REP1(i,n) for(int i=1;i<=(n);++i)

#define SORT(V) sort((V).begin(), (V).end())

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

int n;

map<int, int> v1;
map<int, int> v2;

int main() {
  cin >> n;
  REP(i, n/2) {
    int v;
    cin >> v;
    v1[v]++;
    cin >> v;
    v2[v]++;
  }
  int mv11 = 0, av11 = -1;
  int mv12 = 0, av12 = -1;
  for (auto v : v1) {
    if (v.ND > mv11) {
      mv12 = mv11;
      av12 = av11;
      mv11 = v.ND;
      av11 = v.ST;
    } else if (v.ND > mv12) {
      mv12 = v.ND;
      av12 = v.ST;
    }
  }
  int mv21 = 0, av21 = -1;
  int mv22 = 0, av22 = -1;
  for (auto v : v2) {
    //    cout << v.ST << " " << v.ND << endl;
    if (v.ND > mv21) {
      //      cout << "mv21\n";
      mv22 = mv21;
      av22 = av21;
      mv21 = v.ND;
      av21 = v.ST;
    } else if (v.ND > mv22) {
      //      cout << "mv22\n";
      mv22 = v.ND;
      av22 = v.ST;
    }
  }
  //cout << mv11 << "," << mv12 << endl;
  //cout << mv21 << "," << mv22 << endl;
  int c1, c2;
  if (av11 != av21) {
    c1 = mv11;  // av11残す
    c2 = mv21;  // av21残す
  } else {
    if (mv12 == 0 && mv22 == 0) {
      c1 = mv11;  // av11残す
      c2 = 0;     // 何も残さない
    } else if (mv12 == 0) {
      c1 = mv11;  // av11残す
      c2 = mv22;  // av22残す
    } else if (mv12 == 0) {
      c1 = mv12;  // av12残す
      c2 = mv21;  // av21残す
    } else {
      if (mv12 > mv22) {
        c1 = mv12;  // av12残す
        c2 = mv21;  // av21残す
      } else {
        c1 = mv11;  // av11残す
        c2 = mv22;  // av22残す
      }
    }
  }
  cout << n - c1 - c2 << endl;
}


Measured memory_bytes: 4992
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
inline ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T> V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> > Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T> mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }

/*
 <url:>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

void rec(int n,vector<int>& visited,vector<int>& job,vector<vector<int>>& G){
    if(visited[n]) return;
    visited[n] = 1;
    for(auto next:G[n]){
        rec(next,visited,job,G);
    }
    job.push_back(n);
}
void solve(){
    int V,E; cin >> V >> E;
    vector<vector<int>> G(V);
    for(int i = 0; i < E;i++){
        int s,t; cin >> s >> t;
//        G[s].push_back(t);
        G[t].push_back(s);
    }
    vector<int> job,visited(V);
    for(int i = 0; i < V;i++){
        //if(visited[i]) continue;
        rec(i,visited,job,G);
    }
    for(auto J:job){
        cout << J << endl;
    }
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    solve();
    return 0;
}



Measured memory_bytes: 3740
#include <stdio.h>
#include <iostream>
#include <algorithm>
using namespace std;

int main(void) {
    int n,a,Min=1000000,Max=-1000000;
    long long sum = 0;
    cin >> n;
    
    for (int i = n;i>0;i--){
        cin >> a;
        Min = min(Min,a);
        Max = max(Max,a);
        sum += a;
    }
    printf("%d %d %lld\n", Min, Max, sum);
}



Measured memory_bytes: 3236
#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
#define ld long double
#define pb push_back
#define all(x) (x).begin(), (x).end()
template <typename T> using ord_set = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int N = 2e5 + 123;
ll n, m, k, a[N], b[N];

int main() {
	ios_base::sync_with_stdio(false), cin.tie(NULL);
	#ifdef LOCAL
		freopen("input.txt", "r", stdin);
	#endif
	
	cin >> n >> m >> k;
	for (int i = 1; i <= n; i++) cin >> a[i];
	ll s = 0;
	for (int i = 1; i <= m; i++) cin >> b[i], s += b[i];
	ll cur = 0;
	int j = m, ans = 0;
	for (int i = 0; i <= n; i++) {
		cur += a[i];
		if (cur > k) break;
		while (cur + s > k) {
			s -= b[j], j--;
		}
		ans = max(ans, i + j);
	}
	cout << ans;
}


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

#define ll long long

struct drink {
    ll a;
    ll b;
};

bool cmp(const drink &d1, const drink &d2) {
    return d1.a < d2.a;
}

int main() {
    ll N, M;
    scanf("%lld %lld", &N, &M);
    vector<drink> d;
    d.resize(N);
    for(ll i = 0;i < N;i++) {
        scanf("%lld %lld", &d[i].a, &d[i].b);
    }

    sort(d.begin(), d.end(), cmp);

    ll count = 0;
    ll money = 0;

    for(ll i = 0;i < N;i++) {
        if(M < count + d[i].b) {
            money += d[i].a*(M - count);
            count += M - count;
        }else{
            money += d[i].a*d[i].b;
            count += d[i].b;
        }
    }

    printf("%lld\n", money);
    return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
#include <iomanip>

using namespace std;

int main()
{
    int n, w;
    int hist[200];

    cout << setprecision(7) << fixed;
    while (cin >> n >> w, n || w) {
        int max_w = 0.0, max_h = 0.0;
        double ans = 0.0;

        for (int i = 0; i < 200; i++)
            hist[i] = 0;
        
        for (int i = 0; i < n; i++) {
            int v;
            
            cin >> v;
            v = v / w;
            hist[v]++;
            
            max_h = max(max_h, hist[v]);
            max_w = max(max_w, v);
        }

        for (int i = 0; i <= max_w; i++) 
            ans += hist[i] * (max_w - i) / (double)(max_h * max_w);

        cout << ans + 0.01 << endl;
    }

    return 0;
}

Measured memory_bytes: 1232
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define all(x) x.begin(),x.end()
#define pll  pair <long long,long long>
#define ss second
#define ff first
#define inf 9223372036854775807
#define maa 1000000007
#define ld long double
#define fast  ios_base::sync_with_stdio(false);cin.tie(NULL);
#define bug(x) cout << #x <<": " << x << '\n';
const ll N=200005 ;
int main()
{
   fast ;
   ll tests=1 ;
   ///cin>>tests ;
   for(ll testcase=1;testcase<=tests;testcase++)
   {
      ///cout<<"Case #"<<testcase<<": " ;
      ///Read,Think ans Test Properly,then code
      ///Try to avoid using print statements debug on your own
      string s ;
      cin>>s ;
      if(s[2]==s[3]&&s[4]==s[5])
        cout<<"Yes" ;
      else
        cout<<"No" ;
      cout<<endl ;

   }
}
/// ans ->for answer
/// cur ->for local answer
/// level ->for depth in tree
/// v -> adjacency matrix
/// r -> array
/// s ->string



Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;

int main() {
    int h, w;
    cin >> h >> w;

    vector<int> count(26);  // count[i] : i番目のアルファベット(iは0-index)が何個含まれるか

    rep(i, h) {
        rep(j, w) {
            char c;
            cin >> c;
            count[c - 'a']++;
        }
    }

    int g1, g2, g4;
    
    if(h%2 == 1 && w%2 == 1) {
        g1 = 1;
    }
    else {
        g1 = 0;
    }

    if(h%2 == 1 && w%2 == 1) {
        g2 = h/2 + w/2;
    }
    else if(h%2 == 1 && w%2 == 0) {
        g2 = w/2;
    }
    else if(h%2 == 0 && w%2 == 1) {
        g2 = h/2;
    }
    else if(h%2 == 0 && w%2 == 0) {
        g2 = 0;
    }

    g4 = (h/2)*(w/2);

    rep(loop, g1) {
        rep(i, 26) {
            if(count[i]%2 == 1) {
                count[i]--;
                break;
            }
        }
    }
    
    if(h == 1 || w == 1) {
        rep(loop, g2) {
            rep(i, 26) {
                if(count[i] > 0 && count[i]%2 == 0) {
                    count[i] -= 2;
                    break;
                }
            }
        }
    }
    else {
        rep(loop, g2) {
            rep(i, 26) {
                if(count[i]%4 == 2) {
                    count[i] -= 2;
                    break;
                }
            }
        }
    }

    rep(loop, g4) {
        rep(i, 26) {
            if(count[i] > 0 && count[i]%4 == 0) {
                count[i] -= 4;
                break;
            }
        }
    }

    int flag = 0;
    rep(i, 26) {
        if(count[i] != 0) {
            flag = 1;
        }
    }

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

    cout << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
 
public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int X = sc.nextInt();

        int l = 1; // NG
        int r = 1_000_000_007;

        for (int i = X; i <= r; i++) {
            if (isPrime(i)) {
                System.out.println(i);
                return;
            }
        }
    }

    private static boolean isPrime(int a) {
        boolean isPrime = true;
        for (int i = 2; i*i < a; i++) {
            if (a%i == 0) {
                isPrime = false;
                break;
            }
        }
        return isPrime;
    }
}


Measured memory_bytes: 23380
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<queue>
#include<string>
#include<cstring>
#include<algorithm>
#include<set>
#include<map>
#include<iomanip>

#define REP(i,n) for(int i=0;i<(n);i++)
#define EPS (1e-7)
#define INF (2e9)
// cout << setprecision(10)

using namespace std;
typedef long long int ll;

int M, K;
int main(void){
    cin >> M >> K;
    int C = 0;

    if(K==0) {
        REP(i, pow(2, M)) cout << i << " " << i << " ";
        cout << endl;
        return 0;
    }

    REP(i, pow(2,M)){
        if (i==K) continue;
        C ^= i;
    }
    if(C != K) {
        cout << -1 << endl;
        return 0;
    }
    REP(i, pow(2,M)) {
        if (i==K) continue;
        cout << i << " ";
    }
    cout << K << " ";
    for (int i = pow(2,M)-1;i>=0;i--){
        if (i==K) continue;
        cout << i << " ";
    }
    cout << K << endl;

    return 0;
}



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

int main() {
    int N;
    cin >> N;
    int res = N;
    for (int i = 0; i <= N; i++) {
        int cc = 0;
        int t = i;
        while (t > 0) cc += t % 6, t /= 6;
        t = N - i;
        while (t > 0) cc += t % 9, t /= 9;
        if (res > cc) res = cc;
    }
    cout << res << '\n';
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")

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

using namespace std;
using namespace __gnu_pbds;

typedef
tree<pair<int, int>, null_type, less<pair<int, int>>, rb_tree_tag, tree_order_statistics_node_update> orderedSet;

#define pb push_back
#define F first
#define S second
#define all(a) (a).begin(), (a).end()

#define for1(i0, l0, r0) for (int i0 = l0; i0 < r0; ++i0)
#define for2(i0, l0, r0) for (int i0 = l0; i0 <= r0; ++i0)
#define forn(i0, n0) for (int i0 = 0; i0 < n0; ++i0)
#define forn1(i0, n0) for (int i0 = 1; i0 < n0; ++i0)
#define forr(i0, n0) for (int i0 = n0; i0 >= 0; --i0)
#define forr1(i0, r0, l0) for (int i0 = r0; i0 > l0; --i0)
#define forr2(i0, r0, l0) for (int i0 = r0; i0 >= l0; --i0)

#define Sort(a) sort(all(a))
#define Reverse(a) reverse(all(a))
#define relaxMax(a, b) a = max(a, b)
#define relaxMin(a, b) a = min(a, b)

typedef long long ll;
typedef long double ld;
#define ui unsigned int
#define ull unsigned long long

typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
typedef pair<string, string> pss;

typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<double> vd;
typedef vector<ld> vld;
typedef vector<bool> vb;
typedef vector<string> vs;

typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<pdd> vpdd;

typedef vector<vi> vvi;
typedef vector<vd> vvd;
typedef vector<vll> vvll;
typedef vector<vb> vvb;

#define vpss vector<pss>
#define vvs vector<vs>
#define vvpii vector<vpii>
#define vvpll vector<vpll>
#define vpt vector<pt>
#define vvvi vector<vvi>
#define vsi vector<set<int>>
#define ss second
#define ff first

#define printvi(arr) for (int x0 : arr) cout << x0 << ' '; cout << '\n';
#define printvll(arr) for (ll x0 : arr) cout << x0 << ' '; cout << '\n';
#define printpair(pair0) cout << pair0.F << ' ' << pair0.S << '\n';
#define printvp(arr) for (auto pair0 : arr) printpair(pair0);
#define initArray(arr, N0, X0) memset(arr, X0, N0 * sizeof(int))
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

void init() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    //cout.precision(16);
    //freopen("amusing.in", "r", stdin);
    //freopen("amusing.out", "w", stdout);
}

void solve() {
    int n, k;
    cin >> n >> k;
    vi a(n);
    forn(i, n) cin >> a[i];
    Sort(a);
    int ans = 0;
    forn(i, k) ans += a[i];
    cout << ans << '\n';
}

bool multitest = false;

int main() {
    init();
    int t = 1;
    if (multitest) cin >> t;
    forn(i, t) solve();
}

Measured memory_bytes: 3616
from queue import Queue
K = int(input())
q = Queue()
for i in range(1, 10):
    q.put(i)
for _ in range(K-1):
    x = q.get()
    n = x * 10
    m = x % 10
    if x % 10:
        q.put(n + m - 1)
    q.put(n + m)
    if x % 10 != 9:
        q.put(n + m + 1)
print(q.get())


Measured memory_bytes: 58068
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int main(void){
    string s;
    cin >> s;
    int zero = 0;
    for(int i = 0; i < s.size(); i++){
        if(s[i] == '0') zero++;
    }
    int ichi = s.size() - zero;
    int min_v = min(zero, ichi);
    cout << 2 * min_v << endl;
}
 

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

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

  int count = 0;
  for(int i = a; i <= b; i++){
    if(c%i == 0) {
      count++;
    }
  }

  cout << count << endl;
  return 0;
}


Measured memory_bytes: 3112
n = int(input())
h = list(map(int, input().split()))

for i in range(n-1):
    if h[i] == h[i+1]:
        pass
    elif h[i] <= h[i+1]-1:
        h[i+1] -= 1
    else:
        print("No")
        exit()
print("Yes")

Measured memory_bytes: 63856
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
using namespace std;

int x[3],y[3],z[3],w[3],n;

int main(){
	while(1){
		cin>>n;
		if(n==0){break;}
		for(int i=0;i<n;i++){
			cin>>x[1]>>y[1]>>z[1]>>w[1]>>x[2]>>y[2]>>z[2]>>w[2];
			cout<<(x[1])*(x[2])-(y[1])*(y[2])-(z[1])*(z[2])-(w[1])*(w[2]);
			cout<<" ";
			cout<<(x[2])*(y[1])+(x[1])*(y[2])+(z[1])*(w[2])-(w[1])*(z[2]);
			cout<<" ";
			cout<<(x[1])*(z[2])+(z[1])*(x[2])+(w[1])*(y[2])-(y[1])*(w[2]);
			cout<<" ";
			cout<<(w[1])*(x[2])-(z[1])*(y[2])+(y[1])*(z[2])+(x[1])*(w[2]);
			cout<<endl;
		}
	}
	
	return 0;
}

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

namespace AtCoder_solve
{
    class Program
    {
        public const ulong mod = 1000000007;

        static void Main(string[] args)
        {
            var ans = "";
            var n = Console.ReadLine();
            var hon = new char[] { '2','4', '5', '7','9' };
            var pon= new char[] { '0', '1', '6', '8' };
            var bon= new char[] { '3' };
            for (int i = 0; i < hon.Length; i++)
            {
                if (n[n.Length-1] == hon[i]) ans = "hon";
            }
            for (int i = 0; i < pon.Length; i++)
            {
                if (n[n.Length-1] == pon[i]) ans = "pon";
            }
            if (n[n.Length-1] == bon[0]) ans = "bon";
            Console.WriteLine(ans);




        }

        static public long Input()
        {
            return long.Parse(Console.ReadLine());
        }

        static public string[] Input2()
        {
            return Console.ReadLine().Split();
        }
        
        static public long[] Input3()
        {
            string[] data = Console.ReadLine().Split();
            long[] res = new long[data.LongLength];
            for(long i = 0; i < data.LongLength; i++)
            {
                res[i] = long.Parse(data[i]);
            }
            return res;
        }
        public static long Choose(long n, long a)
        {
            long x = 1;
            long y = 1;
            for (long i = 0; i < a; i++)
            {
                x *= n - i;
                y *= i + 1;
            }
            return x / y;
        }

        public static long Gcd(long a, long b)
        {
            long x = Math.Max(a, b);
            long y = Math.Min(a, b);
            if (x % y == 0) return y;
            else return Gcd(y, x % y);
        }
    }
}


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

#define d(x) cerr << #x ":" << x << endl;
#define dd(x, y) cerr << "(" #x "," #y "):(" << x << "," << y << ")" << endl
#define rep(i, n) for (int i = (int)(0); i < (int)(n); i++)
#define repp(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define all(v) v.begin(), v.end()
#define dump(v)                  \
    cerr << #v ":[ ";            \
    for (auto macro_vi : v) {    \
        cerr << macro_vi << " "; \
    }                            \
    cerr << "]" << endl;
#define ddump(v)                           \
    cerr << #v ":" << endl;                \
    for (auto macro_row : v) {             \
        cerr << "[";                       \
        for (auto macro__vi : macro_row) { \
            cerr << macro__vi << " ";      \
        }                                  \
        cerr << "]" << endl;               \
    }
using lint       = long long;
const int INF    = 1e9;
const lint LINF  = 1e18;
const lint MOD   = 1e9 + 7;
const double EPS = 1e-10;

int main() {
    int n, k;
    cin >> n >> k;
    for (int d = 1; d <= 1000000; d++) {
        if (pow(k, d) - 1 >= n) {
            cout << d << endl;
            return 0;
        }
    }
    return 0;
}

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

const ll MOD = 1e9 + 7;

int main()
{
	ll n,y; cin>>n>>y; y /= 1000;

	for(int i=0;i<=2000;i++){
		int res = n-i;
		if(res < 0) break;
		for(int j=0;j<=2000;j++){
			int k = res - j;
			if(k < 0) break;
			if(10*i + 5*j + k == y){
				cout<<i<<" "<<j<<" "<<k; return 0;
			}
		}
	}

	cout<<"-1 -1 -1";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define ls id << 1
#define rs id << 1 | 1
#define mem(array, value, size, type) memset(array, value, ((size) + 5) * sizeof(type))
#define memarray(array, value) memset(array, value, sizeof(array))
#define pb(x) push_back(x)
#define st(x) (1LL << (x))
#define pii pair<int, int>
#define mp(a, b) make_pair((a), (b))
#define Flush fflush(stdout)
using namespace std;
const int N = 500050;
const int inf = 0x3f3f3f3f;
const ll llinf = 0x3f3f3f3f3f3f;
const ll mod = 998244353LL;
clock_t TIME_START, TIME_END;
void program_end()
{
#ifdef ONLINE
    printf("\nTime used: %.6lf(s)\n", ((double)TIME_END - TIME_START) / CLOCKS_PER_SEC);
    system("pause");
#endif
}
int n, m;
int a[N];
int t[N];
map<int, int> h;
int id[N];
vector<int> vec;
inline int lowbit(int x) { return x & (-x); }
inline void change(int x, int val)
{
    // puts("Flag");
    while (x <= m)
    {
        t[x] += val;
        x += lowbit(x);
    }
}
inline int query(int x)
{
    int ret = 0;
    while (x)
    {
        ret += t[x];
        x -= lowbit(x);
    }
    return ret;
}
bool check(int x)
{
    int sum = query(x);
    if (sum > (n - 1) / 2)
        return 1;
    return 0;
}

void solve()
{
    cin >> n;
    for (int i = 1; i <= n; ++i)
        scanf("%d", &a[i]), vec.push_back(a[i]);
    sort(vec.begin(), vec.end());
    for (int i = 0; i < vec.size(); ++i)
    {
        if (!h.count(vec[i]))
            h[vec[i]] = ++m, id[m] = vec[i];
    }
    // printf("%d\n", m);
    for (int i = 1; i <= n; ++i)
        change(h[a[i]], 1);
    // puts("flag");
    for (int i = 1; i <= n; ++i)
    {
        // printf("flag\n");
        change(h[a[i]], -1);
        int L = 1, R = m, ret = -1;
        while (L <= R)
        {
            int mid = (L + R) >> 1;
            if (check(mid))
                R = mid - 1, ret = mid;
            else
                L = mid + 1;
        }
        printf("%d\n", id[ret]);
        change(h[a[i]], 1);
    }
}

int main()
{
    TIME_START = clock();
    int Test = 1;
    // cin >> Test;
    while (Test--)
        solve();
    TIME_END = clock();
    program_end();
    return 0;
}

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

int main(void) {
	using namespace std;
	int N, M;
	cin >> N >> M;
	vector<int> result(N, 0);
	for(int i = 0; i < M; ++i) {
		int a, b;
		cin >> a >> b;
		++result[a - 1];
		++result[b - 1];
	}
	for(int i = 0; i < N; ++i) {
		cout << result[i] << '\n';
	}
	return 0;
}



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

d = [0] * (N+1)

for i in range(1, N+1):
    d[i] = d[i-1] + L[i-1]

ans = sum([1 if dv <= X else 0 for dv in d])

print(ans)


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, pii> pip;
const ll INF = 1ll<<29;
const ll MOD = 1000000007;
const double EPS  = 1e-10;
const bool debug = 0;
//----------------------//

int n, q;
bool dp[112345];
bool ok[112345];

int main() {
	cin >> n >> q;
	
	int p = 0;
	
	REP(i, q) {
		vector<pii> update;
		int a, b;
		scanf("%d %d", &a, &b);
		a--; b--;
		
		if (p > 0) dp[p - 1] = true;
		if (p < n - 1) dp[p + 1] = true;
		
		if (p == a) p = b;
		else if (p == b) p = a;
		
		swap(dp[a], dp[b]);
		
		if (p > 0) dp[p - 1] = true;
		if (p < n - 1) dp[p + 1] = true;
	}
	
	ok[p] = true;
	REP(i, n) if (dp[i]) ok[i] = true;
	
	int ans = 0;
	REP(i, n) ans += ok[i];
	cout << ans << endl;
	
	return 0;
}


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

using namespace std;
using vi=vector<int>;
using ull=unsigned long long;

typedef long long ll;

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

	int a, b; cin >> a >> b;

	int ans;

	if (a >= 13) ans = b;
	if (a >= 6 and a <= 12) ans = b/2;
	if (a <= 5) ans = 0;


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


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

int main(){
	int n, a, b, c, d;
	int result;
	while(cin >> n){
		result = 0;

		for (a = 0; a < 10; a++) {
			for (b = 0; b < 10; b++) {
				for (c = 0; c < 10; c++) {
					for (d = 0; d < 10; d++) {
						if(a+b+c+d == n){
							result++;
						}
					}
				}
			}
		}
		cout << result << endl;
	}


	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
int main() {
  string o,e;
  cin >> o >> e;
  int os = o.size();
  int es = e.size();
  string ans = "";
  for (int i = 0; i < os + es; i++) {
    if (i % 2 == 1) ans += e[i / 2];
    else ans += o[i / 2];  
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
from collections import Counter,defaultdict
import sys,heapq,bisect,math,itertools,string,queue
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

n,h = inpl()
max_a = 0
bb = []
for i in range(n):
    a,b = inpl()
    bb.append(b)
    max_a = max(max_a, a)
bb.sort()
rr = bisect.bisect_left(bb,max_a)
# print(rr)
sum_b = 0
cnt = 0
for i in range(n-1,rr-1,-1):
    sum_b += bb[i]
    cnt += 1
    if sum_b >= h:
        print(cnt)
        break
else:
    print(cnt + math.ceil((h-sum_b)/max_a))




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

using namespace std;

#define fori(x) for (int i = 0; i < x; ++i)
#define forj(x) for (int j = 0; j < x; ++j)

int main() {
    int n,p[20];
    cin>>n;
    fori(n)cin>>p[i];
    int counter=0;
    fori(n-2){
        int a[3]={p[i],p[i+1],p[i+2]};
        sort(a,a+3);
        if(a[1]==p[i+1]){
            ++counter;
        }
    }
    cout<<counter;
	return 0;
}

Measured memory_bytes: 256
def examA():
    N = I()
    ans = "ABC"
    if N>=1000:
        ans = "ABD"
    print(ans)



import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examA()


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

#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define intll int long long
const int INF = 1e9;
const int MOD = 1e9 + 7;

int main() {
  int n , x ;
  cin >> n >> x ;
  int count = 0;
  int MIN = INF ;
  
  rep(i,n){
    int c ;
    cin >> c ;
    count += c ;
    MIN = min(MIN,c);
  }
  
  cout << n + (x-count) / MIN ; 
  
}


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

using namespace std;


int main(){
    int m,n;
    cin >> m >> n;
    int a[m][n];
    for(int i = 0;i < m; i++){
        for(int j = 0; j < n; j++){
            cin>> a[i][j];
        }
    }

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

    int r[m];
    for(int i = 0; i < m; i ++){
        r[i] = 0;
        for(int j = 0; j < n; j ++){
            r[i] += a[i][j]*b[j];
        }
    }

//    for(int i = 0; i < m; i++){
//        for(int j = 0; j < n; j ++){
//            cout << a[i][j] << " " ;
//        }
//        cout << endl;
//    }
//    cout << endl;
//    for(auto i:b) cout << i << endl;

    for(int i = 0; i < m; i ++){
        cout << r[i] << endl;
    }

    return 0;
}


Measured memory_bytes: 3084
//  Mayank Agarwal
//  IIIT Hyderabad



#include<bits/stdc++.h>
using namespace std;
const long long int M = 1000000007; 
#define ll long long int
#define ld double
#define pb push_back
#define mp make_pair
ll power(ll x, ll y,  ll p) 
{ 
    ll res = 1;      
    x = x % p;   
    while (y > 0) 
    { 
        if (y & 1) 
            res = (res*x) % p; 
        y = y>>1;x = (x*x) % p; 
    } return res%p; 
} 
ll modinver(ll a,ll b)
{
    return (power(a,1,M)*power(b,M-2,M))%M;
}
void SieveOfEratosthenes(int n) 
{   
    bool prime[10005]; 
    memset(prime, true, sizeof(prime)); 
  
    for (int p=2; p*p<=n; p++) 
    { 
        if (prime[p] == true) 
        { 
            for (int i=p*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    } 
} 
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    ll n,x,t;
    cin>>n>>x>>t;
    if(n%x==0)
    {
        cout<<(n/x)*t<<'\n';
    }
    else
    {
        cout<<(n/x+1)*t<<'\n';
    }
}


Measured memory_bytes: 3632
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<string> VS;
typedef vector< vector<int> > VVI;
typedef vector< vector<ll> > VVL;
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define pb push_back
#define mp make_pair
#define ub upper_bound
#define lb lower_bound

int main(){
  int N,Z,W;
  cin>>N>>Z>>W;
  VI A(N);
  rep(i,N) cin>>A[i];
  if(N==1){
    cout<<abs(A[0]-W)<<endl;
    return 0;
  }
  cout<<max(abs(A[N-2]-A[N-1]),abs(A[N-1]-W))<<endl;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
from operator import itemgetter
sys.setrecursionlimit(10000000)
INF = 10**30
from itertools import combinations

def distance(i, j):
	return min(abs(j - i), abs(24-j+i))

def main():
	n = int(input().strip())
	v = sorted(list(map(int, input().strip().split())))
	t = [0] * n

	for i in range(n):
		d = v[i]
		if i % 2 == 0:
			t[i] = d
		else:
			t[i] = 24 - d
	cmin = min(v) #chokudaiとの時差
	for z in combinations(range(n), 2):
		i, j = z[0], z[1]
		cmin = min(cmin, distance(t[i], t[j]))
	print(cmin)

if __name__ == '__main__':
	main()


Measured memory_bytes: 39664
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

#define BUF 101

int judge(char *str, int size) {
  for (int i = 0; i < (size / 2); i++) {
    // printf("%c %c\n", str[i], str[size - 1 - i]);
    if (str[i] != str[size - 1 - i]) return 0;
  }

  return 1;
}

int main(void) {
  char str[BUF];
  memset(str, '\0', BUF);

  scanf("%s", str);
  int str_len = strlen(str);
  // printf("%d\n", str_len);
  if (judge(str, str_len)) {
    int str_half_len = (str_len - 1) / 2;
    if (judge(str, str_half_len) && judge((str + (str_len + 3) / 2 - 1), str_half_len)) {
      printf("Yes\n");
      return 0;
    }
  }
  printf("No\n");

  return 0;
}


Measured memory_bytes: 128
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    long A = sc.nextLong();
    long B = sc.nextLong();
    long ans = 0;
    long p = sc.nextLong();
    for(int i = 1; i < N; i++) {
      long n = sc.nextLong();
      long d = n - p;
      p = n;
      ans += Math.min(d * A, B);
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 49676
#include <bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()
#ifdef _DEBUG_
	#define debug(...) printf(__VA_ARGS__)
#else
	#define debug(...) (void)0
#endif
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;

const int MAXN = 100050;
VI e[MAXN];
int num[MAXN];
bool odd[MAXN];
PII range[MAXN];

bool DFS(int x,int p,bool po) {
	debug("DFS(%d) [%d,%d]\n",x,range[x].F,range[x].S);
	odd[x]=po;
	if(num[x]!=-1) {
		debug("~~DFS(%d)\n",x);
		if((num[x]%2==1) != po) return false;
		if(num[x]<range[x].F || num[x]>range[x].S) return false;
		range[x]=MP(num[x], num[x]);
	}
	debug("!\n");
	for(int u:e[x]) {
		if(u==p) continue;
		range[u]=MP(range[x].F-1, range[x].S+1);
		if(!DFS(u, x, !po))
			return false;
		range[x].F=max(range[x].F, range[u].F-1);
		range[x].S=min(range[x].S, range[u].S+1);
		debug("x=%d [%d,%d]\n",x,range[x].F,range[x].S);
		if(range[x].F>range[x].S) return false;
	}
	return true;
}

bool DFS2(int x,int p) {
	if(range[x].F>range[x].S) return false;
	for(int i=SZ(e[x])-1;i>=0;i--) {
		int u=e[x][i];
		if(u==p) continue;
		range[u].F=max(range[u].F, range[x].F-1);
		range[u].S=min(range[u].S, range[x].S+1);
		if(!DFS2(u, x))
			return false;
		range[x].F=max(range[x].F, range[u].F-1);
		range[x].S=min(range[x].S, range[u].S+1);
		if(range[x].F>range[x].S) return false;
	}
	return true;
}

int main() {
	int N;
	scanf("%d", &N);
	for(int i=1;i<N;i++) {
		int A, B;
		scanf("%d%d", &A, &B);
		e[A].PB(B);
		e[B].PB(A);
	}
	fill(num, num+N+1, -1);
	int K;
	scanf("%d", &K);
	int root=0;
	for(int i=0;i<K;i++) {
		int V, P;
		scanf("%d%d", &V, &P);
		num[V]=P;
		root=V;
	}
	range[root]=MP(num[root], num[root]);
	bool res=DFS(root, 0, num[root]%2==1);
	if(res && DFS2(root, 0)) {
		puts("Yes");
		for(int i=1;i<=N;i++)
			printf("%d\n", range[i].F);
	}
	else
		puts("No");
	return 0;
}


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

using pii = pair<int, int>;
using ll  = long long;
#define rep(i, j) for (int i = 0; i < (int)(j); i++)
#define repeat(i, j, k) for (int i = (j); i < (int)(k); i++)
#define all(v) v.begin(), v.end()
#define debug(x) cerr << #x << " : " << x << endl

template <class T>
bool set_min(T &a, const T &b) {
    return a > b ? a = b, true : false;
}
template <class T>
bool set_max(T &a, const T &b) {
    return a < b ? a = b, true : false;
}
// vector
template <class T>
istream &operator>>(istream &is, vector<T> &v) {
    for (T &a : v) is >> a;
    return is;
}
template <class T>
ostream &operator<<(ostream &os, const vector<T> &v) {
    for (const T &t : v) os << "\t" << t;
    return os << endl;
}
// pair
template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &v) {
    return os << "<" << v.first << ", " << v.second << ">";
}

const int INF = 1 << 30;
const ll INFL = 1LL << 60;



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


    string S; cin >> S;
    cout << (S[2] == S[3] and S[4] == S[5] ? "Yes" : "No") << endl;

    return 0;
}


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

using namespace std;

typedef long long int ll;
typedef pair<int, int> P;
#define INF 10000000000000
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep1(i, n) for(int i = 1; i < (int)(n); i++)
#define repN_1(i, n) for(int i = 0; i < (int)(n - 1); i++)
#define repM(i, n) for(int i = (int)(n - 1); i >= 0; i--)
template<class T>bool chmax(T & a, const T & b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }

int main()
{
	int n;
	string s;

	cin >> n;

	s = to_string(n);

	rep(i, s.size())
	{
		if (s[i] == '7')
		{
			cout << "Yes" << endl;
			return 0;
		}
	}

	cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 3676
import java.util.Scanner;
 public class Main{
   public static void main(String[]args){ 
     Scanner sc = new Scanner(System.in);
     	String s = sc.next();
     	String a ="";
		for(int i = 0;i<s.length();i++){
			a += "x";
        }
     System.out.println(a);
   }
 }

Measured memory_bytes: 23252
#include <bits/stdc++.h>
using namespace std;
template<class T> ostream& operator<<(ostream &os, vector<T> V) { os << "[ "; 
  for(auto v:V)os << v << " "; return os << "]";
}
template<class T> ostream& operator<<(ostream &os, set<T> S){ os << "{ "; 
  for(auto s:S) os<<s<<" ";  return os<<"}"; 
}
template<class L, class R> ostream& operator<<(ostream &os, pair<L,R> P) {
  return os<<"("<<P.first<<","<< P.second << ")";
}
template<class L, class R> ostream& operator<<(ostream &os, map<L,R> M) {
  os<<"{ ";for(auto m:M)os<<"("<<m.first<<":"<<m.second<<")";
  return os<<"}";
}
#define cerr cout
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << " : " << arg1 << std::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 trace(...) 1
#endif
// #include <ext/pb_ds/assoc_container.hpp> 
// #include <ext/pb_ds/tree_policy.hpp> 
// using namespace __gnu_pbds;
// #define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
// find_by_order(k)  returns iterator to kth element starting from 0;
// order_of_key(k) returns count of elements strictly smaller than k;
//For multiset use less_equal operator but it does support erase operations for multiset
#define ll long long
#define ld long double
#define vll vector<ll>
#define pll pair<ll,ll>
#define vpll vector<pll>
#define I insert 
#define pb push_back
#define F first
#define S second
#define endl "\n"
#define all(v) (v).begin(),(v).end()
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<pii,int> ppi;
typedef vector<pii> vpii;
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define mp make_pair


const int mod = 1e9+7;

inline int add(int a,int b){a+=b;if(a>=mod)a-=mod; return a;} 
inline int sub(int a,int b){a-=b;if(a<0) a += mod; return a;}
inline int mul(int a, int b){ return a*1ll*b%mod;}
inline int power(int x, ll y){
  int res = 1;
  while(y){
    if(y&1) res = mul(res , x);
    x = mul(x,x);
    y >>= 1;
  }
  return res;
}

int main(){
  fio; cout<<fixed<<setprecision(25);	
  string t, s; cin >> s >> t;
  int mx = t.size();

  for(int i = 0;i < s.size()-t.size()+1 ; ++i){
    int curr = 0;
    for(int j = 0;j < t.size() ; ++j)
      if(s[i+j] != t[j]) ++curr;
    mx = min(mx , curr);
  }
  cout << mx << endl;

  
  return 0;
}



Measured memory_bytes: 3624
from operator import itemgetter
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
cnt_a = 0
cnt_b = 0
for i, (a, b) in enumerate(zip(A, B)):
    cnt_a += i*a
    cnt_b += i*b

if cnt_a!=cnt_b or not sum(A)==sum(B)==N:
    print("NO")
    exit()

B_ = []
cumi = 0
for i, b in enumerate(B):
    for j in range(b):
        B_.append([cumi, i])
        cumi += 1
B_.sort(key=itemgetter(1), reverse=True)

Ans = [[0]*N for _ in range(N)]
cumi = 0
for i, a in enumerate(A[1:], 1):
    if len(B_) < i:
        print("NO")
        exit()
    for k in range(a):
        for j in range(i):
            B_[j][1] -= 1
            if B_[j][1] < 0:
                print("NO")
                exit()
            Ans[B_[j][0]][cumi] = 1
        cumi += 1
        B_.sort(key=itemgetter(1), reverse=True)
print("YES")
for ans in Ans:
    print(*ans)



Measured memory_bytes: 6048
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define all(v) v.begin(), v.end()
#define MOD 1000000007
const int INF = 1LL<<30;
 
int main(){
    int n;
    cin>>n;
    map<int,int> mp;
    rep(i,n){
        int a;
        cin>>a;
        if(mp[a]>0) mp[a]--;
        else mp[a]++;
    }

    int ans=0;
    for(auto e : mp){
        if(e.second>0) ans++;
    }

    cout<<ans<<endl;
}

Measured memory_bytes: 8316
import sys
while True:
 h,w=map(int,raw_input().split())
 if h==0 and w==0:break
 for i in range(0,h):
  for j in range(0,w):
   if i==0 or j==0 or i==h-1 or j==w-1:
    sys.stdout.write("#")
   else :
    sys.stdout.write(".")
  print
 print

Measured memory_bytes: 4208
n = int(input())

di = {'M': 0, 'A': 1, 'R': 2, 'C': 3, 'H': 4}
cnt = [0 for i in range(5)]

for i in range(n):
    c = input()[0]
    if c in di:
        cnt[di[c]] += 1

ans = 0
for i in range(5):
    for j in range(i + 1, 5):
        for k in range(j + 1, 5):
            ans += cnt[i] * cnt[j] * cnt[k]

print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int main (){
	string s;
	int cont =0;
	cin>> s;
	reverse(s.begin(), s.end());
	
	while(s.size()){
		if (s.back() != s[0]) cont ++;
		s.pop_back();
		if (s.size()) s.erase(s.begin());
	}
	cout << cont;
	
	return 0;
}

Measured memory_bytes: 3628