akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <math.h>

int main(void)
{
  int n;
  int sum;
  int i;
  while(1){
    scanf("%d",&n);
    if(n==0)
      break;
    sum=1;
    for(i=2;i<=sqrt((double)n);i++){
      if(n%i==0){
	if(i!=n/i)
	  sum+=(i+(n/i));
	else
	  sum+=i;
      }
    }
    
    if(n>sum||n==1)
      printf("deficient number\n");
    else if(n==sum)
      printf("perfect number\n");
    else
      printf("abundant number\n");
  }

  return 0;
}

Measured memory_bytes: 584
#include <bits/stdc++.h>
using namespace std;
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef pair<int, int> Pint;
typedef pair<int64_t, int64_t> Pll;

int main() {
    int N, a;
    cin >> N;
    vector<vector<int>> hxy(N, vector<int> (3));
    for (int i = 0; i < N; i++) {
        cin >> hxy.at(i).at(1) >> hxy.at(i).at(2) >> hxy.at(i).at(0);
    }
    sort(rALL(hxy));

    for (int i = 0; i < 101; i++) {
        for (int j = 0; j < 101; j++) {
            for (int k = 0; k < N; k++) {
                
                if (k == 0) {
                    a = hxy.at(k).at(0) + abs(hxy.at(k).at(1) - i) + abs(hxy.at(k).at(2) - j);
                    continue;
                }
                if (hxy.at(k).at(0) != max(a - (abs(hxy.at(k).at(1) - i) + abs(hxy.at(k).at(2) - j)), 0)){
                    break;
                }
                if (k == N - 1) {
                    cout << i << " " << j << " " << a << endl;
                    return 0;
                }

            }
        }
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define range(i, l, r) for(int (i) = (l); (i) < (r); (i)++)
#define reversed_range(i, l, r) for (int (i) = (r) - 1; (i) >= l; (i)--)
using namespace std;
template <typename T>
using vec = vector<T>;
using lint = long long;
using ulint = unsigned long long;
using pint = pair<int, int>;
using plint = pair<lint, lint>;

template <typename S, typename T>
ostream& operator <<(ostream& os, pair<S, T> p) {
    os << "(";
    os << p.first << ", " << p.second;
    return os << ")";
}

template <typename T>
ostream& operator <<(ostream& os, vec<T> v) {
    os << "[";
    for (int i = 0; i < v.size() - 1; i++) {
        os << v.at(i) << ", ";
    }
    return os << v.at(v.size() - 1) << "]";
}

template <typename T>
ostream& operator <<(ostream& os, set<T>& s) {
    os << "{";
    auto it_first_item = s.begin();
    cout << *it_first_item;
    for (auto it = ++it_first_item; it != s.end(); it++) {
        cout << ", " << *it;
    }
    return cout << "}";
}

template <typename T>
ostream& operator <<(ostream& os, unordered_set<T>& s) {
    os << "{";
    auto it_first_item = s.begin();
    cout << *it_first_item;
    for (auto it = ++it_first_item; it != s.end(); it++) {
        cout << ", " << *it;
    }
    return cout << "}";
}

template <typename K, typename V>
ostream& operator <<(ostream& os, map<K, V> m) {
    os << "{";
    auto it_first_item = m.begin();
    cout << it_first_item->first << ": " << it_first_item->second;
    for (auto it = ++it_first_item; it != m.end(); it++) {
        cout << ", " << it->first << ": " << it->second;
    }
    return os << "}";
}

template <typename K, typename V>
ostream& operator <<(ostream& os, unordered_map<K, V> m) {
    os << "{";
    auto it_first_item = m.begin();
    cout << it_first_item->first << ": " << it_first_item->second;
    for (auto it = ++it_first_item; it != m.end(); it++) {
        cout << ", " << it->first << ": " << it->second;
    }
    return os << "}";
}

int main() {
    cin.tie(0); cout.tie(0);
    ios::sync_with_stdio(false);
    int A, P;
    cin >> A >> P;
    cout << (3 * A + P) / 2 << "\n";
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <cmath>

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

char str[500];

int main()
{
	scanf("%s",&str);
	int n=strlen(str);
	for(int i=0;i<n-8;i++)
	{
		printf("%c",str[i]);
	}puts("");
	return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <vector>
#include <queue>

#define AS(a) (sizeof(a)/sizeof(a[0]))
using namespace std;
long long int MOD = 1000000007;

int main() {
  int n;
  cin >> n;
  string S[n];
  for(int i = 0; i < n; i++) {
    cin >> S[i];
  }
  int cou[26];
  for(int i = 0; i < n; i++) {
    int cc[26];
    for(int j = 0; j < 26; j++) {
      cc[j] = 0;
    }
    for(int j = 0; j < S[i].length(); j++) {
      cc[S[i][j] - 'a']++;
    }
    if(i != 0) {
      for(int j = 0; j < 26; j++) {
        cou[j] = min(cou[j],cc[j]);
      }
    } else {
      for(int j = 0; j < 26; j++) {
        cou[j] = cc[j];
      }
    }
  }
  for(int i = 0; i < 26; i++) {
      for(int j = 0; j < cou[i]; j++) {
        cout << (char)('a' + i);
      }
  }
  cout << endl;

}


Measured memory_bytes: 256
#include<stdio.h>

int main(void){
    char s[5];
    scanf("%s",s);
    if(s[0]==s[1] && s[2]==s[3] && s[0]!=s[2]){
        printf("Yes\n");
    }else if(s[0]==s[2] && s[1]==s[3] && s[0]!=s[1]){
        printf("Yes\n");
    }else if(s[0]==s[3] && s[1]==s[2] && s[0]!=s[1]){
        printf("Yes\n");
    }else{
        printf("No\n");
    }
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    int row, col;
    cin>>row>>col;
    ll RC = (ll)row*col;
    if((ll)RC%2==0 && row>1 && col>1)
        cout<<(ll)(RC/2)<<endl;
    else if((ll) RC%2 !=0 && row>1 && col>1)
        cout<<(ll)(RC/2)+1<<endl;
        else cout<<1<<endl;
}


Measured memory_bytes: 256
mod = 1000000007
n = int(input())
s = input()
abets ="abcdefghijklmnopqrstuvwxyz"
counts = []
for c in abets:
  counts.append(s.count(c))
ans = 0
for cnt in counts:
  if cnt != 0:
    ans = (ans + ans*cnt + cnt) % mod
print(ans)

Measured memory_bytes: 3188
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.AbstractMap;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) {
		FastScanner sc = new FastScanner(System.in);
		PrintWriter out = new PrintWriter(System.out);

		solve(sc,out);

		out.flush();
	}

	public static void solve(FastScanner sc, PrintWriter out) {
		int n = sc.nextInt();
		int m = sc.nextInt();
		
		out.println((n-1)*(m-1));
	}

	public static int gcd(int a, int b) {
		if(a < b) return gcd(b, a);
		if(b == 0) return a;
		return gcd(b, a % b);
	}

	public static long gcd(long a, long b) {
		if(a < b) return gcd(b, a);
		if(b == 0) return a;
		return gcd(b, a % b);
	}

	public static int lcm(int a, int b) {
		return (a * b) / gcd(a, b);
	}
}

class Pair<K, V> extends AbstractMap.SimpleEntry<K, V> {

    public Pair(final K key, final V value) {
        super(key, value);
    }

    public Pair<V, K> swap() {
    	return new Pair<V, K>(getValue(), getKey());
    }
 }

class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;

    public FastScanner(InputStream in) {
        reader = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }

    public String next() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public String nextLine() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }

        return tokenizer.nextToken("\n");
    }

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

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

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

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

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

