akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<vector>

const int mod = 1e9 + 7;
const int maxn = 305;

typedef std::pair <int, int> pr;

std::vector <pr> A[maxn];

int N, M;
int dp[maxn][maxn][maxn];

void Input(){
        scanf("%d%d", &N, &M);
        int L, R, W;
        for(int i = 1; i <= M; i ++){
                scanf("%d%d%d", &L, &R, &W);
                A[R].push_back(pr(L, W));
        }
}

int main(){
        Input();
        dp[0][0][0] = 1;
        int Ans = 0;
        for(int a = 0; a <= N; a ++)
                for(int b = 0; b <= N; b ++)
                        for(int c = 0; c <= N; c ++){
                                int &val = dp[a][b][c];
                                if(!val) continue ;
                                int lim = std::max(a, std::max(c, b));
                                int size = A[lim].size();
                                for(int i = 0; i < size; i ++){
                                        int cnt = 0;
                                        cnt += (a >= A[lim][i].first);
                                        cnt += (b >= A[lim][i].first);
                                        cnt += (c >= A[lim][i].first);
                                        if(cnt != A[lim][i].second){ val = 0; break ; }
                                }
                                if(lim < N){
                                        ( dp[lim+1][b][c] += val ) %= mod;
                                        ( dp[a][lim+1][c] += val ) %= mod;
                                        ( dp[a][b][lim+1] += val ) %= mod;
                                }else   ( Ans += val ) %= mod;
                        }
        printf("%d\n", Ans);
        return 0;
}

Measured memory_bytes: 110848
package main

import (
	"fmt"
	"strconv"
)

func main() {
	// Code for B - i18n
	var s string
	fmt.Scanf("%s", &s)
	fmt.Println(s[0:1] + strconv.Itoa(len(s)-2) + s[len(s)-1:len(s)])
}


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

using namespace std;

#define REP1(i,n) for(int i=1, i##_len=(n); i<i##_len; ++i)
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define pow(x) x*x
#define ll long long
static const ll MAX = 1000000;
static const ll INFTY = 1e12;

template < typename T > inline string toString( const T &a ) { ostringstream oss; oss << a; return oss.str(); };

struct edge {
    ll to, cost;
};

using Graph = vector<vector<int>>;
using _Graph = vector<vector<edge>>;


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

// 深さ優先探索
vector<bool> seen;
vector<int> colors;

int H, W, N;
int sx, sy, gx, gy; 
vector<vector<char>> field;
vector<vector<int>> dist;
//vector<pair<int, int>> gx, gy;
deque<pair<int, int>> que;

typedef vector<vector<int> > Matrix;

const int INF = 100000000;


int main() {

   int X, A;
   cin >> X >> A;
   if(X < A)cout << 0;
   else cout << 10;
}
/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         pass System Test!
*/


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <vector>
#include <map>

typedef long long ll;

#define rep(i,n) for(int i = 0; i < n; i++)
#define debug(x) cerr << #x << ": " << x << "\n";

using namespace std;
 
const ll INF = ll(1e18)+1;
const double PI=3.14159265358979323846;

int main(){
  ll N;
  cin >> N;
  vector<ll> A(N+1);
  for(int i=1; i<=N; i++) cin >> A[i];

  map<ll,ll> vm;

  for(int i=1; i<=N; i++){
    vm[i-A[i]] += 1;
  }
  ll ans = 0;
  for(int i=1; i<=N; i++){
    if(vm[i+A[i]] == 0) continue;
    else ans += vm[i+A[i]];
  }
  cout << ans << endl;
  
}


Measured memory_bytes: 27500
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int H = sc.nextInt();
		int W = sc.nextInt();
		String[] S = new String[H];
		for (int i = 0; i < H; i++) {
			S[i] = sc.next();
		}

		int[] x = { 0, 1, 1, 1, 0, -1, -1, -1 };
		int[] y = { 1, 1, 0, -1, -1, -1, 0, 1 };
		for (int i = 0; i < H; i++) {
			String str = "";
			for (int j = 0; j < W; j++) {
				if ("#".equals(String.valueOf(S[i].charAt(j)))) {
					str = str + "#";
					continue;
				}
				int count = 0;
				for (int k = 0; k < 8; k++) {
					int dx = j + x[k];
					int dy = i + y[k];
					if (dx < 0 || W <= dx || dy < 0 || H <= dy) {
						continue;
					}
					if ("#".equals(String.valueOf(S[dy].charAt(dx)))) {
						count++;
					}
				}
				str = str + String.valueOf(count);
			}
			System.out.println(str);
		}
	}
}


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

using namespace std;

#define LL long long
#define ULL unsigned LL
#define LD long double
#define debug(x) cerr << #x << " " << x << endl;

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int s, w;
	cin>>s>>w;
	if(w >= s)
		cout<<"unsafe";
	else
		cout<<"safe";
}


Measured memory_bytes: 3656
use std::io::stdin;
use std::io::BufRead;
use std::io::BufReader;

fn main() {
let mut scan = std::io::stdin();
 
let mut line = String::new();
 
let _ = scan.read_line(&mut line);
 
let vec: Vec<&str> = line.split_whitespace().collect();
 
let a: i32 = vec[0].parse().unwrap_or(0);
let b: i32 = vec[1].parse().unwrap_or(0);
//二行目

if a < b {
    println!("a < b");
}
if a > b {
    println!("a > b");
}
if a == b {
    println!("a == b");
}
}



Measured memory_bytes: 5024
use std::io;

fn main() {
    let mut line = String::new();
    io::stdin().read_line(&mut line).ok();
    let n = line.trim().parse::<i32>().unwrap();

    let mut notices = Vec::new();
    for _ in 0..n {
        let mut line = String::new();
        io::stdin().read_line(&mut line).ok();
        let mut iter = line.split_whitespace();
        let b = iter.next().unwrap().parse::<usize>().unwrap();
        let f = iter.next().unwrap().parse::<usize>().unwrap();
        let r = iter.next().unwrap().parse::<usize>().unwrap();
        let v = iter.next().unwrap().parse::<i32>().unwrap();
        notices.push((b, f, r, v));
    }

    let n_buildings = 4;
    let n_floors = n_buildings * 3;
    let n_rooms = n_floors * 10;
    let mut rooms = vec![0; n_rooms];
    for notice in notices {
        let (b, f, r, v) = notice;
        rooms[(b - 1) * 30 + (f - 1) * 10 + (r - 1)] += v;
    }

    for b in 0..4 {
        if b != 0 { println!("####################"); }
        for f in 0..3 {
            for r in 0..10 {
                print!(" {}", rooms[b * 30 + f * 10 + r]);
            }
            print!("\n");
        }
    }
}



