akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y

using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;

using f32 = float;
using f64 = double;

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) for(i64 i = 1; i <= n; ++i)
#define RREP(i, n) for(i64 i = n - 1; i >= 0 ; --i)
#define RREPS(i, n) for(i64 i = n; i >= 1; --i)

#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define pb push_back
#define mp make_pair

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; }

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }

template<typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }


struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;


int main() {
    i64 K; cin >> K;
    i64 A, B; cin >> A >> B;
    for (i64 i = A; i <= B; i++) {
        if (i % K == 0) {
            cout << "OK" << endl;
            return 0;
        }
    }
    cout << "NG" << endl;

    return 0;
}

Measured memory_bytes: 3648
#include<stdio.h>
int main(void)
{
	int a[100],n,k,p,i,j,cnt;
	cnt=0;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d %d",&k,&p);
		if(k%p==0){
			a[i]=p;
		}
		else {
			a[i]=k%p;
		}
	}
	for(j=0;j<n;j++){
		printf("%d\n",a[j]);
	}
	return 0;
}

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

int main() {
    int N, p = 0, w = 0, g = 0, y = 0;
    string s;
    cin >> N;
    
    for (int i = 0; i < N; i++) {
        cin >> s;
        if (s == "P") {
            p = 1;
        }
        else if (s == "W") {
            w = 1;
        }
        else if (s == "G") {
            g = 1;
        }
        else {
            y = 1;
        }
    }

    int count = p + w + g + y;
    string ans = "Three";
    if (count == 4) {
        ans = "Four";
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0; i<(int)(n); ++i)

using namespace std;

class ParseError{};
struct Result{
    int p, val;
    Result(int a, int b) : p(a), val(b) {}
};
struct Parser{
    int order_dict[256];
    Parser(){
        memset(order_dict, 0, sizeof(order_dict));
        order_dict['*'] = 5;
        order_dict['+'] = 4;
        order_dict['-'] = 4;
        order_dict['&'] = 3;
        order_dict['^'] = 2;
        order_dict['|'] = 1;
    }
    int eval(string s){
        Result r = expr(s, 0, 0);
        if(r.p != s.size()) throw ParseError();
        return r.val;
    }
    int calc(int a, int b, char c){
        //printf("%d%c%d\n", a, c, b);
        if(c == '*') return a * b;
        if(c == '+') return a + b;
        if(c == '-') return a - b;
        if(c == '&') return a & b;
        if(c == '^') return a ^ b;
        if(c == '|') return a | b;
        assert(false);
    }
    Result expr(string s, int k, int order){
        if(order == 5) return term(s, k);
        Result r = expr(s, k, order + 1);
        while(order_dict[ s[r.p] ] == order + 1){
            Result t = expr(s, r.p + 1, order + 1);
            r.val = calc(r.val, t.val, s[r.p]);
            r.p = t.p;
        }
        return r;
    }
    Result term(string s, int k){
        if(s[k] == '('){
            Result r = expr(s, k + 1, 0);
            if(s[r.p++] != ')') throw ParseError();
            return r;
        }else if(isdigit(s[k])){
            if(s[k] == '0') throw ParseError();
            int val = 0;
            while(isdigit(s[k])){
                val = val * 10 + s[k++] - '0';
            }
            return Result(k, val);
        }else {
            throw ParseError();
        }
    }
    bool valid(string s){
        try{
            eval(s);
            return true;
        }catch(...){
            return false;
        }
    }
};
Parser P;

int dfs(const string& s, int n, int type){
    if(n == 0){
        try{
            return P.eval(s);
        }catch(...){
            return (type == 0 ? INT_MAX : INT_MIN);
        }
    }
    string cs = "()*+-&^|0123456789";
    vector<string> next;
    int res = (type == 0 ? INT_MIN : INT_MAX);
    // add 
    for(int i = 0; i <= s.size(); i++){
        for(char c : cs) {
            string ns = s.substr(0, i) + string(1, c) + s.substr(i);
            next.push_back(ns);
        }
    }
    // delete
    for(int i = 0; i < s.size(); i++){
        string ns = s.substr(0, i) + s.substr(i + 1);
        next.push_back(ns);
    }
    for(const string& ns : next) {
        //cout << s << "->" << ns << endl;
        try{
            P.eval(ns);
            if(type == 0){
                res = max(res, dfs(ns, n - 1, type ^ 1));
            }else{
                res = min(res, dfs(ns, n - 1, type ^ 1));
            }
        }catch(...){
        }
    }
    return res;
}

int main(){
    int N;
    while(cin >> N && N > 0){
        if(N % 2 == 0) N = 2;
        else N = 1;
        string s;
        cin >> s;
        cout << dfs(s, N, 0) << endl;
    }
    return 0;
}

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

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;

int main()
{
    int a, b;
    cin >> a >> b;
    OP(a * b - a - b + 1);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
int main() {
  int N;
  cin >> N;
 
  vector<int> a(N);
  for(int i = 0; i < N; i++) {
    cin >> a[i];
  }
 
  int mi = a[0], ma = a[0];
 
  for(int i = 0; i < N; i++) {
    mi = min(mi, a[i]);
    ma = max(ma, a[i]);
  }
 
  if(ma - mi > 1) {
    cout << "No" << endl;
    return 0;
  }
 
  if(ma == mi) {
    int x = ma;
    if(x == N - 1) {
      cout << "Yes" << endl;
      return 0;
    }
 
    if(N >= x * 2) {
      cout << "Yes" << endl;
      return 0;
    }
 
    cout << "No" << endl;
    return 0;
 
  }
 
  int x = ma;
 
  int b = 0;
 
  for(int i: a) {
    if(i == ma) {
      b += 1;
    }
  }
 
  if((N - b) + 1 <= x && x <= (N - b) + b / 2){
    cout << "Yes" << endl;
    return 0;
  }
 
  cout << "No" << endl;
  return 0;
 
}

Measured memory_bytes: 768
import sys
sys.setrecursionlimit(10 ** 9)
# input = sys.stdin.readline    ####
def int1(x): return int(x) - 1
def II(): return int(input())
def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())
def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def MS(): return input().split()
def LS(): return list(input())
def LLS(rows_number): return [LS() for _ in range(rows_number)]
def printlist(lst, k=' '): print(k.join(list(map(str, lst))))
INF = float('inf')
# from math import ceil, floor, log2
# from collections import deque
# from itertools import combinations as comb, combinations_with_replacement as comb_w, accumulate, product, permutations
# from heapq import heapify, heappop, heappush
# import numpy as np    # cumsum
# from bisect import bisect_left, bisect_right

def solve():
    N = II()
    ans = 0
    for i in range(1, N+1):
        if i % 3 == 0 or i % 5 == 0 : continue
        ans = ans + i
    print(ans)

if __name__ == '__main__':
    solve()


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

#define rep(i, n) for(int i = 0; i < n; i++)
#define rrep(i, n) for(int i = n; i >= 0; i--)
#define rep_(i, m, n) for(int i = m; i < n; i++)
#define inf 2e9
#define ALL(v) v.begin(), v.end()
typedef long long ll;


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

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

    else cout << "No" << endl;
  }

}


