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

const int N = 100009;
const int M = N << 1;

int n, m, head[N], nxt[M], to[M], vis[N];
deque<int> ans;

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

inline void AddEdge(int u, int v) {
	static int E = 1;
	to[++E] = v; nxt[E] = head[u]; head[u] = E;
	to[++E] = u; nxt[E] = head[v]; head[v] = E; 
}

int main() {
#ifdef DBG
	freopen("11input.in", "r", stdin);
#endif	
	n = read(), m = read();
	for (int i = 1; i <= m; i++) {
		int u = read(), v = read();
		AddEdge(u, v);
		if (i == 1) {
			ans.push_back(u);
			ans.push_back(v);
			vis[u] = vis[v] = 1;
		}
	}
	for (int mk = 1; mk; ) {
		mk = 0;
		for (int i = head[ans.front()]; i; i = nxt[i]) {
			if (!vis[to[i]]) {
				mk = 1;
				ans.push_front(to[i]);
				vis[to[i]] = 1;
				break;
			}
		}
	}
	for (int mk = 1; mk; ) {
		mk = 0;
		for (int i = head[ans.back()]; i; i = nxt[i]) {
			if (!vis[to[i]]) {
				mk = 1;
				ans.push_back(to[i]);
				vis[to[i]] = 1;
				break;
			}
		}
	}
	cout<<ans.size()<<endl;
	for (; !ans.empty(); ans.pop_front()) {
		printf("%d ", ans.front());
	}
	return 0;
}



Measured memory_bytes: 3456
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;

const ll INF = 1LL << 62;
int N, K;
int x[50], y[50];

ll calc(int l, int r, int d, int u) {
  int sum = 0;
  for (int i = 0; i < N; i++) {
    if (!(x[l] <= x[i] && x[i] <= x[r] && y[d] <= y[i] && y[i] <= y[u])) continue;
    sum++;
  }
  if (sum < K) return INF;
  return (ll)(x[r] - x[l]) * (y[u] - y[d]);
}

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

  cin >> N >> K;
  for (int i = 0; i < N; i++) {
    cin >> x[i] >> y[i];
  }  
  ll ans = INF;
  for (int l = 0; l < N; l++) {
    for (int r = 0; r < N; r++) {
      for (int d = 0; d < N; d++) {
        for (int u = 0; u < N; u++) {
          if (!(x[l] <= x[r] && x[l] <= x[d] && x[l] <= x[u])) continue;
          if (!(x[r] >= x[l] && x[r] >= x[d] && x[r] >= x[u])) continue;
          if (!(y[d] <= y[l] && y[d] <= y[r] && y[d] <= y[u])) continue;
          if (!(y[u] >= y[l] && y[u] >= y[r] && y[u] >= y[d])) continue;
          ans = min(ans, calc(l, r, d, u));
        }
      }
    }
  }
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
    int i, max, min;
    int n, R;
    
    scanf("%d", &n);
    scanf("%d", &R); /* R[0] */
    min = R;
    scanf("%d", &R); /* R[1] */
    max = R - min;
    if ( min > R)
        min = R;
    
    for ( i=2; i<n; ++i) {
        scanf("%d", &R); /* R[i] */
        if ( max < R - min)
            max = R - min;
        if ( min > R)
            min = R;
    }
    printf("%d\n", max);
    return 0;
}


Measured memory_bytes: 2104
#include <algorithm>
#include <climits>
#include <iostream>
#include <random>
#include <stack>
#include <string>
#include <unordered_set>
#include <vector>

using std::cin;
using std::cerr;
using std::cout;
using std::endl;
using std::make_pair;
using std::pair;
using std::stack;
using std::string;
using std::unordered_set;
using std::vector;
using std::lower_bound;
using std::upper_bound;

