akhauriyash/Code-Regression huggingface dataset:
#include <cassert>
#include <vector>
#include <iostream>
using namespace std;

template<long long mod>
class modint{
private:
  long long a;
public:
  constexpr modint(const long long x = 0) noexcept : a(x%mod) {}
  constexpr long long& value() noexcept { return a; }
  constexpr const long long& value() const noexcept { return a; }
  constexpr modint operator+(const modint rhs) const noexcept {
    return modint(*this) += rhs;
  }
  constexpr modint operator-(const modint rhs) const noexcept {
    return modint(*this) -= rhs;
  }
  constexpr modint operator*(const modint rhs) const noexcept {
    return modint(*this) *= rhs;
  }
  constexpr modint operator/(const modint rhs) const noexcept {
    return modint(*this) /= rhs;
  }
  constexpr modint& operator+=(const modint rhs) noexcept {
    a += rhs.a;
    if(a >= mod) a -= mod;
    return *this;
  }
  constexpr modint &operator-=(const modint rhs) noexcept {
    if(a < rhs.a) a += mod;
    a -= rhs.a;
    return *this;
  }
  constexpr modint& operator*=(const modint rhs) noexcept {
    a = a*rhs.a%mod;
    return *this;
  }
  constexpr modint& operator/=(modint rhs) noexcept {
    long long k = mod-2;
    while(k > 0){
      if(k&1){
        *this *= rhs;
      }
      rhs *= rhs;
      k /= 2;
    }
    return *this;
  }
  friend ostream& operator<<(ostream &os, const modint &X){
    return os << X.a;
  }
  friend istream& operator>>(istream &is, modint &X){
    is >> X.a;
    X.a %= mod;
    if(X.a < 0) X.a += mod;
    return is;
  }
};


template<typename T>
struct Combination {
private:
  int sz;
  vector<T> F, F_;
public:
  Combination(int sz) : sz(sz), F(sz+1), F_(sz+1) {
    F[0] = 1;
    for(int i = 0; i < sz; ++i) F[i+1] = F[i]*(i+1);
    F_.back() = (T)1/F.back();
    for(int i = sz-1; i >= 0; --i) F_[i] = F_[i+1]*(i+1);
  }
  T C(int n, int k){
    assert(n <= sz);
    if(n < 0 or k > n) return (T)0;
    return F[n]*F_[k]*F_[n-k];
  }
};

int main(){
  using mint = modint<(int)1e9+7>;
  constexpr int max_n = 2e5;
  Combination<mint> comb(max_n);
  long long n, k;
  cin >> n >> k;
  mint ans = 0;
  for(int i = 0; i < n; ++i){
    if(i > k) break;
    // cerr << comb.C(n,i)*comb.C(n-1,n-i-1) << endl;
    ans += comb.C(n,i)*comb.C(n-1,n-i-1);
  }
  cout << ans << endl;
}


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

class Procon
{
    public Procon() { }
    static void Main(string[] agrs)
    {
        new Procon().Do();
    }

    Scanner cin;

    public void Do()
    {
        cin = new Scanner();
        int N = cin.nextInt();
        string S = cin.nextString();

        var allSet = new HashSet<int>();
        for (int i = 0; i < N; i++)
        {
            allSet.Add(S[i]);
        }

        int max = 0;
        for (int i = 0; i < N; i++)
        {
            var leftSet = new HashSet<int>();
            for (int j = 0; j < i; j++)
            {
                leftSet.Add(S[j]);
            }

            var rightSet = new HashSet<int>();
            for (int j = i; j < N; j++)
            {
                rightSet.Add(S[j]);
            }

            max = Math.Max(leftSet.Count() + rightSet.Count() - allSet.Count(), max);
        }
        Console.WriteLine(max);
    }
}

class Scanner
{
    string[] s;
    int i;
    int max_i;

    public Scanner()
    {
        s = new string[0];
        max_i = 0;
        i = 0;
    }

    public string nextString()
    {
        if (i >= s.Length)
        {
            s = Console.ReadLine().Split(' ');
            max_i = s.Length;
            i = 0;
            if (max_i == 0)
            {
                return "";
            }
            return s[i++];
        }
        else
        {
            return s[i++];
        }
    }

    public int nextInt()
    {
        return int.Parse(nextString());
    }


    public long nextLong()
    {
        return long.Parse(nextString());
    }

    public double nextDouble()
    {
        return double.Parse(nextString());
    }

    public string[] arrayString()
    {
        return Console.ReadLine().Split(' ');
    }

    public int[] arrayInt()
    {
        string[] str = Console.ReadLine().Split(' ');
        int[] array = new int[str.Length];
        for (int i = 0; i < str.Length; i++)
        {
            array[i] = int.Parse(str[i]);
        }
        return array;
    }

    public long[] arrayLong()
    {
        string[] str = Console.ReadLine().Split(' ');
        long[] array = new long[str.Length];
        for (int i = 0; i < str.Length; i++)
        {
            array[i] = long.Parse(str[i]);
        }
        return array;
    }

    public double[] arrayDouble()
    {
        string[] str = Console.ReadLine().Split(' ');
        double[] array = new double[str.Length];
        for (int i = 0; i < str.Length; i++)
        {
            array[i] = double.Parse(str[i]);
        }
        return array;
    }
}

Measured memory_bytes: 13396
import sys, math

max_int = 1000000001  # 10^9+1
min_int = -max_int

a, b, h, m = map(int, sys.stdin.readline().split())

alpha = abs(math.pi * (h / 6 + m / 360 - m / 30))
if alpha > math.pi:
    alpha = 2 * math.pi - alpha

print((a ** 2 + b ** 2 - 2 * a * b * math.cos(alpha)) ** 0.5)


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

int main() {
	int H, W;
	cin >> H >> W;
	while(H != 0 || W != 0) {
		for(int j = 0; j < H; j++) {
			for(int i = 0; i < W; i++) {
				cout << '#';
			}
			cout << endl;
		}
		cout << endl;
		cin >> H >> W;
	}
}


