akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define     ll          long long int
#define     ld          double
#define     REP(i,x,n)    for(ll i=x;i<n;i++)
#define     SZ(v)       (ll)v.size()
#define     endl        "\n"
#define     ff          first
#define     ss          second
#define     PQ_MIN      priority_queue <ll, vector<ll>, greater<ll> >
#define     PQ          priority_queue <int>
#define     pbds        tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define     setbit(x)   __builtin_popcount(x)
#define     prec(n)     fixed<<setprecision(n)
#define     pb(n)       push_back(n)
#define     mp(a,b)     make_pair(a,b)
#define     clr(n)      memset(n,0,sizeof(n))
#define     reset(n)    memset(n,-1,sizeof(n))
#define     ii          pair<ll,ll>
#define     vll         vector<ll>
#define     PI          3.1415926535897932384626433832795028841971693993751

using namespace std;
using namespace __gnu_pbds;
bool comp(pair<ll,ll> a,pair<ll,ll> b) {       }
const ll MOD=1e9+7;
void print(vector<vector<ll> >&v)
{
    ll n=v.size();
    ll m=v[0].size();
    cout<<"\n";
    for(ll i=0;i<n;i++)
    {
        for(ll j=0;j<m;j++)
            cout<<v[i][j]<<" ";
        cout<<"\n";
    }
}
void print(vector<ll>&v)
{
    ll n=v.size();
    cout<<"\n";
    for(ll i=0;i<n;i++)
    {
            cout<<v[i]<<" ";
    }
        cout<<"\n";

}
void print(set<ll>&s)
{

cout<<endl;

set<ll>::iterator it;
for(it=s.begin();it!=s.end();it++)
    cout<<*it<<" ";
cout<<endl;
}
ll __lcm(ll a,ll b)
{
    return ((a*b)/__gcd(a,b));
}
ll power(ll a,ll p)
{
    ll res=1;
    while(p>0)
    {
        if(p&1){
            res=(res*a)%MOD;
            p--;
        }
            a=(a*a)%MOD;
            p/=2;
    }

    return res%MOD;
}
const ll INF=1e16;
const ll nxm=2e5+5;

ll spf[nxm];
void sieve()
{
    memset(spf,-1,sizeof(spf));

    spf[0]=spf[1]=1;

    for(ll i=2;i<nxm;i++)
    {
        if(spf[i]==-1)
            spf[i]=i;
        for(ll j=i*i;j<nxm;j+=i)
        {
            if(spf[j]==-1)
                spf[j]=i;

        }

    }
//    while(x>1)
//    {
//        ll s=spf[x];
//        temp[s]++;
//        x/=s;
//    }


// log n prime factor
}
void solve(){
ll n;
cin>>n;
cout<<(n^1);























}
int main(){
//    freopen("timber_input", "r", stdin);
//    freopen("output.txt", "w", stdout);
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	ll t=1;
//	cin>>t;
    REP(i,1,t+1)
    {
//    cout<<"Case #"<<i<<": ";
		solve();
    }
	return 0;
}
//  bitset<64>(x).to_ullong() // in my com  _ulong()
//  cout<<bitset<64>(ans).to_string().substr(64-m)<<endl;
/*

const int INF = 0x3f3f3f3f;


char s[100];

fgets(s,100,stdin);

stringstream stram(s);

string abc;

bool ok1=0,ok2=0;

while(stram>>abc)

ternary operator for(int i=0;i<23;i++) or while(r-l>eps)

struct P
{

    double logp;
    ll p;
    ll ind;

    	bool operator<(const P &p) const {
		if (abs(logp - p.logp) > 1e-7)
			return logp < p.logp;

		return ind < p.ind;
	} /// to use in set
};

*/


Measured memory_bytes: 3604
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.NoSuchElementException;

public class Main {
	public static void main(String[] args) {
		new Main().run();
	}
	
	void run() {
		FastScanner sc=new FastScanner();
		int X=sc.nextInt();
		int Y=sc.nextInt();
		for (int a=0;a<=100;++a) {
			for (int b=0;b<=100;++b) {
				if (X==a+b && Y==2*a+4*b) {
					System.out.println("Yes");
					return;
				}
				
			}
		}
		System.out.println("No");
		return;
	}

	void tr(Object...o) {System.out.println(Arrays.deepToString(o));}
}

class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
        	ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    
    public double nextDouble() { return Double.parseDouble(next());}
}


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

