akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cmath>
#include <algorithm>
#include <deque>
using namespace std;

long long memo[87];


long long ryuka(int n){
  long long ret;
  if(n == 0){
    return 2;
  } else if (n == 1){
    return 1;
  } else if(memo[n] != -1){
    ret = memo[n];
  } else {
    ret = ryuka(n-1) + ryuka(n-2);
    memo[n] = ret;
  }
  return ret;
}


int main(){
  int abcd, a, b, c, d;
  cin >> abcd;
  a = abcd/1000;
  b = abcd/100%10;
  c = abcd/10%10;
  d = abcd %10;
  int i;
  if(b + c + d == 7 - a){
    cout << a << "+" << b << "+" << c << "+" << d << "=7" << endl;
  } else if(b + c - d == 7 - a){
    cout << a << "+" << b << "+" << c << "-" << d << "=7" << endl;
  } else if(b - c + d == 7 - a){
    cout << a << "+" << b << "-" << c << "+" << d << "=7" << endl;
  } else if(b - c - d == 7 - a){
    cout << a << "+" << b << "-" << c << "-" << d << "=7" << endl;
  } else if(-b + c + d == 7 - a){
    cout << a << "-" << b << "+" << c << "+" << d << "=7" << endl;
  } else if(-b + c - d == 7 - a){
    cout << a << "-" << b << "+" << c << "-" << d << "=7" << endl;
  } else if(-b - c + d == 7 - a){
    cout << a << "-" << b << "-" << c << "+" << d << "=7" << endl;
  } else if(-b - c - d == 7 - a){
    cout << a << "-" << b << "-" << c << "-" << d << "=7" << endl;
  } 

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ld long double
int main(){
	int n;
	cin>>n;
	vector<ld> p(n);
	for(auto &x:p){
		cin>>x;
	}
	vector<vector<ld>>dp(n,vector<ld>(n+1,0));
	dp[0][1]=p[0];
	dp[0][2]=1-p[0];
	for(int i{1};i<n;i++){
		for(int j{1};j<=n;j++){
			dp[i][j]=dp[i-1][j]*p[i]+ dp[i-1][j-1]*(1-p[i]);
		}
	}
	
	ld ans = 0;
	int k = n/2;
	for(int i=1;i<=k+1;i++)ans += dp[n-1][i];//cout<<dp[n-1][n];
	cout<<fixed<<setprecision(9)<<ans;
}

Measured memory_bytes: 144024
def abc126e():
    class UnionFind():
        def __init__(self, n):
            self.n = n
            self.parents = [-1] * n

        def find(self, x):
            if self.parents[x] < 0:
                return x
            else:
                self.parents[x] = self.find(self.parents[x])
                return self.parents[x]

        def union(self, x, y):
            x = self.find(x)
            y = self.find(y)

            if x == y:
                return

            if self.parents[x] > self.parents[y]:
                x, y = y, x

            self.parents[x] += self.parents[y]
            self.parents[y] = x

        def size(self, x):
            return -self.parents[self.find(x)]

        def same(self, x, y):
            return self.find(x) == self.find(y)

        def members(self, x):
            root = self.find(x)
            return [i for i in range(self.n) if self.find(i) == root]

        def roots(self):
            return [i for i, x in enumerate(self.parents) if x < 0]

        def group_count(self):
            return len(self.roots())

        def all_group_members(self):
            return {r: self.members(r) for r in self.roots()}

    n, m = map(int, input().split())
    uft = UnionFind(n)

    for _ in range(m):
        x, y, z = map(int, input().split())
        uft.union(x-1, y-1)

    print(uft.group_count())
abc126e()

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

int main(){
    int n;
    cin>>n;
    string s="";
    do{
        if(n%-2==-1){
            n-=1;
            s+="1";
        }else{
            s+= to_string(n%2);
        }
    }while(n/=-2);
    reverse(s.begin(), s.end());
    cout<<s<<endl;
    return 0;
}

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

using namespace std;

int main(int argc, const char *argv[]) {
  string s;
  cin >> s;

  for (int i = 0; i < s.size(); ++i) {
    if (s[i] == '?') {
      s[i] = 'D';
    }
  }

  cout << s << '\n';
  return 0;
}

Measured memory_bytes: 3720
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,c,d,ans=0;
	cin>>a>>b>>c>>d;
	for(int i=0;i<=a;i++)
		for(int j=0;j<=b;j++)
			for(int k=0;k<=c;k++)
				if(i*500+j*100+k*50==d)
					ans++;
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
T1,T2=gets.split.map(&:to_i)
a1,a2=gets.split.map(&:to_i)
b1,b2=gets.split.map(&:to_i)
A1,A2,B1,B2= a1>b1 ? [a1,a2,b1,b2] : [b1,b2,a1,a2]
XA=A1*T1+A2*T2
XB=B1*T1+B2*T2
if XA>XB
  ans="0"
elsif XA==XB
  ans="infinity"
else
  XM=(A1-B1)*T1
  ans=(XM/(XB-XA)*2 + (XM%(XB-XA)==0 ? 0 : 1)).to_s
end
puts ans


Measured memory_bytes: 1788
#include <bits/stdc++.h>
#define REP(i, m, n) for(int (i) = (m); (i) < (n); ++i)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
using namespace std;
using Graph = vector<vector<int>>;
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; }
typedef long long ll;
typedef pair<ll, ll> P;
const int INF = 1e9+7;
const ll LINF = 1LL<<60;

const int MAX_N = 100010;
vector<int> a(MAX_N, 0);


