akhauriyash/Code-Regression huggingface dataset:
#if __has_include("debug.h")
    #include "debug.h"
#else  
#include <bits/stdc++.h>
using namespace std;
#define d(...) 2;
#endif

#define int long long int

#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl "\n"      

#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define ff first
#define ss second
#define eps 1e-10

#define gcd(a,b)            __gcd((a),(b))
#define lcm(a,b)            ((a*b)/gcd(a,b))

void solve();

unordered_map<int, int>mp;


const int N=1e5+10;
vector<int>visited(1e6,0);

int sieve()
{
	int cnt=0;

	for(int i=1;i<=1000000;i++)
	{
		if(!mp[i]||visited[i])
		{
			continue;
		}
		if(mp[i]==1&&!visited[i])
		{
			cnt++;
		}
		for(int j=i;j<=1000000;j+=i)
			{
				visited[j]=1;
			}
	}
	return cnt;
}

int32_t main()
{
    #ifdef DEBUG
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
    #endif 

    fast
    
    int t = 1;
	// cin>>t;
	
	while(t--)
	    solve();
	return 0;  
}

void solve()
{
	int i,j;
	int n;
	cin>>n;

	vector<int>a(n);

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

	cout<<sieve()<<endl;
}

Measured memory_bytes: 51928
#include <stdio.h>

#define MAXLENGTH 1000 //配列の最大の長さ

main() {
  
  int i,j, v, p;
  int N; //配列の長さ
  int A[MAXLENGTH]; //配列
  
  scanf(" %d", &N);
  
  for( i=0; i<N; i++) {
    scanf(" %d", &A[i]);
  }
  
  for( i=1; i<N; i++) {

    printf("%d", A[0]);
    for( p=1; p<N; p++) {
      printf(" %d", A[p]);
    }
    printf("\n");

    v = A[i];
    j = i-1;
    while( j>=0 && A[j]>v) {
      A[j+1] = A[j];
      j--;
    }
    A[j+1] = v;

  }

  printf("%d", A[0]);
  for( p=1; p<N; p++) {
    printf(" %d", A[p]);
  }
  printf("\n");
  
  return 0;
}

Measured memory_bytes: 604
N_nin, M_ko = map(int, input().split())
like = []

for i in range(N_nin):
    tmp = list(map(int, input().split()))
    like.append(tmp[1:])

all_like = set(like[0])

for i in range(N_nin):
    all_like = (all_like & set(like[i])) 

print(len(all_like))

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<(n); ++i)
#define REP(i, d, n) for(int i=(d); i<(n); ++i)
#define all(v) v.begin(), v.end()
using ll = long long;
using P = pair<int, int>;
const int mod = 1e9 + 7;
const int INF = 1 << 30;

struct mint {
  ll x;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

class Prime{
    int n;
    vector<int> factor, primes;    
public:
    Prime(int n=1) : n(n), factor(n+1){
        factor[0] = factor[1] = -1;
        for(ll i=2; i <= n; ++i){
            if(factor[i]) continue;
            primes.push_back(i);
            factor[i] = i;
            for(ll j = i*i; j <= n; j += i){
                if(!factor[j]) factor[j] = i;
            }
        }
    }

    bool is_prime(int x){
        return factor[x] == x;
    }

    vector<int> factorList(int x){
        vector<int> res;
        while(x != 1){
            res.push_back(factor[x]);
            x /= factor[x];
        }
        return res;
    }

    vector<P> factorize(int x){ //P <prime, num>
        vector<int> fl = factorList(x);
        if(fl.size() == 0){
            return {};
        }
        vector<P> res(1, P(fl[0], 0));
        for (int e : fl) {
            if (res.back().first == e) {
                res.back().second++;
            }
            else {
                res.emplace_back(e, 1);
            }
        }
        return res;
    }
};


int main() {

    Prime p(1000000);
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];

    map<int, int> mp;
    rep(i, n){
        auto f = p.factorize(a[i]);
        for(auto e : f){
            mp[e.first] = max(mp[e.first], e.second);
        }
    }

    mint lcm = 1;
    for(auto e : mp){
        rep(i, e.second){
            lcm *= e.first;
        }
    }

    mint ans;
    rep(i, n){
        mint b = lcm / a[i];
        ans += b;
    }
    cout << ans.x << endl;

    return 0;
}

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

int main(){
  int w[10],k[10];
  for(int i=0;i<10;i++)cin>>w[i];
  for(int i=0;i<10;i++)cin>>k[i];

  sort(w,w+10);
  sort(k,k+10);
  cout<<w[9]+w[8]+w[7]<<" "<<k[9]+k[8]+k[7]<<endl;

  return 0;
}

Measured memory_bytes: 1180
S = list(input())
N = len(S)
N2 = (N-1)//2
N3 = (N+3)//2
ans = 0
Sr = S[::-1]

if(S == Sr):
    ans = 1
    S2 = S[0:N2]
    S2r = S2[::-1]
    if(S2 == S2r):
        S3 = S[(N+3)//2-1:N]
        S3r = S3[::-1]
        if(S3 != S3r):
            ans = 0
    else :
        ans = 0
            
if(ans == 1):
    print('Yes')
else:
    print('No')

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

int main(){
  int n;
  int m;
  cin>>n;
  vector<string> users(n);
  bool flag=false;
  for(int i=0;i<n;i++)
    cin>>users[i];

  cin>>m;
  for(int i=0;i<m;i++){
    string str;
    cin>>str;
    vector<string>::iterator it;
    if((it=find(users.begin(),users.end(),str))!=users.end()){
      if(flag){
	cout<<"Closed by "<<*it<<endl;
	flag=false;
      }else{
	cout<<"Opened by "<<*it<<endl;
	flag=true;
      }
    }else{
      cout<<"Unknown "<<str<<endl;
    }
  }

  return 0;
}

Measured memory_bytes: 1224
import java.io.*;
public class Main {
    public static void main(String[] args) {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        try {
            String line = reader.readLine();
            int n = Integer.parseInt(line);
            if (0 <= n && n < 86400) {
                int h = n / (60 * 60);
                int x = n % (60 * 60);
                int m = x / 60;
                int s = x % 60;
                System.out.println(h + ":" + m + ":" + s);
            } else {
                System.out.println("error!");
            }
        } catch (IOException e) {
            System.out.println(e);
        } catch (NumberFormatException e) {
            System.out.println("??°????????¢????????£????????????????????????");
        }
    }
}

Measured memory_bytes: 24352
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int, int>;




int main() {
    ios_base::sync_with_stdio(false);
    int n;
    cin >> n;
    string s;
    cin >> s;
    vector<int> cnt(26, 0);
    for (int i = 0; i < n; ++i) {
        ++cnt[s[i] - 'a'];
    }
    const ll mod = 1000000007;
    ll dp = 1;
    for (int i = 0; i < 26; ++i) {
        dp = (dp * (ll)(cnt[i] + 1)) % mod;
    }
    dp += mod - 1;
    dp %= mod;
    cout << dp << endl;
}

Measured memory_bytes: 512
#include <iostream>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <limits>
#include <algorithm>
#include <functional>

using namespace std;

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

	string c[3];
	
	cin >> c[0];
	cin >> c[1];
	cin >> c[2];

	cout << c[0][0] << c[1][1] << c[2][2];

	return 0;
}