Measured memory_bytes: 5024
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define fr(i,n) for(int i=0;i<(n);++i)
#define Fr(i,n) for(int i=1;i<=(n);++i)
#define ifr(i,n) for(int i=(n)-1;i>=0;--i)
#define iFr(i,n) for(int i=(n);i>0;--i)
 
int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll n,m,k,t,ca,cb,ans;
    ans =0;
    ca=0;
    cb=0;
    t=0;
    cin>>n>>m>>k;
    ll arra[n];
    ll arrb[m];
    fr(i,n){
        ll a;
        cin>>a;
        arra[i]=a;
    }
    fr(i,m){
        ll a;
        cin>>a;
        arrb[i]=a;
    }
    while(t+arra[ca]<=k and ca<n){
        t+=arra[ca];
        ++ca;
    }
    while(ca!=-1){
        while(t+arrb[cb]<=k and cb<m){
            t+=arrb[cb];
            ++cb;
        }
        ans=max(ans,ca+cb);
        if(ca>0) t-=arra[ca-1];
        --ca;
    }
    cout<<ans;
}

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

int main(){

    string s;
    cin >> s;
    int K;
    cin >> K;

    set<string> dict;
    for(char n = 'a'; n <= 'z'; n++){
        int index = s.find(string{n});
        while(index != std::string::npos){
            for(int i = 1; i <= min(K, (int)(s.length() - index)); i++){
                dict.insert(s.substr(index, i));
            }
            index = s.find(string{n}, index + 1);
        }
        if(dict.size() >= K) break;
    }

    auto ans = dict.begin();
    for(int i = 0; i < K - 1; i++) ans++;
    cout << *ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <cstring>
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath>
#include <numeric>
#include <float.h>
#include <math.h>
#include <sstream>
using namespace std;
// repマクロの定義
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
// allマクロの定義
#define all(v) v.begin(), v.end()
const  long long INF = 1LL << 60;
typedef unsigned long long ll;
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

int ctoi(char c) {
 	switch (c) {
		case '0': return 0;
		case '1': return 1;
		case '2': return 2;
		case '3': return 3;
		case '4': return 4;
		case '5': return 5;
		case '6': return 6;
		case '7': return 7;
		case '8': return 8;
		case '9': return 9;
		default: return 0;
	}
}



int main(){ 
int A,B; cin >> A >> B;
cout << A * B << endl;
}


Measured memory_bytes: 3596
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <vector>
#include <cmath> 
#include <cctype>

using namespace std;

int main() {
    int N;
    int Alice = 0;
    int Bob   = 0;
    cin >> N;
    int a[N];
    for (int i = 0; i < N; i++) {
        cin >> a[i];
    }

    sort(a, a + N, greater<int>());

    for (int i = 0; i < N; i++) {
        if (i % 2 == 0) {
            Alice += a[i];
        } else {
            Bob += a[i];
        }
    }

    cout << Alice - Bob << endl;
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<string>
#include<set>
#include<map>
#include<vector>
#include<queue>
#include<stack>
#include<deque>
#include<tuple>
#include<algorithm>
#include<numeric>
#include<limits>
#include<boost/multiprecision/cpp_int.hpp>
using namespace boost::multiprecision;
using namespace std;
#define BEGIN ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define END return EXIT_SUCCESS
#define up(I,A,B) for(auto I=(A);I<=(B);++I)
#define dw(I,A,B) for(auto I=(A);I>=(B);--I)
#define rep(I,N) up(I,0,N-1)
#define all(C) (C).begin(),(C).end()
#define rall(C) (C).rbegin(),(C).rend()
#define ft first
#define sd second
#define mp make_pair
#define mt make_tuple
#define pf push_front
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define rs resize
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
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;}
template<class T>inline void                                      in(T &p){cin>>p;}
template<class T1,class T2>inline void                            in(T1 &p1,T2 &p2){cin>>p1>>p2;}
template<class T1,class T2,class T3>inline void                   in(T1 &p1,T2 &p2,T3 &p3){cin>>p1>>p2>>p3;}
template<class T1,class T2,class T3,class T4>inline void          in(T1 &p1,T2 &p2,T3 &p3,T4 &p4){cin>>p1>>p2>>p3>>p4;}
template<class T1,class T2,class T3,class T4,class T5>inline void in(T1 &p1,T2 &p2,T3 &p3,T4 &p4,T5 &p5){cin>>p1>>p2>>p3>>p4>>p5;}
template<class T>inline void                                      ins(T &p){for_each(all(p),in<decltype(p[0])>);}
template<class T>inline void                             out(T p){cout<<p<<"\n";}
template<class T1,class T2>inline void                   out(T1 p1,T2 p2){cout<<p1<<" "<<p2<<"\n";}
template<class T1,class T2,class T3>inline void          out(T1 p1,T2 p2,T3 p3){cout<<p1<<" "<<p2<<" "<<p3<<"\n";}
template<class T1,class T2,class T3,class T4>inline void out(T1 p1,T2 p2,T3 p3,T4 p4){cout<<p1<<" "<<p2<<" "<<p3<<" "<<p4<<"\n";}
inline void                                              out(ld p){printf("%.12Lf\n",p);}
template<class T>inline void outml(T p){for_each(all(p),out<decltype(p[0])>);}//ml=multi line
template<class T>inline void outol(T V){auto n=V.size();rep(i,n)cout<<V[i]<<" \n"[i==n-1];}//ol=one line
long ans=-(1L<<60);
long A,B,N;
// index が条件を満たすかどうか
bool isOK(long x) {
    if(floor(A*x/B)-A*floor(x/B) >= ans) {
      ans=floor(A*x/B)-A*floor(x/B);
      return true;
    }
    else return false;
}

inline void solve(void){
  in(A,B,N);
  long ng = N+1; //「index = 0」が条件を満たすこともあるので、初期値は -1
  long ok = -1; // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は a.size()
  /* ok と ng のどちらが大きいかわからないことを考慮 */
  while (abs(ok - ng) > 1) {
      long mid = (ok + ng) / 2;
      if (isOK(mid)) ok = mid;
      else ng = mid;
  }
  out(ans);
}
int main(void){
  BEGIN;
  solve();
  END;
}


Measured memory_bytes: 3640
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main()
{
  int N;
  cin >> N;
  vector<int> X(N);
  for(int i=0; i<N; ++i) cin >> X[i];
  sort(X.begin(), X.end(), greater<int>());
  int m = 1;
  int ans = 0;
  for(int x:X)
  {
    ans += x*m;
    m *= -1;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Edge = pair<int, int>;
using Graph = vector<vector<Edge>>;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
const ll MOD = 1000000007;
const ll nmax = 8;
const ll INF = 1e9;
bool graph[nmax][nmax];
vector<vector<ll>> dist = vector<vector<ll>>(nmax, vector<ll>(nmax, INF));
void warshall_floyd(ll n)
{
    for (size_t i = 0; i < n; i++)
    {
        for (size_t j = 0; j < n; j++)
        {
            for (size_t k = 0; k < n; k++)
            {
                dist[j][k] = min(dist[j][k], dist[j][i] + dist[i][k]);
            }
        }
    }
}

class UnionFind
{
public:
    vector<ll> Parent;

    UnionFind(ll N)
    {
        Parent = vector<ll>(N, -1);
    }
    ll find(ll A)
    {
        if (Parent[A] < 0)
            return A;
        return Parent[A] = find(Parent[A]);
    }

    ll size(ll A)
    {
        return -Parent[find(A)];
    }

    bool Union(ll A, ll B)
    {
        A = find(A);
        B = find(B);
        if (A == B)
        {
            return false;
        }
        if (size(A) < size(B))
            swap(A, B);

        Parent[A] += Parent[B];
        Parent[B] = A;

        return true;
    }
};

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

ll lcm(ll a, ll b)
{
    ll g = gcd(a, b);
    return a / g * b;
}

ll mulMod(ll a, ll b)
{
    return (((a % MOD) * (b % MOD)) % MOD);
}

ll powMod(ll a, ll p)
{
    if (p == 0)
    {
        return 1;
    }
    else if (p % 2 == 0)
    {
        ll half = powMod(a, p / 2);
        return mulMod(half, half);
    }
    else
    {
        return mulMod(powMod(a, p - 1), a);
    }
}

ll ceil(ll a, ll b)
{
    return (a + b - 1) / b;
}

void solve(long long N, long long K)
{
    if (K == 1)
    {
        cout << 0 << endl;
    }
    else
    {

        cout << (N - K) << endl;
    }
}

// Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main()
{
    long long N;
    scanf("%lld", &N);
    long long K;
    scanf("%lld", &K);
    solve(N, K);
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define all(v) v.begin(),v.end()
#define mem(arr) memset(arr, 0, sizeof(arr))
#define ff first
#define ss second
#define int long long int
const int MOD = 1e9 + 7;
const int INF = 1e18;
const int N = 1e6 + 20;
vector<int> g[N];
vector<int> vis(N);
int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int tc = 1;
    while(tc--){
        int n;
        cin >> n;
        int ans = 0, a = 0, b = 0, ba = 0;
        for(int i = 0; i < n; i++){
            string s;
            cin >> s;
            for(int i = 1; i < s.length(); i++){
                if(s[i - 1] == 'A' and s[i] == 'B'){
                    ans++;
                }
            }
            if(s[s.length() - 1] == 'A' and s[0] == 'B'){
                ba++;
            }else if(s[s.length() - 1] == 'A'){
                a++;
            }else if(s[0] == 'B'){
                b++;
            }
        }
        int ans1 = ans, ans2 = ans;
        if(ba == 0){
            ans += min(a, b);
        }else{
            ans += ba - 1;
            if(a > 0){
                ans++;
                a--;
            }
            if(b > 0){
                ans++;
                b--;
            }
            ans += min(a, b);
            // int mn = min(a, b);
            // a -= mn;
            // b -= mn;
            // if(a > 0){
            //     ans++;
            // }
            // if(b > 0){
            //     ans++;
            // }
        }
        cout << ans << '\n';
    }
}

Measured memory_bytes: 31616
#include<bits/stdc++.h>
#define ll long long int
#define cin(a,n) for(int i=0;i<n;i++){cin>>a[i];}
#define ull unsigned long long
#define forl(i,a,n) for(int i=a;i<n;i++)
#define rf1(i,a,n) for(int i=a;i>n;i--)
#define cases() int q;cin>>q;while(q--)
#define ld long double
#define cout(a,n) for(i=0;i<n;i++)cout<<a[i]<<" ";
#define inf 1e9;
#define mod 1000000007;
#define PI 3.14159265358979323846264338327950L
using namespace std;

int main(){
    ios_base:: sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
ull a;
float b;
cin>>a>>b;
ll bb=b*100+0.5;
ll ans=a*bb;
ans/=100;
cout<<fixed<<setprecision(0)<<ans;
 return 0;
 }


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

long long N, K;
vector<long long> sumV(100001);

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

  int a, b, c;
  cin >> a >> b >> c;
  set<int> s;
  s.insert(a);
  s.insert(b);
  s.insert(c);
  
  cout << s.size() <<endl;
}


Measured memory_bytes: 1024
# -*- coding: utf-8 -*-

N = int(input())
S = input()

convert_list = {}
for i in range(26):
    charactor = (i + N) % 26
    convert_list[chr(i+65)] = chr(charactor+65)

new_S = ''
for i in range(len(S)):
    new_S += convert_list[S[i]]

print(new_S)

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <bitset>
#include <stack>
#include <set>
#include <cstdio>
using namespace std;

typedef long long ll;
typedef pair<ll,int> P;
typedef pair<int,P> P2;
const int inf=1000000000;

int main() {
	string s;
	cin>>s;
	int ls=s.length();
	ll dp[10];
	for(int i=0;i<ls;++i){
		dp[i]=s[i]-'0';
	}
	int n=(1<<(ls-1));
	ll t=0;
	for(int i=0;i<n;++i){
		ll t2=0;
		for(int j=0;j<ls-1;j++){
			int k=(1<<j);
			t2+=dp[j];
			if((i&k)==k){
				t+=t2;
				t2=0;
			}else{
				t2*=10;
			}
		}
		t2+=dp[ls-1];
		t+=t2;
//		cout<<t<<endl;
	}
	cout<<t<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF 1e18
#define int long long
#define Rep(i, a, n) for (int i = (a); i < (n); i++)
#define Repr(i, n, a) for (int i = (n); i >= (a); i--)
#define rep(i, n) Rep(i, 0, n)
#define repr(i, n) Repr(i, n, 0)
#define all(a) (a).begin(), (a).end()
using namespace std;
typedef pair<int, int> P;
typedef pair<int, P> PP;
const int mod = 1000000007;

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

    int R, W, C, r;
    while (1)
    {
        cin >> R >> W >> C >> r;
        if (R == 0)
            break;
        cout << max(0LL, (C * W - R + r - 1) / r) << endl;
    }
}


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

using namespace std;

typedef long long int ll;
#define pb push_back
#define ALL(a) (a).begin() , a.end()

int mod = 1e9 + 7;

int add(int a, int b){
	if(a + b >= mod)return a+ b - mod;
	return a + b;
}
int mul(int a, int b){
	return 1LL * a * b  % mod;
}
int power(int a, int b){
	if(b < 0)return 0;
	int re = 1;
	while(b){
		if(b&1){
			re = mul(re, a);
		}
		a = mul(a, a);
		b >>= 1;
	}
	return re;
}
int const N = 100000 + 5;
int fact[N], inverse[N];
void FAC(){
 	fact[0] = 1;
	for(int x = 1; x< N; x++){
		fact[x] = mul(fact[x-1], x);
	}
	inverse[N-1] = power(fact[N-1], mod -2);
	for(int x = N-2; x>= 0; x--){
		inverse[x] = mul(x + 1, inverse[x+1]);
	}

 }

int ncr(int a, int b){
	if(a < b)return 0;
	return mul(fact[a], mul(inverse[a-b], inverse[b]));
}


/******************************************************/

void solve(){
	int n, m;
	cin >> n >> m;
	int pe = 0;
	vector<int> vec(n+1, 0), v(n+1,0);
	for(int x =0; x<m; x++){
		int j;
		string s;
		cin >> j >> s;
		if(s == "AC"){
			vec[j] =1;
		}
		else{
			if(vec[j] == 0)v[j]++;
		}

	}
	int u = 0;
	for(auto a : vec)u += a;
	for(int x = 1; x<n+1; x++){
		if(vec[x])pe += v[x];
	}
	cout << u << " " << pe;
}


/******************************************************/
int main()
{
	ios_base::sync_with_stdio(false);cin.tie(nullptr);
	int t;
	t = 1;
	// cin >> t;
	while(t--){
		solve();
	}

}

Measured memory_bytes: 1024
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define reps(i, n) for (int i = 1; i <= (n); ++i)
#define repd(i, n) for (int i = (n - 1); i >= 0; --i)
#define repds(i, n) for (int i = (n); i > 0; --i)
#define loop(i, x, n) for (int i = (x); i < (n); ++i)
#define loops(i, x, n) for (int i = (x); i <= (n); ++i)
#define loopd(i, x, n) for (int i = (x); i > (n); --i)
#define loopds(i, x, n) for (int i = (x); i >= (n); --i)
#define itrep(i, a) for (auto i = begin(a); i != end(a); ++i)
#define itrepd(i, a) for (auto i = rbegin(a); i != rend(a); ++i)
#define all(x) x.begin(), x.end()
using namespace std;
using ll = long long;
using ld = long double;
template <class T>
using priority_queuel = priority_queue<T, vector<T>, greater<T>>;
constexpr ll inf = static_cast<ll>(1e18);
constexpr int iinf = static_cast<int>(1e9);
constexpr double dinf = 1e10;
constexpr ld ldinf = 1e18;
constexpr double eps = 1e-9;
ll mod = static_cast<ll>(1e9 + 7);
template <class T>
constexpr int sz(const T &a) { return (int)a.size(); }
template <class T>
constexpr T pow2(const T a) { return a * a; }
template <class T, class... Args>
constexpr void mins(T &a, Args... args) { a = min<T>({a, args...}); }
template <class T, class... Args>
constexpr void maxs(T &a, Args... args) { a = max<T>({a, args...}); }
template <class A, int N, class T>
void fillArray(A (&array)[N], const T &val) { std::fill((T *)array, (T *)(array + N), val); }

string s;
void solve() {
    cin >> s;
    ll ans = 0;
    ll res = 0;
    auto n = sz(s);
    repd(i, n) {
        if (s[i] == 'A') {
            if (s.substr(i, 3) == "ABC") {
                if (i + 3 < n && s[i + 3] != 'B') res = 1;
                ans += res;
                s[i] = 'B';
                s[i + 1] = 'C';
                s[i + 2] = (res < 2 ? 'A' : 'B');
            } else
                res = 0;
        } else if (s[i] == 'B') {
            if (s.substr(i, 2) == "BC")
                ++res;
            else
                res = 0;
        } else {
            if (i + 1 < n && s[i + 1] == 'C') res = 0;
        }
    }
    cout << ans << endl;
}

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


Measured memory_bytes: 720
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;
typedef long long ll;

struct block_st {
	int weight;
	int solid;
	int val;
};

typedef struct block_st Block;

int cmp(Block a, Block b) {
	return (a.weight+a.solid) < (b.weight+b.solid);
}

int n;
vector<Block> blocks;

ll dp[1005][20005];

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cin >> n;
	for (int i = 0; i < n; ++i) {
		int w, s, v;
		cin >> w >> s >> v;
		Block cb = {w, s, v};
		blocks.push_back(cb);
	}
	sort(blocks.begin(), blocks.end(), cmp);
	for (int i = 1; i <= n; ++i) {
		for (int j = 0; j <= 20000; ++j) {
			dp[i][j] = dp[i-1][j];
			int prw = j-blocks[i-1].weight;
			if (prw >= 0 && prw <= blocks[i-1].solid) {
				dp[i][j] = max(dp[i][j], dp[i-1][prw] + blocks[i-1].val);
			}
		}
	}
	ll res = 0;
	for (int i = 0; i <= 20000; ++i) {
		res = max(res, dp[n][i]);
	}
	cout << res << "\n";
	return 0;
}

/*
	construct the tower from top to bottom
	dp[i][j] = max value with prefix 1..i and sum of weights j
	dp[i][j] = we can
		- take the item i -> dp[i-1][j-weight[i]] + val[i] if (j-weight[i]) <= solid[i]
		- not take the item -> dp[i-1][j]

	max strength is 10^4 so we can iterate only up to that, since all weights are >= 1
*/


Measured memory_bytes: 156544
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <algorithm>

using namespace std;

vector<vector<int> > allPer;
// n!
void foreach_permutation(int n)
{
    vector<int> indexes(n, 0);
    for (int i = 1; i <= n; i++) indexes[i-1] = i;
    do {
        allPer.push_back(indexes);
    } while (std::next_permutation(indexes.begin(), indexes.end()));
}

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

    foreach_permutation(n);
    sort(allPer.begin(), allPer.end());


    vector<int> p,q;
    for(int i = 0; i < n; i++){
        int tmp;
        cin >>tmp;
        p.push_back(tmp);
    }
    for(int i = 0; i < n; i++){
        int tmp;
        cin >>tmp;
        q.push_back(tmp);
    }
    int a = 0,b = 0;
    for(int i = 0; i < allPer.size(); i++){
        if(allPer[i] == p){
            a = i;
        }
        if(allPer[i] == q){
            b = i;
        }
    }
    printf("%d\n", abs(a-b));
    return 0;
}

