akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;

namespace Q1
{
    class Program
    {
        static void Main(string[] args)
        {
            var line = Console.ReadLine().Split(' ').Select(s => double.Parse(s)).ToArray();
            var t = line[0];
            var x = line[1];

            var answer = t / x;

            Console.WriteLine(answer);
        }
    }
}


Measured memory_bytes: 13396
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		Set<String> set = new HashSet<String>();
		String temp ="";
		for (int i=0;i<N;i++) {
			String s = sc.next();
			if (temp.equals("")==false&&s.charAt(0)!=temp.charAt(temp.length()-1)) {
				System.out.println("No");
				return ;
			}
			if (set.contains(s)) {
				System.out.println("No");
				return ;
			}
			set.add(s);
			temp = s;
		}
		System.out.println("Yes");
	}
}

Measured memory_bytes: 35656
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(), a.end()
#define rrng(a) a.rbegin(), a.rend()
#define maxs(x, y) (x = max(x, y))
#define mins(x, y) (x = min(x, y))
#define limit(x, l, r) max(l, min(x, r))
#define lims(x, l, r) (x = max(l, min(x, r)))
#define isin(x, l, r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)), x.end())
#define show(x) cout << #x << " = " << x << endl;
#define PQ(T) priority_queue<T, v(T), greater<T>>
#define bn(x) ((1 << x) - 1)
#define dup(x, y) (((x) + (y)-1) / (y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;

int main() { 
  cin.tie(0);
  ios::sync_with_stdio(false);
  vector<string> d(7);
  d[0] = "remaerd";
  d[1] = "resare";
  d[2] = "maerd";
  d[3] = "esare";
  string s;
  cin >> s;
  reverse(s.begin(),s.end());
  int n =sz(s);
  int r = 0;
  int er = 0;
  while(n!=0){
    rep(i,4){
      int m = sz(d[i]);
      if(n>=m && s.substr(0,m) == d[i]){
        s = s.substr(m);
      }
    }
    if(n == sz(s)){
        cout<<"NO"<<endl;
        return 0;
    }
    n=sz(s);
  }
  cout<<"YES"<<endl;
  return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<vector>
#include<map>
#include<queue>
#include<algorithm>
using namespace std;

	// n > m
bool f(int n,int m,int k){
	for(int i=0;i<=n;++i){
		int a = i*m;
		if(a == k) return true;
		for(int j=0;j<=m;++j){
		//	if(a  + j  * n  -(i*j) == k) return true; 
			if(a  -i*j + j  * (n-i) == k) return true; 
			
		}
	}
	return false;
}


int main(){
	int n,m,k;
	cin >> n >> m >> k;
	if(n * m < k){
		cout << "No" <<endl;
		return 0;
	}
	
	
	
	if(f(n,m,k)) cout << "Yes" <<endl;
	else cout << "No" <<endl;
	
	return 0;
}



Measured memory_bytes: 256
#include<iostream> 
#include <math.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)n; i++) 
 
int main() {
    int N;
    cin >> N;
 
    int ans = 0;
    for (int i = 0; i < N; i++) {
        int l_i, r_i;
        cin >> l_i >> r_i;
        ans += (r_i+1 - l_i);
    }
 
    cout << ans << endl;
}
 

Measured memory_bytes: 3520
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=2008;
int read(){
    int f=1,g=0;char ch=getchar();
    for (;!isdigit(ch);ch=getchar()) if (ch=='-') f=-1;
    for (;isdigit(ch);ch=getchar()) g=g*10+ch-'0';
    return f*g;
}
int n;
int main(){
	n=read();
	if (n==(n&(-n))){puts("No");return 0;}
	puts("Yes");
	for (int i=2;i<n;i+=2)
		printf("1 %d\n1 %d\n",i,i+1);
	printf("%d %d\n",n+1,n+2);
	printf("%d %d\n",n+2,3);
	printf("%d %d\n",2,n+3);
	for (int i=4;i<n;i+=2){
		printf("%d %d\n",i,n+i+1);
		printf("%d %d\n",n+i,i+1);
	}
	if (!(n&1))
	for (int i=2;i<n;i++){
		int j=n^1^i;
		if ((j>1)&&(j<n)){
			printf("%d %d\n",i,n);
			printf("%d %d\n",j,n+n);
			return 0;
		}
	}
	return 0;
}


Measured memory_bytes: 2304
#include <bits/stdc++.h> 
using namespace std;
typedef long long ll;
#define endl "\n"
int arr[100];

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    double x,k,d;
    cin>>x>>k>>d;
    //x-nd=0
    double prod=abs(x)/d;

    if(prod>k){
        if(x<0) cout<<(ll)(abs(x+d*k))<<endl;
        else cout<<(ll)(abs(x-d*k))<<endl;
    }
    else if(ceil(prod)!=floor(prod)){
        if((ll)(k-ceil(prod))%2==0){
            if(x<0) cout<<(ll)(abs(x+d*ceil(prod)))<<endl;
            else cout<<(ll)(abs(x-d*ceil(prod)))<<endl;
        }
        else{
            if(x<0) cout<<(ll)(abs(x+d*floor(prod)))<<endl;
            else cout<<(ll)(abs(x-d*floor(prod)))<<endl;
        }
    }

    else{
        if((ll)(k-prod)%2==0){
            cout<<"0"<<endl;
        }
        else{
            cout<<(ll)d<<endl;
        }
    }
    
}



  
  
    
  
    

    


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

using namespace std;

using LL = long long;

template<typename T>
ostream& operator << (ostream& out, const vector<T>& v) {
    out << "[";
    for(auto& x : v) {
        out << x << ", ";
    }
    return out << "]";
}

template<typename S, typename T>
ostream& operator << (ostream& out, const pair<S, T>& p) {
    return out << "{" << p.first << ", " << p.second << "}";
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    
    int X;
    cin >> X;
    int K = 1;
    while((X * K) % 360) {
        ++K;
    }
    cout << K << "\n";
    
    
    return 0;
} 


Measured memory_bytes: 3612
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <set>
#include <queue>
#include <stack>
using namespace std;
typedef long long int ll;

ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

