akhauriyash/Code-Regression huggingface dataset:
// Template begins
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <stdio.h>
#include <math.h>
#include <iomanip>
#include <queue> 
#include <string.h>
#include <string>
using namespace std;
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define ll long long
#define endl "\n"
#define lb lower_bound
#define ub upper_bound
#define fo(i,a,b) for(i=a;i<=b;i++)
#define all(v) (v).begin(),(v).end()
#define sort0(v) sort(all(v))
#define lbb(a,b,arr,x) lower_bound(arr+a,arr+b+1,x)-arr
#define ubb(a,b,arr,x) upper_bound(arr+a,arr+b+1,x)-arr
#define freq(a,b,arr,x) upper_bound(arr+a,arr+b+1,x)-lower_bound(arr+a,arr+b+1,x)
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define d0(x) cout<<(x)<<" "
#define d1(x) cout<<(x)<<endl
#define d2(x,y) cout<<(x)<<" "<<(y)<<endl
#define d3(x,y,z) cout<<(x)<<" "<<(y)<<" "<<(z)<<endl
#define d4(a,b,c,d) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<endl
#define d5(a,b,c,d,e) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<" "<<(e)<<endl
#define d6(a,b,c,d,e,f) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<" "<<(e)<<" "<<(f)<<endl
#define max3(a,b,c) max(max((a),(b)),(c))
#define max4(a,b,c,d) max(max((a),(b)),max((c),(d)))
#define ss second
#define ff first
#define pb push_back
#define mp make_pair
#define printp(x) cout << x.ff << " " << x.ss << endl
 
const ll mod=1e9+7;
#define inf 9999999999999
#define MAXN   100001 
  
// stores smallest prime factor for every number 
 
 
ll inv(ll i){if(i==1) return 1;return (mod-((mod/i)*inv(mod%i))%mod)%mod;}
 
ll gcd(ll a,ll b){if(a==0) return b;return gcd(b,b%a);}
inline void fastio(){ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);}
// Template ends
const int MN = 2e5+7;
ll n,m; 
bool visited[200005];
void dfs(vector <int> adj[], set <int> components[], int s, int index){
    visited[s]=true;
    components[index].insert(s);
    for(int i=0;i<adj[s].size();i++){
        if(!visited[adj[s][i]]){
            dfs(adj, components, adj[s][i], index);
        }
    }
    return;
}
void solve(){
    cin>>n>>m;
    vector <int> adj[n];
    for(int i=0;i<n;i++) 
    {
        visited[i]=false;
    }
    map <pii,int> check;
    for(int i=0;i<m;i++){
        int a,b; cin>>a>>b;
        if(check.find(mp(a-1,b-1))!=check.end() || check.find(mp(b-1,a-1))!=check.end()){
            continue;
        }
        adj[a-1].pb(b-1);
        adj[b-1].pb(a-1);
        check[mp(a-1,b-1)]=1;
    }
    set <int> components[n]; int index=0;
    map <int,int> m1;
    for(int i=0;i<n;i++){
        if(!visited[i]){
            dfs(adj, components, i, index);
            index++;
        }
    }
    ll ans=0;
    for(int i=0;i<n;i++){
        ans=max(ans,(ll)components[i].size());
    }
    cout<<ans<<endl;
}
int main(){
    fastio();
    //write code
    int t; t=1;
    while(t--){
        solve();
    }
    return 0;
}

Measured memory_bytes: 53216
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int a = sc.nextInt();
		int b = sc.nextInt();

		System.out.printf("%d %d %.10f\n", a/b,a%b,(double)a/(double)b);
	}
}





Measured memory_bytes: 26532
#include <iostream>
#include <vector>
#include <queue> //priority queue
#include <stack>
#include <map> // multimap
#include <set> //multiset
#include <list> 
#include <utility> // pair
#include <iterator>
#include <deque> // insertion as both ends
#include <string>
// g1=s.substr(0,n/2);
// g2=s.substr(n/2+n%2,n/2);
#include <cctype> //isaplha
#include <iomanip>      // std::setprecision
#include <algorithm> //binary_search,sort, next_permutation in lexicographically greater permutation, fill(it1,it2,val)
#include <cmath>
#include <limits.h> //INT_MIN,INT_MAX
#include <numeric>  //iota,partial_sum,inner_product,accumulate(begin,end,num)
#include <functional>  //Arithmetic, comparators, logical
#include <bitset>
#include <unordered_map>
#include <unordered_set>
#include <stdio.h> 
#include <cstring>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,b,a) for(int i=b;i>=a;i--)
#define fori(a) for(auto i : a )
#define all(a) begin(a), end(a)
#define set(a,b) memset(a,b,sizeof(a))
#define pi 3.14159
#define mod 1000000007

#define ll long long 
#define ull unsigned long long
#define pb push_back
#define pf push_front //deque
#define mp make_pair
#define PQ priority_queue

#define f first
#define s second
#define pii pair< int, int >
#define piii pair<int,pair<int,int> >
#define vi vector<int> 
#define tc int t; cin >> t; while(t--)

using namespace std;
string repeat(string s, int n) {
    string s1 = s; 
    for (int i=1; i<n;i++) 
        s += s1;
    return s; 
}
string getString(char x) {
    string s(1, x); 
    return s;    
} 

void optimizeIO(){
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
    cout.tie(NULL);
}

vector<ll> primeFactors(ll n)  { 
    vector<ll> v;
    if(n%2==0) v.pb(2); 
    while (n % 2 == 0)  {  
        n = n/2;  
    }  
    for (ll i = 3; i <= sqrt(n); i = i + 2) {  
        if(n%i==0) v.pb(i);
        while (n % i == 0) {  
            n = n/i;  
        }  
    } 
    if (n > 2)  v.pb(n);
    return v;
}  
bool isPrime(ll n){
    if (n <= 1)  return false; 
    if (n <= 3)  return true;
    if (n%2 == 0 || n%3 == 0) return false; 
    for (ll i=5; i*i<=n; i=i+6) 
        if (n%i == 0 || n%(i+2) == 0) 
           return false; 
  
    return true; 
} 