Measured memory_bytes: 21332
import math
import bisect
import collections
import itertools
def gcd(a,b):return math.gcd #最大公約数
def lcm(a,b):return (a*b) // math.gcd(a,b) #最小公倍数
def iin(): return int(input()) #整数読み込み
def imn(): return map(int, input().split()) #整数map取得
def iln(): return list(map(int, input().split())) #整数リスト取得
def iln_s(): return sorted(iln()) # 昇順の整数リスト取得
def iln_r(): return sorted(iln(), reverse=True) # 降順の整数リスト取得
def join(l, s=''): return s.join(l) #リストを文字列に変換
def perm(l, n): return itertools.permutations(l, n) # 順列取得
def comb(l, n): return itertools.combinations(l, n) # 組み合わせ取得
def divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    return divisors

A,B,K = imn()

if A >= K:
    A -= K
else:
    K -= A
    A = 0
    B = max(0, B-K)


print(str(A) + ' ' + str(B))

Measured memory_bytes: 3444
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define _USE_MATH_DEFINES
#include <math.h>
#define rep(i,n) for(int i = 0;i < n;i++)
#define NIL = -1;

int digit(ll x) {
    if (x / 10 == 0) return 1;
    return digit(x / 10) + 1;
}

ll gcd(long long a,long long b) {
    if (a < b) swap(a,b);
    if (b == 0) return a;
    
    return gcd(b,a%b);
}

ll lcm(ll a,ll b){
    a / gcd(a,b) * b;
}
const ll mod = 1e9 + 7;
const ll INF = 1e9 + 7;

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


/////////////////////////////////////////////////////////////////////////////////////////
int main(){
    int n,m;
    cin >> n >> m;
    vector<tuple<ll,ll,ll>> p(m);
    for (int i = 0;i < m;i++){
        int P,Y;
        cin >> P >> Y;
        p[i] = make_tuple(Y,P,i);
    }
    vector<tuple<int,int,int>> ans(m);
    sort(p.begin(),p.end());
    vector<int> cnt(n+1);
    for (int i = 0;i < m;i++){
        cnt[get<1>(p[i])]++;
        ans[i] = make_tuple(get<2>(p[i]),get<1>(p[i]),cnt[get<1>(p[i])]);
    }
    sort(ans.begin(),ans.end());

    for (int i = 0;i < m;i++){
        cout << setfill('0') << right << setw(6) << get<1>(ans[i])<< setfill('0') << right << setw(6) << get<2>(ans[i])<< endl;
    }

}

Measured memory_bytes: 5504
#include<stdio.h>
#include<iostream>
#include<math.h>
#include<string>
#include<vector>
#include<map>
#include<queue>
#include<cmath>
using namespace std;
using ll = long long int;

typedef pair<int,int> P;

P p(int x){
    int a=x%10;
    int b=0;
    while(x!=0){
        b=x;
        x=x/10;
    }
    return P(a,b);
}


int main(void){
    int n;
    cin >> n;
    map<P,int> q;
    for(int i=1;i<=n;i++){
        P pre=p(i);
        q[pre]++;
        //cout << q[pre]<<endl;
    }
    ll ans = 0;
    for(int i=1;i<=n;i++){
        P pre=p(i);
        pair<int,int> ret(pre.second,pre.first);
        //cout << q[ret] <<endl;
        ans+=q[ret];
    }
    cout << ans <<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
	int N;
	cin >> N;
	int min = 0;
	long long int max = 10000000000;


	vector<int>A(N);
	for (int i = 0; i < N; ++i) {
		cin >> A[i];
		if (min <= A[i])
			min = A[i];
		if (A[i] <= max)
			max = A[i];
	}
	cout << min - max << endl;
	
	

}

Measured memory_bytes: 256
#pragma warning(disable : 4996)
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#include<unordered_map>
#define endl                         '\n'	
#define Ceil(x,y)             ((x+y-1)/y)
#define sz(s)               (int)s.size()
#define RT(x)           return cout<<x,0;
#define mem(x,y)    memset(x,y,sizeof(x))
#define all(v) ((v).begin()), ((v).end())
#define vi                    vector<int>
#define pii                 pair<int,int>
#define forr(i, n) for (int i =0; i <int(n); i++)
int dx[] = { 0, 0, 1, -1, 1, -1, 1, -1 };
int dy[] = { 1, -1, 0, 0, -1, 1, 1, -1 };
const double EPS = 1e-7;
const int N = 1e7 + 5, mod = 1e9 + 7;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
//ll gcd(ll x, ll y) { return (!y) ? x : gcd(y, x%y); }
//ll lcm(ll x, ll y) { return ((x / gcd(x, y))*y); }
#define ll	long long
using namespace std;
/*void fast()
{
std::ios_base::sync_with_stdio(0);
cin.tie(NULL);
cout.tie(NULL);

#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
}*/
int arr[100000];
int main()
{
	//fast();
	int n, c = 0, a = 0;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> arr[i];

	}
	for (int i = n-1; i >0 ; i--)
	{
		if (arr[i] < arr[i - 1]) arr[i-1]--;
	}

	int y = 0;
	for (int i = 0; i < n-1 ; i++)
	{
		if (arr[i] > arr[i+ 1])
		{
			y = 1; break;
		}

	}
	if (y == 1) cout << "No";
	else cout << "Yes";
}


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

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int N = 2 * 1e5 + 3;