void P(int x) {cout << x << endl;}
void P(long x) {cout << x << endl;}
void P(double x) {cout << x << endl;}
void P(ll x) {cout << x << endl;}
void P(string x) {cout << x << endl;}
void P(char x) {cout << x << endl;}

#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define drep(i, n) for(int i = n - 1; i >= 0; i--)

const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;

int main() {
  int n, m, x;
  cin >> n >> m >> x;
  vector<vector<int>> v(n);
  vector<int> c(n);
  rep (i, n) {
    cin >> c[i];
    v[i] = vector<int>(m);
    rep (j, m) {
      cin >> v[i][j];
    }
  }
  int loop = pow(2, n);
  int ans = INF;
  rep (i, loop) { // 2^n
    vector<int> check(m);
    int price = 0;
    rep (j, n) { // 参考書
      if (i & (1 << j)) {
        price += c[j];
        rep (k, m) { // 上がる
          check[k] += v[j][k];
        }
      }
    }
    int flag = 1;
    rep (k, m) {
      if (check[k] < x) {
        flag = 0;
        break;
      }
    }
    if (flag == 1) {
      ans = min(ans, price);
    }
  }

  if (ans != INF) P(ans);
  else P(-1);
  return 0;
}

Measured memory_bytes: 3948
#include "bits/stdc++.h"
using namespace std;
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<ll, ll>P;
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 (b<a) { a=b; return 1; } return 0; }
void SAY(bool YES){cout<<(YES?"YES":"NO")<<endl;};
void Say(bool Yes){cout<<(Yes?"Yes":"No")<<endl;};

const ll MOD = 1000000007;

ll S, C;
ll isOK(ll x){
    ll c = C - 2 * x;
    if(c < 0)return 0;
    ll s = S + c / 2;
    if(s < x)return 0;
    return 1;
}

int main(){

    cin >> S >> C;
    ll ng = 1100000000000;
    ll ok = 0;
    while(ok + 1 < ng){
        ll p = (ng + ok) / 2;
        if(isOK(p))ok = p;
        else ng = p;
    }
    cout << ok << endl;

    return 0;
}

Measured memory_bytes: 256
/* template.cpp [[[ */
#include <bits/stdc++.h>
using namespace std;
#define get_macro(a, b, c, d, name, ...) name
#define rep(...) get_macro(__VA_ARGS__, rep4, rep3, rep2, rep1)(__VA_ARGS__)
#define rrep(...) get_macro(__VA_ARGS__, rrep4, rrep3, rrep2, rrep1)(__VA_ARGS__)
#define rep1(n) rep2(i_, n)
#define rep2(i, n) rep3(i, 0, n)
#define rep3(i, a, b) rep4(i, a, b, 1)
#define rep4(i, a, b, s) for (ll i = (a); i < (ll)(b); i += (ll)s)
#define rrep1(n) rrep2(i_, n)
#define rrep2(i, n) rrep3(i, 0, n)
#define rrep3(i, a, b) rrep4(i, a, b, 1)
#define rrep4(i, a, b, s) for (ll i = (ll)(b) - 1; i >= (ll)(a); i -= (ll)s)
#define each(x, c) for (auto &&x : c)
#define fs first
#define sc second
#define all(c) begin(c), end(c)
using ui = unsigned;
using ll = long long;
using ul = unsigned long long;
using ld = long double;
const int inf = 1e9 + 10;
const ll inf_ll = 1e18 + 10;
const ll mod = 1e9 + 7;
const ll mod9 = 1e9 + 9;
const int dx[]{-1, 0, 1, 0, -1, 1, 1, -1};
const int dy[]{0, -1, 0, 1, -1, -1, 1, 1};
template<class T, class U> void chmin(T &x, const U &y){ x = min<T>(x, y); }
template<class T, class U> void chmax(T &x, const U &y){ x = max<T>(x, y); }
struct prepare_ { prepare_(){ cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(12); } } prepare__;
ll in(){ ll x; cin >> x; return x; }
vector<ll> in(size_t n){ vector<ll> v(n); each(x, v) cin >> x; return v; }
/* ]]] */

int n, x, y, z;
ll dp[60][1 << 16];
ll pw10[60];

int dfs(int i, int j){
  auto &res = dp[i][j];
  if (~res) return res;
  if (i == n) return res = 1;
  res = 0;
  rep(k, 1, 11){
    int nj = (j << k) | (1 << (k - 1));
    int f = 1;
    f &= (nj >> (z - 1)) & 1;
    f &= (nj >> (z + y - 1)) & 1;
    f &= (nj >> (z + y + x - 1)) & 1;
    if (f) continue;
    nj &= (1 << (x + y + z - 1)) - 1;
    res += dfs(i + 1, nj);
    res %= mod;
  }
  return res;
}

int main(){
  cin >> n >> x >> y >> z;
  pw10[0] = 1;
  rep(i, 59) pw10[i + 1] = pw10[i] * 10 % mod;
  memset(dp, -1, sizeof(dp));
  cout << (pw10[n] - dfs(0, 0) + mod) % mod << endl;
}


Measured memory_bytes: 30976
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    var temp = readLine()!!.toLong()
    for (i in 1 until n) {
        val t = readLine()!!.toLong()
        temp = koubai(temp, t)
    }
    println(temp)
}


fun koubai(n1: Long, n2: Long): Long {
    var temp: Long
    var m = n1
    var n = n2
    while (m % n != 0L) {
        temp = n
        n = m % n
        m = temp
    }
    return n1 / n * n2
}



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

namespace Algorithm
{
    class Program
    {
        static void Main(string[] args)
        {
            var line = Console.ReadLine().Split().Select(z => int.Parse(z)).ToArray();
            int n = line[0], k = line[1];

            var array = new int[n];
            for (var i = 0; i < n; i++)
            {
                array[i] = int.Parse(Console.ReadLine());
            }
            Array.Sort(array);

            var min = int.MaxValue;
            for (var i = 0; i < n - k + 1; i++)
            {
                min = Math.Min(array[i + k - 1] - array[i], min);
            }

            Console.WriteLine(min);
        }
    }
}

