akhauriyash/Code-Regression huggingface dataset:
N,K = map(int, input().split())

if K > (N-1)*(N-2)//2:
    print(-1)
else:
    L = []
    for i in range(N-1):
        L.append(["1", str(i+2)])
    k = (N-1)*(N-2)//2 - K
    i = 2
    j = 3
    while k > 0:
        L.append([str(i), str(j)])
        j += 1
        if j == N+1:
            i += 1
            j = i+1
        k -= 1
        
    print(len(L))
    for i in range(len(L)):
        print(" ".join(L[i]))

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

int main(void)
{
    string s;
    long long count = 0;
    int numA = 0;
    cin >> s;
    for (int i = 0; i < (int)s.size() - 2; i++) {
        if (s[i] == 'A') numA++;
        else numA = 0;

        if (s[i] == 'A' && s[i+1] == 'B' && s[i+2] == 'C') {
            s[i+2] = 'A';
            count += numA;
            numA -= 1;
            i += 1;
        }
    }
    cout << count << endl;

    return 0;
}



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

int main() {
	// your code goes here
	int n;
	cin>>n;
	string str;
	int ac=0,wa=0,tle=0,re=0;
	for(int i=0;i<n;i++){
		cin>>str;
		if(str=="AC") ac++;
		else if(str=="WA")wa++;
		else if(str=="TLE")tle++;
		else re++;
	}
	cout<<"AC x "<<ac<<endl<<"WA x "<<wa<<endl<<"TLE x "<<tle<<endl<<"RE x "<<re;
	return 0;
}

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

int main() {
    ll N;
    cin >> N;
    vector<ll> a(N);
    for (ll i = 0; i < N; ++i) {
        cin >> a.at(i);
    }
    ll minN = INT_MAX;
    ll maxN = INT_MIN;
    ll sum = 0;
    for (ll i = 0; i < N; ++i) {
        minN = min(minN,a.at(i));
        maxN = max(maxN,a.at(i));
        sum += a.at(i);
    }
    cout << minN << " " << maxN << " " << sum << endl;

    return 0;
}


Measured memory_bytes: 3172
a = int(input())
a_list = [a]
b = 0
for i in range(1000001):
    
    
    if a_list[i] % 2== 0:
        b = int((a_list[i])/2)
        if b in a_list:
            print(i+2)
            break
        else:
            a_list.append(b)
    else:
        b = 3 * a_list[i] + 1
        if b in a_list:
            print(i+2)
            break
        else:
            a_list.append(b)

Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
using namespace std;
int gcd(int a, int b){
    if(b == 0) return a;
    return gcd(b, a%b);
}

vector< bool > p(1e6+1, true);


int main(void){
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i=0;i<n;i++) cin >> a[i];
    int g = a[0];
    for(int i=1;i<n;i++){
        g = gcd(g, a[i]);
    }
    if(g > 1){
        puts("not coprime");
        return 0;
    }

    p[0] = p[1] = false;
    for(int i=2;i<=1e6;i++){
        if(i > 1e6/i) continue;
        for(int j=i*i; j<=1e6;j+=i){
            p[j] = false;
        }
    }
    for(int i=0;i<n;i++){
        int x = a[i];
        for(int j=2;j*j <= x;j++){
            if(x%j == 0){
                if(!p[j]){
                    puts("setwise coprime");
                    return 0;
                }
                p[j] = false;
                while(x%j == 0) x/=j;
            }
        }
        if(x > 1){
            if(!p[x]){
                puts("setwise coprime");
                return 0;
            }
            p[x] = false;
        }
    }
    puts("pairwise coprime");
}


Measured memory_bytes: 6772
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors


N, M = map(int, input().split())
divisors = make_divisors(M)
print(max([x for x in divisors if x <= M // N]))

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

int main() {
	int a;
	int b;
	cin >> a;
	cin >> b;
	if (a<b) {
		cout << "a < b" << endl;
	}
	if (a>b) {
		cout << "a > b" << endl;
	}
	if(a==b) {
		cout << "a == b" << endl;
	}
	return 0;
}



Measured memory_bytes: 3096
#include <algorithm>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <list>
#include <cstdio>
#define INF 1000000000000
#define MOD 1000000007ll
#define EPS 1e-10
#define REP(i,m) for(long long i=0; i<m; i++)
#define FOR(i,n,m) for(int i=n; i<m; i++)
#define DUMP(a) for(long long dump=0; dump<(ll)a.size(); dump++) { cout<<a[dump]; if(dump!=(ll)a.size()-1) cout<<" "; else cout<<endl; }
#define ALL(v) v.begin(),v.end()
#define pb push_back
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
typedef long double ld;
using namespace std;

int main(){
  int n, m;
  cin >> n >> m;
  int x[n], y[m];
  REP(i, n) cin >> x[i];
  REP(i, m) cin >> y[i];
  ll dx[n-1], dy[m-1];
  REP(i, n-1) dx[i] = x[i+1]-x[i];
  REP(i, m-1) dy[i] = y[i+1]-y[i];
  ll cx[n-1], cy[m-1];
  cx[0] = n-1;
  cy[0] = m-1;
  ll dcx = n-3;
  ll dcy = m-3;
  REP(i, n-2){
    cx[i+1] = cx[i]+dcx;
    dcx -= 2;
  }
  REP(i, m-2){
    cy[i+1] = cy[i]+dcy;
    dcy -= 2;
  }
  ll ax = 0, ay = 0;
  REP(i, n-1) ax = (ax + (dx[i]*cx[i]))%MOD;
  REP(i, m-1) ay = (ay + (dy[i]*cy[i]))%MOD;
  ll ans = (ax*ay) % MOD;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 4096
#include <stdio.h>
#include <vector>
#include <iostream>
#include <queue>
#include <bits/stdc++.h>
 
#define rep(i,n) for (int i=0;i<(n);++i)
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<double> vd;

typedef pair<int, int> P;
int di[] = {1, -1, 0, 0};
int dj[] = {0, 0, 1, -1};

const int INF = 1001001001;

int main() {
  int h, w;
  cin >> h >> w;
  vector <string> g(h);
  rep(i, h) cin >> g[i];

  // init graph
  int n = h*w;
  vector<vi> dist(n, vi(n, INF));
  rep(i, n) dist[i][i] = 0;

  rep(i, h) rep(j, w){
    if (g[i][j] == '#') continue;
    rep(k, 4){
      int dy = i + di[k];
      int dx = j + dj[k];
      if (dy < 0 or dy >= h or dx < 0 or dx >= w) continue;
      if (g[dy][dx] == '#') continue;
      dist[(i * w)+j][(dy * w)+dx] = 1;
    }
  }

  rep(k, n){
    rep(i, n){
      rep(j, n){
        dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
      }
    }
  }

  int ans = 0;
  rep(i, n){
    rep(j, n){
      if (dist[i][j] != INF) ans = max(ans, dist[i][j]);
    }
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 896
import sys, os.path
from collections import*
from copy import*
import math
mod=10**9+7
if(os.path.exists('input.txt')):
    sys.stdin = open("input.txt","r")
    sys.stdout = open("output.txt","w")

s=input()
if(s[-1]!='s'):
    print(s+'s')
else:
    print(s+'es')

Measured memory_bytes: 68180
#include "bits/stdc++.h"
using namespace std;
typedef long long li;

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

    li n;
    cin >> n;
    map<li, li> cnt;
    for (int i = 0; i < n; ++i) {
        li x;
        cin >> x;
        cnt[x] += 1;
    }


    if (n % 3 == 0) {
        const li unit = n / 3;
        vector<li> abc;
        for (auto tup : cnt) {
            if (tup.second % unit != 0) {
                cout << "No" << endl;
                return 0;
            }
            for (int i = 0; i < tup.second / unit; ++i) {
                abc.push_back(tup.first);
            }
        }
        if ((abc[0] ^ abc[1]) == abc[2]) {
            cout << "Yes" << endl;
        } else {
            cout << "No" << endl;
        }
    } else {
        if (cnt.size() == 1 && cnt[0] > 0) {
            cout << "Yes" << endl;
        } else {
            cout << "No" << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 5120
def main():
    a, b, c = map(int, input().split(" "))
 
    x = c - a - b

    if x > 0:

        y = x * x - 4 * a * b

        if y > 0:

            print("Yes")

        else:
            print("No")

    else:

        print("No")

main()



Measured memory_bytes: 2940
// https://atcoder.jp/contests/abc106/tasks

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

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

    int cnt;
    int answer = 0;
    for (int i = 1; i <= N; i+=2) {
        cnt = 0;
        for (int j = 1; j <= i; j++) {
            if (i%j == 0) {
                cnt++;
            }
        }

        if (cnt == 8) answer++;
    }

    cout << answer << "\n";

    return 0;
}

Measured memory_bytes: 256
l="abcdefghijklmnopqrstuvwxyz"
a,b=0,0
s=int(input())
for _ in range(s):
    t,h=input().split()
    for n in range(min(len(t),len(h))):
        t_=l.find(t[n])
        h_=l.find(h[n])
        if t_>h_:
            a+=3
            break
        elif t_<h_:
            b+=3
            break
        elif n ==min(len(t),len(h))-1:
            if len(t)==len(h):
                a+=1
                b+=1
            elif len(t)>len(h):
                a+=3
            elif len(t)<len(h):
                b+=3
print(a,b)


Measured memory_bytes: 5600
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(i=0;i<n;i++)
#define loop(i,a,n) for(i=a;i<n;i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

typedef vector<int> vi;
typedef pair<int,int> pii;

int main(void) {
  int i,j,k,l;
  int n,m;
  cin>>n>>m;
  vi a(m),b(m);
  rep(i,m) cin>>a[i]>>b[i],a[i]--,b[i]--;
  int ans=0;
  rep(l,m){
    vector<vi> g(n,vi(n,INF));
    rep(i,n) g[i][i]=0;
    rep(i,m)if(i!=l)g[a[i]][b[i]]=g[b[i]][a[i]]=1;
    rep(k,n)rep(i,n)rep(j,n)
      g[i][j]=min(g[i][j],g[i][k]+g[k][j]);
    bool c=false;
    rep(i,n)rep(j,n)if(g[i][j]==INF)c=true;
    if(c)ans++;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 384
N = int(input())
v = list(map(int, input().split()))

ans = 0

v.sort()

while len(v) != 0:
    if ans == 0:
        ans = (v[0]+v[1]) / 2
        v.pop(0)
        v.pop(0)

    else:
        ans = (ans+v[0]) / 2
        v.pop(0)
print(ans)


Measured memory_bytes: 3060
#10:30
s = input()
n = len(s)
now = [1,0,0,0,0,0,0,0,0,0,0,0,0]
for i in range(n):
  last = now
  now = [0 for _ in range(13)]
  here = s[i]
  if here == '?':
    for k in range(10):
      for j in range(13):
        now[(10*j+k)%13] += last[j]
  else:
    k = int(here)
    for j in range(13):
      now[(10*j+k)%13] += last[j]
  for j in range(13):
    now[j] %= 10**9+7
print(now[5])  

Measured memory_bytes: 43116
#include <iostream>
#include <vector>
#include <algorithm>
#include <cassert>

using namespace std;

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for(int i = 0; i < n; ++i) cin >> a[i];
  auto b = a;
  sort(b.begin(), b.end());
  assert(a == b);
  int q;
  cin >> q;
  while(q--) {
    int k;
    cin >> k;
    auto it = lower_bound(a.begin(), a.end(), k);
    cout << (it != a.end() && *it == k) << endl;
  }
  return 0;
}



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

int main() {

	string s;
	cin >> s;
	unsigned long long sum = 0;
	unsigned long long tmp = 0;
	int keta = 0;

	reverse(s.begin(), s.end());


	for (int bit = (1<<s.size()-1); bit < (1 << s.size()); ++bit) {
		//cout << bit << endl;
		for (int i = 0; i<s.size(); i++) {
			tmp += (s.at(i) - '0') *pow(10,keta);
			//cout << "tmp:"<<tmp << endl;

			if (bit & (1 << i)) {
				//cout << "bit:" << bit << ",i:" << i << ",tmp:" << tmp<< endl;
				sum += tmp;
				keta = 0;
				tmp = 0;
			}
			else {
				keta++;
			}
		}

		tmp = 0;
		keta = 0;
	
	}

	cout << sum << endl;

}




Measured memory_bytes: 256
#include <fstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <iomanip>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <climits>
#include <bitset>
#include <cassert>

using namespace std;

const int SIZE = 1 << 17;

int pointer = SIZE;
char buffer[SIZE];

char Advance() {
    if (pointer == SIZE) {
        fread(buffer, 1, SIZE, stdin);
        pointer = 0;
    }
    return buffer[pointer++];
}

int Read() {
    int answer = 0,sign = 1;
    char ch = Advance();
    while (!isdigit(ch) && ch != '-')
        ch = Advance();
    if (ch == '-') {
        ch = Advance();
        sign = -1;
    }
    while (isdigit(ch)) {
        answer = answer * 10 + ch - '0';
        ch = Advance();
    }
    return answer * sign;
}

char ReadCh() {
    char ch = Advance();
    while (!isalpha(ch))
        ch = Advance();
    return ch;
}

const int MAXN = 100;

struct pct{
    double x, y;
    int id;

    inline bool operator < ( const pct &a ) const {
        if ( x != a.x ) {
            return ( x < a.x );
        }
        return ( y < a.y );
    }
} v[ MAXN + 1 ];

pct st[ MAXN + 1 ];
vector< pct > sol;

inline bool cw( pct a, pct b, pct c ) {
    return ( (b.x - a.x) * (c.y - b.y) - (b.y - a.y) * (c.x - b.x) <= 0 );
}

double answer[1 + MAXN];
const double PI = acos(-1);

double Angle(pct c, pct a, pct b) {
    pct e = {a.x - c.x, a.y - c.y}, f = {b.x - c.x, b.y - c.y};
    double pe = atan2(e.y, e.x), pf = atan2(f.y, f.x);
    if (pe < pf)
        swap(pe, pf);
    double alpha = min(2 * PI - (pe - pf), pe - pf);
    return PI - alpha;
}

int main() {
    //freopen("tema.in", "r", stdin);
    //freopen("tema.out", "w", stdout);
    int n,i,k=2;
    scanf("%d",&n);
    for( int i = 1; i <= n; ++ i ) {
        scanf("%lf%lf", &v[i].x, &v[i].y);
        v[i].id = i;
    }
    sort( v + 1, v + n + 1 );

    int t = 0;
    st[ ++ t ] = v[ 1 ];
    st[ ++ t ] = v[ 2 ];
    for( int i = 2; i <= n; ++ i ) {
        while ( t >= 2 && cw( st[ t - 1 ], st[ t ], v[ i ] ) ) {
            -- t;
        }
        st[ ++ t ] = v[ i ];
    }
    for( int i = 1; i <= t; ++ i ) {
        sol.push_back( st[ i ] );
    }

    t = 0;
    st[ ++ t ] = v[ n ];
    st[ ++ t ] = v[ n - 1 ];
    for( int i = n - 2; i > 0; -- i ) {
        while ( t >= 2 && cw( st[ t - 1 ], st[ t ], v[ i ] ) ) {
            -- t;
        }
        st[ ++ t ] = v[ i ];
    }

    for( int i = 2; i < t; ++ i ) {
        sol.push_back( st[ i ] );
    }

    for (int i = 0; i < sol.size(); i++) {
        int a = i - 1;
        if (a == -1)
            a = sol.size() - 1;
        int b = i + 1;
        if (b == sol.size())
            b = 0;
        answer[sol[i].id] = (Angle(sol[i], sol[b], sol[a])) / (2 * PI);
    }
    for (int i = 1; i <= n; i++)
        printf("%.7f\n", answer[i]);
    return 0;
}


Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <iostream>
#include <fstream>


#include<bits/stdc++.h>

#define ll long long
#define pb push_back
#define eb emplace_back
#define ff first
#define ss second
#define len(a) (int)a.size()
#define all(a) (a).begin(), (a).end()
#define pqueue priority_queue

using namespace std ;

template <typename A, typename B>
string to_string(pair<A, B> p);

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);

string to_string(const string& s) {
    return '"' + s + '"';
}

string to_string(const char* s) {
    return to_string((string) s);
}

string to_string(bool b) {
    return (b ? "true" : "false");
}

string to_string(vector<bool> v) {
    bool first = true;
    string res = "{";
    for (int i = 0; i < static_cast<int>(v.size()); i++) {
        if (!first) {
            res += ", ";
        }
        first = false;
        res += to_string(v[i]);
    }
    res += "}";
    return res;
}

template <size_t N>
string to_string(bitset<N> v) {
    string res = "";
    for (size_t i = 0; i < N; i++) {
        res += static_cast<char>('0' + v[i]);
    }
    return res;
}

template <typename A>
string to_string(A v) {
    bool first = true;
    string res = "{";
    for (const auto &x : v) {
        if (!first) {
            res += ", ";
        }
        first = false;
        res += to_string(x);
    }
    res += "}";
    return res;
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
    return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
    return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
    return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}

void debug_out() { cerr << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << to_string(H);
    debug_out(T...);
}

#ifndef ONLINE_JUDGE
#define debug(...) cerr<<"LINE ("<< __LINE__ << ") : [" << #__VA_ARGS__ << "] -> ", debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

class AEatingSymbolsEasy {
public:
    void solveOne(std::istream& in, std::ostream& out){
          string s ;
          in >> s ;
          int ans = 0 ;
          for(char c :s ){
              if(c == '-') ans-- ;
              else ans++ ;
          }
          out << ans ;
    }
	void solve(std::istream& in, std::ostream& out) {
	    int T = 1 ;
	    for(int id = 1 ; id <=  T ; ++id){
	        solveOne(in, out) ;
	    }
	}
};


int main() {
    ios::sync_with_stdio(false) ;
    cin.tie(0) ;
	AEatingSymbolsEasy solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 3544
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    N = int(readline())
    A = input()
    B = input()
    C = input()
    ans = 0

    for a, b, c, in zip(A, B, C):
        s = {a, b, c}
        ans += len(s) - 1

    print(ans)

if __name__ == '__main__':
    main()


Measured memory_bytes: 61268
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ll long long
#define lson l,mid,p<<1
#define rson mid+1,r,p<<1|1
#define pii pair<int,int>
using namespace std;
const int inf=1e9+10;
const int mod=1e9+7;
const int maxn=2e5+10;
int n;
char s[maxn];
int p,suf[maxn],cnt[maxn];
int main(){
	ios::sync_with_stdio(false);
	//freopen("in","r",stdin);
	cin>>n>>p>>s+1;
	if(p==2||p==5){
		ll ans=0;
		for(int i=1;i<=n;i++){
			if((s[i]-'0')%p==0){
				ans+=i;
			}
		}
		cout<<ans<<endl;
		return 0;
	}
	ll t=1;
	for(int i=n;i>=1;i--){
		suf[i]=(suf[i+1]+((s[i]-'0')*t%p))%p;
		t=t*10%p;
		cnt[suf[i]]++;
	}
	ll ans=0;
	for(int i=1;i<=n;i++){
		if(suf[i]==0) ans+=cnt[suf[i]];
		else ans+=cnt[suf[i]]-1;
		cnt[suf[i]]--;
	}
	cout<<ans<<endl;
	return 0;
}
/*
0 2 1 0
0 0 1 0
*/

Measured memory_bytes: 1280
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  vector<int> data(N-1);
  for (int i = 0; i < N-1; i++)
  {
    cin >> data.at(i);
  }

  vector<int> high(N,0);
  for (int i = 0; i < N - 1;i++){
    high.at(data.at(i) - 1)++;
  }
  for (int i = 0; i < N;i++){
    cout << high.at(i) << endl;
  }
  return 0;
}

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

int main() {
	int N;
	cin >> N;
	vector<int>L(N);
	int sum = 0;
	int maxsize = 0;
	for (int n = 0; n < N; ++n) {
		cin >> L[n];
		sum += L[n];
		maxsize = max(maxsize,L[n]);
	}
	if (sum > maxsize*2) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}

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

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

  double tot = 0;
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    double x;
    string u;
    cin >> x >> u;
    tot += (u == "JPY") ? x : x * 380000.0;
  }
  cout << setprecision(6) << tot << '\n';
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
	int a[40]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
	int k;
	
	scanf("%d",&k);
	
	printf("%d \t",a[k-1]);

	return 0;
}


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

typedef long long ll;

int main() {
	ios_base::sync_with_stdio(false);

	int n, k;
	cin >> n >> k;

	vector<int> a(n);

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

	sort(a.rbegin(), a.rend());

	ll ans = 0;

	for(int i = k; i < n; i++) {
        ans += 1LL * a[i];
	}

	cout << ans << endl;
}


Measured memory_bytes: 1024
#pragma GCC optimize("Ofast")
//#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
#define F first
#define S second
#define vec vector
#define pb push_back
#define pll pair<ll,ll>
#define pdd pair<ld, ld>
#define umap unordered_map
#define uset unordered_set
#define pii pair<int, int>
#define pnn pair<Node*, Node*>
#define all(m) m.begin(), m.end()
#define uid uniform_int_distribution
#define init(m, x) memset(m, x, sizeof(m));
#define FILE ifstream in("input.txt");ofstream out("output.txt");
#define fast cin.tie(0);cout.tie(0);cin.sync_with_stdio(0);cout.sync_with_stdio(0);
using namespace std;
typedef string str;
typedef long long ll;
typedef long double ld;
typedef unsigned int uint;
typedef unsigned long long ull;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());

int main() {
    fast;
    ll a; cin>>a;
    str t; cin>>t;
    deque<char> d;
    for(char c : t) d.pb(c);
    ll o = 0;
    for(; d.size();){
        for(; d.size() && d.back()=='W';) d.pop_back();
        for(; d.size() && d.front()=='R';) d.pop_front();
        if(d.empty()) break;
        o++;
        d.pop_back();
        d.pop_front();
    }
    cout<<o;
}

Measured memory_bytes: 3812
#include<bits/stdc++.h>
using namespace std;
int main()
{
  string s;
  cin>>s;
  int q;
  cin>>q;
  int flag=0;
  string beg="";
  while(q--)
  {
      int t;
      cin>>t;
      if(t==1)
      flag=1-flag;
      else
      {
          int f;
          cin>>f;
          char c;
          cin>>c;
          if(f==1 && !flag)
          beg.push_back(c);
          else if(f==2 && !flag)
          s.push_back(c);
          else if(f==1 && flag)
          s.push_back(c);
          else if(f==2 && flag)
          beg.push_back(c);
      }
  }
  if(!flag)
  {
      reverse(beg.begin(),beg.end());
      cout<<beg<<s;
  }
  else 
  {
      reverse(s.begin(),s.end());
      cout<<s<<beg;
  }
  return 0;
}

Measured memory_bytes: 960
<?php

  $i = 0;
  $score = [];
  $evaluation = 1;
  $previous = 0;

  list($seasons, $range) = sscanf(fgets(STDIN), "%d %d");
  $score = explode(" ", fgets(STDIN));
  
  for($i = 0; $i < $seasons; $i++){
    $score[$i] = (int)$score[$i];
    if($i < $range){
      $evaluation = $evaluation * $score[$i];
    }
    else{
      if($score[$i - $range] < $score[$i]){
        printf("Yes\n");
      }
      else{
        printf("No\n");
      }
    }
  }
?>


Measured memory_bytes: 31996
#include <map>
#include <cstdio>
#include <algorithm>
using namespace std;
const int MAXN = 2e5 + 5;
int head[MAXN] , to[MAXN << 1] , nxt[MAXN << 1] , cnt;
void add(int u , int v) {nxt[++cnt] = head[u];head[u] = cnt;to[cnt] = v;}
int mx[MAXN] , n , c[MAXN];
map <int , int> M[MAXN];
int Q(int x , int val , int fa) {
	if(M[x][val]) return M[x][val];
	for (int i = head[x]; i; i = nxt[i]) {
		if(to[i] == fa) continue;
		if(to[i] < val) M[x][val] += Q(to[i] , val , x) + 1;
	}
	return M[x][val];
}
void dfs(int x , int fa) {
	mx[x] = max(mx[fa] , x);
	for (int i = head[x]; i; i = nxt[i]) {
		if(to[i] == fa) continue;
		if(to[i] < mx[x] && x > mx[fa]) {
			if(to[i] < mx[fa]) c[to[i]] = c[x] + Q(to[i] , mx[x] , x) - Q(to[i] , mx[fa] , x);
			else c[to[i]] = c[x] + Q(to[i] , mx[x] , x) + 1;
		}
		else if(to[i] < mx[x]) c[to[i]] = c[x];
		else c[to[i]] = c[x] + Q(to[i] , mx[x] , x) + 1;
		dfs(to[i] , x);
	}
}
int main() {
	scanf("%d" , &n);
	for (int i = 1; i < n; ++i) {
		int u , v;
		scanf("%d %d" , &u , &v);
		add(u , v);add(v , u);
	}
	dfs(1 , 0);
	for (int i = 2; i <= n; ++i) printf("%d " , c[i]);
	return 0;
}

Measured memory_bytes: 44592
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <numeric>
#include <sstream>
#include <iostream>
#include <iomanip>
#define _USE_MATH_DEFINES
#include <cmath>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cfloat>
#include <cmath>
#include <ctime>
#include <cassert>
#include <cctype>
#include <cstdio>
#include <cassert>
using namespace std;

#define EPS 1e-12
#define ull unsigned long long
#define ll long long
#define VI vector<ll>
#define PII pair<ll, ll> 
#define VVI vector<vector<ll> >
#define VVVI vector<vector<vector<ll>>>
#define VVVVI vector<vector<vector<vector<ll>>>>
#define REP(i,n) for(ll i=0,_n=(n);(i)<(ll)_n;++i)
#define REPR(i,n) for(ll i=(ll)(n)-1;0<=(i);--i)
#define RANGE(i,a,b) for(ll i=(ll)a,_b=(ll)(b);(i)<_b;++i)
#define RANGER(i,a,b) for(ll i=(ll)(b)-1,_a=(ll)(a);(_a)<=i;--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define ALLR(c) (c).rbegin(), (c).rend()
#define PB push_back
#define MP(a, b) make_pair(a, b)
#define POPCOUNT __builtin_popcount
#define POPCOUNTLL __builtin_popcountll
#define CLEAR(table, v) memset(table, v, sizeof(table));
#define UNIFORM_DOUBLE(a, b) (((b-a)*(double)rand()/RAND_MAX)+a) // [a, b) 
#define UNIFORM_LL(a, b) (ll)UNIFORM_DOUBLE(a, b) // [a, b) 
#define IN(v, lo, hi) ((lo)<=(v) && (v)<(hi))
#define DD(v) cout<<#v<<": "<<v<<endl
#define FI first
#define SE second
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const map<T0, T1>& v) { for( typename map<T0, T1>::const_iterator p = v.begin(); p!=v.end(); p++ ){os << p->first << ": " << p->second << " ";} return os; }
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const pair<T0, T1>& v) { os << v.first << ": " << v.second << " "; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<T>& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << " "; } return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const set<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const deque<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<vector<T> >& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << endl; } return os; }
template<typename T>void maxUpdate(T& a, T b) {a = max(a, b);}
template<typename T>void minUpdate(T& a, T b) {a = min(a, b);}