int main() {
  string s;
  int q, x, f, cnt = 0;
  char c;
  cin >> s >> q;

  deque<int> que;
  rep(i, s.size()) que.push_back(s[i]);

  rep(i, q) {
    cin >> x;
    if (x == 1)
      cnt++;
    else {
      cin >> f >> c;
      if (cnt % 2 == 0) {
        if (f == 1) {
          que.push_front(c);
        } else {
          que.push_back(c);
        }
      } else {
        if (f == 1) {
          que.push_back(c);
        } else {
          que.push_front(c);
        }
      }
    }
  }

  char ac;
  while (que.size()) {
    if (cnt % 2 == 1)
      ac = que.back(), que.pop_back();
    else
      ac = que.front(), que.pop_front();
    cout << ac;
  }
  cout << endl;

  return 0;
}


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

int main(){
  int N;
  int list[210];
  
  cin >> N;
  for(int i=0; i<N; i++){
  cin >> list[i] ;
  }
  
  int count =0;

  
  while(true){
      bool flag =false;
    for(int i=0; i<N; i++){
      if(list[i]%2 != 0) flag=true;
    }
      if(flag) break;
        
    for(int j=0; j<N; j++){
      list[j] =  list[j]/2;
      }
          count = count +1 ;  
  }
    
  cout << count << endl;
  }

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

#define Vsort(a) sort(a.begin(), a.end())
#define Vreverse(a) reverse(a.bigin(), a.end())
#define Srep(n) for(int i = 0; i < (n); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define Lrep(i,a,n) for(int i = (a); i < (n); i++)
#define vi vector<int>
#define vi64 vector<int64_t>
#define vvi vector<vi>
#define vvi64 vector<vi64>
 
using namespace std;

int main(){
  int a,b,c,d;
  bool ans;
  cin >> a >> b >> c >> d;
  while(true){
    c -= b;
    if(c <= 0){
      ans = true;
      break;
    }
    a -= d;
    if(a <= 0){
      ans = false;
      break;
    }
  }
  ans ? cout << "Yes" << endl : cout << "No" << endl;
}


Measured memory_bytes: 3640
// C++ 14
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)

int main() {
  ll n;
  cin >> n;
  vector<ll> A(n);
  loop(i,0,n) cin >> A[i];
  map<ll, ll> M;
  for (auto&& a: A) M[a]++;
  sort(A.begin(), A.end());
  A.erase(unique(A.begin(), A.end()), A.end());
  n = A.size();
  reverse(A.begin(), A.end());
  ll prev = -1;
  ll max_ = 0;
  for (auto &&a: A) {
    if (M[a] <= 1) continue;
    if (M[a] >= 4) {
      max_ = max(max_, a*a);
    }
    max_ = max(max_, prev*a);
    prev = a;
  }
  cout << max_ << endl;
  return 0;
}


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