int main() {
    using namespace std;

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

    string s;

    cin >> s;

    int len_str = s.length();

    int num_win = 0;
    int num_lose = 0;
    for (int i = 0; i < len_str; i++) {
        if (s[i] == 'o') {
            num_win++;
        }
        else if (s[i] == 'x') {
            num_lose++;
        }
    }

    int hope = 8 - num_win;

    if (15 - len_str >= hope) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }

    
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<set>
#include<queue>
#include<stack>
#include<bitset>
#include<functional>
#include<map>
#include<unordered_set> 
#include<cmath>
using namespace std;
long long p = 998244353;
//long long p = 1000000007;
#define int long long
#define vel vector<long long>
#define vvel vector<vel>
#define rep(i,n) for(int i=0;i<n;i++)
#define sor(v) sort(v.begin(),v.end())
#define mmax(a,b) a=max(a,b)
#define mmin(a,b) a=min(a,b)
#define mkp make_pair
#define pin pair<int,int>
#define qin pair<int,pin>
#define V vector
#define Endl endl
#define veb vector<bool>
#define rev(s) reverse(s.begin(),s.end())
#define lower(h,val) lower_bound(h.begin(),h.end(),val)
#define upper(h,val) upper_bound(h.begin(),h.end(),val)
#define mint modint<998244353>
#define end_s(a) cout <<a<<endl;return 0
vel pa;
int root(int x) {
	if (pa[x] == -1) { return x; }
	int ans = root(pa[x]); pa[x] = ans;
	return ans;
}
void marge(int x, int y) {
	x = root(x);
	y = root(y);
	if (x != y) { pa[x] = y; }
}
V<string> solve2(int a, int b) {
	if (a < 0 || b < 0) { return {}; }
	if (a == 0 && b == 0) {
		V<string> ans(1, "");
		return ans;
	}
	V<string> ans = solve2(a - 1, b);
	V<string> nans;
	for (auto x : ans) { nans.push_back(x+"A"); }
	V<string> ans2 = solve2(a, b - 1);
	for (auto x : ans2) { nans.push_back(x+"B"); }
	return nans;
}
signed main() {
	int n; cin >> n;
	vel rui(33, 1);
	rep(i, 32) { rui[i + 1] = rui[i] * 2; }
	rep(i, n) {
		int s, t; cin >> s >> t;
		int ind = 0;
		int ans = 0;
		while (s != t) {
			if (s%rui[ind + 1] != 0) { s += rui[ind]; ans++; }
			if (t%rui[ind + 1] != 0) { t -= rui[ind]; ans++; }
			ind++;
		}
		cout << ans << endl;
	}
	return 0;
}


Measured memory_bytes: 3084
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>

using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define REP(i, n) for(ll i = 0; i < n; i++)
#define Yes(condition) if(condition){ cout << "Yes" << '\n'; }else{ cout << "No" << '\n'; }
#define YES(condition) if(condition){ cout << "YES" << '\n'; }else{ cout << "NO" << '\n'; }
#define yes(condition) if(condition){ cout << "yes" << '\n'; }else{ cout << "no" << '\n'; }