Measured memory_bytes: 3256
//Switching Railroad Cars
#include<iostream>
#include<cstdio>
#include<stack>
using namespace std;

int main(void){
    stack<int> Q;
    int n;
    
    while((scanf("%d", &n) != EOF)){
        if(n == 0){
            int  x = Q.top(); Q.pop();
            printf("%d\n", x);
        }else{
            Q.push(n);
        }
    }
    
    return 0;
}

Measured memory_bytes: 1192
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
#define rep3(i,i0,n) for(int i=i0;i<(n);i++)
#define pb push_back
#define mod 1000000007
#define INF 200000000000
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; }
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;}
#define all(x) x.begin(), x.end()

bool compare(pair<int, int> a, pair<int, int> b) {
    if(a.first != b.first){
        return a.first < b.first;
        
    }else{
        return a.second < b.second;
    }
}
// 入力



int main() {
    string S;
    ll ans;
    cin >>S;
    if(S == "SUN"){
        ans = 7;
    }
    if(S == "MON"){
        ans = 6;
    }
    if(S == "TUE"){
        ans = 5;
    }
    if(S == "WED"){
        ans = 4;
    }
    if(S == "THU"){
        ans = 3;
    }
    if(S == "FRI"){
        ans = 2;
    }
    if(S == "SAT"){
        ans = 1;
    }
    


    
    cout << ans<< endl;


    return 0;
    

}

