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

#define dlog(str) cout << "====" << str << endl;
#define INF 999999999
#define MOD 1000000007
#define REP(i, n) for(int i = 0, i##_l = (n); i < i##_l; i++)
#define FOR(i, s, e) for(int i = s, i##_l = (e); i < i##_l; i++)
#define LLI long long int
#define _min(a, b) ((a < b) ? a : b)
#define _max(a, b) ((a < b) ? b : a)
#define chmax(a, b) a = _max(a, b)
#define chmin(a, b) a = _min(a, b)
#define bit(a, shift) ((a>>shift)&1))
#define pm(a) ((a) ? 1 : -1)
#define ALL(v) (v).begin(), (v).end()
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort((v).rbegin(), (v).rend())
// int 2.14E±9    lli 9.2E±18    double 1.7E±380

int main() {
    LLI N, K;
    cin >> N >> K;
    double p = 0;
    FOR(i, 1, N + 1) {
        int s = log2((K - 1) / i) + 1;
        if(s < 0) {
            s = 0;
        }
        p += pow(0.5, s) / N;
    }
    printf("%1.16f", p);
    return 0;
}

Measured memory_bytes: 384
#include <stdio.h>
int main(){
	int a1, b1, k;
	scanf("%d", &k);
	scanf("%d %d", &a1, &b1);
	int ans=0;
	for(int i = a1; i <=b1; i++){
		if(i%k==0){
			ans++;
		}
	}if(ans>0){
		printf("OK\n");
	}else {
		printf("NG\n");
	}
	
	return 0;
}


Measured memory_bytes: 1656
n,a,b,c=map(int,input().split())
ans=[]
slist=[]
for i in range(n):
    s=input()
    slist.append(s)
for i in range(n):
    s=slist[i]
    if s=="AB":
        if a==0:
            a+=1
            b-=1
            ans.append("A")
        elif b==0:
            a-=1
            b+=1
            ans.append("B")
        elif slist[(i+1)%n]=="AB":
            if a>b:
                a-=1
                b+=1
                ans.append("B")
            else:
                a+=1
                b-=1
                ans.append("A")
        elif slist[(i+1)%n]=="AC":
            a+=1
            b-=1
            ans.append("A")
        else:
            a-=1
            b+=1
            ans.append("B")
    elif s=="AC":
        if a==0:
            a+=1
            c-=1
            ans.append("A")
        elif c==0:
            a-=1
            c+=1
            ans.append("C")
        elif slist[(i+1)%n]=="AC":
            if a>c:
                a-=1
                c+=1
                ans.append("C")
            else:
                a+=1
                c-=1
                ans.append("A")
        elif slist[(i+1)%n]=="AB":
            a+=1
            c-=1
            ans.append("A")
        else:
            a-=1
            c+=1
            ans.append("C")
    else:
        if b==0:
            b+=1
            c-=1
            ans.append("B")
        elif c==0:
            b-=1
            c+=1
            ans.append("C")
        elif slist[(i+1)%n]=="BC":
            if b>c:
                b-=1
                c+=1
                ans.append("C")
            else:
                b+=1
                c-=1
                ans.append("B")
        elif slist[(i+1)%n]=="AC":
            c+=1
            b-=1
            ans.append("C")
        else:
            c-=1
            b+=1
            ans.append("B")
    if a<0 or b<0 or c<0:
        ans.clear()
        break
if len(ans)==0:
    print("No")
else:
    print("Yes")
    for i in range(n):
        print(ans[i])


Measured memory_bytes: 17036
#include<iostream>
#include<algorithm>
#include<map>
#include<vector>
using namespace std;
typedef long long li;
#define repa(i,a,n) for(int i=(a);i<(n);i++)
#define MOD 1000000000
#define rep(i,n) for(int i=0;i<(n);i++)

#define df 0
template<class T> void print(const T& t){ cout << t << "\n"; }
template<class T, class... Ts> void print(const T& t, const Ts&... ts) { cout << t; if (sizeof...(ts)) cout << " "; print(ts...); }
// vector 型
template<class T>
std::ostream& operator<<(std::ostream& os, const vector<T>& v){
  // ここでストリームに obj を書き込みます。
  for(const T& t:v) cout << t << " ";
  return os;
}


int pow(int a, int b){
  int x=1;
  rep(i,b){
    x*=a;
  }
  return x;
}

int judge(int a,vector<int>& s,vector<int>& c){
  string t;
  while(a){
    t.push_back(a%10+'0'); a/=10;
  }
  reverse(t.begin(),t.end());
  int n=s.size();
  rep(i,n){
    if(t[s[i]]!=c[i]+'0') return 0;
  }
  
  return 1;
}

int main(){
  int h,w; cin >>h >>w;
  vector<int> v(26,0);
  rep(i,h){
    string s; cin >>s;
    if(df)print(s);
    rep(i,w){
      v[s[i]-'a']++;
    }
  }
  if(h%2>w%2)swap(h,w);
  if(w%2==0){
    rep(i,26){
      if(v[i]%4){
        print("No"); return 0;
      } 
    }
    print("Yes"); return 0;
  }
  if(h%2){
    int cnto=1,cnte=h/2+w/2;
    rep(i,26){
      if(v[i]%2){
        if(cnto) cnto--;
        else{
          print("No"); return 0;
        }
        v[i]--;
      }
      if(v[i]%4){
        if(cnte) cnte--;
        else{
          print("No"); return 0;
        }
      }
    }
    print("Yes"); return 0;
  }
  

  int cnt=h/2;
  rep(i,26){
    if(v[i]%2){
      print("No"); return 0;
    }
    if(v[i]%4){
      if(cnt) cnt--;
      else{
        print("No"); return 0;
      }
    }
  }
  print("Yes"); return 0;
  

}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n,x) for(int i=(n);i<(x);++i)

int main() {
	int n, m; cin >> n >> m;
	vector<set<int>> st(m);
	rep(i, 0, m) {
		int k; cin >> k;
		rep(j, 0, k) {
			int s; cin >> s;
			st[i].insert(s - 1);
		}
	}
	vector<int> p(m);
	rep(i, 0, m) cin >> p[i];

	int ans = 0;
	rep(i, 0, 1 << n) {
		vector<int> count(m);
		rep(j, 0, n) {
			if (!(i & (1 << j))) continue;
			rep(k, 0, m) {
				if (st[k].count(j)) count[k]++;
			}
		}
		bool f = true;
		rep(j, 0, m) {
			if (count[j] % 2 != p[j]) {
				f = false;
				break;
			}
		}
		if (f) ans++;
	}
	
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))

