akhauriyash/Code-Regression huggingface dataset:
using System;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.Unicode;

namespace C
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[] A = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();
            int Amin = A.Min();
            int Amax = A.Max();
            int max = 1;
            for (int i = Amax; i >= 2; i--)
            {
                if (Amin < i && i < Amax) continue;
                int cnt = 0;
                for (int j = 0; j < n; j++)
                {
                    if (A[j] % i != 0) cnt++;
                    if (cnt >= 2) break;
                    if (j == n - 1) max = (int)Math.Max(i, max);
                }
                if (max != 1) break;
            }
            if (n == 2 || Amax==Amin)
            {
                Console.WriteLine(Amax);
            }
            else
            {
                Console.WriteLine(max);
            }
        }
    }
}

Measured memory_bytes: 39908
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_4_B
// BFS algorithm
#include <iostream>
#include <vector>
#include <queue>

using namespace std;

int main(int argc, char **argv)
{
        int V, E;
        cin >> V >> E;
        vector<vector<int>> A(V);
        vector<int> B(V);
        for (int i = 0; i < E; i++) {
                int s, t;
                cin >> s >> t;
                A[s].push_back(t);
                B[t]++;
        }
        vector<bool> U(V);
        vector<int> L;
        queue<int> S;
        for (int i = 0; i < V; i++) {
                if (B[i] || U[i])
                        continue;
                S.push(i);
                while (!S.empty()) {
                        auto c = S.front();
                        S.pop();
                        U[c] = true;
                        L.push_back(c);
                        for (auto a: A[c])
                                if (--B[a] == 0 && !U[a])
                                        S.push(a);
                }
        }
        for (auto l: L)
                cout << l << endl;
        return 0;
}

Measured memory_bytes: 3624
#include<iostream>
#include<algorithm>
#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;

int main(){
    string s;
    cin >> s;

    if((s[0] == s[1] && s[1] == s[2]) || (s[1] == s[2] && s[2] == s[3])) puts("Yes");
    else puts("No");
    
   
    
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>
#include <numeric>
#include <set>

using namespace std;
struct aaa{aaa(){cin.tie(nullptr); ios::sync_with_stdio(false); cout<<fixed<<setprecision(20);};}aaa;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v){o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
#define debug(v) {cerr<<"\033[1;36m[debug]\033[m "<<#v<<" : "<<v<<endl;}

using int64 = long long;

int main() {
    string s,t;
    cin >> s >> t;
    int ans = 0;
    int n=s.size();
    for (int i=0; i<n; i++) {
        if (s[i] != t[i]) ans++;
    }

    cout << ans << endl;
}

Measured memory_bytes: 3468
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <functional>
#include <climits>
#include <cstring>

using namespace std;

#define int long long
#define rep(i, n) for (int i=0;i<(int)n;++i)
#define rep1(i, n) for (int i=1;i<=(int)n;++i)
#define all(a) begin(a),end(a)
#define fst first
#define scd second
#define PB emplace_back
#define PPB pop_back

using vi=vector<int>;
using pii=pair<int, int>;

bool chmin(int&a,int b){return a>b?(a=b,true):false;}
bool chmax(int&a,int b){return a<b?(a=b,true):false;}
int read(){int a;scanf("%lld",&a);return a;}

constexpr int TEN(int n) { return n == 0 ? 1 : 10 * TEN(n - 1); }

const int mod = TEN(9) + 7;

bool beki[1010];

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

	double ans = 0;

	for (int i = 1; i <= N; ++i) {
		double p = 1.0 / N;

		int score = i;

		while (score <= K - 1) {
			p /= 2;
			score *= 2;
		}

		ans += p;
	}

	printf("%.10f\n", ans);
}




Measured memory_bytes: 256
MOD=10**9+7
cnt=0; sum=0; prev=nil; can=true; h=Hash.new(0)
def gs() gets.chomp end
def gi() gets.to_i end
def gsmi() gets.chomp.split.map(&:to_i) end

def desc(ar) ar.sort!{|x,y|y<=>x} end
def min(a,b) a<=b ? a : b end
def max(a,b) a>=b ? a : b end
def sum(ar) ar.inject(:+) end

def C(a,b) b==0||a==b ? 1 : (b=a-b if a/2<b;(a-b+1..a).inject(:*)/(1..b).inject(:*)) end

def puts_yesno(can) puts(can ? 'Yes' : 'No') end
def putsend(s) puts s; exit end
def debug(k,v) puts "#{k}:#{v}" end
########### ( ˘ω˘ )ｽﾔｧ… ###########
x=gi
require 'prime'
s = Prime.find{|pr|pr>=x}
puts s

Measured memory_bytes: 2368
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func main() {
	scanInit()

	p := nextInt()
	q := nextInt()
	r := nextInt()

	fmt.Println(p + q + r - max(p, max(q, r)))

}
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

// ---- readfunc
func scanInit() {
	const cap = 64 * 1024
	var buf = make([]byte, cap)
	sc.Buffer(buf, cap)
	sc.Split(bufio.ScanWords)
	return
}
func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}
func nextStr() string {
	sc.Scan()
	return sc.Text()
}


Measured memory_bytes: 1776
// -*- mode: c++; -*-
using namespace std;
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>

#define INF INT_MAX/3

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

#define dump(x)  cerr << #x << " = " << (x) << endl;

int A, B;

void load() {
  scanf("%d %d", &A, &B);
}

void solve() {
  int x = A * B;
  int y = (A + B) * 2;
  printf("%d %d\n", x, y);
}


int main() {
  load();
  solve();
}

Measured memory_bytes: 1188
#include<stdio.h>
#include <ctype.h>

int main(void){
  int n,k;
  char s[50];
  
  scanf("%d %d",&n,&k);
  scanf("%s",&s);
  
  s[k-1] = tolower( s[k-1] );
  
  printf("%s",s);
  
  return 0;
}

Measured memory_bytes: 128
S=list(input())
T=list(input())
x=[1000]*(len(S)+1)
for i in range(len(S)-len(T)+1):
    p=0
    for j in range(len(T)):
        if S[i+j]!=T[j]:
            p+=1
    x[i]=p
print(min(x))


Measured memory_bytes: 8948
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
using namespace std;

