akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
int64_t MOD = 1e9+7;
int main(){
  int N;
  cin >> N;
  vector<char> vec = {'A', 'G', 'C', 'T'};
  map<string,int> mp_s;
  map<int,string> mp_i;
  int cnt = 0;
  for(int i=0; i<4; i++){
    for(int j=0; j<4; j++){
      for(int k=0; k<4; k++){
        string S = "XXX";
        S.at(0) = vec.at(i);
        S.at(1) = vec.at(j);
        S.at(2) = vec.at(k);
        mp_s[S] = cnt;
        mp_i[cnt] = S;
        cnt++;
      }
    }
  }
  
  map<string,bool> mp_ban;
  for(int i=0; i<4; i++){
    string S = "XAGC";
    S.at(0) = vec.at(i);
    mp_ban[S] = true;
  }
  for(int i=0; i<4; i++){
    string S = "XGAC";
    S.at(0) = vec.at(i);
    mp_ban[S] = true;
  }
  for(int i=0; i<4; i++){
    string S = "XACG";
    S.at(0) = vec.at(i);
    mp_ban[S] = true;
  }
  for(int i=0; i<4; i++){
    string S = "AXGC";
    S.at(1) = vec.at(i);
    mp_ban[S] = true;
  }
  for(int i=0; i<4; i++){
    string S = "AGXC";
    S.at(2) = vec.at(i);
    mp_ban[S] = true;
  }
  for(int i=0; i<4; i++){
    string S = "AGCX";
    S.at(3) = vec.at(i);
    mp_ban[S] = true;
  }


  
  int P = 64;
  int64_t dp[N][P];
  for(int i=0; i<N; i++){
    for(int j=0; j<P; j++){
      dp[i][j] = 0;
    }
  }
  
  if(N >= 3){
    for(int i=0; i<P; i++){
      dp[2][i] = 1;
    }
    dp[2][mp_s["AGC"]] = 0;
    dp[2][mp_s["ACG"]] = 0;
    dp[2][mp_s["GAC"]] = 0;    
    for(int i=3; i<N; i++){
      for(int j=0; j<P; j++){
        for(int k=0; k<4; k++){
          string S = mp_i[j];
          S += vec.at(k);
          string T = S.substr(1);
          //cout << T << endl;
          int64_t ni = i;
          int64_t nj = mp_s[T];
          int64_t nk = dp[i-1][j];
          if(mp_ban.count(S)){
            nk = 0;
          }
          dp[ni][nj] += nk;
          dp[ni][nj] %= MOD;
        }
      }
    }
  }
  
  int64_t ans = 0;
  for(int i=0; i<P; i++){
    ans += dp[N-1][i];
    ans %= MOD;
  }
  
  /*for(int i=0; i<N; i++){
    for(int j=0; j<P; j++){
      cout << dp[i][j] << " ";
    }
    cout << endl;
  }*/
  cout << ans << endl;
}

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

using namespace std;

int main() {
    long long N, A, B, C, D, E;
    cin >> N >> A >> B >> C >> D >> E;
    cout << max({ (N - 1) / A, (N - 1) / B, (N - 1) / C, (N - 1) / D, (N - 1) / E }) + 5 << endl;
}


Measured memory_bytes: 888
n, x = input().split()
n = int(n)
x = int(x)
m = [int(input()) for _ in range(n)]
ans = 0
for mm in m:
    x = x - mm
    if x >= 0:
        ans = ans + 1
if x>= 0:
    ans = ans + int(x / min(m))
print(ans)

Measured memory_bytes: 3064
#include<cstdio>

using namespace std;

int main(void){
	int n;
	while(scanf("%d", &n) != EOF ){
		int ans = 1;
		
		for(int i = 1; i <= n; i++){
			ans += i;
		
		}
		printf("%d\n",ans);
	}
	return 0;
}

Measured memory_bytes: 0
def main():
    from itertools import accumulate

    n, k = map(int, input().split())
    *a, = map(int, input().split())

    acc = (0,) + tuple(accumulate((a)))

    bs = [acc[r] - acc[l] for r in range(1, n + 1) for l in range(r)]

    ret = 0
    for j in range(39, -1, -1):
        t = ret | 1 << j
        if sum(1 for b in bs if t & b == t) >= k:
            ret = t
    print(ret)


if __name__ == '__main__':
    main()


Measured memory_bytes: 23020
#include <bits/stdc++.h>
 
using namespace std;
 
typedef vector< int > vi;
typedef vector< vi > vvi;
typedef pair< int,int > ii;
#define ll	long long
#define sz(a) int((a).size())
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(typeof((c)).begin() i = (c).begin(); i != (c).end(); i++)
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define ios	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define hell 1000000007
#define M_PI 3.141592653589793238462643383279502884L

int main() {
	ios;
	int n;
	cin>>n;
	int arr[n+1];
	memset(arr, 0, sizeof(arr));
	int Ai;
	for (int i = 2; i <= n; i++) {
		cin>>Ai;
		arr[Ai]++;
	}
	for (int i = 1; i <= n; i++) {
		cout<<arr[i]<<endl;
	}
	return 0;
}


Measured memory_bytes: 4400
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
template<class S,class T> ostream &operator << (ostream& out,const pair<S,T>& o){
    out << "(" << o.first << "," << o.second << ")"; return out;
}

/*
<url:https://arc071.contest.atcoder.jp/tasks/arc071_c>
問題文============================================================
 A, B からなる文字列に対して、次の操作を考えます。
 
 文字列中の 1 文字を選ぶ。それが A なら BB で、 B なら AA で置き換える。
 AAA か BBB であるような部分文字列を選び、消す。
 例えば、ABA という文字列で 1 番目の操作を 1 文字目に対して行うと、 BBBA となります。
 また、BBBAAAA に対して 2 番目の操作を 4 文字目から 6 文字目に対して行うと、 BBBA となります。
 
 これらの操作を何回でも好きな順で行うことができます。
 
 文字列 S,T と q 個のクエリ ai,bi,ci,di が与えられます。
 各クエリに対して、
 S の部分文字列 SaiSai+1…Sbi を
 T の部分文字列 TciTci+1…Tdi にすることができるか判定してください。
 
 1≤|S|,|T|≤10^5
 S,T は文字A,Bからなる。
 1≤q≤10^5
 1≤ai≤bi≤|S|
 1≤ci≤di≤|T|

=================================================================

解説=============================================================
 
 SとTの部分文字列 s,t を全て B へ変形した時、
 そのBの数の差が 3 の倍数であるとき、 YESとなる。
 
 前処理で累積和を用いて、Bの数を数え上げておけば　各クエリについて O(1) で回答できる
 
================================================================
*/
void solve(){
    string S,T; cin >> S >> T;
    int Q; cin >> Q;
    vector<int> cusumS(S.length()+1,0),cusumT(T.length()+1,0);
    for(int i = 0; i < S.length();i++){
        if(S[i] == 'A') cusumS[i+1] = cusumS[i] + 2;
        else cusumS[i+1] = cusumS[i] + 1;
    }
    for(int i = 0; i < T.length();i++){
        if(T[i] == 'A') cusumT[i+1] = cusumT[i] + 2;
        else cusumT[i+1] = cusumT[i] + 1;
    }
    while(Q--){
        int a,b,c,d; cin >> a >> b >> c >> d;
        if(abs((cusumS[b]-cusumS[a-1])-(cusumT[d]-cusumT[c-1]))%3 == 0) cout << "YES" << endl;
        else cout << "NO" << endl;
    }
}
int main(void) {
	cin.tie(0); ios::sync_with_stdio(false);
    solve();
	return 0;
}


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