Measured memory_bytes: 3072
#include<cstdio>
#include<algorithm>
#define RI register int
#define CI const int&
using namespace std;
const int N=1e6+5;
int n,b[N],ret; char a[N]; bool one;
int main()
{
	RI i,j; for (scanf("%d%s",&n,a),--n,i=0;i<n;++i) b[i]=abs(a[i]-a[i+1]);
	for (i=0;i<n;++i) if (b[i]==1) one=1;
	if (!one) { for (i=0;i<n;++i) if (b[i]==2) b[i]=1; }
	else for (i=0;i<n;++i) b[i]%=2;
	//for (i=0;i<n;++i) printf("%d",b[i]);
	for (i=0;i<n;++i) if (((n-1)^i)==n-1-i) ret^=b[i];
	return printf("%d",ret*(one?1:2)),0;
}

Measured memory_bytes: 5120
#include<bits/stdc++.h>
using namespace std;
#define MAX 105
#define INF (1<<26)

struct state{
  int pos,cost;
  bool operator < (const state &p)const{
    return cost > p.cost;
  }
};

int N,M,L,K,A,H;
int t[MAX][MAX];
vector<int> u;
int d[MAX];

void init(){
  u.clear();
  for(int i=0;i<MAX;i++){
    d[i]=INF;
    for(int j=0;j<MAX;j++){
      if(i==j)t[i][j]=0;
      else t[i][j]=INF;
    }
  }
}


void solve(){
  d[A]=0;
  priority_queue<state> Q;
  Q.push((state){A,0});
  while(!Q.empty()){
    state s=Q.top();Q.pop();
    if(s.pos==H){
      if(s.cost>M)s.cost=s.cost*2-M;
      cout<<s.cost<<endl;
      return;
    }
    if(s.cost>d[s.pos])continue;
    for(int i=0;i<(int)u.size();i++){
      int to=u[i];
      int cost=t[s.pos][to];
      if(s.cost+cost>=d[to]||cost>M)continue;
      d[to]=s.cost+cost;
      Q.push((state){to,d[to]});
    }
  }
  cout<<"Help!"<<endl;
}

int main(){
  while(1){
    cin>>N>>M>>L>>K>>A>>H;
    if(N==0)break;
    init();
    for(int i=0;i<L;i++){
      int a;
      cin>>a;
      u.push_back(a);
    }
    u.push_back(A);
    u.push_back(H);
    for(int i=0;i<K;i++){
      int a,b,c;
      cin>>a>>b>>c;
      t[a][b]=t[b][a]=c;
    }
    for(int k=0;k<N;k++)
      for(int i=0;i<N;i++)
	for(int j=0;j<N;j++)
	  t[i][j]=min(t[i][j],t[i][k]+t[k][j]);
    solve();
  }
  return 0;
}

Measured memory_bytes: 1264
package main

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

func main() {
	io := NewIo()
	defer io.Flush()
	s := getInt64Sice(io.NextLine())
	A, B := s[0], s[1]
	var o int
	for i := 10; i <= 10000; i++ {
		wA := 8 * i / 100
		wB := i / 10
		if int64(wA) == A && int64(wB) == B {
			o = i
			break
		}
	}
	if o == 0 {
		fmt.Println(-1)
	} else {
		fmt.Println(o)
	}
}

type Io struct {
	reader    *bufio.Reader
	writer    *bufio.Writer
	tokens    []string
	nextToken int
}

func NewIo() *Io {
	return &Io{
		reader: bufio.NewReader(os.Stdin),
		writer: bufio.NewWriter(os.Stdout),
	}
}

func (io *Io) Flush() {
	err := io.writer.Flush()
	if err != nil {
		panic(err)
	}
}

func (io *Io) NextLine() string {
	var buffer []byte
	for {
		line, isPrefix, err := io.reader.ReadLine()
		if err != nil {
			panic(err)
		}
		buffer = append(buffer, line...)
		if !isPrefix {
			break
		}
	}
	return string(buffer)
}

func (io *Io) Next() string {
	for io.nextToken >= len(io.tokens) {
		line := io.NextLine()
		io.tokens = strings.Fields(line)
		io.nextToken = 0
	}
	r := io.tokens[io.nextToken]
	io.nextToken++
	return r
}

func (io *Io) NextInt64() int64 {
	i, err := strconv.ParseInt(io.Next(), 10, 64)
	if err != nil {
		panic(err)
	}
	return i
}

func (io *Io) NextFloat() float64 {
	i, err := strconv.ParseFloat(io.Next(), 64)
	if err != nil {
		panic(err)
	}
	return i
}

func (io *Io) PrintLn(a ...interface{}) {
	fmt.Fprintln(io.writer, a...)
}

func (io *Io) Printf(format string, a ...interface{}) {
	fmt.Fprintf(io.writer, format, a...)
}

func (io *Io) PrintInt64(a []int64) {
	b := []interface{}{}
	for _, x := range a {
		b = append(b, x)
	}
	io.PrintLn(b...)
}

func (io *Io) PrintFloat64(a []float64) {
	b := []interface{}{}
	for _, x := range a {
		b = append(b, x)
	}
	io.PrintLn(b...)
}

func (io *Io) PrintStringLn(a []string) {
	b := []interface{}{}
	for _, x := range a {
		b = append(b, x)
	}
	io.PrintLn(b...)
}

func getInt64Sice(arrStr string) []int64 {
	cols := strings.Split(arrStr, " ")
	a := make([]int64, len(cols))
	for i := 0; i < len(cols); i++ {
		v, err := strconv.ParseInt(cols[i], 10, 64)
		if err != nil {
			panic(err)
		}
		a[i] = v
	}
	return a
}

func getStrSice(arrStr string) []string {
	cols := strings.Split(arrStr, " ")
	a := make([]string, len(cols))
	for i := 0; i < len(cols); i++ {
		a[i] = cols[i]
	}
	return a
}

func getFloatSice(arrStr string) []float64 {
	cols := strings.Split(arrStr, " ")
	a := make([]float64, len(cols))
	for i := 0; i < len(cols); i++ {
		f, err := strconv.ParseFloat(cols[i], 64)
		if err != nil {
			panic(err)
		}
		a[i] = f
	}
	return a
}


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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))

template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}

using namespace std;
using tii=tuple<int,int,int>;

int t[55];
set<tii> dp[2];

