akhauriyash/Code-Regression huggingface dataset:
import bisect,collections,copy,heapq,itertools,math,string
import sys
def S(): return sys.stdin.readline().rstrip()
def M(): return map(int,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
s = S()
a = int(s[0])
b = int(s[1])
c = int(s[2])
d = int(s[3])
if a+b+c+d == 7:
    print(str(a)+'+'+str(b)+'+'+str(c)+'+'+str(d)+'=7')
elif a+b+c-d ==7:
    print(str(a)+'+'+str(b)+'+'+str(c)+'-'+str(d)+'=7')
elif a+b-c+d ==7:
    print(str(a)+'+'+str(b)+'-'+str(c)+'+'+str(d)+'=7')
elif a+b-c-d ==7:
    print(str(a)+'+'+str(b)+'-'+str(c)+'-'+str(d)+'=7')
elif a-b+c+d ==7:
    print(str(a)+'-'+str(b)+'+'+str(c)+'+'+str(d)+'=7')
elif a-b+c-d ==7:
    print(str(a)+'-'+str(b)+'+'+str(c)+'-'+str(d)+'=7')
elif a-b-c+d ==7:
    print(str(a)+'-'+str(b)+'-'+str(c)+'+'+str(d)+'=7')
elif a-b-c-d ==7:
    print(str(a)+'-'+str(b)+'-'+str(c)+'-'+str(d)+'=7')

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

int main() {
  int n, m;
  cin >> n >> m;
  vector<int> x(m);
  int i;
  for (i = 0; i < m; i++) {
    cin >> x[i];
  }
  sort(x.begin(), x.end());
  vector<int> diff(m - 1);
  for (i = 0; i < m - 1; i++) {
    diff[i] = x[i + 1] - x[i];
  }
  sort(diff.begin(), diff.end());
  int result = 0;
  for (i = 0; i < m - n; i++) {
    result += diff[i];
  }
  cout << result << endl;

  return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<map>
#include<cstdio>
#include<stack>
#include<queue>
#include<fstream>
#include<cstdio>
#include<deque>
#include<iomanip>
#include <numeric>

using namespace std;
#define ok1 printf("ok1\n");
#define ok2 printf("ok2\n");
#define M 1000000000000000000LL
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);(i)--)
#define all(a) (a).begin(),(a).end()
#define reall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
#define MIN(a,b) a=min((a),(b))
#define MAX(a,b) a=max((a),(b))
#define SIZE(v) (int)v.size()
const double pi = acos(-1.0);

typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef deque<ll> dll;
typedef pair<string, int> P;
#define mod 1e9 + 7;
ll gcd(ll x, ll y)
{
	ll r;
	while ((r = x % y) != 0)
	{
		x = y;
		y = r;
	}
	return y;
}
ll lcm(ll x, ll y)
{
	x /= gcd(x, y);
	y /= gcd(x, y);
	return (x * y);
}


int main()
{
	ios_base::sync_with_stdio(false);
	string s, t;
	cin >> s >> t;
	map<char, char> a,b;
	rep(i, s.size()) {
		//cout << s[i] << " " << t[i] << endl;
		if (!a[t[i]]) {
			a[t[i]] = s[i];
		}
		else if (a[t[i]] != s[i] && s[i] != t[i]) {
			cout << "No\n";
			//cout << s[i] << t[i];
			return 0;
		}
	}
	rep(i, t.size()) {
		if (!b[s[i]])
			b[s[i]] = t[i];
		else if (b[s[i]] != t[i]) {
			cout << "No\n";
			//cout << t[i] << s[i];
			return 0;
		}
	}
	cout << "Yes" << endl;
	return 0;
}

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

int main() {
    int n;
    cin >> n;
    int a[n];
    for (int i = 0; i < n; i++) {
        a[i] = 0;
    }
    for (int i = 0; i < n-1; i++) {
        int x;
        cin >> x;
        a[x - 1]++;
    }

    for (int i = 0; i < n; i++) {
        cout << a[i] << endl;
    }
    
}

Measured memory_bytes: 4416
#include<iostream>
#include<algorithm>
#include<queue>
using namespace std;

static const int MAX = 10000;
static const int INFTY = (1<<20);
static const int WHITE = 0;
static const int GRAY = 1;
static const int BLACK = 2;
int n;

vector<pair<int, int> > adj[MAX];

void dijkstra() {
	priority_queue<pair<int, int> > PQ;
	int color[MAX];
	int d[MAX];
	for ( int i = 0; i < n; i++ ) {
		d[i] = INFTY;
		color[i] = WHITE;
	}

	d[0] = 0;
	PQ.push(make_pair(0, 0));
	color[0] = GRAY;

	while (!PQ. empty()) {
		pair<int, int> f = PQ.top(); PQ.pop();
		int u = f.second;
		color[u] = BLACK;

		if (d[u] < f.first * (-1) ) continue;

		for ( int j = 0; j < adj[u].size(); j++) {
			int v = adj[u][j].first;
			if ( color[v] == BLACK ) continue;
			if ( d[v] > d[u] + adj[u][j].second ) {
				d[v] = d[u] + adj[u][j].second;
				PQ.push(make_pair(d[v] * (-1), v));
				color[v] - GRAY;
			}
		}
	}

	for ( int i = 0; i<n; i++) {
		cout << i << " " << ( d[i] == INFTY ? -1 :d[i] ) << endl;
	}
}

int main() {
	int k, u, v, c;

	cin >> n;
	for (int i = 0; i<n; i++ ) {
		cin >> u >> k;
		for ( int j = 0; j <k; j++ ) {
			cin >> v >> c;
			adj [u].push_back(make_pair(v, c));
		}
	}

	dijkstra();

	return 0;
}


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

using namespace std;

/* g++ -g -fsanitize=address -lasan -std=c++11 -Dfoo_ */

/* freopen("input.txt", "rt", stdin); */
/* freopen("output.txt", "wt", stdout); */

#define ALL(c)          (c).begin(), (c).end()
#define ALLR(c)         (c).rbegin(), (c).rend()
#define FOR(i,a,b)      for (int i=(a); i < (b); ++i)
#define FORR(i,a,b)     for (int i=(a); i > (b); --i)
#define FOR_ALL(i,c)    for (__typeof((c).begin()) i=(c).begin();   \
                             i != (c).end(); ++i)