int main(){
    string s;
    string t;
    cin >> s >> t;
    int N=s.size(); int M=t.size();
    s+=s;
    vector<long long> v[50];
    map<char,int> ma;
    for(int i=0;i<s.size();i++){
        v[s[i]-'a'].push_back(i);
        ma[s[i]]++;
    }
    long long ind=0;
    long long ans=0;
    for(int i=0;i<t.size();i++){
        if(ma[t[i]]==0){
            cout << -1 << endl;
            return 0;
        }
        auto res=lower_bound(v[t[i]-'a'].begin(),v[t[i]-'a'].end(),ind);
        ind=*res+1;
        if(ind>=N){
            ind-=N;
            ans+=N;
        }
        //cout << ind << endl;
    }
    ans+=ind;
    cout << ans << endl;
}

Measured memory_bytes: 2804
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define vll vector<ll>
#define vvll vecror<vector<ll>> 
#define sz size()
#define pb push_back
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
ll fact(ll n){ll s=1; for(ll i=1;i<=n;i++)s*=i; return s;}
ll ceil1(ll n,ll m){if(n%m==0){return n/m;}return n/m +1;}
vll factor(ll n){
    vll ans;
    if(n>0)ans.pb(1);if(n==2)ans.pb(2);
    for(ll i=2;i*i<=n;i++){if(n%i==0){ans.pb(i);if(n/i!=i)ans.pb(n/i);}}if(n>2)ans.pb(n);
    return ans;
}
 
 
 

void solve()
{
	ll n,i,j,k,x,y;
	cin>>n;
	i=n/500;
	
	j=((n%500)/5);
	cout<<(1000*i)+j*5;
	return;
}
 
int main()
{
    ll q;
    q=1;
    // cin>>q;
    while(q--)
    {
        solve();
    }
    return 0;
}

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

const int mod = 1000000007;

int main() {

  int N;
  cin >> N;

  vector<long long> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }

  long long answer = 0;

  // 桁ごとに考える
  // A_i の最大は、2進数で60桁
  for (int i = 0; i < 60; i++) {
    
    // すべてのAのi桁目の1の個数を数える
    long long count = 0;
    for (int j = 0; j < N; j++) {
      if (A[j] >> i & 1) {
        ++count;
      }
    }
    
    // 1の個数 × 0の個数 × 2の桁乗
    // まずは、1の個数 × 0の個数 を計算しておく
    long long v = count * (N - count) % mod;

    // 2の桁乗を計算する
    for (int j = 0; j < i; j++) {
      v = v * 2 % mod;
    }

    answer += v;
    answer %= mod;

  }

  cout << answer << endl;

  return 0;

}