Measured memory_bytes: 3596
//OPTIMIZATONS
#pragma GCC optimize("02")
//CODE
#include<bits/stdc++.h>
#define int long long
#define float double
#define endl "\n"
#define debug cout<<"Good uptill here"<<endl<<flush;
#define deb(x) cout<<#x<<":"<<x<<endl<<flush;

using namespace std;

int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	//CODE FOR SPECIFIED INPUT AND OUTPUT
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int n;
	cin>>n;
	int lim = 125;
	for(int j=-lim;j<lim;j++){
		for(int k=-lim;k<lim;k++){
			if((pow(j,5)-pow(k,5)==n)){
				cout<<j<<" "<<k<<endl;
				return 0;
			}
		}
	}
	return 0;
}



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

int main(){
    int D;
    cin>>D;
    if(D==25)cout<<"Christmas"<<endl;
    else if(D==24)cout<<"Christmas Eve"<<endl;
    else if(D==23)cout<<"Christmas Eve Eve"<<endl;
    else cout<<"Christmas Eve Eve Eve"<<endl;
    return 0;
}


Measured memory_bytes: 256
n = int(input())
sp = [input().split() for _ in range(n)]
ans = []
for i in range(len(sp)):
    ans.append([i, sp[i][0], int(sp[i][1])])
ans = sorted(ans, key=lambda x: (x[1], -x[2]))
for i in range(len(ans)):
    print(ans[i][0] + 1)


Measured memory_bytes: 3060
s = input()

left, right = [0],[0]
tmp=0
for itr,eq in enumerate(s):
    if eq == "<":
        tmp+=1
    else:
        tmp = 0
    left.append(tmp)
tmp = 0
for itr in range(len(s)):
    if s[len(s)-itr -1] == ">":
        tmp+=1
    else:
        tmp =0
    right.append(tmp)
right.reverse()

ans = 0
for i in range(len(s) +1) :
    ans +=max(right[i], left[i])

print(ans)


Measured memory_bytes: 27944
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <map>
#include <numeric>
#include <stack>
#include <string>
#include <vector>
#define _GLIBCXX_DEBUG
using namespace std;
using ll = long long;
 
int main()
{
    int n,m;
    cin >> n >> m;
    int max = 0,min = 1e9;
    vector<vector<int>> G(m,vector<int>(2));
    for (int i = 0; i < m; i++)
    {
        for (int j = 0; j < 2; j++)
        {
            cin >> G[i][j];
        }
        if (max < G[i][0])
        {
            max = G[i][0];
        }
        if (min > G[i][1])
        {
            min = G[i][1];
        }
    }
    if (max > min)
    {
        cout << "0" << endl;
    }else{
        cout << min-max+1 << endl;
    }
}

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

