akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
#define ten5 100000+10
#define MOD 1000000007
#define rep(i,a,n) for (int i=a;i<n;i++)
#define iif(c,t,f) ((c)?(t):(f))
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair

int intcmp(const void *v1,const void *v2){return *(int *)v1-*(int *)v2;}

int k,n;

int a[100010];

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

  rep(i,0,n){
    scanf("%d",a+i);
  }
  n--;
  if(n%(k-1) == 0){
    cout<<(n/(k-1))<<endl;
  }else{
    cout<<(1+n/(k-1))<<endl;
  }

  return 0;
}


Measured memory_bytes: 4152
package main

import (
	"fmt"
	"math"
)

func main() {
	var n int
	fmt.Scan(&n)

	power := 1
	for i := 1; i <= n; i++ {
		power *= i
		power %= int(math.Pow(10, 9) + 7)
	}
	fmt.Println(power)

}


Measured memory_bytes: 512
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		DataSet d = new DataSet();
		d.input();
		if(d.H%d.h==0&&d.W%d.w==0)
			System.out.println("No");
		else if(d.H%d.h!=0){
			System.out.println("Yes");
			for(int i=0;i<d.H;i++){
				for(int j=0;j<d.W;j++){
					System.out.print((i%d.h==0)?1000*d.h-1001:-1000);
					if(j==d.W-1) System.out.println();
					else System.out.print(" ");
				}
			}
		}
		else if(d.W%d.w!=0){
			System.out.println("Yes");
			for(int i=0;i<d.H;i++){
				for(int j=0;j<d.W;j++){
					System.out.print((j%d.w==0)?1000*d.w-1001:-1000);
					if(j==d.W-1) System.out.println();
					else System.out.print(" ");
				}
			}
		}
	}

}

class DataSet{
	
	int H,W,h,w;
	
	public void input(){
		Scanner sc = new Scanner(System.in);
		H = sc.nextInt();
		W = sc.nextInt();
		h = sc.nextInt();
		w = sc.nextInt();
		sc.close();
	}
	
}

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


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

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

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




int main() {
    ll a,b,c;
    cin >> a >> b;
    cout << a + b / 2 << endl;
}


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

int main() {
	int k;
	while (cin >> k, k) {
		int sum = 0;
		rep(i, k*(k - 1) / 2) {
			int c; cin >> c; sum += c;
		}
		cout << sum / (k - 1) << endl;
	}
}

Measured memory_bytes: 3000
#include <bits/stdc++.h>
#define rep(i,a,n) for(int i=a;i<n;i++)
#define repr(i,a,n) for(int i=a;i>=n;i--)
#define INF 99999999
#define INF_M 2147483647
#define pb(a) push_back(a)

using namespace std;
typedef pair<int, int> pii;
typedef long long int ll;
typedef vector<pii> VP;

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

int dist[15][15];
int dp[1 << 15][15];
int V,E;
int s,t,d;

int rec(int S, int v) {
    if(dp[S][v] >= 0) return dp[S][v];
    if(S == (1 << V) - 1 && v == 0) return dp[S][v] = 0;

    int res = INF;
    for(int r = 0; r < V; r++) {
        if(!(S & 1 << r)) {
            res = min(res, rec(S | 1 << r, r) + dist[v][r]);
        }
    }
    return dp[S][v] = res;
}

int main() {
    cin >> V >> E;
    rep(i,0,20) rep(j,0,20) dist[i][j] = INF;

    rep(i,0,E) {
        cin >> s >> t >> d;
        dist[s][t] = d;
    }
    memset(dp, -1, sizeof(dp));

    int ans = rec(0,0);
    if(ans == INF) cout << -1 << endl;
    else cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3092
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner s = new Scanner(System.in);
    int n = s.nextInt();
    int[] a = new int[n];
    
    for (int i = 0; i < n; i++) {
      a[i] = s.nextInt();
    }
    
    System.out.println(solve(n, a));
  }
  
  private static int solve(int n, int[] a) {
    if (n == 2) {
      return Math.max(a[0], a[1]);
    }
    
    int[] gcd1 = new int[n];
    int[] gcd2 = new int[n];
    
    gcd1[0] = a[0];
    for (int i = 1; i < n; i++) {
      gcd1[i] = gcd(gcd1[i-1], a[i]);
    }
    
    gcd2[n-1] = a[n-1];
    for (int i = n-2; i >= 0; i--) {
      gcd2[i] = gcd(gcd2[i+1], a[i]);
    }
    
    int maxV = Math.max(gcd1[n-2], gcd2[1]);
    for (int i = 1; i <= n-2; i++) {
      maxV = Math.max(maxV, gcd(gcd1[i-1], gcd2[i+1]));
    }
    return maxV;
  }
  
  private static int gcd(int a, int b) {
    if (a % b == 0) {
      return b;
    } else {
      return gcd(b, a%b);
    }
  }
}


Measured memory_bytes: 48852
import java.util.*;

public class Main {
    static Scanner sc;
    static List<Node> nodes = new ArrayList<>();

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

        int[] ans = new int[n];
        for (int i = 0; i < n; i++) {
            nodes.add(new Node(i));
        }
        for (int i = 0; i < n - 1; i++) {
            int u = sc.nextInt()-1;
            int v= sc.nextInt()-1;
            int w = sc.nextInt();
            nodes.get(u).next.put(nodes.get(v), w);
            nodes.get(v).next.put(nodes.get(u), w);
        }
        boolean[] done = new boolean[n];
        Deque<Node> deque = new ArrayDeque<>();
        deque.add(nodes.get(0));
        while(!deque.isEmpty()) {
            Node a = deque.poll();
            done[a.num] = true;
            ans[a.num] = a.c;
            for(Node next : a.next.keySet()) {
                if(done[next.num]) {
                    continue;
                }
                next.c = (a.c + a.next.get(next)) % 2;
                deque.add(next);
            }
        }
        for (int i = 0; i < n; i++) {
            System.out.println(ans[i]);
        }
    }


    static class Node {
        int num;
        Map<Node, Integer> next;
        int c = 0;

        public Node(int num) {
            this.num = num;
            next = new HashMap<>();
        }
    }
}