int main(void){
	int n;
	cin >> n;
	rep(i,n) cin >> t[i];

	dp[0].insert(tii(0,0,0));
	
	rep(i,n){
		int ci=i&1,ni=ci^1;
		dp[ni].clear();
		for(auto &cur:dp[ci]){
			rep(j,3){
				int a[3];
				tie(a[0],a[1],a[2])=cur;
				a[j]+=t[i];
				sort(a,a+3);
				dp[ni].insert(tii(a[0],a[1],a[2]));
			}
		}
	}

	int ans=1<<20;
	for(auto &cur:dp[n&1]){
		int res;
		tie(ignore,ignore,res)=cur;
		chmin(ans,res);
	}
	cout << ans << endl;
	return 0;
}

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

signed main(){
	int n;
	int maxw;
	cin>>n>>maxw;
	int sum = 0;
	vector<int> w(n);
	vector<int> val(n);
	for(int i = 0 ; i < n ;i++){
		cin>>w[i]>>val[i];
		sum+= val[i];
	}
	vector<long long > dp(sum+1,1000000010);
	dp[0] = 0;
	for(int i = 0 ; i < n ;i++){
		for(int j = sum ; j >=val[i] ; j--){
			dp[j] = min(dp[j] , dp[j - val[i]] + w[i]);
		}
	}
	for(int i = dp.size() -1  ; i >= 0  ; i--){
		if(dp[i] <= maxw){
			cout<<i;
			return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#define rep(i,n) for(int i=0;i<(n);i++)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define psortfirst(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.first<b.first;});
#define All(x) (x).begin(),(x).end()
using namespace std;
using pii  = pair<int,int>;
long long gcd(long long a, long long b){return (b == 0 ? a : gcd(b, a%b));}
long long lcm(long long a, long long b){return a*b/gcd(a,b);}
int ctoi(const char c){
  if('0' <= c && c <= '9') return (c-'0');
  return -1;
}
int BinarySearch(int key,int n,int S[]){
  int l=0,r=n;
  while(r-l>1){
    int mid=(l+r)/2;
    if(S[mid]>key)r=mid;
    else l=mid;
  }
  return S[l]==(key?1:0);
}
typedef long long ll;
#define MOD 1000000007
#define EPS 10e-8

ll C[100007];

int main() {
    ll N,D,X,A[107],L=0;cin >> N >> D >>X;
    rep(i,N){
        cin >> A[i];
        L+=(D-1)/A[i]+1;
    }
    cout <<  L+X << endl;
}

Measured memory_bytes: 256
; B - Maximum Difference
; https://beta.atcoder.jp/contests/abc102/tasks/abc102_b

(defun read-split (n) (loop repeat n collect (read)))

(defun input-format ()
  (let* ((n (read))
        (as (read-split n)))
    as))

(defun solve (as)
  (abs (- (reduce #'max as) (reduce #'min as))))

(format t "~A" (solve (input-format)))

Measured memory_bytes: 13284
def Judge(i):
    if i%15==0: return "FizzBuzz"
    if i%5==0:  return "Buzz"
    if i%3==0:  return "Fizz"
    return str(i)

while True:
    m,n=map(int,raw_input().split())
    if m==n==0:break
    L=range(1,m+1)
    j=0
    for i in range(1,n+1):
        c=raw_input()
	if len(L)>1:
            if Judge(i)!=c:
                del L[j]
                j%=len(L)
            else:
                j=(j+1)%len(L)
    print " ".join(map(str,L))

Measured memory_bytes: 4488
#include <bits/stdc++.h>
//#include<fstream>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
#define endl '\n'
#define pb push_back
#define fi first
#define se second
typedef long long ll;
#define double long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define fr(a,b,c) for(int a=b; a<=c; a++)
#define rep(a,b,c) for(int a=b; a<c; a++)
#define all(con) con.begin(),con.end()
#define w(x) int x; cin>>x; while(x--)
const ll infl=0x3f3f3f3f3f3f3f3fLL;
const int infi=0x3f3f3f3f;
//const int mod=998244353;
const int mod=1000000007;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

/*ofstream fout("bcount.out");
ifstream fin("bcount.in");*/

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0),cout.tie(0);
    cout<<fixed<<setprecision(8);
    int k;
    cin>>k;
    rep(i,0,k)
        cout<<"ACL";
    return 0;
}
//1. Always consider edge cases like n = 1
//2. Do something or the other rather than just wasting time

Measured memory_bytes: 3656
#include <bits/stdc++.h>
using i64 = long long;

template <class T = int>
class UF {
    T *par;

    public:
    UF(T n) : par(new T[n]) {
        for (T i = 0; i < n; i++) par[i] = i;
    }
    ~UF() { delete[] par; }

    T root(T x) {
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    bool same(T x, T y) {
        return root(x) == root(y);
    }

    void unite(T x, T y) {
        x = root(x);
        y = root(y);
        if (x != y) par[x] = y;
    }
};

int main() {
    i64 n, m;
    std::cin >> n >> m;
    std::vector<int> a(m), b(m);
    for (int i = 0; i < m; i++) {
        std::cin >> a[i] >> b[i];
        a[i]--;
        b[i]--;
    }

    i64 ret = n * (n - 1) / 2;
    std::deque<i64> q { n * (n - 1) / 2 };
    UF<> uft(n);
    std::vector<i64> size(n, 1);
    for (int i = m - 1; i > 0; i--) {
        if (uft.same(a[i], b[i])) {
            q.push_back(ret);
            continue;
        }
        auto c = size[uft.root(a[i])], d = size[uft.root(b[i])];
        ret -= c * d;
        uft.unite(a[i], b[i]);
        size[uft.root(a[i])] = c + d;
        q.push_back(ret);
    }
    for (auto it = q.rbegin(); it != q.rend(); it++) std::cout << *it << std::endl;

    return 0;
}


Measured memory_bytes: 4096
#include <stdio.h>
#include <stdlib.h>
using namespace std;

int n,i,j,k,u,v,ans;
int son[100005],Next[200005],ed[200005],tot;
int S[100005];

void dfs(int x,int y)
{
	int i,j,k,A=0,B=0;
	for(i=son[x];i;i=Next[i])if(ed[i]!=y)dfs(ed[i],x);
	for(i=son[x];i;i=Next[i])
	if(ed[i]!=y)
	{
		B|=(A&S[ed[i]]);
		A|=S[ed[i]];
	}
	for(k=20;k>=0;--k)if(B&(1<<k))break;
	for(++k;(1<<k)&A;++k);
	if(k>ans)ans=k;
	S[x]=A|(1<<k);
	S[x]-=(S[x]&((1<<k)-1));
}

int main()
{
	scanf("%d",&n);
	for(i=1;i<n;++i)
	{
		scanf("%d%d",&u,&v);
		++tot;Next[tot]=son[u];son[u]=tot;ed[tot]=v;
		++tot;Next[tot]=son[v];son[v]=tot;ed[tot]=u;
	}
	dfs(1,0);
	printf("%d\n",ans);
}


Measured memory_bytes: 5888
#include"bits/stdc++.h"
using namespace std;
using ll=long long;
using ull=unsigned long long;
constexpr auto inf=static_cast<ll>(1e18);
template<typename T=ll>inline T in(){T ret;cin>>ret;return ret;}
template<typename T=ll>inline auto vec2(size_t h,size_t w,T v=T()){return vector<vector<T>>(h,vector<T>(w,v));}
inline void setp(int n){cout<<fixed<<setprecision(n);}
inline void delnl(){cin.ignore(numeric_limits<streamsize>::max(),'\n');}

template<ll _mod>class combination_modulo{
    private:
        vector<ll>factorial_mod;
        inline ll pow_mod(ll x,ll y){x%=mod;return(y==0?1:y%2==0?pow_mod(x*x%mod,y/2):x*pow_mod(x,y-1))%mod;}
    public:
        const ll mod;
        combination_modulo(ll max_n):factorial_mod(max_n+1),mod(_mod)
        {
            factorial_mod[0]=1;
            for(ll i=1;i<=max_n;++i)factorial_mod[i]=factorial_mod[i-1]*i%mod;
        }
        ll operator()(ll n,ll r)
        {
            return n<r?0:factorial_mod[n]*pow_mod(factorial_mod[r]*factorial_mod[n-r],mod-2)%mod;
        }
};
int main()
{
    ll n=in();
    vector<ll>a(n+1);for(auto&i:a)i=in();

    ll d=accumulate(a.begin(),a.end(),0LL)-n*(n+1)/2;
    ll d1_idx=find(a.begin(),a.end(),d)-a.begin();
    ll d2_idx=a.rend()-find(a.rbegin(),a.rend(),d)-1;

    auto cm=combination_modulo<1000000007>(n+1);
    for(ll i=1;i<=n+1;++i){
        ll foo=cm(n+1,i)-cm(n+1-(d2_idx-d1_idx+1),i-1);
        if(foo<0)foo+=cm.mod;
        cout<<foo<<endl;
    }
}


Measured memory_bytes: 2816
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vin=vector<int>;
using vll=vector<long long>;
using vvin=vector<vector<int>>;
using vvll=vector<vector<long long>>;
using vstr=vector<string>;
using vvstr=vector<vector<string>>;
using vch=vector<char>;
using vvch=vector<vector<char>>;
using vbo=vector<bool>;
using vvbo=vector<vector<bool>>;
using vpii=vector<pair<int,int>>;
using pqsin=priority_queue<int,vector<int>,greater<int>>;
#define mp make_pair
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,s,n) for(int i=(s);i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define decp(n) cout<<fixed<<setprecision((int)n)
const int inf=1e9+7;
const ll INF=1e18;

int main(){
    int n;cin>>n;
    if(n%10==3)cout<<"bon"<<endl;
    else if(n%10==0||n%10==1||n%10==6||n%10==8)cout<<"pon"<<endl;
    else cout<<"hon"<<endl;
}

Measured memory_bytes: 3636
#include<stdio.h>
#include<stdlib.h>
#define bin(n,m)(((n)>>(m))&1)

int p[8];

void find(int a,int b, int c,int n){
  int j,i;
  if(n==8){
    for(i=0;i<8;i++){
      for(j=0;j<8;j++)putchar(p[i]==j?'Q':'.');
      puts("");
    }
    exit(0);
  }
  if(p[n]!=-1){
    int t=1<<p[n];
    if(!bin(a|b|c,p[n]))find((a|t)<<1,(b|t),(c|t)>>1,n+1);
    return;
  }
  for(j = 0;j<8;j++)if(!bin(a|b|c,j)){
      p[n]=j;
      int t=1<<j;
      find((a|t)<<1,(b|t),(c|t)>>1,n+1);
      p[n]=-1;
    }
}

int main(){
  int n;
  scanf("%d",&n);
  for(int i=0;i<8;i++)p[i]=-1;
  while(n--){
    int x,y;
    scanf("%d%d",&x,&y);
    p[x]=y;
  }
  find(0,0,0,0);
}
  

    



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

int keta(long long n) {
  int cnt = 0;
  while (n) {
    n /= 10;
    cnt++;
  }
  return cnt;
}

int main() {
  long long x, k, d;
  cin >> x >> k >> d;
  if (x < 0) x = -x;
  if (keta(k) + keta(d) < 17 and x > k * d) {
    x -= k * d;
  } else {
    if (k % 2 == 1) x += d;
    x %= 2 * d;
    x = min(x, 2 * d - x);
  }
  cout << x << endl;
  return 0;
}

Measured memory_bytes: 3556
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
//Wrong Answer
public class Main {
    private static int[] A = new int[2000001];
    private static int heapSize = 0;
    private static void maxHeapify(int k){
        int l = 2*k;
        int r = 2*k+1;
        int largest;
    
        if ((l <= (heapSize)) && (A[l] > A[k])){
            largest = l;
        }else{
            largest = k;
        }
        if ((r <= (heapSize)) && (A[r] > A[largest])){
            largest = r;
        }
        if (largest != k){
            swap(k, largest);
            maxHeapify(largest);
        }
    }
    private static void swap(int i, int j) {
        int tmp = A[i];
        A[i] = A[j];
        A[j] = tmp;
    }
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        while (true){
            String[] line = br.readLine().split(" ");
            String order = line[0];
            if (order.equals("insert")){
                heapSize++;
                int num = Integer.parseInt(line[1]);
                A[heapSize] = num;
                int i = heapSize;
                while (i > 1 && A[i/2] < A[i]) {
                    swap(i, i/2);
                    i = i/2;
                }
            }else if (order.equals("extract")){
                int max = A[1];
                A[1] = 0;
                swap(1, heapSize);
                heapSize--;
                maxHeapify(1);
                System.out.println(max);
            }else{ // end
                break;
            }
        }
    }
}

Measured memory_bytes: 186264
#define DREP(i, s, e) for(register int i = s; i >= e ;i--)
#define  REP(i, s, e) for(register int i = s; i <= e ;i++)

#include <algorithm>
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <bitset>
#include <vector>
#include <cmath>
#include <queue>
#include <map>

using namespace std;
const int maxn = 1000010;

template <typename T> T read() {
	T ans(0), p(1);
	char c = getchar();
	while (!isdigit(c)) {
		if (c == '-') p = -1;
		c = getchar();
	}
	while (isdigit(c)) {
		ans = ans * 10 + c - 48;
		c = getchar();
	}
	return ans * p;
}
int m, n, k;
char s[1000];

int main() {
#ifdef CraZYali
	freopen("a.in", "r", stdin);
	freopen("a.out", "w", stdout);
#endif
	scanf("%s", s + 1);
	s[4]++;
	printf("%s", s + 1);

	return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
#define chmin(a, b) ((a)=min((a), (b)))
#define chmax(a, b) ((a)=max((a), (b)))
#define fs first
#define sc second
#define eb emplace_back
using namespace std;

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

const ll MOD=1e9+7;
const ll INF=1e18;
const double pi=acos(-1);
const double eps=1e-10;

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

const int MAX_N = 410;

vector<vector<P>> G(MAX_N);
vector<int> dist(MAX_N, 1e9);
int dijkstra(int s, int g){
    priority_queue<P, vector<P>, greater<P>> que;
    dist[s] = 0;
    que.push(P(0, s));

    while(!que.empty()){
        ll ccost = que.top().first;
        ll cv = que.top().second;
        que.pop();
        if(dist[cv] < ccost) continue;

        for(auto x : G[cv]){
            ll nv = x.first;
            ll ncost = x.second;
            if(dist[nv] > dist[cv] + ncost){
                dist[nv] = dist[cv] + ncost;
                que.push(P(dist[nv], nv));
            }
        }
    }

    return dist[g];
}

int main(){
    int n, m; cin>>n>>m;
    for(int i=0; i<m; i++){
        int a, b, c; cin>>a>>b>>c;
        G[a].eb(P(b, -c));
    }

    cout << -dijkstra(0, n-1) << endl;
}


Measured memory_bytes: 3120
import java.util.Scanner;

public class Main {
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		String A = sc.next();
		
		if(A.equals("ARC"))
			System.out.println("ABC");
		else if(A.equals("ABC"))
			System.out.println("ARC");
		sc.close();
	}
}

Measured memory_bytes: 35632
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define dbg puts("It's Just Begining.Wait For The End!!!!!\n")
#define CHECK(x) cout << (#x) << " is " << (x) <<"\n";
#define endl printf("\n")
typedef pair<ll,ll> pii;
#define pb push_back
#define ms(a,b) memset(a, b, sizeof(a))
#define in(x) scanf("%lld",&x)
#define out(x) printf("%lld",x)
#define X first
#define Y second
#define sps printf(" ")
#define dou(x) cout<<fixed<<setprecision(6)<<x
#define all(v) v.begin(),v.end()
#define dis(it,it1) distance(it,it1)+1
#define MAX 200005
#define INF 1000000000
#define MOD 1000000007
#define print(cs) printf("Case %lld: ",cs)
#define Yesno(ok) if(ok)puts("YES");else puts("NO")
#define yesno(ok) if(ok)puts("Yes");else puts("No")
ll lcm(ll a,ll b){return ((a*b)/__gcd(a,b));}
int main()
{
    ll i,j,k,l,n,m,r,dis;
    in(n);in(dis);
    pii arr[n];
    ll cnt=0;
    for(i=0;i<n;i++){in(arr[i].X);in(arr[i].Y);
    r=arr[i].X*arr[i].X;
    r+=(arr[i].Y*arr[i].Y);
    if(sqrt(r)<=(double)dis)cnt++;
    }
    out(cnt);endl;
}


Measured memory_bytes: 6880
#include <iostream>

using namespace std;

int prime[25] = { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97 };
int pexp[25] = { 0 };

int main()
{
	int N;
	int tmp;
	int up4 = 0, bet2_4 = 0;
	int up24 = 0, bet2_24 = 0;
	int up14 = 0, bet4_14 = 0;
	int up74 = 0;
	int ret = 0;

	cin >> N;

	for (int i = 1; i <= N; i++) {
		for (int j = 0; j < 25; j++) {
			if (i < prime[j]) break;

			tmp = i;
			while (1) {
				if (tmp % prime[j]) break;
				else {
					pexp[j]++;
					tmp /= prime[j];
				}
			}
		}
	}

	for (int i = 0; i < 25; i++) {
		if (pexp[i] >= 4) up4++;
		else if (pexp[i] >= 2) bet2_4++;

		if (pexp[i] >= 24) up24++;
		else if (pexp[i] >= 2) bet2_24++;

		if (pexp[i] >= 14) up14++;
		else if (pexp[i] >= 4) bet4_14++;

		if (pexp[i] >= 74) up74++;
	}

	if ((up4 >= 2)
		&& (up4 + bet2_4 >= 3)) {
		ret += up4 * (up4 - 1) * (up4 + bet2_4 - 2) / 2;
	}

	if ((up24 >= 1)
		&& (up24 + bet2_24 >= 2)) {
		ret += up24 * (up24 + bet2_24 - 1);
	}

	if ((up14 >= 1)
		&& (up14 + bet4_14 >= 2)) {
		ret += up14 * (up14 + bet4_14 - 1);
	}

	if (up74 >= 1) ret += up74;

	cout << ret << endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define debug(var) do{cout << #var << " : "; view(var);}while(0)
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
template<class T> void view(T e) {cout << e << endl;}
template<class T> void view(const vector<T> &v) {for(const auto &e : v){cout << e << " ";} cout << endl;}
template<class T> void view(const vector<vector<T>> &vv) {for(const auto &v : vv){view(v);}}
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const int inf = 1e9;
const ll inf_l = 1e18;
const int MAX = 1e5;

int dis[1005][1005];

int main() {
    int H, W; cin >> H >> W;
    int c_h ,c_w; cin >> c_h >> c_w;
    c_h--; c_w--;
    int d_h, d_w; cin >> d_h >> d_w;
    d_h--; d_w--;
    vector<string> field(H);
    rep(i,H) cin >> field[i];
    deque<P> q;
    rep(i,H)rep(j,W) dis[i][j] = inf;
    dis[c_h][c_w] = 0;
    q.push_back(P(c_h,c_w));
    while (!q.empty()) {
        P p = q.front(); q.pop_front();
        for (int h = -2; h <= 2; h++) {
            for (int w = -2; w <= 2; w++) {
                if (h == 0 && w == 0) continue;
                int n_h = p.first + h;
                int n_w = p.second + w;
                if (n_h >= 0 && n_h < H && n_w >= 0 && n_w < W && field[n_h][n_w] != '#') {
                    if (abs(h) + abs(w) == 1) {
                        if (chmin(dis[n_h][n_w],dis[p.first][p.second])) {
                            q.push_front(P(n_h,n_w));
                        } 
                    } else {
                        if (chmin(dis[n_h][n_w],dis[p.first][p.second]+1)) {
                            q.push_back(P(n_h,n_w));
                        }
                    }
                }
            }
        }
    }
    int ans = dis[d_h][d_w];
    if (ans == inf) cout << -1 << endl;
    else cout << ans << endl;
}

Measured memory_bytes: 9428
import java.util.*;

// ARC 98-D
// https://beta.atcoder.jp/contests/arc098/tasks/arc098_b

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

		int A = in.nextInt();
		int B = in.nextInt();
		
		System.out.println((A - 1) * (B - 1));
    }
}


Measured memory_bytes: 21972
n=int(input())
a=list(map(int,input().split()))
a.sort()
b=list(map(int,input().split()))
b.sort()
c=list(map(int,input().split()))
c.sort()
ans=0
import bisect
for i in range(n):
    x=bisect.bisect_left(a,b[i])
    y=bisect.bisect_right(c,b[i])
    ans+=x*(n-y)
print(ans)

Measured memory_bytes: 29448
import sys

s = input()

rs = s[::-1]

if s != rs:
    print("No")
    sys.exit()
    
s1 = s[:(len(s)-1)//2]
rs1 = s1[::-1]

if s1 != rs1:
    print("No")
    sys.exit()
    
s2 = s[(len(s)+1)//2:]
rs2 = s2[::-1]

if s2 != rs2:
    print("No")
    sys.exit()
    
    
print("Yes")

Measured memory_bytes: 38384
N = int(input())
A = [list(map(int, input().split())) for i in range(N)]
MOD = 10**9 + 7

I = [[j for j in range(N) if Ai[j]] for Ai in A]

memo = [-1]*(1 << N)
memo[0] = 1
def dfs(state, c):
    if memo[state] != -1:
        return memo[state]
    r = 0
    for i in I[c]:
        if state & (1 << i):
            r += dfs(state ^ (1 << i), c+1)
    memo[state] = r = r % MOD
    return r
print(dfs((1 << N)-1, 0))

Measured memory_bytes: 66908
n = int(input())
*A, = map(int, input().split())
for i in range(n):
    v = A[i]
    j = i - 1
    while j >= 0 and A[j] > v:
        A[j+1] = A[j]
        j -= 1
    A[j+1] = v
    print(*A)



Measured memory_bytes: 5984
n,m=map(int,input().split())
g=[[] for i in range(n)]
for i in range(m):
	u,v=map(int,input().split())
	u-=1
	v-=1
	g[u].append(v)
	g[v].append(u)

vis=[False]*n
stk=[]

cnt=0
tt=0
for i in range(n):
	if not vis[i]:
		cnt+=1
		stk.append(i)
	while len(stk)!=0:
		u=stk[-1]
		stk.pop()
		if vis[u]:
			continue
		vis[u]=True
		for v in g[u]:
			tt+=1
			if not vis[v]:
				stk.append(v)
print(cnt-1)


Measured memory_bytes: 26260
from fractions import gcd
n=int(input())
A=list(map(int,input().split()))
a=1
for i in range(n):
  a=a*A[i]//gcd(a,A[i])
ans=0
for i in range(n):
  ans=ans+a//A[i]
print(ans%(10**9+7))

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

void coutingSort(vector<int>& A, vector<int>& B, int k){
    vector<int> C(k+1);
    fill(C.begin(), C.end(), 0);
    for(int i=0; i<A.size(); i++) C[A[i]]++;
    for(int i=1; i<=k; i++) C[i] += C[i-1];
    for(int i=A.size()-1; i>=0; i--) B[C[A[i]] -1] = A[i], C[A[i]]--;
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n; cin >> n;
    vector<int> A(n), B(n);
    for(int i=0; i<n; i++) cin >> A[i];
    int k = *max_element(A.begin(), A.end());
    coutingSort(A, B, k);
    for(int i=0; i<n; i++) cout << B[i] << " \n"[i==n-1]; 
    return 0;
}


Measured memory_bytes: 18428
from math import sqrt
n = input()
ps = [map(float, raw_input().split()) for i in xrange(n)]
ps.sort()

def cross(a, b, c, d):
    return (b[0]-a[0])*(d[1]-c[1]) - (b[1]-a[1])*(d[0]-c[0])
def convex_hull(ps):
    qs = []
    n = len(ps)
    for p in ps:
        while len(qs)>1 and cross(qs[-1], qs[-2], qs[-1], p) >= 0:
            qs.pop()
        qs.append(p)
    t = len(qs)
    for i in xrange(n-2, -1, -1):
        p = ps[i]
        while len(qs)>t and cross(qs[-1], qs[-2], qs[-1], p) >= 0:
            qs.pop()
        qs.append(p)
    return qs

def dist(a, b):
    return sqrt((a[0]-b[0])**2 + (a[1]-b[1])**2)
def rotating_calipers(ps):
    qs = convex_hull(ps)
    n = len(qs)
    if n == 2:
        return dist(qs[0], qs[1])
    i = j = 0
    for k in xrange(n):
        if qs[k] < qs[i]: i = k
        if qs[j] < qs[k]: j = k
    res = 0
    si = i; sj = j
    while i != sj or j != si:
        res = max(res, dist(qs[i], qs[j]))
        if cross(qs[i], qs[i-n+1], qs[j], qs[j-n+1]) < 0:
            i = (i + 1) % n
        else:
            j = (j + 1) % n
    return res
print "%.09f" % rotating_calipers(ps)

Measured memory_bytes: 19072
#include <stdio.h>

int main(void){
int a;
int h;
int m;
int mm;
int s;
scanf("%d",&a);
h = a / 3600;
mm = a - 3600 * h;
m = mm / 60;
s = a - 3600 * h - 60 * m;
printf("%d:%d:%d\n",h,m,s);
}



Measured memory_bytes: 2128
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		try (Scanner sc = new Scanner(System.in);) {
			int n = sc.nextInt();
			int i = 1;
			int x;
			
			StringBuilder sb = new StringBuilder();
			
			while(true) {
				x = i;
				
				if(x % 3 == 0) {
					sb.append(" " + i);
				} else {
					while(true) {
						if(x % 10 == 3) {
							sb.append(" " + i);
							break;
						}
						
						x/=10;
						if(x == 0) {
							break;
						}
					}
				}
				
				++i;
				if(i > n) {
					break;
				}
			}
			
			System.out.println(sb.toString());
		}
	}
}


Measured memory_bytes: 28116
s = input()
t = input()

ls = len(s)
lt = len(t)
ans = ""
dp = [[0]*(ls+1) for i in range(lt+1)]

for i in range(1,lt+1):
    for j in range(1,ls+1):
        dp[i][j] = max(dp[i-1][j],dp[i][j-1])
        if s[j-1] == t[i-1]:
            dp[i][j] = dp[i-1][j-1]+1

i = lt
j = ls
while i-1>=0 and j-1>=0:
    if dp[i][j] == dp[i-1][j]:
        i -= 1
        continue
    elif dp[i][j] == dp[i][j-1]:
        j -= 1
        continue
    else:

        i -= 1
        j -= 1
        ans = s[j] + ans

print(ans)



Measured memory_bytes: 112860
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const ll INF = 1LL << 62;
const int inf = 1 << 30;
const ll MOD = 1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b, const ll mod=MOD) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b, const ll mod=MOD) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b, const ll mod=MOD) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b, const ll mod=MOD) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);

    vi a(3); for(auto& e : a) cin >> e;
    sort(_all(a));

    string res = (a[0] + a[1] == a[2] ? "Yes":"No");
    cout << res << endl;

    return 0;
}


