akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double lf;
typedef pair<int,int> ii;
typedef pair<ii,int> iii;
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define RREP(i,n) for (int i=n-1;i>=0;i--)
#define RST(i,n) memset(i,n,sizeof i)
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(),a.end()
#define X first
#define Y second
#define mkp make_pair
#define pb push_back
#define eb emplace_back
#define pob pop_back
#ifdef cold66
#define debug(...) do{\
    fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<", ";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.X<<","<<_p.Y<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
    _s<<"{";
    for(It _it=_ita;_it!=_itb;_it++)
    {
        _s<<(_it==_ita?"":",")<<*_it;
    }
    _s<<"}";
    return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
#else
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#endif // cold66
//}
template<class T> inline bool chkmax(T &a, const T &b) { return b > a ? a = b, true : false; }
template<class T> inline bool chkmin(T &a, const T &b) { return b < a ? a = b, true : false; }
template<class T> using MaxHeap = priority_queue<T>;
template<class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;

const ll MAXn=1e5+5,MAXlg=__lg(MAXn)+2;
const ll MOD=1000000007;
const ll INF=0x3f3f3f3f;

vector<int> e[MAXn];
vector<ii> edg;
int vis[MAXn];
int sz[MAXn],d[MAXn],nei[MAXn];
int idx;
void dfs(int x){
    debug(x);
    vis[x] = idx;
    sz[idx]++;
    for (auto i:e[x]) {
        if (!vis[i]) dfs(i);
    }
}
int main(){
    IOS();
    int n,m,k;
    cin >> n >> m >> k;
    REP (i,m) {
        int u,v;
        cin >> u >> v;
        u--, v--;
        e[u].eb(v);
        e[v].eb(u);
        nei[u]++, nei[v]++;
    }
    REP (i,k) {
        int u,v;
        cin >> u >> v;
        u--, v--;
        edg.eb(u,v);
    }
    REP (i,n) {
        if (!vis[i]) {
            idx++;
            dfs(i);
        }
    }
    REP (i,SZ(edg)) {
        if (vis[edg[i].X] == vis[edg[i].Y]) {
            d[edg[i].X]++, d[edg[i].Y]++;
        }
    }
    pary(sz+1,sz+idx+1);
    pary(nei,nei+n);
    pary(d,d+n);
    pary(vis,vis+n);
    REP (i,n) {
        cout << sz[vis[i]] - nei[i] - 1 - d[i] << " \n"[i==n-1];
    }
}


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

using namespace std;
typedef long long LL;
typedef pair<int,int> pii;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second

#ifdef OJ
#define debug(x)  do{cerr<<#x<<": "<<x<<"\n";}while(0)
#define debugv(x) do{cerr<<#x<<": ";for(auto&e: (x))cerr<<e<<" ";cerr<<"\n";}while(0)
#else
#define debug(x)
#define debugv(x)
#endif

#define all(x) (x).begin(), (x).end()
#define rsort(x) sort((x).rbegin(), (x).rend())
#define sz(x) ((int)x.size())
#define fori(i, n) for (int i = 0; i < (int)(n); ++i)
#define ford(i, n, e) for (int i = (int)(n); i >= (int)(e); --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
template<typename T> bool mmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T> bool mmin(T &m, const T q) { if (m > q) {m = q; return true;} else return false; }
#define RETURN(x) do{cout << (x) << '\n'; return ;}while(0)

const int MOD = 1e9+7;
const int MAXN = 2e6+3;
const int INF = 1e9;

void solve() {
    int n; cin >> n;
    vector<int> a(n);
    fori(i,n) cin >> a[i];
    rsort(a);
    LL ans = 0;
    int b = 1;
    int c = 0;
    fore(i,1,n-1) {
        if(b == 0) c++;
        ans += a[c];
        b = 1-b;
    }
    cout << ans << '\n';
} 

int main(int argc, char **argv) {
#ifdef OJ
    freopen("input.txt", "rt", stdin);
    //freopen("output.txt", "wt", stdout);
#endif
    ios::sync_with_stdio(false);
    cin.tie(0);

    int ntest = 1;
    //cin >> ntest;
    fori(test, ntest) {
        solve();
    }

    return 0;
}


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

int main(){
    char a[100];
    int n,i,j,c=0;

    scanf("%s", a);
    n = strlen(a);
    for (i = 0; i < n / 2;i++){
        if(a[i]!=a[n-1-i])
            c++;
    }
    printf("%d\n", c);

    return 0;
}

Measured memory_bytes: 128
package main

import "fmt"

func main() {
	var n, m int
	fmt.Scan(&n, &m)

	d := map[int]int{}

	for range make([]struct{}, n) {
		var k int
		fmt.Scan(&k)
		for range make([]struct{}, k) {
			var a int
			fmt.Scan(&a)
			d[a]++
		}
	}

	var a int
	for _, v := range d {
		if v == n {
			a++
		}
	}
	fmt.Println(a)
}


Measured memory_bytes: 640
#include <iostream>

using namespace std;

int main(){
  int N, i, j, k, count=0;
  cin >> N;
  int h[N+2];
  for(int i=1; i<=N; i++) cin >> h[i];
  h[N+1] = 100;
  i=j=k=1;
  while(1){
    k=1;
    while(h[k] == 0) k++;
    if(k == N+1){
      cout << count << "\n";
      break;
    }
    j = k;
    while(j != N+1 && h[j] != 0){
      j++;
    }
    for(i=k; i<j; i++) h[i]--;
    count++;
  }
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<pii>
#define vll vector<pll>
#define all(v) v.begin(),v.end()
#define mem(v,x) memset(v,x,sizeof(v))
#define N 100005

using namespace std;

int main(){
    ios_base::sync_with_stdio(0);
	cin.tie(NULL);
    ll n;
    cin>>n;
    ll val = 100;
    int ans = 0;
    while(val<n){
        val = val + val/100;
        ans++;
    }
    cout<<ans;
}


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

int main(){
  char str[10];
  int i,count,strnum;
  count=0;
  scanf("%s",&str);
  
  strnum=strlen(str);
  
  for(i=0;i<strnum;i++){
    if(str[i]=='h'){
      if(str[i+1]=='i'){
        count++;
        count++;
      }
    }
  }
  
  if(count==strnum){
  printf("Yes");
  return 0;
  }

  printf("No");
  return 0;

}

Measured memory_bytes: 128
import sys, re
from math import ceil, floor, sqrt, pi, factorial, gcd
from copy import deepcopy
from collections import Counter, deque
from heapq import heapify, heappop, heappush
from itertools import accumulate, product, combinations, combinations_with_replacement
from bisect import bisect, bisect_left, bisect_right
from functools import reduce
from decimal import Decimal, getcontext
# input = sys.stdin.readline 
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_list(N): return [s_list() for _ in range(N)]
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 6)
INF = float('inf')
MOD = 10 ** 9 + 7
num_list = []
str_list = []