int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    int n, c;
    cin >> n >> c;
    rep(i, n) {
        int s, t, x;
        cin >> s >> t >> x;
        s, t;
        a[s-1]++;
        a[t]--;
    }

    REP(i, 1, MAX_N) {
        a[i] += a[i-1];
    }
    int ans = 0;
    rep(i, MAX_N) {
        if (a[i] > c) a[i] = c;
        chmax(ans, a[i]);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 640
def ABC67_B():
    N, K = LI()
    L = LI()
    L.sort(reverse=True)
    ans = sum(L[:K])
    print(ans)
    return

def examB():
    ans = 0
    print(ans)
    return

def examC():
    ans = 0
    print(ans)
    return

def examD():
    ans = 0
    print(ans)
    return

def examE():
    ans = 0
    print(ans)
    return

def examF():
    ans = 0
    print(ans)
    return

import sys,bisect,itertools,heapq,math,random
from copy import deepcopy
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = 10**(-12)
alphabet = [chr(ord('a') + i) for i in range(26)]

sys.setrecursionlimit(10**6)

if __name__ == '__main__':
    ABC67_B()

"""

"""

Measured memory_bytes: 3956
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

const int limit=5000;

int main(){

	int n;
	char field[limit][5];
	while(cin>>n&&n!=0){
		for(int i = 0; i < limit; i++)
			for(int j = 0; j < 5; j++)
				field[i][j]='0';
		int d,p,q;
		for(int i = 0; i < n; i++){
			cin>>d>>p>>q;
			if(d==1){
				int init=q-1;
				int at=10000000;
				for(int j = init; j < p+init; j++){
					for(int k = 0; k < limit; k++){
						if(field[k][j]=='1'){
							at=min(at,k-1);
							break;
						}
						else if(k==limit-1){
							at=min(at,k);
							break;
						}
					}
				}
				// atÌÀWÌ³ÉubNð¨­
				for(int j = init; j < p+init; j++){
					field[at][j]='1';
				}
			}
			else{
				int at=10000000;
				for(int k = 0; k < limit; k++){
					if(field[k][q-1]=='1'){
						at=k-1;
						break;
					}
					else if(k==4999)
						at=k;
				}
				//ubNð¨­
				for(int j = at; j!=at-p; j--){
					field[j][q-1]='1';
				}
			}

			// ubNÌÁ
			for(int j = 0; j < limit; j++){
				bool f=false;
				for(int k = 0; k < 5; k++){
					if(field[j][k]!='1'){
						f=true;
						break;
					}
				}
				if(!f){
					for(int k = 0; k < 5; k++)
						field[j][k]='0';
					// Á¦½sæèãÉ éubNðº
					for(int k = j-1; k >= 0; k--){
						for(int l = 0; l < 5; l++){
							field[k+1][l]=field[k][l];
						}
					}
				}
			}
			//for(int j = 0; j < 10; j++){
			//	for(int k = 0; k < 5; k++){
			//		cout<<field[j][k]<<flush;
			//	}
			//	cout<<endl;
			//}
			//cout<<endl;
		}
		int cnt=0;
		for(int i = 0; i < limit; i++){
			for(int j = 0; j < 5; j++){
				if(field[i][j]=='1')
					cnt++;
			}
		}
		cout<<cnt<<endl;
	}

	return 0;
}

Measured memory_bytes: 888
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

struct node{
  int key;
  struct node *right;
  struct node *left;
  struct node *parent;
};

typedef struct node *NodePointer;

NodePointer root;
NodePointer nil;

void insert(int k){
  NodePointer y,x,z;
  y=nil;
  x=root;
  z=(NodePointer)malloc(sizeof(struct node));
  z->key=k;
  z->left=nil;
  z->right=nil;

  while(x!=nil){
    y=x;
    if(z->key < x->key)x=x->left;
    else x=x->right;
  }
  z->parent=y;
  
  if(y==nil)root=z;
  else{
    if(z->key < y->key)y->left=z;
    else y->right=z;
  }
}

void inorder(NodePointer u){
  if(u==nil)return;
  inorder(u->left);
  printf(" %d",u->key);
  inorder(u->right);
}

void preorder(NodePointer u){
  if(u==nil)return;
  printf(" %d",u->key);
  preorder(u->left);  
  preorder(u->right);
}

int main(){
  int n,i,x;
  char c[7];
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%s",c);
    if(strcmp(c,"insert")==0){
      scanf("%d",&x);
      insert(x);
    }
    else if(strcmp(c,"print")==0){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
  }
  return 0;
}



Measured memory_bytes: 25160
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")

#include <bits/stdc++.h>

using namespace std;

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
#define ll long long int

int main(){
    int n;
    cin>>n;
    vector<int> a(n);
    for(auto &x:a)cin>>x;
    if(n<=2){
        cout<<"0\n";
        return 0;
    }
    int cnt=0;
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            for(int k=j+1;k<n;k++){
                if(a[i]+a[j]>a[k] && a[j]+a[k]>a[i] && a[k]+a[i]>a[j] && a[i]!=a[j] && a[j]!=a[k] && a[k]!=a[i]){
                    debug(i+1,j+1,k+1);
                    cnt++;
                }
            }
        }
    }
    cout<<cnt<<"\n";
}


Measured memory_bytes: 3628
def getCount(a, b):
	count = 0
	while(True):
		if a < b:
			a = a*2
			count += 1
		else:
			return count

  
def answer(n, k):
    posibility = 0
    if (n >= k):
        posibility = 1/n * (n-k+1)
        for i in range(1, k):
            posibility += ((1)/(n))*((1/2)**(getCount(i, k)))
    else:
        for i in range(1, n+1):
            count = (getCount(i, k))
            posibility += 1/n*((1/2)**(getCount(i, k)))
    return posibility
        
n, k = map(int, input().split())
print(answer(n, k))

Measured memory_bytes: 39280
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include<cstdio>
#include<bits/stdc++.h>
using namespace std;
using ll =long long;

int main (void) {
  int N,M;
  cin >>  N >> M;
  char A[50][50], B[50][50];
  for (int i=0; i<N; i++) {
    for (int j=0; j<N; j++) {
      cin >> A[i][j];
    }
  }
  for (int i=0; i<M; i++) {
    for (int j=0; j<M; j++) {
      cin >> B[i][j];
    }
  }
  
  int ans=0;
  int flag=0;
  
  for (int i=0; i<(N-M)+1; i++) {
      for (int j=0; j<(N-M)+1; j++) {
      flag=1;
        for (int k=0; k<M; k++) {
          for (int l=0; l<M; l++) {
            if (A[i+k][j+l] != B[k][l]) {
              flag=0;
            }
          }
        }
        if (flag==1){
          ans=1;
        }
      }
  }
  cout << (ans? "Yes":"No");
  return 0;
}

Measured memory_bytes: 256
(* 配列版素集合データ構造 *)
module UnionFind : sig
  type t

  module Class : sig
    type t
    val compare : t -> t -> int
  end

  (* n要素の素集合データ構造を作る *)
  val make : int -> t
  (* 要素がどの集合に属するか調べる *)
  (* 要素は0からn-1の整数である必要がある *)
  val find : t -> int -> Class.t
  (* 与えられた集合同士を合併する *)
  (* 破壊的操作であるため注意 *)
  val unite : t -> Class.t -> Class.t -> unit
  (* 与えられた集合に属する要素の数を求める *)
  val cardinal : t -> Class.t -> int
