akhauriyash/Code-Regression huggingface dataset:
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from itertools import permutations
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
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)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    def root(x):
        if par[x] == x:
            return x
        par[x] = root(par[x])
        return par[x]

    def unite(x,y):
        x = root(x)
        y = root(y)
        if x == y:
            return
        if rank[x] < rank[y]:
            par[x] = y
        else:
            par[y] = x
            if rank[x] == rank[y]:
                rank[x] += 1

    def D2(i,j):
        x1,y1,z1,r = p[i]
        x2,y2,z2,r = p[j]
        return (x1-x2)**2+(y1-y2)**2+(z1-z2)**2

    while 1:
        n = I()
        if n == 0:
            return
        p = [list(map(float, input().split())) for i in range(n)]
        d2 = [[D2(i,j) for j in range(i)] for i in range(n)]
        par = [i for i in range(n)]
        rank = [0]*n
        v = []
        for i in range(n):
            x,y,z,r1 = p[i]
            for j in range(i):
                x,y,z,r2 = p[j]
                d = r1+r2
                d2ij = d2[i][j]
                if d2ij > d**2:
                    v.append((d2ij**0.5-d,i,j))
                else:
                    unite(i,j)
        v.sort()
        ans = 0.0
        for c,a,b in v:
            if root(a) != root(b):
                ans += c
                unite(a,b)
        print("{:.3f}".format(round(ans,3)))
    return

#Solve
if __name__ == "__main__":
    solve()



Measured memory_bytes: 6776
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n); for(int i = 0;i < (int)(n);i++)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
int main(){
    int n;
    cin >>  n;
    int acnt = 0;
    int bcnt = 0;
    int cnt = 0;
    int abcnt = 0;
    string s;
    rep(i,n){
        cin >> s;
        int m = s.size();
        rep(j,m-1){
            if(s[j]=='A' && s[j+1] == 'B'){
                cnt++;
                //cout << i << ' ' << j << endl;
            }
        }
        if(s[0]=='B' && s[m-1]=='A')abcnt++;
        else if(s[0]=='B')bcnt++;
        else if(s[m-1]=='A')acnt++;
        
    }
    int sum = 0;
    if(acnt == 0 && bcnt == 0)abcnt= max(0,abcnt-1);
    cout << cnt + min(acnt+abcnt,bcnt+abcnt) << endl;
    return 0;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
template<class T>inline bool chmax(T &a, const T &b){if(a < b){a = b; return 1;}return 0;}
template<class T>inline bool chmin(T &a, const T &b){if(a > b){a = b; return 1;}return 0;}
typedef long long ll;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N, D, X; cin >> N >> D >> X;
  vector<int> A(N, 0);
  REP(i, N){
    cin >> A[i];
  }
  int res = 0;
  REP(i, N){
    int day = 1;
    while(day <= D){
      res++;
      day += A[i];
    }
  }
  cout << res+X << endl;
}





Measured memory_bytes: 256
//参考：https://qiita.com/DaikiSuyama/items/9dba963ba74396b9b7fd
//インクルード(アルファベット順)
#include <algorithm>     //sort,二分探索,など
#include <bitset>        //固定長bit集合
#include <cmath>         //pow,logなど
#include <complex>       //複素数
#include <deque>         //両端アクセスのキュー
#include <functional>    //sortのgreater
#include <iomanip>       //setprecision(浮動小数点の出力の誤差)
#include <iostream>      //入出力
#include <iterator>      //集合演算(積集合,和集合,差集合など)
#include <map>           //map(辞書)
#include <numeric>       //iota(整数列の生成),gcdとlcm(c++17)
#include <queue>         //キュー
#include <set>           //集合
#include <stack>         //スタック
#include <string>        //文字列
#include <unordered_map> //イテレータあるけど順序保持しないmap
#include <unordered_set> //イテレータあるけど順序保持しないset
#include <utility>       //pair
#include <vector>        //可変長配列

using namespace std;
typedef long long ll;

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= (ll)(b); i++)
#define FORD(i, a, b) for (ll i = a; i >= (ll)(b); i--)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(), (x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size())      //sizeをsize_tからllに直しておく
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007    //10^9+7:合同式の法
#define MAXR 100000       //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define FIR first    //pairの一つ目の要素
#define SEC second   //pairの二つ目の要素

signed main()
{
    //入力の高速化用のコード
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

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

    cout << ((a * b) % 2 == 0 ? "Even" : "Odd") << endl;

    return 0;
}


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

