akhauriyash/Code-Regression huggingface dataset:
#include "algorithm"
#include "functional"
#include "iostream"
#include "map"
#include "set"
#include "string"
#include "vector"
#define rep(i, to) for (ll i = 0; i < (to); ++i)
#define all(vec) vec.begin(), vec.end()
using namespace std;
typedef long long ll;

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

  ll N, M, V, P;
  cin >> N >> M >> V >> P;

  vector<ll> as(N);

  rep(i, N) {
    ll a;
    cin >> a;
    as[i] = a;
  }

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

  auto check = [&](ll i) {
    ll a = as[i];
    ll rest = M * V;

    ll served = 0;
    auto over_it = upper_bound(as.begin(), as.end(), a + M);
    ll over_index = over_it - as.begin();
    ll over_a_ct = N - over_index;
    if (over_a_ct >= P) return false;
    rest -= over_a_ct * M;
    served += over_a_ct;
    ll can_over = P - over_a_ct - 1;

    if (rest <= 0) return true;

    ll over_a_i = upper_bound(as.begin(), as.end(), a) - as.begin();
    ll sm_eq_a_ct = over_a_i;
    rest -= sm_eq_a_ct * M;
    served += sm_eq_a_ct;

    if (rest <= 0) return true;

    over_index -= can_over;
    rest -= can_over * M;
    served += can_over;

    if (rest <= 0) return true;

    ll b_i = upper_bound(as.begin(), as.end(), a) - as.begin();

    for (ll ii = b_i; ii < over_index; ii++) {
      rest -= a + M - as[ii];
      served++;
    }

    return rest <= 0 && served >= V;
  };

  if (check(0)) {
    cout << N << endl;
    return 0;
  }

  ll ng = 0;
  ll ok = N - 1;

  while (ok - ng > 1) {
    ll mid = (ng + ok) / 2;
    if (check(mid)) {
      ok = mid;
    } else {
      ng = mid;
    }
  }

  ll res = N - ok;
  cout << res << endl;

  return 0;
}


Measured memory_bytes: 1024
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {

	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		String[] tmpArray = br.readLine().split(" ");
		int n = Integer.parseInt(tmpArray[0]);
		int k = Integer.parseInt(tmpArray[1]);
		
		tmpArray = br.readLine().split(" ");
		int r = Integer.parseInt(tmpArray[0]);
		int s = Integer.parseInt(tmpArray[1]);
		int p = Integer.parseInt(tmpArray[2]);
		
		String input = br.readLine();
		
		int[][] dp = new int[n][3];
		
		for(int i = 0; i < n; i++) {
			char tmpC = input.charAt(i);
			
			int tmpMax = 0;
			if(i >= 1) {
				for(int j = 0; j < 3; j++) {
					tmpMax = Math.max(tmpMax, dp[i - 1][j]);
				}
			}
			Arrays.fill(dp[i], tmpMax);
			
			if(tmpC == 'r') {
				dp[i][2] += p;
				if(i >= k && dp[i - k][2] > dp[i - k][0] && dp[i - k][2] > dp[i - k][1]) {
					dp[i][2] -= p;
				}
			}
			else if(tmpC == 's') {
				dp[i][0] += r;
				if(i >= k && dp[i - k][0] > dp[i - k][1] && dp[i - k][0] > dp[i - k][2]) {
					dp[i][0] -= r;
				}
			}
			else {
				dp[i][1] += s;
				if(i >= k && dp[i - k][1] > dp[i - k][0] && dp[i - k][1] > dp[i - k][2]) {
					dp[i][1] -= s;
				}
			}
			
		}
		
		System.out.println(Math.max(dp[n-1][0], Math.max(dp[n-1][1], dp[n-1][2])));
	}
}


Measured memory_bytes: 29268
#include <bits/stdc++.h>
using ll = long long;
#define FOR(i, k, n) for(ll i = (k); i < (n); i++)
#define FORe(i, k, n) for(ll i = (k); i <= (n); i++)
#define FORr(i, k, n) for(ll i = (k)-1; i > (n); i--)
#define FORre(i, k, n) for(ll i = (k)-1; i >= (n); i--)
#define REP(i, n) FOR(i, 0, n)
#define REPr(i, n) FORre(i, n, 0)
#define ALL(x) (x).begin(), (x).end()
#define ALLr(x) (x).rbegin(), (x).rend()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;

const int INF = 1001001001;