results = list()
for first, second in zip(A[0:N - K], A[K:N]):
    if second > first:
        results.append(True)
    else:
        results.append(False)

for res in results:
    if res:
        print('Yes')
    else:
        print('No')


Measured memory_bytes: 31760
def counting_sort(a, b, k):
    c = [0 for _ in range(k)]
    
    for i in range(len(a)):
        c[a[i]] += 1 # 要素の数を数えた配列
    

    for i in range(1, k):
        c[i] += c[i-1] # 積み重ねたもの
    

    for i in range(len(a))[::1]:
        b[c[a[i]] -1] = a[i]
        c[a[i]] -= 1
    
    return b



def main():
    n = int(input())
    A = list(map(int, input().split()))

    B = [0 for _ in range(len(A))]

    b = counting_sort(A, B, max(A)+1)

    print(" ".join(map(str, b)))



if __name__ == "__main__":
    main()


Measured memory_bytes: 241920
#include <iostream>
using namespace std;
int main(){
 
int a,b,c,d,e;

  cin>>a>>b>>c>>d>>e;

   if(a<40) a = 40;
   if(b<40) b = 40;
   if(c<40) c = 40;
   if(d<40) d = 40;
   if(e<40) e = 40;

cout<< (a+b+c+d+e)/5<<endl;




return 0;
}



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

namespace ConsoleApp107 {
    class Program {
        static void Main(string[] args) {
            var st = Console.ReadLine().Split().Select(long.Parse).ToArray();

            int N = (int)st[0];
            long K = st[1];

            var a = new int[N];
            var b = new int[N];

            var ans = new long[100010];

            for (int i = 0; i < N; i++) {
                var x = Console.ReadLine().Split().Select(int.Parse).ToArray();

                a[i] = x[0];
                b[i] = x[1];

                ans[a[i]] += b[i];
            }



            for (int i = 0; i < 100010; i++) {
                K -= ans[i];

                if (K <= 0) {
                    Console.WriteLine(i);
                    break;
                }
            }

                

        }
    }
}


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

int main()
{
	int n;
	while (cin >> n, n) {
		vector<int> a(n), sum(n + 1);
		for (int i = 0; i < n; i++) {
			cin >> a[i];
			sum[i + 1] = sum[i] + a[i];
		}
		int res = -1000000000;
		for (int i = 0; i <= n; i++) {
			for (int j = i + 1; j <= n; j++) {
				res = max(res, sum[j] - sum[i]);
			}
		}
		cout << res << endl;
	}
	return 0;
}

Measured memory_bytes: 3116
#include<iostream>
#include<vector>
#include<queue>
#include<cstring>
using namespace std;
struct P{
  int rx,ry,lx,ly;
  P(){}
  P(int rx,int ry,int lx,int ly):rx(rx),ry(ry),lx(lx),ly(ly){};
};
int w,h,dx[]={0,1,-1,0},dy[]={1,0,0,-1};
bool used[50][50][50][50];
char Rin[50][50],Len[50][50];
bool bfs(int,int,int,int);
int main(){
  int rx,ry,lx,ly;
  while(cin >> w >> h && w||h){
    memset(used,false,sizeof(used));
    for(int i=0;i<h;i++){
      cin >> Len[i] >> Rin[i];
      for(int j=0;j<w;j++){
        if(Rin[i][j] == 'R') rx=i,ry=j;
        if(Len[i][j] == 'L') lx=i,ly=j;
      }
    }
    cout << (bfs(rx,ry,lx,ly)?"Yes":"No") << endl;
  }
}
bool bfs(int rx,int ry,int lx,int ly){
  queue<P> que;
  que.push(P(rx,ry,lx,ly));
  while(!que.empty()){
    P p = que.front();
    que.pop();
    if(used[p.rx][p.ry][p.lx][p.ly]) continue;
    if(Rin[p.rx][p.ry] == '%' && Len[p.lx][p.ly] == '%') return true;
    if(Rin[p.rx][p.ry] == '%'||Len[p.lx][p.ly] == '%') continue;
    used[p.rx][p.ry][p.lx][p.ly] = true;
    for(int i=0;i<4;i++){
      int nrx = p.rx + dx[i],nry = p.ry + dy[i];
      int nlx = p.lx + dx[i],nly = p.ly - dy[i];
      if(nrx<0 || nry<0 || nrx>=h || nry>=w || Rin[nrx][nry]=='#')
        nrx = p.rx,nry = p.ry;
      if(nlx<0 || nly<0 || nlx>=h || nly>=w || Len[nlx][nly]=='#')
        nlx = p.lx,nly = p.ly;
      if(used[nrx][nry][nlx][nly]) continue;
      que.push(P(nrx,nry,nlx,nly));
    }
  }
  return false;
}

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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#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 all(x) (x).begin(),(x).end()
 
using namespace std;
using ll = long long;
 
struct edge { int to, cost; };
 
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> P;
 
const int INF = 1e9;
const int MOD = 1e9+7;
const double EPS = 1.0e-10;
const double PI = acos(-1.0);
 
const int mx4[] = {0,1,0,-1};
const int my4[] = {1,0,-1,0};
const int mx8[] = {0,1,1,1,0,-1,-1,-1};
const int my8[] = {1,1,0,-1,-1,-1,0,1};

int main(){
	int a,b;
	cin >> a >> b;
	if(a>b) swap(a,b);
	rep(i,b) cout << a;
	cout << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n;
int a[105];
int main() {
    //freopen("input.txt", "r", stdin);
    ios_base::sync_with_stdio(false);
    //freopen("input.txt", "r", stdin);
    srand(time(0));
    cin >> n;
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
    }
    int ans = 0;
    int cur = 0;
    for (int i = 1; i <= n; i++) {
        if (a[i] != a[i - 1]) {
            ans += cur / 2;
            cur = 1;
        }
        else cur++;
    }
    ans += cur / 2;
    cout << ans;
    return 0;
}