Measured memory_bytes: 17632
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<iomanip>
#include<cmath>
#include<cstring>
#include<functional>
using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
//#define MOD 998244353
#define LINF (long long)4e18
#define jck 3.141592

using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;


int main(){
    int L; cin >> L;
    double k = L/3.0;
    double ans = k*k*k;
    cout << fixed << setprecision(7);
    cout << ans << endl;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int date[1000000];
#define int long long
signed main(){
  int a,b,c;
  cin>>a>>b>>c;
  for(int i=0;i<a;i++){
    if(b!=0){
      date[i]=c;
      b--;
    }
    else if(c!=1) date[i]=c-1;
    else if(c==1) date[i]=c+1;
  }
  for(int i=0;i<a;i++){
    cout<<date[i];
    if(i!=a-1) cout<<" ";
  }
  cout<<"\n";
}


Measured memory_bytes: 1664
#include<queue>
#include<cstdio>

#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

const int INF=1<<29;

struct edge{ int v,cost; };

int main(){
	for(int n,m,c;scanf("%d%d%d",&n,&m,&c),n;){
		vector<edge> G[100];
		rep(i,m){
			int u,v,cost; scanf("%d%d%d",&u,&v,&cost); u--; v--;
			G[u].push_back((edge){v,cost});
		}

		// d[u][i] := ( i 本の辺のコストを 0 にして頂点 u にたどり着いたときの最短距離 )
		static int d[100][1001];
		rep(u,n) rep(i,m+1) d[u][i]=INF;
		d[0][0]=0;
		priority_queue< pair< int,pair<int,int> > > Q; Q.push(make_pair(0,make_pair(0,0)));
		while(!Q.empty()){
			int d_now=-Q.top().first,u=Q.top().second.first,i=Q.top().second.second; Q.pop();
			if(d_now>d[u][i]) continue;
			rep(j,G[u].size()){
				int v=G[u][j].v,cost=G[u][j].cost;
				// 辺のコストを 0 にしない
				if(d[v][i]>d[u][i]+cost){
					d[v][i]=d[u][i]+cost;
					Q.push(make_pair(-d[v][i],make_pair(v,i)));
				}
				// 辺のコストを 0 にする
				if(i<m && d[v][i+1]>d[u][i]){
					d[v][i+1]=d[u][i];
					Q.push(make_pair(-d[v][i+1],make_pair(v,i+1)));
				}
			}
		}

		int ans;
		rep(i,m+1) if(d[n-1][i]<=c) { ans=i; break; }
		printf("%d\n",ans);
	}

	return 0;
}

Measured memory_bytes: 7044
#include    <bits/stdc++.h>
using   namespace   std;
typedef long long ll;

const int MOD = 1000000007;

ll  F(const ll &n, const ll &k, const vector<vector<ll>> &DP) {
    // F(n, k)=F(n-k, k)+F(n, k-1)
    // case 1
        // use full k boxes
        // -> k balls to fill all k boxes and rest: n-k for k boxes
    // case 2
        // not all boxes
        // -> n balls for k-1 boxes
    ll S=0;
    if (n>=k)
        S=DP.at(n-k).at(k);
    if (0<k)
        S +=DP.at(n).at(k-1);
    S %=MOD;
    return S;
}

int main() {
    ll n, k;
    cin >>n >>k;
    // DP for n balls for equall or less than k boxes
    vector<vector<ll>> DP(n+1, vector<ll> (k+1, 0));
    for (ll i=0; i<=k; i++)
        DP.at(0).at(i)=1;
    for (ll i=1; i<=n; i++)
        for (ll j=1; j<=k; j++)
            DP.at(i).at(j) = F(i, j, DP);
    // exact k boxes -> difference between k and k-1
    cout <<(DP.at(n).at(k)-DP.at(n).at(k-1)+MOD)%MOD <<endl;
    return 0;
}



Measured memory_bytes: 10756
N, M, C = map(int,input().split())
B = list(map(int,input().split()))

A = [[0]*M]*N
for i in range(N):
  A[i] = list(map(int,input().split()))
  
def judge(a,b,c):
  sum = 0
  for i in range(len(a)):
    sum += a[i]*b[i]
  sum += c
  if sum > 0:
    return True
  else:
    return False

def solve(n,a,b,c):
  counter = 0
  for i in range(N):
    if judge(a[i],b,c):
      counter += 1
      
  return counter

print(solve(N,A,B,C))
  

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
const int maxn = 501;
int n, c[maxn], s[maxn], f[maxn];
int main(void) {
    std::ios::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    while(cin >> n) {
        for(int i = 0; i < n - 1; ++i)
            cin >> c[i] >> s[i] >> f[i];
        for(int i = 0; i < n; ++i) {
            int ans = 0;
            for(int j = i; j < n - 1; ++j) {
                if(ans < s[j]) ans = s[j];
                else if(ans % f[j] == 0);
                else ans += f[j] - ans % f[j];
                ans += c[j];
            }
            cout << ans << endl;
        }
    }
}


Measured memory_bytes: 256
N, M = gets.split.map(&:to_i)

neighbors = Array.new(N+1){Array.new()}
start, goal = nil, nil
M.times do |i|
    a, b = gets.split.map(&:to_i)
    start ||= a
    goal ||= b
    neighbors[a].push(b)
    neighbors[b].push(a)
end

path = [start, goal]
incl = {start => true, goal => true}
loop do
    start = path[0]
    goal = path[-1]

    s_remain = neighbors[start].reject{|n|incl[n]}
    if s_remain.length > 0
        path.unshift(s_remain[0])
        incl[s_remain[0]] = true
        next
    end

    g_remain = neighbors[goal].reject{|n|incl[n]}
    if g_remain.length > 0
        path.push(g_remain[0])
        incl[g_remain[0]] = true
        next
    end

    puts path.length
    puts path.join(' ')
    exit
end


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

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))
#define rep(i,a,b) for(int (i)=int(a);(i)<int(b);(i)++)
#define rrep(i,a,b) for(int (i)=int(a);(i)>=int(b);(i)--)

#define put(a) cout << (a) << endl
#define puts(a) cout << (a) << " "