typedef pair<long long int, int> P;
int n, m;
priority_queue<P, vector<P>, greater<P>> que;
int main()
{
    cin >> n >> m;
    for (int i = 0; i < n; i++)
    {
        long long int x;
        int y;
        cin >> x >> y;
        que.push(P(x, y));
    }
    long long int ans = 0;
    while (m >= 0)
    {
        P p = que.top();
        que.pop();
        if (p.second > m)
        {
            ans += p.first * m;
            break;
        }
        else
        {
            ans += p.first * p.second;
            m -= p.second;
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 2420
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=1;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define maxs(a, b) a = max(a, b)
#define mins(a, b) a = min(a, b)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll linf = (1LL << 61);
const int inf = 1001001001;
const int mod = 1000000007;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, k;
	cin >> n >> k;
	vector<int> v(n);
	rep(i, n) cin >> v[i];
	int r = min(n, k);
	int ans = 0;
	rep(a, r + 1)rep(b, r + 1) {
		if (a + b > r) continue;
		int tmp = 0;
		priority_queue<int, vector<int>, greater<int>> pq;
		rep(i, a) {
			tmp += v[i];
			if (v[i] < 0) pq.push(v[i]);
		}
		rrep(i, b + 1) {
			tmp += v[n - i];
			if (v[n - i] < 0) pq.push(v[n - i]);
		}
		rep(i, k - (a + b)) {
			if (pq.empty()) break;
			tmp -= pq.top();
			pq.pop();
		}
		maxs(ans, tmp);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
import sys
from collections import deque
def input():return sys.stdin.readline().strip()

def main():
    H, W = map(int, input().split())

    field = "#" * (W+2)
    field += "#" + "##".join([input() for _ in range(H)]) + "#"
    field += "#" * (W+2)

    move = [-1, 1, -(W+2), W+2]
    cost = [-1] * (H+2) * (W+2)

    def dfs(s):
        q = deque()
        enqueue = q.append
        dequeue = q.popleft

        for v in s:
            cost[v] = 0
            enqueue(v)

        while q:
            now = dequeue()
            for dx in move:
                nv = now + dx
                if field[nv] == "." and cost[nv] < 0:
                    cost[nv] = cost[now] + 1
                    enqueue(nv)
    
    starts = []
    for i in range(1, H+1):
        for j in range(1, W+1):
            now = i*(W+2) + j
            if field[now] == "#":
                starts.append(now)
    dfs(starts)

    print(max(cost))

if __name__ == "__main__":
    main()

Measured memory_bytes: 111288
import java.io.*;
import java.util.*;

public class Main {

	final static long MOD = 1000000007;
	public static String[] Ws = null;
	public static int wsIndx = 0;
	public static BufferedReader in = null;
	public static void main(String[] args) throws Exception {

		int N = nextInt();
		int[] P =nextInts();
		int[] Q =nextInts();

		ArrayList<String> list = new ArrayList<>();
		String s = "";
		for(int i=1;i<=N;i++){
			s+=String.valueOf(i);
		}
		C(s,"",list);
		String p="";
		for(int i=0;i<N;i++){
			p+=String.valueOf(P[i]);
		}
		String q="";
		for(int i=0;i<N;i++){
			q+=String.valueOf(Q[i]);
		}

		int pi=0,qi=0;
		String x;
		for(int i=0;i<list.size();i++){
			x=list.get(i);
			if(x.equals(p)){
				pi=i+1;
			}
			if(x.equals(q)){
				qi=i+1;
			}
		}
		System.out.println(Math.abs(pi-qi));
	}

	public static void C(String remain,String ans,ArrayList<String> list){
		if(remain.length()==0){
			list.add(ans);
		}
		for(int i=0;i<remain.length();i++){
			C(remain.substring(0,i)+remain.substring(i+1,remain.length()),ans+remain.substring(i,i+1),list);
		}
	}


	public static boolean isExpN(long a,int base){
		int x=1;
		while((int)Math.pow(x, 2) <= a){
			if((int)Math.pow(x, 2) == a){
				return true;
			}
			x*=base;
		}
		return false;
	}
	public static void check() throws Exception{
		if(in == null){
			in = new BufferedReader(new InputStreamReader(System.in));
		}
		if(Ws==null || Ws.length<=wsIndx){
			Ws = in.readLine().split(" ");
			wsIndx=0;
		}
	}
	public static int nextInt()throws Exception{
		check();
		return Integer.parseInt(Ws[wsIndx++]);
	}

	public static long nextLong()throws Exception{
		check();
		return Long.parseLong(Ws[wsIndx++]);
	}

	public static String nextString()throws Exception{
		check();
		return Ws[wsIndx++];
	}

	public static int[] nextInts()throws Exception{
		check();
		int[] tmp = new int[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Integer.parseInt(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static long[] nextLongs()throws Exception{
		check();
		long[] tmp = new long[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Long.parseLong(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static String[] nextStrings()throws Exception{
		check();
		wsIndx=Ws.length;
		return Ws;
	}


}


Measured memory_bytes: 47448
#include <cstring>
#include <cassert>
#include <utility>
#include <iostream>
#include <cstdio>
#include <iomanip>
#include <bitset>
#include <chrono>
#include <cstdlib>
#include <functional>
#include <tuple>
#include <climits>
#include <limits>
#include <deque>
#include <list>
#include <array>
#include <stack>
#include <queue>
#include <random>
#include <complex>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
 
#define init ios::sync_with_stdio(0); cin.tie(NULL);cout.tie(NULL);
#define setpr(x) cout << setprecision((x))
#define PI atan(1)*4
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define mk(a , b) { min((a) , (b)) , max((a) , (b)) }
#define flush cout.flush()
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define endc "\n"
#define MOD 1000000007
#define meme(x) memset((x), 0, sizeof((x)))
#define memo(x) memset((x),-1, sizeof((x)))
 
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pld;

// #define int ll

ll egcd(ll a, ll b, ll &x, ll &y){
    if (a == 0LL){  
        x = 0LL;  
        y = 1LL;  
        return b;  
    }
    ll xx, yy;
    ll val = egcd(b % a, a, xx, yy);  
    x = yy - (b / a) * xx;  
    y = xx;  
    return val;
}

ll gcd(ll a, ll b){
    while(true){
        if(a>b)
            swap(a,b);
        if (a == 0) 
            return b; 
        ll p = b % a  , q = a;
        a = p;
        b = q;
    }
}
 
ll powerMod(ll x,ll y){
    ll res = 1;
    x %= MOD;
    while(y > 0){
        if(y & 1)res = (res*x)%MOD;
        y = y >> 1;
        x = (x * x)%MOD;
    }
    return res%MOD;
}

//  ==========     //\\       //||     ||====//||
//      ||        //  \\        ||     ||   // ||
//      ||       //====\\       ||     ||  //  ||
//      ||      //      \\      ||     || //   ||
//  ========== //        \\  ========  ||//====|| 
//  code

bool cmp1(pll p1, pll p2){
    return p1.first + p1.second < p2.first + p2.second;
}

bool cmp2(pll p1, pll p2){
    return p1.first - p1.second < p2.first - p2.second;
}

void solve(){
    ll n,i,j,k,l,p;
    cin >> n;
    vector<pll> points(n);
    for(auto &i : points){
        cin >> i.fi >> i.se;
    }
    sort(all(points), cmp1);
    p = points[n - 1].first - points[0].first + points[n - 1].second - points[0].second;

    sort(all(points), cmp2);
    p = max(p, points[n - 1].first - points[0].first - points[n - 1].second + points[0].second);
    cout << p << endc;
}

int32_t main(){
    init;
    int t = 1;
    // cin >> t;
    while(t--){
        solve();
    }
    return 0;
}


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

int main()
{
	int n;
	cin>>n;
	int p=n%10;
	
	if(p==2||p==4||p==5||p==7||p==9) 
		cout<<"hon";
	else if(p==0||p==1||p==6||p==8)
		cout<<"pon";
	else
		cout<<"bon";
	return 0;
}

Measured memory_bytes: 3640
#include"bits/stdc++.h"

using namespace std;
typedef long long ll;
const ll mx = 10000007;
const ll MOD = 1e9 + 7;
#define gcd(a, b) __gcd((a), (b))
#define lcm(a, b) ((a) / __gcd((a), (b)) * (b))

int main() {
    ll n, x;
    cin >> n;
    map<ll, ll>m;

    for (ll i = 0; i < n; i++) {
        cin >> x;
        m[x]++;
    }

    vector<ll>v;

    for (auto i = m.begin(); i != m.end(); i++) {
        if(i->second >= 2) {
            i->second /= 2;
            while (i->second) {
                v.push_back(i->first);
                i->second--;
            }
        }
    }


    sort(v.begin(), v.end(), greater <ll>());
    if (v.size() < 2) {
        puts("0");
        return 0;
    }

   ll ans = v[0] * v[1];
   
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 6528
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <tuple>

using namespace std;
typedef long long ll;
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
const int INF = 1<<29;
const ll LNF = 1LL<<60;

ll dp[110][100010];
ll w[110];
ll v[110];
int main(){
    int N; ll W; cin >> N >> W;
    for(int i=0;i<N;i++){
        cin >> w[i] >> v[i];
    }
    for(int i=0;i<N;i++){
        for(int j=0;j<=W;j++){
            if(j-w[i]>=0){ //まだ入る
                dp[i+1][j] = max(dp[i][j-w[i]]+v[i],dp[i+1][j]);
            }
            dp[i+1][j] = max(dp[i+1][j],dp[i][j]);
        }
    }
    cout << dp[N][W] << endl;
    return 0;
}


Measured memory_bytes: 79360
module Main where

import Control.Applicative
import Numeric

main :: IO ()
main = loop

loop :: IO ()
loop = do
  { [h, w] <- getInts
  ; if h == 0 && w == 0 then done
    else do
      {putStrLn $ unlines $ frame h w
      ;loop
      }
  }

tedge :: Int -> String
tedge n = replicate n '#'

mbody :: Int -> String
mbody n = case n of
          0 -> ""
          1 -> "#"
          _ -> "#" ++ replicate (n-2) '.' ++ "#"

frame :: Int -> Int -> [String]
frame h w = case h of
          0 -> []
          1 -> [tedge w]
          _ -> [tedge w] ++ replicate (h-2) (mbody w) ++ [tedge w]
      
--

getInts :: IO [Int]
getInts = map read . words <$> getLine

putInts :: [Int] -> IO ()
putInts = putStrLn . unwords . map show

getDoubles :: IO [Double]
getDoubles = map read . words  <$> getLine

putDoubles :: [Double] -> IO ()
putDoubles = putStrLn . unwords . map showDouble

showDouble :: Double -> String
showDouble d = showFFloat Nothing d ""

done :: IO ()
done = return ()



Measured memory_bytes: 4236
t=input()
s=input()
a=int(t)
if a%2==1:
  print('No')
else:
  b=a//2
  j=b
  c=0
  for i in range(b):
    if s[i]==s[j]:
      c+=1
      j+=1
      continue
    else:
      break
  if c==b:
    print('Yes')
  else:
    print('No')

Measured memory_bytes: 3188
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(void){
int a,b,k,count;
int count2=0;
scanf("%d %d %d",&a,&b,&k);
for(count=100;;count--){
    if(a%count==0&&b%count==0){count2++;}
    if(count2==k){printf("%d",count);return 0;}
}

}


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

using namespace std;

int main()
{
  int N, C[500], S[500], F[500];

  cin >> N;
  for(int i = 0; i < N - 1; i++) {
    cin >> C[i] >> S[i] >> F[i];
  }
  for(int i = 0; i < N; i++) {
    int t = 0;
    for(int j = i; j < N - 1; j++) {
      t = max(t, S[j]);
      t = (t + F[j] - 1) / F[j] * F[j] + C[j];
    }
    cout << t << endl;
  }
}

Measured memory_bytes: 256
program a
    integer N
    character(10**4)::S
    read*,N
    read*,S
    do i=1,len_trim(S)
        S(i:i)=char(ichar("A")+mod(ichar(S(i:i))-ichar("A")+N,ichar("Z")-ichar("A")+1))
    end do
    print"(A)",trim(S)
end program a

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

template <class T>
class cumulativeSum
{
    int n;
    vector<T> sum;
public:
    cumulativeSum(const vector<T>& a)
    {
        n = a.size();
        sum.assign(n+1, 0);
        for(int i=0; i<n; ++i)
            sum[i+1] = a[i] + sum[i];
    }
    T getSum(int x1, int x2)
    {
        if(x1 > x2)
            return 0;
        x1 = max(x1, 0);
        x2 = min(x2, n-1);
        return sum[x2+1] - sum[x1];
    }
};

const int MAX = 300000;

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

    vector<int> a(n);
    vector<int> b(MAX+1, 0);
    for(int i=0; i<n; ++i){
        cin >> a[i];
        ++ b[a[i]];
    }
    cumulativeSum<int> cs(b);

    vector<int> ret(500, 0);
    for(int i=1; i<500; ++i){
        for(int j=0; j<n; ++j){
            ret[i] = max(ret[i], a[j] % i);
        }
    }

    while(--t >= 0){
        int q;
        cin >> q;

        if(q < 500){
            cout << ret[q] << endl;
            continue;
        }

        int left = 0;
        int right = q-1;
        while(left < right){
            int mid = (left + right + 1) / 2;
            bool ok = false;
            
            int x = mid;
            int y = q-1;
            while(x <= MAX){
                if(cs.getSum(x, y) > 0){
                    ok = true;
                    break;
                }
                x += q;
                y += q;
            }

            if(ok)
                left = mid;
            else
                right = mid - 1;
        }

        cout << left << endl;
    }
}

Measured memory_bytes: 4700
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
struct edge
{
	int v,nxt;
}e[500005];
int n,k,h[100005],t,f[2005][2005],tmp[2005];
void add(int u,int v)
{
	e[++t].v=v;
	e[t].nxt=h[u];
	h[u]=t;
}
void dfs(int u,int fa)
{
	for(int i=h[u];i;i=e[i].nxt)
	{
		int v=e[i].v;
		if(v==fa) continue;
		dfs(v,u);
	}
	memset(tmp,0,sizeof(tmp));
	for(int i=h[u];i;i=e[i].nxt)
	{
		int v=e[i].v;
		if(v==fa) continue;
		for(int j=0;j<k;j++)
		{
			tmp[j+1]+=f[v][j];
			if(j==k-1) f[u][j+1]=max(f[u][j+1],f[v][j]);
			else if(2*(j+1)>k) f[u][j+1]=max(f[u][j+1],f[v][j]-f[v][k-j-2]);
		}
	}
	for(int j=0;j<=k;j++)
	{
		if(2*j<=k) f[u][j]=tmp[j]+1;
		else f[u][j]=f[u][j]+tmp[k-j]+1;
	}
	for(int j=1;j<=k;j++)
		f[u][j]=max(f[u][j],f[u][j-1]);
}
int main()
{
	scanf("%d%d",&n,&k);
	for(int i=1;i<n;i++)
	{
		int u,v;
		scanf("%d%d",&u,&v);
		add(u,v);
		add(v,u);
	}
	dfs(1,0);
	int ans=0;
	for(int i=1;i<=n;i++)
		ans=max(ans,f[i][k]);
	printf("%d",n-ans);
	return 0;
}

Measured memory_bytes: 17588
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define pb push_back
const int maxn=2e5+10;
const int mod=998244353;
int a[3005][3005];
ll dp[3005][3005][5];


int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int r,c,k;
    cin>>r>>c>>k;
    while(k--)
    {
        int x,y,z;
        cin>>x>>y>>z;
        a[x][y]=z;
    }
    ll ans=0;
    for(int i=1;i<=r;i++)
    {
        dp[i][1][0]=dp[i-1][1][1];
        dp[i][1][1]=dp[i-1][1][1]+a[i][1];
        dp[i][1][2]=dp[i][1][1];
        ans=max(ans,dp[i][1][1]);
    }
    /*for(int i=1;i<=c;i++)
    {
        for(int x=1;x<=3;x++)
        {
            dp[1][i][x]=max(dp[1][i-1][x],dp[1][i-1][x-1]+a[1][i]);
            ans=max(ans,dp[1][i][x]);
        }
    }*/

    for(int i=1;i<=r;i++)
    {
        for(int j=2;j<=c;j++)
        {
            dp[i][j][0]=max(dp[i][j-1][0],dp[i-1][j][3]);
            ans=max(ans,dp[i][j][0]);
            for(int x=1;x<=3;x++)
            {
                dp[i][j][x]=max(dp[i-1][j][3]+a[i][j],max(dp[i][j-1][x],dp[i][j-1][x-1]+a[i][j]));
                ans=max(ans,dp[i][j][x]);
            }
        }
    }
    cout<<ans<<'\n';


}


Measured memory_bytes: 390808
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next()) * 2;
        int[] stick = new int[n];
        for (int i = 0; i < n; i++) {
            stick[i] = Integer.parseInt(sc.next());
        }
        Arrays.sort(stick);
        int sum = 0;
        for (int i = 0; i < n; i += 2) {
            int tmp = Math.min(stick[i], stick[i + 1]);
            sum += tmp;
        }
        System.out.println(sum);
    }
}

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

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  for(int i = 0; i < n; i++) cin >> a[i];
  int ans = 0;
  while(true){
    for(int i = 0; i < n; i++){
      if(a[i] % 2 != 0){
        cout << ans << endl;
        return 0;
      }
    }
    for(int i = 0; i < n; i++){
      a[i] /= 2;
    }
    ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
using lint = long long;

signed main(){
	double n, m, d, ans; cin >> n >> m >> d;
	if(d == 0) ans = (m - 1.0) / n;
	else ans = 2.0 * (n - d) * (m - 1) / (n * n);
	cout << setprecision(10) <<  ans << endl;
}

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

using namespace std;

int main(){
int H,W; cin >> H >> W;
  vector<string> A(H);
  for(int i = 0; i < H; i++){ cin >> A[i];}
  int cnt = 0;
  for(int i = 0; i < H; i++){
    for(int j = 0; j  < W; j++){
      if( A[i][j] == '#'){ cnt++;}}}
  
  if( cnt == H + W - 1){ cout << "Possible" << endl;}
  else{ cout << "Impossible" << endl; }
  
  return 0;}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
    long long a, b;
    cin >> a >> b;
    if(a > 0) cout << "Positive" << endl;
    else if(a * b <= 0) cout << "Zero" << endl;
    else{
        if((b - a) % 2 == 1) cout << "Positive" << endl;
        else               cout << "Negative" << endl;
    }
    return 0;
}

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

using int64 = long long;

int gcd(int a, int b) {
  static vector<vector<int>> gcd_(201, vector<int>(201, 0));
  if (b == 0)
    return a;
  if (gcd_[a - 1][b - 1])
    return gcd_[a - 1][b - 1];
  
  return gcd_[a - 1][b - 1] = gcd(b, a % b);
}

int main() {
  int k;
  cin >> k;
  int64 sum = 0;
  for (int a = 1; a <= k; ++a) {
    for (int b = 1; b <= k; ++b) {
      for (int c = 1; c <= k; ++c) {
        sum += gcd(a, gcd(b, c));
      }
    }
  }
  cout << sum << "\n";

  return 0;
}


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

int main(){
    long long n, fixed_n;
    int cnt, ans=0;
    scanf("%lld", &fixed_n);
    n = fixed_n;
    for (long long p=2; p*p<fixed_n; ++p){
        cnt = 0;
        while (n%p==0){
            ++cnt;
            n/=p;
            //printf("%lld %d\n", n, p);
        }
        for (int i=1; ; ++i){
            if (i*(i+1)/2>cnt){
                ans += i-1;
                break;
            }
        }
    }
    if (n>1) ++ans;
    printf("%d", ans);
    return 0;
}


Measured memory_bytes: 3828
#include <cstdio>
#include <cstring>
#include <cmath>
#include <iostream>
#include <cstring>
using namespace std;
#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1

int t[(100010<<4) + 10];
int vis[100010];

int build(int l, int r, int rt) {
    if(l == r) {
        if(!vis[l] && !vis[(l + 1) / 2])
            t[rt] = 1;
        else
            t[rt] = 0;
        return t[rt];
    }
    int mid = (l + r) / 2;
    t[rt] += build(lson);
    t[rt] += build(rson);
	return t[rt];
}

int query(int L, int R, int l, int r, int rt) {
    if(l == L && r == R) return t[rt];
    int mid = (l + r) / 2;
    int sum = 0;
    if(R <= mid) sum += query(L, R, lson);
    else if(L > mid) sum += query(L, R, rson);
    else {
        sum += query(L, mid, lson);
        sum += query(mid + 1, R, rson);
    }
    return sum;
}

int main() {
    memset(t, 0, sizeof(t));
    memset(vis, 0, sizeof(vis));
    vis[1] = 1;
	int i;
    for(i = 2;i <= 100000;i++) {
        if(vis[i]) continue;
        for(int j = i*2;j <= 100000;j += i)
            vis[j] = 1;
    }
    build(1, 100010, 1);
    int Q;
    cin>>Q;
	int l, r;
    for(i = 1;i <= Q;i++) {
        scanf("%d %d", &l, &r);
        printf("%d\n", query(l, r, 1, 100010, 1));
    }
    return 0;
}


Measured memory_bytes: 7296
#include <iostream>
#include <math.h>
#include <string.h>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <stack>
#include <queue>
using namespace std;
#define max_n 100
#define INF 100000000

int h,w;
char a[8][9];

void dfs(int x,int y){
    a[x][y]='.';
    if(x==h-1&&y==w-1){
        return ;
    }
    if(a[x][y+1]=='#'){
        dfs(x,y+1);
    }else if(a[x+1][y]=='#'){
        dfs(x+1,y);
    }else{
        return ;
    }
}

int main()
{
    cin>>h>>w;
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            cin>>a[i][j];
        }
    }
    dfs(0,0);
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            if(a[i][j]=='#'){
                cout<<"Impossible"<<endl;
                return 0;
            }
            
        }
    }
    cout<<"Possible"<<endl;
    return 0;
}


Measured memory_bytes: 256
from scipy.sparse.csgraph import dijkstra
# 2部グラフの最大流問題で解く
N = int(input())
NN = N * 2
XY = [[int(x) for x in input().split()] for _ in range(NN)]

graph = [[0] * (NN+2) for _ in range(NN+2)]
start = NN
goal = NN + 1

for i,(a,b) in enumerate(XY[:N]):
  for j,(c,d) in enumerate(XY[N:],N):
    if a < c and b < d:
      graph[i][j] = 1

for i in range(N):
  graph[start][i] = 1
for i in range(N,NN):
  graph[i][goal] = 1

INF = 10 ** 9

def max_flow(graph):
  dist,pred = dijkstra(graph,indices = start,return_predecessors = True)
  if dist[goal] > INF:
    return 0
  y = goal
  while y != start:
    x = pred[y]
    graph[x][y] -= 1
    graph[y][x] += 1
    y = x
  return 1 + max_flow(graph)

answer = max_flow(graph)
print(answer)

Measured memory_bytes: 17696
import java.util.Scanner;
	public class Main
		{ public static void main(String[] args)
			{   
			    Scanner scanner = new Scanner(System.in);
				int r = scanner.nextInt();
				int g = scanner.nextInt();
				int b = scanner.nextInt();
	            
	            String s1 = String.valueOf(r);
	            String s2 = String.valueOf(g);
	            String s3 = String.valueOf(b);
	            
	            String s4 = s1 + s2 + s3;
	            
	            
	            int total = Integer.parseInt(s4);
	            
	            if (total % 4 == 0) {
	                System.out.print("YES");
	            } else {
	                System.out.print("NO");
	            }
		}
		}

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

int main(void)
{
    string s;
    cin >> s;
    bool flag[26]{0};
    for(int i{0}; i<s.size(); ++i){
        if(flag[s[i]-'a']==false)
            flag[s[i]-'a'] = true;
        else{
            cout << "no" << endl;
            return(0);
        }
    }
    cout << "yes" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

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

    const long long NMAX=100010;
    long long h[NMAX];
    long long dp[NMAX];

    REP(i, N) cin>>h[i];
    REP(i, N) dp[i] = LLONG_MAX;

    dp[0] = 0;

    REP2(i, 1,N){
        chmin(dp[i], dp[i-1]+abs(h[i]-h[i-1]));
        if(i>1) chmin(dp[i], dp[i-2]+abs(h[i]-h[i-2]));
    }

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

   return 0;
}

Measured memory_bytes: 1792
import core.bitop;
import std.algorithm;
import std.ascii;
import std.bigint;
import std.conv;
import std.functional;
import std.format;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.random;
import std.typecons;

alias sread = () => readln.chomp();
alias Point2 = Tuple!(long, "y", long, "x");

T lread(T = long)()
{
    return readln.chomp.to!T();
}

T[] aryread(T = long)()
{
    return readln.split.to!(T[])();
}

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}

enum MOD = (10 ^^ 9) + 7;

void main()
{
    long a, b, c, d;
    scan(a, b, c, d);
    long H = d - b;
    long W = c - a;
    string ans;
    ans ~= repeat('R').take(W).array;
    ans ~= repeat('U').take(H).array;
    ans ~= repeat('L').take(W).array;
    ans ~= repeat('D').take(H).array;
    ans ~= "DR";
    ans ~= repeat('R').take(W).array;
    ans ~= repeat('U').take(H).array;
    ans ~= "ULUL";
    ans ~= repeat('L').take(W).array;
    ans ~= repeat('D').take(H).array;
    ans ~= "DR";
    writeln(ans);
}


Measured memory_bytes: 332
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define debug(x) cerr << #x << ": " << x << endl;
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;}

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

    ll ans = INF;
    rep(bit, 1<<N) {
        ll cost = 0, color = 0, maxa = 0;
        rep(i, N) {
            if (a[i] > maxa) {
                color++;
                maxa = a[i];
            }
            else if (bit>>i&1) {
                color++;
                maxa++;
                cost += maxa - a[i];
            }
        }
        if(color >= K) chmin(ans, cost);
    }
    cout << ans << endl;
}


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