int main() {
    int a, b; cin >> a >> b;
    int ans = a * (a - 1) / 2 + b * (b - 1) / 2;
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define P pair<int,int>
#define All(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
typedef long long ll;
using namespace std;
const int INF = 1e9, MOD = 1e9 + 7;
const ll LINF = 1e18;
bool hate[10];
bool check(long long n) {
	while (n) {
		if (hate[n % 10]) {
			return false;
		}
		n /= 10;
	}
	return true;
}
int main() {
	int n, k;
	cin >> n >> k;
	int d[k];
	for (int i = 0; i < k; i++) {
		cin >> d[i];
		hate[d[i]] = true;
	}
	for (int i = n; i < 10 * n; i++) {
		if (check(i)) {
			cout << i << endl;
			return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
#include <cstdio>
#include <sstream>
#include <cstdlib>
#include <cctype>
#include <cmath>
#include <algorithm>
#include <set>
#include <queue>
#include <stack>
#include <list>
#include <iostream>
#include <fstream>
#include <numeric>
#include <string>
#include <vector>
#include <cstring>
#include <map>
#include <iterator>
typedef long long ll;
#define f(i,a,b) for(i=a;i<b;i++)
using namespace std;
int main()
{
    ll n,i,mini=1000000000000;
    cin>>n;
    ll a[n],b[n];
    cin>>a[0];
    f(i,1,n){cin>>a[i];a[i]+=a[i-1];}
    f(i,0,n)b[i]=a[n-1]-a[i];
    //f(i,0,n)cout<<a[i]<<" "<<b[i]<<endl;
    f(i,0,n-1)mini=min(mini,abs(a[i]-b[i]));
    cout<<mini<<endl;

    return 0;
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(a,b) for(int a=0;a<(b);++a)
#define REP1(i,n) for(int i=1;i<=(n);++i)
#define debug(x) cerr<<#x<<": "<<x<<'\n'
#define all(x) (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define isYES(x) printf("%s\n",(x) ? "YES" : "NO")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define isYes(x) printf("%s\n",(x) ? "Yes" : "No")
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair
#define INF (1<<29)
#define Sp(p) cout<<setprecision(25)<< fixed<<p<<endl
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
#define X first
#define Y second
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;


template<class T=int>
T in(){T x;cin>>x;return (x);}
template<class T>
void print(T& x){cout<<x<<'\n';}

const int MOD =(int)1e9+7;
const int MAX =510000;
ll fac[MAX],finv[MAX],inv[MAX];
void COMint(){
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    for(int i=2;i<MAX;i++){
        fac[i]=fac[i-1]*i%MOD;
        inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
        finv[i]=finv[i-1]*inv[i]%MOD;
    }
}
ll COM(int n,int k){
    if(n<k) return 0;
    if(n<0||k<0)return 0;
    return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;
}
ll gcd(ll a,ll b){
    if(b==0)return a;
    if(a>b){
        swap(a,b);
    }
    return gcd(a,b%a);
}
ll lcm(ll a,ll b){
    ll g;g=gcd(a,b);
    return a*b/g;
}
bool compare_by_b(pair<int, int> a, pair<int, int> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}

bool compare_by_a(pair<int, int> a, pair<int, int> b) {
    if(a.first != b.first){
        return a.first < b.first;
    }else{
        return a.second < b.second;
    }
}
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

ll RS(ll N,ll P,ll M){
    if(P==0){
        return 1;
    }else{
        if(P%2==0){
            ll t=RS(N,P/2,M);
            return t*t%M;
        }else{
            return N*RS(N,P-1,M)%M;
        }
    }
}
//整数iの1への最小経路を求めるDFS
void DFS(int i,int v){
    
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N=in();
    string S=in<string>();
    int l=0;
    string ans;
    REP(i,N){
        if(S[i]==')'){
            l-=1;
        }else{
            if(l<0){
                REP(i,-l)ans="("+ans;
                l=0;
            }
            l++;
        }
        ans+=S[i];
    }

    if(l>0){
        REP(i,l)ans+=")";
    }else if(l<0){
        REP(i,-l){
            ans="("+ans;
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <string>

#include<stdio.h>
#include<math.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>

using namespace std;

int main(){

  double x1,x2,y1,y2;
  double ans;

  scanf("%lf %lf %lf %lf",&x1,&y1,&x2,&y2);

  ans=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));

  printf("%.8f\n",ans);

  return 0;
}

Measured memory_bytes: 1240
local n, m = io.read("*n", "*n")
local edge = {}
local edgeidx = {}
for i = 1, n do
  edge[i] = {}
  edgeidx[i] = {}
end
local edgeuse = {}
for i = 1, m do
  edgeuse[i] = false
  local a, b, c = io.read("*n", "*n", "*n")
  edge[a][b] = c
  edgeidx[a][b] = i
  edge[b][a] = c
  edgeidx[b][a] = i
end
local inf = 1000000007
local len = {}
local asked = {}
local function getpos()
  local cand = 0
  for i = 1, n do
    if not asked[i] then
      if cand == 0 or len[i] < len[cand] then
        cand = i
      end
    end
  end
  return cand
end
local function solve(spos)
  for i = 1, n do
    asked[i] = false
    len[i] = i == spos and 0 or inf
  end
  for i = 1, n do
    local src = getpos()
    asked[src] = true
    for dst, cost in pairs(edge[src]) do
      if len[dst] + cost == len[src] then
        edgeuse[edgeidx[dst][src]] = true
      end
      if len[src] + cost < len[dst] then
        len[dst] = len[src] + cost
      end
    end
  end
end

for i = 1, n do
  solve(i)
end

local ret = 0
for i = 1, m do
  if not edgeuse[i] then ret = ret + 1 end
end
print(ret)


Measured memory_bytes: 760
#include <cstdio>
#include <cctype>
#define repu(i,x,y) for (int i=x; i<=y; ++i)
using namespace std;

int n,a[3010];
struct edge
{
    int u,v,flag;
    edge *nxt;
    bool check();
} pool[6010],*tp=pool,*fst[3010];

int getint()
{
    char ch;
    while (!isdigit(ch=getchar()));
    int x=ch-'0';
    for (; isdigit(ch=getchar()); x=x*10+ch-'0');
    return x;
}

bool edge::check()
{
    if (flag>-1)
        return flag;
    edge **lst=&fst[v];
    for (edge *i=fst[v]; i; i=i->nxt)
        if (i->v!=u)
            if (i->check() || a[v]<=a[i->v])
                *lst=i->nxt;
            else
                return flag=1;
        else
            lst=&i->nxt;
    return flag=0;
}

int main()
{
    n=getint();
    repu(i,1,n)
        a[i]=getint();
    repu(i,2,n)
    {
        int u=getint(),v=getint();
        *tp=(edge){u,v,-1,fst[u]},fst[u]=tp++;
        *tp=(edge){v,u,-1,fst[v]},fst[v]=tp++;
    }
    repu(i,1,n)
    {
        edge t=(edge){0,i,-1,0};
        if (t.check())
            printf("%d ",i);
    }
    return 0;
}

Measured memory_bytes: 384
package main

import (
	"container/heap"
	"fmt"
)

type Vacation struct {
	Priority int // The priority of the item in the queue.
}

type PriorityQueue []*Vacation

func (pq PriorityQueue) Len() int { return len(pq) }

func (pq PriorityQueue) Less(i, j int) bool {
	return pq[i].Priority > pq[j].Priority
}

func (pq PriorityQueue) Swap(i, j int) {
	pq[i], pq[j] = pq[j], pq[i]
}

func (pq *PriorityQueue) Push(x interface{}) {
	vacation := x.(*Vacation)
	*pq = append(*pq, vacation)
}

func (pq *PriorityQueue) Pop() interface{} {
	old := *pq
	n := len(old)
	vacation := old[n-1]
	*pq = old[0 : n-1]
	return vacation
}

func main() {
	var N, M, A, B, sum int
	fmt.Scan(&N, &M)

	m := map[int][]int{}
	for i := 0; i < N; i++ {
		fmt.Scan(&A, &B)
		m[A] = append(m[A], B)
	}

	var pq PriorityQueue
	heap.Init(&pq)
	for i := 0; i <= M; i++ {
		for j := 0; j < len(m[i]); j++ {
			heap.Push(&pq, &Vacation{Priority: m[i][j]})
		}
		if pq.Len() == 0 {
			continue
		}
		w := heap.Pop(&pq).(*Vacation)
		sum += w.Priority
	}
	fmt.Println(sum)
}


Measured memory_bytes: 12288
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
    	
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int N = sc.nextInt();

		ArrayList<Integer> ls4 = new ArrayList<Integer>();

		for (int i = 0; i < N;i ++ ){
			// 重りを入力
			ls4.add( sc.nextInt());
		}

		int ans_a = 0;
		int ans_b = 0;//合計
		int T = 0;
		int min = 999999999;
		int ans = 0;
		
		while (T < N) {
			for (int i = 0; i < N;i ++ ){
				if(i < T){
					ans_a = ans_a + ls4.get(i);
				}else{
					ans_b = ans_b + ls4.get(i);
				}
			}
			if(min > Math.abs(ans_a - ans_b)){
				min = Math.abs(ans_a - ans_b);
				ans = T;
			}
			T ++;
			ans_a = 0;
			ans_b = 0;
		}
	    
		System.out.println(min);

   		sc.close();
        return ;

    }
    
}



Measured memory_bytes: 23636
A = {i-97:chr(i) for i in range(97,123)}
B = {v:k for k,v in A.items()}
s = list(input().strip())
K = int(input())
for i in range(len(s)-1):
    if s[i]!="a" and K>=26-B[s[i]]:
        K -= (26-B[s[i]])
        s[i]="a"
k = K%26
ind = (B[s[-1]]+k)%26
s[-1] = A[ind]
print("".join(s))

Measured memory_bytes: 77176
n = int(input())
s = input()

ans = list()

for i in range(len(s)):
    cnt = 0
    x = sorted(set(s[:i]), key=s.index)
    y = sorted(set(s[i:]), key=s.index)
    for j in x:
        if j in y:
            cnt += 1
    ans.append(cnt)

print(max(ans))

Measured memory_bytes: 3064
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    SA = list(input())
    SB = list(input())
    SC = list(input())
    card = 'a'
    while True:
        if card == 'a':
            if len(SA) == 0:
                break
            card = SA.pop(0)
        elif card == 'b':
            if len(SB) == 0:
                break
            card = SB.pop(0)
        elif card == 'c':
            if len(SC) == 0:
                break
            card = SC.pop(0)
    print(card.upper())


if __name__ == "__main__":
    main()


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

#define d(x) cerr << #x ":" << x << endl;
#define dd(x, y) cerr << "(" #x "," #y "):(" << x << "," << y << ")" << endl
#define rep(i, n) for (int i = (int)(0); i < (int)(n); i++)
#define repp(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define all(v) v.begin(), v.end()
#define dump(v)                  \
    cerr << #v ":[ ";            \
    for (auto macro_vi : v) {    \
        cerr << macro_vi << " "; \
    }                            \
    cerr << "]" << endl;
using lint       = long long;
const int INF    = 1e9;
const lint LINF  = 1e18;
const lint MOD   = 1e9 + 7;
const double EPS = 1e-10;

int main() {
    int n, m;
    cin >> n >> m;
    vector<pair<int, string>> v(m, make_pair(0, ""));

    rep(i, m) { cin >> v[i].first >> v[i].second; }
    set<int> appear{};
    int idx = 0;
    vector<int> wa(n, 0);
    while (idx < m) {
        if (appear.count(v[idx].first - 1) == 0) {
            if (v[idx].second == "WA") {
                wa[v[idx].first - 1]++;
            } else {
                appear.insert(v[idx].first - 1);
            }
        }
        // dump(wa);
        idx++;
    }

    int wa_sum = 0;
    for (int i = 0; i < n; i++) {
        if (appear.count(i) != 0) { wa_sum += wa[i]; }
    }
    cout << appear.size() << " " << wa_sum << endl;

    return 0;
}

Measured memory_bytes: 11520
#include <iostream>
#include <vector>
#include <algorithm> // sort
#include <map> // pair
#include <numeric> // accumulate(begin,end,初期値)

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

using namespace std;
typedef long long ll;

int main(){
  string s;
  cin>>s;
  int days = s.size();
  int win = 0;
  for(int i = 0;i < s.size();i++){
    if(s[i] == 'o')win++;
  }
  days -= win;
  int ans = 15 - days;
  if(ans >= 8)cout<<"YES"; else cout<<"NO"; 
  return 0;
}


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

int N, W, sum = 0, ans = 0, w[101], v[101];
ll dp[101][100001];
 
signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cin >> N >> W;
	for(int i = 1; i <= N; i++) {
		cin >> w[i] >> v[i];
		sum += v[i];
	}
	for(int i = 1; i <= N; i++) {
		for(int j = 1; j <= sum; j++) {
			if (j >= v[i] && (dp[i - 1][j - v[i]] || j == v[i])) {
				dp[i][j] = dp[i - 1][j - v[i]] + w[i];
			}
			if (dp[i - 1][j] && dp[i][j]) {
				dp[i][j] = min(dp[i][j], dp[i - 1][j]);
			} else if (dp[i - 1][j]) {
				dp[i][j] = dp[i - 1][j];
			}
			if (dp[i][j] && dp[i][j] <= W) {
				ans = max(ans, j);
			}
		}
	}
	cout << ans;
}

Measured memory_bytes: 77056
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const ll mod = 1000000007;
//const ll mod = 998244353;
const int inf = 1e9 + 10;
const ll INF = 1e18;
const ld EPS = 1e-10;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }



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

  cout << (s.substr(0, 4) == "YAKI" ? "Yes" : "No") << endl;


  
  return 0;
}

Measured memory_bytes: 256
N = int(input())
ans = 0
n = N
for i in range(2, int(N**0.5)+1):
    if n % i == 0:
        list1 = []
        while n % i == 0:
            list1.append(i)
            n //= i
        x = len(list1)
        ans += int(-0.5+((1+8*x)**0.5)*0.5)
if n != 1:
  ans += 1
if ans == 0 and N != 1:
    ans = 1
print(ans)

Measured memory_bytes: 9368
#include <stdio.h>

int main(){
	long long int a,b,r,x,tmp;
	scanf("%lld%lld",&a,&b);
	x = a * b;
 
  /* 自然数 a > b を確認・入替 */
  if(a<b){
    tmp = a;
    a = b;
    b = tmp;
  }
 
  /* ユークリッドの互除法 */
  r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }
  printf("%lld",x/b);
	return 0;
}