#define llint long long int

#define INF (long long)(1e9+1)
#define MOD (long long)(1e9+7)
#define INF64 (long long)(1e18+1)

#define F first
#define S second

#define Pii  pair<int,int>
#define Pll  pair<long long,long long>
#define Piii pair<int,pair<int,int>>
#define Plll pair<long long,pair<long long,long long>>

#define Vll(a,b,c)    vector<vector<long long>> (a)((b),vector<long long>((c))
#define Vlll(a,b,c,d) vector<vector<vector<long long>>> (a)((b),vector<vector<long long>>((c),vector<long long>((d)))

#define MAX_N 1000000

int main (void)
{
  //INPUT
  llint N;
  cin >> N;
	vector<llint> B(N-1);
	rep(i,0,N-1) {
		cin >> B[i];
	}

	vector<llint> A(N);


  //SOLVE
  llint ans;
  ans = 0;

	A[0] = B[0];
	rep(i,1,N-1) {
		A[i] = min(B[i-1],B[i]);
	}
	A[N-1] = B[N-2];


	rep(i,0,N) {
		ans+=A[i];
	}

  //OUTPUT
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
h, w = map(int, input().split())
n = int(input())
a = list(map(int, input().split()))

ans = [[0] * w for _ in range(h)]

num = 0
for x in range(n):
    for y in range(a[x]):
        i = num // w
        if i%2:
            j = w-1 - (num % w)
        else:
            j = num % w
        ans[i][j] = x+1
        num += 1
for i in range(h):
    print(*ans[i])


Measured memory_bytes: 3920
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

int main(){
  ll x;
  cin >> x;
  
  ll ans = 0;
  ans += 2 * (x / 11);
  
  if(0 < x % 11 && x % 11 <= 6)
    ++ans;
  else if(x % 11 > 6)
    ans += 2;
  
  cout << ans << endl;
}

Measured memory_bytes: 256
class Node(object):
    def __init__(self):
        self.id = None
        self.parent = -1
        self.children = None
        self.depth = -1


if __name__ == "__main__":
    n = int(input())
    Nodes = [Node() for _ in range(n)]
    for _ in range(n):
        inputs = list(map(int,input().split()))
        id = inputs[0]
        k = inputs[1]
        chilren = inputs[2:]
        Nodes[id].id = id
        Nodes[id].children = chilren
        for child in chilren:
            Nodes[child].parent = id
    
    root_id = -1
    for node in Nodes:
        if node.parent == -1:
            root_id = node.id
            node.depth = 0

    node_stack = [Nodes[root_id]]
    visit_node_id = {}
    out_str = [""]*n
    while len(node_stack) > 0 or len(visit_node_id) != n:
        node = node_stack.pop()
        visit_node_id[node.id] = 1

        id = node.id
        parent = node.parent
        depth = node.depth
        node_type = ""
        if parent == -1:
            node_type = "root"
        elif node.parent > -1 and len(node.children)>0:
            node_type = "internal node"
        elif node.parent > -1 and len(node.children) == 0:
            node_type = "leaf"
        children = node.children
        out_str[node.id] = "node "+str(id)+": parent = "+str(parent)+", depth = "+str(depth)+", "+node_type+", "+str(children)

        for child in node.children:
            if Nodes[child].id not in visit_node_id:
                Nodes[child].depth = node.depth+1
                node_stack.append(Nodes[child])
    
    for answer in out_str:
        print(answer)


Measured memory_bytes: 55884
#include <iostream>
#include <string>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <map>
#define ll long long
#define PI 3.141592653589793238462643383279502884
using namespace std;

double a,b,h,m;
double an,an1,an2,ans;

int main()
{
    cin>>a>>b>>h>>m;
    an1=h*30+0.5*m;
    an2=6*m;
    an=min(abs(an1-an2),360-abs(an1-an2));
    an=cos((an/180)*PI);
    ans=sqrt(a*a+b*b-2*a*b*an);
    printf("%.20f",ans);
   return 0;
}

Measured memory_bytes: 4292
s = input()
w = 0
b = 0
wa = 0
ba = 0
l = len(s)
 
for i in range(l):
  if s[i] == 'W':
    wa += i - w
    w += 1
  if s[-1-i] == 'B':
    ba += i - b
    b += 1
    
print(min(ba, wa))

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

int main() {
	int a,b;
	char opt;
	while (true) {
		cin >> a >> opt >> b;
		if (opt == '+') cout << a + b << endl;
		else if (opt == '-') cout << a - b << endl;
		else if (opt == '*') cout << a * b << endl;
		else if (opt == '/') cout << a / b << endl;
		else if (opt == '?') break;
	}
}


Measured memory_bytes: 3116
#include<cstdio>
#include<cctype>

int main(){
  char ch;
  int counter[26] = {};

  while ( scanf("%c", &ch) != EOF ){
    if ( isalpha(ch) ){
      int num = tolower(ch) - 'a';
      counter[num]++;
    }
  }

  for ( int i = 0; i < 26; i++ ){
    printf("%c : %d\n", 'a'+i, counter[i]);
  }

  return 0;
}


Measured memory_bytes: 2712
/* Author: shivangi0802 */

#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define pll pair<ll,ll>
#define pb push_back
#define ll long long int
#define mod 1000000007
#define f(i,n) for(int i=0;i<n;i++)

using namespace std;

bool sortbysec(const pair<int,int> &a,
              const pair<int,int> &b);
 ll gcd(ll a, ll b) ;
 int prime(int n);



int main(){
       ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    ll n,k;
    cin>>n;
    k=2;

    vector<ll> h(n),d(n,INT_MAX);

for(int i=0;i<n;i++){
    cin>>h[i];
}
d[0]=0;
for(int i=1;i<n;i++){
    for(int j=max(0LL,i-k);j<i;j++){
        d[i]=min(d[i],d[j]+abs(h[i]-h[j]));
    }
}
cout<<d[n-1];
}




bool sortbysec(const pair<int,int> &a,
              const pair<int,int> &b)
{
    return (a.second < b.second);
}
ll gcd(ll a, ll b) {
    if (b == 0) return a;
    return gcd(b, a % b);
}
int prime(int n){
    int flag=1;
for(int i=2;i<=sqrt(n);i++){
    if(n%i==0){flag=0;break;}
}
  return flag;
}



Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
const int mod=1e9+7;
int ans=1e9;
string s,t;
int main() {
	cin>>s>>t;
	int ls=s.length(),lt=t.length();
	for(int i=lt-1;i<ls;i++){
		int u=0;
		for(int j=i-lt+1,k=0;j<=i;j++,k++)u+=(s[j]!=t[k]);
		ans=min(ans,u);
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 3648
// 'By Anki'
 
#include<bits/stdc++.h>
// #include<iostream>
using namespace std;
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define mp make_pair
#define wr(i) cout<<#i<<" = "<<i<<",  ";
#define wre(i) cout<<#i<<"  =  "<<i<<endl;
#define all(v) v.begin(),v.end()
typedef long long ll;
#define lim 1000000007LL
typedef unsigned long long ull;
#define M 10004
using u64= uint64_t;

int main()
{
fast
ll t=1LL;
// cin>>t;
while(t--)
{
   ll n;
   cin>>n;
   string s;
   map<string,ll>m;
   for(int i=0;i<n;i++){
     cin>>s;
     m[s]++;
   }
   cout<<"AC x "<<m["AC"]<<"\n";
   cout<<"WA x "<<m["WA"]<<"\n";
   cout<<"TLE x "<<m["TLE"]<<"\n";
   cout<<"RE x "<<m["RE"]<<"\n";
}
} 

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

int main() {
 int N;
  cin >> N;
  vector<int> S (N);
  for (int i =0 ;i<N;i++){
    cin >> S.at(i);
  }
  int counter = 1; 
  int a = S.at(0);//次に光るボタン
  for(int i =0;i<N;i++){
    if(a == 2){
        cout << counter << endl;
        return 0;
    }
     counter++;
    a = S.at(a-1);
}
  cout << -1 << endl;
}

Measured memory_bytes: 640
#include <algorithm>
#include <bitset>
#include <cctype>
#include <complex>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
template<class T> inline T sqr(T x) {return x*x;}

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;

#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define mp make_pair
#define each(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define exist(s,e) ((s).find(e)!=(s).end())
#define range(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  range(i,0,n)
#define clr(a,b) memset((a), (b) ,sizeof(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

const double eps = 1e-10;
const double pi  = acos(-1.0);
const ll INF =1LL << 62;
const int inf =1 << 29;

int main(void){
    string in; cin >> in;

    vector< vector<bool> > dp = vector< vector<bool> >(in.size(), vector<bool>(in.size() + 1, false));

    rep(i, in.size()) dp[i][i] = true;

    for(int i = 3; i < in.size() + 1; i += 3){
        rep(j, in.size() - i + 1){
            if(in.at(j) == 'm' && in.at(j + i - 1) == 'w'){
                range(k, 1, i - 1){
                    if(in.at(j + k) == 'e' && dp[j + 1][j + k] && dp[j + k + 1][j + i - 1]){
                        dp[j][j + i] = true;
                    }
                }
            }
        }
    }

    if(dp[0][in.size()]) cout << "Cat" << endl;
    else cout << "Rabbit" << endl;
    
	return 0;
}

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

class Point3D {
public:
	double x, y, z;
};

class Line {
public:
	Point3D begin, end;
};

class Ball {
public:
	Point3D center;
	double r;
	long long int cost;
};

double dot(Point3D a, Point3D b)
{
	return a.x*b.x + a.y*b.y + a.z*b.z;
}

const double EPS = 1e-9;

bool check(Line line, Ball ball)
{
	Point3D v;
	v.x = line.end.x - line.begin.x;
	v.y = line.end.y - line.begin.y;
	v.z = line.end.z - line.begin.z;

	line.begin.x -= ball.center.x;
	line.begin.y -= ball.center.y;
	line.begin.z -= ball.center.z;
	line.end.x -= ball.center.x;
	line.end.y -= ball.center.y;
	line.end.z -= ball.center.z;
	ball.center.x = 0;
	ball.center.y = 0;
	ball.center.z = 0;

	double t = -dot(line.begin, v) / dot(v, v);
	Point3D near;
	near.x = line.begin.x + v.x*t;
	near.y = line.begin.y + v.y*t;
	near.z = line.begin.z + v.z*t;

	//cout << dot(near, near) << " " << ball.r*ball.r << endl;

	if ((t >= 0 || fabs(t) <= EPS) && (t <= 1 || fabs(t - 1) <= EPS)) {
		if (dot(near, near) <= ball.r*ball.r || dot(near, near) - ball.r*ball.r <= EPS) {
			return true;
		}
	}

	return false;
}

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

	vector<Ball> balls(N);

	for (int i = 0; i < N; i++) {
		cin >> balls[i].center.x >> balls[i].center.y >> balls[i].center.z >> balls[i].r >> balls[i].cost;
	}

	for (int i = 0; i < Q; i++) {
		long long int ans = 0;
		Line line;

		cin >> line.begin.x >> line.begin.y >> line.begin.z >> line.end.x >> line.end.y >> line.end.z;

		for (int j = 0; j < N; j++) {
			if (check(line, balls[j]) == true) {
				ans += balls[j].cost;
			}
		}

		cout << ans << endl;
	}

	return 0;
}

Measured memory_bytes: 3228
#include <bits/stdc++.h>
using namespace std;
int main () {
	string s1,s2;
	cin >> s1 >> s2;
	char tmp = s1[0];
	s1[0] = s1[2];
	s1[2]  = tmp;
	if(s1 == s2){
		cout << "YES" << endl;
	}else{
		cout << "NO" << endl;
	}
}

Measured memory_bytes: 256
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,sqrt,factorial,hypot,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from fractions import gcd
from random import randint
def ceil(a,b): return (a+b-1)//b
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    N,M=MI()
    X=LI()
    d = defaultdict(int)
    double = defaultdict(int)
    for x in X:
        d[x%M] += 1
        double[x] += 1
    ans = 0
    for x in X:
        x = x%M
        if d[x]>=1 and d[(M-x)%M]>=1:
            if x==(M-x)%M and d[x]<2:
                continue
            ans += 1
            d[x]-=1
            d[(M-x)%M]-=1
    for x in X:
        ori_x = x
        x = x%M
        if double[ori_x]>=2 and d[x]>=2:
            ans += 1
            d[x]-=2
            double[ori_x]-=2
    print(ans)
if __name__ == '__main__':
    main()

Measured memory_bytes: 99288
import java.util.Scanner;
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 < c){
      System.out.println("No");
    }else{
      System.out.println("Yes");
    }
  }
}