int main(int argc, char* argv[]) {
  int m, n;
  cin >> m >> n;
  cout << (m * (m - 1) + n * (n - 1)) / 2;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstring>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>
#include <fstream>

using namespace std;

#define REP(i, n) for(ll i = 0;i < n;i++)
#define REPR(i, n) for(ll i = n;i >= 0;i--)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
#define FORR(i, m, n) for(ll i = m;i >= n;i--)
#define REPO(i, n) for(ll i = 1;i <= n;i++)
#define ll long long
#define INF (ll)1 << 60
#define MINF (-1 * INF)
#define ALL(n) n.begin(),n.end()
#define MOD 1000000007
#define P pair<ll, ll>


ll c, d, cnt = 1;
int main() {
	ll n;
	cin >> n;
	vector<ll> a(n), b(n), s;
	
	REP(i, n)cin >> a[i];
	REP(i, n)cin >> b[i];
	REP(i, n)s.push_back(i + 1);
	do {
		bool ok = true;
		REP(i, n) if (s[i] != a[i])ok = false;
		if (ok)c = cnt;
		ok = true;
		REP(i, n) if (s[i] != b[i])ok = false;
		if (ok)d = cnt;
		cnt++;
	} while (next_permutation(ALL(s)));
	cout << abs(c - d) << endl;
}


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

#define ll long long 
#define sz(x) (int)x.size()

using namespace std;

int main(){
		string s;
		cin>>s;
		int x=0,y=0;
		for(int i=0;i<sz(s);i++){
			x+=s[i]=='1';
			y+=s[i]=='0';
		}
		cout<<min(x,y)*2;
}





Measured memory_bytes: 3768
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define pb push_back
#define ll long long
#define endl "\n"
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define hell 1000000007
#define ff first
#define ss second
#define pii pair<ll,ll>
#define upd upper_bound
#define lbd lower_bound
#define vi vector<ll>
#define vii vector<pii>
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pi acos(-1.0)

using namespace std;
using namespace __gnu_pbds;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define N 200005

ll i=0,j=0;

ll powr(ll a,ll b)
{
    ll i=0;
    ll ans=1;
    for(i=1;i<=b;i++)
    {
        ans*=a;
    }
    return ans;
}

int main()
{
    IOS;
    ll n,k;
    cin>>n>>k;
    ll arr[n+1];
    for(i=1;i<=n;i++)
    {
        cin>>arr[i];
    }
    ll dp[n+1];
    memset(dp,0,sizeof(dp));
    for(i=1;i<=n;i++)
        dp[i]=hell;
    dp[1]=0;
    dp[2]=abs(arr[1]-arr[2]);
    for(i=3;i<=n;i++)
    {
        for(j=i-1;j>=max(1LL,i-k);j--)
        {
            dp[i]=min(dp[i],dp[j]+abs(arr[j]-arr[i]));
        }
    }
    cout<<dp[n]<<endl;
}



Measured memory_bytes: 1792
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using bint = boost::multiprecision::cpp_int;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repSE(i,s,n) for (int i = (s); i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main()
{
    int L;
    cin >> L;
    double ret = pow(L/3.0, 3);
    printf("%.8f\n", ret);
    return 0;
}


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

#define FOR(i, a, b) for(int (i)=(a); (i)<(b); (i)++)
#define INF 1000000000+10
using namespace std;

int main() {
	int x, a, b;
	cin >> x >> a >> b;
	if(a >= b) cout << "delicious" << endl;
	else if( a+x >= b) cout << "safe" << endl;
	else cout << "dangerous" <<endl;
	return 0;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)]
def dp2(ini, i, j): return [[ini]*i for _ in range(j)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from collections import Counter # a = Counter(A).most_common()
#from itertools import accumulate #list(accumulate(A))

A = sorted(li())

print(A[0] * A[1] // 2)

Measured memory_bytes: 9200
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

public class Main {
	final Set<Integer> A;
	final Map<Integer, Integer> map;

	public Main(int n, Set<Integer> a) {
		A = a;
		map = new HashMap<>(n);
	}

	public static void main(String[] args) {
		try (Scanner s = new Scanner(System.in)) {
			int n = s.nextInt();
			final int M = s.nextInt();
			Set<Integer> a = IntStream.generate(s::nextInt).limit(M).boxed().collect(Collectors.toSet());

			Main target = new Main(n, a);
			System.out.println(target.move(n));
		}
	}

	int move(int x) {
		if(x == 0) {
			return 1;
		}

		if(A.contains(x)) {
			return 0;
		}

		if(x == 1) {
			return 1;
		}

		if(map.containsKey(x)) {
			return map.get(x);
		} else {
			int v = (move(x - 1) + move(x - 2)) % 1000000007;
			map.put(x, v);
			return v;
		}
	}
}


Measured memory_bytes: 67632
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key

typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef long double ld;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

const long long mod = 1000000007;
const long long inf = 1e18;

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n;
    cin>>n;
    vi a,b,c;
    for(int i=0;i<n;i++){
        int k;
        cin>>k;
        a.pb(k);
    }
    for(int i=0;i<n;i++){
        int k;
        cin>>k;
        b.pb(k);
    }
    for(int i=0;i<n;i++){
        int k;
        cin>>k;
        c.pb(k);
    }
    c.pb(-1);
    sort(a.begin(),a.end());
    sort(b.begin(),b.end());
    sort(c.begin(),c.end());
    ll ans[2][n+1];
    for(int i=0;i<=n;i++){
        ans[1][i]=0;
    }
    int index=n-1;      // index for b
    int i=0;            // i for c
    while(index>=0 && i<=n+1){
        if(c[n-i]<=b[index]){
            ans[1][index]=ans[1][index+1]+i;
            index-=1;
        }
        else{
            i+=1;
        }
    }
    index=0;
    ll count=0;
    int ca=0;
    for(int i=0;i<n;i++){
        for(int j=index;j<n;j++){
            if(b[j]>a[i]){
                count+=ans[1][j];
                index=j;
                break;
            }
            else{
                if(j==n-1){
                    ca=1;
                }
            }
        }
        if(ca==1){
            break;
        }
    }
    cout<<count<<endl;
    return 0;
}


Measured memory_bytes: 2296
import java.util.Scanner;

class Main {
    static int[] dp;

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        dp = new int[n + 1];
        dp[0] = 0;
        // 1円ずつ払う
        for (int i = 1; i < n + 1; i++) {
            dp[i] = dp[i - 1] + 1;
        }
        for (int six = 1; six <= n; six *= 6) {
            for (int j = 1; j < n + 1; j++) {
                if (j - six < 0) {
                    continue;
                }
                dp[j] = Math.min(dp[j - six] + 1, dp[j]);
            }
        }
        for (int nine = 1; nine < n + 1; nine *= 9) {
            for (int j = 1; j < n + 1; j++) {
                if (j - nine < 0) {
                    continue;
                }
                dp[j] = Math.min(dp[j - nine] + 1, dp[j]);
            }
        }
        System.out.println(dp[n]);
        sc.close();
    }
}

Measured memory_bytes: 22100
def xor(n):
    ans = None
    if (n + 1) % 2 == 0:
        if ((n + 1) // 2) % 2 == 0:
            ans = 0
        else:
            ans = 1
    else:
        if ((n +  1) // 2) % 2 == 0:
            ans = 0 ^ n
        else:
            ans = 1 ^ n
    return ans

A, B = tuple(map(int, input().split()))
print(xor(A-1) ^ xor(B))

Measured memory_bytes: 3060
//自称高知能系Vtuberの高井茅乃です。
//Twitter: https://twitter.com/takaichino
//YouTube: https://www.youtube.com/channel/UCTOxnI3eOI_o1HRgzq-LEZw

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

#define INF 1999999999
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define MODA 1000000007 

int main() {
    int ans = 0;
	int n, fi= -1, se = -1, a[200000];
	cin >> n;
	REP(i, n){
		cin >> a[i];
		if(a[i] >= fi)
		{
			se = fi;
			fi = a[i];
		}
		else if(a[i] >= se)
		{
			se = a[i];
		}
	}
	REP(i,n)
	{
	    if(a[i] == fi )cout << se << endl;
		else cout << fi << endl;
	}

}

Measured memory_bytes: 2432
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli; 
string s;
lli a,b,c,t,temp1,temp2,x,y,temp,q,d,k,mod=1e9+7;

long double l;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	
	cin>>l;
	
	long double ans= (l/3)*(l/3)*(l/3);
	cout<<fixed<<setprecision(8)<<ans<<endl;
}


Measured memory_bytes: 3748
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF (1<<30)
#define INFLL (1ll<<60)
typedef pair<ll, ll> P;
#define MOD (1000000007ll)
#define l_ength size

vector<int> g[225816];

int main(void){
	ll k,n=50,i,j,a[55],mn;
	cin >> k;
	for(i=0ll; i<n; ++i){
		a[i] = k/50+i;
	}
	k %= 50;
	for(i=0ll; i<(k%50); ++i){
		mn = INFLL;
		for(j=0ll; j<50ll; ++j){
			--a[j];
			mn = min(mn,a[j]);
		}
		for(j=0ll; j<50ll; ++j){
			if(mn == a[j]){
				++a[j];
				a[j] += 50ll;
			}
		}
	}
	cout << "50" << endl;
	for(i=0ll; i<50ll; ++i){
		cout << ((i)?" ":"") << a[i];
	}
	cout << endl;
	return 0;
}


Measured memory_bytes: 5504
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    int N;
    cin >> N;
    vector<int>data(N);
    for(int i=0;i<N;i++){
        cin >> data.at(i);
    }
    
    for(int i=N-1;i>=0;i--){
        cout << data.at(i);
        if(i==0){
            break;
        }
        cout << " ";
    }
    
    cout << endl;
    
}


Measured memory_bytes: 3096
#include<bits/stdc++.h>
using namespace std;
#define FastRead ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long int
#define ld long double
#define FOR(i,a,n) for (int i=(a);i<=(n);++i)
#define RFOR(i,a,n) for (int i=(n);i>=(a);--i)
#define FI(i,n) for (int i=0; i<(n); ++i)
#define ZERO(a) memset((a),0,sizeof((a)))
#define f first
// #define s second
#define pb push_back
#define mk make_pair
#define all(g) g.begin(),g.end()
int fastMax(int x, int y) { return (((y-x)>>(32-1))&(x^y))^y; }
int fastMin(int x, int y) { return (((y-x)>>(32-1))&(x^y))^x; }

// #include <ext/pb_ds/assoc_container.hpp> // Common file
// #include <ext/pb_ds/tree_policy.hpp>     // Including tree_order_statistics_node_updat
// using namespace __gnu_pbds;
// typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

// I am questioning life and universe and 
// everything else after looking at this

void solve(){
    char c; cin>>c;

    if(c == 'A') cout<<'T'<<endl;
    if(c == 'T') cout<<'A'<<endl;
    if(c == 'C') cout<<'G'<<endl;
    if(c == 'G') cout<<'C'<<endl;
    
}

signed main(){


    FastRead;    

    ll t;
    t = 1; 
    // cin>>t;
    FOR(tt,1,t){
        solve();
    }
    
}

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

const char nl = '\n';

int main() {
    ll x; cin >> x;
    ll s = 100;
    for (ll i = 1;; i++) {
        s = s * 1.01;
        if (s >= x) {
            cout << i << nl;
            return 0;
        }
    }
    return 0;
}



Measured memory_bytes: 3632
#include <bits/stdc++.h>
//#include <atcoder/all>
using namespace std;
//using namespace atcoder;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
typedef long long ll;
#define ALL(v) v.begin(), v.end()
#define vmax(v) *max_element(ALL(v))
#define vmin(v) *min_element(ALL(v))
#define chmax(x, a) x = max(x, a)
#define chmin(x, a) x = min(x, a)

void YesNo(bool x) {
    if (x) cout << "Yes" << endl;
    else cout << "No" << endl;
}

int main() {
    int N; cin >> N;
    int cnt = 0;
    int ans = 0;
    rep(i, N) {
        int d1, d2; cin >> d1 >> d2;
        if (d1 == d2) cnt++;
        else {
            chmax(ans, cnt);
            cnt = 0;
        }
    }
    chmax(ans, cnt);
    YesNo(ans >= 3);
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vii = vector<vi>;
using in6 = int64_t;
using ind = double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  int n;
  cin >> n;
  vi data(n);
  rep(i,n) cin >> data[i];
  int mini = data[0];
  int ans = 0;
  rep(i,n) {
    mini = min(mini,data[i]);
    if(data[i] == mini) ans++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 1024
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

n = read().rstrip().decode()[::-1]
hon = ['2', '4', '5', '7', '9']
pon = ['0', '1', '6', '8']
if n[0] in hon:
    print('hon')
elif n[0] in pon:
    print('pon')
else:
    print('bon')


Measured memory_bytes: 9048
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
const double EPS = 1e-9;
#define INF (1LL<<60)
#define D double
#define fs first
#define sc second
#define int long long
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define RFOR(i,a,b) for(int i = (int)(b-1);i>=(int)(a);--i)
#define REP(i,n)  FOR(i,0,(n))
#define RREP(i,n) RFOR(i,0,(n))
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x)  cout << #x << " = " << (x) << endl;
#define SP << " " << 
typedef pair<int,int> P;
typedef vector<int> vec;
typedef vector<vector<int>> mat;

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

  int w, h, n;
  cin >> w >> h >> n;
  vec x(n), y(n), a(n);
  REP(i, n) cin >> x[i] >> y[i] >> a[i];

  int x_max = w, y_max = h, x_min = 0, y_min = 0;

  REP(i, n){
    switch(a[i]){
    case 1:
      x_min = max(x_min, x[i]);
      break;
    case 2:
      x_max = min(x_max, x[i]);
      break;
    case 3:
      y_min = max(y_min, y[i]);
      break;
    case 4:
      y_max = min(y_max, y[i]);
      break;
    }
  }

  int ans_x = max(0ll, x_max - x_min);
  int ans_y = max(0ll, y_max - y_min);

  cout << ans_x * ans_y << endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, start, end) for (long long i = start; i < end; ++i)
#define repreverse(i, start, end) for (long long i = start; i >= end; --i)
#define all(x) (x).begin(), (x).end()
#define len(x) ((long long)(x).size())
#define lcm(a, b) ((a) / __gcd((a), (b)) * (b))
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vllvll = vector<vll>;
using pll = pair<ll, ll>;
template<class T>void print1d(T x,ll n=-1){if(n==-1)n=x.size();rep(i,0,n){cout<<x[i]<<' ';}cout<<'\n';}
template<class T>void print2d(T x,ll r=-1,ll c=-1){if(r==-1)r=x.size();if(c==-1)c=x[0].size();rep(i,0,r)print1d(x[i],c);}
template<class T, class U>bool haskey(T mp, U key) { return mp.find(key) != mp.end(); }
template<class T, class U>bool isin(T el, U container) { return find(all(container), el) != container.end(); }
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; }
template<class T>bool even(T n) { return ! (n & 1); }
template<class T>bool odd(T n) { return n & 1; }
template<class T>ld deg2rad(T deg) { return M_PI * deg / 180.0; }
template<class T>ld rad2deg(T rad) { return 180.0 * rad / M_PI; }
ll intpow(ll a,ll n){ll p=1;while(n){if(n&1)p*=a;a*=a;n>>=1;}return p;}
const long double pi = M_PI;
const long long big = 1LL << 50;
const long long inf = 1LL << 60;
const long long mod = 1e9 + 7;