Measured memory_bytes: 2560
#include<stdio.h>
#include<string.h>
int main(void){
    int N,Y,i,j,k,all,x;
    int I=-1,J=-1,K=-1;
    int total;
    scanf("%d %d",&N,&Y);
    for(i=0;i<=N;i++){
        for(j=0;j<=N-i;j++){
            for(k=0;k<=N-j-i;k++){
				total=10000*i+5000*j+1000*k;
                if(total==Y){
                    if(i+j+k==N){
                    I=i;
                    J=j;
                    K=k;
                    }
                    
                }   
            }
        }
    }

    printf("%d %d %d",I,J,K);
    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 1000000000000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;



#define SIZE 1000005


ll fact[SIZE],inv_fact[SIZE];
ll A[100005],table[100005];


ll mod_pow(ll x,ll count, ll mod){

	if(count == 0)return 1;
	ll ret = mod_pow((x*x)%mod,count/2,mod);
	if(count%2 == 1){

		ret = (ret*x)%mod;
	}
	return ret;
}

ll extgcd(ll a,ll b,ll &x,ll &y){
	ll d = a;
	if(b != 0){
		d = extgcd(b,a%b,y,x);
		y -= (a/b)*x;
	}else{
		x = 1;
		y = 0;
	}
	return d;
}

ll mod_inverse(ll a,ll m){
    ll x,y;
    extgcd(a,m,x,y);
    return (m+x%m)%m;
}

ll nCk(ll n,ll k){

	if(k > n)return 0;

	ll ret = fact[n]*inv_fact[k];
	ret %= MOD;
	ret *= inv_fact[n-k];

	return ret%MOD;
}



int main(){

	fact[0] = 1;
	for(ll i = 1; i < SIZE; i++){
		fact[i] = i*fact[i-1];
		fact[i] %= MOD;
	}
	inv_fact[SIZE-1] = mod_inverse(fact[SIZE-1],MOD);
	for(ll i = SIZE-1; i >= 1; i--){

		inv_fact[i-1] = inv_fact[i]*i;
		inv_fact[i-1] %= MOD;
	}

	ll N;
	scanf("%lld",&N);

	for(ll i = 1; i <= N; i++){

		table[i] = 0;
	}

	int base = -1;

	for(ll i = 0; i < N+1; i++){

		scanf("%lld",&A[i]);
		table[A[i]]++;
		if(table[A[i]] == 2){

			base = A[i];
		}
	}

	ll L = -1, R = -1;

	for(ll i = 0; i < N+1; i++){
		if(A[i] != base)continue;

		if(L == -1){

			L = i;
		}else{

			R = i;
		}
	}

	ll pre = L;
	ll mid = R-(L+1); //LとRの間にある数
	ll tail = N-(R+1)+1;

	//printf("pre:%lld mid:%lld tail:%lld\n",pre,mid,tail);


	printf("%lld\n",N); //1
	for(ll num = 2; num <= N; num++){

		//printf("\n\nnum:%lld\n",num);

		//baseを含まない
		ll tmp = nCk(N-1,num);
		//printf("tmp:%lld\n",tmp);

		//baseを1つ含む
		//区間midにデータなし(L,Rが区別されない)
		ll no_mid = nCk(pre+tail,num-1);
		//printf("no_mid:%lld\n",no_mid);

		//区間midにデータあり(L,Rが区別される)
		//printf("nCk(N-1,num-1):%lld -nCk(pre+tail,num-1):%lld\n",nCk(N-1,num-1),nCk(pre+tail,num-1));

	 	ll yes_mid = 2*(nCk(N-1,num-1)-nCk(pre+tail,num-1)+MOD)%MOD;
		//printf("yes_mid:%lld\n",yes_mid);

		tmp += (no_mid+yes_mid)%MOD;
		tmp %= MOD;

		//baseを2つ含む
		ll num_two = nCk(N-1,num-2);
		//printf("num_two:%lld\n",num_two);

		tmp += num_two;
		tmp %= MOD;

		printf("%lld\n",tmp);

		/*
		tmp = nCk(N+1,num);
		tmp -= nCk(pre+tail,num-1);
		if(tmp < 0){

			tmp += MOD;
		}
		printf("%lld\n",tmp);
		*/
	}
	printf("1\n");

	return 0;
}


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

int main() {
    long long n, m;
    cin >> n >> m;

    long long ans = 0;
    if (2 * n <= m) {
        ans += n;
        m -= 2 * n;
        n = 0;
        ans += m / 4;
    }
    else {
        ans += m / 2;
        m /= 2;
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    val N = readLine()!!.toInt()
    val p = Array(N) {
        val (x, y) = readLine()!!.split(" ").map{it.toDouble()}
        Pair(x, y)
    }

    fun dot(a: Pair<Double, Double>, b: Pair<Double, Double>): Double {
        return a.first * b.first + a.second * b.second
    }
    fun cross(a: Pair<Double, Double>, b: Pair<Double, Double>): Double {
        return a.first * b.second - a.second * b.first
    }

    fun plus(a: Pair<Double, Double>, b: Pair<Double, Double>): Pair<Double, Double> {
        return Pair(a.first + b.first, a.second + b.second)
    }

    fun minus(a: Pair<Double, Double>, b: Pair<Double, Double>): Pair<Double, Double> {
        return Pair(a.first - b.first, a.second - b.second)
    }

    fun dist(x: Double, y: Double, p: Pair<Double, Double>): Double {
        return Math.sqrt(Math.pow(p.first - x, 2.0) + Math.pow(p.second - y, 2.0))
    }

    var cx = 0.0
    var cy = 0.0
    var alpha = 0.7
    var r = 1e18

    for (k in 1..100000) {
        var t = -1
        var mr = 0.0

        for (i in p.indices) {
            val d = dist(cx, cy, p[i])
            if (d > mr) {
                mr = d
                t = i
            }
        }

        val v = minus(p[t], Pair(cx, cy))
        cx += v.first * alpha
        cy += v.second * alpha

        alpha *= 0.999
        r = mr
    }

    System.out.printf("%1.10f\n", r)
}


Measured memory_bytes: 40692
n = input()

for i in range(2 ** 3):
    l = n[0]
    for j in range(3):
        if (i >> j) & 1 == 1:
            l += '+'
        else:
            l += '-'
        l += n[j + 1]
    if eval(l) == 7:
        print(l, '=7', sep = '')
        exit()


Measured memory_bytes: 38384
#include<iostream>
#include<string>
#include<cstdlib>
#include<vector>
#include<algorithm>
#include<functional>


#define ll long long int

using namespace std;

int to_int(string s) {
  return atoi(s.c_str());
}

int main() {
  int a, b;
  cin >> a >> b;

  if(a%3 == 0 || b%3 == 0 || (a+b)%3 == 0) {
    cout << "Possible" << endl;
  } else {
    cout << "Impossible" << endl;
  }
}


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

#define REP(i, n) for (int i = 0; i < n; i++)
#define ALL(obj) obj.begin(), obj.end()

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

const int iINF = 1e9;
const long long llINF = 1e18;
const int MOD = 1e9 + 7;

using namespace std;

long long dp[110][2][4];
string N;
int K;

long long rec(int i, int small, int non_zero) {
    if (non_zero > K) {
        return 0;
    }

    if (i == N.size()) {
        return non_zero == K;
    }

    if (dp[i][small][non_zero] != -1) {
        return dp[i][small][non_zero];
    }

    int lim = (small ? 9 : N[i] - '0');
    long long ret = 0;
    REP(next, lim + 1) {
        if (next == 0) {
            ret += rec(i + 1, small || N[i] - '0' > next, non_zero);
        } else {
            ret += rec(i + 1, small || N[i] - '0' > next, non_zero + 1);
        }
    }
    return dp[i][small][non_zero] = ret;
}

int main() {
    cin >> N >> K;
    memset(dp, -1, sizeof(dp));
    cout << rec(0, 0, 0) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <iostream> 
using namespace std;
int main(){
	int a,b;
	cin>>a>>b;
	if(a>8||b>8){
		cout<<":(";
		return 0;
	}
	cout<<"Yay!";
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define LOCAL
using namespace std;
template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
out << "(" << a.first << "," << a.second << ")";
return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');
cerr.write(names, comma - names) << ": " << arg1 << " |";
__f(comma + 1, args...);
}
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
#define int long long
using P = pair<int,int>;
//#########################################
const int INF = 1e18;
void chmax(int &a,int b){
    if(a < b) a = b;
}
signed main(){
    int n;cin >> n;
    vector<vector<int>> a(n+1,vector<int>(3)),dp(n+1,vector<int>(3,-INF));
    rep(i,n)cin >> a[i][0] >> a[i][1] >> a[i][2];
    rep(i,3)dp[0][i] = 0;
    rep(i,n)rep(j,3){
        rep(k,3){
            if(j == k)continue;
            chmax(dp[i+1][k],dp[i][j] + a[i][k]);
        }
    }
    int ret = 0;
    rep(i,3)chmax(ret,dp[n][i]);
    cout << ret << endl;
    return 0;
}

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

int N,M;

double H[33][33][33];
const double INF = 1e100;

struct state{
  int n,p,v;
  double c;
  state(int n,int p,int v,double c) : n(n),p(p),v(v),c(c) {}
  bool operator<(const state &st) const{
    return c > st.c;
  }
};

struct edge {
  int to,d,c;
  edge(int to,int d,int c) : to(to),d(d),c(c) {}
};

vector<edge> G[33];

void dijk(int s,int g){
  fill(H[0][0],H[32][32],INF);

  priority_queue<state> q;
  q.push( state( s, s, 0, 0.0 ) );
  H[s][s][0] = 0.0;
  while( !q.empty() ){
    state p = q.top(); q.pop();
    if( p.c > H[p.n][p.p][p.v] ) continue;
    if( p.n == g && p.v == 1 ) {
      printf("%.9lf\n", p.c); return;
    }
    for(int i=0;i<(int)G[p.n].size();i++){
      edge e = G[p.n][i];
      if( e.to == p.p ) continue;
      for(int nv=p.v-1;nv<=p.v+1;nv++){
        if( 0 < nv && nv <= e.c ) {
          double nc = p.c + (double)e.d/(double)nv;
          if( H[e.to][p.n][nv] > nc ){
            H[e.to][p.n][nv] = nc;
            q.push( state( e.to, p.n, nv , nc ) );
          }
        }
      }
    }
  }
  cout << "unreachable" << endl;
}

int main(){
  int s,g;
  while(cin >> N >> M && (N|M) ){
    cin >> s >> g;
    --s; --g;
    for(int i=0;i<M;i++){
      int x,y,d,c;
      cin >> x >> y >> d >> c;
      --x;--y;
      G[x].push_back( edge(y,d,c) );
      G[y].push_back( edge(x,d,c) );
    }
    dijk( s, g );
    for(int i=0;i<N;i++)
      G[i].clear();
  }
}

Measured memory_bytes: 2036
s=list(map(int,input()[::-1]))
t=[[0,0]for i in range(len(s)+1)]
t[0]=[0,9]
for i in range(len(s)):
    t[i+1][0]=min(t[i][0],t[i][1])+s[i]
    t[i+1][1]=min(11-s[i]+t[i][0],9-s[i]+t[i][1])
print(min(t[-1]))

Measured memory_bytes: 146172
import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.io.PrintWriter
import java.util.*

class UnionFind(n: Int) {
    private val rank = IntArray(n) { 0 }
    private val parent = IntArray(n) { -1 }

    fun find(x: Int): Int {
        if (parent[x] < 0) {
            return x
        }
        parent[x] = find(parent[x])
        return parent[x]
    }

    fun unite(x: Int, y: Int) {
        val x1 = find(x)
        val y1 = find(y)
        if (x1 == y1) {
            return
        }
        if (rank[x1] < rank[y1]) {
            parent[y1] += parent[x1]
            parent[x1] = y1
        } else {
            parent[x1] += parent[y1]
            parent[y1] = x1
            if (rank[x1] == rank[y1]) {
                rank[x1]++
            }
        }
    }

    fun same(x: Int, y: Int): Boolean {
        return find(x) == find(y)
    }

    fun size(x: Int): Int {
        return -parent[find(x)]
    }
}

fun PrintWriter.solve(sc: FastScanner) {
    val n = sc.nextInt()
    val m = sc.nextInt()
    val uf = UnionFind(n)
    for (i in 0 until m) {
        val a = sc.nextInt() - 1
        val b = sc.nextInt() - 1
        uf.unite(a, b)
    }
    val count = mutableMapOf<Int, Int>()
    for (i in 0 until n) {
        val p = uf.find(i)
        count[p] = (count[p] ?: 0) + 1
    }
    println(count.values.max())
}

fun main() {
    val writer = PrintWriter(System.out, false)
    writer.solve(FastScanner(System.`in`))
    writer.flush()
}

class FastScanner(s: InputStream) {
    private var st = StringTokenizer("")
    private val br = BufferedReader(InputStreamReader(s))

    fun next(): String {
        while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())

        return st.nextToken()
    }

    fun nextInt() = next().toInt()
    fun nextLong() = next().toLong()
    fun nextLine() = br.readLine()
    fun nextDouble() = next().toDouble()
    fun ready() = br.ready()
}

Measured memory_bytes: 65012
#include <bits/stdc++.h>
using namespace std;
 int main(){
   int N,K;
   cin>>N>>K;
   vector<int>vec(N);
   for(int i=0;i<N;i++){
   cin>>vec[i];
   }
   sort(vec.begin(),vec.end());
   int S,ans=vec[K-1]-vec[0];
   for(int i=K-1;i<N;i++){
     S=vec[i]-vec[i-K+1];
     if(ans>S){
     ans=S;
     }
     }
   cout<<ans<<endl;
   return 0;
   }

Measured memory_bytes: 640
// inputに入力データ全体が入る
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
	input = input.split("\n");
	//tmp = input[1].split(" ");
	//文字列から10進数に変換するときはparseIntを使います
    var n = parseInt(input[0], 10);
    var total = 0;
    var X =[];Y=[];
    for (i=1;i<=n;i++){
      tmp = input[i].split(" ");
      var l = i;
	var xl = parseInt(tmp[0], 10);
    var yl = parseInt(tmp[1], 10);
    X[i]=xl;
    Y[i]=yl;
   // console.log(xl,yl,n);
    }
    for(f=1;f<=n;f++){
    for(i=1;i<n;i++){
    var a=f;b=a+i;
      if(b>n){break;}{
    //  console.log(a,b);
    var p = Math.pow ((X[a]-X[b]),2);
    var q = Math.pow ((Y[a]-Y[b]),2);
  　var r =Math.sqrt(p+q);
  total = total + r;

   // console.log(a,b,p,q,r);
      }
    }
    }
 //   console.log(X,Y);

 
function factorialize(n) {
  var j = 1;
  for(var i = 1; i <= n; i++){
    j *= i;
  }
  return j;
}
  console.log(total*2/n);
	
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
S=input()
T=[0]*4
for i in range(4):
    T[i]=int(S[i])

if T[0]+T[1]+T[2]+T[3]==7: print(S[0]+"+"+S[1]+"+"+S[2]+"+"+S[3]+"=7")
elif T[0]+T[1]+T[2]-T[3]==7: print(S[0]+"+"+S[1]+"+"+S[2]+"-"+S[3]+"=7")
elif T[0]+T[1]-T[2]-T[3]==7: print(S[0]+"+"+S[1]+"-"+S[2]+"-"+S[3]+"=7")
elif T[0]+T[1]-T[2]+T[3]==7: print(S[0]+"+"+S[1]+"-"+S[2]+"+"+S[3]+"=7")
elif T[0]-T[1]-T[2]-T[3]==7: print(S[0]+"-"+S[1]+"-"+S[2]+"-"+S[3]+"=7")
elif T[0]-T[1]-T[2]+T[3]==7: print(S[0]+"-"+S[1]+"-"+S[2]+"+"+S[3]+"=7")
elif T[0]-T[1]+T[2]+T[3]==7: print(S[0]+"-"+S[1]+"+"+S[2]+"+"+S[3]+"=7")
elif T[0]-T[1]+T[2]-T[3]==7: print(S[0]+"-"+S[1]+"+"+S[2]+"-"+S[3]+"=7")


Measured memory_bytes: 3188
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)n; i++)
#define all(x) (x).begin(),(x).end()
typedef long long int ll;
using namespace std;
int main()
{
  int n;
  cin >> n;
  unordered_map<int, int> even;
  unordered_map<int, int> odd;
  int a, b;
  REP(i, n/2){
    cin >> a>> b;
    odd[a] ++;
    even[b] ++;
  }
  int en, on;
  en = on = 0;
  int en2, on2;
  en2 = on2 = 0;
  int ekey, okey;
  ekey = okey = 0;
  int ekey2, okey2;
  ekey2 = okey2 = 0;
  for(auto pair:even){
    if(en <= pair.second){
      en2 = en;
      en = pair.second;
      ekey2 = ekey;
      ekey = pair.first;
    }else if(en2 <= pair.second){
      en2 = pair.second;
      ekey2 = pair.first;
    }
  }
  for(auto pair:odd){
    if(on <= pair.second){
      on2 = on;
      on = pair.second;
      okey2 = okey;
      okey = pair.first;
    }else if(on2 <= pair.second){
      on2 = pair.second;
      okey2 = pair.first;
    }
  }
  // for(auto pair:odd){
  //   cout << pair.first << " " << pair.second << endl;
  // }
  // for(auto pair:even){
  //   cout << pair.first << " " << pair.second << endl;
  // }
  // cout << ekey << " " << en << " " << ekey2 << " " << en2 << endl;
  // cout << okey << " " << on << " " << okey2 << " " << on2 << endl;
  if(ekey == okey){
    // cout << " sp" << endl;
    cout << n - max(en2 + on, en + on2) << endl;
  }else{
    cout << n - en - on << endl;
  }
}