int main() {
    ll n, k;
    cin >> n >> k;
    vector<ll> a(n);
    REP(i, n){
        cin >> a[i];
    }
    vector<ll> m;
    REP(i, n){
        ll sum = 0;
        for(ll j = i; j < n; j++){
            sum += a[j];
            m.push_back(sum);
        }
    }
    sort(m.begin(), m.end(), greater<ll>());
    /*
    REP(i, m.size()){
        cout << m[i] << ' ';
    }
    cout << endl;
    */
    ll ans = 0;
    for(ll i = 0; i < 55; i++){
        ll c = 0;
        for(ll j = 0; j < m.size(); j++){
            if((m[j] & ans) != ans) continue;
            if((m[j] >> (54LL - i)) & 1LL){
                c++;
            }
        }
        if(c >= k){
            ans |= (1LL << (54LL - i));
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 6516
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
#include<iterator>
using namespace std;
typedef  long long int lint;
typedef pair<int, int> IP;
typedef pair<lint, lint> LLP;
typedef pair<char, char>CP;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define llower(v,hoge) *lower_bound(v.begin(), v.end(), hoge)
#define lupper(v,hoge) *upper_bound(v.begin(), v.end(), hoge)

vector<lint> prime_factorization(lint N) {
	//素因数分解して配列で返す
	vector<lint> R;
	if (N < 2)return R;
	for (lint i = 2; i * i <= N; i++) {
		while (N % i == 0) {
			R.push_back(i);
			N /= i;
		}
	}
	if (N != 1) {
		R.push_back(N);
	}
	return R;
}

int main() {
	lint N, P;
	cin >> N >> P;
	vector<lint>V = prime_factorization(P);
	sort(V);
	lint VS = V.size();
	if (VS == 0) {
		cout << P << endl;
		return 0;
	}
	lint cnt = 1;
	lint ans = 1;
	for (int i = 1; i < VS; i++) {
		if (V[i - 1] == V[i]) {
			cnt++;
		}
		else {
			if (cnt / N * V[i - 1] != 0) {
				ans *= pow(V[i-1],cnt / N );
			}
			cnt = 1;
		}
	}
	if (cnt / N * V[VS - 1] != 0) {
		ans *= pow(V[VS-1],cnt / N );
	}
	
	cout << ans << endl;
	
}


Measured memory_bytes: 256
N, M = gets.split.map(&:to_i)
a = gets.split.map(&:to_i)

pair = []
a.sort!
M.times do
  b, c = gets.split.map(&:to_i)
  pair << [b, c]
end

pair.sort_by! do |d|
  d[1]
end

ci = 0
end_f = false
pair.reverse.each do |d|
  d[0].times do
    if ci >= a.size
      end_f = true
      break
    end

    if a[ci] < d[1]
      a[ci] = d[1]
      ci += 1
    else
      end_f = true
      break
    end
  end
  if end_f
    break
  end
end

p a.inject(:+)

Measured memory_bytes: 19744
# coding: utf-8
s = input()
a = [0] *len(s)
for i in range(len(s)):
    for j in range(len(s) - i):
        if s[i+j: i+j+1] == "A" or s[i+j: i+j+1] == "T" or s[i+j: i+j+1] == "C" or s[i+j: i+j+1] == "G":
            a[i] += 1
        else:
            break
        
print(max(a[i] for i in range(len(s))))

Measured memory_bytes: 3064
//Running median
//keeping max heap for first half and min heap for second half
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define endl "\n"
# define M_PI           3.14159265358979323846
ll  P=1000000007;
ll M=P;
ll power(ll a, ll b) {
    if(b == 0) return 1;
    ll x = power(a, b / 2);
    x = (x * x)%M;
    if(b%2) x = (x*a)%M;
    return x;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    ll n;
    cin>>n;
    long double x=(n);
    x=(2*x*M_PI);
    cout<<fixed<<x<<endl;
    return 0;
}


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

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

const ll MOD = 1000000007;

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

    map<int, int> mp_odd;
    map<int, int> mp_even;

    int tmp_v;
    rep(i, n) {
        cin >> tmp_v;
        if ( i % 2 == 0 ) mp_even[tmp_v]++;
        else              mp_odd[tmp_v]++;
    }

    vector<pair<int, int>> p_odd;
    vector<pair<int, int>> p_even;

    for ( auto odd_num : mp_odd ) {
        p_odd.push_back(make_pair(odd_num.second, odd_num.first));
    }

    for ( auto even_num : mp_even ) {
        p_even.push_back(make_pair(even_num.second, even_num.first));
    }

    sort(p_odd.begin(), p_odd.end());
    sort(p_even.begin(), p_even.end());

//    cout << p_odd.size() << " " << p_even.size() << endl;

    if ( p_odd[p_odd.size()-1].second != p_even[p_even.size()-1].second ) {
        cout << n - p_odd[p_odd.size()-1].first - p_even[p_even.size()-1].first << endl;
    }
    else {
        int p_even_num;
        int p_odd_num;
        if ( p_even.size() >= 2 ) p_even_num = p_even[p_even.size()-2].first;
        else                      p_even_num = 0;
        if ( p_odd.size() >= 2 ) p_odd_num = p_odd[p_odd.size()-2].first;
        else                     p_odd_num = 0;
//        cout << p_even_num << " " << p_odd_num << endl;

        cout << n - max(p_odd[p_odd.size()-1].first + p_even_num, p_odd_num + p_even[p_even.size()-1].first) << endl;
    }

    return 0;
}

Measured memory_bytes: 6136
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <utility>

using namespace std;
#define LL long long
#define pb push_back
#define mk make_pair
#define pill pair<LL, LL>
#define mst(a, b)	memset(a, b, sizeof a)
#define REP(i, x, n)	for(int i = x; i <= n; ++i)
const int MOD = 1e9 + 7;
const int qq = 2e5 + 10;
const int INF = 1e9 + 10;
char s1[60], s2[60];

int main(){
	int n;	scanf("%d", &n);
	scanf("%s%s", s1, s2);
	int up, down;
	up = down = 0;
	LL ans = 1;
	int state = 0;
	while(up < n && down < n) {
		int f;
		if(s1[up] == s2[down]) {
			f = 1;
			up++, down++;
		} else {
			f = 2;
			up += 2;
			down += 2;
		}
		if(state == 0) {
			if(f == 1)	ans *= 3;
			else if(f == 2)	ans *= 6;
		} else if(state == 1) {
			if(f == 1)	ans *= 2;
			else if(f == 2)	ans *= 2;
		} else if(state == 2) {
			if(f == 1)	ans *= 1;
			else if(f == 2)	ans *= 3;
		}
		ans %= MOD;
		state = f;
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 256
h, w = list(map(int, input().split()))
n = int(input())
a = [0]+list(map(int, input().split()))

ans = [[0]*w for _ in range(h)]
color = 1
for y in range(h):
    for x in range(w):
        if y%2 == 0:
            ans[y][x] = color
        else:
            ans[y][-(x+1)] = color
        a[color] -= 1
        if a[color] == 0:
            color += 1

    print(' '.join(map(str, ans[y])))


Measured memory_bytes: 3552
#include <stdio.h>
long long n, i, a, s=1, d=1e18;
double t=1;
int main(){
	scanf("%lld", &n);
	for(i=1; i<=n; i++){
		scanf("%lld", &a);
		s = s * a;
		t = t * a;
	}
	if(s > d || t > d) printf("-1\n");
	else printf("%lld\n", s);
	return 0;
}

Measured memory_bytes: 1736
n, k = map(int, input().split())

A = list(map(int, input().split()))


min_a = A.index(min(A))

left = min_a
right = n - min_a - 1


min_ = min(left, right)
max_ = max(left, right)


t = 0
min_ = min_ - k
t +=1
temp = 0
if min_ > 0:
    if min_ % (k - 1) != 0:
        temp = min_ // (k - 1)
    else:
        temp = min_ // (k - 1) + 1
    min_ -= temp * (k - 1)
t += temp

max_ = max_ + min_ + 1

if max_ % (k - 1) == 0:
    t += max_ // (k - 1)
else:
    t += max_ // (k - 1) + 1

print(t)

Measured memory_bytes: 52476
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(int (i) = (s);(i) <= (e);(i)++)

int main(){
  int N;
  string s;
  cin >> N >> s;
  int ans = 0;
  for(int i = 0;i < N - 1;i++){
    set<char> st;
    rep(j,0,i) st.insert(s[j]);
    int cnt = 0;
    rep(j,i + 1,N - 1){
      cnt += st.count(s[j]);
      st.erase(s[j]);
    }
    ans = max(ans , cnt);
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
//#include<ext/pb_ds/assoc_container.hpp>
using namespace std;
//using namespace __gnu_pbds;
const int inf=0x3f3f3f3f;
const double eps=1e-6;
const int mod=1000000007;
typedef long long ll;
int modpow(int x,int y,int md=mod){if(y==0)return 1;int ret=modpow(x,y>>1,md);ret=(ll)ret*ret%md;if(y&1)ret=(ll)ret*x%md;return ret;}
int n; 
int main(){
	cin>>n;
	cout<<180*n-360<<endl;
	return 0;
}

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

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

	vector<int> dv(n);
	for (auto& d : dv) {
		cin >> d;
	}

	int ret = 0;
	for (int i = 0; i < n; ++i) {
		for (int j = i + 1; j < n; ++j) {
			ret += dv[i] * dv[j];
		}
	}

	cout << ret << endl;
	return 0;
}

Measured memory_bytes: 256
// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools

#include <bits/stdc++.h>

using namespace std;

using i64 = long long;

const i64 MOD = 1e9 + 7;
const i64 INF = i64(1e18) + 7;


template <typename T>
bool chmin(T& x, T y){
    if(x > y){
        x = y;
        return true;
    }
    return false;
}

template <typename T>
bool chmax(T& x, T y){
    if(x < y){
        x = y;
        return true;
    }
    return false;
}


void solve(long long n, long long k, std::vector<long long> h){
    sort(h.begin(), h.end(), greater<>());
    i64 ans = 0;
    for(int i = 0; i < n; ++i){
        if(k){
            --k;
        }
        else{
            ans += h[i];
        }
    }
    cout << ans << endl;
}


signed main(){
    long long N;
    scanf("%lld",&N);
    long long K;
    scanf("%lld",&K);
    std::vector<long long> H(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&H[i]);
    }
    solve(N, K, std::move(H));
    return 0;
}


Measured memory_bytes: 1792
#include<stdio.h>
#include<string.h>
#define LEN 1000005

typedef struct pp{
  char name[100];
  int t;
}P;

P Q[LEN+1];
int head=1, tail, n;

void enqueue(P x){

  Q[tail]=x;
  tail++;
}

P dequeue(){
  P x;
  x=Q[head];
  head++;
  return x;
}


int main(){
  int elaps = 0, c=0;
  int i, q;
  P u;
  scanf("%d %d", &n, &q);

  for ( i = 1; i <= n; i++){
    scanf("%s", Q[i].name);
    scanf("%d", &Q[i].t);
 }

  tail=n+1;


  while(1){

    u=dequeue();

    u.t=u.t-q;

    if(c==n) break;

    if(u.t>0){
      enqueue(u);
      elaps+=q;
    }

    if(u.t<=0){
      elaps+=(u.t+q);
      u.t=0;
      printf("%s %d\n",u.name,elaps);
      c++;
}

}

  return 0;
}

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

#define ll long long int

int main(){
    int k,x;
    string s;
    map<string,ll> mp;
    cin >> k;
    while(k--){
        cin >> s;
        sort(s.begin(),s.end());
        mp[s] += 1;
    }
    ll ans = 0;
    for(auto it:mp){
        ans += (it.second)*(it.second-1)/2;
    }
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 11136
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		String[] strArray = br.readLine().split(" ");
		int count = 0;
		int currentNum= 1;
		for(int i = 0; i < n ; i++) {
			int a = Integer.parseInt(strArray[i]);
			if(a ==currentNum) {
				count++;
				currentNum++;
			}
		}
		if(currentNum == 1) {
			System.out.println(-1);
		}else {
			System.out.println(n-count);

		}
	}
}


Measured memory_bytes: 51924
#include<stdio.h>
 int main(void){
   int N;
   int i, l, r;
   int kotae = 0;
   scanf("%d", &N);
   for(i = 0; i < N; i++){
     scanf("%d %d", &l , &r);
     kotae = r - l + 1 + kotae;
   }
   printf("%d\n", kotae);
  return 0;
 }


Measured memory_bytes: 128
import itertools

N, M = map(int,input().split())
edges = {tuple(sorted(map(int,input().split()))) for i in range(M)}
ans = 0
for i in itertools.permutations(range(2,N+1)):
  l = [1] + list(i)
  ans += sum(1 for edge in zip(l,l[1:]) if tuple(sorted(edge)) in edges)==N-1
print(ans)         


Measured memory_bytes: 3060
i,a,b;main(n){for(n=1e6;n--;)printf("");for(;scanf("%d",&n)*n;puts("")){int t[128]={0};for(;n--;t[a]=b)scanf("%s%s",&a,&b);for(scanf("%d",&n);n--;putchar(t[a]?t[a]:a))scanf("%s",&a);}}

Measured memory_bytes: 0
#include<stdio.h>
int main(){
  int a,b;
  char op;
  while(1){
    scanf("%d %c %d",&a,&op,&b);
    if (op == '?') break;
   else if (op =='+') printf("%d\n",a + b);
  else if (op == '-' )printf("%d\n",a - b);
  else if (op == '*') printf("%d\n",a * b);
  else if (op == '/') printf("%d\n",a / b );
  }
  return 0;
 }



Measured memory_bytes: 2104
#include<queue>
#include<cstdio>

#define	mp	make_pair

using namespace std;

typedef	pair<int,int>	pii;

int main(){
	for(int n,tlim,l,m,s,g;scanf("%d%d%d%d%d%d",&n,&tlim,&l,&m,&s,&g),n;){
		bool frz[100]={};
		frz[s]=frz[g]=true;
		for(int i=0;i<l;i++){
			int p;	scanf("%d",&p);
			frz[p]=true;
		}

		static int adj[100][100];
		for(int i=0;i<n;i++)for(int j=0;j<n;j++)	adj[i][j]=-1;
		for(int i=0;i<m;i++){
			int x,y,t;	scanf("%d%d%d",&x,&y,&t);
			adj[y][x]=adj[x][y]=t;
		}

		static int tmin[100][101];
		static bool visited[100][101];
		for(int i=0;i<n;i++)for(int j=0;j<=tlim;j++){
			tmin[i][j]=1<<30;
			visited[i][j]=false;
		}
		tmin[s][tlim]=0;

		int ans=-1;
		priority_queue< pair<int,pii> > pq;
		pq.push(mp(-tmin[s][tlim],mp(s,tlim)));
		while(!pq.empty()){
			pair<int,pii> a=pq.top();	pq.pop();
			int t=-a.first,u=a.second.first,rem=a.second.second;
			if(visited[u][rem])	continue;
			if(u==g){ ans=t; break; }
			visited[u][rem]=true;
			// next stat
			int nextt=t+1,nextrem=rem+1;
			if(frz[u] && rem<tlim && nextt<tmin[u][nextrem]){
				pq.push(mp(-nextt,mp(u,nextrem)));
				tmin[u][nextrem]=nextt;
			}
			for(int v=0;v<n;v++){
				if(adj[u][v]==-1)	continue;
				nextt=t+adj[u][v];
				nextrem=rem-adj[u][v];
				if(nextrem>=0 && nextt<tmin[v][nextrem]){
					pq.push(mp(-nextt,mp(v,nextrem)));
					tmin[v][nextrem]=nextt;
				}
			}
		}

		if(~ans)	printf("%d\n",ans);
		else		puts("Help!");
	}

	return 0;
}

Measured memory_bytes: 992
/* � Ashiq Uddin Pranto
   Department of Computer Science and Engineering
   BATCH 27
   University Of Rajshahi,Bangladesh
*/
#include<bits/stdc++.h>

#define ll long long
#define ld long double
#define FOR(x,y) for(ll i=x;i<=y;i++)
#define pb(x) push_back(x)
#define mp make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define matrix(x) vector<vector<x>>
#define vss vector<string>
#define PI (2*acos(0.0))
#define sqr(x) ((x)*(x))
#define sf(a)   scanf("%d",&a)
#define sfl(a)  scanf("%lld",&a)
#define sff(a,b)    scanf("%d %d",&a,&b)
#define sffl(a,b)   scanf("%lld %lld",&a,&b)
#define sfff(a,b,c) scanf("%d %d %d",&a,&b,&c)
#define sfffl(a,b,c)    scanf("%lld %lld %lld",&a,&b,&c)
#define ms(a,b) memset(a, b, sizeof(a))
#define ff  first
#define ss  second
#define lcm(a, b)   ((a)*((b)/__gcd(a,b)))
#define all(a)  a.begin(),a.end()
#define readfile freopen("input.txt","r",stdin);
#define writefile freopen("output.txt","w",stdout);
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL);
#define gap " "
#define mx 104
#define inf (ll)1e9
#define WHITE 1
#define GRAY 2
#define BLACK 3
#define EMPTY_VALUE -1
#define mod 1000000007
#define MOD(a,b) (a%b + b)%b

using namespace std;

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif


int main()
{
    //fastio
    string s,a;
    cin>>s>>a;
    ll lenofs = s.length(),lenofa = a.length();
    ll ans = 0;
    for(ll i=0;i<=lenofs-lenofa;i++)
    {
        ll cnt = 0;
        for(ll j=0;j<lenofa;j++)
        {
            if(a[j]==s[j+i]) cnt++;
        }
        ans = max(ans,cnt);
    }
    cout<<lenofa-ans<<endl;

    return 0;
}

Measured memory_bytes: 3588
#include<stdio.h>
int main(){
  int a[100],temp,i,j,n;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
  }
  for(i=0;i<n-1;i++){
    for(j=n-1;j>i;j--){
      if(j>i){
	temp=a[j];
	a[j]=a[j-1];
	a[j-1]=temp;
      }
    }
  }
  for(i=0;i<n;i++){
    printf("%d",a[i]);
    if(i!=n-1){
      printf(" ");
    }
  }
  printf("\n");
  return (0);
}

Measured memory_bytes: 600
#include <iostream>
#include <iomanip> // << fixed << setprecision(xxx)
#include <algorithm> // do { } while ( next_permutation(A, A+xxx) ) ;
#include <vector>
#include <string> // to_string(nnn) // substr(m, n) // stoi(nnn)
#include <complex>
#include <tuple> // get<n>(xxx)
#include <queue>
#include <stack>
#include <map> // if (M.find(key) != M.end()) { }
#include <set> // S.insert(M);
// if (S.find(key) != S.end()) { }
// for (auto it=S.begin(); it != S.end(); it++) { }
// auto it = S.lower_bound(M);
#include <random> // random_device rd; mt19937 mt(rd());
#include <cctype>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib> // atoi(xxx)
using namespace std;

#define DEBUG 0 // change 0 -> 1 if we need debug.
// insert #if<tab> by my emacs. #if DEBUG == 1 ... #end

typedef long long ll;

// const int dx[4] = {1, 0, -1, 0};
// const int dy[4] = {0, 1, 0, -1};

// const int C = 1e6+10;
// const ll M = 1000000007;

int main () {
  string A, B, C;
  cin >> A >> B >> C;
  if (A[A.size()-1] == B[0] && B[B.size()-1] == C[0]) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
}


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

int main(void) {
    int a, b;
    cin >> a >> b;
    for (double i = 1; i <= 1250; i++) {
        if (floor(i * 0.08) == a && floor(i * 0.1) == b) {
            cout << i << endl;
            return 0;
        }
    }
    cout << -1 << endl;
    return 0;
}

Measured memory_bytes: 3768
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
using namespace std;

long long qaq(int x, int y){
	long long ans = 1;
	if(x == 0 || y == 0) ans = 1;
	else {
	for(int i = 0; i < x; i++) {
		ans = ans * (y - i);
		ans = ans / (i + 1);
	}
	}
	return ans;
}

int main()
{
	int l,k;
	scanf("%d %d",&l,&k);
	long long ans=0;
	for(int i=0;i<=(l+1)/2;i++){
		for(int j=0;j<=(l+1)/2;j++){
			if(i+j-1+i+k*j>0 && i+j-1+k*j+i<=l){
				ans+=qaq(i,i+j);
		}
		}
	}
	if(k==1) ans/=2;
	printf("%lld\n",ans);
}


Measured memory_bytes: 2740
main(){
  int a[100],n,o=0,i;
  for(i=0;i<100;i++)
    a[i]=0;
  while(scanf("%d",&n)!=-1){
    a[n-1]++;
    if(a[n-1]>o)
      o=a[n-1];
  }
  for(i=0;i<100;i++)
    if(a[i]==o)
      printf("%d\n",i+1);
  return 0;
}

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

int main(){
    string s,t;
    cin >> s >> t;

    int n = s.length();
    t += t;
    for(int i=0; i<n; i++){
        if(s == t.substr(i,n)){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}

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

int main(){
  string s,t,u;
  int a,b;
  cin >>s >>t >>a >>b >>u;
  if(s==u) cout << a-1 << " " << b << endl;
  if(t==u) cout << a << " " << b-1 << endl;
  return 0;
}

Measured memory_bytes: 256
// Input macro
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! stdin {
    () => {{
        use std::io::Read;
        let mut s = String::new();
        std::io::stdin().read_to_string(&mut s).unwrap();
        s
    }};
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

// Test Code
macro_rules! test {
    ($($input:expr => $output:expr),* $(,)*) => {
        #[test]
        fn solve_test() {
            $(
                assert_eq!(solve($input), $output);
            )*
        }
    };
}

test! {
    "H H" => "H",
    "D H" => "D",
    "D D" => "H",
}

fn main() {
    println!("{}", solve(&stdin!()));
}

fn solve(src: &str) -> String {
    input! {
        source = src,
        a: String,
        b: String,
    }

    if a == "H" {
        return b.to_string();
    } else {
        if b == "H" {
            return "D".to_string(); 
        }

        return "H".to_string();  
    }
}

Measured memory_bytes: 4352
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<string>
#include<vector>
#include<set>
#include<cctype>
#define ld long double
#define ll long long int
#define ull unsigned long long int
using namespace std;
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
const long long INF=1LL<<60;


int main(void){
	ios::sync_with_stdio(false); cin.tie(0);
	
	string s;
	int j,i,h,w;
	cin>>h>>w;
	string snuke[h][w];
	for(i=0;i<h;i++)for(j=0;j<w;j++)cin>>snuke[i][j];
	for(i=0;i<h;i++){
		for(j=0;j<w;j++){
			if(snuke[i][j]=="snuke"){
				cout<<(char)('A'+j)<<i+1<<endl;
				return 0;
			}
		}
	}
	
	return 0;
}

Measured memory_bytes: 256
from collections import Counter
from itertools import product

def main():
    with open(0) as f:
        H, W = map(int, f.readline().split())
        C = [list(map(int, f.readline().split())) for _ in range(10)] 
        A = Counter(map(int, f.read().split()))

    r10 = range(10)
    for k,i,j in product(r10, r10, r10):
        C[i][j] = min(C[i][j], C[i][k]+C[k][j])

    ans = sum(C[key][1]*value for key,value in A.items() if key != -1)
    print(ans)

main() 

Measured memory_bytes: 12400
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <array>
#include <vector>
#include <functional>
#include <unordered_map> 
#include <map> 
#include <numeric>
#include <limits>
#include <utility>
#include <queue>
#include <random>
#include <bitset>
#include <memory>
#include <complex>
using namespace std;
typedef long long LL;

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

    LL ans = a[0];

    for (int i = 1; i < n; i++) {
        if (ans < a[i]) {
            swap(ans, a[i]);
        }
        LL r;
        r = a[i] % ans;
        while (r != 0) {
            a[i] = ans;
            ans = r;
            r = a[i] % ans;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1024
import java.util.Scanner;
import java.util.Arrays;

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

        int[] bell = new int[3];
        for (int i = 0; i < bell.length; i++) {
            bell[i] = sc.nextInt();
        }

        Arrays.sort(bell);
        System.out.println(bell[0] + bell[1]);
    }
}

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

using namespace std;

#define int int64_t
#define MAX 1005
#define MOD 1000000007

int h,w,dp[MAX][MAX];

char s[MAX][MAX];

int sp(int i, int j){
    if(i == h || j == w || s[i][j] == '#'){
        return 0;
    }
    if(dp[i][j] != -1){
        return dp[i][j];
    }
    if(i == h-1 && j == w -1){
        return 1;
    }
    return dp[i][j] = (sp(i+1,j) % MOD + sp(i,j+1)% MOD) %MOD;
}

signed main() {
    scanf("%lld %lld", &h, &w);
    for (int i = 0; i < h; i++)
        scanf("%s", s[i]);
    for (int i = 0; i <= h; i++)
        for (int j = 0; j <= w; j++)
            dp[i][j] = -1;


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

Measured memory_bytes: 9088
#include<iostream>
using namespace std;
#define rep(i,n) for ( int i = 0; i < n; i++)
#define L 1000

long long getValue(long long x){
  if ( x <= L ) return x +1;
  else return L - x%(L+1);
}

main(){
  int n;
  int tcase = 0;
  while( cin >> n){
    tcase++;
    long long cnt = 0;

    for ( int i = 0; i <= 2*L; i++ ){
      int t = n - i;
      if ( 0 <= t && t <= 2*L ){
	cnt += getValue(i) * getValue(t);
      }
    }

    cout << cnt << endl;
  }
}

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

int main() {
    int N, K;
    cin >> N >> K;
    vector<int64_t> A(N);
    for(auto &e : A) cin >> e;
    for(int i = 0; i < N - K; ++i) {
        cout << (A[i + K] > A[i] ? "Yes" : "No") << '\n';
    }
    return 0;
}


Measured memory_bytes: 4816
import java.util.Scanner;
public class Main{
	static boolean signBord(char name[],char old[],int k,int d, int temp[]){
	    temp[d]=k;
	    if(name.length-1 <= d){
	        for(int i=0; i+2<name.length; i++){
	            if(temp[i+1]-temp[i] != temp[i+2]-temp[i+1]){
	                    return false;
	            }
	        }
	        return true;
	    }
	    for(int j=k+1; j<old.length; j++){
	        if(name[d+1]==old[j]){
	            if(signBord(name, old, j, d+1, temp)){
	                return true;
	            }
	        }
	    }
	    return false;
	}
	public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        while(sc.hasNext()){
            int n=sc.nextInt();
            int count=0;
            char name[]=sc.next().toCharArray();
            char old[][]=new char[n][];
            int temp[]=new int[name.length];
            for(int i=0; i<n; i++){
                old[i]=sc.next().toCharArray();
            }
            for(int i=0; i<n; i++){
                for(int j=0; j<old[i].length; j++){
                    if(name[0]==old[i][j]){
                        if(signBord(name, old[i], j, 0, temp)){
                            count++;
                            break;
                        }
                    }
                }
            }
            System.out.println(count);
        }
    }
}

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

int main(){
    int a, b;
    cin >> a >> b;
    double ret = 0;

    for(int i = 1; i <= a; i++){
        double tmp = 1.0/a;
        int now = i;
        while(now < b){
            now *= 2;
            tmp /= 2;
        }
        ret += tmp;
    }

    cout << setprecision(12) << ret << endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
const ld eps = 1e-9;

//// < "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\a.txt" > "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\b.txt"
set<string>memo;
vector<string> dfs(string now, map<string, vector<string>>mp) {
	if (memo.find(now) != memo.end())return vector<string>();
	else memo.emplace(now);
	if (mp.find(now) == mp.end())return vector<string>(1,now);
	else {
		vector<string>ans;
		for (auto child : mp[now]) {
			auto sts=dfs(child,mp);
			ans.insert(ans.end(), sts.begin(), sts.end());
			sort(ans.begin(), ans.end());
			ans.erase(unique(ans.begin(), ans.end()), ans.end());
		}
		return ans;
	}
}

int main() {
	while (1) {
		memo.clear();
		int N; cin >> N;
		if (!N)break;
		map<string, vector<string>>mp;
		string start;
		for (int i = 0; i < N; ++i) {
			string st; cin >> st;
			int a = st.find(':');
			string parent = st.substr(0, a);
			if (!i)start = parent;
			vector<string>children;
			int from = a+1;
			while (1) {
				int r = st.find(',',from);
				if (r == string::npos) {
					children.push_back(st.substr(from,st.find('.')-from));
					break;
				}
				else {
					children.push_back(st.substr(from, r-from));
					from = r + 1;
				}
			}
			mp[parent] = children;
		}
		auto anss = dfs(start, mp);
		cout << anss.size() << endl;
	}
	return 0;
}

Measured memory_bytes: 4956
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
using System.Numerics;
using System.Runtime.InteropServices.ComTypes;
using System.Xml.Schema;
using System.ComponentModel.DataAnnotations;
using System.Security.Cryptography;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            Solve();
            //Out.Flush();
            Read();
        }

        static void Solve()
        {
            var N = Sarray()[0];
            var Ai = Sarray();
            var rui = new long[N + 1];
            var ruiR = new long[N + 1];
            for (var i = 1; i <= N; ++i)
            {
                rui[i] = Gcd(rui[i - 1], Ai[i - 1]);
                ruiR[N - i] = Gcd(ruiR[N - i + 1], Ai[N - i]);
            }
            var ans = 0L;
            for (var i = 0; i < N; ++i)
                ans = Max(ans, Gcd(rui[i], ruiR[i + 1]));
            WriteLine(ans);
        }
        static long Gcd(long x, long y) => y == 0 ? x : Gcd(y, x % y);

        static long Mod = (long)1e9 + 7;
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }
        static public (T1 a, T2 b) Slice<T1, T2>()
        {
            var t = ReadLine().Split();
            return (
            (T1)Convert.ChangeType(t[0], typeof(T1)),
            (T2)Convert.ChangeType(t[1], typeof(T2)));
        }
        static public (T a, T b) Slice2<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)));
        }
        static public (T a, T b, T c) Slice3<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)),
            (T)Convert.ChangeType(t[2], typeof(T)));
        }
        static public (T a, T b, T c, T d) Slice4<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)),
            (T)Convert.ChangeType(t[2], typeof(T)),
            (T)Convert.ChangeType(t[3], typeof(T)));
        }
    }
}

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