int main()
{
        ll N;
        cin >> N;
        vll a(N);
        rep(i, 0, N) cin >> a[i];

        vll l(N+1), r(N+1);
        rep(i, 0, N) {
                l[i+1] = l[i]  ^ a[i];
        }

        repreverse(i, N-1, 0) {
                r[i] = r[i+1] ^ a[i];
        }

        rep(i, 0, N) {
                ll ans = l[i] ^ r[i+1];
                cout << ans;
                if (i != N-1) cout << ' ';
                else cout << endl;
        }
}

Measured memory_bytes: 7932
a, b, C= gets.chomp.split.map(&:to_i)
rad = C * Math::PI / 180.0

S = (a * b * Math.sin(rad)) / 2
c = ((a ** 2) + (b ** 2)) - 2 * a * b * Math.cos(rad)
L = a + b + Math.sqrt(c)
h = Math.sin(rad) * b
puts "#{sprintf("%.9f", S)}"
puts "#{sprintf("%.9f", L)}"
puts "#{sprintf("%.9f", h)}"

Measured memory_bytes: 9004
/*------------------------------------
........Bismillahir Rahmanir Rahim....
..........created by Abdul Aziz.......
------------------------------------*/
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <cstring>
#include <unordered_map>
#include <queue>
#define   mod  998244353
#define   int  long long 
#define   ld   long double
#define   pb   push_back
#define   vi  vector<int> 
#define   dbg(x)  cerr << #x << " = " << x << '\n'
#define   sz(x)  (int)x.size()
#define   all(a) (a.begin(),a.end())
#define   ff   first
#define   ss   second
#define   pii  pair<int,int> 
#define   lcm(a,b) (a*b)/__gcd(a,b) 
using namespace std; 