int main(void)
{
    int n,k,tmp;
    cin >> n >> k;
    vector<int> a;
    rep(i, n){
        cin >> tmp;
        a.push_back(tmp);
    }

    rep2(i, k, n){
        if(a.at(i)>a.at(i-k)){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
    }

    return 0;

}

Measured memory_bytes: 4272
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1001001001LL;
constexpr long long LINF = 1e18 + 10;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define rept(i, j, n) for(int i=(j); i<(n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


int main(){ 
    int m; cin >> m;
    cout << 48 - m << ln;
}


Measured memory_bytes: 3616
#include <bits/stdc++.h>
//#pragma GCC optimize(2)
#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define rep(i,a,b) for(int i = (a);i <= (b);i++)
#define per(i,a,b) for(int i = (a);i >= (b);i--)
#define pii pair<int,int>
#define pll pair<long long, long long>
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll mod = 1e9 + 7;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const int inf = 0x3f3f3f3f;
const int maxn = 2e5 + 5;
const double eps = 1e-8;
const double pi = acos(-1.0);	
ll gcd(ll a,ll b){return !b?a:gcd(b,a%b);}
ll lcm(ll a,ll b){return a * b / gcd(a,b);}
ll qw(ll x,ll y){ll res = 1;while(y){if(y & 1) res *= x;x = x * x;y >>= 1;}return res;}
ll poww(ll x,ll y,ll p){ll ans = 1;while(y){if(y & 1) ans = ans * x % p;x = x * x % p;y >>= 1;}return ans % p;}
bool isp(ll x){if(x < 2) return 0; for(ll i = 2;i * i <= x;i++){if(x % i == 0) return 0;}return 1;}
int x,y;
void solve(){
	bool ok = 0;
	for(int i = 0;i <= x;i++){
		if(i * 2 + (x - i) * 4 == y){
			ok = 1;
		}
	}
	if(ok) cout << "Yes" << endl;
	else cout << "No" << endl;
	return;
} 
int main(){
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cin >> x >> y;
	solve();	
	return 0;
}
//do smt instead of nothing! never give up!


Measured memory_bytes: 3640
import java.util.Scanner;

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

  int j = 0;
  int[] ans = new int[1000];

    while (true) {
      String x;
      x = stdInt.next();
      int tmp=0;
      for (int i = 0; i < x.length(); i++) {
        tmp += x.charAt(i) - '0';
      }
      if (tmp == 0) break;
      ans[j++] = tmp;
    }

    for (int i = 0; i < j; i++) {
      System.out.println(ans[i]);
    }
  }
}


Measured memory_bytes: 26024
#include <vector>
#include <math.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <queue>
#include <iomanip>
#include <deque>
#include <cctype>
#include <unordered_map>

using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<long, long>;
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;
#define rep(i, n) for(int i = 0; i<n; i++)
#define rep_s(i, start, n) for(int i= start;  i<n; i++)
#define rep_down(i, n) for(int i = n-1; i>=0; i--)
#define rep_down_s(i, n, start) for(int i = n-1; i>=start; i--)
#define ALL(a) (a).begin(), (a).end()
#define ALL_str(a) (a).cbegin(), (a).cend()

string alphabet_upper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
string alphabet_lower  = "abcdefghijklmnopqrstuvwxyz";
string numbers = "0123456789";

/*
using edge = struct {int to; ll cost;};
vector<edge> tree[limit];
ll depth[limit];

void dfs(int v, int p, ll d){
  depth[v] = d;
  //cout <<"v: " << v << endl;
  for (auto &e: tree[v]){
    //cout << "e.to: " << e.to << endl;
    if (e.to == p) continue;
    dfs(e.to, v, d+e.cost);
  }
}
*/
int keta_sum(int num){
  int dig, sum = 0;
  while(num){
    dig = num % 10;
    sum = sum + dig;
    num = num / 10;
  }
  return sum;
}

ll binary_search(ll left_key, ll border, ll low, ll high) {
     // 配列 a の左端と右端
    ll mid = (low+high)/2;
    while (high > low+1) {
       mid = (low+high)/2;
        if (left_key*mid>border) high = mid;
        else if (left_key*mid<border) low = mid;
        else {
          mid =mid-1;
          break;
        }
    }
    return mid;
}

bool IsPrime(ll a){
  ll b = sqrt(a);
  b++;
  while(b-->=2){
    if (a%b==0) return false;
  }
  return true;
}

ll gcd(ll a, ll b){
  ll tmp;
  if(a<b){
    tmp = a;
    a = b;
    b = tmp;
  }

  ll r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }
  return b;
}

struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

int main(void){
  ll N, M, A, B, C, D, K,W, H, Q, X, Y;
  ll ans;
  string S, T;
  cin >> N;
  if (N == 3 || N==5||N==7) cout << "YES" <<endl;
  else cout << "NO" << endl;


}


Measured memory_bytes: 256
#include <iostream>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)