Measured memory_bytes: 128
#include<stdio.h>

typedef int S4;
typedef unsigned char U1;

#define FALSE (0)
#define TRUE  (1)

#define MAX_DIGIT (7)    /* ?????§?????° */
#define MIN_DIGIT (1)    /* ????°??????° */

#define DIVID_NUM_FOR_LOWER_DIGIT (10) /* ????????????????????????????????° */

#define MAX_INPUT_VALUE (1000000) /* ?????§??\?????? */

static S4 s4_s_calcDigit(S4 s4_a_inputNum);

S4 main() {

	S4 s4_t_a;
	S4 s4_t_b;
	U1 u1_t_delimiter;
	S4 s4_t_scanfRtn;
	S4 s4_t_sumInput;
	S4 s4_t_digit;
	U1 u1_t_isEnd;

	s4_t_scanfRtn = (S4)0;
	u1_t_isEnd = (U1)FALSE;

	while (u1_t_isEnd != (S4)TRUE)
	{
		s4_t_scanfRtn = scanf("%d %d%c", &s4_t_a, &s4_t_b, &u1_t_delimiter);
		if (s4_t_scanfRtn != (S4)EOF)
		{
			s4_t_sumInput = s4_t_a + s4_t_b;

			s4_t_digit = s4_s_calcDigit(s4_t_sumInput);

			printf("%d\n", s4_t_digit);
		}
		else
		{
			u1_t_isEnd = (U1)TRUE;
		}
	}

	return 0;
}

static S4 s4_s_calcDigit(S4 s4_a_inputNum)
{
	S4 s4_t_digit;
	S4 s4_t_maxNumOfDigit;
	U1 u1_t_isFinishCalc;

	u1_t_isFinishCalc = (U1)FALSE;
	s4_t_maxNumOfDigit = (S4)MAX_INPUT_VALUE;
	s4_t_digit = (S4)MAX_DIGIT;

	while ((s4_t_digit > (S4)MIN_DIGIT) &&
		(u1_t_isFinishCalc != (U1)TRUE))
	{
		if (s4_a_inputNum >= s4_t_maxNumOfDigit)
		{
			u1_t_isFinishCalc = (U1)TRUE;
		}
		else
		{
			s4_t_digit--;
			s4_t_maxNumOfDigit /= (S4)DIVID_NUM_FOR_LOWER_DIGIT;
		}
	}

	return (s4_t_digit);
}