Measured memory_bytes: 256
#include <stdio.h>
#include <string>
#include <vector>
#include <array>
#include <memory>
#include <iostream>
#include <algorithm>

using namespace std;

int main(void) {
	

	int win=-1;
	
	int a;
	cin >> a;

	int power[2];
	power[0] = 0;
	power[1] = 0;
	vector<string> aaa;
	vector<string>bbb;
	for (int i = 0; i < a; ++i) {
		string tt;
		cin >> tt;
		aaa.push_back(tt);
	}
	for (int i = 0; i < a; ++i) {
		string tt;
		cin >> tt;
		bbb.push_back(tt);
	}
	for (int i = 0; i < a; ++i) {
		string tl[2];
		tl[0] = aaa[i]; tl[1] = bbb[i];
		if (tl[0] == "tameru") {
			if (power[0] != 5)power[0]++;
		}
		if (tl[1] == "tameru") {
			if (power[1] != 5)power[1]++;
		}
		if (tl[0] == "kougekida"&&tl[1] == "mamoru") {
			if (power[0] == 0)win = 1;
			if (power[0] == 5)win = 0;
			else {
				power[0] = 0;
			}

		}
		else if (tl[0] == "mamoru"&&tl[1] == "kougekida") {
			if (power[1] == 0)win = 0;
			if (power[1] == 5)win = 1;
			else {
				power[1] = 0;
			}
		}else if (tl[0] == "kougekida"&&tl[1] == "tameru") {
			if (power[0] != 0)win = 0;
			else {
				win = 1;
			}

		}
		else if (tl[0] == "tameru"&&tl[1] == "kougekida") {
			if (power[1] != 0)win = 1;
			else {
				win = 0;
			}
		}
		else if (tl[0] == "kougekida"&&tl[1] == "kougekida") {
			if (power[0] == 0)win = 1;
			else if (power[1] == 0)win = 0;
			if (power[0] == 0 && power[1] == 0) { win = -1; }
			if (power[0] > power[1]) {
				win = 0;
			}
			else if (power[0] < power[1]) {
				win = 1;
			}
			else {
				power[0] = 0;
				power[1] = 0;
			}
		}
		if (win != -1)break;


	}
	/*if (win == -1) {
		if (power[0] > power[1]) {
			win = 0;
		}
		else if(power[0] < power[1]) {
			win = 1;
		}
	}
*/
	switch (win) {
	case 0:
		cout << "Isono-kun" << endl;
		break;
	case 1:
		cout << "Nakajima-kun" << endl;
		break;
	case -1:
		cout << "Hikiwake-kun" << endl;

	}
	
	
	return 0;

}

Measured memory_bytes: 1232
#include <bits/stdc++.h>
 
using namespace std;
 
#define repr(i,a,b) for (int i=a; i<b; i++)
#define rep(i,n) for (int i=0; i<  n; i++)
 
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
 
const long long INF = 1LL << 60;
#define PI 3.14159265359 
 
template<typename T>
void remove(std::vector<T>& vector, unsigned int index)
{
    vector.erase(vector.begin() + index);
}
 
int gcd(int a, int b){
    if(b == 0) return a;
    else return gcd(b, a%b);
}
 
long long lcm (int a, int b){
    return  (long long) a*b /gcd(a,b);
}


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

    int p[N];
    rep(i,N)cin>>p[i];

    int co = 0;
    rep(i,N){
        if(i+1 != p[i])co++;
    }

    if(co == 2 ||  co == 0)cout <<"YES" << endl;
    else cout <<"NO" << endl;

}