int main(){
    optimizeIO();
    int x;int y;
    cin>>x>>y;
    ll a=0;
    if(x==1) a+=300000;
    else if(x==2) a+=200000;
    else if(x==3) a+=100000;
    if(y==1) a+=300000;
    else if(y==2) a+=200000;
    else if(y==3) a+=100000;
    if(x==1 && y==1) a+=400000;
    cout<<a<<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<map>

typedef long long ll;
using namespace std;

int N;

int main(){
    cin >> N;
    map<ll, ll > m;
    ll stick[2];
    stick[0] = 0;
    stick[1] = 0;
    ll a;
    for(ll i=0; i<N; i++){
        cin >> a;
        m[a] += 1;
        if((m[a]>=2) && (m[a]%2==0)){
            if(stick[1]<=a){
                stick[0] = stick[1];
                stick[1] = a;
            }else if(stick[1]>a && stick[0]<=a){
                stick[0] = a;
            }
        }
    }
    cout << stick[0]*stick[1] << endl;
}


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

int main() {
  int N, count = 0, i = 1;
  cin >> N;
  vector<int> b(N);
  
  for (int i=0; i<N; i++) {
    cin >> b.at(i);
  }
  
  while (count <= N) {
    i = b.at(i-1);
    count++;
    if (i == 2) {
      cout << count << endl;
      break;
    }
  }
  if (i != 2){
  cout << -1 << endl;
  }
  return 0;
}


Measured memory_bytes: 768
#include<bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define dofloat cout<<fixed<<setprecision(8)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define bitcount __builtin_popcount
#define all(vec) vec.begin(),vec.end()
#define rall(vec) vec.rbegin(),vec.rend()
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<long long> vl;
typedef pair<long long,long long> pll;
typedef vector<pair<long long,long long> > vll;
typedef vector<pair<int,int> > vii;
typedef vector<int> vi;
typedef pair<int,int> ii;
const long long MOD=1000000007;
const long long MAX=100005;
const long double PI=3.14159265359;
const long double G=9.807;
const long long INF=1e18;
const long double EPS=1e-6;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
bool isprime(ll a){
  if(a==2)return 1;
  if(!(a&1))return 0;
  for(ll i=3;i*i<=a;i+=2)
    if(a%i==0)return 0;
  return 1;
}
ll mpow(ll base,ll exponent,ll modulus){
  if(modulus==1)return 0;
  long long result = 1;
  base=base%modulus;
  while(exponent){
    if(exponent%2 == 1)
	  result=(result*base)%modulus;
	  exponent=exponent>>1;
	  base=(base*base)%modulus;
  }
  return result;
}
ll minv(ll a,ll mod){
  ll _gcd=gcd(a,mod);
  assert(_gcd==1);
  return mpow(a,mod-2,mod);
}


/*
ll ncr(ll N,ll K){
	if(N<K)return 0;
	if(K==0)return 1;
	if(N==0)return 0;

	ll den=1;
	for(ll i=1;i<=K;i++)den*=i;
	ll num=1;
	while(K--){
		num*=N;
		if(num%den==0){
			num/=den;
			den=1;
		}
		N--;
	}

	return num;
}
*/
ll x;
int main(){FAST;
cin>>x;
ll rem = x%11;
ll ans = x/11*2;
if(rem)
	if(rem-6<=0){
		ans++;
	}
	else{
		ans+=2;
	}
cout<<ans;
return 0;
}

Measured memory_bytes: 256
def read_input():
    a = int(input())
    b = int(input())
    c = int(input())
    d = int(input())

    return a, b, c, d


def submit():
    a, b, c, d = read_input()

    print(min(a, b) + min(c, d))

if __name__ == '__main__':
    submit()


Measured memory_bytes: 2940
object Main extends App{
  val sc = new java.util.Scanner(System.in)
  var a, b, c, d = sc.nextInt()
  var i,j = 0
  while (a>0){
    i+=1
    a=a-d
  }
  while (c>0){
    j+=1
    c=c-b
  }
  printf(if(i>=j) "Yes" else "No")
}

Measured memory_bytes: 55232
#include <bits/stdc++.h>
#define sz(c)       int(c.size())
#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 fore(c,...) for (auto __VA_ARGS__:(c))
using namespace std;
typedef long long ll;



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

	int N,K,C;
	string S;
	cin>>N>>K>>C>>S;

	auto calc=[&](string s) {
		vector<int> res(1);
		int prev=-2*N,cnt=0;
		rep(i,0,sz(s)) {
			if (s[i]=='o' && i-prev>C) {
				cnt++;
				prev=i;
			}
			res.push_back(cnt);
		}
		return res;
	};

	auto a=calc(S);
	reverse(S.begin(),S.end());
	auto b=calc(S);
	reverse(b.begin(),b.end());

	rep(i,0,N) if (a[i]+b[i+1]<K) cout<<i+1<<'\n';
}


Measured memory_bytes: 3656
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;

int main() {
    int64_t x, y;
    cin >> x >> y;

    if (x % y == 0) {
        cout << -1 << endl;
        quick_exit(0);
    }

    cout << x << endl;

    return 0;
}

Measured memory_bytes: 256
H, W, N = map(int, input().split())
sr, sc = map(int, input().split())
S = input()
T = input()
B = [1, W, 1, H]
for i in range(N - 1, -1, -1):
  if T[i] == 'L': B[1] = min(B[1] + 1, W)
  if T[i] == 'R': B[0] = max(B[0] - 1, 1)
  if T[i] == 'U': B[3] = min(B[3] + 1, H)
  if T[i] == 'D': B[2] = max(B[2] - 1, 1)
  if S[i] == 'L': B[0] += 1
  if S[i] == 'R': B[1] -= 1
  if S[i] == 'U': B[2] += 1
  if S[i] == 'D': B[3] -= 1
  if B[1] < B[0] or B[3] < B[2]:
    print('NO')
    break
else:
  print('YES' if B[0] <= sc <= B[1] and B[2] <= sr <= B[3] else 'NO')

Measured memory_bytes: 4016
#include<iostream>
#include<vector>
#include<string>
#include<map>
#include<algorithm>
#include<cmath>
using namespace std;

typedef long long int llint;