int main()
{
    vector<int> count(4,0);
    rep(i, 3) {
        int a, b;
        cin >> a >> b;
        count[a - 1]++;
        count[b - 1]++;
    }
    rep(i, 4) {
        if (count[i] >= 3) {
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
for ( int m = 1 ; m <= n ; m++) {
  int count =0;
  for ( int i = 1 ; i < 100 ; i++ ) {
    for (int j = 1 ; j <= i ; j++ ) {
      for ( int l = 1 ; l <= j ; l++ ) {
        if ((i+j)*(i+j)+(j+l)*(j+l)+(l+i)*(l+i) == 2*m) {
          if (i==j&&j==l) {
            count++;
          }
          else if (i==j && j!=l) {
            count += 3;
          }
          else if (i==l && i!=j) {
            count +=3;
          }
          else if (j==l && i!= j ) {
            count +=3;
          }
          else {
            count +=6;
          }
        }
      }
    }
  }
  cout << count << endl;
}
}

Measured memory_bytes: 3564
import numpy as np

def main():
  H,W = map(int,input().split())
  maze = [list(input())for _ in range(H)]
  for i in range(H):
    for j in range(W):
      if maze[i][j]=="#":
        maze[i][j]=0
      else:
        maze[i][j]=float('INF')
  maze = np.array(maze)
  for i in range(1,H):
    maze[i,:]=np.minimum(maze[i,:],maze[i-1,:]+1)
  for i in range(H-2,-1,-1):
    maze[i,:]=np.minimum(maze[i,:],maze[i+1,:]+1)
  for i in range(1,W):
    maze[:,i]=np.minimum(maze[:,i],maze[:,i-1]+1)
  for i in range(W-2,-1,-1):
    maze[:,i]=np.minimum(maze[:,i],maze[:,i+1]+1)
  print(int(np.max(maze)))
main()

Measured memory_bytes: 52564
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
  cin>>n;
  map<string, int> m;
  string s;
  for(int i = 0 ; i < n ; i++){
  	cin>>s;
    m[s]++;
  }
  cout<<"AC x "<<m["AC"]<<endl;
  cout<<"WA x "<<m["WA"]<<endl; 
  cout<<"TLE x "<<m["TLE"]<<endl;
  
  cout<<"RE x "<<m["RE"]<<endl;
    
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
#include <atcoder/all>

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
#define LL long long

int main() {
    int n,m;
    cin>>n>>m;
    auto uf = atcoder::dsu(n);

    REP(i,m){
        int a,b;
        cin>>a>>b;
        uf.merge(a-1, b-1);
    }
    auto v = uf.groups();

    cout<<v.size()-1<<endl;
}

Measured memory_bytes: 8948
#include <iostream>
#include <map>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>

using namespace std;
#define int long long
#define double long double
#define fst first
#define snd second
#define fr(s,n,i) for(int i=s;i<n;i++)
#define times(n) for(int i=0;i<n;i++)
#define fr_(s,n,i) for(int i=s;i>=n;i--)
#define srt(v) sort(v.begin(), v.end());
#define upr(v, aim, ind) int ind; ind=(int)distance(v.begin(), upper_bound(v.begin(),v.end(), aim))
#define sz(v) (int)v.size()
#define ers(v, i) v.erase(v.begin() + i)
#define last(v) v[sz(v) - 1]
#define swp(v, i, j) int buf = v[j]; v[j] = v[i]; v[i] = buf
#define shout(a) cout << a << endl
#define dshout(a) printf("%.16Lf\n", a)
#define pr pair<int, int>
#define vi vector<int>
#define vp vector<pair<int, int>>
#define vd vector<double>
#define vdd vector<vd>
#define mx(a, b) a = max(a, b)
#define mn(a, b) a = min(a, b)
#define mulM(a,b,c) a = a * b % c
#define squM(a,b) a = a * a % b
#define mpr(a,b) make_pair(a,b)
#define iinp(a) int a; cin >> a
#define sinp(a) string a; cin >> a
#define dinp(a) double a; cin >> a
#define ios() ios_base::sync_with_stdio(0);cin.tie(0)

int MOD = 1000000007;
int INF = ~(1LL << 63);

int powM(int base, int exp){
    int ret = 1;
    int buf = base;
    while(exp > 0){
        if(exp & 1){
            ret *= buf;
        }
        squM(buf, MOD);
        exp >>= 1;
    }
    return ret;
}
int combM(int a, int b){
    if(b == 0){
        return 1;
    }
    if(a-b < b){
        return combM(a, a-b);
    }
    int ans = 1;
    fr(1,b+1,i){
        ans *= a + 1 - i;
        ans /= i;
    }
    return ans;
}
void solve();
signed main() {
    ios();
    solve();
    return 0;
}

int calc(int num, int l, int r){
    if(r < 0){
        return calc(num, abs(r), abs(l));
    }
    if(l > 0){
        return (r+l)*num/2;
    }
    return calc(abs(l), 1, l) + calc(r, 1, r);
}

struct Task{
    int place, time;
    bool operator>(const Task & an) const{
        return time > an.time;
    }
};






void solve(){
    int N,M;
    cin >> N >> M;
    vp inp(N);
    fr(0, N, i){
        int val, cnt;
        cin >> val >> cnt;
        inp[i] = mpr(val, cnt);
    }
    srt(inp);
    int answer = 0;
    int ind = 0;
    while(M > 0){
        auto aa = inp[ind];
        answer += aa.fst * min(M, aa.snd);
        ind++;
        M -= aa.snd;
    }
    shout(answer);
}















Measured memory_bytes: 1792
N, M = map(int, input().split())
dp = [0 for _ in range(N+1)]
skip = {}

for _ in range(M):
    skip[int(input())] = 1

dp[0] = 1
if 1 not in skip:
    dp[1] = 1

for i in range(2, N+1):
    if i in skip:
        continue
    dp[i] += (dp[i-1] + dp[i-2]) % 1000000007

print(dp[N])


Measured memory_bytes: 87552
#include <bits/stdc++.h>
using namespace std;
int main (){
  string s;
  int n,i,j;
  cin>>n>>s;
  int tmp=0;
  int rep=0;
  vector<int> a(30);
  for(i=0;i<n;i++){
    for(j=0;j<i;j++){
      a[s[j]-'a']=1;
    }
    for(j=i;j<n;j++){
      if(a[s[j]-'a']){
        tmp++;
        a[s[j]-'a']=0;
      }
           }
    rep=max(rep,tmp);
    tmp=0;
  }
  cout<<rep<<endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
  public static void main(String[] args) {
    new Main().run();
  }

  private void run() {
    while(sc.hasNext()) {
      System.out.println(sc.nextLine().toUpperCase(Locale.ENGLISH));
    }
  }

  private final Scanner sc = new Scanner(System.in);
}

Measured memory_bytes: 11000
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
const lint mod = 998244353;
#define all(x) (x).begin(), (x).end()
#define bitcount(n) __builtin_popcountl((lint)(n))
#define fcout cout << fixed << setprecision(15)
#define highest(x) (63 - __builtin_clzl(x))
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T = string, class U = char>int character_count(T text, U character){ int ans = 0; for(U i: text){ ans += (i == character); } return ans; }
lint power(lint base, lint exponent, lint module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ lint root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
struct position{ int y, x; }; position mv[4] = {{0, -1}, {1, 0}, {0, 1}, {-1, 0}}; // double euclidean(position first, position second){ return sqrt((second.x - first.x) * (second.x - first.x) + (second.y - first.y) * (second.y - first.y)); }
template<class T, class U> string to_string(pair<T, U> x){ return to_string(x.first) + "," + to_string(x.second); } string to_string(string x){ return x; }
template<class itr> void array_output(itr start, itr goal){ string ans; for(auto i = start; i != goal; i++) ans += to_string(*i) + " "; if(!ans.empty()) ans.pop_back(); cout << ans << endl; }
template<class itr> void cins(itr first, itr last){ for(auto i = first; i != last; i++){ cin >> (*i); } }
template<class T> T gcd_calc(T a, T b){ if(b){ return gcd_calc(b, a % b); }else{ return a; }}
template<class T> T gcd(T a, T b){ if(a < b) swap(a, b); return gcd_calc(a, b); }
template<class T> T lcm(T a, T b){ return a / gcd(a, b) * b; }
struct combination{ vector<lint> fact, inv; combination(int sz) : fact(sz + 1), inv(sz + 1){ fact[0] = 1; for(int i = 1; i <= sz; i++){ fact[i] = fact[i - 1] * i % mod; } inv[sz] = power(fact[sz], mod - 2, mod); for(int i = sz - 1; i >= 0; i--){ inv[i] = inv[i + 1] * (i + 1) % mod; } } lint C(int p, int q) const{ if(q < 0 || p < q) return 0; return (fact[p] * inv[q] % mod * inv[p - q] % mod); } };
template<class itr> bool next_sequence(itr first, itr last, int max_bound){ itr now = last; while(now != first){ now--; (*now)++; if((*now) == max_bound){ (*now) = 0; }else{ return true; } } return false; }
inline int at(int x, int k){ return (x >> k) & 1; }
random_device rnd;

int main(){
    string S;
    cin >> S;
    int ans = 1000;
    for(int i = 0; i < S.size() - 2; i++){
        ans = min(ans, abs(stoi(S.substr(i, 3)) - 753));
    }
    cout << ans << endl;
}


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

using namespace std;
using p=pair<int,int>;
typedef long long ll;

int main() {
  ll n,k;
  cin >> n >> k;
  int con=0;
  while(n>=k){
    n=n/k;
    con++;
  }
  con++;
  cout << con << endl;
  return 0;

}


Measured memory_bytes: 3572
#include<cstdio>
#include<iostream>
using namespace std;
#define LL long long
const int CN = 2010; const LL R = 1e9+7; LL n,k,a[CN],ans = 0; LL read() {LL s; cin>>s; return s;}
int main(){n = read(); k = read(); for(int i=1;i<=n;i++) a[i] = read();

           
           
for(int i=1;i<=n;i++){
  LL prv = 0,all = 0; 
  for(int j=1;j<i;j++) if(a[j] > a[i]) prv++;
  for(int j=1;j<=n;j++) if(a[j] > a[i]) all++;
  (ans += prv * k) %= R;
  LL tp = (k * (k - 1) / 2) % R;
  (ans += all * tp) %= R;
} 
           

           
printf("%lld",ans); }

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
typedef double flt;
const int MAXN = 50000 + 10;
const flt eps = 1e-10;

int X[MAXN], R[MAXN], N;

flt sqr(flt x) {
  return x * x;
}

flt get(flt xa, flt ra, flt xb, flt rb) {
  flt len = xb - xa;
  flt cosa = (sqr(ra) + sqr(len) - sqr(rb)) / (2.0 * ra * len);
  flt sina = sqrt(1.0 - sqr(cosa));
  //flt h = ra * sina;
  flt w = ra * cosa;
  flt xx = xa + w;
  return xx;
}

typedef pair<flt, flt> PDD;

PDD get(flt x, flt r, flt y) {
  if (y >= r - eps) return PDD(0, 0);
  flt x1 = x - sqrt(sqr(r) - sqr(y));
  flt x2 = x + sqrt(sqr(r) - sqr(y));
  return PDD(x1, x2);
}

bool check(flt y) {
  vector<PDD> v;
  for (int i = 0; i < N; ++ i) {
    v.push_back(get(X[i], R[i], y));
  }
  sort(v.begin(), v.end());
  flt l = v[0].first, r = v[0].second;
  flt mx = 0;
  for (auto &se : v) {
    if (se.first <= r + eps) r = max(se.second, r);
    else {
      mx = max(mx, r - l);
      l = se.first, r = se.second;
    }
  }
  mx = max(mx, r - l);
  return mx >= 2.0 * y - eps;
}

int main() {
  while (scanf("%d", &N) == 1 && N) {
    flt ret = 0;
    for (int i = 0; i < N; ++ i) {
      scanf("%d%d", X + i, R + i);
      ret = max(ret, sqrt(2.0) * R[i]);
    }
    flt left = 0, right = 2e5;
    for (int _ = 0; _ < 50; ++ _) {
      flt mid = (left + right) * 0.5;
      if (check(mid)) left = mid;
      else right = mid;
    }
    printf("%.18f\n", left + right);
  }
  return 0;
}

Measured memory_bytes: 3292
#include <iostream>
#include <stack>

using namespace std;

void Solution()
{
    int a[10]={1,2,4,8,16,32,64,128,256,512};
    
    int n;
    
    stack<int> save;
    
    while(cin>>n)
    {
        for(int i = 9; 0 <= i; i--) // first , find out(be sure) the biggest weight.
        {
            if(n - a[i] > -1)
            {
                save.push(a[i]); //and save it at stack
                
                n = n - a[i];  //loop until n == a[i]
            }
        }
        
        while(1)
        {
            cout<<save.top(); //output the result from stack
            
            save.pop(); // delete
            
            if (save.empty())
            {
                break;
            }
            else
            {
                cout<<" ";
            }
        }
        
        cout<<endl;
    }
}

int main()
{
    Solution();
    return 0;
}

Measured memory_bytes: 1200
#include<stdio.h>
long long int ten[11];
long long int two[11];

int keta;
long long int sum(int s) {
	long long int memo=0;
	memo += ten[s - 1] * two[keta - s];
	for (int i = 1; i <= s - 1; i++) {
		memo += ten[s - i - 1] * two[keta - s + i-1];
	}
	return memo;

}
int min(int a, int b) {
	if (a >= b) { return b; }
	else { return a; }
}
int max(int a, int b) {
	if (a <= b) { return b; }
	else { return a; }
}
int main() {
	long long int a;
	long long result=0;
	keta = 0;
	long long int memo=1;
	for (int i = 0; i <= 10; i++) {
		ten[i] = memo;
		memo *= 10;
	}
	memo = 1;
	for (int i = 0; i <= 10; i++) {
		two[i] = memo;
		memo *= 2;
	}
	int i = 1;
	scanf("%lld", &a);
	int s[11] = {};
	while (a != 0) {
		s[i] = a % 10;
		keta++;
		a /= 10;
i++;
	}
	for (int i = 1; i <= keta; i++) {
		result += sum(i)*s[i];
	}
	printf("%lld\n", result);
}

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

#define rep(i, x, n) for (int i = x; i < n; i++)
typedef long long ll;

const int INF = 1e9 + 7;

using namespace std;

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

	int n;
	cin >> n;

	vector<int> res;
	vector<bool> prime(55555 + 1, true);
	prime[0] = prime[1] = false;

	for (int i = 2; i * i < 55555 + 1; i++) {
		for (int j = i * i; j < 55555 + 1; j += i) {
			prime[j] = false;
		}
	}

	int count = 0;
	for (int i = 11; i < 55555 + 1; i += 5) {
		if (prime[i]) {
			cout << i << " ";
			count++;
 		}

		if (count >= n)
			break;
	}
	cout << "\n";

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;
ll q,h,s,d,n;
int main(void){
    cin>>q>>h>>s>>d>>n;
    h=min(h,q*2);
    s=min(s,h*2);
    d=min(d,s*2);
    cout<<n/2*d+n%2*s<<endl;  
}


Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<vector>
#include<math.h>
#include<queue>
#include<map>
#include<algorithm>
#include<string.h>
#include<functional>
#include<limits.h>
#include<stdlib.h>
#include<cmath>
#include<cstring>
#include<set>
#include<climits>
#include<deque>
#include <iomanip>
#include<utility>
using namespace std;

#define intmax INT_MAX
#define lmax LONG_MAX
#define uintmax UINT_MAX
#define ulmax ULONG_MAX
#define llmax LLONG_MAX
#define ll long long
#define rep(i,a,N) for((i)=(a);(i)<(N);(i)++)
#define rrp(i,N,a) for((i)=(N)-1;(i)>=(a);(i)--)
#define llfor ll i,j
#define sc(a) cin>>a
#define pr(a) cout<<a<<endl
#define pY puts("YES")
#define pN puts("NO")
#define py puts("Yes")
#define pn puts("No")
#define pnn printf("\n")
#define all(a) a.begin(),a.end()
#define push(a,b) (a).push_back(b)
#define llvec vector<vector<ll>>
#define charvec vector<vector<char>>
#define size(a,b) (a,vector<ll>(b))
#define llpvec vector<pair<ll,ll>>
llfor;ll mod=1000000007;
/*pi*/double pi=acos(-1);
/*繰り上げ除算*/ll cei(ll x,ll y){ll ans=x/y;if(x%y!=0)ans++;return ans;}
/*最大公約数*/ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
/*最小公倍数*/ll lcm(ll x,ll y){return x/gcd(x,y)*y;}
/*n乗*/ll llpow(ll x,ll n){ll ans=1;rep(i,0,n){ans*=x;ans%=mod;}return ans;}
/*階乗*/ll fact(ll x){ll ans=1;rep(i,0,x)ans*=(x-i);return ans;}
/*nCr*/ll ncr(ll n,ll r){return fact(n)*fact(n-r)/fact(r);}
/*nPr*/ll npr(ll n,ll r){return fact(n)/fact(n-r);}
/*primejudge*/bool prime(ll a){if(a<=1)return false;for(i=2;i*i<=a;i++){if(a%i==0)return false;}return true;}
/*Fibonacci数列*/ll fib(ll x){ll fibo[x+10];fibo[0]=1;fibo[1]=1;fibo[2]=1;rep(i,3,x+1)fibo[i]=fibo[i-1]+fibo[i-2];return fibo[x];}
/*桁数*/ll dig(ll n){ll d=1,tmp=n;while(tmp/10>0){tmp/=10;d++;}return d;}
ll ans=0;
////////////////////////////////////////////////////////////
int main(){
 ll x,y;
 cin>>x>>y;
 ll tmp=360;
 if(x*y<=0){
  puts("Zero");
  return 0;
 }
 if(x<0&&y<0&&abs(y-x)%2==0){
  puts("Negative");
  return 0;
 }
 if(x<0&&y<0&&abs(y-x)%2==1){
  puts("Positive");
  return 0;
 }
 if(x>0&&y>0){
  puts("Positive");
  return 0;
 } 
return 0;}

Measured memory_bytes: 3620
# frozen_string_literal: true

sentence = readlines.map(&:chomp).join
counts = Array.new(26, 0)
sentence.chars.map(&:ord).each do |i|
  case i
  when 65..90
    counts[i - 65] += 1
  when 97..122
    counts[i - 97] += 1
  end
end
26.times do |i|
  puts "#{(i + 97).chr} : #{counts[i]}"
end



Measured memory_bytes: 6896
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,k;
    cin>>k>>n;
    int a[n];
    for(int i=0;i<n;i++)cin>>a[i];
    int md=0;
    for(int j=0;j<n-1;j++)
    {
        md=max(md,a[j+1]-a[j]);
    }
 //   cout<<md<<endl;
    md=max(md,k-a[n-1]+a[0]);
    cout<<k-md<<endl;
    return 0;
}

Measured memory_bytes: 1024
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#include <queue>
#include <string>
using namespace std;
typedef long long LL;

LL n,k,s;

int main(){
	ios::sync_with_stdio(false);
	cin >> n >> k >> s;
	for(LL i = 1;i <= k;i ++){
		cout << s << ' ';
	}
	for(LL i = k + 1;i <= n;i ++){
		cout << (s <= 10 ? s + 1 : s - 1) << (i == n ? '\n' : ' ');
	}
	return 0;
}

Measured memory_bytes: 1280
import java.io.*;
import java.util.*;
import java.math.*;

/*
	Author:	Koushik Sahu
	Date: 28-Aug-2020 10:17:59 pm
*/

public class Main {

	static FastScanner fs = new FastScanner();

	public static void main(String[] args) {
		String s;
		s = fs.next();
		int ans = 0;
		int[] arr = new int[3];
		for(int i=0; i<3; i++) {
			if(s.charAt(i)=='R') arr[i] = 1;
			else arr[i] = 0;
		}
		for(int i=1; i<3; i++) {
			if(arr[i]==1) arr[i] += arr[i-1];
		}
		ans = Math.max(arr[0], Math.max(arr[1], arr[2]));
		System.out.println(ans);
	}

	static class FastScanner {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer("");

		public String next() {
			while (!st.hasMoreTokens())
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}

		public String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

		public int[] readArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}

		public long nextLong() {
			return Long.parseLong(next());
		}

		public long[] readLongArray(int n) {
			long[] a = new long[n];
			for (int i = 0; i < n; i++)
				a[i] = nextLong();
			return a;
		}

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

}

Measured memory_bytes: 32596
#include<iostream>
#include<algorithm>
#define MDL 1000000007

using namespace std;

inline long long takemod(long long a) {
	if (a < 0) {
		return MDL + (a % MDL);
	}
	return a % MDL;
}

long long modpow(long long n, long long i) {
	if (i == 0)
		return 1;
	if (i == 1)
		return n % 1000000007;
	if (i % 2 == 0) {
		long long m = i / 2;
		long long mp = modpow(n, m);
		return (mp * mp) % MDL;
	} else {
		long long m = i / 2;
		long long mp1 = modpow(n, m), mp2 = modpow(n, m + 1);
		return (mp1 * mp2) % MDL;
	}
}


inline long long modmul(long long a, long long b) {
	return (takemod(a) * takemod(b)) % MDL;
}

long long moddiv(long long a, long long b) {
	const long long p =  MDL;
	long long r1, cb1, r2, cb2;
	a = takemod(a);
	b = takemod(b);
	r1 = p; cb1 = 0;
	r2 = b; cb2 = 1;

	while(r2 != 1) {
		long long r, cb, d;
		d = r1 / r2;
		r = r1 - d * r2;
		cb = (cb1 - d * cb2) % MDL;
		r1 = r2; cb1 = cb2;
		r2 = r; cb2 = cb;
	}
	return takemod(modmul(cb2, a));
}




int main() {
	long long n, c[200000];

	cin >> n;
	for(int i = 0; i < n; i++)
		cin >> c[i];

	sort(c, c + n);
	long long s = 0;
	for(int i = 0; i < n; i++) {
		s += c[i] * (n + 1 - i);
		s = takemod(s);
	}
	long long r = moddiv(modmul(modpow(2, 2*n), s), 4);
	cout << r;
	return 0;
}

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

using namespace std;

#define SZ(x) (int)(x.size())
#define REP(i, n) for(int i=0;i<(n);++i)
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RREP(i, n) for(int i=(int)(n);i>=0;--i)
#define RFOR(i, a, b) for(int i=(int)(a);i>=(int)(b);--i)
#define ALL(a) (a).begin(),(a).end()
#define DUMP(x) cerr<<#x<<" = "<<(x)<<endl
#define DEBUG(x) cerr<<#x<<" = "<<(x)<<" (L"<<__LINE__<<")"<< endl;

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using P = pair<int, int>;

const double eps = 1e-8;
const ll MOD = 1000000007;
const int INF = INT_MAX / 2;
const ll LINF = LLONG_MAX / 2;

template <typename T1, typename T2>
bool chmax(T1 &a, const T2 &b) {
  if(a < b) {a = b; return true;}
  return false;
}

template <typename T1, typename T2>
bool chmin(T1 &a, const T2 &b) {
  if(a > b) {a = b; return true;}
  return false;
}

template<typename T1, typename T2>
ostream& operator<<(ostream &os, const pair<T1, T2> p) {
  os << p.first << ":" << p.second;
  return os;
}

template<class T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  REP(i, SZ(v)) {
    if(i) os << " ";
    os << v[i];
  }
  return os;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);

  int n; cin >> n;

  int cnt = 0;
  int tmpn = n;
  int a = 0;
  int now = 1;
  while(tmpn) {
    if(tmpn & 1) {
      cnt++;
      a = now;
    }
    tmpn >>= 1;
    now <<= 1;
  }
  if(cnt == 1) {
    cout << "No" << endl;
    return 0;
  } else {
    cout << "Yes" << endl;
  }

  int b = n ^ 1 ^ a;

  for(int i=2;i<n;i+=2) {
    if(i == 2) cout << n+1 << " " << i << endl;
    cout << i << " " << i+1 << endl;
    cout << i+1 << " " << 1 << endl;
    cout << 1 << " " << n+i << endl;
    cout << n+i << " " << n+i+1 << endl;
  }

  if(n % 2 == 0) {
    if(a % 2) cout << n << " " << a << endl;
    else cout << n << " " << n + a << endl;

    if(b % 2) cout << 2*n << " " << b << endl;
    else cout << 2*n << " " << n + b << endl;
  }

}
























