akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
struct node
{
    int k,s;
} p[100005];
int cmp(node x,node y)
{
    return x.s<y.s;
}
int main()
{
    int n;
    scanf("%d",&n);
    for(int i=1; i<=n; i++)
    {
        int x;
        scanf("%d",&x);
        p[i].k=i;
        p[i].s=x;
    }
    sort(p+1,p+1+n,cmp);
    for(int i=1; i<=n; i++)
        cout<<p[i].k<<" ";
    return 0;
}


Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
#define INCANT cin.tie(0), cout.tie(0), ios::sync_with_stdio(false), cout << fixed << setprecision(20);
#define int long long
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define _overload(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(...) _overload(__VA_ARGS__, repi, _rep)(__VA_ARGS__)
#define _rev(i, n) revi(i, n, 0)
#define revi(i, a, b) for(int i = (int)(a - 1); i >= (int)(b); i--)
#define rev(...) _overload(__VA_ARGS__, revi, _rev)(__VA_ARGS__)
#define each(i, n) for(auto&& i: n)
void in(){}
template<typename F, typename... R>
bool in(F& f, R&... r){
    if(cin >> f){in(r...);return true;}
    else return false;
}
#define out(x) cout << (x)
#define space() cout << " "
#define indent() cout << '\n'
void print(){}
template<typename F, typename... R>
void print(F f, R... r){out(f), indent(), print(r...);}
#define debughead(x) cerr << "Line " << __LINE__ << ": " << #x << ": "
#define debugout(x) cerr << (x) << " "
#define debugindent() cerr << '\n'
#define debug(x) debughead(x), debugout(x), debugindent()
const int INF = 1e18, MOD = 1e9 + 7;
template<typename T>
bool chmax(T& a, T b){return (a = max(a, b)) == b;}
template<typename T>
bool chmin(T& a, T b){return (a = min(a, b)) == b;}
bool isPrime(int n){
    rep(i, 2, sqrt(n) + 1){
        if(i > 3){
            i++;
        }
        if(!(n % i)){
            return false;
        }
    }
    return true;
}
main(){
    INCANT;
    int q, l, r, tmp, res = 0;
    string s;
    int v[111111] = {};
    vector<vector<int>> g;
    for(int i = 3; i < 111111; i += 2){
        v[i] = v[i - 2];
        if(isPrime(i) && isPrime(i / 2 + 1)){
            v[i]++;
        }
    }
    in(q);
    tmp = 111111 - q;
    while(q--){
        in(l, r);
        print(v[r] - v[max(0LL, l - 2)]);
    }
    while(tmp--){
        debug(l = 0);
    }
}


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

int main() {
  long double a,b,x; cin >> a >> b >> x;
  if(a*a*b/2.0 == x){
    cout << 45 << endl;
  }
  else if(a*a*b/2.0 > x){
    long double tang = b*b*a/x/2.0;
    long double ang = atan(tang);
    cout << fixed << setprecision(10) << ang / 3.141592653589 * 180.0 << endl;
  }
  else{
    double tang = 2.0 * b / a - 2.0 * x / a / a / a;
    double ang = atan(tang);
    cout << fixed << setprecision(10) << ang * 180.0 / 3.141592653589 << endl;
  }
}

Measured memory_bytes: 256
import scala.io.StdIn
import scala.annotation.tailrec
import scala.collection.mutable.HashMap
import scala.collection.mutable.HashSet

object Main extends App {
  val Array(h, w) = StdIn.readLine.split(" ").map(_.toInt)
  val table = Iterator.continually(StdIn.readLine)
    .take(h)
    .map(_.map(_ == '#').toArray)
    .toArray

  @inline
  def flat(i:Int, j:Int):Int = i * w + j

  val ans = {
    val dx = Array(0, 1, 0, -1)
    val dy = Array(-1, 0, 1, 0)
    val uft = new UnionFindTree(flat(h, w))

    for{
      i <- 0 until h
      j <- 0 until w
    } {
        (0 until 4).foreach(k => {
          val y = i + dy(k)
          val x = j + dx(k)
          if(0 <= y && y < h && 0 <= x && x < w &&
              table(i)(j) != table(y)(x) &&
              !uft.same(flat(i, j), flat(y, x))) {
            uft.unite(flat(i,j), flat(y,x))
          }
        })
    }

    val map = HashMap.empty[Int,(Int,Int)]

    for {
      i <- 0 until h
      j <- 0 until w
    } {
      val r = uft.root(flat(i,j))
      if(uft.set.contains(r)) {
        val b = if(table(i)(j)) 1 else 0
        val w = if(b == 1) 0 else 1
        map(r) = (map.getOrElseUpdate(r,(0,0))._1 + b , map.getOrElseUpdate(r,(0,0))._2 + w)
      }
    }
    map.values./:(0L)((acc,e) => {
      acc + e._1.toLong * e._2.toLong
    })
  }

  println(ans)

  class UnionFindTree(n:Int) {
    private val par  = Array.range(0, n)
    private val rank = Array.fill(n)(1)
    val set = HashSet.empty[Int]

    def root(x:Int):Int = {
      if(par(x) == x) x
      else { par(x) = root(par(x)); par(x) }
    }

    def same(x:Int, y:Int):Boolean = root(x) == root(y)

    def unite(x:Int, y:Int):Unit = {
      val rx = root(x)
      val ry = root(y)
      if(rx == ry) return

      if(rank(rx) < rank(ry)) {
        par(rx) = ry
        set += ry
        if(set.contains(rx)) set -= rx
      }
      else {
        par(ry) = rx
        if(rank(rx) == rank(ry)) rank(rx) += 1
        set += rx
        if(set.contains(ry)) set -= ry
      }
    }
  }
}

Measured memory_bytes: 43516
#include<bits/stdc++.h>
using namespace std;
struct node{
	int from,to,v;
}edge[5005];
long long dis[2505];
int main(){
	int n,m,p;
	scanf("%d%d%d",&n,&m,&p);
	for(int i=1;i<=m;i++){
		scanf("%d%d%d",&edge[i].from,&edge[i].to,&edge[i].v);
		edge[i].v=p-edge[i].v;
	}
	memset(dis,0x7f,sizeof(dis));
	long long inf=dis[0];
	dis[1]=0;
	for(int i=1;i<=2*n;i++){
		//bool flag=0;
		for(int j=1;j<=m;j++){
			int a=edge[j].from;
			int b=edge[j].to;
			int c=edge[j].v;
			if(dis[a]==inf)continue;
			if(dis[b]>dis[a]+1ll*c){
				if(i<n)dis[b]=dis[a]+c;
				else dis[b]=-1e18;
			}
		}
		//if(!flag)break;
	}
	if(dis[n]==-1e18)cout<<-1;
	else cout<<max(1ll*0,-dis[n]);
}

Measured memory_bytes: 384
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const int mod = 1000000007;
struct mint{
	ll x;
	mint(ll x = 0):x((x%mod+mod)%mod){}
	mint operator-() const{return mint(-x);}
	mint& operator+=(const mint a){
		if((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator-=(const mint a){
		if((x += mod-a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator*=(const mint a){
		(x *= a.x) %= mod;
		return *this;
	}
	mint operator+(const mint a) const{
		mint res(*this);
		return res+=a;
	}
	mint operator-(const mint a) const{
		mint res(*this);
		return res-=a;
	}
	mint operator*(const mint a) const{
		mint res(*this);
		return res*=a;
	}
	mint pow(ll t) const{
		if(!t) return 1;
		mint a = pow(t>>1);
		a *= a;
		if(t&1) a *= *this;
		return a;
	}
	mint inv() const{
		return pow(mod-2);
	}
	mint& operator/=(const mint a){
		return (*this) *= a.inv();
	}
	mint operator/(const mint a) const{
		mint res(*this);
		return res/=a;
	}
	bool operator==(const mint a){
		return x == a.x;
	}
};

struct Combination{
	vector<mint> fact, ifact;
	Combination(int n):fact(n+1),ifact(n+1){
		assert(n < mod);
		fact[0] = 1;
		for(int i = 1; i <= n; i++) fact[i] = fact[i-1]*i;
		ifact[n] = fact[n].inv();
		for(int i = n; i >= 1; i--) ifact[i-1] = ifact[i]*i;
	}
	mint operator()(int n, int k){
		if(k < 0 || k > n) return 0;
		return fact[n]*ifact[k]*ifact[n-k];
	}
};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int k;
    string s;
    cin >> k >> s;
    int n = s.size();
    mint ans = 0;
    Combination comb(n+k);
    for(int i = 0; i <= k; ++i){
        mint now = mint(26).pow(k-i);
        now *= mint(25).pow(i);
        now *= comb(i+n-1, n-1);
        ans += now;
    }
    cout << ans.x << endl;
    return 0;
}

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

int main()
{
	long long n;
	string s="";
	cin>>n;
	
	while(n--)
	{
		s=s+char(n%26+'a');
		n/=26;
	} 
	reverse(s.begin(),s.end()); 
	cout<<s;
	return 0;
 } 

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

int main() {
  int A, B, count = 0;
  cin >> A >> B;
  for (int i = A; i <= B; i++) {
  	int dig_1, dig_2, dig_4, dig_5;
    dig_1 = i % 10;
    dig_2 = (i / 10) % 10;
    dig_4 = (i / 1000) % 10;
    dig_5 = i / 10000;
    if (dig_1 == dig_5 && dig_2 == dig_4) {
      count++;
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 256
//84104971101048411497 - Can you guess what does this mean?
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef complex<double> point;
#define mapii map<int, int>
#define debug(a) cout << #a << ": " << a << endl
#define debuga1(a, l, r) fto(i, l, r) cout << a[i] << " "; cout << endl
#define fdto(i,  r, l) for(int i = (r); i >= (l); --i)
#define fto(i, l, r) for(int i = (l); i <= (r); ++i)
#define forit(it, var) for(__typeof(var.begin()) it = var.begin(); it != var.end(); it++)
#define forrit(rit, var) for(__typeof(var.rbegin()) rit = var.rbegin(); rit != var.rend(); rit++)
#define ii pair<int, int>
#define iii pair<int, ii>
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define X real()
#define Y imag()
#define maxN 2005
#define oo 2000000007
#define EPS 1e-9
#define sz(a) (int)a.size()

const double PI = acos(-1.0);

double fRand(double fMin, double fMax)
{
    double f = (double)rand() / RAND_MAX;
    return fMin + f * (fMax - fMin);
}

template <class T>
T min(T a, T b, T c) {
    return min(a, min(b, c));
}

template <class T>
T max(T a, T b, T c) {
    return max(a, max(b, c));
}

int n, m, a[maxN];
vector<int> b;

int main () {
    scanf("%d%d", &n, &m);
    fto(i, 1, m) scanf("%d", &a[i]);

    fto(i, 1, m)
        if (a[i]&1) {swap(a[1], a[i]); break;}
    fdto(i, m, 1)
        if (a[i]&1) {swap(a[m], a[i]); break;}
    fto(i, 2, m-1)
        if (a[i]&1) {puts("Impossible"); return 0;}

    if (a[1] > 1) b.pb(a[1]-1);
    fto(i, 2, m-1) b.pb(a[i]);
    if (m == 1) b.pb(1);
    else b.pb(a[m]+1);

    fto(i, 1, m) printf("%d ", a[i]);
    printf("\n%d\n", sz(b));
    forit(it, b) printf("%d ", *it);

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
#include <functional>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef vector<vector<int>> v2int;
typedef vector<ll> vll;
typedef vector<vector<ll>> v2ll;
typedef list<int> liint;
typedef pair<int, int> pint;
const int INF = int(2e9);
const ll LINF = ll(2e9) * ll(2e9);
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T, class C> void chmax(T& a, C b) { a > b ? : a = b; }
template<class T, class C> void chmin(T& a, C b) { a < b ? : a = b; }



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

    int N;
    cin >> N;
    set<string> Snum;
    rep(i, N) {
        string S;
        cin >> S;
        Snum.insert(S);
    }
    cout << Snum.size() << endl;
    return 0;
}

Measured memory_bytes: 19184
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    void Solve()
    {
        int T = read.NextInt();
        while (T-- > 0)
        {
            int[] A = read.NextIntArray();
            if (DFS(0, A, -1, -1)) Console.WriteLine("YES");
            else Console.WriteLine("NO");
        }
    }
    bool DFS(int i, int[] A, int preva, int prevb)
    {
        if (i == A.Length) return true;
        if (A[i] > preva && DFS(i + 1, A, A[i], prevb)) return true;
        if (A[i] > prevb && DFS(i + 1, A, preva, A[i])) return true;
        return false;
    }

    static void Main() { new Program().Solve(); }
    static Read read = new Read();
    class Read
    {
        private Queue<string> que = new Queue<string>();
        public string Next() { return Dequeue(); }
        public int NextInt() { return int.Parse(Dequeue()); }
        public long NextLong() { return long.Parse(Dequeue()); }
        public double NextDouble() { return double.Parse(Dequeue()); }
        public int[] NextIntArray() { return Array.ConvertAll(Console.ReadLine().Split(), int.Parse); }
        private string Dequeue()
        {
            if (que.Count == 0) foreach (var s in Console.ReadLine().Split()) que.Enqueue(s);
            return que.Dequeue();
        }
    }
}

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

int main() {
  int m, f, b;
  cin >> m >> f >> b;
  
  if (m >= b) {
    cout << 0 << endl;
  } else if (m + f >= b) {
    cout << b - m << endl;
  } else {
    cout << "NA" << endl;
  }
  
  return 0;
  
}



Measured memory_bytes: 3116
#include "bits/stdc++.h"
using namespace std;
/////////////////// TYPES & MACROS ///////////////////////////////
#define mp make_pair
#define eb emplace_back
#define pb push_back
#define all(x) x.begin(),x.end()
#define ff first
#define ss second
#define vv vector
#define exist(s,e) (s.find(e)!=s.end())
#define sz(x) ((int)(x).size())
// #define int ll
typedef long long ll; typedef long double ld; typedef double dd;typedef vector<int> vi; typedef pair<int, int> pii;typedef pair<ll,ll> pll;
ll INFLL=(ll)4e18, MOD=1e9+7; const int INF=0x3f6f6f6f;
//////////////////// DEBUG /////////////////////////////////////////
#define D(x) cerr<<#x<<" is:\t"<<x<<'\n';
#define DD(x,y) cerr<<'('<<#x<<','<<#y<<") are:\t"<<x<<' '<<y<<'\n';
#define DDD(x,y,z) cerr<<'('<<#x<<','<<#y<<','<<#z<<") are:\t"<<x<<' '<<y<<' '<<z<<'\n';
/////////////////// VARIABLES & FUNCTIONS//////////////////////////
vv<vv<int>> adj; vi vis, color, level; int dx8[]={0,1,1,1,0,-1,-1,-1}, dy8[]={1,1,0,-1,-1,-1,0,1},dx4[]={0,1,0,-1}, dy4[]={1,0,-1,0};
inline ll mexp(ll x,ll n,ll m=MOD){ll res=1;x%=m;while(n){if(n&1)res=(res*x)%m;n>>=1;x=(x*x)%m;}return res;}
inline bool ispow2(ll x){ return x && (!(x&(x-1)));}
inline ll gcd(ll a, ll b){while (a>0 && b>0){if(a>b)a%=b;else b%=a;}return a+b;}


//////////////////// MAIN STARTS //////////////////////////////////
int32_t main(void){
ios_base::sync_with_stdio(false);cin.tie(NULL); cout.tie(NULL);
cout<<fixed;cerr<<fixed; cout<<setprecision(10); cerr<<setprecision(3);
// mt19937 genr(chrono::high_resolution_clock::now().time_since_epoch().count());


ll n,p; cin>>n>>p;
ll ans=1;
for(ll i=2;i*i<=p;++i){
    int ct=0;
    while(p%i==0) ct++, p/=i;
    ct/=n;
    ll cur=i;
    while(ct){
        if(ct&1) ans*=cur;
        cur*=cur; ct>>=1;
    }
    DD(i,ct);
}
if(n==1) ans*=p;
cout<< ans <<'\n'; 

return 0;
}


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

string divide[4] ={"dream", "dreamer", "erase", "eraser"};

int main(){
 string S;
  cin>>S;
  reverse(S.begin(),S.end());
  for(int i=0;i<4;++i) reverse(divide[i].begin(), divide[i].end());
  bool can = true;
    for (int i = 0; i < S.size();) {
        bool can2 = false; 
        for (int j = 0; j < 4; ++j) {
            string d = divide[j];
            if (S.substr(i, d.size()) == d) { 
                can2 = true;
                i += d.size(); 
            }
        }
        if (!can2) { 
            can = false;
            break;
        }
    }

    if (can) cout << "YES" << endl;
    else cout << "NO" << endl;
}

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

// this question teach us calc totally
// then minus small set, so did not get TLE

public class Main {
    static StringTokenizer st;
    static BufferedReader br;  
    static PrintWriter out;
 
    static int parent[]; 

    public static void main(String[] args) throws IOException {
        br = new BufferedReader(new InputStreamReader(System.in));
 
        int N = nextInt();
        int K = nextInt();

        long ans = 0;
        long mod = (long)1e9 + 7;

        //include 0, so number is N+1
        // int * int is int
        // int * long is long
        for (long x=K; x<=N+1; x++) {
            long small =(0 + x-1) * (x) / 2;
            long big = (N + N-x+1) * (x) / 2;
            ans += big - small +1;
            ans %= mod;
        }
 
        System.out.println(ans);
        
    }
 
    public static int nextInt() throws IOException {
        return Integer.parseInt(next());
    }
    public static long nextLong() throws IOException {
        return Long.parseLong(next());
    }

    public static double nextDouble() throws IOException {
        return Double.parseDouble(next());
    }

    static String next() throws IOException {
        while (st == null || !st.hasMoreTokens())
            st = new StringTokenizer(br.readLine().trim());
        return st.nextToken();
    }
}

Measured memory_bytes: 32792
#include <stdio.h>
 
int main()
{
  char a[4],b[4];
  scanf("%s%s",&a,&b);
  char c[7];
  int i;
  int k=0;
  i = 0;
  while (a[i])
  {
    c[i] = a[i];
    i++;
  }
  while (b[k])
  {
    c[i] = b[k];
    i++;
    k++;
  }
  c[i] = '\0';
  int d;
  i = 0;
  d = 0;
  while (c[i + 1])
  {
    d += c[i] - '0';
    d *= 10;
    i++;
  }
  d += c[i]-'0';
  i = 0;
  while (i * i < d)
  {
    i++;
  }
  if (i*i == d)
  {
    printf("Yes");
  }
  else
  {
    printf("No");
  }
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define REP(i,s,e) for(int i=(s); i<(e);i++)
#define rep(i,n) REP(i,0,n)
#define rep1(i,n) REP(i,1,n)
#define repe(i,n) for(auto &&i:n)
#define all(v) (v).begin(),(v).end()
#define decimal fixed<<setprecision(20)
#define fastcin() cin.tie(0);ios::sync_with_stdio(false)
using namespace std;
using LL = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = 1e9;
const LL LLINF = 1e16;

int main(){
    fastcin();
    char c;
    cin >> c;
    c += 1;
    cout << c << endl;
}

Measured memory_bytes: 256
def make_a_rectangle(N: int, A: list)->int:
    d = {}
    for a in A:
        d.setdefault(a, 0)
        d[a] += 1

    max1, max2 = 0, 0
    for v, p in sorted([(k, v) for k, v in d.items() if v > 1], key=lambda x: -x[0]):
        if max1 == 0:
            max1 = v
            if p >= 4:
                max2 = v
                break
        else:
            max2 = v
            break

    return max1 * max2


if __name__ == "__main__":
    N = int(input())
    A = [int(s) for s in input().split()]
    ans = make_a_rectangle(N, A)
    print(ans)


Measured memory_bytes: 18060
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;

#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define range(i,a,n) for(int i=(a);i<(n);i++)

#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI 3.1415926535897932384

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

template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S acm(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
void YN(bool b){cout<<(b?"YES":"NO")<<"\n";}
void Yn(bool b){cout<<(b?"Yes":"No")<<"\n";}
void yn(bool b){cout<<(b?"yes":"no")<<"\n";}

ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s;a=0;} return os;}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n,k;
	double ans=0;
	double tab=1;
	cin>>n>>k;
	range(i,1,n+1){
		tab=1;
		ll num=i;
		while(num<k){
			num*=2;
			tab/=2;
		}
		ans+=tab;
	}
	fcout(11)<<(ans/n)<<endl;
}


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

using namespace std;
using ll = long long int;

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

	vector<pair<int, int>> P;
	for (int i = 0; i < n; i++)
	{
		int x, y;
		cin >> x >> y;
		P.emplace_back(x, y);
	}

	sort(P.begin(), P.end());
	double sum = 0;
	int count = 0;

	do
	{
		for (size_t i = 0; i < P.size() - 1; i++)
		{
			int dx = P[i].first - P[i + 1].first, dy = P[i].second - P[i + 1].second;
			sum += sqrt(dx * dx + dy * dy);
		}

		count++;
	} while (next_permutation(P.begin(), P.end()));

	double ans = sum / count;
	printf("%.10f\n", ans);
}

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

int main()
{
  int K;
  cin >> K;
  int ans = 0;
  for (int i = 1; i <= K; i++)
  {
    for (int j = 1; j <= K; j++)
    {
      for (int k = 1; k <= K; k++)
      {
        ans += __gcd(__gcd(j,k),i);
      }
    }
  }
  cout << ans;
}

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

int main(){
	int n;
	cin>>n;
	string a;
	cin>>a;
	if(a.length()>n){
		for(int i=0;i<n;i++){
    	cout<<a[i];
	}
	cout<<"...";
	}
	else{
		cout<<a;
	}
	return 0;
}

Measured memory_bytes: 3040
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=(int)1e9+7;
const int INF=(int)1e9;
const ll LINF=(ll)1e18;

int main(){
    ll k,x;
    cin>>k>>x;
    if(500*k>=x)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 256
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt, factorial
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]

def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


def main():
    N, M, R = map(int, input().split())
    R = list(map(lambda x: int(x) - 1, input().split()))

    matrix = [[INF] * N for _ in range(N)]
    for _ in range(M):
        a, b, c = map(int, input().split())
        matrix[a - 1][b - 1] = c
        matrix[b - 1][a - 1] = c

    for i in range(N):
        matrix[i][i] = 0

    for m in range(N):
        for s in range(N):
            for e in range(N):
                if matrix[s][m] != INF and matrix[m][e] != INF:
                    matrix[s][e] = min(matrix[s][e], matrix[s][m] + matrix[m][e])

    ans = INF
    for r in permutations(R):
        tmp = 0
        for i in range(len(r) - 1):
            tmp += matrix[r[i]][r[i + 1]]
        ans = min(ans, tmp)

    print(ans)


if __name__ == '__main__':
    main()


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

main(){
	int x, y, z;
  	cin >> x >> y;
  	z = x+y ;
  	if(z<24){cout << z <<endl;}
  	else if (z == 24){cout << 0 << endl;}
  	else {cout << z-24 << endl;}
  	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF (int)1e9
#define endl "\n"
#define ll long long
#define ull unsigned long long

using namespace std;

int main()
{
    ll n;
    cin >> n;
    ll ans = 0;

    ans += 1000 * (n / 500);
    n %= 500;
    ans += 5 * (n / 5);
    cout << ans << endl;
}

Measured memory_bytes: 256
/**
 *   author: sahushivam
 *   created: 11 January 2020 (Saturday)  16:29:46
**/
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define INF 1e18
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define int long long

void solve(){
	int n;
	cin>>n;
	vector<pair<string,int>> a(n);
	for(int i=0;i<n;i++)
	{
		cin>>a[i].F>>a[i].S;
	} 
	string ss;
	cin>>ss;
	int h=0;
	int sum=0;
	for(int i=0;i<n;i++)
	{
		if(a[i].F==ss)
		{
			h=i;
			break;
		}
	}
	for(int i=h+1;i<n;i++)
	{
		sum+=a[i].S;
	}
	cout<<sum;

}

signed main(){
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL); 
    int t=1; while(t--) solve();
    return 0;
}

Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {

  public static void main(String[] args) {
    InputReader in = new InputReader(System.in);
    PrintWriter out = new PrintWriter(System.out);

    int n = in.nextInt();
    String s = in.next();
    String t = in.next();

    StringBuilder sb = new StringBuilder();

    for (int i = 0; i < n; i++) {
      sb.append(s.charAt(i));
      sb.append(t.charAt(i));
    }

    out.println(sb.toString());

    out.close();
  }

  static class InputReader {
    public BufferedReader reader;
    public StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
      reader = new BufferedReader(new InputStreamReader(stream), 32768);
      tokenizer = null;
    }

    public String next() {
      while (tokenizer == null || !tokenizer.hasMoreTokens()) {
        try {
          tokenizer = new StringTokenizer(reader.readLine());
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }
      return tokenizer.nextToken();
    }

    public int nextInt() {
      return Integer.parseInt(next());
    }

    public long nextLong() {
      return Long.parseLong(next());
    }

    public double nextDouble() {
      return Double.parseDouble(next());
    }
  }

  public static int[][] mergeSort(int[][] a) {
    if (a.length <= 1)
      return a;

    int mid = a.length / 2;
    int[][] left = new int[mid][2];
    int[][] right = new int[a.length - mid][2];

    for (int i = 0; i < mid; ++i)
      left[i] = a[i];

    for (int i = mid; i < a.length; ++i)
      right[i - mid] = a[i];

    return merge(mergeSort(left), mergeSort(right));
  }

  public static int[][] merge (int[][] l, int[][] r) {
    int[][] merged = new int[l.length + r.length][2];

    int i = 0, j = 0, k = 0;
    while (i < l.length && j < r.length) {
      if (l[i][1] < r[j][1] || l[i][1] == r[j][1] && l[i][0] <= r[j][0])
        merged[k++] = l[i++];
      else
        merged[k++] = r[j++];
    }

    while (i < l.length)
      merged[k++] = l[i++];
    while (j < r.length)
      merged[k++] = r[j++];

    return merged;
  }
}



Measured memory_bytes: 20692
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<map>
#include<queue>
#include<string>
#include<sstream>
#include<cmath>
#include<numeric>
using namespace std;


int main(){

  int x, y;
  while(cin >> x >> y){
    if( x == 0 && y == 0 ) break;

    if( x < y ) cout << x << " " << y << endl;
    else cout << y << " " << x << endl;

  }

  return 0;
}








// EOF

Measured memory_bytes: 2992
import sys
input = sys.stdin.readline
N = int(input())
a = [int(i) for i in input().split()]
li = [False] * 8
count_over = 0
for i in range(N) :
    if 1 <= a[i] <= 399 :
        if li[0] == False :
            li[0] = True
    if 400 <= a[i] <= 799 :
        if li[1] == False :
            li[1] = True
    if 800 <= a[i] <= 1199 :
        if li[2] == False :
            li[2] = True
    if 1200 <= a[i] <= 1599 :
        if li[3] == False :
            li[3] = True
    if 1600 <= a[i] <= 1999 :
        if li[4] == False :
            li[4] = True
    if 2000 <= a[i] <= 2399 :
        if li[5] == False :
            li[5] = True
    if 2400 <= a[i] <= 2799 :
        if li[6] == False :
            li[6] = True
    if 2800 <= a[i] <= 3199 :
        if li[7] == False :
            li[7] = True
    if 3200 <= a[i] :
        count_over += 1
sum = 0
for i in range(8) :
    if li[i] :
        sum+=1
maxx = sum+count_over
minn = 0
if sum == 0 :
    minn = 1
else :
    minn = sum
print(minn,maxx)

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

int main()
{
 
  int N;cin>>N;
  vector<double> v(N);
  for (int i=0;i<N;i++)
    cin>>v[i];
  
  sort(v.begin(),v.end());
  
  double a = v[0];
  for (int i=1;i<N;i++)
  {
    a += v[i];
    a /= 2;
  }
  cout<<a<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

int main() {
    int n;
    cin >> n;
    vector<int> x(n), a(n*n,0);
    vector<P> ls;
    for(int i=0;i<n;i++){
        cin >> x[i];
        ls.push_back(P(x[i],i));
    }
    sort(ls.begin(),ls.end());
    int l = 0;
    bool ok = true;
    for(int i=0;i<n;i++){
        int m = ls[i].second, cnt = 0;
        a[x[m]-1] = m+1;
        while(cnt < m && l < x[m]-1){
            if(a[l]==0){
                a[l] = m+1;
                cnt++;
            }
            l++;
        }
        if(cnt < m){
            ok = false;
            break;
        }
    }
    for(int i=0;i<n;i++){
        int m = ls[i].second, cnt = 0;
        while(cnt < n-m-1){
            if(a[l]==0){
                if(l < x[m]){
                    ok = false;
                    break;
                }
                a[l] = m+1;
                cnt++;
            }
            l++;
        }
    }
    if(ok){
        cout << "Yes" << endl;
        for(int i=0;i<n*n;i++){
            cout << a[i] << " \n"[i==n*n-1];
        }
    }
    else{
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 2176
#include<stdio.h>
#include<stdlib.h>

int compare_int(const void *a, const void *b)
{
    return *(int*)a - *(int*)b;
}

int main()
{
    int n, m, x[100000], temp, dif[99999], sum = 0;
    scanf("%d%d", &n, &m);
    for(int i = 0; i < m; i++)
    {
        scanf("%d", &(x[i]));
    }
    qsort(x, m, sizeof(int), compare_int);
    for(int i = 0; i < m - 1; i++)
    {
        dif[i] = abs(x[i] - x[i + 1]);
    }
    qsort(dif, m - 1, sizeof(int), compare_int);
    for(int i = 0; i < m - n; i++)
    {
        sum += dif[i];
    }
    printf("%d", sum);
    return 0;
}


Measured memory_bytes: 1396
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define MAXV 10001

int main(){
    int a[MAXV], b[MAXV], i, temp;

    i = 0;

    while(true){
        cin >> a[i] >> b[i];
        if(b[i] == 0 && a[i] == 0){
            break;
        }
        i++;
    }

    i = 0;

    while(true){
        if(a[i] == 0 && b[i] == 0){
            break;
        }
        if(a[i] > b[i]){
            temp = a[i];
            a[i] = b[i];
            b[i] = temp;
        }
        cout  << a[i] << " " << b[i] << endl;
        i++;
    }
}


Measured memory_bytes: 3036
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
  int N, K;
  cin >> N >> K;
  vector<int> h(N);
  for(int i = 0; i < N; i++){
    cin >> h[i];
  }
  sort(h.begin(),h.end());
  int Min = 1000000000;
  for(int i = 0; i < N - K + 1; i++){
    //cout << h[i+K-1]  << " " << h[i] << endl;
    //cout << h[i+K-1] - h[i] << endl;
    Min = min(Min,h[i+K-1] - h[i]);
  }
  cout << Min << endl;
  return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <regex>
using namespace std;
typedef long long ll;

#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a, 0, sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define SIZE(array) (sizeof(array) / sizeof(array[0]))

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

#define MAX_V 100000

#define MOD 1000000007L
#define INF 100000000000

signed main() {
	int a, b;
	cin >> a >> b;
	cout << (a + b) % 24 << endl;
}


Measured memory_bytes: 256
N = int(input())

A = list(map(int, input().split()))

X = [0]*N

for i in range(N):
    X[0] += (-1)**(i)*A[i]

for j in range(0,N-1):
    X[j+1] = 2 * (A[j] - int(X[j]/2))

print(" ".join(map(str, X)))

Measured memory_bytes: 84452
use std::io::prelude::*;
use std::io::stdin;
use std::str::FromStr;

fn main() {
    let a: i32 = read();
    let b: i32 = read();
    let c: i32 = read();
    let d: i32 = read();
    println!(
        "{}",
        if a + b > c + d {
            "Left"
        } else if a + b < c + d {
            "Right"
        } else {
            "Balanced"
        }
    );
}

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|b| b.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}


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

using namespace std;

int main() {

	vector<int> a;

	for(int i = 0; i < 3; i++) {
		int x;
		scanf("%d", &x);
		a.push_back(x);
	}

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

	int count = 0;

	for(int i = 1; i < 3; i++) {
		count += abs(a[i-1] - a[i]);
	}

	printf("%d\n", count);



	return 0;
}

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

int main(void)
{
    char s[506];
    int a = 0;
    cin >> s;
    for(int i = 0; s[i] != '\0'; ++i)
        if(s[i] == '+')
            a++;
        else
            a--;
    cout << a <<endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void) {
  int a,b,c;
  scanf("%d%d", &a,&b);
  c = a*b;
  if (c%2 == 0) {
    printf("%s\n", "Even");
  } else {
    printf("%s\n", "Odd");
  }
  return 0;
}

Measured memory_bytes: 1640
#include <atcoder/all>
#include <bits/stdc++.h>
#define FOR(i, a, n) for(ll i = (ll)a; i < (ll)n; i++)
#define FORR(i, n) for(ll i = (ll)n - 1LL; i >= 0LL; i--)
#define rep(i, n) FOR(i, 0, n)
#define ALL(x) begin(x), end(x)
using namespace std;
using ll = long long;
constexpr ll Mod = 998244353;
constexpr ll mod = 1e9 + 7;
constexpr ll inf = 1LL << 60;
const double PI = acos(-1);
template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) {
    return a < b && (a = b, true);
}
template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) {
    return a > b && (a = b, true);
}
/*-------------------------------------------*/

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

    int n, d;
    cin >> n >> d;
    int x[1000][2];
    rep(i, n) rep(j, 2) cin >> x[i][j];

    atcoder::two_sat ts(n);
    rep(i, n) rep(j, i) rep(k, 4) if(abs(x[i][k >> 1] - x[j][k & 1]) < d)
        ts.add_clause(i, k >> 1, j, k & 1);

    if(ts.satisfiable()) {
        cout << "Yes\n";
        auto ans = ts.answer();
        rep(i, n) cout << x[i][!ans[i]] << endl;
    } else
        cout << "No\n";

    return 0;
}

Measured memory_bytes: 3744
#include<bits/stdc++.h>
#define forn(i,n) for(int i = 0; i < n; i++)
#define forr(i,a,n) for(int i = a; i<= n; i++)
#define __ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define fi first
#define se second
#define pb push_back
#define all(u) u.begin(),u.end()
#define lli long long int
#define ld long double

using namespace std;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector<vi> vvi;
int a, b, k;
int main(){__
	cin >> k >> a >> b;
	forr(i,a,b){
		if(i % k == 0){
			cout << "OK\n";
			return 0;
		}
	}
	cout << "NG\n";
	return 0;
}



Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
#define fo(i, n) for (i = 0; i < n; i++)
#define ll long long
#define pb push_back
#define mp make_pair
// #define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for (auto it = a.begin(); it != a.end(); it++)
mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());
int mpow(int base, int exp);
void ipgraph(int n, int m);
void dfs(int u, int par);
const int mod = 1'000'000'007;
const int N = 3e5, M = N;

ll knapsack(ll wt[], ll val[], ll n, ll W)
{
    ll dp[n + 1][W + 1];
    ll i, j;
    for (i = 0; i < n + 1; i++)
    {
        for (j = 0; j < W + 1; j++)
        {
            if (i == 0 || j == 0)
            {
                dp[i][j] = 0;
            }

            else if (wt[i - 1] <= j)
            {
                dp[i][j] = max(dp[i - 1][j], val[i - 1] + dp[i - 1][j - wt[i - 1]]);
            }

            else
            {
                dp[i][j] = dp[i - 1][j];
            }
        }
    }

    return dp[n][W];
}

void solve()
{
    ll i, j, n, m, W;
    cin >> n >> W;
    ll wt[n];
    ll val[n];
    fo(i, n)
    {
        cin >> wt[i];
        cin >> val[i];
    }
    ll ans = knapsack(wt, val, n, W);
    cout << ans << "\n";
}

int main()
{
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    srand(chrono::high_resolution_clock::now().time_since_epoch().count());

    int t = 1;
    //cin >> t;
    while (t--)
    {
        solve();
    }

    return 0;
}


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

#ifdef DEBUG
#define debug(x) cout << #x << ": " << x << endl
#else
#define debug(x)
#endif

#define REP(i, n) for(int i = 0; i < (n); i++)
#define REPS(i, n) for(int i = 1; i <= (n); i++)
#define ALL(v) (v).begin(), (v).end()

#define pb push_back
#define mp make_pair
#define mt make_tuple

using namespace std;

using ll = long long;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;

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

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

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

    int N; cin >> N;
    vi L(2*N); REP(i, 2*N) cin >> L[i];
    sort(ALL(L));
    int ans = 0;
    REP(i, N) ans += min(L[2*i], L[2*i+1]);
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>

int hantei(char A[],char B[]){
    for(int i = 0;i < strlen(A);i++){
        if(A[i] != B[i]) return 0;
    }
    return 1;
}

void rot(char A[]){
    char keep;
    keep = A[0];
    for(int i = 0;i < strlen(A)-1;i++){
        A[i] = A[i+1];
    }
    A[strlen(A)-1] = keep;
}

int main(){
    char S[100],T[100];
    scanf("%s%s",S,T);
    int len = strlen(S);
    for(int i = 0;i < len;i++){
        if(hantei(S,T) == 1){
            printf("Yes\n");
            return 0;
        }
        rot(S);
    }
    printf("No\n");
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int main(){
  int s = 0;
  cin >> s;
  int UP = s/100;
  int DOWN = s-UP*100;
  if(UP>=0){
    if(UP>=13 || UP ==0){
      if(DOWN>=1 && DOWN<=12){
        cout << "YYMM";
      }
      else{
        cout << "NA";
      }
    }
    if(UP<=12 && UP>=1){
      if(DOWN>=13 || DOWN==0){
        cout << "MMYY";
      }
      if(DOWN>=1 && DOWN<=12){
        cout << "AMBIGUOUS";
      }
    }
  }
}    

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

int main() {
  int N ,M;
  cin >> N >> M;
  
  vector<vector<bool>> G(10, vector<bool>(10));
  rep (i, M)
  {
    int a, b;
    cin >> a >> b;
    --a;
    --b;
    G.at(a).at(b) = G.at(b).at(a) = true; 
  }
  
  vector<int> ord(N);
  rep (i, N)
  {
    ord.at(i) = i;
  }
  
  int count = 0;
  do {
    if (ord.at(0) != 0)
      break;
  	bool ok = true;
    for (int i = 0; i < N - 1; i++)
    {
      if(G.at(ord.at(i)).at(ord.at(i+1)) != true)
      {
        ok = false;
      }
    }
    if (ok == true)
    {
      count++;
    }
  } while (next_permutation(ord.begin(), ord.end()));
  cout << count << endl;
  
}

Measured memory_bytes: 256
#include <vector>
#include <complex>
#include <cstdio>
#include <cassert>
#include <cmath>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()

const double EPS = 1e-8;
const double INF = 1e12;
typedef complex<double> P;
namespace std {
  bool operator < (const P& a, const P& b) {
    return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
  }
}
double cross(const P& a, const P& b) {
  return imag(conj(a)*b);
}
double dot(const P& a, const P& b) {
  return real(conj(a)*b);
}

struct L : public vector<P> {
  L(const P &a, const P &b) {
    push_back(a); push_back(b);
  }
};
bool on_line(const P& a, const L& l){
  return dot(l[0]-a,l[1]-a)<EPS;
}

P crosspoint(const L &l, const L &m) throw(bool){
  double A = cross(l[1] - l[0], m[1] - m[0]);
  double B = cross(l[1] - l[0], l[1] - m[0]);
  if (abs(A) < EPS && abs(B) < EPS) return m[0]; // same line
  if (abs(A) < EPS) throw(false); // !!!PRECONDITION NOT SATISFIED!!!
  return m[0] + B / A * (m[1] - m[0]);
}

int main(){
	int x1,y1,x2,y2;
	for(;~scanf("%d%d%d%d",&x1,&y1,&x2,&y2),x1||y1||x2||y2;){
		try{
			L A(P(x1,y1),P(x2,y2));
			scanf("%d%d%d%d",&x1,&y1,&x2,&y2);
			L B(P(x1,y1),P(x2,y2));
			scanf("%d%d%d%d",&x1,&y1,&x2,&y2);
			L C(P(x1,y1),P(x2,y2));
			P a=crosspoint(A,B),b=crosspoint(B,C),c=crosspoint(C,A);
			if(!on_line(a,A)||!on_line(a,B)||!on_line(b,B)||!on_line(b,C)||!on_line(c,C)||!on_line(c,A)){puts("kyo");continue;}
			double s=abs(cross(a,b)+cross(b,c)+cross(c,a))/2;
			if(s<EPS)puts("kyo");
			else if(s<100000)puts("syo-kichi");
			else if(s<1000000)puts("kichi");
			else if(s<1900000)puts("chu-kichi");
			else puts("dai-kichi");
		}catch(bool e){puts("kyo");}
	}
}

Measured memory_bytes: 1092
#include <bits/stdc++.h>
#define repz(i, z, n) for (decltype(n) i = (z); i < (n); i++)
#define rep(i, n) for (decltype(n) i = 0; i < (n); i++)

#define REPZ(i, z, n) for (decltype(n) i = (z); i <= (n); i++)
#define REP(i, n) for (decltype(n) i = 0; i <= (n); i++)
#define ALL(v) v.begin(), v.end()
#define SIZE(v) ((ll)(v).size())
#define MAX(v) (*max_element(ALL(v)))
#define MIN(v) (*min_element(ALL(v)))
#define INF 1000000000000  // 1E+12

// 略
#define PB push_back
#define F first
#define S second
#define MP make_pair
#define READ cin >>
#define PRINT cout <<
#define PYES cout << "YES" << endl
#define pyes cout << "Yes" << endl
#define POK cout << "OK" << endl
#define PNO cout << "NO" << endl
#define pno cout << "No" << endl
#define PNG cout << "NG" << endl
#define ret return 0

using namespace std;

// デバッグ用
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}

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

#ifdef _DEBUG
#define debug(...) debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

// typedef
typedef long long ll;
typedef unsigned long long ul;
typedef long double ld;
typedef pair<ll, ll> pl;

// const
// 円周率
const ld pi = acos(-1);
// mod用
// 1E+9 +7
const ll mod = (int)1e+9 + 7;
// 1s間で可能なループ回数2E+8回
// int        最大値2147483647         〜2E+9
// long long  最大値9223372036854775807〜9E+18
// 総和accumulate
// 単純リストvector<type> push_back
// 連想配列map<key,value> insert,
// 集合set<type>
// pair キーとバリューを格納 firstとsecondでアクセス
// 小数点指定 cout << fixed << setprecision(15) << endl;
// to_string<->stoi
// stoll(longlong)
// stod(double)
// deep copy v1->v2 copy(v1.begin(), v1.end(), back_inserter(v2) );
// 大文字65-90(-32)
// 小文字97-122(+32)
//  priority_queue<pair<ll, ll>, vector<pair<ll, ll>>, greater<pair<ll, ll>>>

signed main() {
  // faster
  // C言語流の入出力は使用できない
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  int n, m, c;
  cin >> n >> m >> c;
  vector<vector<int>> a(n, vector<int>(m));
  vector<int> b(m);
  rep(i, m) cin >> b[i];
  rep(i, n) rep(j, m) cin >> a[i][j];
  int res = 0;
  rep(i, n) {
    int sum = c;
    rep(j, m) { sum += a[i][j] * b[j]; }
    res += sum > 0;
  }
  cout << res << endl;
  ret;
}


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

using namespace std;

int main()
{
    long n;
    cin>>n;
    int a= n%10;
    if(a==2|| a==4||a==5||a==7||a==9){
        cout<<"hon";
    }
    else if(a==0|| a==1||a==6||a==8){
        cout<<"pon";
    }
    else
    cout<<"bon";

    return 0;
}


Measured memory_bytes: 3540
import java.util.*;
import java.io.*;
import java.math.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        boolean chk = true;
        HashMap<Integer,Integer> map = new HashMap<Integer,Integer>();
        for(int i = 0; i < n; i++){
            int a = sc.nextInt();
            if(map.containsKey(a)){
                chk = false;
                break;
            }else{
                map.put(a,1);
            }
        }
        if(chk){
            System.out.println("YES");
        }else{
            System.out.println("NO");
        }
    }
}

Measured memory_bytes: 100564
#include<stdio.h>
#define N 500000
int H,A[N];
int maxHeapify(int i){
  int l,r,z,largest;
  l = i*2;
  r = i*2+1;

  if(l<=H && A[l]> A[i])  largest = l;
  else  largest = i;
  if(r<=H && A[r] > A[largest]) largest = r;
  if(largest != i){
    z=A[i];
    A[i]=A[largest];
    A[largest]=z;
    maxHeapify(largest);
  }
}
int main(){
  int i;
  scanf("%d",&H);
  for(i=1;i<=H;i++){
    scanf("%d",&A[i]);
  }
  for(i=H/2;i>=1;i--){
    maxHeapify(i);
  }
  for(i=1;i<=H;i++){
    printf(" %d",A[i]);
  }
  printf("\n");
  return 0;
}

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

int main() {
    int T[101][101], r, c;
    cin>> r >> c;
    for(int i = 0; i < r; i++)
        for (int j = 0; j < c; j++)cin >> T[i][j];
    
    for (int i = 0; i <= r; i++)T[i][c] = 0;
    for (int j = 0; j <= c; j++)T[r][j] = 0;
    
    for (int i = 0; i < r; i++){
        for (int j = 0; j<c; j++){
            T[i][c] += T[i][j];
            T[r][j] += T[i][j];
            T[r][c] += T[i][j];
        }
    }
    for (int i = 0; i <= r; i++){
        for (int j= 0; j <= c; j++){
            if (j)cout << " ";
            cout << T[i][j];
        }
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 3096
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <bitset>
#include <random>
#include <complex>
#include <assert.h>
 
using namespace std;
typedef long long ll;
#define endl '\n'
 
/////////////         modの計算
 
#define MOD_IS_PRIME
constexpr ll mod = 1000000007LL;
 
int main() {
	ios::sync_with_stdio(false);
	std::cin.tie(0);
 
	constexpr int K = 16;
 
	vector<ll> v_e = { 0, 765144583, 346175634, 347662323, 5655049, 184117322, 927321758, 444014759, 542573865, 237315285, 417297686, 471090892, 183023413, 660103155, 727008098, 869418286 };
	vector<ll> v_o = { 539588932, 729548371, 700407153, 404391958, 962779130, 184117322, 927321758, 444014759, 542573865, 237315285, 417297686, 471090892, 183023413, 660103155, 727008098, 869418286 };
 
	int T; cin >> T;
	for (int _t = 0; _t < T; _t++) {
		ll N; cin >> N;
		if (N % 2 == 0) {// even
			ll ans = 0;
			ll x = 1;
			for (int i = 0; i < K; i++) {
				ans += (x * v_e[i]) % mod;
				x = (x * N) % mod;
			}
			cout << ans % mod << endl;
		}
		else {// odd
			ll ans = 0;
			ll x = 1;
			for (int i = 0; i < K; i++) {
				ans += (x * v_o[i]) % mod;
				x = (x * N) % mod;
			}
			cout << ans % mod << endl;
		}
	}
 
	return 0;
}

Measured memory_bytes: 3616