akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

#define M_PI       3.14159265358979323846   // pi

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> VI;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> t3;
typedef tuple<ll, ll, ll, ll> t4;

#define rep(a,n) for(ll a = 0;a < n;a++)
#define repi(a,b,n) for(ll a = b;a < n;a++)

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

const ll mod = 998244353;

const ll INF = 1e15;

template<typename T>
void cmpmax(T & reference, T value) {
	reference = max(reference, value);
}

template<typename T>
void cmpmin(T& reference, T value) {
	reference = min(reference, value);
}

struct LongestCommonSubsequence {
    static const int max_length = 5010;
    std::vector<std::vector<int>> dp;
    std::vector<std::vector<int>> pre;
    std::string s, t;

    LongestCommonSubsequence(std::string left, std::string right) {
        s = "+" + left;
        t = "*" + right;
        dp.assign(max_length, std::vector<int>(max_length, 0));
        pre.assign(max_length, std::vector<int>(max_length, 0));
    }

    void lcs() {

        for (int si = 1; si < s.size(); si++) {
            for (int ti = 1; ti < t.size(); ti++) {
                if (s[si] == t[ti]) {
                    dp[si][ti] = dp[si - 1][ti - 1] + 1;
                    pre[si][ti] = 1;
                }
                else if (dp[si - 1][ti] > dp[si][ti - 1]) {
                    dp[si][ti] = dp[si - 1][ti];
                    pre[si][ti] = 2;
                }
                else {
                    dp[si][ti] = dp[si][ti - 1];
                    pre[si][ti] = 3;
                }
            }
        }
    }

    std::string solve() {
        std::string ans = "";

        int si = s.size() - 1;
        int ti = t.size() - 1;
        while (si >= 1 && ti >= 1) {
            if (pre[si][ti] == 1) {
                ans += s[si];
                si--, ti--;
            }
            else if (pre[si][ti] == 2) {
                si--;
            }
            else {
                ti--;
            }
        }

        reverse(ans.begin(), ans.end());
        return ans;
    }
};

