akhauriyash/Code-Regression huggingface dataset:
S = input()
first = int(S[:2])
second = int(S[2:])
if first >= 1 and first <= 12 and second >= 1 and second <= 12:
    print('AMBIGUOUS')
elif first >= 1 and first <= 12:
    print('MMYY')
elif second >= 1 and second <= 12:
    print('YYMM')
else:
    print('NA')

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i,n) for(ll i=0;i<n;i++)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define fi first
#define se second
#define endl "\n"

template<typename T> inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){int len=d.size();rep(i,len){s<<d[i];if(i<len-1) s<<" ";}return s;}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){int len=d.size();rep(i,len){s<<d[i]<<endl;}return s;}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){s<<"{"<<endl;for(auto itr=m.begin();itr!=m.end();++itr){s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;}s<<"}"<<endl;return s;}

const ll mod=1e9+7;
const ll inf=1e17;
const int INF=1e9;
const double PI=acos(-1);
const double EPS=1e-10;

int main(){
	cin.tie(0);ios::sync_with_stdio(false);
	ll n,x;
	cin>>n>>x;
	vector<ll> a(n+1),b(n+1);
	a[0]=1;
	b[0]=1;
	FOR(i,1,n+1){
		a[i]=2*a[i-1]+3;
		b[i]=2*b[i-1]+1;
	}
	auto dfs=[&](auto &dfs,int level,ll d)->ll{
		if(level==0){
			return 1ll;
		}
		if(d==a[level]){
			return b[level];
		}
		level--;
		if(d==1){
			return 0;
		}
		if(1<d && d<=1+a[level]){
			return dfs(dfs,level,d-1);
		}
		if(d==2+a[level]){
			return 1+b[level];
		}
		return b[level]+1+dfs(dfs,level,d-2-a[level]);
	};
	cout<<dfs(dfs,n,x)<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
struct edge{
  int t;
  int from;
  int to;
  edge(){};
  edge(int t,int from,int to):t(t),from(from),to(to){};
  bool operator<(const edge& other) const {
	return t < other.t;
  }
};

int main(){
  int n,m;
  while(cin >> n >> m && n != 0){
	vector<edge> vec;
	for(int i = 0;i < m;i++){
	  int t,f,to;
	  cin >> t >> f >> to;
	  vec.emplace_back(t,f,to);
	}
	sort(vec.begin(),vec.end());
	vector<bool> infected(n,false);
	infected[0] = true;
	for(int i = 0;i < m;i++){
	  int to,from;
	  to = vec[i].to;
	  from = vec[i].from;
	  if(infected[from-1])infected[to-1] = true;
	}
	int res = 0;
	for(int i = 0;i < n;i++){
	  if(infected[i])res++;
	}
	cout << res << endl;
	
  }

  return 0;
}

Measured memory_bytes: 1680
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

def main():
    s=SI()
    if s[0]==s[-1]:cnt=len(s)-1
    else:cnt=len(s)
    if cnt%2:print("First")
    else:print("Second")

main()

Measured memory_bytes: 3316
#include<bits/stdc++.h>
#include<vector>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
using namespace std;

//ループマクロ
#define FOR(i , a , b)  for(int i = (a) ; i < (b) ; i++)
#define REP(i , n)      for(int i = 0 ; i < n ; i++)
#define REPR(i , n)     for(int i = n ; 0 <= i ; i--)

//入出力
#define SCOUT(x) cout << (x) << " "
#define VECCIN(x) for(auto& ele : (x) ) cin >> ele
#define CEVCOUT(x) for(auto& ele : (x) ) cout << ele << " "; cout << endl;

//その他
#define ALL(obj) (obj).begin() , (obj).end() 
#define P pair<int , int>
#define V vector<int>
#define M map<int>
#define S set<int>
#define PQ priority_queue<int>
#define PQG priority_queue<int , V , greater<int>>

int main(void) {

	ios::sync_with_stdio(false);	cin.tie(0);
	int n, m;	cin >> n >> m;
	int left = 0, right = n;
	for(int i = 0 ; i < m ; i++){
	 int L , R;	cin >> L >> R;
	 left = max(left , L);	right = min(right, R);
	}

	int ans = (right < left) ? 0 : right - left + 1;
	SCOUT(ans) << endl;

	return 0;
}


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

int main(void){
	int n = 0,in;
	int array[][8] ={
		{0,1,1,1,1,1,1}, // 0
		{0,0,0,0,1,1,0},
		{1,0,1,1,0,1,1},
		{1,0,0,1,1,1,1}, // 3
		{1,1,0,0,1,1,0}, // 4
		{1,1,0,1,1,0,1}, // 5
		{1,1,1,1,1,0,1}, // 6
		{0,1,0,0,1,1,1}, // 7
		{1,1,1,1,1,1,1}, // 8
		{1,1,0,1,1,1,1}  // 9
	};
	int box[] = {0,0,0,0,0,0,0};
	while(cin>>n,n!=-1){

		int box[] = {0,0,0,0,0,0,0};
		while(n--){
			cin>>in;
			for(int i = 0 ; i < 7 ; i ++){
				cout<<(box[i] != array[in][i]?1:0);
				box[i] = array[in][i];
			}
			cout<<endl;
		}
	}
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define stoi stoll
using pii=pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
#define all(c) begin(c),end(c)
#define rall(c) rbegin(c),rend(c)
#define fore(x,c) for(auto &&x:c)
#define rep(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define rrep(i, a, n) for(int i=(int)(n-1);i>=a;--i)
#define sz(c) ((int)c.size())
#define contains(c,x) (c.find(x)!=end(c))
#define inseg(l,x,r) ((l)<=(x)&&(x)<(r))
#define dump(...)
#define pb push_back
#define _ 0
const signed INF_=1001001001; const long long INF=1001001001001001001LL;
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) {
    for (auto i = begin(v); i != end(v); i++) os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> istream& operator>>(istream &is,vector<T> &v) {
    for (auto i = begin(v); i != end(v); i++) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
    is>>p.first>>p.second;return is;}
template<class T, class U> bool chmax(T &a,const U &b){return a<b?a=b,1:0;}
template<class T, class U> bool chmin(T &a,const U &b){return a>b?a=b,1:0;}
template <class T> void psum(T& c) {partial_sum(begin(c), end(c), begin(c));}
template<class T> using heap=priority_queue<T,vector<T>,greater<T>>;
struct before_main_function {
    before_main_function() {
        cin.tie(nullptr); ios::sync_with_stdio(0);
        cout << setprecision(15) << fixed;
        // #define endl "\n"
    }
} before_main_function;
//------------------8<------------------------------------8<--------------------

signed main() {
    int A, B;
    cin >> A >> B;
    if (B == 1) {
        cout << 0 << endl;
        return 0;
    }
    
    rep(i, 1, 1000) {
        if (A + (A - 1) * (i - 1) >= B) {
            cout << i << endl;
            return 0;
        }
    }
    return (0^_^0);
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <cstdlib>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <stack>
#include <math.h>
#define rep(i, n) for(int i = 0; i < (n); ++i)
using namespace std;

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 GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
const long long INF = 1LL << 60;
// spring s; cin >> s;
// cout << res << endl;
// --------write my code!!!!!----------//

int main(){
  int A[3];rep(i,3) cin >> A[i];
  sort(A,A+3);
  cout << A[0]+A[1]+10*A[2] << endl; 
  
  

}


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

int main()
{
    int n;cin>>n;
    string s;cin>>s;
    vector<int> sumlefte(n,0);
    int i;
    int ans=1e8;
    if(s.at(0)=='E')sumlefte.at(0)=1;
    for(i=1;i<n;i++)
    {
        if(s.at(i)=='E')sumlefte.at(i)=sumlefte.at(i-1)+1;
        else sumlefte.at(i)=sumlefte.at(i-1);
    }
    vector<int> man(n);
    for(i=1;i<n-1;i++)
    {
        man.at(i)=(i-sumlefte.at(i-1))+(sumlefte.at(n-1)-sumlefte.at(i));
    }
    man.at(0)=sumlefte.at(n-1)-sumlefte.at(0);
    man.at(n-1)=(n-1-sumlefte.at(n-2));
    for(i=0;i<n;i++)ans=(man.at(i)<ans)?man.at(i):ans;
    cout<<ans<<endl;
}


Measured memory_bytes: 3076
#include <cstdio>
#include <climits>
#include <cassert>
#include <cmath>
#include <iostream>
#include <string>
#include <algorithm>
#include <numeric>
#include <functional>
#include <tuple>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <vector>

#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
#define FOR(x,xs) for(auto &x: xs)

using namespace std;
typedef long long ll;
typedef pair<int,int> PI;
typedef pair<ll,ll> PL;
typedef vector<int> VI;
typedef vector<ll> VL;

int main() {
  ios::sync_with_stdio(false);
  string s;
  cin >> s;
  VI cnt(3);
  FOR(c,s) {
    cnt[c-'a']++;
  }
  sort(cnt.begin(), cnt.end());
  cout << (cnt.back() - cnt[0] <= 1 ? "YES" : "NO") << endl;
  
  return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
int main(){

    string N;
    cin >> N;
    long long n = N.size(),i,j,sum=0,c[n];

    for(i = 0; i < n; i++) {
        c[i] = N[i] - '0';
    }
    for(i = 0; i < n-1; i += 1) {

        if (c[i + 1] != 9) {
                c[i] -= 1;
                c[i + 1] = 9;
                break;
            
        }
    }
        for (j = i + 2; j < n; j++) {
            c[j] = 9;
        }


    for(i = 0; i < n; i++){
        sum += c[i];
    }

    cout << sum << endl;
    return 0;
}


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

using namespace std;

int main(){
    int a, b;
    cin >>a>>b;
    int s1 = 0, s2 = 0;

    for(int i=0;i<a;i++){
        s1 *= 10;
        s1 = s1 + b;
    }
    for(int i=0;i<b;i++){
        s2 *= 10;
        s2 = s2 + a;
    }
    cout<< (a<b ? s2 : s1);

}


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

#define IOS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define FILE_WR freopen("../input.txt", "r", stdin);\
	freopen("../output.txt", "w", stdout);
#define deb(x)	cout << #x << " " << x << endl;
#define ll long long int

int main() {

	IOS

	int x, y, a, b, c;
	cin >> x >> y >> a >> b >> c;

	int red[a], green[b], cls[c];

	for (int i = 0; i < a; i++)
		cin >> red[i];

	for (int i = 0; i < b; i++)
		cin >> green[i];

	for (int i = 0; i < c; i++)
		cin >> cls[i];

	sort(red, red+a);
	sort(green, green+b);
	sort(cls, cls+c);

	priority_queue<int> pq;

	for (int i = 0; i < x; i++)
		pq.push(red[a-1-i]);

	for (int i = 0; i < y; i++)
		pq.push(green[b-1-i]);

	for (int i = 0; i < c; i++)
		pq.push(cls[i]);

	ll del = 0;
	for (int i = 0; i < x+y; i++) {
		del += pq.top();
		pq.pop();
	}

	cout << del << endl;

	return 0;
}

Measured memory_bytes: 3572
#include<stdio.h>
#include<string.h>
int main()
{
  char s[3];
  scanf("%s",s);


if((s[0] == s[1] && s[1] != s[3] && s[2] == s[3]) ||
       (s[0] == s[2] && s[1] == s[3] && s[0] != s[3]) ||
       (s[0] == s[3] && s[1] == s[2] && s[3] != s[1]))
{


    printf("Yes");
}

else

    printf("No");


return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
using namespace std;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)

typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, double> Pid;
typedef pair<double, int> Pdi;
const double PI = 3.1415926535897932;   // acos(-1)
const double EPS = 1e-15;
const int INF = 1001001001;
const int mod = 1e+9 + 7;

int n;
vector<ll> a;
// dp[left][right] := 区間 [left,right) におけるコストの最小値
vector<vector<ll>> dp(405, vector<ll>(405, -1));
ll sum[405];

ll memo_rec(int left, int right){
    if(dp[left][right] != -1)   return dp[left][right];
    if(right - left == 1)   return dp[left][right] = a[left];
    if(right - left < 1)    return 0;

    ll res = numeric_limits<ll>::max();
    for(int pos = left + 1; pos < right; ++pos){
        ll tmp = 0;
        if(pos - left > 1)  tmp += memo_rec(left, pos) + sum[pos] - sum[left];
        else    tmp += memo_rec(left, pos);
        if(right - pos > 1) tmp += memo_rec(pos, right) + sum[right] - sum[pos];
        else    tmp += memo_rec(pos, right);
        chmin(res, tmp);
    }
    return dp[left][right] = res;
}

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

    cin >> n;
    a.resize(n);
    for(int i = 0; i < n; ++i){
        cin >> a[i];
        sum[i+1] = sum[i] + a[i];
    }

    cout << memo_rec(0, n) << endl;
}

Measured memory_bytes: 1664
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <set>
#include <sstream>
#include <bitset>
#include <stack>
#include <cstdlib>
#include <utility> //pair

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

typedef long long ll;

using namespace std;

int main() {
    
    ll n;
    cin >> n;
    
    ll ans=0;
    
    vector<ll> a(n);
    FOR(i, 0, n){
        cin >> a[i];
        ans += a[i];
    }
    ans -= n;
    
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
 
int main()
{
  int N, A, B;
  string S;
  cin >> N >> A >> B >> S;

  int a = 0, b = 0;
  REP(i,S.size()){
    if(S.at(i) == 'a' && a+b < A+B){
      cout << "Yes" << endl;
      a++;
    }else if(S.at(i) == 'b' && b < B && a+b < A+B){
      cout << "Yes" << endl;
      b++;
    }else{
      cout << "No" << endl;
    }
  }
}

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

int main() {
  int n, t[20000];

  while(1) {
    cin >> n;
    if (n == 0) break;

    for (int i = 0; i < n; i++) cin >> t[i];

    sort(t, t+n);

    long long tmp = 0, ans = 0;
    for (int i = 0; i < n - 1; i++) {
      tmp += t[i];
      ans += tmp;
    }
    cout << ans << endl;
  }

}

Measured memory_bytes: 3132
#include<stdio.h>
#include<algorithm>
#include<map>
#include<queue>
using namespace std;
int c[8][8];
struct wolf{
	int v[8];
};
inline bool operator<(const wolf&a,const wolf&b){
	for(int i=0;i<8;i++)if(a.v[i]!=b.v[i])return a.v[i]<b.v[i];
	return false;
}
map<wolf,int>ijk;
priority_queue<pair<int,wolf> > Q;
int main(){
	int a;
	scanf("%d",&a);
	for(int i=0;i<a;i++)
		for(int j=0;j<a;j++)
			scanf("%d",&c[i][j]);
	wolf s;
	for(int i=0;i<a;i++)s.v[i]=i;
	Q.push(make_pair(0,s));
	int ret=0;
	while(Q.size()){
		int cost=-Q.top().first;
		wolf now=Q.top().second;
		Q.pop();
		if(ijk.count(now))continue;
		ijk[now]=cost;
		ret=max(ret,cost);
		for(int i=0;i<a;i++)
			for(int j=i+1;j<a;j++){
				int w=now.v[i];
				now.v[i]=now.v[j];
				now.v[j]=w;
				if(!ijk.count(now)){
					Q.push(make_pair(-cost-c[i][j],now));
				}
				w=now.v[i];
				now.v[i]=now.v[j];
				now.v[j]=w;
			}
	}
	printf("%d\n",ret);
	
}

Measured memory_bytes: 22436
S = input()

ans = [-1, -1]
for i in range(len(S) - 1):
    if S[i] == S[i + 1]:
        ans = [i + 1, i + 2]
        break

for i in range(len(S) - 2):
    if len(set(S[i:i + 3])) <= 2:
        ans = [i + 1, i + 3]
        break

print(ans[0], ans[1])


Measured memory_bytes: 3188
#include <bits/stdc++.h>
#define rep(i, n) for(long long int i = 0; i < n; i++)
#define _rep(i, m, n) for(long long int i = m; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
//const int N = 1000000;
const ll mod = 1000000007;
using Graph = vector<vector<int>>;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
 
ll gcd(ll A, ll B){
    if(B == 0)return A;
    return gcd(B, A % B);
}
ll lcm(ll A, ll B){
    return A * B / gcd(A, B);
}
 
/*------------------------------------------------------------------*/
 
int main(){
    ll n; cin >> n;
    vector<ll> a(n);
    rep(i, n){
        cin >> a[i];
        a[i]--;
    }
    ll count = 0;
    rep(i, n){
        if(i == a[a[i]])count++;
    }
    cout << count / 2 << endl;
}

Measured memory_bytes: 1024
#include<iostream>
using namespace std;
#define N 105
#define INF 1<<21
int n;
int a[N][N];
int d[N],p[N],color[N];              //0.未访问的节点   1.正在访问的节点  2.已经访问过的节点 
int prim(){
	int u ,minv;
	for (int i = 0;i < n;i++){
		d[i] = INF;
		p[i] = -1;
		color[i] = 0; 
	}
	d[0] = 0;
	while (1){
		minv = INF;
		u = -1;
		for (int i = 0;i < n;i++){
			if (minv > d[i] && color[i] != 2){
				u = i;
				minv = d[i]; 
			}
		}
		if ( u == -1) break;
		color[u] = 2;
		for (int v = 0;v < n;v++){
			if (color[v] != 2 && a[u][v] != INF){
				if (d[v] > a[u][v]){
					d[v] = a[u][v];
					p[v] = u;
					color[v] = 1;
				}
			}
		}
	}
	int sum = 0;
	for (int i = 0;i < n;i ++){
		if (p[i] != -1){
			sum = sum + a[i][p[i]];
		}
	}
	return sum;
}

int main()
{
	cin >> n;
	int x;
	for (int i = 0;i < n;i++){
		for (int j = 0;j < n;j++){
			cin >> x;
			if (x == -1){
				a[i][j] = INF;
			}
			else{
				a[i][j] = x;
			}
		}
	}
	cout << prim() << endl;
	return 0;
}


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

int main() {
  for (int i = 0; i < 5; i++) {
    int n; cin >> n;
    
    if (n == 0) break;
    int ch = 1000 - n;
    
    int ans = 0;
    if (ch > 0 && ch >= 500) {
      ans += ch / 500;
      ch %= 500;
    }
    if (ch > 0 && ch >= 100) {
      ans += ch / 100;
      ch %= 100;
    }
    if (ch > 0 && ch >= 50) {
      ans += ch / 50;
      ch %= 50;
    }
    if (ch > 0 && ch >= 10) {
      ans += ch / 10;
      ch %= 10;
    }
    if (ch > 0 && ch >= 5) {
      ans += ch / 5;
      ch %= 5;
    }
    if (ch > 0 && ch >= 1) {
      ans += ch / 1;
    }
    
    cout << ans << endl;
  }
}


Measured memory_bytes: 3088
if __name__=="__main__":
  N = int(input())
  A = list(map(int, input().split()))
  B = [A[i]-(i+1) for i in range(N)] 
  sortedB = sorted(B)
  optB = sortedB[int(N/2)]
  print(sum([abs(value-optB) for value in sortedB], 0))

Measured memory_bytes: 28372
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.lang.management.ManagementFactory;
import java.lang.management.ThreadMXBean;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws IOException {

		Scanner scan = new Scanner(System.in);
		// Scanner scan = new Scanner(new
		// File("D:\\UserArea\\J0124567\\Downloads\\ALDS1_3_C-in10.txt"));
		// while (scan.hasNext()) {

		int n = scan.nextInt();

		curb((float) 0, (float) 0, (float) 100, (float) 0, n);
		System.out.println((double) 100 + " " + (double) 0);

		scan.close();
		System.exit(0);
	}

	private static void curb(double x1, double y1, double x2, double y2, int n) {
		if (n == 0) {
			System.out.println(x1 + " " + y1);
			return;
		}

		double r3 = Math.pow(3, 0.5);

		double d1x = x1 + (x2 - x1) / 3;
		double d1y = y1 + (y2 - y1) / 3;
		curb(x1, y1, d1x, d1y, n - 1);

		double d2x = d1x + (x2 - x1) / 6 - (y2 - y1) * r3 / 6;
		double d2y = d1y + (y2 - y1) / 6 + (x2 - x1) * r3 / 6;
		curb(d1x, d1y, d2x, d2y, n - 1);

		double d3x = x1 + (x2 - x1) / 3 * 2;
		double d3y = y1 + (y2 - y1) / 3 * 2;
		curb(d2x, d2y, d3x, d3y, n - 1);

		curb(d3x, d3y, x2, y2, n - 1);

	}

}

Measured memory_bytes: 32424
function main(input) {
  const args = input.split(' ').map(n => parseInt(n, 10));
  const A = args[0];
  const B = args[1];
  
  let t = A + B;
  
  if (t >= 24) {
    console.log(t % 24);
  } else {
    console.log(t);
  }
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 29540
#include <iostream>
#include <climits>
#include <cmath>
#include <cstring>
#include <cctype>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <utility>
#include <sstream>
#include <algorithm>
#include <stack>
#include <set>
#include <list>
#include <map>
#include <queue>
#include <vector>
#include <stdint.h> //uint32_t

typedef long long ll;
typedef double lf;

#define ull unsigned long long

#define FileIn(file) freopen("input.txt", "r", stdin)
#define FileOut(file) freopen("output.txt", "w", stdout)
#define __FastIO ios_base::sync_with_stdio(false); cin.tie(0)

#define For(i, a, b) for (__typeof (a) i=a; i<=b; i++)
#define Rof(i, b, a) for (__typeof (a) i=b; i>=a; i--)
#define Rep(i, n) for (__typeof (n) i=0; i<n; i++)
#define Forit(i, s) for (__typeof ((s).end ()) i = (s).begin (); i != (s).end (); ++i)
#define all(ar) ar.begin(), ar.end()
#define fill(ar, val) memset(ar, val, sizeof(ar))
#define clr(a) memset(a, 0, sizeof a)
#define sfll(a) scanf("%lld", &a)
#define pfll(a) printf("%lld", a)
#define sflf(a) scanf("%lf", &a)
#define pflf(a) printf("%lf", a)
#define sff(a) scanf("%f", &a)
#define pff(a) printf("%f", a)
#define sf(a) scanf("%d", &a)
#define pf(a) printf("%d", a)
#define nl cout << '\n';
#define SP cout << ' ';
#define gc getchar
#define chk cout << "##########\n"
#define debug1(x) cout << #x << ": " << x << endl
#define debug2(x, y) cout << #x << ": " << x << '\t' << #y << ": " << y << endl
#define debug3(x, y, z) cout << #x << ": " << x << '\t' << #y << ": " << y << '\t' << #z << ": " << z << endl

#define PB push_back
#define max(a, b) (a < b ? b : a)
#define min(a, b) (a > b ? b : a)
#define sq(a) a * a
#define INF 0x7fffffff
#define MOD 1000000007
#define PI acos(-1.0)
#define MAX 100000000

using namespace std;

/********************* Code starts here ************************/

int main() {
    __FastIO;
    queue<ll> arr;
    int count{};
    int n{};
    cin >> n;
    for(int i = 1; i <= 9 ;i++) arr.push(i);
    while(count < n){
        ll x = arr.front();
        arr.pop();
        if(x % 10 != 0) arr.push(10 * x + (x % 10) - 1);
        arr.push(10 * x + (x % 10));
        if(x % 10 != 9) arr.push(10 * x + (x % 10) + 1);
        count++;
        if(count == n) cout << x << '\n';
    }
}


Measured memory_bytes: 1792
<?php

fscanf(STDIN, "%d %d", $N, $M);

define('NMAX', 1000);
define('MMAX', 2000);

$a = array();
$b = array();
$c = array();

for ($i = 0; $i < $M; ++$i) {
    fscanf(STDIN, "%d %d %d", $a[$i], $b[$i], $c[$i]);
    $c[$i] = -$c[$i];
}

$dist = array();

for ($i = 0; $i < $N; ++$i) {
    $dist[$i] = PHP_INT_MAX;
}

$dist[0] = 0;

for ($loop = 0; $loop < $N - 1; ++$loop) {
    for ($i = 0; $i < $M; ++$i) {

        if ($dist[$a[$i] - 1] == PHP_INT_MAX) continue;

        if ($dist[$b[$i] - 1] > $dist[$a[$i] - 1] + $c[$i]) {
            $dist[$b[$i] - 1] = $dist[$a[$i] - 1] + $c[$i];
        }
    }
}

$ans = $dist[$N - 1];

$negative = array();

for ($i = 0; $i < $N; ++$i) {
    $negative[$i] = false;
}

for ($loop = 0; $loop < $N ; ++$loop) {
    for ($i = 0; $i < $M; ++$i) {
        if ($dist[$a[$i] - 1] == PHP_INT_MAX) continue;

        if ($dist[$b[$i] - 1] > $dist[$a[$i] - 1] + $c[$i]) {
            $dist[$b[$i] - 1] = $dist[$a[$i] - 1] + $c[$i];
            $negative[$b[$i] - 1] = true;
        }

        if ($negative[$a[$i] - 1] == true) {
            $negative[$b[$i] - 1] = true;
        }
    }
}

if ($negative[$N - 1]) {
    echo "inf" . PHP_EOL;
} else {
    echo -$ans . PHP_EOL;
}


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

void solve(long long A, long long B){
	if (A >= 13) cout << B << endl; else if (A>=6) cout << B/2 << endl; else cout << "0" << endl;
}

int main(){	
	long long B;
	long long A;
	scanf("%lld",&A);
	scanf("%lld",&B);
	solve(A, B);
	return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define dump(a) (cerr << #a << "=" << (a) << endl)
#define DUMP(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }


using namespace std;


bool is_prime[ 5555551 ];
vector<int> P;
void Eratosthenes( const int N )
{
    for( int i = 0; i <= N; i++ )
    {
        is_prime[ i ] = true;//初期化
    }
    for( int i = 2; i <= N; i++ )
    {
        if( is_prime[ i ] )
        {
            for( int j = 2 * i; j <= N; j += i )
            {
                is_prime[ j ] = false;
            }
            P.emplace_back( i );
        }
    }
    is_prime[1] = false;
}

int main() {
    int N;
    cin >> N;
    Eratosthenes(555550);
    int ans[N];
    int ind = 0;
    rep(i, 555551) {
        if (is_prime[i] && i % 5 == 1) {
            ans[ind] = i;
            ind++;
        }
        if (ind == N) {
            break;
        }
    }

    rep(i, N) {
        cout << ans[i] << " ";
    }
    cout << endl << endl;
}

Measured memory_bytes: 1152
import sys
import itertools
import collections


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    n = int(readline())
    xy = []
    for i in range(n):
        a = int(readline())
        for j in range(a):
            x, y = list(map(int, readline().split()))
            xy.append([i, x-1, y])
    ls = collections.deque([v for v in itertools.product([True, False], repeat=n)])
    for i, x, y in xy:
        for j in range(len(ls)):
            lsv = ls.pop()
            if not lsv[i] or lsv[x] == bool(y):
                ls.appendleft(lsv)
    t = 0
    for i in range(len(ls)):
        t = max(t, ls[i].count(True))
    print(t)


if __name__ == '__main__':
    solve()


Measured memory_bytes: 51184
#include <iostream>
#include<cmath>
using namespace std;
int main() {
	int a,b;cin>>a>>b;
	for(int i=1;i<=10000;i++){
		if(floor(i*0.08)==a){
			if(floor(i*0.1)==b){
				cout<<i<<endl;
				return 0;
			}
		}
	}
	cout<<-1<<endl;
	return 0;
}


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

#define ll long long
#define d long double

#define scf(n) scanf("%d",&n)
#define lscf(n) scanf("%lld",&n)
#define dscf(n) scanf("%Lf",&n)
#define pri(n) printf("%d ",(int)n)
#define lpri(n) printf("%lld ",n)
#define dpri(n) printf("%Lf ",n)
#define prin(n) printf("%d\n",(int)n)
#define lprin(n) printf("%lld\n",n)
#define dprin(n) printf("%Lf\n",n)

#define rep(i,ini,n) for(ll i=ini;i<(int)n;i++)
#define all(x) x.begin(),x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define bitcount(n) __builtin_popcount(n)
#define tc   int tt; scf(tt); while(tt--)
#define gcd __gcd
#define inf INT_MAX
#define ninf INT_MIN

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

const ll M =1e9+7;
const int N = 1e6+7;


int main()
{
    ll n;
    lscf(n);
    ll a[n];
    rep(i,0,n)
    lscf(a[i]);

    ll sum=0;
    rep(i,1,n)
    {
        if(a[i]<a[i-1])
        {
            sum+=(a[i-1]-a[i]);
            a[i]=a[i-1];
        }
    }
    lpri(sum);
return 0;
}

Measured memory_bytes: 5296
#include <stdio.h>          // printf(), scanf()
#include <math.h>           // sqrt()
#include <stdbool.h>

#define MAX_V 31623
#define min(a, b) ((a) < (b) ? (a) : (b))

int
main(int argc, char** argv)
{
	int x;
	bool f[MAX_V + 1];
	int i, j;

	scanf("%d", &x);
	printf("%d:", x);

	for (i = 0; i < min(x, MAX_V); ++i)
		f[i] = true;

	int a = x;
	for (i = 2; i <= min(sqrt(x), MAX_V); ++i)
	{
		if (f[i])
		{
			for (j = i + i; j <= min(x, MAX_V); j += i)
				f[j] = false;

			while (a % i == 0)
			{
				a /= i;
				printf(" %d", i);
			}
		}
	}

	if (a != 1)
		printf(" %d", a);

	printf("\n");
	return 0;
}

Measured memory_bytes: 628
MOD = 10**9 + 7


def main():
    N = int(input())
    A = list(map(int, input().split()))
    cnt = [0] * (N//2+1)
    for a in A:
        cnt[(a+1)//2] += 1
    if (N % 2 == 0 and cnt[0] != 0) or (N % 2 == 1 and cnt[0] != 1):
        print(0)
        return
    ans = 1
    for i in range(1, N//2+1):
        if cnt[i] != 2:
            print(0)
            return
        ans = (ans * 2) % MOD
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 52460
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <cassert>

#define SIZE 100005
 
using namespace std;
typedef long long int ll;
typedef pair <int,int> P;
 
using namespace std;


int main()
{	
	ll N;
	scanf("%lld", &N);
	ll A[N], B[N], C[N];
	for(ll i=0;i<N;i++){
		scanf("%lld", &A[i]);
	}
	for(ll i=0;i<N;i++){
		scanf("%lld", &B[i]);
		C[i]=A[i]-B[i];
	}
	
	sort(C,C+N);
	ll sum=0;
	ll hucount=0;
	for(ll i=0;i<N;i++){
		if(C[i]<0){
			sum+=C[i];
			hucount++;
		}
	}
	ll soeji=N-1;
	while((soeji>=0)&&(sum<0))
	{
		sum+=C[soeji];
		soeji--;
	}
	if(soeji==-1){
		printf("%lld", soeji);
	}
	else{
		printf("%lld", N-1-soeji+hucount);
	}

}


Measured memory_bytes: 2432
package main

import (
	"fmt"
	"math"
)

func main() {
	var a, b, c float64

	fmt.Scan(&a, &b, &c)
	s := (a + b + c) / 2
	fmt.Println(int(math.Sqrt(s * (s - a) * (s - b) * (s - c))))
}


Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <map>
using namespace std;

int main(int argc, const char * argv[]) {
    string S, T; cin >> S >> T;
    map<char, char> mp1;
    map<char, char> mp2;
    
    for (int i = 0; i < (int) S.length(); i++) {
        if(mp1.count(S[i]) == 0) {
            mp1[S[i]] = T[i];
        } else if (mp1[S[i]] != T[i]) {
            cout << "No" << endl;
            exit(0);
        }
    }
    
    for (int i = 0; i < (int) S.length(); i++) {
        if(mp2.count(T[i]) == 0) {
            mp2[T[i]] = S[i];
        } else if (mp2[T[i]] != S[i]) {
            cout << "No" << endl;
            exit(0);
        }
    }
    
    cout << "Yes" << endl;

    return 0;
}


Measured memory_bytes: 1020
#include <bits/stdc++.h>
 
//#include <unistd.h>
//#include <iostream>
 
using namespace std;
 
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl;
#define DEBUG_MAT(v) cerr<<#v<<endl;for(int i=0;i<v.size();i++){for(int j=0;j<v[i].size();j++) {cerr<<v[i][j]<<" ";}cerr<<endl;}
typedef long long ll;
#define int ll
 
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
template<class S, class T> pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first + t.first, s.second + t.second); }
template<class S, class T> pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first - t.first, s.second - t.second); }
template<class S, class T> ostream& operator<<(ostream& os, pair<S, T> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
#define X first
#define Y second
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(int i=(n);i>0;i--)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define in(x, a, b) (a <= x && x < b)
#define all(c) c.begin(),c.end()
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a = b; return 1; } return 0; }
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
const ll inf = 1000000001;
const ll INF = (ll)1e18 + 1;
const long double pi = 3.1415926535897932384626433832795028841971L;
#define Sp(p) cout<<setprecision(25)<< fixed<<p<<endl;
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
#define fio() cin.tie(0); ios::sync_with_stdio(false);
const ll MOD = 1000000007;
//const ll MOD = 998244353;
// #define mp make_pair
//#define endl '\n'

signed main() {
  fio();
  int n;
  cin >> n;
  vi p(n), q(n);
  rep (i, n) cin >> p[i];
  rep (i, n) cin >> q[i];

  vi idx(n);
  rep (i, n) idx[i] = i + 1;
  int cnt = 0;
  int pa, pb;
  do {
    if (idx == p) pa = cnt;
    if (idx == q) pb = cnt;
    cnt++;
  } while (next_permutation(all(idx)));
  cout << abs(pa - pb) << endl;
}


Measured memory_bytes: 256
import sys

sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))  #空白なし
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())  #空白あり
def LS2(): return list(sys.stdin.readline().rstrip())  #空白なし

N = I()
A = [0]
for i in range(1,13):
    A.append(A[-1]+26**i)

ANS = []
for i in range(1,12):
    if N > A[i]:
        continue
    else:
        a = N-A[i-1]-1
        for j in range(i):
            ANS.append(a % 26)
            a = (a-a%26)//26
        break

ANS.reverse()

for i in range(len(ANS)):
    ANS[i] = chr(ANS[i]+97)

print(''.join(ANS))

Measured memory_bytes: 61884
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#define rep(i,n) for(int i = 0; i , (n); ++i)
using ll = long long;
using namespace std;
int sum(int n) {
    if (n == 0) {
        return 0;
    }

    int s = sum(n - 1);
    return s + n;
}
int main() {
    ll N, D, a, b, count=0;
    double c;
    cin >> N >> D;
    vector<int>x(N);
    vector<int>y(N);
    for (int i = 0;i < N;i++) {
        cin >> x.at(i) >> y.at(i);
    }
    
    for (int i = 0;i < N;i++) {
        a = x.at(i);
        a *= a;
        b = y.at(i);
        b *= b;
        c = sqrt(a + b);
        if (c <= D) {
            count++;
        }
    }
    cout << count;
}


Measured memory_bytes: 4840
#include <iostream>
#include <utility>
#include <queue>
using namespace std;

int le[200010], ri[200010];
priority_queue<pair<int, int>> pqa, pqb;
int main() {
	int N, a[200010]; cin >> N;
	a[0]=a[N+1]=0;
	for(int i=1; i<=N; ++i) cin >> a[i];
	pqa.push(make_pair(0, 0));
	for(int i=1; i<=N; ++i){
	    while(pqa.top().first>a[i]) pqa.pop();
	    le[i]=pqa.top().second;
	    if(a[i]<a[i+1]) pqa.push(make_pair(a[i], i));
	}
	pqb.push(make_pair(0, N+1));
	for(int i=N; i>0; --i){
	    while(pqb.top().first>a[i]) pqb.pop();
	    ri[i]=pqb.top().second;
	    if(a[i-1]>a[i]) pqb.push(make_pair(a[i], i));
	}
	long ans=0;
	for(int i=1; i<=N; ++i) ans += (long) a[i]*(i-le[i])*(ri[i]-i);
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 4468
#include <iostream>
#include <string>
#define N 1000

std::string num;

bool found(int digit, int& index) {
    digit += '0';
    while (index < num.length()) {
        if (num[index++] == digit) {
            return true;
        }
    }
    return false;
}

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

#if DEBUG_ON
    freopen("input", "r", stdin);
#endif

    int codes[N][3];
    for (int i = 0; i < N; ++i) {
        codes[i][2] = i % 10;
        int temp = i / 10;
        codes[i][1] = temp % 10;
        temp /= 10;
        codes[i][0] = temp % 10;
    }
    int n, res = 0;
    std::cin >> n >> num;
    for (int i = 0; i < N; ++i) {
        int index = 0;
        if (found(codes[i][0], index) && found(codes[i][1], index) && found(codes[i][2], index)) {
            ++res;
        }
    }
    std::cout << res << '\n';
    return 0;
}

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

int main() {
  string test;
  int count;
  cin >> test;
  if(test[0]=='7') count++;
  if(test[1]=='7') count++;
  if(test[2]=='7') count++;
  
  if(count > 0){
    cout << "Yes" <<endl;
  } else {
    cout << "No" <<endl;
  }
}  
  
    
 
 

Measured memory_bytes: 3588
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;


int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    string in;
    cin >> in;
    for(int i=0;i<in.length();i++){
    	if(i%2==0) cout << in[i];
    }
    return 0;
}

