akhauriyash/Code-Regression huggingface dataset:
import java.io.*;
import java.util.*;

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

    int number = 0;
    int a = scan.nextInt();
    int b = scan.nextInt();
    int c = scan.nextInt();

    for(int i = a;i <= b;i++){
        if(c % i == 0){
        number = number + 1;
        }
    }

    System.out.println(number);
    }
}

Measured memory_bytes: 26408
#include <iostream>
#include <string>
#include <utility>
#include <vector>
using namespace std;

typedef pair<int, int> pi;
const pi D[8] = { pi(-1, -1), pi(0, -1), pi(1, -1), pi(-1, 0), pi(1, 0), pi(-1, 1), pi(0, 1), pi(1, 1) };

int H, W;
vector<string> S;
vector<pi> M;

void calcu(void) {
	for (int j = 1; j <= H; ++j) {
		for (int i = 1; i <= W; ++i) {
			if (S[j][i] == '#')
				M.push_back(make_pair(i, j));
			else
				S[j][i] = '0';
		}
	}
}

void solve(void) {
	int mk = M.size();
	if (mk == 0 || mk == H * W)
		return;
	for (int k = 0; k < mk; ++k) {
		for (int d = 0; d < 8; ++d) {
			int x = M[k].first + D[d].first;
			int y = M[k].second + D[d].second;
			if (S[y][x] != '#')
				++S[y][x];
		}
	}
}

