akhauriyash/Code-Regression huggingface dataset:
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
using namespace std;
#define Ma_PI 3.141592653589793
#define eps 0.00000001
#define LONG_INF 30000000000000000LL
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define MOD 998244353
#define REP(i,n) for(long long i = 0;i < n;++i)    
#define seg_size 524288
double dot(complex<double> a, complex<double> b) {
	return a.real() * b.real() + a.imag() * b.imag();
}
double gyaku_dot(complex<double> a, complex<double> b) {
	return a.real() * b.imag() - a.imag() * b.real();
}
double leng(complex<double> a) {
	return sqrt(a.real() * a.real() + a.imag() * a.imag());
}
double angles(complex<double> a, complex<double> b) {
	double cosine = dot(a, b) / (leng(a) * leng(b));
	double sine = gyaku_dot(a, b) / (leng(a) * leng(b));
	double kaku = acos(cosine);
	if (sine <= 0) {
		kaku = 2 * Ma_PI - kaku;
	}
	return kaku;
}
vector<int> convex_hull(vector<complex<double>> a) {
	vector<int> ans;
	double now_minnest = a[0].real();
	int now_itr = 0;
	REP(i, a.size()) {
		if (now_minnest > a[i].real()) {
			now_minnest = a[i].real();
			now_itr = i;
		}
	}
	ans.push_back(now_itr);
	complex<double> ba(0, 1);
	while (true) {
		int now_go = 0;
		double now_min = 0;
		int starter = ans[ans.size() - 1];
		for (int i = 0; i < a.size(); ++i) {
			if (i != starter) {
				double goa = angles(ba, a[i] - a[starter]);
				if (goa > now_min) {
					now_min = goa;
					now_go = i;
				}
			}
		}
		if (now_go == ans[0]) break;
		ans.push_back(now_go);
		ba = complex<double>(a[now_go] - a[starter]);
	}
	return ans;
}
unsigned long xor128() {
	static unsigned long x = 123456789, y = 362436069, z = 521288629, w = 88675123;
	unsigned long t = (x ^ (x << 11));
	x = y; y = z; z = w;
	return (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)));
}
long long gcd(long long a, long long b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}
long long dp[200000] = {};
long long bad[200000] = {};
int main(){
	long long n, m;
	cin >> n >> m;
	REP(i, m) {
		int a;
		cin >> a;
		bad[a] = 1;
	}
	dp[0] = 1;
	for (int i = 0; i <= n; ++i) {
		dp[i] %= MAX_MOD;
		if (bad[i + 1] == 0) {
			dp[i + 1] += dp[i];
		}
		if (bad[i + 2] == 0) {
			dp[i + 2] += dp[i];
		}
	}
	cout << dp[n] % MAX_MOD << endl;
	return 0;
}

Measured memory_bytes: 1792
// https://atcoder.jp/contests/abc061/tasks/abc061_c

#include <bits/stdc++.h>
#define REP(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define REPR(i, n) for (int(i) = (n); (i) >= 0; (i)--)
#define FOR(i, m, n) for (int(i) = (m); (i) < (n); i++)
#define INF 1e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;

ll N, K, a, b, c[100000], r;

int main()
{
  for (auto &cc : c)
    cc = 0;

  cin >> N >> K;

  REP(i, N)
  {
    cin >> a >> b;
    c[a - 1] += b;
  }

  r = 0;
  while (0 < K)
    K -= c[r++];

  cout << r << '\n';

  return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <cstdio>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <functional>


using namespace std;

int main()
{
    int r;
    cin>>r;
    double ans;
    double PI=3.14159265358979323846;

    ans=2*r*PI;
    cout<<ans;


}
    






Measured memory_bytes: 3784
#include <bits/stdc++.h>
using Int = int64_t;
using UInt = uint64_t;
using C = std::complex<double>;
#define rep(i, n) for(Int i = 0; i < (Int)(n); ++i)
#define guard(x) if( not (x) ) continue;
#ifndef LOCAL_
#define fprintf if( false ) fprintf
#endif

#define debug() fprintf(stderr, "#%d\n", __LINE__);

template<typename T>
using RQ = std::priority_queue<T, std::vector<T>, std::greater<T>>;

struct Tree {
   Tree(Int n)
      : ps(n, -1) {}
   std::vector<Int> ps;
   Int root(Int x) {
      if( ps[x] == -1 ) return x;
      return ps[x] = root(ps[x]);
   }
   void connect(Int parent, Int child) {
      parent = root(parent), child = root(child);
      if( parent == child ) return;
      ps[root(child)] = root(parent);
   }
};

int main() {
   Int v, e, r;
   std::cin >> v >> e >> r;
   std::vector<Int> ss(e), ts(e), ws(e);
   rep(i, e) std::cin >> ss[i] >> ts[i] >> ws[i];
   std::vector<RQ<std::pair<Int,Int>>> qs(v);
   std::vector<Int> os(v);
   rep(i, e) {
      Int s = ss[i], t = ts[i], w = ws[i];
      qs[t].emplace(w, s);
   }
   std::vector<Int> xs(v);
   xs[r] = 2;
   Tree tree(v);
   bool fail = false;
   Int res = 0;
   rep(i, v) {
      Int a = tree.root(i);
      assert( xs[a] == 0 or xs[a] == 2 );
      guard( xs[a] == 0 );
      std::vector<std::pair<Int,Int>> ps(v);// p->i (cost, p)
      std::vector<Int> ys;
      while( xs[a] != 2 ) {
         ys.emplace_back(a);
         xs[a] = 1;
         if( qs[a].empty() ) {
            fail = true;
            break;
         }
         Int w, p;
         do {
            std::tie(w, p) = qs[a].top(); qs[a].pop();
            w += os[a];
            p = tree.root(p);
         } while( tree.root(a) == tree.root(p) );
         ps[a] = std::make_pair(w, p);
         res += w;
         if( xs[p] != 1 ) {
            a = p;
         }
         else {
            Int nr = a;
            for(Int b = ps[a].second; b != a; b=ps[b].second) {
               if( qs[nr].size() < qs[b].size() ) nr = b;
            }
            os[nr] -= ps[nr].first;
            for(Int b = ps[nr].second; b != nr; b=ps[b].second) {
               tree.connect(nr, b);
               while( not qs[b].empty() ) {
                  Int w2, p2; std::tie(w2, p2) = qs[b].top(); qs[b].pop();
                  Int nw = w2 + os[b] - ps[b].first - os[nr];
                  qs[nr].emplace(nw, p2);
               }
            }
            a = nr;
         }
      }
      if( fail ) break;
      for(Int y : ys) {
         xs[y] = 2;
      }
   }
   printf("%ld\n", res);
}



Measured memory_bytes: 3356
using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;


class B
{
    static int[,] m=new int[101,101];
    static int[] p=new int[101];
    public static void Main() {
        int n = int.Parse(System.Console.ReadLine());
        for(int i = 1; i <= n; i++) {
            string[] input = Console.ReadLine().Split(' ');
            p[i - 1] = int.Parse(input[0]);
            p[i] = int.Parse(input[1]);
        }
        matrixChainOrder(n);
        Console.WriteLine(m[1, n]);
    }
    static void matrixChainOrder(int n) {
        int j;
        for(int l = 2; l <= n; l++) {
            for(int i = 1; i <= n - l + 1; i++) {
                j = i + l - 1;
                m[i, j] = int.MaxValue;
                for(int k = i; k < j; k++) {
                    m[i, j] = Math.Min(m[i, j], m[i, k] + m[k + 1, j] + p[i - 1] * p[k] * p[j]);
                }
            }
        }
    }
}


Measured memory_bytes: 16028
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int h = x / 60 / 60;
		int m = x / 60 % 60;
		int s = x % 60;
		System.out.println(h + ":" + m + ":" + s);
	}
}



