akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
int main(void){
  int n,a[200],ans=0;
  cin >> n;
  
  for(int i=0;i<n;i++){
      cin >> a[i];
  }
  
  for(int j=0;j<1000000000;j++){
      for(int i=0;i<n;i++){
      if(a[i]%2==0){
          a[i]/=2;
      }
      else{
          cout << ans << endl;
          return 0;
      }
      
  }
  ans++;
  
}
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,d;
int a[200010],b[200010];
int main() {
	scanf("%d",&n);
	for(int i=1;i<=n;i++) {
		scanf("%d",&a[i]);
		b[i]=a[i];
	}
	sort(b+1,b+1+n);
	for(int i=1;i<=n;i++)
		if(a[i]==b[n]) printf("%d\n",b[n-1]);
		else printf("%d\n",b[n]);
	return 0;
}

Measured memory_bytes: 3328
s = input()
k = int(input())
n = len(s)
ss = set(s)
# print(ss)
ans = 0
if len(ss) == 1:
    print(k*n//2)
    # print('y')
    exit()
if n == 1:
    print(n//2)
    exit()
streaks = []
cnt = 0
now = s[0]
for i in range(n):
    if now == s[i]:
        cnt += 1
    else:
        streaks.append(cnt)
        now = s[i]
        cnt = 1
streaks.append(cnt)
# print(streaks)
m = len(streaks)
if s[0] == s[-1]:
    for i in range(1, m-1):
        ans += streaks[i]//2
    # print(ans)
    ans *= k
    # print(ans)
    ans += (streaks[0] + streaks[m-1])//2*(k-1)
    # print(ans)
    ans += streaks[0]//2 + streaks[m-1]//2
    # print(ans)
else:
    for i in range(m):
        ans += streaks[i]//2
    ans *= k

print(ans)


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

int main() {
    int n;
    cin>>n;
    int l;
    int r;
    int cnt=0;
    for(int i=1;i<=n;i++){
        cin>>l>>r;
        cnt+=r-l+1;
    }

    cout<<cnt<<endl;

}

Measured memory_bytes: 256
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

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

		int n = stdIn.nextInt();
		BigInteger max = BigInteger.valueOf((long)Math.pow(10, 18));

		BigInteger num = BigInteger.valueOf(1);

		List<Long> numList = new ArrayList<>();
		for (int i = 0; i < n; i++) {
			numList.add(stdIn.nextLong());
		}

		Collections.sort(numList);
		stdIn.close();

		if(numList.get(0) == 0) {
			System.out.println(0);
			return;
		}

		for (int i = 0; i < n; i++) {
			num = num.multiply(BigInteger.valueOf(numList.get(i)));

			if(num.compareTo(max) > 0) {
				break;
			}
			if(num.signum() == 0) {
				break;
			}
		}

		if(num.compareTo(max) > 0) {
			System.out.println(-1);
		} else {
			System.out.println(num);
		}

	}
}


Measured memory_bytes: 61368
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for (int i = (n)-1; i >= 0; i--)
#define rep2(i,s,n) for (int i = (s); i < (n); ++i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define pb push_back
#define eb emplace_back
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vs vector<string>
#define vc vector<char>
#define vb vector<bool>
#define vp vector<P>
using namespace std;
using ll = long long;
using P = pair<int,int>;
using LP = pair<ll,ll>;
template<class T> istream& operator>>(istream& is,vector<T>& v) { for(T& t:v){is>>t;} return is; }
template<class T> ostream& operator<<(ostream& os,const vector<T>& v) { for(T t:v){os<<t<<" ";} os<<"\n"; return os; }
void Yes(bool b) { cout << (b ? "Yes" : "No") << endl; }
void YES(bool b) { cout << (b ? "YES" : "NO") << endl; }
template<class T> inline bool chmin(T& a,T b) {if(a > b){a = b; return true;} return false;}
template<class T> inline bool chmax(T& a,T b) {if(a < b){a = b; return true;} return false;}
const int inf = 1001001001;
const ll linf = 1001001001001001001;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
    int n;
    cin >> n;
    vs s(n);
    cin >> s;
    int A = 0,B = 0;
    vp in,de;
    rep(i,n) {
        string ns = s[i];
        int na = 0,nb = 0,mn = 0;
        for(char c : ns) {
            if(c == '(') {
                A++;
                na++;
            } else {
                B++;
                nb++;
            }
            chmin(mn,na-nb);
        }
        if(na-nb >= 0) in.eb(na-nb,-mn);
        else de.eb(na-nb,na-nb-mn);
    }
    if(A != B) {
        Yes(0);
        return 0;
    }
    sort(all(in),[](P a,P b){ return a.second < b.second; });
    sort(all(de),[](P a,P b){ return a.second > b.second; });
    int now = 0;
    for(P p : in) {
        if(now-p.second < 0) {
            Yes(0);
            return 0;
        }
        now += p.first;
    }
    for(P p : de) {
        now += p.first;
        if(now-p.second < 0) {
            Yes(0);
            return 0;
        }
    }
    Yes(1);
}

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

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

using namespace std;

int main()
{
  int n, k;
  map<int, int> d;

  cin >> n >> k;

  REP(i, k) {
    int a;
    cin >> a;
    d[a] = 1;
  }

  int ans = n;

  while (1) {
    int tmp = ans;
    while (tmp) {
      if (d[tmp % 10]) {
        break;
      }
      tmp /= 10;
    }
    if (!tmp) {
      break;
    }
    ++ans;
  }

  cout << ans << endl;
}


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

int main()
{
    const double pi = acos(-1);
    double r;
    cin >> r;
    cout << fixed << setprecision(8);
    cout << r * r * pi << " " << 2 * r * pi << "\n";
}

Measured memory_bytes: 1288
N=int(input())
ab=[list(map(int,input().split())) for _ in range(N)]
cd=[list(map(int,input().split())) for _ in range(N)]

ab=[x[0]+x[1]*1j for x in ab]
cd=[x[0]+x[1]*1j for x in cd]

def comp(a,b):
	if a.real<b.real and a.imag<b.imag:
		return True
	else:
		return False

abd=dict()
cdd=dict()

