akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
vector<tuple<int,int,int>> q;

int main() {
	int l;
	cin >> l;
	int ncnt = 1;
	while (pow(2,ncnt)-1 <  l) {
		ncnt++;
	}
	int node[ncnt];
	for (int i;i < ncnt;i++) {
		node[i] = pow(2,i) - 1;
		if (i != ncnt-1) {
			q.push_back(make_tuple(i+1,i+2,0));
			q.push_back(make_tuple(i+1,i+2,pow(2,i)));
		}
	}
	int nmax = node[ncnt-1] + 1;
	for (int i = ncnt - 1;i >= 0;i--) {
		if (node[i] + nmax < l) {
			q.push_back(make_tuple(i+1,ncnt,nmax));
			if (node[i] + nmax == l - 1) {
				break;
			}
			nmax += node[i] + 1;
		}
	}
	cout << ncnt << " " << q.size() << endl;
	for (int i = 0;i < q.size();i++) {
		cout << get<0>(q[i]) << " " << get<1>(q[i]) << " " << get<2>(q[i]) << endl;
	}
}

Measured memory_bytes: 256
from collections import Counter
N=int(input())
number=list(map(int,input().split()))
sum_number=sum(number)
Q=int(input())
number_count=Counter(number)


for _ in range(Q):
    B,C=map(int,input().split())
    sum_number += (C-B)*number_count[B]
    number_count[C] += number_count[B]
    number_count[B] = 0
    print(sum_number)

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

int main(){
  int N;
  cin>>N;
  vector<int> l;
  l.resize(N);
  int ans=0;
  
  for(int i=0; i<N; i++){
    cin>>l[i];
  }
  
  sort(l.begin(), l.end());
  
  for(int i=0; i<N; i++){
    for(int j=i+1; j<N; j++){
      for(int d=j+1; d<N; d++){
        if(l[d]< (l[i]+l[j])) ans++;
      }
    }
  }
  
  cout<<ans<<endl;
}

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

int max_area(int n)
{
  if (n == 1){
    return (2);
  }

  return (max_area(n - 1) + n); // before sum area + sum draw line
}

int main()
{
  int n;

  while (~scanf("%d", &n)){
    printf("%d\n", max_area(n));
  }

  return (0);
}

Measured memory_bytes: 1184
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
using namespace std;
int vis[13];
int main()
{
	for(int i=1;i<=12;i++)
	{
		if(i==1||i==3||i==5||i==7||i==8||i==10||i==12) vis[i]=1;
		else if(i==4||i==6||i==9||i==1) vis[i]=2;
		else vis[i]=3;
	}
	int x,y;
	cin>>x>>y;
	if(vis[x]!=vis[y]) cout<<"No"<<endl;
	else cout<<"Yes"<<endl;
	return 0;
}

Measured memory_bytes: 256
<?php
list($A, $B, $Q) = array_map("intval", explode(" ", trim(fgets(STDIN))));
for($i = 0; $i < $A; $i++){
    $aArray[] = intval(fgets(STDIN));
}
array_unshift($aArray, -10**18);
$aArray[] = 10**18;
for($i = 0; $i < $B; $i++){
    $bArray[] = intval(fgets(STDIN));
}
array_unshift($bArray, -10**18);
$bArray[] = 10**18;

for($i = 0; $i < $Q; $i++){
    $qArray[] = intval(fgets(STDIN));
}

foreach($qArray as $q){
    $min = 10**18;
    $a = bsl($aArray, $q);
    $b = bsl($bArray, $q);
    foreach([[[$aArray, $a], [$bArray,$b]], [[$bArray, $b], [$aArray,$a]]] as list(list($aa, $_a), list($bb, $_b))){
        foreach([$aa[$_a], $aa[$_a+1]] as $a1){
            $p3 = $bb[$_b]??10**12;
            $p4 = $bb[$_b+1]??10**12;
            $min = min($min, abs($q - $a1) + abs($a1 - $p3));
            $min = min($min, abs($q - $a1) + abs($a1 - $p4));
        }
    }
    printf("%d\n", $min);
}

//二分探索　target以下で最大の値の場所を返す
function bsl($nums, $target) {
    $size = count($nums);
    $min = 0; 
    $max = $size - 1;
    while(true){
        $center = floor(($min + $max) / 2);
        $centerValue = $nums[$center];
        if($target == $centerValue){
            return $center;
        }elseif($target > $centerValue){
            $min = $center + 1;
        }else{
            $max = $center;
        }
        if($min == $max){
            $center = floor(($min + $max) / 2);
            $centerValue = $nums[$center];
            if($centerValue == $target){
                return $center;
            }elseif($centerValue < $target){
                return $center;
            }else{
                return $center-1;
            }
        }
    }
}


Measured memory_bytes: 18928
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<set>

using namespace std;

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

	int n = N % 1000;

	if (n > 0) {
		cout << 1000 - n << endl;
	}
	else {
		cout << 0 << endl;
	}
	

}






Measured memory_bytes: 3624
import java.util.*;
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();
		int k=sc.nextInt();
		char[][] c=new char[h][w];
		
		for(int i=0;i<h;i++) {
			String s=sc.next();
			c[i]=s.toCharArray();
		}
		
		int ans=0;
		for(int i=0;i<(Math.pow(2, h));i++) {
			for(int j=0;j<(Math.pow(2, w));j++) {
				int count=0;
				for(int row=0;row<h;row++) {
					for(int col=0;col<w;col++) {
						if(((i>>row & 1)==1) && ((j>>col & 1)==1)) {
							if (c[row][col] == '#')count++;
							//ystem.out.println(c[row][col]);
						}
					}
				}	
				if(count==k)ans++;
			}
		}
		
	    System.out.println(ans);
	}
}


Measured memory_bytes: 36000
#include <numeric>
#include <bits/stdc++.h>
#include <utility>
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <math.h>
#include <string>
#define ll long long
#define ull unsigned long long
#define make(type,x) type x; cin>>x
#define make2(type,x,y) type x,y; cin>>x>>y
#define fr(x,y) for(long long x=0;x<y;x++)
#define makevec(x,y,n) vector <x> y(n); for(ll i=0;i<n;i++) cin>>y[i]
#define M (ll)1000000007
#define MM (ll) 1e8
#define INF (ll) 1e18

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

