akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
typedef long long int lint;

#define PI acos(-1)
#define INF64 1LL << 60
#define INF32 1 << 29
#define all(a) (a).begin(), (a).end()
#define INV ((long long int)1000000007)

using namespace std;

void execute()
{
	int N, K;
	cin >> N >> K;

	int count = 0;
	for (int i = 1; i <= N; i *= K)
	{
		count++;
	}

	cout << count << endl;

	return;
}

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

	int stop;
	cin >> stop;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define U [7<<15]={}
#define G ((c=A[a]+A[P[a]]+C[a])%k?c:0)+M(
typedef long long L;using namespace std;map<L,L>T U;L P U,Z U,H U,C U,A U,O U,X U,B U,k,n,a,b,c;char s U;L M(L f){return f?B[f]+M(f^f&-f):0;}L S(L i){for(c=G i++)-M(i);i<2e5;i+=i&-i)B[i]+=c;}L D(L f){L d;for(map<L,L>::iterator I=T[f].begin();I!=T[f].end();I++)d=I->first,d-P[f]?P[d]=f,C[d]=I->second,D(d),n=Z[f]+=++Z[d],Z[H[f]]<Z[d]?H[f]=d:0:0;}L K(L f){return Z[a=X[f]]>Z[n=X[b]]?n=b,b=f,K(n):abs(M(O[f])-(a-n?-G O[a])-K(P[a]):M(O[b])));}main(){for(cin>>n>>k;--*Z+n;T[a][b]=T[b][a]=c)cin>>a>>b>>c;for(D(0);Z[a=H[P[++n]]-n?n:0];)for(;!O[a];a=H[a],S(*Z=O[c]=++b))X[c=a]=n;for(cin>>a;cin>>s>>a>>b;S(b=O[a]-1),a=H[a],S(b+1))*s&2?cout<<K(a)<<endl,0:A[a]+=b;}

Measured memory_bytes: 37328
#include <bits/stdc++.h>
#define fi first
#define se second
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define space putchar(' ')
#define enter putchar('\n')
#define eps 1e-10
#define MAXN 100005
//#define ivorysi
using namespace std;
typedef long long int64;
typedef unsigned int u32;
typedef double db;
template<class T>
void read(T &res) {
    res = 0;T f = 1;char c = getchar();
    while(c < '0' || c > '9') {
	if(c == '-') f = -1;
	   c = getchar();
    }
    while(c >= '0' && c <= '9') {
    	res = res * 10 +c - '0';
    	c = getchar();
    }
    res *= f;
}
template<class T>
void out(T x) {
    if(x < 0) {x = -x;putchar('-');}
    if(x >= 10) {
    	out(x / 10);
    }
    putchar('0' + x % 10);
}
int N;
char s[MAXN];
void Solve() {
    scanf("%s",s + 1);
    N = strlen(s + 1);
    int ans = 0;
    for(int i = 1 ; i <= N ; ++i) {
        if(i & 1) {
            if(s[i] == 'p') ans--;
        }
        else {
            if(s[i] == 'g') ans++;
        }
    }
    out(ans);enter;
}
int main() {
#ifdef ivorysi
    freopen("f1.in","r",stdin);
#endif
    Solve();
    return 0;
}


Measured memory_bytes: 764
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.buffer.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.buffer.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

n = ri() - 1
li = []
while n >= 26:
  a = n%26
  li.append(a)
  n //= 26
  n -= 1
li.append(n)  
li.reverse()
ans = ''
for i in li:
  s = 'abcdefghijklmnopqrstuvwxyz'[i]
  ans += s
print(ans)



Measured memory_bytes: 27164
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for( int i=a; i<b; i++ )
#define REP(i,n) rep(i,0,n)
#define INF 1000000000000
using lli = long long int;
using ulli = unsigned long long int;
typedef pair<lli,lli> P;

struct edge{ int u, v; lli cost; };
struct DirectedGraph
{
  int vertex_num;
  int edge_num;
  vector<edge> edge_list;
  vector< vector<int> > adj_list;
	vector< vector<lli> > distance_matrix;
};

template <typename T>
vector<int> argsort(const vector<T> &v) {

  // initialize original index locations
  vector<int> idx(v.size());
  iota(idx.begin(), idx.end(), 0);

  // sort indexes based on comparing values in v
  sort(idx.begin(), idx.end(),
       [&v](int i1, int i2) {return v[i1] < v[i2];});

  return idx;
}

template<typename T>
void displayVector(vector<T> v)
{
	lli n = v.size();
	REP(i,n){
		cout << v[i] << " " ;
	}
	cout << endl;
}



int main(){
	string s, t; cin >> s >> t;
	int out = 0;
	REP(i, s.size()){
		if(s[i] != t[i]){ out++; }
	}
	cout << out << endl;
	return 0;
}

Measured memory_bytes: 3916
#include <bits/stdc++.h>
using namespace std;
using lint = long;
using ll = long long;
#define rep(i,n) for(lint i = 0;i < (lint)n; i++)
#define repInRange(i,start,end) for(lint i = start; i < end; ++i)
using lpair = pair<lint,lint>;
using Vecint = vector<lint>;
using Llist = list<lint>;

ll pow(ll k,ll l) {
	ll ret = 1;
	rep(i,l) {
		ret *= k;
	}
	return ret;
}

void Main() {
	string s;
	lint sum = 0;
	cin >> s;
	rep ( i, s.size() )
		sum += s.at(i) - '0';
	if ( sum % 9 == 0 )
		cout << "Yes" << '\n';
	else
		cout << "No" << '\n';
}

signed main() {
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	Main();
	return 0;
}

Measured memory_bytes: 3768
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <array>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <cmath>
#include <climits>
#include <cstdio>
#include <iomanip>
#include <utility>

using namespace std;
typedef long long int ll;