int main(void){
  ll n, a, b;
  cin >> n >> a >> b;
  vector<ll> x(n);
  REP(i, n) cin >> x[i];
  ll ans = 0;
  REP(i, n-1){
    ll d = x[i+1] - x[i];
    if(a*d < b) ans += a*d;
    else ans += b;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1024
using System;
using System.Linq;
using System.Collections.Generic;

class Mondai
{
    static void Main()
    {
        var nk = Console.ReadLine().Split(' ').Select(x => Int32.Parse(x)).ToArray();
        var N = nk[0];
        var K = nk[1];
        var D = Console.ReadLine().Where(x=>x!=' ').ToArray();
        for (int i=N; ; i++)
        {
            var n = i.ToString().ToCharArray();
            var flg = true;
            for (int j=0;j<n.Length;++j) if (D.Contains(n[j])) flg = false;
            if (flg)
            {
                Console.WriteLine(i);
                return;
            }
        }
    }
}

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

using namespace std;
#define _for(i,j,N) for(int i = (j);i < (N);i++)
#define _rep(i,j,N) for(int i = (j);i <= (N);i++)
#define _dec(i,N,j) for(int i = (N-1);i >= (j);i--)
#define _rec(i,N,j) for(int i = (N);i >=(j);i--)
#define ALL(x) x.begin(),x.end()
#define MEM(a,n) memset(a,n,sizeof(a))
#define fst first
#define scd second
#define PB push_back
#define MP make_pair

typedef long long LL;
typedef long double LD;
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;

int get_int(){int x;scanf("%d",&x);return x;}
LL get_ll(){LL x;scanf("%lld",&x);return x;}
double get_db(){double x;scanf("%lf",&x);return x;}

template<typename T> int chmin(T &a,T b){if(a > b){a = b;return 1;}else return 0;}
template<typename T> int chmax(T &a,T b){if(a < b){a = b;return 1;}else return 0;}
template<typename T>
ostream& operator<<(ostream& os,const vector<T>& v) {_for(i,0,v.size()) os << v[i] << " ";return os;}
template<typename T>
ostream& operator<<(ostream& os,const set<T>& v){for(auto a:v) os << a <<" ";return os;}
template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& v){os << v.fst <<" "<<v.scd << " ";return os;}
template<typename T1,typename T2>
ostream& operator<<(ostream& os,const map<T1,T2>& v){for(auto a:v) cout << a << endl;return os;}

static const int dx[8] = { -1,  0, 1, 0,  1, -1,  1, -1};
static const int dy[8] = {0,  1, 0,  -1,  1, -1, -1,  1};
const double pi  = acos(-1.0);
const double eps = 1e-8;
const LL  INF  = 0x3f3f3f3f3f3f3f3f;
const int inf  = 0x3f3f3f3f;

const int maxn = 1e6+5;
const int max_prime = 1005;

int is_pair = 1;
int is_set = 1;

int A[maxn];
int prime[max_prime];
int N;

map<int,int> mp;

void get_prime(){
    _for(i,2,max_prime){
        prime[i] = 1;
    }
    _for(i,2,max_prime){
        if(prime[i]){
            for(int j = i+i;j < max_prime;j += i){
                prime[j] = 0;
            }
        }
    }
}

void factor(int n)
{
	int i ,temp = sqrt(n + 1);

	for(i = 2; i <= temp; i++)
	{
        if(prime[i]){
            int c = 0;
            _for(j,0,N){
                if(A[j] % i == 0){
                    c++;
                    while(A[j] % i == 0) A[j] /= i;
                }
            }

          //if(i == 5) cout << c << endl;

            if(c >= 2){
                is_pair = 0;
            }
            if(c == N){
                is_set = 0;
            }
        }
        if(!is_pair && !is_set) return;
	}

    _for(i,0,N){
        if(A[i] != 1){
            mp[A[i]]++;
        }
    }
    for(auto a:mp){
        if(a.second >= 2) is_pair = 0;
        if(a.second == N) is_set = 0;
    }

}




int main()
{
    cin >> N;

    _for(i,0,N){
        cin >> A[i];
    }



    get_prime();
    factor(maxn);

    if(is_pair){
        cout << "pairwise coprime" <<endl;
    }else if(is_set){
        cout << "setwise coprime" <<endl;
    }else{
        cout << "not coprime" <<endl;
    }

    return 0;
}


Measured memory_bytes: 10928
#include<bits/stdc++.h>
#define jaldi ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
const int N = 2e5+5;
vector<int> adj[N];
vector<int> ans[N];
vector<int> visited(N+1);
int k=0;
void DFSUtil(int v)
{
    visited[v] = true;
//    cout << k<<" "<<v << " ";
    ans[k].push_back(v);
    for(int i = 0; i < adj[v].size(); ++i)
        if(!visited[adj[v][i]])
            DFSUtil(adj[v][i]);
}

void connectedComponents(vector<int> arr[], int V)
{
    // Mark all the vertices as not visited
    for(int v = 1; v <= V; v++)
        visited[v] = false;

    for (int v=1; v<=V; v++)
    {
        if (visited[v] == false)
        {
            DFSUtil(v);
            k++;
//            cout << "\n";
        }
    }
}



// method to add an undirected edge
void addEdge(int v, int w)
{

}

int main() {
    int n;
    int m;
    cin>>n;
    cin>>m;
    int x;
    int y;

    while(m--) {
        cin>>x;
        cin>>y;
        adj[x].push_back(y);
        adj[y].push_back(x);
    }

    connectedComponents(ans,n);
    int maxi = INT_MIN;
    for(int i=0;i<N;i++) {
        if(ans[i].size()!=0) {
            int k = ans[i].size();
            if(k>maxi) {
                maxi = k;
            }
        }
    }
    cout<<maxi<<'\n';
}

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

// FIXME:　クラス名をMainに修正してからコミットすること。
class Main {

    // エントリポイント
    public static void main(String args[]) {
        doLogic();
    }

    // 定数
    private static final int TOP = 0;
    private static final int NORTH = 1;
    private static final int EAST = 2;
    private static final int SOUTH = 3;
    private static final int WEST = 4;

    // フィールド
    private static int sum = 1;
    private static int[] dice = new int[5]; // TOP, NORTH, EAST, SOUTH, WEST を保持

    /**
     * サイコロに対するコマンドを実行する。
     *
     * @param command コマンド
     */
    private static void doCommand(String command) {
        int tmp = 0;
        if ("Right".equals(command)) {
            tmp = dice[4];
            for (int j = 3; j >= 1; j--) {
                dice[j + 1] = dice[j];
            }
            dice[1] = tmp;

        } else if ("Left".equals(command)) {
            tmp = dice[1];
            for (int j = 1; j <= 3; j++) {
                dice[j] = dice[j + 1];
            }
            dice[4] = tmp;

        } else if ("North".equals(command)) {
            dice[NORTH] = dice[TOP];
            dice[TOP] = dice[SOUTH];
            dice[SOUTH] = 7 - dice[NORTH];

        } else if ("South".equals(command)) {
            dice[SOUTH] = dice[TOP];
            dice[TOP] = dice[NORTH];
            dice[NORTH] = 7 - dice[SOUTH];

        } else if ("East".equals(command)) {
            dice[EAST] = dice[TOP];
            dice[TOP] = dice[WEST];
            dice[WEST] = 7 - dice[EAST];

        } else if ("West".equals(command)) {
            dice[WEST] = dice[TOP];
            dice[TOP] = dice[EAST];
            dice[EAST] = 7 - dice[WEST];
        }
    }

    /**
     * 標準入力を1行読む（例外処理を切り出し）
     *
     * @param reader 入力ストリーム
     * @return 1行分のデータ
     */
    private static String readLine(BufferedReader reader) {
        String line = null;
        try {
            line = reader.readLine();
        } catch (IOException e) {
            throw new RuntimeException();
        }
        return line;
    }

    /**
     * メインロジック
     *
     */
    private static void doLogic() {

        // 標準入力のストリームを作成する
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));

        String input = null;
        while (true) {
            input = readLine(reader);
            int loop = Integer.parseInt(input);

            // 終了判定を行う
            if (loop == 0) {
                break;
            }

            // 初期化する
            sum = 1;
            dice[0] = 1;
            dice[1] = 5;
            dice[2] = 3;
            dice[3] = 2;
            dice[4] = 4;

            // 指定された数だけコマンドを実行する
            for (int i = 0; i < loop; i++) {
                String command = readLine(reader);
                doCommand(command);
                sum += dice[0];
            }
            System.out.println(sum);

        }
    }
}

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