Measured memory_bytes: 2304
#include <bits/stdc++.h>
using namespace std;
int main(){
  long T,N,ans=0;
  cin >> N >> T;
  long t[N];
  for(int i=0;i<N;i++) cin >> t[i];
  for(int i=1;i<N;i++){
    long div;
    div = t[i] - t[i-1];
    ans += div < T ? div : T;
  }
  ans += T;
  cout << ans << endl;
  return 0;
}


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

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

	int N, M;
	scanf("%d %d", &N, &M);

	int A, day = 0;
	for (int i = 0; i < M; i++) {
		scanf("%d", &A);
		day += A;
	}
	if (N >= day) {
		printf("%d", N - day);
	} else {
		printf("-1");
	}

	return 0;
}

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

int main(){
    double a,b,x;
    cin>>a>>b>>x;
    double s=x/a;
    double rad;
    if(s>=a*b/2){
        double h=(a*b-s)*2/a;
        rad=atan2(h,a);
    }else{
        double w=s*2/b;
        rad=atan2(b,w);
    }
    double ans=rad/(2*acos(-1))*360;
    printf("%.10f\n",ans);
}

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

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

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

Measured memory_bytes: 3604
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<set>
#include<vector>

using namespace std;
const int N=2e5+10,inf=1e9;

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