using namespace std;

template <typename T>
T modpow(T base, T exp, T modulus) {
  base %= modulus;
  T result = 1;
  while (exp > 0) {
    if (exp & 1) result = (result * base) % modulus;
    base = (base * base) % modulus;
    exp >>= 1;
  }
  return result;
}
bool sortbysec(const pair <ll,ll> &a,const pair <ll,ll> &b){
    return a.second<b.second;
}

struct cmp {
	bool operator() (const pair<int, int> &a, const pair<int, int> &b) const {
		int lena = a.second - a.first + 1;
		int lenb = b.second - b.first + 1;
		if (lena == lenb) return a.first < b.first;
		return lena > lenb;
	}
};


struct c_h {
    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        x ^= FIXED_RANDOM;
        return x ^ (x >> 16);
    }
};

ll calcpow(ll x, ll y)
{
    ll temp;
    if(y == 0)
        return 1;
    temp = calcpow(x, y / 2);
    if (y % 2 == 0)
        return temp * temp;
    else
    {
        if(y > 0)
            return x * temp * temp;
        else
            return (temp * temp) / x;
    }
}
ll gcd(ll a, ll b){
    if(b==0) return a;
    return gcd(b,a%b);

}
ll egcd(ll a, ll b, ll &x,ll &y){
    if(b==0){
        x=1;
        y=0;
        return a;
    }
    ll x1;
    ll y1;
    ll g=egcd(b,a%b,x1,y1);
    x=y1;
    y=x1-y1*(a/b);
    return g;
}


bool isprime(ll a){
bool flag=1;
for(ll i=2;i*i<=a;i++){
    if(a%i==0) {flag=0; break;}
}
return flag;
}
ll n,m;
bool ok(ll a,ll b){
    return a>=0&&b>=0&&a<n&&b<m;
}
ll dx[8]={1,0,-1,0,1,-1,1,-1};
ll dy[8]={0,1,0,-1,1,-1,-1,1};

int main(){
    IOS;
    ll N=1e5;
    vector <ll> mp(N);
    make(ll,n);
    fr(i,n){
        make(ll,x);
        mp[x]++;
    }
    ll ans=0;
    for(ll i=0;i+2<N;i++){
        ans=max(ans,mp[i]+mp[i+1]+mp[i+2]);
    }
    cout<<ans<<endl;


    return 0;
}


Measured memory_bytes: 3932
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1000000007;

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;
}

/* mint、表示は変数名.x */
struct mint {
  ll x;
  mint(ll x = 0) : x((x % MOD + MOD) % MOD) {}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= MOD)
      x -= MOD;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += MOD - a.x) >= MOD)
      x -= MOD;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= MOD;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res -= a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res *= a;
  }
  /* 変数名.pow(n) */
  mint pow(ll t) const {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }

  // 以降はMODが素数のみ
  mint inv() const {
    return pow(MOD - 2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res /= a;
  }
};

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  rep(i, N) cin >> A[i];

  vector<int> cnt(N);
  rep(i, N) {
    cnt[A[i]]++;
  }

  if (N % 2 == 0) {
    for (int i = 1; i < N; i += 2) {
      if (cnt[i] != 2) {
        cout << 0 << endl;
        return 0;
      }
    }
  } else {
    if (cnt[0] != 1) {
      cout << 0 << endl;
      return 0;
    }
    for (int i = 2; i < N; i += 2) {
      if (cnt[i] != 2) {
        cout << 0 << endl;
        return 0;
      }
    }
  }
  mint ans = 2;
  ans = ans.pow(N / 2);
  cout << ans.x << endl;
}

Measured memory_bytes: 1024
//============================================================================
// Name        : AOL.cpp
// Author      : Akari Fujii
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <cctype>
#include <string>
#include<algorithm>

using namespace std;



int main(){


	string str1;
	int t;


	cin>>str1;

	for(int i=0; i<str1.size(); i++){
		t=i;
		if(i<i+1){
			t=i+1;

		}
		t=t-2;
	}
	cout<<str1[0]<<t<<str1[t+1]<<endl;









}


Measured memory_bytes: 256
#include<stdio.h>
#define MAX 5000
int sa[MAX][MAX];
 
void Hira(int t){
  int i,j;
  for(i = 0;i < t;i++){
    for(j = 0;j <t-1; j++){
      printf("%d ",sa[i][j]);
    }
    printf("%d\n",sa[i][j]);
  }
}
 
main(){
  int b,pine,i,j,qu,t;
  
  scanf("%d",&t);
  for(i = 0;i < t;i++){
    scanf("%d%d",&qu,&pine);
    for(j = 0;j < pine;j++){
      scanf("%d",&b);
      sa[qu-1][b-1] = 1;
    }
  }
  Hira(t);
  return 0;
}

Measured memory_bytes: 996
// Created by Nandu Vinodan
#include <bits/stdc++.h>

#define db1(x) cout<<#x<<"="<<x<<'\n'
#define db2(x,y) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<'\n'
#define db3(x,y,z) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<","<<#z<<"="<<z<<'\n'
#define rep(i,a,n) for(int i=a;i<=(n);++i)
#define repD(i,a,n) for(int i=a;i>=(n);--i)
#define pb(a) push_back(a)
#define eb(a) emplace_back(a)
#define vi vector<int>
#define pi pair<int, int>
#define INF INT_MAX
#define _INF INT_MIN
#define TC 0

using namespace std;
using ll = long long;