int main(){
	int H,W;
	cin >> H >> W;
	for(int y=0;y<H;y++){
		string C;
		cin >> C;
		cout << C << endl;
		cout << C << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#define _USE_MAT_DEFINES
#include<iostream>
#include <iomanip>
#include<stdio.h>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include <queue>
#include <utility>
#include <map>
#include <set>
#include <stack>
#include <deque>
#include <numeric>
#include <functional>
using namespace std;

#define MOD 1000000007;//1e9+7

int main() {
    int A, B;
    cin >> A >> B;

    cout << 6 - A - B;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		long min = 0,max = 0,sum = 0;
		
		for(int i = 0;i < N;i++){
			long a = sc.nextInt();
			sum += a;
			if(i == 0){
				min = a;
				max = a;
			}
			if(max < a)
				max = a;
			if(min > a)
				min = a;
			
		}
		System.out.println(min+" "+max+" "+sum);
	}
}

Measured memory_bytes: 31772
from collections import Counter
N = int(input())
strs = [input() for _ in range(N)]

dic = Counter(strs)
max_count = max(dic.values())

results = []
for k, v in dic.items():
  if v == max_count:
    results.append(k)
      
for s in sorted(results):
  print(s)

Measured memory_bytes: 35572
def A():
    seq = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
    K = int(input())
    print(seq[K-1])

import math
def B():
    H, W = map(int, input().split())
    if H==1 or W==1:
        print(1)
        return
    print(int(math.ceil(H*W/2.0)))
B()

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0; i<(int)(n); ++i)
using namespace std;
typedef long long LL;
struct Edge{
    int dst, cost;
};
typedef vector<Edge> Node;
typedef vector<Node> Graph;
typedef tuple<int, int, int> P;

int mask(int cur, vector<int> B) {
    int s = 0;
    REP(i, B.size()) if(B[i] == cur + 1) s |= (1 << i);
    return s;
}

int main(){
    int N, M, L, K;
    while(cin >> N >> M >> L >> K && N > 0) {
        Graph G(N);

        REP(i, M) {
            int u, v, c;
            cin >> u >> v >> c;
            u--; v--;
            G[u].push_back({v, c});
            G[v].push_back({u, c});
        }

        int start, goal;
        cin >> start >> goal;
        start--; goal--;

        vector<int> B(L);
        REP(i, L) cin >> B[i];

        vector<int> dist[55][1 << 8];
        priority_queue<P, vector<P>, greater<P>> que;
        que.push(P(0, start, mask(start, B)));
        while(!que.empty()) {
            auto p = que.top(); que.pop();
            int d, u, s;
            tie(d, u, s) = p;
            if(dist[u][s].size() >= K) continue;
            dist[u][s].push_back(d);
            for(auto e : G[u]) {
                int nu = e.dst;
                int nd = d + e.cost;
                int ns = s | mask(nu, B);
                if(dist[nu][ns].size() < K)  {
                    que.push(P(nd, nu, ns));
                }
            }
        }
        if(dist[goal][(1 << L) - 1].size() == K) {
            cout << dist[goal][(1 << L) - 1][K-1] << endl;
        } else {
            assert(dist[goal][(1 << L) - 1].size() == 0);
            cout << "NA" << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 41304
n=int(input())
s=input().split()
a=[]
for i in range(n):
    x=int(s[i])
    a.append([x,i+1])
a.sort(key=lambda x:x[0])
for i in range(n):
    if i==n-1:
        print(a[i][1])
    else:
        print(a[i][1],end=" ")


Measured memory_bytes: 27832
#include<bits/stdc++.h>
#define ll long long
#define inf 1000000000
#define mp make_pair
#define pii pair<int,int>
#define pb push_back
#define r1 rt<<1
#define r2 rt<<1|1
#define ri register int
#define rep(i,a,b) for(ri i=(a);i<=(b);++i)
#define rep2(i,a,b,c) for(ri i=(a);i<=(b);i+=(c))
#define REP(i,a,b) for(ri i=(a);i>=(b);--i)
#define REP2(i,a,b,c) for(ri i=(a);i>=(b);i-=(c))
#define db double
#define pdd pair<db,db>
using namespace std;

inline int read(){
	ri x=0,f=1;char c=getchar();
	while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
	while(c>='0'&&c<='9') x=(x<<1)+(x<<3)+(c^'0'),c=getchar();
	return x*f;
}

const int N=105;
int n;
vector<pdd> v;
#define fi first
#define se second
int main()
{
	n=read();
	rep(i,1,n) v.pb(mp(1.0*read(),1.0*read()));
	db mx=0;
	rep(i,0,359){
		db tarx=cos(i),tary=sin(i),tx=0,ty=0;
		rep(j,0,n-1)
			if((tarx*v[j].fi+tary*v[j].se)>0){
				tx+=v[j].fi;ty+=v[j].se;
			}
		db tans=sqrt(tx*tx+ty*ty);
		if(tans>mx) mx=tans;
	}
	printf("%.12lf",mx);
	return 0; 
}

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

using ll = long long int;
using P = pair<ll, ll>;
using P3 = pair<double,P>;
using PP = pair<P, P>;
constexpr int INF = 1 << 30;
constexpr ll MOD = 998244353;
constexpr int di[] = {0, 1, 0, -1};
constexpr int dj[] = {1, 0, -1, 0};
constexpr double EPS = 1e-8;

ll n ,m;
vector<ll> a, sum;

ll count(ll x){
    ll res = 0;
    for(int i=0;i<n;i++){
        res += a.end() - lower_bound(a.begin(),a.end(),x-a[i]);
    }
    return res;
}

int solve(){
    cin >> n >> m;
    a.resize(n);
    for(int i=0;i<n;i++){
        cin >> a[i];
    }
    sort(a.begin(), a.end());
    ll ok = 0, ng = 2e5+1;
    while(abs(ok-ng)>1){
        ll mid = (ok+ng)/2;
        if(count(mid) >= m){
            ok = mid;
        }else{
            ng = mid;
        }
    }
    sum.resize(n+1);
    for(int i=n-1;i>=0;i--){
        sum[i] = sum[i+1]+a[i];
    }
    ll ans = 0;
    for(int i=0;i<n;i++){
        ll len = a.end() - lower_bound(a.begin(), a.end(), ng-a[i]);
        ans += a[i]*len + sum[n-len];
        m -= len;
    }
    ans += ok*m;
    cout << ans << endl;
    return 0;
}

int main(){
    solve();
    return 0;
}

Measured memory_bytes: 1920
n = (int)(input())
s = input()
l = len(s)
d_l = [0]*(l+1)
for i in range(1, l+1):
    d = s[:i]
    n_open = d.count('(')
    d_l[i] = 2*n_open - i

x = min(d_l)

print('('*(-x) + s + ')'*(d_l[-1]-x))


Measured memory_bytes: 3060
def main():
    n = int(input())

    n_odd = 0
    n_even = 0
    n_four = 0

    for x in (int(a) for a in input().split()):
        if x % 4 == 0:
            n_four += 1
        elif x % 2 == 1:
            n_odd += 1
        else:
            n_even += 1

    if n_even == 0:
        extra = 1
    else:
        extra = 0

    if n_odd <= n_four + extra:
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    main()

Measured memory_bytes: 11096
#include<bits/stdc++.h>
	#define fastio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	#define range(i,l,h) for(int i=l;i<h;i++)
	#define endl '\n'
	#define I INT_MAX
	#define L INT_MIN
	#define pb push_back
	#define ll long long
	#define ull unsigned long long
	#define vi vector<int>
	using namespace std;
	using std::ios;
	constexpr int MOD=1e9+7;
	constexpr int mod=998244353;  

	int main()
	{
	  fastio;
	 int n,k;
	 cin>>n>>k;
	 vector<ll> a(n);
	 range(i,0,n)
	 {
	 		cin>>a[i];
	 }
	 ll p=1,np=1;
	 // range(i,0,k)
	 // {
	 // 		p*=a[i];
	 // }
	 range(i,k,n)
	 {	
	 		//cout<<p<<' ';
	 		if(a[i]>a[i-k])
	 			cout<<"Yes\n";
	 		else cout<<"No\n";
	 }
	}

Measured memory_bytes: 4760
#include<iostream>
#include<math.h>
#include<algorithm>
#include<utility>
#include<queue>
#include<string.h>
#include<string>
#include<set>
#include<map>
#include<vector>
using namespace std;
typedef long long LL;
typedef pair<int, int> P;

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

    cout<<min(a+b,min(b+c,c+a));
    return 0;
}

Measured memory_bytes: 256
## main

ans = nil
op = nil
is_num = true

loop do
  val = gets.strip

  if is_num
    n = val.to_i
    case op
    when '+'
      ans += n
    when '-'
      ans -= n
    when '*'
      ans *= n
    when '/'
      ans /= n
    else
      ans = n
    end
  else
    op = val
    break if op == '='
  end

  is_num = ! is_num
end

puts ans

Measured memory_bytes: 6088
#if __has_include("debug.h")
    #include "debug.h"
#else  
#include <bits/stdc++.h>
using namespace std;
#define d(...) 2;
#endif

#define int long long int

#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl "\n"      

#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define ff first
#define ss second
#define eps 1e-10

#define gcd(a,b)            __gcd((a),(b))
#define lcm(a,b)            ((a*b)/gcd(a,b))

void solve();

int32_t main()
{
    #ifdef DEBUG
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
    #endif 

    fast
    
    int t = 1;
	// cin>>t;
	
	while(t--)
	    solve();
	return 0;  
}

void solve()
{
	int i,j;
	int k,n;
	cin>>k>>n;

	vector<int>f(200,0);

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

	int left=0,right=0;

	for(i=k;;i++)
	{
		if(!f[i])
		{
			right=i;
			break;
		}
	}

	for(i=k-1;;i--)
	{
		if(!f[i])
		{
			left=i;
			break;
		}
	}

	if(abs(k-left)<=abs(k-right))
	{
		cout<<left<<endl;
	}
	else
	{
		cout<<right<<endl;
	}

}

Measured memory_bytes: 3608
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine( calc());
            Console.ReadLine();
        }

        static int calc()
        {
            string[] s = Console.ReadLine().Split(' ');
            int dec = int.Parse(s[1]) - int.Parse(s[0]);
            int blength = 0;
            for (int i = 1; i <= dec; i++)
            {
                blength += i;
            }
            return blength - int.Parse(s[1]);
                
        }
    }


}