int main(){
	int N,ans=0;
    cin >> N;
    vector<int> A(N);
    vector<int> L(N);
    vector<int> R(N);
    for(int i=0;i<N;i++){
        cin >> A[i];
    }
    L[0]=A[0];
    R[N-1]=A[N-1];
    for(int i=1;i<N-1;i++){
        L[i] = gcd(L[i-1], A[i]);
        R[N-i-1] = gcd(A[N-i-1], R[N-i]);
    }
    
    for(int i=1;i<N-1;i++){
        ans=max(ans, gcd(L[i-1], R[i+1]));
    }
    ans = max(ans, L[N-2]);
    ans = max(ans, R[1]);

	cout << ans << endl;
}


Measured memory_bytes: 1408
#include<iostream>
using namespace std;
int main(){
        int n;
        cin>>n;
        if(n==0){
                cout<<1<<endl;
        }else{
                int a[n+1];
                a[0]=1;
                a[1]=1;
                for(int i=2;i<n+1;i++)
                        a[i] = a[i-1]+a[i-2];
                cout<<a[n]<<endl;
        }
        return 0;
}


Measured memory_bytes: 3084
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using ll = long long ;
using vll = vector<ll> ;
using vvll = vector<vll> ;

int main(){
	ll h,w,n ;
	cin >> h >> w >> n ;
	vvll graph(h,vll(w,0)) ;
	vll a (n) ;
	bool right = true ;
	ll x,y ;
	x = y = 0 ;
	for(int i=1;i<=n;i++){
		ll num ; cin >> num ;
		for(int j=0;j<num;j++){
			graph.at(y).at(x) = i ;
			if(right){
				x++ ;
				if(x==w){
					x-- ; y++ ;
					right = false ;
				}
			}else{
				x-- ;
				if(x==-1){
					x++ ; y++ ;
					right = true ;
				}
			}
		}
	}
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			cout << graph.at(i).at(j) ;
			if(j==w-1) cout << endl ;
			else cout << " " ;
		}
	}
}