def main():
    n = i_input()

    n += 4

    print(n//11*2 + (n%11>4))
 
if __name__ == '__main__':
    main()


Measured memory_bytes: 77100
#include<bits/stdc++.h>
using namespace std;
#define ll  long long 
#define INF 999999999
#define rep(i,n) for(int i=0;i<n;i++)
const ll MOD = 1000000007;
ll cnt =0,ans=0;
const int MAX = 510000;

int main(){
    int n,k;
    map<int,int>mp;
    cin >> n >> k;
    int d[110],a[110][110];
    for(int i=1;i<=k;i++){
        cin >> d[i];
        for(int j=1;j<=d[i];j++){
            cin >> a[i][d[i]];
            mp[ a[i][d[i]] ]++;
        }
    }

    for(int i=1;i<=n;i++){
       // cout << "i= " << i << " mp[i] = " << mp[i] << endl;
        if(mp[i] == 0)cnt++;
    }
    cout << cnt << endl;


}
       


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

using namespace std;

//FILE *fi=freopen("1.txt","r",stdin);

int n,a[200001];
bool f[200001];
long long k;

void nhap()
{
    scanf("%d %lld",&n,&k);
    for (int i=1;i<=n;++i)
    {
        scanf("%d",&a[i]);
    }
}

void process()
{
    vector<int> v;
    int vt=1;
    while (!f[vt])
    {
        v.push_back(vt);
        f[vt]=1;
        vt=a[vt];
    }
    if (k<v.size())
    {
        cout<<v[k];
        return;
    }
    while (v.front()!=vt)
    {
        v.erase(v.begin());
        k--;
    }
    k%=(v.size());
    cout<<v[k];
}

int main()
{
    nhap();
    process();
    return 0;
}


Measured memory_bytes: 5280
#include <bits/stdc++.h>
using namespace std;
#define rep(i,ini,n) for(int i=ini;i<n;i++)
#define _rep(i,ini,n) for(int i=ini;i>=n;i--)
#define ToEnd(a) a.begin(),a.end()
uint64_t MOD=1000000007;

int main(){
    int N,M; cin>>N>>M;
    vector<int> A;  //穴の位置
    A.push_back(-1);
    rep(m,0,M){
        int a; cin>>a;
        A.push_back(a);
    }
    A.push_back(N+1);

    vector<int64_t> Fibo(N+1,1);    //n歩進み組み合わせ
    rep(i,2,N+1) Fibo.at(i)=(Fibo.at(i-1)+Fibo.at(i-2))%MOD;

    int64_t ans=1;
    rep(i,1,A.size()){
        int d=(A.at(i)-1)-(A.at(i-1)+1);
        if(d<0){ans=0; break;}

        ans*=Fibo.at(d);
        ans%=MOD;
    }

    cout<<ans<<endl;
}

Measured memory_bytes: 1528
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <complex>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <iomanip>
#include <assert.h>
#include <array>
#include <cstdio>
#include <cstring>
#include <random>
#include <functional>
#include <numeric>
#include <bitset>
#include <fstream>

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define watch(a) { cout << #a << " = " << a << endl; }
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }

typedef long long ll;
int const inf = 1<<29;
double const EPS = 1e-7;

typedef complex<double> P;

double dot(P a, P b) { return real(conj(a)*b); }
double cross(P a, P b) { return imag(conj(a)*b); }

int ccw(P p0, P p1, P p2) {
  auto a = p1 - p0;
  auto b = p2 - p0;
  if(cross(a, b) > EPS) return +1;
  if(cross(a, b) < -EPS) return -1;
  if(dot(a, b) < -EPS) return +2;
  if(norm(a) < norm(b)) return -2;
  return 0;
}

double area(vector<P> &g) {
  double ret = 0;
  rep(i, g.size()) {
    ret += cross(g[i], g[(i+1)%g.size()]);
  }
  return abs(ret) / 2.0;
}

struct Line: public vector<P> {
  Line(P a, P b) {
    push_back(a), push_back(b);
  }
};

Line perpendicular_bisector(P& a, P& b) {
  P c = (a + b) / 2.0;
  P p = P(c.real() + (a.imag() - b.imag()), c.imag() - (a.real() - b.real()));
  return Line(c, p);
}

P crosspointLL(Line const& a, Line const& b) {
  P va = a[1] - a[0], vb = b[1] - b[0];
  double d = cross(vb, va);
  if(abs(d) < EPS) return b[0];
  return a[0] + va * cross(vb, b[1] - a[0]) * (1.0 / d);
}

vector<P> convex_cut(vector<P>& g, Line const& l) {
  vector<P> ret;
  rep(i, g.size()) {
    if(ccw(l[0], l[1], g[i]) != -1) ret.push_back(g[i]);
    if(ccw(l[0], l[1], g[i]) * ccw(l[0], l[1], g[(i+1)%g.size()]) < 0) {
      ret.push_back(crosspointLL(Line(g[i], g[(i+1)%g.size()]), l));
    }
  }
  return ret;
}

vector<P> ps;

bool input() {
  ps.clear();
  rep(i, 3) {
    int x, y;
    cin >> x >> y;
    if (x == 0)
      return 0;
    ps.push_back(P(x, y));
  }
  return 1;
}

int main() {

  int tc = 1;
  while(input()) {
    vector<P> U = {P(0,0), P(10000,0), P(10000,10000), P(0,10000)};
    REP(i, 1, ps.size()) {
      U = convex_cut(U, perpendicular_bisector(ps[0], ps[i]));
    }
    printf("%d %.10f\n", tc++, area(U) / 100000000.0);
  }

  return 0;
}

Measured memory_bytes: 3296
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>

using namespace std;

typedef long long ll;
// constexpr ll MOD = 998244353;
constexpr ll MOD = 1000000007;

// struct UnionFind {
//     vector<int> par;
    
//     UnionFind(int N): par(N) {
//         for (int i=0;i<N;i++) par[i] = i;
//     }

//     int root(int x) {
//         if (par[x] == x) return x;
//         else return par[x] = root(par[x]);
//     }

//     void unite(int x, int y) {
//         int rx = root(x);
//         int ry = root(y);
//         if (rx == ry) return;
//         par[rx] = ry;
//     }

//     bool same(int x, int y) {
//         int rx = root(x);
//         int ry = root(y);
//         return rx == ry;
//     }
// };

int main(void) {
    int N;
    vector<int> X(1010), Y(1010);
    cin >> N;
    for (int i=0;i<N;i++) cin >> X[i] >> Y[i];

    double res1 = 3000.0;
    double res2 = 3000.0;

    if (N == 2) {
        res1 = sqrt((X[0]-X[1])*(X[0]-X[1])+(Y[0]-Y[1])*(Y[0]-Y[1]))/2.0;
        res2 = res1 + 1.0;
    } else {
        for (int i=0;i<N;i++) for (int j=i+1;j<N;j++) for (int k=j+1;k<N;k++) {
            double ax = X[j]-X[i], ay = Y[j]-Y[i], bx = X[k]-X[i], by = Y[k]-Y[i], cx = X[k]-X[j], cy = Y[k]-Y[j];
            // printf("(%f, %f), (%f, %f), (%f, %f)\n", ax, ay, bx, by, cx, cy);
            double S = sqrt((ax*ax+ay*ay)*(bx*bx+by*by)-(ax*bx+ay*by)*(ax*bx+ay*by))/2.0;
            // printf("%f\n", S);
            if (abs(S)<1e-6) continue;
            double R = sqrt(ax*ax+ay*ay)*sqrt(bx*bx+by*by)*sqrt(cx*cx+cy*cy)/(4.0*S);
            // printf("%f\n", R);
            double a2 = ax*ax+ay*ay, b2 = bx*bx+by*by, ab = ax*bx+ay*by;
            // printf("%f, %f, %f\n", a2, b2, ab);
            double u = (a2*b2-b2*ab)/(2.0*(a2*b2-ab*ab));
            // printf("%f\n", u);
            double v = (a2*b2-a2*ab)/(2.0*(a2*b2-ab*ab));
            // printf("%f\n", v);
            double p = X[i]+u*ax+v*bx, q = Y[i]+u*ay+v*by;

            // printf("(%2d,%2d), (%2d,%2d), (%2d,%2d): (%9.5f,%9.5f), %9.5f\n", X[i], Y[i], X[j], Y[j], X[k], Y[k], p, q, R);

            bool flag = true;
            for (int l=0;l<N;l++) {
                if (l == i || l == j || l == k) continue;
                if ((X[l]-p)*(X[l]-p) + (Y[l]-q)*(Y[l]-q) > R*R) flag = false;
            }
            if (flag) res1 = min(res1,R);
        }
        for (int i=0;i<N;i++) for (int j=i+1;j<N;j++) {
            double R = sqrt((X[i]-X[j])*(X[i]-X[j])+(Y[i]-Y[j])*(Y[i]-Y[j]))/2.0;
            double p = (X[i]+X[j])/2.0, q = (Y[i]+Y[j])/2.0;
            bool flag = true;
            for (int l=0;l<N;l++) {
                if (l == i || l == j) continue;
                if ((X[l]-p)*(X[l]-p) + (Y[l]-q)*(Y[l]-q) > R*R) flag = false;
            }
            if (flag) res2 = min(res2,sqrt((X[i]-X[j])*(X[i]-X[j])+(Y[i]-Y[j])*(Y[i]-Y[j]))/2.0);
        }
    }

    cout << fixed << setprecision(10) << min(res1,res2) << endl;

    return 0;
}


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

void swap(int *A, int i, int j){
    
    int temp = A[i];
    A[i] = A[j];
    A[j] = temp;
}

int Partition(int *A, int p, int r){
    
    int x = A[r];
    int i = p-1;
    for(int j = p; j < r; j++){
        if (A[j] <= x){
        i+=1;
        swap(A, i , j);
        }
    }
 swap(A, i+1, r);
 return i + 1;
 }

/*
 * 
 */
int main(int argc, char** argv) {

    int p = 0, n, track; 
    scanf("%d",&n);
    int *A = (int*)malloc(n * sizeof(int));
    for(int a = 0; a < n; a++){
            scanf("%d",&A[a]);
    }
    track = Partition(A,0,n-1);
    
    for(int a = 0; a < n; a++){
        
            if(a == track)printf("[");
            printf("%d",A[a]);
            if(a == track)printf("]");
            if(a < n - 1)printf(" ");
            
    }
    printf("\n");
    return (0);
}


Measured memory_bytes: 2140
import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    String s=sc.next();
    String t=sc.next();
    int[][] a=new int[26][s.length()*2+1];
    for(int i=0;i<s.length();i++){
      for(int j=0;j<26;j++){
        a[j][i+1]=a[j][i];
      }
      a[s.charAt(i)-'a'][i+1]++;
    }
    for(int i=0;i<s.length();i++){
      for(int j=0;j<26;j++){
        a[j][s.length()+i+1]=a[j][s.length()+i];
      }
      a[s.charAt(i)-'a'][s.length()+i+1]++;
    }
    int ab=0;
    long ans=0;
    for(int i=0;i<t.length();i++){
      if(a[t.charAt(i)-'a'][s.length()*2]==0){
        System.out.println(-1);
        return;
      }
      int l=ab+1;
      int r=s.length()*2;
      int base=a[t.charAt(i)-'a'][ab];
      while(true){
        int gaze=l+(r-l)/2;
        if(base+1==a[t.charAt(i)-'a'][gaze]&&a[t.charAt(i)-'a'][gaze-1]==base){
          ans=ans+gaze-ab;
          ab=gaze;
          if(ab>=s.length()){ab-=s.length();}
          break;
        }else if(a[t.charAt(i)-'a'][gaze]<=base){
          l=gaze+1;
        }else if(base+1<=a[t.charAt(i)-'a'][gaze]){
          r=gaze-1;
        }
      }
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 57300
# d日目の終わりの低下する満足度
def cost(c, d, lastdi):
    total = 0
    # print("{}日目".format(d))
    # print(lastdi)
    for i in range(26):
        total += c[i]*(d - lastdi[i])
    # print("cost:{}".format(total))
    return total

# 最終日
D = int(input())
# type毎の満足度の下がりやすさ
c = list(map(int, input().split()))
# [d,i]の満足度
s = [[] for _ in range(D)]
for d in range(D):
    si = list(map(int, input().split()))
    s[d] = si

# type毎の最後に開催された日を管理
lastdi = [0 for _ in range(26)]

ans = 0
for d in range(D):
    # d日目に選択されたtype
    typei = int(input()) - 1
    lastdi[typei] = d+1 # 日付なので+1
    ans += s[d][typei] - cost(c, d+1, lastdi)
    print(ans)



Measured memory_bytes: 9392
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
from functools import reduce


sys.setrecursionlimit(2147483647)
INF = 10 ** 20
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
# def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007


n = I()
s = S()
q = I()
def f(k):
    cnt = [0, 0, 0] # dの個数、mの個数、dmの個数
    ans = 0
    for i in range(n):
        if i - k >= 0:
            if s[i - k] == 'D':
                cnt[2] -= cnt[1]
                cnt[0] -= 1
            elif s[i - k] == 'M':
                cnt[1] -= 1
        if s[i] == 'D':
            cnt[0] += 1
        elif s[i] == 'M':
            cnt[1] += 1
            cnt[2] += cnt[0]
        elif s[i] == 'C':
            ans += cnt[2]
    return ans

K = LI()
for i in range(q):
    print(f(K[i]))


Measured memory_bytes: 59248
const main = input => {
  const inputs = input.trim().split('\n')

  const N = parseInt(inputs[0])
  const sequence = inputs[1].split(' ').map(x => parseInt(x))

  const sortedSample = sequence.slice().sort((a, b) => a - b)

  let diff = 0
  for (let i = 0; i < N; i++) {
    //    console.log(sequence[i], sortedSample[i]);
    if (sequence[i] !== sortedSample[i]) {
      diff++
    }
  }

  diff === 2 || diff === 0 ? console.log('YES') : console.log('NO')

}
// 標準入力
main(require("fs").readFileSync("/dev/stdin", "utf8"))


Measured memory_bytes: 29476
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <functional>
#include <ctime>
using namespace std;
#pragma warning(disable: 4996)
string S;
int main() {
	cin >> S;
	for (int i = 0; i < 8; i++) {
		int C = (S[0] - '0');
		for (int j = 0; j < 3; j++) {
			if ((i / (1 << j)) % 2 == 0)C -= (S[j + 1] - '0');
			else C += (S[j + 1] - '0');
		}
		if (C == 7) {
			for (int j = 0; j < 3; j++) {
				cout << S[j];
				if ((i / (1 << j)) % 2 == 0)cout << "-";
				else cout << "+";
			}
			cout << S[3]; cout << "=7" << endl; break;
		}
	}
	return 0;
}


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

long long int Array[100005];
long long int Menor;

int main(){
	long int n;
	long long int aux;
	Array[0]=-1000000009;
	scanf("%ld",&n);
	bool first=true;
	for (long int i = 1; i < n+2; ++i)
	{
		scanf("%lld",&aux);
		Array[i]=aux;	
	}
	sort(Array,Array+n+2);
	for (long int i = 2; i < n+2; ++i)
	{
		aux=Array[i]-Array[i-1];
		if (!first){
			aux=__gcd(aux,Menor);
		}
		Menor=aux;
		first=false;
	}
	printf("%lld",Menor);
}

Measured memory_bytes: 1024
def ok(s):
    a = b = c = 0
    for ch in s:
        if ch == 'a': a += 1
        if ch == 'b': b += 1
        if ch == 'c': c += 1
    return abs(a - b) <= 1 and abs(b - c) <= 1 and abs(c - a) <= 1

s = input()
if ok(s):
    print('YES')
else:
    print('NO')

Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
ll GetDigit(ll num){ return log10(num)+1; } //numの桁数を求める

int main()
{
    int a, b, c;
    cin >> a >> b >>c;
    if(a+b >= c) cout << "Yes"  << endl;
    else cout <<"No" << endl;
    return 0;
}

Measured memory_bytes: 3684
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define se second
#define fi first
#define ll long long
#define INF INT_MAX
#define mod 1000000007
#define chutiyaap ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using namespace std;
ll pw(ll a, ll b) {
    if (b == 0) return 1;
    ll t = pw(a, b / 2);
    if (b % 2 == 0) return (t * t)%mod;
    else return ((t * t)%mod * a)%mod;
}
int main()
{
	int x,n;cin>>x>>n;
	unordered_set<int>st;
	for(int i=0;i<n;i++)
	{
		int a;cin>>a;
		st.insert(a);
	}
	int diff=INT_MAX,res=INT_MAX;
	for(int i=-105;i<=105;i++)
	{
		if(!st.count(i))
		{
			if(abs(x-i)<diff)
			{
				diff=abs(x-i);
				res=i;
			}
		}
	}
	cout<<res<<endl;
	return 0;
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define endl "\n"

int main()
{
  i64 N;
  cin >> N;
  vector<i64> x(N), y(N);
  for (i64 i = 0; i < N; i++)
    cin >> x[i] >> y[i];
  for (i64 i = 0; i < N; i++)
  {
    i64 tx = x[i], ty = y[i];
    x[i] = tx + ty;
    y[i] = tx - ty;
  }
  cout << max(*max_element(x.begin(), x.end()) - *min_element(x.begin(), x.end()), *max_element(y.begin(), y.end()) - *min_element(y.begin(), y.end())) << endl;
  return 0;
}


Measured memory_bytes: 6408
#include<stdio.h>

int main(){

	int a,b;

	for (a = 1; a <= 9;a++){
		b=1;
		printf("%dx%d=%d\n",b,a,b*a);
	}

		for (a = 1; a <= 9;a++){
		b=2;
		printf("%dx%d=%d\n",b,a,b*a);
	}

	for (a = 1; a <= 9;a++){
		b=3;
		printf("%dx%d=%d\n",b,a,b*a);
	}

	for (a = 1; a <= 9;a++){
		b=4;
		printf("%dx%d=%d\n",b,a,b*a);
	}

	for (a = 1; a <= 9;a++){
		b=5;
		printf("%dx%d=%d\n",b,a,b*a);
	}

	for (a = 1; a <= 9;a++){
		b=6;
		printf("%dx%d=%d\n",b,a,b*a);
	}

	for (a = 1; a <= 9;a++){
		b=7;
		printf("%dx%d=%d\n",b,a,b*a);
	}

	for (a = 1; a <= 9;a++){
		b=8;
		printf("%dx%d=%d\n",b,a,b*a);
	}

	for (a = 1; a <= 9;a++){
		b=9;
		printf("%dx%d=%d\n",b,a,b*a);
	}

	return 0;
}

Measured memory_bytes: 524
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

int main(void) {
  int A;
  scanf("%d", &A);
  int i,flag=0;
  for(i=1;i<10;i++)
  {
  	if((int)(A/i)*i==A && (int)(A/i)<10)
    {
   		flag = 1;
    }
  }
  if(flag == 1)
  {
	  printf("Yes");
  }else{
  		printf("No");
  }
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <set>
#include <map>
#include <utility>
#include <string>
#include <sstream>
#include <algorithm>
#include <random>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#include <cassert>
#include <climits>

using namespace std;

uint64_t final_calc(const string& str, vector<int> plus)
{
	uint64_t sum = 0;

	uint64_t val = 0;
	auto     it = plus.begin();

	for (int i = 0; i < str.size(); i++) {
		if (it != plus.end() && *it == i) {
			sum += val;
			val = 0;
			it++;
		}
		val = val * 10 + (str[i] - '0');
	}

	sum += val;

	return sum;
}

uint64_t calc(const string& str, int p, vector<int> plus)
{
	if (p == str.size()) {
		return final_calc(str, plus);
	}

	vector<int> add = plus;
	add.push_back(p);

	uint64_t ret = 0;
	ret += calc(str, p + 1, plus);
	ret += calc(str, p + 1, add);

	return ret;
}

int main()
{
	string s; cin >> s;

	uint64_t ret = calc(s, 1, {});
	cout << ret << endl;

	return 0;
}

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

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int h, w, a, b;
    cin >> h >> w >> a >> b;
    for (int i = 0; i < b; i++) {
        string s = "";
        for (int j = 0; j < a; j++)
            s = s + '1';
        for (int j = a; j < w; j++)
            s = s + '0';
        cout << s << "\n";
    }
    for (int i = b; i < h; i++) {
        string s = "";
        for (int j = 0; j < a; j++)
            s = s + '0';
        for (int j = a; j < w; j++)
            s = s + '1';
        cout << s << "\n";
    }
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define o(a) cout << a << endl
#define int long long
#define fi first
#define se second
using namespace std;
typedef pair<int, int> P;

struct edge{
    int to, cost;
    edge(int to, int cost):to(to), cost(cost){}
};

const int INF = 1e9;
int v, e, r;
int d[100010];
vector<edge> G[100010];

void dijkstra(int s){
    priority_queue<P, vector<P>, greater<P> > q;
    fill(d, d + v, INF);
    q.push(P(0, s));
    d[s] = 0;
    while(q.size()){
        P p = q.top(); q.pop();
        int now = p.se;
        int nowCost = p.fi;
        if(nowCost > d[now]) continue;
        for(auto i: G[now]){
            int next = i.to;
            int cost = i.cost;
            if(d[next] > nowCost + cost){
                d[next] = nowCost + cost;
                q.push(P(d[next], next));
            }
        }
    }
}

signed main(){
    cin >> v >> e >> r;
    rep(i, 0, e){
        int s, t, d;
        cin >> s >> t >> d;
        G[s]. push_back(edge(t, d));
        // G[t]. push_back(edge(s, d));
    }
    dijkstra(r);
    rep(i, 0, v){
        if(d[i] == INF) o("INF");
        else o(d[i]);
    }
}

Measured memory_bytes: 19396
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] s = sc.next().split("");
        List<String> sList = new ArrayList<>(Arrays.asList(s));
        int zeroCount = 0;
        int oneCount = 0;
        for (int i = 0; i < sList.size(); i++) {
            String target = sList.get(i);
            if ("0".equals(target)) {
                zeroCount++;
                continue;
            }
            oneCount++;
        }
        System.out.println(2 * Math.min(zeroCount, oneCount));
    }

}


Measured memory_bytes: 36140
N, M = [int(i) for i in input().split(' ')]
SC = []
for _ in range(M):
    SC.append([int(i) for i in input().split(' ')])

ch = [-1] * N
for s,c in SC:
    if N >1:
        if s == 1 and c == 0:
            print(-1)
            exit()

    if ch[s-1] == -1 or ch[s-1] == c:
        ch[s-1] = c
    else:
        print(-1)
        exit()
s = 10**(N-1) if N >1 else 0
f = 10 ** N if N >1 else 10
for n in range(s,f):
    n = list(str(n))
    flg = 0
    for s,c in SC:
        if not n[s-1] == str(c):
            flg = 1

    if flg == 0:
        print(''.join(n))
        exit()

Measured memory_bytes: 3064
N=int(raw_input())
A = []
for i in range(N):
    A.append(int(raw_input()))

A.sort()
prev=A[0]
count=1
all_count=0
for i in range(1,N):
    if prev==A[i]:
        count+=1
    else:
        prev=A[i]
        all_count+=count%2
        count=1
all_count+=count%2

print all_count

Measured memory_bytes: 8964
import java.util.Scanner;

class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int A = scan.nextInt();
        int B = scan.nextInt();
        int C = scan.nextInt();
        if (A + B + C > 21){
            System.out.println("bust");
        } else {
            System.out.println("win");
        }
        scan.close();
    }
}