Measured memory_bytes: 13140
#include<iostream>
#include<queue>
using namespace std;
void debug1();
int n, gragh[110][110] = {}, d[110] = {};
queue<int> q;

int main() {
	cin >> n;
	//input
	for (int i = 0; i < n; i++) {
		int u,k;
		cin >> u >> k;
		for (int j = 0; j < k; j++) {
			int t;
			cin >> t;
			gragh[u][t] = 1;
		}
	}
	//debug1();
	//search
	d[1] = 0;
	q.push(1);
	while (!q.empty()) {
		int cur = q.front();
		q.pop();
		//cerr << "visiting " << cur << " Distance: " << d[cur] << endl;
		for (int i = 1; i <= n; i++) {
			if (d[i] == 0 && gragh[cur][i] == 1 && i != 1) {
				d[i] = d[cur] + 1;
				q.push(i);
			}
		}
	}

	//from 0 to 1
	for (int i = 2; i <= n; i++) {
		if (d[i] == 0) d[i] = -1;
	}

	//output
	for (int i = 1; i <= n; i++) {
		cout << i << " " << d[i] << endl;
	}
	return 0;
}

void debug1() {
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= n; j++) {
			cerr << gragh[i][j] << " " ;
		}
		cerr << endl;
	}
}

Measured memory_bytes: 1248
n, a, b = map(int, input().split())

result = 0
for i in range(1, n + 1):
    number = i
    sum_of_digits = 0
    while number > 0:
        sum_of_digits += (number % 10)
        number //= 10
    if a <= sum_of_digits <= b:
        result += i

print(result)

Measured memory_bytes: 9120
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
    string N;
    cin >> N;
    int l = N.length();
    int k[l];
    for (int i = 0; i < l; i++) {
        k[i] = N[i] - '0';
    }
    int d[l][2]{};
    d[0][1] = 10 - k[0];
    d[0][0] = k[0];
    for (int i = 1; i < l; i++) {
        d[i][0] = min(d[i - 1][0] + k[i], d[i - 1][1] + k[i] + 1);
        d[i][1] = min(d[i - 1][0] + 10 - k[i], d[i - 1][1] + 10 - k[i] - 1);
    }
    cout << min(d[l - 1][0], d[l - 1][1] + 1) << "\n";
    // for (int i = 0; i < l; i++) {
    //     printf("%d %d\n", d[i][0], d[i][1] + 1);
    // }
    return 0;
}

Measured memory_bytes: 13060
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Numerics;
using System.Text;
using static System.Math;

class Program
{
    static void Main()
    {
        string[] inp = Console.ReadLine().Split();
        int n = int.Parse(inp[0]);
        int x = int.Parse(inp[1]);
        int[] l = Console.ReadLine().Split().Select(int.Parse).ToArray();
        int c = 1;
        int d = 0;
        for (int i = 0; i < n; i++)
        {
            d += l[i];
            if (d > x) break;
            c++;
        }
        Console.WriteLine(c);
    }
}