Measured memory_bytes: 512
var print = console.log;

function read_input(_input) {
    var lines = _input.split("\n");
    return function () {
        return lines.shift();
    };
}

String.prototype.dot = function dot(x) {
    var res = "";
    for (var i = 0; i < x; i++) {
        res += this.toString();
    }
    return res;
};

function IL(line, min1Flg) {
    var s = line.split(' ');
    var offset = min1Flg ? -1 : 0;
    var res = [];
    for (var i = 0; i < s.length; i++) {
        res.push(parseInt(s[i]));
    }
    return res;
}

function range(i, n) {
    var res = [];
    for (; i < n; i++) {
        res.push(i);
    }
    return res;
}

function IMAX(x, y) {
    return x > y ? x : y;
}

function IMIN(x, y) {
    return x < y ? x : y;
}

function item_getter_key(x) {
    return function (a, b) {
        if (a[x] < b[x]) return -1;
        else if (a[x] > b[x]) return 1;
        return 0;
    };
}

/*

(((???????????)??? ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

*/


// input?????\??????????????¨????????\???
function Main(_input) {
    var input = read_input(_input); // input = ?????????????????¢??°
    var N = input() - 0;
    for (var i = 0; i < N; i++) {
        var out = 0;
        var runner = 0;
        var pt = 0;
        while (out < 3) {
            var v = input();
            if (v === 'HIT') {
                runner++;
                if (runner === 4) {
                    pt++;
                    runner--;
                }
            } else if (v === 'HOMERUN') {
                pt += runner + 1;
                runner = 0;
            } else {
                out++;
            }
        }
        print(pt);
    }

}