Measured memory_bytes: 22100
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace test
{
    class Program
    {
        static void Main(string[] args)
        {
            var line = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
            int N = line[0], M = line[1], X = line[2], left = 0, right = 0;
            var A = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();

            foreach(var i in A)
            {
                if (i <= X) left++;
                else right++;
            }            

            Console.WriteLine(left < right ? left : right);
        }
    }
}

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

#define rep(i,n) for(int i = 0; i < n; i++)
#define REP(i,n) for(int i = 1; i < n; i++)
#define sz(x) int(x.size())
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define YesorNo(a) printf(a ? "Yes\n" : "No\n")
#define endl '\n'
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vii = vector<vi>;
using vl = vector<ll>;
using vll = vector<vl>;
using vs = vector<string>;
using vb = vector<bool>;
using vc = vector<char>;
using vcc = vector<vc>;
const int dx[] = {0,1,0,-1,1,1,-1,-1};
const int dy[] = {1,0,-1,0,1,-1,-1,1};
const int inf = (1<<30)-1;
const ll infll = (1LL<<62)-1;
ll ceil(const ll &a, const ll &b){return ((a)+(b)-1)/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; }



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

  double r;
  cin >> r;
  double p = 3.14159265;
  double ans = r*2*p;
  cout << ans << endl;
}