for i in range(len(ab)):
	temp=[]
	for j in range(len(cd)):
		if comp(ab[i],cd[j]):
			temp.append(cd[j])
	if temp!=[]:
		abd[ab[i]]=temp
	
for i in range(len(cd)):
	temp=[]
	for j in range(len(ab)):
		if comp(ab[j],cd[i]):
			temp.append(ab[j])
	if temp!=[]:
		cdd[cd[i]]=temp
	
ans=0
while(len(abd.keys())+len(cdd.keys())):
	m=10**5
	
	for i in abd.keys():
		for j in abd[i]:
			cnt=len(abd[i])+len(cdd[j])
			if cnt<m:
				m=cnt
				abm=i
				cdm=j
	
	cdl=abd[abm]
	abl=cdd[cdm]
	
	for i in abl:
		abd[i].remove(cdm)
	for i in cdl:
		cdd[i].remove(abm)
	
	del abd[abm]
	del cdd[cdm]
	
	abk=[i for i in abd.keys()]
	cdk=[i for i in cdd.keys()]
	
	for i in abk:
		if abd[i]==[]:
			del abd[i]
	for i in cdk:
		if cdd[i]==[]:
			del cdd[i]
	ans+=1
print(ans)

Measured memory_bytes: 3192
fn main() {
    let mut reader = acio::Reader::new();
    let n = reader.read::<u32>();
    let a = reader.read::<u32>();
    let b = reader.read::<u32>();
    println!("{}", if n * a < b { n * a } else { b });
}

/// Mathematics Module
#[allow(dead_code)]
mod math {
    trait Math {
        fn lcm(v1: Self, v2: Self) -> Self;
        fn gcd(v1: Self, v2: Self) -> Self;
    }

    macro_rules! integer {
        ($t:ty) => {
            impl Math for $t {
                fn lcm(v1: $t, v2: $t) -> $t {
                    v1 * v2 / Self::gcd(v1, v2)
                }

                fn gcd(v1: $t, v2: $t) -> $t {
                    let (mut v1, mut v2) = (v1, v2);
                    while v1 != v2 {
                        if v1 < v2 {
                            v2 -= v1;
                        } else {
                            v1 -= v2;
                        }
                    }
                    v1
                }
            }
        };
    }

    integer!(i8);
    integer!(i16);
    integer!(i32);
    integer!(i64);
    integer!(isize);
    integer!(u8);
    integer!(u16);
    integer!(u32);
    integer!(u64);
    integer!(usize);
}

/// IO Module for AtCoder
#[allow(dead_code)]
mod acio {
    use std::fmt::Debug;
    use std::io::{stdin, Stdin};
    use std::str::FromStr;

    pub struct Reader {
        input: Stdin,
        stack: Vec<String>,
    }

    impl Reader {
        pub fn new() -> Self {
            Reader {
                input: stdin(),
                stack: vec![],
            }
        }

        pub fn read_by<F>(&mut self, count: u64) -> Vec<F>
        where
            F: FromStr,
            <F as FromStr>::Err: Debug,
        {
            let mut v = vec![];
            for _ in 0..count {
                v.push(self.read());
            }
            v
        }

        pub fn read<F>(&mut self) -> F
        where
            F: FromStr,
            <F as FromStr>::Err: Debug,
        {
            while self.stack.is_empty() {
                let mut line = self.read_line();
                self.stack.append(&mut line);
                self.stack.reverse();
            }
            self.stack.pop().unwrap().parse().unwrap()
        }

        fn read_line(&mut self) -> Vec<String> {
            let mut buf = String::new();
            self.input.read_line(&mut buf).unwrap();
            buf.split_whitespace().map(|s| s.to_string()).collect()
        }
    }
}


Measured memory_bytes: 4352
void main() {
  problem();
}

void problem() {
  auto X = scan!ulong;

  ulong solve() {
    ulong years;
    real money = 100;

    while(money < X) {
      years++;
      money = cast(ulong)(cast(real)money * 1.01);
    }

    return years;
  }

  writeln(solve());
}

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

import std.stdio, std.conv, std.array, std.string, std.algorithm, std.container, std.range, core.stdc.stdlib, std.math, std.typecons, std.numeric;
T[][] combinations(T)(T[] s, in int m) {   if (!m) return [[]];   if (s.empty) return [];   return s[1 .. $].combinations(m - 1).map!(x => s[0] ~ x).array ~ s[1 .. $].combinations(m); }
string scan(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }
T scan(T)(){ return scan.to!T; }
T[] scan(T)(int n){ return n.iota.map!(i => scan!T()).array; }
void deb(T ...)(T t){ debug writeln(t); }
alias Point = Tuple!(long, "x", long, "y");

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


Measured memory_bytes: 2716
#include <bits/stdc++.h>
using namespace std;
 
int main() {
string C;
  cin>>C;
  if(C == "a"||C == "e"||C == "i"||C == "o"||C == "u"){
  cout<<"vowel";
  }
  else{
  cout<<"consonant";
  }
}

Measured memory_bytes: 256
listA = []
listB = []
for _ in range(3):
    listA.append(list(map(int, input().split())))
N = int(input())
for _ in range(N):
    listB.append(int(input()))
tate =  [0 , 0 , 0]
yoko = [0, 0, 0]
naname = [0, 0] 
for i in range(3):
    for j in range(3):
        if listA[i][j] in listB:
            tate[i] += 1
            yoko[j] += 1
            if i == j:
                naname[0] += 1
            if  i + j == 2:
                naname[1] += 1
if  3 in tate or 3 in yoko or 3 in naname:
    print("Yes")
else:
    print("No")
    

Measured memory_bytes: 9212
import java.util.stream.IntStream;

public class Main {
    private static java.util.Scanner scanner = new java.util.Scanner(System.in);

    public static void main(String[] args) {
        int n = scanner.nextInt();
        int[][] f = IntStream.range(0, n).mapToObj(i -> IntStream.range(0, 10).map(j -> scanner.nextInt()).toArray()).toArray(int[][]::new);
        int[][] p = IntStream.range(0, n).mapToObj(i -> IntStream.range(0, 11).map(j -> scanner.nextInt()).toArray()).toArray(int[][]::new);
        IntStream.range(1, 1024).map(i -> IntStream.range(0, n).map(j -> p[j][(int)IntStream.range(0, 10).filter(k -> (i >> k & 1) == 1 && f[j][k] == 1).count()]).sum()).max().ifPresent(System.out::println);
    }
}