Measured memory_bytes: 26352
import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.util.*

fun main(args: Array<String>) {
    val sc = FastScanner(System.`in`)

    val n = sc.nextInt()
    val s = sc.next()

    var sum = 0
    for (i in 0..n - 3) {
        if ("ABC" == s.substring(i..i + 2)) sum += 1
    }
    println(sum)

}

class FastScanner(s: InputStream) {
    private var st = StringTokenizer("")
    private val br = BufferedReader(InputStreamReader(s))

    fun next(): String {
        while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())

        return st.nextToken()
    }

    fun nextInt() = next().toInt()
    fun nextLong() = next().toLong()
    fun nextLine() = br.readLine()
    fun nextDouble() = next().toDouble()
    fun ready() = br.ready()
}


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

using namespace std;
using ll = long long;

/*********************************/
template<class T> inline ostream& operator<<(ostream& os,vector<T> arr) {os << "["; for(int i = 0; i < (int)arr.size(); i++)os << arr[i] << (i == (int)arr.size() - 1 ? "]" : ",");os << endl;return os;}
template<typename A, typename B> ostream& operator<<(ostream& os, const pair<A,B>& p){os << "{" << p.first << "," << p.second << "}";return os; }
#define prvec(v) cerr<<#v<<": [";for(int __i = 0;__i < (int)(v).size(); __i++)cerr<<((v)[__i])<<(__i+1==(int)(v).size()?"]\n":",");
#define print(x) cerr<<#x<<": "<<(x)<<endl
/*********************************/

int main()
{
    int n; cin >> n;
    vector<int> ms(1<<n);
    for(int i = 0; i < (1<<n); i++)cin >> ms[i];
    sort(ms.begin(), ms.end());
    vector<int> a = {ms.back()}; //既に消してるやつ
    ms.pop_back();

    bool ok = true;


    for(int I = 0; I < n; I++) {
        vector<int> nxt;    //消される
        vector<int> remain;
        sort(ms.begin(), ms.end());
        sort(a.begin(), a.end(), greater<int>());

        for(auto i : a) {
            while(ms.size() && ms.back() == i) {
                remain.push_back(ms.back());
                ms.pop_back();
            }
            if(!ms.size()) {
                ok = false;
                break;
            }
            nxt.push_back(ms.back());
            ms.pop_back();
        }
        // print(nxt);
        // print(ms);
        if(!ok) {
            cout << "No" << endl;
            return 0;
        }
        for(auto i : nxt)a.push_back(i);
        for(auto i : remain)ms.push_back(i);
    }
    print(ms);
    cout << "Yes" << endl;

}

Measured memory_bytes: 7484
N,K = map(int, input().split(' '))
R,S,P = map(int, input().split(' '))
T = input()
win={'r':'p', 's':'r', 'p':'s'}
progress=''
for i,v in enumerate(T):
    if i<K:   progress+=win[v]
    else:
        if win[v]!=progress[i-K]:
            progress+=win[v]
        else:
            progress+='x'
print(progress.count('r')*R + progress.count('s')*S + progress.count('p')*P)

Measured memory_bytes: 3444
#define D(x) cout << #x " = " << x << endl
#define DD(x, y) cout << "(" #x ", " #y ") = (" << x << ", " << y << ")" << endl
#define DDD(x, y, z) cout << "(" #x ", " #y ", " #z ") = (" << x << ", " << y << ", " << z << ")" << endl
#define DV(v) for (auto __macro_vi : v){ cout << __macro_vi << " ";} cout << endl;
#define DA(a, n) for (int __macro_i = 0; __macro_i < n; ++__macro_i) { cout << a[__macro_i] << " "; } cout << endl;
#define REP(i, n) for (int i = 0; i < n; ++i)
#define ALL(v) (v).begin(), (v).end()
#include<iostream>
#include<vector>
#include<cassert>
#include<cmath>
template<class T, class U> std::ostream& operator<<(std::ostream& os, const std::pair<T, U>& p){ os << "(" << p.first << ", " <<  p.second << ")"; return os; }

using namespace std;
template<class T>
using V=vector<T>;