Measured memory_bytes: 13268
#include<cstdio>
#include<algorithm>
#include<cmath>
#define fo(i,a,b) for(i=a;i<=b;i++)
using namespace std;
typedef long long ll;
typedef double db;
const int maxn=6+10;
int a[maxn],p[maxn];
ll f[maxn*50][(1<<10)];
int i,j,k,l,t,n,m,all;
ll sum,cnt;
ll work(){
	int i,j,k,t;
	fo(i,0,n*m)
		fo(j,0,all) f[i][j]=0;
	f[n*a[n]][0]=1;
	fo(k,1,n*m){
		t=k%n;
		if (!t) continue;
		fo(j,0,all)
			if (((1<<(t-1))&j)==0)
				fo(i,k,n*m)
					f[min(n*m,max(k+n*a[p[t]],i))][j|(1<<(t-1))]+=f[i][j];
	}
	return f[n*m][all];
}
int main(){
	scanf("%d%d",&n,&m);
	all=(1<<(n-1))-1;
	fo(i,1,n) scanf("%d",&a[i]);
	sort(a+1,a+n+1);
	fo(i,1,n-1) p[i]=i;
	do{
		sum+=work();
		cnt++;
	}while (next_permutation(p+1,p+n));
	fo(i,1,n-1) cnt=(ll)cnt*m;
	printf("%.15lf\n",(db)sum/cnt);
}

Measured memory_bytes: 3328
/* 
		BURN OUT
	*/	  
		#include <bits/stdc++.h>
		using namespace std;
			     
		#define ll long long int
		#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
			     
		#define mp make_pair
		#define pb push_back
		#define ld long double
		#define F first
		#define S second
		const ll N =(1e6);  
		const ll mod = (1e9+7);

	int main(){
	fast;
	int n , m;
	cin >> n >> m ;
	if(2*m >= n )
		return cout<<0 , 0;
	
		cout<< n - 2*m;
	}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;
int main()
{
	ll n,k;
	cin>>n>>k;
	ll cnt=0;
	while(n>0){
		n/=k;
		cnt++;
	}
	cout<<cnt<<endl;
	return 0;
}

Measured memory_bytes: 256
import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv, std.math,
    std.functional, std.numeric, std.range, std.stdio, std.string, std.random,
    std.typecons, std.container, std.format;
static import std.ascii;

// dfmt off
T lread(T = long)(){return readln.chomp.to!T();}
T[] lreads(T = long)(long n){return generate(()=>readln.chomp.to!T()).take(n).array();}
T[] aryread(T = long)(){return readln.split.to!(T[])();}
void scan(TList...)(ref TList Args){auto line = readln.split();
foreach (i, T; TList){T val = line[i].to!(T);Args[i] = val;}}
alias sread = () => readln.chomp();enum MOD = 10 ^^ 9 + 7;
alias PQueue(T, alias less = "a<b") = BinaryHeap!(Array!T, less);
// dfmt on

void main()
{
    long N = lread();
    long ans = N - 1;
    foreach (x; 1 .. N + 1)
    {
        if (N < x * x)
            break;
        if (N % x != 0)
            continue;
        ans = ans.min(x - 1 + (N / x) - 1);
    }
    writeln(ans);
}


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

ll func(ll x){
    if(x<=1) return 1;
    return x*func(x-1)%1000000007;
}

int main(){
    ll n,m;
    cin>>n>>m;
    ll ans=0;
    if(n<m) swap(n,m);
    if(n==m) ans=func(n)*func(m)*2;
    else if(n-m<=1) ans=func(n)*func(m);
    ans%=1000000007;
    cout<<ans<<endl;
}

Measured memory_bytes: 5108
#include <iostream>
#include <queue>
#include <vector>
#include <set>
#include <algorithm>
#include <stdio.h>
//#define int long long
inline int in() { int32_t x; scanf("%d", &x); return x ;}
using namespace std;
//const int INF = 1e18;
const int MAX_N = 1e5 + 5;
struct top3
{
    int a[4] = {0 , 0 , 0 , 0};
    void add(int x)
    {
        a[3] = x;
        sort(a , a + 4 , greater<int>());
    }
}tp;
int32_t main()
{
    int x;
    
    while (scanf("%d",&x) != EOF)
    {
        tp.add(x);
    }
    
    cout << tp.a[0] << endl << tp.a[1] << endl << tp.a[2] << endl;
}

Measured memory_bytes: 3216
#include<iostream>

using namespace std;

int main(){
  
  int a,b;
  cin>>a>>b;
  int max=-100000000;
  
  if(a+b>max)max=a+b;
  if(a-b>max)max=a-b;
  if(a*b>max)max=a*b;
  cout<<max<<endl;
  return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES	//M_PI
#include <iostream>			//std::cout, std::cin
#include <string>			//std::string
#include <vector>			//std::vector
#include <valarray>			//std::valarray	??°????????????????¬???????
#include <algorithm>		//std::sort
#include <time.h>			//localtime_s
#include <cstdlib>			//abs
#include <cmath>			//abs, pow, sqrt, sin, cos,
#include <fstream>			//std::ifstream
#include <iomanip>			//std::setprecision

int main(void) {

	//test??¨
	//std::ifstream in("test.txt");
	//std::cin.rdbuf(in.rdbuf());

	int n;
	std::cin >> n;

	while (n != 0) {

		std::valarray<double> s(n);
		for (int i = 0; i < n; i++) {
			std::cin >> s[i];
		}

		double ave = s.sum() / n;
		s -= ave;
		s *= s;
		double dev = sqrt(s.sum() / n);

		std::cout << std::fixed << std::setprecision(10) << dev << std::endl;

		std::cin >> n;
	}
	
}

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

typedef long long ll;
typedef double dd;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;

const int mx=1e6+11;
const double PI = acos(-1);
#define MOD 1000000007


#define nl '\n'
#define pb push_back
#define F first
#define S second
#define I insert
#define mp make_pair

#define sz(x) x.size()
#define tt int t; cin>>t; while(t--)
#define lo(i,a,b) for(int i=a;i<b;i++)
#define be(a) (a).begin(),(a).end()
#define rbe(a) (a).rbegin(),(a).rend()
#define mem(a,b) memset(a,b,sizeof(a))

#define su ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define frac cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);

#define dbg(args...) do {cerr << #args << " : "; faltu(args); } while(0)
void faltu () {            cerr << endl;}
template < typename T, typename ... hello>void faltu( T arg, const hello &... rest) {cerr << arg << ' ';faltu(rest...);}


int main()
{
   su;
   string s[4];
   char c;
   int i=0;
   cin>>s[0]>>s[1]>>s[2];
   while(true)
   {
     if(sz(s[i])==0)
     {
       cout<<(char)(i+'A')<<nl;
       break;
     }
     c=s[i][0];
     s[i].erase(s[i].begin());
     i=c-'a';
   }
   return 0;
}


Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
int A,B,C,ans,x;
int main(){
	scanf("%d%d%d",&A,&B,&C);
	ans+=x=min(A,C);A-=x;C-=x;
	x=min(B,C);B-=x;C-=x;ans+=x<<1;
	ans+=B+(C>0);
	printf("%d\n",ans);
	return 0;
}

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

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		String[] streamLine = br.readLine().split(" ");
		int a = Integer.parseInt(streamLine[0]);
		int b = Integer.parseInt(streamLine[1]);
		int c = Integer.parseInt(streamLine[2]);
		
		String res = "No";
		if ( a < b && b < c) {
			res = "Yes";
		}
		System.out.println(res);
	}
}