Measured memory_bytes: 592
import sys
import  math
import fractions
from collections import defaultdict
stdin = sys.stdin
     
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

N=int(input())

if(N%2==1):
    print(0)
    sys.exit()

else:
    ans=0
    for i in range(1,36):
        ans+=((N//2)//(5**i))
    print(ans)




Measured memory_bytes: 5072
#include<stdio.h>

int main(void)
{
	int height, width;
	int i,j;


	while (1)
	{
		scanf("%d %d", &height, &width);
		/*たてよこ０ならプログラム終了*/
		if (height == 0 && width == 0)
		{
			break;
		}
		for (i = 0; i < height; i++)
		{
			for (j = 0; j < width; j++)
			{
				/*i行目+j列目を2で割っ
				たときの余りで#か.を判定*/
				if ((i + j) % 2 == 0)
				{
					printf("#");
				}
				else
				{
					printf(".");
				}
			}
			printf("\n");   //改行
		}
		printf("\n");   //空行
	}
	return 0;

}


Measured memory_bytes: 2048
# coding: UTF-8
import sys
#sys.setrecursionlimit(n)
import heapq
import re
import bisect
import random
import math
import itertools
from collections import defaultdict, deque
from copy import deepcopy
from decimal import *

n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

count = 0
for i in range(n):
    count += max(a[i] - b[i], 0)
print(count)


Measured memory_bytes: 7752
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;

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

	int a, b, c;
	set<int> s;
	cin >> a >> b >> c;
	s.insert(a);
	s.insert(b);
	s.insert(c);

	cout << s.size();

	return 0;
}



Measured memory_bytes: 256
import itertools
N, M = map(int, input().split())
X = [[int(a) - 1 for a in input().split()] for _ in range(M)]
Y = [[0] * N for _ in range(N)]
for a, b in X:
    Y[a][b] = 1
    Y[b][a] = 1
ans = 0
for A in itertools.permutations(range(1, N)):
    A = [0] + [a for a in A]
    if all([Y[A[i]][A[i+1]] for i in range(N-1)]):
        ans += 1
print(ans)

Measured memory_bytes: 3064
N, K = map(int, input().split())

l = [0 for i in range(N)]

for i in range(K):
    d = int(input())
    A = list(map(int, input().split()))
    for j in range(d):
        a = A[j]
        l[a-1] += 1

print(l.count(0))

Measured memory_bytes: 67500
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <cstring>
#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 <numeric>
#include <float.h>
using namespace std;
// repマクロの定義
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
// allマクロの定義
#define all(v) v.begin(), v.end()
typedef unsigned long long ll;

int my_gcd(int n , int m){
  if(n < m){
    int tmp = n;
    n = m;
    m = tmp;
  }
  int l  = n % m;
  while(l != 0){
    n = m;
    m = l;
    l = n % m;
}
return m;
}



int main(){
int N; cin >> N;
int a = N % 10;
if(a == 3){
  cout << "bon" << endl;
}
else if(a == 0 || a ==1 || a ==6 || a ==8 ){
  cout << "pon" << endl;
}
else{
  cout << "hon" << endl;
}
}

Measured memory_bytes: 3596
import itertools
N = int(input())
P = tuple(map(int, input().split()))
Q = tuple(map(int, input().split()))
for i, a in enumerate(itertools.permutations(range(1, 1+N))):
    if a == P:
        p = i
    if a == Q:
        q = i
        
print(abs(p-q))

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

using namespace std;

#define SZ(x) (int)(x.size())

using ll = long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const double eps = 1e-10;
const ll MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;

template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}

