akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
inline ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T>& V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> >& Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T>& mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }
template<typename T>vector<T> make_v(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>auto make_v(size_t a,Ts... ts){return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type fill_v(T &t,const V &v){t=v;}
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type fill_v(T &t,const V &v){for(auto &e:t) fill_v(e,v);}
/*
 <url:>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

const ll MOD = 1e9+7;
template<class Type>
Type solve(Type res = Type()){
    ll N; cin >> N;
    vector<int> C(N); for(auto& in:C) cin >> in;

    vector<int> T;
    T.emplace_back(C[0]);
    for(int i = 1; i < N;i++){
        if(T.back() == C[i]) continue;
        T.emplace_back(C[i]);
    }

    ll M = T.size();
    vector<vector<int>> color_idx(200001);
    for(int i = 0; i < M;i++){
        color_idx[T[i]].emplace_back(i);
    }
    vector<ll> dp(M+1);
    dp[0] = 1;


    for(int i = 0; i < M; i++){
        int c = T[i];
        int idx = (int)(upper_bound(color_idx[c].begin(),color_idx[c].end(),i) - color_idx[c].begin());
        if(idx != color_idx[c].size()){
            dp[color_idx[c][idx]] += dp[i];
            dp[color_idx[c][idx]] %= MOD;
        }
        dp[i+1] += dp[i];
        dp[i+1] %= MOD;
    }
    // cout << T << endl;
    // cout << dp << endl;
    res = dp[M];

    return res;
}
int main(void) {
    cin.tie(0); ios::sync_with_stdio(false);
    //solve<ll>(0);
    cout << fixed << setprecision(12) << solve<ll>() << endl;
    return 0;
}

Measured memory_bytes: 17180
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

const ll INF=(1LL<<60);

int main(void){
    string s; cin >> s;

    ll b=0, ans=0;
    for(int i=0; i<s.size(); i++){
        if(s[i] == 'B') b++;
        else ans += b;
    }

    cout << ans << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define INF LLONG_MAX/10
#define rep(i,n) for(int i=0;i<n;i++)
#define krep(i,k,n,m) for(int i=k;i<n;i+=m)
#define erep(i,k,n) for(int i=k;i<n;i++)
#define mod 1000000007
//最大公約数
int gcd(int s,int t){
    if(t==0)return s;
    return gcd(t,s%t);
}
signed main(){
    int n;
    cin>>n;
    vector<char> w;
    int con=0;
    while(1){
        if(n%26==0){
            w.push_back('z');
            n=n/26-1;
            con++;
            if(n==0){
                break;
            }
            continue;
            
        }
        w.push_back(n%26-1+'a');
        con++;
        n=n/26;
        if(n==0){
            break;
            
        }
    }
    for(int i=con-1;i>=0;i--){
        cout<<w[i];
    }
    cout<<endl;
}


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

int main(){
    int r,c;
    cin >> r >> c;
    vector<string> field(r);
    rep(i,r) cin >> field[i];
    vector<vi> r_count(r,vi(c));
    vector<vi> c_count(r,vi(c));
    
    int cnt=1;
    rep(i,r){
        rep(j,c){
            if(field[i][j]=='#'){
                cnt=0;
                r_count[i][j]=cnt;
                cnt++;
            }else{
                r_count[i][j]=cnt;
                cnt++;
            }
        }
        cnt=1;
    }

    rep(i,r){
        for(int j=c-2;j>=0;j--){
            if(field[i][j]=='#') continue;
            r_count[i][j]=max(r_count[i][j],r_count[i][j+1]);
        }
    }

    rep(i,c){
        rep(j,r){
            if(field[j][i]=='#'){
                cnt=0;
                c_count[j][i]=cnt;
                cnt++;
            }else{
                c_count[j][i]=cnt;
                cnt++;
            }
        }
        cnt=1;
    }

    rep(i,c){
        for(int j=r-2;j>=0;j--){
            if(field[j][i]=='#') continue;
            c_count[j][i]=max(c_count[j][i],c_count[j+1][i]);
        }
    }

    int ans=0;
    rep(i,r) rep(j,c) ans=max(ans,r_count[i][j]+c_count[i][j]-1);
    cout << ans << endl;

}

Measured memory_bytes: 42244
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <iomanip>
using namespace std;
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
typedef vector <int> vi;
typedef pair<int,int> ii;
typedef long long ll;
typedef long double ld;
const int mod = 1e9 + 7;
const ll inf = 3e18 + 5;
int add(int a, int b) { return (a += b) < mod ? a : a - mod; }
int mul(int a, int b) { return 1LL * a * b % mod; }

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

	string s;
	cin >> s;
	int k = 0;
	string lst = "";
	string cur = "";
	for(char c : s){
		cur += c;
		if((int) cur.size() != (int) lst.size() || cur != lst){
			lst = cur;
			k++;
			cur = "";
		}
	}
	cout << k;
}

Measured memory_bytes: 720
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		if (A==B && B==C) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}

Measured memory_bytes: 23124
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <map>
#include <cstdio>
#include <string>
#include <cstdlib>
#include <cstring>
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
const long double EPS = 1e-9;
const ll mod = 1e9 + 7;
const ll INF = 1e9;

#define rep(i, n) for(ll i = 0; i < n ; i++ )
#define For(i, a, b) for(ll i = (a); i < (b) ; i++ )
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()

const ll MAX_N = 100;

int main(void){
    ll N;
    string W[MAX_N];
    string answer = "Yes";

    cin >> N;
    rep(i, N) cin >> W[i];
    rep(i, N - 1) For(j, i + 1, N) if (W[i] == W[j]) answer = "No";
    rep(i, N - 1){
        string pre = W[i].substr(W[i].size() - 1, 1);
        string post = W[i + 1].substr(0, 1);
        if (pre != post) answer = "No";
    } 

    cout << answer << endl;

    return 0;
}

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



int main()
{
    int ar[3];
    for(int i=0; i<3; i++){
        cin >> ar[i];   
    }
    sort(ar, ar+3);

    if(ar[0]==5 && ar[0]==ar[1] && ar[2]==7){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
}


Measured memory_bytes: 256
n = int(input())
a = list(map(int,input().split()))
res = [0]*n
for i in range(n,0,-1):
  k = 2
  c = True
  while i*k <= n:
    if res[i*k-1] == 1:
      c = not c
    k += 1
  if c == a[i-1]:
    res[i-1] = 1
print(sum(res))
for i in range(n):
  if res[i]:
    print(i+1,end=" ")

Measured memory_bytes: 7148
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
      	Set<Integer> s = new HashSet<Integer>();      	
      
      	for (int i=0; i<k; i++){
          int d = sc.nextInt();
          for(int j=0; j<d; j++){
            int a = sc.nextInt();
            s.add(a);
          }
        }
      
      int r = n - s.size();
            System.out.println(r);
    }
}

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

int main(){
    long long n; //初期値
    long long k; //差で使える数
    cin >> n >> k;

    

    long long mini = n % k; //差の最小値
    long long same = mini + 1; //１回前のminiの値を格納

    while(mini < same){
        same = mini;
        mini = min(mini,abs(mini-k));
    }

    cout << mini << endl;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fastIO std::ios_base::sync_with_stdio(false); std::cin.tie(0); std::cout.tie(0)
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
typedef double db;
//mt19937 mrand(random_device{}()); 
const ll mod=1000000007;
const int INF = 0x3f3f3f3f;
//int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}

const int maxn = 2e5 + 10; 

ll n,k;
ll sum[maxn];

int main()
{
	fastIO;
	cin >> n >> k;
	for(int i = 1; i <= n; ++i) sum[i] = (sum[i - 1] + i) % mod;
	ll ans = 1;
	for(ll i = k; i <= n; ++i) {
		ll t = (sum[n] - sum[n - i] + mod - sum[i - 1] + 1 + mod) % mod;
		//cout << t << endl;
		ans = (ans + t) % mod;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 5212
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <cmath>
#include <map>
#include <queue>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  int n, w;
  cin >> n >> w;
  vector<int> weight(n);
  vector<int> value(n);
  rep(i, n) {
    cin >> value[i] >> weight[i];
  }
  vector<vector<int>> dp(n+2, vector<int>(w+2));
  rep(i, w) {
  dp[0][i]=0;
  }
  rep(i, n) {
    rep(j, w+1) {
      if(j >= weight[i]) {
        dp[i+1][j] = max(dp[i][j-weight[i]]+value[i], dp[i][j]);
      }
      else {dp[i+1][j] = dp[i][j];}
      //cout << dp[i+1][j]<< endl;
    }
  }
  cout << dp[n][w] << endl;
}


Measured memory_bytes: 6796
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <map>
#include <set> 
#include <bitset>
#include <cmath>
using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0;i<n;i++)

int main () {
    
    vector<int> a(5, 0);
    vector<int> b(5, 0);
    for(int i = 0; i < 5; i++)
    {
        cin >> a[i];
    }
    REP(i,5) {
        while (a[i] % 10 != 0) {
            a[i] += 1;
            b[i] += 1;
        }
    } 

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

    int s=0;
    REP(i,5) { 
        s += a[i];
    }
    s -= b[b.size()-1];

    cout << s << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    Scanner stdin = new Scanner(System.in);
    int n = stdin.nextInt();
    Main.call(n);
  }

  private static void call(int n) {
    for (int i = 1; i <= n; i++) {
      if (i % 3 == 0 || String.valueOf(i).contains("3")) {
        System.out.printf(" %d", i);
      }
    }
    System.out.println("");
  }
}

Measured memory_bytes: 34244
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <iomanip>
using ll = long long;
using uint = unsigned int;
using graph = std::vector<std::vector<ll>>;
using wGraph = std::vector<std::vector<std::pair<ll,ll>>>;
#define rep(i,n) for (int i=0; i < int(n); i++)

using namespace std;
ll MOD7 = 1000000007;
ll MOD9 = 1000000009;
vector<ll> InputVec(ll N){
    vector<ll> A(N);
    for (int i = 0; i < N; ++i) {
        cin >> A[i];
    }
    return A;
}
void OutputVec(vector<ll> A){
    for (int i = 0; i < A.size(); ++i) {
        cout << A[i] << ",";
    }
    cout << endl;
}
vector<vector<ll>> InputVec2d(ll H,ll W){
    vector<vector<ll>> A(H);
    for (int yi = 0; yi < H; ++yi) {
        A[yi] = vector<ll>(W);
    }
    for (int yi = 0; yi < H; ++yi) {
        for (int xi = 0; xi < W; ++xi) {
            cin >> A[yi][xi];
        }
    }
    return A;
}
vector<vector<char>> InputVec2dStr(ll H,ll W){
    vector<vector<char>> A(H);
    for (int yi = 0; yi < H; ++yi) {
        A[yi] = vector<char>(W);
    }
    for (int yi = 0; yi < H; ++yi) {
        string S;
        cin >> S;
        for (int xi = 0; xi < W; ++xi) {
            A[yi][xi] = S[xi];
        }
    }
    return A;
}
void OutputVec2d(vector<vector<ll>> A){
    for (int yi = 0; yi < A.size(); ++yi) {
        for (int xi = 0; xi < A[yi].size(); ++xi) {
            cout << A[yi][xi] << ",";
        }
        cout << endl;
    }
}
graph InputGraph(ll N,ll M){
    graph G(N);
    for (int i = 0; i < M; ++i) {
        ll a,b;
        cin >> a >> b;
        a--;b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    return G;
}
graph InputDGraph(ll N,ll M){
    graph G(N);
    for (int i = 0; i < M; ++i) {
        ll a,b;
        cin >> a >> b;
        a--;b--;
        G[a].push_back(b);
    }
    return G;
}
void OutputGraph(graph G){
    for (int i = 0; i < G.size(); ++i) {
        cout << i << ":";
        for (int j = 0; j < G[i].size(); ++j) {
            cout << G[i][j]<< ",";
        }
        cout << endl;
    }
}
void OutputAnswerBool(bool b,bool isUpperCase = false){
    if(b){
        if(isUpperCase){
            cout << "YES" << endl;
        }else{
            cout << "Yes" << endl;
        }
    }else{
        if(isUpperCase){
            cout << "NO" << endl;
        }else{
            cout << "No" << endl;
        }
    }
}

int main() {
    ll N,A,B,C,D;
    cin >> N >> A >> B >> C >> D;
    for (int i = 0; i <= N-1; ++i) {
        if(C*(N-1-i) -D*i<=B-A && B-A<=-C*i+D*(N-1-i)){
            cout << "YES" << endl;
            return 0;
        }
    }
    cout << "NO" << endl;
}


Measured memory_bytes: 256
l,r = map(int,input().split())
mod = 2019
r = (r%mod) + 2019*(r-l>=2019)
l = l%mod
ans = float("inf")
for i in range(l,r):
  for j in range(i+1,r+1):
    ans = min(ans,(i*j)%mod)
print(ans)

Measured memory_bytes: 3060
n = int(input())
H = list(map(int, input().split()))
count = 0
maxi = 0
first = H[0]
for h in H[1:]:
  if first >= h:
    count+=1
    if maxi < count:
      maxi = count
  else:
    count=0
  first = h
print(maxi)

Measured memory_bytes: 14224
/**
 * @author karayuu
 */
fun main(args: Array<String>) {
    val s = readLine()!!
    var length = 0
    var count = 0
    for (c in s) {
        if (c in "ACGT") {
            count++
        } else {
            length = _max(length, count)
            count = 0
        }
    }
    length = _max(length, count)

    println(length)
}

fun _max(a: Int, b: Int): Int {
    return if (a >= b) a else b
}

Measured memory_bytes: 33660
//
//  main.cpp
//  C
//
//  Created by Knight_F on 2019/8/10.
//  Copyright © 2019年 Knight_F. All rights reserved.
//

#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <vector>
#define LL long long
using namespace std;
unordered_map <string, int> M;
int a[30];
int main(){
    ios::sync_with_stdio(false);
    int n; cin>>n;
    LL ans=0;
    for(int i=1;i<=n;i++){
        string s,k; cin>>s;
        memset(a,0,sizeof(a));
        for(int j=0;j<s.size();j++){
            a[s[j]-'a']++;
        }
        for(int j=0;j<26;j++){
            k+='0'+a[j]-1;
        }
        ans+=M[k];
        M[k]++;
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 13732
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N; cin >> N;
  vector<int> MY(N);
  for (int i=0;i<N;i++){
    cin >> MY.at(i);
  }
  sort(MY.begin(), MY.end());
  int k=0;
  for (int i=0;i<N-1;i++){
    k+=MY.at(i);
  }
  if(k>MY.at(N-1)){cout << "Yes" << endl;}
  else cout << "No" << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<climits>
#include<algorithm>
#include<sstream>
#include<iostream>
#include<string>
#include<queue>
#include<stack>
#include<set>
#include<list>
#include<map>
#include<vector>

using namespace std;


#define rep(i,n) for(int i=0; i<n; i++)
#define rept(i,a,b) for(int i=a; i<b; i++)
#define ll long long
#define MOD 1000000007

#define IMIN INT_MIN;
#define IMAX INT_MAX;


int main(){
	int H, W;
	cin >> H >> W;
	string tmp;
	char mat[H][W];
	int lr[H][W];
	int ud[H][W];
	rep(i, H) {
		rep(j, W) {
			lr[i][j] = 0;
			ud[i][j] = 0;
		}
	}
	rep(i, H) {
		cin >> tmp;
		rep(j, W) {
			mat[i][j] = tmp[j];
		}
	}
	int leftcnt;
	rep(i, H) {
		leftcnt = 0;
		rep(j, W) {
			if (mat[i][j] == '.') {
				leftcnt++;
				if (j == W-1) lr[i][j] = leftcnt;
			}
			else {
				lr[i][j] = -1;
				if (j > 0 && mat[i][j-1] == '.') lr[i][j-1] = leftcnt;
				leftcnt = 0;
			}
		}
	}
	int cnt;
	for(int i=H-1; i>=0; i--) {
		cnt = 0;
		for(int j=W-1; j>=0; j--) {
			if (lr[i][j] > 0) cnt = lr[i][j];
			else if (lr[i][j] == 0) lr[i][j] = cnt;
			else {
				cnt = 0;
				lr[i][j] = -1;
			}
		}
	}
	/*
	rep(i, H) {
		rep(j, W) cout << lr[i][j];
		cout << endl;
	}
	*/

	int upcnt;
	rep(j, W) {
		upcnt = 0;
		rep(i, H) {
			if (mat[i][j] == '.') {
				upcnt++;
				if (i == H-1) ud[i][j] = upcnt;
			}
			else {
				ud[i][j] = -1;
				if (i > 0 && mat[i-1][j] == '.') ud[i-1][j] = upcnt;
				upcnt = 0;
			}
		}
	}
	for(int j=W-1; j>=0; j--) {
		cnt = 0;
			for(int i=H-1; i>=0; i--) {
			if (ud[i][j] > 0) cnt = ud[i][j];
			else if (ud[i][j] == 0) ud[i][j] = cnt;
			else {
				cnt = 0;
				ud[i][j] = -1;
			}
		}
	}
	/*
	rep(i, H) {
		rep(j, W) cout << ud[i][j];
		cout << endl;
	}
	*/
	int ans = 0;
	rep(i, H) rep(j, W) ans = max(ans, ud[i][j] + lr[i][j] - 1);
	cout << ans << endl;



	return 0;
}



Measured memory_bytes: 35456
import sys
n, m = map(int, input().split())
lr = [list(map(int, input().split())) for _ in range(m)]
min_gate = 0
max_gate = sys.maxsize
for l, r in lr:
    min_gate = max(min_gate, l)
    max_gate = min(max_gate, r)
print(max(0, max_gate - min_gate + 1))

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

#define endl '\n'
#define rep(i,n)       for(int i=0; i<n; i++)
#define clr(arr)       memset(arr, 0, sizeof arr)
#define all(x)         x.begin(), x.end()
const int MOD = 1e9 + 7;

#ifdef SMIT
template<class F, class S> ostream& operator<<(ostream &out, const pair<F, S> &p)
{
	return out << '(' << p.first << ", " << p.second << ')';
}
template<class T> auto operator<<(ostream &out, T &&x) -> decltype(x.begin(), out)
{
	out << '{';
	for (auto i = x.begin(); i != x.end(); i++)
		out << *i << (i == prev(x.end()) ? "" : ", ");
	return out << '}';
}
void dmp() {}
template<class T, class... Args> void dmp(T &&x, Args... args)
{
	cerr << x << ";  "; dmp(args...);
}
struct Nl {~Nl() {cerr << '\n';}};
#define debug(x...) cerr << (strcmp(#x, "") ? #x ":  " : ""), dmp(x), Nl(), cerr << ""
#else
#define debug(...) {}
#endif
// Yes you CAN



void solve()
{
// #define TEST
	int n;
	cin >> n;
	int a[n], b[n];
	rep(_, n)
	{
		cin >> a[_] >> b[_];
	}
	for (int i = 2; i < n; i++)
	{
		if (a[i] == b[i] and a[i - 1] == b[i - 1] and a[i - 2] == b[i - 2])
		{
			cout << "Yes" << endl;
			return;
		}
	}
	cout << "No" << endl;
}

int32_t main()
{
#ifdef SMIT
	// freopen("/home/smit/Desktop/in.txt", "r", stdin);
#endif
	ios_base::sync_with_stdio(false); cin.tie(nullptr);

	int t = 1;
#ifdef TEST
	cin >> t;
#endif
	while (t--)
		solve();
}

Measured memory_bytes: 3656
import java.util.Arrays;
import java.util.Scanner;
public class Main
{
        public static void main(String args[]) throws Exception
        {
                Scanner cin=new Scanner(System.in);
                int n,midmid,ll,rr;
                long sum,l,r,mid,k;
                n=cin.nextInt();
                k=cin.nextLong();
                long arr[]=new long[n];
                for(int i=0; i<n; ++i) {
                	arr[i]=cin.nextLong();
                }
                Arrays.sort(arr);
                if(arr[0]<=0&&arr[n-1]<=0) {
                	//l=arr[n-1]*arr[n-2];
                	//r=arr[0]*arr[1];
                	l=-1;r=1;
                	for(int i=0; i<18; ++i) {
                		l*=(long)10;
                		r*=(long)10;
                	}
                	--l;++r;
                	--l;++r;
                	--l;++r;
                }
                else if(arr[0]>=0&&arr[n-1]>=0) {
                	//l=arr[0]*arr[1];
                	//r=arr[n-1]*arr[n-2];
                	l=-1;r=1;
                	for(int i=0; i<18; ++i) {
                		l*=(long)10;
                		r*=(long)10;
                	}
                	--l;++r;
                	--l;++r;
                	--l;++r;
                }
                else {
                	l=-1;r=1;
                	for(int i=0; i<18; ++i) {
                		l*=(long)10;
                		r*=(long)10;
                	}
                	--l;++r;
                	--l;++r;
                	--l;++r;
                }
                while(true) {
                	if(r-l<=1)
                		break;
                	mid=(l+r)/2;
                	sum=0;
                	for(int i=0; i<n; ++i) {
                		ll=i;
                		rr=n;
                		if(arr[i]<0){
                            while(rr-ll>1){
                                midmid=(ll+rr)/2;
                                if(arr[i]*arr[midmid]<=mid)
                                	rr=midmid;
                                else 
                                	ll=midmid;
                            }
                            sum=sum+(long)(n-rr);
                        }
                		else {
                			while(rr-ll>1){
                                midmid=(ll+rr)/2;
                                if(arr[i]*arr[midmid]<=mid)
                                	ll=midmid;
                                else 
                                	rr=midmid;
                            }
                			sum=sum+(long)(ll-i);
                		}
                	}
                	if(sum<k)
                		l=mid;
                	else
                		r=mid;
                }
                System.out.println(r);
                cin.close();
        }
}

Measured memory_bytes: 66812
from collections import *
n=int(input())
c=Counter(map(int,input().split()))
x=y=0
for k,v in c.items():
    if v>=2 and k>y:
        if k>=x:
            if v>=4:
                x=y=k
            else:
                x,y=k,x
        else:
            y=k
print(x*y)


Measured memory_bytes: 24104
#include<algorithm>
#include<iostream>
#include<cstdio>
#include<vector>
#include<climits>
using namespace std;
const int N=2e5+5;
const int M=4e6+5;
inline int read(){
	register int x=0;
	register char ch=getchar();
	while(ch<'0'||ch>'9')	ch=getchar();
	while(ch>='0'&&ch<='9')	x=x*10+(ch^48),ch=getchar();
	return x;
}
const long long inf=LLONG_MAX;
int v[N],w[N],nex[N];
long long deep[N];
int n,now,head[N];

void addedges(int x,int y,int z){
	nex[++now]=head[x],w[now]=z;
	head[x]=now,v[now]=y;
}

long long L,R,mid;
void Dfs(int x){
	for(int i=head[x];i;i=nex[i])
		deep[v[i]]=deep[x]+w[i],Dfs(v[i]);
}

typedef pair<long long,long long>P;
#define se second
#define fi first
vector<P>b[N],tmp;
void merge(int rt){
	int x=0,y;
	long long res=inf;
	for(int i=head[rt];i;i=nex[i])
		x?y=v[i]:x=v[i];

	if(b[x].size()>b[y].size())	swap(x,y);
	int sx=b[x].size(),sy=b[y].size();
	tmp.clear();

	for(int i=sx-1,j=0;~i;i--){
		while(j<sy&&b[y][j].fi+b[x][i].fi-deep[rt]*2<=mid)
			res=min(res,b[y][j++].se);
		if(res==inf)	continue;
		tmp.push_back(P(b[x][i].se,res));
		tmp.push_back(P(res,b[x][i].se));
	}

	sort(tmp.begin(),tmp.end());
	int si=tmp.size();
	res=inf;

	for(int i=0;i<si;i++)
		if(!i||tmp[i].se<res){
			b[rt].push_back(tmp[i]);
			res=tmp[i].se;
		}
}

void dfs(int x){
	if(!head[x]){
		b[x].push_back(P(deep[x],deep[x]));
		return ;
	}
	for(int i=head[x];i;i=nex[i])
		dfs(v[i]);
	merge(x);
}

bool check(){
	for(int i=1;i<=n;i++)	b[i].clear();
	dfs(1);
	return b[1].size();
}

int main(){
	n=read();
	for(int i=2;i<=n;i++){
		int x=read(),z=read();
		addedges(x,i,z),R+=z;
	}	Dfs(1);

	while(L<R){
		mid=(L+R)>>1;
		if(check())	R=mid;
		else	L=++mid;
	}
	printf("%lld\n",L);
	return 0;
}


Measured memory_bytes: 32244
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
	ll k,a,b;
	cin>>k>>a>>b;
	ll K=k;
	if(k<=a||a>=b){
		cout<<k+1<<endl;
	}
	else {
		ll ans=a;
		k-=a-1;
		if(k%2){
			--k;
			ans+=1;
		}
		ans+=(b-a)*k/2;

		cout<<max(ans,K+1)<<endl;
	}
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

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

	    int x=gi();
	    int m= uclid(360,x);
//	    if (k>k2) {
//	    	System.out.println("NO");
//	    } else {
//	    	System.out.println("YES");
//	    }
	    System.out.println(360/m);
	}

	// s進数で表した時の桁数
    public static int uclid(int m, int n) {
    	if (m<n) {
			m^=n;
			n^=m;
			m^=n;
		}

		while(true) {
			int t=m%n;
			if (t==0) {
				return n;
			} else {
				m=n;
				n=t;
			}
		}
    }


	// 文字列として入力を取得
	public static String gs() {
		return scanner.next();
	}

	// intとして入力を取得
	public static int gi() {
		return Integer.parseInt(scanner.next());
	}

	// longとして入力を取得
	public static long gl() {
		return Long.parseLong(scanner.next());
	}

	// doubleとして入力を取得
	public static double gd() {
		return Double.parseDouble(scanner.next());
	}
}

Measured memory_bytes: 35500
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
signed main(){
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    int n;
    cin>>n;
    vector<int> d(n);
    for(int i=0;i<n;i++){
        cin>>d[i];
    }
    sort(d.begin(),d.end());
    int ans=1;
    for(int i=0;i<n-1;i++){
        if(d[i]!=d[i+1]){
            ans++;
        }
    }
    cout<<ans<<'\n';
    return 0;
}

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

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

	int maxv = -1, maxa = -1;
	for (int i = 0; i < n; i++) {
		int a, v;
		cin >> a >> v;
		if (v > maxv) {
			maxv = v;
			maxa = a;
		}
		else if (v == maxv && a < maxa) {
			maxa = a;
		}
	}

	cout << maxa << " " << maxv << endl;
}

Measured memory_bytes: 1164
//40
#include<iostream>
#include<algorithm>

using namespace std;

int main(){
  for(int n,m;cin>>n>>m,n|m;){
    int uv[20000][2],d[20000],c[20000];
    for(int i=0;i<m;i++){
      cin>>uv[i][0]>>uv[i][1]>>d[i]>>c[i];
    }
    int ds[10001],p[10001];
    fill(ds,ds+10001,1<<29);
    ds[1]=0;
    for(int i=0;i<n;i++){
      for(int j=0;j<m;j++){
	for(int k=0;k<2;k++){
	  int a=uv[j][k],b=uv[j][!k];
	  if(ds[a]>ds[b]+d[j]||ds[a]==ds[b]+d[j]&&c[p[a]]>c[j]){
	    ds[a]=ds[b]+d[j];
	    p[a]=j;
	  }
	}
      }
    }
    int cs=0;
    for(int i=2;i<=n;i++){
      cs+=c[p[i]];
    }
    cout<<cs<<endl;
  }
  return 0;
}

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

long A[100000];
long M[100000];

int main(){
  int N;
  cin >> N;
  for(int i=0; i<N; i++){
    cin >> A[i];
  }
  for(int i=0; i<N; i++){
    A[i] = 2*A[i];
  }
  long w=0;
  for(int i=0; i<N; i++){
    if(i%2==0) w += A[i];
    else w -= A[i];
  }
  M[0]=w/2;
  for(int i=1; i<N; i++){
    M[i] = A[i-1]-M[i-1];
  }
  for(int i=0; i<N; i++){
    cout << M[i] << " ";
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 2816
package main

import (
	"fmt"
	"sort"
)

func main() {
	S := ""
	fmt.Scan(&S)
	c := [3]int{}
	for _, b := range []byte(S) {
		c[b-'a']++
	}
	sort.Ints(c[:])
	if c[2]-c[0] <= 1 {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}


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

using namespace std;

#define int long long

const int N = (int)3e5, MOD = (int)1e9 + 7, INF = (int)3e18;

main() {
    ios :: sync_with_stdio(0);
    cin.tie(0);
    int n, k;
    cin >> n >> k;
    int j = n % k;
    if (j <= abs(j - k)) cout << j;
    else cout << abs(j - k);
    return 0;
}

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

int main()
{
    int n,k;
    int a,b;
    int ans=1;

    cin >> n >> k;

    for(int i=0;i<n;i++){
        a=ans*2;
        b=ans+k;

        if(a<b){
            ans*=2;
        }else{
            ans+=k;
        }
    }

    cout << ans << endl;
    
}

Measured memory_bytes: 764
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef string str;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector <pii> vpii;
typedef vector <pll> vpll;
typedef map <str,int> mapsi;
typedef map <str,int> :: iterator mapsitr;
typedef map <int , int> mint;
typedef map <ll , ll> mll;
typedef set <int> si;
typedef set <int> :: iterator sitr;
typedef set <ll> :: iterator sltr;
#define mset multiset
typedef mset <int> msi;
typedef mset <ll> msll;
typedef mset <int> :: iterator msitr;
typedef mset <ll> :: iterator msltr;
#define mp make_pair
#define pb push_back
#define pob pop_back
#define fi first
#define se second
#define fs first.second
#define ss second.second
#define ff first.first
#define sf second.first
#define newl '\n'
char to_upper (char x){
    if( 97 <= int(x) && int(x) <= 126)return char(x-32);
    else if( 65 <= int(x) && int(x) <= 90)return x;
}
char to_lower (char x){
    if( 97 <= int(x) && int(x) <= 126)return x;
    else if( 65 <= int(x) && int(x) <= 90)return char(x+32);
}
int numerize (char x){
    if(48 <= int(x) && int(x) <= 57)return int(x-'0');
    else if( 97 <= int(x) && int(x) <= 126)return int(x-96);
    else if( 65 <= int(x) && int(x) <= 90)return int(x-64);
}
//void IO(){
//	#ifndef ONLINE_JUDGE
//	    freopen("input.txt", "r", stdin);
//	    freopen("output.txt", "w", stdout);
//	#endif
//}
// end of Template

int a,b;
int main(){
	//IO();
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin>>a>>b;
    if(a>=13)cout<<b<<newl;
    else if(a<=5)cout<<0<<endl;
    else cout<<b/2<<endl;


}


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

#define N 100005
#define MP make_pair
typedef long long LL;

struct data
{
	int a, b, c;
	bool operator < (const data &t)const
	{
		return c < t.c;
	}
}p[N];

int main()
{
	//freopen("in.txt", "r", stdin);
	
	int n; LL sa = 0, sb = 0;
	scanf("%d", &n);
	for (int i = 1; i <= n; ++i)
	{
		scanf("%d", &p[i].a);
	}

	for (int i = 1; i <= n; ++i)
	{
		scanf("%d", &p[i].b);
		p[i].c = p[i].a - p[i].b;
		sa += p[i].a, sb += p[i].b;
	}
	if (sa < sb) puts("-1");
	else
	{
		sort(p + 1, p + n + 1);
		LL more = sa - sb;
		int ans = n;
		for (int i = 1; i <= n; ++i)
		{
			if (p[i].c < 0) continue;
			if (more - p[i].c >= 0) --ans, more -= p[i].c;
		}
		printf("%d\n", ans);
	}
	
	return 0;	
}

Measured memory_bytes: 1408
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#include <queue>

#define rep(i, a, b) for ( int i = (a); i < (b); i++ )
#define per(i, a, b) for ( int i = (b)-1; i >= (a); i--)
#define pb push_back
#define mp make_pair
#define bg begin()
#define en end()


using namespace std;

typedef long long ll;

static const long long MOD = 1000000007;

int ans, K, X;

int main(void) {
    scanf("%d %d", &K, &X);

    if (K*500 >= X) puts("Yes");
    else puts("No");

	return 0;
}


Measured memory_bytes: 256
def DFS(n = 1, A = [0], i = 0, d = [0], f = [0], time = 1):
    for j in range(n):
        if A[i][j] == 1 and d[j] == 0:
            time = time + 1
            d[j] = time
            time = DFS(n, A, j, d, f, time)
    time = time + 1
    f[i] = time
    return time

n = int(raw_input())
A = [0] * n
for i in range(n):
    A[i] = [0] * n

for i in range(n):
    value = map(int, raw_input().split())
    u = value[0] - 1
    k = value[1]
    nodes = value[2:]
    for j in range(k):
        v = nodes[j] - 1
        A[u][v] = 1

d = [0] * n
f = [0] * n

time = 0
for i in range(n):
    if d[i] == 0:
        time = time + 1
        d[i] = time
        time = DFS(n, A, i, d, f, time)

for i in range(n):
    print(str(i + 1) + " " + str(d[i]) + " " + str(f[i]))

Measured memory_bytes: 6604
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int k = sc.nextInt();
        sc.close();

        int count = 0;
        if (k - a > 0) {
            count += a;
        } else {
            count += k;
        }
        k -= a;
        if (k > 0) {
            k -= b;
        }
        if (k > 0) {
            if (k - c > 0) {
                count -= c;
            } else {
                count -= k;
            }
        }
        System.out.println(count);
    }
}


Measured memory_bytes: 27024
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using Library;
using static Library.Input;

namespace AtCoderTemplate
{
    class ProgramD
    {
        private class Task
        {
            public long A {get;set;}
            public long B {get;set;}
        }
        static void Main()
        {
            int n = NextInt;
            var tasks = TakeLine(n).Select(l => new Task{A = l[0], B = l[1]}).OrderBy(t => t.B).ToArray();
            long sum = 0;
            
            foreach (var task in tasks)
            {
                sum += task.A;
                if (sum > task.B)
                {
                    System.Console.WriteLine("No");
                    return;
                }
            }

            System.Console.WriteLine("Yes");

        }
    }
}

namespace Library
{
    class Input
    {
        static IEnumerator<string> enumerator = new string[] { }.AsEnumerable().GetEnumerator();

        public static string Line => Console.ReadLine();

        public static string[] StrArr => Line.Split(' ');

        public static int NextInt => int.Parse(NextWord());

        public static long NextLong => long.Parse(NextWord());

        public static List<int> IntList => StrArr.Select(int.Parse).ToList();

        public static List<long> LongList => StrArr.Select(long.Parse).ToList();

        public static IEnumerable<long[]> TakeLine(int N)
        {
            return Enumerable.Repeat(0, N).Select(_ => Console.ReadLine().Split(' ').Select(long.Parse).ToArray());
        }

        public static string NextWord()
        {
            while (!enumerator.MoveNext())
            {
                enumerator = StrArr.AsEnumerable().GetEnumerator();
            }
            return enumerator.Current;
        }
    }
}


Measured memory_bytes: 35972
#include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define rep(i, n) for (int i = 0; i < n; i++)

int main() {
  int A, B, T;
  cin >> A >> B >> T;
  int count = T / A;
  cout << count * B << endl;
  return 0;
}


Measured memory_bytes: 256
N = int(input())
NN = [[0]*10 for _ in range(11)]
for i in range(11,100):
    As = str(i)[0]
    Ae = str(i)[-1]
    cnt = 0
    for j in range(1,N+1):
        if str(j)[-1]== As and str(j)[0] == Ae:
            cnt +=1
    NN[int(As)][int(Ae)] = cnt


ans = 0
for i in range(1,N+1):
    ans += NN[int(str(i)[0])][int(str(i)[-1])]

print(ans)


Measured memory_bytes: 73672
A = int(input())
B = int(input())
C = int(input())
X = int(input())

cnt = 0
for a in range(A+1):
  for b in range(B+1):
    for c in range(C+1):
      if a * 500 + b * 100 + c * 50 == X:
        cnt += 1

print(cnt)

Measured memory_bytes: 3060
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            var ab = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();
            var a = ab[0];
            var b = ab[1];
            var c = ab[2];
            if (a < b)
            {
                if (b < c)
                {
                    if(a< c)
                    {
                        Console.WriteLine("Yes");
                    }
                    else
                    {
                        Console.WriteLine("No"); 
                    }
                }
                else
                {
                    Console.WriteLine("No");
                }
            }
            else
            {
                Console.WriteLine("No");
            }
            
        }
    }
}