Measured memory_bytes: 3600
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <vector>
#include <queue>
#include <random>
#include <cstdint>
#include <bitset>
#include <iomanip>
#include <utility>
#include<map>
#include<functional>
#include<climits>
using namespace std;
typedef long long ll;
const int mod = 1000000007;

int main() {
	int n;
	cin >> n;
	cout << n * (n - 1) / 2 - n / 2 << endl;
	for (int i = 1; i <= n;i++) {
		for (int j = i + 1; j <= n;j++) {
			if (n % 2 == 0) {
				if ((i + j) == n + 1)continue;
				cout << i <<" "<< j<<endl;
			}
			else {
				if (i + j == n)continue;
				cout << i <<" "<< j << endl;;
			}
		}
	}
}


Measured memory_bytes: 256
import sun.reflect.generics.tree.Tree;

import java.util.Map;
import java.util.Scanner;
import java.util.TreeMap;

public class Main implements Runnable {

    private static int MOD = 1_000_000_007;

    public static void main(String[] args) {
        // Run with 32MB stack
        Thread thread = new Thread(null, new Main(), "", 32 * 1024 * 1024);
        thread.start();
    }

    @Override
    public void run() {
        final Scanner scanner = new Scanner(System.in);
        solve(scanner);
    }

    static void solve(Scanner scanner) {
        int N = Integer.parseInt(scanner.next());
        TreeMap<Integer, Integer> primes = new TreeMap<>();
        for (int i = 1; i <= N; i++) {
            primes = factorize(i, primes);
        }

        int c74 = 0, c2 = 0, c4 = 0, c14 = 0, c24 = 0;
        for (Map.Entry<Integer, Integer> entry : primes.entrySet()) {
            Integer k = entry.getKey();
            Integer v = entry.getValue();
            if (v >= 74) {
                c74++;
            }
            if (v >= 24) {
                c24++;
            }
            if (v >= 14) {
                c14++;
            }
            if (v >= 4) {
                c4++;
            }
            if (v >= 2) {
                c2++;
            }
        }

        int ans = c74;

        Combination combination = new Combination(N, 1_000_000_007);
        ans += combination.kFromN(1, c24) * combination.kFromN(1, c2 - 1);
        ans += combination.kFromN(1, c14) * combination.kFromN(1, c4 - 1);
        ans += combination.kFromN(2, c4) * combination.kFromN(1, c2 - 2);
        System.out.println(ans);

    }