int main(){
    int r;
    cin >> r;
    cout << 3 * r * r << endl;
    return 0;
}

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

using namespace std;

#define rep(i,j) REP((i), 0, (j))
#define REP(i,j,k) for(int i=(j);(i)<(k);++i)
#define BW(a,x,b) ((a)<=(x)&&(x)<=(b))
#define ALL(v) (v).begin(), (v).end()
#define LENGTHOF(x) (sizeof(x) / sizeof(*(x)))
#define AFILL(a, b) fill((int*)a, (int*)(a + LENGTHOF(a)), b)
#define MP make_pair
#define PB push_back
#define F first
#define S second
#define INF 1 << 30
#define EPS 1e-10

typedef pair<int, int> pi;
typedef pair<int, pi> pii;
typedef vector<int> vi;
typedef queue<int> qi;
typedef long long ll;

int flag[1024][1024], cr[2][2], M, N;

int count(int y, int x){
  int res = 0;
  REP(i, -1, 1) REP(j, -1, 1){
    int ny = y+i, nx = x+j;
    if(ny < 0 || nx < 0 || ny+1 >= M || nx+1 >= N) continue;
    int f = 1;
    rep(k, 2) rep(l, 2) if(flag[ny+k][nx+l] != cr[k][l]) f = 0;
    res += f;
  }
  return res;
}

int main(){
  char in[1024];
  scanf("%d%d", &M, &N);
  rep(i, M){
    scanf("%s", in);
    rep(j, N){
      if(in[j] == 'J') flag[i][j] = 0;
      else if(in[j] == 'O') flag[i][j] = 1;
      else flag[i][j] = 2;
    }
  }
  rep(i, 2){
    scanf("%s", in);
    rep(j, 2){
      switch(in[j]){
      case 'J': cr[i][j] = 0; break;
      case 'O': cr[i][j] = 1; break;
      case 'I': cr[i][j] = 2; break;
      }
    }
  }

  int sum = 0;
  rep(i, M-1) rep(j, N-1){
    if(flag[i][j] != cr[0][0]) continue;
    if(flag[i+1][j] == cr[1][0] && flag[i+1][j+1] == cr[1][1] && flag[i][j+1] == cr[0][1]) sum++;
  }

  int res = sum;
  rep(i, M) rep(j, N){
    int tmpc = count(i, j), tmp = flag[i][j];
    rep(k, 3){
      if(tmp == k) continue;
      flag[i][j] = k;
      res = max(res, sum - tmpc + count(i, j));
    }
    flag[i][j] = tmp;
  }
  printf("%d\n", res);
  return 0;
}

Measured memory_bytes: 5284
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
#define fi first
#define se second
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define pf push_front
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define SZ(x) (int)(x).size()
#define endl '\n'
#define FOR(a, b, c) for (auto(a) = (b); (a) < (c); ++(a))
#define ROF(a, b, c) for (auto(a) = (b); (a) > (c); --(a))
#define F0R(a, b) FOR ((a), 0, (b))
#define R0F(a, b) ROF ((a), (b), -1)
#define CEIL(a, b) ((a) + (b)-1) / (b)
#define SET(a, b) memset((a), (b), sizeof(a))
template <class t>
bool ckmin(t& a, const t& b) {
    return a > b ? a = b, true : false;
}
template <class t>
bool ckmax(t& a, const t& b) {
    return a < b ? a = b, true : false;
}
#ifndef DEBUG
#define DEBUG 0
#endif
#define dout \
    if (DEBUG) std::cerr
#define dvar(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
template <class a, class b>
ostream& operator<<(ostream& o, const pair<a, b>& p);
template <class T>
struct IsC {
    template <class C>
    static char test(typename C::const_iterator*);
    template <class C>
    static int test(...);
    static const bool value = sizeof(test<T>(0)) == sizeof(char);
};
template <>
struct IsC<string> {
    static const bool value = false;
};
template <class C>
typename enable_if<IsC<C>::value, ostream&>::type operator<<(ostream& o,
                                                             const C& c) {
    o << '[';
    for (auto it = c.begin(); it != c.end();)
        o << *it << (++it != c.end() ? ", " : "");
    return o << ']';
}
template <class a, class b>
ostream& operator<<(ostream& o, const pair<a, b>& p) {
    return o << '(' << p.fi << ", " << p.se << ')';
}

void solve() {
    ll n;
    cin >> n;
    ll nn = n;
    vi factors;
    for (ll i = 2; i <= n; ++i) {
	if (i * i > nn) {
	    factors.pb(1);
	    break;
	}
	int cnt = 0;
	while (n % i == 0) {
	    n /= i; ++cnt;
	}
	if (cnt) factors.eb(cnt);
    }
    int score = 0;
    for (int cnt : factors) {
        for (int i = 1; i <= cnt; ++i) {
	    ++score;
	    cnt -= i;
	}
    }
    cout << score << endl;
}

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

    int tt = 1;
    FOR (t, 1, tt + 1) {
	// cout << "Case #" << t << ": ";
	solve();
    }

    return 0;
}


Measured memory_bytes: 3652
using System;
using System.Collections.Generic;
using System.Linq;

namespace ABC120_D
{
    class Program
    {
        static void Main(string[] args)
        {
            var NM = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var N = NM[0];
            var M = NM[1];

            long path = (long)N * (long)(N - 1) / 2L;

            var a = new int[M];
            var b = new int[M];
            for (int i = 0; i < M; i++)
            {
                var input = Console.ReadLine().Split().Select(int.Parse).ToArray();
                a[i] = input[0] - 1;
                b[i] = input[1] - 1;
            }

            var uf = new UnionFind(N);
            var ans = new long[M];
            for (int i = M - 1; i >= 0; i--)
            {
                ans[i] = path;

                if (!uf.Same(a[i], b[i]))
                {
                    long sizeA = uf.Size(a[i]);
                    long sizeB = uf.Size(b[i]);
                    path = path - sizeA * sizeB;
                    uf.Unite(a[i], b[i]);
                }
            }

            for (int i = 0; i < M; i++)
            {
                Console.WriteLine(ans[i]);
            }
        }
    }

    class UnionFind
    {
        public List<int> Par;
        public List<int> Sizes;