Measured memory_bytes: 3804
#include <bits/stdc++.h>
using namespace std;
/*
struct line {
    // y = mx + b
    ll m, b;
};

long double intersectX (line X, line Y) {
    if (X.m==Y.m) return 1000000000;
    return (double)(Y.b - X.b) / (double)(X.m - Y.m);
}

ll eval (ll x, line X) {
    return ((X.m)*x + X.b);
}

deque <line> st;
vector <long double> points;

void addline (line X) {
    if (st.empty()) {
        st.pb(X);
        return;
    }
    if (st.size()==1) {
        st.pb(X);
        points.pb(intersectX(st.front(),X));
        return;
    }
    while (points.size()) {
        // l1 -> l2 -> X
        // if poi(l1,l2) >= poi(l1,X) then l2 is useless
        line l2 = st.back();
        st.pop_back();
        if (intersectX(st.back(),X)<=points.back())
            points.pop_back();
        else {
            st.pb(l2);
            break;
        }
    }
    points.pb(intersectX(X,st.back()));
    st.pb(X);
}

ll findbest (ll x) {
    return eval(x, st[lower_bound(ALL(points),x)-points.begin()]);
}
*/
#define ll long long
#define ld long double

struct line {
    ll m, b;
};

ld intersectX (line x, line y) {
    if (x.b == y.b) return 1000000000;
    return (double)(y.b - x.b) / (double)(x.m - y.m);
}

