akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
#define ll long long
#define mx 2000000
//#define mod 1000000007
#define max(x,y) ((x)>(y)?(x):(y))
#define min(x,y) ((x)<(y)?(x):(y))
#define fur(i,x,y) for(i=x;i<=y;i++)
#define fdr(i,x,y) for(i=x;i>=y;i--)
#define Fur(i,x,y) for(ll i=x;i<=y;i++)
#define Fdr(x,y) for(ll i=x;i>=y;i--)
#define in2(x,y) in(x);in(y)
#define in3(x,y,z) in2(x,y);in(z)
#define in4(a,b,c,d) in2(a,b);in2(c,d)
#define clr(x,y) memset(x,y,sizeof(x))
#define cpy(x,y) memcpy(x,y,sizeof(x))
using namespace std;
/*---------------------------------------*/
namespace fib{char b[300000]= {},*f=b;}
#define gc ((*fib::f)?(*(fib ::f++)):(fgets(fib::b,sizeof(fib::b),stdin)?(fib::f=fib::b,*(fib::f++)):-1))
inline void in(ll &x){x=0;char c;bool f=0;while((c=gc)>'9'||c<'0')if(c=='-')f=!f;x=c-48;while((c=gc)<='9'&&c>='0')x=x*10+c-48;if(f)x=-x;}
namespace fob{char b[300000]= {},*f=b,*g=b+300000-2;}
#define pob (fwrite(fob::b,sizeof(char),fob::f-fob::b,stdout),fob::f=fob::b,0)
#define pc(x) (*(fob::f++)=(x),(fob::f==fob::g)?pob:0)
struct foce{~foce(){pob;fflush(stdout);}} _foce;
namespace ib{char b[100];}
inline void out(ll x){if(x==0){pc(48);return;}if(x<0){pc('-');x=-x;}char *s=ib::b;while(x) *(++s)=x%10,x/=10;while(s!=ib::b) pc((*(s--))+48);}
inline void outn(ll x){out(x);pc('\n');}
/*------------------------------------------------------------------------------------------------*/

/*------------------------------------------------------------------------------------------------*/
int main(){
	ll a,b,lb=1,x;
	in2(a,b);x=b;
	while(b){lb*=10;b/=10;}
	x=a*lb+x;a=int(sqrt(x));
	if(a*a==x)printf("Yes\n");
	else printf("No\n");
}
/*

*/


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string s,t;
  cin >> s >> t;
  t.pop_back();
  
  if(s == t){
    
        cout << "Yes" << endl;
  }

	else
      cout <<"No"<<endl;
  return 0;
    
 
  
}

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

using namespace std;

#define int long long

#define rep(i,x) for(int i=0;i<x;++i)

const int mod = 1e9 + 7;

int N, C;
int A[405], B[405];
int Sum[405][405];

// bubunten
int dp[405][405];

int modpow(int a, int x, int m)
{
    int res = 1;

    while (x > 0) {
        if (x & 1) (res *= a) %= m;

        (a *= a) %= m;
        x /= 2;
    }

    return res;
}

signed main()
{
    cin >> N >> C;

    rep(i, N) cin >> A[i];
    rep(i, N) cin >> B[i];

    int v = 0;

    for (int i = 0; i < N; ++i) {
        for (int j = 0; j <= C; ++j) {
            for (int k = A[i]; k <= B[i]; ++k) {
                (Sum[i][j] += modpow(k, j, mod)) %= mod;
            }
        }
    }

    for (int i = 0; i <= C; ++i) {
        for (int l = A[0]; l <= B[0]; ++l) {
            (dp[0][i] += modpow(l, i, mod)) %= mod;
        }
    }

    for (int i = 1; i < N; ++i) {
        for (int j = 0; j <= C; ++j) {
            for (int k = 0; k <= C - j; ++k) {
                int v = 0;

                v += Sum[i][k];

                (dp[i][j + k] += dp[i - 1][j] * v) %= mod;
            }
        }
    }

    cout << dp[N - 1][C] << endl;
}


Measured memory_bytes: 2816
#include <algorithm>
#include <iostream>
#include <numeric>
#include <vector>
using namespace std;
int main()
{
    int n, m;
    cin >> n >> m;
    if(n > m){
        cout << 0;
        return 0;
    }else{
    vector<int>x(m);
    for(auto &in : x){
        cin >> in;
    }
    sort(x.begin(), x.end());
    vector<int>d(m-1);
    for(auto i = 0; i < m - 1; ++i){
        d[i] = x[i + 1] - x[i];
    }
    sort(d.begin(), d.end());
    int ans = accumulate(d.begin(), d.end() - n + 1, 0);
    cout << ans;
    return 0;
    }
}