Measured memory_bytes: 256
def solve():
  m, n = map(int,input().split())
  k = int(input())
  mp = [input() for i in range(m)]
  dp = [[[0] * 3 for j in range(n + 1)] for i in range(m + 1)]
  for i in range(1, m + 1):
    for j in range(1, n + 1):
      for p in range(3):
        dp[i][j][p] = dp[i][j - 1][p] + dp[i - 1][j][p] - dp[i - 1][j - 1][p]
      if mp[i - 1][j - 1] == "J":
        dp[i][j][0] += 1
      elif mp[i - 1][j - 1] == "O":
        dp[i][j][1] += 1
      else:
        dp[i][j][2] += 1
  for i in range(k):
    x1,y1,x2,y2 = map(int,input().split())
    print(dp[x2][y2][0] - dp[x1 - 1][y2][0] - dp[x2][y1 - 1][0] + dp[x1 - 1][y1 - 1][0], dp[x2][y2][1] - dp[x1 - 1][y2][1] - dp[x2][y1 - 1][1] + dp[x1 - 1][y1 - 1][1], dp[x2][y2][2] - dp[x1 - 1][y2][2] - dp[x2][y1 - 1][2] + dp[x1 - 1][y1 - 1][2])
solve()


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

#define ll long long



void solve(){
    int n;cin>>n;
    int d;cin>>d;
    int cnt;cnt=0;
    double x[100][100];
    for(int i=0; i<n; i++){
        for(int j=0; j<d; j++){
            cin>>x[i][j];
        }
    }
    for(int i=0; i<n-1; i++){
        for(int j=i+1; j<n; j++){
            double sum=0;
            for(int k=0; k<d; k++){
                double y=x[i][k]-x[j][k];
                sum+=y*y;
            }
            double sq=sqrt(sum);
            if(sq-int(sq)==0.0){
                cnt++;
            }
        }
    }
    cout<<cnt<<endl;
}