Measured memory_bytes: 4376
#include<iostream>
#include<stack>
#include<cstdlib>


using namespace std;

int main(){
	stack<int> st;
	int num1,num2;
	while (true){
		string c;
		cin >> c;
		if (cin.eof()) break;
		if (c == "+"){
			num1 = st.top();
			st.pop();
			num2 = st.top();
			st.pop();
			st.push(num1+num2);
		}else if (c == "-"){
			num1 = st.top();
			st.pop();
			num2 = st.top();
			st.pop();
			st.push(num2-num1);
		}else if (c == "*"){
			num1 = st.top();
			st.pop();
			num2 = st.top();
			st.pop();
			st.push(num1*num2);
		}else{
			st.push(stoi(c));
		}
		

	}
	cout << st.top() << endl;
return 0;
}

Measured memory_bytes: 3136
N = int(input())
fizzbuzz = []

for i in range(1 , N+1):
    if i % 3 != 0 and i % 5 != 0:
        if i % 3 != 0:
            if i % 5 != 0:
                fizzbuzz.append(i)
#print(fizzbuzz)
print(sum(fizzbuzz))

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

int main()
{
  int N,D,X;
  cin >> N >> D >> X;
  int res = 0;
  for (int i = 0; i < N; i++) {
	int A;
    cin >> A;
    for (int j = 1; j <= D; j+=A) {
      res++;
    }
  }

  cout << res + X << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fi first
#define se second
#define show(x) cout<<#x<<"="<<x<<"\n"
typedef long long ll;
template<typename T>
void print_to(std::ostream &os,const char *,const char *tail,const T &fst){
  os<<fst<<tail;
}
template<typename Fst,typename... Rst>
void print_to(std::ostream &os,const char *del,const char *tail,const Fst &fst,const Rst &... rst){
  os<<fst<<del;
  print_to(os,del,tail,rst...);
}
template<typename Iter>
void print_to_(std::ostream &os,const char *del,const char *tail,Iter bgn,Iter end){
  for(Iter it=bgn;it!=end;){
    os<<*it;
    if(++it!=end)os<<del;
    else os<<tail;
  }
}
template<typename Fst,typename... Rst>
void println(const Fst &fst,const Rst &... rst){
  print_to(std::cout,"\n","\n",fst,rst...);
}
template<typename Fst,typename... Rst>
void print(const Fst &fst,const Rst &... rst){
  print_to(std::cout," ","\n",fst,rst...);
}
template<typename Iter>
void println_(Iter bgn,Iter end){
  print_to_(std::cout," ","\n",bgn,end);
}
using namespace std;


//const int MOD=(ll)1e10+7;
const int dy[]={1,0,-1};
const int dx[]={1,0,-1};
int n,m,h,w;
string s;
bool past[100001];
int dd[100001];
vector<pair<int,int> > v[100001];

bool bfs(int start){
  queue<pair<int,ll> > q;
  q.push(make_pair(start,0));
  while(!q.empty()){
    int now=q.front().fi;
    ll nowd=q.front().se;
    q.pop();
    for(int i=0;i<(int)v[now].size();i++){
      if(past[v[now][i].fi] && dd[v[now][i].fi]==nowd+v[now][i].se)continue;
      if(past[v[now][i].fi]){
        return 0;
      }
      dd[v[now][i].fi]=nowd+v[now][i].se;
      past[v[now][i].fi]=1;
      q.push(make_pair(v[now][i].fi,nowd+v[now][i].se));
    }
  }
  return 1;
}

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.precision(10);
  cout<<fixed;
#ifdef LOCAL_DEFINE
  FILE *stream1;
  //FILE *stream2;
  stream1=freopen("in","r",stdin);
  //stream2=freopen("out","w",stdout);
  if(stream1==NULL)return 0;
  //if(stream2==NULL)return 0;
#endif
  cin>>n>>m;
  for(int i=0;i<m;i++){
    int l,r,d;cin>>l>>r>>d;
    l--;r--;
    v[l].push_back(make_pair(r,d));
    v[r].push_back(make_pair(l,-d));
  }
  for(int i=0;i<n;i++){
    if(past[i])continue;
    if(!bfs(i)){
      print("No");
      return 0;
    }
  }
  print("Yes");
#ifdef LOCAL_DEFINE
  cerr<<"Time elapsed: "<<1.0*clock()/CLOCKS_PER_SEC<<"s.\n";
  fclose(stream1);
  //fclose(stream2);
#endif
    return 0;
}






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