//*???????????\????????¨??????????????§????????????????¨??????\????????????????????????????????????Main????????????????????????
 Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//Main(require("fs").readFileSync("input.txt", "utf8"));

Measured memory_bytes: 15228
h, w = map(int, raw_input().split())
a = [raw_input().strip() for _ in xrange(h)]
for i in xrange(h):
    if i % 2:
        print '#' * (w - 1) + '.'
    else:
        print '#' + a[i][1:]
print
for i in xrange(h):
    if i % 2:
        print a[i][:-1] + '#'
    else:
        print '.' + '#' * (w - 1)


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

typedef long long int ll;
typedef unsigned long long int ull;
#define rep(i,n) for(auto i=0;i<(n);i++)
#define rep1(i,n) for(auto i=1;i<=(n);i++)
#define all(x) (x).begin(),(x).end()

using namespace std;


struct init{ init(){ cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20); }; }aaaaaaa;


vector<vector<bool>> solve(int n){
    vector<vector<bool>> g(n, vector<bool>(n, false));

    int d = 1+n;
    rep(src, n){
        rep(sink, n){
            if(src+1 + sink+1 != d){
                g[src][sink] = true;
            }
        }
    }

    return g;
}

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


    vector<vector<bool>> g;

    if(n%2 == 0){
        g = solve(n);
    }
    else{
        vector<vector<bool>> gg = solve(n-1);
        rep(i, n-1) gg[i].push_back(true);
        gg.push_back(vector<bool>(n, true));
        g = gg;
    }

    vector<pair<int, int>> res;
    rep(src, n){
        for(int sink = src+1; sink < n; sink++){
            if(g[src][sink]) res.push_back({src+1, sink+1});
        }
    }
    
    cout << res.size() << endl;
    for(auto p : res){
        cout << p.first << " " << p.second << endl;
    }
    
    return 0;
}

Measured memory_bytes: 384
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define np next_permutation
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define pi acos(-1.0)
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
ll jou(ll N, ll P){if(P==0) return 1;
    if(P%2==0){ll t = jou(N, P/2);return t*t % mod;
    }return (N * jou(N, P-1)) % mod;}  //jou(n,mod-2)で逆元
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'0'+=16;        で大文字に
//'大文字'+=32;    で小文字に
//  cout << fixed << setprecision (20);   小数点以下2０桁まで
//実行時間制約2秒では２×10^8回くらいまで計算できる


struct UF {
    vector <ll> par; // 各元の親を表す配列
    vector <ll> siz; // 素集合のサイズを表す配列(1 で初期化)

    UF(ll sz_): par(sz_), siz(sz_, 1LL) {
        for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
    }
    void init(ll sz_) {
        par.resize(sz_);
        siz.assign(sz_, 1LL);
        for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
    }

    ll root(ll x) { // 根の検索
        while (par[x] != x) {
            x = par[x] = par[par[x]]; // x の親の親を x の親とする
        }
        return x;
    }