int main(void) {
  int n, k, i, j, tmp, max, bloc;
  int* p;
  int* e;
  scanf("%d %d", &n, &k);
  p = (int*)malloc(sizeof(int) * n);
  e = (int*)malloc(sizeof(int) * (n-k+1));
  bloc = 0;
  for(i=0; i<k; i++) {
    scanf("%d", &p[i]);
    bloc += p[i];
  }
  e[0] = bloc;
  for(; i<n; i++) {
    scanf("%d", &p[i]);
    bloc += p[i];
    bloc -= p[i-k];
    e[i-k+1] = bloc;
  }
  max = e[0];
  for(i=1; i<n-k+1; i++) {
    if(max < e[i]) {
      max = e[i];
    }
  }
  printf("%lf\n", (double)(max+k)/2);
  return 0;
}


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

int main(){
  int N;
  int tmp,c = -1;
  
  cin >> N;
  vector<int> a(N);
  
  for(int i = 0;i < N;i++){
    cin >> a.at(i);
  }
  
  if(a.at(0) == 2){
    c = 1;
  }
  else{
    tmp = a.at(0);
    for(int i = 0;i < N;i++){
      if(a.at(tmp - 1) == 2){
        c = i + 2;
        break;
      }
      else{
        tmp = a.at(tmp - 1);
      }
    }
  }
  cout << c << endl;
  return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
//make_tuple emplace_back next_permutation push_back make_pair second first setprecision

#if MYDEBUG
#include "lib/cp_debug.h"
#else
#define DBG(...) ;
#endif

using LL = long long;
constexpr LL LINF=334ll<<53;
constexpr int INF=15<<26;
constexpr LL  MOD=1E9+7;
struct UnionFind{
    vector<int> par; //par: -1*elements(root) number of par(not root)
    UnionFind(int n){
        par = vector<int>(n,-1);
    }
    int root(int x){
        return par[x]<0?x:(par[x]=root(par[x]));
    }
    void unite(int x,int y){
        x=root(x);
        y=root(y);
        if(x!=y){
            if(par[x]<par[y]) swap(x,y);
            par[y] += par[x];
            par[x] = y;
        }
        return;
    }
    bool same(int x,int y){
        return root(x) == root(y);
    }
    int size(int x){
        return -par[root(x)];
    }
};

struct Problem{
    LL n,m;
    vector<vector<int>> g;
    vector<int> vis;
    UnionFind uf;
    Problem(LL n, LL m):n(n),m(m),g(n),vis(n),uf(n){};
    bool oddloop(int s){
        queue<int> Q;
        Q.push(s);
        vis[s]=1;
        while(!Q.empty()){
            int cur=Q.front();Q.pop();
            for(int v : g[cur]){
                if(vis[v]==0){
                    vis[v]=3-vis[cur];
                    Q.push(v);
                }else{
                    if(vis[cur]==vis[v])return true;
                }
            }
        }
        return false;
    }

    void solve(){
        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);
            uf.unite(a,b);
        }
        vector<int> vis(n);
        LL cnt=0, conn=0, ev=0;
        for(int i=0; i<n; ++i){
            if(uf.par[i]<-1){
                if(!oddloop(i))ev++;
                conn+=uf.size(i);
                cnt++;
            }
        }
        cout << n*n-conn*conn+cnt*cnt+ev*ev <<"\n";

    }
};

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    long long n=0,m;
    cin >> n >> m;
    Problem p(n,m);
    p.solve();
    return 0;
}