void testcase() {
   string s, t; cin >> s >> t;
   int a, b; cin >> a>> b;
   string u; cin>>u;
   if (u==s) a--;
   else b--;
   cout <<  a << " " << b << endl; 
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t=1;
    if (TC)
        cin>>t;
    while(t--) {
        testcase();
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    string S;
    cin >> S;
    if (S == "Sunny") cout << "Cloudy" << endl;
    if (S == "Cloudy") cout << "Rainy" << endl;
    if (S == "Rainy") cout << "Sunny" << endl;
    return 0;
}


Measured memory_bytes: 256
A,B,C=list(input().split())
X=[A,B]
D=int("".join(X))+int(C)
X=[B,A]
E=int("".join(X))+int(C)
X=[A,C]
F=int("".join(X))+int(B)
X=[C,A]
G=int("".join(X))+int(B)
X=[B,C]
H=int("".join(X))+int(A)
X=[C,B]
I=int("".join(X))+int(A)

print(max([D,E,F,G,H,I]))

Measured memory_bytes: 3064
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) c.begin(), c.end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
 
int main(){
    ll n, k;
    cin >> n >> k;
    vector<P> a(n);
    REP(i,n){
        cin >> a[i].first >> a[i].second;
    }
    sort(ALL(a));
    ll s = 0;
    REP(i,n){
        s += a[i].second;
        if (s >= k){
            cout << a[i].first << endl;
            return 0;
        }
    }
 
    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define fr ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#include<string>
#include<algorithm>
#include<vector>
const long long int maxn = 1e3+2;
const long long int mod = 1e3+2;

int main()
{
	fr
	ll n;
	cin>>n;
	ll a[n+1],dp[n+1];
	for(ll i=0;i<n;i++)
	cin>>a[i];
	dp[0]=0;
	dp[1]=abs(a[0]-a[1]);
	for(ll i=2;i<n;i++)
	{
		dp[i]=min((dp[i-1]+abs(a[i]-a[i-1])),(dp[i-2]+abs(a[i]-a[i-2])));
	}
	cout<<dp[n-1]<<endl;
}
	

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define ll long long
using namespace std;

const ll P = 1000000007;
int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }

int main()
{
  cout << fixed << setprecision(10);
  int N, M, X, Y;
  cin >> N >> M >> X >> Y;
  vector<int> x(N), y(M);
  bool ans = false;
  rep(i, N)
  {
    cin >> x[i];
  }
  rep(i, M)
  {
    cin >> y[i];
  }
  for (int i = X + 1; i <= Y; i++)
  {
    bool a = true;
    rep(j, N)
    {
      if (x[j] >= i)
      {
        a = false;

        break;
      }
    }
    rep(j, M)
    {
      if (y[j] < i)
      {
        a = false;
        break;
      }
    }
      if (a == true)
      {
        ans = true;
        break;
      }
  }
    if (X >= Y)
    {
      ans = false;
    }
    if (ans == false)
    {
      cout << "War" << endl;
    }
    else
    {
      cout << "No War" << endl;
    }

    return 0;
  }


Measured memory_bytes: 3612
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
const int INF = (1<<30)-1;
const long long LINF = (1LL<<62)-1;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int k, n;
  cin >> k >> n;
  vector<int> a(n);
  rep(i, n)
    cin >> a[i];
  ll sum = 0, mx = 0;
  rep(i, n) {
    ll d = (a[(i+1)%n]-a[i]+k)%k;
    sum += d;
    chmax(mx, d);
  }
  cout << sum-mx << endl;
  return 0;
}

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

int main(void) {
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a.at(i);
    }
    vector<bool> f(n, false);
    int i = 0;
    int cnt = 0;
    while (1) {
        if (f.at(i)) {
            cout << -1 << endl;
            return 0;
        }
        else if (i == 1) {
            cout << cnt << endl;
            return 0;
        }
        else {
            f.at(i) = true;
            i = a.at(i) - 1;
            cnt++;
        }
    }
    return 0;
}

Measured memory_bytes: 3784
#include <iostream>

#define N_SIZE 1000000
#define M_SIZE 100

using namespace std;

int insertionSort(int[], int, int);
void shellSort(int[], int);

int main(void) {
	int n;
	static int list[N_SIZE];

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

	shellSort(list, n);

	for (int i = 0; i < n; i++) {
		cout << list[i] << "\n";
	}

	cin >> n;

	return 0;
}

int insertionSort(int list[], int n, int g) {
	int v, j, cnt = 0;
	for (int i = g; i < n; i++) {
		v = list[i];
		j = i - g;
		while (j >= 0 && list[j] > v) {
			list[j + g] = list[j];
			j = j - g;
			cnt++;
		}
		list[j + g] = v;
	}
	return cnt;
}

void shellSort(int list[], int n) {
	int m, i = 0, cnt = 0;
	int glist[M_SIZE];
	
	glist[0] = 1;
	while (++i) {
		int tmp = glist[i - 1] * 3 + 1;
		if (tmp >= n || i >= M_SIZE-1) {
			m = i;
			break;
		}
		else {
			glist[i] = tmp;
		}
	}

	cout << m << "\n";
	for (int i = m - 1; i >=0; i--) {
		if (i < m-1) {
			cout << " ";
		}
		cout << glist[i];
	}
	cout << "\n";

	for (int i = m - 1; i >= 0; i--) {
		cnt += insertionSort(list, n, glist[i]);
	}
	cout << cnt << "\n";
}

Measured memory_bytes: 6984
n=int(input())
a=list(map(int,input().split()))
count=0
for i in range(n):
  if a[i]%2==0:
    if a[i]%3==0 or a[i]%5==0:
      pass
    else:
      count+=1
if count==0:
  print('APPROVED')
else:
  print('DENIED')
  

Measured memory_bytes: 2940
#include<stdio.h>

int main()
{
	long long n;
	scanf("%lld",&n);
	long long num[40000];
	num[0]=100;
	long long i;
	for(i=1;i<=40000;i++)
	{
		num[i]=num[i-1]*1.01;
		if(num[i]>=n)
			break;
	}
	printf("%lld",i);
	
	return 0;
}

Measured memory_bytes: 2148
#include<bits/stdc++.h>
#define ll long long
using namespace std;
// 3
// 4
// 1 2
// 2 3
// 3 4
// 2
// 2 2
// 4
// 3 4
// 1 3
// 3 2
// 2
// 3 2
// 7
// 6 1
// 2 3
// 4 6
// 7 3
// 5 1
// 3 6
// 4
// 7 5 13 3
// 20 12 6
int main()
{
	ll n,x,t;
	cin>>n>>x>>t;
	ll q=n/x;
	ll r=n%x;
	if(r!=0)
		cout<<q*t+t;
	else
		cout<<q*t;
}