#define MOD 1000000007LL
#define INF (1LL<<60)

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll H;
	while(cin>>H) {
		ll ans = 0;
		ll co = 1;
		while(1<H) {
			H/=2;
			ans+=co;
			co*=2;
		}
		ans += H*co;
		
		cout<<ans<<endl;
	}
	
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n;
vector<long long>a;
long long mem[3000][3000];
long long dp(int i,int j)
{
    if(i>j)
        return 0;
    if(mem[i][j]!=-1)
        return mem[i][j];

    if((n-(i+j))%2!=0)
    mem[i][j]=max(a[i]+dp(i+1,j),a[j]+dp(i,j-1));
    else
    mem[i][j]=min(dp(i+1,j)-a[i],dp(i,j-1)-a[j]);
    return mem[i][j];
}
int main()
{
    memset(mem,-1,sizeof(mem));
    cin>>n;
    a.resize(n);
    int i;
    for(i=0;i<n;i++)
        cin>>a[i];
    cout<<dp(0,n-1);
    return 0;
}


Measured memory_bytes: 70784
#include<bits/stdc++.h>
using namespace std;
main(){
  int n,x,y,w,h,m;
  cin>>n;
  while(n--){
    cin>>x>>y>>w>>h>>m;
    int sum=0;
    for(int i=0;i<m;i++){
      int px,py;
      cin>>px>>py;
      if(x<=px&&px<=x+w&&y<=py&&py<=y+h)sum++;
    }
    cout<<sum<<endl;
  }
}