template<typename T1, typename T2>
ostream& operator<<(ostream &os, const pair<T1, T2> p) {
  os << p.first << ":" << p.second;
  return os;
}

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

  int n, p; cin >> n >> p;
  string s; cin >> s;
  vi a(n);
  for(int i=0;i<n;++i) {
    a[i] = s[i] - '0';
  }

  if(p == 2 || p == 5) {
    vvi dp(n+1, vi(p));
    dp[0][0] = 0;
    for(int i=0;i<n;++i) {
      for(int j=0;j<p;++j) {
        int nxt = (j*10+a[i]) % p;
        dp[i+1][nxt] += dp[i][j];
      }
      dp[i+1][a[i]%p]++;
      //printv(dp[i]);
    }
    //printv(dp[n]);
    ll ans = 0;
    for(int i=1;i<=n;++i) {
      ans += dp[i][0];
    }
    cout << ans << endl;
    return 0;
  }

  int now = 1;
  for(int i=n-1;i>=0;--i) {
    a[i] *= now;
    a[i] %= p;
    now *= 10;
    now %= p;
  }

  vll su(n+1);
  for(int i=0;i<n;++i) {
    su[i+1] = su[i] + a[i];
    su[i+1] %= p;
  }

  map<ll, ll> mp;
  mp[0] = 1;
  ll ans = 0;
  for(int i=0;i<n;++i) {
    ans += mp[su[i+1]];
    mp[su[i+1]]++;
  }

  cout << ans << endl;


}