Measured memory_bytes: 22612
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <complex>
#include <stack>
using namespace std;

int main(){
    int n;
    int k;
    int s = 0;
    cin >> n;
    k = n;
    while(k != 0){
        s += k % 10;
        k /= 10;
    }
    if(n % s == 0){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
N,M = map(int, input().split())

ab = []
for i in range(M):
    a,b = map(int, input().split())
    ab.append((a,b))

ab.sort()


ans = 1
l = 1
r = N
for a,b in ab:
    if a < r:
        l = a
        r = min(r,b)
    else:
        ans += 1
        l = a
        r = b
print(ans)
        

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

int main(){

    int x1,x2,x3,x4,x5;

    cin >> x1 >> x2 >> x3 >> x4 >> x5;

    if(x1 == 0){
        cout << "1" << endl;
    }
    if(x2 == 0){
        cout << "2" << endl;
    }
    if(x3 == 0){
        cout << "3" << endl;
    }
    if(x4 == 0){
        cout << "4" << endl;
    }
    if(x5 == 0){
        cout << "5" << endl;
    }
}



Measured memory_bytes: 3584
#include<cstdio>
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstring>
using namespace std;

int main(){
  int n;
  cin>>n;
  vector<int> vc(n);	
  for(int i=0;i<n;i++)
  cin>>vc[i];
  int ans = 0,q,a;
  cin>>q;
  sort(vc.begin(),vc.end());
  while(q--){
  cin>>a; 
  
  if(binary_search(vc.begin(),vc.end(),a))
  ans++;
  
}
printf("%d\n",ans);	
	
}


Measured memory_bytes: 3272
using System;
class p
{
  static void Main()
  {
    string[] ipt = Console.ReadLine().Split(' ');
    string S = ipt[0];
    string T = ipt[1];
    ipt = Console.ReadLine().Split(' ');
    int A = int.Parse(ipt[0]);
    int B = int.Parse(ipt[1]);
    string U = Console.ReadLine();
    if (S == U) { A--; }
    else { B--; }
    Console.WriteLine(A.ToString() + " " + B.ToString());
  }
}

Measured memory_bytes: 11092
#include<iostream>
#include<unordered_map>
#include<bitset>
#include<math.h>
#include<vector>
#include<set>
#include<algorithm>
#include<ctype.h>
#include<unordered_set>
#include<string>
#include<iomanip>
#include<queue>
#include<limits>
#include<map>
#include<stack>
#include<iterator>
#include<cstring>
 
#include<deque>
#define pi 3.141592653589793238
#include<chrono>
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#define MOD 1000000007
#define INF 999999999999999999 
#define pb push_back
#define ff first
#define ss second
 
#define mt make_tuple
#define ll long long
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>

using namespace __gnu_pbds;
 
 
typedef tree<ll, null_type, less_equal<ll>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
 
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    fast;
    ll T = 1, i, j;
    
    //cin >> T;
    while (T--) {
        ll n;
        string s;
        cin >> s;
        n = s.size();
        vector<vector<ll>> dp(n + 1, vector<ll>(13));
        dp[0][0] = 1;
        for(i = 0; i < n; i++){
            if(s[i] == '?'){
                for(j = 0; j < 13; j++){
                    for(ll k = 0; k <= 9; k++){
                        dp[i + 1][(10 * j + k) % 13] += dp[i][j];
                        dp[i + 1][(10 * j + k) % 13] %= MOD;
                        
                    }
                }
            }
            else{
                ll curr = s[i] - '0';
                for(j = 0; j < 13; j++){
                    dp[i + 1][(10 * j + curr) % 13] += dp[i][j];
                    dp[i + 1][(10 * j + curr) % 13] %= MOD;
                }
            }
        }
        cout << dp[n][5];
    }
    return 0;
}

Measured memory_bytes: 16664
#pragma GCC optimize("O3")
#include <bits/stdc++.h>

using namespace std;

typedef int64_t  ll;
typedef uint64_t ull;

#define rep(i,n)   for (int i = 0; i < (n); i++)
#define rrep(i,n)  for (int i = (n)-1; i >= 0; i--)
#define rep1(i,n)  for (int i = 1; i <= (n); i++)
#define rrep1(i,n) for (int i = (n); i > 0; i--)

ll n, m, ans, a;
priority_queue<ll> pq;
int main(void) {
    cin >> n >> m;
    rep(i,n) {
        cin >> a;
        pq.push(a);
    }
    while (m > 0 && pq.size() != 0) {
        ll x = pq.top();
        pq.pop();
        x /= 2;
        m--;
        if (x > 0) {
            pq.push(x);
        }
    }
    while (pq.size() != 0) {
        ans += pq.top();
        pq.pop();
    }
    cout << ans << endl;
    return 0;
#if 0
    sort(a, a+n);
    reverse(a, a+n);
    if (n==1) {
        while (m > 0 && a[0] > 0) {
            a[0] /= 2;
            m--;
        }
        ans = a[0];
        cout << ans << endl;
        return 0;
    }

    rep(i,n-1) {
        ll nextdis = a[i+1]-(a[i+1]/2);
        while (m > 0) {
            ll dis = (a[i]-(a[i]/2));
            if (dis < nextdis) {
                break;
            }
            a[i] /= 2;
            m--;
        }
        ans += a[i];
    }
    while (m > 0 && a[n-1] > 0) {
        a[n-1] /= 2;
        m--;
    }
    ans += a[n-1];
    cout << ans << endl;
    return 0;
#endif
}


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

int main(){
    int n,k;
    cin >> n >> k;
    k--;
    vector<int> a(n);
    rep(i,n) cin >> a.at(i);
    for(int i = k+1; i < n;i++){
        if((double)a.at(i)/a.at(i-k-1) > 1){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 3996
#include <bits/stdc++.h>
using namespace std; 
const int maxn = 16;
vector < pair < int, int > > a[maxn];
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int n;
    cin >> n;
    for(int i = 0 ; i < n ; ++i){
        int k;
        cin >> k;
        for(int j = 0 ; j < k ; ++j){
            int x, y;
            cin >> x >> y;
            x--; y++;
            a[i].push_back({x, y});
        }
    }
    int ans = 0;
    for(long long i = 0 ; i < (1 << n) ; ++i){
        int good[n] = {0};
        bool ok = true;
        for(int j = 0 ; j < n ; ++j)
            if((1ll << j) & i){
                for(auto t : a[j]){
                    if(good[t.first] && good[t.first] != t.second)
                        ok = false;
                    good[t.first] = t.second;
                }
            }
        for(int j = 0 ; j < n ; ++j)
            if((1ll << j) & i){
                if(good[j] == 1) ok = false;
            }else{
                if(good[j] == 2) ok = false;
            }
        if(ok) ans = max(ans, __builtin_popcount(i));
    }   
    cout << ans << '\n';
}


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

    int t,k,j,i,d,c=0,a,b;
    cin>>a>>b;
    string s;
    cin>>s;

    if(s[a]=='-')
    {
        for(j=0; j<a; j++)
        {
            if(s[j]>='0' && s[j]<='9')
                c++;

        }
        for(j=a+1; j<s.length(); j++)
        {
            if(s[j]>='0' && s[j]<='9')
                c++;

        }
        if(c==b+a)
            cout<<"Yes\n";
        else
            cout<<"No\n";
    }
    else
        cout<<"No\n";

}



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

int main()
{
  uint64_t sum = 0;
  int k;
  cin >> k;
  for (int a = 1; a <= k; a++)
  {
    for (int b = 1; b <= k; b++)
    {
      int abgcd = __gcd(a, b);
      for (int c = 1; c <= k; c++)
      {
        sum += __gcd(abgcd, c);
      }
    }
  }
  cout << sum << endl;
}


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

#define int long long
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define exrep(i, a, b) for(ll i = a; i < b; i++)
#define out(x) cout << x << endl
#define EPS (1e-7)
#define gearup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<bool> > vvb;
typedef vector<vector<double> > vvd;
typedef vector<vector<string> > vvs;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
typedef vector<vector<vector<ll> > > vvvl;
ll MOD = 1000000007;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
//cout<<fixed<<setprecision(10);

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;}
template<class T> void debug(T v){rep(i,v.size()) cout<<v[i]<<" ";cout<<endl;}
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};
//以降 cin の入力元が 'input.txt' になる
//std::ifstream in("input.txt");
//std::cin.rdbuf(in.rdbuf());