ll eval (line l, ll x) {
    return ( (l.m)*x + l.b );
}

vector <line> st;
vector <ld> points;

void addline (line l) {
    if (st.empty()) {
        st.push_back(l);
        return;
    }
    // if (st.size() == 1) {
    //     st.push_back(l);
    //     points.push_back(intersectX(l, st.back()));
    //     return;
    // }
    while (points.size()) {
        if (intersectX(l, st[st.size()-2]) <= points.back()) {
            points.pop_back();
            st.pop_back();
        }
        else break;
    }
    points.push_back(intersectX(l, st.back()));
    st.push_back(l);
}

ll findbest (ll x) {
    return eval(st[lower_bound(points.begin(),points.end(),x)-points.begin()], x);
}

ll dp[200002];
ll  h[200002];

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

    int n;
    ll c;
    cin >> n >> c;

    for (int i=1; i<=n; i++)
        cin >> h[i];

    line l;
    l.m = -2LL * h[1];
    l.b = h[1] * h[1];
    addline(l);

    for (int i=2; i<=n; i++) {
        dp[i] = c + h[i]*h[i] + findbest(h[i]);
        l.m = -2LL * h[i];
        l.b = h[i] * h[i] + dp[i];
        addline(l);
    }
    cout << dp[n] << '\n';

    return 0;
}

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