        public UnionFind(int n)
        {
            Par = new List<int>();
            Sizes = new List<int>();
            for (int i = 0; i < n; i++)
            {
                Par.Add(i);
                Sizes.Add(1);
            }
        }

        public int Find(int x)
        {
            if (x == Par[x]) return x;
            Par[x] = Find(Par[x]);
            return Par[x];
        }

        public void Unite(int x, int y)
        {
            x = Find(x);
            y = Find(y);
            if (x == y) return;

            if (Sizes[x] < Sizes[y])
            {
                int temp = x;
                x = y;
                y = temp;
            }

            Par[y] = x;
            Sizes[x] += Sizes[y];
            Sizes[y] = 0;
        }

        public bool Same(int x, int y)
        {
            return Find(x) == Find(y);
        }

        public int Size(int x)
        {
            return Sizes[Find(x)];
        }
    }

}

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


int main(){


    string s, t;

    int i;

    int k = 0;

 
    cin >> s >> t;


    for( i = 0 ; i < 3 ; i = i + 1 ){

         if( s.at(i) == t.at(i) ) k += 1;

         }


    cout << k << endl;
         

    return 0;


    }

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

int main() {
  int n,sum = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int l,r;
    cin >> l >> r;
    sum += r - l + 1;
  }
  cout << sum << endl;
}


Measured memory_bytes: 3516
import bisect
A,B,Q=map(int,input().split())
INF=10**18
S=[-INF]+[int(input()) for i in range(A)]+[INF]
T=[-INF]+[int(input()) for i in range(B)]+[INF]
for q in range(Q):
    x=int(input())
    i=bisect.bisect_right(S,x)
    j=bisect.bisect_right(T,x)
    d=INF
    for s in [S[i-1],S[i]]:
        for t in[T[j-1],T[j]]:
            d1=abs(s-x)+abs(s-t)
            d2=abs(t-x)+abs(s-t)
            d=min(d,d1,d2)
    print(d)

Measured memory_bytes: 12824
#include <bits/stdc++.h>
using namespace std;
#define int        long long 
#define test       int t;cin>>t;while(t--)
#define tezi       ios_base::sync_with_stdio(false);cin.tie(NULL);
#define F(i,a,b)   for(int i=a;i<b;i++)
#define pb         push_back
#define mp         make_pair
#define pii        pair<int,int>
#define vi         vector<int>
#define umap       unordered_map<int,int>
#define maxN 200005
#define endl "\n"
#define YES cout<<"YES\n";
#define NO  cout<<"NO\n";
#define lld long long

signed main(){
    // int n; lld h;
    // cin>>n>>h;
    // string path = "";
    // lld ll = pow(2,n);
    // lld c = ll;
    // while(c>0) { 
    //     c = c/2;
    //     if(c==0) break;
    //     if(h <= c) path += "L" ;
    //     else path += "R",h = h-c;
    // }
    // char prev = 'R';
    // lld d = ll;
    // lld visited = 0;
    // for(int i=0;i<path.size();i++) { 
    //     if(prev!=path[i]) {
    //         visited++;
    //     } else {
    //         visited += d;
    //     }
 
    //     prev = path[i];
    //     d/=2;
    // }
    // cout<<visited;

    int n,m,num;
    cin>>n>>m>>num;

    umap freqr,freqc;
    int a,b;
    int ans = 0;
    pii *arr = new pii[num];
    set<pii> filled;
    F(i,0,num){
        cin>>a>>b;
        filled.insert(mp(a,b));
        freqr[a]++;
        freqc[b]++;
    }
    umap :: iterator it;
    a = 0,b = 0;
    int r,c;

    for(it = freqc.begin();it!=freqc.end();it++){
        if(it->second > a){
            a = it->second;
            c = it->first;
        }
    }
    for(it = freqr.begin();it!=freqr.end();it++){
        int k = it->second;
        if(filled.count({it->first,c})!=0)k--;
        if(k > b){
            b = k;
            r = it->first;
        }
    }
    ans = a+b;
    // if(filled.count(mp(r,c))!= 0)ans--;
    a = 0,b = 0;
    r,c;
    for(it = freqr.begin();it!=freqr.end();it++){
        if(it->second > b){
            b = it->second;
            r = it->first;
        }
    }
    for(it = freqc.begin();it!=freqc.end();it++){
        int k = it->second;
        if(filled.count(mp(r,it->first))!=0)k--;
        if(k > a){
            a = k;
            c = it->first;
        }
    }
    int tmp = a+b;
    // if(filled.count(mp(r,c))!=0)tmp--;
    ans = max(tmp,ans);
    
    cout<<ans<<"\n";
}



Measured memory_bytes: 53516
import fractions
n=int(input())
t=[int(input()) for i in range(n)]
t.sort()
check=t[0]
if n==1:
    print(check)
else:
    for i in range(n-1):
        f1=fractions.gcd(check,t[i+1])
        f2=check*t[i+1]//f1
        check=f2
    print(f2)

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

int cmp(const void *a, const void *b) {
    int *p = *(int**)a; int *q = *(int**)b;
    if( p[0] > q[0] )       { return 1; }
    else if( p[0] < q[0] )  { return -1; }
    else                    { return 0; }
}

int main()
{
    int i, n, m, temp;
    unsigned long long mny;
    scanf("%d %d", &n, &m);
    int **a = (int **)malloc(n * sizeof(int *));
    a[0] = (int *)malloc(n*2*sizeof(int));
    for(i = 1; i < n; ++i) { a[i] = a[0] + i*2; }
    for(i = 0; i < n; ++i) { scanf("%d %d", &a[i][0], &a[i][1]); }
    qsort(a, n, sizeof(int*), cmp);
    //for(i = 0; i < n; ++i) { printf("%d %d\n", a[i][0], a[i][1]); }

    //printf("---------\n");
    i = 0; mny = (unsigned long long)0;
    for(i = 0; (i < n && m > 0); ++i) {
        temp = ( a[i][1] <= m) ? a[i][1] : m;
        mny += (unsigned long long)a[i][0] * (unsigned long long)temp;
        m -= temp;
    }
    printf("%llu\n", mny);
    return 0;
}