Measured memory_bytes: 3644
#include<stdio.h>
#include<math.h>
#define C(a) ((a[0]-a[1])*(a[2]-a[3]))
int main()
{
	double x[4],y[4];
	for(;;)
	{
		for(int i=0;i<4;++i)if(scanf("%lf%lf",x+i,y+i)<0)return 0;
		puts(fabs(C(x)+C(y))<1e-9?"YES":"NO");
	}
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define pf push_front
#define all(t) t.begin(), t.end()
#define inrange(i, a, b) (((i)>= min((a), (b))) && ((i) <= max((a), (b))))
typedef vector<ll> vi;
typedef pair<ll, ll> pii;
#define fi first
#define se second
#define upb upper_bound
#define lwb lower_bound
#define show(x) cout << #x << " is " << x << "\n";
const ll inf = 2e18;
const ll mod = 1e9 + 7;
const ld pi = 3.141592653589793238462643383279502884;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

void print(ll a[], ll n){for(ll i=0;i<n;i++){cout<<a[i]<<" ";}cout<<"\n";}
ll power(ll x, ll y){
    if(y<=0) return 1;
    ll ans = 1;
    x %= mod;
    while(y){
        if(y&1)
            ans = (x * ans) % mod;
        x = (x * x) % mod;
        y >>= 1;
    }
    return ans;
}
ll modInverse(ll n) {return power(n, mod-2);}
inline ll mul(ll a, ll b){ return (a * b) % mod; }
inline ll sub(ll a, ll b){ ll c = (a - b); if(c < 0) c += mod; return c; }
inline ll add(ll a, ll b){ ll c = (a + b); if(c >= mod) c -= mod; return c; }
inline ll divi(ll a, ll b){ return mul(a, modInverse(b)); }

//------------------------------------------------------------------------------------------

const ll N = 1e6 + 1;
//vector<ll> adj[N];
//bool visited[N];

ll modfac[N];
ll modfacinv[N];
ll invsi[N];

void simake(){
	invsi[0]=1;
	invsi[1]=1;

	modfac[0]=1;
	modfac[1]=1;

	modfacinv[0]=1;
	modfacinv[1]=1;

	for(ll i=2;i<N;i++)
	{
		invsi[i] = mul(invsi[mod%i], (mod-(mod/i)));
		modfac[i] = mul(i, modfac[i-1]);
		modfacinv[i] = mul(invsi[i], modfacinv[i-1]);
	}
}

ll nCrm(ll n,ll r){
	if(n==r||r==0) return 1;
	if(n<r) return 0;
	return mul(mul(modfac[n], modfacinv[r]), modfacinv[n-r]);
}
ll nPrm(ll n,ll r){
	ll op;
	if(n==r||r==0) op = 1;
	if(n<r) return 0;
	op =  mul(mul(modfac[n], modfacinv[r]), modfacinv[n-r]);
	return mul(op, modfac[r]);
}

int main() {
	simake();
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    cout<<fixed<<setprecision(10);

	ll n;
	cin>>n;

if(n==1){
	cout<<0;
	return 0;
}
ll op = 0;
for(int i=1;i<=n;i++){
	op = add(op, mul(nCrm(n, i), power(8, n-i)));
}
op = add(mul(op, 2), power(8, n));
cout<<sub(power(10, n), op);

    return 0;
}


Measured memory_bytes: 27092
def main():
    import math
    import sys

    input = sys.stdin.readline

    n = int(input())
    c_1 = 0
    c_2 = 0
    c_3 = 0

    for i in range(n):
        for j in range(i,n):
            gc = math.gcd(i+1,j+1)
            for k in range(j,n):
                if i == j and j == k:
                    c_1  += i+1
                elif i != j and j != k and k != i:
                    c_2 += math.gcd(gc,k+1)
                else:
                    c_3 += math.gcd(i+1,k+1)

    print(c_1 + c_2 * 6 + c_3 * 3)

if __name__ == '__main__':
    main()

Measured memory_bytes: 67936
#include <iostream>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
using namespace std;

typedef long long ll;
#define rep(i, n) for(int i = 0; i < n; i++)

int main(){
    int N, K;
    cin >> N >> K;
    ll h[N];
    rep(i, N) cin >> h[i];
    ll sub_min = pow(10, 9);
    sort(h, h + N);
    for(int i = 0; i + K <= N; i++){
        ll sub = h[i + K - 1] - h[i];
        sub_min = min(sub_min, sub);
    }
    cout << sub_min << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#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 MP make_pair

using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
const int MOD = 998244353;

char ch[200005];
int n, a, b, c, d;

int main()
{
	scanf("%d%d%d%d%d%s", &n, &a, &b, &c, &d, ch + 1);
	for(int i = a; i <= max(c, d) - 1; i ++)
	if(ch[i] == '#' && ch[i + 1] == '#') {
		printf("No\n");
		return 0;
	}
	if(c < d) {
		printf("Yes\n");
		return 0;
	}
	
	for(int i = max(a + 1, b); i <= min(c - 1, d); i ++)
	if(ch[i] == '.' && ch[i - 1] == '.' && ch[i + 1] == '.') {
		printf("Yes\n");
		return 0;
	}
	
	printf("No\n");
	return 0;
}

Measured memory_bytes: 384
def solve():
    cnt = 0
    while True:
        for i in range(n):
            if (li[i] % 2 != 0):
                print(cnt)
                return
            else:
                li[i] = li[i] // 2
        cnt += 1


n = int(input())
li = list(map(int, input().split()))

solve()

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

typedef long long unsigned int llu;
typedef long long int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {
  int N;
  cin >> N;
  
  int count = 0;
  for (int i=1; i<N; i++){
    count += (N-1)/i;
  }
  cout << count << endl;
}


Measured memory_bytes: 3636
#include <stdio.h>
int N,t,i,j,a[50][20];
int main(){
    char c[2]="",s[4]="SHCD";
    for(scanf("%d",&N);N--;){
        scanf("%s%d",c,&t);
        switch(c[0]){
            case'S':a[0][t-1]=1;break;
            case'H':a[1][t-1]=1;break;
            case'C':a[2][t-1]=1;break;
            case'D':a[3][t-1]=1;break;
        }
    }
    for(i=0;i<4;i++){
        for(j=0;j<13;j++){
            if(a[i][j]==0)
            printf("%c %d\n",s[i],j+1);
        }
    }
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll mod=1e9+7;
  ll n,k;
  cin >> n >> k;
  ll a[n];
  rep(i,n) cin >> a[i];
  ll ans=0;
  ll ttt=0;
  rep(i,n){
    for(int j=i+1;j<n;j++){    
      if(i<j && a[i]>a[j]){
	ans++;
      }
    }
    rep(j,n){
      if(a[i]<a[j]){
	ttt++;
      }
    }
  }
  set<ll> ss;
  multiset<ll> set;
  //  ans = (ans*k)%mod;
  ll tt=((k*(k-1))/2LL)%mod;
  //  cout << ans << " " << ttt << endl;
  cout << (ans *k + ttt*tt)%mod << endl;

  /*
  rep(i,n){
    set.insert(a[i]);
    ss.insert(a[i]);
  }
  //  cout << ans << endl;
  ll t=0;
  for(auto i: ss){
    ll tt=(((k%mod)*(k-1)%mod)/2LL)%mod;
    t = (t + ((((n-set.count(i))*tt)%mod)*set.count(i))%mod)%mod;
    
    cout << t << endl;
  }
  //  assert(t!=0);
  t = (t/2LL)%mod;
  ans = (ans+t)%mod;
  cout << ans << endl;*/
  
  return 0;
    

}


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

int n,m;

int c(int x){
	int u = 1;
	int sign = x - 1;
	for(int i = x; i >= sign; i--) u *= i;
	return u / 2;
}

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

	int ans = 0;

	if(n >= 2) ans += c(n);
	if(m >= 2) ans += c(m);

	cout << ans << endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <sstream>
#include <functional>
#include <map>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <list>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;
#define rep(i,n) for(int (i)=0;(i)<(ll)(n);++(i))
#define repd(i,n,d) for(ll (i)=0;(i)<(ll)(n);(i)+=(d))
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset((m),(v),sizeof(m))
#define chmin(x,y) (x=min(x,y))
#define chmax(x,y) (x=max(x,y))
#define fst first
#define snd second
#define UNIQUE(x) (x).erase(unique(all(x)),(x).end())
template<class T> ostream &operator<<(ostream &os, const vector<T> &v){int n=v.size();rep(i,n)os<<v[i]<<(i==n-1?"":" ");return os;}
#define N 3
ll x[N], y[N];
double r[N], t[N];
int main(){
	rep(i, N) cin>>x[i]>>y[i];
	rep(i, N){
		ll xx = x[(i+1)%N]-x[i], yy = y[(i+1)%3]-y[i];
		r[i] = sqrt(xx*xx+yy*yy);
	}
	rep(i, N){
		double a = r[i], b = r[(i+1)%3], c = r[(i+2)%3];
		t[i] = acos((b*b+c*c-a*a)/(2*b*c));
		t[i] /= 2;
	}
	double res = 0.0;
	rep(i, N){
		double l = r[i]/(1/tan(t[(i+1)%3])+1/tan(t[(i+2)%3])+2);
		chmax(res, l);
	}
	cout.precision(11);
	cout<<res<<endl;
	return 0;
}


Measured memory_bytes: 256
import math
import bisect

def is_prime(n):
    #if n % 2 == 0 and n > 2: 
    #    return False
    return all(n % i for i in range(3, int(math.sqrt(n)) + 1, 2))


N = int(input())

P = [3]

for i in range(5,10**5,4) :
    if (is_prime(i)) and (is_prime((i+1)//2)) :
        P.append(i)

ans = []

for i in range(N) :
    l,r = map(int,input().split())    
    ans.append(bisect.bisect_right(P,r) - bisect.bisect_left(P,l))

print(*ans, sep="\n")



Measured memory_bytes: 9400
#include <bits/stdc++.h>
using namespace std;
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<typename T> using gpp_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T, typename L> using gpp_map = tree<T, L, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T> using gpp_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;*/
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define bit_exist(x, n) ((x >> n) & 1)
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) { cout << #v << "=" << endl; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << endl; }
#define mdebug(m) { cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;} }
#define Return(ans) { cout << (ans) << endl; return 0; }
#define pb push_back
#define f first
#define s second
#define int long long
#define INF 1000000000000000000
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); i++) { cout << v[i]; if(i != v.size() - 1) cout << endl; }; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p){ cout << '(' << p.first << ',' << p.second << ')'; return os; }
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void Ans(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;
using pairs = vector<Pii>;

//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//char d[4] = {'D','R','U','L'};

const int mod = 1000000007;
//const int mod = 998244353;
//#define Add(x, y) x = (x + (y)) % mod
//#define Mult(x, y) x = (x * (y)) % mod



signed main(){

    int N; cin >> N;
    vec A(N - 1); cin >> A;
    vec ans(N, 0);
    REP(i, N - 1) ans[A[i] - 1]++;
    Out(ans);

    return 0;
}


Measured memory_bytes: 7952
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
    
    int N, K;
    set<int> set;
    cin >> N >> K;
    
    rep(i, K){
        
        int d;
        cin >> d;
        
        rep(j, d){
            
            int a;
            cin >> a;
            set.insert(a);
            
        }
    }
    
    cout << N - set.size() << endl;
    
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for(int i = 1; i <= n ; i++)
#define MAX_N 200100

int par[2][MAX_N];
int myrank[2][MAX_N];

void init(int n){
	rep(i,n){
		par[0][i] = par[1][i] = i;
		myrank[0][i] = myrank[1][i] =0;
	}
}

int find(int x, int z){
	return par[z][x]==x?x:par[z][x] = find(par[z][x], z);
}

void unite(int x, int y, int z){
	x = find(x,z);
	y = find(y,z);
	if(x == y) return;
	
	if(myrank[z][x] < myrank[z][y]){
		par[z][x] = y;
	} else {
		par[z][y] = x;
		if(myrank[z][x] == myrank[z][y]) myrank[z][x]++;
	}
}

signed main(){	
	int N, K, L, a, b;
	unordered_map<int,int> mp;
	cin>>N>>K>>L;
	
	init(N+10);
	
	rep(i, K){cin>>a>>b;unite(a,b,0);}
	rep(i, L){cin>>a>>b;unite(a,b,1);}
	
	rep(i,N) mp[find(i,0)*(N+1) + find(i,1)]++;
	
	rep(i,N) cout<<(i-1?" ":"")<<mp[find(i,0)*(N+1)+find(i,1)];
	
	cout<<endl;
	
	
	return 0;
}

Measured memory_bytes: 14536
#include <iostream>
#include <algorithm>

using namespace std;

typedef long long ll;

int main() {
		ll e[3];
		for (int i = 0; i < 3; i++) cin >> e[i];

		for (int i = 0; i < 3; i++) {
				if (e[i] % 2 == 0) {
						cout << 0 << endl;
						return 0;
				}
		}

		sort(e, e+3);
		cout << e[0] * e[1] << endl;
		return 0;
}


Measured memory_bytes: 256
n = int(input())
a = [int(i) for i in input().split()]

ans = 10**10
x = 0
y = sum(a)
for i in range(len(a)-1):
  x += a[i]
  y -= a[i]
  d = abs(x-y)
  if d < ans:
    ans = d
print(ans)

Measured memory_bytes: 24928
import java.util.Scanner;


public class Main {
    public static void main(String[] args) {
       Scanner sc = new Scanner(System.in);
       double r;
       r = sc.nextDouble();
       double pi = Math.PI;
       System.out.printf(" %.5f %.5f",pi*Math.pow(r,2) ,2*pi*r);
    }
}


Measured memory_bytes: 28264
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define print(x)cout<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;

int main() {
  int n;
  cin >> n;
  int x = n%10;
  if(x == 2 || x == 4 || x==5 || x ==7 || x ==9){
    cout<<"hon"<<endl;
  }
  else if(x == 3){
  cout<<"bon"<<endl;    
  }
  else{
    cout<<"pon"<<endl;
  }
  return 0;
}

Measured memory_bytes: 3620
def main():
    n, m, c = map(int, input().split())
    b_list = list(map(int, input().split()))
    a_list = [list(map(int, input().split())) for _ in range(n)]
    cnt = 0

    for i in range(n):
        tmp_sum = 0
        for j in range(m):
            tmp_sum += a_list[i][j] * b_list[j]
        if tmp_sum + c > 0:
            cnt += 1

    print(cnt)


if __name__ == "__main__":
    main()


Measured memory_bytes: 62292
#include<iostream>

using namespace std;

int main(){
  int N,M,sum=0;
  cin >> N >> M;
  int arr[M];
  for (int i = 0; i < M; i++)
  {
      cin >> arr[i];
      sum += arr[i];
  }
  if (sum > N) cout << -1;
  else cout << N - sum;
  return 0;
}


Measured memory_bytes: 3668
a = input().split()
N = int(a[0])
M = int(a[1])
Q = int(a[2])
current = []
for i in range(Q):
    e = input().split()
    f = [int(i) for i in e]
    current.append(f)
import itertools

c = list(itertools.combinations_with_replacement(range(1, M + 1), N))
value_list = []
for item in c:
    value = 0
    for k in current :
        if item[k[1]-1]-item[k[0]-1]==k[2]:
            value+=k[3]
    value_list.append(value)

print(max(value_list))

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

int main() {
  int N, K, a = 0;
  cin >> N >> K;
  vector<int> H(N);
  
  for (int i = 0; i < N; i++)
    cin >> H.at(i);
  
  sort(H.begin(), H.end());
  
  for (int i = 0; i < N; i++) {
    if (H.at(i) >= K) {
      break;
    }
    a++;
  }
  
  cout << N - a;
}

Measured memory_bytes: 640
//#include "pch.h"
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <bitset>
#include <limits.h>
#include <string>
#include <deque>
#include <cmath>

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

#define rip(i, n, s) for (int i = (s);i < (int)( n ); i++)
#define mpa make_pair
#define all(a) (a).begin(), (a).end()

int main(){
    int x;
    cin >> x;
    vector<bool> dp(x + 1,false);
    dp[0] = true;
    rip(i,x + 1, 0){
        rip(j, 106, 100){
            if(i - j >= 0){
                dp[i] = dp[i]|dp[i - j];
            }
        }
    }
    if(dp[x]){
        cout << 1 << endl;
    }
    else{
        cout << 0 << endl;
    }
}

Measured memory_bytes: 256
n = int(input())
nt  =0
na = 0
for _ in range(n):
    t,a = map(int,input().split())
    if nt==0 and na==0:
        nt =t
        na =a
        continue
    if na <= nt*(a/t):
        mod = nt%t
        if not mod==0:
            mod = t - mod
            nt = nt + mod
            na = a*nt//t
        else:
           nt = nt
           na = a*nt//t
    else:
        mod = na%a
        if not mod==0:
            mod = a - mod
            na = na + mod
            nt = t*na//a
        else:
           na = na
           nt = na*t//a 
        

print(na+nt)

Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>
#include<stdio.h>
#include<string>
#include<vector>

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

using namespace std;

// ==========================
//ライブラリ

//aからbまでの合計
int total(int a,int b) {
	int ans = 0;
	for (int i = a; i <= b; i++) {
		ans += i;
	}
	return ans;
}

// ==========================
//マクロ
#define rep(i,n) for(int i=0;i<n;i++)

// ==========================
//本文
int main() {
	int a;
	cin >> a;
	if (a)cout << "0" << endl;
	else cout << "1" << endl;
	return 0;
}

Measured memory_bytes: 3616
def resolve():
    import sys
    from fractions import gcd
    input = sys.stdin.readline
    n=int(input())
    a=list(map(int,input().split()))
    m=10**6+5
    chk=[0]*m
    for i in a:
      chk[i]+=1
    pw=1
    for i in range(2,m):
      cnt=0
      for j in range(i,m,i):
        cnt+=chk[j]
      if cnt>1:
        pw=0
        break
    g=a[0]
    for i in a[1:]:
      g=gcd(g,i)
    if pw==1:
      print('pairwise coprime')
    elif g==1:
      print('setwise coprime')
    else:
      print('not coprime')

if __name__ == '__main__':
    resolve()

Measured memory_bytes: 128680
#include<iostream>
#include<cstdio>
const int N=1e5+5;
int n,m,par[N],dir[N];
void init() {
    for(int i=1;i<=n;i++) par[i]=i,dir[i]=0;
}
int fd(int x) {
    if(x==par[x]) return x;
    int t=par[x];
    par[x]=fd(par[x]);
    dir[x]+=dir[t];
    return par[x];
}
void unite(int x,int y,int c) {
    int a=fd(x),b=fd(y);
    if(a==b) return;
    dir[a]=-dir[x]+c+dir[y];
    par[a]=b;
}
int main() {
    scanf("%d%d",&n,&m);
    int l,r,d;init();
    bool ok=true;
    while(m--) {
        scanf("%d%d%d",&l,&r,&d);
        if(fd(l)!=fd(r)) unite(l,r,d);
        else if(dir[l]-dir[r]!=d) ok=false;
    }
    printf("%s\n",ok?"Yes":"No");
    return 0;
}


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

using namespace std;

int main(){

    vector<int> v(3);
    int out=0;
    for(int i=0; i<3; i++){
        cin >> v[i];
    }

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

    out = v[0] + v[1] + ( v[2] * 10 );
    cout << out;

    return 0;
}


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


int main()
{
	int i;
	char s;
	int sum[26];
    for(i=0;i<26;i++)
		sum[i] = 0;
    while(scanf("%c",&s)!=EOF){

		if( s>='a' && s<='z')
			sum[ s%'a' ]++;

		else if(s>='A' && s<='Z')
			sum[ s%'A' ]++;

	}
        for(i=0;i<26;i++)
            printf("%c : %d\n",'a'+i , sum[i]);
return 0;
}


Measured memory_bytes: 2040
#include <iostream>
#include <string>
#include <cstring>
#include <iostream>
#include <string>
#include <cstring>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <utility>
using namespace std;
int main(){
    int n;
    cin>>n;
    vector<int> a(n);
    for(int i=0;i<n;i++)cin>>a[i];
    vector<int> dp(n);
    dp[0]=0;
    dp[1]=abs(a[1]-a[0]);
    for(int i=2;i<n;i++){
        dp[i]=min(dp[i-2]+abs(a[i-2]-a[i]),dp[i-1]+abs(a[i-1]-a[i]));
    }
    cout<<dp[n-1]<<endl;
    return 0;
}



Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
////////////////////////////////////////////////
int main()
{
    string s;
    cin >> s;
    if (s[2] == s[3] && s[4] == s[5])
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

Measured memory_bytes: 3624
import math
from functools import reduce
from collections import deque
import sys
sys.setrecursionlimit(10**7)

def s(generator, splitter, mapper):
    return [ mapper(s) for s in generator().split(splitter) ]

# スペース区切りの入力を読み込んで数値リストにして返します。
def get_nums_l():
    return [ int(s) for s in input().split(" ")]

# 改行区切りの入力をn行読み込んで数値リストにして返します。
def get_nums_n(n):
    return [ int(input()) for _ in range(n)]

n,k = get_nums_l()

edges = []

edges.append((1, 2))

right = min(k, n-2) 
for i in range(right):
    edges.append((2, i+3))

kumi = right + (right*(right-1)//2)

if(kumi < k):
    print(-1)
    exit()

over = kumi - k
count = 0
if over > 0:
    for i in range(right):
        for j in range(i+1, right):
            count += 1
            edges.append((i+3, j+3))
            if count >= over:
                break
        if count >= over:
            break

amari = n - (right+2)

for i in range(amari):
    for j in range(right+2):
        edges.append((j+1, i+right+3))

for i in range(amari-1):
    for j in range(i+1, amari):
        edges.append((i+right+3, j+right+3))

print(len(edges))
for e in edges:
    print(" ".join(map(str,(e))))

Measured memory_bytes: 46576
import java.util.*;

public class Main{
      public static void main(String[] args) {
            Scanner sc = new Scanner(System.in);
            int N = sc.nextInt();
            int X = sc.nextInt();
            int sum = 0;
            int count = 1;
            for(int i = 0; i < N; i++){
              int j = sc.nextInt();
              sum += j;
              if(sum <= X){
                count++;
              }
            }
            System.out.println(count);
          }
}

Measured memory_bytes: 22608
n = int(input())
xl = []
for _ in range(n):
    xl.append([int(i) for i in input().split()])

xl.sort(key=lambda x: x[0] + x[1])
ans = 0
i = 0
j = -10**9*2
while i < n:
    t = xl[i]
    if j <= t[0] - t[1]:
        ans += 1
        j = t[0] + t[1]
    i += 1
print(ans)


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

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

    Scanner sc = new Scanner(System.in);
    HashMap<String, Integer> hashmap = new HashMap<>();

    hashmap.put("A" , 10);
    hashmap.put("B" , 11);
    hashmap.put("C" , 12);
    hashmap.put("D" , 13);
    hashmap.put("E" , 14);
    hashmap.put("F" , 15);


    String X = sc.next();
    String Y = sc.next();



    if  (hashmap.get(X) > hashmap.get(Y)){
      System.out.println(">");
    }
    else if (hashmap.get(X) < hashmap.get(Y)) {
      System.out.println("<");
    }
    else {
      System.out.println("=");
    }
  }
}


Measured memory_bytes: 23764
#include <iostream>
#include <algorithm>

#define MAX_N 10000

using namespace std;

int N;
int k[MAX_N];

//void solve();

int main()
{
	while (cin>>N&&N) {
		//for (int i=0; i<N; i++) cin>>k[i];
		//solve();
		int zero=0,one=0;
		for (int i=0; i<N; i++) {
			int t;
			cin>>t;
			if (t==0) zero++;
			else if (t==1) one++;
		}
		if (zero+one==N) {
			cout<<"NA"<<endl;
		} else {
			cout<<N+1-zero<<endl;
		}
	}
}
/*
void solve()
{
	int zero=0;
	sort(k,k+N);
	if (k[N-1]<2) {
		cout<<"NA"<<endl;
	} else if (k[0]>=2) {
		cout<<N+1<<endl;
	} else {
		while (k[zero]==0) zero++;
		cout<<N+1-zero<<endl;
	}
	
}
*/

Measured memory_bytes: 1172
use std::io::*;
use std::str::FromStr;
use std::cmp::Ordering;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("faild to read char") as char)
        .take_while(|c| !c.is_whitespace())
        .collect();
    token
        .parse()
        .ok()
        .expect("faild to parse token")
}