signed main(){
    //while(1)
    solve();
}

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

int main(){
  string s;
  long long n;
  cin >> s >> n;
  bool flag = true;
  char ans;
  for(int i = 0; i < n; i++){
    if(s[i] != '1') {flag = false; ans = s[i]; break;}
  }
  if(flag) cout << 1 << endl;
  else cout << ans << endl;
}

Measured memory_bytes: 3592
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define str to_string
#define endl "\n"
#define PI 3.141592653589
using namespace std;
using lint = long long;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

vector<int> minp(1000001);
vector<int> vec(1000001);
bool pairwise=true;

void pf(int x){
    map<int,int> soinsu;
    while(x>1){
        soinsu[minp[x]]++;
        x/=minp[x];
    }
    for(auto p:soinsu){
        if(vec[p.first])pairwise=false;
        else vec[p.first]=1;
    }
}


//AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC
int main(){
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    for(int i=2;i<=sqrt(1000000);i++){
        if(minp[i]==0){
            for(int j=i;j<1000001;j+=i){
                if(minp[j]==0)minp[j]=i;
            }
        }
    }
    for(int i=2;i<1000001;i++){
        if(minp[i]==0)minp[i]=i;
    }
    int n,tmp,x;cin>>n>>tmp;
    pf(tmp);
    for(int i=1;i<n;i++){
        cin>>x;
        tmp=__gcd(tmp,x);
        if(pairwise)pf(x);
    }
    if(pairwise)cout<<"pairwise coprime"<<endl;
    else if(tmp==1)cout<<"setwise coprime"<<endl;
    else cout<<"not coprime"<<endl;
}