Measured memory_bytes: 2964
#include <iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<set>
#include<queue>
#include<map>
#define debug(a) cout << "*" << a << "*" << endl
using namespace std;
typedef unsigned long long ull;
typedef pair<int, int> P;
int a[30], num, len;
char s[50];
ull sum, ans, b[30];
int main()
{
	scanf("%s", s);
	for (int i = 0; s[i]; i++)
	{
		a[s[i] - 'a']++;
	} 
	for (int i = 0; i < 26; i++)
	{
		if (a[i] % 2 == 1)
			num++;
		a[i] /= 2;
		sum += a[i];
		if (a[i] >= 2)
		{
			b[len++] = a[i];
		}
	}
	
	if (num > 1)	
	{
		printf("0\n");
		return 0;
	}
	for (int i = 0; i < len; i++)
	{
		ans = 1; 
		for (int j = 1; j < b[i]; j++)
			ans *= j;
		b[i] *= ans;
	}
	ans = 1;
	for (int i = 1, j = 0; i <= sum; i++)
	{
		ans *= i;
		while (b[j] && ans % b[j] == 0)
		{
			ans /= b[j];
			j++;
		}
	}
	printf("%lld\n", ans);
}
		


Measured memory_bytes: 3228
#include <bits/stdc++.h> 
using namespace std;
#define int long long
#define ld double
#define fi first
#define se second
#define pb push_back
#define pii pair<int,int>
#define all(x) (x).begin(), (x).end()
const int MOD =1e9+7;
int mpow(int a,int b,int p=MOD){a=a%p;int res=1;while(b>0){if(b&1)res=(res*a)%p;a=(a*a)%p;b=b>>1LL;}return res%p;}
const int N=1e6+2,M=1e6+2;