Measured memory_bytes: 1760
#include<bits/stdc++.h>
#define ll long long int
#define ld long double
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
using namespace std;
const int MOD = 1000000007; 
const int N = 200005;


int main(){
    fast;
    ll k;
    cin >> k;
    string s;
    cin >> s;
    if(s.size() <= k)
        cout << s;
    else{
        for(int i = 0; i < k; ++i)
            cout << s[i];
        cout << "..."; 
    }
    return 0;
}

Measured memory_bytes: 3656
#include <bits/stdc++.h>
#define ll long long
#define f first
#define s second
#define mod 1000000007
#define N 100043
#define mp(a,b) make_pair(a,b)
#define loop(a,b) for(int i=a;i<b;i++)
#define test int t; cin >> t; while(t--)
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    ll n,w;
    cin >> n >> w;
    vector<ll>wei(n),val(n);
    for(int i=0;i<n;i++) cin >> wei[i] >> val[i];
    vector<vector<ll>>dp(n+1,vector<ll>(N,INT_MAX));
    dp[0][0]=0;
    for(int i=1;i<=n;i++){
        for(int j=0;j<N;j++){
            if(j-val[i-1]>=0){
                dp[i][j]=min(dp[i-1][j],dp[i-1][j-val[i-1]]+wei[i-1]);
            }
            else
                dp[i][j]=dp[i-1][j];
        }
    }
    ll ans=0;
    for(int i=1;i<N;i++)
    {
        if(dp[n][i]<=w)
            ans=i;
    }
    cout << ans << endl;
}


Measured memory_bytes: 83148
using System;
using System.Linq;

public class Test
{
	public static void Main()
	{
		int n = int.Parse(Console.ReadLine());
		int[] a = Console.ReadLine().Split().Select(int.Parse).ToArray();
		Array.Sort(a);
		double ret = 0.0;
		for(int i = 0; i < n - 1; i++) {
			for(int j = i + 2; j < n - 1; j++) {
				double c1 = 1.0 * (a[j + 1] + a[j]) / (a[i + 1] - a[i]);
				double c2 = 1.0 * (a[i + 1] + a[i]) / (a[j + 1] - a[j]);
				ret = Math.Max(ret, c1);
				ret = Math.Max(ret, c2);
			}
		}
		Console.WriteLine(ret);
	}
}

Measured memory_bytes: 9784
#include <iostream>
#include<cstdio>
#include<set>
#include<queue>
#include<vector>
#include<map>
#include<cmath>
#include<cstdlib>
#include<algorithm>
#include<string>
#include<cstring>

using namespace std;

int main()
{
    ios::sync_with_stdio(false);
	int n;
	int sl,sr;//1男2女
	string s,t;
	cin>>n;
	cout<<0<<endl;
	cin>>s;
	if(s[0]=='M')
        sl=1;
    else
        sl=2;
	if(s[0]=='V')
        return 0;
    int l=0,r=n,m;
    while(l<r)
	{
	    m=(l+r)/2;
	    cout<<m<<endl;
	    cin>>t;
        if(t[0]=='V')
            return 0;
        if(t[0]=='M')
            sr=1;
        else
            sr=2;
        if((m-l)&1)
        {
            if(sl==sr)
                r=m;
            else
            {
                l=m;
                sl=sr;
            }
        }
        else
        {
            if(sl==sr)
                l=m;
            else
                r=m;
        }
	}
    return 0;
}


Measured memory_bytes: 976
d = {
        ((0, 0), (1, 0), (0, 1), (1, 1))  : 'A',
        ((0, 0), (0, 1), (0, 2), (0, 3))  : 'B',
        ((0, 0), (1, 0), (2, 0), (3, 0))  : 'C',
        ((0, 0), (-1, 1), (0, 1), (-1, 2)): 'D',
        ((0, 0), (1, 0), (1, 1), (2, 1))  : 'E',
        ((0, 0), (0, 1), (1, 1), (1, 2))  : 'F',
        ((0, 0), (1, 0), (-1, 1), (0, 1)) : 'G'
    }


n = 9
while True:
    if n == 9:
        n = 0
        a = []
    try:
        line = input()
    except:
        break
    a.append(line)
    n += 1
    if n != 8: continue

    piece = [(x, y) for y in range(8) for x in range(8) if a[y][x] == '1']
    x0, y0 = piece[0]
    piece = tuple([(x - x0, y - y0) for x, y in piece])
    print(d[piece])

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

int main(){
    int n , k;
    cin >> n >>k;
    vector<int> d(k);
    vector<int> a(n);
    vector<int> a_count(n,-1);
    rep(i,k){
        cin>>d.at(i);
        rep(j, d.at(i)) {
            cin>>a.at(j);
            a_count.at(a.at(j)-1)++;
        }
    }

    int ans =0;
    rep(i,n){
        if(a_count.at(i) < 0) ans++;
    }
    cout << ans <<endl;

    return 0;
}

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

public class Main {
	public static void main(String[] a) throws IOException {
		InputStreamReader is = new InputStreamReader(System.in);
		BufferedReader br = new BufferedReader(is);
		String str;
		while ((str = br.readLine()) !=null) {

			String num_str[] = new String[2];
			num_str = str.split(" ");
			int sum = Integer.parseInt(num_str[0]) + Integer.parseInt(num_str[1]);
			System.out.println(Integer.toString(sum).length());
		}
	}
}