ll dp[55][55][3000];
signed main()
{
    gearup;
    int n,a; cin >> n >> a;
    vl x(n);
    rep(i,n)cin>>x[i];
    dp[0][0][0] = 1;
    rep(i,n){ //種類
        rep(j,n+1){ //何枚選ぶか
            rep(k,n*a+1){
                dp[i+1][j][k] += dp[i][j][k]; //選ばない
                dp[i+1][j+1][k+x[i]] += dp[i][j][k]; //選ぶ
            }
        }
    }
    ll res = 0;
    rep(i,n)res += dp[n][i+1][(i+1)*a];
    out(res);
}

Measured memory_bytes: 64520
#include "iostream"
#include "vector"
#include "string"
#include "algorithm"
#include "math.h"

using namespace std;
typedef long long ll;

int main()
{
  int n, l;
  cin >> n >> l;
  vector<string> s(n);
  for (int i = 0; i < n; i++)
  {
    cin >> s[i];
  }
  sort(s.begin(),s.end());
  for (int i = 0; i < n; i++)
  {
    cout << s[i];
  }
  cout << "\n";
}

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

int main() {
  int n; cin >> n;
  if (n%2==0) {
    cout << 0.5 << endl;
  } else {
    double ans = ((n+1)/2.)/n;
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include <cmath>
#include <limits>
#include<set>
#include <iomanip>
#include <queue>
#pragma GCC optimize("Ofast")
using namespace std;
const long long INF=20000000000;
//setprecision(2) <<

const int MOD = 1000000007;

long long max(long long a,long long b){
	if(a<b)return b;
	else return a;	
}
long long min(long long a,long long b){
	if(a>b)return b;
	else return a;	
}
long long gcd(long long a,long long b){
	if(a<b)swap(a,b);
	if(a%b==0)return b;
	else return gcd(a%b,b);
}

long long lcm(long long a,long long b){
	return a*b/gcd(a,b);
}


int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int a,b,c;
	cin>>a>>b>>c;
	cout<<min(a*b,c)<<endl;
}

	


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  long long N,M,flag=0,ans=1;cin>>N>>M;
  vector<long long> a(M);
  for(int i=0;i<M;i++)cin>>a.at(i);
  
  for(int i=0;i<M-1;i++)
    if(a.at(i)+1==a.at(i+1))flag++;
  
  if(flag==0 && M==0){
    vector<long long> c(N);
    for(int i=0;i<N;i++){
      if(i==0)c.at(i)=1;
      else if(i==1)c.at(i)=2;
      else c.at(i)=(c.at(i-2)+c.at(i-1))%1000000007;
    }
    ans=c.at(N-1);
  }
    
  else if(flag==0){
    vector<long long> b(M+1);
    for(int i=0;i<M+1;i++){
      if(i==0)b.at(i)=a.at(i)-1;
      else if(i==M)b.at(i)=N-a.at(M-1)-1;
      else b.at(i)=a.at(i)-a.at(i-1)-2;
    }
    
    sort(b.begin(),b.end());
    
    
    vector<long long> c(b.at(M));
    for(int i=0;i<b.at(M);i++){
      if(i==0)c.at(i)=1;
      else if(i==1)c.at(i)=2;
      else c.at(i)=(c.at(i-2)+c.at(i-1))%1000000007;
    }

    for(int i=0;i<M+1;i++){
      if(b.at(i)==0)continue;
      ans=ans*c.at(b.at(i)-1)%1000000007;
    }
  }
  
  if(flag>0)cout<<0<<endl;
  else cout<<ans<<endl;
}

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