Measured memory_bytes: 12180
H, W = map(int, input().split())
s = [list(input()) for _ in range(H)]
dd = [[0, -1], [-1, 0], [0, 1], [1, 0]]
for i in range(H):
    for j in range(W):
        if s[i][j] == "#":
            for dx, dy in dd:
                nx = j + dx
                ny = i + dy
                if 0 <= nx < W and 0 <= ny < H:
                    if s[ny][nx] == "#":
                        break
            else:
                print("No")
                exit(0)

print("Yes")

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

int main(){
  
  int q, lcs[1010][1010] = {};
  string a, b;
  
  cin >> q;
  for(int i = 0;i < q;i++){
    cin >> a;
    cin >> b;
    
    for(int r = 0;r < a.size();r++){
      for(int c = 0;c < b.size();c++){
        if(a[r] == b[c]) lcs[r + 1][c + 1] = lcs[r][c] + 1;
        else lcs[r + 1][c + 1] = max(lcs[r + 1][c], lcs[r][c + 1]);
      }
    }
    
    cout << lcs[a.size()][b.size()] << endl;
  }
  
  return 0;
}



Measured memory_bytes: 7140
table = list(map(int,input().split()))
 
for i in range(2,0,-1):
    k = 0
    while k < i:
        if table[k] > table[k+1]:
            table[k],table[k+1] = table[k+1],table[k]
        k += 1;
 
 