Measured memory_bytes: 50420
#include "bits/stdc++.h"
// Custom Header {{{
#define ALL(x) x.begin(), x.end()
#define rep(i, s, n)      for(int i(s); i < int(n); ++i)
#define endl '\n'
#ifndef YDK
#define eprintf(...)
#endif
using namespace std;
using i64 = long long;
using pii = pair<i64, i64>;
template<class A, class B>inline bool chmax(A &a, const B &b){return b>a ? a=b,1 : 0;}
template<class A, class B>inline bool chmin(A &a, const B &b){return b<a ? a=b,1 : 0;}
constexpr const int INF  = 0x3f3f3f3f;
constexpr const i64 LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr const int MOD  = int(1e9) + 7;
// }}}

// Library {{{

// }}}

namespace {
    int N, M;
    vector<pii> G[105];
    int dist[105];
    int prev[105];

    bool used[1005];
    map<pii, int> edgeid;

    void dijkstra(int start)
    {
        priority_queue< pii, vector<pii>, greater<pii> > pq;
        memset(dist, INF, sizeof(dist));

        pq.emplace(0, start);
        dist[start] = 0;

        while(!pq.empty()) {
            const int c = pq.top().first;
            const int u = pq.top().second;
            pq.pop();

            if (dist[u] < c) continue;
            for (auto e : G[u]) {
                const int ncost = c + e.first;
                const int nxt   = e.second;
                if (chmin(dist[nxt], ncost)) {
                    pq.emplace(ncost, nxt);
                    prev[nxt] = u;
                }
            }
        }
        return;
    }

    int getID(int s, int t)
    {
        if (s > t) swap(s, t);
        return edgeid[pii(s,t)];
    }

    void setID(int s, int t, int id)
    {
        if (s > t) swap(s, t);
        edgeid[pii(s,t)] = id;
        return;
    }

    void dfs(int i, int sum = 0)
    {
        for (auto e : G[i]) {
            const int nxt = e.second;
            const int nc = sum + e.first;
            if (nc <= dist[nxt]) {
                used[getID(i, nxt)] = true;
                dfs(nxt, nc);
            }
        }
    }

    signed __()
    {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);

        cin >> N >> M;
        for (int i = 0; i < M; ++i) {
            int a, b, c;
            cin >> a >> b >> c;
            G[a].push_back(pii(c, b));
            G[b].push_back(pii(c, a));
            setID(a, b, i);
        }

        for (int i = 1; i <= N; ++i) {
            dijkstra(i);
            dfs(i);
        }

        int ans = 0;
        for (int i = 0; i < M; ++i) {
            if (!used[i]) ++ans;
        }

        cout << ans << endl;

        return 0;
    }
}

signed main() { __(); return 0; }


Measured memory_bytes: 384
#include<stdio.h>

int main(void)
{
   int d,n,x,i,a[100],s,j;
   scanf("%d%d%d",&n,&d,&x);
   for(i=0;i<n;i++)
   scanf("%d", &a[i]);

   s=0;
   for(i=0;i<n;i++){
      for(j=1;j<=d;j=j+a[i])
    s++;
   }

   printf("%d\n", s+x);

   return 0;
}



Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <time.h>
#include <numeric>
#include <random>
#include <unordered_map>
#include <unordered_set>
#define int long long
#define all(a) a.begin(),a.end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define pb push_back
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> P;
typedef complex<ld> com;
constexpr int inf = 1000000000;
constexpr ll INF = 1000000000000000010;
constexpr ld EPS = 1e-12;
constexpr ld PI = 3.141592653589793238;
template<class T, class U> inline bool chmax(T &a, const U &b) { if (a < b) { a = b; return true; } return false; }
template<class T, class U> inline bool chmin(T &a, const U &b) { if (a > b) { a = b; return true; } return false; }

struct edge {
	ll to, cost;
};

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(20);

	int n, m, s;
	cin >> n >> m >> s;
	if (s >= 5000) {
		vector<vector<int>> dis(n, vector<int>(n, INF));
		rep(i, n) dis[i][i] = 0;
		rep(i, m) {
			int u, v, a, b;
			cin >> u >> v >> a >> b;
			u--; v--;
			chmin(dis[u][v], b); chmin(dis[v][u], b);
		}
		rep(k, n) rep(i, n) rep(j, n) chmin(dis[i][j], dis[i][k] + dis[k][j]);
		for (int i = 1; i < n; i++) cout << dis[0][i] << '\n';
	}
	else {
		vector<int> dis(5001 * n, INF);
		vector<vector<int>> dis2(n, vector<int>(n, INF));
		vector<vector<edge>> graph(5001 * n);
		rep(i, s + 1) dis[i] = 0;
		rep(i, n) dis2[i][i] = 0;
		rep(i, m) {
			int u, v, a, b;
			cin >> u >> v >> a >> b;
			u--; v--;
			chmin(dis2[u][v], b); chmin(dis2[u][v], b);
			rep(j, 5001) {
				if (j >= a) {
					graph[u * 5001 + j].pb({ v * 5001 + j - a,b });
					graph[v * 5001 + j].pb({ u * 5001 + j - a,b });
				}
			}
		}
		rep(k, n) rep(i, n) rep(j, n) chmin(dis2[i][j], dis2[i][k] + dis2[k][j]);
		rep(i, n) {
			int c, d;
			cin >> c >> d;
			rep(j, 5001) {
				if (j + c < 5001) {
					graph[i * 5001 + j].pb({ i * 5001 + j + c,d });
				}
				else {
					graph[i * 5001 + j].pb({ i * 5001 + 5000,d });
				}
			}
		}
		priority_queue<P, vector<P>, greater<P>> que;
		que.push(P(0, s));
		while (!que.empty()) {
			P p = que.top(); que.pop();
			int pf = p.first; int ps = p.second;
			if (pf > dis[ps]) continue;
			for (edge e : graph[ps]) {
				if (dis[e.to] > dis[ps] + e.cost) {
					dis[e.to] = dis[ps] + e.cost;
					que.push(P(dis[e.to], e.to));
				}
			}
		}
		for (int i = 1; i < n; i++) {
			int ans = INF;
			rep(j, 5001) {
				chmin(ans, dis[i * 5001 + j]);
			}
			rep(j, n) {
				chmin(ans, dis[j * 5001 + 5000] + dis2[j][i]);
			}
			cout << ans << '\n';
		}
	}
}