Measured memory_bytes: 1024
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from itertools import permutations, accumulate, combinations, combinations_with_replacement
from math import sqrt, ceil, floor, factorial
from bisect import bisect_left, bisect_right, insort_left, insort_right
from copy import deepcopy
from operator import itemgetter
from functools import reduce
from fractions import gcd
import sys
def input(): return sys.stdin.readline().rstrip()
def I(): return int(input())
def Is(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def TI(): return tuple(map(int, input().split()))
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def TIR(n): return [TI() for _ in range(n)]
def S(): return input()
def Ss(): return input().split()
def LS(): return list(input())
def SR(n): return [S() for _ in range(n)]
def SsR(n): return [Ss() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
sys.setrecursionlimit(10**6)
MOD = 10**9+7
INF = 10**18
# ----------------------------------------------------------- #

n, k = Is()
H = IR(n)
H.sort()
ans = INF
for i in range(n-k+1):
    hmax = H[i+k-1]
    hmin = H[i]
    ans = min(ans, hmax-hmin)
print(ans)


Measured memory_bytes: 76804
import std.stdio,std.string,std.conv;

void main(){
    auto input=readln.chomp.split;
    auto n=input[0].to!ulong;
    auto a=input[1].to!ulong;
    auto b=input[2].to!ulong;
    auto ans=n/(a+b)*a;
    ans+=n%(a+b)>a?a:n%(a+b);
    writeln(ans);
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <functional>
#include <vector>
#define numarr 12
using namespace std;

int Lsum(int L[], int n, int N)
{
	int i, ans = 0;
	for (i = 0; i < N; i++)
	{
		if (i != n)
			ans += L[i];
	}
	return ans;
}

int main() {
	string can = "Yes";
	int N, L[numarr], i;
	cin >> N;
	for (i = 0; i < N; i++)
		cin >> L[i];
	for (i = 0; i < N; i++)
	{
		if (L[i] >= Lsum(L, i, N))
			can = "No";
	}
		cout << can << endl;
}

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

int solve(ll H, ll i, vector<int>&Hb, ll W, ll j, vector<int>&Wb, ll K, vector<string>& c){

    // 終了条件
    if( i==H and j==W ){
        int cnt = 0;
        for(ll ik=0; ik<H; ik++) {
            for(ll jk=0; jk<W; jk++) {
                if( Hb[ik] == 0 and Wb[jk] == 0 and c[ik][jk] == '#'){
                    cnt++;
                }
            }
        }
        /*
        for(auto &&elm : Hb) {
                cout << elm << " ";
            }
            cout << endl;
                                        
            for(auto &&elm : Wb) {
                cout << elm << " ";
            }
            cout << endl;
        */
        if(cnt == K) {
            return 1;
        }
        else {
            return 0;
        }
    }

    int ans = 0;
    if( i<H ){
        Hb[i] = 0;                  // 選択しない
        ans += solve(H,i+1,Hb,W,j,Wb,K,c);
        Hb[i] = 1;                  // 選択する
        ans += solve(H,i+1,Hb,W,j,Wb,K,c);
    }
    else{
        Wb[j] = 0;
        ans += solve(H,i,Hb,W,j+1,Wb,K,c);
        Wb[j] = 1;
        ans += solve(H,i,Hb,W,j+1,Wb,K,c);
    }
    return ans;

}


signed main(){
    
    ll H,W,K;
    cin >> H >> W >> K;

    vector<string> c;
    for(ll i=0; i<H; i++) {
        string s; cin >> s;
        c.push_back(s)    ;
    }
    vector<int> Hb(H,0),Wb(W,0);

    cout << solve(H, 0, Hb, W, 0, Wb, K, c) << endl;

    

    return 0;
}


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

#define lol long long
#define gcd(x,y) __gcd(x,y)
#define mt make_tuple
#define mp make_pair
#define fi first
#define se second
#define fixed fixed<<setprecision(14)
using namespace std;
using pii=pair<int,int>;
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
template <class T> using MAX_pq = priority_queue<T>;
template <class T> using MIN_pq = priority_queue<T,vector<T>,greater<T>>;
template <class A> inline lol abs(A &a) { return (a < 0 ? -a : a); }
const lol Mod=(1e9)+7;
const lol mod=998244353;
const int dx[]={1,0,-1,0,1,1,-1,-1};
const int dy[]={0,1,0,-1,1,-1,1,-1};
lol n,m,k,r,q;
int ans[100010];
vector<int> mi[100010];
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >>n>>m;
  for(int i=0;i<m;i++){
    int a,b;
    cin >>a>>b;
    mi[a].emplace_back(b);
    mi[b].emplace_back(a);
  }
  queue<int> q;
  q.push(1);
  memset(ans,-1,sizeof(ans));
  ans[1]=0;
  while(!q.empty()){
    int x=q.front();
    q.pop();
    for(int i=0;i<mi[x].size();i++){
      if(ans[mi[x][i]]==-1){
	ans[mi[x][i]]=x;
	q.push(mi[x][i]);
      }
    }
  }
  cout <<"Yes\n";
  for(int i=2;i<=n;i++) cout <<ans[i]<<'\n';
  return (0);
}


Measured memory_bytes: 10568
using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using System.Numerics;

namespace abc173
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });
            if (File.Exists("input.txt"))
            {
                Console.SetIn(new StreamReader("input.txt"));
            }
            solve_abc173B();
            Console.Out.Flush();
        }

        public static void solve_abc173C()
        {
        }

        public static void solve_abc173B()
        {
            int t = Convert.ToInt32(Console.ReadLine());
            Dictionary<string, int> cnt = new Dictionary<string, int>();
            for (int tt = 0; tt < t; tt++)
            {
                string v = Console.ReadLine();
                if (cnt.ContainsKey(v))
                {
                    cnt[v]++;
                }
                else
                {
                    cnt.Add(v, 1);
                }
            }
            Console.WriteLine("AC x {0}", cnt.ContainsKey("AC") ? cnt["AC"] : 0);
            Console.WriteLine("WA x {0}", cnt.ContainsKey("WA") ? cnt["WA"] : 0);
            Console.WriteLine("TLE x {0}", cnt.ContainsKey("TLE") ?  cnt["TLE"] : 0);
            Console.WriteLine("RE x {0}", cnt.ContainsKey("RE") ? cnt["RE"] : 0);
        }

        public static void solve_abc173A()
        {
            int n = Convert.ToInt32(Console.ReadLine());
            Console.Write(n % 1000 == 0 ? 0 : 1000 - (n % 1000));
        }
    }
}