Measured memory_bytes: 9328
//Author:xht37
#include <bits/stdc++.h>

#define ui unsigned int
#define ll long long
#define ul unsigned ll
#define ld long double

#define pi pair <int, int>
#define fi first
#define se second
#define mp make_pair

#define ls (p << 1)
#define rs (ls | 1)
#define md ((t[p].l + t[p].r) >> 1)

#define vi vector <int>
#define pb push_back
#define pq priority_queue

#define dbg(x) cerr << #x" = " << x << endl
#define debug(...) fprintf(stderr, __VA_ARGS__)

#define fl(x) freopen(x".in", "r", stdin), freopen(x".out", "w", stdout)

using namespace std;

namespace io {
	const int SI = 1 << 21 | 1;
	char IB[SI], *IS, *IT, OB[SI], *OS = OB, *OT = OS + SI - 1, c, ch[100];
	int f, t;
	#define gc() (IS == IT ? (IT = (IS = IB) + fread(IB, 1, SI, stdin), IS == IT ? EOF : *IS++) : *IS++)
	inline void flush() {
		fwrite(OB, 1, OS - OB, stdout), OS = OB;
	}
	inline void pc(char x) {
		*OS++ = x;
		if (OS == OT) flush();
	}
	template <class I>
	inline void rd(I &x) {
		for (f = 1, c = gc(); c < '0' || c > '9'; c = gc()) if (c == '-') f = -1;
		for (x = 0; c >= '0' && c <= '9'; x = (x << 3) + (x << 1) + (c & 15), c = gc());
		x *= f;
	}
	template <class I>
	inline void rd(I &x, I &y) {
		rd(x), rd(y);
	}
	template <class I>
	inline void rd(I &x, I &y, I &z) {
		rd(x), rd(y), rd(z);
	}
	template <class I>
	inline void rda(I *a, int n) {
		for (int i = 1; i <= n; i++) rd(a[i]);
	}
	inline void rdc(char &c) {
		for (c = gc(); c < 33 || c > 126; c = gc());
	}
	inline void rds(char *s, int &x) {
		for (c = gc(); c < 33 || c > 126; c = gc());
		for (x = 0; c >= 33 && c <= 126; s[++x] = c, c = gc());
		s[x+1] = '\0';
	}
	template <class I>
	inline void print(I x, char k = '\n') {
		if (!x) pc('0');
		if (x < 0) pc('-'), x = -x;
		while (x) ch[++t] = x % 10 + '0', x /= 10;
		while (t) pc(ch[t--]);
		pc(k);
	}
	template <class I>
	inline void print(I x, I y) {
		print(x, ' '), print(y);
	}
	template <class I>
	inline void print(I x, I y, I z) {
		print(x, ' '), print(y, ' '), print(z);
	}
	inline void printc(char c) {
		pc(c);
	}
	inline void prints(string s) {
		int x = s.length();
		while (t < x) pc(s[t++]);
		pc('\n'), t = 0;
	}
	struct Flush {
		~Flush() {
			flush();
		}
	} flusher;
}
using io::rd;
using io::rda;
using io::rdc;
using io::rds;
using io::print;
using io::printc;
using io::prints;