Measured memory_bytes: 44568
#include <iostream>
#include <string>

using namespace std;

int sameCount(string s, string t)
{
  int count = 0;
  for (int i = 0; i < t.length(); ++i)
  {
    if (s[i] == t[i])
      ++count;
  }
  return count;
}

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

  int count = 0;

  for (int i = 0; i <= s.length() - t.length(); ++i)
  {
    int c = sameCount(s.substr(i, t.length()), t);
    if (c > count)
      count = c;
  }

  cout << t.length() - count << endl;
}

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

int num;
int a[21][21];

int retcost(int Island){
	int x=0;
	for(int i=1;i<=num;i++){
		if(a[Island][i]){
			a[i][Island]=0;
			x=max(x,a[Island][i]+retcost(i));
		}
	}
	return x;
}

int main(void){
	while(cin>>num,num){
		int I1,I2,t,ans,I[num+1]={},Cost=0;
		memset(a,0,sizeof(a));
		for(int i=1;i<num;i++){
			cin>>I1>>I2>>t;
			a[I1][I2]=a[I2][I1]=t;
			I[I1]++,I[I2]++;
			Cost+=t*2;
		}
		for(int i=1;i<=num;i++){
			for(int j=1;j<=num;j++){
				if((I[i]==1||I[j]==1)&&!((i==1&&I[i]==1)||(j==1&&I[j]==1))){
					Cost-=a[i][j]*2;
					a[i][j]=a[j][i]=0;
				}
			}
		}
		ans=Cost-retcost(1);
		cout<<ans<<endl;
	}
	return 0;
}

Measured memory_bytes: 3072
#include <bits/stdc++.h>
 
using namespace std;
typedef long long int lli;
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
typedef pair <lli,lli> pii;
#define ff first
#define ss second
#define MOD 1000000007
#define pb push_back
#define EPS 1e-6
#define SZ(v) int((v).size())
#define ALL(vec) begin(vec), end(vec)
typedef long long i64; 
long long const INF = 1e18 + 42;
 
 
int main(){
	fast;
	string s,t;
	cin>>s>>t;
  	int a,b;
  	cin>>a>>b;
  	string u;
  	cin>>u;
	if(u==s) cout<<(a-1)<<" "<<b;
  	else cout<<a<<" "<<(b-1);
	return 0;
}

Measured memory_bytes: 256
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

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

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

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

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

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

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

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

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

fn main() {
    input! {
        n: usize,
    }
    let result = if n % 2 == 0 {
        n / 2 - 1
    } else {
        n / 2
    };
    println!("{}", result);
}


Measured memory_bytes: 4352
#include<math.h>
#include<limits.h>
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<sstream>
#include<list>
#include<queue>
#include <algorithm>
#include<initializer_list>
using namespace std;
#define ul unsigned long long


int main() {
	int n;
	cin >> n;
	vector<int> s = vector<int>(n, 0);
	for (int i = 0; i < n; i++) cin >> s[i];
	
	int sum = 0;
	for (int i = 0; i < n; i++)sum += s[i];
	
	int max = 0;
	if (sum % 10 == 0) {
		sort(s.begin(), s.end());
		for (int i = 0; i < n; i++) {
			if (s[i] % 10 == 0) {
				continue;
			}
			else {
				max = sum - s[i];
				break;
			}
		}
	}
	else {
		max = sum;
	}
	cout << max << endl;

	return 0;
}




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