fn main(){
    let mut v: Vec<i64> = Vec::with_capacity(5);
    for _ in 0..5 {
        v.push(read());
    }
    v.sort_by(cmp_num);
    let mut min_i: usize = 0;
    for i in 0..5 {
        if v[i] % 10 != 0 && v[i] % 10 < v[min_i] % 10 {
            min_i = i;
        }
    }
    let mut ret = v[min_i];
    for i in 0..5 {
        if i != min_i {
            ret += (v[i] + 9) / 10 * 10;
        }
    }
    println!("{}", ret);
}

fn cmp_num(a: &i64, b: &i64) -> Ordering {
    if a % 10 == 0 {
        return Ordering::Greater;
    }
    if b % 10 == 0 {
        return Ordering::Less;
    }
    (a % 10).partial_cmp(&(b % 10)).unwrap()
}


Measured memory_bytes: 4352
#include<cstdio>
#include <iostream>
#include<algorithm>
#include<string>
#include<cstring>
#include<queue>
#include<vector>
#include<functional>
#include<cmath>
#include<map>
#include<stack>
#include<cstdlib>
#include<list>
#include<set>
#include<numeric>

using namespace std;
typedef long long ll;
typedef pair<int, int> P;

ll a[300010];

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

	for (int i = 0; i < N * 3; i++) {
		cin >> a[i];
	}
	sort(a, a + (N * 3));
	reverse(a,a+(N*3));

	ll ans = 0;
	for (int i = 1; i < (N * 3)-N; i+=2) {
		ans += a[i];
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 2560
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "iomanip"
#include "random"

using namespace std;

const long long int MOD = 1000000007;
const long double EPS = 0.00000001;
const long double PI = 3.1415926535897932384626433;

long long int N, M, K, H, W, L, R;


int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	cin >> N >> M;
	vector<vector<int>>edge(N + 1);
	for (int i = 0; i < M; i++) {
		cin >> L >> R;
		edge[L].push_back(R);
		edge[R].push_back(L);
	}
	vector<int>dis(N + 1, INT_MAX);
	dis[1] = 0;
	queue<int>Q;
	Q.push(1);
	while (!Q.empty()) {
		int cn = Q.front();
		Q.pop();
		for (auto i : edge[cn]) {
			if (dis[i] > dis[cn] + 1) {
				dis[i] = dis[cn] + 1;
				Q.push(i);
			}
		}
	}
	bool flag = true;
	long long int odd = 0;
	long long int even = 0;
	for (int i = 1; i <= N; i++) {
		if (dis[i] % 2) {
			odd++;
		}
		else {
			even++;
		}
		for (auto j : edge[i]) {
			if (dis[i] % 2 == dis[j]%2) {
				flag = false;
			}
		}
	}
	if (flag) {
		cout << odd*even - M;
	}
	else {
		cout << N*(N - 1) / 2 - M;
	}
	cout << endl;
	return 0;
}