int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	#ifdef LOCAL
	freopen("input.txt", "r", stdin);
	// freopen("out10.txt","w",stdout);
	#endif
	int n,m;
	cin>>n>>m;
	int a[n],s=0;
	for(int i=0;i<n;i++) cin>>a[i],s+=a[i];
	int cnt=0;
	for(int i=0;i<n;i++)
	{
		if(a[i]*4*m>=s)
		{
			cnt++;
		}
	}
	if(cnt>=m)
	{
		cout<<"Yes\n";
	}
	else cout<<"No\n";
}
//
// Don't be afraid to fail. Be afraid not to try.
// "Become grindian instead of greendian" - aryanc403
// When you want to succeed as bad as you want to breathe, only then you’ll Be Successful!
// No Matter,How Fast You Are Driving If You Are Driving in a Wrong Direction You Will Never Reach Your Destination
// When failures hit you, you hit the failures back with Bounce Back!
// When you face failures, Don’t change your goal, Change your strategy!

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
	int a,b;
	cin>>a>>b;
	if(a>b){
		if(a*2-1>a+b) cout<<a*2-1<<endl;
		else cout<<a+b<<endl;
	}
	else{
		if(b*2-1>a+b) cout<<b*2-1<<endl;
		else cout<<a+b<<endl;
	}
} 

Measured memory_bytes: 256
N=int(input())
a=[]
b=[]
for c in range(N):
    A,B=map(int,input().split())
    a.append(int(A))
    b.append(int(B))
