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

public class Main {

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

		int a,f,b;

		a = stdIn.nextInt();
		f = stdIn.nextInt();
		b = stdIn.nextInt();

		if(a > b) {
			System.out.println(0);
		}else if(a + f < b) {
			System.out.println("NA");
		}else {
			System.out.println(b -a);
		}
	}

}



Measured memory_bytes: 26288
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    
    long prevT = 1;
    long prevA = 1;
    for (int i = 0; i < N; i++) {
      int T = sc.nextInt();
      int A = sc.nextInt();
      long ft = prevT/T + (prevT%T == 0 ? 0 : 1);
      long fa = prevA/A + (prevA%A == 0 ? 0 : 1);
      long f = Math.max(ft,fa);
      
      prevT = f*T;
      prevA = f*A;
    }
    System.out.println(prevT + prevA);
  }
}

Measured memory_bytes: 24020
#include <bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

using namespace std;

#define rep(i, a, b) for (int i = a; i < b; i++)
#define rrep(i, a, b) for (int i = a; i <= b; i++)
#define all(a)  begin((a)),end((a))
#define uniq(c) (c).erase(unique(all((c))), end((c)))

int main()
{
    int N, m = INF, ans = 0; cin >> N;
    vector<int> P(N);
    rep (i, 0, N) {
        cin >> P[i];
        m = min(m, P[i]);
        if (m == P[i]) ++ans;
    }

    cout << ans << endl;
}

Measured memory_bytes: 1024
import std.stdio, std.string, std.conv;