inline void solve(){ 
    int n,ans=0; 
    cin >> n ; 
    if (n&1^1) { 
    	while (n>9){ 
    		ans += n/10; 
    		n /= 5; 
    	} 
    } 
    cout << ans << endl; 
}

signed main() 
{ 
    int n=1; // cin>>n; 
    while (n--) solve(); 
    return 0; 
} 
/*
200->40->8->5

20+4+0+0=24
*/

Measured memory_bytes: 3636
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.Map.Entry;
import java.util.PriorityQueue;
import java.util.StringTokenizer;
 
public class Main {
	
	public static void main(String[] args) throws IOException {
		try(final Scanner sc = new Scanner(System.in)){
			final int N = sc.nextInt();
			
			long answer = 0;
			for(int i = 0; i < N; i++) {
				answer += sc.nextLong() - 1;
			}
			
			System.out.println(answer);
		}
	}
 
	public static class Scanner implements Closeable {
		private BufferedReader br;
		private StringTokenizer tok;
 
		public Scanner(InputStream is) throws IOException {
			br = new BufferedReader(new InputStreamReader(is));
		}
 
		private void getLine() throws IOException {
			while(!hasNext()){
				tok = new StringTokenizer(br.readLine());
			}
		}
 
		private boolean hasNext() {
			return tok != null && tok.hasMoreTokens();
		}
 
		public String next() throws IOException {
			getLine();
			return tok.nextToken();
		}
 
		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}
 
		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}
 
		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}
 
		public int[] nextIntArray(int n) throws IOException {
			final int[] ret = new int[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextInt();
			}
			return ret;
		}
 
		public long[] nextLongArray(int n) throws IOException {
			final long[] ret = new long[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextLong();
			}
			return ret;
		}
 
		public void close() throws IOException {
			br.close();
		}
	}
}

Measured memory_bytes: 22612
package main

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

func numArrayToString(iary []int) []string {
	ary := make([]string, len(iary))
	for i, v := range iary {
		ary[i] = strconv.Itoa(v)
	}
	return ary
}

func main() {
	var a, b, c int
	fmt.Scanf("%d %d %d", &a, &b, &c)
	ary := []int{a, b, c}
	sort.Sort(sort.IntSlice(ary))

	fmt.Println(strings.Join(numArrayToString(ary), " "))
}



Measured memory_bytes: 1140
#include<stdio.h>

int main()
{
	int a,b;
	int r;
	int swp;
	

	scanf("%d %d",&a,&b);
/*
	if(a<b){
		swp = a;
		a = b;
		b = a;
	}
*/
	while( (r=a%b) != 0){
		a=b;
		b=r;
	}
	printf("%d\n",b);
	return 0;
}



Measured memory_bytes: 2104
#include <iostream>
#include <set>

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

    std::set<int> s;
    s.insert(a);
    s.insert(b);
    s.insert(c);
    
    if(s.size() != 2) {
        std::cout << "No" << std::endl;
    } else {
        std::cout << "Yes" << std::endl;
    }
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<functional>
#include<string.h>
#include<bitset>
#include<set>
#include<cstdio>
using namespace std;

int main(){
	int n, k, ruiseki[11][2001] = {}, dp[11][2001] ={};
	int a, b;
	vector<int> books[11];
	cin >> n >> k;
	for(int i = 0; i < n;i++){
		scanf("%d%d", &a, &b);
		books[b].push_back(-a);
	}
	for(int i = 1; i < 11; i++){
		sort(books[i].begin(), books[i].end());
		for(int j = 0; j < books[i].size(); j++){
			ruiseki[i][j + 1] = -books[i][j] + ruiseki[i][j] + j * 2;
		}
	}

	for(int i = 1; i < 11; i++){
		for(int j = 0; j <= k; j++){
			for(int l = 0; l + j <= k; l++){
				dp[i][l + j] = max(max(dp[i][l + j], dp[i - 1][l + j]), max(dp[i - 1][j] + ruiseki[i][l], dp[i - 1][l] + ruiseki[i][j]));
			}
		}
	}
	cout << dp[10][k] << endl;
}