Measured memory_bytes: 2556
// KNOW NOTHING!
#include <bits/stdc++.h>
#define ll long long int
#define F(i,j,k,in) for(ll i=j;i<k;i+=in)
#define DF(i,j,k,in) for(int i=j;i>=k;i-=in)
#define feach(it,l) for (auto it = l.begin(); it != l.end(); ++it)
#define fall(a) a.begin(),a.end()
#define sz(x) (int)x.size()
#define szs(x) (int)s.length()
#define pb push_back
#define ub upper_bound
#define lb lower_bound
#define eq equal_range
#define fs first
#define ss second
#define ins insert
#define mkp make_pair
#define endl "\n"
using namespace std;
typedef vector<ll> vll;
typedef vector<int> vin;
typedef vector<char> vch;
typedef vector<string> vst;
typedef set<ll> sll;
typedef set<int> sint;
typedef set<char> sch;
typedef set<string> sst;
typedef queue<ll> qll;
typedef queue<int> qin;
typedef deque<ll> dqll;
typedef deque<int> dqint;
typedef priority_queue<ll> pqll;
typedef priority_queue<int> pqin;
typedef map<ll,ll> mpll;
typedef map<int,int> mpin;
typedef pair<ll,ll> pll;
typedef pair<int,int> pin;
const ll MOD=1000000007;
const long double PI=3.1415926535897932384626433832795;
ll pwr(ll b,ll p){ll res=1;while(p){if(p&1) {res*=b; p--;}else{b*=b; p>>=1;}}return res;}
const int maxn = 1e5;
vin adj [maxn];
int ans [maxn];
int vis [maxn];
int n , m;
bool flag = false;

void bfs (int a) {
	F (i,1,n,1) ans[i]=-1;
	qin q;
	q.push(a);
	vis[a]=1;
	while (!q.empty()) {
		int u=q.front();
		q.pop();
		for (auto v:adj[u]) {
			if (!vis[v]) {vis[v]=1; q.push (v); ans[v]=u;}
		}
	}
	F (i,1,n,1) if (ans[i]==-1) flag=true;
}

int main()
{
/*
freopen ("input.txt","r","stdin");
freopen ("output.txt","w","stdout");
*/
ios_base::sync_with_stdio(false) , cin.tie(NULL) , cout.tie(NULL);
cin>>n>>m;
F (i,0,m,1) {
	int a , b; cin>>a>>b; --a; --b;
	adj[a].pb(b);  adj[b].pb(a);
}
bfs (0);
if (flag) cout<<"No";
else {
	cout<<"Yes"<<endl;
	F (i,1,n,1) cout<<ans[i]+1<<endl;
}
return 0;
}
/* What we know is a drop , but what we don't know is an ocean !*/

Measured memory_bytes: 10864
#include<iostream>
#include<string>
#include<iomanip>
#include<algorithm>
using namespace std;
#define int long long
#define rep(i,n) for(int i = 0; i < n; i++)
#define INF (long long)(1e18)
#define MOD (int)(1e9+7)
#define min(a,b) (a>b?b:a)
#define max(a,b) (a>b?a:b)
#define yn(f) (f?"Yes":"No")
#define YN(f) (f?"YES":"NO")


signed main(){
	cout<<fixed<<setprecision(7);
	int n, m;
	int a, b, c, d;
	bool flag = false, f = true;
	string s, t;
	
	cin>>n>>m;
	
	cout<<n+m/2<<endl;
	
	// cout<<yn(f)<<endl;
	
	return 0;
}

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


public class Main{

	public static void main(String[] args)throws IOException {
		// TODO ?????????????????????????????????????????????

		BufferedReader insBR = new BufferedReader(new InputStreamReader(System.in));
		//?¬?????????????

		String strNum = insBR.readLine();
		int n = Integer.parseInt(strNum);

		//x?????§?¨?????????????????´?
		String[] xAry = insBR.readLine().split(" ");
		//y?????§?¨?????????????????´?
		String[] yAry = insBR.readLine().split(" ");

		//xy?????§?¨????????¬?????????????????´?
		int[][] xyAry = new int[2][n];
		for(int i = 0; i < n; i++){

			xyAry[0][i] = Integer.parseInt(xAry[i]);
			xyAry[1][i] = Integer.parseInt(yAry[i]);
		}


		//P=1??????????????¢????????????????????°
		double dbDistance01 = 0.0;

		//P=2??????????????¢????????????????????°(??????????????????????¨????)
		double dbDistance02 = 0.0;

		//P=3??????????????¢????????????????????°(??????????????????????¨????)
		double dbDistance03 = 0.0;

		//P=?????????????????¢????????????????????°
		double dbDistance04 = 0.0;


		for(int i = 0; i < n; i++){

			//P=1(???????????????????????¢)
			dbDistance01 += Math.abs(xyAry[0][i]-xyAry[1][i]);


			//P=2 2?????????(???????????????????????¢)?????¢???????????§???
			//??????????????§??¶??????????¨??????????
			dbDistance02 += Math.pow(xyAry[0][i]-xyAry[1][i],2);

			//P=3 3?????????
			dbDistance03 += Math.pow(Math.abs(xyAry[0][i] - xyAry[1][i]),3);

			//P=?????????
			//???????????????max??¨???????????????dbDistance04?????£??\
			if(i == 0){
				dbDistance04 = Math.abs(xyAry[0][i] - xyAry[1][i]);
			}else{

				if(dbDistance04 < Math.abs(xyAry[0][i] - xyAry[1][i])){
					//????????§?????????????????£?????????
					dbDistance04 = Math.abs(xyAry[0][i] - xyAry[1][i]);

				}

			}

		}


		//System.out.println("?????????????????????");
		System.out.println(dbDistance01);


		//????????????????????????????¨????
		dbDistance02 = Math.sqrt(dbDistance02);
		System.out.println(dbDistance02);

		//??????????¨????
		dbDistance03 = Math.cbrt(dbDistance03);
		System.out.println(dbDistance03);

		//?????§????????§????????¢
		System.out.println(dbDistance04);
	}

}

Measured memory_bytes: 17120
n = int(input())
zyusyo = list(map(int, input().split(" ")))

min_zyusho = min(zyusyo)
max_zyusyo = max(zyusyo)

ans = 10**9
for p in range(min_zyusho, max_zyusyo+1):
    sum = 0
    for z in zyusyo:
        sum += (z-p)**2
    if sum < ans:
        ans = sum

print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
 
using namespace std;
 
using tint = long long;
using ld = long double;
 
#define forsn(i, s, n) for(int i = s; i < int(n); i++)
#define forn(i, n) forsn(i, 0, n)
 