newa=sorted(a)
newb=sorted(b)
number=N
for c in range(N-1):
    z=newa[c+1]-newa[c]-1
    number+=z
y=newa[0]-1
number+=y
number+=newb[0]
print(number)


Measured memory_bytes: 12896
#include<algorithm>
#include<iostream>
#include<cstdio>
#define ll long long
using namespace std;
int main()
{
	int a,b,c;
	cin>>a>>b>>c;
	int t=0;
	for(int i=b;i<=c;i++)
	{
		if(i%a==0)
		{
			cout<<"OK";
			t=1;
			break;
		}
	}
	if(t==0)
	{
		cout<<"NG";
	}
}

Measured memory_bytes: 3136
/**
 *
 * Contest - Problema X: Nome (link)
 *
 * Abridge version.
 *
 * Solution: text
 */
#include <iostream>

#include <map>
#include <set>
#include <queue>
#include <cmath>
#include <vector>
#include <bitset>
#include <cstring>
#include <algorithm>

using namespace std;

using ll = long long;
using ii = pair<ll, ll>;

#define LOG(var, sep) (cerr << #var << " = " << (var) << (sep))
#define LOGM(msg) (cerr << (msg))
#define LOGV(vec, sep) { cerr << #vec << " ="; for (const auto& v : vec) cerr << " " << v; cerr << (sep); }
#define LOGA(arr, N, sep) { cerr << #arr << " ="; for (int i = 0; i < N; ++i) cerr << " " << (arr)[i]; cerr << (sep); }
#define LOGA2(arr, N, M, sep) { cerr << #arr << " =\n"; for (int i = 0; i < N; ++i) { for (int j = 0; j < M; ++j) cerr << (arr)[i][j] << " "; cerr << endl; } cerr << (sep); }

ostream& operator<<(ostream& os, const ii& p)
{
    os << "(" << p.first << ", " << p.second << ")";
    return os;
}

const int MAX { 2000010 };
const ll oo { 1LL << 62 };
const int MOD { 1000000007 };

void precomp()
{
}

void solve(int N, int K)
{
    cout << (N % K ? 1 : 0) << endl;
}

int main()
{
    ios::sync_with_stdio(false);
    precomp();

    int N, K;
    cin >> N >> K;

    solve(N, K);

    return 0;
}


Measured memory_bytes: 256
import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, std.bitmanip;

alias Point = Tuple!(int, "x", int, "y", int, "i");

void main() {
    auto s = readln.split.map!(to!int);
    auto N = s[0];
    auto M = s[1];
    auto G = new UndirectedGraph(N);
    foreach (_; 0..M) {
        s = readln.split.map!(to!int);
        G.add_edge(s[0], s[1]);
    }
    G.articulation_points.each!writeln;
}

class UndirectedGraph {
    int N;
    int[][] G;
    int[][] dfs_tree;
    int[] dfs_subtree;
    bool[] dfs_subtree_odd;

    this (int N) {
        this.N = N;
        G = new int[][](N);
    }

    void add_edge(int u, int v) {
        G[u] ~= v;
        G[v] ~= u;
    }

    int[] articulation_points() {
        dfs_tree = new int[][](N);
        dfs_subtree = new int[](N);
        dfs_subtree_odd = new bool[](N);
        auto ord = new int[](N);
        auto low = new int[](N);
        auto used = new bool[](N);
        int cnt = 0;

        int dfs(int n, int p) {
            ord[n] = cnt++;
            low[n] = ord[n];
            used[n] = true;
            foreach (m; G[n]) {
                if (m == p) continue;
                if (used[m]) low[n] = min(low[n], ord[m]);
                else low[n] = min(low[n], dfs(m, n)), dfs_tree[n] ~= m; 
            }
            return low[n];
        }

        int dfs2(int n, int p) {
            dfs_subtree[n] = 1;
            foreach (m; dfs_tree[n]) {
                if (m == p) continue;
                auto s = dfs2(m, n);
                if (s % 2) dfs_subtree_odd[n] = true;
                dfs_subtree[n] += s;
            }
            return dfs_subtree[n];
        }

        int[] ans;

        foreach (i; 0..N) if (!used[i]) dfs(i, -1);
        foreach (i; 0..N) {
            if (ord[i] == 0 && dfs_tree[i].length >= 2) {
                ans ~= i;
            } else if (ord[i] != 0 && dfs_tree[i].map!(j => (low[j] >= ord[i])).any) {
                ans ~= i;
            }
        }

        foreach (i; 0..N) if (ord[i] == 0) dfs2(i, -1);

        //ord.writeln;
        //low.writeln;
        //G.writeln;
        //dfs_tree.writeln;
        return ans;
    }
}



Measured memory_bytes: 10548
import numpy as np
a = int(input())
b,c=map(int,input().split())
d = np.arange(a,1001,a)
f = np.arange(b,c+1)
d_set=set(d)
f_set=set(f)
#dとfに共通するものを抽出
g_set=d_set&f_set 
#結果をlistに変換
g=list(g_set)
if len(g) == 0:
    print('NG')
else:
    print('OK')

Measured memory_bytes: 27140
import java.util.HashMap;
import java.util.Scanner;

public class Main {

	static Scanner sc = new Scanner(System.in);
	static char[] input;
	static int pos;

	public static void main(String[] arg) {
		String[] q = sc.nextLine().split("\\.");
		StringBuilder sb = new StringBuilder();
		while (sc.hasNext()) {
			sb.append(sc.nextLine() + "\n");
		}
		input = sb.toString().toCharArray();
		Elem elem = parseMapping(0);
		for (int i = 1; i < q.length && elem != null; ++i) {
			elem = elem.get(q[i]);
		}
		System.out.println(elem == null ? "no such property" : elem.toString());
	}

	static Mapping parseMapping(int indent) {
		Mapping mapping = new Mapping();
		while (true) {
			int n = nextIndent();
			if (n != indent) break;
			pos += indent;
			int sp = pos;
			while (input[pos] != ':') {
				++pos;
			}
			String key = String.valueOf(input, sp, pos - sp);
			++pos;
			if (input[pos] == '\n') {
				++pos;
				int m = nextIndent();
				Mapping child = parseMapping(m);
				mapping.map.put(key, child);
			} else {
				++pos;
				sp = pos;
				while (input[pos] != '\n') {
					++pos;
				}
				mapping.map.put(key, new Str(String.valueOf(input, sp, pos - sp)));
				++pos;
			}
		}
		return mapping;
	}