int main(){
   int n;
   cin >>n;
   map<int,long long> mp;
   for(int i=1;i<=n;i++){
      string s = to_string(i);
      int l = s.length()-1;
      int t =0;
      //if(s[0]!=s[l])
      t+=s[l]-'0';
      t+=10*(s[0]-'0');
      mp[t]++;
      // cout << t << endl;
   }
   long long cnt=0;
   for(int i=1;i<=n;i++){
      int d = i*10+i;
      cnt += mp[d]*mp[d];
      mp[d] = 0;
      if(i==9) break;
   }
   for(int i=10;i<99;i++){
      if(i%10 == i/10 || i%10 == 0) continue;
      if(mp[i]==0) continue;
      int rev = (i%10)*10 + i/10;
      cnt += mp[i]*mp[rev]*2;

      mp[i]=0;
      mp[rev]=0;
      
   }
   cout <<cnt<< endl;
   return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  for(int i = 0;i < n;i++)cin >> a[i];
  sort(a.begin(),a.end());
  int cnt;
  for(int i = a[1];i > 0;i--){
    cnt = 0;
    for(int j = 0;j < n;j++){
      if(a[j] % i != 0)++cnt;
      if(cnt == 2){
        break;
      }
    }
    if(cnt == 0||cnt == 1){
      cout << i << endl;
      break;
    }
    if(i == 1){
      cout << 1 << endl;
    }
  }
}