    static TreeMap<Integer, Integer> factorize(int n, TreeMap<Integer, Integer> primes) {
        for (int i = 2; i * i <= n; i++) {
            while (n % i == 0) {
                primes.put(i, primes.getOrDefault(i, 0) + 1);
                n /= i;
            }
        }
        if (n != 1) {
            primes.put(n, primes.getOrDefault(n, 0) + 1);
        }
        return primes;
    }
}


class Combination {

    private final int MOD;
    private final int MAX;

    private final long[] fac, facInv, inv;

    public Combination(int max, int mod) {
        this.MAX = max + 1;
        this.MOD = mod;
        fac = new long[MAX];
        facInv = new long[MAX];
        inv = new long[MAX];

        fac[0] = fac[1] = 1;
        facInv[0] = facInv[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;
            facInv[i] = facInv[i - 1] * inv[i] % MOD;
        }
    }

    public long kFromN(int k, int n) {
        if (n < k) return 0;
        if (n < 0 || k < 0) return 0;
        return fac[n] * (facInv[k] * facInv[n - k] % MOD) % MOD;
    }
}



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

#define int long long
using ll = long long;
using ld = long double;
using intpair = pair<int, int>;
using intmap = map<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
const int MOD = 1e9 + 7;
inline int mod (ll a, int m = MOD) { return (a % m + m) % m; }
inline bool bit (ll b, ll i) { return b & (1 << i); }
inline ll ceiv (ll a, ll b) { return (a + b - 1) / b; }
//struct Fast {Fast(){cin.tie(0);ios::sync_with_stdio(0);}} fast;