int main() {
    string s, t;
    cin >> s >> t;
    LongestCommonSubsequence seq(s, t);
    seq.lcs();
    auto common = seq.solve();
    cout << common << endl;
	return 0;
}

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

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
//#pragma GCC optimize ("-O3") 
#ifdef YANG33
#include "mydebug.hpp"
#else
#define DD(x) 
#endif
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };


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

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

	int ans = 0;

	FOR(try_times, 0, 30) { // 2^30 = (1024)^3  
		bool dividable_two = 1;
		FOR(i, 0, N) {
			if (a[i] % 2 == 0) { // 2で割れるなら割る
				a[i] /= 2;
			}
			else { // １つでも割れないものがあればだめ
				dividable_two = 0;
			}

		}
		if (dividable_two) {
			ans++;
		}
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <queue>
#include <tuple>
#include <set>
#include <map>

using namespace std;

struct UnionFind {
    vector< int > data;

    UnionFind(int sz) {
        data.assign(sz, -1);
    }

    bool unite(int x, int y) {
        x = find(x), y = find(y);
        if(x == y) return (false);
        if(data[x] > data[y]) swap(x, y);
        data[x] += data[y];
        data[y] = x;
        return (true);
    }

    int find(int k) {
        if(data[k] < 0) return (k);
        return (data[k] = find(data[k]));
    }

    int size(int k) {
        return (-data[find(k)]);
    }
};

int main(void) {
    int N, M;
    cin >> N >> M;
    UnionFind uf(N);
    while(M--) {
        int A, B;
        cin >> A >> B;
        --A; --B;
        uf.unite(A, B);
    }

    int ans = 0;
    for(int i=0; i<N; i++) {
        ans = max(ans, uf.size(i));
    }

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


Measured memory_bytes: 4048
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define debug(x) cerr << #x << " " << x << '\n'
using namespace std;
using ll = long long;
using pii = pair<int,int>;
using pli = pair<ll,int>;
const int INF = 0x3f3f3f3f, N = 405;
const ll LINF = 1e18 + 5;
int n, a[N];
ll sum[N], dp[N][N];
int main()
{
 	ios::sync_with_stdio(false);
 	cin.tie(0);
 	cin >> n;
 	for(int i=1; i<=n; i++) cin >> a[i];
 	for(int i=1; i<=n; i++) sum[i] = sum[i-1] + a[i];
 	memset(dp, 0x3f, sizeof(dp));
 	for(int i=1; i<=n; i++) dp[i][i] = 0;
 	for(int len=2; len<=n; len++)
 	{
 		for(int i=1; i+len-1<=n; i++)
 		{
 			int j = i + len - 1;
 			for(int k=i; k<j; k++)
 			{
 				dp[i][j] = min(dp[i][j], dp[i][k]+dp[k+1][j]+(sum[j]-sum[i-1]));
 			}
 		}
 	}
 	cout << dp[1][n];
	return 0;
}


Measured memory_bytes: 1536
#include <stdlib.h>
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
using ll=long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
inline constexpr ll gcd(ll a,ll b){if(!a||!b)return 0;while(b){ll c=b;b=a%b;a=c;}return a;}
inline constexpr ll lcm(ll a,ll b){if(!a||!b)return 0;return a*b/gcd(a,b);}

int main() {
  long long a,b;
  cin>>a>>b;
  vector<long long> vec(a);
  long long f=1000000007;
  rep(i,a){
    cin>>vec.at(i);
  }
  long long re,re2;
  long long count1=0;
  rep(i,a){
    for(int j=i+1;j<a;j++){
      if(vec.at(i)>vec.at(j)){
        count1++;
      }
    }
  }
  //cout<<count1<<endl;
  re=(count1*(b%f))%f;
  //cout<<re<<endl;
  long long count2=0;
  rep(i,a){
    for(int j=0;j<a;j++){
      if(vec.at(i)<vec.at(j)){
        count2++;
      }
    }
  }
  //cout<<count2<<endl;
  //cout<<b%f<<endl;
  long long sub=b*(b-1)/2LL;
  sub%=f;
  cout<<(count1*b+count2*sub)%f<<endl;

}

Measured memory_bytes: 256
## subroutines

def dist_rec(k)
  max_d = 1

  for k0 in $nbrs[k]
    if ! $visited[k0]
      $visited[k0] = true
      max_d = [1 + dist_rec(k0), max_d].max
      $visited[k0] = false
    end
  end

  max_d
end

### main

loop do
  m = gets.strip.to_i
  n = gets.strip.to_i
  mn = m * n
  break if mn == 0

  $brd = []
  n.times do
    $brd += gets.strip.split(' ').map{|s| s.to_i}
  end

  $nbrs = []
  id = 0

  for y in (0...n)
    for x in (0...m)
      $nbrs[id] = []
      if $brd[id] == 1
        $nbrs[id] << (id - 1) if x > 0 && $brd[id - 1] == 1
        $nbrs[id] << (id + 1) if x < m - 1 && $brd[id + 1] == 1
        $nbrs[id] << (id - m) if y > 0 && $brd[id - m] == 1
        $nbrs[id] << (id + m) if y < n - 1 && $brd[id + m] == 1
      end

      id += 1
    end
  end
  #p $nbrs

  $visited = (0...mn).map{false}

  max_dist = 0

  for st in (0...mn)
    if $brd[st] == 1
      $visited[st] = true
      max_dist = [dist_rec(st), max_dist].max
      $visited[st] = false
    end
  end

  puts max_dist
end

Measured memory_bytes: 8156
if __name__ == '__main__':
    N = int(input())
    S = input()

    numE = S.count('E')
    numW = S.count('W')

    #index iの要素はiより左側にいてかつ西を向いている
    #人の人数を表す
    sumW = [0]
    for i in range(N):
        if S[i] == 'W':
            sumW.append(sumW[i] + 1)
        else:
            sumW.append(sumW[i])

    sumE = []
    for i in range(N):
        sumE.append(numE-i+sumW[i])
        if S[i] == 'E':
            sumE[i] -= 1
    att = []
    for i in range(N):
        att.append(sumW[i] + sumE[i])

    print(min(att))

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

int main() {
  long long a, b, k;
  cin >> a >> b >> k;
  long long T = 0, A = 0;
  if (k<=a) {
    T = a-k; A = b;
  } else if (k<=a+b) {
    A = b-k+a;
  }
  cout << T << " " << A << endl;
}

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

int main(){
  int n;
  cin >> n;
  vector<int>p(n*3);
  for(int i=0,l=n*3;i<l;i++)
    cin >> p.at(i);
  sort(p.begin(),p.end(),greater());
  int64_t ans=0;
  for(int i=1;i<2*n;i+=2)
    ans+=p.at(i);
  cout << ans << endl;
  return 0;
}

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

int main(){
  int N;
  cin >> N;
  vector <int> a;
  bool flag_2 = true;
  for(int i = 0; i < N; i++){
    int n_a;
    cin >> n_a;
    a.push_back(n_a);
  }

  for(int c: a){
    if(c%2 != 0){
      cout << "0" << endl;
      flag_2 = false;
      break;
    }else{
      continue;
    }
  }

  int least = 0;

  if(flag_2){
    for(int i = 1;; i++){
      for(int c: a){
        int n_2 = pow(2, i);
        if(c%n_2 != 0){
          cout << i - 1 << endl;
          return 0;
        }else{
          continue;
        }
      }
    }
  }
}


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

int main(){
  int a,b,x;
  cin>>a;
  cin>>b;
  if(a>=13){
    x=b;
  }
  else if(a<=12&&a>=6){
    x=b/2;
  }
  else x=0;
  cout<<x<<endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
typedef pair<int,int> pii;
typedef vector<int> vi;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define per(i,a,b) for(int i=(b)-1;i>=a;i--)
#define sz(x) (int)(x).size()
#define all(x) (x).begin(),(x).end()
#define de(x) cout << #x << "=" << x << endl
#define dd(x) cout << #x << "=" << x << " "
#define pw(x) (1ll<<(x))
#define pq priority_queue
#define endl "\n"
int main()
{
    ios::sync_with_stdio(false);
    pair<ll,ll> a,b;
    ll t;
    cin >> a.fi >> a.se;
    cin >> b.fi >> b.se;
    cin >> t;
    if(a.fi<b.fi){
        if(a.fi+t*a.se>=b.fi+t*b.se)
    	cout <<"YES";
    else cout <<"NO";
	}
	else{
		if(a.fi-t*a.se<=b.fi-t*b.se)
			cout <<"YES";
	else cout <<"NO";
	}
    return 0;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
using ull = uint64_t;
const ll INF = 9e18;

void print() { cout << endl; }
template <typename Head, typename... Tail>
void print(Head head, Tail... tail) {
    int size = sizeof...(Tail);
    cout << head;
    if (size > 0) {
        cout << " ";
    }
    print(tail...);
}

void print0() {}
template <typename Head, typename... Tail>
void print0(Head head, Tail... tail) {
    cout << head;
    print0(tail...);
}

ll divceil(ll numer, ll denom) {
    if (numer % denom == 0) {
        return numer / denom;
    } else {
        return 1L + numer / denom;
    }
}

int main() {
    ll A, B, N;
    cin >> A >> B >> N;
    if (N >= B - 1) {
        print(A - divceil(A, B));
    } else {
        print((A * N / B) - A * (N / B));
    }
}


Measured memory_bytes: 3640
/*input
3
101 9901 999999000001
*/

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  int n;
  cin >> n;
  vector<ll> a(n);
  rep(i, n) cin >> a[i];
  rep(i, n) {
    if (a[i] == 0) {
      cout << 0 << endl;
      return 0;
    }
  }
  ll ans = 1;
  const ll M = 1e18;
  rep(i, n) {
    if (a[i] > M/ans) {
      cout << -1  << endl;
      return 0;
    }
    ans *= a[i];
  }
  cout << ans << endl;
}

Measured memory_bytes: 3988
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections
MOD = 10**9 + 7

a,b = map(int,input().split())
if a == 1 and b == 1:
    print("Draw")
elif a == 1:
    print("Alice")
elif b == 1:
    print("Bob")
elif a > b:
    print("Alice")
elif a == b:
    print("Draw")
else:
    print("Bob")

Measured memory_bytes: 3316
//  Created by ZJYelizaveta on 2017年09月23日 星期六 20时16分12秒
//  Copyright (c) 2017年 ZJYelizaveta. All rights reserved.

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

typedef long long ll;
typedef unsigned long long ull;
template<typename T> T readIn() {
	T x(0), f(1);
	char ch = getchar();
	while (ch < '0' || ch > '9') {if (ch == '-') f = -1; ch = getchar();}
	while (ch >= '0' && ch <= '9') {x = x * 10 + ch - '0'; ch = getchar();}
	return x * f;
}
const int MAX_N = 1000 + 3;
const int INF = 0x3f3f3f3f;
int n, m, k;

int main()
{
	n = readIn<int>(), m = readIn<int>(), k = readIn<int>();
	
	bool flag = false;
	int sum = n * m;
	for (int i = 0; i <= n; ++i) {
		for (int j = 0; j <= m; ++j) {
			int temp1 = i * m + j * n;
			int temp2 = i * j * 2;
			if (temp1 - temp2 == k) {flag = true; break;}
		}
	}
	if (flag) printf("Yes\n");
	else printf("No\n");
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <limits.h>
#include <math.h>
int acs(const void *a, const void *b){return *(int*)a - *(int*)b;} /* 1,2,3,4.. */
int des(const void *a, const void *b){return *(int*)b - *(int*)a;} /* 8,7,6,5.. */
int cmp_char(const void *a, const void *b){return *(char*)a - *(char*)b;} /* a,b,c,d.. */
int cmp_str(const void *a, const void *b){return strcmp(*(const char **)a, *(const char **)b);} /* aaa,aab.. */
#define min(a,b) (a < b ? a: b)
#define max(a,b) (a > b ? a: b)
#define rep(i, l, r) for (int i = l; i < r; i++)
#define MAX 100001
#define MOD 1000000007

typedef long long int lli;

int main(void) {
  int a, b, c;
  scanf("%d %d %d", &a, &b, &c);
  if (a + b + c >= 22) 
    printf("bust\n");
  else
    printf("win\n");
  return 0;
}


Measured memory_bytes: 128
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

public class Main {
    public static final int BIG_NUM = 2000000000;
    public static final int MOD     = 1000000007;
    
    public static void main(String[] args) {
        int N, tmp, maximum = -BIG_NUM, minimum = BIG_NUM;
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        
        try {
            N = Integer.parseInt(br.readLine());
            
            for(int loop = 0; loop < N; loop++) {
                tmp = Integer.parseInt(br.readLine());
                maximum = Math.max(maximum, tmp - minimum);
                minimum = Math.min(minimum, tmp);
            }
        }catch(NumberFormatException e) {
            e.printStackTrace();
        }catch(IOException e) {
            e.printStackTrace();
        }
        
        System.out.println(maximum);
    }
}


Measured memory_bytes: 42336
#include<bits/stdc++.h>
using namespace std;
int r[100000];
int main()
{
    int a,b,c,d,e,f;
    string ch;
    while(cin>>a>>b)
    {
        cin>>ch;
        d=0;
        for(c=0;c<ch.size();c++)
        {
            if(c>0)
            {
                if(ch[c]=='C'&&ch[c-1]=='A')
                {
                    d++;
                }
            }
            r[c+1]=d;
        }
        for(int i=1;i<=b;i++)
        {
            cin>>e>>f;
            cout<<r[f]-r[e]<<endl;
        }

    }



    return 0;
}


Measured memory_bytes: 1408
s =  list(input())
if ("C" in s and "F" in s):
    if(s.count("F") == 1):
        if(s.index("C") < s.index("F")):
            print("Yes")
        else:
            print("No")
    else:
        if(s.index("C") < s.index("F",1)):
            print("Yes")
        else:
            print("No")

else:
    print("No")

Measured memory_bytes: 9044
card = {}

for _ in range(int(input())):
    key = input()
    card[key] = card.get(key, 0) + 1

for _ in range(int(input())):
    key = input()
    card[key] = card.get(key, 0) - 1

sorted_card = sorted(card.items(), key=lambda x: x[1], reverse=True)

print(max(sorted_card[0][1], 0))

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
typedef long long ll;
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;
const int inf = 1001001001;
const int mod = 1000000007;
using pint=pair<ll,ll>;
 
// union by size + path having
class UnionFind {
public:
   vector <ll> par; // 各元の親を表す配列
   vector <ll> siz; // 素集合のサイズを表す配列(1 で初期化)
 
   // Constructor
   UnionFind(ll sz_): par(sz_), siz(sz_, 1LL) {
       for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
   }
   void init(ll sz_) {
       par.resize(sz_);
       siz.assign(sz_, 1LL);  // resize だとなぜか初期化されなかった
       for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
  }
 
   // Member Function
   // Find
   ll root(ll x) { // 根の検索
      while (par[x] != x) {
           x = par[x] = par[par[x]]; // x の親の親を x の親とする
       }
       return x;
  }
 
   // Union(Unite, Merge)
   bool unite(ll x, ll y) {
       x = root(x);
       y = root(y);
       if (x == y) return false;
       // merge technique（データ構造をマージするテク．小を大にくっつける)
       if (siz[x] < siz[y]) swap(x, y);
       siz[x] += siz[y];
       par[y] = x;
       return true;
  }
 
  bool same(ll x, ll y) { // 連結判定
       return root(x) == root(y);
  }
 
  ll size(ll x) { // 素集合のサイズ
      return siz[root(x)];
  }
};
 
ll modpow(ll x, ll n) {
   x = x%mod;
   if(n==0) return 1;  //再帰の終了条件
 
   else if(n%2==1) {
       return (x*modpow(x, n-1))%mod;  //nが奇数ならnを1ずらす
   }
   else return modpow((x*x)%mod, n/2)%mod;  //nが偶数ならnが半分になる
}
 
ll com(ll n, ll k) {
   ll x = 1;
   for(int i=n-k+1; i<=n; i++) {
      x = x*i%mod;
   }
 
   ll y = 1;
   for(int i=1; i<=k; i++) {
       y = y*i%mod;
   }
   y = modpow(y, mod-2);
 
   return x*y%mod;
}
 
int main(){

    ll n,m,c,ans=0;
    cin >> n >> m >> c;
    vector<ll> b(m);
    vector<vector<ll>> a(n,vector<ll>(m));
    rep(i,m){
        cin >> b.at(i);
    }
    rep(i,n){
        rep(j,m){
            cin >> a.at(i).at(j);
        }
    }

    rep(i,n){
        ll x=c;
        rep(j,m){
            x+=((a.at(i).at(j))*(b.at(j)));
        }
        if(x>0) ans++;
    }

    cout << ans << endl;

    
 
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>

using namespace std ;

void print2dvector(vector<vector<long long int> > v){
    for (int  i=0 ; i<v.size() ; i++){
        for(int j=0 ; j<v[0].size() ; j++)
            cout << v[i][j] << " " ;
        cout << "\n" ;
    }
}

int main(){
    int n ;
    cin >> n ;
    
    vector<int> a(n, 0) ;
    
    for (int i=0 ; i<n ; i++)
        cin >> a[i] ;
    
    vector<vector<long long int> > dp (n, vector<long long int> (n, 0)) ;
    
    for (int i=n-1 ; i>=0 ; i--){
        for (int j=i ; j<n ; j++){
            if (i == j)
                dp[i][j] = a[i] ;
            else
                dp[i][j] = max(a[i] - dp[i+1][j], a[j] - dp[i][j-1]) ;
        }
    }
    
//    print2dvector(dp) ;
    
    cout <<  dp[0][n-1] << "\n" ;
    
    return 0 ;
}


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

void solve() {
    int a[3];
    cin >> a[0] >> a[1] >> a[2];
    sort(a, a+3);
    int ans = 0;
    if((a[1] - a[0])%2) {
        a[2]++;
        a[0]++;
        ans++;
    }
    ans += (a[1] - a[0])/2;
    int x = a[2] - a[1];
    if(x % 2){
        ans++;
    }
    ans += (x/2)*2;
    cout << ans;
}

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


Measured memory_bytes: 3652
#include<iostream>
using namespace std;
int main(){
	string s;
	cin >> s;
	int ans=0;
	int tmp=0;
	for(char c:s){
		if(c=='A' || c=='C' || c=='G' || c=='T') tmp++;
		else{
			ans=max(tmp,ans);
			tmp=0;
		}
	}
	ans=max(tmp,ans);
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,count1=0,count2=0,count3=0,count4=0;
	string s;
	cin>>n;
	while(n--)
	{
		cin>>s;
		if(s=="AC")
			count1++;
		else if(s=="WA")
			count2++;
		else if(s=="TLE")
			count3++;
		if(s=="RE")
			count4++;

	}

	cout<<"AC x "<<count1<<endl;
	cout<<"WA x "<<count2<<endl;
	cout<<"TLE x "<<count3<<endl;
	cout<<"RE x "<<count4<<endl;
	return 0;
}

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

using namespace std;
using ll = long long;
using vl = vector<ll>;
using pll = pair<ll, ll>;

#define rep(i, n) for (ll i = 0, xxx_rep_end = (n); i < xxx_rep_end; ++i)
#define all(x) (x).begin(), (x).end()

template <class T1, class T2>
inline void chmax(T1 &a, const T2 &b)
{
    if (a < b)
    {
        a = b;
    }
}
template <class T1, class T2>
inline void chmin(T1 &a, const T2 &b)
{
    if (a > b)
    {
        a = b;
    }
}

constexpr ll INF = 0x3f3f3f3f3f3f3f3fLL;

inline bool C(ll num, ll K, const vl &A)
{
    ll sum = 0;
    for (auto a : A)
    {
        sum += (a - 1) / num;
        if (sum > K)
        {
            return false;
        }
    }
    return true;
}

int main()
{
    ll N, K;
    cin >> N >> K;
    vl A(N);
    rep(i, N) cin >> A[i];
    sort(all(A), greater<ll>());

    ll lb = 1;
    ll ub = A[0] + 1;
    while (ub - lb > 1)
    {
        ll mid = (lb + ub) / 2;
        if (C(mid, K, A))
        {
            ub = mid;
        }
        else
        {
            lb = mid;
        }
    }
    if (C(lb, K, A))
    {
        cout << lb << endl;
    }
    else
    {
        cout << ub << endl;
    }
}

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

public class Main {
    public static void main(String[] args) {
        PrintWriter out = new PrintWriter(System.out);
        Scanner sc = new Scanner(System.in);
        Task task = new Task();
        task.solve(sc, out);
        out.flush();
        sc.close();
    }

    static class Task {
        void solve(Scanner sc, PrintWriter out) {
            int K = nint(sc);
            int T = nint(sc);
            List<Integer> aList = getIntegerList(sc, T);
            Optional<Integer> maxNum = aList.stream().max(Comparator.naturalOrder());
            out.println(Math.max(0, maxNum.orElse(0) -1 - ( K - maxNum.orElse(-1))));


        }
    }

    static int nint(Scanner sc) {
        return Integer.parseInt(sc.next());
    }

    static long nlong(Scanner sc) {
        return Long.parseLong(sc.next());
    }

    static double ndouble(Scanner sc) {
        return Double.parseDouble(sc.next());
    }

    static float nfloat(Scanner sc) {
        return Float.parseFloat(sc.next());
    }

    static String nstr(Scanner sc) {
        return String.valueOf(sc.next());
    }

    static long[] longLine(Scanner sc, int size) {
        long[] lLine = new long[size];
        for (int i = 0; i < size; i++) {
            lLine[i] = nlong(sc);
        }
        return lLine;
    }

    static int[] intLine(Scanner sc, int size) {
        int[] iLine = new int[size];
        for (int i = 0; i < size; i++) {
            iLine[i] = nint(sc);
        }
        return iLine;
    }

    static String[] strLine(Scanner sc, int size) {
        String[] strLine = new String[size];
        for (int i = 0; i < size; i++) {
            strLine[i] = nstr(sc);
        }
        return strLine;
    }

    static long maxFromList(List<Long> longList) {
        return longList.stream().max(Comparator.naturalOrder()).get();
    }

    static long minFromList(List<Long> longList) {
        return longList.stream().min(Comparator.naturalOrder()).get();
    }

    public static int sumDigits(int n) {
        int sum = 0;
        while (n != 0) {
            sum += n % 10;
            n /= 10;
        }
        return sum;
    }

    public static long sumDigits(long n) {
        long sum = 0;
        while (n != 0) {
            sum += n % 10;
            n /= 10;
        }
        return sum;
    }

    static List<Integer> getIntegerList(Scanner sc, int size) {
        List<Integer> list = new ArrayList<>();
        for (int i = 0; i < size; i++) {
            list.add(nint(sc));
        }
        return list;
    }

    static List<Long> getLongList(Scanner sc, int size) {
        List<Long> list = new ArrayList<>();
        for (int i = 0; i < size; i++) {
            list.add(nlong(sc));
        }
        return list;
    }
}


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

int main(){
    int N; cin >> N; string S;  cin >> S;
    int k = S.size();
    rep(i, 0, k){
        S[i] = 'A' + (S[i] - 'A' + N) % 26;
    }
    cout << S << endl;

}

Measured memory_bytes: 256
using System;
 
namespace Aizu
{
    class OnlineJudge
    {
        public static void Main()
        {
            int[] input;
            while(((input = Array.ConvertAll(Console.ReadLine().Split(), int.Parse))[0] | input[1]) != 0) {
                for(int i = 0; i < input[0]; ++i){
                    Console.WriteLine(new String('#', input[1]));
                }
                Console.WriteLine();
            }
        }
    }
}

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

typedef long long ll;
typedef long double ld;

#define pb push_back
#define sort(s) sort(s.begin(),s.end())
#define reverse(s) reverse(s.begin(),s.end())
#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++)

const ll mod = 1e9+7;

//最大公約数
ll gcd(ll a, ll b) {
    return b ? gcd(b, a%b) : a;
}

//最小公倍数
ll lcm(ll a, ll b) {
    return a / gcd(a, b) * b;
}

//素数判定
bool isPrime(ll x){
    ll i;
    if(x < 2)return 0;
    else if(x == 2) return 1;
    if(x%2 == 0) return 0;
    for(i = 3; i*i <= x; i += 2) if(x%i == 0) return 0;
    return 1;
}

//桁和
int digsum(ll n) {
    int res = 0;
    while(n > 0) {
        res += n%10;
        n /= 10;
    }
    return res;
}

//桁数
int dignum(ll n) {
    int res = 0;
    while(n > 0) {
        res++;
        n /= 10;
    }
    return res;
}

//文字列中の特定の文字カウント
ll stringcount(string s,char c){
    return count(s.cbegin(),s.cend(),c);
}

//階乗
ll ka(ll i){
    ll res=1;
    while(i>0){
        res=res*i;
        i--;
    }
    return res;
}
 
//ncr
ll ncr(ll x,ll y){
    ll a = x;
    ll b = 1;
    if(y>(x/2)){
        y=x-y;
    }
    for(ll i=1;i<y;i++){
        a*=x-i;
        b*=i+1;
    }
    return a/b;
}

//フィボナッチ数列
ll f(ll x){
    ll dp[x+1];
    dp[1]=1;
    dp[2]=1;
    for(ll i=3;i<=x;i++){
        dp[i]=dp[i-1]+dp[i-2];
    }
    return dp[x];
}

//char->int
int ctoi(char c){
    return c-'0';
}



int main(){
    string s,t;
    cin >> s >> t;
    int n = s.size()-1;

    for(int i=0;i<s.size();i++){
        char c = s[n];
        s.pop_back();
        s = c + s;
        if(t==s){
            cout << "Yes" << endl;
            return 0;
        }
    }

    cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define f first
#define s second
#define pb push_back
#define ENDL '\n'
#define all(a) begin(a),end(a)
#define sz(a) (int)(a.size())
#define deb(a) cout << #a << ": " << a << ENDL;
#define fore(i, a, b) for(int i(a), ThkMk(b); i < ThkMk; ++i)
#define _ ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

using namespace std;

typedef long long lli;
typedef long double ld;
typedef pair<lli, lli> ii;
typedef vector<lli> vi;

vector<lli> v;
lli k;

bool ok(lli u) {
    lli cnt = 0;
    for(auto it : v) {
        if(it <= u) continue;
        cnt += (it % u == 0 ? (it / u) - 1LL : (it - it%u ) / u);
    }
    return cnt <= k;
}

int main()
{   _
    lli n; cin >> n >> k;
    v.resize(n); fore(i, 0, n) cin >> v[i];
    lli x = 1;
    for(lli i = 1e9; i > 0; i /= 2LL) while(!ok(x + i)) x += i;
    while(!ok(x)) ++x;
    cout << x << ENDL;
    return 0;
}


Measured memory_bytes: 4724
a,b,k = map(int,input().split())
ans=[]
for i in range(k):
    if a+i <=b:
        ans+=[a+i]
for i in range(k):
    if b-k+i+1 >=a and b-k+i+1 not in ans:
        ans+=[b-k+i+1]
for i in range(len(ans)):
    print(ans[i])






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

using namespace std;

#define FAST_IO ios_base::sync_with_stdio(0); cin.tie(nullptr)
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define REP(n) FOR(z, 1, (n))
#define pb push_back
#define INF 1000000000
#define f first
#define s second
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vii;

const int MAXN = 100100;
const int MOD = 1e9+7;
int n;
ld x[MAXN], y[MAXN]; char d[MAXN];

ld f(ld t) {
    ld maxX = -INF, minX = INF, maxY = -INF, minY = INF;
    FOR(i, 0, n-1) {
        if (d[i] == 'R') {
            maxX = max(maxX, x[i]+t);
            minX = min(minX, x[i]+t);
            maxY = max(maxY, y[i]);
            minY = min(minY, y[i]);
        } else if (d[i] == 'L') {
            maxX = max(maxX, x[i]-t);
            minX = min(minX, x[i]-t);
            maxY = max(maxY, y[i]);
            minY = min(minY, y[i]);
        } else if (d[i] == 'U') {
            maxX = max(maxX, x[i]);
            minX = min(minX, x[i]);
            maxY = max(maxY, y[i]+t);
            minY = min(minY, y[i]+t);
        } else {
            maxX = max(maxX, x[i]);
            minX = min(minX, x[i]);
            maxY = max(maxY, y[i]-t);
            minY = min(minY, y[i]-t);
        }
    }
    ld ret = (maxX-minX)*(maxY-minY);
    return ret;
}

ld ternary () {
    ld l = 0, r = 2*1e8;
    REP(200) {
        ld m1 = l+(r-l)/3, m2 = r-(r-l)/3;
        ld f1 = f(m1), f2 = f(m2);
        if (f1 < f2)
            r = m2;
        else l = m1;
    }
    return f(l);
}

int main()
{
    FAST_IO;

    cin >> n;
    FOR(i, 0, n-1) cin >> x[i] >> y[i] >> d[i];

    ld ans = ternary();
    ans = min(ans, f(0));
    cout << fixed << ans << endl;

    return 0;
}


Measured memory_bytes: 3456
package main

import "fmt"

func main(){
  var N,D,X int
  fmt.Scan(&N,&D,&X)
  result := X
  A := make([]int,N)
  for i:=0;i<N;i++{
    fmt.Scan(&A[i])
    if D%A[i]==0{
      result += D/A[i]
    }else{
      result += D/A[i]+1
    }
  }
  fmt.Println(result)
}


Measured memory_bytes: 512
// #pragma GCC target("avx2")  // CPU 処理並列化
// #pragma GCC optimize("O3")  // CPU 処理並列化
// #pragma GCC optimize("unroll-loops")  // 条件処理の呼び出しを減らす
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
#include<numeric>
using namespace std;
const long long mod=998244353;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-10;
const double INF=1e+10;
const double PI=acos(-1.0);
const int C_SIZE = 3121000;
long long fact[C_SIZE];
long long finv[C_SIZE];
long long inv[C_SIZE];
long long Comb(int a,int b){
 	if(a<b||b<0)return 0;
 	return fact[a]*finv[b]%mod*finv[a-b]%mod;
}
void init_C(int n){
	fact[0]=finv[0]=inv[1]=1;
	for(int i=2;i<n;i++){
		inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
	}
	for(int i=1;i<n;i++){
		fact[i]=fact[i-1]*i%mod;
		finv[i]=finv[i-1]*inv[i]%mod;
	}
}
long long pw(long long a,long long b){
	if(a<0LL)return 0;
	if(b<0LL)return 0;
	long long ret=1;
	while(b){
		if(b%2)ret=ret*a%mod;
		a=a*a%mod;
		b/=2;
	}
	return ret;
}
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
double ABS(double a){return max(a,-a);}
// ここから編集しろ
char S[110];
char T[110];
int main(){
	scanf("%s%s",S,T);
	int n=strlen(S);
	for(int i=0;i<n;i++){
		bool ok=true;
		for(int j=0;j<n;j++){
			if(S[j]!=T[(i+j)%n])ok=false;
		}
		if(ok){
			printf("Yes\n");return 0;
		}
	}
	printf("No\n");
}

Measured memory_bytes: 128
import queue

K = int(input())

q = queue.Queue()

for i in range(9):
  q.put(i+1)

for i in range(K-1):
  x = q.get()
  if x%10 != 0:
    q.put(x*10+x%10-1)
  q.put(x*10+x%10)
  if x%10 != 9:
    q.put(x*10+x%10+1)
    
print(q.get())

Measured memory_bytes: 12452
#include <bits/stdc++.h>
using namespace std;
using Int = long long int;
template<typename T> void swap(T *t1, T *t2){ T* tmp=t1; t1=t2; t2=tmp;}
Int tmpi = 0;
double tmpd = 0.0;


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

    Int x, a;
    cin >> x >> a;
    if(x<a){
        cout << "0" << endl;
        return 0;
    }
    if(x>=a){
        cout << "10" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define yorn(f) cout<<((f)?"Yes":"No")<<endl
#define YORN(f) cout<<((f)?"YES":"NO")<<endl
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    yorn(a <= c && c <= b);
    return 0;
}

Measured memory_bytes: 3588
#include<bits/stdc++.h>
using namespace std;
#define fast ios::sync_with_stdio(false);cin.tie(0)
#define pb push_back
#define digit(x) floor(log10(x))+1
#define mod 1000000007
#define endl "\n"
#define int long long
#define matrix vector<vector<int> >
#define vi vector<int>
#define pii pair<int,int>
#define vs vector<string>
#define vp vector<pair<int,int> >
#define test() int t;cin>>t;while(t--)
#define all(x) x.begin(),x.end()
#define debug(x) cerr << #x << " is " << x << endl;
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
//=================================================================//


#undef int
int main(){
#define int long long 
    fast;
    int n; int k;
    cin >> n >> k;
    vector<int> a(n+1), vis(n+1), b;
    for(int i = 1; i <= n; ++i) cin >> a[i];
    int pre, cir, nex = 1;
    for(int i = 1;;++i) {
        if(vis[nex]) {
            cir = i - vis[nex];
            pre = vis[nex];
            int sta = nex;
            do{
                b.push_back(sta);
                sta = a[sta];
            } while(sta != nex);
            
            break;
        } else {
            vis[nex] = i;
            nex = a[nex];
        }
    }
    int ans;
    if(k <= pre) {
        ans = 1;
        while(k--) {
            ans = a[ans];
        }
    } else {
        k -= pre;
        ans = b[(k+1+cir)%cir];
    }
    cout << ans;
    return 0;
}

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

int main() {
	
	int a,b;
	cin >> a >> b;
	int c = a + b;
	if(c%2 == 0)
	{
	    cout << c/2;
	    
	}
	else
	{
	    cout << "IMPOSSIBLE";
	}

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
const int INF = 1000000001;

ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

int main() {
  int h, w, n;
  cin >> h >> w >> n;
  vector<int> a(n);
  for(int i = 0; i < n; ++i){
    cin >> a[i];
  }

  vector<vector<int>> g(h, vector<int>(w, 0));
  int index = 0;
  for(int i = 0; i < n; ++i){
    int limit = index + a[i];
    for(; index < limit; ++index){
      g[index / w][index % w] = i + 1;
    }
  }
  
  for(int i = 0; i < h; ++i){
    if(i & 1){
      reverse(g[i].begin(), g[i].end());
    }
  }

  for(int i = 0; i < h; ++i){
    for(int j = 0; j < w; ++j){
      cout << g[i][j] << " ";
    }
    cout << endl;
  }

  return 0;
}


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

using namespace std;

const int N = 2000010;

long long tr[N], n, m;

int lowbit(int x) {
    return x & -x;
}

long long sum(int x) {
    long long sum = 0;
    for (int i = x; i; i -= lowbit(i)) sum += tr[i];
    return sum;
}

void modify(int x, int k) {
    for (int i = x; i <= n; i += lowbit(i)) tr[i] += k;
}

int main() {
    cin >> n >> m;
    for (int i = 1; i <= n; ++i) {
        int x;
        cin >> x;
        modify(i, x);
    }
    for (int i = 1; i <= m; ++i) {
        int t, a, b;
        cin >> t >> a >> b;
        if (t == 0) {
            modify(a + 1, b);
        } else {
            cout << sum(b) - sum(a) << '\n';
        }
    }
    return 0;
}

Measured memory_bytes: 8232
#include <algorithm>
#include <climits>
#include <iostream>
#include <string>
#include <utility>
#include<vector>
#include<iomanip>
#include<map>
#include <queue>
#include<cmath>

using namespace std;

using ll = long long int; 

void prime(vector<int> &num, int n){
    for(int i=0;i<=n;i++){
        num[i] = 1;
    }
    num[0] = 0;
    num[1] = 0;
    num[2] = 1;

    for(int i=2;i<=sqrt(n);i++){
        if(num[i] == 1){
            for(int j=2;j<=n/i;j++){
                num[i*j] = 0;
            }
        }
    }
}


ll gcd(ll a, ll b) {
  ll tmp;
  if ( b > a) {
    tmp = a;
    a = b;
    b = tmp;
  }
  while (a % b !=0) {
    tmp = b;
    b = a % b;
    a = tmp;
  }
  return b;
}
 
ll lcm(ll a, ll b) {
  return a * b / gcd(a, b);
}

int main(void){

    ll a,b;
    cin>>a>>b;

    //cout<<

    // vector<ll> a_c;
    // vector<ll> b_c;

    ll g = gcd(a,b);
    //cout<<g<<endl;

    vector<ll> common;

    for(ll i=1;i<sqrt(g);i++){
        if(g%i==0){
            common.push_back(i);
            common.push_back(g/i);
        } 
    }

    sort(common.begin(), common.end());
    
    int i=0, j=0;
    // while(1){
    //     if(a_c[i] == b_c[j]){
    //         //cout<<a_c[i]<<endl;
    //         common.push_back(a_c[i]);
    //         i++;
    //         j++;
    //     }else if(a_c[i] > b_c[j]){
    //         j++;
    //     }else{
    //         i++;
    //     }

    //     if(i==a_c.size() && j==b_c.size()) break;
    // }

    // for(i=0;i<common.size();i++){
    //     cout<<common[i]<<" ";
    // }
    // cout<<endl;

    vector<ll> ans;
    ans.push_back(1);

    for(i=1;i<common.size();i++){
        //cout<<i<<endl;
        if(common[i]!=0) ans.push_back(common[i]);
        for(j=i+1;j<common.size();j++){
            //cout<<j<<endl;
            if(common[i]==0) break;
            if(common[j]%common[i]==0) common[j]=0;
            //cout<<common[j]<<" "<<common[i]<<endl;
        }
    }


    cout<<ans.size()<<endl;
    return 0;

}

Measured memory_bytes: 384
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;
const int INF = 1e9;

int main() {
  string s;
  cin >> s;
  if (s == "ABC") {
    cout << "ARC";
  } else {
    cout << "ABC";
  }
  cout << endl;
}


Measured memory_bytes: 3632
def tairyoku(list_x, p):
    sum_t = 0
    for xx in list_x:
        sum_t += (xx - p)**2
    return sum_t

n = int(input())
x = list(map(int, input().split()))
ave = sum(x) / n

print(min(tairyoku(x, int(ave)), tairyoku(x, int(ave)+1)))

Measured memory_bytes: 3060
N = int(input())
s = []
for i in range(N):
    s.append(input())
M = int(input())
t = []
for j in range(M):
    t.append(input())

ans = 0
u = set(s + t)
for k in u:
    cnt1 = 0
    for l in s:
        if l == k:
            cnt1 += 1
    cnt2 = 0
    for m in t:
        if m == k:
            cnt2 -= 1
    if cnt1 + cnt2 >= ans:
        ans = cnt1 + cnt2

print(ans)

Measured memory_bytes: 3064
import java.util.*;

public class Main {
    public static void main(String[] args) {
        int n;
        int a[] = new int[100];
        Scanner num = new Scanner(System.in);
        
        n = num.nextInt();
        for(int i = 0; i < n; i++) {
            a[i] = num.nextInt();
        }

        for(int i = n - 1; i >= 0; i--) {
            System.out.print(a[i]);
            if(i == 0) {
                System.out.print("\n");
            } else {
                System.out.print(" ");
            }
        }
        
    }
}


Measured memory_bytes: 26372
#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>

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;
    else 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,k;
    cin >> n >> k;
    int ans = 0;
    while(n>0){
        ans++;
        n/=k;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MAX (ll)(2e5 + 7)
#define INF (ll)(1e17)
#define MOD (int)(1e9 + 7)
#define PI (double)(3.14159265)
#define IO ios_base :: sync_with_stdio (false);
#define LOG 25

using namespace std;
using ll = long long;
using ul = unsigned long long;

ul ssq (ul x) {
 ul l = 1, h = x;
 ul ans = 1;
 while (l <= h) {
  ul m = (l + h) >> 1;
  if (m  < (x / m) + (x % m > 0) || x / m == m) {
   ans = m;
   l = m + 1;
  }
  else {
   h = m - 1;
  }
 }
 return ans;
}
   
int main () {
 ul a, b, c;
 cin >> a >> b >> c;
 if (a + b >= c) {
  cout << "No\n";
  return 0;
 }
 if (c - a - b > ssq (a * b * 4)) {
  cout << "Yes\n";
 }
 else {
  cout << "No\n";
 }
}


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

using namespace std;

int main()
{
    int N, K;
    cin >> N >> K;

    int total = 0;
    for (int i = 0; i < N; ++i)
    {
        int h;
        cin >> h;
        if (h >= K)
        {
            ++total;
        }
    }

    cout << total;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;
template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  ll n, k; cin >> n >> k;
  vector<ll> a(n), f(n);
  for(int i=0;i<n;++i) {
    cin >> a[i];
  }
  for(int i=0;i<n;++i) {
    cin >> f[i];
  }
  sort(a.begin(), a.end());
  sort(f.begin(), f.end());
  reverse(f.begin(), f.end());
  vector<pair<ll, ll>> v(n);
  ll ma = 0;
  for(int i=0;i<n;++i) {
    v[i].first = a[i] * f[i];
    v[i].second = f[i];
    ma = max(ma, v[i].first);
  }
  ll l = -1, r = ma;
  while(r - l > 1) {
    ll mid = (l + r) / 2;
    ll su = 0;
    for(int i=0;i<n;++i) {
      if(v[i].first > mid) {
        su += (v[i].first - mid - 1) / v[i].second + 1;
      }
    }
    if(su <= k) {
      r = mid;
    } else {
      l = mid;
    }
  }
  cout << r << endl;
}


Measured memory_bytes: 6528
package main

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

var sc = bufio.NewScanner(os.Stdin)

func Scanner() string {
	sc.Scan()
	return sc.Text()
}

func intScanner() int {
	n, _ := strconv.Atoi(Scanner())
	return n
}

func floatScanner() float64 {
	n, _ := strconv.ParseFloat(Scanner(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}

var mod int

func main() {
	mod = 1000000007
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	n := intScanner() % 10
	if n == 2 || n == 4 || n == 5 || n == 7 || n == 9 {
		fmt.Println("hon")
	} else if n == 1 || n == 0 || n == 6 || n == 8 {
		fmt.Println("pon")
	} else {
		fmt.Println("bon")
	}
}


Measured memory_bytes: 1756
#include <bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define ff           first
#define ss           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define hell        1000000007
#define rep(i,a,b)  for(int i=a;i<b;i++)
using namespace std;

// Most important thing in CP - Have Fun :)

void solve(){
	//write here
    int n;
    cin>>n;
    vi arr(n);
    rep(i,0,n)cin>>arr[i];
    vi dp(n,INT_MAX);
    dp[0] = 0;
    dp[1] = abs(arr[1] - arr[0]);
    for (int i = 2 ; i<n ; i++){
        dp[i] = min(dp[i-1] + abs(arr[i] - arr[i-1]),dp[i-2] + abs(arr[i-2] - arr[i]));
    }
    cout<<dp[n-1]<<endl;
	return;
}

int main(){
	cin.tie(NULL);
	ios::sync_with_stdio(false);
	//insert code
	
		solve();
	return 0;
}

Measured memory_bytes: 3948
#include <bits/stdc++.h>
#define int long long
#define ll long long 
#define rep(i,a,b) for(signed i=a;i<(b);++i)
#define erep(i,a,b) for(signed i=a;i<=(b);++i)
#define per(i,a,b) for(signed i=(a);i>(b);--i)
#define eper(i,a,b) for(signed i=(a);i>=b;--i)
#define fore(i, x, a) for(auto &&x:a) 
#define ITR(i,b,e) for(auto i=(b);i!=(e);++i)
#define endl "\n";
#define pb push_back
#define mp make_pair
#define ALL(x) begin(x),end(x)
#define F first
#define S second
#define debug(x)  cout << #x << ": " << (x) << '\n';
const long long INF=1001001001001001001;
const int MOD=(int)1e9 + 7;
const double EPS=1e-9;
using namespace std;
using Pii = pair<int,int>;
using vii = vector<int>;
template<class T>using  PS_queue = priority_queue<T, vector<T>, greater<T> >;
template<class T>using vv = vector<T>;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val){fill( (T*)array, (T*)(array+N), val );}
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) {
    ITR(i,begin(v),end(v))os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> ostream& operator<<(ostream &os,const vector<vector<T> > &v) {
    ITR(u,begin(v),end(v))ITR(w,begin(*u),end(*u))os<<*w<<(w==end(*u)-1?"\n":" ");return os;}
template<class T> istream& operator>>(istream &is,vector<T> &v) {
    ITR(i,begin(v),end(v)) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
    is>>p.first>>p.second;return is;}
template<class T>T gcd(T a, T b){ return b ? gcd(b, a % b) : a; }
template<class T>T lcm(T a, T b){ return a / gcd(a, b) * b; }
struct edge { int from, to, cost; };
int dy[]={0, 1, -1, 0}; int dx[]={1, 0, 0, -1};
// cout << fixed << setprecision(10) << val;

int N, Q;
vii graph[200005];
signed main() {
 cin.tie(0);
 ios::sync_with_stdio(false);
  cin >> N >> Q;
  rep(i, 0, N-1) {
    int a, b;
    cin >> a >> b;
    graph[a].push_back(b);
    graph[b].push_back(a);
  }
  vii costs(N+1, 0);
  rep(i, 0, Q) {
    int p, x;
    cin >> p >> x;
    costs[p] += x;
  }

  stack<pair<int, int>> s;
  s.push(mp(1, 0));
  while (s.size()) {
    int p, parent;
    tie(p, parent) = s.top(); s.pop();
    costs[p] += costs[parent];
    for (auto nx : graph[p]) {
      if (nx == parent) continue;
      s.push(mp(nx, p));
    }
  }
  erep(i, 1, N) {
    cout << costs[i] << (i == N ? '\n' : ' ');
  }
  return 0;
}




Measured memory_bytes: 19568
#include <iostream>
#include <bitset>
#define M 16000
using namespace std;
string s;
int x, y, z, c;
bitset<M*2> bs[2];
int main() {
	cin>>s>>x>>y;
	s += "T";
	c = s.find("T");
	s = string(s.begin()+c, s.end());
	x -= c;
	bs[0][M] = bs[1][M] = 1;
	for(int i=c=0; s[i]; i++) {
		if(s[i]=='F') c++;
		else {
			bs[z] = (bs[z]<<c) | (bs[z]>>c);
			z = !z;
			c = 0;
		}
	}
	cout<<(bs[0][x+M] & bs[1][y+M] ? "Yes":"No");
	return 0;
}

Measured memory_bytes: 256