const int N = 1e3 + 7, M = 2e5 + 7;
int n, m, u[M], v[M];
bool w[N][N];
int p[N][N], q[N][N];
vi e[N];

void dfs(int x, bool *w) {
	w[x] = 1;
	for (int y : e[x])
		if (!w[y]) dfs(y, w);
}

void dfs(int x, int *p, int z) {
	p[x] = z;
	for (int y : e[x])
		if (!p[y]) dfs(y, p, z);
}

int main() {
	rd(n, m);
	for (int i = 1; i <= m; i++) rd(u[i], v[i]), e[u[i]].pb(v[i]);
	for (int x = 1; x <= n; x++) {
		dfs(x, w[x]);
		p[x][x] = q[x][x] = x;
		for (int y : e[x]) if (!p[x][y]) dfs(y, p[x], y);
		reverse(e[x].begin(), e[x].end());
		for (int y : e[x]) if (!q[x][y]) dfs(y, q[x], y);
	}
	for (int i = 1; i <= m; i++)
		prints((w[v[i]][u[i]] ^ (p[u[i]][v[i]] != q[u[i]][v[i]])) ? "diff" : "same");
	return 0;
}

Measured memory_bytes: 16128
# coding: utf-8
def q0():
    while True:
        data=[]
        n=int(input())
        if n==0:
            return
        for i in range(n):
            data.append(int(input()))
        print((sum(data)-max(data)-min(data))//(n-2))

def q1():
    while True:
        n,r=map(int,input().split())
        if n==0:
            return
        deck=[n-i for i in range(n)]
        for i in range(r):
            p,c=map(int,input().split())
            deck=deck[p-1:p-1+c]+deck[0:p-1]+deck[p-1+c:]
        print(deck[0])


question=[q0,q1]

question[0]()


Measured memory_bytes: 5612
using System;
using System.Linq;

class Program
{
    public static void Main()
    {
        var line = Console.ReadLine().Split(' ').Select(p => int.Parse(p)).ToArray();
        var A = line[0];
        var B = line[1];
        int ans = 0;
        for(int i = 1; i < B;i++ )
        {
            if(((A-1)*(i-1) + A) >= B)
            {
                ans = i;
                break;
            }
        }

        Console.WriteLine(ans);
    }

}

Measured memory_bytes: 13268
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i <= n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.rbegin(), v.rend());
#define ALL(v) (v).begin(),(v).end()
 
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;