Measured memory_bytes: 10936
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        try (Scanner in = new Scanner(System.in)) {
            int A1 = in.nextInt();
            int A2 = in.nextInt();
            int A3 = in.nextInt();
            System.out.println(A1 + A2 + A3 >= 22 ? "bust" : "win");
        }
    }
}


Measured memory_bytes: 26940
num = int(input())
count = {"AC":0, "WA":0, "TLE":0, "RE":0}
 
for i in range(num):
  word = input()
  for (key , n) in count.items():
    if word == key:
      count[key] += 1
 
for (key , n) in count.items():
  print(key + " x " + str(n))

Measured memory_bytes: 9076
#include <stdio.h>

int main(int argc, const char * argv[]) {
    
    int a,b,c;
    
    scanf("%d %d %d",&a,&b,&c);
    
    if (a < b && b < c) {
        printf("Yes\n");
    } else {
        printf("No\n");
    }
    return 0;
}

Measured memory_bytes: 580
#include <bits/stdc++.h>
#define INF 1000000000
using namespace std;

class Bellman_Ford {
	struct edge {
		int from, to, cost;
		edge(int _from, int _to, int _cost) : from(_from), to(_to), cost(_cost) {}
	};
	vector<edge> es;
	bool isdirected;
	vector<int> d;
	int V;
public:
	Bellman_Ford(int _V, bool _isdirected = true) : isdirected(_isdirected), V(_V), d(_V) { }
	void add(int a, int b, int c) {
		es.push_back(edge(a, b, c));
		if (!isdirected) es.push_back(edge(b, a, c));
	}
	bool calc(int start) {
		fill(d.begin(), d.end(), INF);
		d[start] = 0;
		bool update;
		for (int i = 0; i < V; i++) {
			update = false;
			for (auto &e : es) {
				if (d[e.from] != INF && d[e.to] > d[e.from] + e.cost) {
					d[e.to] = d[e.from] + e.cost;
					update = true;
				}
			}
			if (!update) return false;
		}
		return true;
	}
	int dist(int to) {
		return d[to];
	}
};