end = struct
  type t = int array

  module Class = struct
    type t = int
    let compare = compare
  end

  let make n = Array.make n (-1)

  let rec find uf x =
    if uf.(x) < 0 then x
    else begin
      let y = find uf uf.(x) in
      uf.(x) <- y; y
    end

  let unite uf x y =
    if x <> y then begin
      let x, y = if uf.(x) <= uf.(y) then x, y else y, x in
      uf.(x) <- uf.(x) + uf.(y);
      uf.(y) <- x
    end

  let cardinal uf x = ~- (uf.(x))
end

let () = Scanf.scanf "%d %d %d\n" @@ fun n m k ->
  let friends = Array.make n 0 in
  let blocks = Array.make n 0 in
  let uf = UnionFind.make n in
  for i = 0 to m - 1 do
    Scanf.scanf "%d %d\n" @@ fun a b ->
      friends.(a - 1) <- 1 + friends.(a - 1);
      friends.(b - 1) <- 1 + friends.(b - 1);
      UnionFind.unite uf (UnionFind.find uf (a - 1)) (UnionFind.find uf (b - 1))
  done;
  for i = 0 to k - 1 do
    Scanf.scanf "%d %d\n" @@ fun c d ->
      if UnionFind.Class.compare (UnionFind.find uf (c - 1)) (UnionFind.find uf (d - 1)) = 0 then begin
        friends.(c - 1) <- 1 + friends.(c - 1);
        friends.(d - 1) <- 1 + friends.(d - 1);
      end
  done;
  for i = 0 to n - 1 do
    Printf.printf "%d " @@ UnionFind.cardinal uf (UnionFind.find uf i) - friends.(i) - blocks.(i) - 1
  done;
  print_newline ()

Measured memory_bytes: 6784
#include <stdio.h>
#include <iostream>
#include <queue>
#include <cstdio>
#include <stack>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <string.h>
#include <limits.h>
#include <map>
#include <string>
#include <bitset>
#include <vector>
using namespace std;
int a[100005];
int main()
{
    long long n,now=1,ans=0;
    cin>>n;
    for(long long i=2;i*i<=n;i++)
    {
        if(n%i==0)
        {
            while(n%i==0)
            {
                a[now]++;
                n/=i;
            }
            now++;
        }
    }
    if(n>1) a[now++]=1;
    for(int i=1;i<now;i++)
    {
        int t=1;
        while(a[i]>=t)
        {
            a[i]-=t;
            ans++;
            t++;
        }
        //cout<<ans<<endl;
    }
    printf("%lld\n",ans);
    return 0;
}


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

using namespace std;

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

    vector<int> vt;
    for (int i = 0; i < s.length(); ++i) {
        if (s[i] == '-') vt.emplace_back(i);
    }

    if (vt.size() == 1 and vt[0] == a) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
function parseInt(s::AbstractString)
    parse(Int, s)
end

function main()
    a,b,c,d = parseInt.(split(readline()))
    while true
        c -= b
        a -= d
        if c <= 0
            println("Yes")
            exit()
        end
        if a <= 0
            println("No")
            exit()
        end
    end
end

main()

Measured memory_bytes: 166872
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ALL(obj)   (obj).begin(),(obj).end()

#define debug(var)  do{std::cout << __LINE__ << "> " << #var << ": ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }

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

using namespace std;
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;

void Main() {
	string S, T; cin >> S >> T;
	int ans = 1e9;
	REP(i,S.length() - T.length() + 1) {
		int match_sum = 0;
		REP(j,T.length()) {
			if (S[i + j] == T[j]) {
				match_sum += 1;
			}
		}
		int tmp = T.length() - match_sum;
		chmin(ans, tmp);
	}
	cout << ans << endl;
}

int main() {
    cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
}


Measured memory_bytes: 3660
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <atcoder/all>
#include <vector>
#include <math.h>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#define PI 3.14159265359
using namespace std;
using namespace atcoder;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pai;
typedef pair<ll, ll> pal;
const int MOD = 1e9+7;
const int MODD = 998244353;
const ll LLINF = 1e18;


int main(){
	int n, m;
	cin >> n >> m;
	vector<ll> a(n), b(m);
	for (int i = 0; i < n; i++) cin >> a[i];
	for (int i = 0; i < m; i++) cin >> b[i];

	vector<ll> c = convolution<MODD>(a, b);
	
	for (auto ans : c) cout << ans << " ";
	cout << endl;
	return 0;
}



Measured memory_bytes: 27280
// dile a la jardinera que traigo flores
// corner cases // int vs ll // cin vs scanf
#include <bits/stdc++.h>
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define sz(x) int(x.size())
#define fill(x,v) memset(x,v,sizeof(x))
#define FER(i,a,b) for(int i = int(a); i < int(b); ++i)
#define trace(x) cout << #x << " = " << x << endl
#define fastio ios_base::sync_with_stdio(0);cin.tie(0)
#define N 450
using namespace std;
typedef long long ll;
typedef pair<int,int> ii;

int n;
ll a[N],sum[N],dp[N][N];

ll get(int i, int j){ return sum[j] - ( i ? sum[i-1] : 0); }

void prec(){
	sum[0] = a[0];
	for(int i = 1; i < n; ++i) sum[i] = a[i] + sum[i-1];
}

int main(){

	fastio;
	cin >> n;
	FER(i,0,n) cin >> a[i];
	FER(i,0,n) dp[i][i] = 0;
	
	prec();
	for(int i = 1; i < n; ++i){
		for(int j = 0; j+i < n; ++j){
			dp[j][i+j] = 4e18;
			for(int k = j; k < i+j; ++k) 
				dp[j][i+j] = min(dp[j][i+j],dp[j][k]+dp[k+1][i+j]);
			dp[j][i+j] += get(j,i+j);
		}
	}
	cout << dp[0][n-1] << endl;
	return 0;
}


Measured memory_bytes: 1664
#include<bits/stdc++.h>
using namespace std;
typedef complex<double> P;
typedef vector<P> vec;

double eps=1e-8;
double PI=acos(-1);