int main()
{
  int n,k;cin>>n>>k;
  vector<int> h(n);
  int i,j;
  for(i=0;i<n;i++)cin>>h.at(i);
  vector<int> cost(n,INF);
  cost.at(0)=0;
  for(i=1;i<n;i++)
  {
    for(j=1;j<=k&&i-j>=0;j++)
    cost.at(i)=min(cost.at(i-j)+abs(h.at(i-j)-h.at(i)),cost.at(i));
  }
  cout<<cost.at(n-1)<<endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll  = long long;
using vl  = vector<ll>;
using vvl = vector<vl>;

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define per(i,n) for(int i = (n)-1; i >= 0; --i)
#define rng(i,a,b) for(int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()
const int mod = 998244353;
struct mint {
    ll x;
    mint(ll x=0) : x((x%mod+mod)%mod) {}
    mint operator-() const { return mint(-x); }
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) {
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint a) const {
        mint res(*this);
        return res += a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res -= a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res *= a;
    }
    mint pow(ll t) const {
        if (t == 0) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const {
        return pow(mod-2);
    }
    mint &operator/=(const mint a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint a) const {
        mint res(*this);
        return res /= a;
    }
};
istream& operator>>(istream& i, mint& var) {
    ll tmp; i >> tmp;
    var.x = tmp;
    return i;
}
ostream& operator<<(ostream& o, const mint& var) {
    o << var.x;
    return o;
}
vector<mint> fac;
mint ncr(int n, int r) {
    if (fac.empty()) {
        const int MAX_N = 2e5+10;
        fac.assign(MAX_N,1);
        for (int i = 0; i < MAX_N; ++i) {
            fac[i+1] = fac[i] * mint(i+1);
        }
    }
    return fac[n] / fac[n-r] / fac[r];
}

int main() {
    ll n, m, k; cin >> n >> m >> k;
    mint ans(0);
    rep(i,k+1) ans += ncr(n-1,i) * mint(m-1).pow(n-i-1);
    cout << ans * mint(m) << endl;
    return 0;
}


Measured memory_bytes: 4800
#include<iostream>;
using namespace std;
struct DATA {
	bool a = false;
	bool b = false;
	bool c = false;
};
int main()
{
	struct DATA data[111];
	int n,na,nb,nc;
	int nom;
	int i;
	int cnt = 0;
	cin >> n >> na;
	for (i = 0; i < na; i++)
	{
		cin >> nom;
		data[nom].a = true;
	}
	cin >> nb;
	for (i = 0; i < nb; i++)
	{
		cin >> nom;
		data[nom].b = true;
	}
	cin >> nc;
	for (i = 0; i < nc; i++)
	{
		cin >> nom;
		data[nom].c = true;
	}
	for (i = 1; i <= n; i++)
	{
		if (data[i].a == false && data[i].c) cnt++;
		else if (data[i].b && data[i].c) cnt++;
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 3096
import bisect

n = int(input())
aList = sorted(list(map(int,input().split())))
bList = sorted(list(map(int,input().split())))
cList = sorted(list(map(int,input().split())))
#print("aList",aList)
#print("bList",bList)
#print("cList",cList)

count = 0
for i in bList:
  idxA = bisect.bisect_left(aList,i)
  idxC = bisect.bisect_right(cList,i)
#  print("idxA",idxA)
#  print("idxC",idxC)

  count += (idxA)*(n-idxC)
#  print("count",count)
print(count)


Measured memory_bytes: 23504
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <map>
#include <utility>

using ll = long long ;
#define MAXN 200009
#define MAXL 29 
std::map<std::pair<int,int>, int> bucket;

class Rat
{
    private:
        int cofp2,cofp5;
    public:
        Rat(){}
        Rat(ll nn,ll dd)
        {
           ll tn = nn;
           ll td = dd;
           cofp2 = 0;
           while( tn%2==0){
               cofp2++;
               tn/=2;
           } 
           while(td%2==0){
               cofp2--;
               td/=2;
           }
           cofp5=0;
           while(tn%5==0){
               cofp5++;
               tn/=5;
           }
           while(td%5==0){
               cofp5--;
               td/=5;
           }
        }
        void output() 
        { 
            printf("2^{%d}*5^{%d}\n",cofp2,cofp5); 
        } 
        int getcofp2()
        {
            return cofp2;
        }
        int getcofp5()
        {
            return cofp5;
        }
}; 
        

int main(void) 
{ 
    char theNumber[MAXL]; 
    int N,i,j;
    scanf("%d",&N);
    Rat *a ;

    for (i=0;i<N;i++){
        scanf("%s",theNumber);
        char* ret = strchr(theNumber,'.');
        if (ret==NULL){
            a = new Rat(atoi(theNumber),1); 
        } else {
            int lenOfDen = strlen(&theNumber[ret-&theNumber[0]+1]);
            ll den = pow(10,lenOfDen); 
            ll num = atoi(theNumber)*den
            +atoi(&theNumber[ret-&theNumber[0]+1]);
            a = new Rat(num,den);
        }
        bucket[std::make_pair(a->getcofp2(),a->getcofp5())] ++;
    }

    ll s=0;
    for (auto it:bucket) {
        int x1 = it.first.first;
        int y1 = it.first.second;
        int r1 = it.second;
        for (auto it2:bucket) {
            int x2 = it2.first.first;
            int y2 = it2.first.second;
            int r2 = it2.second;

            if(x1+x2>=0 && y1+y2>=0)
            {
                if(it<it2){
                    s+=((ll)r1)*r2;
                } else if (it==it2) {
                    s+=((ll)r1*(r1-1))/2;
                }
            }
        }
    }

    printf("%lld\n",s);

    return 0;
}


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

int main() {
  int N;
  std::string S;
  std::cin >> N;
  std::cin >> S;

  int countABC = 0;
  for (int i = 0; i < N-2; i++) {
	if (S[i] == 'A' && S[i+1] == 'B' && S[i+2] == 'C')
      	countABC++;
  }

  std::cout << countABC << std::endl;
}


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

int main(){
  long long a,b,k;

  cin >> a >> b >> k;

  long long left = 0;
  if(k>a)left = k-a;

  a -= min(k,a);
  b-= min(left,b);
  cout << a << " " << b << endl;
  return 0;
}
    
  


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll ;
const ll MOD = 998244353;
const ll dx[4] = { -1,1,0,0 };
const ll dy[4] = { 0,0,-1,1 };
const ll MAX = 7e5 ;
const ll oo = 1e16;
#define pb push_back
#define f first
#define s second
#define all(v) v.begin(),v.end()
long long gcd(long long  a, long long  b) { return (b == 0 ? a : gcd(b, a % b)); }
ll n , m  , k , Q , a , b , l , x , y, ans , p , T , G; string s;
ll fact[MAX] , inv[MAX];
ll binpow(ll a, ll b){
	if(b == 0){
		return 1;
	}if(b % 2 == 1) return (binpow(a, b - 1) * a) % MOD;
	else{
		ll x = binpow(a, b / 2);
		return (x * x) % MOD;
	}
}

ll C(ll n, ll k){
	ll x = (inv[k] * inv[n - k]) % MOD;
	return (fact[n] * x) % MOD;
}

ll solve(ll cntA, ll cntB){
    if (cntB > n) return 0;
	return C(n, cntA) * C(n, cntB) % MOD;
}
signed main()
{
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    fact[0] = inv[0] = 1;
	for(ll i = 1; i < MAX; i++){
		fact[i] = (fact[i - 1] * i) % MOD;
		inv[i] = (inv[i - 1] * binpow(i , MOD - 2))%MOD;
	}


	cin >> n >> a >> b >> k;
	for(int i = 0; i <= n; i++){
		if(k >= a * i && (k - (i * a)) % b == 0){
			ans += solve(i, (k - (i * a)) / b);
			ans %= MOD;
		}
	}
	cout << ans;




    return 0;
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define int long long

signed main(){
    int n; cin >> n;
    vector<int> a(n), b;
    rep(i, n) cin >> a[i];
    b = a;
    sort(rALL(b));
    
    for(int i: a){
        cout << (i == b[0] ? b[1] : b[0]) << endl;
    }
}

Measured memory_bytes: 4736
n = int(input())
t,a = map(int,input().split())
l = list(map(int,input().split()))
d = 10**6
point = -1
for i in range(n):
  if abs(t-l[i]*0.006-a) < d:
    d = abs(t-l[i]*0.006-a)
    point = i+1
print(point)

Measured memory_bytes: 38256
// Bridge
// 所要時間 分
// 解説みてしまった
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<(n); ++i)
#define REP(i, d, n) for(int i=(d); i<(n); ++i)
#define all(v) v.begin(), v.end()
using ll = long long;
using P = pair<int, int>;

class UnionFind {
public:
    vector<int> d;
    UnionFind(int n) : d(n, -1) {}
    int find(int x){
        if(d[x] < 0){
            return x;
        }
        return d[x] = find(d[x]);
    }

    bool unite(int x, int y){
        int a = find(x);
        int b = find(y);
        if(a == b){
            return false;
        }
        if(size(a) < size(b)){
            swap(a, b);
        }
        d[a] += d[b];
        d[b] = a;
        return true;
    }

    bool same(int x, int y){
        return find(x) == find(y);
    }

    int size(int x){
        return -d[find(x)];
    }
};

int main() {

    int n, m;
    cin >> n >> m;
    vector<int> a(m), b(m);
    rep(i, m){
        int x, y;
        cin >> x >> y;
        a[i] = --x;
        b[i] = --y;
    }

    int ans = 0;
    rep(i, m){
        UnionFind uf(n);
        rep(j, m){
            if(i == j){
                continue;
            }
            uf.unite(a[j], b[j]);
        }
        if(uf.size(0) != n){
            ans++;
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
S = str(input())
t = len(S)
ans =0
for i in range(1<<t-1):
    s =int(S[0])
    for x in range(t-1):
        if i & 1<<x:
            ans+=s
            s=int(S[x+1])
        else:
            s = 10*s+int(S[x+1])
    ans +=s
print(ans)

Measured memory_bytes: 3060
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>

int main() {
  long N;
  std::cin >> N;

  std::vector<long> tallness(N);
  for (auto& t : tallness) {
    std::cin >> t;
  }

  long long sum = 0;
  long current_max = 0;
  for (auto t : tallness) {
    if (t < current_max) {
      sum += current_max - t;
    }

    current_max = std::max(t, current_max);
  }

  std::cout << sum << '\n';
}


Measured memory_bytes: 4392
#include "bits/stdc++.h"

#define REP(i,num) for(ll i=0;i<(num);++i)
#define FOR(i,c,num) for(ll (i)=(c);(i)<(num);++(i))
#define LOOP(i) while(i--)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto pitr=c.begin();pitr!=c.end();++pitr){cout<<*pitr;if(next(pitr,1)!=c.end())cout<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=ll>
T in(){T x; cin >> x; return (x);}
template<typename T=ll,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return x;}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

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

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);

	auto N=in();
	vll P[3];
	REP(i,N){
		P[0].push_back(in());
		P[1].push_back(in());
		P[2].push_back(in());
	}
	vvll dp(N+1,vll(3,0));

	REP(i,N){
		REP(j,3){
			REP(k,3){
				if(j==k) continue;
				chmax(dp[i+1][k],dp[i][j]+P[k][i]);
			}
		}
	}
	out(*max_element(ALL(dp[N])));
	return 0;
}


Measured memory_bytes: 11092
#include<bits/stdc++.h>
#define ll long long
#define N 500005
#define inf 1000000005
#define mod 998244353
#define put putchar('\n')
#define F(i,a,b) for (int i=a;i<=b;i++)
#define D(i,a,b) for (int i=a;i>=b;i--)
#define go(i,t) for (int i=head[t];i;i=Next[i])
#define sqr(x) ((x)*(x))
#define re register
#define mp make_pair
#define fi first
#define se second
#define M 10000005
#define pa pair <int,int>
#define int ll
using namespace std;
inline char gc(){
    static char buf[100000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}
#define gc getchar
inline int read(){
	int x = 0; char ch = gc(); bool positive = 1;
	for (; !isdigit(ch); ch = gc())	if (ch == '-')	positive = 0;
	for (; isdigit(ch); ch = gc())	x = x * 10 + ch - '0';
	return positive ? x : -x;
}
inline void wr(ll x){if (x<0) {putchar('-');wr(-x);return;}if(x>=10)wr(x/10);putchar(x%10+'0');}
inline void wrn(ll x){wr(x);put;}inline void wri(ll x){wr(x);putchar(' ');}
inline void wrn(ll x,ll y){wri(x);wrn(y);}
int n,m,a[N],ans;
#define ex return puts("-1"),0;
signed main(){
	n=read();
	F(i,1,n) a[i]=read();
	F(i,1,n){
		if (a[i]>=i||a[i]>a[i-1]+1) ex;
		if (a[i]==a[i-1]+1) ans++;
		else ans+=a[i];
	}
	wrn(ans);
	return 0;
}

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

int main(){

	int n;
	cin >> n;

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

	vector<int> dp(n,INT_MAX);
	dp[n-1]=0;


	for(int i=n-2;i>=0;i--){
		if(i+1<n){
			dp[i] = min(dp[i] , abs(a[i]-a[i+1])+dp[i+1]);
		}
		if(i+2<n){
			dp[i] = min(dp[i] , abs(a[i]-a[i+2])+dp[i+2]);
		}
	}

	cout << dp[0] << "\n";


	return 0;
}

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

using namespace std;

int main()
{
    int a, b;
    int d, r;
    double f;
    cin >> a >> b;

    d = a / b;
    r = a % b;
    f = (double)a / (double)b;

    printf("%d %d %.6f\n", d, r, f);

    return 0;
}


Measured memory_bytes: 3228
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define pb emplace_back
#define mp make_pair
#define f(i,a,n) for(int i=a ; i<n ; i++)
#define F first
#define E endl
#define S second
#define fast ios:: sync_with_stdio(false),cin.tie(0);
#define COUT cout<<fixed<<setprecision(9)

int main()
{
    char a,b,c,d,e,f;
    cin>>a;
    char k=a-97;
    a=a+1;
    cout<<a;
	
}

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

using namespace std;

int gcd(int a, int b)
{
    if(b==0) return a;
    else return gcd(b, a%b);
}

int main()
{
    string dir;
    while(cin >> dir, dir!="#")
    {
        stack<char> st;
        string::iterator itr = dir.begin();
        int den = 1;
        while(itr!=dir.end())
        {
            st.push(*itr);
            itr += *itr=='n' ? 5 : 4;
            den<<=1;
        }
        int num = st.top()=='w' ? 1 : 0;
        st.pop();
        while(!st.empty())
        {
            num *= 2;
            if(st.top()=='w') num++;
            else num--;
            st.pop();
        }
        num *= 180;
        int g = gcd(num, den);
        num /= g;
        den /= g;
        if(den==1) cout << num << endl;
        else cout << num << "/" << den << endl;
    }
}

Measured memory_bytes: 3128
#include <bits/stdc++.h>
//#define int long long
#define r(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin,v.end()
using namespace std;
typedef pair<int,int>P;
int dx[]={0,0,-1,1};
int dy[]={1,-1,0,0};
string s;
signed main(){
  cin>>s;
  int n;
  cin>>n;
  vector<string>v;
  for(int i=0;i<s.size();i++){
    string t;
    for(int j=0,k=0;k<5;j++,k++){
      if(j+i>=s.size())break;
      t+=s[j+i];
      v.push_back(t);
      //cout<<t<<endl;
    }
  }
  sort(v.begin(),v.end());
  v.erase(unique(v.begin(),v.end()),v.end());
  cout<<v[n-1]<<endl;
}

Measured memory_bytes: 1660
#include <iostream>
#include <vector>
#include <algorithm>

int main() {
    int N, M, X;
    std::cin >> N >> M >> X;

    std::vector<int> A(M);
    for (int& a : A) {
        std::cin >> a;
    }

    int cost_to_zero = std::count_if(A.begin(), A.end(), [&](int a){return a < X;});
    std::cout << std::min(cost_to_zero, M - cost_to_zero) << std::endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define fr first
#define sc second
typedef pair<int,int> pii;
typedef vector<int> vi;
const int INF = (1<<25);
const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};

#define MAX_V 20 //最大頂点数

struct edge{
  int to,cost;
  edge(int _to,int _cost){to=_to;cost=_cost;}
};

int V; //頂点数
vector <edge> G[MAX_V];
int d[MAX_V]; //頂点sからの最短距離

void dij(int s){
  priority_queue<pii,vector<pii>,greater<pii> > q;
  fill(d,d+V,INF);
  d[s]=0;
  q.push(pii(0,s));

  while(!q.empty()){
    pii p=q.top(); q.pop();
    int v=p.second; //secondは頂点の番号
    if(d[v]<p.first) continue; //firstは最短距離
    for(int i=0;i<G[v].size();i++){
      edge e=G[v][i];
      if(d[e.to]>d[v]+e.cost){
	d[e.to]=d[v]+e.cost;
	q.push(pii(d[e.to],e.to));
      }
    }
  }
}

int main(){
  int m; //道の総数
  cin>> V>> m;
  for(int i=0;i<m;i++){
    int a1,b1,c1,d1;
    scanf("%d,%d,%d,%d",&a1,&b1,&c1,&d1);
    G[a1-1].pb(edge(b1-1,c1));
    G[b1-1].pb(edge(a1-1,d1));
  }
  int x1,x2,y1,y2;
  scanf("%d,%d,%d,%d",&x1,&x2,&y1,&y2);
  dij(x1-1);
  int go=d[x2-1];
  dij(x2-1);
  int back=d[x1-1];
  int ans=y1-go-back-y2;
  cout<< ans<< endl;
}

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

pair<int, int> solve(int N) {
    
    vector<vector<int>> field(1000, vector<int>(1000)); // field[x][y]
    field[500][500] = 1;
    vector<pair<int, int>> sq(N);
    sq[0].first = sq[0].second = 500;
    
    int dx[] = {-1, 0, 1, 0};
    int dy[] = {0, -1, 0, 1};
    
    for (int i = 1; i <= N-1; i++) {
        int n, d; cin >> n >> d;
        int nx = sq[n].first + dx[d];
        int ny = sq[n].second + dy[d];
        sq[i].first = nx;
        sq[i].second = ny;
        field[nx][ny] = 1;
    }
    
    int minX = 10000;
    int maX = -1;
    int minY = 10000;
    int maY = -1;
    for (int x = 0; x < 1000; x++) {
        for (int y = 0; y < 1000; y++) {
            if (field[x][y]) {
                maX = max(maX, x);
                minX = min(minX, x);
                minY = min(minY, y);
                maY = max(maY, y);
            }
        }
    }
    return {maX-minX+1, maY - minY+1};
}

int main(void){
    // Your code here!
    int N;
    vector<pair<int, int>> ans;
    while (1) {
        cin >> N;
        if (!N) break;
        ans.push_back(solve(N));
    }
    for (auto &p : ans) {
        cout << p.first << " " << p.second << endl;
    }
}



Measured memory_bytes: 6736
a, b = map(int, input().split())
c = input()
d = [0] * len(c)
e = 0
for i in range(1, len(c)):
    if c[i] == "C" and c[i-1] == "A":
        e += 1
    d[i] = e
for i in range(b):
    f, g = map(int, input().split())
    print(d[g-1] - d[f-1])


Measured memory_bytes: 7876
#include<iostream>
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<vector>
#include<cstdlib>
#include<map>
#include<fstream>
#include<string>
#include<sstream>
#include<iomanip>
#include<iostream>
#include<numeric>
using namespace std;

int main() {
	int a, b;
	cin >> a >> b;
	if (a > b)
		cout << a - 1 << endl;
	else if (a <= b)
		cout << a << endl;
}

Measured memory_bytes: 256
#ifdef LOCAL
#define _GLIBCXX_DEBUG
#endif
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define reps(i,a,b) for(int i=a;i<b;++i)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
using namespace std;
using ll = long long;
using P = pair<int, int>;
template<typename T> inline bool chmax(T &a,T b){if(a<b){a=b;return 1;}return 0;}
template<typename T> inline bool chmin(T &a,T b){if(b<a){a=b;return 1;}return 0;}
template<typename T> vector<T> make_vec(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>
auto make_vec(size_t a,Ts... ts){return vector<decltype(make_vec<T>(ts...))>(a,make_vec<T>(ts...));}
template<typename T,typename U,typename... V>
typename enable_if<is_same<T,U>::value>::type fill_v(U &u,const V... v){u=U(v...);}
template<typename T,typename U,typename... V>
typename enable_if<!is_same<T,U>::value>::type fill_v(U &u,const V... v){for(auto &e:u)fill_v<T>(e,v...);}

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

    int n;
    cin >> n;
    vector<int> v(n+1), w(n+1);
    rep(i, n) cin >> v[i+1] >> w[i+1];
    int k = 1;
    int p = 2;
    while (n >= p) {
        k++;
        p <<= 1;
    }
    int k2 = k/2;
    const int maxl = 1e5;
    auto dp = make_vec<int>(1<<k2, maxl+1);
    rep(i, 1<<k2) {
        rep(j, maxl+1) {
            chmax(dp[i][j], dp[i/2][j]);
            if (j != 0) chmax(dp[i][j], dp[i][j-1]);
            if (j+w[i] <= maxl) chmax(dp[i][j+w[i]], dp[i/2][j] + v[i]);
        }
    }
    int q;
    cin >> q;
    while (q--) {
        int u, W;
        cin >> u >> W;
        int res = 0;
        rep(bit, 1<<(k-k2)) {
            int s = u;
            int noww = 0, nowv = 0;
            rep(i, k-k2) {
                if (bit>>i&1) {
                    noww += w[s];
                    nowv += v[s];
                }
                s >>= 1;
            }
            if (noww <= W) {
                nowv += dp[s][W-noww];
                chmax(res, nowv);
            }
        }
        cout << res << endl;
    }
}


Measured memory_bytes: 206440
#include <bits/stdc++.h>
using namespace std;
int main (){
  string s;
  cin>>s;
  if(s[1]==s[0]&&s[1]==s[2])
    cout<<"Yes"<<endl;
  else if(s[1]==s[2]&&s[2]==s[3])
    cout<<"Yes"<<endl;
  else
    cout<<"No"<<endl;
  return 0;
}
  


Measured memory_bytes: 256
package main

import(
    "fmt"
    "sort"
    "strings"
)



func main() {
    var a,b string
    fmt.Scan(&a,&b)
    ans := "EQUAL"
    if len(a)!=len(b){
        if len(a)>len(b){
            ans = "GREATER"
        } else {
            ans = "LESS"
        }
    } else{
        for i:=0;i<len(a);i++{
            if a[i]>b[i]{
                ans = "GREATER"
                break
            }
            if b[i]>a[i]{
                ans = "LESS"
                break
            }
        }
    }
    fmt.Println(ans)
}





// Pairsort
type Pair struct {
    first,second int64
}

type By func(p1, p2 *Pair) bool

func (by By) Sort(pairs []Pair) {
    ps := &pairSorter{
            pairs : pairs,
            by: by,
    }
    sort.Sort(ps)
}

type pairSorter struct {
    pairs []Pair
    by func(p1, p2 *Pair) bool
}

func (s *pairSorter) Len() int {
    return len(s.pairs)
}

func (s *pairSorter) Swap(i, j int) {
    s.pairs[i], s.pairs[j] = s.pairs[j], s.pairs[i]
}

func (s *pairSorter) Less(i, j int) bool {
    return s.by(&s.pairs[i], &s.pairs[j])
}

func first (p1, p2 *Pair) bool {
        return p1.first < p2.first
}

func second (p1, p2 *Pair) bool {
        return p1.second < p2.second
}
// end



func abs32(a int) int {
    if a<0{
        return -a
    }
    return a
}

func abs64(a int64) int64 {
    if a<0{
        return -a
    }
    return a
}

func min32(a, b int) int {
    if a >= b {
        return b
    }
    return a
}

func max32(a, b int) int {
    if a >= b {
        return a
    }
    return b
}

func min64(a, b int64) int64 {
    if a >= b {
        return b
    }
    return a
}

func max64(a, b int64) int64 {
    if a >= b {
        return a
    }
    return b
}

func gcd(a, b int64) int64 {
    if a % b == 0 {
        return b
    } else {
        return gcd(b, a%b)
    }
}

func lcm(a, b int64) int64 {
    return a / gcd(a, b) * b
}

func scanNums(len int) (nums []int){
    var num int
    for i:=0; i<len; i++{
        fmt.Scan(&num)
        nums = append(nums,num)
    }
    return
}

func scanNums64(len int) (nums []int64){
    var num int64
    for i:=0; i<len; i++{
        fmt.Scan(&num)
        nums = append(nums,num)
    }
    return
}

func scanString(len int) (str []string){
    var s string
    for i:=0; i<len; i++{
        fmt.Scan(&s)
        str = append(str,s)
    }
    return
}

func makeTwoNums(n,m int) ([][]int){
    Nums := make([][]int, n)
    for i:=0; i<n; i++{
        Nums[i] = make([]int, m)
    }
    return Nums
}

func sortString(s string) string{
    t := strings.Split(s, "")
    sort.Strings(t)
    return strings.Join(t, "")
}

func reverseString(s string) string{
    t := []rune(s)
    for i,j := 0, len(s)-1 ; i < j ; i, j = i+1, j-1 {
        t[i], t[j] = t[j], t[i]
    }
    return string(t)
}

func inside(h,w,H,W int) bool{
    if h>=0 && h<H && w>=0 && w<W{
        return true
    }
    return false
}


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

int main(){
	int a,b,c;
	cin >> a >> b >> c;
	cout << min(b/a, c) << endl;
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define lowbit(a) ((a)&(-(a)))
using namespace std;

int n;
int a[100000+5];

int main()
{
	cin >> n;
	for (int i = 1; i <= n; i++)cin >> a[i];
	sort(a + 1, a + 1 + n);
	int l = a[(1 + n) / 2];
	int r = a[(1 + n) / 2 + 1];
	cout << r - l << endl;
	return 0;
}

Measured memory_bytes: 640