Measured memory_bytes: 24420
#include <bits/stdc++.h>
#include <stdio.h>
#include <stdlib.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <set>
#include <utility>
#include <vector>

#define MAX_N (200000L)

using namespace __gnu_pbds;
using namespace std;

typedef tree<pair<long, long>, null_type, less<pair<long, long>>, rb_tree_tag,
             tree_order_statistics_node_update>
    ordered_set;

int main(int argc, char *argv[]) {
  // read inputs
  long N, K, as[MAX_N];
  scanf("%ld %ld", &N, &K);
  for (long i = 0; i < N; i++) {
    scanf("%ld", &as[i]);
  }

  // precalculation
  vector<long> accls(N + 1, 0), acclds(N + 1, 0);
  ordered_set accldds;
  accls[0] = 0;
  acclds[0] = 0;
  for (long i = 0; i < N; i++) {
    accls[i + 1] = accls[i] + as[i];
    acclds[i + 1] = accls[i + 1] - (i + 1) * K;
  }
  for (long i = 0; i < N; i++) {
    accldds.insert(make_pair(acclds[i + 1], i + 1));
  }
  // for (long i = 0; i < N; i++) {
  //   printf("i = %ld, acclds[i + 1] = %ld\n", i, acclds[i + 1]);
  // }

  // solve
  long ans = 0;
  for (long l = 0; l < N; l++) {
    const long num =
        accldds.size() - accldds.order_of_key(make_pair(acclds[l], 0));
    ans += num;
    // printf("l = %ld, num = %ld, size = %ld\n", l, num, accldds.size());
    accldds.erase(make_pair(acclds[l + 1], l + 1));
  }
  printf("%ld\n", ans);

  return 0;
}


Measured memory_bytes: 17408
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define REP(i, n) for (int i = 0; i < (n); i++)

const long double EPS = 1e-10;
const long long INF = 1e18;
const long double PI = acos(-1.0L);

int main() {
  ll n;
  cin >> n;
  vector<ll> a;
  for (ll i = 1; i < n + 1; i++) {
    if (i % 5 == 0) continue;
    if (i % 3 == 0) continue;
    a.push_back(i);
  }
  ll cnt = 0;
  REP(i, a.size()) { cnt += a[i]; }
  cout << cnt << endl;
  return 0;
}

Measured memory_bytes: 11544
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
using namespace std;
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const ll inf = 1e18;

// union-find
vint par;
vint depth;

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

int find(int x) {
    if (par[x] == x) return x;
    else return par[x] = find(par[x]);
}

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

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

// kruscal
struct edge {int u, v; double cost;};

bool comp(const edge &e1, const edge &e2) {
    return e1.cost < e2.cost;
}

edge es[10005];
int V, E;

double kruskal() {
    sort(es,es+E,comp);
    init(V);
    double res = 0;
    rep(i,E) {
        edge e = es[i];
        if (!same(e.u,e.v)) {
            unite(e.u,e.v);
            res += e.cost;
        }
    }
    return res;
}

int main() {
    while (true) {
        cin >> V;
        if (V == 0) break;
        E = V*(V-1)/2;
        par.resize(V);
        depth.resize(V);
        vector<vector<double>> a(V);
        rep(i,V) {
            double x, y, z, r;
            cin >> x >> y >> z >> r;
            a[i] = {x,y,z,r};
        }
        int ct = 0;
        for (int i = 0; i < V; i++) {
            for (int j = i+1; j < V; j++) {
                es[ct].u = i; es[ct].v = j;
                double c = 0;
                rep(k,3) c += (a[i][k]-a[j][k])*(a[i][k]-a[j][k]);
                c = sqrt(c) - a[i][3] - a[j][3];
                if (c < 0.001) c = 0;
                es[ct].cost = c;
                ct++;
            }
        }
        printf("%.3f\n",kruskal());
    }
}


Measured memory_bytes: 3312
#include <iostream>
#define mod 1000000007
using namespace std;
int main() {
long int n,k;
cin >> n>>k;
long int ans=0;
for(long int i=k;i<=n+1;i++)
{
    ans +=((i*(n-i))+i+1);
    ans %=mod;
}    cout <<ans<<endl;
}

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

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

  short x;
  cin>>x;
  if(x>=30)
    	cout<<"Yes\n";
  else
    	cout<<"No\n";
  return 0;
}

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

using namespace std;
using ll = long long;
using pii = pair<int, int>;

const ll INF = 1LL << 40;
int N, M;
int a[2010], b[2010], c[2010];
ll dis[1010];

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  cin >> N >> M;
  for (int i = 0; i < M; i++) {
    cin >> a[i] >> b[i] >> c[i];
    a[i]--, b[i]--;
    c[i] = -c[i];
  }
  fill(dis, dis + N, INF);
  dis[0] = 0;
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < M; j++) {
      if (dis[b[j]] > dis[a[j]] + c[j]) {
        dis[b[j]] = dis[a[j]] + c[j];
        if (i == N - 1 && b[j] == N - 1) {
          cout << "inf" << endl;
          return 0;
        }
      }
    }
  }
  cout << -dis[N - 1] << endl;

  return 0;
}

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