	static int nextIndent() {
		int cur = pos;
		if (cur >= input.length) return -1;
		while (input[cur] == ' ') {
			++cur;
		}
		return cur - pos;
	}

	static abstract class Elem {
		abstract Elem get(String key);
	}

	static class Mapping extends Elem {
		HashMap<String, Elem> map = new HashMap<String, Elem>();

		Elem get(String key) {
			return map.get(key);
		}

		public String toString() {
			return "object";
		}
	}

	static class Str extends Elem {
		String v;

		Str(String s) {
			this.v = s;
		}

		Elem get(String key) {
			return null;
		}

		public String toString() {
			return "string \"" + v + "\"";
		}
	}

}

Measured memory_bytes: 27912
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <set>
using namespace std;

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

    int p[51];
    int x[51];
    for (int i=0; i < n; ++i) {
        cin >> p[i];
        x[i] = p[i];
    }
    sort(x, x+n);
    for (int i=0; i < n; ++i) {
        int t[51];
        for (int j=i; j < n; ++j) {
            copy(p, p+n, t);
            swap(t[i], t[j]);
            bool isOk = true;
            
            for (int k=0; k < n; ++k) {
                if (t[k] != x[k]) {
                    isOk = false;
                    break;
                }
            }
            if (isOk) {
                cout << "YES" << endl;
                return 0;
            }
        }
    }
    cout << "NO" << endl;
    return 0;
}

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

int main()
{
    int n;
    cin >> n;
    vector<unsigned> v(n);
    for(auto i=0; i<n; i++) {
        cin >> v[i];
    }
    sort(v.begin(), v.end(), greater<unsigned>());
    int sum = *v.begin() / 2;
    for(auto i=1; i<n; i++) {
        sum += v[i];
    }
    cout << sum << "\n";
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define PI 3.1415926535897932384626433832795
#define ll long long
#define MP make_pair
#define IN insert
#define PB push_back
#define fr first
#define se second
#define sf scanf
#define pf printf
#define debug(x) cout<<"---------"<<x<<endl;
#define LEN(a) sizeof(a)/sizeof(a[0])
#define MEM(arr,k) memset(arr,k,sizeof arr)
#define input freopen("input","r",stdin)
#define output freopen("output","w",stdout)

int X8[] = {0, 1, 0, -1, 1, -1, 1, -1};
int Y8[] = {1, 0, -1, 0, 1, -1, -1, 1};
int X4[]={+1,-1,+0,+0};
int Y4[]={+0,+0,+1,-1};

using namespace std;


int main()
{
    int n,k;
    sf("%d %d",&n,&k);
    n = n-k;
    if(k==1)
    {
		pf("0\n");
	}
    else
    {
		pf("%d\n",n);
	}
    
    return 0;
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;
import java.util.stream.IntStream;

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

        int N = sc.nextInt();
        int K = sc.nextInt();
        int[] h = new int[N];
        for (int i = 0; i < h.length; ++i) {
            h[i] = sc.nextInt();
        }

        System.out.println(solve(h, K));

        sc.close();
    }

    static int solve(int[] h, int K) {
        h = Arrays.stream(h).boxed().sorted().mapToInt(x -> x).toArray();

        int[] h_ = h;
        return IntStream.rangeClosed(0, h.length - K).map(i -> h_[i + K - 1] - h_[i]).min().getAsInt();
    }
}

Measured memory_bytes: 61088
s=input()
if 4<len(s)<10 and s in ['KIHBR', 'KIHBRA', 'KIHBAR', 'KIHBARA', 'KIHABR', 'KIHABRA', 'KIHABAR', 'KIHABARA', 'AKIHBR', 'AKIHBRA', 'AKIHBAR', 'AKIHBARA', 'AKIHABR', 'AKIHABRA', 'AKIHABAR', 'AKIHABARA']:print("YES")
else:print("NO")

Measured memory_bytes: 2940
import java.util.Scanner;
import java.util.regex.*;
import java.math.*;

public class Main {
	
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		//int a = sc.nextInt();
		// スペース区切りの整数の入力
		//int b = sc.nextInt();
		//int c = sc.nextInt();
		// 文字列の入力
		//String s = sc.next();
		//1文字ずつ
		//s.atChar(i);
		// 出力
		//System.out.println("");
		//double countx=0;
		String s=sc.next();
		long K=sc.nextLong();
	
		
	
		long aho=5000000000000000L;
		
		int[] nums = new int[s.length()];
		//int[] counts=new int[s.length()];
		int non_one=0;
		//System.out.println(s.charAt(0));
		for(int i=0;i<s.length();i++){
			nums[i]=Character.getNumericValue(s.charAt(i));
			//System.out.println(i+":"+nums[i]);
			//counts[i]=nums[i];
			
			if(nums[i]!=1){
				non_one=i;
				break;
			}
			
		}
		if(K<=non_one){
			System.out.println(1);
		}else{
			System.out.println(nums[non_one]);
		}
		
		
		
	}
}

Measured memory_bytes: 21844
#include <bits/stdc++.h> 
#include <time.h>
#define F(i,a,b) for(long long i=a;i<=(b);++i)
#define dF(i,a,b) for(long long i=a;i>=(b);--i)
#define inf 0x3f3f3f3f
#define infll 0x3f3f3f3f3f3f3f3f
#define pb push_back
#define maxnkp make_pair
#define fi first
#define se second
#define eps 1e-10
using namespace std;
typedef long long ll;
const int mods = 1e9+7;
const int maxn = 1e5+10;
const int N = 1e5+10;
const int E = 2e5+10;  
ll n,m,k,x;
bool vis[maxn];
int main(){
	cin>>n>>k;
	F(i,1,k){
		cin>>m;
		F(j,1,m){
			cin>>x;
			vis[x]=1;
		}
	}
	ll ans = 0;
	F(i,1,n) if(!vis[i]) ans++;
	cout<<ans<<endl;
}


Measured memory_bytes: 3640
//============================================================================
// Name        : abc.cpp
// Author      : 
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <iomanip>
using namespace std;

int main() {
	double t,x;
	cin >> t >> x;
	cout << setprecision(8) << t / x;
	return 0;
}


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