void solve(long long N, std::string S){
    V<V<int>> dp(N + 1, V<int>(N + 1, 0));
    int ans = 0;
    for (int i = 1; i <= N; ++i) {
        for (int j = i + 1; j <= N; ++j) {
            if (S[i - 1] == S[j - 1]) {
                dp[i][j] = min(j - i, dp[i - 1][j - 1] + 1);
            }
            ans = max(ans, dp[i][j]);
        }
    }
    cout << ans << endl;
}

// Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    std::string S;
    std::cin >> S;
    solve(N, S);
    return 0;
}


Measured memory_bytes: 100224
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define debug(x) cout << '>' << #x << ':' << x << endl;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define fr(i,a,b) for(ll i=(a);i<(b);i++)
#define frd(i,a,b) for(ll i=(a);i>=(b);i--)
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define endl "\n"
#define inf ((lng lng) 1e18 + 10)
#define ve vector<ll>
using namespace std;

int main() {
        std::ios::sync_with_stdio(false);
        cin.tie(0);cout.tie(0);
        ll t;
        // cin>>t;
        t = 1;
        while(t--){
                int n,a,b;
                cin>>n>>a>>b;
                int l = (a/n);
                if(a % n == 0){
                        cout<<"OK\n";
                        continue;
                }
                int val = (l + 1) * n;
                if(val <= b){
                        cout<<"OK\n";
                        continue;
                }
                cout<<"NG\n";
        }
        return 0;
}


Measured memory_bytes: 3652
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <map>
#include <queue>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using namespace std;

template<class T>
constexpr T INF = ::numeric_limits<T>::max() / 32 * 15 + 208;