#define ll long long
#define pll pair<ll,ll> 

int main() {

	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

	ll n,w;
	cin>>n>>w;
	ll W[n+1];
	ll V[n+1];
	for(ll i=1;i<=n;i++)
		cin>>W[i]>>V[i];
	ll M[n+1][w+1];
	memset(M,0,sizeof M);

	for(ll i=1;i<=n;i++){
		for(ll j=1;j<=w;j++){
			if(j-W[i]>=0)
				M[i][j]=max(M[i-1][j], M[i-1][j-W[i]]+V[i]);
			else M[i][j]=M[i-1][j];
		}
	}
	cout<<M[n][w];


}


Measured memory_bytes: 82424
import bisect
n, m, k = map(int, input().split())
*A, = map(int, input().split())
*B, = map(int, input().split())
SA, SB = [0], [0]
for i in range(n):
    SA.append(SA[i] + A[i])
for j in range(m):
    SB.append(SB[j] + B[j])
ans = 0
for i in range(n + 1):
    if SA[i] <= k:
        j = bisect.bisect_right(SB, k - SA[i]) - 1
        ans = max(ans, i + j)
print(ans)


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

using namespace std;

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,n) for(int i=1;i<=(int)(n);i++)
#define rep3(i,n) for(int i=0;i<=(int)(n);i++)
#define REP(i,m,n) for(int i=m;i<(int)(n);i++)
#define repll(i,n) for(ll i=0;i<(ll)(n);i++)
#define repll2(i,n) for(ll i=1;i<=(ll)(n);i++)
#define REPLL(i,m,n) for(ll i=m;i<(ll)(n);i++)
#define INF (int)1e9  //
#define LINF (ll)4e18  //
#define MOD (1e9)+7
#define MP make_pair
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl

//------------------------------------------------------

int main() {
    char a, b, c;
    cin >> a >> b >> c;
    Yes(a == c);

    return 0;
}