print(table[0],table[1],table[2])


Measured memory_bytes: 5596
#include <bits/stdc++.h>
#include <ext/rope>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define int long long
#define pb push_back
#define x first
#define y second
#define mk(a,b) make_pair(a,b)
#define rr return 0
#define sqr(a) ((a)*(a))
#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()

using namespace std;
using namespace __gnu_cxx;
using namespace __gnu_pbds;

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

template<class value, class cmp = less<value> >
using ordered_set = tree<value, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
template<class value, class cmp = less_equal<value> >
using ordered_multiset = tree<value, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
template<class key, class value, class cmp = less<key> >
using ordered_map = tree<key, value, cmp, rb_tree_tag, tree_order_statistics_node_update>;

/// find_by_order()
/// order_of_key()
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
inline int randll(int l = INT_MIN, int r = INT_MAX) {
    return uniform_int_distribution<int>(l, r)(rng);
}
const int INF = 1e9, MOD = 1e9 + 7; /// think
const ll LINF = 1e18;


const int dx[] = {0, 0, 1, -1}, dy[] = {1, -1, 0, 0};
inline bool inside (int x, int y, int n, int m) {
    return 0 <= x && 0 <= y && x < n && y < m;
}

template<class T> bool umin (T &a, T b) {return a > b ? (a = b, true) : false; }
template<class T> bool umax (T &a, T b) {return a < b ? (a = b, true) : false; }