int main(void){
    int a;
    int b;
    int c;

    cin >>a;
    cin >>b;
    cin >>c;

    if(a == b && a!=c){
        cout << "Yes" << endl;
    }else if(b==c && a!= b){
        cout << "Yes" << endl;
    }else if(a==c && a!= b){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

    return 0;
}

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

int main()
{
    int arr[6],i,k,min,max;
    for (i=0;i<6;i++)
    {
        scanf("%d",&arr[i]);
    }
    k=arr[5];
    min=arr[0];
    for(i=0;i<6;i++)
    {
            if(arr[i]<min)
            {
                min=arr[i];
            }
    }
    max=arr[0];
    for(i=0;i<6;i++)
    {
            if(arr[i]>max)
            {
                max=arr[i];
            }
    }
    if ((max-min)<=k)
        printf("Yay!");
    else
        printf(":(");
    return 0;
}


Measured memory_bytes: 128
/*
 * atcoder/abc138/c.cpp
 */

// C++ 14
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring> // memset
#include <cassert>
using namespace std;
#define ll long long
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)
template <class T> ostream & operator << (ostream & out, vector<T> const & v) {
  for (auto &&a: v) out << a << " "; out << endl; return out;
}
template <class T> void dump(T &a) { cout << a << endl; }
void solve();
int main() { solve(); return 0; }


#include <set>
void solve() {
  cout.precision(15); cout << fixed;
  int n;
  cin >> n;
  vector<double> A(n);
  loop(i,0,n) cin >> A[i];
  sort(A.begin(), A.end());
  double prev = (A[0] + A[1])/2;
  loop(i,2,n) {
    prev = (prev + A[i])/2;
  }
  cout << prev << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] a = new int[N];
		for(int i = 0; i < a.length; i++){
			a[i] = sc.nextInt();
		}
		sc.close();

		int max = Integer.MIN_VALUE;
		int min = Integer.MAX_VALUE;

		for(int ai: a){
			if(ai < min){
				min = ai;
			}
			if(max < ai){
				max = ai;
			}
		}
		System.out.println(max-min);
	}

}


Measured memory_bytes: 22612
//%std
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define per(i,a,b) for(int i=(a);i>=(b);--i)
#define debug(...) fprintf(stderr, __VA_ARGS__)
using namespace std;
const int mod = 1e9 + 7, N = 52, O = 50;
int fpow(int base, int v) {
	int tot = 1;
	for(; v; v >>= 1, base = 1LL * base * base % mod) if (v & 1) tot = 1LL * tot * base % mod;
	return tot;
}
void upd(int&a, int b) { a = (a + b) % mod; }
int n, fac[N], ifac[N], dp[N][2 * N];
int main ()
{
	scanf("%d", &n);
	fac[0] = 1; rep(i, 1, 50) fac[i] = 1LL * fac[i - 1] * i % mod;
	ifac[50] = fpow (fac[50], mod - 2);
	per(i, 49, 0) ifac[i] = 1LL * ifac[i + 1] * (i + 1) % mod;
	dp[0][O + 1] = 1;
	rep(i, 0, n - 1) {
		if (i == 0) {
			int x = 1, y = 0;
			rep(d, -y, x) upd (dp[i + x + y][O + d], 1LL * ifac[x - d] * ifac[y + d] % mod * dp[i][O + x - y] % mod);
			continue;
		}
		rep(x, 0, n - i) rep(y, 0, n - i - x) if (x + y > 0) rep(d, -y, x) upd (dp[i + x + y][O + d], 1LL * ifac[x - d] * ifac[y + d] % mod * dp[i][O + x - y] % mod);
	}
	int ans = 1LL * fac[n] * dp[n][O] % mod;
	printf ("%d\n", ans);
	return 0;
}

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

set<int> monday_saturday_primes(int lim) {
    vector<bool> is_prime(lim+1, true);
    for (int i = 0; i < lim+1; ++i) {
        is_prime[i] = i % 7 == 1 or i % 7 == 6;
    }
    is_prime[1] = false;
    set<int> result;
    for (int i = 1; ; ++i) {
        for (int j : { -1, 1 }) {
            int n = i*7+j;
            if (not (n < lim+1)) goto done;
            if (is_prime[n]) {
                result.insert(n);
                for (int k = n+n; k < lim+1; k += n) {
                    is_prime[k] = false;
                }
            }
        }
    }
done:
    return result;
}

set<int> monday_saturday_prime_factors(int n) {
    assert (n % 7 == 1 or n % 7 == 6);
    set<int> result;
    for (int i = 1; ; ++i) {
        for (int j : { -1, 1 }) {
            int m = 7*i + j;
            if (not (m <= n)) goto done;
            if (n % m == 0) {
                result.insert(m);
            }
        }
    }
done:
    return result;
}

int main() {
    set<int> primes = monday_saturday_primes(300000);
    while (true) {
        int n; cin >> n;
        if (n == 1) break;
        cout << n << ":";
        for (int p : monday_saturday_prime_factors(n)) {
            if (primes.count(p)) {
                cout << " " << p;
            }
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 2908
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<cstring>
#include<map>
#include<vector>
#include<queue>
#include<stack>
#include<climits>
#include<set>
#include<utility>
#include<typeinfo>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef set<int> S;
#define rep(i, n) for(int i=0; i<n; i++)
const ll MOD=1e9+7;

int main(){

	pair<pair<string, int>, int> p[110];
	int n;
	string s;
	cin >> n;
	for(int i=0; i<n; i++){
		int t;
		cin >> s >> t;
		p[i]=make_pair(make_pair(s, -t), i);
	}
	sort(p, p+n);
	for(int i=0; i<n; i++){
		cout << p[i].second+1 << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
#include <math.h>
#define Max(a, b) ((a) > (b) ? (a) : (b))
#define Min(a, b) ((a) > (b) ? (b) : (a))
#define REP(i, n) for(int i = 0; i < n; i++)
typedef long long ll;

int
main(int argc, char *argv[])
{
  ll a, b, c;
  scanf("%lld %lld %lld", &a, &b, &c);

  if(a == b && b == c && c % 2 == 0) printf("-1\n");
  else{
    ll ans = 0; ll tmp[3];
    while(a % 2 == 0 && b % 2 == 0 && c % 2 == 0){
      tmp[0] = a / 2;
      tmp[1] = b / 2;
      tmp[2] = c / 2;
      a = tmp[1] + tmp[2];
      b = tmp[0] + tmp[2];
      c = tmp[0] + tmp[1];
      ans++;
    }
    printf("%lld\n", ans);
  }

  return 0;
}


Measured memory_bytes: 128
l = []
z = []
w = []
n = int(input())
for i in range(n):
    x,y = map(int,input().split())
    l.append([x+y,x,y])
    z.append(x+y)
    w.append(x-y)

l.sort()
z.sort()
w.sort()

ans = max(z[-1]-z[0],w[-1]-w[0])

print(ans)


Measured memory_bytes: 65272