Measured memory_bytes: 24104
def calc(h,w):
  ans = w
  for i in range(1,h):
    s1 = w*i
    s2 = (h-i)*(w//2)
    s3 = (h-i)*(w-w//2)
    s = [s1,s2,s3]
    ds = max(s)-min(s)
    ans = min([ans,ds])
  return ans

h,w = map(int,input().split())
if (h*w)%3==0:
  print(0)
else:
  print(min([calc(h,w),calc(w,h)]))


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (k); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
#define D10 fixed<<setprecision(10)
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
const int MOD = 1000000007;
const int INF = MOD + 1;
const ld EPS = 1e-12;
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }
typedef int Weight;
struct Edge
{
	int from, to; Weight cost;
	bool operator < (const Edge& e) const { return cost < e.cost; }
	bool operator > (const Edge& e) const { return cost > e.cost; }
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
typedef vector<Weight> Array;
typedef vector<Array> Matrix;
void add_edge(Graph &g, int from, int to, Weight cost)
{
	g[from].push_back(Edge{ from, to, cost });
}

/*--------------------template--------------------*/
void dijkstra(Graph &g, int s, Array &d)
{
	d.assign(g.size(), INF);
	d[s] = 0;
	typedef pair<Weight, int> P;
	priority_queue<P, vector<P>, greater<P>> que;
	que.push(P(0, s));
	while (!que.empty())
	{
		Weight dist = que.top().first;
		int v = que.top().second;
		que.pop();
		if (d[v] < dist) continue;
		REP(i, g[v].size())
		{
			Edge e = g[v][i];
			if (d[e.to] > d[v] + e.cost)
			{
				d[e.to] = d[v] + e.cost;
				que.push(P(d[e.to], e.to));
			}
		}
	}
}

int main()
{
	int n, m, cap;
	while (cin >> n >> m >> cap, n)
	{
		map<string, int> mp;
		string src, dst; cin >> src >> dst;
		mp[src] = 0, mp[dst] = 1;
		int cnt = 2;
		Graph g;
		REP(i, n)
		{
			string s, t; cin >> s >> t;
			if (!mp.count(s))
			{
				mp[s] = cnt;
				cnt++;
			}
			if (!mp.count(t))
			{
				mp[t] = cnt;
				cnt++;
			}
			g.resize(cnt);
			int d; cin >> d;
			add_edge(g, mp[s], mp[t], d);
			add_edge(g, mp[t], mp[s], d);
		}
		vi sta = { 0,1 };
		REP(i, m)
		{
			string s; cin >> s;
			sta.push_back(mp[s]);
		}
		Graph h(sta.size());
		REP(i, sta.size())
		{
			Array d;
			dijkstra(g, sta[i], d);
			REP(j, sta.size())
			{
				if (d[sta[j]] <= cap * 10) add_edge(h, i, j, d[sta[j]]);
			}
		}
		Array ans;
		dijkstra(h, 0, ans);
		if (ans[1] == INF) puts("-1");
		else cout << ans[1] << endl;
	}
	return 0;
}

Measured memory_bytes: 5124
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		Set<Integer> setA = new HashSet<>();
		for (int i = 0; i < N; i++) {
			setA.add(sc.nextInt());
		}
		if (setA.size() == N) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
	}

}


Measured memory_bytes: 99540
import math

n, m = list(map(int, input().split(" ")))
n_c = 0
m_c = 0

if n >= 2:
  n_c = math.factorial(n) // (math.factorial(n - 2) * math.factorial(2))
if m >= 2:
  m_c = math.factorial(m) // (math.factorial(m - 2) * math.factorial(2))
  
print(n_c + m_c)
  

Measured memory_bytes: 3060
def main():
    import sys
    sys.setrecursionlimit(10**9)
    input = sys.stdin.readline

    N = int(input())

    if N == 1:
        print(0)
        return

    def prime_factorization(n):
        from collections import Counter
        p = Counter()
        while n % 2 == 0:
            p[2] += 1
            n //= 2

        i = 3
        while i*i <= n:
            if n % i == 0:
                p[i] += 1
                n //= i
            else:
                i += 2

        if n != 1:
            p[n] += 1

        return p

    d = prime_factorization(N)

    ans = 0
    for i in d:
        tmp = 1
        for j in range(d[i]):
            tmp *= i
            if N % tmp == 0:
                ans += 1
                N //= tmp
            else:
                break
            if N == 1:
                break
        if N == 1:
            break

    print(ans)

main()

Measured memory_bytes: 9472
// AOJ 2233 Carrot Tour
// 2018.2.1 bal4u

#include <stdio.h>
#include <string.h>
#include <math.h>

#define EPS 1e-8
#define PI 3.1415926535897932384626433832795

int x[21], y[21];
double d[21][21];
double dp[5000][21][21]; char f[5000][21][21];
int to[21][21][21], hi[21][21];

#define getchar_unlocked()  getchar()
int in()
{
	int n = 0;
	int c = getchar_unlocked();
	if (c == '-') {
		c = getchar_unlocked();
		do n = (n<<3)+(n<<1) + (c & 0xf), c = getchar_unlocked();
		while (c >= '0');
		return -n;
	}
	do n = (n<<3)+(n<<1) + (c & 0xf), c = getchar_unlocked();
	while (c >= '0');
	return n;
}

double angle(int k, int i, int j)
{
	double a, b, c;
	
	a = hypot(x[k]-x[i], y[k]-y[i]);
	b = hypot(x[i]-x[j], y[i]-y[j]);
	c = (double)(x[k]-x[i])*(x[i]-x[j]) + (double)(y[k]-y[i])*(y[i]-y[j]);
	return acos(c/(a*b));
}

int main()
{
	int n, i, j, k, m, s, ok, ans;
	double r, a, t;
	char buf[30];

	n = in();
	fgets(buf, 30, stdin), sscanf(buf, "%lf%lf", &r, &a);
	a *= PI/180;
	for (i = 0; i < n; i++) x[i] = in(), y[i] = in();

	for (i = 0; i < n; i++) for (j = i+1; j < n; j++)
		d[i][j] = d[j][i] = hypot(x[i]-x[j], y[i]-y[j]);

	for (i = 0; i < n; i++) for (j = 0; j < n; j++) if (j != i) {
		for (k = 0; k < n; k++) if (k != i) {
			if (angle(k, i, j) < a + EPS) to[i][j][hi[i][j]++] = k;
		}
	}

	ok = 0;
	for (j = 1; j < n; j++) if (d[0][j] < r + EPS) {
		ok = 1, dp[0][j][0] = d[0][j], f[0][j][0] = 1;
	}

	ans = 0;
	for (s = 0; ok; s++) {
		ans++;
		ok = 0;
		for (i = 0; i < n; i++) for (j = 0; j < n; j++) {
			if (i == j || !f[s][i][j]) continue;
			for (m = 0; m < hi[i][j]; m++) {
				k = to[i][j][m];
				if ((t = dp[s][i][j] + d[i][k]) < r + EPS) {
					if (!f[s+1][k][i] || dp[s+1][k][i] > t) {
						dp[s+1][k][i] = t, f[s+1][k][i] = 1, ok = 1;
					}
				}
			}
		}
	}
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 20264
#include<bits/stdc++.h>
#define int long long int
#define inf 100000000000
#define hell (int)(998244353)

using namespace std;

void solve(){
    double l,ans;
    cin>>l;
    ans=pow(l/3,3);
    cout<<fixed<<setprecision(7)<<ans;
}

signed main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int t;
	//cin>>t;
	t=1;
	while(t--){
		solve();
	}
	return 0;
}