class Program
{
    public static void Main()
    {
        bool flag = true;
        int N = int.Parse(Console.ReadLine());
        string[] temp = Console.ReadLine().Split();
        int[] A = new int[N];
        for(int i = 0; i < N; i++)
        {
            A[i] = int.Parse(temp[i]);
            if (A[i] % 2 == 0)
            {
                if (A[i] % 3 == 0 || A[i] % 5 == 0) {  }
                else { flag = false; }
            }
        }
        Array.Sort(A);
        if (flag) { Console.WriteLine("APPROVED"); }
        else { Console.WriteLine("DENIED"); }
    }
}

Measured memory_bytes: 13140
#include <stdio.h>
#include <set>
#include <utility>
using namespace std;
typedef pair<int, int> pii;

int main(void) {
  int i, j, n, ans = 0, a;
  scanf("%d", &n);
  set<pii> s;
  set<pii>::iterator it;
  for(i = 0; i < n; ++i) {
    scanf("%d", &a);
    pii p = make_pair(a, 1);
    it = s.lower_bound(p);
    if(it != s.end() && (*it).first == a) {
      int tmp = (*it).second;
      s.erase(it);
      p.second = tmp + 1;
      s.insert(p);
    } else {
      s.insert(p);
    }
  }
  for(it = s.begin(); it != s.end(); ++it) {
    if((*it).first > (*it).second) ans += (*it).second;
    else ans += (*it).second - (*it).first;
  }
  printf("%d", ans);
  return 0;
}

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