Measured memory_bytes: 6272
// Ver19.03
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define INF 1 << 29
#define LLINF 4545454545454545454
#define MOD 1000000007
#define ll long long
#define ull unsigned long long
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
int upll(const void *a, const void *b) { return *(ll *)a < *(ll *)b ? -1 : *(ll *)a > *(ll *)b ? 1 : 0; }
int downll(const void *a, const void *b) { return *(ll *)a < *(ll *)b ? 1 : *(ll *)a > *(ll *)b ? -1 : 0; }
void sortup(ll *a, int n) { qsort(a, n, sizeof(ll), upll); }
void sortdown(ll *a, int n) { qsort(a, n, sizeof(ll), downll); }

int s[26];
int main()
{
  while (1)
  {
    char c = getchar();
    if (c == 10)
      break;
    s[c - 'a'] = 1;
  }
  for (int i = 0; i < 26; i++)
  {
    if (s[i] == 0)
    {
      printf("%c\n", i + 'a');
      return 0;
    }
  }
  puts("None");
}

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

int main(void){


  int top=0,stack[200],i;
  char tmp[7];

  while(scanf("%s",&tmp)!=EOF){

    if(tmp[0] == '+') {
      stack[top-2] = stack[top-2]+stack[top-1];
      top--;
    }   

    else if(tmp[0] == '-') {
      stack[top-2] = stack[top-2]-stack[top-1];
      top--;
    }

    else if(tmp[0] == '*') {      
      stack[top-2] = stack[top-2]*stack[top-1];
      top--;
    }
    
    else { 
      stack[top] = atoi(tmp);
      top++;
    }
   

  }



  printf("%d\n",stack[top-1]);

  return 0;

}

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