using namespace std;
int main()
{
    int n;
    string s;
    cin >> n >> s;
    bool dp[n+9][4][1009];
    dp[0][0][0]=true;
    for(int i=0;i<n;i++){
        for(int j=0;j<4;j++){
            for(int k=0;k<1000;k++){
                if(dp[i][j][k] == false) continue;
                dp[i+1][j][k] = true;
                if(j < 3)
                    dp[i+1][j+1][k*10+(s[i]-'0')] = true;
            }
        }
    }
    int cnt=0;
    for(int i=0;i<1000;i++)
    {
        if(dp[n][3][i])
            cnt++;
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 118528
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  string S;
  
  cin >> N;
  
  for (int i = 0; i < N; i++) {
    cin >> S;
    
    if (S == "Y") {
      cout << "Four" << endl;
      break;
    }

    else if (i == N - 1) {
      cout << "Three" << endl;
    }
    
    else {
      continue;
    }
  }
}

Measured memory_bytes: 3584
"use strict"

function main(input) {
    let num = Number(input)
    let sum = input.split('\n')[0].split('').map(x => Number(x)).reduce((x, y) => x + y)

    if (num % sum == 0) console.log('Yes')
    else console.log('No')

}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 7372
import std.stdio, std.string, std.array, std.conv, std.algorithm, std.typecons, std.range, std.container, std.math, std.algorithm.searching, std.functional,std.mathspecial;

void main(){
    auto n=readln.chomp.to!int;
    auto as=readln.split.map!(to!long).array;

    long fromNega;
    long fromPosi;
    long currentNega;
    long currentPosi;
    foreach(i,a;as){
        currentNega+=a;
        currentPosi+=a;
        if(i%2){
            if(currentNega>=0){
                fromNega+=currentNega+1;
                currentNega=-1;
            }
            if(currentPosi<=0){
                fromPosi+=-currentPosi+1;
                currentPosi=+1;
            }
        }else{
            if(currentNega<=0){
                fromNega+=-currentNega+1;
                currentNega=+1;
            }
            if(currentPosi>=0){
                fromPosi+=currentPosi+1;
                currentPosi=-1;
            }
        }
    }
    writeln(min(fromNega,fromPosi));
}


Measured memory_bytes: 4476
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FIO ios_base::sync_with_stdio(0);cin.tie(0);
 
const int N = 2e5+5, M = 1e6+6, OO = 0x3f3f3f3f;
int tc;
ll arr[305];
int main()
{
    FIO
    int n; cin>>n;
    for (int i = 0; i < n; i++)
    {
        cin>>arr[i];
    }
    ll x = 0;
    for(int i = 2 ; i< n ; i++)
        x ^= arr[i];
    ll a = arr[0], b = arr[1];
    if((arr[0] ^ arr[1]) == x)
        cout<<0<<endl;
    else {
        if((a + b) - (x) < 0 || ((a + b) - (x))%2 )
        {
            return cout<<-1, 0;
        }
        ll d = ((a + b) - (x)) / 2;
        if( d > a)
            return cout<<-1,0;
        ll na = d;
        ll y = 0;
        ll cnt = 0;
        for(ll i = 40 ; i!= -1 ;i--)
        {
            ll tmp = (1LL<<i);
            if((d&tmp) && (x&tmp))
                cnt++;
        }
        if(cnt)
            return cout<<-1, 0;
        for(ll i = 40; i!= -1 ; i--)
        {
            if((x & (1LL << i)))
            {
                if(((y|(1LL<<i))^d)<=a)
                    y |= (1LL <<i); 
            }
        }
        // cout<<na<<" "<<y<<endl;
        if((d^y)!=0)
            cout<<a - (d^y);
        else
            cout<<-1<<endl;
    }
    return 0;
}

Measured memory_bytes: 3628
#include<stdio.h>
#include<stdlib.h>
int main(){
int v,w,x,y,min=1000000000,k,h,n,i,ans=0,a,e,f,g;
scanf("%d %d %d\n",&k,&h,&n);
scanf("%d %d\n",&e,&f);
for(i=1;i<n;i++){
v=e,w=f;
scanf("%d %d\n",&x,&y);
e=x,f=y,g=v,h=w;
a=abs(v-x)+abs(y-w);
if(a<min){
min=a;
}
if(v>x){
a=v-x;
w=w-a;
a=a+abs(w-y);
}
else{
a=x-v;
w=w+a;
a=a+abs(w-y);
}
if(a<min){
min=a;
}
x=e,y=f,v=g,w=h;
if(w>y){
a=w-y;
v=v-a;
a=a+abs(v-x);
}
else{
a=y-w;
v=v+a;
a=a+abs(v-x);
}
if(a<min){
min=a;
}
ans=ans+min;
min=1000000000;
}
printf("%d\n",ans);
return 0;
}


Measured memory_bytes: 2044
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;
#define dame { puts("-1"); return 0;}
#define yn {puts("YES");}else{puts("NO");}
  
int main() {
  int N,K;
  cin >> N >> K;
  int kmax = (N-1) * (N-2) / 2;
  if(K > kmax) {
    cout << -1 << endl;
    return 0;
  }
  vp ans;
  rep(i,N-1) {
    ans.push_back(P(1,i+2));
  }
  
  int k = kmax - K;
  srep(i,1,N) {
    if(k == 0) break;
    srep(j,i+1,N) {
      ans.push_back(P(i+1,j+1));
      k--;
      if(k == 0) break;
    }
    
  }
  cout << sz(ans) << endl;
  rep(i,sz(ans)){
    cout << ans[i].first << " " << ans[i].second << endl;
  }
  return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
#define ll long long
#define uint unsigned int
#define ull unsigned long long
#define inf 1010000000
#define infll 1010000000000000000ll
#define vi vector<int>
#define vll vector<ll>
#define pb push_back
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define mpr make_pair
#define fi first
#define se second
#define pq priority_queue<int>
#define pqll priority_queue<ll>
#define up(x,y) (x<(y)?x=(y):0)
#define dn(x,y) (x>(y)?x=(y):0)
#define ad(x,y) (x=(x+(y))%mod)
#define cbn(x,y) ((ll)fac[x]*inv[y]%mod*inv[(x)-(y)]%mod)
#define N 100009
#define mod 998244353
using namespace std;

int read(); ll readll();

int n,m,mx,pw[N],a[N],b[N],c[N],f[N],g[N],h[N],tg[N]; vi e[N];
void work(int *a,int *b){
	m=read();
	int i,x,y;
	for (i=1; i<=n; i++) e[i].clear();
	for (i=1; i<=m; i++){
		x=read(); y=read();
		if (x>y) swap(x,y); e[x].pb(y);	
	}
	memset(tg,0,sizeof(tg));
	for (i=n; i; i--){
		for (int p:e[i]) tg[a[p]]=i;
		for (; tg[a[i]]==i; a[i]++);
		up(mx,a[i]); ad(b[a[i]],pw[i]);
	}
}
int main(){
	n=read();
	int i,j;
	for (i=pw[0]=1; i<=n; i++) 
		for (j=0,pw[i]=pw[i-1]; j<18; j++) pw[i]=10ll*pw[i]%mod;
	work(a,f); work(b,g); work(c,h);
	int ans=0;
	for (i=0; i<=mx; i++)
		for (j=0; j<=mx; j++) ad(ans,(ll)f[i]*g[j]%mod*h[i^j]);
	printf("%d\n",ans);
	return 0;
}
int read(){
	int x=0; char ch=getchar(); bool flag=0;
	while (ch<'0' || ch>'9'){ if (ch=='-') flag=1; ch=getchar(); }
	while (ch>='0' && ch<='9'){ x=x*10+ch-'0'; ch=getchar(); }
	return flag?-x:x;
}
ll readll(){
	ll x=0; char ch=getchar(); bool flag=0;
	while (ch<'0' || ch>'9'){ if (ch=='-') flag=1; ch=getchar(); }
	while (ch>='0' && ch<='9'){ x=x*10+ch-'0'; ch=getchar(); }
	return flag?-x:x;
}


Measured memory_bytes: 10696
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;

#define MOD 1000000007

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

Measured memory_bytes: 3620
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;

public class Main {

  public static void main(String[] args) {
    new Main().run();
  }

  public void run() {

    try(BufferedReader in = new BufferedReader(new InputStreamReader(System.in))) {

      String[] lines = in.readLine().split(" ");
      // int n = Integer.parseInt(lines[0]);
      int k = Integer.parseInt(lines[1]);

      Map<Integer,Integer> map = new HashMap<>();
      String line = in.readLine();
      char regex = ' ';
      boolean isContinue = true;
      for(int m=0,offset=0,next=0; isContinue; offset = ++next) {
        if((next = line.indexOf(regex,offset)) == -1) {
          next = line.length();
          isContinue = false;
        }
        m = Integer.parseInt(line.substring(offset,next));

        if(map.containsKey(m)) {
          map.replace(m, map.get(m)+1);
        }
        else {
          map.put(m, 1);
        }
      }

      int g = map.size();
      int[] v = new int[g];
      int j = 0;
      for (Integer i : map.values()) {
        v[j++] = i;
      }
      Arrays.parallelSort(v);
      // for (int i : v) {
      //   System.out.print(i + " ");
      // }
      // System.out.println();
      int ans = 0;
      for(int i=0; i<g-k; i++) {
        ans += v[i];
      }

      System.out.println(ans);
    }
    catch(IOException e) {
      System.err.println(e);
    }
  }
}

Measured memory_bytes: 54468
#include<bits/stdc++.h>
using namespace std ;
int main (){
    int x;
    cin>>x;
    if(400<=x&x<600){
        cout<<8<<endl;
    }
    if(600<=x&x<800){
        cout<<7<<endl;
    }
    if(800<=x&x<1000){
        cout<<6<<endl;
    }
    if(1000<=x&x<1200){
        cout<<5<<endl;
    }
    if(1200<=x&x<1400){
        cout<<4<<endl;
    }
    if(1400<=x&x<1600){
        cout<<3<<endl;
    }
    if(1600<=x&x<1800){
        cout<<2<<endl;
    }
    if(1800<=x&x<2000){
        cout<<1<<endl;
    }
}

Measured memory_bytes: 3632
#define FOR(i,j,n) for (int i=(j);i<(n);i++)
#define REP(i,n) for (int i=0;i<(n);i++)
#define REPN(i,n) for (int i=(n);i>=0;i--)
#define I(n) scanf("%d", &(n))
#define LL(n) scanf("%lld", &(n))
#define pb(n) push_back((n))
#define mp(i,j) make_pair((i),(j))
#include <bits/stdc++.h>
using namespace std;

int n,d[50],di[13],s,table,inittable;
int prevt,ret;

int solve(int table){
    prevt = 0;
    ret = 24;
    REP(i,24){
        if(table & 1){
            ret = min(ret, i - prevt);
            prevt = i;
        }
        table >>= 1;
    }
    return min(ret,24-prevt);
}

int main(){
    I(n);
    REP(i,n){ I(d[i]); di[d[i]]++; }
    if (di[0] || di[12] > 1 || *(max_element(di+1,di+12)) > 2){
        cout << 0 << endl;
        return 0;
    }
    inittable = di[12] ? 1 << 12 : 0;
    REP(bits,1<<12){
        table = inittable;
        REP(i,12){
            if (di[i] == 1){
                table |= 1 << ((bits >> i) & 1 ? i : 24 - i);
            } else if (di[i] == 2){
                table |= (1 << i) | (1 << (24 - i));
            }
        }
        s = max(s,solve(table));
    }
    cout << s << endl;
}


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

Measured memory_bytes: 1028
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int X = sc.nextInt();
        PriorityQueue<Integer> queue = new PriorityQueue<>();
        queue.add(X);
        for(int i = 0; i < N; i++) {
            queue.add(sc.nextInt());
        }
        int minValue = 0;
        int prev = queue.poll();
        HashSet<Integer> set = new HashSet<>();
        int size = queue.size();
        for(int i = 0; i < size; i++) {
            int num = queue.poll();
            minValue = Math.min(minValue, num);
            set.add(num - prev);
            prev = num;
        }
        Integer[] sorted = new Integer[set.size()];
        set.toArray(sorted);
        Arrays.sort(sorted);
        int ans = sorted[0];
        for(int i = 1; i < sorted.length; i++) {
            if(sorted[i] % ans != 0){
                int num = sorted[i];
                while (true)
                {
                    int r = num % ans;
                    if(r == 0) break;
                    num = ans;
                    ans = r;
                }
            }
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 59800