bool eq(double a,double b){return (b-a<eps&&a-b<eps);}
double dot(P a,P b){return real(b*conj(a));}
double cross(P a,P b){return imag(b*conj(a));}
P project(P a,P b,P c){b-=a;c-=a;return a+b*real(c/b);}
P reflect(P a,P b,P c){b-=a;c-=a;return a+conj(c/b)*b;}
int ccw(P a,P b,P c){
  b-=a,c-=a,a=c*conj(b);
  if(a.imag()>eps)return 1;//ccw
  if(a.imag()<-eps)return -1;//cw
  if(a.real()<-eps)return 2;//ob
  if(abs(b)+eps<abs(c))return -2;//of
  return 0;//os
}

//segment ab , point c
double dist(P a,P b,P c){
  if(dot(b-a,c-a)<0)return abs(c-a);
  if(dot(a-b,c-b)<0)return abs(c-b);
  return abs(cross(b-a,c-a))/abs(b-a);
}

bool isintersect(P a,P b,P c,P d){
  return ((ccw(a,b,c)*ccw(a,b,d)<=0)&&(ccw(c,d,a)*ccw(c,d,b)<=0));
}

//segment ab , segment cd
P intersect(P a,P b,P c,P d){
  a-=d;b-=d;c-=d;
  return d+a+(b-a)*imag(a/c)/imag(a/c-b/c);
}

double dist(P a,P b,P c,P d){
  if(isintersect(a,b,c,d))return 0;
  double ab=min(dist(a,b,c),dist(a,b,d));
  double cd=min(dist(c,d,a),dist(c,d,b));
  return min(ab,cd);
}

double calcArea(vec &t){
  double res=0;
  int n=t.size();
  for(int i=0;i<n;i++)res+=cross(t[i],t[(i+1==n?0:i+1)]);
  return abs(res/2.0);
}

double Arg(P a,P b,P c){
  b-=a,c-=a;
  return arg(c*conj(b));
}

int inPolygon(vec &t,P p){
  int n=t.size();
  double sum=0;  
  for(int i=0;i<n;i++){
    P a=t[i],b=t[(i+1==n?0:i+1)];
    if( ccw(a,b,p) == 0 )return 1;// on
    sum+= Arg(p,a,b);
  }
  if( abs(sum) < eps )return 0;//out
  else  return 2;//in
}

int main(){
  int n;
  cin>>n;
  vec t;
  double x,y;
  for(int i=0;i<n;i++){
    cin>>x>>y;
    t.push_back(P(x,y));
  }
  int q;
  cin>>q;
  while(q--){
    cin>>x>>y;
    cout<<inPolygon(t,P(x,y))<<endl;
  }

  return 0;
}

Measured memory_bytes: 1336
($W,$H,$N)=glob<>;
for(1..$N){
    ($w,$h,$a)=glob<>;
    $mw=$mw>$w?$mw:$w if($a==1);
    $W=$W<$w?$W:$w if($a==2);
    $mh=$mh>$h?$mh:$h if($a==3);
    $H=$H<$h?$H:$h if($a==4);
}
$w=$W-$mw<0?0:$W-$mw;
$h=$H-$mh<0?0:$H-$mh;
print$h*$w

Measured memory_bytes: 768
N, A, B = map(int, input().split())
cnt = 0
num = []
for i in range(N+1):
    n = i
    while True:
        cnt += i % 10
        i = i//10
        if i == 0:
            break
    if cnt >= A and cnt <= B:
        num.append(n)
    cnt = 0

print(sum(num))


Measured memory_bytes: 3292
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) begin(v),end(v)
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
using ll = long long;
using pii = pair<int, int>;
constexpr ll INF = 1ll<<30;
constexpr ll longINF = 1ll<<60;
constexpr ll MOD = 1000000007;
constexpr bool debug = 0;
//---------------------------------//

int main() {
	int N, X, Y;
	cin >> N >> X >> Y;
	--X; --Y;
	
	vector<vector<int>> g(N);
	REP(i, N - 1) {
		g[i].emplace_back(i + 1);
		g[i + 1].emplace_back(i);
	}
	g[X].emplace_back(Y);
	g[Y].emplace_back(X);
	
	vector<int> ans(N);
	REP(s, N) {
		queue<int> que;
		vector<int> dist(N, INF);
		que.push(s);
		dist[s] = 0;
		while (!que.empty()) {
			int cur = que.front(); que.pop();
			for (int u : g[cur]) if (chmin(dist[u], dist[cur] + 1)) que.push(u);
		}
		REP(j, N) ++ans[dist[j]];
	}
	
	FOR(i, 1, N) printf("%d\n", ans[i] / 2);
}