Measured memory_bytes: 3628
use std::io;
use std::str::FromStr;

fn input_tuple() -> (u64, u64) {
    let mut line: String = String::new();
    io::stdin().read_line(&mut line);
    let vec: Vec<u64> = line.split_whitespace().map(|s| s.parse().unwrap()).collect();
    (vec[0], vec[1])
}

fn input_vec() -> Vec<u64> {
    let mut line: String = String::new();
    io::stdin().read_line(&mut line);
    line.split_whitespace().map(|s| s.parse().unwrap()).collect()
}

fn main() {
    let (n, m) = input_tuple();
    let mut a_vec = input_vec();
    a_vec.sort_by(|x, y| y.cmp(&x));
    // println!("{:?}", a_vec);
    let mut sum = 0;
    for a in &a_vec {
        sum += *a;
    }
    for i in 0..m as usize {
        if a_vec[i] * 4 * m < sum {
            println!("No");
            return;
        }
    }
    println!("Yes");
}


Measured memory_bytes: 4352
import java.util.Arrays;
import java.util.HashSet;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {
        final Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        final HashSet<Integer> integers = new HashSet<>();
        for (int i = 0; i < n; i++) {
            integers.add(sc.nextInt());
        }
        System.out.println(integers.size() == n ? "YES" : "NO");
    }
}


Measured memory_bytes: 100788
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

def main():
    n = int(input())
    if n == 1:
        print(0)
        return 0
    l = factorization(n)
    cnt = 0
    for i in range(len(l)):
        tmp = l[i][1]
        for j in range(1,l[i][1]+1):
            if j <= tmp:
                cnt += 1
                tmp -= j
            else:
                break
    print(cnt)

if __name__ == '__main__':
    main()





Measured memory_bytes: 63464
#include <iostream>
#include <string.h>
using namespace std;

int main()
{
	int m, g;
	int n, dp[8][1001];
	
	cin >> m;

	while (m > 0) {
		memset(dp, 0, sizeof(dp));

		for (int i = 0; i <= m; i++)
			dp[i][0] = 1;

		for (int i = 1; i <= m; i++) {
			int a, b;

			cin >> a >> b;

			for (int j = 1; j < 1001; j++) {
				dp[i][j] = dp[i - 1][j];

				for (int k = 1; k <= b; k++) {
					if (j - a * k >= 0)
						dp[i][j] += dp[i - 1][j - a * k];
				}
			}
		}

		cin >> g;

		for (int i = 0; i < g; i++) {
			cin >> n;
			cout << dp[m][n] << endl;
		}

		cin >> m;
	}

	return 0;
}



Measured memory_bytes: 3016
#pragma region Macros
#include <bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pld = pair<ld, ld>;
template <typename Q_type>
using smaller_queue = priority_queue<Q_type, vector<Q_type>, greater<Q_type>>;

const int MOD_TYPE = 1;
const ll MOD = (MOD_TYPE == 1 ? (ll)(1e9 + 7) : 998244353);
const int INF = (int)1e9;
const ll LINF = (ll)4e18;
const ld PI = acos(-1.0);
const ld EPS = 1e-11;

#define REP(i, m, n) for (ll i = m; i < (ll)(n); ++i)
#define rep(i, n) REP(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << "\n"
#define Yes(n) cout << ((n) ? "Yes" : "No") << "\n"
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << "\n"
#define possible(n) cout << ((n) ? "possible" : "impossible") << "\n"
#define Yay(n) cout << ((n) ? "Yay!" : ":(") << "\n"
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x) cerr << #x << ":" << x << "\n";

vector<int> Dx = {0, 0, -1, 1, -1, 1, -1, 1, 0};
vector<int> Dy = {1, -1, 0, 0, -1, -1, 1, 1, 0};

#pragma endregion

template <typename T>
class SegmentTree
{
private:
  using Fn = function<T(T, T)>;
  int N;
  vector<T> dat;
  T unit;
  Fn func;

public:
  SegmentTree() {}
  SegmentTree(int n_, Fn func_, T unit_) { init(n_, func_, unit_); }
  SegmentTree(vector<T> &v, Fn func_, T unit_) { init(v, func_, unit_); }

  void init(int n_, Fn func_, T unit_)
  {
    func = func_, unit = unit_;
    N = 1;
    while (N < n_)
      N *= 2;
    dat.assign(2 * N - 1, unit);
  }

  void init(vector<T> &v, Fn func_, T unit_)
  {
    func = func_, unit = unit_;
    N = 1;
    int sz = v.size();
    while (N < sz)
      N *= 2;
    dat.resize(2 * N - 1);
    for (int i = 0; i < N; ++i)
      dat[i + N - 1] = (i < sz ? v[i] : unit);
    for (int i = N - 2; i >= 0; --i)
      dat[i] = func(dat[i * 2 + 1], dat[i * 2 + 2]);
  }

  void update(int k, T a)
  {
    k += N - 1;
    dat[k] = a;
    while (k > 0)
    {
      k = (k - 1) / 2;
      dat[k] = func(dat[k * 2 + 1], dat[k * 2 + 2]); //
    }
  }

  T query(int a, int b, int k = 0, int l = 0, int r = -1)
  {
    if (r < 0)
      r = N;
    if (r <= a || b <= l)
      return unit;
    if (a <= l && r <= b)
      return dat[k];
    else
    {
      T vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
      T vr = query(a, b, k * 2 + 2, (l + r) / 2, r);
      return func(vl, vr);
    }
  }
};

bool f(ll x)
{
  if (x <= 1)
    return false;
  for (ll i = 2; i * i <= x; i++)
  {
    if (x % i == 0)
      return false;
  }
  return true;
}

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

  vector<int> v(100010);
  rep(i, 100010)
  {
    v[i] = (i % 2 == 1 && f(i) && f((i + 1) / 2));
  }
  SegmentTree<int> sg(v, plus<int>(), 0);
  int q;
  cin >> q;
  rep(qi, q)
  {
    ll l, r;
    cin >> l >> r;
    cout << sg.query(l, r + 1) << endl;
  }

  return 0;
}


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