int main(int argc, char const *argv[])
{
    ll k, s, ans = 0;
    cin >> k >> s;
    for (ll x = 0; x <= k; x++)
    {
        for (ll y = 0; y <= k; y++)
        {
            if (s - x - y >= 0 && s - x - y <= k)
                ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<string>
#include<vector>
#include<set>
#include<cctype>
#define ld long double
#define ll long long int
#define ull unsigned long long int
using namespace std;
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
const long long INF=1LL<<60;


int main(void){
	ios::sync_with_stdio(false); cin.tie(0);
	
	string s,a="CODEFESTIVAL2016";
	cin>>s;
	int i,ans=0;
	for(i=0;i<16;i++)if(a[i]!=s[i])ans++;
	cout<<ans<<endl;
	
	return 0;
}

Measured memory_bytes: 256
using System;

public class P
{
    public int x { get; set; }
    public int y { get; set; }
}

public class Hello
{
    public static void Main()
    {
        while (true)
        {
            var n = int.Parse(Console.ReadLine().Trim());
            if (n == 0) break;
            var map = new P[n, n];
            var used = new int[n, n];
            for (int i = 0; i < n; i++)
            {
                string[] line = Console.ReadLine().Trim().Split(' ');
                for (int j = 0; j < n; j++)
                {
                    var wx = int.Parse(line[2 * j]);
                    var wy = int.Parse(line[2 * j + 1]);
                    map[j, i] = new P { x = wx, y = wy };
                }
            }
            var count = 0;
            var mark = 1;
            for (int i = 0; i < n; i++)
                for (int j = 0; j < n; j++)
                {
                    if (used[j, i] == 0)
                    {
                        used[j, i] = mark;
                        var nx = j;
                        var ny = i;
                        while (true)
                        {
                            var nx2 = map[nx, ny].x;
                            var ny2 = map[nx, ny].y;
                            var w = used[nx2, ny2];
                            if (w != 0 && w != mark) { mark++; break; }
                            else if (w == mark) { count++; mark++; break; }
                            used[nx2, ny2] = mark;
                            nx = nx2;
                            ny = ny2;
                        }
                    }
                }
            Console.WriteLine(count);
        }
    }
}


Measured memory_bytes: 15776
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, a, b) for (int i = (a); i < (b); i++)
//#include "library/debug.cpp"

vector<int> zalg(string s) {
    int n = s.size(), i = 1, j = 0;
    vector<int> a(n);
    a[0] = n;
    while (i < n) {
        while (i + j < n && s[j] == s[i + j]) j++;
        a[i] = j;
        if (j == 0) {
            i++;
            continue;
        }
        int k = 1;
        while (i + k < n && k + a[k] < j) {
            a[i + k] = a[k];
            k++;
        }
        i += k;
        j -= k;
    }
    return a;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, ans = 0;
    cin >> n;
    string s;
    cin >> s;
    rep(i, 0, n) {
        string t = s.substr(i);
        vector<int> x = zalg(t);
        //debug(x);
        rep(j, 0, n - i) {
            ans = max(ans, min(j, x[j]));
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#define FASTIO ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
//#define BZ
//#define PBDS
//#define POINT

#ifndef BZ
#pragma GCC optimize ("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC optimize ("no-stack-protector")
#pragma GCC target ("tune=native")
//#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize ("conserve-stack")
//#pragma GCC optimize ("no-stack-limit")
#endif

#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
using str = string;
using pll = pair<ll, ll>;

#ifdef POINT
using point = complex<ll>;
#define x real
#define y imag
#endif

#ifdef PBDS
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
//using namespace __gnu_pbds::detail;
template <class T>
using indexed_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#endif

#define INF 0x7fffffffffffffffLL
#define BASE 1000000007LL // 3 * 10**9 + 19 // 998244353 - rev == pow(n + m, BASE - 2)
#define MAX(type) std::numeric_limits<type>::max()
#define MIN(type) std::numeric_limits<type>::min()

#define LOG(v) //cout << #v << " " << v << "\n";

#define pb push_back
#define eb emplace_back
//#define all(c) c.begin(), c.end()
//#define rall(c) c.rbegin(), c.rend()
#define F first
#define S second
#define forEach(c) for (auto &it : c)
#define loop while (true)
#define mp make_pair
#define mt make_tuple

template<class T>
void chMax(T &a, T b) {
	if (a < b) a = b;
}

template<class T>
void chMin(T &a, T b) {
	if (b < a) a = b;
}

inline ll divUp(ll a, ll b) {
	return (a + b - 1)/b;
}

vector<ll> precFact{1};
ll fact(ll n) {
	while (precFact.size() <= n) {
		precFact.pb(precFact.back() * precFact.size() % BASE);
	}
	return precFact[n];
}

ll mul(ll a, ll b) {
	return ((a * b % BASE) + BASE) % BASE;
}

ll mpow(ll a, ll p) {
	ll ans = 1;
	while (p) {
		if (p & 1) ans = mul(ans, a);
		a = mul(a, a);
		p /= 2;
	}
	return ans;
}

ll rev(ll a) {
	return mpow(a, BASE - 2);
}

ll nCk(ll n, ll k) {
	LOG(n) LOG(fact(n))
	LOG(k) LOG(fact(k))
	LOG(n - k) LOG(fact(n - k))
	ll ans = fact(n);
	ans = mul(ans, rev(fact(n - k)));
	ans = mul(ans, rev(fact(k)));
	return ans;
}

void solve() {
	ll x, y;
	cin >> x >> y;
	if ((x + y) % 3) {
		cout << "0\n";
		return;
	}
	if (x < y) swap(x, y);
	ll n = x / 2;
	ll m = x - 2 * n;
	while ((x != 2 * n + m) || (y != n + 2 * m)) {
		n--;
		m += 2;
		if (n < 0) break;
	}
	if (n < 0 || m < 0) {
		cout << "0\n";
		return;
	}
	cout << nCk(n + m, n) << "\n";
}

//#define LOCAL

int main() {
	FASTIO
#ifdef LOCAL
	auto start = std::chrono::system_clock::now();
#endif
	solve();
#ifdef LOCAL
	auto end = std::chrono::system_clock::now();
	std::chrono::duration<ld> elapsed_seconds = end - start;
	cerr << "\ntime: " << elapsed_seconds.count() << " s\n";
#endif
	return 0;
}


Measured memory_bytes: 10604
#include <bits/stdc++.h>
using namespace std;
int main(){
    int N;
    cin >> N;
    vector<int> H(N);
    for(int i=0; i < N; i++){
        cin >> H[i];
    }

    int res = 0;
    for (vector<int>::iterator it=H.begin(); it < H.end(); it++){
        // cout << "*it = " << *it << endl;
        int max = *max_element(H.begin(), it+1);
        // cout << "max = " << max <<endl;
        if(max == *(it)){
            res += 1;
        }
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  string S;
  int ans = 0;
  cin >> S;
  for (int i=0; i<S.size(); i++){
    if (S.at(i) == '+'){
      ans ++;
    }
    else{
        ans --;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
let cnt = ref 0

let insertion_sort (n:int) ?(gap=1) (a:int array) =
  for i=gap to n-1 do
    let v = a.(i) in
    let j = ref (i - gap) in
    while !j >= 0 && a.(!j) > v do
      a.(!j+gap) <- a.(!j);
      j := !j - gap;
      incr cnt;
    done;
    a.(!j+gap) <- v
  done

let gen_gaps (n:int) =
  let rec aux = function
      [] -> aux [1]
    | h::t when h > n -> t
    | h::_ as l -> aux ((float_of_int h |> ( *. ) 2.25 |> int_of_float) ::l) in
  (if n > 701 then aux [701;301;132;57;23;10;4;1]
   else List.filter ((>=) n) [701;301;132;57;23;10;4;1])
  |> Array.of_list

let shell_sort (array:int array) (n: int) =
  let g = gen_gaps n in
  let m = Array.length g in
  for i=0 to m-1 do
    insertion_sort n ~gap:g.(i) array;
  done;
  Printf.printf "%d\n" m;
  Array.iteri
    (fun i x -> Printf.printf (if i=m-1 then "%d\n" else "%d ") x)
    g;
  Printf.printf "%d\n" !cnt;
  array

let () =
  let n = read_int () in
  let rec read a = function
      i when i = n -> a
    | i -> a.(i) <- (read_int ());
      read a (i+1) in
  let a = read (Array.make n 0) 0 in
  Array.iter (Printf.printf "%d\n") (shell_sort a n)

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

class ModInt{
private:
  long long number;

public:
  static constexpr long long mod = 998244353;

  constexpr ModInt(const ModInt& x) : number(x.number){};

  constexpr ModInt(const long long number = 0) : number((mod + number) % mod){}

  constexpr long long get() const{
    return number;
  }

  constexpr ModInt& operator=(const ModInt& rhs) &{
    number = rhs.number;
    return *this;
  }

  constexpr ModInt operator+() const{
    return ModInt(*this);
  }

  constexpr ModInt operator-() const{
    return ModInt(mod - number);
  }

  constexpr ModInt& operator+=(const ModInt& rhs){
    number += rhs.number;
    if(number >= mod) number -= mod;
    return *this;
  }

  constexpr ModInt& operator-=(const ModInt& rhs){
    number -= rhs.number;
    if(number < 0) number += mod;
    return *this;
  }

  constexpr ModInt& operator*=(const ModInt& rhs){
    (number *= rhs.number) %= mod;
    return *this;
  }

  constexpr ModInt& operator/=(const ModInt& rhs){
    (*this) *= rhs.inverse();
    return *this;
  }

  constexpr ModInt inverse() const{
    long long a = number, m = mod, u = 1, v = 0;

    while(m){
      long long t = a / m;
      a -= t * m;
      u -= t * v;

      //swap a, m
      a ^= m; m ^= a; a ^= m;

      //swap u, v
      u ^= v; v ^= u; u ^= v;
    }

    return ModInt(u);
  }

  constexpr ModInt& operator++(){
    return *this += 1;
  }

  constexpr ModInt& operator--(){
    return *this -= 1;
  }

  constexpr ModInt operator++(int){
    ModInt ret = *this;
    ++(*this);
    return ret;
  }

  constexpr ModInt operator--(int){
    ModInt ret = *this;
    --(*this);
    return ret;
  }
};

constexpr ModInt operator+(const ModInt& lhs, const ModInt& rhs){
  return ModInt(lhs) += rhs;
}

constexpr ModInt operator-(const ModInt& lhs, const ModInt& rhs){
  return ModInt(lhs) -= rhs;
}

constexpr ModInt operator*(const ModInt& lhs, const ModInt& rhs){
  return ModInt(lhs) *= rhs;
}

constexpr ModInt operator/(const ModInt& lhs, const ModInt&rhs){
  return ModInt(lhs) /= rhs;
}

constexpr ModInt operator^(const ModInt& lhs, const int& rhs){
  long long b = lhs.get(), e = rhs, y = 1, mod = lhs.mod;
  bool inv = e < 0;
  if(inv) e = -e;

  while(e){
    if(e & 1) (y *= b) %= mod;

    (b *= b) %= mod;
    e >>= 1;
  }

  return (inv ? ModInt(y).inverse() : ModInt(y));
}

std::istream& operator>>(std::istream& is, ModInt& x){
  long long in;
  is >> in;
  x = in;
  return is;
}

std::ostream& operator<<(std::ostream& os, const ModInt& x){
  os << x.get();
  return os;
}

using namespace std;

int main(){
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  
  vector<vector<ModInt>> dp(C + 1, vector<ModInt>(D + 1, 0));
  dp[A][B] = 1;
  for(int a = A; a <= C; a++){
    for(int b = B; b <= D; b++){
      if(a == A && B == b) continue;
      dp[a][b] = dp[a - 1][b] * b + dp[a][b - 1] * a - dp[a - 1][b - 1] * ((a - 1) * (b - 1));
    }
  }
  
  
  cout << dp[C][D] << endl;
  
  return 0;
}

Measured memory_bytes: 73600
#include<bits/stdc++.h>
#define rep(i,n) for (int i=0;i<(n);i++)
using namespace std;
using P = pair<int,int>;
using ll = long long;
using namespace std;
int main(void){
    // Your code here!
    int k; cin >> k;
    int a, b; cin >> a >> b;
    for(int i = a; i <= b; ++i){
        if(i%k == 0){cout << "OK" << endl; return 0;}
    }
    cout << "NG" << endl;
}


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

typedef long long ll;
const ll INF = 1010000000000000017LL;
const ll MOD = 1000000007LL;

#define REP(i, n) for(ll i = 0 ; i < n; i++)

//#define DEBUG(fmt, ...)
#define DEBUG(fmt, ...) fprintf(stderr, fmt "\n", ##__VA_ARGS__)

int main(){
    std::cout<<std::fixed<<std::setprecision(10);

    int r;
    cin >> r;

    cout << r * r << endl;
}


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

ll s[200005]={};

int main() {
	int n;
	scanf("%d",&n);
	for(int i = 1; i <= n; ++i)
		scanf("%lld",s+i);
	for(int i = 2; i <= n; ++i)
		s[i] += s[i-1];
	ll diff = 1LL<<60;
	for(int sz = 1; sz < n; ++sz)
		diff = min(diff,abs(s[n]-s[sz]-s[sz]));
	printf("%lld\n",diff);
}

Measured memory_bytes: 1792
//author : Yogi79

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

long long m,n;

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

   cin>>m>>n;
   m--;
   n--;
   long long p =n/m;
   if(p*m == n)
   	cout<<p;
   else
   	cout<<p+1;
}

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

using namespace std;

typedef long long ll;

typedef pair<ll,ll> pll;
typedef vector<ll> vll;
typedef vector<pll> vpll;
typedef vector<vll> vvll;

#define all(x) (x).begin(), (x).end()
#define fi first
#define se second

int main() 
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s,t;
    cin >> s;
    cin >> t;
    int n = s.size();
    int ma = t.size();
    for(int i=0;(i+t.size())<=n;i++){
    	int cc = 0;
    	int cnt = 0;

    	for(auto x : t){
    		if(x!=s[i+cc]){
    			cnt++;
    		}
    		cc++;
    	}
    	if(cc == t.size()){
    		ma = min(ma,cnt);
    	}
    }
    cout<<ma<<"\n";
    return 0;
}


Measured memory_bytes: 3656
// 3:34
#include <iostream>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <utility>
#include <vector>
#include <map>
#include <deque>
#include <tuple>
using namespace std;
typedef long long ll;
#define for1(i,n) for (ll i=0;i<(n);(i)++)
#define for2(i,m,n) for (ll (i)=(m);(i)<(n);(i)++)
#define for3(i,m,n,d) for (ll (i)=(m);(i)<(n);(i)+=(d))
#define INF (1LL << 60)
#define STRING(str) #str
#define DEBUG 0
#if DEBUG
    #define trace(var) dump(STRING(var), var)
#else
    #define trace(var)
#endif

void dump(const string& name, const ll value)
{
    cerr << name << ": " << value << endl;
}

ll A[100005];

void solve()
{
    ll ans = 0;
    ll N;
    cin >> N;
    for1(i,N) {
        ll a;
        cin >> a;
        A[i] = a - 1;
    }
    for1(i,N) {
        if (A[A[i]] == i) {
            ans++;
        }
    }

    cout << ans / 2 << endl;
}

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


Measured memory_bytes: 1024
a,b,c=map(int,input().split())
k=int(input())
cnt=1
while cnt<=k:

    if a>=b:
        b*=2
    elif b>=c:
        c*=2
    elif b>a and c>b:
        break
    cnt+=1


if a<b and b<c:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 9184
#include <iostream>

using namespace std;

int n, m;
int jn[1001][1001];
int oc[1001][1001];
int ic[1001][1001];

int main()
{
  char c;
  int k, s, t, u, v;

  while(cin>>m>>n && n+m){
    cin >> k;
    for(int i = 0; i <= m; ++i)
      for(int j = 0; j <= n; ++j)
	jn[i][j] = oc[i][j] = ic[i][j] = 0;

    for(int i = 1; i <= m; ++i){
      s = t = u = 0;
      for(int j = 1; j <= n; ++j){
	cin >> c;
	if(c == 'J') ++s;
	if(c == 'O') ++t;
	if(c == 'I') ++u;

	jn[i][j] += (s+jn[i-1][j]);
	oc[i][j] += (t+oc[i-1][j]);
	ic[i][j] += (u+ic[i-1][j]);
      }
    }

    while(k--){
      cin >> s >> t >> u >> v;
      cout << (jn[u][v]-jn[u][t-1]-jn[s-1][v]+jn[s-1][t-1]) << " " << flush;
      cout << (oc[u][v]-oc[u][t-1]-oc[s-1][v]+oc[s-1][t-1]) << " " << flush;
      cout << (ic[u][v]-ic[u][t-1]-ic[s-1][v]+ic[s-1][t-1]) << endl;
    }
  }

  return 0;
}

Measured memory_bytes: 12000
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, x, n) for (int i = x; i < (int)(n); i++)
#define sc(x) scanf("%d",&x)
#define scll(x) scanf("%lld",&x)
int main(){
    ll n, ans = 0; scll(n);
    map<string, ll> mp;
    string s;
    rep(i, 0, n){
        cin >> s;
        sort(s.begin(), s.end());
        ++mp[s];
    }
    for (const auto &x : mp){
        if (x.second==1) continue;
        ans += x.second*(x.second-1)/2;
    }
    cout << ans << endl;
    return 0;
}

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

#define int ll
#define endl '\n'
#define ends ' '
#define die(x) return cout << x << endl, 0
#define all(v) v.begin(), v.end()
#define sz(x) (int)(x.size())
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) { cerr << ends << H; debug_out(T...); }
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
typedef long long ll;
typedef pair<int, int> pii;
const ll INF = 1e18;
const ll MOD = 1e9 + 7;

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

const int N = 2e5 + 5;

int H[N];
ll FEN[N];

void Add(int p, ll x) {
	for (p++; p < N; p += p & -p) FEN[p] = max(FEN[p], x);
}
ll Get(int p) {
	ll res = 0;
	for (; p > 0; p -= p & -p) res = max(res, FEN[p]);
	return res;
}

int32_t main() {

	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);

	int n; cin >> n;
	for (int i = 0; i < n; i++) cin >> H[i], H[i]--;
	for (int i = 0; i < n; i++) {
		int x; cin >> x;
		x += Get(H[i]);
		Add(H[i], x);
	}
	cout << Get(n) << endl;

	return 0;
}


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

#define INF 1e9
#define LLINF 1e18
#define pi 3.14159265358979323
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;

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


int main() {
    int n;
    int ans = 0;
    cin >> n;
    int h, w;
    cin >> h >> w;
    vector<int> a(n);
    vector<int> b(n);
    rep(i, n) {
        cin >> a.at(i) >> b.at(i);
        if (a.at(i) >= h && b.at(i) >= w) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3624
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
const int N=2*1e5+5;
long long n,a[N],b[N];
long long ans=0;
int main()
{
    cin>>n;
    int f=0;
    ans=0;
    for(int i=0;i<n;i++)
        {
            cin>>a[i]>>b[i];
            ans+=a[i];
            if(a[i]!=b[i])
                f=1;
        }
    if(!f)
    {
        cout<<0<<endl;
    }
    else
    {
        //sort(a,a+n);
        //sort(b,b+n);
        long long p=2000000000+7;
        for(int i=0;i<n;i++)
        {
            if(a[i]>b[i])
                p=min(p,b[i]);
        }
        cout<<ans-p<<endl;
    }
    return 0;
}


Measured memory_bytes: 1144
#include<iostream>
#include<cstring>
#include<cstdio>
#define mod 1000000007
using namespace std;
long long dp[5010][5010];
char s[5010];
void rw(long long &a,long long b){a=(a+b)%mod;}
int main()
{
	int n;scanf("%d%s",&n,s);
	int m=strlen(s);dp[0][0]=1;
	for(int i=0;i<=n;i++)
	for(int j=0;j<=i;j++)
	{
		rw(dp[i+1][max(0,j-1)],dp[i][j]);
		rw(dp[i+1][j+1],2*dp[i][j]);
	}
	for(int i=1;i<=m;i++)dp[n][m]=dp[n][m]*500000004%mod;
	printf("%lld\n",dp[n][m]);return 0;
}

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

const int maxn = 111;
int a[maxn];

signed main() {
  // freopen("in", "r", stdin);
  for(int i = 1; i <= 3; i++) scanf("%d",&a[i]);
  sort(a+1, a+3+1);
  int ret = 0;
  for(int i = 2; i <= 3; i++) ret += a[i] - a[i-1];
  printf("%d\n", ret);
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define dup(x,y) (((x)+(y)-1)/(y))
#define v(T) vector<T>
#define vv(T) v(v(T))
#define diup(v,a,k) distance((v).begin(),(k)+upper_bound((v).begin(),(v).end(),(a)))
#define dilo(v,a,k) distance((v).begin(),(k)+lower_bound((v).begin(),(v).end(),(a)))
using ll = int64_t;
using ull = uint64_t;
using uint = uint32_t;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,v.size())i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,v.size())s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(v.size())o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
//---------------------------------------------------------------
#define fastio cin.tie(nullptr); std::ios::sync_with_stdio(false);
#define myio ifstream iofi; if(argc>1){iofi.open(argv[1]); std::cin.rdbuf(iofi.rdbuf());}
#define myloopset int loop = 1; if(argc>2) loop =stoi(argv[2]); rep(i,loop)
//--------------------------------------------------------------
template <class T> T chmin(T &a,T b){if(a>b){a=b; return 1;}else return 0;}
template <class T> T chmax(T &a,T b){if(a<b){a=b; return 1;}else return 0;}
struct Edge{
  int from;
  int to;
  ll cost;
  Edge(int from,int to,ll cost){
    this->from = from; 
    this->to   = to; 
    this->cost = cost; 
  }
};
void Main(){
  int n;
  cin>>n;
  vv(Edge) g(n);
  vl d(n,LINF);
  rep(i,n-1){
    int a,b;ll c;
    cin>>a>>b>>c;
    a--;b--;
    g[a].pb({a,b,c});
    g[b].pb({b,a,c});
  }
  int q,k;
  cin>>q>>k;
  k--;
  d[k]=0;
  PQ(pll) que;
  que.push({0,k});
  while(!que.empty()){
    pll p = que.top(); que.pop();
    ll v = p.second;
    if(d[v] < p.first) continue;
    for(auto e:g[v]){
      if(chmin(d[e.to],d[e.from]+e.cost)){
        que.push({d[e.to], e.to});
      }
    }
  }
  rep(i,q){
    int x,y;
    cin>>x>>y;
    x--;y--;
    cout<<d[x]+d[y]<<endl;
  }
} int main(int argc,char** argv)
{fastio; myio; myloopset Main();}


Measured memory_bytes: 11120
#include <algorithm>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <vector>

using namespace std;

#define rep(i, n) for (int64_t i = 0; i < (int64_t)(n); i++)
#define irep(i, n) for (int64_t i = 0; i <= (int64_t)(n); i++)
#define rrep(i, n) for (int64_t i = (n)-1; i >= 0; i--)
#define rirep(i, n) for (int64_t i = n; i >= 0; i--)

int main() {
  vector<int> var(3);
  rep(i, 3) { cin >> var[i]; }
  sort(var.begin(), var.end());

  int d = var[2] - var[0];
  if (d == 0) {
    cout << (var[0] % 2 == 0 ? -1 : 0) << endl;
  } else {
    int cnt = bitset<32>((d & -d) - 1).count() + 1;
    rep(i, cnt) {
      if (var[0] % 2 == 1 || var[1] % 2 == 1 || var[2] % 2 == 1) {
        cout << i << endl;
        break;
      }
      vector<int> tmp = {(var[0] + var[1]) / 2, (var[1] + var[2]) / 2,
                         (var[2] + var[0]) / 2};
      var = tmp;
    }
  }
  return 0;
}

Measured memory_bytes: 3628
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;

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

        int p = s.nextInt(); // A<=>B
        int q = s.nextInt(); // B<=>C
        int r = s.nextInt(); // C<=>A

        int pq = p + q;
        int pr = p + r;
        int qr = r + q;

        if (pq == Math.min(Math.min(pq, pr), qr)) {
            System.out.println(pq);
        } else if (pr == Math.min(Math.min(pq, pr), qr)) {
            System.out.println(pr);
        } else {
            System.out.println(qr);
        }
    }
}


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

using ll = long long;

int main()
{
    auto values = array<ll, 3>{};
    for (auto& x : values) cin >> x;

    auto iterations = 0;
    while (true)
    {
        auto any_odd = false;
        for (const auto x : values)
            any_odd |= x % 2 == 1;
        if (any_odd) break;

        if (values[0] == values[1] && values[1] == values[2])
        {
            cout << -1 << endl;
            return 0;
        }

        iterations++;

        auto total = accumulate(begin(values), end(values), 0LL);
        for (auto& x : values)
            x = (total - x) / 2;
    }

    cout << iterations << endl;
}


Measured memory_bytes: 764
#include <bits/stdc++.h>
using namespace std;
 
 int main(){
   int a,b,c,d,e;
   cin >> c;
   a = c/1000;
   b = c/100-a*10;
   d = c/10 -a*100 - b*10;
   e = c - a*1000 - b* 100 - d*10;
   if (( a==b && a==d)||(b ==d && b ==e)){
     cout << "Yes" << endl;
   }
   else {
     cout <<"No"<< endl;
   }
 }

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
//#define _GLIBCXX_DEBUG //GCC5.4.1で配列の範囲外アクセスをエラーにする

//cmdで g++ test.cpp とするとコンパイルできる
//制限1秒なら10^6は余裕 10^7は多分間に合う 10^8はよほど単純でないと厳しい

typedef long long ll; //long long
typedef pair<int,int> pii; //pair<int,int>

const int MOD=1000000007; //10^9+7

const int MAX = 1000001;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
    int X,Y;
    cin>>X>>Y;
    //x+yは常に3の倍数
    //(0,0) -> (1,2)(2,1) -> (2,4)(3,3)(4,2) -> (3,6)(4,5)(5,4)(6,3)
    //1 -> 1,1 -> 1,2,1 -> 1,3,3,1
    if((X+Y)%3){
        cout<<0<<endl;
    }else{
        int n=(X+Y)/3;
        int r=X-n;
        COMinit();
        cout<<COM(n,r)<<endl;
    }
}


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

#define sswap(x, y) { x+=y; y=x-y; x-=y; }
#define LSOne(S) ((S) & (-S))

#define EPS 1e-6
#define MOD 1000000007

#define fi first
#define se second
#define pb push_back
#define ende '\n'

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define mset(x, y) memset(&x, (y), sizeof(x))

using ll = long long;
using ii = pair<int, int>;
using vi = vector<int>;

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
	ll w, h, x, y, hor, ver;
	cin >> w >> h >> x >> y;

	cout << double(w)*double(h)/2 << ' ' << ((x<<1 == w)&&(y<<1 == h) ? 1 : 0) << ende;
  return 0;
}


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

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

ans=[0]*8
c=0

for i in range(n):
    if a[i]<3200:
        ans[a[i]//400]=1
    else:
        c+=1

mi=sum(ans)
ma=sum(ans)+c

if mi==0:
    mi=1


print(' '.join([str(mi),str(ma)]))

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

int main()
{
	int x;
	
	cin >> x;
	if(x==7 || x==5 || x==3)
	{
		cout << "YES";
	}else{
		cout << "NO";
	}
	cout << endl;
	return 0;
}



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

using namespace std;

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

  return 0;
}
/* vim:set fdm=marker: */


Measured memory_bytes: 3592
using System;
using System.Linq;
using System.IO;
using System.Collections.Generic;
using System.Text;

namespace AtCoder {
    public class Program {
        static int[] getKeys() {
            var Keys = Console.ReadLine().Split(' ');
            int N = Keys.Length;
            int[] Ns = new int[N];
            for (int i = 0; i < N; i++) {
                Ns[i] = int.Parse(Keys[i]);
            }
            return Ns;
        }
        static int[] getKeys(char delimiter) {
            var Keys = Console.ReadLine().Split(delimiter);
            int N = Keys.Length;
            int[] Ns = new int[N];
            for (int i = 0; i < N; i++) {
                Ns[i] = int.Parse(Keys[i]);
            }
            return Ns;
        }
        public static void Show<T>(T[,] map) {
            int H = map.GetLength(0);
            int W = map.GetLength(1);
            Console.WriteLine("-------------------------");
            for (int i = 0; i < H; i++) {
                for (int j = 0; j < W; j++) {
                    Console.Write(map[i, j] + " ");
                }
                Console.WriteLine();
            }
            Console.WriteLine("-------------------------");
        }
        public static void Show<T>(T[,] map, string delimiter) {
            int H = map.GetLength(0);
            int W = map.GetLength(1);
            Console.WriteLine("-------------------------");
            for (int i = 0; i < H; i++) {
                for (int j = 0; j < W; j++) {
                    Console.Write(map[i, j] + delimiter);
                }
                Console.WriteLine();
            }
            Console.WriteLine("-------------------------");
        }
        public static void Show<T>(IEnumerable<T> ts) {
            foreach (var item in ts) {
                Console.Write(item + " ");
            }
            Console.WriteLine();
        }
        public static void Show<T>(IEnumerable<T> ts, string delimiter) {
            foreach (var item in ts) {
                Console.Write(item + delimiter);
            }
            Console.WriteLine();
        }


        static void Main() {
            var Key = getKeys();
            int N = Key[0];
            int M = Key[1];
            if (N >= M) {
                Console.WriteLine(0);
                return;
            }
            Key = getKeys();
            Array.Sort(Key);
            List<int> distances = new List<int>();
            for (int i = 1; i < M; i++) {
                distances.Add(Key[i] - Key[i - 1]);
            }
            distances.Sort((x, y) => y - x);
            for (int i = 0; i < N - 1; i++) {
                distances.Remove(distances.First());
            }
            Console.WriteLine(distances.Sum());
        }
    }
}


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

template <class T1, class T2>
ostream& operator << (ostream& out, const pair <T1, T2> p)
{
	out << '(' << p.first << ',' << p.second << ')';
	return out;
}
 
template <class T1, class T2>
istream& operator >> (istream& in, pair<T1, T2> &p)
{
	in >> p.first >> p.second;
	return in;
}
 
template <class T>
istream& operator >> (istream& in, vector<T> &v)
{
	for (T &x : v)
		in >> x;
	return in;
}
 
template <class T>
ostream& operator << (ostream& out, const vector<vector<T>> &v)
{
	for (const vector<T> &x : v)
		out << x << '\n';
	return out;
}
 
template <class T>
ostream& operator << (ostream& out, const vector<T> &v)
{
	for (const T &x : v)
		out << x << ' ';
	return out;
}


#define ll long long
#define lf long double
#define pb push_back
#define mp make_pair
#define F first
#define S second
typedef pair <ll,ll > ii;
typedef vector <ll> vi;
typedef vector <ii> vii;
typedef vector <bool> vb;
typedef vector <vector <ll> > vv;
typedef vector <vector <vector<ll> > > vvv;
typedef vector <string> vs;
typedef vector <lf> vf;
#define sz(x) (ll)(x).size()
#define tr1(x) cerr << #x << ": " << x << nl
#define tr2(x, y) cerr << #x << ": " << x << " | " << #y << ": " << y << nl
#define tr3(x,y,z) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<nl
#define tr4(x,y,z,w) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<" | "<<#w<<": "<<w<<nl
#define trv(a) cerr<<#a<<": ";for(ll zz=0;zz<sz(a);zz++) cerr<<a[zz]<<" ";cerr<<nl
#define trset(s) cerr<<#s<<": ";for(auto &i:s) cerr<<i<<" ";cerr<<nl
#define epsilon 0.000000001L
#define inf 9999999999999999ll// ~ 10^16
#define nl endl
#define all(x) x.begin(), x.end()
#define r_all(x) x.rbegin(), x.rend()
#define fast()  ios_base::sync_with_stdio(false);cin.tie(NULL)
#define mod 1000000007ll
#define modulo 998244353ll
ll power(ll a,ll b){return b?power(a*a%mod,b/2)*(b%2?a:1)%mod:1;}



int main() 
{
    fast();
    ll n,k;
    cin>>n>>k;
    vi a(n);
    cin>>a;
    for(ll i=0;i<n;i++)
        a[i]--;
    vi nodes;
    vb vis(n,false);
    ll curr=a[0];
    while(!vis[curr])
    {
        vis[curr]=true;
        nodes.pb(curr);
        curr=a[curr];
    }
    ll cycle_len=0;
    ll ind1=find(all(nodes),curr)-nodes.begin();
    
    cycle_len=sz(nodes)-ind1;

    k--;
    if(k<sz(nodes))
    {
        cout<<nodes[k]+1<<nl;
    }
    else
    {
        k-=ind1;
        k%=cycle_len;
        cout<<nodes[k+ind1]+1<<nl;

    }
}


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

int main()
{
    int N, M;
    cin >> N >> M;
    int R[8][8] = {};
    for (int i = 0; i < M; ++i)
    {
        int a, b;
        cin >> a >> b;
        R[a - 1][b - 1] = 1;
        R[b - 1][a - 1] = 1;
    }
    int array[8] = {0, 1, 2, 3, 4, 5, 6, 7};
    int ans = 0;
    do
    {
        if (array[0])
        {
            break;
        }
        bool can = true;
        for (int i = 1; i < N; ++i)
        {
            if (!R[array[i - 1]][array[i]])
            {
                can = false;
                break;
            }
        }
        if (can)
        {
            ++ans;
        }
    } while (next_permutation(array, array + N));
    cout << ans << endl;

    return 0;
}

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

int main(){
    int n;

    cin >> n;

    for(int i=1; i<=n; i++){
        double xa, ya, ra, xb, yb, rb;
        cin >> xa >> ya >> ra >> xb >> yb >> rb;

        double d = sqrt((xb-xa)*(xb-xa) + (yb-ya)*(yb-ya));

        if(ra + rb < d){
            cout << "0" << endl;
        }else if(ra + d < rb){
            cout << "-2" << endl;
        }else if(rb + d < ra){
            cout << "2" << endl;
        }else{
            cout << "1" << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 0
#coding:utf-8

H,W,K = map(int,input().split())

HB = [0] * H 
ans = 0

for i in range(H):
    koko = input()
    HB[i] = koko

for r in range(int(1 << H) - 1):
    for c in range(int(1 << W) - 1):
        black = 0
        for i in range(H):
            for j in range(W):
                if((r >> i) & 1) == 0 and ((c >> j) & 1) == 0 and HB[i][j] == '#':
                    black += 1
        if black == K:
            ans += 1

print('{}'.format(ans))

Measured memory_bytes: 9132
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

long long x;

int main() {
    cin >> x;
    vector<long long> xvec;
    xvec.emplace_back(1);
    for(int i = 2; i < sqrtl(x)+1; ++i) {
        if(x % i == 0) {
            xvec.emplace_back(i);
        }
    }

    int xlen = xvec.size();
    for(int i = 0; i < xlen; ++i) {
        long long nokori = x/xvec.at(i);
        xvec.emplace_back(nokori);
    }

    int xxlen = xvec.size();
    int ansa = 0; int ansb = 0;
    int xlim = sqrtl(x);
    int xun = -(xlim+1);
    int xup = xlim+1;
    for(int i = 0; i < xxlen; ++i) {
        for(int bb = xun; bb <= xup; ++bb) {
        int aa = bb + xvec.at(i);
        long long noko = x/xvec.at(i);
        long long sum = powl(aa, 4) + powl(aa, 3)*bb + powl(aa, 2)*powl(bb, 2) + aa*powl(bb, 3) + powl(bb, 4);
        if(sum == noko) {
            ansa = aa;
            ansb = bb;
            break;
        }

        }
    }
    cout << ansa << " " << ansb << endl;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
    ll m,n,s=0,c,d,t=0;
    cin>>n>>m>>c;
    ll a[n+10][n+10],b[n+10];
    for(int i = 0; i < m; i++)
    {
        cin>>b[i];
    }
    for(int i = 0; i < n; i++)
    {
        s = 0;
        for(int j = 0; j < m; j++)
        {
            cin>>a[i][j];
            s += (a[i][j]*b[j]);
        }
        s += c;
        if(s > 0)
        {
            t++;
        }
    }
    cout<<t<<endl;

}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
    int a,b,c;
    cin >> a >> b;
if(a <= 0 && 0 <= b){
    cout << "Zero" << endl;
    return 0;
}
else if(0 < a){
    cout << "Positive" << endl;
    return 0;
}
c = b - a + 1;
if(c % 2 == 0){
    cout << "Positive" << endl;
}
  else{
  cout << "Negative" << endl;}
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <stack>
#include <vector>
#include <set>
#include <algorithm>
#define INT long long
#define PP pair<double, pair<INT, pair<INT, INT> > >
using namespace std;

int n;
set<int> s;
int main()
{
    ios::sync_with_stdio(false);
    cin>>n;
    for(int i = 0, l ; i < n ; i++ )
    {
        cin>>l;
        if( s.find(l) == s.end() ) s.insert(l);
        else s.erase(s.find(l));
    }
    cout<<s.size()<<endl;
    
}

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

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

// I am questioning life and universe and 
// everything else after looking at this
const ll MAXN = 1e5 + 2;
ll N,M;
ll A[MAXN],B[MAXN];
pair<ll,ll> val[MAXN];

void solve(){
    cin>>N>>M;
    FOR(i,1,N){
        cin>>A[i]>>B[i];
        val[i].first = A[i];
        val[i].second = B[i];
    }

    sort(val+1,val+N+1);

    FOR(i,1,N) A[i] = val[i].first,B[i] = val[i].second;
    ll cost = 0;
    FOR(i,1,N){
        if(M >= B[i]){
            cost += A[i]*B[i];
            M -= B[i];
        }else {
            cost += A[i]*M;
            M -= M;
        }
    }
    cout<<cost<<endl;
}

signed main(){

    FastRead;

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

Measured memory_bytes: 3328
n,m = map(int,input().split())
e = []
for _ in range(m):
  a,b = map(int,input().split())
  e += [(a-1,b-1)]

def dfs(con, v, mat):
  if con[v] == 1:
    return
  con[v] = 1
  for x in mat[v]:
    dfs(con, x, mat)
  
def is_connected(n, mat):
  con = [0] * n
  dfs(con, 0, mat)
  return sum(con) == n
  
ans = 0
for i in range(m):
  mat = [[] for _ in range(n)]
  for j in range(m):
    if j == i:
      continue
    mat[e[j][0]] += [e[j][1]]
    mat[e[j][1]] += [e[j][0]]
  if not is_connected(n, mat):
    ans += 1

print(ans)

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

// isDebug?
#ifndef ONLINE_JUDGE
#define _DEBUG
#endif

// Function Macros:
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define all(v) (v).begin(), (v).end()
#define setpre(n) cout << fixed << setprecision(n)

// -* https://xn--kst.jp/blog/2019/08/29/cpp-comp/ *- Thx :)
// debug methods
// usage: debug(x,y);
#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0, a1, a2, a3, a4, x, ...) x
#define debug_1(x1) cout << #x1 << ": " << x1 << endl
#define debug_2(x1, x2) cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << endl
#define debug_3(x1, x2, x3) cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " << x3 << endl
#define debug_4(x1, x2, x3, x4) cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " << x3 << ", " #x4 << ": " << x4 << endl
#define debug_5(x1, x2, x3, x4, x5) cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " << x3 << ", " #x4 << ": " << x4 << ", " #x5 << ": " << x5 << endl
#ifdef _DEBUG
#define debug(...)                                                        \
    cout << __FILE__ << ": " << __LINE__ << ": " << __func__ << " -> ";   \
    CHOOSE((__VA_ARGS__, debug_5, debug_4, debug_3, debug_2, debug_1, ~)) \
    (__VA_ARGS__)
#else
#define debug(...)
#endif

// namespace / type / class / struct - alias, def:
using namespace std;

using ll = long long;
using ull = unsigned long long;

// Constants:
const int INF = (1ll << 30) - 1;  // approx 1.07e9
const ll INFLL = 1ll << 60;       // approx 1.15e18
const int MOD = 1e9 + 7;          // 998244353
const long double EPS = 1.0e-14;
const int FACN = 510000;

// Global Variables:
// ll fac[FACN], finv[FACN], inv[FACN];

// Prototype Declarations:
int gcd(int, int);
int lcm(int, int);
template <class T>
inline bool chmin(T&, T);
template <class T>
inline bool chmax(T&, T);

// ================ Main Loop ================
int main() {
    int n;
    cin >> n;
    string s;
    vector<int> c(4);
    rep(i, n) {
        cin >> s;
        if(s == "AC") {
            c[0]++;
        } else if(s == "WA") {
            c[1]++;
        } else if(s == "TLE") {
            c[2]++;
        } else {
            c[3]++;
        }
    }
    cout << "AC x " << c[0] << endl;
    cout << "WA x " << c[1] << endl;
    cout << "TLE x " << c[2] << endl;
    cout << "RE x " << c[3] << endl;
    return 0;
}
// ===========================================

// Functions:
// 最大公約数 O(log(min(a, b)))
int gcd(int a, int b) {
    return b ? gcd(b, a % b) : a;
}
// 最小公倍数 O(log(min(a, b)))
int lcm(int a, int b) {
    return a * b / gcd(a, b);
}

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;
}


Measured memory_bytes: 3628
#include <iostream>

using namespace std;

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

int n;
int data[3][200];
int score[200];

bool isUnique(int a[], int x) {
	REP(i,n) {
		if (i == x) continue;
		if (a[i] == a[x]) return false;
	}
	return true;
}


int main() {
	cin >> n;
	REP(i,n) cin >> data[0][i] >> data[1][i] >> data[2][i];

	REP(i,n) {
		REP(j,3) {
			if (isUnique(data[j], i))
				score[i] += data[j][i];
		}
	}

	REP(i,n) cout << score[i] << endl;

	return 0;
}

Measured memory_bytes: 1164