using vi = vector<tint>;
#define pb push_back
#define rsz resize
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
 
using pi = pair<int,int>;
#define f first
#define s second
#define mp make_pair
 
#define DBG(x) cerr << #x << " = " << x << endl;
 
const int MOD = 1e9+7;
const int MX = 5e5+5;
const tint INF = 1e18;
const ld PI = acos(ld(-1)); 
 
void NACHO(string name = "out"){
    ios_base::sync_with_stdio(0); cin.tie(0);
    //freopen((name+".in").c_str(), "r", stdin);
    //freopen((name+".out").c_str(), "w", stdout);
}
 
int main(){
	NACHO();
	int n;
	cin >> n;
	vi a (n);
	forn(i, n) cin >> a[i];
	function<tint(tint)> f = [&](tint b){
		tint tot = 0;
		forn(i, n) tot+=abs(a[i]-(b+i+1));
		return tot;
	};
	tint lo = -INF, hi = INF;
	while (hi - lo > 1){
		tint mid = (hi + lo)>>1;
		if (f(mid) < f(mid + 1)) 
			hi = mid;
		else 
			lo = mid; 
	}
	tint mini = INF;
	forsn(i, lo, hi+1) mini = min(mini, f(i));
	cout << mini << "\n";
}


Measured memory_bytes: 4732
#include <iostream>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <stack>
#define ll long long
#define PI = acos(-1.0);
//#define local

using namespace std;

const int MOD = 1e9+7;
const int inf = 0x3f3f3f3f;
const int maxn = 1e3 + 5;
int x[maxn], y[maxn];

int main() {
#ifdef local
    if(freopen("/Users/Andrew/Desktop/data.txt", "r", stdin) == NULL) printf("can't open this file!\n");
#endif
    int n, m;
    scanf("%d%d", &n, &m);
    scanf("%d%d", &x[0], &y[0]);
    for (int i = 0; i < n; ++i) {
    	scanf("%d", &x[i+1]);
    }
    for (int i = 0; i < m; ++i) {
    	scanf("%d", &y[i+1]);
    }
    sort(x, x+n+1);
    sort(y, y+m+1);
    if (y[0] > x[n]) printf("No War\n");
    else printf("War\n");
#ifdef local
    fclose(stdin);
#endif
    return 0;
}













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

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

const int N = 2e5 + 5;

int a[N];

int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);	
	int n;
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> a[i];
	bool val = 1;
	sort(a, a + n);
	for (int i = 0; i < n - 1; i++)
		if(a[i] == a[i + 1])
			val = 0;
	cout << ((val)? "YES\n" : "NO\n");
}

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

int main()
{
    int N;
    cin >> N;
    vector<tuple<string, int, int>> a;
    for (int i = 1; i < N + 1; i++)
    {
        string S;
        int P;
        cin >> S >> P;
        P = -P; // sortは昇順なので、降順にするために-1かける
        a.push_back(tie(S, P, i));
    }
    sort(a.begin(), a.end());
    for (int i = 0; i < N; i++)
    {
        cout << get<2>(a[i]) << endl;
    }

    return 0;
}

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

using namespace std;


int main(){
	long long int mod = 1000000007LL;
	long long int N, M;
	cin >> N >> M;
	long long int S, T;
	cin >> S >> T;
	S--; T--;
	vector<vector<pair<long long int, long long int>>>route(N);
	vector<long long int>u(M), v(M), d(M);
	for( size_t i = 0; i < M; i++ ){
		long long int U, V, D;
		cin >> U >> V >> D;
		U--; V--;
		u[i] = U;
		v[i] = V;
		d[i] = D;
		route[U].push_back(make_pair(V, D));
		route[V].push_back(make_pair(U, D));
	}
	priority_queue<pair<long long int, long long int>, vector<pair<long long int, long long int>>, greater<pair<long long int, long long int>>>que;
	que.push(make_pair(0, S));
	long long int STtime = 1LL << 60;
	vector < long long int >Stime(N, 1LL << 60), Ttime(N, 1LL << 60), Scount(N, 0), Tcount(N, 0);
	Stime[S] = 0;
	Ttime[T] = 0;
	Scount[S] = 1;
	Tcount[T] = 1;
	while( que.size() ){
		auto now = que.top(); que.pop();
		if( now.first > STtime ){
			break;
		}
		if( Stime[now.second] < now.first ){
			continue;
		}
		if( now.second == T ){
			STtime = now.first;
			continue;
		}
		for( auto x : route[now.second] ){
			auto next = now;
			next.first += x.second;
			next.second = x.first;
			if( Stime[next.second] == next.first ){
				Scount[next.second] += Scount[now.second];
				Scount[next.second] %= mod;
				continue;
			}
			if( Stime[next.second] > next.first ){
				Stime[next.second] = next.first;
				Scount[next.second] = Scount[now.second];
				que.push(next);
			}
		}
	}
	que.push(make_pair(0, T));
	while( que.size() ){
		auto now = que.top(); que.pop();
		if( now.first > STtime ){
			break;
		}
		if( Ttime[now.second] < now.first ){
			continue;
		}
		if( now.second == S ){
			STtime = now.first;
			continue;
		}
		for( auto x : route[now.second] ){
			auto next = now;
			next.first += x.second;
			next.second = x.first;
			if( Ttime[next.second] == next.first ){
				Tcount[next.second] += Tcount[now.second];
				Tcount[next.second] %= mod;
				continue;
			}
			if( Ttime[next.second] > next.first ){
				Ttime[next.second] = next.first;
				Tcount[next.second] = Tcount[now.second];
				que.push(next);
			}
		}
	}
	vector<long long int >test;
	for( size_t i = 0; i < N; i++ ){
		if( Stime[i] * 2 == STtime && Ttime[i] * 2 == STtime ){
			test.push_back(Scount[i] * Tcount[i] % mod);
		}
	}
	for( size_t i = 0; i < M; i++ ){
		if( Stime[u[i]] + Ttime[v[i]] + d[i] == STtime ){
			if( Stime[u[i]] * 2 < STtime && ( Stime[u[i]] + d[i] ) * 2 > STtime ){
				test.push_back(Scount[u[i]] * Tcount[v[i]] % mod);
			}
		}
		if( Stime[v[i]] + Ttime[u[i]] + d[i] == STtime ){
			if( Stime[v[i]] * 2 < STtime && ( Stime[v[i]] + d[i] ) * 2 > STtime ){
				test.push_back(Scount[v[i]] * Tcount[u[i]] % mod);
			}
		}
	}
	long long int ans = 0,memo=0;
	for( auto x : test ){
		ans += x * memo;
		memo += x;
		memo %= mod;
		ans %= mod;
	}
	ans *= 2;
	ans %= mod;
	cout << ans << endl;
}