Measured memory_bytes: 764
#include<bits/stdc++.h>
#define _CRT_SECURE_NO_WARNIGNS
#include <iostream>
#include <cstdio>
#include <vector>
#include <utility>
#include <algorithm>
#include <string>
#include <queue>
#include <stack>
#include <tuple>
#include <set>
#include <map>
#include <functional>
#include <cmath>
#include <cstring>
using namespace std;
#define sci(n) scanf(“%lld”, &(n))
#define scd(n) scanf(“%Ld”, &(n))
using namespace std;
using ll = long long;
const ll mof = 1e9+7;
ll dp[111][8];
int h,w,k;
bool ok(int s)
{
    
    for(int i=1;i<w-1;++i)
    {
        if(((s>>i)&1) && ((s>>(i-1))&1))
            return 0;
    }
    return 1;
}
int main()
{
    cin>>h>>w>>k;
    int nxt;
    dp[0][0] = 1;
    for(int i=1;i<=h;++i)
    {
        for(int pre = 0; pre < w ;pre++)
        {
            for(int x = 0;x < 1<<(w-1) ;++x)
            {
                if(ok(x))
                {
                    bitset<8> bs(x);
                    if(bs.test(pre))
                        nxt = pre + 1;
                    else if(pre > 0 && bs.test(pre-1))
                        nxt = pre - 1;
                    else
                        nxt = pre;
                    dp[i][nxt] += dp[i-1][pre];
                    dp[i][nxt] %= mof;
                }
            }
        }
    }
    cout<<dp[h][k-1]<<endl;
}

Measured memory_bytes: 256
//
//  main.cpp
//  Rainy Season
//
//  Created by Parsa Alimohammadi on 5/31/1399 AP.
//  Copyright © 1399 Parsa Alimohammadi. All rights reserved.
//

#include <iostream>

using namespace std;

string s;
int ans;

int main()
{
    cin >> s;
    for (int i=0; i<3; i++)
    {
        if (s[i] == 'S' && ans > 0)
            break;
        else if (s[i] == 'R')
            ans++;
    }
    
    cout << ans;
    return 0;
}


Measured memory_bytes: 3604
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <string>
#include <cmath>
#include <iomanip>
#include <numeric>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

int main()
{
    string a;
    map<char, int> mp;
    cin >> a;

    ll ans = 1;
    REP(i, a.size())
    {
        ans += i - mp[a[i]];

        mp[a[i]]++;
    }

    cout << ans << endl;

    return 0;
}


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

int main() {
    string S;  cin >> S;
    int sum = 0;
    for (int i = 0; i < S.size(); ++i) sum += S[i] - '0';
    if (sum % 9) cout << "No" << endl;
    else cout << "Yes" << endl;
}


Measured memory_bytes: 3724
#include<iostream>
#include<iomanip>
#include<queue>
#include<string>
#include<stack>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<cassert>
#include<ctime>
#include<algorithm>
#include<utility>
#include<map>
#include<set>
#include<vector>
#include<functional>

using namespace std;

#ifdef DEBUG
#define dprintf      printf
#define dout(x)      cout<<#x" = "<<(x)<<endl
#define darray(x,n)  {int i;rep(i,n)cout<<#x"["<<i<<"] = "<<*((x)+i)<<endl;}
#define dloop(i,s,g) for(int (i)=(s);(i)<(g);(i)++)
#define drep(i,n)    for(int (i)=0;(i)<(n);(i)++)
#define dstop()      scanf("%*c")
#else
#define dprintf      (1)?0:printf
#define dout(x)
#define darray(x,n)
#define dloop(i,s,g) if(int i=0){}else
#define drep(i,n)    if(int i=0){}else
#define dstop()      scanf("")
#endif

#define F    first
#define S    second
#define pb   push_back
#define mp   make_pair

#define loop(i,s,g) for(int (i)=(s);(i)<(g);(i)++)
#define rep(i,n)    for(int (i)=0;(i)<(n);(i)++)
#define all(x)      (x.begin(),x.end())
#define in(T,...) T __VA_ARGS__; impl(__VA_ARGS__);
#define array(T,id,n) T id[n]; rep(i,n)cin>>id[i];

//#define int long long;
#ifndef int
#define INF (0x7fffffff)
#else
#define INF (0x7fffffffffffffff)
#endif

typedef  long long           ll;
typedef  unsigned            ui;
typedef  unsigned long long  ull;
typedef  pair<int,int>       i_i;
typedef  pair<ll,int>        ll_i;
typedef  pair<ll,ll>         ll_ll;
typedef  pair<double,int>    d_i;
typedef  pair<double,double> d_d;

void impl(){};
template <typename T,typename... TS >
void impl(T &head,TS &... tail)
{
  cin>>head;
  impl(tail ...);
}

signed main(void)
{
  in(int,x,t);

  if(x-t>0)
    cout<<x-t<<endl;
  else
    puts("0");
  return 0;
}


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

int main()
{
    //ios_base::sync_with_stdio(false); cin.tie(0);
    int n,lo,hi,l,r,m,len;
    string s;
    cin >> n;
    // First
    cout << 0 << '\n'; cout.flush();
    cin >> s; 
    if(s[0] == 'V') return 0;
    l = (s[0] == 'M');
    // Last
    cout << n-1 << '\n'; cout.flush();
    cin >> s; 
    if(s[0] == 'V') return 0;
    r = (s[0] == 'M');
    // Binary search
    lo = 0; hi = n - 1;
    while(lo <= hi)
    {
        // Try 
        int mid = lo + (hi-lo)/2;
        cout << mid << '\n'; cout.flush();
        cin >> s;
        if(s[0] == 'V') return 0;
        m = (s[0] == 'M');
        // Move
        len = mid - lo + 1;
        if((l == m && len % 2 == 0) || (l != m && len % 2 != 0))
        {
            hi = mid;
            r = m;
        }
        else 
        {
            lo = mid;
            l = m;
        }
    }
    return 0;
}

Measured memory_bytes: 852
n = int(input())
d_list = [0] * n
count = 0
check = False

for i in range(n):
  d_list[i] = int(input())

for i in range(110):
  for j in range(n):
    if d_list[j] == i:
      check = True
  if check == True:
    count += 1
    check = False

print(count)

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

int main() {
  int n;
  cin >> n;
  vector<pair<int, int>> a(n);
  for (auto& e : a) cin >> e.first >> e.second;

  map<pair<int, int>, int> m;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (i == j) continue;
      m[{a[j].first - a[i].first, a[j].second - a[i].second}]++;
    }
  }

  int r = n;
  for (auto e : m) {
    r = min(r, n - e.second);
  }
  cout << r << endl;
}


Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <string>
#include <bitset>
#include <cmath>
#include <iomanip>
#include <stack>
#include <set>
#include <queue>
#include <algorithm>
#include <deque>
using namespace std;

#define INF 1e18
#define int long long