Measured memory_bytes: 384
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define LINF (ll)INF*INF
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(int i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

#define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef vector<pii> vp;

int gcd(int a, int b){
    if(b==0) return a;
    return gcd(b,a%b);
}
int lcm(int a, int b){
    return a/gcd(a,b)*b;
}

vector<vi> g;
bool ans = true;
vi used;
void dfs(int now,int t){
    rep(i,g[now].size()){
        if(g[now][i] == t)ans = false;
        if(used[g[now][i]])return;
        used[now]++;
        dfs(g[now][i],t);
    }
}

signed main(void) {
    int m,n;
    cin >> m >> n;
    vector<vp> v(m);
    bool c = true;
    rep(i,m){
        int k;
        cin >> k;
        vp in(n,pii(-1,-1));
        rep(j,k){
            int a,b;
            string s;
            cin >> a >> s >> b;
            a--;
            if(s == ">="){//first
                if(in[a].first == -1) in[a].first = b;
                else in[a].first = max(in[a].first, b);
            }else{//second
                if(in[a].second == -1) in[a].second = b;
                else in[a].second = min(in[a].second, b);
            }
        }
        rep(j,n){
            int l = in[j].first, r = in[j].second;
            if(l != -1 && r != -1 && l > r){
                c = false;
                break;
            }
        }
        v[i] = in;
    }

    if(c == false){
        cout << "No" << endl;
        return 0;
    }

    g = vector<vi>(m);
    rep(i,m)rep(j,m)if(i != j){// i -> j ?
        int c = 0;
        rep(k,n){
            if(v[j][k].second != -1 && v[i][k].first != -1 && v[j][k].second < v[i][k].first){
                if(c == 1) ans = false;
                else c = -1;
            }
            if(v[i][k].second != -1 && v[j][k].first != -1 && v[i][k].second < v[j][k].first){
                if(c == -1)ans = false;
                else c = 1;
            }
        }
        //cout << i << " " << j << " " << c << " " << ans << endl;
        if(c == 1)g[i].push_back(j);//,cout << i << " " << j << endl;
    }
    //グラフの閉路検出
    rep(i,m)if(ans){
        used = vi(m,0);
        used[i]++;
        dfs(i,i);
    }

    if(ans){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}



Measured memory_bytes: 3400
n,m,c= map(int, input().split())
b = list(map(int, input().split()))  # -> li = [1,2,3,...n]
a = []
for i in range(n):
    a.append(list(map(int, input().split())))
p = 0
for i in range(n):
    s = 0
    for j in range(m):
        s += a[i][j] * b[j]
    s += c
    if s > 0:
        p+=1
print(p)

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

int N(), E(), S(), W(), R(), L(), a[6], tmp;

int N(){
	tmp = a[0];
	a[0] = a[1];
	a[1] = a[5];
	a[5] = a[3];
	a[3] = tmp;
	return 0;
}
int E() {
	tmp = a[0];
	a[0] = a[4];
	a[4] = a[5];
	a[5] = a[2];
	a[2] = tmp;
	return 0;
}
int W() {
	tmp = a[0];
	a[0] = a[2];
	a[2] = a[5];
	a[5] = a[4];
	a[4] = tmp;
	return 0;
}
int S() {
	tmp = a[0];
	a[0] = a[3];
	a[3] = a[5];
	a[5] = a[1];
	a[1] = tmp;
	return 0;
}
int R() {
	tmp = a[1];
	a[1] = a[2];
	a[2] = a[3];
	a[3] = a[4];
	a[4] = tmp;
	return 0;
}
int L() {
	tmp = a[1];
	a[1] = a[4];
	a[4] = a[3];
	a[3] = a[2];
	a[2] = tmp;
	return 0;
}

int main(){
	int n, ans, k;
	string input;
	while(cin>>n){
		if (n == 0 ){break; }
		ans = 1;
		a[0] = 1;
		a[1] = 2;
		a[2] = 3;
		a[3] = 5;
		a[4] = 4;
		a[5] = 6;
		for (int i = 0; i < n; i++) {
			cin >> input;
			k = input[0];
			if (k == 78) { N(); }
			else if (k == 83) { S(); }
			else if (k == 69) { E(); }
			else if (k == 87) { W(); }
			else if (k == 82) { R(); }
			else if (k == 76) { L(); }
			ans += a[0];
		}
		cout << ans << endl;

	}
}

Measured memory_bytes: 3168
n=int(input())
p=[int(x) for x in input().rstrip().split()]
cnt=0

for i in range(1,n-1):
  l=p[i-1]
  m=p[i]
  r=p[i+1]
  if l<m<r or r<m<l:
    cnt+=1

print(cnt)

Measured memory_bytes: 3060
def 解():
    iN = int(input())
    iD = 10**9 + 7

    if iN < 3:
        print(iN)
        exit()

    i上限 = int(iN**0.5)+1
    a篩 = [1]*(iN+1)
    d素={}
    for i in range(2,iN+1):
        if a篩[i]:
            d素[i] = 1
            for j in range(i*2,iN+1,i):
                a篩[j] = 0

    for i in range(2,iN+1):
        for i素 in d素:
            while i % i素 == 0:
                d素[i素]+=1
                i //= i素
    iAns = 1
    for i素 in d素:
        iAns *= d素[i素]
        iAns %= iD
    print(iAns)
解()


Measured memory_bytes: 3316
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
	ios_base::sync_with_stdio(false);
	cout << setiosflags(ios::fixed) << setprecision(10);
	int n, m, d;
	cin >> n >> m >> d;
	const double deno = static_cast<double>(n) * n;
	const double nume = static_cast<double>(m - 1) * (n - d) * (d == 0 ? 1.0 : 2.0);
	cout << nume / deno << endl;
	return 0;
}



Measured memory_bytes: 256
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

N = int(input())
A = list(map(int, input().split()))

seq = 0
ans = 0
for i in range(1, N+1):
    if A[i-1] == i:
        seq += 1
    else:
        ans += (seq+1)//2
        seq = 0
ans += (seq+1)//2
print(ans)


Measured memory_bytes: 13876
import java.util.*;
public class Main {
  public static void main(String[] args){

    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();

    if (a == b) {
      if (a == c) {
        System.out.println(1);
      } else {
        System.out.println(2);
      }
    } else if (a == c) {
      if (b == c) {
        System.out.println(1);
      } else {
        System.out.println(2);
      }
    } else {
      if (b == c) {
        System.out.println(2);
      } else {
        System.out.println(3);
      }
    }

  }
}

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

using namespace std;

int A, B, i;
char answer, solution[5000];

stack <int> st;

int main ()
{
    scanf("%d %d", &A, &B);

    if (A <= B)
    {
        printf("Impossible");
        return 0;
    }

    st.push(0);

    for (i = 1; i < A + B; ++i)
    {
        if (st.empty())
        {
            st.push(i);
            continue;
        }
        printf("? %d %d\n", st.top(), i);

        fflush(stdout);

        scanf("\n%c", &answer);

        if (answer == 'N') st.pop();
        else st.push(i);
    }

    int always_right = st.top(), N = 0;



    for (i = 0; i < A + B; ++i)
    {
        if (always_right == i)
        {
            solution[++N] = '1';
            continue;
        }

        printf("? %d %d\n", always_right, i);

        fflush(stdout);

        scanf("\n%c", &answer);

        if (answer == 'Y') solution[++N] = '1';
        else solution[++N] = '0';
    }

    printf("! ");

    for (i = 1; i <= N; ++i)
        printf("%c", solution[i]);

    return 0;
}


Measured memory_bytes: 724
#include<stdio.h>

int main(){
    int x[10];
    int i;
    int max[3]={0};

    for(i=0;i<10;i++){
        scanf("%d",&x[i]);    
    }
    for(i=0;i<10;i++){
        if(max[0]<x[i]){
            if(max[0]>max[1]){
                if(max[1]>max[2]){
                    max[2]=max[1];
                }
                max[1]=max[0];
            }                
            max[0]=x[i];
        }
        else if(max[1]<x[i]){
            if(max[1]>max[2]){
                max[2]=max[1];
            }
            max[1]=x[i];
        }
        else if(max[2]<x[i]) max[2]=x[i];
    }
    for(i=0;i<3;i++){
        printf("%d\n",max[i]);
    }
    return 0;
}

Measured memory_bytes: 600
#include<bits/stdc++.h>
#define pb push_back
using namespace std;
int main()
{
	#define int long long
	int n,k;
	cin >> n >> k;
	int a[n];
	for(int i = 0; i < n; i++)
	cin >> a[i];
	int ans = (n-1)/(k-1);
	if((n-1)%(k-1) != 0)
	ans++;
	cout << ans << "\n";
	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <complex>
#include <cmath>
using namespace std;
typedef complex<double> xy_t;
xy_t P[110];
double dot_product(xy_t a, xy_t b) { return (conj(a)*b).real(); }
double cross_product(xy_t a, xy_t b) { return (conj(a)*b).imag(); }
xy_t projection(xy_t p, xy_t b) { return b*dot_product(p,b)/norm(b); }
int main() {
 double x[4], y[4];
 while (true) {
  for (int i=0; i<4; ++i) cin >> x[i] >> y[i];
  if (!cin) break;
  xy_t a(x[0],y[0]), b(x[1],y[1]), c(x[2],y[2]), p(x[3],y[3]);
  double pab = cross_product(a-p,b-p);
  double pbc = cross_product(b-p,c-p);
  double pca = cross_product(c-p,a-p);
  bool ok = (pab>0 && pbc>0 && pca>0) || (pab<0 && pbc<0 && pca<0);
  cout << (ok ? "YES" : "NO") << endl;
 }
}


Measured memory_bytes: 1220
package main
 
import (
  "fmt"
  "os"
  "bufio"
  "strconv"
  "strings"
)
 
func main() {
  scanner := bufio.NewScanner(os.Stdin)
  scanner.Scan()
  stdInput := scanner.Text()
  valueList := strings.Split(stdInput, " ")
  a, _ := strconv.Atoi(valueList[0])
  b, _ := strconv.Atoi(valueList[1])
  
  if a > b * 2 {
    fmt.Println(a-(2*b))
  } else {
    fmt.Println(0)
  }
}


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

using namespace std;

void judg(int a,int b){

	if(a==1)a+=13;
	if(b==1)b+=13;
	
	if(a==b){
		cout<<"Draw"<<endl;
	}else if(a>b){
		cout<<"Alice"<<endl;
	}else if(b>a){
		cout<<"Bob"<<endl;
	}
}

int main(){

	int alice;
	int bob;

	cin>>alice>>bob;
	
	judg(alice,bob);

	return 0;
}


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


typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef long double ld;

typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;

const int INF = 1e9 + 7;
const int MOD = 1e9 + 7;
const int MAXN = 1e6 + 3;

#define _  %  MOD
#define __ %= MOD

#define      each(it,s)        for(auto it = s.begin(); it != s.end(); ++it)
#define      sortA(v)          sort(v.begin(), v.end())
#define      sortD(v)          sort(v.begin(), v.end(), greater<auto>())
#define      fill(a)           memset(a, 0, sizeof (a))

#define      swap(a,b)        {a=a+b;b=a-b;a=a-b;}
#define      rep(i, n)         for(ll i = 0; i < (n); ++i)
#define      repA(i, a, n)     for(ll i = a; i <= (n); ++i)
#define      repD(i, a, n)     for(ll i = a; i >= (n); --i)
#define watch(x) cout << (#x) << " is " << (x) <<endl

#define fi first
#define se second
#define mp make_pair
#define pb push_back

#define fbo find_by_order
#define ook order_of_key

ll gcd(ll a,ll b){if(b==0) return a; else return gcd(b,a%b);}
ll power(ll x,ll y){ll res=1; while(y>0){if(y&1) res=res*x;y=y>>1;x=x*x;}return res;} // modular exponent

int main()
{
    ios_base::sync_with_stdio(false); // don't use printf and scanf
    cin.tie(NULL); // cout<<fixed<<setprecision
    ll n,m,k;
    cin>>n>>m>>k;
    vector<ll> a(n+1,0),b(m+1,0);
    repA(i,1,n)
    {
      cin>>a[i];
      a[i]+=a[i-1];
    }
    repA(j,1,m)
    {
      cin>>b[j];
      b[j]+=b[j-1];
    }
    ll ans=0;
    repD(i,n,0)
    {
      ll num=0;
      if(a[i]>k) continue;
      ll val=k-a[i];
      num+=(ll)i;
      auto it=lower_bound(b.begin()+1,b.begin()+m+1,val);
      if(it==b.end())
      {
        ans=max(ans,num);
      }
      else
      {
        if(*it==val)
        {
          num+=(it-b.begin());
          ans=max(ans,num);
        }
        else
        {
          it--;
          if(*it==0)
          {
            ans=max(ans,num);
          }
          else
          {
            num+=(it-b.begin());
            ans=max(ans,num);
          }
        }
      }
    }
    cout<<ans<<'\n';
    return 0;
}
// JUST ASK YOURSELF DID YOU GIVE YOUR BEST ? ISSE ZYADA
// KUCH KAR BHI NAHI SAKTE !! ENJOY AND GIVE YOUR BEST!!


Measured memory_bytes: 6364
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#define PB push_back
#define SZ size()
#define REP(a, n) { for(ll i = a; a < n; a++) }
#define GET(a) cin >> a
#define GET2(a, b) cin >> a >> b
#define GET3(a, b, c) cin >> a >> b >> c
#define GETV(v) { for(ll i = 0; i < v.size(); i++) cin >> v[i]; }
#define SHOW(v) cout << v << endl
#define MOD 1000000007
typedef long long ll;

using namespace std;

int main()
{
	int n;
	GET(n);
	
	if(n == 1) {
		SHOW("Hello World");
	}
	else {
		int a, b;
		GET2(a, b);
		
		SHOW(a + b);
	}
	
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;//リストの使用
using System.Collections.Generic;
class Program
{
static long n = long.Parse(Console.ReadLine());//頂点数
static long[,] nextMatrix = new long[n,n];//隣接行列

	static void Main()
	{
    for(long i = 0; i < n; i++)
    {
      for(long j = 0; j < n; j++)
      {
        nextMatrix[i,j] = long.MaxValue;//隣接しない頂点は距離無限と仮定
      }
    }

    for(long i = 0; i < n; i++)
    {
      long[] nums = Array.ConvertAll(Console.ReadLine().Split(' '),long.Parse);
      for(long j = 0; j < nums[1]; j++)
      {
        nextMatrix[i,nums[2*(j+1)]] = nums[2*(j+1)+1];//隣接行列の作成
      }
    }

    Dijkstra();

  }

    static void Dijkstra()
    {
      long minDistance;//更新する頂点の中での最短距離
      long[] distances = new long[n];//最短距離のメモ
      long[] colors = new long[n];//0で未確認、2で最短距離確定

      for(long i = 0; i < n; i++)
      {
        distances[i] = long.MaxValue;
        colors[i] = 0;
      }

      distances[0] = 0;
      colors[0] = 1;
      while(true)
      {
        minDistance = long.MaxValue;
        long minVertex = -1;//最短距離を更新した頂点番号
        for(long i = 0; i < n; i++)
        {
          if(distances[i] < minDistance && colors[i] != 2)
          {
            minVertex = i;
            minDistance = distances[i];
          }
        }

        if(minVertex == -1) break;//最短距離の更新がなかった場合
        colors[minVertex] = 2;
        for(long i = 0; i < n; i++)
        {
          if(colors[i] != 2 && nextMatrix[minVertex,i] != long.MaxValue)//未確定の頂点
          {
            if(distances[i] > distances[minVertex] + nextMatrix[minVertex,i])
            {
              distances[i] = distances[minVertex] + nextMatrix[minVertex,i];
              colors[i] = 1;
            }
          }
        }
      }

      for(long i = 0; i < n; i++)
      {
        Console.WriteLine(i + " " + (distances[i] == long.MaxValue? "-1" : distances[i].ToString()));
      }
      
    }
    
}


Measured memory_bytes: 17932
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i <(n); ++i)
#define ALL(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int,int>;


int main(){
  int a, b, c;
  cin >> a >> b >> c;
  int ans = min({a+b, b+c, c+a});
  cout << ans << endl;

}


Measured memory_bytes: 3632
#include<iostream>
#include<string>
#include<algorithm>
#include<cstring>
using namespace std;
int main() {
    ios_base :: sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //char s1[120], s2[120];
    string s1, s2;
    cin >> s1 >> s2;
    int len1, len2;
    len1 = s1.length();
    len2 = s2.length();
    if(len1>len2){
        cout << "GREATER\n";
    }
    else if(len1<len2){
        cout << "LESS\n";
    }
    else{
        if(s1>s2) cout << "GREATER\n";
        else if(s1<s2) cout << "LESS\n";
        else cout << "EQUAL\n";
    }
    return 0;
}

Measured memory_bytes: 3620
def SelectionSort(A, N):
    cnt = 0
    for i in range(0, N):
      minj = i
      for j in range(i, N):
        if A[j] < A[minj]:
          minj = j
      if i != minj:
        cnt += 1      
      c = A[i]
      A[i] = A[minj]
      A[minj] = c

    for b in range(N):
      print(A[b], end=" \n"[b + 1 == N])
    print(cnt)


N = int(input())
A = list(map(int, input().split()))

SelectionSort(A, N)


Measured memory_bytes: 5608
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) (v).begin(),(v).end()
#define out(a) cout << (a) << endl
using namespace std;
using ll = long long;

int main(){
    int x;
    cin >> x;
    vector<bool> vec(x+1);
    vec[1] = 1;

    for(int i=2; i<=x; i++){
        int v = i*i;
        while(v <= x){
            vec[v] = 1;
            v *= i;
        }
    }
    for (int i=x; i>=1; i--){
        if (vec[i]){
            out(i);
            return 0;
        }
    }
}

Measured memory_bytes: 256
###############################################################################

from sys import stdout
from bisect import bisect_left as binl
from copy import copy, deepcopy
from collections import defaultdict


mod = 1


def intin():
    input_tuple = input().split()
    if len(input_tuple) <= 1:
        return int(input_tuple[0])
    return tuple(map(int, input_tuple))


def intina():
    return [int(i) for i in input().split()]


def intinl(count):
    return [intin() for _ in range(count)]


def modadd(x, y):
    global mod
    return (x + y) % mod


def modmlt(x, y):
    global mod
    return (x * y) % mod


def lcm(x, y):
    while y != 0:
        z = x % y
        x = y
        y = z
    return x


def combination(x, y):
    assert(x >= y)

    if y > x // 2:
        y = x - y

    ret = 1

    for i in range(0, y):
        j = x - i
        i = i + 1

        ret = ret * j
        ret = ret // i

    return ret


def get_divisors(x):
    retlist = []
    for i in range(1, int(x**0.5) + 3):
        if x % i == 0:
            retlist.append(i)
            retlist.append(x // i)
    return retlist


def get_factors(x):
    retlist = []
    for i in range(2, int(x**0.5) + 3):
        while x % i == 0:
            retlist.append(i)
            x = x // i
    retlist.append(x)
    return retlist


def make_linklist(xylist):
    linklist = {}
    for a, b in xylist:
        linklist.setdefault(a, [])
        linklist.setdefault(b, [])
        linklist[a].append(b)
        linklist[b].append(a)
    return linklist


def calc_longest_distance(linklist, v=1):
    distance_list = {}
    distance_count = 0
    distance = 0
    vlist_previous = []
    vlist = [v]
    nodecount = len(linklist)

    while distance_count < nodecount:
        vlist_next = []
        for v in vlist:
            distance_list[v] = distance
            distance_count += 1
            vlist_next.extend(linklist[v])
        distance += 1
        vlist_to_del = vlist_previous
        vlist_previous = vlist
        vlist = list(set(vlist_next) - set(vlist_to_del))

    max_distance = -1
    max_v = None
    for v, distance in distance_list.items():
        if distance > max_distance:
            max_distance = distance
            max_v = v

    return (max_distance, max_v)


def calc_tree_diameter(linklist, v=1):
    _, u = calc_longest_distance(linklist, v)
    distance, _ = calc_longest_distance(linklist, u)
    return distance


###############################################################################


def main():
    d, n = intin()

    if n == 100:
        print(101 * (100**d))
    else:
        print(n * (100**d))


if __name__ == '__main__':
    main()


Measured memory_bytes: 3544
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        // 標準入力の読み込み開始
        Scanner scanner = new Scanner(System.in);

        // 数列の長さ
        int n = scanner.nextInt();

        // 数列
        List<Integer> numList = new ArrayList<Integer>();
        for (int i = 0; i < n; i++) {
            numList.add(scanner.nextInt());
        }

        // 標準入力の読み込み終了
        scanner.close();

        // 処理実行
        
        int flag = 1; // 逆の隣接要素が存在する
        int c = 0; //カウンタ
        while (flag == 1){
            flag = 0;
            for(int j = n-1; j >= 1; j--){
            //for j が N-1 から 1 まで
                if(numList.get(j)<numList.get(j-1)){
                //if A[j] < A[j-1]
                    //A[j] と A[j-1] を交換
                   
                    numList.add(j-1,numList.get(j));
                    numList.remove(j+1);
                    
                    c++;
                    
                    flag = 1;
                }
            }
        }        
        
        for(int i =0; i<n; i++){
	System.out.print(numList.get(i));
	if(i < n-1){
	    System.out.print(" ");
	}
        }
        System.out.println();
        
        System.out.println(c);
    }
}


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