Measured memory_bytes: 7936
#include<bits/stdc++.h>
using namespace std;
#define int long long
int gcd(int a,int b){
    return (b==0?a:gcd(b,a%b));
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}
signed main(){
    int n;
    cin>>n;
    int ans=1;
    for(int i=0;i<n;i++){
        int t;
        cin>>t;
        ans=lcm(ans,t);
    }
    cout<<ans<<endl;
    return 0;
}


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

int main(void) {
    char buf[8];
    char *p;
    int i;
    p = fgets(buf,8,stdin);

    for(i=0;i<3;i++){
        if(buf[i] == '7'){
            printf("Yes\n");
            p = NULL;
            break;
        }
    }

    if(p) printf("No\n");

    return 0;
}


Measured memory_bytes: 1516
N = int(input())
r = {}
for i in range(N):
  S = str(input())
  if S in r:
    r[S] += 1
  else:
    r[S] = 1

for row in r:
  max = row
  break
for row in r:
  if r[row] > r[max]:
    max = row

ans = []
for row in r:
  if r[row] == r[max]:
    ans.append(row)
A = sorted(ans)
for a in A:
  print(a)

Measured memory_bytes: 32984
MOD = 10**9 + 7
def dp(a):
    L = len(a)

    dp = [[0 for j in range(13)] for k in range(L + 1)]
    dp[0][0] = 1
    for i in range(L):
        if a[i] == "?":
            for j in range(10):
                for k in range(13):
                    dp[i + 1][(j + k*10) % 13] += dp[i][k]
                    dp[i + 1][(j + k*10) % 13] %= MOD
        else:
            for k in range(13):
                dp[i + 1][(int(a[i])+k*10) % 13] += dp[i][k]
                dp[i + 1][(int(a[i])+k*10) % 13] %= MOD
    print(dp[L][5] % MOD)