#define debug(x) cerr << #x << ": " << x << '\n'
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()

signed main(){
    string s;
    cin >> s;
    if(s.back() == 's') {
        cout << s << "es" << endl;
    }else{
        cout << s << 's' << endl;
    }
}

Measured memory_bytes: 3620
H, W, K = gets.split.map(&:to_i)
MOD = 10 ** 9 + 7
dp = Array.new(H + 1) { Array.new(W, 0) }
dp[0][0] = 1
H.times do |h|
  # ある高さにおいて、2^(W-1)通りの横線の引き方がある
  (0...(1 << (W - 1))).each do |bit|
    # check
    # 正しくないあみだくじを弾く
    # 1が連続して2つあったらアウト
    flag = false
    (1...W).each do |i|
      if bit[i] == 1 && bit[i - 1] == 1
        flag = true
      end
    end
    next if flag
    # transition
    # 横線をそれぞれ調べて遷移
    W.times do |w|
      if w != W - 1 && bit[w] == 1
        target = w + 1
      elsif w != 0 && bit[w - 1] == 1
        target = w - 1
      else
        target = w
      end
      dp[h + 1][target] = (dp[h + 1][target] + dp[h][w]) % MOD
    end
  end
end
puts dp[H][K - 1]

Measured memory_bytes: 3836
import java.util.Scanner;
public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int[][]data = new int[3][3];
		for(int i = 0; i < 3; i++) {
			for(int j = 0; j < 3; j++) {
				data[i][j] = sc.nextInt();
			}
		}
		int a1 = 0;
		int b1 = data[0][0];
		int b2 = data[1][0];
		int b3 = data[2][0];
		int a2 = data[0][1]-b1;
		int a3 = data[0][2]-b1;
		if(data[0][0]==a1+b1 && data[0][1]==a2+b1 && data[0][2]==a3+b1 && data[1][0]==a1+b2 && data[1][1]==a2+b2 && data[1][2]==a3+b2 && data[2][0]==a1+b3 && data[2][1]==a2+b3 && data[2][2]==a3+b3) {
			System.out.println("Yes");
		}else System.out.println("No");
		sc.close();
	}
}

Measured memory_bytes: 24020
#include <iostream>
#include <vector>
#include <stack>
#include <algorithm>

using namespace std;

void solve(){
	int m=1,r;
	pair<int,int> next,now=make_pair(0,100);
	vector<pair<int,int> > stack;
	vector<vector<int> > ans;
	vector<int> door(1,100);
	ans.push_back(vector<int>());
	while(cin>>r, r){
//		cout << r;
//		while(door[now.first] <= 0){
//			now=stack.back();
//			stack.pop_back();
//		}
		if(r>0){
			next=make_pair(m++, r);
			ans[now.first].push_back(next.first);
			--door[now.first];
			ans.push_back(vector<int>());
			door.push_back(r-1);
//			if(now.first > 0){
				ans[next.first].push_back(now.first);
//			}
			stack.push_back(now);
			now=next;
		}else{
			int tmp=stack[stack.size()+r].first;
//			int tmp=stack.size()+r;
			ans[now.first].push_back(tmp);
			--door[now.first];
			ans[tmp].push_back(now.first);
			--door[tmp];
		}
		while(door[now.first] <= 0){
			now=stack.back();
			stack.pop_back();
		}
//		cout <<" now:"<<now.first<< endl;
	}
	for(auto it=ans.begin()+1; it!=ans.end(); ++it){
		cout << (it-ans.begin());
		sort((*it).begin(), (*it).end());
		for(auto j:(*it))if(j>0)	cout<<" "<<j;
		cout << endl;
	}
}
int main(){
	int N;
	cin >> N;
	while(--N>=0)	solve();
}

Measured memory_bytes: 1244
/*
      author  : nishi5451
      created : 14.08.2020 21:03:31
*/

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