Measured memory_bytes: 256
//Catchharsh
    //I Luv Kunj017
    #include<bits/stdc++.h>
    #define ll long long int 
    #define ld long double
    #define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
    #define F first
    #define S second
    #define pb push_back
    #define endl '\n'
    const ll MOD = 1e9+7;
    const ll INF = 1011111111;
    const ll LLINF = 1000111000111000111LL;
    const ld EPS = 1e-10;
    const ld PI = 3.14159265358979323;
    using namespace std;
    ll power (int x,int n)
    {
        if(n==0)
        return 1;
        else if(n%2==0)
        return power((x*x),n/2);
        else
        return x*power((x*x),(n-1)/2); 
    }
    int main()
    {   
         IOS;
         ll n,m,i,j,k;
         cin>>n;
         vector<ll> v(n+1);
         vector<ll> ans;
         int f=0;
         for(i=1;i<=n;i++)
          {
            cin>>v[i];
          }
         for(i=n;i>=1;i--)
         {
           for(j=i+i;j<=n;j=j+i)
           {
            v[i]=v[i]^v[j];
           }
         }
         ll cnt=0;
         for(i=1;i<=n;i++)
         {
           if(v[i]!=0)
            {cnt++;ans.pb(i);}
         }
         cout<<cnt<<endl;
         for(i=0;i<ans.size();i++)
          cout<<ans[i]<<" ";

        

    }

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

using namespace std;

long long inf = (1e18);

long long mul(long long a, long long b) {
  if (a == 0 or b == 0) {
    return 0;
  }
  if (inf / a >= b) {
    return a * b;
  } else {
    return inf;
  }
}

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

  int n;
  cin >> n;
  long long ans = 1;
  ++inf;
  while (n--) {
    long long x;
    cin >> x;
    ans = mul(ans, x);
  }
  cout << (ans == inf ? -1 : ans);

  return 0;
}


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

constexpr int INF = 1e9;

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

  vector<int> a;
  int six = 6, nine = 9;
  a.push_back(1);
  for (int i = 0;; i++) {
    if(six <= n) {
      a.push_back(six);
      six *= 6;
    } else break;
    if(nine <= n) {
      a.push_back(nine);
      nine *= 9;
    }
  }

  sort(a.begin(),a.end());
  int m = a.size();
  vector<vector<int>> dp(m + 1, vector<int> (n + 1, INF));
  dp[0][0] = 0;
  for (int i = 0; i < m; i++) { // i番目までの要素を使う
    for (int j = 0; j <= n; j++) { //金額をjにする
      if(j - a[i] >= 0) dp[i][j] = min(dp[i][j], dp[i][j - a[i]] + 1);
      if(i != 0) dp[i][j] = min(dp[i][j], dp[i - 1][j]);
    }
  }
  cout << dp[m - 1][n] << endl;
}

Measured memory_bytes: 5760
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string A, B, C;
  cin >> A >> B >> C;
  
  if (A.at(A.size()-1) == B.at(0) && B.at(B.size()-1) == C.at(0)) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
  
  
  
  return 0;  
}

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

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

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

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

using namespace std;

using R=long double;
const R EPS = 1E-11;
const R INF = 1E40;
constexpr R PI = acos(R(-1));
inline int sgn(const R& r){ return (r > EPS) - (r < -EPS);}

using P=complex<R>;
constexpr P O = P(0,0);
istream& operator >> (istream& is,P& p){ R x,y;is >> x >> y; p=P(x,y); return is;}
ostream& operator << (ostream& os,P& p){ os << real(p) << " " << imag(p); return os;}

//?????? dot ?????? det
inline R dot(P o,P a,P b){a-=o,b-=o; return real(conj(a)*b);}
inline R det(P o,P a,P b){a-=o,b-=o; return imag(conj(a)*b);}

using L=struct{P s,t;};

// ?°???± verify AOJ CGL_1_A
P proj(P o,P a,P b){ a-=o,b-=o; return a*real(b/a);}
P proj(L l,P p){ return l.s+proj(l.s,l.t,p);}
// ????°? verify AOJ CGL_1_B
P refl(L l,P p){ return R(2.0)*proj(l,p)-p;}
// CCW verify AOJ CGL_1_C
enum CCW{ LEFT = 1,RIGHT = 2,BACK = 4,FRONT = 8,ON = 16};
inline int ccw(P o,P a, P b) {//???a??¨???b???????????????????????????
	if (sgn(det(o,a,b)) > 0) return LEFT;    // counter clockwise
	if (sgn(det(o,a,b)) < 0) return RIGHT;   // clockwise
	if (sgn(dot(o,a,b)) < 0) return BACK;    // b--base--a on line
	if (sgn(norm(a)-norm(b)) < 0) return FRONT;   // base--a--b on line
	return ON;// base--b--a on line  a??¨b????????????????????????
}