main()
{
    ios::sync_with_stdio(0);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    vector <int> a(n);
    for (auto &i : a) cin >> i;
    int cur = 0, ans = 0;
    for (int i = 0; i < n; i++) {
        if (a[i] == cur + 1) {
            ++cur;
        }
        else ++ans;
    }
    if (ans == n) {
        cout << "-1\n";
    }
    else cout << ans << '\n';
}


Measured memory_bytes: 4832
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int d = sc.nextInt();

		int xPrices = b * (int)Math.ceil((double)n / a);
		int yPrices = d * (int)Math.ceil((double)n / c);

		if(xPrices <= yPrices) {
			System.out.println(xPrices);
		} else {
			System.out.println(yPrices);
		}
	}

}



Measured memory_bytes: 26380
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#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() {
  ll N;
  cin >> N;
  int M = 1000000;
  ll ans = 1000000000010;
  for (int i = 1; i <= M; ++i) {
    if (N%i==0) {
      ll temp = i + N/i;
      ans = min(ans, temp);
    }
  }
  cout << ans - 2 << endl;
  return 0;
}

Measured memory_bytes: 3188
#include  <iostream>
#include  <stdio.h>
#include <algorithm>
using namespace std;
#include <vector>
#define rep(i,n) for (int i = 0; i < (n) ; i++)
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define ll long long
#define ull unsigned long long
#define vint vector<int>
#define vll vector<ll>

//#include <stack>
//#include <queue>

/*
#include <math.h>
int standerd = int(pow(10.0,9.0)) + 7;
*/
string ans_Yes = "Yes"; 
string ans_No = "No"; 
string ans_yes = "yes"; 
string ans_no = "no"; 
 
ll N;
ll NN;

int main(){

    cin >> N;

    NN = N * (N-1) / 2 ;
    cout << NN << endl;

}


Measured memory_bytes: 256