int main(){
    int n;
    cin >> n;
    map<string,int> mp;
    string word;
    cin >> word;
    char end = word.back();
    mp[word]++;
    for(int i=1; i<n; i++){
        string word;
        cin >> word;
        if(word.front() != end){
            cout << "No" << endl;
            return 0;
        }
        end = word.back();
        mp[word]++;
        if(mp[word]==2){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
#define endl '\n'
#define fr(i,a,b) for(ll i=a; i<b; i++)
#define fr1(i,a,b) for(ll i=a; i>=b; i--)
#define ll long long int
#define ld long double
#define vi vector<ll>
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define mp(i,j) make_pair(i,j)
#define fi first
#define se second
#define input(a,n) fr(i,0,n)cin>>a[i]
#define output(a,n) fr(i,0,n)cout<<a[i]<<" "
#define dbg cout<<"hurr"<<endl;
#define dbg2 cout<<"hurr2"<<endl;
#define md 1000000007
#define inf 100000000000000000
#define sp << " " <<
#define pi 3.14159265358979323846
#define fixd(x) cout << fixed << setprecision(x);

int main()
{
    fast;
    ll n;
    cin >> n;
    ll a[n];
    input(a,n);
    ll dp[n][n],sum[n][n];
    fr(l,0,n)
    {
        fr(i,0,n)
        {
            ll j=i+l;
            if(j>=n)
                break;
            if(j==i)
            {
                dp[i][j]=0;
                sum[i][j]=a[i];
            }
            else if(j==i+1)
            {
                dp[i][j]=a[i]+a[j];
                sum[i][j]=a[i]+a[j];
            }
            else
            {
                sum[i][j]=a[i]+sum[i+1][j];
                dp[i][j]=inf;
                fr(k,i,j)
                    dp[i][j]=min(dp[i][j],dp[i][k]+dp[k+1][j]+sum[i][j]);
            }
        }
    }
    cout << dp[0][n-1];
}

Measured memory_bytes: 2816
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = uint32_t;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    string s, t;
    cin >> s >> t;
    int ans = 0;
    for (int i = 0; i < 3; ++i) {
        if(s[i] == t[i]) ans++;
    }
    cout << ans << "\n";
    return 0;
}

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

using namespace std;
using ll = long long;

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

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define debug(x) cout << #x << ": " << x << endl;
#define popcnt __builtin_popcount


int main() {
    int a, b, c;
    cin >> a >> b >> c;
    cout << a * b / 2 << endl;

    return 0;
}

Measured memory_bytes: 256
# (x,a), (x,b) → (s,a)と(t,b)は同値になる → aとbを同一視
# 連結成分を作る
N = int(input())
U = 10 ** 5
root_x = [None] * (U+1)
root_y = [None] * (U+1)
size_x = [0] * (U+1) # 連結成分のxの個数
size_y = [0] * (U+1) # 連結成分のyの個数
cnt_x = [0] * (U+1) # 生成時に登場した点
cnt_y = [0] * (U+1) # 生成時に登場した点
x_to_y = [None] * (U+1)
y_to_x = [None] * (U+1)

def find_root(root,size,x):
  y = root[x]
  if y is None:
    root[x] = x
    size[x] = 1
    return x
  if x == y:
    return y
  z = find_root(root,size,y)
  root[x] = z
  return z

def merge(root,size,cnt,x,y):
  rx = find_root(root,size,x)
  ry = find_root(root,size,y)
  if rx == ry:
    return
  sx = size[rx]
  sy = size[ry]
  if sx > sy:
    root[ry] = rx
    size[rx] += sy
    cnt[rx] += cnt[ry]
  else:
    root[rx] = ry
    size[ry] += sx
    cnt[ry] += cnt[rx]
  return

for _ in range(N):
  x,y = map(int,input().split())
  rx = find_root(root_x,size_x,x)
  ry = find_root(root_y,size_y,y)
  cnt_x[rx] += 1
  cnt_y[ry] += 1
  if x_to_y[rx] is None:
    x_to_y[rx] = ry
  if y_to_x[ry] is None:
    y_to_x[ry] = rx
  merge(root_y, size_y, cnt_y, x_to_y[rx], ry)
  merge(root_x, size_x, cnt_x, y_to_x[ry], rx)
  x_to_y[root_x[rx]] = root_y[ry]
  y_to_x[root_y[ry]] = root_x[rx]

  
answer = 0

for x in range(1,U+1):
  if root_x[x] is None:
    continue
  rx = find_root(root_x,size_x,x)
  if x != rx:
    continue
  y = x_to_y[x]
  ry = find_root(root_y,size_y,y)
  sx = size_x[rx]
  sy = size_y[ry]
  cnt = cnt_x[rx]
  answer += (sx * sy - cnt)
print(answer)


Measured memory_bytes: 11336
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Linq;

class Program
{
	static int[] minCounts;

	static void Main(string[] args)
	{
		string[] nm = Console.ReadLine().Split();

		int n = int.Parse(nm[0]);
		int m = int.Parse(nm[1]);

		int[] cs = Console.ReadLine().Split().Select(str => int.Parse(str)).ToArray();

		minCounts = new int[50001];

		// コイン1枚で実現できる金額には枚数1を入れておく
		for (int ci = 0; ci < m; ci++)
		{
			minCounts[cs[ci]] = 1;
		}

		// 1から順番に辿る
		for (int i = 1; i <= n; i++)
		{
			minCounts[i] = GetMinCounts(i);
		}
		System.Console.WriteLine(minCounts[n]);
	}

	// Kを実現する最小コイン枚数を返す
	static int GetMinCounts(int k)
	{
		// 記録済み
		if (minCounts[k] > 0) return minCounts[k];

		// 頭と後ろからの組み合わせで最小値を計算
		int min = k;
		for (int j = 1; j < k; j++)
		{
			if (k - j < j) return min;
			int current = minCounts[k - j] + minCounts[j];
			if (current < min) min = current;
		}
		return min;
	}
}



Measured memory_bytes: 9828
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
#include<complex>
#include<numeric>
using namespace std;

typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef pair<int, int>P;
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
typedef vector<vector<ll>> mat;
typedef vector<int> vec;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
const ll mod = 1000000007;
const ll INF = mod * mod;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
ll qp(ll a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };

void solve() {
    ll a,b,c,n,k;
    string s, t;
    ll ans;
    double dans;
    string sans;


    cin  >> n;
    ans = n*n*n;

    std::cout << ans << endl; 
    // std::cout << sans << endl; 
    
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(10);
    solve();
    // stop
        return 0;
}

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

#define len 3

int main(void) {
  char s[4];
  int count = 0;
  scanf("%s", s);
  for(int i = 0; i < len - 1; i++) {
    if(s[i] != s[i+1]) {
      count++;
    }
  }
  if(s[len-1] != s[0]) {
    count++;
  }
  if(count > 0) {
    printf("Yes");
  } else {
    printf("No");
  }
  return 0;
}


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

#define ll long long
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define REP(i, x) for (int i = 0; i < (int)(x); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define RREP(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define RREPS(i, x) for (int i = ((int)(x)); i > 0; i--)
#define INF 2147483647
#define LLINF 9223372036854775807LL
#define vi vector<int>
#define vvi vector<vector<int>>
#define vvvi vector<vector<vector<int>>>
#define pi pair<int, int>
#define ALL(a) (a).begin(), (a).end()
#define BIT(n) (1LL << (n))

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

int main(){
ll N,A,B; cin>>N>>A>>B;
ll amari=N%(A+B);
ll shou=N/(A+B);
ll ans=shou*A+min(amari,A);
cout<<ans<<endl;
}

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

int main(){
	int n;
  	cin>>n;
	int a[3*n];
	rep(i,3*n)cin>>a[i];
	sort(a,a+3*n);
	ll ans=0;
	rep(i,n){
		ans+=a[3*n-2-2*i];
	}
  	puts(ans);
	
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
int main() {
  ll n, ans;
  cin >> n;
  double sqrtNum = sqrt(n);
  for (ll i = floor(sqrtNum); i > 0; i--) {
    if (n % i == 0) {
      ans = i;
      break;
    }
  }
  cout << (n / ans) + ans - 2;
  return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int num = sc.nextInt();
		String array[][] = new String[num][3];
		for(int i = 0; i < num; i ++) {
			array[i][0] = sc.next();
			array[i][1] = sc.next();
			array[i][2] = String.valueOf(i + 1);
		}
		Arrays.sort(array, (a, b) -> Integer.compare(Integer.parseInt(b[1]), Integer.parseInt(a[1])));
		Arrays.sort(array, (a, b) -> a[0].compareTo(b[0]));
		for(int i = 0; i < num; i ++) {
			System.out.println(array[i][2]);
		}
	}
}

Measured memory_bytes: 26572
#include <cstdio>
#include <iostream>
#include <cstring>
#include <algorithm>
#include <cstring>
#include <vector>

#define For(i, j, k) for(int i = j; i <= k; i++)
#define Forr(i, j, k) for(int i = j; i >= k; i--)
#define pb push_back

using namespace std;

const int N = 1010010;
const int Mod = 924844033;
const int r = 5;

typedef long long LL;

LL Pow(LL x, LL e){
	LL ret = 1;
	while(e){
		if(e & 1) ret = ret * x % Mod;
		x = x * x % Mod;
		e >>= 1;
	}
	return ret;
}

int rev[N];

void DFT(LL* A, int n, bool inv){
	For(i, 0, n - 1) if(i < rev[i]) swap(A[i], A[rev[i]]);
	for(int i = 2; i <= n; i <<= 1){
		LL w = Pow(r, (Mod - 1) / i);
		if(inv) w = Pow(w, Mod - 2);
		for(int j = 0; j < n; j += i){
			LL cur = 1;
			for(int k = 0; k < (i >> 1); ++k){
				LL x = A[j + k], y = A[j + k + (i >> 1)] * cur % Mod;
				A[j + k] = (x + y) % Mod, A[j + k + (i >> 1)] = (x - y + Mod) % Mod;
				cur = cur * w % Mod;
			}
		}
	}
}

void NTT(LL *A, LL *B, int m){
	int n = 1;
	while(n <= m + 2) n <<= 1;
	For(i, 1, n - 1) rev[i] = (rev[i >> 1] >> 1) | (i & 1 ? n >> 1 : 0);
	DFT(A, n, 0), DFT(B, n, 0);
	For(i, 0, n - 1) A[i] = A[i] * B[i] % Mod;
	DFT(A, n, 1);
	LL inv = Pow(n, Mod - 2);
	For(i, 0, n - 1) A[i] = A[i] * inv % Mod;
}

LL coe[N], F[N], fac[N], rfac[N];
int n, sz[N];
vector<int> G[N];

void DFS(int o, int f){
	sz[o] = 1;
	for(int v : G[o]){
		if(v == f) continue;
		DFS(v, o);
		sz[o] += sz[v];
		coe[sz[v]]++;
	}
	if(n > sz[o]) coe[n - sz[o]]++;
}

LL C(int a, int b){
	return fac[a] * rfac[b] % Mod * rfac[a - b] % Mod;
}

int main(){
	scanf("%d", &n);
	For(i, 2, n){
		int u, v;
		scanf("%d%d", &u, &v);
		G[u].pb(v), G[v].pb(u);
	}

	fac[0] = 1;
	For(i, 1, n) fac[i] = fac[i - 1] * i % Mod;
	rfac[n] = Pow(fac[n], Mod - 2);
	Forr(i, n - 1, 0) rfac[i] = rfac[i + 1] * (i + 1) % Mod;
	DFS(1, 0);

	For(i, 1, n) coe[i] = coe[i] * fac[i] % Mod;
	For(i, 0, n) F[i] = rfac[n - i];

	NTT(coe, F, 2 * n);

	For(i, 1, n) printf("%lld\n", (1ll * n * C(n, i) % Mod - coe[n + i] * rfac[i] % Mod + Mod) % Mod);
	return 0;
}

Measured memory_bytes: 68224
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;

int main() {
	int a[100];
	int b, c;
	cin >> b >> c;
	for (int d = 0; d < b; d++) {
		scanf("%d", &a[d]);
	}
	for (int k = 2; k <= c; k++) {
		for (int g = 0; g < b - 1; g++) {
			if (a[g] % k > a[g + 1] % k)swap(a[g], a[g + 1]);
		}
	}
	for (int s = 0; s < b; s++) {
		cout << a[s] << endl;
	}
}

Measured memory_bytes: 3240
def count(n):
    if n == 0:
        return 0
    return count(n >> 1) + (n & 1)


N = int(input())

shogen = [[] for _ in range(N)]

for i in range(N):
    a = int(input())
    for _ in range(a):
        shogen[i].append(list(map(int, input().split())))
ans = 0
for i in range(1 << N):
    ok = True
    for j in range(N):
        if not (i & (1 << j)):
            continue
        for s in shogen[j]:
            if ((i >> (s[0] - 1)) & 1) ^ s[1]:
                ok = False
    if ok:
        ans = max(ans, count(i))
print(ans)

Measured memory_bytes: 3064