int main(void){
	P a,b,p;
	int n;
	cin >> a >> b >> n;
	L l={a,b};
	cout.precision(20);
	rep(i,n){
		cin >> p;
		P ans=proj(l,p);
		cout << fixed << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 3284
solve x y
  | y < 9 = do
    putStrLn((show x)++"x"++(show y)++"="++(show (x*y)))
    solve x (y+1)
  | x < 9 = do
    putStrLn((show x)++"x"++(show y)++"="++(show (x*y)))
    solve (x+1) 1
  | x == 9 && y == 9 = do
    putStrLn((show x)++"x"++(show y)++"="++(show (x*y)))

main = do 
  solve 1 1

Measured memory_bytes: 3572
# https://atcoder.jp/contests/abc106/tasks/abc106_c

import itertools
import collections
import bisect

def main():
    S = input()
    K = int(input())

    for i in range(len(S)):
        if S[i] != '1':
            print(S[i])
            exit()
        elif i == K - 1:
            print(S[i])
            exit()


if __name__ == '__main__':
    main()


Measured memory_bytes: 3316
#include <iostream>
#include <cstring>
#include <stdlib.h>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <math.h>
#include <string>
#include <map>
#include <cstdlib>
#include <sstream>
#include <bitset>
using namespace std;

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

int main()
{
    int N,M;
    cin >> N >> M;
    vector<P> vt;
    map<int,int> mp;
    vector<string> ans(M);
    for(int i=0; i<M; i++){
        int p,y;
        cin>>p>>y;
        vt.push_back(P(p,y));
        mp[y]=i;
    }
    sort(vt.begin(), vt.end());
    int pre=-1,cnt=0;
    for(auto v:vt){
        int p=v.first;
        if(p!=pre){
            cnt=1;
            pre=p;
        }else cnt++;
        string t1=to_string(p), t2=to_string(cnt);
        while(t1.size()<6) t1="0"+t1;
        while(t2.size()<6) t2="0"+t2;
        ans[mp[v.second]]=t1+t2;
    }
    for(auto v:ans){
        cout << v << endl;
    }






    return 0;
}

Measured memory_bytes: 12404
#include <assert.h>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using ll = long long;
using P = std::pair<ll, ll>;

#define rep(i, a, b) for (ll(i) = (a); i < (b); i++)
#define all(i) i.begin(), i.end()
#define debug(i) std::cerr << "debug "<< i << std::endl

// const ll MOD = 998244353;
const ll MOD = 1e9 + 7;

//とりあえず1-indexedでつくったBIT
template <class T>
class BinaryIndexedTree {
  private:
  T n;
  std::vector<T> bit;

  public:
  BinaryIndexedTree(T i) : n(i), bit(i + 1, 0){};

  // a番目にwを加算
  void add(T a, T w) {
    for (T x = a; x <= n; x += (x & -x)) {
      bit[x] += w;
    }
  }

  //[1,a]の和
  T sum(T a) {
    T ret = 0;
    for (T x = a; x > 0; x -= (x & -x)) {
      ret += bit[x];
    }
    return ret;
  }

    //各項がすべて非負のものに対して、sum[1,a]>=keyを満たす最小のaを返す 存在しないなら-1返す
  T lower_bound(T key){
    T len=1,temp=n,now=0,value=0,flag;
    while(temp/2!=0){
      len*=2;
      temp/=2;
    }

    while(len>0){
      while(now+len>n)len/=2;

      if(value+bit[now+len]>=key){
        len/=2;
      }else{
        now+=len;
        value+=bit[now];
        len/=2;
        if(now==n){
          return -1;
        }
      }
    }

    now++;
    return now;
  }
};

int main() {
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);
  //問題文中の添え字が0-indexか1-indexか確認!

  ll n;
  std::cin>>n;

  std::vector<ll> a(n);
  rep(i,0,n)std::cin>>a[i];

  ll left=0,right=MOD;

  ll len=n*(n+1)/2;

  while(right-left>1){
    ll mid=left+(right-left)/2;

    ll cnt=0;

    BinaryIndexedTree<ll> count(2*n+1);

    ll sum=0;count.add(sum+n+1,1);
    rep(i,0,n){
      sum+=((a[i]>=mid)?1:-1);
      cnt+=count.sum(sum+n+1);
      count.add(sum+n+1,1);
    }

    debug(mid<<" "<<cnt);

    if(cnt>=(len+1)/2)left=mid;
    else right=mid;
  }

  std::cout<<left;

  return 0;
}


Measured memory_bytes: 2660
#include<iostream>
#include<vector>
#include<map>
#include<math.h>
#include<cassert>

const int MAX_P = 37;
using namespace std;

typedef unsigned long long ull;

vector<int> vprimes;
bool isPrime[MAX_P];

void MakePrime(){
  isPrime[0]=false;
  isPrime[1]=false;
  isPrime[2]=true;
  for(int i = 2; i < MAX_P; ++i){
    isPrime[i] = true;
  }
  for(int i = 2; i < MAX_P; ++i){
    if( isPrime[i] ){
      for(int j = 2; i * j < MAX_P; ++j) {
	isPrime[i*j] = false;
      }
    }
  }
  for(int i = 0; i < MAX_P; ++i){
    if( isPrime[i] ){
      vprimes.push_back( i );
    }
  }
}

ull convtodec(string t, ull B){
  ull ret = 0;
  for(int i = 0; i < (int)t.length(); ++i){
    int d = 0;
    if(t[i]>='A'&&t[i]<='Z')d=t[i]-'A'+10;
    else d=t[i]-'0';
    //cout << t[0] << ' ' << d << endl;
    ret *= B;
    ret += d;
  }
  return ret;
}

ull ipow(ull t, int p){
  ull ret = 1;
  for(int i = 0; i < p; ++i){
    ret *= t;
  }
  return ret;
}

int main(){
  MakePrime();
  ull N,B;
  ull base;
  string num;
  while(cin>>base>>num){
    if( base == 0 ) break;
    if( base == 0 && num[0] == '0' ) break;

    N = convtodec(num,base);
    B = base;

    //cout << N << ' ' << B << endl;

    ull num[vprimes.size()];
    for(int i = 0; i < (int)vprimes.size(); ++i){
      num[i] = 0;
      int maxpow = 1;
      while(N>=ipow(vprimes[i],maxpow)){
	++maxpow;
      }
      --maxpow;

      ull presum = 0;
      for(int p = maxpow; p >= 1; --p){
	ull tnum = (N / ipow(vprimes[i],p)) - presum;
	presum += tnum;
	num[i] += p * tnum;
      }
      //cout << vprimes[i] << ' ' << num[i] << endl;
    }

    ull res = 1LL<<62;
    for(int i = 0; i < (int)vprimes.size(); ++i){
      int e = 0;
      ull tB = B;
      while(tB % vprimes[i] == 0){
	++e;
	tB /= vprimes[i];
      }
      if( e > 0 ){
	res = min(res, num[ i ] / e);
      }
    }
    if( res == 1LL<<62 ) res = 0;

    cout << res << endl;
  }
  return 0;
}

Measured memory_bytes: 928
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<functional>
#include<algorithm>
#include<cstdio>
#include<unordered_map>
using namespace std;
//---------------------------------------------------
//ライブラリゾーン！！！！
#define int long long
#define str string
#define rep(i,j) for(int i=0;i<(int)(j);i++)
typedef long long ll;
typedef long double ld;
const ll inf = 999999999999999999;
struct P {
	ll pos, cost;
};
bool operator<(P a, P b) { return a.cost < b.cost; }
bool operator>(P a, P b) { return a.cost > b.cost; }
struct B {//隣接リスト表現
	ll to, cost;
};
struct S {//辺の情報を入れる変数
	int from, to, cost;
};
ll gcm(ll i, ll j) {//最大公約数
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcm(j%i, i);
}
//---------------------------------------------------
//+++++++++++++++++++++++++++++++++++++++++++++++++++
signed main() {
	int n, m, a[100000];//何個のボールがあるか
	bool b[100000];//赤いボールがある可能性があるか
	cin >> n >> m;
	for (int i = 0; i < n; i++) {
		a[i] = 1;
		b[i] = 0;
	}
	b[0] = 1;
	for (int i = 0; i < m; i++) {
		int x, y;
		cin >> x >> y;
		x--; y--;
		if (a[x] == 1) {
			a[x]--;
			a[y]++;
			if (b[x]) {
				b[x] = 0;
				b[y] = 1;
			}
		}
		else {
			a[x]--;
			a[y]++;
			if (b[x])
				b[y] = 1;
		}
	}
	int sum = 0;
	for (int i = 0; i < n; i++)
		if (b[i]) sum++;
	cout << sum << endl;
	getchar(); getchar();
}

Measured memory_bytes: 1152
def collatz(n):
    if n % 2 == 0:
        return n // 2
    else:
        return n * 3 + 1
    
i = 2
x = int(input())

if x == 1 or x == 2:
    i = 4
else:
    while(x != 1):
        i += 1
        x = collatz(x)
    
print(i)

Measured memory_bytes: 2940
from collections import defaultdict
N,M=map(int,input().strip().split())
G=defaultdict(list)
for i in range(M):
  u,v=map(int,input().strip().split())
  G[u].append(v)
  G[v].append(u)
dist=[]
for i in range(N+1):
    dist.append([0,-1])
valid=False
Q=[1]
visited=[False]*(N+1)
visited[1]=True
while(len(Q)!=0):
  top=Q[0]
  Q.pop(0)
  for u in G[top]:
    if not visited[u]:
      Q.append(u)
      dist[u][0]=1+dist[top][0]
      dist[u][1]=top
      visited[u]=True
for pair in dist[2:]:
  if pair[0]==-1:
    valid=True
    print("No")
if not valid:
  print("Yes")
  for pair in dist[2:]:
    print(pair[1])

Measured memory_bytes: 47960
#include<bits/stdc++.h>
#define STDIO
#define MOD 1000000007
#define testbit(mask,i) (((mask)>>(i))&1)
#define setbit(mask,i) ((mask)|(1<<i))
#define delbit(mask,i) ((mask)^(1<<i))
#define lowbit(x) ((x)&(-x))
#define INF MOD
using namespace std;
int a[60]={-1,1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
int ddd;
int main(){
	#ifndef STDIO
		freopen("input.in","r",stdin);
		freopen("output.out","w",stdout);
	#endif
	ios::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(NULL);
	cin>>ddd;
	cout<<a[ddd]<<endl;
	return 0;
}


Measured memory_bytes: 256
eps :: Double
eps = 1e-10

main :: IO ()
main = do
  [a, b] <- fmap (map read . words) getLine
  let low = ceiling $ (-eps) + max (12.5 * a) (10 * b)
      high = ceiling $ (-eps) + min (12.5 * a + 12.5) (10 * b + 10)
  putStrLn $ show $ if low < high then low else -1

Measured memory_bytes: 508
#include <bits/stdc++.h>
using namespace std;
int main(){
	long long int ans = 0;
	int n,m;
	scanf("%d %d",&n,&m);
	if(n == 0 || m == 0){
		printf("0\n");
		return 0;
	}
	ans = (n-1) * (m-1);
	printf("%lld\n",ans); 
	return 0;
}

Measured memory_bytes: 256
import java.util.*;
class Main
{
  public static void main(String[] args)
  {
    Scanner a = new Scanner(System.in);
    int input = a.nextInt();
    int hour = input / 3600;
    int minute = (input % 3600) / 60;
    int second = (input % 3600) % 60;
    System.out.println(hour+":"+minute+":"+second);
  }
}


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

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<=(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define Eunique(v) v.erase(unique(all(v)),v.end())
#define Eback(s) s.erase(s.end()-1,s.end())
#define rev(v) reverse(all(v))

typedef long long ll;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<long long> vll;
typedef vector<vll> vvll;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<string> vs;

typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef vector<pair<int,int>> vpii;
typedef vector<pair<ll,ll>> vpll;

const double pi = acos(-1.0);
const int mod=1000000007;
const int mod2=998244353;

ll powmod(ll a,ll b){ll c=1; while(b>0){ if(b&1){ c=a*c%mod; } a=a*a%mod; b>>=1; } return c;}
ll gcd(ll x, ll y) {return __gcd(x,y);}
ll lcm(ll x, ll y) {return x/__gcd(x,y)*y;}

int main()
{
	int a,b,c,d;cin>>a>>b>>c>>d;
    bool ok=true;
    while(a>0&&c>0){
        c-=b;
        if(c<=0){
            break;
        }
        a-=d;
        if(a<=0){
            ok=false;
            break;
        }

    }
    if(ok) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;

}

 
    

Measured memory_bytes: 3624
N,M=map(int,input().split())
a=set([int(input()) for i in range(M)])
mod=10**9+7

if N==1:
  print(1)
  exit()

total=[0 for i in range(N+1)]
total[0] = 1
for i in range(1,N+1):
  if i>=2 and i-2 not in a:
  	total[i] += total[i-2]
  if i-1 not in a:
    total[i] += total[i-1]

print(total[-1] % mod)

Measured memory_bytes: 468624
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <math.h>
#include <cmath>
#include <limits.h>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <functional>
using namespace std;

int main() {
    
    long long a,b;
    
    cin >> a >> b;
    
    if ( a == 0 || b == 0 ) {
        cout << "Zero" << endl;        
    }
    else if ( a < 0 && b > 0 ) {
        cout << "Zero" << endl;        
    }
    else if ( a > 0 && b > 0 ){
        cout << "Positive" << endl;        
    }
    else {
         cout << ((b - a)%2 == 0 ? "Negative" : "Positive" ) << endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int a[1010],b[1010],x,y,c1=0,c2=0,i,n;
    scanf("%d",&x);
    for(i=0;i<x;i++)
    scanf("%d",&a[i]);
    scanf("%d",&y);
    for(i=0;i<y;i++)
    scanf("%d",&b[i]);
        if(x<y)
            n=x;
        else
            n=y;

        for(i=0;i<n;i++){
            if(a[0]<b[0]){
                c1=1;
                break;
            }
            else if(a[0]>b[0]){
                c1=3;
                break;
            }
            else if(a[i]<b[i]){
                c1=1;
                break;
            }
            else if(a[i]>b[i]){
                c1=3;
                break;
            }

            else if(a[i]==b[i])
            c2++;
        }
        if(c1==1)
            printf("1\n");
        else{
                if(c1==3)
                    printf("0\n");
               else if(c2 ==x && y>x)
            printf("1\n");

            else
                printf("0\n");
        }

}



Measured memory_bytes: 2696
N, M, Q = map(int, input().split())
abcd = [list(map(int, input().split())) for _ in range(Q)]

m = M - 1

def f(s):
    if len(s) == N:
        return [s]
    result = []
    if s == '':
        r = 0
    else:
        r = int(s[-1])
    for i in range(r, m + 1):
        result.extend(f(s + str(i)))
    return result

result = 0
V = f('')
for s in V:
    A = [int(c) + 1 for c in s]
    t = 0
    for a, b, c, d in abcd:
        if A[b - 1] - A[a - 1] == c:
            t += d
    result = max(result, t)
print(result)


Measured memory_bytes: 15820
#include<bits/stdc++.h>
using namespace std;
int main(){
  string A;
  cin>>A;
  int ans=0;
  int kouho=0;
  for(int i=0; i<A.size(); i++){
    if(A.at(i)=='A'||A.at(i)=='T'||A.at(i)=='G'||A.at(i)=='C'){
      kouho++;
    }
    else{
      ans=max(ans, kouho);
      kouho=0;
    }
  }
  ans=max(ans, kouho);
  cout<<ans<<endl;
}


Measured memory_bytes: 3600
#include <stdio.h>

int main(void)
{
	int n,i,j;
	int date[5];
	int temp=0;
	int max=0,min=500;
	
	for(;;){
		
		min=500;
		max=0;
		scanf("%d",&n);
		if(n==0) break;
		
		for(i=0;i<n;i++){
			
			
			temp=0;
			
			
			scanf("%d %d %d %d %d",&date[0],&date[1],&date[2],&date[3],&date[4]);
			for(j=0;j<5;j++){
				temp+=date[j];
			}
			if(temp>max) max=temp;
			if(temp<min) min=temp;
			
		}
		
		printf("%d %d\n",max,min);
	}
	return 0;
}

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

typedef long long ll;
typedef long double lg;
using namespace std;

int main(){

  ll n,k,x;
  cin>>n>>k;

  vector<ll>a;

  for(int i=0;i<n;i++){
     cin>>x;
     a.push_back(x);
  }

  sort(a.begin(),a.end());

  if(k>= n){
    cout<<"0"<<endl;
    return 0;
  }


 ll sum=0;
  for(int i=0;i<n-k;i++)
 {
    sum += a[i];
  }

  cout<<sum<<endl;

return 0;
}

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

int main(){
    int n;
    cin>>n;
    long long a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    long long cnt=0;
    for(int i=0;i<n;i++){
        cnt+=a[i]/2;
        if(i!=n-1 && a[i]%2==1 && a[i+1]!=0){
            cnt++;
            a[i+1]--;
        }
    }
    cout<<cnt;
    
}


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

int main(){
    int n;
    int64_t a[200000], s = 0;
    cin >> n;
    for(int i=0;i<n;++i) cin >> a[i];

    int64_t len = 0;
    int64_t dif = INT64_MAX;
    for(int i=0;i<n;++i) len += 2*a[i];
    for(int i=0;i<n-1;++i){
        s += 2*a[i];
        dif = min(dif, abs(len/2 - s));
    }

    cout << dif << endl;
    return 0;
}

Measured memory_bytes: 1792
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<map>
#include<iomanip>
#include<queue>
#include<stack>
#include<time.h>
#define rep(i,n)for(ll i=0;i<n;i++)
#define ll long long
#define ggr getchar();getchar();return 0;
#define prique priority_queue
#define inf 1000000007
#define double long double
using namespace std;
typedef pair<ll, ll>P;
bool prime(int n) {
	int cnt = 0;
	for (int i = 1; i <= sqrt(n); i++) {
		if (n % i == 0)cnt++;
	}
	if (cnt != 1)return false;
	else return n != 1;
}
ll gcd(ll x, ll y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
ll lcm(ll x, ll y) {
	return x * y / gcd(x, y);
}
ll mod_pow(ll x, ll n, ll mod) {
	ll bit = 1;
	while (n) {
		if (n & 1)bit = bit * x % mod;
		x = x * x % mod;
		n /= 2;
	}
	return bit;
}
ll n;
ll a[114514];
signed main() {
	cin >> n;
	rep(i, n)cin >> a[i];
	bool p = false;
	for (int i = 1; i < n; i++) {
		if (a[i] == 0)p = true;
	}
	if (p == true)puts("0");
	else if (a[0] != 0)puts("0");
	else {
		ll memo = 1, ans = 1, mm = 1;
		sort(a, a + n);
		rep(i, n - 1) {
			if (a[i + 1] - a[i] >= 2) {
				puts("0");
				ggr
			}
		}
		a[n] = 1e9 + 7;
		rep(i, n) {
			if (a[i] == a[i + 1])memo++;
			else {
				ans *= mod_pow(mm, memo, 998244353);
				ans %= 998244353;
				mm = memo;
				memo = 1;
			}
		}
		cout << ans % 998244353 << endl;
	}
	ggr
}

Measured memory_bytes: 1024
import heapq

N, M = map(int,input().split())
A = list(map(int,input().split()))

A_minus = [-int(a) for a in A]
heapq.heapify(A_minus)

for _ in range(M):
    tmp = -heapq.heappop(A_minus)
    tmp //= 2
    heapq.heappush(A_minus, -tmp)
 
print(-sum(A_minus))

Measured memory_bytes: 73196
import sys
import math
stdin = sys.stdin
mod = 10**9 + 7

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
sa = lambda h: [list(map(int, stdin.readline().split())) for i in range(h)]


a, b = na()
c = max(a, b)
d = min(a, b)
print(str(d)*c)

Measured memory_bytes: 3064
import sys
import math
#+++++

def sp(value):
		ret_v=[]
		v=value
		for i in range(2, value):
			if v % i == 0:
				ret_v.append(i)
				v=v//i
				
				while v % i == 0:
					ret_v.append(i)
					v=v//i
					
			if i*i>v:
				ret_v.append(v)
				return (ret_v)
				
		ret_v.append(v)
		return (ret_v)

def main():
	a = int(input())
	mm=a*2
	for i in range(1, int(math.sqrt(a))+1):
		if a % i == 0:
			dd=i+(a//i)-2
			mm=min(dd,mm)

	print(mm)
	
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)

if __name__ == "__main__":
	if sys.platform =='ios':
		sys.stdin=open('inputFile.txt')
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

Measured memory_bytes: 3064
#include<stdio.h> 
#include<stdlib.h> 
  #include<bits/stdc++.h>
#define N 100005
#define K 200005
#define MOD 998244353
#define ll long long int
using namespace std;
 
 
int main() 
{ 
    int n,k;
    cin>>n>>k;
    int h[n];
    for(int i=0;i<n;i++)
    {
        cin>>h[i];
    }
    vector<int> dp(n,1000000005);
   dp[0]=0;
    for(int i=0;i<n;i++)
    {
        for(int j=i+1;j<=i+k&&j<n;j++)
        dp[j]=min(dp[i]+abs(h[j]-h[i]),dp[j]);
    }
    cout<<dp[n-1]<<endl;
    return 0; 
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rep2(j,n) for(int j = 0; j < (n); ++j)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define drep2(j,n) for(int j = (n)-1; j >= 0; --j)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define srep2(j,s,t) for (int j = s; j < t; ++j)
#define srep3(k,s,t) for (int k = s; k < t; ++k)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;
#define dame { puts("-1"); return 0;}
#define yn {puts("YES");}else{puts("NO");}
  
vector<pair<ll, int>> Pfact(ll num) {
  vector<pair<ll, int>> res;
  for (ll i = 2; i * i <= num; i++) {
    int cnt = 0;
    while (num % i == 0) {
      cnt++;
      num /= i;
    }
    if (cnt) res.emplace_back(i, cnt);
  }
  if (num != 1) res.emplace_back(make_pair(num, 1));
  return res;
}

class Combi {
  private:
    v(ll) fac, inv, finv;
   
    void init(int N) {
      fac[0] = fac[1] = 1; inv[1] = 1; finv[0] = finv[1] = 1;
   
      for (int i = 2; i < N; i++) {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
      }
    }
   
  public:
    Combi(int N) : fac(N + 1), inv(N + 1), finv(N + 1) { init(N + 1); }
   
    int Cmod(int n, int k) {
      if (n < k) return 0;
      if (n < 0 || k < 0) return 0;
      return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
    }
   
    ll Pmod(int n, int k) {
      if (n < k) return 0;
      if (n < 0 || k < 0) return 0;
      return fac[n] * finv[n - k] % MOD;
    }
  };

int main() {
  int N,M;
  cin >> N >> M;
  vector<pair<ll,int>> a = Pfact(M);
  Combi c(1000030);
  ll ans = 1;
  rep(i,sz(a)) {
    ans *= c.Cmod(N-1+a[i].second,N-1);
    ans %= MOD;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 23808
#include<bits/stdc++.h>
using namespace std;
struct var{
	int sum;
	double t;
}q[501001];
int n,L,v[501001],l,r,sum;
double t[501001],tn;
int main()
{
	scanf("%d%d",&n,&L);
	for(int i=1;i<=n;i++)
		scanf("%lf%d",&t[i],&v[i]);
	for(int i=1;i<=n;i++)
	{
		while(sum+v[i]>L)
		{
			int tmp=min(sum+v[i]-L,q[l].sum);
			q[l].sum-=tmp;
			sum-=tmp;
			tn-=1.00*q[l].t*tmp;
			if(!q[l].sum)l++;
		}
		r++;
		q[r].sum=v[i];
		q[r].t=t[i];
		sum+=v[i];
		tn+=v[i]*t[i];
		while(l<r&&q[r].t<q[r-1].t)
		{
			double tt=1.000*(q[r].t*q[r].sum+q[r-1].t*q[r-1].sum)/(q[r].sum+q[r-1].sum);
			q[r-1].t=tt;
			q[r-1].sum+=q[r].sum;
			r--;
		}
		printf("%.7f\n",1.000*tn/L);
	}
}

Measured memory_bytes: 22784
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<long long> vl;
#define pll pair<ll, ll>
#define vpl vector<pll>
#define vb vector<bool>
#define PB push_back
#define MP make_pair
#define ln "\n"
#define forn(i,e) for(ll i=0; i<e; i++)
#define forsn(i,s,e) for(ll i=s; i<e; i++)
#define rforn(i,e) for(ll i=e; i>=0; i--)
#define rforsn(i,s,e) for(ll i=s; i>=e; i--)
#define vasort(v) sort(v.begin(), v.end())
#define vdsort(v) sort(v.begin(), v.end(),greater<int>())
#define F first
#define S second

#define out1(x1) cout << x1 << ln
#define out2(x1,x2) cout << x1 << " " << x2 << ln
#define out3(x1,x2,x3) cout << x1 << " " << x2 << " " << x3 << ln
#define out4(x1,x2,x3,x4) cout << x1 << " " << x2 << " " << x3 << " " << x4 << ln
#define out5(x1,x2,x3,x4,x5) cout << x1 << " " << x2 << " " << x3 << " " << x4 << " " << x5 << ln
#define out6(x1,x2,x3,x4,x5,x6) cout << x1 << " " << x2 << " " << x3 << " " << x4 << " " << x5 << " " << x6 << ln

#define in1(x1) cin >> x1
#define in2(x1,x2) cin >> x1 >> x2
#define in3(x1,x2,x3) cin >> x1 >> x2 >> x3
#define in4(x1,x2,x3,x4) cin >> x1 >> x2 >> x3 >> x4
#define in5(x1,x2,x3,x4,x5) cin >> x1 >> x2 >> x3 >> x4 >> x5
#define in6(x1,x2,x3,x4,x5,x6) cin >> x1 >> x2 >> x3 >> x4 >> x5 >> x6

#define mz(a)   memset(a,0,sizeof(a))
#define arrin(a,n) forn(i,n) cin >> a[i];
#define arrout(a,n) forn(i,n) {cout << a[i] << " ";} cout << ln;
#define TYPEMAX(type)   std::numeric_limits<type>::max()
#define TYPEMIN(type)   std::numeric_limits<type>::min()

#define zoom ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
int main() {
    zoom;
    ll n,d;
    in2(n,d);
    ll s=0;
    forn(i,n){
        ll x,y;
        in2(x,y);
        if (x*x+y*y<=d*d) s++;
    }
    out1(s);
    return 0;
}

Measured memory_bytes: 3648
#include<iostream>
#include<bits/stdc++.h> 
#include<string>
#define UB upper_bound
#define LB lower_bound
#define BS binary_search
#define IN insert
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define NL cout<<endl
#define ll long long int
#define ld long double
#define vl vector<ll>
#define sl set<ll>
#define ml map<ll,ll>
#define sc set<char>
#define li list<ll>
#define vp vector<pair<ll, ll> >
#define vs vector<string>
#define ss set<string>
#define REP(i,a,b) for(ll i=a;i<b;i++)
#define REPI(i,a,b) for(ll i=b-1;i>=a;i--)
#define REPIT(it,a) for(auto it=a.begin();it!=a.end();it++)
#define N (ll)pow(2,32)-1
#define mod (ll)1000000007
using namespace std;
vl f;
void sieve(ll m){
  REP(i,1,sqrt(m)+1){
    if(m%i==0){
      f.PB(i);
      if(m/i!=i)
       f.PB(m/i);
    }
  }
}
int main()
{

ios::sync_with_stdio(0);
cin.tie(0);
ll t=1;
//cin>>t;
while(t--){
 ll a,b,k; cin>>a>>b>>k;
 cout<<max(a-k,0ll)<<" "<<max(min(a+b-k,b),0ll)<<endl;
}
return 0; 
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(ii, ss, ee) for(ll ii = (ss); ii <= (ll)(ee); ++ii)
#define DEC(ii, ss, ee) for(ll ii = (ss); ii >= (ll)(ee); --ii)
#define IAMSPEED ios_base::sync_with_stdio(false); cin.tie(0);
#define db(x) cerr << #x << "=" << x << endl;
#define db2(x, y) cerr << #x << "=" << x << " , " << #y << "=" << y << endl;
#define dbv(v) cerr << #v << ":"; for (auto i : v) cerr << i << ' '; cerr << endl;
#define dbvp(v) cerr << #v << ":"; for (auto i : v) cerr << "{"  << i.f << ',' << i.s << "} "; cerr << endl;
#define dba(a,ss,ee) cerr << #a << ":"; FOR(i,ss,ee) cerr << a[i] << ' '; cerr << endl;
#define pb push_back
#define pf push_front
#define oo (ll)1e18
#define inf (int)1e10
#define ll long long 
#define ld long double
#define all(x) (x).begin(), (x).end()
#define f first
#define s second
#define reach cerr << "hi\n";
typedef pair <int, int> pi;
typedef pair <ll,ll> pl;
typedef pair <pi, int> pii;
typedef tuple<int,int,int> ti3;
typedef tuple<ll,ll,ll> tl3;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
string lts(ll x) {stringstream s; s << x; return s.str(); }
ll stl(string x) {stringstream s(x); ll temp; s >> temp; return temp; }
string cts(char x) {string s(1,x); return s;}
const int MOD = 1e9 + 7;
const int MAXN = 1005;
template <typename T> void maxself(T& a, T b) {
    a = max(a, b);
}
template <typename T> void minself(T& a, T b) {
    a = min(a, b);
}

//#define cerr if(0)cout

char A[MAXN][MAXN];
ll dp[MAXN][MAXN];

int main() {
    IAMSPEED
    int h,w; cin >> h >> w;
    FOR(i,1,h) {
		FOR(j,1,w) cin >> A[i][j];
	}
	dp[1][1] = A[1][1] == '.';
	FOR(i,1,h) {
		FOR(j,1,w) {
			if (i==1 && j==1) continue;
			dp[i][j] = dp[i-1][j] + dp[i][j-1];
			if (A[i][j]=='#') dp[i][j] = 0;
			dp[i][j] %= MOD;
		}
		
	}
	cout << dp[h][w];
}


Measured memory_bytes: 9088
s = list(input())
n = int(input())
order = []
rep = []
l = []
a = 0
b = 0
toprint = ""
for i in range(n):
    order = input().split()
    a = int(order[1])
    b = int(order[2])
    if len(order)==4:
        rep = list(order[3])
        for j in range(len(rep)):
            s[j+a]=rep[j]
    elif order[0]=="reverse":
        l = ["" for k in range(b-a+1)]
        for j in range(len(l)):
            l[j]=s[j+a]
        l.reverse()
        for j in range(len(l)):
            s[j+a]=l[j]
    else:
        toprint=""
        for j in range(b-a+1):
            toprint+=s[j+a]
        print(toprint)


Measured memory_bytes: 5652
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.util.Arrays;

public class Main{
    public static void main(String[] args){
        FastScanner sc = new FastScanner();

        double r = sc.nextDouble();
        System.out.println(String.format("%.6f",(double)Math.PI*r*r)+" "+2*(double)Math.PI*r);

    }

    public static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner(String s) {
            try {
                br = new BufferedReader(new FileReader(s));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        }

        public FastScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String nextToken() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(nextToken());
        }

        long nextLong() {
            return Long.parseLong(nextToken());
        }

        double nextDouble() {
            return Double.parseDouble(nextToken());
        }
    }
}



Measured memory_bytes: 24800
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
const int INF = 100100100;
using namespace std;

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

  if(R<1200) cout << "ABC" << endl;
  else if(R<2800) cout << "ARC" << endl;
  else cout << "AGC" << endl;
}

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

using namespace std;

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

int main() {
  int K;
  cin >> K;
  int A, B;
  cin >> A >> B;

  int N = (A + K - 1) / K;
  if (N * K <= B) {
    cout << "OK" << endl;
  } else {
    cout << "NG" << endl;
  }

  return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
const int INF = 100100100;
using namespace std;

int main()
{
  int N;
  double a[110];
  double res=0;
  cin >> N;

  rep(i,N) cin >> a[i];

  rep(i,N){
    res += 1/a[i];
  }

  res = 1/res;
  
  printf("%.16f\n",res);
}

    


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define debug(x) cout << '>' << #x << ':' << x << endl;
#define ll long long
int arr[60];
int n, p;

int main() {
	int n;
	scanf("%d", &n);
	int arr[n + 2] = { };
	int total = 0;
	for (int i = 0; i < n; i++) {
		scanf("%d", &arr[i + 1]);
		total += abs(arr[i + 1] - arr[i]);
	}
	total += abs(arr[n] - 0);
	for (int i = 1; i <= n; i++) {
		cout
				<< total - (abs(arr[i - 1] - arr[i]) + abs(arr[i] - arr[i + 1]))
						+ abs(arr[i - 1] - arr[i + 1]) << endl;
	}
}


Measured memory_bytes: 4064