const ll mod = 1e9 + 7;

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

    double r;
    cin >> r;

    double res = 2 * 3.1415 * r;
    std::cout << std::fixed;
    std::cout << std::setprecision(4) << res << endl;
    return 0;
}

Measured memory_bytes: 3780
#include<stdio.h>
#include<string.h>
int main(){
	//freopen("in/0008.txt","r",stdin);
	
	int n,i,j,k,l;
	int NUM=10;
	int m[NUM][NUM][NUM][NUM];
	int r[37];
	memset(r, 0, sizeof(int)*37);

	for(i=0;i<NUM;i++){
		for(j=0;j<NUM;j++){
			for(k=0;k<NUM;k++){
				for(l=0;l<NUM;l++){
					if(l==0) m[i][j][k][l]=i+j+k+l;
					else m[i][j][k][l]=m[i][j][k][l-1]+1;

					r[m[i][j][k][l]]+=1;
				}
			}
		}
	}

	while(scanf("%d",&n)!=EOF){
		printf("%d\n",n<37? r[n]:0 );
	}

	return 0;
}

Measured memory_bytes: 632
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin>>N;
  vector<double> A(N);
  for(int i=0;i<N;i++) cin>>A[i];
  sort(A.begin(),A.end());
  for(int k=0;k<N-1;k++){A[k+1]=(A[k]+A[k+1])/2;}
  cout<<A[N-1]<<endl;
}

Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.BufferedReader;
 