    bool unite(ll x, ll y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        // merge technique（データ構造をマージするテク．小を大にくっつける）
        if (siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

    bool same(ll x, ll y) { // 連結判定
        return root(x) == root(y);
    }

    ll size(ll x) { // 素集合のサイズ
        return siz[root(x)];
    }
};


int main() {
  int n,m;
  cin >>n>>m;
    
  vector<ll> p(m);
  vector<ll> q(m);
  
  rep(i,m){
  cin>>p[i]>>q[i];
  }
  
  int ans=0;
  rep(i,m){
    int cnt=0;
    UF uf(n);
    rep(j,m){
      if(i!=j) uf.unite(p[j]-1,q[j]-1);
    }
    
    rep(k,n){
      if(uf.root(k)==k) cnt++;
    }
    if(cnt==2) ans++;    
  }
  
  cout << ans << endl;
  
}

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

int main(){
  int A,B;
  cin>>A>>B;
  int x=(A*100-1)/8+1;
  int y=(B*100-1)/10+1;
  int upper=min(((A+1)*100-1)/8+1,((B+1)*100-1)/10+1);

  int ans=max(x,y);
  if(ans<upper){
    cout<<ans<<endl;
  }else{
    cout<<-1<<endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
#define llint long long

using namespace std;

llint x, y;

int main(void)
{
	cin >> x >> y;
	
	llint ans = 0, val = x;
	while(val <= y){
		ans++;
		val *= 2;
	}
	
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <array>
#include <vector>
#include <iomanip>
#include <string>
#include <cmath>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
using namespace std;

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

const LL  INF=1<<31;
const LL MOD=1000000007;



int main(){
    char a,b;
    cin>>a>>b;
    if(a=='H')cout<<b<<endl;
    else if(b=='H')cout<<'D'<<endl;
    else cout<<'H'<<endl;
}


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


int main(){
string a,b;
  cin>>a>>b;
string c=a+b;
int d=stoi(c);
int ok=0;
  for(int i;i<d;i++){
    if(i*i==d)ok=1;
  }
  if(ok==1){
  cout<<"Yes"<<endl;
  }else{
   cout<<"No"<<endl; 
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <algorithm>

using namespace std;

int main() {
    string t,h;
    int n{0}, tp{0}, hp{0};
    cin >> n;
    while(cin >> t >> h){
        if (lexicographical_compare(t.begin(),t.end(),h.begin(),h.end())){
            tp+=3;
        }
        else if (t==h){
            tp++;
            hp++;
        }
        else{
            hp+=3;
        }
    };
    cout << hp << " " << tp << endl;
}


Measured memory_bytes: 3204
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <string>
#include <cmath>
#include <iomanip>
#include <numeric>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

int main()
{
    int h, w, tate[110] = {}, yoko[110] = {};
    char a[110][110];
    cin >> h >> w;
    REP(i, h)
    {
        bool all = true;
        REP(j, w)
        {
            cin >> a[i][j];

            if (a[i][j] == '#')
                all = false;
        }

        if (all)
            yoko[i] = 1;
    }

    REP(j, w)
    {
        bool all = true;
        REP(i, h)
        {
            if (a[i][j] == '#')
                all = false;
        }
        if (all)
            tate[j] = 1;
    }

    REP(i, h)
    {
        if (yoko[i] == 1)
            continue;

        REP(j, w)
        {
            if (tate[j] == 0)
                cout << a[i][j];
        }
        cout << endl;
    }

    return 0;
}

Measured memory_bytes: 256
import java.util.*;
class Main{
	public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
      int tempInt = 0;
      int sum = 0;
      int div=0;
      int min=10;
      for(int i = 0;i<5;i++){
        tempInt = sc.nextInt();
        div = tempInt%10;
        if(div==0){
          sum+= tempInt;
        }else{
          sum+= (int)(tempInt/10)*10+10;
          if(div<min)
            min=div;
        }
      }
      System.out.println(sum-10+min);
    }
}

Measured memory_bytes: 21972
package main

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

var (
	reader io.Reader = os.Stdin
	writer io.Writer = os.Stdout
)

func main() {
	reader = os.Stdin
	writer = os.Stdout
	run()
}

func run() {
	var res []string
	secs := readIntsFromStdin()[0][0]

	mins, secs := secs/60, secs%60
	hours, mins := mins/60, mins%60

	res = append(res, strconv.Itoa(hours))
	res = append(res, strconv.Itoa(mins))
	res = append(res, strconv.Itoa(secs))

	fmt.Fprintln(writer, strings.Join(res, ":"))
}

// ReadInts parses lines of inputs into 2D int array.
func readIntsFromStdin() [][]int {
	out := [][]int{}
	scanner := bufio.NewScanner(reader)

	for scanner.Scan() {
		var ints []int

		for _, s := range strings.Split(scanner.Text(), " ") {
			i, err := strconv.Atoi(s)

			if err != nil {
				fmt.Fprintln(os.Stderr, "Failed to parse string into int.", err)
				os.Exit(1)
			}

			ints = append(ints, i)
		}

		out = append(out, ints)
	}

	return out
}



Measured memory_bytes: 1132
#include<iostream>
#include<string>
using namespace std;
int main()
{
    string s;
    int apos, zpos;
    cin >> s;
    for(apos = 0; ; apos++){
        if(s[apos] == 'A') break;
    }
    for(zpos = s.size() - 1; ; zpos--){
        if(s[zpos] == 'Z') break;
    }
    cout << zpos - apos + 1;
    return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<climits>
#include<queue>
#include<map>
#include<set>
#include<vector>
#include<list>
#include<stack>
#include<cstring>
#include<string>
#include<cmath>
using namespace std;

struct Coor{
	double x,y;
};

struct Ans2{
	double l,m;
};

struct Ans3{
	double l,m,n;
	Ans3(Ans2 a){
		l=a.l; m=a.m;
	}
};

Ans2 solve2(double l[2],double m[2],double n[2]){
	/*for(int i=0;i<2;i++){
		printf("(%lfl)+(%lfm)+n = (%lf)\n",l[i],m[i],n[i]);
	}*/
	Ans2 ans;
	double a,b;
	a = l[0]*m[1]-l[1]*m[0]; b = n[0]*m[1]-n[1]*m[0];
	ans.l = b/a;
	//printf("%lfx = %lf\n",a,b);
	a = m[0]*l[1]-m[1]*l[0]; b = n[0]*l[1]-n[1]*l[0];
	ans.m = b/a;
	//printf("%lfy = %lf\n",a,b);
	return ans;
}

Ans3 solve3(double l[3],double m[3],double n[3]){
	double _l[2],_m[2],_n[2];
	_l[0] = l[0]-l[1]; _l[1] = l[0]-l[2];
	_m[0] = m[0]-m[1]; _m[1] = m[0]-m[2];
	_n[0] = n[0]-n[1]; _n[1] = n[0]-n[2];
	Ans3 ans = Ans3(solve2(_l,_m,_n));
	ans.n = n[0]-(l[0]*ans.l+m[0]*ans.m);
	return ans;
}

int main(){
	int N;
	cin>>N;
	for(int i=0;i<N;i++){
		Coor in[3];
		double l[3],m[3],n[3];
		for(int i=0;i<3;i++){
			cin>>in[i].x>>in[i].y;
			l[i] = in[i].x;
			m[i] = in[i].y;
			n[i] = -(in[i].x*in[i].x+in[i].y*in[i].y);
			//printf("(%lfl)+(%lfm)+n = (%lf)\n",l[i],m[i],n[i]);
		}
		Ans3 ans3 = solve3(l,m,n);
		//printf("l = %lf, m = %lf, n = %lf\n",ans3.l,ans3.m,ans3.n);
		double r = sqrt(-(ans3.n-ans3.l/2*ans3.l/2-ans3.m/2*ans3.m/2));
		printf("%.3lf %.3lf %.3lf\n",-ans3.l/2,-ans3.m/2,r);
	}
}

Measured memory_bytes: 1244