Measured memory_bytes: 31960
#include <bits/stdc++.h>
#define BIT(n) (1LL << (n))
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPB(i, n) for (int i = 0; i < BIT(n); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORA(i, n) for (auto &&i : n)
#define FORS(i, m, n) for (int i = m; i <= n; i++)
#define DEBUG(x) cerr << #x << ": " << x << "\n"
#define ALL(v) v.begin(), v.end()
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
#define epb emplace_back
#define int long long
using namespace std;
template < class T > using vec = std::vector< T >;
template < class T > void print(T &x) { cout << x << "\n"; }
typedef long long ll;
const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI = acos(-1.0);
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
signed main() {
  cin.tie(0), ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  int H, W;
  cin >> H >> W;
  vec< string > S(H);
  vec< int > a(H, 0);
  vec< int > b(W, 0);
  REP(i, H) {
    cin >> S[i];
    REP(j, W) {
      if (S[i][j] == '#') {
        a[i]++;
        b[j]++;
      }
    }
  }
  REP(i, H) {
    REP(j, W) {
      if (a[i] && b[j])
        cout << S[i][j];
    }
    if (a[i])
      cout << "\n";
  }
  // print();
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
vector<int> g[100001];
void dfs(int u,int r,int ans[],int a[],int &p){
    ans[u]=a[p];
    for(auto i: g[u]){
        if(i==r) continue;
        p--;
        dfs(i,u,ans,a,p);
    }
    return;
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n,m,i,j,k;
    cin>>n;
    for(i=0;i<n-1;i++){
        int u,v;
        cin>>u>>v;
        g[u].push_back(v);
        g[v].push_back(u);
    }
    bool c[n+1];
    memset(c,0,sizeof(c));
    int a[n];
    for(i=0;i<n;i++) cin>>a[i];
    sort(a,a+n);
    int s=0;
    for(i=0;i<n-1;i++) s+=a[i];
    int ans[n+1];
    int p=n-1;
    dfs(1,-1,ans,a,p);
    cout<<s<<endl;
    for(i=1;i<=n;i++) cout<<ans[i]<<" ";
    cout<<endl;

}




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

int main() {
  ll n, m; cin >> n >> m;
  vector<ll> D;
  for (ll i=1; i*i<=m; i++) {
    if (m%i == 0) {
      D.push_back(i);
      if (i*i<=m) D.push_back(m/i);
    }
  }
  
  sort(D.rbegin(), D.rend());
  
  for (auto &&d: D) {
    if (n*d <= m) {
      cout << d << endl;
      return 0;
    }
  }
  
  cout << -1 << endl;
  return 0;
}


Measured memory_bytes: 3564
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 2019;


int main(){
    set<char> ST;
    string S; cin >> S;
    for(auto ch : S){
        ST.insert(ch);
    }
    if(ST.size() == 3) cout << "Yes" << endl;
    else cout << "No" << endl;


}


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

int main() {
  int A, B, C;
  cin >> A >> B >> C;
  if (A==B && B==C) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

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

using i64 = long long;
using P = pair<i64, i64>;


void solve(long long N, std::string S){
    i64 ans = 0;
    for(int i = 0; i < N - 2; ++i){
        if(S[i] == 'A' && S[i + 1] == 'B' && S[i + 2] == 'C') ++ans;
    }
    cout << ans << endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    std::string S;
    std::cin >> S;
    solve(N, S);
    return 0;
}


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

#define range(i, n) for (i = 0; i < n; i++) 
#define rrange(i, n) for(i = n-1; i>=0; i--)

typedef long long int ll;


using namespace std;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }

int main() {
	int i, k, l;
	ll N, M;
	ll H, W;
	ll h, w;

	cin >> H >> W >> h >> w;

	ll ret = H * W;

	ret -= (h * W) + (H * w) - (h*w);

	if (ret <= 0)ret = 0;


	cout << dec << ret;


	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<cstdio>
#include<vector>
#include<queue>
#include<string>
#include<algorithm>
#include<set>
#include<map>
using namespace std;
using ll = long long;

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

Measured memory_bytes: 3628
N, M = map(int, input().split())
a1 = 0
b1 = N
for i in range(M):
    a, b = map(int, input().split())
    if a1 <= a:
        a1 =a
    if b1 >= b:
        b1 = b

ans = b1-a1+1
if ans <0:
    ans = 0
print(ans)



Measured memory_bytes: 3188
#include "bits/stdc++.h"
using namespace std;
using ll = long long; using ull = unsigned long long;
//#define int ll
using vb = vector<bool>; using vvb = vector<vb>;
using vi = vector<int>; using vvi = vector<vi>;
using vl = vector<ll>; using vvl = vector<vl>;
template<class T> using V = vector<T>;
template<class T> using vv = vector<V<T>>;
template<class T> using VV = vector<V<T>>;
#define fi first
#define se second
#define maxs(x,y) (x=max(x,y))
#define mins(x,y) (x=min(x,y))
using pii = pair<int,int>; using pll = pair<ll,ll>;
#define FOR(i,a,b) for(ll i = (a); i < (ll)(b); ++i)
#define REP(i,n) FOR(i,0,n)
#define RFOR(i,a,b) for(ll i = (ll)(b)-1;i >= a;--i)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define eb(val) emplace_back(val)
const double PI = acos(-1);
const double EPS = 1e-10;
const ll MOD = 1e9+7;
void cioacc(){//accelerate cin/cout
  cin.tie(0);
  ios::sync_with_stdio(false);
}
//naive
signed main(){
  cioacc();
  int n;
  cin >> n;
  vi c;
  REP(i,n){
    int tmp;
    cin >> tmp;
    tmp--;
    if(i>0&&tmp==c.back()) continue;
    c.eb(tmp);
  }
  if(c.size()<2){
    cout << 1 << endl;
    return 0;
  }
  vi dp(c.size(),0);
  vl ct(n,0);
  ct[c[c.size()-1]]++;
  ct[c[c.size()-2]]++;
  vi last(n,-1);
  vl dp2(n,0);
  RREP(i,c.size()-2){
    dp[i] = (dp[i+1]+ct[c[i]])%MOD;
    if(last[c[i]]!=-1) {
      dp2[c[i]] = (dp2[c[i]]+dp[last[c[i]]+1])%MOD;
      dp[i] = (dp[i]+dp2[c[i]]) % MOD;
    }
    last[c[i]]=i;
    ct[c[i]]++;
  }
  cout << (dp[0]+1)%MOD << endl;
}

Measured memory_bytes: 5876
//inlclude前用define 
#define _USE_MATH_DEFINES

//include
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<type_traits>
#include<numeric>
//#include<deque>
#include<iomanip>
#include<set>
#include<tuple>
#include<map>

using namespace std;

//typedef
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<char> VC;
typedef long long int ll;

//define
#define INF 1e9 
#define NUM 1000000007
#define all(x) begin(x), end(x)
#define rep(i,n) for(int i=0;i<(int)(n);i++)

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	string s;
	cin >> s;
	bool flag = false;
	string ans = "No";

	rep(i, s.size()) {
		if (s[i] == 'C') {
			flag = true;
		}
		if (flag && s[i] == 'F') {
			ans = "Yes";
		}
	}
	cout << ans << endl;

	return 0;
	
}





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

int i;
int n, q;
vector<int> s;

// int linearSearch(int key) {
//     for (int i=0; i<n; i++) {
//         if (s[i] == key)
//             return i;
//     }
//     return -1;
// }

int linearSearch(int key) {
    int i = 0;
    s[n] = key;
    while (s[i] != key)
        i++;
    if (i == n)
        return -1;
    return i;
}

int main() {
    int input;
    vector<int> ans;

    cin >> n;
    rep(i, n) {
        cin >> input;
        s.push_back(input);
    }
    s.push_back(0); // 番兵用

    cin >> q;
    rep(i, q) {
        cin >> input;
        int t = linearSearch(input);
        if (t >= 0)
            ans.push_back(t);
    }
    ans.erase(unique(ans.begin(), ans.end()), ans.end());
    cout << ans.size() << endl;

    return 0;
}



Measured memory_bytes: 3240
using System;

namespace c
{
    class Program
    {
        static void Main(string[] args)
        {
            var _ = Console.ReadLine().Split();
            var a = int.Parse(_[0]);
            var b = int.Parse(_[1]);

            Console.WriteLine(Lcm(a, b));
        }

        //最小公倍数
        static long Lcm(long m, long n){
        	return (m * n) / Gcd(m, n);
        }

        //最大公約数
        static long Gcd(long m, long n)
        {
	        while (m % n != 0){
        		var temp = n;
		        n = m % n;
		        m = temp;
	        }
        	return n;
        }
    }
}


Measured memory_bytes: 13140
//#pragma GCC optimize "trapv"
#include<bits/stdc++.h>
#define ll long long int
#define fab(a,b,i) for(int i=a;i<b;i++)
#define pb push_back
#define db double
#define mp make_pair
#define endl "\n"
#define f first
#define se second
#define all(x) x.begin(),x.end()
#define MOD 1000000007
#define quick ios_base::sync_with_stdio(false);cin.tie(NULL)
using namespace std;
//dp with bitmasking
ll dp[1<<21+1];
int main()
{ quick;

	int n;
	cin>>n;
	bool allowed[n][n];
	fab(0,n,i)
	fab(0,n,j)
	cin>>allowed[i][j];
	
	dp[0]=1;
	for(int mask=0;mask<(1<<n);mask++)
	{
		int x=__builtin_popcount(mask);
		for(int i=0;i<n;i++)
		{
			if(allowed[x][i] and (mask&(1LL<<i))==0)
			{
				dp[mask|(1LL<<i)]=(dp[mask|(1LL<<i)]+dp[mask])%MOD;
			}
		}
	}

	cout<<dp[(1<<n)-1]<<endl;


	return 0;
}

Measured memory_bytes: 18688
#include <iomanip>
#include <iostream>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;

int main(void) {
  ios::sync_with_stdio(false);
  string S, T;
  cin >> S >> T;
  int N = S.size();
  int answer = 0;
  rep(i, N) {
    if (S[i] != T[i]) ++answer;
  }
  cout << answer << endl;
  return 0;
}


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

using namespace std;

bool CompareMin(int a, int b) {
	return a > b;  
}

int main(){
    int n,c=0;
    string str;
    cin >> n >> c;
    cin >> str;
    
    
    str[c-1] += 32;
    cout << str << endl; 
    
}

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

int main() {
  int N;
  cin >> N;
  vector<int> mm(101010,0);
  int pp;
  for (int i=0; i<N; i++) {
    cin >> pp;
    mm[pp]++;
  }
  int ans = 0;
  for(int i=0; i<101000; i++) {
    ans = max(ans,mm[i]+mm[i+1]+mm[i+2]);
  }
  cout << ans << endl;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#define ll long long int
#define FOR(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define REP(i,n) FOR(i,0,n)
#define REP1(i,n) FOR(i,1,n)
using namespace std;
 /*temp*/

int main(){
    int i, j;
    while(cin >> i >> j){
        int n = 0;
        i += j;
        while(i > 0){
            i /= 10;
            ++n;
        }
        cout << n << '\n';
    }
}

Measured memory_bytes: 3012
#include<cstdio>
int a,b,c,k;
int main() {
	scanf("%d%d%d",&a,&b,&c);
	scanf("%d",&k);
	int ans=0;
	while (b<=a) {
		b*=2;
		ans++;
	}
	while (c<=b) {
		c*=2;
		ans++;
	}
	if (ans<=k) printf("Yes"); else printf("No");
	return 0;
} 

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

using namespace std;

#define ll long long int

int main() {
	
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	
	int t; cin >> t;
	
	ll prev1 = 1;
	ll prev2 = 1;
	
	while(t--) {
		
		ll a,b; cin >> a >> b;
		
		ll na = prev1 / a + (prev1 % a != 0);
		ll nb = prev2 / b + (prev2 % b != 0);
		
		prev1 = a*max(na,nb);
		prev2 = b*max(na,nb);
	}
	
	cout << prev1 + prev2 << '\n';
	
	return 0;
}

Measured memory_bytes: 256
n,a,b,k = map(int,input().split())
mod = 998244353
fun = [1]*(n+1)
for i in range(1,n+1):
  fun[i] = fun[i-1]*i%mod
rev = [1]*(n+1)
rev[n] = pow(fun[n],mod-2,mod)
for i in range(n-1,0,-1):
  rev[i] = rev[i+1]*(i+1)%mod
def nCr(n,r):
  if r > n:
    return 0
  return fun[n]*rev[r]%mod*rev[n-r]%mod
ans = 0
for i in range(min(n,k//a)+1):
  j = (k-a*i)//b
  if i*a+j*b == k and 0<=j<=n:
    ans += nCr(n,i)*nCr(n,j)
    ans %= mod
print(ans)

Measured memory_bytes: 27764
#include <bits/stdc++.h>
#define int long long
using namespace std;

int count(const vector<string>& vs, const int K) {
    int n = vs.size();
    string s;
    char top = vs[0][0];
    for (int i = 0, k = 0; i < n; i++) {
        if (i % 2 && k >= K) s += vs[i];
        else s += string(vs[i].size(), top);
        k += i % 2;
    }

    int ret = s.size();
    s = "R" + s + "L";
    for (int i = 1; i < s.size() - 1; i++) {
        char t = s[i + (s[i] == 'L' ? -1 : 1)];
        ret -= (t != s[i]);
    }
    cerr << s << " " << ret << endl;
    return ret;
}

signed main() {
    int N, K;
    string S;
    cin >> N >> K >> S;

    vector<string> vs;
    char last = '"';
    for (char c : S) {
        if (last != c) vs.push_back(string(1,c));
        else vs.back() += c;
        last = c;
    }

    int ans = count(vs, K);
    reverse(vs.begin(), vs.end());
    ans = max(ans, count(vs, K));
    cout << ans << endl;
}


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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------


void solve() {
    int i,j,k,l,r,x,y; string s;
    bool exit = false;
    ll a,b;
    cin>>a>>b;
    if(a+b==15)
        cout<<'+'<<endl;
    else if(a * b == 15)
        cout<<'*'<<endl;
    else
        cout<<'x'<<endl;
    /*cin>>N;
    vector<ll> V;
    FOR(x,N+1) {
            FOR(y,N+1) {
                    ll ret=1;
                    FOR(i,x) ret*=2;
                    FOR(i,y) ret*=5;
                    V.push_back(ret);
            }
    }
    sort(ALL(V));
    FORR(v,V) cout<<v<<endl;*/
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<string>
#include<algorithm>
using namespace std;

#define rep0(n) for(int i=0;i<n;i++)
#define rep(n) for(int i=1;i<=n;i++)

double const pi=3.1415926535;

int printint(int n){
	cout<<n<<endl;
	return 0;
}

int prints(string s){
	cout<<s<<endl;
	return 0;
}

int main(){
	string s;
	cin>>s;
	printf("%c%d%c\n",s[0],s.length()-2,s[s.length()-1]);
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(), (v).end()
using namespace std;
using lint = long long;
using pi = pair<lint, lint>;
const int MAXN = 10005;
const lint inf = 1e17;

int n; 
pi a[MAXN], b[MAXN];
bool dp[61][3][2];

bool on(lint x, lint y){
	bool ans = 0;
	for(int i=0; i<n; i++){
		lint px = x - a[i].first;
		lint py = a[i].second - y;
		if(py >= 0 && px >= 0 && (px & py) == px) ans ^= 1;
	}
	return ans;
}

bool query(lint l, int m){ 
	l = 3 * l + m;
	bool ans = 0;
	for(int i=0; i<n; i++){
		lint x = l - a[i].first;
		lint y = a[i].second;
		if(x <= 0) continue;
		memset(dp, 0, sizeof(dp));
		dp[0][(m - a[i].first % 3 + 3) % 3][0] = 1;
		for(int j=1; j<=60; j++){
			bool hasbit = (y >> (j - 1)) & 1;
			for(int k=0; k<3; k++){
				dp[j][k][0] = dp[j-1][k][0] ^ (hasbit & dp[j-1][(k + (1ll<<(j-1)))%3][0]);
				if((x >> (j-1)) & 1){
					dp[j][k][1] = dp[j-1][k][0] ^ (hasbit * dp[j-1][(k + (1ll<<(j-1)))%3][1]);
				}
				else{
					dp[j][k][1] = dp[j-1][k][1];
				}
			}
		}
		ans ^= dp[60][0][1];
	}
	return ans;
}

pi get_coord(){
	lint s = 0, e = (1ll << 58);
	int i = 0;
	while(i < 3 && query(s, i) == query(e, i)) i++;
	for(int it=0; it<58; it++){
		lint m = (s+e)/2;
		if(query(s, i) != query(m, i)) e = m;
		else s = m;
	}
	return pi(s * 3 + i, 0);
}

int main(){
	scanf("%d",&n);
	for(int i=0; i<n; i++){
		scanf("%lld %lld",&a[i].first,&a[i].second);
		a[i].first += inf;
		a[i].second += inf;
	}
	pi p = get_coord();
	for(int i=59; i>=0; i--){
		if(on(p.first - (1ll << i), p.second)) p.first -= (1ll << i);
	}
	lint x = p.first;
	lint y = p.second;
	for(int i=59; i>=0; i--){
		if(on(p.first + (1ll << i), p.second)){
			p.first += (1ll << i);
			y += (1ll << i);
		}
	}
	printf("%lld %lld\n", x-inf, y-inf);
}



Measured memory_bytes: 512
#include<iostream>
#include<string>
using namespace std;;
int main(){
string s,t;
cin >> s>>t;
int slen=s.length();
int tlen=t.length();
int len=slen-tlen;
if(len<0){
cout <<"UNRESTORABLE";
}
else{
int flag1=0;
for(int i=0;i<=len;i++){
int flag=0;
string ans=s;
for(int j=0;j<tlen;j++){
if(s[len-i+j]=='?'||s[len-i+j]==t[j]){
ans[len-i+j]=t[j];
flag++;
}
}
if(flag==tlen){
s=ans;
flag1=1;
break;
}
}
if(flag1==1){
for(int i=0;i<slen;i++){
if(s[i]=='?'){
s[i]='a';
}
}
cout <<s;
}
else{
cout <<"UNRESTORABLE";
}
}
}


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

int n, m;
int dfn[1010], low[1010], up[1010], dft, bel[1010], blt, st[1010], tp;
map<int,int>mp[1010]; int ans[202000];
vector<int>G[1010]; 

void tar(int x){
  dfn[x]=low[x]=++dft;
  st[++tp]=x;
  
  for (auto &y:G[x])
    if (dfn[y]){
      if (!bel[y]) low[x]=min(low[x],dfn[y]);
    }else{
      tar(y); low[x]=min(low[x],low[y]);
    }
  
  if (dfn[x]==low[x]){
    ++blt;
    for (;;){
      bel[st[tp]]=blt;
      if (st[tp--]==x) break;
    }
  }
}

void dfs(int x,int *vis,int tp){
  if (vis[x]) return; vis[x]=tp;
  for (auto &y:G[x]) dfs(y,vis,tp);
}

void doit(int x){
  memset(up,0,sizeof up); memset(low,0,sizeof low);
  up[x]=low[x]=x;
  sort(G[x].begin(),G[x].end());
  for (auto &y:G[x]) dfs(y,low,y);
  reverse(G[x].begin(),G[x].end());
  for (auto &y:G[x]) dfs(y,up,y);
  for (auto &y:G[x])
    ans[mp[x][y]]= (bel[x]!=bel[y]) ^ (up[y]==low[y]);
}

int main(){
  cin>>n>>m; int x, y;
  for (int i=1;i<=m;++i){
    scanf("%d%d",&x,&y);
    mp[x][y]=i; G[x].push_back(y);
  }
  for (int i=1;i<=n;++i) if (!dfn[i]) tar(i);
  
  for (int i=1;i<=n;++i) doit(i);
  for (int i=1;i<=m;++i) puts(ans[i]? "diff": "same");
}

Measured memory_bytes: 13696
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

pub fn read_n<T: FromStr>(n: usize) -> Vec<T> {
    read_n_logic::<T>(n, vec![])
}

pub fn read_n_logic<T: FromStr>(n: usize, mut a: Vec<T>) -> Vec<T> {
    match n {
        0 => a,
        _ => {
            a.push(read::<T>());
            read_n_logic(n - 1, a)
        }
    }
}
use std::cmp::{max, min};
use std::collections::HashSet;

fn main() {
    let sx: i64 = read();
    let sy: i64 = read();
    let tx: i64 = read();
    let ty: i64 = read();

    let mut ans: String = String::new();
    let xdist = tx - sx;
    let ydist = ty - sy;

    for _ in 0..xdist {
        ans += "R"
    }

    for _ in sy..ty {
        ans += "U"
    }

    for _ in sx..tx {
        ans += "L"
    }
    for _ in sy..ty {
        ans += "D"
    }
    ans += "D";

    for _ in sx..tx + 1 {
        ans += "R"
    }

    for _ in 0..ydist + 1 {
        ans += "U"
    }
    ans += "LU";
    for _ in 0..xdist + 1 {
        ans += "L"
    }

    for _ in 0..ydist + 1 {
        ans += "D"
    }
    ans += "R";
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <iostream>
#include <cmath>
#include <numeric>
#include <algorithm>
#include <deque>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <set>
#include <iomanip>
#include <map>
#include <stack>
#include <queue>
#include <functional>
#include <climits>
#include <numeric>
#include <bitset>
#include <random>
#include <tuple>
#include <initializer_list>
#include <fstream>
#include <cctype>
#include <string>
#include <cfloat>
#include <array>


int main() {
	int n; std::cin >> n;
	std::vector<std::string> str(n); for (auto& c : str) std::cin >> c;
	std::sort(str.begin(), str.end()); 
	std::cout << std::distance(str.begin(), std::unique(str.begin(), str.end())) << std::endl;
}

Measured memory_bytes: 9604
// Problem : B - Popular Vote
// Contest : AtCoder Beginner Contest 161
// URL : https://atcoder.jp/contests/abc161/tasks/abc161_b
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>

using namespace std;

int main(){
	int n,m;
	cin >> n >> m;
	vector<int> a(n);
	
	for(int i = 0; i < n; i++){
		cin >> a[i];
	}
	
	sort(a.rbegin(),a.rend());
	
	int c = 0;
	int sum = accumulate(a.begin(),a.end(),0);
	
	for(int i = 0; i < n; i++){
		if (a[i] * 4 * m >= sum ){
			c++;
		}	
	}

	
	if (c >= m){
		cout << "Yes" << endl;
	}else {
		cout << "No" << endl;
	}
	return 0;	
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); ++i)
using ll = long long;
const ll INF = 100100100;
template <typename T> inline bool chmin(T& a, T b) { 
  if(a > b) {
    a = b;
    return true;
  }
  return false;
}
template <typename T> inline bool chmax(T& a, T b) {
  if(a < b) {
    a = b;
    return true;
  }
  return false;
}

int N;
long long a[100010][3]; // a[i], b[i], c[i] をそれぞれまとめて a[i][0], a[i][1], a[i][2] にしてしまう

// DP テーブル
long long dp[100010][3];

int main() {
    int N; cin >> N;
    for (int i = 0; i < N; ++i) for (int j = 0; j < 3; ++j) cin >> a[i][j];

    // 初期化は既に 0 に初期化される
    // 初期条件も既に 0 で OK

    // ループ
    for (int i = 0; i < N; ++i) {
        for (int j = 0; j < 3; ++j) {
            for (int k = 0; k < 3; ++k) {
                if (j == k) continue;
                dp[i+1][k] = max(dp[i + 1][k], dp[i][j] + a[i][k]);
            }
        }
    }

    // 答え
    long long res = 0;
    for (int j = 0; j < 3; ++j) chmax(res, dp[N][j]);
    cout << res << endl;
}

Measured memory_bytes: 4992
# include <iostream>
# include <algorithm>
#include <array>
# include <cassert>
#include <cctype>
#include <climits>
#include <numeric>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <tuple>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
# include <chrono>
# include <random>
# include <limits.h>
# include <unordered_map>
# include <unordered_set>
# include <deque>
# include <cstdio>
# include <cstring>
#include <stdio.h>
#include<time.h>
#include <stdlib.h>
#include <cstdint>
#include <cfenv>
#include<fstream>
//#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
long long MOD = 1000000000 + 7;
constexpr long long INF = numeric_limits<LL>::max();
const double PI = acos(-1);
#define fir first
#define sec second
#define thi third
#define debug(x) cerr<<#x<<": "<<x<<'\n'
typedef pair<LL, LL> Pll;
typedef pair<LL, pair<LL, LL>> Ppll;
typedef pair<LL, pair<LL, bitset<100001>>> Pbll;
typedef pair<LL, pair<LL, vector<LL>>> Pvll;
typedef pair<LL, LL> Vec2;
struct Tll { LL first, second, third; };
struct Fll { LL first, second, third, fourth; };
typedef pair<LL, Tll> Ptll;
#define rep(i,rept) for(LL i=0;i<rept;i++)
#define Mfor(i,mf) for(LL i=mf-1;i>=0;i--)
LL h, w, n, m, k, t, s, p, q, last, first, cnt, sum, ans, dp[200000];
Pll a[300000], b[300000];
string str, ss;
bool f[200];
char c, ch[100][100];
int di[4][2] = { { 0,1 },{ 1,0 },{ 0,-1 },{ -1,0 } };
struct Edge { LL to, cost; };
vector<Edge>vec[200000];
vector<LL>v;
map<Pll,LL>ma;
multiset<LL>st;
void YN(bool f) {
	if (f)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
}
void yn(bool f) {
	if (f)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}

int main() {
	cin >> n;
	rep(i, n) {
		LL x;
		cin >> x;
		x--;
		if (i % 2 == 0)
			a[x].fir++, a[x].sec = x;
		else
			b[x].fir++, b[x].sec = x;
	}
	sort(b, b + 110000, [](Pll x, Pll y) {return x.fir > y.fir; });
	sort(a, a + 110000, [](Pll x, Pll y) {return x.fir > y.fir; });
	cout << n-(a[0].second==b[0].second?max(a[0].fir+b[1].fir,a[1].fir+b[0].fir): a[0].first+  b[0].fir) << endl;
	return 0;
}


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

using namespace std;

#define debug(n) cerr << #n << ':' << n << endl;
#define dline    cerr << __LINE__ << endl;

using ll = long long;
template<class T, class U> using P = pair<T,U>;
template<class T> using Heap = priority_queue<T>;
template<class T> using heaP = priority_queue<T,vector<T>,greater<T>>;
template<class T,class U> using umap = unordered_map<T,U>;
template<class T> using uset = unordered_set<T>;

template<class T>
bool ChangeMax(T&a,const T&b){
  if(a >= b) return false;
  a = b;    return true;
}

template<class T>
bool ChangeMin(T&a,const T&b){
  if(a <= b) return false;
  a = b;    return true;  
}

template<class T, size_t N, class U>
void Fill(T (&a)[N], const U&v){
    fill((U*)a,(U*)(a+N),v);
}

template<class T>
istream& operator >> (istream&is, vector<T>&v){
  for(auto&e:v)is >> e;
  return is;
}

int main(){
  int a, b; cin >> a >> b;
  int sum = 0;
  if(a == 1) sum += 300000;
  if(a == 2) sum += 200000;
  if(a == 3) sum += 100000;
  if(b == 1) sum += 300000;
  if(b == 2) sum += 200000;
  if(b == 3) sum += 100000;
  if(a == 1 && b == 1) sum += 400000;
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#include <map>

#define ll long long int
#define mod 1000000007

using namespace std;


int main()
{
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
    map<int, int> m;
    int n;
    cin >> n;
    
    for(int i = 0; i < n-1; i++){
        int x;
        cin >> x;
        m[x]++;
    }
    for(int i = 1; i <= n; i++){
        int ans = m[i] == 0 ? 0 : m[i];
        cout << ans << '\n';
    }
    
}









Measured memory_bytes: 13040
#include <iostream>
#define ll long long
using namespace std;
int main(void){
  ll x;
  cin >> x;
  ll kaisuu = x / 11;
  ll amari = x % 11;
  if(amari == 0){
    amari = 0;
  } else {
    amari = (amari - 6 <= 0 ? 1 : 2);
  }
  cout << kaisuu * 2 + amari << endl;
}

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

using namespace std;
typedef string STR;
typedef long long LL;

// variables()
/*int N, min_r = 1000001, max_c = -1000001, mn = 1000001, mx = -1000001;
pair <int, int> pr;
vector <pair <int, int> > vc;*/
///int plank, T, n, l, r, ans, sq, rct;
///STR op;
///vector <int> vc;
long A, B, N, mx = -1;
// variables(NULL)

int main() {
    ios_base::sync_with_stdio(NULL);
    cin.tie(0); cout.tie(0);
    srand(time(0));
    /// start_main()
	/*cin >> N;
	int grid[N][N];
	for (int i = 0 ; i < N ; i ++) {
        for (int j = 0 ; j < N ; j ++) {
            cin >> grid[i][j];
        }
	}
	for (int i = 0 ; i < N ; i ++) {
        for (int j = 0 ; j < N ; j ++) {
            min_r = min(min_r, grid[i][j]);
            max_c = max(max_c, grid[j][i]);
        }
        pr.first = min_r;
        pr.second = max_c;
        vc.push_back(pr);
        min_r = 1000001;
        max_c = -1000001;
	}
	for (int i = 0 ; i < N ; i ++) {
        mx = max(mx, vc[i].first);
        mn = min(mn, vc[i].second);
	}
	if (mx == mn) cout << 0;
	else {
        if (mx < mn) cout << 1;
        else cout << 2;
        multiset
	}
	cin >> plank;
	int arr[plank];
	for (int i = 0 ; i < plank ; i ++) {
        cin >> n;
        vc.push_back(n);
	}
	sort (vc.begin(), vc.end());
	r = vc.size() - 1;
	while (T --) {
        cin >> op >> n;
        if (op == '+') {
            vc.push_back(n);
            sort (vc.begin(), vc.end());
        }
        else {
            while (l <= r) {
                int m = l + (r - l) / 2;
                if (vc[m] == n) {
                    ans = m;
                    break;
                }
                if (vc[m] < n) l = m + 1;
                else r = m - 1;
            }
            vc.pop(m);
        }
        for (int i = 0 ; i < vc.size() ; i ++) {
            for (int j = i + 1 ; j < vc.size() ; j ++) {
                if (vc[i] == vc[j]) {

                }
            }
        }
	}*/
    cin >> A >> B >> N;
    if (N < B) cout << floor(A * N / B) - A * floor(N / B);
    else cout << floor(A * (B - 1) / B) - A * floor((B - 1) / B);
    /// end_main()
    return 0;
}


Measured memory_bytes: 3800
#pragma region include
#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <tuple>
#include <bitset>

#include <queue>
#include <complex>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <fstream>
#include <random>
//#include <time.h>
#include <ctime>
#pragma endregion //#include
/////////
#define REP(i, x, n) for(int i = x; i < n; ++i)
#define rep(i,n) REP(i,0,n)
/////////
#pragma region typedef
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
#pragma endregion //typedef
////定数
const int INF = (int)1e9;
const LL MOD = (LL)1e9+7;
const LL LINF = (LL)1e18;
const double PI = acos(-1.0);
const double EPS = 1e-9;
/////////
using namespace::std;

void solve(){
	int N;
	cin >> N;
	vector<int> P(N);
	vector<int> A(N),B(N);
	for(int i=0;i<N;++i){
		cin >> P[i];
		--P[i];
	}
	const int vMAX = 20001;
	for(int i=0;i<N;++i){
		B[i] = vMAX*vMAX+vMAX*(N-i);
	}
	for(int i=0;i<N;++i){
		A[i] = vMAX*(i+1);
	}

	int pos,prev;
	pos = 0;
	prev = -1;
	LL prevVal;
	for(int i=0;i<N;++i){
		int index = P[i];
		if( i ){
			A[ index ] = prevVal - B[index] + 1;
			prevVal = A[index] + B[index];
		}else{//i==0
			prev =  P[i];
			prevVal = A[index] + B[index];
		}
	}
	for(int i=0;i<N;++i){
		if( i ) cout << ' ';
		cout << A[i];
	}cout << endl;
	for(int i=0;i<N;++i){
		if( i ) cout << ' ';
		cout << B[i];
	}cout << endl;
	/*for(int i=0;i<N;++i){
		if( i ) cerr << ' ';
		int pos = P[i];
		cerr << A[pos] + B[pos];
	}*/
}

#pragma region main
signed main(void){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	
	
	solve();
}
#pragma endregion //main()


Measured memory_bytes: 896
import math
import string


def readints():
    return list(map(int, input().split()))


def nCr(n, r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))


def has_duplicates2(seq):
    seen = []
    for item in seq:
        if not(item in seen):
            seen.append(item)
    return len(seq) != len(seen)


def divisor(n):
    divisor = []
    for i in range(1, n+1):
        if n % i == 0:
            divisor.append(i)
    return divisor


# coordinates
dx = [-1, -1, -1, 0, 0, 1, 1, 1]
dy = [-1, 0, 1, -1, 1, -1, 0, 1]

n = input()
# print(n)
#print(sum(map(int, n)))
x = sum(map(int, n))
# print(int(n)/x)

if int(n) % sum(map(int, n)) == 0:
    print('Yes')
    exit()
else:
    print('No')


Measured memory_bytes: 4212
#include<bits/stdc++.h>
using namespace std;
const int N=210;
int n,m;
char a[N][N];
int f[2][N][N][N];
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++)
		scanf("%s",a[i]+1);
	for(int i=1;i<=n;i++)
		for(int j=m;j;j--)
			if(a[i][j]==a[i][j+1])
				f[0][i][i][j]=f[0][i][i][j+1];
			else
				f[0][i][i][j]=j;
	for(int len=2;len<=n;len++)
		for(int l=1;l<=n-len+1;l++)
		{
			int r=l+len-1;
			for(int k=m;k;k--)
			{
				f[0][l][r][k]=min(f[0][l][r-1][k],f[0][l+1][r][k]);
				if(a[r][k]!=a[r-1][k])
					f[0][l][r][k]=k-1;
			}
		}
	int ans=0;
	for(int o=1;f[o^1][1][n][1]<m;o^=1)
	{
		ans++;
		for(int len=1;len<=n;len++)
			for(int l=1;l<=n-len+1;l++)
			{
				int r=l+len-1;
				for(int k=1;k<=m;k++)
				{
					if(f[o^1][l][r][k]==m)
					{
						f[o][l][r][k]=m;
						continue;
					}
					f[o][l][r][k]=f[o^1][l][r][f[o^1][l][r][k]+1];
					if(len==1)continue;
					int L=l,R=r-1,mx=0;
					while(L<=R)
					{
						int mid=L+R>>1;
						mx=max(min(f[o^1][l][mid][k],f[o^1][mid+1][r][k]),mx);
						if(f[o^1][l][mid][k]<f[o^1][mid+1][r][k])
							R=mid-1;
						else
							L=mid+1;
					}
					f[o][l][r][k]=max(mx,f[o][l][r][k]);
				}
			}
	}
	printf("%d\n",ans);
	return 0;
}


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

int main()
{
    int n, k; cin>>n>>k;
    int x=0;
    for(int i=k/2; i<=n; i+=k) ++x;
#define pow3(x) (long)(x)*(x)*(x)
    cout<<(k%2 ? pow3(n/k) : pow3(n/k)+pow3(x))<<endl;
}

Measured memory_bytes: 256
from numpy import array, argmin

input()
temp_on_sea, oracle = map(int, input().rstrip("\n").split())
heights = list(map(int , input().rstrip("\n").split()))
temp_diff = [abs(temp_on_sea - height * 0.006 - oracle) for height in heights]

print(array(temp_diff).argmin() + 1)


Measured memory_bytes: 21556
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
string s,t;
int ans;
int main() {
	ios::sync_with_stdio(false);
	cin.tie(0),cout.tie(0);
	cin>>s>>t;
	for(int i=0; i<s.size(); i++)
		if(s[i]!=t[i])
			ans++;
	cout<<ans;

	return 0;
}

Measured memory_bytes: 3812
#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0;i<n;i++)
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
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 a,b,c,x,y;
    cin >> a >> b >> c >> x >> y;
    int ab = 2*c;
    int sum = 1001001001;
    rep(i,100001) {
        int tmp = 2*c*i + a*max(0,x-i) + b*max(0,y-i);
        sum = min(sum,tmp);
    }
    cout << sum << endl;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline
ins = lambda: input().rstrip()
ini = lambda: int(input().rstrip())
inm = lambda: map(int, input().rstrip().split())
inl = lambda: list(map(int, input().split()))
out = lambda x: print('\n'.join(map(str, x)))

def dfs(x):
    stack = [x]
    visited = 0
    checked[x] = 1
    while stack:
        visited += 1
        node = stack.pop()
        for i in graph[node]:
            if checked[i] == 0:
                stack.append(i)
                checked[i] = 1
    return visited
 
n, m = inm()
checked = [0] * (n+1)
graph = {}
for i in range(m):
    a, b = inm()
    if a not in graph:
        graph[a] = set()
    if b not in graph:
        graph[b] = set()
    graph[a].add(b)
    graph[b].add(a)
ans = 1
for i in graph:
    if checked[i] == 0:
        ans = max(ans, dfs(i))
print(ans)

Measured memory_bytes: 81960
def sort(a, b, c)
  if b > c
    b,c = c,b
  end
  if a > c
    a,c = c,a
  end
  if a > b
    a,b = b,a
  end
  print a
  print " "
  print b
  print " "
  puts c
end

a,b,c = gets.split(' ').map(&:to_i)
sort(a,b,c)

Measured memory_bytes: 8596
#include <bits/stdc++.h>
using namespace std;
using ull = unsigned long long;

ull N, cnt=0;

bool check_753(const string s) {
    if (
        (s.find("3") != string::npos) && 
        (s.find("5") != string::npos) && 
        (s.find("7") != string::npos) 
    ) return true;
    else return false;
}

void cnt_753(string s, ull &cnt) {
    ull num = atoi(s.c_str());
    if (num <= N) {
        if (check_753(s)) cnt++;
        cnt_753(s + "3", cnt);
        cnt_753(s + "5", cnt);
        cnt_753(s + "7", cnt);
    }
}

int main() {
    cin >> N;

    cnt_753("3", cnt);
    cnt_753("5", cnt);
    cnt_753("7", cnt);

    cout << cnt << endl;

    return 0;

}


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

int main() {

	int n;//dataset
	std::string st_1,st_2;

	st_2 = "Hoshino";

	std::cin >> n;
	std::cin.ignore();

	for (int i = 0; i < n; ++i)
	{
		getline(std::cin,st_1);

		std::string::size_type pos = st_1.find(st_2);

		while (pos != std::string::npos) {
			st_1.replace(pos, st_2.length(), "Hoshina");
			pos = st_1.find(st_2,pos+st_2.length());
		}

		std::cout << st_1 << std::endl;

	}

	return 0;
}

Measured memory_bytes: 1212