Measured memory_bytes: 122132
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    int ans=0;
    for(int i=1;i<=n;i++)
    {
       if(i<10)
            ans++;
       if(i<=999&&i>=100)
        ans++;
       if(i<=99999&&i>=10000)
        ans++;
    }
     cout<<ans<<endl;

    return 0;
}






Measured memory_bytes: 256
/* Author: $%U%$
 * Time: $%Y%$-$%M%$-$%D%$ $%h%$:$%m%$:$%s%$
**/
#include <bits/stdc++.h>
using namespace std;
#define fore(i, a, b) for (int i = a, to = b; i < to; i++)
#define all(v) v.begin(), v.end()
#define SZ(v) (int)v.size()
#define pb push_back
typedef long long Long;
typedef pair<int, int> Pair;
const int MX = (3e3);
const Long MOD = (998244353);
vector<Long> v;
Long n, s;
Long memo[MX + 2][MX + 2];
Long dp(int pos, int suma) {
  if (pos == n) {
    if (suma == s)
      return 1LL;
    else
      return 0LL;
  }
  if (memo[pos][suma] != -1) return memo[pos][suma];
  Long &ans = memo[pos][suma] = 0;
  if (suma + v[pos] <= s) ans += dp(pos + 1, suma + v[pos]);
  ans += 2 * dp(pos + 1, suma);
  ans %= MOD;
  return ans;
}
void solve() {
  cin >> n >> s;
  v.resize(n);
  fore(i, 0, n) cin >> v[i];
  memset(memo, -1, sizeof memo);
  cout << dp(0, 0) << '\n';
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(NULL);
  int t = 1;
  //cin >> t;
  while (t--) solve();

  return 0;
}

Measured memory_bytes: 74236
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <string>
#include <vector>

typedef long long ll;
using namespace std;

int main() {
    int h = 0, w = 0;
    cin >> h >> w;
    vector<vector<int>> ans(h, vector<int>(w));
    char buf = 0;
    for (int i=0; i<h; i++) {
        for (int j=0; j<w; j++) {
            cin >> buf;
            if (buf == '#') {
                ans.at(i).at(j) = -10;
            }
        }
    }
    for (int i=0; i<h; i++) {
        for (int j=0; j<w; j++) {
            if (ans.at(i).at(j) < 0) {
                if (i-1 >= 0) {
                    ans.at(i-1).at(j)++;
                    if (j-1 >= 0) ans.at(i-1).at(j-1)++;
                    if (j+1 < w) ans.at(i-1).at(j+1)++;
                }
                if (i+1 < h) {
                    ans.at(i+1).at(j)++;
                    if (j-1 >= 0) ans.at(i+1).at(j-1)++;
                    if (j+1 < w) ans.at(i+1).at(j+1)++;
                }
                if (j-1 >= 0) ans.at(i).at(j-1)++;
                if (j+1 < w) ans.at(i).at(j+1)++;
            }
        }
    }
    for (int i=0; i<h; i++) {
        for (int j=0; j<w; j++) {
            if (ans.at(i).at(j) < 0) {
                cout << "#";
            }
            else {
                cout << ans.at(i).at(j);
            }
        }
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define fi first
#define se second
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define INF  (1<<30)
#define INFL (1LL<<60)
#define MOD 1000000007LL
#define EPS ((ld)(1e-9))
 
#define sz(x) ((int)(x).size())
#define setz(x) memset(x, 0, sizeof(x))
#define all(x) (x).begin(), (x).end()
#define rep(i, x)  for (int i = 0, _##i = (x); i < _##i; i++)
#define repp(i, s, e) for (int i = (s), _##i = (e); i < _##i; i++)
#define repr(i, s, e) for (int i = (s)-1, _##i = (e); i >= _##i; i--)
#define repi(i, x) for (auto &i : (x))
 
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
 
template<typename T, typename V>
ostream &operator<<(ostream &os, const pair<T, V> pai) { 
    return os << '(' << pai.first << ' ' << pai.second << ')';
}
 
template<typename T>
ostream &operator<<(ostream &os, const vector<T> v) {
    cout << '[';
    rep(i, sz(v)) cout << v[i] << ",";
    cout << "]";
    return os;
}
 
template<typename T>
ostream &operator<<(ostream &os, const set<T> v) {
    cout << "{";
    for (auto p : v) cout << p << ",";
    cout << "}";
    return os;
}
 
template<typename T, typename V>
ostream &operator<<(ostream &os, const map<T, V> v) {
    cout << "{";
    for (auto p : v) cout << p << ",";
    cout << "}";
    return os;
}
 
#ifndef __SOULTCH
#define debug(...) 0
#define endl '\n'
#else
#define debug(...) cout << " [-] ", _dbg(#__VA_ARGS__, __VA_ARGS__)
template<class TH> void _dbg(const char *sdbg, TH h){ cout << sdbg << '=' << h << endl; }
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
    while(*sdbg != ',') cout << *sdbg++;
    cout << '=' << (h) << ','; 
    _dbg(sdbg+1, a...);
}
#endif
 
template<typename T> void get_max(T &a, T b) {a = max(a, b);}
template<typename T> void get_min(T &a, T b) {a = min(a, b);}

int N, W;
int A[101], B[101];
int dp[101][100001];

void upd(map<ll, ll> &x, int p, ll n) {
    if (x.count(p)) get_max(x[p], n);
    else x[p] = n;
}

int main(void) {
    iostream::sync_with_stdio(false);
    cin.tie(nullptr), cout.tie(nullptr);

    cin >> N >> W;
    repp(i, 1, N+1) cin >> A[i] >> B[i];
    repp(j, 1, 100001) dp[0][j] = INF;
    repp(i, 1, N+1) {
        rep(j, 100001) dp[i][j] = min({INF, dp[i-1][j], j>=B[i]?dp[i-1][j-B[i]]+A[i]:INF});
    }

    repr(i, 100001, 0) if (dp[N][i] <= W) return cout << i << endl, 0;
    return 0;
}

Measured memory_bytes: 39680
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>
#include <assert.h>
#include <unordered_set>
#include <random>


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

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

#define REP(i, n) for(ll i = 0; i < n; i++)















string s;
ll k;
ll dp[1000][2][5];

ll rec(ll idx = 0, bool tight = true, ll cnt = 0){
    if(cnt > k) return 0;
    
    if(idx == s.size()){
        return cnt == k;
    }
    
    ll x = s[idx] - '0';
    ll r = tight? x : 9;
    
    ll &res = dp[idx][tight][cnt];
    if(~res) return res;
    res = 0;
    
    for(ll i = 0; i <= r; i++){
        res += rec(idx + 1, tight && (i == r), (i == 0? cnt : cnt + 1));
    }
    
    return res;
}

int main(){
    cin >> s >> k;
    memset(dp, -1, sizeof(dp));
    cout << rec() << endl;
}

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

 using namespace std;

 int main() {
   int N, L, ans;
   cin >> N >> L;

   if (L >= 0) ans = (L + N - 1) * (L + N) / 2 - L * (L + 1) / 2;

   else if (L + N - 1 < 0) ans = - L * (L - 1) / 2 + (L + N - 2) * (L + N - 1) / 2;

   else ans = - L * (L - 1) / 2 + (L + N - 1) * (L + N) / 2;

   cout << ans << endl;
}


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

void calc0(int64_t n, vector<int64_t>& yakusuu)
{
	for (int64_t i = 1; i * i <= n; i++) {
		if (n % i == 0) {
			yakusuu.push_back(i);
		}
	}

	int s = yakusuu.size();
	for (int i = s - 1; i >= 0; i--) {
		if (yakusuu.at(i) * yakusuu.at(i) != n) {
			yakusuu.push_back(n / yakusuu.at(i));
		}
	}
}

void calc1(int64_t n, vector<int64_t>& yakusuu, vector<pair<int64_t, int>>& soinsuu)
{
	for (auto num : yakusuu) {
		if (num == 1) {
			continue;
		}
		pair<int64_t, int> temp = make_pair(num, 0);
		while (n % num == 0) {
			n /= num;
			temp.second++;
		}
		soinsuu.push_back(temp);
		if (n == 1) {
			break;
		}
	}
}

int calc2(int num)
{
	int ret = 1;
	int temp = 1;
	while (true) {
		num -= temp;
		temp++;
		if (num >= temp) {
			ret++;
		} else {
			break;
		}
	}
	return ret;
}

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

	if (n == 1) {
		cout << 0 << endl;
		return 0;
	}

	vector<int64_t> yakusuu;
	calc0(n, yakusuu);
	vector<pair<int64_t, int>> soinsuu;
	calc1(n, yakusuu, soinsuu);

	int ans = 0;
	for (auto soinsuu_ele : soinsuu) {
		int num = soinsuu_ele.second;
		if (num == 0) {
			continue;
		}
		ans += calc2(num);
	}

	cout << ans << endl;
}


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