#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i, m, n) for(int i = (int)(m); i < (int)(n); ++i)


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

    long long ans = 0;
    map<int, int> num_appear;
    REP(i, N){
        ans += num_appear[i-A[i]];
        ++num_appear[i+A[i]];
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 21088
#include <bits/stdc++.h>
     //https://www.codechef.com/viewsolution/28454497
using namespace std;
#define ll long long
#define ld long double
#define pll pair<long long,long long>
#define vll vector<long long>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define F(i,a,b) for(ll i=a;i<=b;i++)
#define RF(i,a,b) for(ll i=a;i>=b;i--)
#define in(a,n) F(i,0,n-1)cin>>a[i]
#define vi vector<int>
#define out(a,n) F(i,0,n-1)cout<<a[i]<<" ";cout<<endl
#define mod 1000000007
#define int long long
vector < ll> primes;
 int dx[]={0,0,1,-1};
int dy[]={1,-1,0,0};
int n,m;
bool isvalid(int x,int y){
  return (x>=0 and x<n and y>=0 and y<m);
}
void Sieve(ll n) 
{ 
    bool prime[n+1];
	for(ll i=0;i<n+1;++i)
		prime[i]=true;
    for (ll p=2;p*p<=n;++p) 
    {
        if (prime[p] == true) 
        {  
            for (ll i=2*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    }  
    for(ll p=2; p<=n; p++) 
       if (prime[p]) 
		primes.push_back(p);  
}
 const int N = 5e5 + 5;
 	int connected;
	int par[N], sz[N];
 
struct DSU
{

	void init(int n) 
	{
		for(int i=1;i<=n;i++)
		{
			par[i]=i;
			sz[i]=1;
		}
		connected=n;
	}
 
	int getPar(int k)
	{
		while(k!=par[k])
		{
			par[k]=par[par[k]];
			k=par[k];
		}
		return k;
	}
 
	int getSize(int k)
	{
		return sz[getPar(k)];
	}
 
	void unite(int u, int v)
	{
		int par1=getPar(u), par2=getPar(v);
 
		if(par1==par2)
			return;
 
		connected--;
 
		if(sz[par1]>sz[par2])
			swap(par1, par2);
 
		sz[par2]+=sz[par1];
		sz[par1]=0;
		par[par1]=par[par2];
	}
};
 
 

DSU dsu;
ll gcd(ll a, ll b) 
{ 
    if (a == 0) 
        return b; 
        return gcd(b % a, a); 
} 
ll powermod(ll x, ll y){
    if(y==0)
    return 1;
        
    if(y%2==0)
    return (powermod(x,y/2)*powermod(x,y/2))%mod;
    else
    return (((powermod(x,y/2)*powermod(x,y/2))%mod)*x)%mod;
}
   
int32_t main()
{
	ios::sync_with_stdio(false);
    cin.tie(NULL);
   
    int a,b;
    cin>>a>>b;
    
    string a1="",a2="";
    
    for(int i=0;i<a;i++)
    {
        a1+=to_string(b);
    }
    for(int i=0;i<b;i++)
    {
        a2+=to_string(a);
    }
    if(a1<=a2)cout<<a1;
    else cout<<a2;
   
    
    
    
    
}



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

int main(void){
  int a,b,n,k,m,N,sum,i,L,p[100],ans;
  char S[50];
    
  if(scanf("%d",&N)>1){
    exit(0);
  }
  //  for(i=0;i<N;i++){
  if(scanf("%s",&S)>1){
    exit(0);
  }
  //printf("aaa");
  //printf("%s",S);
  ans=0;
  for(i=0;i<N-2;i++){
    if(S[i]=='A' && S[i+1]=='B' && S[i+2]=='C'){
      ans+=1;
    }
  }
  printf("%d",ans);
  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <cstring>
#include <iomanip>

using namespace std;

int main(){
    string s;
    cin >> s;
    int n=s.size();
    if(s[n-1]=='1' || s[0]=='0'){
        cout <<-1 << endl;
        return 0;
    }
    for(int i=0;i<n-2-i; i++){
        if(s[n-2-i]!=s[i]){
            cout <<-1 << endl;
            return 0;
        }
    }
    int ind = 1;
    for(int i=0;i<n-1;i++){
        cout << ind <<" "<< i+2  <<endl;
        if(s[i]=='1'){
            ind = i+2;
        }
    }
    return 0;
}

Measured memory_bytes: 1664
#pragma region
#include <bits/stdc++.h>
using namespace std;
inline void ci(void){
  return;
}
template <typename First, typename... Rest>
void ci(First& first, Rest&... rest){
  cin >> first;
  ci(rest...);
  return;
}
inline void co(void){
  cout << "\n";
  return;
}
template <typename First, typename... Rest>
void co(First first, Rest... rest){
  cout << first << " ";
  co(rest...);
  return;
}
#define ll long long
#define ld long double
#define st string
#define dl double
#define wh while
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define tp tuple
#define ft first
#define sc second
#define ve vector
#define tos to_string
#define len length
#define rt return 0
#define br break
#define con continue
#define lcm(n, m) (n * m / gcd(n, m))
#define np next_permutation
#define repi(i, m, n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i, n) repi(i, 0, n)
#define repill(i, m, n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define repll(i, n) repill(i, 0, n)
#define revi(i, m, n) for(int i=(int)(m);i>(int)(n);i--)
#define rev(i, m) revi(i, m, 0)
#define revill(i, m, n) for(ll i=(ll)(m);i>(ll)(n);i--)
#define revll(i, n) revill(i, 0, n)
#define sz(v) ((int)(v).size()) 
#define each(i, n) for(auto&& i: n)
#define all(n) (n.begin(), n.end())
#define allr(n) (n.rbegin(), n.rend())
#define sp(n) cout << fixed << setprecision(n)
#pragma endregion
// sqrt ルート, int 2*10^9, gcd　最大公約数
// __builtin_popcount bitの個数

int main() {
  int N, L;
  ci(N, L);
  map<st, int> S;
  rep(i, N){
    st x;
    ci(x);
    S[x]++;
  }
  each(i, S){
    rep(j, i.sc){
      cout << i.ft;
    }
  }
  cout << endl;
}

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

#define next '\n'
#define sp " "
#define print(x) cout << (x)
#define println(x) cout << (x) << next
#define stop return(0)
#define rep(i, n) for(int (i) = (0); (i) < (n); (++i))
#define FOR(i, start, end) for(int (i) = (start); (i) < (end); (++i))
#define foreach(e, elem) for(auto& (e) : (elem))
#define FAST ios::sync_with_stdio(false); cin.tie(nullptr)
#define size(s) (s).size()
#define all(vec) (vec).begin(), (vec).end()
#define pb(e) push_back(e);
using ll = long long;
using ull = unsigned long long;

vector<ll> v;

int a[] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

int main() {
    FAST;

    int k;
    cin >> k;
    println(a[k - 1]);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define mp make_pair
#define pb push_back
#define pa pair<int,int>
using namespace std;
const int MAX=1e5+6;
int positions[MAX];
int main()
{
    for (int i=0;i<=MAX-1;i++)
    {
        positions[i]=-1;
    }
    int n,k;
    scanf("%d%d",&n,&k);
    int tab[n];
    for (int i=0;i<n;i++)
    {
        scanf("%d",&tab[i]);
    }

    for (int i=1;i<=k;i++)
    {
        bool t=false;
        for (int j=0;j<n;j++)
        {
            if (i-tab[j]>=0 && positions[i-tab[j]]==-1)
            {
                t=true;
                break;
            }
        }

        if (t==true)positions[i]=1;
        else positions[i]=-1;
    }


    if (positions[k]==1)
    {
        printf("First");
    }
    else printf("Second");
    return 0;
}


Measured memory_bytes: 640
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder_20190707_1
{    class Program
    {
        static void Main(string[] args)
        {
            string[] l1 = Console.ReadLine().Split(' ');
            string[] l2 = Console.ReadLine().Split(' ');

            if(l1[0] == l2[0])
            {
                Console.WriteLine(0);
            }
            else
            {
                Console.WriteLine(1);
            }
        }
    }
}

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

int main(){
	int N, M; cin >> N >> M;
	int s[N];
	fill(s, s+N, 0);
	for(int i=0; i<M; i++){
		int a; cin >> a;
		s[a] = 1;
	}
	int dp[N+1];
	for(int i=1; i<=N; i++){
		if(i==1){
			if(s[1] == 1){
				dp[i] = 0;
			}else{
				dp[i] = 1;
			}
		}else if(i==2){
			if(s[2] == 1){
				dp[i] = 0;
			}else{
				dp[i] = 1 + dp[i-1];
			}
		}else{
			if(s[i] == 1){
				dp[i] = 0;
			}else{
				dp[i] = (dp[i-2] + dp[i-1]) % mod;
			}
		}
	}
	cout << dp[N] << endl;
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
//freopen("transmitters.in","r",stdin);
//cout<<fixed<<setprecision(6)<<n<<endl;
// transform(s.begin(), s.end(), s.begin(), ::tolower);
//double PI=3.14159265359,c=0;
#define all(v) v.begin(),v.end()
#define endl '\n'
#define ll long long
//#define f(n) for(int i=;i<n;i++)
double PI = acos(-1);
using namespace std;
void fast()
{
    std::ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}
ll arr[10000000],n,k;
vector<ll>v(1e6,-1);
ll minCost(ll indx)
{
    ll path1=LLONG_MAX;
    if(indx==n-1)
        return 0;
        
    if(v[indx]!=-1)
        return v[indx];
    for(int i=0;i<k;i++)
    {
      if((indx+1+i)<n)
          path1=min(path1,(abs(arr[indx]-arr[indx+1+i])+minCost(indx+1+i)));
    }
    return v[indx]=path1;
}
int main()
{
    fast();
    cin>>n>>k;
    for(int i=0; i<n; i++)
        cin>>arr[i];

    cout<<minCost(0)<<endl;

    return 0;
}


Measured memory_bytes: 13568
<?php
  fscanf(STDIN, "%d", $n);
  $d = explode(" ",trim(fgets(STDIN)));
  $sum = array_sum($d);

  $ans = 0;
  for ($i=0; $i<$n; $i++) {
    $sum -= $d[$i];
    $ans += $sum * $d[$i];
  }
  echo $ans . "\n";
?>

Measured memory_bytes: 4732
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstring>
#include <climits>
using namespace std;
typedef long long ll;
ll INF=1LL<<60;

int main(){
    ios::sync_with_stdio(false);
	ll N,W,tmp=0,ans=0;
	cin>>N>>W;
	ll w[N],v[N],dp[110][100010];
	for(int i=0;i<110;i++){
		for(int j=0;j<100010;j++){
			dp[i][j]=INF;
		}
	}
	dp[0][0]=0;
	for(int i=0;i<N;i++) cin>>w[i]>>v[i];
	for(int i=0;i<N;i++){
		for(int j=0;j<100010;j++){
			if(j-v[i]>=0) dp[i+1][j]=min(dp[i][j-v[i]]+w[i],dp[i+1][j]);
			dp[i+1][j]=min(dp[i][j],dp[i+1][j]);
		}
	}
	for(int i=0;i<100010;i++){
		if(dp[N][i]<=W){
			tmp=i;
		}
		//cout<<dp[N][i]<<" ";
	}
	cout<<tmp;
}

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

int64_t f(int64_t a, int64_t b){
  if(a==-1){
    return 0;
  }else{
    return a/b+1;
  }
}

int main(){
  int64_t a,b,x;
  cin>>a>>b>>x;
  cout<<f(b,x)-f(a-1,x)<<endl;
}


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

#define pow5(r) (r*r*r*r*r)

int main(void) {

    int X;
    scanf("%d",&X);

    for(int i = -120;i <= 120;i++){
        for(int j = -120;j <= 120;j++){
            if((pow5(i) - pow5(j)) == X){
                printf("%d %d\n",i,j);
                return 0;
            }
        }
    }
}

Measured memory_bytes: 2156
#include <bits/stdc++.h>
using namespace std;
long long int m,n,min1;
int main()
{
	cin>>n>>m;
	min1=m/n;
	for(long long int i=min1;i>=1;i--)
	{
		if(m%i!=0) continue;
		if(m/i>=n)
		{
			cout<<i;
			return 0;
		}
	}
	return 0;
}//asdasdhklwajhsjdhjsakdkaslda
//adasldhas

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

using namespace std;

int main(void) {
    string s;
    int k;

    cin >> k >> s;
    if((int)(s.length()) <= k){
        cout << s << endl;
    }
    else{
        for(int i = 0; i < k; i++){
            cout << s.at(i);
        }
        cout << "..." << endl;
    }
    return 0;
}


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

#define vint vector<int>
#define vvint vector<vint>
#define sint stack<int>
#define qint queue<int>
#define rep(i, n) for(int i=0;i<(int)(n);i++) // 繰り返し処理
#define all(x) (x).begin(),(x).end() // 全体 こんな感じで使う→sort(all(a));
#define ct(a) cout << a << endl
#define iceil(a,b) (a+(b-1))/b //int ceil : 繰り上げの割り算 通常のceilではceil((7.0/2.0))のようにしなければならなかった。
//#define ul unsigned long
vint CinLine(int N){vint v(N);for(int i=0;i<N;i++){cin >> v.at(i);}return v;}//cin line 連続でvectorに格納
void CoutLine(vint v){for(int i=0;i<v.size()-1;i++){cout<<v.at(i)<<" ";}cout << v.at(v.size()-1)<<endl;}
// str.substr(開始位置, 取り出す長さ);

void Main(){
    int n,k;
    cin >> n >> k;
    vint p(n);
    for(int i = 0; i < n; i++){
        cin >> p[i];
    }
    sort(all(p));
    int ans = 0;
    for(int i = 0; i < k; i++){
        ans += p[i];
    }
    ct(ans);
}

int main() {
    Main();
}

Measured memory_bytes: 3632
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define all(c) begin(c),end(c)

template<typename T1, typename T2>
inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }

template<typename T1, typename T2>
inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

//改造
typedef long long int ll;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007


//ここから編集する
class Solve {
public:
    void input() {

    }

    void solve() {
        input();
        int N;
        cin >> N;
        vector<string> strs(3);
        for (int i = 0; i < 3; ++i) cin >> strs[i];

        int ans = 0;
        for (int i = 0; i < N; ++i) {
            char a = strs[0][i];
            char b = strs[1][i];
            char c = strs[2][i];
            if (a == b && b == c) {

            } else if (a == b && b != c) {
                ans++;
            } else if (a != b && b == c) {
                ans++;
            } else if (a == c && a != b) {
                ans++;
            } else {
                ans += 2;
            }
        }
        cout << ans << endl;


    }
};


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

    Solve().solve();


    return 0;
}


Measured memory_bytes: 888
#include<bits/stdc++.h>
using namespace std;
int x,y,z;
int main(){
	scanf("%d/%d/%d",&x,&y,&z);
	if (x>2019 || (x==2019 && (y>4 || (y==4 && z>30)))) puts("TBD");
	else puts("Heisei");
}

Measured memory_bytes: 256
from sys import stdin, stdout
def gc(): return map(int, stdin.readline().strip().split())
def gar(): return list(map(int, stdin.readline().strip().split()))
def gs(): return stdin.readline().strip()
n = int(stdin.readline())
ar = gar()
ans = 0
p = ar[0]
for i in range(n):
    if ar[i] <= p:
        ans += p-ar[i]
        ar[i] = p
    else:
        p = ar[i]
print(ans)

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

void main() {
	int [] a = readln().chomp().split().to!(int []);
	int res = 1;
	while(true) {
		int cnt = 0;
		int tmp = res;
		while(tmp % 100 == 0) {
			tmp /= 100;
			cnt++;
		}
		if(cnt == a[0])
			a[1]--;
		if(a[1] == 0)
			break;
		res++;
	}
	writefln("%d",res);
}


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

using namespace std;

struct Card {
	char suit;
	char value;
};

void bubbleSort(int n, struct Card A[]) {
	for (int i = 0; i < n; i++) {
		for (int j = n - 1; j >= i + 1; j--) {
			if (A[j].value < A[j - 1].value) swap(A[j], A[j - 1]);
		}
	}
}

void selectionSort(int n, struct Card A[]) {
	for (int i = 0; i < n; i++) {
		int minj = i;
		for (int j = i + 1; j < n; j++) {
			if (A[j].value < A[minj].value) minj = j;
		}
		Card t = A[i];
		A[i] = A[minj];
		A[minj] = t;
	}
}

void print(int n, struct Card A[]) {
	for (int i = 0; i < n; i++) {
		if (i != 0) cout << " " << A[i].suit << A[i].value;
		else cout << A[i].suit << A[i].value;
	}
	cout << endl;
}

bool isStable(struct Card C1[], struct Card C2[], int n) {
	for (int i = 0; i < n; i++) {
		if (C1[i].suit != C2[i].suit) return false;
	}
	return true;
}

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

	Card C1[100], C2[100];
	for (int i = 0; i < n; i++) {
		cin >> C1[i].suit >> C1[i].value;
	}

	for (int i = 0; i < n; i++) {
		C2[i] = C1[i];
	}

	bubbleSort(n, C1);
	selectionSort(n, C2);

	print(n, C1);
	cout << "Stable" << endl;
	print(n, C2);
	if (isStable(C1, C2, n)) {
		cout << "Stable" << endl;
	}
	else {
		cout << "Not stable" << endl;
	}

	return 0;

}


Measured memory_bytes: 3096
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define show(x) {for(auto i: x){cout << i << " ";} cout << endl;}
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
    int N, D;
    cin >> N >> D;
    vector<int> X[N];
    rep(i, N) {
        vector<int> A(D);
        rep(i, D) cin >> A[i];
        X[i] = A;
    }
    int ans = 0;
    for (int i = 0; i < N; i++) {
        for (int j = i+1; j < N; j++) {
            int temp = 0; // 平方数
            rep(k, D) {
                int x = X[i][k] - X[j][k];
                temp += x * x;
            }
            int y = sqrt(temp);
            if (temp == y * y) ans++;
        }        
    }
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 3572
import java.util.Scanner;

class Main {

	public static void main(String[] args) {

		int n, m, l;

		Scanner stdIn = new Scanner(System.in);

		n = stdIn.nextInt();
		m = stdIn.nextInt();
		l = stdIn.nextInt();

		int[][] matrixA = new int[n][m];
		int[][] matrixB = new int[m][l];
		long[][] matrixC = new long[n][l];

		for (int i = 0; i < n; i++) {
			for (int j = 0; j < m; j++) {
				matrixA[i][j] = stdIn.nextInt();
			}
		}

		for (int i = 0; i < m; i++) {
			for (int j = 0; j < l; j++) {
				matrixB[i][j] = stdIn.nextInt();
			}
		}

		for (int i = 0; i < n; i++) {
			for (int j = 0; j < l; j++) {
				for (int k = 0; k < m; k++) {
					matrixC[i][j] += matrixA[i][k] * matrixB[k][j];
//					System.out.println("i:" + i + " j:" + j + " k:" + k + " " + matrixA[i][k] + " * " + matrixB[k][j] + " C : " + matrixC[i][j]);
				}
			}
		}

		for (int i = 0; i < n; i++) {
			for (int j = 0; j < l; j++) {
				System.out.print(matrixC[i][j]);
				if (j < l-1) {
					System.out.print(" ");
				}
			}
			
				System.out.println();
			
		}
	}
}

Measured memory_bytes: 53604
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define REP(i, n) rep(i, 0, n)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e12;

int n, k;

signed main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	while(1){
		cin >> n >> k;
		if(n == 0 && k == 0) break;
		bool f = false;
		vector<int> a; 
		rep(i, 0, k){
			int in;
			cin >> in;
			if(in == 0) f = true;
			else a.push_back(in);
		}
		a.push_back(INF);
		sort(all(a));
		int ans = 1;		
		int l = a[0], pre = a[0], cnt = 1;
		int r = -INF, pcnt = 0;
		rep(i, 1, a.size()){
			if(pre + 1 != a[i]){
				chmax(ans, cnt);
				if(f){
					chmax(ans, cnt + 1);
					if(r != -INF && r + 2 == l){
						chmax(ans, cnt + pcnt + 1);
					}
				}
				r = pre;
				pcnt = cnt;
				l = a[i];
				cnt = 0;
			}
			cnt++;
			pre = a[i];
		}
		cout << ans << endl;
	}
}


Measured memory_bytes: 3868
l = input().split()
N = int(l[0])
M = int(l[1])
X = int(l[2])
cost1 = 0
cost2 = 0
j = 0
k = input().split()
for e in k:
    if int(e) >= X:
        j = k.index(e)
        break
    cost1 = cost1 + 1

for i in range(j, M):
    cost2 = cost2 + 1
if cost1 > cost2:
    print(cost2)
else:
    print(cost1)


Measured memory_bytes: 3060
N,K = map(int,input().split())
A = [[0 for j in range(K)]for i in range(K)]
B = [0 for j in range(N)]
S = 0
for i in range(K):
    d = int(input())
    A[i] = list(map(int,input().split()))
for i in range(K):
    for j in range(len(A[i])):
        for k in range(N):
            if A[i][j] == k+1:
                B[k] = 1
for i in range(N):
    if B[i] != 1:
        S += 1
print (S)

Measured memory_bytes: 9084
s=input()
if len(s)==2 and s[0]==s[1]:print(1,2)
else:
    for i in range(3,len(s)+1):
        a=s[i-3:i]
        if len(set(a))!=3:
            print(i-2,i)
            break
    else:print(-1,-1)

Measured memory_bytes: 3188
from sys import stdin
nii=lambda:map(int,stdin.readline().split())
lnii=lambda:list(map(int,stdin.readline().split()))
from collections import Counter

n=int(input())
a=lnii()

c=Counter(a)
a_max=max(a)

ans=0
for i in range(a_max+1):
  t_ans=c[i-1]+c[i]+c[i+1]
  ans=max(ans,t_ans)

print(ans)


Measured memory_bytes: 21108
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"sort"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func scanInt() int {
	num, _ := strconv.Atoi(scanString())
	return num
}

func scanString() string {
	sc.Scan()
	return sc.Text()
}

func scanInts(n int) []int {
	sl := make([]int, n)
	for i := range sl {
		sl[i] = scanInt()
	}
	return sl
}

func init() {
	sc.Split(bufio.ScanWords)
}

func main() {
	n, k := scanInt(), scanInt()
	h := scanInts(n)

	sort.Ints(h)
	ans := math.MaxInt32
	for i := 0; i <= n-k; i++ {
		ans = min(h[i+k-1]-h[i], ans)
	}

	fmt.Println(ans)
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

Measured memory_bytes: 4216
#include <iostream>
#include <math.h>
#include <cstdio>
using namespace std;
int main(){
	double r,ans1,ans2;
	cin >> r;
	ans1 = r * r * M_PI;
	ans2 = r * M_PI * 2;
	printf("%.5lf %.5lf\n",ans1,ans2);
return 0;
}

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

int main()
{
  string s;
  cin >> s;

  bool f[4] = {false};
  char c[4] = {'N', 'S', 'W', 'E'};

  for (int i = 0; i < s.size(); i++){
    for (int j = 0; j < 4; j++){
      if (s[i] == c[j]){
        f[j] = true;
      }
    }
  }

  if (f[0] == f[1] && f[2] == f[3]){
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
string s;
long long len;
int main()
{
	cin>>s;
	len=s.length();
	for(int i=0;i<len;i++)
	if(s[i]=='C')
	for(int j=i+1;j<len;j++)
	if(s[j]=='F')
	cout<<"Yes",exit(0);
	cout<<"No";
	return 0;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main(){
    long long h, w, k;
    cin >> h >> w >> k;
    int field[6][6];
    for(int i = 0; i < 6; i++){
        for(int j = 0; j < 6; j++){
            field[i][j] = 0;
        }
    }
    for(int i = 0; i < h; i++){
        string s;
        cin >> s;
        for(int j = 0; j < w; j++){
            if(s[j] == '#'){
                field[i][j] = 1;
            }
        }
    }
    int ans = 0;
    for(int bith = 0; bith < (1 << h); bith++){
        for(int bitw = 0; bitw < (1 << w); bitw++){
            int count = 0;
            for(int i = 0; i < h; i++){
                if(!(bith & 1<<i)){
                    for(int j = 0; j < w; j++){
                        if(!(bitw & 1<<j)){
                            count += field[i][j];
                        }
                    }
                }
            }
            if(k == count) ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

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

#define rep(i, x, n) for(int i=(x);i<(n);i++)
#define reps(i, x, n) for(int i=(x);i<=(n);i++)
#define lol long long
#define SUM(n) ((n)+1)*(n)/2 //1〜nまでの総和を求める式
#define mp make_pair
#define fi first
#define se second
#define pu push_back
#define SYOU(x) fixed<<setprecision(x+1) //小数点桁数を指定する
#define abs(x,y) max(x,y)-min(x,y)
#define all(v) v.begin(),v.end()
#define UPDigit(a,b) (a+b-1)/b //小数点切り上げ
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const int MOD=int(1e9)+7; 
using namespace std;
using pii = pair<int, int>;
typedef vector<int> vit;
//八方向を見るのに使うと便利(楽)
const int dy[] = {0, 1, 0, -1, -1, 1, 1, -1};
const int dx[] = {1, 0, -1, 0, 1, 1, -1, -1};

signed main(void){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  int d[n + 5];
  rep(i, 0, n){
    cin >> d[i];
  }
  sort(d, d + n);
  int ans = 0;
  rep(i, 1, n){
    if(d[i - 1] < d[i]){
      ans ++;
    }
  }
  cout << ans + 1 << '\n';
  return 0;
}


Measured memory_bytes: 3592
#include<bits/stdc++.h>
using namespace std;
#define ll unsigned long long
ll n,k;
ll a[2019],b[2019],c[2019];
int main(){
    scanf("%d%d",&n,&k);
    for(int i=0;i<n;i++){
        scanf("%d",a+i);
    }
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            if(a[i]>a[j])b[i]++;
        }
        for(int j=0;j<n;j++){
            if(a[i]>a[j])c[i]++;
        }
    }
    //for(int i=0;i<n;i++)printf("%d,%d\n",b[i],c[i]);
    const ll mod=1e9+7;
    k;
    ll ans=0;
    for(int i=0;i<n;i++){
        ans+=b[i]*k;
        ans%=mod;
        ll kkk=k*(k-1);
        kkk/=2;
        kkk%=mod;
        ans+=kkk*c[i];
        ans%=mod;
    }
    printf("%lld\n",ans);
    return 0;
}

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

#define N 5500 * 5500

string s;
string res[N];

int main() {
    int k;
    ios_base::sync_with_stdio(false);
    while (cin >> s >> k) {
        int cnt = 0;
        set<string> se;
        int len = (int)s.size();
        for (int i = 0; i < len; ++i) {
            //cout << i <<endl;
            string tmp = "";
            int cc = 0;
            for (int j = i; j < len && cc < 5; ++j) {
                tmp += s[j];
                //cout << tmp <<endl;
                se.insert(tmp);
                cc++;
            }
        }
        cnt = 1;
        for (set<string>::iterator it = se.begin(); it != se.end(); it++) {
            if (cnt == k) {
                cout << *it << '\n';
                break;
            }
            cnt++;
        }
    }
    return 0;
}


Measured memory_bytes: 237952
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
#[allow(unused_imports)]
use std::io::*;
#[allow(unused_imports)]
use std::iter;
#[allow(unused_imports)]
use std::mem::*;
#[allow(unused_imports)]
use std::str::*;
#[allow(unused_imports)]
use std::usize;

#[allow(unused_macros)]
macro_rules! read_cols {
    ($($t:ty),+) => {{
        let mut line = String::new();
        stdin().read_line(&mut line).unwrap();

        let mut it = line.trim()
            .split_whitespace();

        ($(
            it.next().unwrap().parse::<$t>().ok().unwrap()
        ),+)
    }}
}

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let mut line = String::new();
    stdin().read_line(&mut line).unwrap();
    line.trim().to_string().parse().ok().unwrap()
}

#[allow(dead_code)]
fn read_vec<T: FromStr>() -> Vec<T> {
    let mut line = String::new();
    stdin().read_line(&mut line).unwrap();

    line.trim()
        .split_whitespace()
        .map(|s| s.parse().ok().unwrap())
        .collect()
}

fn gcd(x: usize, y: usize) -> usize {
    let mut x = x;
    let mut y = y;
    while y != 0 {
        let t = y;
        y = x % y;
        x = t;
    }
    x
}

fn main() {
    let n = read::<usize>();
    let mut a = read_vec::<usize>();

    assert_eq!(a.len(), n);

    a.sort();

    let g = a.iter().fold(a.first().unwrap().clone(), |gg, &aa| gcd(gg, aa));

    println!("{}", g);
}


Measured memory_bytes: 6396
K, N = map(int, input().split())
A = sorted(map(int, input().split()))
assert len(A) == N


dists = []
for i,start in enumerate(A):
  # 右回り
  posR = A[(i - 1) % N] + (K if A[(i - 1) % N] < start else 0)
  #max([a + K for a in A[:i]] + A[i+1:])
  # 左回り
  posL = A[(i + 1) % N] - (K if A[(i + 1) % N] > start else 0)
  #posL = min(A[:i] + [a - K for a in A[i+1:]])
#  print(start, posL, posR)
  dists.append(min(posR - start, - posL + start))
#print(dists)
print(min(dists))

Measured memory_bytes: 101744
a,b,c,d=map(int,input().split());l="URDL";e,f=d-b,c-a;print("".join([l[i]*e+l[i+1]*(f) for i in[0,2]]+[l[(j+3)%4]+l[j]*(e+1)+l[j+1]*(f+1)+l[(j+2)%4] for j in[0,2]]))

Measured memory_bytes: 3064
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC138_A
{
    class Program
    {
        static void Main(string[] args)
        {
            var a = int.Parse(Console.ReadLine());
            var s = Console.ReadLine();
            Console.WriteLine(a >= 3200 ? s : "red");
        }
    }
}


Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define endl "\n"
const int MAX= 100005 ;
const long long mod = 1.0e9+7;
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
    #endif
    int t;
    t=1;
    while(t--)
    {
        int n,k,i,x,y,z;
        cin>>n;
        int arr[n+1],ans=1000,prev=1000;
        for(i=0;i<n;i++)
        {
            cin>>arr[i];
        }
        for(i=0;i<n;i++) {
            while(i<n && arr[i]>=arr[i+1]) {
                i++;
            }
            if(i<n) {
                x=arr[i];
                while(i<n && arr[i]<=arr[i+1]) {
                    i++;
                }
                if(i==n)
                    i--;
                y=arr[i];
                ans=y*(prev/x) + (prev%x);
                prev=ans;
            }
        }
        cout<<ans<<endl;
    }
    return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
//cout << setprecision(20) << 

int main() {
    ll a, b, c, d; cin  >> a >> b >> c >> d;
    cout << max(a*c, max(a*d, max(b*c, b*d)));
}

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

int main(){
	int n, k;
  	cin>>n>>k;
  	int p[n];
  	for(int i=0;i<n;i++){
    	cin>>p[i];
    }
  	
  	sort(p, p+n);
  	
  	long long int sum=0;
  	for(int i=0;i<k;i++){
    	sum+=p[i];
    }
  	
  	cout<<sum<<endl;
}

Measured memory_bytes: 3600
N = $stdin.readline.to_i
A = $stdin.readline.to_i
B = $stdin.readline.to_i
C = $stdin.readline.to_i
D = $stdin.readline.to_i
E = $stdin.readline.to_i

capa = [A,B,C,D,E]
minCapa = capa.min

print (N+(minCapa-1)) / minCapa + 4


Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
 
int main()
{
  double a,b,x;
  cin >> a >> b >> x;
  double y ;
  double t ;
  double PI = 3.14159265359;
  
  if(x>=a*a*b/2){
    cout << fixed << setprecision(12) << 90-atan(a*a*a/(2*(a*a*b-x)))*180.0/PI;
  }else{
    cout << fixed << setprecision(12) << atan(a*b*b/(2*x))*180.0/PI;
  }

 
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
from sys import stdin
from operator import itemgetter
from collections import deque
import math
# stdin = open("sample.txt")

K = int(stdin.readline().rstrip())
a = deque(range(1,10))
ans_list = deque()
attack = 100000
while attack > 0:
    ans = a.popleft()
    ue = ans*10
    shimo = ans%10
    ans_list.append(ans)
    if shimo == 0:
        a.append(ue)
        a.append(ue+1)
    elif shimo == 9:
        a.append(ue+shimo-1)
        a.append(ue+shimo)
    else:
        a.append(ue+shimo-1)
        a.append(ue+shimo)
        a.append(ue+shimo+1)
    attack -= 1

print(ans_list[K-1])

Measured memory_bytes: 16240
import qualified Data.Vector.Unboxed as U
import qualified Data.Vector as V
import qualified Data.ByteString.Char8 as C
import Debug.Trace
import Data.List
import Control.Monad
import Control.Arrow
import Data.Ord
import qualified Data.IntSet as IS


r :: Int -> IO (U.Vector Int)
r n = U.unfoldrN n (C.readInt . C.dropWhile (==' ')) <$> C.getLine

r' :: IO [Int]
r'  =   unfoldr    (C.readInt . C.dropWhile (==' ')) <$> C.getLine



main :: IO ()
main = do
    k <- readLn
    s <- getLine
    putStr $ take k s
    putStrLn $ if length s > k then "..." else ""

Measured memory_bytes: 3888
#include <bits/stdc++.h>
#define pb push_back
#define ss second
#define ff first
#define all(x) x.begin(), x.end()
#define INF 3000000000000001 // 3e15
#define ll_max 9000000000000000000
#define PI 3.14159265358979323846L
#define fill(a, n, x) for(int i = 0; i < n; i++) a[i] = x;
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define db(args...) {string _ss = #args; replace(_ss.begin(), _ss.end(), ',' , ' '); stringstream ___s(_ss) ; debug(___s, args);}
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> pll;
ll mod = 1000000007;
const ll N = 1000001;
const ll M = 1;

struct point
{
    ll x, y;
};

void debug(stringstream &s) {}
template <typename T, typename... Args>
void debug(stringstream &s, T a, Args... args)
{
    string word;
    s >> word;
    cerr << word << " = " << a << endl;
    debug(s, args...);
}

ll fast_exp(ll x,ll n)
{
    if(n == 0) return 1;
    ll ans = 1;
    if( n % 2 == 0)
    {
         ans = fast_exp(x, n / 2);
         ans = ans * ans % mod;
    }
    else ans = fast_exp(x, n - 1) * x % mod;
    return ans;
}

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

vector<ll> p;
void SoE(ll n)
{
    bool Primes[n + 1];
    Primes[0] = Primes[1] = 0;
    for(ll i = 2; i < n + 1; i++)
        Primes[i] = 1;
    for(ll i = 2; i * i <= n; i++)
    {
       if(Primes[i] == 1)
       {
           for(ll j = i; i * j <= n; j++)
           {
               Primes[i * j] = 0;
           }
       }
    }
    for(ll i = 2; i < n + 1; i++)
    {
        if(Primes[i])
        {
            p.push_back(i);
        }
    }
}

int main()
{
    fast;
    int _ = 1;
    //cin >> _;
    int test = 0;
    while(_--)
    {
        test++;
        ll n, m, x, y, ans = INF, k;
        cin >> n;
        if(n < 2)
        {
            cout << "0\n";
            continue;
        }
        ans = (fast_exp(10, n) - 2 * fast_exp(9, n) % mod + mod) % mod;
        ans = ans % mod;
        ans = (ans + fast_exp(8, n)) % mod;
        ans = ans % mod;
        cout << ans << "\n";
    }
    return 0;
}


Measured memory_bytes: 3652
#include <iostream>

int main(){
	int h, w;
	while(1){
		std::cin >> h >> w;
		if(!h && !w)
			break;
		for(int j = 0; j < h; j++){
			for(int i = 0; i < w; i++){
				std::cout << '#';
			}
			std::cout << std::endl;
		}
		std::cout << std::endl;
	}
	return 0;
}

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

const int MAXN = 1e2 + 7;
const int MAXM = 5e3 + 7;

int n, m, fa[MAXN];
vector<int> to[MAXN];
vector< pair<int, int> > ans;
bool G[MAXN][MAXN], vis[MAXN];

void add(int u, int v) {to[u].push_back(v), to[v].push_back(u);}
int Root(int x) {return x == fa[x] ? x : fa[x] = Root(fa[x]);}
bool unite(int u, int v) {
    u = Root(u), v = Root(v);
    if(u == v) return false;
    fa[v] = u;
    return true;
}

bool dfs(int u) {
    vis[u] = 1;
    int res = 1, v, len = to[u].size();
    for(int i = 0;i < len;i++) {
        v = to[u][i];
        if(vis[v]) continue;
        int tmp = dfs(v);
        if(!tmp) ans.push_back(make_pair(u, v));
        res ^= tmp;
    }
    return res;
}

int main() {
    cin >> n >> m;
    int st, en;
    for(int i = 1;i <= n;i++) {
        for(int j = 1;j <= n;j++) G[i][j] = 1;
        G[i][i] = 0;
    }
    for(int i = 1;i <= m;i++) {
        cin >> st >> en;
        G[st][en] = G[en][st] = 0;
    }
    if(n % 2) {
        for(int i = 1;i <= n;i++) {
            for(int j = 1;j <= i;j++) {
                if(G[i][j]) ans.push_back(make_pair(j ,i));
            }
        }
    }
    else {
        int root = -1;
        for(int i = 1;i <= n;i++) {
            int num = 0;
            for(int j = 1;j <= n;j++) {
                num += G[i][j];
            }
            if(num == n-1) {root = i; break;}
        }
        for(int i = 1;i <= n;i++) fa[i] = i;
        if(root != -1) {
            bool flag = false;
            for(int i = 1;i <= n;i++) {
                for(int j = 1;j <= i;j++) {
                    if(flag || !G[i][j] || i == root || j == root) continue;
                    unite(i, j), add(i, j);
                    G[i][j] = G[j][i] = 0;
                    flag = true;
                }
            }
            if(!flag) {cout << "-1" << endl; return 0;}
            for(int i = 1;i <= n;i++) {
                if(root == i) continue;
                int j = root;
                if(G[i][j]) {
                    if(unite(i, j)) add(i, j);
                    else ans.push_back(make_pair(j, i));
                    G[i][j] = G[j][i] = 0;
                }
            }
        }
        for(int i = 1;i <= n;i++) {
            for(int j = 1;j <= i;j++) {
                if(!G[i][j]) continue;
                if(unite(i, j)) add(i, j);
                else ans.push_back(make_pair(j, i));
            }
        }
        memset(vis, 0, sizeof(vis));
        for(int i = 1;i <= n;i++) {
            if(vis[i]) continue;
            if(dfs(i)) {cout << "-1" << endl; return 0;}
        }
    }
    cout << ans.size() << endl;
    for(int i = 0;i < ans.size();i++) {
        st = ans[i].first, en = ans[i].second;
        if(st > en) swap(st, en);
        cout << st << " " << en << endl;
    }
    return 0;
}


Measured memory_bytes: 3240
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define EACH(i, c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s, e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

//#define LOCAL 0
//#ifdef LOCAL
//#define DEBUG(s) cout << (s) << endl
//#define dump(x)  cerr << #x << " = " << (x) << endl
//#define BR cout << endl;
//#else
//#define DEBUG(s) do{}while(0)
//#define dump(x) do{}while(0)
//#define BR
//#endif


//改造
typedef long long int ll;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007
//ここから編集する


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

    int N;
    cin >> N;
    vector<vector<char> > vvc(2 * N - 1, vector<char>(2 * N - 1));
    rep(i, 0, N) {
        rep(j, 0, N) {
            cin >> vvc[i][j];
            if(j != N-1){
                vvc[i][j + N] = vvc[i][j];
            }
        }
    }
    auto check = [&](int bi, int bj){
        rep(i,0,N){
            rep(j,0,N){
                if(vvc[bi + i][bj + j] != vvc[bi + j][bj + i]){
                    return false;
                }
            }
        }
        return true;
    };

    int ans = 0;
    for(int i = 0; i < N; i++){
        if(check(0,i)){
            ans += N;
        }
    }
    cout << ans << endl;


    return 0;
}


Measured memory_bytes: 888
#include<bits/stdc++.h>
#define ll long long
#define ff first
#define ss second
#define pb push_back
using namespace std;

const int N = 1e6 + 69;

int n,y,m;

string s,t,u;

double A[N],x;

int main(){

    cin>>n>>m;
    for(int i=1;i<=n;i++){
          cin>>x;
          A[i] = (x*(x+1)/2)/x + A[i-1];
    }
    x = 0;
    for(int i=0;i+m<=n;i++){
        x = max(x,A[i+m]-A[i]);
    }

    cout<<setprecision(10)<<x<<endl;
}


Measured memory_bytes: 1792
#include<iostream>
using namespace std;
int main(void)
{   
	int n;
	int min=1000000,max=-1000000;
	long long sum=0;
	cin>>n;
	for(int i=0;i<n;i++){
		int a;
		cin>>a;
		if(max<a){
			max=a;
		}
		sum+=a;
		if(min>a){
			min=a;
		}
	}
	cout<<min<<" "<<max<<" "<<sum<<endl; 
	return 0;
}

Measured memory_bytes: 1168
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <iomanip>
using namespace std;
#define INF 1e9
#define PI acos(-1)
typedef long long ll;
typedef pair<int, int> p_ii;


int main() {
	
	ll i, n, m; cin >> n >> m;
	vector<ll> a(n), sum(n+1, 0);
	for (i = 0; i < n; i++)cin >> a[i];
	ll ans = 0;
	for (i = 1; i <= n; i++)sum[i] = (sum[i - 1] + a[i - 1]) % m;
	map<ll, ll>cnt;
	for (i = 0; i <= n; i++) cnt[sum[i]]++;
	for (auto itr = cnt.begin(); itr != cnt.end(); itr++) {
		ll c = (itr->second);
		ans += c * (c - 1) / 2;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 5760
package main

import (
	"fmt"
)

func main() {
	var a int
	var b int
	var k int

	fmt.Scan(&a)
	fmt.Scan(&b)
	fmt.Scan(&k)

	i := a
	if a < b {
		i = b
	}
	num := 0
	count := 0
	for {
		if a%i == 0 && b%i == 0 {
			count++
			if count == k {
				num = i
				break
			}
		}
		i--
	}

	fmt.Println(num)
}


Measured memory_bytes: 512