signed main() {
    int x, a; cin >> x >> a;
    cout << (x < a ? 0 : 10) << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <set>
using namespace std;
using ll = long long;

ll dp[205][205];

ll grundy(ll w, ll b) {

	if (dp[w][b] != -1) return dp[w][b];
	set<ll> s;

	if (w - 1 >= 0) s.insert(grundy(w - 1, b));
	if (b - 1 >= 0) s.insert(grundy(w + 1, b - 1));

	for (int i = 1; i <= w; i++) {
		if (b - i >= 0) s.insert(grundy(w, b - i));
	}

	ll g = 0;
	while (s.find(g) != s.end()) g++;

	return dp[w][b] = g;
}

int main() {
	for (int i = 0; i <= 200; i++) {
		for (int j = 0; j <= 200; j++) {
			dp[i][j] = -1;
		}
	}
	for (int i = 0; i <= 100; i++) {
		for (int j = 0; j <= 100; j++) {
			grundy(i, j);
		}
	}

	ll n;
	ll w, b;
	ll x = 0;

	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> w >> b;
		x ^= grundy(w, b);
	}

	if (x != 0) cout << 0 << endl;
	else cout << 1 << endl;
}



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

#define rep(i, a, n)  for(ll i=a; i<n; i++)
#define per(i, a, n)  for(ll i=n-1; i>=a; i--)
#define fill0(n)  setfill('0') << right << setw(n)
#define all(x)  (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define LONGMAX 1e18
#define INTMAX 1000000000
using namespace std;
typedef long long ll;
typedef pair<int,int> p;

int n;
int a[100100];
vector <int> v(100100,0);

int main(){
  cin >> n;
  rep(i,0,n){
    cin >> a[i];
    v[a[i]]++;
    v[a[i]+1]++;
    v[a[i]+2]++;
  }
  cout << *max_element(all(v)) << endl;
}


Measured memory_bytes: 1024
import java.util.*;
public class Main{
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N =sc.nextInt();
    int cnt = 0;
    if(N%2 == 0){
      cnt = N/2;
      System.out.println(cnt);
    }else{
      cnt=(int)(N/2) +1;
      System.out.println(cnt);
    }
    
  }


}


Measured memory_bytes: 21844
//#include <bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <stdio.h>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <time.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second
#define mp make_pair
 
const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll INF = 1ll << 60;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

ll Pow(ll A, ll N){
  if (N == 0) return 1;
  if (N % 2 == 0) return Pow(A * A % MOD, N / 2);
  else return A * Pow(A * A % MOD, N / 2) % MOD;
}

ll M, N;

int main(){
  scanf("%lld%lld", &M, &N);
  printf("%lld\n", Pow(M, N));
  return 0;
}



Measured memory_bytes: 3224
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define ll long long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
static const ll MAX = 1000000000000000;
static const int NIL = -1;
using namespace std;
const long double EPS = 0.0000000001;
const long double PI = (acos(-1));
const int MOD = 1000000007;

int main() {
  int r;
  cin >> r;
  cout << 2 * PI * r << endl;
}


Measured memory_bytes: 3760
H,W=map(int,input().split())

a=[[0]*W for i in range(H)]
b=[[0]*W for i in range(H)]

#print(b)

for i in range(H):
	a[i]=list(input())
#print(a)
    
for j in range(1,W):
	b[0][j]=b[0][j-1]+int(not(a[0][j]==a[0][j-1]))

for i in range(1,H):
	b[i][0]=b[i-1][0]+int(not(a[i-1][0]==a[i][0]))
	for j in range(1,W):
		b[i][j]=min(b[i-1][j]+int(not(a[i-1][j]==a[i][j])),b[i][j-1]+int(not(a[i][j-1]==a[i][j])))

if(a[0][0]=="." and a[H-1][W-1]=="."):
	print(int(b[H-1][W-1]/2))
elif(a[0][0]=="#" and a[H-1][W-1]=="#"):
  print(int(b[H-1][W-1]/2+1))
else:
  print(int((b[H-1][W-1]+1)/2))
#print(int(b[H-1][W-1]/2))


Measured memory_bytes: 3316
#include <iostream>
bool ac(int temp)
{
  if(temp<30)
    return false;
  else
    return true;
}

int main()
{
  int temp;
  std::cin>>temp;
  bool result=ac(temp);
  if(result)
    std::cout<<"Yes";
  else
    std::cout<<"No";
}

Measured memory_bytes: 3128
#include <bits/stdc++.h>
using namespace std;
#define e1 first
#define e2 second
#define pb push_back
#define mp make_pair
#define boost ios_base::sync_with_stdio(false)
#define eb emplace_back
#define OUT(x) {cout << x; exit(0); }
#define REYNA(i,a,b) for(int i=(a);i<(b);++i)
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define scanf(...) scanf(__VA_ARGS__)?:0
typedef long long int ll;
typedef unsigned long long ull;
typedef pair <int, int> PII;
typedef pair <ll, ll> PLL;
typedef pair <PLL, int> PLLI;
typedef pair <PLL, pair <int, ll> > PP;
typedef pair <PII, int> PPI;
typedef pair <int, PII> PIP;
typedef pair <ll, int> PLI;
typedef unsigned int ui;
const int mod = 1e9+7;
const int inf = 1e9+9;
const ll MOD = 1e9+696969;
const long long INF = 1e18+3;
const int maxn = 6010;
string s;

PII tab[6010];
int ca, cb, n;
int kta[6010], ktb[6010];

string best[6010];
int endblock[6010], sadd[6010];
int dp[6010];
string ovbest[6010];

int main()
{
	boost;
	cin >> n >> s;
	int N = 2 * n;
	ca = cb = 0;
	for (int i=0; i<N; ++i)
	{
		if (s[i] == 'a') 
		{
			kta[++ca] = i + 1;
			if (ca <= cb) 
			{
				tab[ca] = mp(ktb[ca], kta[ca]);
				if (ca == cb) endblock[ca] = 1;
			}
		}
		else 
		{
			ktb[++cb] = i + 1;
			if (cb <= ca) 
			{
				tab[cb] = mp(ktb[cb], kta[cb]);
				if (ca == cb) endblock[cb] = 1;
			}
		}
	}

	for (int i=n; i>0; --i) sadd[i] = sadd[i + 1] + (tab[i].e1 < tab[i].e2);
	N = n;
	while (n > 0 && sadd[n] == 0) --n;
	//potem dopisujemy na koncu "ababab" dostatecznie wiele razy
	best[n + 1] = "";
	for (int i=n; i>0; --i)
	{
		if (tab[i].e1 > tab[i].e2)
		{
			best[i] = best[i + 1];
			ovbest[i] = ovbest[i + 1];
			continue;
		}
		
		string cur_string = "";
		int j = i; while (endblock[j] == false) ++j;
		//teraz mam pewien przedzial liter
		vector <pair <int, char> > pp;
		
		for (int k = i; k <= j; ++k)
		{
			pp.push_back(mp(tab[k].e1, 'b'));
			pp.push_back(mp(tab[k].e2, 'a'));
		}
		
		sort(pp.begin(), pp.end());
		for (auto u : pp) cur_string += u.e2;
		cur_string += ovbest[j + 1];
		if (cur_string > ovbest[j + 1]) best[i] = cur_string;
		else best[i] = ovbest[j + 1];
		if (ovbest[i + 1] > best[i]) ovbest[i] = ovbest[i + 1];
		else ovbest[i] = best[i];
	}
	
	string ret = best[1];
	for (int i=2; i<=n; ++i)
		if (best[i] > ret) ret = best[i];
	
	int start = n + 1; n = N;
	for (int i=start; i<=n; ++i) assert(tab[i].e1 > tab[i].e2);
	dp[start] = 1;
	for (int i = start + 1; i <= n; ++i)
		for (int j = start; j < i; ++j)
			if (tab[j].e1 < tab[i].e2) dp[i] = max(dp[i], dp[j] + 1);
	
	int hal = 0;
	for (int i=start; i<=n; ++i) hal = max(hal, dp[i]);
	for (int i=1; i<=hal; ++i) ret += "ab";
	cout << ret;
}


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