Measured memory_bytes: 640
/*　　　　　　　{:i:i:|i:i:/l/l--　 　 　--l/li:i:i|i:i:i:i}
　　　　　　 　 {:rx|:i:i ィi芥ミ 　 　 .ィi芥ミｉ:ｉ|ﾍ:i:i:}
.　　　 　 　 　 ｛ﾏ|ｉ:  {::’:} 　 　 　{:‘::} :ｉ:i:|〉｝:/
　　 　 　 　 　 乂|:i:| ｀¨¨¨¨´ 　 　　｀¨¨¨´  :i:ｉ:|ｼ/
　 　 　 　 　 　 ﾉ:|:i|　　　　　　′　　　 　   |:i:i:|ﾂ
　　　　　　　　/:/|:i:| ､　　　 　_ _ 　　　　  |:i:i:|
　 　 　　 　 /:/ .|:i:|/ ＼　　　 　 　     ｨ〔|:i:/
　　 　 　  　 〈;/ く刈＿ 个 　   -   　＜}　./|/_〉
　　     　　 r-っ'~ﾞ~ﾞ~ﾞ~ﾞ~ﾞ~ﾞ~ﾞ~ﾞ~ﾞ~ﾞ~ﾞ~ﾞ~ﾞ~ﾞ~ﾞ~ﾞ~ﾞ|___
　　 　     /／ニつ　　　　　　 ､　　　　　　　ノﾆﾆ　＼
.　　　     |　　ニ⊃ 　./　/　 ──   /　/　　..⊆ﾆﾆ　　:|
.　　　     |　　丁´　 /|￣|￣  ─‐ /|￣|￣ 　 .￣|丁 　|
.　　　     |　　ﾉ.  　 |￣|￣  ─‐  |￣|￣ 　 　.|八 　|
.　　　     |　　||. 　 |￣|￣ |￣| |￣|￣ 　   .|　|
.　 　 　   |  　||   　￣￣￣　￣ 　￣￣￣　　  .|　|  |
.　 　 　  　    ||＿＿＿＿＿＿＿＿＿＿＿＿______|__　　 ',
　 　      ,′　 | ７ﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆ}  ,′
.　　     {　　　|/　}ﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆ{/ 　 　
*///讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐。
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath>
#include <limits>