Measured memory_bytes: 1460
import java.util.*;

public class Main {
    static int n, k;
    static int[] a;
    static int modP = 1000000007;
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        n = in.nextInt();
        k = in.nextInt();
        a = new int[n];
        for(int i = 0; i < n; i++) a[i] = in.nextInt();

        int ans = (int)Math.ceil((double)(n - 1) / (double)(k - 1));

        System.out.println(ans);
    }
}


Measured memory_bytes: 50292
#include<bits/stdc++.h>
using namespace std;
 
#define pb push_back
#define ll long long
#define maxn 300005
#define fr(i,j,k) for(int i=j;i<k;i++)
#define f(n) fr(i,0,n)
#define f1(n) fr(i,1,n+1)
#define ms(i) memset(i,0,sizeof(i));
#define ms1(i) memset(i,-1,sizeof(i));
#define F first
#define S second
#define all(x) x.begin(), x.end()
const int mod = 1e9+7;

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	ll a;
	double b;
	cin >> a >> b;
	ll B = (ll)(b * 100);
	cout << a * B / 100 << '\n';
}


Measured memory_bytes: 3728
#include <iostream>
#include <utility>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <stack>
#include <set>
#include <deque>
#include <cmath>
#include <cassert>

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

int main() {
    int l, r, d;
    cin >> l >> r >> d;
    int ans = 0;
    for (int i = l; i <= r; ++i) {
        if (i % d == 0) ++ans;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3620
N,M,X=list(map(int,input().split()))
C=[list(map(int,input().split())) for i in range(N)]
result=[]
for i in range(2**N):
    A=[]
    for j in range(N):
        if (i>>j)&1:
            A.append(C[j])
    result.append(A)
inf=float('inf')
ans2=inf

for i in result:
    D=dict()
    ans1=0
    ans3=0
    if i!=[]:
        for j in i:
            ans1+=j[0]
            for k,value in enumerate(j):
                if k!=0:
                    D[k]=D.get(k,0)+value
            
        for j in D.values():
            if j>=X:
                ans3+=1
        if ans3==M:
            ans2=min(ans2,ans1)
if ans2==inf:
    print(-1)
else:
    print(ans2) 

Measured memory_bytes: 69344
S = input()
Q = int(input())
Query = [input().split() for _ in range(Q)]

muki = 1
a = ''
b = ''
for i in Query:
    if i[0] == '1':
        muki *= -1
    else:
        if i[1] == '1':
            if muki == 1:
                a += i[2]
                # S = i[2] + S
            else:
                # S = S + i[2]
                b += i[2]
        else:
            if muki == -1:
                # S = i[2] + S
                a += i[2]
            else:
                # S = S + i[2]
                b += i[2]
S = a[::-1] + S + b
if muki == -1:
    print(S[::-1])
else:
    print(S)
    



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

int main()
{
  int N, K;
  cin >> N >> K;
  
  vector<int> p(N);
  for(int i = 0; i < N; i++)
  {
    cin >> p.at(i);
  }
  sort(p.begin(), p.end());
  int ans = 0;
  for(int i = 0; i < K; i++)
  {
    ans += p.at(i);
  }
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 3624
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		
		int a = scanner.nextInt();
		int b = scanner.nextInt();
		
		System.out.printf("%d %d\n", a*b, 2*a+2*b);

	}

}

Measured memory_bytes: 26100
L = input()
dp = [[0,0] for _ in range(len(L))]
MOD = 10**9+7

dp[0][0] = 1
dp[0][1] = 2

for i in range(1,len(L)):
    if L[i] == '0':
        dp[i][0] = 3*dp[i-1][0]
        dp[i][1] = dp[i-1][1]
    else:
        dp[i][0] = 3*dp[i-1][0] + dp[i-1][1]
        dp[i][1] = 2*dp[i-1][1]
    dp[i][0] %= MOD
    dp[i][1] %= MOD

print(sum(dp[len(L)-1])%MOD)

Measured memory_bytes: 19656
import fractions
n=int(input())
ans=0
for i in range(1,n+1):
    for j in range(i,n+1):
        g=fractions.gcd(i,j)
        for k in range(j,n+1):
            l=fractions.gcd(g,k)
            if i==j and j==k:
                ans+=l
            elif i==j or j==k or k==i:
                ans+=3*l
            else:
                ans+=6*l
print(ans)

Measured memory_bytes: 10684
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h> // uint64_t

#define max(a,b) ((a) > (b) ? (a) : (b))
#define min(a,b) ((a) > (b) ? (b) : (a))

int get_int(void) {
  int num;
  scanf("%d", &num);
  return num;
}

int get_int2(int *a1, int *a2) {
  scanf("%d %d", a1, a2);
  return 0;
}

#define NUM_MAX 100

struct point2d {
    int x;
    int y;
};

struct pair {
    int val;
    int idx;
};

int is_big(struct point2d b, struct point2d s) {
    return b.x > s.x && b.y > s.y;
}

int asc_by_val(const void *a1, const void *a2) {
    struct pair *pa1 = (struct pair*)a1;
    struct pair *pa2 = (struct pair*)a2;
    return pa1->val - pa2->val;
}

struct edge {
    int blue;
    int red;
    int dist2;
};

int asc_by_x(const void *a1, const void *a2) {
    struct point2d *p1 = (struct point2d*)a1;
    struct point2d *p2 = (struct point2d*)a2;
    return p1->x - p2->x;
}

int desc_by_y(const void *a1, const void *a2) {
    struct point2d *p1 = (struct point2d*)a1;
    struct point2d *p2 = (struct point2d*)a2;
    return p2->y - p1->y;
}

int main(void) {
    int num = get_int();
    static struct point2d reds[NUM_MAX];
    static struct point2d blues[NUM_MAX];
    int i, j;

    for(i = 0; i < num; i++) {
        get_int2(&reds[i].x, &reds[i].y);
    }
    for(i = 0; i < num; i++) {
        get_int2(&blues[i].x, &blues[i].y);
    }

    qsort(blues, num, sizeof(struct point2d), asc_by_x);
    qsort(reds, num, sizeof(struct point2d), desc_by_y);

    static int red_map[NUM_MAX+1];
    int ans = 0;
    for(i = 0; i < num; i++) {
        struct point2d bp = blues[i];
        for(j = 0; j < num; j++) {
            struct point2d rp = reds[j];
            if(red_map[j]) continue;
            if(is_big(bp, rp)) {
                ans++;
                red_map[j] = 1;
                break;
            }
        }
    }
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <cstdio>
#include <algorithm>
#include <utility>
#include <string>
#include <cmath>
#include <set>
#include <functional>
#include <map>
#include <queue>
#include <cstring>
#include <stack>
#include <iomanip>
#include <climits>
#include <numeric>
#include <cassert>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define show(x) cout << #x << " = " << x << endl;
typedef long long ll;
typedef pair<int,int> pii;
struct edge{
    int to;
    ll w;
};
vector<edge>G[200005];
bool used[200005];
ll min_r,min_c;
ll cost[200005];
void dfs(int s){
    used[s] = true;
    rep(i,G[s].size()){
        if(!used[G[s][i].to]){
            cost[G[s][i].to] = G[s][i].w - cost[s];
            if(G[s][i].to >100000){
                min_c = min(min_c, cost[G[s][i].to]);
            }else{
                min_r = min(min_r, cost[G[s][i].to]);
            }
            dfs(G[s][i].to);
        }else{
            if(cost[G[s][i].to] != G[s][i].w - cost[s]){
                cout << "No" << endl;
                exit(0);
            }
        }
    }
}
int main(){
    int h,w;
    cin >> h >> w;
    int n;
    cin >> n;
    vector<int> r(n),c(n);
    vector<ll> a (n);
    rep(i,n){
        cin >> r[i] >> c[i] >> a[i];
        c[i] += 100000;
        G[r[i]].push_back(edge{c[i],a[i]});
        G[c[i]].push_back(edge{r[i],a[i]});
    }
    rep(i,n){
        if(!used[r[i]]){
            min_r = 0;
            min_c = 1LL<<60;
            dfs(r[i]);
            if(min_r + min_c < 0){
                cout <<"No" << endl;
                return 0;
            }
        }
    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 18176
#include <bits/stdc++.h>
 #define ll long long
 #define int long long
 #define MOD  1000000007
 #define MAX 500005
 #include<iomanip>
 #define Need_for_speed(activated) ios_base :: sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
 #define satisfy ll t; cin>> t; while(t--)
 #define inp(n) int n;cin >> n
 #define mp make_pair
 #define pb push_back
 #define fore(i,a,b) for(ll i=a;i<b;i++)
 #define x first
 #define y second
using namespace std;
int gcd(int a, int b);
  
//int power(int x, unsigned int y, unsigned int m)
//{
//    if (y == 0)
//        return 1;
//    int p = power(x, y/2, m) % m;
//    p = (p * p) % m;
//
//    return (y%2 == 0)? p : (x * p) % m;
//}
int power(int x, int y, int p)
{
    int res = 1;      // Initialize result
  
    x = x % p;  // Update x if it is more than or
                // equal to p
  
    while (y > 0)
    {
        // If y is odd, multiply x with result
        if (y & 1)
            res = (res*x) % p;
  
        // y must be even now
        y = y>>1; // y = y/2
        x = (x*x) % p;
    }
    return res;
}
  
// Returns n^(-1) mod p
int modInverse(int n, int p)
{
    return power(n, p-2, p);
}
  
// Returns nCr % p using Fermat's little
// theorem.
int nCrModPFermat(int n, int r, int p)
{
   // Base case
   if (r==0)
      return 1;
  
    // Fill factorial array so that we
    // can find all factorial of r, n
    // and n-r
    int fac[n+1];
    fac[0] = 1;
    for (int i=1 ; i<=n; i++)
        fac[i] = fac[i-1]*i%p;
  
    return (fac[n]* modInverse(fac[r], p) % p *
            modInverse(fac[n-r], p) % p) % p;
}
//ll modInverse(int a, int m)
//{
//    int g = gcd(a, m);
//
//    {
//        // If a and m are relatively prime, then modulo inverse
//        // is a^(m-2) mode m
//
//             return power(a, m-2, m);
//    }
//}
int gcd(int a, int b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);

}
 /*  ll n,k;
    cin>>n>>k;
    ll a[100005]={0};
    fore(i,0,n)cin>>a[i];
    ll p[100005]={0};
    p[0]=a[0];
    for(ll i=1;i<n;i++)
    {
        p[i]=p[i-1]+a[i];
    }
    ll ans=0,m=0;
    for(ll i=1;i<n;i++)
    {
        ll l,r;
        l=1;ll mid;
        r=i;
        while(l<=r)
        {
             mid=(l+r)>>1;
            ll sum=p[i]-p[mid-1];
            ll d=i-mid+1;
            if(a[i]*d-sum<=k && d>ans)
            {
                r=mid-1;
                ans=d;
                m=a[mid];
                cout<<a[i]<<endl;
            }
            else
            {
                l=mid+1;
            }
        }
        
    }
    cout<<ans<<" "<<m<<endl;*/

 int32_t main()
{
    Need_for_speed(activated);
//    satisfy
//    {}
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    ll k=nCrModPFermat(c+d+2,d+1,MOD)+nCrModPFermat(a+b,b,MOD)-nCrModPFermat(a+d+1,d+1,MOD)-nCrModPFermat(c+b+1,b,MOD);
    k+=MOD;
    k%=MOD;
    cout<<k<<endl;
    return 0;
    }



Measured memory_bytes: 15872
#include <stdio.h>
#include <math.h>

struct Point {
    double x, y;
};

void koch(int n, Point a, Point b) {
    if(n==0) return;
    Point s, t, u;
    double th = M_PI * 60.0 / 180.0;
    
    s.x = (2.0 * a.x + 1.0 * b.x) / 3.0;
    s.y = (2.0 * a.y + 1.0 * b.y) / 3.0;
    t.x = (1.0 * a.x + 2.0 * b.x) / 3.0;
    t.y = (1.0 * a.y + 2.0 * b.y) / 3.0;
    u.x = (t.x - s.x) * cos(th) - (t.y - s.y) * sin(th) + s.x;
    u.y = (t.x - s.x) * sin(th) + (t.y - s.y) * cos(th) + s.y;
    
    koch(n-1, a, s);
    printf("%.8f %.8f\n", s.x, s.y);
    koch(n-1, s, u);
    printf("%.8f %.8f\n", u.x, u.y);
    koch(n-1, u, t);
    printf("%.8f %.8f\n", t.x, t.y);
    koch(n-1, t, b);
}

int main() {
    Point a, b;
    int n;
    
    scanf("%d", &n);
    
    a.x = 0;
    a.y = 0;
    b.x = 100;
    b.y = 0;
    
    printf("%.8f %.8f\n", a.x, a.y);
    koch(n, a, b);
    printf("%.8f %.8f\n", b.x, b.y);
    
    return 0;
}


Measured memory_bytes: 2708
#include <cstdio>
#include <climits>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <list>
#include <set>
#include <bitset>
#include <iterator>
#define rep(i, n) for(long long i = 0; i < (long long)(n); i++)
using namespace std;
typedef long long int LL;
typedef unsigned long long int ULL;

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

    vector<LL> v(m);
    rep(i, m) {
        cin >> v[i];
    }

    if (n >= m) {
        cout << 0 << endl;
        return 0;
    }
    sort(v.begin(), v.end());
    vector<LL> diff(m - 1);

    rep(i, m - 1) {
        diff[i] = v[i + 1] - v[i];
    }
    sort(diff.begin(), diff.end(), greater<LL>());
    // rep(i, m - 1){
    //     cout << diff[i] << endl;
    // }

    LL sum = 0;
    for (int i = n - 1; i < m - 1; i++) {
        sum += diff[i];
    }
    cout << sum << endl;
    return 0;
}


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

#pragma GCC optimize("02")
#pragma GCC target("tune=native")

using namespace std;

#define ll long long int
#define lu unsigned long long int
#define fi first
#define se second
#define edge pair<long long int,long long int>
#define weighted_edge pair<long long int,pair<long long int,long long int>>

int main() {

	ios_base::sync_with_stdio(0);
	cin.tie(0);

	string s1,s2,s3; cin >> s1 >> s2 >> s3;

	cout << s1[0] << s2[0] << s3[0] << endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>

int main(){
	using namespace std;
	int a1, a2, a3;
	cin >> a1 >> a2 >> a3;
	if (a1 + a2 + a3 <= 21) {
		cout << "win" << endl;
	}
	else {
		cout << "bust" << endl;
	}

}

Measured memory_bytes: 256
package main

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

func search(n int, as []int, q int, bs []int) {
	count := 0
	for _, b := range bs {
		flag := true
		for i := 0; i < n && flag; i++ {
			if b == as[i] {
				flag = false
				count++
			}
		}
	}
	fmt.Println(count)
}

func nextInt(sc *bufio.Scanner) int {
	sc.Scan()
	n, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return n
}

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	n := nextInt(sc)
	var as []int
	for i := 0; i < n; i++ {
		as = append(as, nextInt(sc))
	}
	q := nextInt(sc)
	var bs []int
	for i := 0; i < q; i++ {
		bs = append(bs, nextInt(sc))
	}
	search(n, as, q, bs)
}



Measured memory_bytes: 1500
#include <bits/stdc++.h>
#define ll long long
const ll base = 31;
const ll MOD = 1e9+9;
const ll  maxN = 1e6+9;

using namespace std ;
int a[5][5] ;
bool kt[101];
int32_t main()
{   int n ;
    for ( int i = 1; i<= 3 ; i++)
    for ( int j = 1; j<= 3; j++) cin >> a[i][j];
    cin >> n;
    int x ;
    for ( int i =1 ; i<= n; i++){
        cin >> x;
        kt[x] = true;
    }
    int ans = 0 ,cnt = 0;
    for ( int i = 1; i<= 3; i++)
        { cnt = 0 ;
        for ( int j = 1; j<= 3; j++)
         if ( kt[a[i][j]]==true) cnt++;
         if ( cnt == 3 ) ans = 1;
        }
     for ( int i = 1; i<= 3; i++)
        { cnt = 0 ;
        for ( int j = 1; j<= 3; j++)
         if ( kt[a[j][i]]==true) cnt++;
         if ( cnt == 3 ) ans = 1;
        }
    cnt = 0 ;
    for ( int i = 1; i<= 3; i++)
        if (kt[a[i][i]] == true) cnt++ ;
        if ( cnt ==3) ans = 1 ;
        cnt = 0 ;
        int j =3;
       for ( int i = 1; i<= 3; i++)
        {
         if ( kt[a[i][j--]]==true) cnt++;
         if ( cnt == 3 ) ans = 1;
        }
        if ( ans ==1 ) cout<<"Yes";
         else cout<<"No";
    return 0;
}


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

struct edge {int from,to;long cost;};
edge es[5100];
long d[2600];
int n,m;
long inf = 100000000000000007;
bool negative = false;
bool used[2600];

void bellmanford(int s){
  for(int i = 0;i < n;i++){
    d[i] = inf;
  }
  d[s] = 0;
  for(int j = 0;j < n;j++){
    bool update = false;
    for(int i = 0;i < m;i++){
      edge e = es[i];
      if(d[e.from] != inf && d[e.to] > d[e.from] + e.cost){
        d[e.to] = d[e.from] + e.cost;
        update = true;
        if(j == n-1){
          negative = true;
        }
      }
    }
    if(!update) break;
  }
  return;
}

void dfs(int cur){
  used[cur] = true;
  for(int i = 0;i < m;i++){
    if(es[i].from == cur && used[es[i].to] == false){
      dfs(es[i].to);
    }
  }
  return;
}

void dfs2(int cur){
  used[cur] = true;
  for(int i = 0;i < m;i++){
    if(es[i].to == cur && used[es[i].from] == false){
      dfs2(es[i].from);
    }
  }
  return;
}

int main(){
  cin >> n >> m;
  for(int i = 0;i < m;i++){
    cin >> es[i].from >> es[i].to >> es[i].cost;
    es[i].from--;es[i].to--;es[i].cost *= -1;
  }
  for(int i = 0;i < n;i++) used[i] = false;
  dfs(0);
  for(int i = 0;i < m;i++){
    if(used[es[i].from] == false || used[es[i].to] == false) es[i].cost = inf;
  }
  for(int i = 0;i < n;i++) used[i] = false;
  dfs2(n-1);
  for(int i = 0;i < m;i++){
    if(used[es[i].from] == false || used[es[i].to] == false) es[i].cost = inf;
  }
  bellmanford(0);
  if(negative == true){
    cout << "inf" << endl;
  }
  else{
    cout << -d[n-1] << endl;
  }
}

Measured memory_bytes: 256
N = int(input())
src = list(map(int,input().split()))

asc = [N*(n+1) for n in range(N)]
desc = [N*(n+1) for n in reversed(range(N))]

for i,a in enumerate(src):
    desc[a-1] += i

print(' '.join(list(map(str,asc))))
print(' '.join(list(map(str,desc))))

Measured memory_bytes: 7232
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>

using namespace std;


#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repr(i,n) for(int (i)=(n); (i)>=(0); (i)--)
#define SIZE(x) ((int)(x).size())
#define GCD(a, b) int gcd(int a,int b){return b?gcd(b,a%b):a;}
#define QP(a, b) int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define all(v) (v).begin(),(v).end()


template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
template<typename A, size_t N, typename T>
void FILL(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

typedef vector<int, int> vint;
typedef pair<int,int> pint;
typedef vector<pint>vpint;
typedef long long ll;

int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1LL << 60;
const ll MOD = 1000000007LL;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n = 0; cin >> n;
    vector<ll> a(n);
    ll now = 1;
    for(int i=0; i<n; i++){
        cin >> a[i];
        if(a[i] == 0){
            cout << 0 << endl;
            return 0;
        }
    }
    for(int i=0; i<n; i++){
        if(a[i] > 1000000000000000000 / now){
            cout << -1 << endl;
            return 0;
        }
        else{
            now *= a[i];
        }
    }
    cout << now;
    cout << endl;
    return 0;
}

Measured memory_bytes: 3936
// Package main provides
//
// File:  d.go
// Author: ymiyamoto
//
// Created on Thu Jan 17 12:41:47 2019
//
package main

import (
	"fmt"
)

var N, A, B int

func canKillAll(monsters []int, n int) bool {
	count := 0
	for i := range monsters {
		rest := monsters[i] - n*B
		if rest > 0 {
			count += (rest + (A - B) - 1) / (A - B)
		}
	}
	return count <= n
}

func main() {
	fmt.Scan(&N, &A, &B)

	arr := make([]int, N)
	for i := range arr {
		fmt.Scan(&arr[i])
	}

	left := 0
	right := int(1e9)
	for left+1 < right {
		mid := (left + right) / 2
		if !canKillAll(arr, mid) {
			left = mid
		} else {
			right = mid
		}
	}
	fmt.Println(right)
}


Measured memory_bytes: 5504
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
#include <stack>
#include <set>
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 INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define all(v) v.begin(), v.end()

const int N = 1234567;

ll mpow(ll a, ll b){
	if(b==0) return 1;
	else if(b%2==0){ll memo = mpow(a,b/2); return memo*memo%MOD;}
	else return mpow(a,b-1) * a % MOD;
}
ll gcd(ll a, ll b){
	if(b==0) return a;
	else return gcd(b, a%b);
}
vector<ll> kaijo_memo;
ll kaijo(ll n){
	if(kaijo_memo.size() > n) return kaijo_memo[n];
	if(kaijo_memo.size() == 0) kaijo_memo.push_back(1);
	while(kaijo_memo.size() <= n) kaijo_memo.push_back(kaijo_memo[kaijo_memo.size()-1] * kaijo_memo.size() % MOD);
	return kaijo_memo[n];
}
ll nCr(ll n, ll r){
	if(n < r || r < 0) return 0;
	ll ret = 1;
	ret *= kaijo(n); ret %= MOD;
	ret *= mpow(kaijo(r), MOD-2); ret %= MOD;
	ret *= mpow(kaijo(n-r), MOD-2); ret %= MOD;
	return ret;
}

int main(void){
	string s;
	cin>>s;
	ll ans = LINF;
	rep(i,s.size()-2){
		int x = 0;
		x += (s[i] - '0') * 100;
		x += (s[i+1] - '0') * 10;
		x += (s[i+2] - '0');
		ans = min(ans, (ll)abs(x-753));
	}
	cout<<ans<<endl;

	return 0;
}


Measured memory_bytes: 256
import java.util.*;

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

Measured memory_bytes: 26204
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <queue>
#include <map>
#include <string>
using namespace std;
typedef long long LL;

string s[200005];
LL n,cnt = 0;
LL a[55];

void dfs(LL dep,LL tmp,LL lim){
	if(cnt > 100000) return;
	if(dep > lim){
		s[++ cnt] = "";
		for(LL i = 1;i <= lim;i ++) s[cnt] += (char)(a[i] + 48);
		return;
	}
	for(LL i = tmp - 1;i <= tmp + 1;i ++){
		if(i < 0 || i > 9) continue;
		a[dep] = i;
		dfs(dep + 1,i,lim);
		a[dep] = 0;
	}
}

int main(){
	ios::sync_with_stdio(false);
	for(LL i = 1;i <= 10;i ++){
		for(LL j = 1;j <= 9;j ++){
			a[1] = j;
			dfs(2,j,i);
		}
	}
//	for(LL i = 1;i <= 50;i ++) cout << s[i] << endl;
	cin >> n;
	cout << s[n] << endl;
	return 0;
}

Measured memory_bytes: 7680
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;

int main(int argc, char* argv[]){
	cin.tie(0);
	ios::sync_with_stdio(false);

	int N, M; cin >> N >> M;
	int s = 0;
	vector<int> V; V.assign(N, 1);
	map<int, int> mp;
	mp[0] = 1;
	for(int i=0; i<M; i++){
		int x, y; cin >> x >> y;
		x--; y--;
		V[x]--; V[y]++;
		if(mp.count(x) != 0){
			mp[y] = 1;
			s = y;
		}
		if(V[x] == 0) mp.erase(x);
	}
	int ans = 0;
	for(auto itr = mp.begin(); itr != mp.end(); itr++){
		int v = itr->second;
		if(v > 0) ans++;
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 8268