using namespace std;

int main()
{
	int n, l;
	cin >> n >> l;
	vector<string> s(n);
	for (auto&& si : s) cin >> si;
	sort(s.begin(), s.end());
	for (auto&& si : s) cout << si;
	cout << endl;
	return 0;
}


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

int main() {
	char C[2][4] = {};
	
	cin >> C[0] >> C[1];

	if (C[0][0] == C[1][2] && C[0][1] == C[1][1] && C[0][2] == C[1][0])cout << "YES";
	else cout << "NO";
	
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define gc getchar
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(),(x).end()
#define x1 uvuvwevwevwe
#define y1 onyetenyevwe
#define x2 ugwemubwem
#define y2 ossas
typedef long long LL;
typedef long double LD;
typedef pair<int,int> pii;
template <typename T> void scan(T &angka){
	angka=0;char input=gc();T kali=1;
	while(!(48<=input&&input<=57)){	if(input=='-')	kali=-1;input=gc();}
	while(48<=input&&input<=57)	angka=(angka<<3)+(angka<<1)+input-48,input=gc();angka*=kali;
}
template <typename T1,typename T2> void scan(T1 &angka1,T2 &angka2){
	scan(angka1);scan(angka2);
}
const LL mods=1000000007;
int panjang;
string input[2];
LL ans=1;
LL modulo(LL angka){
	if(angka>=mods||angka<=-mods)
		angka%=mods;
	if(angka<0)
		assert(false);
	return angka;
}
int main()
{
	scan(panjang);
	cin>>input[0]>>input[1];
	int tadi=-1;
	//assert(input[0].length()==panjang);
	//assert(input[1].length()==panjang);
	for(int i=0;i<panjang;i++)
	{
		if(input[0][i]==input[1][i])			//kasus 1
		{
			if(tadi==-1)
				ans=modulo((LL) ans*3);
			else if(tadi==1)
				ans=modulo((LL) ans*2);
			else
				ans=modulo((LL) ans*1);
				
			tadi=1;
		}
		else
		{
			if(i!=0&&(input[0][i]==input[0][i-1]))		//kasus 2
			{
				assert(input[1][i]==input[1][i-1]);
				if(tadi==-1)
					ans=modulo((LL) ans*6);
				else if(tadi==1)
					ans=modulo((LL) ans*2);
				else
					ans=modulo((LL) ans*3);
					
				tadi=2;
			}
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
typedef long long ll;
const long long INF = 1LL << 60;
typedef pair<int, int> P;
int main()
{
    int N;
    cin >> N;

    vector<int> ans(N + 1);
    for (int i = 1; i <= 200; i++) {
        for (int j = 1; j <= 200; j++) {
            for (int k = 1; k <= 200; k++) {
                int z = i * i + j * j + k * k + i * j + j * k + k * i;
                if (z <= N && z >= 1) {
                    ans[z]++;
                }
            }
        }
    }

    repd(i, 1, N + 1) cout << ans[i] << endl;
    return 0;
}

Measured memory_bytes: 3568
#include <bits/stdc++.h>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()
#define fi first
#define se second
#define endl "\n"
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

//const ll MOD = 998244353;
const ll MOD = (1e+9) + 7;
const ll INF = 2e+9 + 10;
typedef pair<ll, ll> P;


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

  string s,t; cin >> s >> t;
  sort(ALL(s));
  sort(ALL(t), greater<int>());
  if(s < t) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}


Measured memory_bytes: 256
def get_root(s):
    if s != root[s]:
        root[s] = get_root(root[s])
        return root[s]
    return s

def unite(s, t):
    root_s = get_root(s)
    root_t = get_root(t)
    if not root_s == root_t:
        if rank[s] == rank[t]:
            root[root_t] = root_s
            rank[root_s] += 1
        elif rank[s] > rank[t]:
            root[root_t] = root_s
        else:
            root[root_s] = root_t

def same(s, t):
    if get_root(s) == get_root(t):
        return True
    else:
        return False

n, m = map(int, input().split())
p = list(map(int, input().split()))
root = [i for i in range(n)]
rank = [1 for _ in range(n)]
for _ in range(m):
    x, y = map(int, input().split())
    unite(x - 1, y - 1)
ans = 0
for i in range(n):
    if get_root(i) == get_root(p[i] - 1):
        ans += 1
print(ans)

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

int main()
{
    int a,b;
    cin>>a>>b;
    if(a>b)
    {
        cout<<"safe"<<endl;
    }
    else
    {
        cout<<"unsafe"<<endl;
    }
    return 0;
}

Measured memory_bytes: 3624
#include <iostream>

using namespace std;

int main()
{
	int a, b, c;
	int cnt = 0;
	
	cin >> a >> b >> c;
	for (int i=a; i<=b; i++)
	{
		if (c % i == 0) cnt++;
	}
	cout << cnt << "\n";
	
	return 0;
}

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

A = [0 for _ in range(N)]

for _ in range(K):
  d = int(input())
  L = input().split()
  L = [int(x) for x in L]
  for x in L:
    A[x-1] +=1
c = 0
for x in A:
  if x == 0:
    c +=1
print(c)

Measured memory_bytes: 9188