using namespace std;

#define rep(b) for(int i=0;i<int(b);i++)
#define ll long long
#define fst first
#define snd second
#define pf(b) printf("%.12f\n",(double)b)
#define _GLIBCXX_DEBUG
const double pai = 3.1415926535897;
#define _cos(n) cos(n*pai/180)
#define l_b lower_bound
#define u_b upper_bound
#define b_s binary_search

//factorial(練習)　階乗
int fact(int n) {
	int a = 1;
	for (int i = 1;i <= n;i++) a *= i;
	return a;
}
int sa(int n, int m) {      //差！
	if (n < m)return m - n;
	else return n - m;
}
int keta(int num) {
	int n = 0;
	if (num == 0) {
		return 1;
	}
	while (num != 0) {
		num /= 10;
		n++;
	}
	return n;
}
int x;
signed main() {
	cin >> x;
	if (x == 1)cout << 0 << endl;
	else cout << 1 << endl;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
typedef long long ll;
#define ALL(l)  (l).begin(),(l).end()
#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
using namespace std;

//const ll mod =  1000000007;
//const ll maxn = 1000000000;

//---------------------------------------------------------------------------------------------------
using vi = vector<int>; // intの1次元の型に vi という別名をつける
using vll = vector<ll>; // long longの1次元の型に vll という別名をつける
using vvll = vector<vll>; // long longの2次元の型に vvll という別名をつける
using vs = vector<string>; // stringの1次元の型に vs という別名をつける
using pll = pair<ll, ll>; // これ以降 pll という型名はpair<ll, ll> と同じ意味で使える
//---------------------------------------------------------------------------------------------------
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}