class Program
{
    static void Main()
    {
        Console.WriteLine(Solve());
        //Solve();
        return;
    }

    public static string Solve()
    {
        string S = Read();
        int ans = 0;
        int l = S.Length;
        for (int i = 0; i < l / 2; i++)
        {
            if (S[i] != S[l - 1 - i])
            {
                ans++;
            }
        }
        return ans.ToString();
    }


    private static string Read() { return Console.ReadLine(); }
    private static int ReadInt() { return int.Parse(Read()); }
    private static long ReadLong() { return long.Parse(Read()); }
    private static double ReadDouble() { return double.Parse(Read()); }
    private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
    private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
    private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 3e3+10;
ll n, v[maxn], dp[maxn][maxn];
ll solve(int l, int r){
    if(l > r or r < l) return 0;
    if(l == r) return dp[l][r] = v[l];
    if(dp[l][r] != -1) return dp[l][r];
    return dp[l][r] = max((v[l] - solve(l+1, r)), (v[r] - solve(l, r-1)));
}
int main(){
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    cin >> n;
    for(int i=1; i<=n; i++) cin >> v[i];
    memset(dp, -1, sizeof dp);
    cout << solve(1, n) << "\n";
    return 0;
}

Measured memory_bytes: 74588
//#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define int long long
#define x first
#define y second
#define inf 1000000000000000000
#define N 1000000007
#define speed ios_base::sync_with_stdio(0);cin.tie(0);
using namespace std;
template<class L,class R> ostream& operator<<(ostream& cout,pair<L, R> P)
{return cout<<'('<<P.x<<','<< P.y<<')';}
template<class T> ostream& operator<<(ostream& cout,vector<T> V)
{cout<<"[ ";for(auto v:V)cout<<v<<' ';return cout<<']';}
vector<vector<int>> g;
map<int,bool> vis;
int dfs(int node){
    vis[node]=true;
    int ret=1;
    for(auto it:g[node]){
        if(!vis[it]){
            ret+=dfs(it);
        }
    }
    return ret;
}
//edge cases when n=1,m=1.wrong variable in loop.if<->while;merge resize;LLONG_MAX
signed main()
{
    //#ifndef ONLINE_JUDGE
    //freopen("input.txt","r",stdin);
    //#endif
    speed
    //global var
    int n,m;cin>>n>>m;
    g.resize(n);
    for(int i=0;i<m;++i){
        int a, b;cin>>a>>b;
        --a;--b;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    int ans=0;
    for(int i=0;i<n;++i){
        if(vis[i]==false){
            ans=max(ans,dfs(i));
        }
    }
    cout<<ans<<"\n";
    
}
//try thinking from a different angle after spending some time


Measured memory_bytes: 45408
// Author : MohamedSameh
#include <bits/stdc++.h>
typedef long long ll ;
#define pb push_back
#define f first
#define s second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define SZ(a) (int)a.size()
#define IN(n) scanf("%d" , &n )
void fo (){fflush(stdout);}
using namespace std;
int main ()
{

int a , b ;
cin >> a >> b ;
if (max (a , b ) <= 8 )
{
  cout <<"Yay!\n";
}else
cout <<":(\n"; 
//  cerr << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
  return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
S = int(input())
INF = 10**9

if S == 10**18:
    print(0, 0, INF, 1, 0, INF)
else:
    x = INF - S % INF
    y = S // INF + 1
    print(0, 0, INF, 1, x, y)

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

const int N = (int) 1e5 + 5;
const int MOD = (int) 1e9 + 7;
 
int n, k;
vector <int> g[N];
long long ans;

void dfs(int u, int p) {
	int remain = k - 1;
	remain -= (p != 0);
	for (int i = 0; i < g[u].size(); i++) {
		int v = g[u][i];
		if (v == p) continue;
		ans = (ans * remain) % MOD;
		remain--;
		dfs(v, u);
	} 
}

int main() {
	//freopen(".inp", "r", stdin); freopen(".out", "w", stdout);
	scanf("%d %d", &n, &k);
	for (int i = 1; i < n; i++) {
		int u, v; scanf("%d %d", &u, &v);
		g[u].push_back(v);
		g[v].push_back(u);
	}
	ans = k;
	dfs(1, 0);
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 10368
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
typedef long long ll;
long long mod = 1e9 + 7;
const int iINF = 0x3f3f3f3f;
const long long INF = 1LL << 60;
using namespace std;

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

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

int main()
{
  int n;
  cin >> n;
  vector<string> sv;

  rep(i, n)
  {
    string str;
    cin >> str;
    sv.push_back(str);
  }
  sort(sv.begin(), sv.end());
  sv.erase(std::unique(sv.begin(), sv.end()), sv.end());
  cout << sv.size() << endl;
  return 0;
}

Measured memory_bytes: 11656
let rec read () = 
  try
    let t = Scanf.scanf "%c,%c\n" (fun x y -> (x, y)) in t :: read ()
  with
    End_of_file -> []

let _ = 
  let lst = read () in
  Printf.printf "%c\n" (List.fold_left (fun c (x, y) -> 
                                       if c = x then y else if c = y then x else c) 'A' lst)

Measured memory_bytes: 2260
#include<bits/stdc++.h>
#define rep(n) for(int i=0;i<(n);i++)
#define rep1(n) for(int i=1;i<=(n);i++)
#define all(n) n.begin(),n.end()
#define fi first
#define se second
#define lb lower_bound
#define ub upper_bound
using namespace std;
using ll=long long;
using pii=pair<int,int>;
#define pb push_back
ll seg[400005];

int n;

void mod(int p,ll v){
   p+=n;
   seg[p] = v;
   for(p>>=1;p;p>>=1) seg[p] = max(seg[p<<1],seg[p<<1|1]);
}
ll que(int l,int r){
   //cout<<l<<" "<<r<<'\n';
   l+=n,r+=n+1;
   ll ans = 0;
   for(;l<r;l>>=1,r>>=1){
      if(l&1)ans = max(ans,seg[l++]);
      if(r&1)ans = max(ans,seg[--r]);
   }
   //cout<<l<<" "<<r<<" "<<ans<<'\n';
   return ans;
}

ll dp[200005];
ll h[200005];
ll beau[200005];

int main(){

    cin>>n;
    ll ans = 0;
    for(int i=1;i<=n;i++){
      cin>>h[i];
    }
    for(int i=1;i<=n;i++){
      cin>>beau[i];
      dp[i] = que(1,h[i]-1) + beau[i];
      mod(h[i],dp[i]);

      //cout<<dp[i]<<'\n';
      ans = max(ans,dp[i]);
    }
    cout<<ans<<'\n';


}


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

#define rep(i, n) for(int i = 0; i < (n); i++)
#define all(a) (a).begin(),(a).end()

using ll = long long;
constexpr ll INF = 1000000000;

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

using namespace std;

//fixed << setprecision(10)

/////////////////////////////////////////////////////////////////////////////////////////////////////////

int main() {
	ll n, a, b; cin >> n >> a >> b;

	ll sa = b - a;		// a < b

	if (sa % 2 == 0) {
		cout << sa / 2 << endl;
	}
	else {
		cout << min(a - 1, n - b) + 1 + (b - a - 1) / 2 << endl;
	}
}


Measured memory_bytes: 256