#define FOR_ALLR(i,c)   for (__typeof((c).rbegin()) i=(c).rbegin(); \
                             i != (c).rend(); ++i)
#define SZ(array)       (sizeof(array)/sizeof(array[0]))
#define lc(x)           (x<<1)     /* 2*x */
#define rc(x)           (x<<1 | 1) /* 2*x+1 */
#define lowbit(x)       (x & (-x)) /* 0b10100 -> 0b100 */

typedef long long       LL;
typedef map<int,int>    MII;
typedef pair<int,int>   PII;
typedef set<int>        SI;
typedef vector<bool>    VB;
typedef vector<double>  VD;
typedef vector<int>     VI;
typedef vector<string>  VS;

/* check if a key is in container C */
template <class C>
inline bool in_(const typename C::key_type& k, const C& A)
{ return A.find(k) != A.end(); }
inline bool in_(const string& s, const string& S)
{ return S.find(s) != string::npos; }

int main()
{
#ifdef foo_
    freopen("foo", "rt", stdin);
#endif
    ios::sync_with_stdio(false);
    int x,a;
    while (cin >> x >> a) {
        if (x < a)
            cout << 0 << endl;
        else
            cout << 10 << endl;
    }
    return 0;
}


Measured memory_bytes: 256
// Copyright lzt
#include<stdio.h>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<cmath>
#include<iostream>
#include<queue>
#include<string>
#include<ctime>
using namespace std;
typedef long long ll;
typedef std::pair<int, int> pii;
typedef long double ld;
typedef unsigned long long ull;
typedef std::pair<long long, long long> pll;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define rep(i, j, k)  for (register int i = (int)(j); i <= (int)(k); i++)
#define rrep(i, j, k) for (register int i = (int)(j); i >= (int)(k); i--)
#define Debug(...) fprintf(stderr, __VA_ARGS__)

inline ll read() {
  ll x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch <= '9' && ch >= '0') {
    x = 10 * x + ch - '0';
    ch = getchar();
  }
  return x * f;
}

const int maxn = 18;
int n;
int A[maxn][maxn];
ll f[100100], cost[100100];

void work() {
  n = read();
  rep(i, 0, n - 1) rep(j, 0, n - 1) A[i][j] = read();
  int st = (1 << n) - 1;
  rep(i, 0, st) {
    rep(a, 0, n - 1) rep(b, a + 1, n - 1) {
      if (i & (1 << a)) if (i & (1 << b)) cost[i] += A[a][b];
    }
  }
  rep(i, 0, st) {
    int j = i;
    for (; j; j = (j - 1) & i) {
      f[i] = max(f[i], f[i -j] + cost[j]);
    }
  }
  cout<<f[st]<<endl;
}

int main() {
  #ifdef LZT
    freopen("in", "r", stdin);
  #endif

  work();

  #ifdef LZT
    Debug("My Time: %.3lfms\n", (double)clock() / CLOCKS_PER_SEC);
  #endif
}


Measured memory_bytes: 1280
#include <iostream>

int64_t A[10'000'010];