Measured memory_bytes: 512
/* Who in the world am I? Ah, that's the great puzzle. */
#include<bits/stdc++.h>
using namespace std;
typedef long long int uli;
const int mx=2e3+10;
const int mxl=13;
const uli oo=1e15;
int a[mxl][mx];
int mini(int l,int r){
  int len=32-__builtin_clz(r-l+1)-1;
  return min(a[len][l],a[len][r-(1<<len)+1]);
}
int main(){
  int n;
  uli x;
  cin>>n>>x;
  for(int i=0;i<n;i++)cin>>a[0][i];
  for(int l=1;l<mxl;l++){
    for(int i=0;i<n;i++){
      a[l][i]=a[l-1][i];
      int j=i+(1<<(l-1));
      if(j<n)a[l][i]=min(a[l][i],a[l-1][j]);      
    }
  }
  uli ans=1e15;
  for(int dx=0;dx<n;dx++){
    uli sm=0;
    for(int i=0;i<n;i++){
      int x=i-dx;
      if(x<0){
        sm+=min(mini(0,i), mini((x+n)%n,n-1));   
      }
      else{
        sm+=mini(x,i);
      }
    }
    sm+=uli(dx)*x;
    ans=min(ans,sm);
  }
  printf("%lld\n",ans);
  return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <string>

using namespace std;

int main(void)
{
	int input;
	cin >> input;

	int temp = input / 100;
	int result = temp * 100 + temp * 10 + temp;

	if(input > result) {
		result = (temp + 1) * 100 + (temp + 1) * 10 + (temp + 1);
	}

	cout << result;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define INF 1e18
#define N 5010
using namespace std;
template <typename T> void read(T &x){
	x=0;char c=getchar();int fh=1;
	while (!isdigit(c)){if (c=='-')fh=-1;c=getchar();}
	while (isdigit(c))x=x*10+c-'0',c=getchar();
	x*=fh;
}
ll n,yo,zu,mi[N],a[N],dp[N][N];
int main(){
	read(n);read(yo);read(zu);mi[0]=INF;
	for (int i=1;i<=n;i++) read(a[i]);
	for (int i=1;i<=n+1;i++){
		for (int j=1;j<=n;j++) mi[j]=min(mi[j-1],dp[i-1][j]);
		for (int j=1;j<=n;j++){
			dp[i][j]=mi[j];
			if (j<a[i])dp[i][j]+=yo;
			if (j>a[i])dp[i][j]+=zu;
		}
	}
	cout<<mi[n]<<endl;
	return 0;
}

Measured memory_bytes: 196096
#include <iostream>
#include <array>
#include <algorithm>
 
int main(void) {
    std::array<u_int, 10> heights;
    //??\???
    for (u_int i = 0; i < 10; ++i) {
        std::cin >> heights[i];
    }
    //?????????
    std::sort(heights.begin(), heights.end(), std::greater<u_int>());
    //??????
    for (u_int i = 0; i < 3; ++i) {
        std::cout << heights[i] << std::endl;
    }
    return 0;
}

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

struct drink {
  int cost;
  int num;
};

int asc(const void *a, const void *b) {
  return (*(struct drink*)a).cost - (*(struct drink*)b).cost;
}

int main() {
  int n, m, i = 0, count = 0, ncount = 0;
  long int price = 0;
  scanf("%d%d", &n, &m);
  struct drink st[n];
  for (size_t i = 0; i < n; i++) {
    scanf("%d%d", &(st[i].cost), &(st[i].num));
  }
  qsort(st, n, sizeof(struct drink), asc);
  while (count < m) {
    price += st[i].cost;
    if (ncount+1 >= st[i].num) {
      i++;
      ncount = 0;
    } else {
      ncount++;
    }
    count++;
  }
  printf("%ld\n", price);
  return 0;
}


Measured memory_bytes: 1788
#include <functional>
#include <algorithm>
#include <stdexcept>
#include <iostream>
#include <sstream>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <cctype>
#include <vector>
#include <string>
#include <bitset>
#include <cmath>
#include <queue>
#include <stdio.h>
#include <stack>
#include <ctime>
#include <list>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <assert.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define TR(i,x) for(__typeof(x.begin()) i=x.begin();i!=x.end();i++)
#define ALL(x) x.begin(),x.end()
#define SORT(x) sort(ALL(x))
#define CLEAR(x) memset(x,0,sizeof(x))
#define FILL(x,c) memset(x,c,sizeof(x))
#define PB push_back
#define MP make_pair

using namespace std;

const double eps = 1e-8;

typedef map<int,int> MII;
typedef map<string,int> MSI;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<long double> VD;
typedef pair<int,int> PII;
typedef long long int64;
typedef long long LL;
typedef unsigned int UI;
typedef long double LD;

int main() {
    int h, a;
    cin >> h >> a;
    cout << floor(h / a) + ((h % a) ? 1 : 0) << endl;
    return 0;
}



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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define vec vector
#define INF 1000000007

void p(vec<int> a)
{
  rep(i, a.size()) cout << a[i] << endl;
  return;
}

bool check(vec<int> a, int k)
{
  map<int, int> s;
  s[a[0] - 1] = 1;
  rep(i, a.size() - 1) {
    if (a[i + 1] > a[i]) {
      s[a[i + 1] - 1] = 1;
    } else {
      if (k == 1) return false;
      int cur = a[i + 1] - 1;
      while(cur >= 0) {
        int temp = s.find(cur) == end(s) ? 1 : s[cur];
        temp++;
        if (temp <= k) {
          s[cur] = temp;
          break;
        }
        s[cur] = 1;
        cur--;
      }
      if (cur < 0) return false;
    }
    auto it = s.find(a[i + 1] - 1);
    it++;
    s.erase(it, end(s));
  }
  return true;
}

int main(void)
{
  int n;
  cin >> n;
  vec<int> a(n);
  rep(i, n) cin >> a[i];

  int left = 1, right = n;
  while(left < right) {
    int mid = (left + right) / 2;
    if (check(a, mid)) right = mid;
    else left = mid + 1;
  }
  cout << left << endl;
  return 0;
}


Measured memory_bytes: 11248