int main()
{
    int h, w;
    
    while(cin >> h >> w && h && w) {
        string top(w, '#');
        string middle(w,'.');
        middle[0] = '#'; middle.back() = '#';
        
        cout << top << '\n';
        while(h-- > 2) cout << middle << '\n';
        cout << top << '\n' << endl;
    }
    
    return 0;
}


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

#define fi first
#define se second
#define FO(x, n) for (int x = 0; x < n; ++x)
#define FOR(x, a, b) for (int x = a; x < b; ++x)
#define RFO(x, n) for (int x = n - 1; x >= 0; --x)
#define RFOR(x, a, b) for (int x = b - 1; x >= a; --x)
#define FOR_ITER(x, a) for(auto x = a.begin(); x != a.end(); ++x)

#define pb push_back
#define pf push_front
#define mp make_pair
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define len(str) str.size()


using namespace std;

typedef complex<double> P;
typedef unsigned char byte;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef pair<string, string> pss;
typedef pair<ll, ll> pll;
inline bool feq(const double& a, const double& b) { return fabs(a - b) < 1e-10; }
inline int gcd(int a, int b) {
    if (b == 0) return a;
    return a < b? gcd(b, a) : gcd(b, a % b);
}
ll mo=1000000007;


int main(){
//    int n, l;
//    cin >> n >> k;
//    vector<bool> dislike(10, false);
//
//    FOR(i, 0, k) {
//        int t;
//        cin >> t;
//        dislike[t] = true;
//    }


    string a, b;
    cin >> a >> b;

    int sz1 = len(a);
    int sz2 = len(b);

    FO(i, sz1) {
        cout << a.at(i);
        if (i < sz2)
            cout << b.at(i);
    }

        cout << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
typedef vector<int> VI;
ll mm=1000000000;ll MM=mm+7;
#define rep(i, n) for(int i=0;i<n;i++)
#define PI 3.141592653589793


   
int main(){
 int h,w;
 cin >> h >> w;
 vector<vector<char>> a(h+2,vector<char>(w+2));
 rep(i,h+2){
    rep(j,w+2){
       if(i==0 ||i==h+1){
          a.at(i).at(j)='#';
       }
       else if(j==0 || j==w+1){
          a.at(i).at(j)='#';
       }
    }
 }
 for(int i=1;i<=h;i++){
    for(int j=1;j<=w;j++){
       cin >> a.at(i).at(j);
    }
 }
 rep(i,h+2){
    rep(j,w+2){
       cout << a.at(i).at(j);
    }
    cout << endl ;
 }
}
    

Measured memory_bytes: 3616
#include <iostream>
using namespace std;
typedef long long ll;
int main() {
  ios::sync_with_stdio(false);
  ll X;
  cin >> X;
  ll a = 100;
  int ret = 0;
  while (a < X) {
    a = a + a / 100;
    ret++;
  }
  cout << ret << endl;
}

Measured memory_bytes: 3652
//g++ -std=c++14 test.cpp -o test.out
 
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <iomanip>
#include <vector>
#include <queue>
#include <stack>
#include <map> 
#include <unordered_map> 
#include <utility>
#include <limits.h>
#include <bitset>
#include <set>
using namespace std;
 
#define LL long long int
const LL INF = (1LL<<60);
const int INF_INT = 2147483647-1e6-1;
const LL mod = 1000000007ll;
const int mod_int = 1000000007;

//https://github.com/atcoder-live/library/blob/master/mint.cpp
struct mint {
	LL x; 
	mint(LL x=0):x((x%mod+mod)%mod){}
	mint& operator+=(const mint a) {
		if ((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator-=(const mint a) {
		if ((x += mod-a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator*=(const mint a) {
		(x *= a.x) %= mod;
		return *this;
	}
	mint operator+(const mint a) const {
		mint res(*this);
		return res+=a;
	}
	mint operator-(const mint a) const {
		mint res(*this);
		return res-=a;
	}
	mint operator*(const mint a) const {
		mint res(*this);
		return res*=a;
	}
	mint pow(LL t) const {
		if (!t) return 1;
		mint a = pow(t>>1);
		a *= a;
		if (t&1) a *= *this;
		return a;
	}

	// for prime mod
	mint inv() const {
		return pow(mod-2);
	}
	mint& operator/=(const mint a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint a) const {
		mint res(*this);
		return res/=a;
	}
};

struct combination {
	vector<mint> fact, ifact;//factに階乗を計算、ifactはその各々に対する逆元
	combination(LL n):fact(n+1),ifact(n+1) {
		assert(n < mod);
		fact[0] = 1;
		for (LL i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
		ifact[n] = fact[n].inv();
		for (LL i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
	}
	mint operator()(LL n,LL k) {
		if (k < 0 || k > n) return 0;
		return fact[n]*ifact[k]*ifact[n-k];
	}
};

LL N;
LL A[200000];
 
mint ans = 0;

void solve(){
	mint accum = A[0];
	for(int i=1;i<N;i++){
		ans += accum*mint(A[i]);
		accum += mint(A[i]);
	}
}
 
int main(){
    cin >> N;
    for(int i=0;i<N;i++) cin >> A[i];
 
    solve();
 
    cout << ans.x << endl;
    return 0;
}

Measured memory_bytes: 4712
n = int(input())
a_i = input().split()
ans = ""
ans_l = [0] * n
for i in range(len(a_i)):
  ans_l[int(a_i[i])-1] = i + 1
for j in range(n):
  ans += str(ans_l[j])
  if j != (n - 1):
    ans += " "
print(ans)

Measured memory_bytes: 15056
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i = 0;i<((ll)(n));i++)
#define reg(i,a,b) for(ll i = ((ll)(a));i<=((ll)(b));i++)
#define irep(i,n) for(ll i = ((ll)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(ll i = ((ll)(b));i>=((ll)(a));i--)
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;
template<class T = int> void print(vector<T> v){for(auto a:v)cout<<a<<" ";cout<<endl;}

/*

*/

ll n,m,L,q;
ll d[301][301],d2[301][301];

int main(void){
	cin>>n>>m>>L;
	reg(i,1,n)reg(j,1,n){
		d[i][j]=1e18;
		d2[i][j]=1e18;
	}
	reg(i,1,n){
		d[i][i]=0;
		d2[i][i]=0;
	}
	rep(i,m){
		ll a,b,c;
		cin>>a>>b>>c;
		d[a][b]=min(c,d[a][b]);
		d[b][a]=min(c,d[b][a]);
	}
	//
	reg(k,1,n) {
		reg(i,1,n) {
			reg(j,1,n) {
				d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
			}
		}
	}
	// reg(i,1,n) {
	// 	reg(j,1,n)cerr<<d[i][j]<<" ";
	// 	cerr<<endl;
	// }
	reg(i,1,n) {
		reg(j,1,n) {
			if(d[i][j]<=L)d2[i][j] = min(1LL, d2[i][j]);
		}
	}
	reg(k,1,n) {
		reg(i,1,n) {
			reg(j,1,n) {
				d2[i][j] = min(d2[i][j], d2[i][k] + d2[k][j]);
			}
		}
	}
	// reg(i,1,n) {
	// 	reg(j,1,n)cerr<<d2[i][j]<<" ";
	// 	cerr<<endl;
	// }
	cin>>q;
	rep(i,q){
		ll s,t;
		cin>>s>>t;
		cout<<(d2[s][t]!=1e18?d2[s][t]-1:-1)<<endl;
	}
	return 0;
}

Measured memory_bytes: 1920
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

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

vector<vector<int> > edges;
vector<int> memo;

bool solve(int curr)
{
    for(unsigned i=0; i<edges[curr].size(); ++i){
        int next = edges[curr][i];
        int x = memo[curr];
        if(i == 0)
            x ^= 1;

        if(memo[next] == -1){
            memo[next] = x;
            if(!solve(next))
                return false;
        }else if(memo[next] != x){
            return false;
        }
    }
    return true;
}

int main()
{
    for(;;){
        int n;
        cin >> n;
        if(n == 0)
            return 0;

        map<pair<int, int>, int> index;
        edges.assign(2*n, vector<int>(0));
        for(int i=0; i<n; ++i){
            int y1, x1, y2, x2;
            char dir;
            cin >> x1 >> y1 >> dir;
            y2 = y1;
            x2 = x1;
            if(dir == 'x')
                ++ x2;
            else
                ++ y2;

            edges[2*i].push_back(2*i+1);
            edges[2*i+1].push_back(2*i);

            for(int j=0; j<4; ++j){
                map<pair<int, int>, int>::iterator it1 = index.find(make_pair(y1+dy[j], x1+dx[j]));
                if(it1 != index.end()){
                    edges[2*i].push_back(it1->second);
                    edges[it1->second].push_back(2*i);
                }
                map<pair<int, int>, int>::iterator it2 = index.find(make_pair(y2+dy[j], x2+dx[j]));
                if(it2 != index.end()){
                    edges[2*i+1].push_back(it2->second);
                    edges[it2->second].push_back(2*i+1);
                }
            }

            index[make_pair(y1, x1)] = 2 * i;
            index[make_pair(y2, x2)] = 2*i+1;
        }

        memo.assign(2*n, -1);
        bool ok = true;
        for(int i=0; i<2*n; ++i){
            if(memo[i] != -1)
                continue;

            memo[i] = 0;
            if(!solve(i)){
                ok = false;
                break;
            }
        }

        if(ok)
            cout << "Yes" << endl;
        else
            cout << "No" << endl;
    }
}

Measured memory_bytes: 7144
//c++14
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;

int main(){
  int x[5];
  for (int i=0;i<5;i++){
    cin >> x[i];
  }
  int k;cin >> k;
  bool ans = true;
  for (int i = 0;i<5;i++){
    for (int j=0;j<5;j++){
      if (x[i] - x[j] > k) ans = false;
    }
  }
  cout << (ans ? "Yay!" : ":(" ) << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
  int input[5];
  int k;
  for(int i=0; i<5; i++){
    std::cin >> input[i];
  }
  std::cin >> k;

  bool can_flag = true;
  for(int i=0; i<5; i++){
    for(int j=0; j<5; j++){
      if( i!= j){
        if( abs(input[i]-input[j]) > k ) can_flag = false;
      }
    }
  }

  if( can_flag ) std::cout << "Yay!" << '\n';
  else std::cout << ":(" << '\n';

  return 0;
}


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

using namespace std;

#define mP make_pair
#define pB push_back
#define ll long long

int main(){
	int n, a ,b;
	cin >> n >> a >> b;
	if((b - a) % 2 == 1){
		cout << "Borys" << endl;
	}else{
		cout << "Alice" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
import           Control.Applicative

main :: IO ()
main = do
    [a, b, c] <- fmap read . words <$> getLine :: IO [Double]
    let r = (pi / 180) * c
    let h = b * sin r
    let s = a * h / 2
    let d = sqrt $ a ^ 2 + b ^ 2 - 2 * a * b * cos r
    print s
    print (a + b + d)
    print h



Measured memory_bytes: 4132
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> vvl;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvec;
typedef vector<vector<bool>> vveb;
typedef vector<vector<string>> vves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pb push_back
#define pp pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
typedef long long int64;
#define dame { puts("-1"); return 0;}
#define YES { cout << "YES" << endl; return 0; }
#define NO { cout << "NO" << endl; return 0; }
#define Yes { cout << "Yes" << endl; return 0; }
#define No { cout << "No" << endl; return 0; }
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 (a > b) { a = b; return 1; } return 0; }
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	vi vec(3);
	rep(i, 3) {
		cin >> vec.at(i);
	}
	cout << vec.at(2) << " " << vec.at(0) << " " << vec.at(1);
	return 0;
}

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

char s[1000005];
int ans;

int main()
{
	scanf("%s",s);
	int len=strlen(s),k=0;
	for (int i=len-1;i>=0;i--) {
		int t=s[i]-'0'+k;
		if (t>=6) ans+=10-t,k=1;
		else if (i>=0&&t==5&&s[i-1]>='5') ans+=10-t,k=1;
		else ans+=t,k=0;
	}
	if (k==1) ans++;
	cout << ans << endl;
	
	return 0;
}

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

#define irep(i,n) for(int i = 0; i < (int)(n); i++)
#define irep2(i,a,n) for(int i = (int)(a); i <= (int)(n); i++)
#define lrep(i,n) for(long long  i = 0; i < (long long)(n); i++)
#define lrep2(i,a,n) for(long long i = (long long)(a); i <= (long long)(n); i++)
#define irrep(i,n) for(int i = (int)(n-1); i > -1; i--)
#define irrep2(i,a,n) for(int i = (int)(n); i >= (int)(a); i--)

typedef long long ll;
typedef std::vector<int> v_int;
typedef std::vector<v_int > v2_int;
typedef std::vector<ll> v_ll;
typedef std::vector<v_ll > v2_ll;
typedef std::vector<std::string> v_string;
typedef std::vector<v_string > v2_string;
typedef std::vector<bool> v_bool;
typedef std::vector<v_bool > v2_bool;
typedef std::pair<ll, ll> pll;
typedef std::pair<int, int> pii;

const double PI = 3.1415926535897932;
const int INF = (int)1e9;
const ll LINF = 1e18;
const ll MOD = 998244353;
const int dr[4] = {1, 0, -1, 0};
const int dc[4] = {0, 1, 0, -1};

using namespace std; 

template<typename T, typename U> inline
ostream& operator<<(ostream &o, pair<T,U> &p)
{
    return o << "{" << p.first << "," << p.second << "}";
}

template<typename T> inline
ostream& operator<<(ostream &os, vector<T> &v)
{
    int len = v.size();
    for(int i = 0; i < len; i++) { 
        os << v[i];
        if(i != len-1) { os << ","; } 
    } 
    return os;
}

int main(void)
{
    int k, t;
    cin >> k >> t;
    
    v_int a(t);
    irep(i, t) {
        cin >> a[i];
    }
    sort(a.rbegin(), a.rend());
    
    cout << max(a[0] - 1 - (k-a[0]), 0) << endl;
    return 0;
}

/*atcoder*/


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		//String t = sc.next();
		//long n = sc.nextLong();
		//long m = sc.nextLong();
		//long k = sc.nextLong();
		long count=0;

		for(int i=0;i<3;i++) {
			if(s.substring(i,i+1).equals(s.substring(i+1,i+2))) {
				count++;
			}else if(i!=2){
				count=0;
			}
		}
		if(count>=2) {
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
		//System.out.println(count);
	}
}




Measured memory_bytes: 21844
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <climits>
#include <iomanip>
#include <bitset>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <list>
#include <map>

using namespace std;

const int N = 200005;

long long fenw[N];

void update(int i, long long val) {
  for (; i < N; i += i & (-i)) {
    fenw[i] += val;
  }
}

long long query(int i) {
  long long ans = 0;
  for (; i > 0; i -= i & (-i)) {
    ans += fenw[i];
  }
  return ans;
}

long long query(int x, int y) {
  return (query(y) - (x > 0 ? query(x - 1) : 0));
}

int main() {
  long long n, k;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    int a, b;
    cin >> a >> b;
    update(a, b);
  }
  int l = 0, r = 1e5, ans;
  while (l <= r) {
    int mid = (l + r) >> 1;
    if (query(1, mid) >= k) {
      ans = mid;
      r = mid - 1;
    } else {
      l = mid + 1;
    }
  }
  cout << ans << endl;
  return 0;
}




Measured memory_bytes: 1024
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <fstream>
#include <iomanip>

typedef long long ll;
const ll INF = (ll)1e18 + 1;
const ll MOD = 1e9 + 7;

template<class T> std::ostream& operator << (std::ostream& os, std::vector< T > v)
{
  ll i = 0;
  for (auto x : v){os << " [" << i++ << "]" << x; if (i % 5 == 0) os << std::endl;}
  return os;
}

template<class T, class S> std::ostream& operator << (std::ostream& os, std::vector< std::pair<T, S> > vp)
{
  ll i = 0;
  for (auto p : vp){os << " [" << i++ << "]" << p.first << " " << p.second; if (i % 5 == 0) os << std::endl;}
  return os;
}

void print(){ std::cout << std::endl; }
template<typename H> void print(H head) { std::cout << head << std::endl; }
template<typename H, typename... T> void print(H head, T... tail){ std::cout << head << " ", print(tail...); }

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

  ll N, A;
  std::cin >> N >> A;

  bool judge = (N % 500) <= A;
  if (judge) {
    print("Yes");
  } else {
    print("No");
  }


  return 0;
}


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


struct UnionFind {
	vector<int> par, rank, cnt;
	UnionFind(int n) : par(n), rank(n, 0), cnt(n, 1){
		for(int i=0; i<n; ++i) par[i] = i;
	}

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

	void unite(int x, int y) {
		x = find(x); y = find(y);
		if (x == y) return;

		if (rank[x] < rank[y]) swap(x, y);

		par[y] = x;
		cnt[x] += cnt[y];
		if (rank[x] == rank[y]) rank[x]++;
	}

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

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

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

  vector<pair<int, int>> e(m);
  for(int i=0; i<m; ++i){
    int a, b; cin >> a >> b;
    e[i].first = a-1;
    e[i].second = b-1;
  }

  UnionFind uf(n);
  long long now = (long long)n*(n-1)/2;
  vector<long long> ans(m);
  for(int i=m-1; i>=0; --i){
    ans[i] = now;

    int f = e[i].first, s = e[i].second;
    if(!uf.same(f, s)){
      now -= uf.size(f) * uf.size(s);
      uf.unite(f, s);
    }
  }

  for(auto answer : ans) cout << answer << endl;
}


Measured memory_bytes: 4096
use std::collections::HashSet;
use std::io::{stdin, Read};

macro_rules! parse {
    ($iter: ident) => {
        $iter.next().unwrap().parse().unwrap()
    };
    ($iter: ident,2) => {
        (parse!($iter), parse!($iter))
    };
    ($iter: ident,3) => {
        (parse!($iter), parse!($iter), parse!($iter))
    };
    ($iter: ident,4) => {
        (parse!($iter), parse!($iter), parse!($iter), parse!($iter))
    };
    ($iter: ident, $n: ident) => {
        $iter.take($n).map(|e| e.parse().unwrap()).collect();
    };
}

fn main() {
    let mut s = String::new();
    stdin().read_to_string(&mut s).unwrap();
    let mut iter = s.split_whitespace();
    let n: usize = parse!(iter);
    let a: HashSet<usize> = parse!(iter, n);
    if n != a.len() {
        println!("NO");
    } else {
        println!("YES");
    }
}


Measured memory_bytes: 13100
#include <cmath>
#include <iostream>

using namespace std;

int main(void)
{
  int N;
  int prev[3] = {0,0,0};
  int post[3] = {0,0,0};
  int diff[3] = {0,0,0};

  cin >> N;
  
  for( int num=0;num<N;num++ )
  {
    cin >> post[0] >> post[1] >> post[2];
    for ( int i=0;i<3;i++ ) diff[i] = post[i]-prev[i];
    if ( diff[0] < abs(diff[1])+abs(diff[2]) ||
         diff[0]%2 != (abs(diff[1])+abs(diff[2]))%2 )
    {
      cout << "No";
      return 0;
    }
    for ( int i=0;i<3;i++ ) prev[i] = post[i];
  }
  cout << "Yes";
}

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

using namespace std;
#define PI 3.1415926535897932384626433832795
#define MOD (1000000007)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repc(i, s, n) for (int i = (s); i <= (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define rrepc(i, s, n) for (int i = (s); i >= (n); i--)
typedef long long ll;
typedef unsigned long long ull;

int main()
{
	int N, A, B, C, l[8], ans = 1000000000;
	int op[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };

	cin >> N >> A >> B >> C;
	rep(i, N) cin >> l[i];

	while (true) {
		bool end = true;
		int cost[3] = { 0, 0, 0 };
		int sum[3] = { 0, 0, 0 };
		bool mul[3] = { false, false, false };

		rep(i, N) {
			if (op[i] == 3) op[i] = 0;
			else {
				op[i]++;
				break;
			}
		}

		rep(i, N) if (op[i] != 3) end = false;

		rep(i, N) {
			if (op[i] != 0) {
				int id = op[i] - 1;
				if (mul[id]) cost[id] += 10;
				else mul[id] = true;
				sum[id] += l[i];
			}
		}

		if (mul[0] && mul[1] && mul[2]) {
			cost[0] += abs(A - sum[0]);
			cost[1] += abs(B - sum[1]);
			cost[2] += abs(C - sum[2]);
			ans = min(ans, cost[0] + cost[1] + cost[2]);
		}

		if (end) break;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    val (n, t) = readLine()!!.split(" ").map { it.toInt() }
    val roots = (1..n).map { readLine()!!.split(" ").map { it.toInt() } }
    val cost  = roots.filter { it[1] <= t }
    val ans = if (cost.isEmpty()) {
        "TLE"
    } else {
        cost.minBy { it[0] }!![0].toString()
    }
    println(ans)
}

Measured memory_bytes: 38032
#include<string>
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdlib>
using namespace std;
int main(){
  string str,s1,s2;
  int n;
  cin >> n;
  vector<int>data(n);
  for(int i=0;i<n;i++){
    cin >> data[i];
  }
  sort(data.begin(),data.end());
  vector<int>ddata;
  for(int i=0;i<min(20,n);i++){
    for(int j=0;j<min(20,n);j++){
      if(i==j)continue;
      int left=data[i],right=data[j];
      while(right!=0) right/=10,left*=10;
      ddata.push_back(left+data[j]);
    }
  }
  sort(ddata.begin(),ddata.end());
  cout << ddata[2] << endl;
}

Measured memory_bytes: 1252
#include<bits/stdc++.h>
#define fi first
#define se second
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define rep2(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define rev(i, n) for (int (i) = (n)-1; (i) >= 0; (i)--)
#define rev2(i, a, b) for (int (i) = (a)-1; (i) >= (b); (i)--)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define pb push_back
#define eb emplace_back
#define yn {puts("Yes");}else {puts("No");}
using namespace std;
using ll = long long;
using P = pair<int, int>;
using Pll = pair<long long, long long>;
template<class T> using Vec = vector<T>;
template<class T> using VVec = vector<vector<T>>;
long long TEN(int i) {return !i ? 1 : TEN(i-1)*10LL;}
template<class T, class U> 
bool chmin(T& a, const U& b) {if (a > b) {a = b; return 1;} return 0;}
template<class T, class U> 
bool chmax(T& a, const U& b) {if (a < b) {a = b; return 1;} return 0;}

struct IoSetup {
	IoSetup() {
		cin.tie(nullptr);
		ios::sync_with_stdio(false);
		cout << fixed << setprecision(10);
	}
} iosetup;

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//

void solve() {

}

int main() {
	int R;
	cin >> R;
	if (R < 1200) cout << "ABC" << endl;
	else if (R < 2800) cout << "ARC" << endl;
	else cout << "AGC" << endl;
	
	return 0;
}

Measured memory_bytes: 3616
#include<stdio.h>
int main()
{
    char s[5];
    scanf("%s", s);
    int i;
    int ans = 0;
    for (i = 0; i < 4; i++)
    {
        if (s[i] == '+')
            ans++;
        else
            ans--;
    }
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define all(c) (c).begin(),(c).end()
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define iter(c) __typeof((c).begin())
#define tr(it,c) for(iter(c) it=(c).begin(); it!=(c).end(); it++)
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define pr(a) cout << (a) << endl
#define F first
#define S second
typedef long long ll;
typedef pair<int,int> P;
const int MAX=2000000001;
int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

int ch[26]={'0','0','0','0','0','0','0','1','1','1','1','1','1','1','1','1','0','0','0','0','1','0','0','0','1','0'};

int main() {
  string s;
  while(cin >> s && s!="#") {
    int a=ch[(int)s[0]-'a'];
    int cnt=0;
    rep(i,s.size()) {
      int b=ch[(int)s[i]-'a'];
      cnt+=abs(a-b);
      a=b;
    }
    pr(cnt);
  }
  return 0;
}


Measured memory_bytes: 1184
package main

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

func getNextLine(scanner *bufio.Reader) string {
	var buffer string
	for {
		line, isPrefix, _ := scanner.ReadLine()
		buffer += string(line)
		if isPrefix == false {
			break
		}
	}
	return buffer
}

func getIntList(scanner *bufio.Reader) []int {
	list := strings.Split(getNextLine(scanner), " ")
	l := len(list)
	result := make([]int, l)
	for i := 0; i < l; i++ {
		result[i], _ = strconv.Atoi(list[i])
	}
	return result
}

func main() {
	fp := os.Stdin
	if len(os.Args) > 1 {
		fp, _ = os.Open(os.Args[1])
	}

	scanner := bufio.NewReader(fp)

	var n, m, q, l, r int

	fmt.Sscan(getNextLine(scanner), &n, &m, &q)
	counter := make([][]int, n+1)
	for i := 0; i <= n; i++ {
		counter[i] = make([]int, n+1)
	}
	for i := 0; i < m; i++ {
		lr := getIntList(scanner)
		l, r = lr[0], lr[1]
		counter[l][r]++
	}
	for i := 1; i <= n; i++ {
		for j := 1; j <= n; j++ {
			counter[i][j] += counter[i][j-1]
		}
	}
	for i := 1; i <= n; i++ {
		for j := 1; j <= n; j++ {
			counter[i][j] += counter[i-1][j]
		}
	}
	for i := 0; i < q; i++ {
		lr := getIntList(scanner)
		l, r = lr[0], lr[1]
		fmt.Println(counter[r][r] - counter[l-1][r] - counter[r][l-1] + counter[l-1][l-1])
	}
}


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

public class Main {
	public static void main(String[] args){

		//????????£?????????????????§????????????????????????
		//????????\???
		Scanner sc = new Scanner(System.in);
		//int???????????????a
		int a = sc.nextInt();
	     //int???????????????b
		int b = sc.nextInt();
	     //int???????????? ???
		int c = sc.nextInt();
		int i;
		//??????????????\??????
		int[] arr = new int[] {a,b,c};
		Arrays.sort(arr);
		for(  i = 0; i < arr.length; i++){
			if (i == 2){
				System.out.println(arr[i]);
				
			}else {
				System.out.print(arr[i] + " ");
			}

		}
	}
}

Measured memory_bytes: 26192
import java.util.Scanner;
import java.lang.Math;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
			int N =sc.nextInt();		
			int []A=new int[N];
			int max=-100;
			int min=1000000000;
						
			for(int i=0;i<N;i++){
				A[i]=sc.nextInt();
			}
			for(int i=0;i<N;i++){
				min=Math.min(min,A[i]);
				max=Math.max(max,A[i]);
			}
			System.out.println(max-min);
		}
}

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

// 簡易UF
struct UF{
    vector<int> p, cnt;
    int n;

    UF(int siz){
        n = siz;
        p.resize(n, 0);
        cnt.resize(n, 1);
        for(int i = 0; i < n; i++)  p[i] = i;
    }

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

    bool same(int x, int y){
        return parent(x) == parent(y);
    }
    
    void unite(int x, int y){
        x = parent(x), y = parent(y);
        if(x == y)  return;
        cnt[y] += cnt[x];
        p[x] = y;
    }
};

int main(){
    int n, m, k;
    cin >> n >> m >> k;
    vector<int> ans(n, 0), deg(n, 0);
    UF uf(n);
    while(m--){
        int a, b;
        cin >> a >> b;
        a--, b--;
        uf.unite(a, b);
        deg[a]++, deg[b]++;
    }
    for(int i = 0; i < n; i++)  ans[i] = uf.cnt[uf.parent(i)]-deg[i]-1;
    while(k--){
        int a, b;
        cin >> a >> b;
        a--, b--;
        if(uf.same(a, b)){
            ans[a]--, ans[b]--;
        }
    }
    for(int i = 0; i < n; i++)  cout << ans[i] << " \n"[i==n-1];
    return 0;
}

Measured memory_bytes: 3200
#include<bits/stdc++.h>
using namespace std;
const int maxn=600;
int a[maxn];
int n,k;
int sum=0;
bool solve(int x)
{
    vector<int>s;
    for(int i=0;i<n;i++)
    {
        s.push_back(a[i]%x);
    }
    sort(s.begin(),s.end());
    int l=0,r=s.size()-1;
    int su=0;
    int toal=0;
    while(l<=r)
    {
          if(su<=0)
          {
              su+=s[l];
              toal+=s[l];
              l++;
          }
          else
          {
              su-=(x-s[r]);
              toal+=(x-s[r]);
              r--;
          }
    }
    if(toal>2*k||su!=0)
        return false;
    else
        return true;
}
int main()
{
    cin>>n>>k;
    for(int i=0;i<n;i++)
        cin>>a[i],sum+=a[i];
        int ans=1;
    for(int i=1;i*i<=sum;i++)
    {
         if(solve(i))
            ans=max(ans,i);
         if(solve(sum/i))
            ans=max(ans,sum/i);
    }
    cout<<ans<<endl;
    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[] strArgs) throws Exception {
		BufferedReader br = null;

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

			String[] strValues = readValues(br);

			int iSummerDays = toInt(strValues[0]);
			int iWorkCount = toInt(strValues[1]);

			strValues = readValues(br);

			int iWorkDays = 0;
			for (String strWorkDay : strValues) {
				iWorkDays += toInt(strWorkDay);
			}

			int iPlayDays = iSummerDays - iWorkDays;
			if (iPlayDays < 0) {
				iPlayDays = -1;
			}

			System.out.println(iPlayDays);

		} finally {
			br.close();
		}
	}

	private static String[] readValues(BufferedReader br) throws IOException {
		return br.readLine().split("\\s");
	}

	private static int toInt(String str) {
		return Integer.parseInt(str);
	}
}


Measured memory_bytes: 35896
def solve(string):
    h, w, d, *a = map(int, string.split())
    n = h * w
    a, q, lr = a[:n], a[n], a[n + 1:]
    index = [0] * n
    for i, _a in enumerate(a):
        index[_a - 1] = i
    diff = [0] * d + [
        abs(i0 // w - i1 // w) + abs(i0 % w - i1 % w) for i0, i1 in zip(index, index[d:])
    ]
    for i in range(n):
        if i >= d:
            diff[i] += diff[i - d]
    return "\n".join([str(diff[r - 1] - diff[l - 1]) for l, r in zip(lr[::2], lr[1::2])])


if __name__ == '__main__':
    n, m, d = map(int, input().split())
    ins = '{} {} {}\n'.format(n, m, d) + '\n'.join([input() for _ in range(n)])
    n = int(input())
    print(solve(ins + '\n{}\n'.format(n) + '\n'.join([input() for _ in range(n)])))


Measured memory_bytes: 36768
a[20],z=1e4,n;*p;main(m){for(;scanf("%d%d",&m,&n)*n;puts(a))for(*a=1;~n--;)for(p=a+18;p-->a;)*p=~n?p[1]+=*p*m/z,*p*m%z:*p&&!printf("%d%.3s",*p,"MtsFksNytAsgGgsGokSaiSeiKanKo\0JouJo\0GaiKeiChoOkuMan"+(a-p+17)*3);}

Measured memory_bytes: 616
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) debug(x) debug(y);
#define repn(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, a) for(int i = 0; i < (int)(a); i++)
#define all(v) v.begin(), v.end() 
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define sq(x) ((x) * (x))

template<class T> T gcd(T a, T b){ return ((b == 0) ? a : gcd(b, a % b)); }

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	//freopen("input.in", "r", stdin);
	//freopen("output.out", "w", stdout);
	int n;
	cin >> n;
	vi a(n);
	unordered_map<int, int> m;
	rep(i, n) cin >> a[i], m[a[i]]++;
	int ans = n;
	for(pi x : m){
		if(x.fi < x.se) ans -= x.se - x.fi;
		else if(x.fi > x.se) ans -= x.se;
	}
	cout << n - ans << endl;
	return 0;
}
/*
Things to look out for:
	- Integer overflows
	- Array bounds
	- Special cases
Be careful!
*/


Measured memory_bytes: 4644
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=5e18;

int main() {
  ll n;
  cin >> n;
  ll f;
  for(ll i=1;i<=n;i++) {
    if(i*(i+1)/2>=n) {
      f=i;
      break;
    } 
  }
  ll sum=f*(f+1)/2;
  for(ll i=1;i<=f;i++) {
    if(sum-i==n) continue;
    cout << i << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <deque>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <complex>
#include <functional>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cctype>

using namespace std;

#define dump(n) cout<<"# "<<#n<<"="<<(n)<<endl
#define debug(n) cout<<__FILE__<<","<<__LINE__<<": #"<<#n<<"="<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,n) repi(i,0,n)
#define iter(c) __typeof((c).begin())
#define tr(c,i) for(iter(c) i=(c).begin();i!=(c).end();i++)
#define allof(c) (c).begin(),(c).end()
#define mp make_pair

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int,int> pii;

string decrypt(const string& c,int a,int b)
{
	int table[26];
	rep(i,26)
		table[(a*i+b)%26]=i;
	string res=c;
	rep(i,c.size())
		if(islower(c[i]))
			res[i]=table[c[i]-'a']+'a';
	return res;
}

int main()
{
	int n;
	cin>>n;
	cin.get();
	rep(loop,n){
		string c;
		getline(cin,c);
		repi(i,1,26){
			if(i==2 || i==13)
				continue;
			rep(j,26){
				string d=decrypt(c,i,j);
				string temp=" "+d+" ";
				if(temp.find(" that ")!=string::npos || temp.find(" this ")!=string::npos){
					cout<<d<<endl;
					goto end;
				}
			}
		}
		end:
		;
	}
	
	return 0;
}

Measured memory_bytes: 0