int main() {
  ll n,ans;
  cin>>n;
  
  ans=modpow(10, n, 1000000007) + modpow(8, n, 1000000007);
  
  ll k = 2*modpow(9, n, 1000000007) ;
  k%=1000000007;
  if(ans<k){
      ans+=1000000007;
      ans-=k;
      
  }else ans-=k;
  
  
  
  ans%=1000000007;
  cout<<ans<<endl;
}



Measured memory_bytes: 3632
fun main(args: Array<String>) {
  val n = Integer.parseInt(readLine() ?: "0")
  val alist = readLine()?.split(" ") ?: listOf()
  val a = alist.map{it.toLong()}
  val minnum = a.filter{it < 0}.size
  if(minnum % 2 == 0) {
    println(a.map{Math.abs(it)}.sum())
  } else {
    val s: Long = a.map{Math.abs(it)}.sum()?.toLong() ?: 0
    val m: Long = a.map{Math.abs(it)}.min()?.toLong() ?: 0
    println(s - m * 2)
  }
}

Measured memory_bytes: 60164
#include <iostream>
#include <algorithm>
#include <iomanip>
using namespace std;
using ll = long long;
#define pi 3.1415926

int a[3];

int main(){
    int n, a, b;
    cin >> n;
    if(n == 1)
        cout << "Hello World";
    if(n == 2){
        cin >> a >> b;
        cout << a + b;
    }
    
}
	


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