int main() {
    int n;
    cin >> n;
    vector<int> v(n);
    ll ans = 0;
    for (int i = 0; i < n; ++i) {
        scanf("%d", &v[i]);
    }
    for (int i = 0; i < n; ++i) {
        ans += v[i]/2;
        v[i] %= 2;
        if(v[i] && v[i+1] != 0) {
            v[i+1]--;
            v[i]--;
            ans++;
        }
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 640
#include<iostream>
#include<string>
#include<queue>
#include<algorithm>
#include<map>
#include<set>
#include<vector>
#include<math.h>

using namespace std;

#define INF 1000000007
#define LINF (1LL << 62)

typedef long long i64;
typedef pair<i64,i64> P;


int n, a,b,c, x[10];

int solve(int ma, int mb, int mc){
	int cc = -1;
	int A = 0,B = 0, C = 0;
	int ans = 0;
	for(int i = 0; i < n; i++){
		if((mc >> i) & 1){
			if(((ma >> i) & 1) || ((mb >> i) & 1)) return INF;
			C += x[i];
			cc++;
		}
	}
	if(cc == -1) return INF;
	ans += cc * 10 + abs(c-C);
	cc = -1;
	for(int i = 0; i < n; i++){
		if((mb >> i) & 1){
			if((ma >> i) & 1) return INF;
			B += x[i];
			cc++;
		}
	}
	if(cc == -1) return INF;
	ans += cc * 10 + abs(b-B);
	cc = -1;
	for(int i = 0; i < n; i++){
		if((ma >> i) & 1){
			A += x[i];
			cc++;
		}
	}
	if(cc == -1) return INF;
	ans += cc * 10 + abs(a-A);
	return ans;
}

int main(){
	cin >> n >> a >> b >> c;
	for(int i = 0; i < n; i++){
		cin >> x[i];
	}
	
	sort(x,x+n);
	
	int ans = INF;
	for(int i = 0; i < (1<<n); i++){
		for(int j = 0; j < (1<<n); j++){
			for(int k = 0; k < (1<<n); k++){
				ans = min(ans, solve(i,j,k));
			}
		}
	}
	
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 384
(eval-when (:compile-toplevel :load-toplevel :execute)
  (defparameter OPT
    #+swank '(optimize (speed 3) (safety 2))
    #-swank '(optimize (speed 3) (safety 0) (debug 0)))
  #+swank (progn (ql:quickload '(:cl-debug-print :fiveam))
                 (shadow :run)
                 (use-package :fiveam)))
#+swank (cl-syntax:use-syntax cl-debug-print:debug-print-syntax)

;; BEGIN_INSERTED_CONTENTS
(defmacro nlet (name args &body body)
  (labels ((ensure-list (x) (if (listp x) x (list x))))
    (let ((args (mapcar #'ensure-list args)))
      `(labels ((,name ,(mapcar #'car args) ,@body))
         (,name ,@(mapcar #'cadr args))))))

(declaim (inline split-ints-into-vector))
(defun split-ints-into-vector (string dest-vector &key (offset 0) (key #'identity))
  (declare (string string)
           (function key)
           ((array * (*)) dest-vector)
           ((integer 0 #.most-positive-fixnum) offset))
  (loop with position = 0
        for idx from offset below (length dest-vector)
        do (setf (values (aref dest-vector idx) position)
                 (parse-integer string :start position :junk-allowed t))
           (setf (aref dest-vector idx) (funcall key (aref dest-vector idx)))
        finally (return dest-vector)))

(defmacro define-int-types (&rest bits)
  `(progn
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "UINT~A" b)) () '(unsigned-byte ,b))) bits)
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "INT~A" b)) () '(signed-byte ,b))) bits)))
(define-int-types 2 4 7 8 15 16 31 32 62 63 64)

(defmacro println (obj &optional (stream '*standard-output*))
  `(let ((*read-default-float-format* 'double-float))
     (prog1 (princ ,obj ,stream) (terpri ,stream))))

(defconstant +mod+ 1000000007)

;; Hauptteil

;; Let the sequence (Ai) be 0-based.
;; 1. A(0)+...+A(r0-1)+A(r0) where r0 is the first index that causes overflow.
;; 2. A(1)+...+A(r1-1)+A(r1) where r1 ...

;; result = r0 + (r1-1) + (r2-2) + ... + rn-1
(defun main ()
  (let* ((n (read))
         (as (make-array n :element-type 'uint32)))
    (split-ints-into-vector (read-line) as)
    (nlet recurse ((l 0) (r 0) (psum (aref as 0)) (pxor (aref as 0)) (count 0))
      (declare (optimize (speed 3))
               (uint32 l r psum pxor)
               (fixnum count))
      (if (= l n)
          (println count)
          (loop for i from r below n
                for csum = psum then (+ csum (aref as i))
                for cxor = pxor then (logxor cxor (aref as i))
                while (= csum cxor)
                finally
                   (return (recurse (1+ l)
                                    i
                                    (- (or csum psum) (aref as l))
                                    (logxor (or cxor pxor) (aref as l))
                                    (+ count (- i l)))))))))

#-swank(main)


Measured memory_bytes: 33252
#pragma GCC optimize("Ofast")

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;

#define X first
#define Y second

//#include <boost/unordered_map.hpp>
//using namespace boost;

/*
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> rbtree;
rbtree T;
*/

namespace io{
	const int L = (1 << 20) + 1;
	
	char buf[L], *S , *T, c;
	 
	char getchar() {
		if(__builtin_expect(S == T, 0)) {
			T = (S = buf) + fread(buf, 1, L, stdin);
			return (S == T ? EOF : *S++);
		}
		return *S++;
	}
	
	int inp() {
		int x = 0, f = 1; char ch;
		for(ch = getchar(); !isdigit(ch); ch = getchar())
			if(ch == '-') f = -1;
		for(; isdigit(ch); x = x * 10 + ch - '0', ch = getchar());
		return x * f;
	}
	
	unsigned inpu()
	{
		unsigned x = 0; char ch;
		for(ch = getchar(); !isdigit(ch); ch = getchar());
		for(; isdigit(ch); x = x * 10 + ch - '0', ch = getchar());
		return x;
	}
	
	ll inp_ll() {
		ll x = 0; int f = 1; char ch;
		for(ch = getchar(); !isdigit(ch); ch = getchar())
			if(ch == '-') f = -1;
		for(; isdigit(ch); x = x * 10 + ch - '0', ch = getchar());
		return x * f;
	}
	
	char B[25], *outs=B+20, *outr=B+20;
	template<class T>
	inline void print(register T a,register char x=0){
		if(x) *--outs = x, x = 0;
		
		if(!a)*--outs = '0';
		else 
			while(a)
				*--outs = (a % 10) + 48, a /= 10;
		
		if(x)
			*--outs = x;
		
		fwrite(outs, outr - outs , 1, stdout);
		outs = outr;
	}
};

using io :: print;
using io :: inp;
using io :: inpu;
using io :: inp_ll;

using i32 = int;
using i64 = long long;
using u8 = unsigned char;
using u32 = unsigned;
using u64 = unsigned long long;
using f64 = double;
using f80 = long double;

ll power(ll a, ll b, ll p)
{
	if (!b) return 1;
	ll t = power(a, b/2, p);
	t = t*t%p;
	if (b&1) t = t*a%p;
	return t;
}

const int MAXN = 150010;
const int MAXP = 10000000;
const u64 MOD = 1000000007;
const f80 MI = f80(1)/MOD;
const ll INF = 10000000000000000LL;
const ll inf = 5000000000000LL;

int n;
ll K;
ll a[MAXN];
ll cnt[77];

ll calc(ll tmp)
{
	ll sum = 0;
	for (int i = 1; i <= n; ++ i)
		sum += a[i]^tmp;
	return sum;
}

int main()
{
	
	scanf("%d%lld", &n, &K);
	for (int i = 1; i <= n; ++ i)
	{
		scanf("%lld", &a[i]);
		ll t = a[i];
		for (int k = 0; k < 40; ++ k)
		{
			cnt[k] += t&1;
			t >>= 1;
		}
	}
	
	ll cur = 0;
	ll ans = 0;
	for (int k = 39; k >= 0; -- k)
	{
		ll x = K>>k&1;
		if (x)
		{
			ll tmp = cur;
			for (int j = k-1; j >= 0; -- j)
				if (cnt[j]*2 < n)
					tmp |= 1LL<<j;
			ans = max(ans, calc(tmp));
		}
		cur |= x<<k;
	}
	ans = max(ans, calc(K));
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 1024
#include<iostream>
int max ( int a, int b )
{
	if ( a > b ) return a;
	else return b;
}
int main()
{
	int a, b, c;
	std::cin >> a >> b >> c;
	int maxn = max ( max ( a, b ), c );
	std::cout << a + b + c - maxn << std::endl;
	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iostream>
#include <iterator>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define FOR(i,k,n) for(int(i)=(k);(i)<(n);++(i))
#define rep(i,n) FOR(i,0,n)
#define all(v) begin(v),end(v)
#define debug(x) std::cerr<<#x<<": "<<x<<"\n"
#define debug2(x,y) std::cerr<<#x<<": "<<x<<", "<<#y<<": "<<y<<"\n"
#define debug3(x,y,z) std::cerr<<#x<<": "<<x<<", "<<#y<<": "<<y<<", "<<#z<<": "<<z<<"\n"

using ll=long long;
using vi=std::vector<int>;
using vvi=std::vector<vi>;
using vll=std::vector<ll>;
using vvll=std::vector<vll>;
template<typename T> using vvec=std::vector<std::vector<T>>;
template<typename T>
auto make_v(size_t sz){return std::vector<T>(sz);}
template<typename T,typename... Ts>
auto make_v(size_t sz,Ts...ts){return std::vector<decltype(make_v<T>(ts...))>(sz,make_v<T>(ts...));}
template<typename T>
void fill_v(T&var,const T&x){var=x;}
template<typename V,typename T>
void fill_v(V&v,const T&x){for(auto&& w:v){fill_v(w,x);}}

template<typename T> std::ostream& operator<<(std::ostream&s,const std::vector<T>&v){
  int sz=v.size();s<<"\n";rep(i,sz){s<<v[i];if(i<sz-1){s<<"\t";}}s<<"\n";return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::vector<std::vector<T>>&v){
  for(auto&& w:v){s<<w;}return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::deque<T>&v){
  int sz=v.size();s<<"\n";rep(i,sz){s<<v[i];if(i<sz-1){s<<"\t";}}s<<"\n";return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::deque<std::deque<T>>&v){
  for(auto&& w:v){s<<w;}return s;}
template<typename T> std::ostream& operator<<(std::ostream&s, const std::set<T>&v){
  s<<"\n";for(auto&& elm:v){s<<elm<<"\t";}s<<"\n";return s;}

inline void scan(int&a){scanf("%d",&a);}
inline void scan(ll&a){scanf("%lld",&a);}
inline void scan(char&a){scanf(" %c",&a);}
inline void scan(double&a){scanf("%lf",&a);}
template<typename T>
inline void scan(std::vector<T>&v){for(auto&& sv:v){scan(sv);}}
template<typename First,typename...Args>
inline void scan(First&f,Args&...args){scan(f);scan(args...);}
inline void scan(std::string&s){char BUF[3000000];scanf(" %s",BUF);s=std::string(BUF);}
inline void print(int a){printf("%d\n",a);}
inline void print(ll a){printf("%lld\n",a);}
inline void print(double a){printf("%.12f\n",a);}
inline void print(std::string s){std::cout<<s<<"\n";}

using namespace std;

int main() {
  ll x;
  scan(x);
  ll happiness = 0;
  happiness += (x / 500) * 1000;
  happiness += (x % 500 / 5) * 5;
  print(happiness);

  return 0;
}


Measured memory_bytes: 888
# -*- coding: utf-8 -*-

def bigThan(a, b):
    if a == 1 and b == 1:
        return False
    elif a == 1 and b != 1:
        return True
    elif a != 1 and b == 1:
        return False
    else:
        return a > b


def judge(a, b):

    if a == b:
        return "Draw"
    elif bigThan(a, b):
        return "Alice"
    else:
        return "Bob"

# スペース区切りの整数の入力
a, b = map(int, input().split())

j = judge(a, b)
print(j)

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <iomanip>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>

#define debug(x) cout << #x << " = " << x << endl
#define fori(i, ini, lim) for(int i = int(ini); i < int(lim); i++)
#define ford(i, ini, lim) for(int i = int(ini); i >= int(lim); i--)

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;

void solve() {
    int n;
    cin >> n;
    vector<int> a(n), cnt(n + 1, 0);
    fori (i, 0, n) {
        cin >> a[i];
        cnt[a[i]]++;
    }
    ll total = 0;
    fori (i, 1, n + 1) {
        total += (1LL * cnt[i] * (cnt[i] - 1)) / 2;
    }
    fori (i, 0, n) {
        ll cur = total - (cnt[a[i]] - 1);
        cout << cur << "\n";
    }
}

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



Measured memory_bytes: 4760
#include<bits/stdc++.h>
using namespace std;
#define ll long long
void solve(){
    double d,t,s;
    cin>>d>>t>>s;
    double x=d/s;
    if(x<=t) cout<<"Yes";
    else cout<<"No";
}
int main(){
    ll a=1;
    //cin>>a;
    while(a--){
        solve();
    }
}

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

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

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

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int main(){
    int a,b,c;
    cin >> a >> b >> c;
    int num=0;
    if(a==b && b==c){
        num=1;
    }
    else{
        if(a==b || b==c || a==c){
            num=2;
        }
        else{
            num=3;
        }
    }
    cout << num;
}

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

using ll = long long;
using vi = vector<ll>;
using vvi = vector<vi>;

ll INF = 1ll << 60;

void chmin(ll &a, ll b){
  if(a > b)
    a = b;
}
void chmax(ll &a, ll b){
  if(a < b)
    a = b;
}

int main(){
  int n, w;
  cin >> n >> w;
  vi weight(n), value(n);
  for(int i = 0; i < n; i++)
    cin >> weight[i] >> value[i];
  
  vvi knap(110, vi(110000, 0));
  
  for(int i = 0; i < n; i++){
    for(int j = 0; j < 110000; j++){
      if(j >= weight[i])
        chmax(knap[i+1][j], knap[i][j-weight[i]] + value[i]);
      chmax(knap[i+1][j], knap[i][j]);
    }
  }
  
  cout << knap[n][w] << endl;
  
  return 0;
  
}

Measured memory_bytes: 95744
#include <bits/stdc++.h>
#define N 101
using namespace std;
int h,w,A;
string mp[101];
int dx[]={0,0,1,-1};//V^><
int dy[]={1,-1,0,0};

int ans=1e9,used[101][101][10][10][4];
void dfs(int x,int y,int p,int q,int dir){
  int &u=used[x][y][p][q][dir];
  if(ans<=2*A-(p+q)||(u!=-1&&u<=2*A-(p+q)))return;
  u=2*A-(p+q);
  
  vector<int> X,Y,ch;
  while(1){
    x+=dx[dir];
    y+=dy[dir];
    if(x<0||y<0||x>=w||y>=h||mp[y][x]=='#')break;
    if(mp[y][x]=='S')continue;
    if(mp[y][x]=='G')ans=min(ans,2*A-(p+q));
    X.push_back(x);
    Y.push_back(y);
    ch.push_back(mp[y][x]);
    mp[y][x]='#';
    if(p){
      if(dir==0)dfs(x,y,p-1,q,2); //>
      if(dir==1)dfs(x,y,p-1,q,3); //<
      if(dir==2)dfs(x,y,p-1,q,0); //V
      if(dir==3)dfs(x,y,p-1,q,1); //^
    }
    if(q){
      if(dir==0)dfs(x,y,p,q-1,3); //>
      if(dir==1)dfs(x,y,p,q-1,2); //<
      if(dir==2)dfs(x,y,p,q-1,1); //^
      if(dir==3)dfs(x,y,p,q-1,0); //V
    }
  }
  for(int i=0;i<X.size();i++)mp[Y[i]][X[i]]=ch[i];
}

int main(){
  cin>>h>>w>>A;
  for(int i=0;i<h;i++)cin>>mp[i];

  memset(used,-1,sizeof(used));
  for(int i=0;i<h;i++)
    for(int j=0;j<w;j++)
      if(mp[i][j]=='S')dfs(j,i,A,A,0);

  cout<<(ans==1e9? -1:ans)<<endl;
  return 0;
}

Measured memory_bytes: 19168
//============================================================================
// Name        : Partition.cpp
// Author      : Ken
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <vector>
using namespace std;

int Partition(vector<int>& A, int p, int r){
	int x = A.at(r);
	int i = p-1;
	for(int j=p; j<r; j++){
		//cout << "j: " << j << "\n";
		if(A.at(j) <= x){
			i ++;
			int tmp;
			tmp = A.at(i);
			A.at(i) = A.at(j);
			A.at(j) = tmp;
			//cout << "i: " << i << "\n";
		}
	}
	int tmp = A.at(i+1);
	A.at(i+1) = A.at(r);
	A.at(r) = tmp;

	return i+1;
}

void Print(vector<int>& A, int n){
	for(int i=0; i<n; i++){
		cout << A.at(i) << " ";
	}

	cout << "[" << A.at(n) << "] ";

	for(int i=n+1; i<A.size()-1; i++){
		cout << A.at(i) << " ";
	}

	cout << A.at(A.size()-1) << "\n";
}


int main() {
	int n;
	cin >> n;
	vector<int> A;

	for(int i=0; i<n; i++){
		int input;
		cin >> input;
		A.push_back(input);
	}
	//cout << "here\n";
	int ret = Partition(A, 0, n-1);

	Print(A, ret);

	return 0;
}



Measured memory_bytes: 3544
n = int(input())
b = list(int(x) for x in input().split())
revans = []
flg = True
cond = True

while(flg):
    removable = []
    for i, item in enumerate(b):
        if item == i+1:
            removable.append(i)

    if removable == []:
        flg = False
        cond = False
        break

    revans.append(b.pop(max(removable)))

    if b == []:
        flg = False

if cond:
    for item in reversed(revans):
        print(item)
else:
    print(-1)


Measured memory_bytes: 3064
#include<algorithm>
#include<iostream>
#include<cstring>
#include<string>
#include<vector>
#include<cstdio>
#include<cmath>
#include<set>
#include<map>
using namespace std;
typedef long long ll;
const int MAXN=1e5+5;
int read()
{
    int s=0,f=1;
    char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){s=s*10+ch-'0';ch=getchar();}
    return s*f;
}
ll arr[7]={100,101,102,103,104,105,207};
ll vis[10000000];
int main()
{
    int n;
    cin>>n;
    int m=n/100;
    if(m*100<=n&&n<=m*100+5*m)cout<<1<<endl;
    else cout<<0<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <cstring>

using namespace std;

const int MAX_V = 1100;
const int INF = 100000000;

// &#65533;&#65533;&#65533;_&#65533;&#65533;
int V;
// &#65533;O&#65533;&#65533;&#65533;t&#65533;&#771;&#65533;&#65533;X&#65533;g&#65533;\&#65533;&#65533;
vector<int> G[MAX_V];
// &#65533;}&#65533;b&#65533;`&#65533;&#65533;&#65533;O&#65533;&#771;y&#65533;A
int match[MAX_V];
// dfs&#65533;&#322;&#65533;&#65533;&#322;&#594;&#65533;&#65533;&#1474;&#65533;&#65533;&#65533;&#65533;&#450;&#65533;&#65533;&#65533;&#65533;&#771;t&#65533;&#65533;&#65533;O
static bool used[MAX_V];

// u&#65533;&#65533;v&#65533;&#65533;&#1301;&#1218;&#65533;O&#65533;&#65533;&#65533;t&#65533;&#594;&#457;&#65533;
void add_edge(int u,int v){
	G[u].push_back(v);
	G[v].push_back(u);
}

// &#65533;&#65533;&#65533;&#65533;p&#65533;X&#65533;&#65533;dfs&#65533;&#338;T&#65533;&#65533;
bool dfs(int v){
	used[v] = true;
	for(int i = 0; i < G[v].size(); i++){
		int u = G[v][i],w = match[u];
		if(w < 0 || !used[w] && dfs(w)){
			match[v] = u;
			match[u] = v;
			return true;
		}
	}
	return false;
}

// &#65533;&#349443;O&#65533;&#65533;&#65533;t&#65533;&#781;&#337;&#65533;}&#65533;b&#65533;`&#65533;&#65533;&#65533;O&#65533;&#65533;&#1986;&#65533;
int bipartite_matching(){
	int res = 0;
	//memset(match,-1,sizeof(match));
	for(int i = 0; i < MAX_V; i++)
		match[i]=-1;
	for(int v = 0; v < V; v++){
		if(match[v] < 0){
			memset(used,0,sizeof(used));
			if(dfs(v)){
				res++;
			}
		}
	}
	return res;
}

int gcd(int a,int b){
	if(b==0)
		return a;
	return gcd(b,a%b);
}


int main(){

	int n,m;
	vector<int> bs,rs;
	int b,r;

	while(cin>>m>>n&&!(m==0&&n==0)){
		for(int i = 0; i < MAX_V; i++)
			G[i].clear();
		bs.clear();
		rs.clear();

		V=n+m;
		for(int i = 0; i < m; i++){
			cin>>b;
			bs.push_back(b);
		}
		for(int i = 0; i < n; i++){
			cin>>r;
			rs.push_back(r);
		}
		for(int i = 0; i < rs.size(); i++){
			for(int j = 0;j < bs.size(); j++){
				int res=gcd(rs[i],bs[j]);
				if(res>1)
					add_edge(i,j+rs.size());
			}
		}
		cout<<bipartite_matching()<<endl;
	}

	return 0;
}

Measured memory_bytes: 3084
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef pair<ll, int> li;
typedef pair<int, ll> il;
typedef pair<ll , ll> lli;
typedef vector<ii> vii;
typedef vector<il> vil;
typedef vector<li> vli;
typedef vector<lli> vlli;
typedef set <int> st;
typedef set <char> stc;
typedef vector<int>::iterator itr;
 
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define in insert
#define f0(b) for(int i=0;i<(b);i++)
#define f00(b) for(int j=0;j<(b);j++)
#define f1(b) for(int i=1;i<=(b);i++)
#define f11(b) for(int j=1;j<=(b);j++)
#define f2(a,b) for(int i=(a);i<=(b);i++)
#define f22(a,b) for(int j=(a);j<=(b);j++)
#define sq(a) a*a
#define cu(a) (sq(a)*a)
#define sf1(a) scanf("%d",&a)
#define sf2(a,b) scanf("%d %d", &a , &b)
#define pf1(a) printf("%d\n",a)
#define pf2(a,b) printf("%d %d\n", a , b)
#define Last(i) ( (i) & (-i) )
 
const int mod = 1000000007;
const int maxn = (int)1e5+30;
const ll nnn = (ll)5e7+5;
const int inf = 1e9+9;
const ll INF = 1e18;

int main() {
   
	ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);	
    
    double l;
    cin >> l;
    
    l = l/3;
    
    printf("%.12lf",(l*l*l));
    
    
    return 0;
    
}


Measured memory_bytes: 256
#ifdef __APPLE__
    # include <iostream>
    # include <cmath>
    # include <algorithm>
    # include <stdio.h>
    # include <cstdint>
    # include <cstring>
    # include <string>
    # include <cstdlib>
    # include <vector>
    # include <bitset>
    # include <map>
    # include <queue>
    # include <ctime>
    # include <stack>
    # include <set>
    # include <list>
    # include <random>
    # include <deque>
    # include <functional>
    # include <iomanip>
    # include <sstream>
    # include <fstream>
    # include <complex>
    # include <numeric>
    # include <immintrin.h>
    # include <cassert>
    # include <array>
    # include <tuple>
    # include <unordered_map>
    # include <unordered_set>
    # include <thread>
#else
    # include <bits/stdc++.h>
#endif

#define F first
#define S second
#define MP make_pair
#define PB push_back

#define all(a) a.begin(),a.end()
#define mp make_pair
#define pb push_back
#define fir first
#define sec second

using namespace std;

typedef pair<int, int> pii;
typedef long long ll;
typedef long double ld;

const int max_n = 2e5+10, inf = 1000111222;

int val[max_n][2]; // cnt-1 cnt+1
ll sum[2]; // cnt-1 cnt cnt+1

int get(ll a)
{
    int res=0;
    while (a){
        a = a % __builtin_popcountll(a);
        res++;
    }
    return res;
}

int main() {
//    freopen("barik.in", "r", stdin);
//    freopen("barik.out", "w", stdout);

    string s;
    cin>>s>>s;
    int cnt=0;
    for (int i=0;i<s.size();i++){
        if (s[i]=='1'){
            cnt++;
        }
    }
    int cur_0=1;
    int cur_1=1;
    for (int i=(int)s.size()-1;i>=0;i--){
        cur_0%=(cnt-1==0 ? 1 : cnt-1);
        cur_1%=(cnt+1==0 ? 1 : cnt+1);

        val[i][0]=cur_0;
        cur_0*=2;
        cur_0%=(cnt-1==0 ? 1 : cnt-1);

        val[i][1]=cur_1;
        cur_1*=2;
        cur_1%=(cnt+1==0 ? 1 : cnt+1);
    }

    for (int j=0;j<2;j++){
        for (int i=0;i<s.size();i++){
            if (s[i]=='1'){
                sum[j]+=val[i][j];
            }
        }
    }

    for (int i=0;i<s.size();i++){
        if (s[i]=='0'){
            ll cur = sum[1];
            cur += val[i][1];

            cur%=(cnt+1);

//            cout<<"cur to get :: "<<cur<<"\n";
            cout<<get(cur)+1<<"\n";
        }
        else if (s[i]=='1'){
            if (cnt!=1) {
                ll cur = sum[0];
                cur -= val[i][0];

                cur%=(cnt-1);

//                cout<<"cur to get :: "<<cur<<"\n";
                cout << get(cur) + 1 << "\n";
            }
            else{
                cout<<0<<"\n";
            }
        }
        else{
            assert(0);
        }
    }
}


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


int main(){

   int N,W;
   int weight[110],value[110];

   int dp[110][10010];

   std::cin >> N>>W;
   for(int i=0;i<N;i++) std::cin >> value[i]>>weight[i];

   for(int i=0;i<=W;i++) dp[0][i]=0;


   for(int i=0;i<N;i++){
     for(int w=0;w<=W;w++){
       if(w>=weight[i]) dp[i+1][w]=max(dp[i][w-weight[i]]+value[i],dp[i][w]);
       else dp[i+1][w]=dp[i][w];
     }
   }

std::cout << dp[N][W] << '\n';



return 0;



}



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

#define fast ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define int long long
#define endl '\n'

using namespace std;

const int N = 2e5 + 77 ;
int mod = 998244353;
int cnt[N];
int32_t main(){
    fast;
    int n ; cin >> n ;
    int in = 0;
    for(int i = 0 ; i < n ; ++i){
        int a ; cin >> a;
        cnt[a]++;
        if(i==0) in = a;
    }
    int ans = (int)((cnt[0] == 1) && (in == 0));
    for(int i = 1 ; i <= 1e5 ;++i){
        for(int j = 0 ;j < cnt[i] ; ++j){
            ans = (ans*cnt[i-1]) % mod;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4240
// clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
// #define main int main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vpii = vector<pii>;
using vvi = vector<vi>;
using vvb = vector<vb>;
using vvpii = vector<vpii>;
template<typename A> using fn = function<A>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
constexpr bool odd(const int &n) { return n & 1; }
constexpr bool even(const int &n) { return !odd(n); }
void solve();
main { solve(); return 0; }
// clang-format on

void solve() {
  string s;
  while (getline(cin, s), s != ".") {
    stack<char> t;
    rep(i, s.size()) {
      if (s[i] == '[' || s[i] == '(') t.push(s[i]);
      if (s[i] == ')') {
        if (t.size() && t.top() == '(') {
          t.pop();
        } else {
          cout << "no" << endl;
          goto next;
        }
      }
      if (s[i] == ']') {
        if (t.size() && t.top() == '[') {
          t.pop();
        } else {
          cout << "no" << endl;
          goto next;
        }
      }
    }
    cout << (t.size() ? "no" : "yes") << endl;
  next:;
  }
}

Measured memory_bytes: 3140
#include<iostream>

using namespace std;

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

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


	return 0;
}

Measured memory_bytes: 3588
N =int(input())
l1 =[input() for i in range(N)]
M =int(input())
l2 =[input() for i in range(M)]
dic = {'':0}
for v in (l1 + l2):
    dic[v] = l1.count(v) - l2.count(v)
print(max(dic.values()))

Measured memory_bytes: 3064
#include <iostream>
using namespace std;
typedef long long ll;
int main(void) {
  ll k;
  cin >> k;
  cout << 50 << endl;
  ll answer = k / 50 + 49;
  int rest = k % 50;
  for (int i = 0; i < rest; i++) {
    cout << 1LL * (answer - rest + 50) << " ";
  }
  for (int i = rest; i < 50; i++) {
    cout << 1LL * (answer - rest) << " ";
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <utility>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <math.h>
#include <string.h>
#include <iomanip>
#include <numeric>
#include <cstdlib>
#include <cstdint>
#include <cmath>
#include <functional>

using namespace std;

using ll = long long;
using pll = pair<ll, ll>;
using vl = vector<ll>;
using vll = vector<vl>;
using vpll = vector<pll>;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define Rep(i, n) for (long long i = 0; i< (long long)(n); i++)
#define RRep(i,n) for (long long i = ((long long)(n)-1); i>=0; i--)

struct Edge{
    int to;
    int weight;
    Edge(int t, int w) : to(t), weight(w){ }
};

using Graph = vector<vector<Edge>>;
using graph = vector<vector<int>>;

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

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

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

template <class T>
T lcm(T a, T b){
    return (a*b)/gcd(a,b);
}

int INF = 1e9+7;

vector<int> dx = {-1,0,1,0};
vector<int> dy = {0,-1,0,1};

int main(){
    int n;
    cin >> n;
    vector<int> v(n);
    vector<int> a(1e5+10),b(1e5+10);
    rep(i,n){
        cin >> v[i];
        if(i%2==0) a[v[i]]++;
        else b[v[i]]++;
    }
    vector<pair<int,int>> x,y;
    rep(i,1e5+7){
        if(a[i]){
            x.emplace_back(pair<int,int>(a[i],i+1));
        }
        if(b[i]){
            y.emplace_back(pair<int,int>(b[i],i+1));
        }
    }
    x.emplace_back(pair<int,int>(0,0));
    y.emplace_back(pair<int,int>(0,0));
    sort(x.begin(),x.end(),greater<pair<int,int>>());
    sort(y.begin(),y.end(),greater<pair<int,int>>());
    int ans = 0;
    if(x[0].second==y[0].second){
        ans = min(n-x[0].first-y[1].first,n-x[1].first-y[0].first);
    }
    else{
        ans = n- x[0].first -y[0].first;
    }
    cout << ans << endl;
}

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

const int MOD = 1e9 + 7;
const int N = 55;

struct Matrix {
  int n;
  int a[N][N];

  Matrix(int _n = 0) {
    n = _n;
    for (int i = 0 ; i < n ; i++)
      for (int j = 0 ; j < n ; j++)
        a[i][j] = 0;
  }

  void read() {
    for (int i = 0 ; i < n ; i++)
      for (int j = 0 ; j < n ; j++)
        scanf("%d", &a[i][j]);
  }

  Matrix operator *(Matrix other) const {
    Matrix ret(n);

    for (int i = 0 ; i < n ; i++)
      for (int j = 0 ; j < n ; j++)
        for (int k = 0 ; k < n ; k++) {
          ret.a[i][j] = (ret.a[i][j] + 1ll * a[i][k] * other.a[k][j]) % MOD;
        }
    
    return ret;
  }

  Matrix operator ^(long long po) const {
    Matrix base(n), ret(n);
    for (int i = 0 ; i < n ; i++) {
      ret.a[i][i] = 1;
      for (int j = 0 ; j < n ; j++) {
        base.a[i][j] = a[i][j];
      }
    }

    while (po) {
      if (po & 1) ret = ret * base;
      base = base * base;
      po >>= 1;
    }

    return ret;
  }
};

int main() {
  int n;
  long long k;

  cin >> n >> k;
  Matrix m(n);
  m.read();

  m = m^k;

  int ret = 0;
  for (int i = 0 ; i < n ; i++)
    for (int j = 0 ; j < n ; j++) {
      ret = (ret + m.a[i][j]) % MOD;
    }
  
  cout << ret << endl;
  return 0;
}

Measured memory_bytes: 384
import sys
def input():
    return sys.stdin.readline()[:-1]


def main():
    n = int(input())
    a = list(map(int,input().split()))
    s = sum(a)
    ans = 0
    for i in range(n):
        s = s - a[i]
        ans = ans + a[i] * s
    print(ans % (10 ** 9 + 7))

    
if __name__ == "__main__":
    main()

Measured memory_bytes: 31616
#include<bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int (i)=0;(i) < (N); (i)++)
#define all(V) V.begin(), V.end()
using i64 = long long;
using P = pair<int,int>;


int main(){
    int N;
    cin >> N;
    cout << N*N*N << endl;
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <map>
#include <list>
#include <cmath>
using namespace std;
typedef long long ll;
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define mp make_pair
#define pb push_back
const int INF = 1e9;
const ll LINF = 1e18;
const int MOD = 1e9+7;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<int> x(n), y(n);
	for (int i = 0; i < n; i++) cin >> x.at(i) >> y.at(i);

	double ans = 0;
	for (int i = 0; i < n; i++) {
		for (int j = i+1; j < n; j++) {
			ans += (sqrt( pow((x.at(i)-x.at(j)),2.0) + pow((y.at(i)-y.at(j)),2.0) )) * 2/n;
		}
	}
	printf("%.8lf", ans);

    return 0;
}


Measured memory_bytes: 256