int main() {
  int N, MA, MB;
  cin >> N >> MA >> MB;
  vector<tuple<int, int, int>> V(N);
  for (int i = 0; i < N; i++) {
    int a, b, c;
    cin >> a >> b >> c;
    V.at(i) = {a, b, c};
  }
  vector<vector<int>> DP(N * 10 + 1, vector<int>(N * 10 + 1, INT_MAX));
  DP.at(0).at(0) = 0;
  for (auto [a, b, c] : V) {
    for (int i = N * 10; i >= 0; i--) {
      for (int j = N * 10; j >= 0; j--) {
        if (DP.at(i).at(j) != INT_MAX) {
          if (i + a < N * 10 + 1 && j + b < N * 10 + 1) {
            DP.at(i + a).at(j + b) = min(DP.at(i + a).at(j + b), DP.at(i).at(j) + c);
          }
        }
      }
    }
  }
  int ans = INT_MAX;
  for (int i = 1; i < N * 10 + 1; i++) {
    for (int j = 1; j < N * 10 + 1; j++) {
      if (j * MA == i * MB) ans = min(ans, DP.at(i).at(j));
    }
  }
  cout << ((ans == INT_MAX) ? -1 : ans) << "\n";
}

Measured memory_bytes: 4244
#include <iostream>
#include <map>
#include <vector>
#include <algorithm>

using namespace std;

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(),v.end()
#define each(it,c) for(__typeof(c.begin()) it=c.begin(); it!=c.end(); it++)
#define INF 1<<30
#define mp make_pair
#define pb push_back

typedef vector<int> vi;
typedef long long ll;

int main(){
	int n; cin>>n;
	vi a(n);
	int s = 0;
	rep(i,n) {
		cin>>a[i];
	}
	
	int ans = INF;
	for(int y=-100;y<=100;y++){
		int w = 0;
		rep(i,n){
			w += (a[i]-y)*(a[i]-y);
		}
		ans = min(w,ans);
	}
	cout<<ans<<endl;

	return 0;
}

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

using namespace std;
typedef long long ll;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()

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

    cout << ((n * a > b) ? b : n * a) << '\n';

    return 0;
}


Measured memory_bytes: 3548
H, W = map(int,input().split())
map = []
for i in range(H):
    map.append(input())

checkMap = [[1 for _ in range(W)] for _ in range(H)]

flag = False
end = False
for i in range(H):
    for j in range(W):
        flag = False
        if(checkMap[i][j] == 1):
            if(map[i][j] == "."):
                flag = True
                checkMap[i][j] = 0
            if(map[i][j] == "#"):
                if(j < W-1 and map[i][j+1] == "#"):
                    checkMap[i][j] = 0
                    checkMap[i][j+1] = 0
                    flag = True
                if(j > 0 and map[i][j-1] == "#"):
                    checkMap[i][j] = 0
                    checkMap[i][j-1] = 0
                    flag = True
                if(i < H-1 and map[i+1][j] == "#"):
                    checkMap[i][j] = 0
                    checkMap[i+1][j] = 0
                    flag = True
                if(i > 0 and map[i-1][j] == "#"):
                    checkMap[i][j] = 0
                    checkMap[i-1][j] = 0
                    flag = True
            if(flag == False):
                print("No")
                end = True
                break
        else:
            flag = True
            continue
        if(flag == False):
            break
    if(flag == False):
        break

if(end == False):
    print("Yes")

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

int main(){
  int h,w;
  cin >>h >>w;
  vector<vector<string>> s(h, vector<string>(w));
  int H,W;
  rep(i,h){
    rep(j,w) {
      cin >>s[i][j];
      if(s[i][j]=="snuke") {
        H=i+1;
        W=j+65;
      }
    }
  }
  cout << char(W) << H << endl;  
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
    
    int H , W ;
    
    
    do{
        cin >> H >> W ;
        if((H == 0)&&(W == 0)){
        }
        else{
            for(int i = 1 ; i <= H ; i++){
                for(int j = 1 ; j <= W ; j++){
                    cout << "#" ;
                }
                    cout << endl ;
            }
                    cout << endl ;
        }
    }while((H > 0)||(W > 0));

    
    
    
}


Measured memory_bytes: 3100