int main() {
    string str;
    cin >> str;
    int n = 0, s = 0, e = 0, w = 0;
    for (auto i : str) {
        if (i == 'N') n++;
        if (i == 'S') s++;
        if (i == 'E') e++;
        if (i == 'W') w++;
    }

    if (((s&&n) || (!n&&!s)) && ((w&&e) || (!e&&!w))) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}


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

namespace B
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] inputs = Console.ReadLine().Trim().Split(' ').Select(x => int.Parse(x)).ToArray();
            int n = inputs[0] <= inputs[1] ? inputs[0] : inputs[1];
            int m = inputs[0] > inputs[1] ? inputs[0] : inputs[1];

            var nd = GetDivisors(n);
            var md = GetDivisors(m);

            var ans = md.Reverse().Where(x => nd.Contains(x)).ElementAt(inputs[2] - 1);

            Console.WriteLine(ans);

#if DEBUG
            Console.ReadKey();
#endif
        }

        static IEnumerable<int> GetDivisors(int n)
        {
            for (int i = 1; i <= n; i++)
                if (n % i == 0)
                    yield return i;

            yield break;
        }
    }
}


Measured memory_bytes: 13280
import java.util.Scanner

object Main {

  def solve(sc: => Scanner): Unit = {
    val N = sc.nextInt
    val A = Array.fill[Int](100003)(0)
    for (_ <- 0 until N) {
      val x = sc.nextInt
      A(x) += 1
      A(x + 1) += 1
      A(x + 2) += 1
    }
    println(A.max)
  }

  def main(args: Array[String]): Unit = {
    val sc: Scanner = new Scanner(System.in)
    solve(sc)
  }
}


Measured memory_bytes: 51544
// include
// ------------------------------------------------
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

// func
// ------------------------------------------------
int CalcSumOfDigit(int n);      // 各桁の和を計算する。

// define
// ------------------------------------------------
#define all(a)        (a).begin(),(a).end()
#define pb            push_back
#define sz(a)         int((a).size())
#define rep(i,n)      for(int(i)=0;(i)<(n);(i)++)
#define repe(i,n)     for(int(i)=0;(i)<=(n);(i)++)
#define vsort(v)      sort((v).begin(),(v).end())

// code
// ------------------------------------------------
int main() {
  int a,b;
  cin >> a >> b;

  if( a > 8 || b > 8) cout << ":(";
  else cout << "Yay!";


  return 0;
}

// funcの実体
// ------------------------------------------------
int CalcSumOfDigit(int n)
{
  int s = 0;
  while(n)
  {
    s += n % 10;
    n = n / 10;
  }
  return s;
}

Measured memory_bytes: 256
#include<stdio.h>

typedef struct{
  char suit;
  int value;
}Card;

void bubble(Card A[], int N){
  int i,j;
  Card t;

  for(i=0;i<N;i++){
    for(j=N-1;j>i;j--){
      if(A[j].value<A[j-1].value){
	t = A[j];
	A[j] = A[j-1];
	A[j-1] = t;
      }
    }
  }
}

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

void print(Card A[], int N){
  int i;

  for(i=0;i<N-1;i++){
    printf("%c%d ",A[i].suit,A[i].value);
  }
  printf("%c%d\n",A[i].suit,A[i].value);
}

int isStable(Card C1[], Card C2[], int N){
  int i;

  for(i=0;i<N;i++){
    if(C1[i].suit != C2[i].suit)return 0;//false
  }
  return 1;//true
}

int main(){
  Card C1[100], C2[100];
  int N,i;
  char ch;

  scanf("%d",&N);
  for(i=0;i<N;i++){
    scanf(" %c%d",&C1[i].suit,&C1[i].value);
    C2[i] = C1[i];
  }

  bubble(C1,N);
  selection(C2,N);

  print(C1,N);
  if(isStable(C1,C1,N)==1){
    printf("Stable\n");
  }else{
    printf("Not stable\n");
  }
  print(C2,N);
  if(isStable(C1,C2,N)==1){
    printf("Stable\n");
  } else {
    printf("Not stable\n");
  }

  return 0;
}



Measured memory_bytes: 2112
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>

// output
#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
// utility
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline T chmax(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T chmin(T& a, const T b) { return a = (a > b) ? b : a; }

// type/const
#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;


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

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

  sort(ALL(A));
  sort(ALL(F), greater<>());

  int ok = INF;
  int ng = -1;
  while(ok-ng > 1){
    int mid = (ok+ng)/2;
    int cnt = 0;
    REP(i, N) cnt += max(0ll, A[i]-mid/F[i]);
    if(cnt <= K) ok = mid;
    else ng = mid;
  }

  cout << ok << endl;

  return 0;
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
bool pal(string s){
    string t(s.rbegin(),s.rend());
    return s == t;
}

int main() {
  string s;
  cin >> s;
  int n=s.size();
  if(pal(s)&&pal(s.substr(0,(n-1)/2))&&pal(s.substr((n+1)/2))){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
s = str(input().split())
S = list(s)

ans = 0
alist = []

for i in range(len(s)):
  if S[i] == "A" or S[i] == "C" or S[i] == "G" or S[i] == "T":
    ans += 1
  else:
    alist.append(ans)
    ans = 0
    
print(max(alist))

Measured memory_bytes: 9128