int main()
{
	int V, E, r;
	cin >> V >> E >> r;
	Bellman_Ford bf(V);
	for (int i = 0, s, t, d; i < E; i++) {
		cin >> s >> t >> d;
		bf.add(s, t, d);
	}

	if (!bf.calc(r)) {
		for (int i = 0; i < V; i++) {
			if (bf.dist(i) == INF)
				cout << "INF" << endl;
			else
				cout << bf.dist(i) << endl;
		}
	}
	else {
		cout << "NEGATIVE CYCLE" << endl;
	}
	return 0;
}

Measured memory_bytes: 3156
#include<bits/stdc++.h>
#define ll long long
using namespace std;

char mat[10][10];
int sol=0;
string s="";
int h,w,k;

void solve() {
    int cnt=0;
    for (int i=0;i<h;i++) {
        for (int j=0;j<w;j++) {
             if (s[i]=='1' && s[h+j]=='1' && mat[i][j]=='#') cnt++;
        }
    }
    if (cnt==k) {sol++;}
}

void rek(int i) {
    if (i==h+w) {solve(); return;}
    s.push_back('1');
    rek (i+1);
    s.pop_back();
    s.push_back('0');
    rek (i+1);
    s.pop_back();
}

int main() {
    cin >> h >> w >> k;
    for (int i=0;i<h;i++) {
        for (int j=0;j<w;j++) {
            cin >> mat[i][j];
        }
    }

    rek(0);
    cout << sol;
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
///Welcome to Nasif's Code
#define bug printf("bug\n");
#define bug2(var) cout<<#var<<" "<<var<<endl;
#define co(q) cout<<q<<endl;
#define all(q) (q).begin(),(q).end()
#define pi acos(-1)
#define inf 1000000000000000LL
#define FastRead    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define MODADD(ADD_X,ADD_Y)  (ADD_X+ADD_Y)%MOD;
#define MODSUB(SUB_X,SUB_Y)  (SUB_X-SUB_Y)+MOD)%MOD;
#define MODMUL(MUL_X,MUL_Y)  (MUL_X*MUL_Y)%MOD;
#define LCM(LCM_X,LCM_Y) (LCM_X*LCM_Y)/__gcd(LCM_X,LCM_Y);
typedef long long int ll;
typedef unsigned long long int ull;
const int MOD = (int)1e9+7;
const int MAX = 1e6;
int dx[]= {1,0,-1,0,1,-1,1,-1};
int dy[]= {0,1,0,-1,1,-1,-1,1};

int main()
{
    FastRead
    //freopen("output.txt", "w", stdout);
   string x,y;
   int cnt=0;
   cin>>x>>y;
   for(int i=0;i<3;i++)
    if(x[i]==y[i])
    cnt++;
   cout<<cnt<<endl;

    return 0;
}


Measured memory_bytes: 3616
import java.util.*;
class Main
{
  public static void main(String args[])
  {
    Scanner in=new Scanner(System.in);
    int a=in.nextInt();
    HashSet<String> set=new HashSet<>();
    while(a>0)
    {
     String s=in.next();
     set.add(s);
      
      
      a--;
    }
    System.out.print(set.size());
    
  }
}

Measured memory_bytes: 77244
#include<bits/stdc++.h>
using namespace std;
#define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int main(){
	#ifndef ONLINE_JUDGE
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	#endif
	fastio
	string s;
	cin>>s;
	int cnt1=0;
	for(int i=0;i<s.size();++i){
		if(i&1 && s[i]!='0') ++cnt1;
		else if(i%2==0 && s[i]!='1') ++cnt1; 
	}
	int cnt2=0;
	for(int i=0;i<s.size();++i){
		if(i&1 && s[i]!='1') ++cnt2;
		else if(i%2==0 && s[i]!='0') ++cnt2;
 	}
 	//cout<<cnt1<<" "<<cnt2<<'\n';
 	cout<<min(cnt1,cnt2);
	return 0;
}

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

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

    vector<vector<int>> x(n, vector<int> (d));

    for ( int i = 0; i < n; i++ ) {
        for ( int j = 0; j < d; j++ ) {
            cin >> x[i][j];
        }
    }

    int sum = 0;
    int cnt = 0;

    for ( int i = 0; i < n - 1; i++ ) {
        for ( int j = i + 1; j < n; j++ ) {
            sum = 0;
            for ( int k = 0; k < d; k++ ) {
//                cout << x[i][k] << endl;
//                cout << x[j][k] << endl;
//                cout << ( x[i][k] - x[j][k] ) * ( x[i][k] - x[j][k] ) << endl;
//                if ( i == 0 & j == 2 ) {
//                    cout << ( x[i][k] - x[j][k] ) * ( x[i][k] - x[j][k] ) << endl;
//                }
                sum += ( x[i][k] - x[j][k] ) * ( x[i][k] - x[j][k] );
            }
//            cout << sum << endl;
 //           cout << sum << endl;
            for ( int j = 1; j <= 126; j++ ) {
                if ( sum == j * j ) {
                    cnt++;
                    break;
                }
            }
        }
    }

    cout << cnt << endl;


    return 0;
}


Measured memory_bytes: 256