Measured memory_bytes: 22904
#include <bits/stdc++.h>
#define REP(i, n) for (long long i = 0; i < (long long)n; i++)
#define _GLIBCXX_DEBUG
using namespace std;
using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using Vecl = vector<ll>;
using Graph = vector<vector<int>>;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll N;
  Vecl a;
  cin >> N;
  ll tmp;
  REP(i, N) {
    cin >> tmp;
    a.push_back(tmp);
  }
  tmp = 1;
  ll ans = 0;
  for (auto x : a) {
    if (x != tmp)
      ans++;
    else
      tmp++;
  }
  if (ans == N)
    cout << -1 << endl;
  else
    cout << ans << endl;
}

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

using ll = long long;

#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
#define len(x) int((x).size())

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define randint(n) uniform_int_distribution<int>(1, (n))(rng)

ll grid[3001][3001];
ll dp[4][3001][3001];

void smax(ll &a, ll b)
{
	a=max(a,b);
}

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

	#ifdef ARTHUR_LOCAL
		ifstream cin("input.txt");
	#endif

	int R,C,k;
	cin>>R>>C>>k;

	while(k--)
	{
		int r,c;
		ll v;
		cin>>r>>c>>v;
		grid[r][c]=v;
	}

	ll ans=0LL;

	for(int r=1; r<=R; r++)
	{
		for(int c=1; c<=C; c++)
		{
			smax(dp[0][r][c],max({dp[0][r-1][c],dp[1][r-1][c],dp[2][r-1][c],dp[3][r-1][c],dp[0][r][c-1]}));
			smax(dp[1][r][c],max({dp[1][r][c-1],grid[r][c]+dp[0][r][c]}));
			smax(dp[2][r][c],max({dp[2][r][c-1],dp[1][r][c-1]+grid[r][c]}));
			smax(dp[3][r][c],max({dp[3][r][c-1],dp[2][r][c-1]+grid[r][c]}));
			smax(ans,max({dp[0][r][c],dp[1][r][c],dp[2][r][c],dp[3][r][c]}));
		}
	}

	// cout << dp[3][1][4] << endl;

	cout << ans << endl;
}

Measured memory_bytes: 355300
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <vector>
#include <iomanip>
#define ALL(x) (x).begin(), (x).end()
#define dll(x) scanf("%I64d",&x)
#define xll(x) printf("%I64d\n",x)
#define sz(a) int(a.size())
#define all(a) a.begin(), a.end()
#define rep(i,x,n) for(int i=x;i<n;i++)
#define repd(i,x,n) for(int i=x;i<=n;i++)
#define pii pair<int,int>
#define pll pair<long long ,long long>
#define gbtb ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define MS0(X) memset((X), 0, sizeof((X)))
#define MSC0(X) memset((X), '\0', sizeof((X)))
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define eps 1e-6
#define gg(x) getInt(&x)
#define db(x) cout<<"== [ "<<x<<" ] =="<<endl;
using namespace std;
typedef long long ll;
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 powmod(ll a,ll b,ll MOD){ll ans=1ll;while(b){if(b&1)ans=ans*a%MOD;a=a*a%MOD;b>>=1;}return ans;}
inline void getInt(int* p);
const int maxn=1000010;
const int inf=0x3f3f3f3f;
/*** TEMPLATE CODE * * STARTS HERE ***/

int main()
{
	//    freopen("C:\\Users\\DH_M\\Desktop\\code_io\\in.txt.txt","r",stdin);
	//    freopen("C:\\Users\\DH_M\\Desktop\\code_io\\out.txt.txt","w",stdout);
	ll x;
	cin>>x;
	ll ans=x/11ll;
	x%=11ll;
	ans*=2ll;
	if(x!=0)
	{
		if(x>6)
		{
			ans+=2ll;
		}else
		{
			ans+=1ll;
		}
	}
	cout<<ans<<endl;


    return 0;
}

inline void getInt(int* p) {char ch;do {ch = getchar();}
while (ch == ' ' || ch == '\n');if (ch == '-') {*p = -(getchar() - '0');
while ((ch = getchar()) >= '0' && ch <= '9') {*p = *p * 10 - ch + '0';}}
else {*p = ch - '0';while ((ch = getchar()) >= '0' && ch <= '9')
{*p = *p * 10 + ch - '0';}}}


Measured memory_bytes: 256
//#include <bits/stdc++.h>
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>

using namespace std;

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

    int N, K;

    cin >> N >> K;

    char last;
    cin >> last;

    char first = last;

    int change_count = 0;
    int count = 0;

    for(int i = 1; i < N; i++) {
        char now;
        cin >> now;
        if(now == last) {
            count++;
        } else {
            change_count++;
            last = now;
       //     cout << last<< " " << count << endl;
        }
    }

    int a = change_count / 2;


    if(K <= a) {
        count += K * 2;
    } else {
        count += change_count / 2 * 2;
        if(first != last) {
            count++;
        }
    }

    cout << count << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<cstring>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
#include<math.h>
#define ll long long int
#define d double 
using namespace std;

int main()
{
	ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
	
     string s;
	 cin>>s;
	 if(s[2]==s[3]&&s[4]==s[5]){
	   cout<<"Yes"<<endl;	
	 }   
	 else {
      cout<<"No"<<endl;	
	 }
    
    return 0;   
}

Measured memory_bytes: 3640
#include<iostream>
using namespace std;
int main(){
    int n = 1;
    int x, y;
    while(n == 1){
        cin >> x >> y;
        if (x == 0 && y == 0) break;
        if (x >= y) cout << y << " " << x << endl;
        if (y > x) cout << x << " " << y << endl;

    }
    return 0;
}


Measured memory_bytes: 3072
#pragma region template
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const long long MOD = 1e9 + 7, MAX = 1e18, larg = 1e5, INF = -1e9;
long long A, B, C, D, E, F, G, H, I, J, K, L, N, M, O, P, Q, R, S, T, U, V, W;
typedef long long ll;
typedef pair<ll, ll> Pa;