public class Main{
    static String shuffle(String origin , int h){
        return origin.substring(h , origin.length()) + origin.substring(0 , h);
    }
    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String line;
 
        while(!(line=br.readLine()).equals("-")){
            int times = Integer.parseInt(br.readLine());
            for(int i = 0; i < times; i++){
                line = shuffle(line , Integer.parseInt(br.readLine()));
            }
            System.out.println(line);
        }
 
    }
}


Measured memory_bytes: 24496
#include<bits/stdc++.h>
using namespace std;
int main(){
	int x,y;
	cin>>x>>y;
	if(x==1||x==3||x==5||x==7||x==8||x==10||x==12){
		if(y==1||y==3||y==5||y==7||y==8||y==10||y==12){
			cout<<"Yes"<<endl;
		}
		else cout<<"No"<<endl;
	}
	else if(x==4||x==6||x==9||x==11){
		if(y==4||y==6||y==9||y==11){
			cout<<"Yes"<<endl;
		}
		else cout<<"No"<<endl;
	}
	else if(x==2){
		if(y==2){
			cout<<"Yes"<<endl;
		}
		else cout<<"No"<<endl;
	}
}

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

#define int long long

signed main(){
    double sum;
    int n;
    cin >> n;
    for(int i = 0;i < n;i++){
        double a;
        cin >> a;
        sum += 1.0 / a;
    }

    printf("%.12lf\n", 1.0/sum);



    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<utility>
#include<cmath>
#include<climits>
#include<queue>
#include<stack>
#include<numeric>
#include<set>
#include<iomanip>
#include<map>
using namespace std;


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


int main(){
  int n, a, b;
  cin >> n >> a >> b;
  int ans = 0;
  for(int i = 1; i <= n; ++i){
    int num = i;
    int sum = 0;
    while(num != 0){
      sum += num % 10;
      num /= 10;
    }

    if(sum >= a && sum <= b){
      ans += i;
    }
  }

  cout << ans << endl;

}


Measured memory_bytes: 256