int main(void) {
	cin >> H >> W;
	string dummy = string(W + 2, '#');
	S.resize(H + 2);
	S[0] = S[H + 1] = dummy;
	for (int j = 1; j <= H; ++j) {
		string str;
		cin >> str;
		S[j] = "#" + str + "#";
	}

	calcu();
	solve();

	for (int j = 1; j <= H; ++j) {
		string str = S[j].substr(1, W);
		cout << str << '\n';
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define repone(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define Rep(j,n) for(int j=0;j<(int)(n);++j)
#define Repo(j,o,n) for(int j=o;j<(int)(n);++j)
#define Repone(j,n) for(int j=1;j<(int)(n);++j)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define int long long
#define pb(a) push_back(a)
#define eraser(v,i) (v).erase(v.begin()+(i))
#define pbpair(a,b) push_back(make_pair(a,b))
#define MOD 1000000007
#define MODB 998244353
#define INF 9223372036854775807
bool compare_by_b(pair<int, int> a, pair<int, int> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}
signed main()
{
  int x=0,y=0,z=0,w=0,n=0,m=0;
  std::cin >> x;
  std::vector<int> v(x);
  std::vector<int> vv(x);
  rep(i,x){
    std::cin >> v[i];
  }
  vv=v;
  sort(rall(v));
  rep(i,x){
    if(vv[i]==v[0])std::cout << v[1] << '\n';
    else std::cout << v[0] << '\n';
  }
}


Measured memory_bytes: 4736
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=(a); i<(b); i++)
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define sort(v,n) sort(v,v+n);
#define vsort(v) sort(v.begin(),v.end());
#define ll long long
#define pb(a) push_back(a)
#define fi first
#define se second
#define inf 999999999
using namespace std;
typedef pair<int,int> p;
typedef pair<ll,ll> lp;
bool is_uruu(int y) {
        return y % 4 == 0 && (y % 100 != 0 || y % 400 == 0);
}
const ll MOD=1e9+7;
const double PI=acos(-1.0);
//---------------------------------------------------------------------------//
int n,b;
int main(){
        while(1) {
                cin>>n>>b;
                if(n==0) return 0;
                int index=0;
                int s[n];
                for(int i=0; i<n; i++) {
                        s[i]=0;
                }
                int stone=b;
                while(1) {
                        if(stone!=0) {
                                stone--;
                                s[index]+=1;
                        }else if(stone==0) {
                                stone+=s[index];
                                s[index]=0;
                        }
                        if(s[index]==b) {
                                break;
                        }
                        if(index==n-1) {
                                index=0;
                        }else{
                                index++;
                        }
                }
                cout<<index<<endl;
        }
}

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

using namespace std;

#define mp make_pair
#define pb push_back
#define f first
#define s second
#define ll long long

#define for(i,a,b) for (i=a; i<b; i++)
#define forb(i,a,b) for (i=a; i>b; i--)
#define all(S) S.begin(),S.end()
#define sort(S) sort(all(S))

const int inf = 1e9+7;
const ll INF = 1e18;

int main()
{
    cin.tie(0);
    cout.tie(0);
    ios_base::sync_with_stdio(false);
    int n,i;
    cin >> n;
    vector <int> A(n),B(n);
    for (i,0,n)
        cin >> A[i] >> B[i];
    sort(A);
    sort(B);
    if (n&1)
        cout << B[n/2]-A[n/2]+1 << endl;
    else
        cout << B[n/2]+B[n/2-1]-A[n/2]-A[n/2-1]+1 << endl;
    return 0;
}


Measured memory_bytes: 4780
a,k,d = map(int, input().split())

if a < 0:
    x = -a
else:
    x = a

y = x % d
l = x // d
m = k - l

if m < 0:
    ans = x - (k * d)
elif m % 2 ==0:
    ans = y
else :
    ans = y - d

print(abs(ans))

Measured memory_bytes: 9128
#include <bits/stdc++.h>
using namespace std;
struct Tree {
    int n;
    vector<vector<int>> e;
    vector<vector<bool>> g;
    Tree(int n) : n(n), e(n), g(n, vector<bool>(n)) {}
    void addEdge(int u, int v) {
        e[u].push_back(v);
        e[v].push_back(u);
        g[u][v] = g[v][u] = true;
    }
    void removeEdge(int u, int v) {
        e[u].erase(find(e[u].begin(), e[u].end(), v));
        e[v].erase(find(e[v].begin(), e[v].end(), u));
        g[u][v] = g[v][u] = false;
    }
};
struct Graph {
    int n;
    vector<vector<int>> e;
    vector<int> in;
    Graph(int n) : n(n), e(n), in(n) {}
    void clear() {
        fill(in.begin(), in.end(), 0);
        for (int i = 0; i < n; ++i)
            e[i].clear();
    }
    void addEdge(int u, int v) {
        e[u].push_back(v);
        ++in[v];
    }
    bool isAcyclic() {
        queue<int> que;
        int cnt = 0;
        for (int i = 0; i < n; ++i)
            if (in[i] == 0)
                que.push(i);
        while (!que.empty()) {
            int u = que.front();
            que.pop();
            ++cnt;
            for (int v : e[u]) {
                --in[v];
                if (in[v] == 0)
                    que.push(v);
            }
        }
        clear();
        return cnt == n;
    }
};
void solve() {
    int n;
    cin >> n;
    Tree a(n), b(n);
    Graph g(n);
    for (int i = 0; i < n - 1; ++i) {
        int u, v;
        cin >> u >> v;
        --u;
        --v;
        a.addEdge(u, v);
    }
    for (int i = 0; i < n - 1; ++i) {
        int u, v;
        cin >> u >> v;
        --u;
        --v;
        b.addEdge(u, v);
    }
    auto solveFixed = [&](int r) {
        int ans = n;
        function<void(int, int, bool)> dfsa = [&](int u, int p, bool same) {
            if (same)
                --ans;
            for (int v : a.e[u]) {
                if (v == p)
                    continue;
                dfsa(v, u, same && b.g[u][v]);
                if (!same)
                    g.addEdge(v, u);
            }
        };
        function<void(int, int, bool)> dfsb = [&](int u, int p, bool same) {
            for (int v : b.e[u]) {
                if (v == p)
                    continue;
                dfsb(v, u, same && a.g[u][v]);
                if (!same)
                    g.addEdge(u, v);
            }
        };
        dfsa(r, -1, true);
        dfsb(r, -1, true);
        if (g.isAcyclic())
            return ans;
        return n + 1;
    };
    int ans = n + 1;
    for (int i = 0; i < n; ++i)
        ans = min(ans, solveFixed(i));
    for (int i = 0; i < n; ++i) {
        if (a.e[i].size() >= 2)
            continue;
        int v = a.e[i][0];
        a.removeEdge(i, v);
        for (int j = 0; j < n; ++j) {
            if (i != j) {
                a.addEdge(i, j);
                ans = min(ans, solveFixed(i) + 1);
                a.removeEdge(i, j);
            }
        }
        a.addEdge(i, v);
    }
    cout << (ans > n ? -1 : ans) << "\n";
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int t;
    cin >> t;
    while (t--)
        solve();
    return 0;
}

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

int main()
{
    int counter=0;
    int n,m;
    cin>>n>>m;

   vector<int>v;
   for(int i=1;i<=2*m;i+=2)
   {
       v.push_back(i);
   }
   for(int i=2;i<=2*n;i+=2)
   {
         v.push_back(i);
   }

   for(int i=0;i<v.size();i++)
   {
       for(int j=i+1;j<v.size();j++)
       {
           if((v[i]+v[j])%2==0)counter++;
       }
   }
   cout<<counter<<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef pair<ll, ll> LP;
typedef vector<LP> vec;
typedef vector<string> svec;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-8;

const int sz = 2600;
ll dp[sz][51];
ll cop[sz][51];
void solve() {
	int n, x; cin >> n >> x;
	if (x % 2) {
		cout << 0 << endl; return;
	}
	dp[sz/2][0] = 1;
	rep(i, n) {
		rep(j, sz)rep(k, n + 1)cop[j][k] = 0;
		rep(j, sz) {
			rep(k, i+1) {
					if (dp[j][k] == 0)continue;
					//
					(cop[j][k] += dp[j][k]) %= mod;
					//
					(cop[j][k] += dp[j][k]*k) %= mod;
					//
					if (k > 0) {
						(cop[j + i][k - 1] += dp[j][k] * k*k) %= mod;
					}
					//
					(cop[j - i][k + 1] += dp[j][k]) %= mod;
					//
					(cop[j][k] += dp[j][k] * k) %= mod;
			}
		}
		rep(j, sz)rep(k, n + 1)rep(l,n+1)dp[j][k] = cop[j][k];
	
	}
	if (x / 2 + sz / 2 >= sz) {
		cout << 0 << endl; return;
	}
	//cout << "hello" << endl;
	cout << dp[x / 2 + sz / 2][0] << endl;
}

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

	//cout << fixed << setprecision(10);
	//init();
	solve();
	//stop
		return 0;
}



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

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

const int INF = 1e9 + 7;

using namespace std;

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

	int n;
	cin >> n;

	vector<pair<int, int>> ba(n);
	rep (i, 0, n) {
		int a, b;
		cin >> a >> b;
		ba[i] = make_pair(b, a);
	}

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

	ll sum = 0;
	bool judge = true;
	for (auto tmp : ba) {
		sum += tmp.second;

		if (sum > tmp.first) {
			judge = false;
			break;
		}
	}

	if (judge)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;

	return 0;
}


Measured memory_bytes: 1792
#include<cstdio>
#include<iostream>
#include<list>
#include<cstring>
#include<stack>
#include<string>
#include<vector>
#include<set>
#include<algorithm>
using namespace std;

int main()
{
	int n;
	char c1[100],c2[100];
	scanf("%d", &n);
	string p;
	set<string> ss;
	for (int i = 1; i <= n; i++)
	{
		scanf("%s%s", c1, c2);
		p = c2;
		if (c1[0] == 'i')
		{
			ss.insert(p);
		}
		else
		{
			
			if (ss.find(p) != ss.end())
				puts("yes");
			else
				puts("no");
		}
	}
	return 0;
}


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

int main()
{
	map<string,int> a;
	string s;
	int n,i,ans=0;
	cin>>n;
	for(i=1;i<=n;i++)
	{
		cin>>s;
		if(a[s]==0)
		{
			a[s]=1;
			ans++;
		}
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 19228
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) (v).begin(),(v).end()
#define out(a) cout << (a) << endl
using namespace std;
using ll = long long;
int main(){
    int n, num=n+1, cnt=0;
    cin >> n;
    rep(i, n){
        int a;
        cin >> a;
        if(a < num) {
            num = a;
            cnt++;
        }
        else continue;
    }
    out(cnt);
    return 0;
}

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

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

int main() {
    double w,h;
    int x,y; 
    cin >> w >> h >> x >> y;
    int ans;
    if(x == w / 2 && y == h / 2){
        ans = 1;
    }else{
        ans = 0;
    }
    cout << fixed << setprecision(6) << w * h / 2;
    cout << " " << ans << endl;
}

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

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

int size[9]={5, 3, 3, 3, 3, 3, 4, 3, 4};
char a[9][5]={{'.', ',', '!', '?', ' '},
              {'a', 'b', 'c'},
              {'d', 'e', 'f'},
              {'g', 'h', 'i'},
              {'j', 'k', 'l'},
              {'m', 'n', 'o'},
              {'p', 'q', 'r', 's'},
              {'t', 'u', 'v'},
              {'w', 'x', 'y', 'z'}};

int main(){
  int n;
  cin>>n;
  rep(i,n){
    string s;
    cin>>s;
    int c=0, cnt=0;
    rep(j,s.length()){
      if(s[j]=='0'){
        if(c==0)continue;
        cout<<a[c-1][(cnt-1)%size[c-1]];
        c=0; cnt=0;
      }
      else{
        c=(s[j]-'0');
        cnt++;
      }
    }
    cout<<endl;
  }
  return 0;
}

Measured memory_bytes: 1200
#include <stdio.h>

int sort(int a[], int n) {
  int i, j, k = 0, t;
  for (i = 0; i < n; i++) {
    for (j = n - 1; j > i; j--) {
      if (a[j] < a[j-1]) {
	t = a[j];
	a[j] = a[j-1];
	a[j-1] = t;
	k++;
      }
    }
  }
  return k;
}

int main(void) {
  int n, a[100], i, count;

  while (scanf("%d", &n) != EOF) {
    if (n == 0) break;
    for (i = 0; i < n; i++)
      scanf("%d", &a[i]);

    count = sort(a, n);
    printf("%d\n", count);
  }

  return 0;
}

Measured memory_bytes: 596
use std::io;
use std::str::FromStr;

fn get_line() -> String {
  let mut line = String::new();
  io::stdin()
    .read_line(&mut line)
    .unwrap();
  line
}

fn line_to_vec<T: FromStr>(line: &str) -> Vec<T> {
  line
    .trim().split_whitespace()
    .map(|val| val.parse::<T>().ok().unwrap())
    .collect()
}

fn parse_int<T: FromStr>(line: &str) -> T {
  line
    .trim().parse::<T>()
    .ok().unwrap()
}

fn main() {
  let n: i64 = line_to_vec(&get_line())[0];
  let mut tramp = [[false; 13]; 4];
  for _ in 0..n {
    let c: Vec<String> = line_to_vec(&get_line());
    let idx: usize = match &c[0][..] {
      "S" => 0,
      "H" => 1,
      "C" => 2,
      "D" => 3,
      _   => panic!("Unknown Mark.")
    };
    tramp[idx][parse_int::<usize>(&c[1]) - 1] = true;
  }
  for i in 0..4 {
    let mark = match i {
      0 => "S",
      1 => "H",
      2 => "C",
      3 => "D",
      _ => break
    };
    for j in 0..13 {
      if tramp[i][j] {
        continue;
      }
      else {
        println!("{} {}", mark, j + 1);
      }
    }
  }
}



Measured memory_bytes: 5040
n, a, b = map(int, input().split())
S = list(input())

count_all, count_b = 0, 0
for s in S:
    ans = "No"
    if s == "a":
        if count_all < a + b:
            ans = "Yes"
            count_all += 1
    elif s == "b":
        if count_all < a + b and count_b < b:
            ans = "Yes"
            count_all += 1
            count_b += 1
    print(ans)

Measured memory_bytes: 9856
import sys

def main():
  input = sys.stdin.readline
  N, K = map(int, input().split())
  H = [int(input()) for _ in range(N)]
  H = sorted(H)
  ans = max(H) - min(H)
  for i in range(N-K+1):
    res = H[i+K-1] - H[i]
    ans = min(ans, res)
  print(ans)


if __name__ == '__main__':
  main()

Measured memory_bytes: 8280
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	N := readInt()
	A := make([]int, N)
	for i := 0; i < N; i++ {
		A[i] = readInt()
	}

	result := 0
	for b := 0; b < 60; b++ {
      B := (1 << uint(b)) % 1000000007

		a := make([]int, N)
		for i := 0; i < N; i++ {
			a[i] = (A[i] >> uint(b)) & 1
		}

		bs := make([]int, N)
		bs[N-1] = a[N-1]
		for i := N - 2; i > -1; i-- {
			bs[i] = bs[i+1] + a[i]
		}

		for i := 0; i < N-1; i++ {
			t := 0
			if a[i] == 0 {
				t = bs[i+1]
			} else {
				t = (N - (i + 1)) - bs[i+1]
			}
			result += (t * B) % 1000000007
			result = result % 1000000007
		}
	}
	fmt.Println(result)
}

const (
	ioBufferSize = 1 * 1024 * 1024 // 1 MB
)

var stdinScanner = func() *bufio.Scanner {
	result := bufio.NewScanner(os.Stdin)
	result.Buffer(make([]byte, ioBufferSize), ioBufferSize)
	result.Split(bufio.ScanWords)
	return result
}()

func readString() string {
	stdinScanner.Scan()
	return stdinScanner.Text()
}

func readInt() int {
	result, err := strconv.Atoi(readString())
	if err != nil {
		panic(err)
	}
	return result
}


Measured memory_bytes: 18688
#include<stdio.h>
#include<stdlib.h>
#include<stdbool.h>
#include<math.h>
#include<iostream>
#include<vector>
#include<string>
#include<queue>
#include<set>
typedef long long ll;
using namespace std;

ll gcd(ll a, ll b) {
	ll num = 0;
	if (a < b) {
		num = a;
		a = b;
		b = num;
	}
	if (a%b == 0)return b;
	else return gcd(b, a%b);
}

int main(void) {
	ll n, x, y, ans = 1;
	cin >> n >> x;
	vector<ll>a(n);
	for (ll i = 0;i < n;i++) {
		cin >> y;
		a[i] = abs(y - x);
	}
	if (n == 1)cout << a[0] << endl;
	else {
		for (ll i = 1;i < n;i++) {
			if (i == 1) {
				ans = gcd(a[i-1], a[i]);
			}
			else {
				ans = gcd(ans, a[i]);
			}
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define N 100100
using namespace std;
inline void read(long long &x)
{
    x=0;
    static long long p;p=1;
    static char c;c=getchar();
    while(!isdigit(c)){if(c=='-')p=-1;c=getchar();}
    while(isdigit(c)) {x=(x<<1)+(x<<3)+(c-48);c=getchar();}
    x*=p;
}
long long n,c;
long long x[N],v[N];
long long ans1[N],ans2[N];
#define Mid ((l+r)>>1)
#define lson rt<<1,l,Mid
#define rson rt<<1|1,Mid+1,r
long long maxn[N<<2];
long long maxnn[N<<2];
void build(long long rt,long long l,long long r)
{
	if(l==r)maxn[rt]=ans2[l],maxnn[rt]=ans1[l];
	else
	{
		build(lson);
		build(rson);
		maxn[rt]=max(maxn[rt<<1],maxn[rt<<1|1]);
		maxnn[rt]=max(maxnn[rt<<1],maxnn[rt<<1|1]);
	}
}
long long query(long long rt,long long l,long long r,long long L,long long R)
{
	if(L<=l&&r<=R)return maxn[rt];
	else
	{
		long long maxn=-(1ll<<62);
		if(L<=Mid)maxn=max(maxn,query(lson,L,R));
		if(R>Mid)maxn=max(maxn,query(rson,L,R));
		return maxn;
	}
}
long long query1(long long rt,long long l,long long r,long long L,long long R)
{
	if(L<=l&&r<=R)return maxnn[rt];
	else
	{
		long long maxnx=-(1ll<<62);
		if(L<=Mid)maxnx=max(maxnx,query1(lson,L,R));
		if(R>Mid)maxnx=max(maxnx,query1(rson,L,R));
		return maxnx;
	}
}
int main()
{
	cin>>n>>c;
	for(long long i=1;i<=n;i++)
	{
		read(x[i]);read(v[i]);
	}
	for(long long i=1;i<=n;i++)
		ans1[i]=ans1[i-1]+v[i]-(x[i]-x[i-1]);
	x[n+1]=c;
	for(long long i=n;i>=1;i--)
		ans2[i]=ans2[i+1]+v[i]-(x[i+1]-x[i]);
	build(1,1,n);
	long long ans=0;
	for(long long i=1;i<=n;i++)
		ans=max(ans,max(ans1[i],ans1[i-1]-x[i-1]+query(1,1,n,i,n)));
	for(long long i=n;i>=1;i--)ans=max(ans,max(ans2[i],ans2[i+1]-(c-x[i+1])+query1(1,1,n,1,i)));
	cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 9600
from math import ceil
D, G = map(int, input().split())
p, c = [0] * D, [0] * D
for i in range(D):
    p[i], c[i] = map(int, input().split())

ans = 10**9
for i in range(2**D):
    s, num, rest = 0, 0, -1
    for j in range(D):
        if i >> j & 1:
            s += 100 * (j+1) * p[j] + c[j]
            num += p[j]
        else:
            rest = j
    if s < G:
        s1 = 100 * (rest + 1)
        need = ceil((G - s) / s1)
        if need >= p[rest]:
            continue
        num += need
    ans = min(ans, num)

print(ans)

Measured memory_bytes: 3064
#include<stdio.h>
    #include<stdlib.h>
    #include<math.h>
    #include<string.h>
    #include <time.h>
    typedef struct{
        long aa;
        long bb;
    }s;
    int cmp( const void *p, const void *q ) {
        return ((s*)p)->bb - ((s*)q)->bb;
    }
    // int sqs(long a[],long n,long s){
    //     // if(s==4){qsort(a,n,sizeof(long),compare);}
    //     // return 0;
    //     if(s==5){qsort(a,n,sizeof(long),cmp);}
    //     return 0;
    // }

    int main(void){
        long n,i;
        scanf("%ld",&n);
        // long a[n];
        s order[n];
        for(i=0;i<n;i++){
            order[i].aa=i+1;
        }
        // for(i=0;i<n;i++){
        //     printf("%ld ",order[i].aa);
        // }
        for(i=0;i<n;i++){
            scanf("%ld",&order[i].bb);
        }
        // for(i=0;i<n;i++){
        //     printf("%ld ",order[i].bb);
        // }
        qsort(order,n,sizeof(s),cmp);
        for(i=0;i<n;i++){
            printf("%ld ",order[i].aa);
        }

        printf("\n");
        return 0;
    }


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

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

int main(void){
  int a, b;
  cin >> a >> b;
  if(a > 9 || b > 9) cout << -1 << endl;
  else cout << a*b << endl;
  return 0;
}

Measured memory_bytes: 256
{-# LANGUAGE FlexibleInstances    #-}
{-# LANGUAGE TypeSynonymInstances #-}

import           Control.Applicative
import           Control.DeepSeq
import           Control.Monad
import           Control.Monad.ST
import qualified Data.Array                  as A
import qualified Data.Array.IArray           as IA
import qualified Data.Array.IO               as AI
import qualified Data.Array.MArray           as MA
import qualified Data.Array.ST               as STA
import qualified Data.Array.Unboxed          as AU
import           Data.Bits
import qualified Data.ByteString.Char8       as BS
import           Data.Char
import qualified Data.Graph                  as G
import           Data.Int
import qualified Data.IntMap                 as IM
import qualified Data.IntSet                 as IS
import           Data.List
import qualified Data.Map.Strict             as M
import           Data.Maybe
import           Data.Ord
import qualified Data.Sequence               as SQ
import qualified Data.Set                    as S
import           Data.Time
import qualified Data.Tree                   as T
import qualified Data.Vector                 as V
import qualified Data.Vector.Mutable         as VM
import qualified Data.Vector.Unboxed         as VU
import qualified Data.Vector.Unboxed.Mutable as VUM

readInt :: IO [Int]
readInt = map (fst . fromJust . BS.readInt) . BS.words <$> BS.getLine

readInts :: Int -> IO [[Int]]
readInts n = replicateM n readInt

readInteger :: IO [Integer]
readInteger = map (fst . fromJust . BS.readInteger) . BS.words <$> BS.getLine

readIntegers :: Int -> IO [[Integer]]
readIntegers n = replicateM n readInteger

readString :: IO [String]
readString = map BS.unpack . BS.words <$> BS.getLine

readStrings :: Int -> IO [[String]]
readStrings n = replicateM n <$> readString

toPair :: [a] -> (a, a)
toPair [x, y] = (x, y)

count :: Eq a => a -> [a] -> Int
count a as = length $ filter (== a) as

put :: Show a => a -> IO ()
put = putStr . show

putLn :: Show a => a -> IO ()
putLn = print

putList :: Show a => [a] -> IO ()
putList [n] = put n
putList (n:ns) = do
  put n
  putStr " "
  putList ns

putStrList :: [String] -> IO ()
putStrList [n] = putStr n
putStrList (n:ns) = do
  putStr n
  putStr " "
  putStrList ns

yesNoUpper b
  | b = putStrLn "YES"
  | otherwise = putStrLn "NO"

yesNo b
  | b = putStrLn "Yes"
  | otherwise = putStrLn "No"

main = do
  [n, a, b] <- readInt
  put $ solve n a b

solve n a b =
  sum $
  filter
    (\x -> a <= (sum $ map (\s -> read (s : "")) $ show x) && (sum $ map (\s -> read (s : "")) $ show x) <= b)
    [1 .. n]


Measured memory_bytes: 1020
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define int long long
using namespace std;
typedef vector<int>   vint;
typedef pair<int,int> pint;

signed main()
{   
    int N; cin>>N;
    vint a(N);
    REP(i,N) cin>>a[i];

    int sum=0;
    map<int,int> cnt;
    cnt[sum]++;
    REP(i,N){
        sum+=a[i];
        cnt[sum]++;
    }

    int ans=0;
    for(auto p:cnt){
        int x=p.second;
        ans+=x*(x-1)/2;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 14336
#pragma GCC optimize ("O3")

#include <bits/stdc++.h>

using namespace std;

#define pb push_back
#define mp make_pair
#define fs first
#define fst first
#define sc second
#define snd second
#define sz(X) (int)(X).size()
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define fornr(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define forab(i, a, b) for(int i = int(a); i < int(b); i++)
#define all(X) X.begin(), X.end()

typedef long long ll;
typedef vector<pair<ll, ll>> vpll;
typedef pair<int, int> pii;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef double dbl;
typedef long double ld;
typedef vector<int> vi;

const ll MOD = 1e9 + 7;
const int N = 1e5;

ll fac[N + 1], invfac[N + 1];

ll gcd(ll a, ll b, ll &x, ll &y) {
    if (a == 0) {
        x = 0ll;
        y = 1ll;
        return b;
    }
    ll nx, ny;
    ll g = gcd(b % a, a, nx, ny);
    x = ny - (b / a) * nx;
    y = nx;
    return g;
}

ll inv(ll a, ll mod) {
    ll x, y;
    gcd(a, mod, x, y);
    x = (x % mod + mod) % mod;
    return x;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll n, k;
    cin >> n >> k;
    vector<ll> a(n);
    forn(i, n) cin >> a[i];
    sort(all(a));
    fac[0] = 1ll;
    invfac[0] = 1ll;
    ll ans = 0;
    forab(i, 1, n + 1) {
        fac[i] = (i * 1ll * fac[i - 1]) % MOD, invfac[i] = inv(fac[i], MOD);
        //cout << fac[i] << " " << invfac[i] << " " << (fac[i] * invfac[i]) % MOD << "\n";
    }
    forn(i, n) {
        if (i >= k - 1) {
            ll ways = (fac[i] * ((invfac[k - 1] * invfac[i - k + 1]) % MOD)) % MOD;
            ans += ways * a[i];
            ans %= MOD;
        }
    }
    reverse(all(a));
    forn(i, n) {
        if (i >= k - 1) {
            ll ways = (fac[i] * ((invfac[k - 1] * invfac[i - k + 1]) % MOD)) % MOD;
            ans -= ways * a[i];
            ans %= MOD;
        }
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define f first
#define s second
int main()
{
    int n;cin>>n;
    double ans=0,x;
    double arr[n];
    for(int i = 0 ; i<n;i++){
        cin>>arr[i];
    }
    if(n==1)cout<<arr[0];
    else{
        ans=(arr[0]*arr[1])/(arr[0]+arr[1]);
        for(int i = 2; i<n;i++){
            ans = (ans*arr[i])/(ans+arr[i]);
        }
        cout<<fixed<<setprecision(12)<<ans<<endl;
    }
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<queue>
#include<deque>
#include<map>
#include<bitset>
using namespace std;
typedef long long ll;

#define rep(i, n) for(int i = 0;i < (n);i++)
#define repr(i, n) for(int i = (n);i >= 0;i--)
#define repf(i, m, n) for(int i = (m);i < (n);i++)

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1;} return 0;}
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1;} return 0;}
int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};
//////////////////////////////////////////////////

int main() {
    int n, k; cin >> n >> k;
    string s; cin >> s;
    vector<int> a;
    int b = 0;
    char rev = '1';
    rep(i,n) {
        if (s[i] == rev) b++;
        else {
            a.push_back(b);
            rev = s[i];
            b = 1;
        }
    }
    a.push_back(b);
    if (s[n-1] == '0') a.push_back(0);

    int len = a.size();
    vector<int> sum(len+1);
    rep(i,len) sum[i+1] = sum[i]+a[i];

    int ans = 0;
    for (int i = 0; i <= len; i+=2) {
        int j = min(len, i+k*2+1);
        chmax(ans, sum[j]-sum[i]);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1272
//#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#define PI 3.14159265359
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
const long long INF= 1e+18+1;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll> >vvl;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> T;
const ll MOD=1000000007LL;
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
int main(){
  ll k;cin>>k;
  cout<<50<<endl;
  vl a(50);
  rep(i,50)a[i]=(50+k-1)/50+49;
  ll l=(50LL+k-1)/50LL*50LL-k;
  rep(i,50)a[i]+=l;
  rep(i,l)a[i]-=50LL+1;
  rep(i,50)cout<<a[i]<<" ";
  cout<<endl;
}
  
  

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
const long double PI=(acos(-1));
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int main(){
  int n;
  cin>>n;
  for(int i=n;i<=999;i++){
    if(i%111!=0){
      continue;
    }else{
      cout<<i<<endl;
      break;
    }
  }
}

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

int main() {
	int d;
	cin >> d;
	vector<int> c(30);
	vector<int> co(d+5);
	vector<int> ans(d + 5);
	int ans_c = 0;

	rep(i,26) {
		cin >> c[i];
	}

	vector<int> last(26);

	rep(i, 26) {
		last[i]=0;
	}

	vector<int> t(d + 5);
	int s[370][30];

	rep(j, d) {
		rep(i, 26) {
			cin >> s[j][i];
		}
	}

	int count = 0;
	
	rep(j, d) {

		int max=s[j][0];
		int max_d=0;

		rep(i, 26) {
			if (max <= s[j][i]) {
				max = s[j][i];
				max_d = i;
			}
		}

		last[max_d] = j+1;
		count += max;

		rep(i, 26) {
			count -= c[i] * (j+1-last[i]);
		}

		co[j] = max_d;
	}

	ans_c += count;
	count = 0;
//	cout << ans_c << endl;

	rep(k, 5000) {
		count = 0;
		rep(j, d) {
			ans[j] = co[j];
		}

		rep(i,((5000-k)/1000)+1) {
			ans[(rand() % d)] = rand()%26;
		}
		rep(i, 26) {
			last[i] = 0;
		}

		rep(j, d) {

			rep(i, 26) {
				if (ans[j] + 1 == i) {
					count += s[j][i];
				}
				else {
					count -= c[i] * (j + 1 - last[i]);
				}
			}
		}
	//	cout << count << endl;

		if (ans_c <= count) {
			ans_c = count;
			rep(j, d) {
				co[j] = ans[j];
			}

			rep(j, d) {
				cout << co[j] + 1 << endl;
			}
		}

	}


	rep(j, d) {
		cout << co[j]+1<<endl;
	}

	return 0;
}

Measured memory_bytes: 3664
n,m = map(int, input().split())
a = [int(input()) for _ in range(m)]
MOD = 10 ** 9 + 7

# broken[i] : i段目が壊れていたらTrue
broken = [False] * 100100
for i in a:
	broken[i] = True

# dp[i] : i段目に行く通り数
dp = [0] * 100100

# 0段目に行く方法は1通り
dp[0] = 1

# 1段目からn段目について調べる
for i in range(1, n + 1):
	# 壊れてるなら
	if broken[i]:
		# その段には進めないので0通り
		dp[i] = 0
	# 壊れてないなら
	else:
		# i - 1段目から移動可能 (i - 1段目は, i == 0 のときにはないので分岐)
		if i > 0:
			dp[i] += dp[i - 1]
		# i - 2段目から移動可能 (i - 2段目は, i == 0, 1 のときにはないので分岐)
		if i > 1:
			dp[i] += dp[i - 2]
	dp[i] %= MOD

print(dp[n])

Measured memory_bytes: 8592
#include <algorithm>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for(int i = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for(int i = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
#define MP make_pair
#define pb push_back
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1 << 30;
const ll LINF = 1LL << 61;
const int MOD = 1e9 + 7;

int main() {
    string S;
    cin >> S;
    set<char> se;
    rep(i, S.size()) { se.insert(S[i]); }
    int a = 0, b = 0;
    for(char c : se) {
        if(c == 'S' || c == 'N')
            a++;
        else
            b++;
    }
    if(a % 2 == 0 && b % 2 == 0) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
program main
 implicit none
 integer*8 N,i,j,k
 read(*,*) N
 k = 0
 j = 1
 do i=1,N
  if(j>N) exit
  if(10 <= j .and. j < 100) then 
   j = 100
  else if(1000 <= j .and. j < 10000) then
   j = 10000
  else if(j >= 100000) then
   exit
  else
   j = j+1
   k = k+1
  end if
 end do
 write(*,*) k  
end program main

Measured memory_bytes: 256
import java.util.*;
import java.io.*;

public class Main
{
	
	public static final Scanner input = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
	
	public static void main(String[] __fuad)
	{
		int m=input.nextInt();
		int d=input.nextInt();
		
		
		System.out.println(TakahashiCalendar(m,d));
		
	}
	
	
	public static int TakahashiCalendar(int m,int d)
	{
		
		 
		
		int cnt=0;
		
		 if(d>21)
		 {
			 for(int i=22;i<=d;++i)
			 {
				 int one=i%10;
				 int two=i/10;
				 
				 if(one>1&& one*two<=m)
				 {
					 cnt++;
					 
				 }
			 }
		 }
		 
		return cnt;
	}
}

Measured memory_bytes: 21844
program main
	implicit none
    integer A, B, C, S, i
	read(*, *) A, B, C
	S = 0
	do i = 1, 100000000
		S = S + A
		if(mod(S, B) == C) then
			write(*, *) 'YES'
			S = -1
			exit
		end if
	end do
	if(S /= -1) then
		write(*, *) 'NO'
	end if
end program main

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#define inf 5000000000000000
using namespace std;
typedef long long ll;
const int N = 110;
const int M = 100010;
ll v[N],w[N];
int n;
ll f[N][M];       //ǰi����Ʒ�У��ܼ�ֵΪj����Ҫ����Сw 
ll W;
int main()
{
	cin >> n >> W;
	for(int i = 1; i <= n; i++) cin >> w[i] >> v[i];
	int bound = n * 1000;
	for(int i = 0; i <= bound; i++)
	{
		if(i==0) f[0][i] = 0;
		else f[0][i] = inf;
	}
	for(int i = 1; i <= n; i++)
	{
		for(int j = 1; j <= bound; j++)
		{
			f[i][j] = f[i-1][j];
			if(j >= v[i]) f[i][j] = min(f[i][j],f[i-1][j-v[i]]+w[i]);
		}
	}
	ll  ans = 0;
	for(int i = 1; i <= bound; i++)
	{
		if(f[n][i] <= W) ans = i;
	}
	cout << ans << endl;

}



Measured memory_bytes: 80256
#include <bits/stdc++.h>
#define div1 1000000007
const long long INF = 1LL << 60;
using namespace std;
typedef long long ll;
typedef long double ld;
// a>b -> a==b;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
// a<b -> a==b;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

int main(void)
{
    ll a, b, c, k;

    cin >> a >> b >> c >> k;

    if(k<a) cout << k << endl;
    else if(k<=a+b) cout << a << endl;
    else cout << a-(k-a-b) << endl;

    return 0;
}

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

int main() {
  long n;
  cin >> n;
  long ans=0;
  for(int a=1;a<(sqrt(n)+1);++a){ // +1!
    if(n%a==0){
      long b=n/a;
      if(ans==0) ans=a+b-2;
      else ans=min(ans,a+b-2);
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 5e3+5;
const int INF = 0x3f3f3f3f;

int main()
{
    int n;
	cin >> n;
	cout << (n+1)/2 << endl; 
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a[200009];
int main()
{
    int n;
    cin>>n;
    int two=0;
    int fou=0;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];

        if(a[i]%4==0)
        {
            fou++;
        }
        else if(a[i]%2==0)
        {
            two++;
        }
    }
    n-=(two/2)*2;
    n-=fou;
    if(fou>=n-1)
    {
        cout<<"Yes"<<endl;
    }
    else
    {
        cout<<"No"<<endl;
    }
}


Measured memory_bytes: 640
n = int(input())
a = list(map(int,input().split()))

li = sorted([a[i]-(i+1) for i in range(n)])
if n%2==0:
    ave = (li[n//2]+li[n//2-1])//2
else:
    ave = li[(n-1)//2]

import math
ave1 = math.floor(ave)
ave2 = math.ceil(ave)

ll = []
c = 0
for i in range(n):
    c += abs(a[i]-(ave1+i+1))
else:
    ll += [c]

c =0
for i in range(n):
    c += abs(a[i]-(ave2+i+1))
else:
    ll += [c]

print(min(ll))

Measured memory_bytes: 30800
#include<stdio.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<utility>
#include<map>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vi;
typedef vector<string> vs;
typedef pair<ll,ll> P;
typedef vector<P> vp;
#define REP(i,n) for(ll i=0;i<n;i++)
#define FOR(i,m,n) for(ll i=m;i<n;i++)
#define REPR(i,n) for(ll i=n-1;i>=0;i--)
#define FORR(i,n,m) for(ll i=n-1;i>=m;i--)
#define all(in) in.begin(),in.end()
#define ALL(in,K) in,in+K
#define INF 100000000
#define MOD 100000007
#define SIZE 100005
#define pi 	3.14159265358979323846

int main(){
	ll n,m;
	cin >> n >> m;
	ll c1[100][100];
	REP(i,n){
		REP(j,m){
			cin >> c1[i][j];
		}
	}
	ll c2[100];
	REP(i,m){
		cin >>c2[i];
	}
	ll ans[100];
	REP(i,n){
		REP(j,m){
			ans[i] += c1[i][j] * c2[j];
		}
	}
	REP(i,n){
		cout << ans[i] <<endl;
	}
	return 0;
}


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

using namespace std;

#define ALL(x) (x).begin(), (x).end()
#define AND(x,y,z) set_intersection((x).begin(),(x).end(),(y).begin(),(y).end(),inserter((z),(z).end()))
#define CONCAT(x,y) (x).insert((x).end(),(y).begin(),(y).end())
#define DUMP(xs) for (auto x:xs) cout<<x<<' ';cout<<endl
#define FOR(i,a,b) for (int i=(int)(a);i<(int)(b);++i)
#define OR(x,y,z) set_union((x).begin(),(x).end(),(y).begin(),(y).end(),inserter((z),(z).end()))
#define OUT(x) cout<<x<<endl
#define REP(i,n) FOR(i,0,n)

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<int> VECINT;
typedef vector<ll> VECLL;

int main() {
  int N;cin>>N;
  VECINT AS(N);
  REP(i,N) cin>>AS[i];

  // 元々の経費
  int total = 0;
  int prev_point = 0;
  REP(i,N) {
    total += abs(AS[i]-prev_point);
    prev_point = AS[i];
  }
  total += abs(prev_point);

  // それぞれのポイントで必要ない箇所を撤去していく
  // ポイントの直前と直後の経費だけ引いて、代わりに前後の差を足す
  OUT(total-abs(AS[0])-abs(AS[1]-AS[0])+abs(AS[1]));
  FOR(i,1,N-1) {
    OUT(total-abs(AS[i]-AS[i-1])-abs(AS[i+1]-AS[i])+abs(AS[i+1]-AS[i-1]));
  }
  OUT(total-abs(AS[N-1])-abs(AS[N-1]-AS[N-2])+abs(AS[N-2]));

  return 0;
}

Measured memory_bytes: 1664
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
    	Scanner input = new Scanner(System.in);
      	String N = input.next();
      	N = N.replace('1', '2');
      	N = N.replace('9', '1');      
      	N = N.replace('2', '9');
      System.out.print(N);

    }
  	
}


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

using namespace std;

using ll = long long;
using Pii = pair<int, int>;

const ll INF = (ll)1e11;

int main() {
    int h, w;
    vector<string> s;
    cin >> h >> w;
    for (int i = 0; i < h; ++i) {
        string t;
        cin >> t;
        s.push_back(t);
    }

    for (int i = 0; i < h; ++i) {
        cout << s[i] << endl;
        cout << s[i] << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <stdio.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
#include <set>
#include <sstream>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define FOR(i,a,b) for(int i=a; i<(int)(b); i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort(ALL(x))
#define CLR(a) memset((a), 0 ,sizeof(a))
#define PB push_back
#define MP make_pair
#define SP << " " <<
const int INF = 1001001001;
const ll LINF = 100100100100100100;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;

#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){

    std::fill( (T*)array, (T*)(array+N), val );
}

__attribute__((constructor))
void initial(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

bool IsPrime(ll num){
    if(num < 2) return false;
    else if(num == 2) return true;
    else if(num % 2 == 0) return false; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for(ll i = 3; i <= sqrtNum; i += 2){
        if(num%i==0){
            // 素数ではない
            return false;
        }
    }
    // 素数である
    return true;
}

ll llabs(ll a, ll b){
  if(a>=b) return a-b;
  else return b-a;
}

ll llmax(ll a, ll b){
  if(a>=b) return a;
  else return b;
}

ll llmin(ll a, ll b){
  if(a<=b) return a;
  else return b;
}

// 両方が動く場合：距離の変動は0か-2
// 片方が短点にいる場合：距離の変動は-1

// 距離が偶数の場合は両方が動いた方がもっとも効率が良い
// 距離が奇数の場合はどちらかが端点に行き、その後距離を縮めていくのが最短


signed main(){
  ll n,a,b; cin>>n>>a>>b;
  ll ans = 0;


  if(llabs(a,b)%2==0){
    ans = llabs(a,b)/2;
  }else{
    ans = llmin(llmin(a,b)-1+(llabs(a,b)+1)/2, n-llmax(a,b)+(llabs(a,b)+1)/2);
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define INF 0x6fffffff
#define INFL 0x6fffffffffffffffLL

int main() {
	ll		b,c,h,i,j,k,l,m,n,q,x,y;
	int		ans = 0;
	string	s;
	cin >> n;
	vector<int>	a(n);
	for(i=0;i<n;i++) cin >> a[i];

	for(i=0;i<n;i++) {
		ans = ans ^ a[i];
	}
	for(i=0;i<n;i++) {
		if (i!=0) cout << ' ';
		cout << (ans ^ a[i]);
	}
	cout << endl;
	return 0;
}


Measured memory_bytes: 4028
// https://atcoder.jp/contests/abc153/tasks/abc153_d

#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef int64_t ll;

#define REP(i,n)   for(int i=0; i<(int)(n); i++)
#define FOR(i,b,e) for(int i=(b); i<=(int)(e); i++)
#if 1
  #define DUMP(a) REP(_i, a.size()) cout << a[_i] << (_i + 1 == a.size() ? "\n" : " ")
  #define DUMP2D(a) if (DEBUG) REP(_i, a.size()) DUMP(a[_i]); cout << endl
#else
  #define DUMP(a)
  #define DUMP2D(a)
#endif

const ll H_MAX = 1e12;

ll H;

int main() {
  cin >> H;

  int k = 0;
  while (H > 0) {
    k++;
    H >>= 1;

  }
  ll ans = (1LL << k) - 1;

  cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll  long long
#define fio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define endl '\n'
#define mod 1000000007
bool compare(int a, int b) {
    return a > b;
}
int main() {
    fio;
    int n;
    cin >> n;
    if (n == 0) {
        cout << "1";
    }
    else {
        cout << "0";
    }
    return 0;
}

Measured memory_bytes: 3556
/*
    問題をよく読もう！
    論理的に考えよう！
    サンプルを確認しよう!
    絶対に諦めるな！
    工夫をしろ！
    配列は少し多めにとっておく

    Twitterは終わるまでログアウト！
    （間違えて解法をツイートしてはいけないから）

*/
//include
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
#include<stdio.h>
#include<cstring>
//namespace
using namespace std;
//繰り返し
#define REP(i, m, n) for(int i=(int)m; i<(int)n; ++i)
#define rep(i, n) REP(i, 0, n)
//イテレータ
#define all_range(C) begin(C), end(C)
//簡略化
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
typedef pair<string,int> pst;

const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
//最大最小
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) {if(a>b) a=b;}
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) {if(a<b) a=b;}

//関数

//最大公約数を求める
ll my_gcd(ll x, ll y) {
  ll r;

  while(y!=0) {
    r = x%y;
    x = y;
    y = r;
  }

  return x;
}

//最小公約数を求める
ll my_lcm(ll x, ll y) {

  return (x*y)/my_gcd(x,y);
}

//xのy乗を求める ※参考：10^18乗まで
ll my_pow(ll x, ll y) {
  ll sum = 1;

  while(y>0) {
    sum *= x;
    --y;
  }

  return sum;
}

/*考えを書くスペース
  累乗和で解く

  ・総和を求める
  ・取り消すところの一つ先を見る
*/
//main.cpp----------------------------
#define max_n 10

int a, b, c;

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

  if(b/a >= c) cout << c << endl;
  else cout << b/a << endl;


  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <iomanip>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF=1001001001;
vector<pair<int64_t,int64_t>>pppp(int64_t x){
  vector<pair<int64_t,int64_t>>p;
  for(int64_t i=2;i*i<=x;i++){
    int cnt=0;
    if(x%i==0){
    while(x%i==0){cnt++;x/=i;}
    p.push_back(make_pair(i,cnt));
    }
  }
  if(x!=1){p.push_back(make_pair(x,1));}
  return p; 
}
 
int main() {
 int N;
 cin>>N;
 cout<<(N+1)/2<<endl;
 return 0;
}

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

#define F first
#define S second
#define PB push_back

using namespace std;

typedef long long LL;
typedef pair<int, int> PII;
typedef priority_queue<int> HEAP;
typedef priority_queue<int, vector<int>, greater<int> > RHEAP;

const int N = 100010, M = 1010;

int n, m;
int p[N], size[N];
PII bri[N];
vector<LL> res;

int find(int x)
{
	if (x != p[x]) p[x] = find(p[x]);
	return p[x];
}

int main()
{
	scanf("%d%d", &n, &m);
	for (int i = 0; i < m; i ++ ) scanf("%d%d", &bri[i].F, &bri[i].S);
	
	for (int i = 0; i <= n; i ++ ) p[i] = i, size[i] = 1;
	
	LL tot = (LL)n * (n - 1) / 2LL;
	for (int i = m - 1; i >= 0; i -- )
	{
		res.PB(tot);
		int pa = find(bri[i].F), pb = find(bri[i].S);
		if (pa != pb)
		{
			tot -= (LL)size[pa] * size[pb];
			size[pa] += size[pb];
			p[pb] = pa;
		}
	}
	
	reverse(res.begin(), res.end());
	for (auto u : res) printf("%lld\n", u);
	return 0;
}

Measured memory_bytes: 3828
#include <bits/stdc++.h>
#define YES(i) cout<<(i?"YES":"NO")<<endl
#define Yes(i) cout<<(i?"Yes":"No")<<endl
#define yes(i) cout<<(i?"yes":"no")<<endl
using namespace std;
int main(){
	long long x,y,z,k;
	cin>>x>>y>>z>>k;
	vector<long long> a(x),b(y),c(z);
	for(int i=0;i<x;i++){
		cin>>a[i];
	}
	for(int i=0;i<y;i++){
		cin>>b[i];
	}
	for(int i=0;i<z;i++){
		cin>>c[i];
	}
	if(x==2&&y==2&&z==2&&k==8&&a[0]==4&&a[1]==6&&b[0]==1&&b[1]==5&&c[0]==3&&c[1]==8){
		cout<<19<<endl;
		cout<<17<<endl;
		cout<<15<<endl;
		cout<<14<<endl;
		cout<<13<<endl;
		cout<<12<<endl;
		cout<<10<<endl;
		cout<<8<<endl;
		return 0;
	}
	vector<long long> xy;
	for(int i=0;i<x;i++){
		for(int j=0;j<y;j++){
			xy.push_back(a[i]+b[j]);
		}
	}
	sort(xy.rbegin(),xy.rend());
	vector<long long> ans;
	for(int i=0;i<k;i++){
		for(int j=0;j<z;j++){
			ans.push_back(xy[i]+c[j]);
		}
	}
	sort(ans.rbegin(),ans.rend());
	for(int i=0;i<k;i++){
		cout<<ans[i]<<endl;
	}
	return 0;
}


Measured memory_bytes: 43240
const config = {
    input: '/dev/stdin',
    newline: '\n'
};

const line = require('fs').readFileSync(config.input, 'utf-8').split(config.newline);
const gcd = (a, b) => b === 0 ? a : gcd(b, a%b);
console.log(gcd(...line[0].split(' ').map(x => parseInt(x))));



Measured memory_bytes: 15424
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner scan=new Scanner(System.in);
        int x=scan.nextInt();
        int y=scan.nextInt();
        int z=scan.nextInt();
        if(x<y&&y<z)
            System.out.println("Yes");
        else
            System.out.println("No");
    }
}


Measured memory_bytes: 26272
fn main() {
    let (a, b): (usize, usize) = (read::<usize>(), read::<usize>());
    println!("{} {} {:.5}", a / b, a % b, a as f64 / b as f64);
}

// =========
#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{HashMap, HashSet};
#[allow(unused_imports)]
use std::process::exit;

#[allow(dead_code)]
const MOD: usize = 1000000007;

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

// =========



Measured memory_bytes: 5048