void main() {
    long[] tmp = readln.split.to!(long[]);
    long w = tmp[0], h = tmp[1], x = tmp[2], y = tmp[3];
    double s = w * h / 2.0;
    int t = 2 * x == w && 2 * y == h ? 1 : 0;
    writefln("%.10f %d", s, t);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
int main () {
    int n;
    cin >> n;
    vector<int> l;
    for (int i = 1; i <= n; i++) {
        int x;
        cin >> x;
        l.push_back(x);
    }
    sort(l.begin(), l.end());
    ll count = 0;
    for (int i = 0; i < n - 2; i++) {
        for (int j = i + 1; j < n - 1; j++) {
            int first_index = j + 1;
            int last_index = n - 1;
            while (last_index - first_index > 1) {
                int medium_index = (first_index + last_index) / 2;
                if (l[medium_index] < l[i] + l[j]) {
                    first_index = medium_index;
                }
                else {
                    last_index = medium_index;
                }
            }
            if (l[first_index] >= l[i] + l[j]) {
                ;
            }
            else if (l[last_index] >= l[i] + l[j]) {
                count += first_index - j;
            }
            else {
                count += last_index - j;
            }
        }
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 3616
n = int(input())
w = list(map(int,input().split()))

minimum = sum(w)

for t in range(n):
    s1 = 0
    s2 = 0

    for i in range(n):
        if i<=t:
            s1 += w[i]
        else:
            s2 += w[i]

    min_tmp = abs(s1-s2)
    minimum = min(minimum,min_tmp)

print(minimum)


Measured memory_bytes: 2940
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define PI 3.14159265358979323

//void quick(int *,long long,long long);
//int comp(char *a,char *b);

int main(){
	
	int i,j;
	for(i=1;i<=9;i++)
		for(j=1;j<=9;j++)
			printf("%dx%d=%d\n",i,j,i*j);
	//for(i=0;i<=10000000000;i++);
	return 0;
}

Measured memory_bytes: 524
grid = [list(map(int,input().split(' '))) for i in range(3)]

b = [grid[0][0], grid[0][1], grid[0][2]]
a = [0, grid[1][0]-b[0], grid[2][0]-b[0]]
 
for i in range(1,3):
    for j in range(1,3):
        if grid[i][j] != a[i]+b[j]:
            print('No')
            exit()
print('Yes')

Measured memory_bytes: 3064
#include<iostream>
#include<string>
using namespace std;
int main()
{
    string x;
    cin>>x;
    for(int i=0;i<x.size();++i)
    if(x[i]=='a'||x[i]=='e'||x[i]=='i'||x[i]=='o'||x[i]=='u')
       cout<<"vowel"<<endl;
    else cout<<"consonant"<<endl;
}

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

using namespace std;

int main()
{
    long long n;
    vector<long long> v;
    cin >> n;
    for(long long i=1;i<pow(n,0.5)+1;i++){
        if(n%i==0)
            v.push_back(i+(n/i)-2);
    }
    sort(v.begin(),v.end());
    cout << v[0] << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <unordered_map>

using namespace std;
using ll = long long;

void _cin(){} template <class Head, class... Tail> void _cin(Head&& head, Tail&&... tail){ cin >> head; _cin(forward<Tail>(tail)...); }
void _cout(){ cout << "\n"; } template <class Head, class... Tail> void _cout(Head&& head, Tail&&... tail){ cout << head; _cout(forward<Tail>(tail)...); }
int gcd(int a, int b){ return (b == 0) ? a : gcd(b, a % b); }

#define For(i, n) for(int i = 0; i < (n); i ++)
#define Rep(n) For(_, n)
#define Range(c) c.begin(), c.end()
#define RevRange(c) c.rbegin(), c.rend()
#define Contains(c, x) (find(Range(c), x) != c.end())
#define Search(rb, re, x) distance(rb, find(rb, re, x))
#define Sort(a) sort(Range(a))
#define DeSort(a) sort(RevRange(a))
#define Reverse(c) reverse(Range(c))
#define Vec2(T, n, m, xs, x0) vector<vector<T>> xs(n, vector<T>(m, x0))
#define Sum(a) accumulate(Range(a), 0)
#define Cusum(T, xs, sxs) vector<T> sxs(xs.size()+1); For(i, (int)xs.size()) sxs[i+1] = sxs[i] + xs[i]
#define Cin(T, ...) T __VA_ARGS__; _cin(__VA_ARGS__)
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i]
#define Cins2(T, n, xs, ys) vector<T> xs(n), ys(n); For(i, n) cin >> xs[i] >> ys[i]
#define Cins3(T, n, xs, ys, zs) vector<T> xs(n), ys(n), zs(n); For(i, n) cin >> xs[i] >> ys[i] >> zs[i]
#define Cinss(T, n, m, xs) Vec2(T, n, m, xs); For(i, n) For(j, m) cin >> xs[i][j]
#define Cinm(T, n, map) unordered_map<T, int> map; Rep(n){ Cin(T, x); map[x] ++; }
#define Cout(...) _cout(__VA_ARGS__)
#define Couts(xs) for(const auto &e : xs) cout << e << " "; cout << "\n"
#define Coutyn(cond) Cout((cond) ? "yes" : "no")
#define CoutYn(cond) Cout((cond) ? "Yes" : "No")
#define CoutYN(cond) Cout((cond) ? "YES" : "NO")

// constexpr int MOD = 1e9+7;

int main(void){
    Cins(ll, 3, a);
    Sort(a);
    Cout((a[0]*a[1]*a[2] % 2) ? a[0]*a[1] : 0);
}


Measured memory_bytes: 256
/*
 * main3.cpp
 *
 *  Created on: 12 באפר׳ 2020
 *      Author: Dell
 */



/*
 * main2.cpp
 *
 *  Created on: 11 באפר׳ 2020
 *      Author: Dell
 */




#include <iostream>
#include <string>
#include <stdio.h>
#include <stdlib.h>
#include <cmath>
#include <cstring>
#include <vector>
#include<stack>
#include<list>
#include <algorithm>
#include <unordered_map>
using namespace std;
int main()
{
	int N;
	cin>>N;
	long long result=0;
	bool flag=true;
	for(int x=1;x<N+1;x++)
	{
		if(x%3==0 || x%5==0)
		{
			continue;
		}
		result+=x;
	}
	if(flag){
	cout<<result;
}}


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

taoshita = 0
for i in range(n):
  taoshita += min(a[i], b[i])
  yoryoku = max(b[i]-a[i], 0)
  taoshita += min(a[i+1], yoryoku)
  a[i+1] = max(a[i+1]-yoryoku, 0)

print(taoshita)

Measured memory_bytes: 19244
#include <bits/stdc++.h>
using ll = long long;
#define FOR(i, k, n) for(ll i = (k); i < (n); i++)
#define FORe(i, k, n) for(ll i = (k); i <= (n); i++)
#define FORr(i, k, n) for(ll i = (k)-1; i > (n); i--)
#define FORre(i, k, n) for(ll i = (k)-1; i >= (n); i--)
#define REP(i, n) FOR(i, 0, n)
#define REPr(i, n) FORre(i, n, 0)
#define ALL(x) (x).begin(), (x).end()
#define ALLr(x) (x).rbegin(), (x).rend()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;
using P = pair<ll, ll>;

const int INF = 1001001001;
vector<P> to[100000];
vector<ll> dist(100000);

void dfs(ll v, ll p = -1, ll d = 0){
  dist[v] = d;
  for(P u : to[v]){
    if(u.first == p) continue;
    dfs(u.first, v, d+u.second);
  }
}

int main(void){
  ll n;
  cin >> n;
  REP(i, n-1){
    ll a, b, c;
    cin >> a >> b >> c;
    a--; b--;
    to[a].emplace_back(P(b, c));
    to[b].emplace_back(P(a, c));
  }
  ll q, k;
  cin >> q >> k;
  dfs(--k);
  vector<ll> ans(q);
  REP(i, q){
    ll x, y;
    cin >> x >> y;
    x--; y--;
    ans[i] = dist[x]+dist[y];
  }
  REP(i, q) cout << ans[i] << endl;
  
  return 0;
}

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

int main(){
  int n,m;
  cin>>n>>m;
  int a,b=0;
  map<int,int> mp;
  mp[0]++;
  long long int ans=0;
  for(int i=0;i<n;++i){
    cin>>a;
    b=(b+a)%m;
    ans+=mp[b]++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3200
#include <iostream>
#include <algorithm>
#include <complex>
#include <utility>
#include <vector>
#include <string>
#include <queue>
#include <tuple>
#include <cmath>
#include <bitset>
#include <cctype>
#include <set>
#include <map>
#include <unordered_map>
#include <numeric>
#include <functional>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long;
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; }
inline void Yes(bool condition){ if(condition) PRINT("Yes"); else PRINT("No"); }
template<class itr> void cins(itr first,itr last){
    for (auto i = first;i != last;i++){
        cin >> (*i);
    }
}
template<class itr> void array_output(itr start,itr goal){
    string ans = "",k = " ";
    for (auto i = start;i != goal;i++) ans += to_string(*i)+k;
    if (!ans.empty()) ans.pop_back();
    PRINT(ans);
}
ll gcd(ll a, ll b) {
    return a ? gcd(b%a,a) : b;
}
const ll INF = 1e16;
const ll MOD = 1000000007;
typedef pair<ll,ll> P;
const ll MAX = 100010;
constexpr ll nx[8] = {1,0,-1,0,-1,-1,1,1};
constexpr ll ny[8] = {0,1,0,-1,-1,1,-1,1};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a,b;
    cin >> a >> b;
    if ((a+b)%2) PRINT("IMPOSSIBLE");
    else PRINT((a+b)/2);
}    


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

int main() {
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  if(a+b>c+d){
    cout << "Left";
  }else if(a+b<c+d){
    cout << "Right";
  }else{
    cout << "Balanced";
  }
}

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

#define fr first
#define sc second
#define pb push_back
#define mk make_pair
#define ll long long
#define OK puts("OK")
#define sz(s) (int)s.size()
#define all(s) s.begin(), s.end()

using namespace std;

const int N = 2e5+10;
const int inf = 1e9+7;

ll n, m, ans = 0;
ll x[N], y[N], s[N], p[N];
set <pair <ll, int> > st;

int main() {
    cin >> n >> m;
    for(int i = 1; i <= n; i++) {
        cin >> x[i] >> y[i];
        p[i] = p[i - 1] + y[i];
    }
    for(int i = n; i >= 1; i--) {
        s[i] = s[i + 1] + y[i];
        st.insert(mk(-(s[i] - m + x[i]), i));
    }
    for(int i = 1; i <= n; i++) {
        st.erase(mk(-(s[i] - m + x[i]), i));
        ans = max(ans, p[i] - x[i]);
        if(!st.empty())
            ans = max(ans, p[i] - x[i] - x[i] - st.begin()->fr);
    }
    for(int i = 1; i <= n; i++) {
        st.insert(mk(-(p[i] - x[i]), i));
    }
    for(int i = n; i >= 1; i--) {
        st.erase(mk(-(p[i] - x[i]), i));
        ans = max(ans, s[i] - m + x[i]);
        if(!st.empty())
            ans = max(ans, s[i] - m + x[i] - m + x[i] - st.begin()->fr);
    }
    cout << ans << endl;
}


Measured memory_bytes: 11904
import java.io.PrintWriter;
import java.util.*;

public class Main {
    void run() {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        int n = sc.nextInt();
        int k = sc.nextInt();
        int[] parr = new int[n];
        int[] carr = new int[n];
        for (int i = 0; i < n; i++) {
            parr[i] = sc.nextInt() - 1;
        }

        for (int i = 0; i < n; i++) {
            carr[i] = sc.nextInt();
        }

        boolean visited[] = new boolean[n];

        long ans = Long.MIN_VALUE;
        for (int i = 0; i < n; i++) {
            if (visited[i]) {
                continue;
            }
            List<Integer> loop = new ArrayList<>();
            int current = i;
            while (!visited[current]) {
                loop.add(carr[current]);
                visited[current] = true;
                current = parr[current];
            }

            long x = partialSolve(loop.size(), k, loop);
//            debug(x);
//            debug("-------");
            ans = Math.max(ans, x);
        }
        System.out.println(ans);

        // out.println("Hello World");
        out.flush();
    }

    long partialSolve(int n, int k, List<Integer> loop) {
        long[] accList = new long[3 * n + 1];
        accList[0] = 0;
        for (int j = 1; j <= 3 * n; j++) {
            accList[j] = loop.get((j - 1) % n) + accList[j - 1];
        }
//        debug(loop);
//        debug(accList);

        long ret = Long.MIN_VALUE;

//        for (int l = 0; l < n; l++) { // スタート地点をどこにするか
//            for (int count = 1; count <= k; count++) { // kの回数のルーぷ
//                ret = Math.max(ret, accList[l + count] - accList[l]);
//            }
//        }

        long loopSum = accList[n];
//        debug("loopSum", loopSum);

        if (k < n) {
            ret = Math.max(ret, noLoopMax(n, k, accList));
        } else {
            if (loopSum > 0) {
                long loopCount = k / n - 1;
                ret = Math.max(ret, noLoopMax(n, n + k % n, accList) + loopSum * loopCount);
            } else {
                ret = Math.max(ret, noLoopMax(n, n - 1, accList));
            }
        }

        return ret;
    }

    // k < nのときのmax
    long noLoopMax(int n, int k, long[] accList) {
        long ret = Long.MIN_VALUE;
        for (int l = 0; l < n; l++) {
            for (int r = l + 1; r <= l + k; r++) {
                ret = Math.max(ret, accList[r] - accList[l]);
            }
        }
        return ret;
    }

    void debug(Object... os) {
        System.err.println(Arrays.deepToString(os));
    }

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


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

#ifdef LOCAL
#include "dump.hpp"
#else
#define dump(...)
#define dumpv(...)
#endif

#define rep(i, n) for (int i = 0; i < (n); i++)
#define mins(x, y) (x = min(x, y))
#define maxs(x, y) (x = max(x, y))
typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
const int MOD = 1e9 + 7;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;

vi bfs(int n, vvi& to, int st) {
  vi dist(n, INF);
  vi from(n, -1);
  queue<int> q;
  dist[st] = 0;
  q.push(st);
  int found = false;
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    for (int v : to[u]) {
      if (v == st) {
        int d = dist[u];
        vi res(d + 1);
        res[d] = u;
        while (u != st) {
          u = from[u];
          res[--d] = u;
        }
        return res;
      }
      if (dist[v] != INF) continue;
      dist[v] = dist[u] + 1;
      from[v] = u;
      q.push(v);
    }
  }
  vi res(1);
  return res;
}

void solve() {
  int n, m;
  cin >> n >> m;
  vvi to(n);
  rep(i, m) {
    int u, v;
    cin >> u >> v;
    u--, v--;
    to[u].push_back(v);
  }
  dump(to);
  vvi loop(n);
  rep(u, n) loop[u] = bfs(n, to, u);
  // rep(u, n) dump(u, loop[u]);

  vector<int> erased;
  vector<int> used;
  function<void(int)> dfs = [&](int u) {
    dump(u, used[u]);
    if (used[u]) {
      if (used[u] == 1) used[u] = 3;
      return;
    }
    used[u] = 1;
    for (auto& v : to[u]) {
      if (erased[v]) continue;
      dfs(v);
    }
    if (used[u] != 3) used[u] = 2;
  };

  rep(u, n) {
    if (loop[u].size() > 1) {
      int pass = true;
      erased.assign(n, 1);
      for (int i : loop[u]) erased[i] = 0;
      used.assign(n, 0);
      dfs(u);
      dump(u, used);
      used[u] = 2; // 開始点はOK
      for (int v : loop[u]) {
        if (used[v] == 3) {
          pass = false;
          break;
        }
      }
      if (pass) {
        cout << loop[u].size() << endl;
        for (int v : loop[u]) cout << v + 1 << endl;
        return;
      }
    }
  }
  cout << -1 << endl;

  // int minsz = INF;
  // int minu = -1;
  // rep(u, n) {
  //   if (loop[u].size() > 1) {
  //     if (minu == -1 || loop[u].size() < loop[minu].size()) {
  //       minu = u;
  //     }
  //   }
  // }
  // if (minu == -1) {
  //   cout << -1 << endl;
  // } else {
  //   int u = minu;
  //   cout << loop[u].size() << endl;
  //   for (int v : loop[u]) cout << v + 1 << endl;
  // }
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  // freopen("temp.1", "r", stdin);
  solve();
  return 0;
}

Measured memory_bytes: 4352
#include <stdio.h>
#include <iostream>
#include <queue>
#include <algorithm>
#include <string>
#include <fstream>
#include <math.h>
#include <iomanip>
#include <time.h>
#include <assert.h>
#include <stack>
#include <deque>
#include <bits/stdc++.h>
#include <array>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <sstream>  // istringstream buffer(myString);
// #include <boost/functional/hash.hpp>

using namespace std;

#define endl "\n";
#define bit(x, i) (x&(1<<i))  //select the bit of position i of x
#define lowbit(x) ((x)&((x)^((x)-1))) //get the lowest bit of x; example: x=12;  1100 => 100 => 4
#define LL long long
#define ULL unsigned long long
#define inf 1000000007
#define mod 1000000007
#define PII pair<int, int>
#define V vector
#define VI vector<int>
#define VS vector<string>
#define ALL(x) x.begin(), x.end() //handy for function like "sort()"
#define pi 3.14159265358979323846
// set a to the maximum of a and b
#define REMAX(a,b) (a)=max((a),(b));
#define REMIN(a,b) (a)=min((a),(b));
// conversion
string removeZeros(string str) { return str.erase(0, min(str.find_first_not_of('0'), str.size()-1)); } // remove leading zeros
#define char2int(c) (c-'0')
#define int2char(i) (static_cast<char>(i))
#define bin2int(bin) (bitset< 1001 >(bin).to_ulong())
#define int2bin(i) removeZeros(bitset< 1001 >( i ).to_string())
// str.erase(0, min(str.find_first_not_of('0'), str.size()-1)); // remove leading zeros


// works for unordered_set, unordered_map..
#define HMAP unordered_map
#define SET unordered_set
#define HAS(umap, key) (umap.find(key) != umap.end())
#define COUNTER(m, j) if (HAS(m, j)) { m[j]++; } else { m[j] = 1; }
// loop
#define FOREACH(vec, i) for (auto i = vec.begin(); i!= vec.end(); i++)
// read line
#define READ_INTS(vec, n) vector<LL> vec(n); for (LL i=0; i<n; i++) { cin >> vec[i]; }; cin.ignore();
#define READ_DOUBLES(vec, n) vector<double> vec (n); FOREACH(vec, i) { cin >> *i; }; cin.ignore();
#define READ_STRING(vec) string vec; getline(cin, vec);
#define READ_INT(i) LL i; cin >> i; cin.ignore();
// #define SPLIT_STRINGS(vec, str) istringstream iss(str); vector<string> vec((istream_iterator<string>(iss)), istream_iterator<string>());
// debug
#define dd(var) cerr << #var << "=" << (var) << " | "
#define ddv(vec) FOREACH(vec, i) { cout << *i << " "; } cout << endl;
#define ddvv(vec) for(auto& i:vec) { for(auto& j:i) { cout <<  j << " "; }; cout << endl };

auto diff(int i, int j, vector<LL> &v) {
    return abs(v[i] - v[j]);
}

void solve() {
    READ_INT(t);
    READ_INT(k);
    READ_INTS(jumps, t);
    vector<LL> price(t);

    price[0] = 0;
    for (LL i = 1; i < t; i++) {
        price[i] = LONG_LONG_MAX;
        for (LL j = max((LL)0, i-k); j < i; j++) {
            price[i] = min(price[i], price[j] + diff(j, i, jumps));
        }
    }
    cout << price[t-1] << endl;
}


int main()
{  
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
//   READ_INT(t);
//   for (LL i = 0; i < t; i++) {
    solve();
//   }
  return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n,d;
    cin>>n>>d;
    vector<double>dista;
    int ans = 0;
    double arr[n][d];
    for(int i=0;i<n;i++){
        for(int j=0;j<d;j++){
            cin>>arr[i][j];
        }
    }
    vector<double>roots;
    vector<int>x;
    vector<int>y;
    int e = 0;
    for(int i=1;i<3000;i++){
        roots.push_back(i*i);
    }
    for(int i=0;i<n;i++){
        for(int j=e;j<n;j++){
            double dist = 0;
            for(int s=0;s<d;s++){
                dist+=pow(abs(arr[i][s]-arr[j][s]),2);
            }

            sort(dista.begin(),dista.end());
            if(binary_search(roots.begin(),roots.end(),dist)){
                ans++;
                dista.push_back(dist);
            }

        }
        e++;
    }
    cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 384
#include<iostream>
using namespace std;
void selectionSort(int[], int);

int main() {
	int n, a[110];
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	selectionSort(a, n);
	return 0;
}

void selectionSort(int a[], int n) {
	int count = 0;
	for (int i = 0; i < n; i++) {
		int minj = i;
		for (int j = i; j <= n - 1; j++) {
			if (a[j] < a[minj]) {
				minj = j;
			}
		}
		if (i != minj) {
			int copy = a[i];
			a[i] = a[minj];
			a[minj] = copy;
			count++;
		}
	}

	for (int i = 0; i < n; i++) {
		cout << a[i];
		if (i == n - 1) cout << endl;
		else cout << " ";
	}
	cout << count << endl;

}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
#define mo 1000000007
using namespace std;
int f[2000100],sum[2000100];
int getsum(int l,int r)
{
	if ((l>r)||(r<0)) return 0;
	l=max(l,0);
	if (l==0) return sum[r];
	return (sum[r]-sum[l-1]+mo)%mo;
}
int main()
{
	int n;scanf("%d",&n);
	f[0]=1;sum[0]=1;int ans=(long long)(n-1)*(n-1)%mo;
	for (int i=1;i<=2*n-1;i++)
	{
		f[i]=(f[i-1]+getsum(max(0,i-(n+1)),min(i-3,n-2)))%mo;
		if (i<n-1) ans=(ans+(long long)f[i]*(n-1)%mo*(n-1))%mo;
		if (i==n-1) ans=(ans+(long long)f[i]*(n-1))%mo;
		sum[i]=(sum[i-1]+f[i])%mo;
	}
	ans=(ans+f[2*n-1])%mo;
	printf("%d\n",ans);
}

Measured memory_bytes: 15872
import java.util.*;

public class Main {
	public static void main(String args[]) throws Exception {
		Scanner sc = new Scanner(System.in);
		int cnt = sc.nextInt();
		Map<Restaulant, Integer> map = new TreeMap<>();

		for (int i = 0; i < cnt; i++) {
			String name = sc.next();
			int score = sc.nextInt();
			map.put(new Restaulant(name, -score), i + 1);
		}
		map.entrySet().stream().forEachOrdered(e -> System.out.println(e.getValue()));		
	}
}

class Restaulant implements Comparable<Restaulant>{
	String city;
	int score;

	public Restaulant(String city,int score) {
		super();
		this.score = score;
		this.city = city;
	}

	@Override
	public int compareTo(Restaulant arg0) {
		int ret = this.getCity().compareTo(arg0.getCity());
		if (ret == 0) {
			if (this.getScore() < arg0.getScore()) return -1;
			else return 1;
		}
		return ret;
	}

	public int getScore() {
		return score;
	}

	public String getCity() {
		return city;
	}
}


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

using namespace std;

int main()
{
    int n;
    int flag=1;
    int a[110];
    cin>>n;
    for(int i=0;i<n;i++)
        cin>>a[i];
    for(int i=0;i<n;i++)
        if(!(a[i]%2))//偶数
            if(a[i]%3!=0 && a[i]%5!=0)
                {flag=0;break;}
    if(flag) cout<<"APPROVED"<<endl;
    else cout<<"DENIED"<<endl;
    return 0;
}


Measured memory_bytes: 256
N, M = map(int,input().split())
X = list(map(int,input().split()))
if N >= M:
    print(0)
    exit()
#print(X)
X.sort()
#print(X)
L = [X[i+1]-X[i] for i in range(M-1)]
#print(L)
L.sort(reverse=True)
#print(L)
print(X[-1]-X[0]-sum(L[:N-1]))

Measured memory_bytes: 13968
#include <stdio.h>
#include <string.h>
#include <stdbool.h>

#define S_MAX 200000
#define N_MAX 100000
#define M_MAX 200000
#define INF 10000000
#define MOD 1000000007
#define SMAP(a, b) ((a)!=(b))&&((a)^=((b)^=((a)^= (b))))

typedef unsigned long long ull;
typedef   signed long long dll;

int n, m;
int h, w;
int i, j, k;
int a, b;

char s[S_MAX + 1];

typedef struct {
	int in;
	int out;
} twoway;

void solve(){
	ull result = 0;
	ull prev;

	char *t, *u;

	for (t = s; *t != 'A'; t++);
	for (u = s; *u; u++);
	for (; *u != 'Z'; u--);

	printf("%d\n", u - t + 1);

	return;
}

int main (void) {
	char *t;
	scanf("%s", s);

	solve();
	return 0;
}




Measured memory_bytes: 384
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#define int long long
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPS(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF (LLONG_MAX - 1e5)
#define fcout cout << fixed << setprecision(10)

using namespace std;

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

    vector<int> v(4);
    REP(i, 4) {
        cin >> v[i];
    }
    sort(v.begin(), v.end());
    if (v[0] == 1 && v[1] == 4 && v[2] == 7 && v[3] == 9) {
        cout << "YES" << endl;
    }
    else {
        cout << "NO" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
from collections import Counter, defaultdict
import sys
sys.setrecursionlimit(10 ** 5 + 10)
# input = sys.stdin.readline
from math import factorial
import heapq, bisect
import math
import itertools


import queue
from collections import deque


def main():
    high, width, a, b = map(int, input().split())

    ans = [[0 for i in range(width)] for j in range(high)]

    for i in range(high):
        for j in range(width):
            if (i < b and j >= a) or (i >= b and j < a):
                ans[i][j] = 1
        print(''.join(list(map(str, ans[i]))))



if __name__ == '__main__':
    main()


Measured memory_bytes: 54232
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
template <typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; //greater<T> for sorting decreasingly
#define ll 	long long
#define pll	pair<ll,ll>
#define unique(a) a.resize(unique(a.begin(), a.end()) - a.begin())
#define fill(v, p) memset(v,p,sizeof v)
#define all(x) x.begin(),x.end()
#define _fastio	ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(0)
#define PI acos(-1.0)
#define EPS 0.000000000000001
#define INF 1LL<<62
#define MAX 100005
#define MOD 1000000007

//int dx[]={1,0,-1,0};
//int dy[]={0,1,0,-1}; //4 Direction
 
//int dx[]={1,1,0,-1,-1,-1,0,1};
//int dy[]={0,1,1,1,0,-1,-1,-1}; //8 direction
 
//int dx[]={2,1,-1,-2,-2,-1,1,2};
//int dy[]={1,2,2,1,-1,-2,-2,-1}; //Knight Direction (horse)

///////////////////////////////////////////////////////////

int main()
{
	_fastio;
	
	ll n, k;
	cin >> n >> k;
	
	if(n*500 <k) cout << "No\n";
	else cout << "Yes" << endl;
	
	
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <map>
#include <deque>
using namespace std;

#define REP(i,n) for(int i = 0; i < n; i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pll;
typedef pair<string,string> pss;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pi> vpi;
typedef vector<ll> vll;
typedef vector<vll> vvll;

double EPS = 1e-9;
int INFi = 1000000005;
long long INFll = 1000000000000000005ll;
double PI = acos(-1);
int dirx[8] = {-1,0,0,1,-1,-1,1,1};
int diry[8] = {0,1,-1,0,-1,1,-1,1};
ll MOD = 1000000007;

const int MAX_N = 18;

int N;
ll A[1 << MAX_N];

pll B[1 << MAX_N];

pll max2(pll a, pll b) {
  ll t[4] = {a.first, a.second, b.first, b.second};
  sort(t, t + 4, greater<ll>());
  return pll(t[0], t[1]);
}

int main(){
  cin >> N;
  REP(i, 1 << N) {
    cin >> A[i];
    B[i] = pll(A[i], 0);
  }

  REP(i, N) REP(j, 1 << N) {
    if(j & (1 << i)) {
      B[j] = max2(B[j], B[j ^ (1 << i)]);

    }
  }

  ll ma = 0;

  // REP(i, 1 << N) {
  //   cout << B[i].first + B[i].second << endl;
  // }

  for(int i = 1; i < 1 << N; i++) {
    ma = max(ma, B[i].first + B[i].second);
    cout << ma << endl;
  }

  // REP(i, 1 << N) {
    // cout << B[i].first << ", " << B[i].second << endl;
  // }

  return 0;
}


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

int main(void) {
  ll N, M;
  cin >> N >> M;
  vector<ll> A(N);
  REP(i, 0, N) cin >> A[i];
  vector<ll> E[N];
  REP(i, 0, M) {
    ll X, Y;
    cin >> X >> Y;
    E[X].push_back(Y);
    E[Y].push_back(X);
  }

  vector<bool> used(N, false);
  vector< vector<ll> > connected;
  function<vector<ll> (ll)> dfs = [&](ll v) {
    used[v] = true;
    vector<ll> ret;
    ret.push_back(v);
    for(ll u : E[v]) if(!used[u]) {
      vector<ll> r = dfs(u);
      ret.insert(ret.end(), r.begin(), r.end());
    }
    return ret;
  };
  REP(i, 0, N) if(!used[i]) connected.push_back(dfs(i));

  if(connected.size() == 1) cout << 0 << endl;
  else if(N < ((ll) connected.size() - 1) * 2) cout << "Impossible" << endl;
  else {
    ll ans = 0;
    vector<ll> vec;
    for(vector<ll> vs : connected) {
      vector<ll> a;
      for(ll v : vs) a.push_back(A[v]);
      sort(a.begin(), a.end());
      ans += a[0];
      REP(i, 1, a.size()) vec.push_back(a[i]);
    }
    sort(vec.begin(), vec.end());
    REP(i, 0, ((ll) connected.size() - 2)) ans += vec[i];
    cout << ans << endl;
  }
}


Measured memory_bytes: 12328
#include <bits/stdc++.h>
 
using namespace std;
inline void prep ()
{
  cin.tie (0);
  cin.sync_with_stdio (0);
};
const double pi = acos(-1.);
//printf(%.12lf\n,mid);
// __builtin_popcount(int) count 1's in binary
// get decimal part of number
/*
double intpart;
double thiss = modf((double)(n*m)/(double)k, &intpart);
*/
// round = (int)(num+.5)
long long mod = 998244353;
 
// 32 mil = ~1 sec 
long long mymod(long long num){
  if (num< 0 && !(num%mod == 0)){
    if (mod == 1){
      return 0;
    }
    return mod-abs(num)%mod;
  }else{
    return num%mod;
  }
}
 
/*string sentence = And I feel fine...;
    istringstream iss(sentence);
*/  
const int biggg = 2000000000;
const long long bigggest = 1000000000000000000LL;
const double eps = .0000000001; 

typedef pair<long long, pair<int, int> > pp;

const int maxx = 250050;
vector<pair<int, long long> > graph[maxx+1];
int u[101], v[101], a[101], b[101], c[101], d[101];
long long dists[maxx+1];

int main ()
{
  prep();
  for (int i=0; i<maxx; i++) dists[i] = bigggest;
  int n, m, s;
  cin >> n >> m >> s;
  for (int i=0; i<m; i++){
      cin >> u[i] >> v[i] >> a[i] >> b[i];
      u[i]--;
      v[i]--;
      // make edges u -> v w/ cost, subtract a and add b to mins
    
      // make edges u -> u w/ cost, add c and add d to mins
  }
  for (int i=0; i<n; i++){
      cin >> c[i] >> d[i];
  }
  int most = 5001;
  for (int i=0; i<m; i++){
     
      // cost for crossing
      for (int j=a[i]; j<most; j++){
          graph[u[i]*most+j].emplace_back(v[i]*most+j-a[i], b[i]);
          graph[v[i]*most+j].emplace_back(u[i]*most+j-a[i], b[i]);
      }
  }
  // costs for buying
  for (int i=0; i<n; i++){
      for (int j=0; j<most; j++){
          graph[i*most+j].emplace_back(i*most+min(j+c[i], most-1), d[i]);
      }
  }
  priority_queue<pair<long long, int> > pq;
  pq.emplace(0, min(most-1, s));
  while (!pq.empty()){
      long long mins = pq.top().first;
      int cur = pq.top().second;
      pq.pop();
      if (dists[cur] != bigggest) continue;
      dists[cur] = -mins;
      for (pair<int, long long> p : graph[cur]){
          if (dists[p.first] != bigggest) continue;
          pq.emplace(mins-p.second, p.first);
      }
  }
  for (int i=1; i<n; i++){
      long long minnest = bigggest;
      for (int j=0; j<most; j++){
          minnest = min(minnest, dists[i*most+j]);
      }
      cout << minnest << '\n';
  }
  return 0;
}


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

#ifdef LOCAL
#include "dump.hpp"
#else
#define dump(...)
#define dumpv(...)
#endif

#define rep(i, n) for (int i = 0; i < (n); i++)
#define mins(x, y) (x = min(x, y))
#define maxs(x, y) (x = max(x, y))
typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
const int MOD = 1e9 + 7;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;

void solve() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  rep(i, s.size()) {
    s[i] = 'A' + ((s[i] - 'A') + n) % 26;
  }
  cout << s << endl;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  // freopen("temp.1", "r", stdin);
  solve();
  return 0;
}

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

#define ll long long

void solve() {
	int k;
	string s;
	cin>>k>>s;
	string ret=s;
	if(s.length()>k)
		ret=s.substr(0,k)+"...";
	cout<<ret<<"\n";
}

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	solve();
	return 0;
}
































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

using namespace std;

int main(void){

    int N, a;
    cin >> N;
    vector<int> cnt(N,0);
    
    
    for(int i=0;i<N-1;++i){
        cin >> a;
        ++cnt[a-1];
    }

    for(int i=0;i<N;++i){
        cout << cnt[i] << endl;
    }
    
    
    return 0;
}


Measured memory_bytes: 4052
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define mp make_pair
#define pb push_back
#define ALL(A) A.begin(),A.end()
const long long mod=1000000007;
int main(){
    int a,b,c;
    cin>>a>>b>>c;
    if(a>b){
        int tmp=a;
        a=b;b=tmp;
    }
    if(a<c&&c<b)
    cout<<"Yes"<<endl;
    else
    cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
import itertools
N,M = map(int,input().split())
ab = [list(map(int,input().split())) for _ in [0]*M]
connect = [[] for _ in [0]*N]
for a,b in ab:
    connect[a-1].append(b-1)
    connect[b-1].append(a-1)
ans = 0
for a in itertools.permutations(range(1,N)):
    a = (0,) + a
    for i in range(N-1):
        if not a[i+1] in connect[a[i]]:
            break
    else:
        ans+=1
print(ans)

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

int main() {
  string N;

  cin >> N ;
  if((N[0] == N[1] && N[1] == N[2]) ||( N[1] == N[2] && N[2] == N[3])) cout << "Yes" << endl;
  else  cout << "No" << endl;

}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int[] A = new int[20];
		
		int n = in.nextInt();
		for (int i = 0; i < n; i++) {
			A[i] = in.nextInt();
		}
		
		int q = in.nextInt();
		for (int i = 0; i < q; i++) {
			int val = in.nextInt();
			if (solve(val, n, 0, A)) {
				System.out.println("yes");
			} else {
				System.out.println("no");
			}
		}
	}
	static boolean solve(int val, int n, int now, int[] A) {
		if (val == 0) return true;
		if (val < 0) return false;
		if (n == now) return false;
		else {
			if (solve(val-A[now], n, now+1, A)) {
				return true;
			}
			if (solve(val, n, now+1, A)) {
				return true;
			}
		}
		return false;
	}
}



Measured memory_bytes: 26868
#include<bits/stdc++.h>
using namespace std;
typedef long long L;
vector<L>v;
L n,r,x,y;
void init(L n){
    v.clear();
    for(L i=0;i<n;i++){
        v.push_back(i+1);
    }
}
void shuffle_(L x,L y){
    L s,e,c=0;
    if(x==1&&y==n)return;
    e=n-x;s=n-(x+y-1);
    c=e-s+1;/// 1 2 3 4 5
    while(c--){
        L d=v[s];
        v.erase(v.begin()+s);
        v.push_back(d);
    }
}
int main(){
    while(scanf("%lld%lld",&n,&r)){
        if(n==0&&r==0)return 0;
        init(n);
        for(L i=0;i<r;i++){
            scanf("%lld%lld",&x,&y);
            shuffle_(x,y);
        }
        cout<<v[n-1]<<"\n";
    }
    return 0;
}



Measured memory_bytes: 3216
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
#define pb push_back
#define mp make_pair
#define M 1000000007
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
const int N = 5e5 + 1;
int n , m , fact[N] , inv[N];
int mult(ll a , ll b){
	return (a*b)%M;
}
int fp(ll a , ll b){
	int res = 1;
	while(b > 0){
		if(b&1)res = mult(res , a);
		b/=2;
		a = mult(a , a);
	}
	return res;
}
int nck(ll n , ll k){
	//if(k > n)return 1;
	return mult(fact[n] , mult(inv[n-k] , inv[k]));
}
int npk(ll n , ll k){
	return mult(fact[n] , inv[n-k]);
}
int main(){
	cin >> n >> m;
	fact[0] = inv[0] = 1;
	for (int i = 1; i <= m; ++i){
		fact[i] = mult(fact[i-1] , i);
		inv[i] = fp(fact[i] , M-2);
	}
	int res = 0;
	//cout << nck(5 , 2) <<endl;
	for (int i = 0; i <= n; ++i){
		int x = mult(nck(n , i) , npk(m-i , n-i));
		if(i&1) res = (res - x + M)%M;
		else res = (res + x)%M;
		//cout << res <<endl;
	}
	cout << mult(npk(m,n) , res);
	

}	

Measured memory_bytes: 7488
#include <bits/stdc++.h>
#define VI vector<int> 
#define SI set<int>
#define QI queue<int> 
#define PB push_back
#define REP(i,a,b) for(int i = a; i < b; ++i)
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);
#define ll long long int
#define M 1000000007
using namespace std;

int main() 
{
    FIO
    string str; cin>>str;
    if (str[2] == str[3] and str[4] == str[5])
    {
    	cout<<"Yes";
    }
    else {
    	cout<<"No";
    }
    return 0;
}

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

int a[509], r[509];
vector<int> v;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, k; cin >> n >> k;
	int s = 0;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		s += a[i];
	}
	for (int i = 1; i * i <= s; i++) {
		if (s % i != 0) continue;
		if (i * i == s) v.push_back(i);
		else {
			v.push_back(i);
			v.push_back(s / i);
		}
	}
	int ans = 1;
	for (int i = 0; i < v.size(); i++) {
		int rs = 0;
		for (int j = 0; j < n; j++) {
			r[j] = a[j] % v[i];
			rs += r[j];
		}
		sort(r, r + n);
		int mr = 0;
		for (int j = 0; j < n - rs / v[i]; j++)
			mr += r[j];
		if (mr <= k) ans = max(ans, v[i]);
	}
	cout << ans << '\n';
	return 0;
}	

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

using namespace std;

#define REP(i,x) for(int i=0; i<(int)(x); i++)       // 0 <= i < x
#define REPS(i,x) for(int i=1; i<=(int)(x); i++)     // 0 < i <= x
#define RREP(i,x) for(int i=((int)(x)-1); i>=0; i--) // x > i >= 0
#define RREPS(i,x) for(int i=((int)(x)); i>0; i--)   // x >= i > 0
#define INF 100000000

typedef long long ll;
typedef pair<int, int> P;

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

int main(void){
    int N;
    cin >> N;
    int dist[N][N];
    REP(i, N){
        REP(j, N){
            cin >> dist[i][j];
        }
    }

    ll res = 0;
    REP(i, N - 1){
        for(int j = i + 1; j < N; j++){
            bool x = true;
            REP(k, N){
                if(dist[i][j] > dist[i][k] + dist[k][j]){
                    cout << "-1\n";
                    return 0;
                }else if(dist[i][j] == dist[i][k] + dist[k][j] && k!=i && k!=j){
                    x = false;
                    break;
                }
            }

            if(x){
                res += dist[i][j];
            }
        }
    }

    cout << res << endl;
    return 0;
}


Measured memory_bytes: 640
fun main(args: Array<String>) {
    val list = readLine()!!.split(" ").map(String::toInt)
    val A = list[0]
    val B = list[1]
    val C = list[2]

    val D = list[0] + list[1] + list[2]

    if(D < 22) {
        println("win")
    } else {
        println("bust")
    }
}

Measured memory_bytes: 37928
#include <stdio.h>

int main(void)
{
	int num1 = 0;
	int num2 = 0;
	
	scanf("%d %d", &num1, &num2);
	
	if (num1 > num2) {
		printf("a > b");
	}
	else if (num1 < num2) {
		printf("a < b");
	}
	else {
		printf("a == b");
	}
        printf("\n");
	
	return (0);
}

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

// Shrotening
#define fst first
#define snd second
#define pb push_back

// Loop
#define FOR(i,a,b) for(long i=(a);i<(b);++i)
#define RFOR(i,a,b) for(long i=(a);i>=(b);--i)

#define REP(i,a) for(long i=0;i<(a);++i)
#define RREP(i,a) for(long i=(a);i>=0;--i)

#define EACH(i,a) for(auto (i)=(a).begin(),_END=(a).end();i!=_END;++i)
#define REACH(i,a) for(auto (i)=(a).rbegin(),_END=(a).rend();i!=_END;++i)

//Algorithm
#define ALL(a) (a).begin(), a.end()
#define RALL(a) (a).rbegin(), a.rend()
#define EXIST(a,x) ((a).find(x)!=(a).end())
#define SORT(a) std::sort((a).begin(), (a).end())
#define UNIQUE(a) std::sort((a).begin(), a.end()), a.erase(std::unique((a).begin(), a.end()), a.end());
#define SUM(a) std::accumulate((a).begin(), (a).end(), 0);

//Setting
#define OPT std::cin.tie(0);std::ios::sync_with_stdio(false);

//debug message
bool debug = true;
#define MSG(s)   if(debug){std::cout << s << std::endl;}
#define DEBUG(x) if(debug){std::cout << "debug(" << #x << "): " << x << std::endl;}

//alias
typedef long long LL;
typedef std::vector<char> VC;
typedef std::vector<int>  VI;
typedef std::vector<long> VL;
typedef std::vector<long long> VLL;

typedef std::vector< VC > VC2;
typedef std::vector< VI > VI2;
typedef std::vector< VL > VL2;
typedef std::vector< VLL > VLL2;

typedef std::pair<int,int> PII;

int len;
std::vector<int> v;
int main() {
    std::string s;
    std::cin >> s;
    len = s.length();
    v.resize(len);
    REP(i, len) {
        v[i] = s[i] - '0';
    }

    int p = (1 << (len-1));
    for(int i=0; i<p; ++i) {
        int ans = v[0];
        for(int k=0; k<len-1; ++k) {
            if( (i>>(len-k-2)) & 0x01 ) {
                ans -= v[k+1];
            } else {
                ans += v[k+1];
            }
        }

        if(ans == 7) {
            std::cout << v[0];
            for(int k=0; k<len-1; ++k) {
                if( (i>>(len-k-2)) & 0x01 ) {
                    std::cout << "-";
                } else {
                    std::cout << "+";
                }
                std::cout << v[k+1];
            }
            std::cout << "=7" << std::endl;
            return 0;
        }
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define sz(x) (int)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}
int main(){
  ll n;
  cin>>n;
  vvll x(n,vll(3));
  rep(i,n)rep(j,3)cin>>x[i][j];
  rep(i,101)rep(j,101){
    ll h;
    rep(u,n){
      if(x[u][2]!=0){
        h=abs(x[u][0]-i)+abs(x[u][1]-j)+x[u][2];
        break;
      }
    }
    ll k=1;
    rep(d,n){
      ll q=max(h-abs(x[d][1]-j)-abs(x[d][0]-i),0LL);
      if(x[d][2]!=q){
        k=0;
        break;
      }
    }
    if(k){
      cout<<i<<" "<<j<<" "<<h<<endl;
      return 0;
    }
  }
}


Measured memory_bytes: 256
n, z, w = gets.split.map(&:to_i)
numbers = gets.split.map(&:to_i)
option_1 = (w - numbers[n - 1]).abs
if n > 1
  option_2 = (numbers[n - 2] - numbers[n - 1]).abs
else
  option_2 = 0
end
puts [option_1, option_2].max


Measured memory_bytes: 1788
#define _CRT_SECURE_NO_WARNINGS 1

#include<stdio.h>


int main() {
	//6+5+6+5+6+5+......が最速のはず。

	long long int needpoint = 0;
	long long int i = 0;
	int			  jouyo = 0;

	scanf("%lld", &needpoint);

	i = (needpoint / 11) * 2;
	jouyo = needpoint % 11;
	if (jouyo > 0) { i++; }
	if (jouyo > 6) { i++; }

	printf("%lld", i);
	return 0;
}

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


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

    for(int i=0; i<2000; i++){
	if(a==(int)((double)i*0.08) && b==(int)((double)i*0.1)){
	    cout << i << endl;
	    return 0;
	}
	
    }
    cout << -1  << endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
typedef long long ll;
long long mod = 1e9 + 7;
const int iINF = 0x3f3f3f3f;
const long long INF = 1LL << 60;
using namespace std;
using pint = pair<int, int>;

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

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

int main()
{
  int k;
  cin >> k;
  vector<int> a;
  rep(i, k)
  {
    int x;
    cin >> x;
    a.push_back(x);
  }

  if (*a.rbegin() != 2)
  {
    cout << -1 << endl;
    return 0;
  }

  reverse(a.begin(), a.end());

  vector<ll> next;
  next.push_back(a[0]);
  ll mini, maxi;

  rep(i, k)
  {
    mini = *next.begin();
    maxi = *next.rbegin();
    next.clear();

    next.push_back(ceil(double(mini) / double(a[i])) * a[i]);
    next.push_back(floor(double(maxi) / double(a[i])) * a[i] + a[i] - 1);

    if (*next.begin() == 0 || *next.begin() > *next.rbegin())
    {
      cout << -1 << endl;
      return 0;
    }
  }

  cout << *next.begin() << " " << *next.rbegin() << endl;
  return 0;
}


Measured memory_bytes: 3876
#include <bits/stdc++.h>
        using namespace std;
        #define int long long int
        #define pb push_back
        #define mk make_pair
        #define ft first
        #define sc second
        #define ppb pop_back
        #define sz size
        #define forn(i,a,n) for(i=a;i<n;i++)
        #define M 998244353 
        #define inf 2e18
 
        signed main() {
 

        ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        cout.tie(NULL);
        
        int x;
        cin>>x;
        if(x>=30)
            cout<<"Yes\n";
        else
            cout<<"No\n";

        return 0;
    }
    

Measured memory_bytes: 3648