int main() {
  int N;
  string c;
  cin >> N;

  for (int i = 0; i < N; i++) {
      cin >> c;
      if (c == "Y") {
          cout << "Four" << endl;
          break;
      }
      else if (i == N - 1) cout << "Three" << endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
constexpr auto MOD = 1000000007;
constexpr int INF = 1e9;
constexpr long long LINF = 1e18;
#define rep(i, n) for (int i = 0; i < (n); i++)
typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
typedef vector<int> VI;
typedef vector<ll> VLL;

string s;
long long n, m;
int ret(int a){
  int c = 0;
  if (a <= 3 && a >= 1)
  {
    c = (4 - a) * 100000;
  }
  return c;
}

int main()
{
  cin>>n>>m;
  int ans = ret(n) + ret(m);
  if (n == 1 && m == 1)
  {
    ans += 400000;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
N, K = [int(_) for _ in input().split()]
points = [int(_) for _ in input().split()]
T = list(input())

PAT = ['r', 's', 'p']

ans = 0
for k in range(K):
    pre = -1
    for i in range(k, N, K):
        win_i = (PAT.index(T[i]) + 2) % 3
        if pre != win_i:
            ans += points[win_i]
            pre = win_i
        else:
            pre = -1

print(ans)


Measured memory_bytes: 4084
#include<bits/stdc++.h>
using namespace std;
bool st(int a,int b)
{
	if(a!=b)
	return a>b;
	else
	return a=b; 
}
int n,abc[111];
long long a,b;
int main()
{
cin>>n;
for(int i=0;i<n;i++)
{
	cin>>abc[i];
}
sort(abc,abc+n,st);
for(int i=0;i<n;i++)
{
	if(i%2==0)
	a+=abc[i];
	else
	b+=abc[i];
 } 
cout<<a-b;
return 0;
}

Measured memory_bytes: 256
def main():
    N = int(input())
    A = [int(a) for a in input().split()]
    d = dict()
    for a in A: d[a] = d.get(a, 0) + 1

    max_area = 0
    edges = list(d.keys())
    for a in edges:
        if d[a] > 3:
            max_area = max(max_area, a*a)
        if d[a] == 1:
            del d[a]

    edges = sorted(d.keys(), reverse = True)
    if len(edges) > 1:
        max_area = max(max_area, edges[0]*edges[1])

    return max_area



if __name__ == '__main__':
    print(main())

Measured memory_bytes: 17960
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main()
{
	int N, T, c, t, menor = 0, menor_custo = 0;
    scanf("%d %d", &N, &T);
    while(N > 0){
        scanf("%d %d", &c, &t);
        if(t <= T)
            if(menor_custo == 0){
                menor = t;
                menor_custo = c;
            }
            else if(menor_custo > c){
                if(t <= T){
                    menor = t;
                    menor_custo = c;
                }
            }
        N--;
    }
    if(menor_custo == 0)
        printf("TLE\n");
    else
        printf("%d\n", menor_custo);
	return 0;
}






Measured memory_bytes: 128
//PR2
#include<iostream>
using namespace std;

int main()
{
	int H, W;
	while(1)
	{
		cin >> H >> W;
		if( H == 0 && W == 0)
		break;
		for(int i = 0; i < W; i++)
			cout << '#';
		cout << endl;
		
		for(int j = 1; j < H-1; j ++){
		cout << '#';	
		for(int i = 1; i < W-1; i++)
		cout << '.';
		cout << '#' << endl;
		}
		
		for(int i = 0; i < W; i++)
			cout << '#';
		cout << endl;
		
		cout << endl;
	}
	return 0;
}


Measured memory_bytes: 3060
package main

import (
  "fmt"
  "sort"
)

type Node struct {
  Cost int
  Index int
}
type Forest []Node
func (f Forest) Len() int {
  return len(f)
}
func (f Forest) Less(i, j int) bool {
  return f[i].Cost < f[j].Cost
}
func (f Forest) Swap(i, j int) {
  f[i], f[j] = f[j], f[i]
}

func find(R *[]int, i int) int {
  if (*R)[i] == i {
    return i
  }
  (*R)[i] = find(R, (*R)[i])
  return (*R)[i]
}

func union(R *[]int, i, j int) {
  ri := find(R, i)
  rj := find(R, j)
  if ri <= rj {
    (*R)[rj] = ri
  } else {
    (*R)[ri] = rj
  }
}

func main() {
  var N, M int
  fmt.Scan(&N, &M)
  A := make([]int, N)
  R := make([]int, N)
  var x, y int
  for i := 0; i < N; i++ {
    fmt.Scan(&x)
    A[i] = x
    R[i] = i
  }
  for i := 0; i < M; i++ {
    fmt.Scan(&x, &y)
    union(&R, x, y)
  }
  for i := 0; i < N; i++ {
    find(&R, i)
  }
  if N < 2 * (N - M - 1) {
    fmt.Println("Impossible")
  } else if M == N - 1 {
    fmt.Println(0)
  } else {
    cnt := 0
    C := make([]int, N)
    var F Forest = make([]Node, N)
    for i := 0; i < N; i++ {
      F[i] = Node{A[i], R[i]}
      C[i] = 0
    }
    sort.Sort(F)
    L := N - M - 2
    for _, node := range F {
      if C[node.Index] == 0 {
        C[node.Index] = node.Cost
        cnt += node.Cost
      } else if L > 0 {
        cnt += node.Cost
        L -= 1
      }
    }
    fmt.Println(cnt)
  }
}

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


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

    vector<vector<ll>> dp(n+10,vector<ll>(710));
    dp[0][0] = 1;

    rep(j, 700){
        vector<ll> C(n+10);
        rep(i, n+1){
            C[i+3] = dp[i][j];
        }
        rept(i,3, n+1){
            dp[i][j+1] = (dp[i-1][j+1] + C[i]) % MOD;
        }
    }
    ll res  = 0;
    rep(i, 700)res = (res + dp[n][i]) % MOD;
    cout << res  << ln;
/*
    rep(i, n+1){
        rep(j, 5){
            cout << dp[i][j] << " ";
        }cout << ln;
    }*/
}



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

int main()
{
  string s;
  cin >> s;
  char c;
  int tmp = 0, maxs = 0, res = s.size();
  for (int i = 0; i < 26; i++)
  {
    for (int j = 0; j < s.size(); j++)
    {
      c = i + 97;
      if (s.at(j) == c)
      {
        maxs = max(tmp, maxs);
        tmp = 0;
      }
      else if (j == s.size() - 1)
      {
        tmp++;
        maxs = max(tmp, maxs);
      }
      else
      {
        tmp++;
      }
    }
    res = min(maxs, res);
    tmp = 0;
    maxs = 0;
  }
  cout << res << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <sstream>

using namespace std;

int main() {
    while(true) {
        int N;
        cin >> N;
        if(!N) break;

        string str;
        cin >> str;
        while(N--) {
            string tmp;
            ostringstream ss(tmp);

            int pos = 0;
            while(pos < str.size()) {
                int start = pos;
                char c = str[pos];
                while(pos < str.size() && str[pos] == c) ++pos;
                ss << (pos-start) << c;
            }
            str = ss.str();
        }
        cout << str << endl;
    }
    return 0;
}

Measured memory_bytes: 0
// Problem : C - Step
// Contest : AtCoder - AtCoder Beginner Contest 176
// URL : https://atcoder.jp/contests/abc176/tasks/abc176_c
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

// Delete the dynamically allocated memory

#include<bits/stdc++.h>
using namespace std;
 
#define ff              first
#define ss              second
#define pb              push_back
#define pr              pair<long long,long long>
#define mp(a,b)         make_pair(a,b)
#define vr              vector<long long>
#define mod1            1000000007
#define mod2            998244353
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define fill(a,b)       memset(a, b, sizeof(a))
#define mk(arr,n,type)  type *arr=new type[n];
#define ll              long long
#define ld	            long double
#define w(x)            int x; cin>>x; while(x--)
ll power(ll base, ll exp) {
    ll res=1;
    while(exp>0) {
       if(exp%2==1) res=(res*base);
       base=(base*base);
       exp/=2;
    }
    return res;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll n;
	cin>>n;
	mk(a,n,ll)
	for(ll i=0;i<n;i++){
		cin>>a[i];
	}
	ll sum=0;
	for(ll i=1;i<n;i++){
		if(a[i]<a[i-1]){
			sum+=a[i-1]-a[i];
			a[i]=a[i-1];
		}
	}
	cout<<sum<<"\n";
	delete[] a;
	return 0;
	}

Measured memory_bytes: 4776
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = -1145141919810;
ll dp[110][100010] = {INF};
int main(){
    ll n,w;
    cin >> n >> w;
    vector<ll> weight(n),value(n);
    for(ll i = 0; i <= w; i++){
        dp[0][i] = 0;
    }
    for(ll i = 0; i < n; i++){
        cin >> weight[i] >> value[i];
    }

    for(ll i = 0; i < n; i++){
        for(ll j = 0; j <= w; j++){
            dp[i + 1][j] = dp[i][j];
            if(j - weight[i] >= 0){
                dp[i + 1][j] = max(dp[i + 1][j], dp[i][j - weight[i]] + value[i]);
            }
        }
    }
    cout << dp[n][w] << endl;
}

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

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int N, ha = 0, hb = 0, hc = 0;
    cin >> N;
    for (int i = 0; i < N; i++)
    {
        int a, b, c;
        cin >> a >> b >> c;
        int nha = a + max(hb, hc), nhb = b + max(ha, hc), nhc = c + max(ha, hb);
        ha = nha;
        hb = nhb;
        hc = nhc;
    }
    cout << max(ha, max(hb, hc)) << '\n';
    return(0);
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>

using namespace std;

#define int long long

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

	map<string, int> cnt;
	int n;
	cin >> n;
	int ans = 0;
	while (n--) {
		string s;
		cin >> s;
		sort(s.begin(), s.end());
		ans += cnt[s];
		cnt[s]++;
	}
	cout << ans << endl;
}


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

using namespace std;

int main()
{
  string n; cin >> n;
  for (int i = 0; i <= 9; ++i) {
    for (int j = 0; j < 2; ++j) {
      if (n.substr(j, 3) == to_string(i) + to_string(i) + to_string(i)) {
        cout << "Yes";
        return 0;
      }
    }
  }

  cout << "No";
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
using namespace std;
#define endl '\n'
#define pi pair<int, int>

const int maxn = 100000;
int n, k;
int col[maxn];
vector<pi> graph[maxn];

void dfs(int c, int p){
	int cur = 0;
	for(pi i : graph[c]){
		if(i.second == p) continue;
		if(cur + 1 == col[p]) cur++;
		col[i.second] = ++cur;
		dfs(i.first, i.second);
	}
	k = max(k, cur);
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	
	cin >> n;
	
	for(int i = 0; i < n - 1; i++){
		int a, b;
		cin >> a >> b;
		a--, b--;
		
		graph[a].push_back({b, i});
		graph[b].push_back({a, i});
	}
	
	dfs(0, n - 1);
	
	cout << k << endl;
	for(int i = 0; i < n - 1; i++) cout << col[i] << endl;

	return 0;
}

Measured memory_bytes: 7552
#include <cstdio>
#include <string>
#include <iostream>
#include <sstream>
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <stdlib.h>
#include <vector>
#include <map>
#include <math.h>
using namespace std;

int main() {
    char op;
    int a, b;
    scanf("%d %c %d", &a, &op, &b);
    if (op == '+') printf("%d\n", a + b);
    if (op == '-') printf("%d\n", a - b);
}


Measured memory_bytes: 256
/*  */
#include <iostream>
#include <sstream>
#include <string>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <vector>
#include <deque>
#include <bitset>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstring>
#include <climits>
#include <cctype>
#include <cassert>
#include <functional>
#include <iterator>
#include <iomanip>
using namespace std;
//#pragma comment(linker,"/STACK:102400000,1024000")

#define sti				set<int>
#define stpii			set<pair<int, int> >
#define mpii			map<int,int>
#define vi				vector<int>
#define pii				pair<int,int>
#define vpii			vector<pair<int,int> >
#define rep(i, a, n) 	for (int i=a;i<n;++i)
#define per(i, a, n) 	for (int i=n-1;i>=a;--i)
#define clr				clear
#define pb 				push_back
#define mp 				make_pair
#define fir				first
#define sec				second
#define all(x) 			(x).begin(),(x).end()
#define SZ(x) 			((int)(x).size())
#define lson			l, mid, rt<<1
#define rson			mid+1, r, rt<<1|1
#define getBits(x)		__builtin_popcount(x)
#define getBitIdx(x)	__builtin_ffs(x)

typedef long long LL;



int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	// #ifndef ONLINE_JUDGE
		// freopen("data.in", "r", stdin);
		// freopen("data.out", "w", stdout);
	// #endif
	
	LL a, b;
	
	cin >> a >> b;
	if (a < b)
		swap(a, b);
	if (a-b > 1)
		puts("Alice");
	else
		puts("Brown");
	
	// #ifndef ONLINE_JUDGE
		// printf("time = %ldms.\n", clock());
	// #endif
	
	return 0;
}


Measured memory_bytes: 256
from collections import OrderedDict

while True:
    n = int(input())
    if not n:
        break
        
    ds = OrderedDict()
    for _ in range(n):
        i, p, q  = input().split()
        ds[i] = ds.get(i, 0) + int(p) * int(q)
    
    ds = OrderedDict((i, v) for i, v in ds.items() if v >= 1000000)
    if ds:
        print('\n'.join(ds.keys()))
    else:
        print('NA')

Measured memory_bytes: 8528
#include <iostream>
#include <cstdio>
#define ll long long
using namespace std;
ll mx[200001<<2],tag[200001<<2];
int n,m,rr,q;

inline void change(int rt,int l,int r,int L,int R,int k)
{
	if(L<=l && r<=R)
	{
		mx[rt]+=k; tag[rt]+=k;
		return;
	}
	int mid=l+r>>1;
	if(L<=mid) change(rt<<1,l,mid,L,R,k);
	if(R>mid) change(rt<<1|1,mid+1,r,L,R,k);
	mx[rt]=max(mx[rt<<1],mx[rt<<1|1])+tag[rt];
}

int main()
{
	scanf("%d%d",&n,&q);
	int rr=1,x,y,k;
	for(int i=1;i<=q;i++)
	{
		scanf("%d%d%d",&x,&y,&k);
		while(rr<y) change(1,1,n,++rr,n,1);
		change(1,1,n,x,y,k);
		printf("%lld\n",mx[1]);
	}
}



Measured memory_bytes: 7308
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Math;

namespace CSharp
{
    static class Program
    {
        static void Main(string[] args)
        {
            int[] values = ReadIntArray();
            int ans = values.GroupBy(x => x).First(g => g.Count() == 1).Key;
            Console.WriteLine(ans);
        }

        #region Helpers

        static int[] ReadIntArray() => Console.ReadLine().Split().Select(s => int.Parse(s)).ToArray();
        static long[] ReadLongArray() => Console.ReadLine().Split().Select(s => long.Parse(s)).ToArray();

        static int[] ReadLineIntArray(int count) => Enumerable.Repeat(0, count).Select(_ => int.Parse(Console.ReadLine())).ToArray();
        static long[] ReadLineLongArray(int count) => Enumerable.Repeat(0, count).Select(_ => long.Parse(Console.ReadLine())).ToArray();

        static string ReadString() => Console.ReadLine();
        static int ReadInt() => int.Parse(Console.ReadLine());
        static long ReadLong() => long.Parse(Console.ReadLine());

        static void ReadInt(out int first)
        {
            var array = ReadIntArray();
            first = array[0];
        }

        static void ReadInt(out int first, out int second)
        {
            var array = ReadIntArray();
            first = array[0];
            second = array[1];
        }

        static void ReadInt(out int first, out int second, out int third)
        {
            var array = ReadIntArray();
            first = array[0];
            second = array[1];
            third = array[2];
        }

        static void ReadInt(out int first, out int second, out int third, out int fourth)
        {
            var array = ReadIntArray();
            first = array[0];
            second = array[1];
            third = array[2];
            fourth = array[3];
        }

        static void ReadLong(out long first)
        {
            var array = ReadLongArray();
            first = array[0];
        }

        static void ReadLong(out long first, out long second)
        {
            var array = ReadLongArray();
            first = array[0];
            second = array[1];
        }

        static void ReadLong(out long first, out long second, out long third)
        {
            var array = ReadLongArray();
            first = array[0];
            second = array[1];
            third = array[2];
        }

        static void ReadLong(out long first, out long second, out long third, out long fourth)
        {
            var array = ReadLongArray();
            first = array[0];
            second = array[1];
            third = array[2];
            fourth = array[3];
        }

        #endregion
    }
}

Measured memory_bytes: 13524
import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate


def read_ints():
    return list(map(int, read().split()))


def read_a_int():
    return int(read())


def read_tuple(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(tuple(map(int, read().split())))
    return ret


def read_col(H):
    '''
    H is number of rows
    A列、B列が与えられるようなとき
    ex1)A,B=read_col(H)    ex2) A,=read_col(H) #一列の場合
    '''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return tuple(map(list, zip(*ret)))


def read_matrix(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return ret
    # return [list(map(int, read().split())) for _ in range(H)] # 内包表記はpypyでは遅いため


MOD = 10**9 + 7
INF = 2**31  # 2147483648 > 10**9
# default import
from collections import defaultdict, Counter, deque
from operator import itemgetter
from itertools import product, permutations, combinations
from bisect import bisect_left, bisect_right  # , insort_left, insort_right

# https://atcoder.jp/contests/abc055/tasks/abc055_a

N = read_a_int()
print(N * 800 - 200 * (N // 15))


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

bool isprime(ll x) {
	for (ll i = 2; i * i <= x; ++i) {
		if (x % i == 0)
			return false;
	}
	return true;
}

int main(int argc, char const *argv[])
{
	ll a, b; cin >> a >> b;
	ll gcd = __gcd(a, b);
	set<ll> prime;

	for (ll i = 1; i * i <= gcd; ++i) {
		if (gcd % i == 0) {
			// cout << i << " " << gcd / i << endl;
			if (isprime(i))
				prime.insert(i);
			if (isprime(gcd / i))
				prime.insert(gcd / i);
		}
	}
	// for (auto u : prime) cout << u << endl;
	cout << prime.size() << endl;
	return 0;
}


Measured memory_bytes: 256
"""
=int(input())
=map(int,input().split())
=list(map(int,input().split()))

# アレイ import numpy as np =np.array(list(map(float,input().split())))

# 文字列 =list(str(input()).split(" " or ","))

# 一文字＆連番(縦横可能) =map(int, open(0).read().split())

# 2-d list
lis=[[] for _ in range(M)]
for i in range(M):
    lis[i] = list(map(int,input().split()[0:]))

# Each list
N = int(input())
a = [0] * N
b = [0] * N
c = [0] * N
for i in range(N):
    a[i], b[i], c[i] = map(int, input().split())
"""

k=int(input())
a,b=map(int,input().split())
lis=list(range(a,b+1))
for i in range(len(lis)):
    if lis[i]/k==int(lis[i]/k):
        print('OK')
        break
else:
    print('NG')

Measured memory_bytes: 9180
N,k=map(int,input().split())
h = list(map(int,input().split()))
DP = [0] * N
for i in range(1,N):
    dp = [0] * (k)
    for j in range(1,k+1):
        if(i - j) >=0:
            dp[j-1] = abs(h[i] - h[i-j]) + DP[i-j]
        else:
            dp[j-1] = 10**6
    DP[i] = min(dp)
print(DP[-1])

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

using namespace std;

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

const int N = 100010;
const double eps = 1e-6;

int n, m;
struct City
{
    int p, y, order, a;
}cities[N];

bool cmp1(City a, City b)
{
    if(a.p != b.p) return a.p < b.p;
    else return a.y < b.y;
}

bool cmp2(City a, City b)
{
    return a.order < b.order;
}

int main()
{
    scanf("%d%d", &n, &m);
    for(int i = 1; i <= m; i++)
    {
        scanf("%d%d", &cities[i].p, &cities[i].y);
        cities[i].order = i;
    }
    sort(cities + 1, cities + 1 + m, cmp1);

    for(int i = 1, r; i <= m; i++)
    {
        if(cities[i].p != cities[i - 1].p) r = 1;
        cities[i].a = r++;
    }
    sort(cities + 1, cities + 1 + m, cmp2);

    for(int i = 1; i <= m; i++)
        printf("%06d%06d\n", cities[i].p, cities[i].a);
    return 0;
}


Measured memory_bytes: 3196
from networkx import*
(N,M,S,T,*r),*t=[map(int,t.split())for t in open(0)]
G=Graph()
for u,v,a,b in t:G.add_edge(u,v,y=a,s=b)
b=m=10**15
y,s=map(f:=eval(dir()[763]),(G,G),(S,T),(m,m),'ys')
while N:b=min(b,y[N]+s[N]);r+=m-b,;N-=1
print(*r[::-1])

Measured memory_bytes: 212008
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define printVec(v) printf("{"); for (const auto& i : v) { std::cout << i << ", "; } printf("}\n");
#define degreeToRadian(deg) (((deg)/360)*2*M_PI)
#define radianTodegree(rad) (((rad)/2/M_PI)*360)
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; }
using namespace std;
using P = pair<int,int>;
using ll = long long;
const ll INF = 1LL<<60;
const int MOD = 1e9 + 7;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

struct UnionFind {
    vector<int> a;
    UnionFind(int n) : a(n) {
        for(int i = 0; i < n; i++) a[i] = i;
    }

    int root(int x) { 
        if (a[x] == x) return x;
        return a[x] = root(a[x]);
    }

    void unite(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        if (rx == ry) return;
        a[rx] = ry;
    }

    bool same(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    } 
};


//cin.tie(0);ios::sync_with_stdio(false);
//cout << fixed << setprecision(15) << y << endl;
int main() {
  int n, m;
  cin >> n >> m;
  vector<P> edge;
  rep (i, m) {
    int a, b;
    cin >> a >> b;
    --a; --b;
    edge.push_back(make_pair(a, b));
  }

  int ans = 0;
  rep (i, m) {
    UnionFind uf(n);
    rep (j, m) {
      if (i == j) continue;
      uf.unite(edge[j].first, edge[j].second);
    }
    set<int> se;
    rep (k, n) {
      se.insert(uf.root(k));
    }

    if (se.size() != 1) ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3632
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<unordered_map>
#include<array>
#include<map>
#include<iomanip>
//<< setprecision(5)
using namespace std;
typedef long long int llint;
typedef long double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
#define dme cout<<-1<<endl;return 0
const int mod=1000000007;
const llint big=1e9+10;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-7;
template <class T,class U>void mineq(T& a,U b){if(a>b){a=b;}}
template <class T,class U>void maxeq(T& a,U b){if(a<b){a=b;}}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){return a/gcd(a,b)*b;}
int main(void){
	int h,w,d,i,j;cin>>h>>w>>d;
	if(d%2==1){
		for(i=0;i<h;i++){
			for(j=0;j<w;j++){
				if((i+j)%2==0){cout<<'R';}
				else{cout<<'Y';}
			}
			cout<<endl;
		}
		return 0;
	}
	for(i=0;i<h;i++){
		for(j=0;j<w;j++){
			int x=i+j+1000;
			int y=i-j+1000;
			x/=d;
			y/=d;
			if(x%2==0&&y%2==0){cout<<'R';}
			if(x%2==0&&y%2==1){cout<<'Y';}
			if(x%2==1&&y%2==0){cout<<'B';}
			if(x%2==1&&y%2==1){cout<<'G';}
		}
		cout<<endl;
	}
	return 0;
}

Measured memory_bytes: 512