int main(){
	int n,x;
	cin >> n >> x;
	int ad[n];
	for(int i = 0;i < n;i++){
		cin >> ad[i];
	}
	int t,count = 0;
	for(int i = 0;i < n;i++){
		count += ad[i];
		if(count > x){
			t = i;
			break;
		}
	}
	cout << t+1;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const LL INF=1e18;
const int MAX=200010;
LL n,m;
int main()
{
    int i,j,k,t;
    while(~scanf("%lld%lld",&n,&m))
    {
        if(n%m==0)
            printf("-1\n");
        else
            printf("%lld\n",n);
    }
    return 0;
}




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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
using P = pair<ll, ll>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep1(i, n) for(ll i=1;i<=(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
#define ALL(obj) (obj).begin(), (obj).end()
#define MOD 1000000007
#define INF 1000000000

void solve_156() {
	ll n, k;
	ll ans = 0;

	cin >> n >> k;

	ans = log10(n)/log10(k) + 1;

	cout << ans << "\n";
}

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

	solve_156();

	return 0;
}

Measured memory_bytes: 640
#include<cstdio>
#include<cstring>
#include<vector>
using namespace std;

#define i64 long long int
#define mo 1000000007
#define ran 101101

int n;
vector<int> e[ran];
int f[ran][2];

int add(int a, int b) { return (a+=b)>=mo ? a-mo : a; }
int mul(int a, int b) { return 1LL*a*b%mo; }

int dfs(int cur, int par) {
	f[cur][0] = f[cur][1] = 1;
	
	for(int i=0;i<(int)e[cur].size();i++) {
		int nxt = e[cur][i];
		if (nxt == par) continue;
		
		if (f[nxt][0]<0) dfs(nxt, cur);
		
		f[cur][0] = mul(f[cur][0], add(f[nxt][0], f[nxt][1]));
		f[cur][1] = mul(f[cur][1], f[nxt][0]);
	}
}

int main() {
	scanf("%d", &n);
	for(int i=1;i<n;i++) {
		int x, y;
		scanf("%d%d", &x, &y);
		
		e[x].push_back(y);
		e[y].push_back(x);
	}
	
	memset(f, -1, sizeof f);
	dfs(1, -1);
	printf("%d\n", add(f[1][0], f[1][1]));
	
	return 0;
}

Measured memory_bytes: 13440
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define vl vector<ll>
#define pl pair<ll,ll>
#define rep(i,b) for(ll i=0;i<b;i++)
#define all(v) (v).begin(),(v).end()

int main() {
    ll n,q,b,l,r;
  cin>>q;
  set<ll>a;
  rep(i,q){
      cin>>n;
      if(n==0){
          cin>>b;
          a.insert(b);
          cout<<a.size()<<endl;
      }else{
          cin>>b;
          bool ans=a.find(b)!=a.end();
          cout<<ans<<endl;
      }
  }
}


Measured memory_bytes: 12376
#include <iostream>
#include <vector>
#include <algorithm>
#include <climits>
#include <cmath>
#include <stack>
#include <queue>
#include <map>
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<string> vs;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define all(a) (a).begin(),(a).end()
#define UNIQUE(v) v.erase(unique(all(v)),v.end());
#define fill(a,x) memset(a,x,sizeof(a))
#define zero(a) fill(a,0)
#define minus(a) fill(a,-1)
#define dbg(x) cout << #x"=" << x << endl

const int INF=INT_MAX/3;
const int LIMIT=100;

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

int n;
string c1,c2;
int ans;

int main(){
    cin>>c1>>c2;
    bool flag=true;
    rep(i,3){
        if(c1[i]!=c2[2-i])flag=false;
    }
    if(flag)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
    return 0;
}

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

using namespace std;

using ll = long long;

template<typename T> using V = std::vector<T>;
using Vi = V<int>;
using VVi = V<V<int>>;
using Vl = V<ll>;
using VVl = V<V<ll>>;
using Vs = V<string>;

template<typename T1, typename T2> using P = std::pair<T1, T2>;
using Pii = P<int, int>;
using Pll = P<ll, ll>;
using Pdd = P<double, double>;

template<typename T1, typename T2> using M = std::map<T1, T2>;
using Mii = M<int, int>;
using Msi = M<string, int>;

#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define REP2(i,s,e) for(int i=(int)(s);i<(int)(e);++i)
#define RREP(i,s,e) for(int i=(int)(s);i>=(int)(e);--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin(),ie=(c).end();i!=ie;++i)
#define ALL(c) (c).begin(), (c).end()

const double PI = acos(-1);
const ll MOD = 1e9+7;

int n, k;
string s;
Vl a;
V<bool> u;

ll dfs(int d) {
    if (d == n) {
        int cnt = 0;
        REP(i, n) cnt += u[i] ? 1 : 0;
        if (cnt < k) return 1e18;
        ll sum = 0;
        ll maxi = a[0];
        REP2(i, 1, n) {
            if (u[i]) {
                if (a[i] <= maxi) sum += maxi - a[i] + 1;
                maxi++;
            }
            maxi = max(maxi, a[i]);
        }
        return sum;
    }
    u[d] = true;
    ll x = dfs(d+1);
    u[d] = false;
    ll y = dfs(d+1);
    return min(x, y);
}

int main() {
    cin >> n >> k;
    a = Vl(n);
    REP(i, n) cin >> a[i];

    u = V<bool>(n, false);
    u[0] = true;
    std::cout << dfs(1) << '\n';

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<vector>
#include<cstdlib>
#include<map>
#include<fstream>
#include<string>
#include<sstream>
#include<iomanip>
#include<stdio.h>
#include<iostream>
#include<numeric>
using namespace std;

int main() {
	double t, x;
	cin >> t >> x;
	cout << t / x << endl;
}

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

const int N = 22;
char C[N][N];

int h, w;

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

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

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

    int ans = 0;
    for(int sx = 0; sx < h; sx++){
        for(int sy = 0; sy < w; sy++){
            if(C[sx][sy] == '#'){
                continue;
            }
            
            int D[h][w] = {};
            for(int i = 0; i < h; i++){
                for(int j = 0; j < w; j++){
                    D[i][j] = 1e9;
                }
            }

            D[sx][sy] = 0;
            queue<pair<int, int>> q;
            q.push({sx, sy});
            
            int ma = 0;
            while(!q.empty()){
                pair<int, int> now = q.front();
                q.pop();

                int x = now.first;
                int y = now.second;

                for(int i = 0; i < 4; i++){
                    int nx = dx[i] + x;
                    int ny = dy[i] + y;
                    if(nx < 0 or ny < 0 or nx >= h or ny >= w){
                        continue;
                    }
                    if(C[nx][ny] == '#'){
                        continue;
                    }
                    if(D[x][y] + 1 < D[nx][ny]){
                        D[nx][ny] = D[x][y] + 1;
                        ma = max(ma, D[nx][ny]);
                        q.push({nx, ny});
                    }
                }
            }
            ans = max(ans, ma);
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
 
int main()
{
  int a,b,i;
  while(scanf("%d",&a) != EOF){
    b=1;
    for(i=0;i<=9;i++){
      if((a & b)!=0){
        printf("%d",b);
        a-=b;
        if(a!=0) printf(" ");
      }
      b=b*2;
    }
    printf("\n");
  }
  return 0;
}

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

const int N = 2010;
const int P = 1e9 + 7;

long long f[N << 1][N][2], s[N];

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

	int n, m, k;
	long long ans = 0;
	std::cin >> n >> m >> k;

	f[0][0][0] = 1;
	for (int i = 1; i <= (std::max(n, m) << 1); ++i) {
		s[0] = f[i - 1][0][0] + f[i - 1][0][1];
		for (int j = 1; j <= n; ++j) {
			s[j] = (((s[j - 1] + f[i - 1][j][0]) % P) + f[i - 1][j][1]) % P;
		}
		for (int j = 0; j <= n; ++j) {
			f[i][j][0] = (s[j] - s[j - 1] + P) % P;
			if (j) f[i][j][1] = (s[j - 1] - (j >= k ? s[j - k] : 0) + P) % P;
		}
		for (int j = 0; j <= n; j++) {
			if (j % (k - 1) == n % (k - 1) && (i * (k - 1) - j + 1) % (k - 1) == m % (k - 1) && i * (k - 1) - j + 1 <= m) {
				ans = (ans + f[i][j][1]) % P;
			}
		}
	}

	std::cout << ans << '\n';

	return 0;
}

Measured memory_bytes: 129264
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <vector>
using namespace std;
int main(){
    int K;
    string acl;
    cin >> K;
    for(int i=0;i<K;i++){
        acl = acl+"ACL";
    }
    cout << acl << endl;
    return 0;
}

Measured memory_bytes: 3600
#[macro_use]extern crate text_io;

fn main(){
    let s:String = read!();
    let s = s.as_bytes();
    let mut s:Vec<i32> = s.iter().map(|e|(e - b'0') as i32).collect();
    s.reverse();
    let modml = |rhs,lhs|rhs * lhs % 2019;
    let modpow = |mut num,ind|{
        let mut cnt = ind as u32;
        let mut res = 1;
        while cnt != 0u32 {
            if 1u32 & cnt == 1u32 {res = modml(res,num)}
            num = modml(num,num);
            cnt >>= 1;
        }
        res
    };
    let mut c = Vec::new();
    c.push(0);
    for (i,e) in s.iter().enumerate(){
        c.push((c.last().unwrap() + modml(modpow(10,i),*e)) % 2019);
    }
    let nck2 = |n|n * (n-1) / 2;
    let mut v = vec![0;2019];
    for i in c.iter() {
        v[(*i) as usize] += 1;
    }
    let mut ans = 0u64;
    for i in v.iter() {
        ans += nck2(*i) as u64;
    }
    println!("{}",ans);
}

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

using namespace std;
typedef long long int ll;
typedef pair<ll, ll > pi;  
typedef pair<pair<ll, ll >, ll > pii;  
vector<ll > vec;
vector<vector<ll > > vec2;
ll MOD = 1000000007;
ll INF = 11451419194545;

int main(){
    ll A, B, C;
    cin >> A >> B >> C;

    cout << A * B / 2 << endl;
}

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

#define boost                         \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
#define ll long long int
// #define int ll
#define vi vector<ll>
#define vvi vector<vi>
#define pii pair<int, int>
#define vii vector<pii>
#define pb push_back
#define B begin()
#define E end()
#define sz(A) (ll)(A).size()
#define F first
#define S second
#define loop(z, v) for (auto &z : v)
#define sp << ' ' <<
#define sps << ' '
#define nl "\n"
// #define nl endl
#define fat 1000000007
// #define fat 998244353
#define PI_2 1.57079632679489661923

int main() { 
    ll tt = 1, n, q, m, l, r, c, i, j, k, w;
    boost;
    
    // cin >> tt;
    ll ans = 1;

    ll a, b, d;
    for(int _ = 1; _ <= tt; _++){
        cin >> a >> b >> c >> d;

        ans = max(b*d, max(b*c, max(a*d, a*c)));
        cout << ans << nl;
    }
}


Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<int,int> P;
const LL mod=1000000007;
const LL LINF=1LL<<60;
const int INF=1<<30;



int main(){
    LL n;cin >> n;
    vector<vector<int>> a(n,vector<int> (n));
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n-1; j++) {
            cin >> a[i][j];
            a[i][j]--;
        }
    }
    vector<int> c(n,0);
    vector<int> x(n,0);
    vector<queue<P>> q(2,queue<P>());
    for (int i = 0; i < n; i++) {
        int j = a[i][c[i]];
        if(!x[i]&&!x[j]&&a[j][c[j]] == i){
            q[1].push(mp(i,j));
            x[i]++;
            x[j]++;
        }
    }
    int cnt = 0;
    for (int i = 1; i <= n*(n-1)/2+1; i++) {
        while(!q[i%2].empty()){
            auto p = q[i%2].front();q[i%2].pop();
            int j = p.fs;
            int en = p.sc;
            c[j]++;
            c[en]++;
            if(c[j]<n-1){
                int ee = a[j][c[j]];
                if(a[ee][c[ee]] == j) q[(i+1)%2].push(mp(j,ee));
            }
            else cnt++;
            if(c[en]<n-1){
                int ee = a[en][c[en]];
                if(a[ee][c[ee]] == en) q[(i+1)%2].push(mp(en,ee));
            }
            else cnt++;
            x[j]=i;
            x[en]=i;
        }
        if(q[(i+1)%2].empty()){
            if(cnt==n){
                cout << i << endl;
                return 0;
            }
            else{
                puts("-1");
                return 0;
            }
        }
    }
    return 0;
}



Measured memory_bytes: 4224
#include <iostream>

#define REP(i, a, b) for ( int i = (a); i < (b); i++ )
#define REVREP(i, a, b) for ( int i = (a); i >= (b); i--)
#define DEBUG_INT(var) printf("the value of "#var" is %d\n", var)
#define PRINT_ARRAY(name, i) printf("the value of "#name"[%d] is %d\n", (i), name[(i)])
#define DEBUG_ARRAY(name, begin, end) REP(i, begin, end) PRINT_ARRAY(name, i)

#define YES puts("YES")
#define NO  puts("NO")
#define Yes puts("Yes")
#define No  puts("No")

using namespace std;

typedef long long ll;

int N;

int main(void) {
    scanf("%d", &N);

    if (N < 1000) puts("ABC");
    else puts("ABD");

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n,l,ans;
  cin>>n>>l;
  if(l>=0)
  {
    ans=(l*(n-1));
    ans+=((n*(n-1))/2);
    cout<<ans;
  }
  else
  {
    if(abs(l)<=n-1)
    {
     ans=(l*n);
     ans+=((n*(n-1))/2);
     cout<<ans;
    }
    else
    {
     ans=(l*(n-1));
    ans+=(((n-2)*(n-1))/2);
    cout<<ans; 
    }
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "debug.h"
#else
#define dump(...)
#endif
#define endl "\n"
#define ll long long
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define REP(i, x) for (int i = 0; i < (int)(x); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define RREP(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define RREPS(i, x) for (int i = ((int)(x)); i > 0; i--)
#define INF (1 << 30)
#define LLINF (1LL << 60)
#define vi vector<int>
#define vvi vector<vector<int>>
#define pi pair<int, int>
#define ALL(a) (a).begin(), (a).end()
#define BIT(n) (1LL << (n))
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end()) //sortしてからつかうこと
constexpr ll MOD = 1e9 + 7;
int dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
int dy[8] = {0, 1, 0, -1, 1, -1, 1, -1};
ll A, B, C, D, E, F, G, H, N, M, L, K, P, Q, R, W, X, Y, Z;
string S, T;
ll ans = 0;

template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
    for (T &x : vec)
        is >> x;
    return is;
}

signed main() {
    cin >> N >> K >> S;
    for (int i = 0; i < N - 1; i++) {
        if (S[i] == S[i + 1]) {
            ans++;
        }
    }
    cout << min(ans + 2 * K, N - 1) << endl;
}

Measured memory_bytes: 512