vector<int> strcompress(string S, int N){
    int count = 1;
    char c = S[0];
    vector<int> vec; 
	rep(i, N-1){
		if(c == S[i+1]){
			count++;
		}else{
			vec.push_back(count);
			count = 1;
			c = S[i+1];
		}
	}
	vec.push_back(count);
    return vec;
}

vector<int> domino_type;
int main() {
    cin >> N;
    string s;
    cin >> s;
    cin >> s;
    domino_type = strcompress(s, N);
    ll sum = (domino_type[0] == 1 ? 3 : 6);
    rep(i, domino_type.size() - 1){
        ll mul;
        if(domino_type[i] == 1 && domino_type[i+1] == 1){
            mul = 2;
        }else if(domino_type[i] == 1 && domino_type[i+1] == 2){
            mul = 2;
        }else if(domino_type[i] == 2 && domino_type[i+1] == 1){
            mul = 1;
        }else if(domino_type[i] == 2 && domino_type[i+1] == 2){
            mul = 3;
        }
        sum = (sum * mul)%MOD;
    }
    cout << sum;
}


Measured memory_bytes: 256
from fractions import gcd
import sys
input = sys.stdin.readline

n = int(input())
a = list(map(int, input().split()))

cnt = 1
for i in range(n):
    cnt = a[i] * cnt // gcd(a[i], cnt)

b = [cnt // a[i] for i in range(n)]
print(sum(b) % (10**9+7))


Measured memory_bytes: 264632
import sys,bisect as bs
sys.setrecursionlimit(100000)
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

n = onem()

print(n**3)


Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include<algorithm>
#include<iomanip>
#include<queue>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for(int i=m;i<(int)(n);i++)
typedef pair<int,int> pint;
typedef long long ll;
const int inf   = 1<<30;
const ll  longinf = 1LL<<60;
int dx[4]={1,0,-1,0}, dy[4]={0,1,0,-1};
int mod=1000000007;

ll fact[100005];

ll calc(ll n,ll k){
  if(k==0) return 1;
  ll m=n*n %mod;
  if(k%2) return n*calc(m,k/2) %mod;
  else return calc(m,k/2) %mod;
  }
  

ll comb(ll n,ll k){
  ll ret=fact[n];
  ret=ret*calc(fact[k],mod-2) %mod;
  ret=ret*calc(fact[n-k],mod-2) %mod;
  return ret;
  }
  
int main(){
  ll n;cin>>n;
  int a[n];
  rep(i,n)a[i+1]=0;
  ll left,right;
  rep(i,n+1){
    int x;
    scanf("%d",&x);
    if(a[x]==0)a[x]=i+1;
    else {
      left=a[x];right=i+1;
      break;
      }
    }
  fact[0]=1;
  rep(i,n+1)fact[i+1]=(i+1)*fact[i] %mod;
  rep(i,n+1){
    if(right-left+i<=n){
      ll ans=comb(n+1,i+1)-comb(n-right+left,i);
      if(ans<0)ans+=mod;
      printf("%ld\n",ans);
      }
    else
      printf("%ld\n",comb(n+1,i+1));
    }
  return 0;
    
    
} 


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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); 

#define ll long long
#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define mp make_pair
#define pu push
#define pp pop_back
#define in insert
#define ld long double
#define forn(low,high,i) for(i = low;i < high;i++)
#define forrev(high,low,i) for(i = high; i >= low;i--)
#define all(v) v.begin(),v.end()
#define sz(v) (int)v.size()
#define line cout << __LINE__;
#define prv(a) for(auto x : a) cout << x << ' ';cout << '\n';
#define prvp(a) for(auto x : a) cout << "{" << x.ff << ',' << x.ss << "}";cout << '\n';
#define decimal_digits cout << fixed << setprecision(15);
string to_string(string s) { return '"' + s + '"';}
string to_string(char s) { return string(1, s);}
string to_string(const char* s) { return to_string((string) s);}
string to_string(bool b) { return (b ? "true" : "false");}
template <typename A> string to_string(A);
template <typename A, typename B>string to_string(pair<A, B> p) {return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";}
template <typename A> string to_string(A v) {bool f = 1; string r = "{"; for (const auto &x : v) {if (!f)r += ", "; f = 0; r += to_string(x);} return r + "}";}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) {cerr << " " << to_string(H); debug_out(T...);}
#define pr(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

typedef unordered_map<int,int> umi;
typedef unordered_map<ll,ll> uml;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

const int inf = 1e9;
const ll INF = 1e18;
const int mod = 1e9 + 7;
const int bit32 = log2(inf) + 3;
const int bit64 = log2(INF) + 3;

inline int add(int a, int b){a += b; if(a >= mod) a -= mod; return a;}
inline int sub(int a, int b){a -= b; if(a < 0) a += mod; return a;}
inline int mul(int a, int b){return (int)((long long) a * b % mod);}
inline int modexpo(int a, int b){int res = 1; while(b > 0){ if(b & 1) res = mul(res, a); a = mul(a, a); b /= 2;} return res;}
inline int divide(int a, int b){ return mul(a, modexpo(b, mod - 2));}

clock_t time_p = clock();

void ktj(){
  time_p = clock() - time_p;
  cerr << "Time elapsed : " << (float)(time_p)/CLOCKS_PER_SEC << "\n";
}

void pre(){ // Reset each global variable (esp. for graphs)
  
}

void solve(){
  char c;
  cin >> c;
  c++;
  cout << c << '\n';
}

int main(){
  fastio

  pre();

  int t = 1;
  // cin >> t;
  while(t--){
    solve();
  }

  ktj();
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,tune=native")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>

using namespace std;

#define forn(i, s, f) for (int i = s; i < f; i++)
#define ll long long
#define pii pair <int, int>
#define fs first
#define sc second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0);
    char c;
    cin >> c;
    if (c == 'A')
        cout << 'T';
    if (c == 'T')
        cout << 'A';
    if (c == 'C')
        cout << 'G';
    if (c == 'G')
        cout << 'C';
    return 0;
}


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

int main()
{
 string a;
 cin>>a;
 if(a=="SUN")
 cout<<7;
    if(a=="MON")
    cout<<6;
    if(a=="TUE")
    cout<<5;
    if(a=="WED")
    cout<<4;
    if(a=="THU")
    cout<<3;
    if(a=="FRI")
    cout<<2;
    if(a=="SAT")
    cout<<1;

}


Measured memory_bytes: 256