int main() {
  string s;
  cin >> s;
  int dp[2019] = {1};
  int num(0), ans(0);
  for (int i = 0; i < s.length(); ++i) {
    num = (num * 10 + s[i] - '0') % 2019;
    int temp[2019];
    for (int j = 0; j < 2019; ++j)
      temp[j * 10 % 2019] = dp[j];
    swap(temp, dp);
    ans += dp[num]++;
  }
  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 3724
#include <stdio.h>

int main() {
	static char s[8];
	int a, b, my, ym;

	scanf("%s", s);
	a = (s[0] - '0') * 10 + (s[1] - '0');
	b = (s[2] - '0') * 10 + (s[3] - '0');
	my = a > 0 && a <= 12;
	ym = b > 0 && b <= 12;
	if (my && ym)
		printf("AMBIGUOUS\n");
	else if (my)
		printf("MMYY\n");
	else if (ym)
		printf("YYMM\n");
	else
		printf("NA\n");
	return 0;
}


Measured memory_bytes: 128
N = int(input())
S,T = map(str,input().split(" "))

list = [0] * (2*N)
for i in range(N):
    list[2 * i] = S[i]
for j in range(N):
    list[2 * j + 1] = T[j]

ans = "".join(list)
print(ans)

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

int main() {
  int h, w, a, b;
  cin >> h >> w >> a >> b;

  vector<vector<int>> s(h, vector<int>(w));
  rep(i, h) rep(j, w) {
    if (i < b && j < a || i >= b && j >= a) s[i][j] = 0;
    else s[i][j] = 1;
  }
  rep(i, h) {
    rep(j, w) cout << s[i][j];
    cout << endl;
  }
  return 0;
}

Measured memory_bytes: 7524
N, M = map(int, input().split())
AB = []
ans = 0

for _ in range(M):
    Ai, Bi = map(int, input().split())
    AB.append((Ai,Bi))

for i in range(M):
    memo = [[] for _ in range(N+1)]
    for j in range(M):
        if i != j:
            memo[AB[j][0]].append(AB[j][1])
            memo[AB[j][1]].append(AB[j][0])
    queue = [1]
    visited = [0] * (N+1)

    while queue:
        node = queue.pop()
        next_nodes = memo[node]
        for next_node in next_nodes:
            if visited[next_node] == 0:
                queue.append(next_node)
        visited[node] = 1

    if sum(visited[1:]) != N:
        ans += 1

print(ans)


Measured memory_bytes: 3064
#include<cstdio>
#include<algorithm>
using namespace std;
int a[101];
int main()
{
	int n,i,j,ans=0,color=0;
	scanf("%d",&n);
	for(i=1;i<=n;i++)	
	{
		scanf("%d",&a[i]);
		color=max(a[i],color);
	}
	color+=1;
	for(i=1;i<=n;i++)
	{
		if(a[i-1]==a[i])
		{
			ans++;
			a[i]=color;
			color++;	
		}
		if(a[i]==a[i+1])
		{
			ans++;
			a[i+1]=color;
			color++;
		}	
	}
	printf("%d",ans);
	return 0;	 
} 

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
const ll M=1e9+7;
char ch[100];
ll power(ll x,ll y){
    ll res=1;
    x=x;
    if(x==0)
        return 0;
    while(y>0){
        if(y&1)
            res=(res*x);
        y=y>>1;
        x=(x*x);
    }
    return res;
}

int main(){
  ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s;
  cin>>s;
      if(s[1]=='B')
        s[1]='R';
    else
        s[1]='B';
    cout<<s<<"\n";
}

Measured memory_bytes: 3652
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<deque>

using namespace std;

#define ull unsigned long long

int n;
vector<ull> v;

int input(){
  cin >> n;
  v.resize(n);
  for( int i = 0; i < n; i++ ){
    cin >> v[i];
  }
  sort(v.begin(), v.end());
  return 0;
}

int run(){
  //for( int i = 0; i < n; i++ ){
  // for( int j = 0; j < n; j++ ){
    
  // }
  //}
  ull ai = v[n-1];
  int t2i = static_cast<int>(lower_bound(v.begin(), v.end(), ai / 2) - v.begin());
  ull t1 = v[t2i-1];
  ull t2 = v[t2i];
  // cout << ai << endl;
  // cout << t2i << endl;
  // cout << t1 << endl;
  // cout << t2 << endl;
  if( t2-(v[n-1]+1)/2 < (v[n-1]/2)-t1 ){
    cout << ai << " " << t2 << endl;
  }else{
    cout << ai << " " << t1 << endl;
  }
  return 0;
}


int main(int argc, char *argv[]){
  input();
  run();
  return 0;
}






Measured memory_bytes: 1024
N = int(input())
A = list(map(int, input().split()))
color = [0 for _ in range(8)]
e = 0

for a in A:
    k = a // 400
    if k < 8 and color[k] == 0:
        color[k] += 1
    elif k >= 8:
        e += 1

c = color.count(1)
y = e + c

if c == 0:
    x = 1
else:
    x = c

print(x, y)


Measured memory_bytes: 3060
#include<stdio.h>

int main() {
	int list[] = {1, 4, 8, 9, 16, 25, 27, 32, 
		36, 49, 64, 81, 100, 121, 125, 128, 
		144, 169, 196, 216, 225, 243, 256, 
		289, 324, 343, 361, 400, 441, 484, 
		512, 529, 576, 625, 676, 729, 784, 
		841, 900, 961, 1000};

	int x, val, i;
	val = scanf("%d", &x);
	if (val == 0) return 1;

	for (i = 0; i < 41; i++) {
		if (list[i] <= x) val = i;
		else break;
	}

	printf("%d", list[val]);
}


Measured memory_bytes: 128
import java.util.*;
// 7
// nikoandsolstice
public class Main {
    public static void main(String args[]) {
        
        Scanner sc = new Scanner(System.in);
       int t = sc.nextInt();
       String s = sc.next();
       String f = "";
       int length = s.length();
       
       for(int i = 0;i<t&& i<s.length();i++){
          f+= s.charAt(i); 
       }
    
  
   if(length>t){
       System.out.print(f+"...");
   }else
   System.out.print(f);
    }
}

Measured memory_bytes: 39744