def main():
    S = input()
    dp(S)


if __name__ == '__main__':
    main()

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

int main() {
	int a, b;
	cin >> a >> b;
	if (a > b)
		swap(a, b);
	if (a == b) {
		if (!a)
			return cout << "Zero\n", 0;
		else if (a < 0)
			return cout << "Negative\n", 0;
		else
			return cout << "Positive\n", 0;
	}
	else {
		if (a <= 0 && b >= 0)
			return cout << "Zero\n", 0;
		if (a > 0)
			return cout << "Positive\n", 0;
		if (b < 0) {
			if ((abs(abs(a) - abs(b) + 1)) % 2)
					return cout << "Negative\n", 0;
			else
				return cout << "Positive\n", 0;
		}
	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
typedef long long int lli;

int main() {
	int N;
	cin >> N;
	char S[100];
	for (int i = 0;i<N;i++) cin >> S[i];

	int flag = 3;
		for (int i = 0;i<N;i++) {
			if (S[i] == 'Y') flag = 4;
		}
	if (flag == 3) cout << "Three";
	else cout << "Four";
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main(void)
{
  int a,b; cin>>a>>b;
  int sum=0;
  
  if(a>b){sum=a; a--;}else{sum=b; b--;}
  if(a>b){sum+=a; a--;}else{sum+=b; b--;}
  
  cout<<sum<<endl;
  return 0;
}

Measured memory_bytes: 256