int main()
{
    int N;
    std::cin >> N;

    for (int i = 1; i <= N; i++) {
        for (int j = i; j <= N; j += i) {
            A[j] += 1;
        }
    }

    int64_t ans = 0;
    for (int64_t k = 1; k <= N; k++) {
        ans += k * A[k];
    }

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

Measured memory_bytes: 81260
#include <bits/stdc++.h>
#define maxn 2005
#define maxl 1000000000

using namespace std;

#define st first
#define nd second
#define ALL(x) (x).begin(), (x).end()

template <class T>
void mini(T& l, T r) {
  l = min(l, r);
}
template <class T>
void maxi(T& l, T r) {
  l = max(l, r);
}

using LL = long long;
using LD = long double;
using ULL = unsigned long long;
const int dx[] = {0, -1, 1, 0, -1, -1, 1, 1},
          dy[] = {-1, 0, 0, 1, -1, 1, -1, 1};
const int INF = 1e9;
const LL MOD = 1e9 + 7;

int t, T;

void Solve() {
  // TODO
  int n;
  cin >> n;
  if (n == 2) {
    cout << "2\n";
    return;
  }
  if (n % 2 == 0) n += 1;
  bool flag = false;
  while (!flag) {
    bool tmp = true;
    for (int i = 3; i <= n / i; i += 2) {
      if (n % i == 0) {
        tmp = false;
        break;
      }
    }
    if (tmp) break;
    n += 2;
  }
  cout << n << '\n';
}

void Prepare() {
  // TODO
  return;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  // Prepare();
  // cin >> T;
  // for (t = 1; t <= T; t++) {
  //   printf("Case #%d: ", t);
  Solve();
  //}
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
int n;
  cin>>n;
  int64_t prime = 1000000007;
int64_t after_training=1;
for(int i=1;i <=n;i++){
	after_training *= i;
  if(after_training > prime){after_training %= prime;}
}
cout<<after_training<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
double dp[3000][3000];
int main(){
	int n;
	cin>>n;
	double a[n];
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	memset(dp,0,sizeof(dp));
	dp[0][0]=1;
	for(int i=1;i<=n;i++){
		dp[i][0]=dp[i-1][0]*(1-a[i-1]);
	}
	for(int i=1;i<=n;i++){
		for(int j=1;j<=i;j++){
			dp[i][j]=dp[i-1][j-1]*a[i-1]+dp[i-1][j]*(1-a[i-1]);
		}
	}
	double sum=0;
	for(int i=n/2+1;i<=n;i++){
		sum+=dp[n][i];
	}
	cout<<fixed<<setprecision(9)<<sum;
}

Measured memory_bytes: 70528
#include <stdio.h>
#include <iostream>
#include <string.h>
#include <limits.h>
#include <string>
#include <vector>
#include <algorithm>

#ifndef U_L_LONG
typedef unsigned long long U_L_LONG;
#endif
#ifndef L_LONG
typedef long long L_LONG;
#endif

static void B_task();

int main()
{
	B_task();
	
	fflush(stdout);
	return 0;
}

static void B_task()
{
	int R, G, B, N;
	scanf(" %d %d %d %d", &R, &G, &B, &N);
	
	int rMax = N / R;
	int gMax = N / G;
	int ptn = 0;
	for (int r = 0; r <= rMax; r++) {
		for (int g = 0; g <= gMax; g++) {
			int rest = N - ((r * R) + (g * G));
			if (((rest % B) == 0) && (rest >= 0)) {
				ptn++;
			}
		}
	}
	
	printf("%d\n", ptn);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define FOR(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define REPD(i, n) for (ll i = (ll)(n)-1; i >= 0; i--)
const ll INF = 1LL << 60;
const int INF32 = 1 << 29;
const ll MOD = 1000000007;
using Graph = vector<vector<int>>; // グラフ型
using pint = pair<int, int>;

int main()
{
    int K;
    cin >> K;
    string S;
    cin >> S;
    if (S.size() <= K)
    {
        cout << S << endl;
    }
    else
    {
        REP(i, K)
        {
            cout << S[i];
        }
        cout
            << "..." << endl;
    }
}

Measured memory_bytes: 3592
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX 2000000

int H, A[MAX+1];

void maxHeapify(int i){
  int l, r, largest,tmp;
  l = 2 * i;
  r = 2 * i + 1;

  if(l <= H && A[l] > A[i]) largest = l;
  else largest = i;
  if(r <= H && A[r] > A[largest]) largest = r;
  
  if(largest != i){
    //swap
    tmp = A[i];
    A[i] = A[largest];
    A[largest] = tmp;
    
    maxHeapify(largest);
  }
}

int main(){
  int i;
  
  scanf("%d",&H);
  
  for(i = 1; i <= H; i++) scanf("%d",&A[i]);
  for(i = H/2; i >= 1; i--) maxHeapify(i);
  for(i = 1; i <= H; i++){
    printf(" %d",A[i]);
  }
  printf("\n");

  return 0;
}



Measured memory_bytes: 3688
#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9+7;

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

    //穴の開いた階段をfalseにする
    vector<int> oks(N + 1, true);
    for (int i = 0; i < M; i++)
    {
        int a;
        cin >> a;
        oks[a] = false;
    }
    
    vector<long long int> dp(N + 1);
    dp[0] = 1;
    for (int i = 0; i < N; i++)
    {
        for (int j = i + 1; j <= min(N, i + 2); j++)
        {
            if (oks[j])
            {
                dp[j] += dp[i];
                dp[j] %= mod;
            }
            
        }
        
    }
    
    cout << dp[N] << endl;
    return 0;
}


Measured memory_bytes: 1408
#include <iostream>
#include <algorithm>
#include <complex>
#include <utility>
#include <vector>
#include <string>
#include <queue>
#include <tuple>
#include <cmath>
#include <bitset>
#include <cctype>
#include <set>
#include <map>
#include <numeric>
#include <functional>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
inline void Yes(bool condition){ if(condition) PRINT("Yes"); else PRINT("No"); }
template<class itr> void cins(itr first,itr last){
    for (auto i = first;i != last;i++){
        cin >> (*i);
    }
}
template<class itr> void array_output(itr start,itr goal){
    string ans = "",k = " ";
    for (auto i = start;i != goal;i++) ans += to_string(*i)+k;
    if (!ans.empty()) ans.pop_back();
    PRINT(ans);
}
ll gcd(ll a, ll b) {
    return a ? gcd(b%a,a) : b;
}
const ll INF = 1e18;
const ll MOD = 1000000007;
typedef pair<ll,ll> P;
const ll MAX = 100005;
constexpr ll nx[8] = {1,0,-1,0,-1,-1,1,1};
constexpr ll ny[8] = {0,1,0,-1,-1,1,-1,1};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll a,b;
    cin >> a >> b;
    if (a > 0) PRINT("Positive");
    else if (b >= 0) PRINT("Zero");
    else{
        ll k = abs(a-b)+1;
        if (k%2) PRINT("Negative");
        else PRINT("Positive");
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using pint = pair<int,int>;

const long long INFLL = 1LL << 60;
const int INFI = 1000000000;


int main(){
    long long  N,A,B; cin >> N >> A >> B;
    long long  ans;
    if((B-A)%2 == 0) ans = (B-A)/2;
    else{
        if((A+B < N+1)) ans = (A+B-1) /2;
        else ans = (2*N-A-B+1) / 2;
    }
    cout << ans << endl;
}




Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<string>
#include<algorithm>
#include<cmath>
using namespace std;

int main(){
    int a,b,s;
    while(cin>>a>>b){
        s=a+b;
        if(s<10){
            cout<<"1"<<endl;
        }else if(s<100){
            cout<<"2"<<endl;
        }else if(s<1000){
            cout<<"3"<<endl;
        }else if(s<10000){
            cout<<"4"<<endl;
        }else if(s<100000){
            cout<<"5"<<endl;
        }else if(s<1000000){
            cout<<"6"<<endl;
        }else{
            cout<<"7"<<endl;
        }
    }
    return 0;
}

Measured memory_bytes: 2976
import java.io.*;
import java.util.*;
import java.lang.Math.*;

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

    public void solve(String[] args) {
        MyScanner scanner = new MyScanner();
        long N = scanner.nextLong();
        List<Long> list = new ArrayList<>();
        long ans = ("" + N).length();
        for (long i = 1; i * i <= N; i++) {
            if (N % i == 0) {
                long b = N / i;
                long c = Math.max(("" + i).length(), ("" + b).length());
                ans = Math.min(c, ans);
            }
        }

        System.out.println(ans);
    }

    private class MyScanner {
        String[] s;
        int i;
        BufferedReader br;
        String reg = " ";

        MyScanner () {
            s = new String[0];
            i = 0;
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        public String next() throws IOException {
            if (i < s.length) return s[i++];
            String line = br.readLine();
            while (line.equals("")) {
                line = br.readLine();
            }
            s = line.split(reg, 0);
            i = 0;
            return s[i++];
        }

        public int nextInt() {
            try {
                return Integer.parseInt(next());
            } catch (Exception e) {
                e.printStackTrace();
            }
            return -1;
        }

        public double nextDouble() {
            try {
                return Double.parseDouble(next());
            } catch (Exception e) {
                e.printStackTrace();
            }
            return -1;
        }

        public long nextLong()  {
            try {
                return Long.parseLong(next());
            } catch (Exception e) {
                e.printStackTrace();
            }
            return -1;
        }
    }
}


Measured memory_bytes: 21460
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define sz(x) (int)x.size()
#define LINF 0x3f3f3f3f3f3f3f3f
#define int long long 
typedef pair<int,int>pii;
const int mxN=110,M=1e9+1,mxV=1e5+5;
int n,w;
pii v[mxN];
int dp[mxV];
// LONG LONG CASE
int32_t main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);    
    cin>>n>>w;
    for(int i=0;i<=mxV;i++){
        dp[i]=w+1;
    }
    for(int i=0;i<n;i++){
        cin>>v[i].first>>v[i].second;
    }
    dp[0]=0;
    for(int i=0;i<n;i++){
        for(int j=mxV-1;j>=v[i].second;j--){
            if(dp[j-v[i].second]!=w+1){
                dp[j]=min(dp[j],dp[j-v[i].second]+v[i].first);
                //cout<<j<<" "<<dp[j]<<"\n";
            }
        }
    }
    int ans=0LL;
    for(int i=100000;i>=1;i--){
        if(dp[i]!=w+1){
            ans=i;
            break;
        }
    }
    cout<<ans;
    

}


Measured memory_bytes: 1024
n, k = map(int, input().split())

mod = 10 ** 9 + 7
ans = 0

for i in range(k, n + 2):
    n_min = (i * (i - 1) // 2) % mod

    first = (n * (n + 1) // 2) % mod
    second = ((n - i) * (n - i + 1) // 2) % mod
    n_max = (first - second) % mod

    add = (n_max - n_min + 1) % mod
    ans = (ans + add) % mod

print(ans)


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

 
int main() {
   int n;
   cin>>n;
   vector<int> A(n),B(n);
   rep(i,n)cin>>A[i];
   rep(i,n)B[i]=A[i];
   sort(B.begin(),B.end(),greater<int>());
   rep(i,n){
       if(A[i]==B[0])cout<<B[1]<<endl;
       else cout<<B[0]<<endl;
   }
}

Measured memory_bytes: 3200
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
#include <iomanip>
#include <utility>
using namespace std;

#define REP(i,n) for(int i = 0; i < n; i++)
#define MOD 1000000007

int dp[100000];

int main(int argc, char const *argv[]) {
  int N;
  cin >> N;
  long A[N];
  long B[N];
  REP(i,N){
    cin >> A[i] >> B[i];
  }
  long count = 0;
  for(int i = N-1; i >= 0; i--){
    long est = A[i] + count;
    if(est % B[i] != 0){
      count += (B[i] - est % B[i]);
    }
  }
  cout << count << endl;
}


Measured memory_bytes: 1920
import sys
  
cnt = {}
  
for line in sys.stdin:
  for l in line:
    if l.isalpha():
      c = l.lower()
      cnt[c] = cnt.get(c,0)+1
  
for i in range(26):
  c = chr(ord('a')+i)
  print( c, " : ", cnt.get(c,0), sep = '' )


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

using namespace std;
using ll = long long int;

ll Solve(const vector<ll> &a, int index, int skip, vector<vector<ll>> &memo)
{
	if (index + (1 + a.size() % 2 - skip) >= a.size())
	{
		return 0;
	}

	if (memo[index][skip] != -(1 << 60))
	{
		return memo[index][skip];
	}

	ll ans = Solve(a, index + 2, skip, memo) + a[index];
	if (skip < 1 + a.size() % 2)
	{
		ans = max(ans, Solve(a, index + 1, skip + 1, memo));
	}

	return memo[index][skip] = ans;
}

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

	vector<ll> A(n);
	for (int i = 0; i < n; i++)
	{
		cin >> A[i];
	}

	vector<vector<ll>> memo(n + 5, vector<ll>(5, -(1 << 60)));
	ll ans = Solve(A, 0, 0, memo);

	cout << ans << endl;
}

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

using namespace std;
typedef long long int ll;
typedef long double ld;
#define REP(i, n) for(ll i = 0LL; i < (ll)(n); i++)
#define REPR(i, n) for (ll i = (ll)(n) - 1; i >= 0; i--)
#define FOR(i, n, m) for(ll i = (ll)n; i < (ll)(m); i++)
#define ALL(x) (x).begin(),(x).end()
#define MOD 1000000007
#define INF (1LL << 62)

#define PI (acos(-1))
#define PRINT(x) std::cout << x << endl
 
ll gcd(ll a, ll b) { return b ? gcd(b,a%b) : a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
ll countDigit(ll n) { return floor(log10(n) + 1); } 
typedef pair <ll,ll> P;
static const ll dx[8] = {0,1,0,-1, 1, -1, 1, -1}, dy[8] = {1,0,-1,0,1,1,-1,-1};

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

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

int main()
{ 
  ll X;
  cin >> X;
  if(X >= 30) {
    PRINT("Yes");
  } else {
    PRINT("No");
  }
  return 0;
} 


Measured memory_bytes: 3580
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
using Graph = vector<vector<int>>;
const int INF = 1001001001;
// << fixed << setprecision(0) <<
// sort(ALL(),greater<int>());
unsigned euclidean_gcd(unsigned a, unsigned b) {
  if(a < b) return euclidean_gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

int main() {
  ll a,b,c,d;
  cin >> a >> b >> c >> d;
  ll ax,bx;
  ll cd=euclidean_gcd(c,d);
  cd = (c*d)/cd;
  a--;
  ax=a-a/c-a/d+a/cd;
  bx=b-b/c-b/d+b/cd;
  cout << bx-ax << endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		String str="";
		for(;;) {
			int n=sc.nextInt();
			double nn=n*1.0;
			if(n==0)break;
			double [] s=new double [n];
			double sam=0;
			for(int i=0;i<n;i++) {
				s[i]=sc.nextDouble();
				sam+=s[i];
			}
			double heikin=sam/n;
			sam=0;
			for(int j=0;j<n;j++) {
				s[j]=(s[j]-heikin)*(s[j]-heikin);
				sam+=s[j];
			}
			sam=sam/nn;
			double a=Math.sqrt(sam);
			String strs=String.valueOf(a);
			str=str+strs+"\n";
		}
		System.out.println(str);
		sc.close();
		}
	}


Measured memory_bytes: 40096
/*Hey, What's up?*/

#include<bits/stdc++.h>
using namespace std;
#define pi acos(-1.0)
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
vector<pair<long long,long long> >v;
vector<long long>vx,vy;
int main()
{
    //fastio;
    long long c,d,e,l,g,n,k,i,j,t,p,q,x,y,x1,y1,x2,y2;
    long long f=4000000000000000005,a,b,m;
    //cout<<f<<'\n';
    cin>>n>>k;
    for(i=0; i<n; i++)
    {
        cin>>c>>d;
        v.push_back({c,d});
        vx.push_back(c);
        vy.push_back(d);
    }
    if(k==1)
    {
        cout<<0<<'\n';
        return 0;
    }
    sort(vx.begin(),vx.end());
    sort(vy.begin(),vy.end());
    for(i=0; i<n; i++)
    {
        for(j=i+1; j<n; j++)
        {
            for(p=0; p<n; p++)
            {
                for(q=p+1; q<n; q++)
                {
                    x1=vx[i];
                    x2=vx[j];
                    y1=vy[p];
                    y2=vy[q];

                    a=x2-x1;
                    b=y2-y1;
                    m=a*b;
                    //cout<<m<<'\n';
                    g=0;
                    for(l=0; l<n; l++)
                    {
                        if(v[l].first>=x1&&v[l].first<=x2&&v[l].second>=y1&&v[l].second<=y2)
                            g++;
                    }
                    if(g>=k)
                    {
                        f=min(m,f);
                    }
                }
            }
        }
    }
    cout<<f<<'\n';
    return 0;
}


Measured memory_bytes: 256
// Mere bas ka nahi hai
// still i'm trying
// apna time aayega
//
//        .--------------.  
//        | Try First One|
//        '--------------'
//                |     .--------------.
//                |     |              |
//                V     V              |
//              .--------------.       |
//              |      AC.     |<---.  |  
//              '--------------'    |  |
//              (True)|  |(False)   |  |
//           .--------'  |          |  |
//           |           V          |  |
//           |  .--------------.    |  |
//           |  |   Try Again  |----'  |
//           |  '--------------'       |
//           |                         |
//           |  .--------------.       |
//           '->| Try Next One |-------'
//              '--------------'                          		  
//


#include<bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision;
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
#define int long long int
#define ld long double
#define ull unsigned long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define r0 return 0;
#define tc int t;cin>>t;while(t--)
#define for0(i, n) for (int i = 0; i < n; i++)
#define for1(i, n) for (int i = 1; i <= n; i++)
#define loop(i,a,b) for (int i = a; i < b; i++)
#define vi vector<int>
#define vii vector<long long int>
#define SORT(v) sort(v.begin(),v.end());
#define PI 3.1415926535897932384626433832795
#define mod 1000000007
#define md 998244353
#define inf 1000000000000000 //1e15
#define gcd __gcd
#define lcm(a,b) ((a)*(b))/gcd(a,b)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define crap ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define endl "\n"
int min(int a,int b){
    return (a<b)?a:b;
}
int max(int a,int b){
    return (a>b)?a:b;
}
int fp(int a,int b){
    if(b==0) return 1;
    int x=fp(a,b/2);
    x=(x*x)%mod;
    if(b&1) x=(x*a)%mod;
    return x;
}
int factorial(int n)
{
    int fact=1;
    for(int i=2;i<=n;i++)
    fact=fact*i;
    
    return fact;
}
int ncr(int n,int r)
{
    return factorial(n)/(factorial(r)*factorial(n-r));
}
int binomialCoeff(int n,int k)
{
    int dp[k+1];
    memset(dp,0,sizeof(dp));
    dp[0]=1;
    for(int i=1;i<=n;i++)
    {
        for(int j=min(i,k);j>0;j--)
        dp[j]=(dp[j]+dp[j-1])%mod;
    }
    return dp[k]%mod;
    
}
void c_p_c()
{
    crap;
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}
signed main()
{
    c_p_c();
    int n;
    cin>>n;
    vector<pair<int,int>> v(n);
    for(int i=0;i<n;i++)
    {
        cin>>v[i].first>>v[i].second;
    }
    int mn=INT_MAX,mx=INT_MIN;
    int mxx=INT_MIN,mnn=INT_MAX;
    for(auto i:v)
    {
        int sum=0;
        sum=i.first+i.second;
        mn=min(mn,sum);
        mx=max(mx,sum);
        int diff=0;
        diff=i.first-i.second;
        mnn=min(mnn,diff);
        mxx=max(mxx,diff);
    }
    cout<<max(mx-mn,mxx-mnn)<<endl;
}

Measured memory_bytes: 6344
#!usr/bin/env python3
from collections import defaultdict
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
mod = 1000000007

#A
a = LI()
s = "ABC"
print(s[a.index(max(a))])
#B

#C

#D

#E

#F

#G

#H

#I

#J

#K

#L

#M

#N

#O

#P

#Q

#R

#S

#T



Measured memory_bytes: 8164
#include<cstdio>
#include<iostream>
#include<algorithm>

using namespace std;
int n,a[10][200],dp[10][200];
int main()
{
    scanf("%d",&n);
    for (int i = 1;i<=2;i++)
        for (int j = 1;j<=n;j++)scanf("%d",&a[i][j]);
    for (int i = 1;i<=2;i++)
        for (int j = 1;j<=n;j++)
        dp[i][j] = a[i][j]+max(dp[i-1][j],dp[i][j-1]);

    cout<<dp[2][n]<<endl;
    return 0;
}


Measured memory_bytes: 256
object Main {

  import java.util.Scanner

  def main(args: Array[String]): Unit = {
    val scanner = new Scanner(System.in)
    var str = scanner.next()
    val num = str.toInt
    str = scanner.next()
    val len = str.toInt

    var list: Seq[String] = List()
    for (i <- 0 until num) {
      str = scanner.next()
      list = list :+ str
    }

    val sortedList = list.sorted

    sortedList.foreach(print)

  }
}


Measured memory_bytes: 26380
#include <iostream>
using namespace std;
int main(void){
    int a,b,c,x,cnt=0;
    cin>>a>>b>>c;
    for(x=a; x<=b; x++){
        if(c%x==0){
            cnt++;
        }
    }
    std::cout << cnt << std::endl;
    
    return 0;
}


Measured memory_bytes: 3100
#include <stdio.h>
   
int main()
{
    int a,b,d,r;
    double f;
  
    scanf("%d %d", &a,&b);
   
    d = a / b;
    r = a % b;
    f = (double)a / (double)b;
  
    printf("%d %d %lf\n", d,r,f);
  
    return(0);
}


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

using namespace std;

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

  int n;
  cin >> n;
  unordered_set<string> s;
  string ans = "Yes";
  string w;
  cin >> w;
  s.insert(w);
  char c = w.back();
  for (int i = 1; i < n; ++i) {
    cin >> w;
    if (c != w[0] || s.count(w)) {
      ans = "No";
      break;
    }
    s.insert(w);
    c = w.back();
  }

  cout << ans << '\n';

  return 0;
}


Measured memory_bytes: 3644
#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;
    if(n%1000==0)cout << 0 << endl;
    else{
    cout << 1000 - n%1000 << endl;}
    return 0;
}

Measured memory_bytes: 3628
#include <iostream>

using namespace std;

int n, k;
typedef long long ll;
ll T[100000];

int check(ll P) {
    int i = 0;
    for (int j = 0; j < k; j++) {
        ll s = 0;
        while (s + T[i] <= P) {
            s += T[i];
            i++;
            if (i == n) return n;
        }
    }
    return i;
}

int solve() {
    ll left = 0;
    ll right = 100000 * 10000;
    ll mid;

    while (right - left > 1) {
        mid = (left + right) / 2;
        int v = check(mid);
        if (v >= n)
            right = mid;
        else
            left = mid;
    }
    return right;
}

int main() {
    cin >> n >> k;
    for (int i = 0; i < n; i++) cin >> T[i];

    ll ans = solve();
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3872
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner s = new Scanner(System.in);
    
    int n = s.nextInt();
    int count = 0;
    int maxH = 0;
    for (int i = 0; i < n; i++) {
      int h = s.nextInt();
      if (h >= maxH) {
        count++;
        maxH = h;
      }
    }
    System.out.println(count);
  }
}


Measured memory_bytes: 21844
#include <iostream>
#include <ios>
#include <vector>

using namespace std;

void dfs(int node, int group, const vector<vector<int>> & Es, vector<int> & groups){
    if (groups[node] != -1) return;
    groups[node] = group;
    for (auto new_node : Es[node]){
        dfs(new_node, group, Es, groups);
    }
}

void classify(int n, const vector<vector<int>> & Es, vector<int> & groups){
    for (int node = 0; node != n; ++node){
        dfs(node, node, Es, groups);
    }
}

int main()
{
    ios::sync_with_stdio(false);
    int n, m;
    cin >> n >> m;
    vector< vector<int> > Es(n);
    int s = 0, t = 0;
    for (int i = 0; i != m; ++i){
        cin >> s >> t;
        Es[s].push_back(t);
        Es[t].push_back(s);
    }
    vector<int> groups(n, -1);
    classify(n, Es, groups);
    int q = 0;
    cin >> q;
    for (int i = 0; i != q; ++i){
        cin >> s >> t;
        if (groups[s] == groups[t]){
            cout << "yes" << endl;
        }else{
            cout << "no" << endl;
        }
    }
    
    return 0;
}

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

int dx[4] = { 0, 1, 0, -1};
int dy[4] = { 1, 0, -1, 0};
char map[22][22];
bool memo[16][22][22][4];
int f,r,c;

void search(int m, int x, int y, int d){
//cout<<x<<y<<endl;

	if(memo[m][x][y][d]) return;
	memo[m][x][y][d] = 1;
	if(map[x][y] == NULL) return;
	else if(map[x][y] >= '0' && map[x][y] <= '9') m = (int)(map[x][y] - '0');

	switch(map[x][y]){
		case '<': d = 2; break;
	  case '>': d = 0; break;
		case '^': d = 3; break;
		case 'v': d = 1; break;
		case '_':	if(m) d = 2;
							else  d = 0;
							break;
		case '|': if(m) d = 3;
							else  d = 1;
							break;
		case '+': m = (m+1)%16; break;
		case '-': m = (m+15)%16; break;
		case '@': f=1; return;
	}

	if(map[x][y] == '?')
		for(int i = 0; i < 4; i++) search( m, (x + dx[i]+r)%r, (y + dy[i]+c)%c, i);
	else search( m, (x + dx[d]+r)%r, (y + dy[d]+c)%c, d);
}

int main(){
	int i,j;
	char s;
	cin >> r >> c;
	for(i = 0; i < r; i++)
		for(j = 0; j < c; j++){ cin >> s; map[i][j] =s;}

	search( 0, 0, 0, 0);
	if(f) cout << "YES" <<endl;
	else cout << "NO" << endl;
	return 0;
}

Measured memory_bytes: 0
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;

typedef pair<ll, ll> P;
#define fs first
#define sc second

int main(){
    string s;
    cin >> s;
    int N = s.size();

    for(int i = 0; i < N; i++){
        cout << 'x';
    }

    cout << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    int n;
    cin>>n;
    char S[n];
    int c=0;
    for(int i=0;i<n;i++)
    {
        cin>>S[i];
    }
    for (int i=0;i<n;i++)
    {
        if (S[i]=='A' && S[i+1]=='B' && S[i+2]=='C' ){
                c++;}

    }
    cout<<c;
    return 0;
}

Measured memory_bytes: 888
// 全探索は間に合わない
// 尺取りか二分探索
#include <bits/stdc++.h>
using namespace std;

int main() {
    int N, M;
    long long K;
    cin >> N >> M >> K;
    vector<long long> A(N, 0);
    vector<long long> B(M, 0);
    for (int i = 0; i < N; ++i) {
        cin >> A[i];
    }
    for (int i = 0; i < M; ++i) {
        cin >> B[i];
    }

    // 累積和
    for (int i = 1; i < N; ++i) {
        A[i] += A[i - 1];
    }
    for (int i = 1; i < M; ++i) {
        B[i] += B[i - 1];
    }

    int res = 0;
    for (int a = 0; a <= N; ++a) {
        // [0, a]冊まで読んだ時の時間
        long long At = (a == 0) ? 0 : A[a - 1];
        if (At > K) continue;
        // [0, b]冊まで読んだ時の時間Bt
        // Bt < K - At
        int b = upper_bound(B.begin(), B.end(), K - At) - B.begin();
        //cout << "a: " << a << " b: " << b << endl;
        res = max(res, a + b);
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 6428
n = gets.to_i
m = Array.new(n){Array.new(n){0}}

n.times do
	s = gets.split.map(&:to_i)
	i = s[0] - 1
	s[1].times do |l|
		j = s[l + 2] - 1
		m[i][j] = 1 
	end
end

n.times do |i|
		puts m[i].join(" ")
end

Measured memory_bytes: 8772
#!/usr/bin/python
# coding: utf-8
import sys

n=int(raw_input())
m=n
w,S,H,C,D=[],[],[],[],[]
CARD=['1','2','3','4','5','6','7','8','9','10','11','12','13']
for i in xrange(n):
    w.append(map(str, raw_input().split()))

for j in xrange(m):
    if str(w[j][0]) == 'S': S.append(str(w[j][1]))
    elif str(w[j][0]) == 'H': H.append(str(w[j][1]))
    elif str(w[j][0]) == 'C': C.append(str(w[j][1]))
    else: D.append(str(w[j][1]))

for a in range(0,13):
    if CARD[a] not in S: print 'S',str(a+1)
for b in range(0,13):
    if CARD[b] not in H: print 'H',str(b+1)
for c in range(0,13):
    if CARD[c] not in C: print 'C',str(c+1)
for d in range(0,13):
    if CARD[d] not in D: print 'D',str(d+1)

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



int main(){
    ios_base::sync_with_stdio(false); cin.tie(0);
    int n,q;
    string s;
    cin>>n>>q>>s;
    vector<int>l(q),r(q),a(n+1);
    a[0]=0;a[1]=0;
    for(int i=2; i<=n; i++){
        if(s.substr(i-2,2)=="AC")a[i]=a[i-1]+1;
        else a[i]=a[i-1];
    }
    for(int i=0; i<q; i++)cin>>l[i]>>r[i];
    for(int i=0; i<q; i++){
        if(l[i]>1&&s[l[i]-2]=='A'&&s[l[i]-1]=='C')cout<<a[r[i]]-a[l[i]-1]-1<<endl;
        else cout<<a[r[i]]-a[l[i]-1]<<endl;
    }
    //for(int i=0; i<n+1; i++)cout<<a[i];
    return 0;
}

Measured memory_bytes: 2256
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a;
		int b;
		while(true){
			if(!sc.hasNext())break;
			a = sc.nextInt();
			b = sc.nextInt();
			System.out.println(a + b);
		}
	}
}

Measured memory_bytes: 25992
#include <bits/stdc++.h>
#define INF 1000000000000001
#define ll long long
using namespace std;

int main()
{
  ll N, M, Q;
  cin >> N >> M >> Q;
  vector<vector<ll>> imos(N + 1, vector<ll>(N + 1, 0));// start, end
  for (ll i = 0; i < M; ++i)
  {
    ll L, R;
    cin >> L >> R;
    imos.at(L - 1).at(R - 1) += 1;
  }
  for (ll start = N; start > 0; --start)
  {
    for (ll end = 0; end < N + 1; ++end)
    {
      imos.at(start - 1).at(end) += imos.at(start).at(end);
    }
  }
  for (ll start = N; start >= 0; --start)
  {
    for (ll end = 0; end < N; ++end)
    {
      imos.at(start).at(end + 1) += imos.at(start).at(end);
    }
  }
  for (ll i = 0; i < Q; ++i)
  {
    ll p, q;
    cin >> p >> q;
    cout << imos.at(p - 1).at(q - 1) << endl;
  }
  // for (ll i = 0; i < N + 1; ++i)
  // {
  //   for (ll j = 0; j < N + 1; ++j)
  //   {
  //     cout << imos.at(i).at(j) << ' ';
  //   }
  //   cout << endl;
  // }
}


Measured memory_bytes: 2944
#include <iostream>
#include <vector>
#include<limits.h>
using namespace std;
int main() {
	int N, C;
	cin >> N >> C;
	vector<vector<int>>D(C);
	for (int i = 0; i < C; i++) {
		for (int j = 0; j < C; j++) {
			int tmp;
			cin >> tmp;
			D[i].push_back(tmp);
		}
	}
	vector<vector<int>>cnt(3);
	for (int i = 0; i < 3; i++)
		cnt[i].resize(C);
	vector<vector<int>>c(N);
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) {
			int tmp;
			cin >> tmp;
			c[i].push_back(tmp);
			cnt[(i + j + 2) % 3][(tmp-1)]++;
		}
	}
	int ans = INT_MAX;
	int tmp, res = 0, m;
	for (int i = 0; i < C; i++) {
		for (int j = 0; j < C; j++) {
			if (j == i) continue;
			for (int y = 0; y < C; y++) {
				res = 0;
				if (y == i || y == j) continue;
				for (m = 0; m < C; m++) {
					res += cnt[1][m] * D[m][j] + cnt[2][m] * D[m][y] + cnt[0][m] * D[m][i];
				}
				if (ans > res) {
					ans = res;
				}
			}
			
		}
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 1280
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <string>
#include <cmath>
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
//int A[4005]={0};
int gcd(int x,int y,int z){
  int m=min(x,min(y,z));
  while(!(x%m==0&&y%m==0&&z%m==0))m--;
  return m;
}


int main(){
  int k;
  cin>>k;
  ll ans=0;
  for(int i=1;i<=k;i++){
    for(int j=1;j<=k;j++){
      for(int l=1;l<=k;l++){
        ans+=gcd(i,j,l);
      }
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
#include <variant>
#include <atcoder/all>
#define FOR(i,k,n) for(ll i=(k);i<(ll)(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(x) begin(x),end(x)
 
using namespace std;
using namespace std::string_literals;
using namespace atcoder;
using ll = int64_t;
using vecint = vector<int>;
using vecll = vector<ll>;
#define MAX_V 10000
int V;

using Weight = int;
const Weight INF = 1000000000;
// const Weight eps = 1e-8;

struct Edge{
  int src, dest;
  int cap, rev;
  Weight weight;
  bool operator < (const Edge &rhs) const {return weight > rhs.weight;}
};

using Edges = vector<Edge>;
using Graph = vector<Edges>;
using Array = vector<Weight>;
using Matrix = vector<Array>;

Weight h[MAX_V];                // potential
Weight dist[MAX_V];             // minimum distance
int prevv[MAX_V], preve[MAX_V]; // previous vertex and edge

void add_edge(Graph &g, int src, int dest, int cap, Weight weight) {
  g[src].push_back((Edge){src, dest, cap, (int)g[dest].size(), weight});
  g[dest].push_back((Edge){dest, src, 0, (int)g[src].size() - 1, -weight});
}

Weight min_cost_flow(Graph &g, int s, int t, int f) {
  Weight res = 0; V = g.size();
  memset(h, 0, sizeof(h));
  using P = pair<Weight, int>;
  while (f > 0) {
    priority_queue<P, vector<P>, greater<P> > que;
    fill(dist, dist + V, INF);
    dist[s] = 0;
    que.push(P(0, s));
    while (!que.empty()) {
      P p = que.top(); que.pop();
      int v = p.second; 
      if (dist[v] < p.first) continue;
      REP(i, g[v].size()) {
        Edge &e = g[v][i];
        if (e.cap > 0 && dist[e.dest] > dist[v] + e.weight + h[v] - h[e.dest] /* + eps */) {
          dist[e.dest] = dist[v] + e.weight + h[v] - h[e.dest];
          prevv[e.dest] = v;
          preve[e.dest] = i;
          que.push(P(dist[e.dest], e.dest));
        }
      }
    }
    if (dist[t] == INF) return -1;
    REP(v, V) h[v] += dist[v];

    int d = f;
    for (int v = t; v != s; v = prevv[v]) d = min(d, g[prevv[v]][preve[v]].cap);
    f -= d;
    res += d * h[t];
    for (int v = t; v != s; v = prevv[v]) {
      Edge &e = g[prevv[v]][preve[v]];
      e.cap -= d;
      g[v][e.rev].cap += d;
    }
  }
  return res;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  ll n,m;
  cin>>n>>m;
  vector<string> mat(n);
  REP(i,n) cin>>mat[i];
  Graph g(n*m+2);
  int s = n*m;
  int t = s+1;
  auto idx = [&] (int i, int j) {
    return i * m + j;
  };
  int cnt = 0;
  REP(i,n) REP(j,m) {
    if (mat[i][j] == '#') continue;
    add_edge(g, idx(i,j), t, 1, 0);
    if (mat[i][j] == 'o') {
      add_edge(g, s, idx(i,j), 1, 0);
      ++cnt;
    }
    int dij[] = {1, 0, 1};
    REP(k,2) {
      int ni = i + dij[k];
      int nj = j + dij[k+1];
      if (ni >= n || nj >= m) continue;
      if (mat[ni][nj] == '#') continue;
      add_edge(g, idx(i, j), idx(ni, nj), INF, -1);
    }
  }
  cout << -min_cost_flow(g, s, t, cnt) << endl;
  return 0;
}


Measured memory_bytes: 4160
#include <bits/stdc++.h>
using namespace std;
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;
}
typedef long long int ll;

#define EPS (1e-7)
#define INF (1 << 30)
#define LLINF (1LL << 60)
#define PI (acos(-1))
#define MOD (1000000007)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//-------------------------------------

ll dp[100];
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    dp[0] = 2;
    dp[1] = 1;
    for (int i = 2; i < 100; i++)
    {
        dp[i] = dp[i - 1] + dp[i - 2];
    }
    cout << dp[n] << endl;
}

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

int main() {
	ll N;
	cin >> N;

	for (ll h = 1; h <= 3500; h++) {
		for (ll n = 1; n <= 3500; n++) {
			ll x = N*h*n;
			ll y = 4*h*n - N*n - N*h;

			if (y <= 0) continue;
			if (x%y == 0) {
				cout << h << " " << n << " " << x/y << endl;
				return 0;
			}
		}
	}

	return 0;
}


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

using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int N, M;
string A[55], B[55];
bool ans = false;

int Solve(int I, int J){
  for (int i = 0; i < M; i++){
    for (int j = 0; j < M; j++){
      if (A[I+i][J+j] != B[i][j]) return 0;
    }
  }
  ans = true;
  return 0;
}

int main(){
  cin >> N >> M;
  for (int i = 0; i < N; i++) cin >> A[i];
  for (int i = 0; i < M; i++) cin >> B[i];

  for (int i = 0; i <= N - M; i++){
    for (int j = 0; j <= N - M; j++){
      Solve(i,j);
    }
  }

  if (ans) Yes();
  else No();
  return 0;
}


Measured memory_bytes: 3612
#include<stdio.h>
#include<algorithm>
#include<functional>
#include<cmath>
using namespace std;
int A[100000];
int main()
{
	int N;
	int count[100000] = { 0 };
	scanf("%d", &N);
	for (int i = 0; i < N; i++) {
		scanf("%d", &A[i]);
		count[A[i]]++;
	}
	if (N % 2 == 1) {
		if (count[0] == 2) {
			printf("0");
			return 0;
		}
	}
	else {
		for (int i = 0; i < N; i++) {
			if (count[i] == 3) {
				printf("0");
				return 0;
			}
		}
	}
	long long an = 1;
	for (int i = 0; i < N / 2; i++) {
		an *= 2;
		an = an % 1000000007;
	}
	printf("%lld", an);
	return 0;
}

Measured memory_bytes: 896