akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define pfi(a) printf("%d",a);
#define pfl(a) printf("%lld",a);
#define pfin(a) printf("%d\n",a);
#define pfln(a) printf("%lld\n",a);
#define sfi(a) scanf("%d",&a);
#define sfl(a) scanf("%lld",&a);
#define pb push_back
#define F first
#define S second
#define vi vector<int>
#define vl vector<long long>
#define vs vector<string>
#define vpp vector<pair<long long,long long>>
#define watch(x) cout << (#x) << " is " << (x) << endl
#define d0(x) cout<<(x)<<" "
#define c1(x) cin>>(x)
#define c2(x,y) cin>>(x)>>(y)
#define c3(x,y,z) cin>>(x)>>(y)>>(z)
#define c4(w,x,y,z) cin>>(w)>>(x)>>(y)>>(z)
#define d1(x) cout<<(x)<<endl
#define d2(x,y) cout<<(x)<<" "<<(y)<<endl
#define d3(x,y,z) cout<<(x)<<" "<<(y)<<" "<<(z)<<endl
#define d4(a,b,c,d) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<endl
#define d5(a,b,c,d,e) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<" "<<(e)<<endl
#define fo(i,a,b) for(int i=a;i<b;i++)
#define alld(c) (c).rbegin(),(c).rend()
#define alli(c) (c).begin(),(c).end()
#define ll long long
const int M=1e9+7;




int main() 
{ 
	int n;
	sfi(n);

	map<string,int> mp;
	fo(i,0,n)
	{
		string st;
		cin>>st;
		mp[st]++;
	}

	d1(mp.size());
	return(0);
}

Measured memory_bytes: 19268
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define lper(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};
int main(){
    string S;int K;cin>>S>>K;
    int N = S.size();
    int dp[N][2][4];
    rep(i,N)rep(j,2)rep(k,4)dp[i][j][k]=0;
    ll x=S[0]-'0';
    dp[0][0][1]=1;
    dp[0][1][0]=1;
    dp[0][1][1]=x-1;
    rep(i,N-1){
        ll x=S[i+1]-'0';
        int p=0;
        if(x!=0)p=1;
        dp[i+1][0][1]=dp[i][0][1]*(!p);
        dp[i+1][0][2]=dp[i][0][1]*p+dp[i][0][2]*(!p);
        dp[i+1][0][3]=dp[i][0][2]*p+dp[i][0][3]*(!p);
        dp[i+1][1][0]=dp[i][1][0];
        dp[i+1][1][1]=9*dp[i][1][0]+dp[i][1][1]+dp[i][0][1]*p;
        dp[i+1][1][2]=9*dp[i][1][1]+dp[i][1][2]+dp[i][0][2]*p+dp[i][0][1]*(x-1)*p;
        dp[i+1][1][3]=9*dp[i][1][2]+dp[i][1][3]+dp[i][0][3]*p+dp[i][0][2]*(x-1)*p;
    }
    cout<<dp[N-1][0][K]+dp[N-1][1][K]<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef int Weight;
struct Edge {  
  int src, dst;
  Weight weight;
  Edge(int src, int dst, Weight weight) :
    src(src), dst(dst), weight(weight) { }
};
bool operator < (const Edge &e, const Edge &f) {
  return e.weight != f.weight ? e.weight > f.weight : 
    (e.src != f.src ? e.src < f.src : e.dst < f.dst);
}
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
const int INF=1e9;
bool spwf(const Graph &g,vector<vector<Weight>> &dist,vector<vector<int>> &inter) {
  int n = g.size();
  dist.assign(n,vector<Weight>(n,INF));
  for(int i=0;i<n;i++) dist[i][i]=0;
  for(int i=0;i<n;i++){
    for(auto f : g[i]) dist[i][f.dst] = f.weight;
  }
  inter.assign(n, vector<int>(n,-1));
  for(int k=0;k<n;k++){
    for(int i=0;i<n;i++){
      for(int j=0;j<n;j++){
        if(dist[i][k]<INF && dist[k][j]<INF && dist[i][j]>dist[i][k]+dist[k][j]){
          dist[i][j] = dist[i][k] + dist[k][j];
          inter[i][j] = k;
        }
      }
    }
  }
  for(int i=0;i<n;i++){
    if(dist[i][i]<0) return false;
  }
  return true;
}
int main(){
	int h, w;
	cin >> h >> w;
    vector<vector<int>> s(h+1,vector<int>(w+1));
    for(int i=1; i<=h; ++i){
        for(int j=1; j<=w; ++j){
            char tmp; cin >> tmp;
            s[i][j]=(tmp=='.' ? 1 : 0);
        }
    }

    Graph g(h*w+1);
    for(int i=1; i<=h; ++i){
        for(int j=1; j<=w; ++j){
            if(s[i][j]==0) continue;
            int x=(i-1)*w+j;
            if(j>=2 && s[i][j-1]==1){
                g[x].push_back(Edge(x,x-1,1));
                g[x].push_back(Edge(x-1,x,1));
            }
            if(j<=w-1 && s[i][j+1]==1){
                g[x].push_back(Edge(x,x+1,1));
                g[x].push_back(Edge(x+1,x,1));
            }
            if(i>=2 && s[i-1][j]==1){
                g[x].push_back(Edge(x,x-w,1));
                g[x].push_back(Edge(x-w,x,1));
            }
            if(i<=h-1 && s[i+1][j]==1){
                g[x].push_back(Edge(x,x+w,1));
                g[x].push_back(Edge(x+w,x,1));
            }
        }
    }
    vector<vector<Weight>> dist;
    vector<vector<int>> inter;
    spwf(g,dist,inter);

    int ans=0;
    for(auto i : dist){
        for(auto j : i){
            if(j==INF) continue;
            ans = max(ans,j);
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 1536
use std::io;
#[allow(dead_code)]
fn read<T: std::str::FromStr>() -> T {
    let mut n = String::new();
    io::stdin().read_line(&mut n).unwrap();
    n.trim().parse().ok().unwrap()
}
#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut n = String::new();
    io::stdin().read_line(&mut n).unwrap();
    n.trim()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}
#[allow(dead_code)]
fn str_join<T: std::string::ToString>(s: &Vec<T>) -> String {
    s.iter()
        .map(|i| i.to_string())
        .collect::<Vec<_>>()
        .join(" ")
}

fn main() {
    let input: Vec<usize> = read_vec();
    let n = input[0];
    let m = input[1];
    let l = input[2];
    let mut a: Vec<Vec<usize>> = Vec::new();
    let mut b: Vec<Vec<usize>> = Vec::new();
    for i in 0..n {
        a.push(read_vec());
    }
    for i in 0..m {
        b.push(read_vec());
    }
    for i in 0..n {
        let mut row: Vec<usize> = Vec::new();
        for j in 0..l {
            let sum = (0..m).map(|k| a[i][k] * b[k][j]).sum();
            row.push(sum);
        }
        println!("{}", str_join(&row));
    }
}



Measured memory_bytes: 5052
// In the name of God

#include <iostream>
#include <algorithm>
#include <fstream>
#include <vector>
#include <deque>
#include <assert.h>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <stdio.h>
#include <string.h>
#include <utility>
#include <math.h>
#include <bitset>
#include <iomanip>

using namespace std;

const int N = (int) 0, mod = (int) 0;
int cnt[200];
int32_t main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int n, c;
    cin >> n >> c;
    int mx = 0, sum = n;
    for (int i = 0; i < c; ++i) {
        int x;
        cin >> x;
        cnt[i] = x;
    }
    for (int i = 0; i < 200; ++i)
        mx = max(mx, cnt[i]);
    int ot = n - mx;
    if (ot >= mx - 1) {
        cout << 0 << endl;
    } else {
        cout << mx - 1 - ot << endl;
    }
}

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

ll N, M, score=0;
vector<ll> Fib;

void dp(){
    for(int i=2;i<=N;i++) Fib[i] = Fib[i-1]+Fib[i-2];
}

signed main(){
    cin >> N;
    Fib.resize(N+1);
    Fib[0]=1;
    Fib[1]=1; 
    dp();
    cout << Fib[N] << endl;
    return 0;
}


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

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

using namespace std;

template<class T> struct edge{
	int to;
	T wt;
	edge(int to,const T& wt):to(to),wt(wt){}
};
template<class T> using weighted_graph=vector<vector<edge<T>>>;

int main(){
	int n,m; scanf("%d%d",&n,&m);
	vector<int> val(n);
	rep(u,n) scanf("%d",&val[u]);
	weighted_graph<int> G(n);
	rep(i,m){
		int u,v; scanf("%d%d",&u,&v); u--; v--;
		G[u].emplace_back(v,i);
		G[v].emplace_back(u,i);
	}

	vector<pair<int,int>> p(n);
	rep(u,n) p[u]={val[u],u};
	sort(p.begin(),p.end());

	vector<int> color(n,-1),wt(m,1e9);
	rep(i,n){
		int u=p[i].second;
		if(color[u]!=-1) continue;

		int v=-1,id;
		for(auto e:G[u]) if(val[e.to]<=val[u]) { v=e.to; id=e.wt; break; }
		if(v==-1) return puts("-1"),0;

		if(color[v]==-1){
			color[u]=0;
			color[v]=1;
		}
		else{
			color[u]=1-color[v];
		}
		wt[id]=val[u];
	}

	rep(u,n) putchar(color[u]==0?'B':'W'); puts("");
	rep(i,m) printf("%d\n",wt[i]);

	return 0;
}


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

int main(){
  int n;  cin>>n;
  string s; cin>>s;
  int nr=0, nb=0;
  for(int i=0; i<n; i++){
    if(s[i]=='R') nr++;
    if(s[i]=='B') nb++;
  }
  cout<<(nr>nb?"Yes":"No")<<endl;
  return 0;
}

Measured memory_bytes: 256
<?php

	$n = trim(fgets(STDIN));
	$f = true;
	
	for($i=0;$i<$n;$i++){
		$data[$i] = trim(fgets(STDIN));
		$s = str_split($data[$i], 1);
		$s1 = $s[0];
		if ($i == 0) $s2 = $s1;
		
		for($j=0;$j<$i;$j++){
			if($data[$i] == $data[$j]) $f = false;
		}
		if ($s1 !== $s2) $f = false;
		$s2 = $s[strlen($data[$i])-1];
	}
	
	if($f){
		echo "Yes";
	} else {
		echo "No";
	}

?>

Measured memory_bytes: 4604
# 整数の入力
a = gets.to_i
# スペース区切りの整数の入力
b,c=gets.chomp.split(" ").map(&:to_i);
(b..c).each{ |i|
  if(i % a == 0)
    print 'OK'
    return
  end
  }
print 'NG'

Measured memory_bytes: 14376
#include <iostream>
#include <vector>
#include <sstream>
#include <string>
#include <cmath>

using namespace std;

vector<string> split(const string &s, char delim) {
    vector<string> elems;
    string item;
    for (char ch: s) {
        if (ch == delim) {
            if (!item.empty())
                elems.push_back(item);
            item.clear();
        } else {
            item += ch;
        }
    }
    if (!item.empty())
        elems.push_back(item);
    return elems;
}

int main() {
    string buffer;
    int vedge, hedge, diagonal, countRect = 0, countRhom = 0;


    while (cin >> buffer) {
        vector<string> buffers = split(buffer, ',');
        
        vedge = stoi(buffers[0]);
        hedge = stoi(buffers[1]);
        diagonal = stoi(buffers[2]);
        
        if (vedge == hedge) {
            countRhom++;
        }
        if (pow(vedge, 2) + pow(hedge, 2) == pow(diagonal, 2)) {
            countRect++;
        }
    }

    cout << countRect << endl;
    cout << countRhom << endl;

    return 0;
}


Measured memory_bytes: 3116
#define __USE_MINGW_ANSI_STDIO 0
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <set>
#include <numeric>
#include <bitset>
#include <map>
#include <limits.h>
#include <iomanip>
using namespace std;
typedef unsigned long ul;
typedef pair<ul, ul> P;
const int INF = 1e9;
 
long long gcd(long long x, long long y){
			if (x==0)return y;
      if(y==0)return x;
      if(x<y){
				long long temp = x;
			x = y;
				y = temp;
			}
			long long r = x % y;
				while(r!=0){
					x = y;
					y = r;
				r = x % y;
	    		}
			return y;
	    }

int main(){
	int N;
	cin >> N;
	vector<pair<string,pair<int,int>>> vec(N);
	for(int i =0;i<N;i++){
		int n;
		string s;
		cin >> s >> n;
		vec[i] = make_pair(s,make_pair(-n,i+1));
			}
			sort(vec.begin(),vec.end());
			for(int i =0;i<N;i++){
			cout << vec[i].second.second << endl;
			}
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pl;
typedef vector<pl> vp;
#define fore(i,a,b) for(ll i=(a);i<=(b);++i)
#define rep(i,n) fore(i,0,(n)-1)
#define rfore(i,a,b) for(ll i=(b);i>=(a);--i)
#define rrep(i,n) rfore(i,0,(n)-1)
#define all(x) (x).begin(),(x).end()
const ll INF=1001001001;
const ll LINF=1001001001001001001;
const ll D4[]={0,1,0,-1,0};
const ll D8[]={0,1,1,0,-1,-1,1,-1,0};
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;}
template<class T>
ll sum(const T& a){return accumulate(all(a),0LL);}

ll n;
vl g[105];
void solve(){
    cin>>n;
    rep(i,n){
        ll from,m;cin>>from>>m;from--;
        rep(j,m){
            ll to;cin>>to;to--;
            g[from].push_back(to);
        }
    }
    queue<ll> q;
    q.push(0);
    vl a(n,-1);a[0]=0;
    while(!q.empty()){
        ll from=q.front();q.pop();
        if(!g[from].size())continue;
        rep(i,g[from].size()){
            ll to=g[from][i];
            if(a[to]==-1){
                a[to]=a[from]+1;
                q.push(to);
            }
        }
    }
    rep(i,n){
        cout<<(i+1)<<" "<<a[i]<<endl;
    }
}

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



Measured memory_bytes: 3188
#include <stdio.h>

int main(void){
	int w,h,i,j;
	while(1){
		scanf("%d %d",&h,&w);
		if(w == 0 && h == 0)
			break;
		for(i = 0;i < h;i++){
			for(j = 0;j < w;j++){
				if(0 < i && i < h-1 && 0 < j && j < w-1){
					printf(".");
					}else{
					printf("#");
					}
				}
			printf("\n");
			}
		printf("\n");
		}
	return 0;
}

Measured memory_bytes: 572
def a_akiba(S):
    import re
    if re.search(r'^A{,1}KIHA{,1}BA{,1}RA{,1}$', S) is not None:
        ans = 'YES'
    else:
        ans = 'NO'
    return ans

S = input().strip()
print(a_akiba(S))

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

int get_days(int Y, int M, int D){
  int sum = 0;
  for(int i = 1; i < Y; i++){
    for(int j = 1 ; j <= 10; j++){
      if(i % 3 == 0 || j % 2 == 1) sum += 20;
      else sum += 19;
    }
  }
  for(int j = 1; j < M; j++){
    if(Y % 3 == 0 || j % 2 == 1) sum += 20;
    else sum += 19;
  }
  sum += D;
  return sum;
}

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

  while(n--){
    int Y, M, D;
    cin >> Y >> M >> D;
    cout << get_days( 1000, 1, 1) - get_days( Y, M, D) << endl;
  }
}

Measured memory_bytes: 1160
#include "bits/stdc++.h"
using namespace std;
#define FAST ios_base::sync_with_stdio(false); cin.tie(0);
#define LLINF (long long) 1e18//1234567890987654321
#define INF 1234567890
#define pb push_back
#define ins insert
#define f first
#define s second	
#define db 0
#define EPS (1e-7)    //0.0000001 the value
#define PI (acos(-1))
#define MAXN 300006
#define MAXK 26
#define MAXX 15000006
#define ll long long int
#define ld long double
#define rep0(kk, l1, l2)for(ll kk = l1; kk < l2; kk++)
#define rep1(kk, l1, l2)for(ll kk = l1; kk <= l2; kk++)
#define foritr(itr, A) for(set<ll>::iterator itr = A.begin(); itr != A.end(); itr++)
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());    //can be used by calling rng() or shuffle(A, A+n, rng)
#define FOR(ii, ss, ee) for(ll ii = ss; ii < ee; ii++)
#define cr(x) cerr << #x << " = " << x << "\n";
#define crA(x, A) cerr << #x << " = " << A[x] << "\n";
#define spacing if(db)cout << " ";
#define mmst(x, v) memset((x), v, sizeof ((x)));
#define bg(ms) (*ms.begin())
#define ed(ms) (*prev(ms.end(), 1))
#define addedge(a, b, c, v) v[(a)].pb(pi((b), (c))); v[(b)].pb(pi((a), (c)))
#define ph push
#define btinpct(x) __builtin_popcountll(x)
#define p2(x) (1LL<<(x))
#define all(x) (x).begin(), (x).end()
#define lbd(x, y) lower_bound(all(x), y)
#define ubd(x, y) upper_bound(all(x), y)
typedef pair <ll, ll> pi;
typedef pair <ll, pi> spi;
typedef pair <pi, pi> dpi;
inline ll rand(ll x, ll y) { ++y; return (rng() % (y-x)) + x; } //inclusivesss
ll n, m, ans, vis[406][406];
char grid[406][406];
ll dx [] = {0, 0, 1, -1};
ll dy [] = {1, -1, 0, 0};
char b = '#', w = '.';
void bfs(pi sp)
{
	queue <pi> q; map<char,ll>mp;
	vis[sp.f][sp.s] = 1;
	q.ph(sp); mp[grid[sp.f][sp.s]] ++;
	while(!q.empty())
	{
		ll x = q.front().f, y = q.front().s;
		q.pop();
		for(ll i = 0; i < 4; i++)
		{
			ll nx = x + dx[i];
			ll ny = y + dy[i];
			if(nx < 0 || ny  < 0 || nx >= n || ny >= m || grid[x][y] == grid[nx][ny] || vis[nx][ny]) continue;
			assert(!vis[nx][ny]);
			vis[nx][ny] = 1;
			q.ph(pi(nx, ny));
			mp[grid[nx][ny]] ++;
		}
	}
	ans += (mp[b] * mp[w]);
}
int main()
{
	cin >> n >> m;
	FOR(i,0,n)
	{
		FOR(j,0,m) cin >> grid[i][j];
	}
	FOR(i,0,n)
	{
		FOR(j,0,m)
		{
			if(vis[i][j]) continue;
			bfs(pi(i,j));
		}
	}
	cout << ans << '\n';
}


Measured memory_bytes: 1664
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
ll n,i;
cin>>n;
ll arr[n+1],dp[n+1];

for(i=0;i<n;i++)
{
dp[i]=1e12;
cin>>arr[i];
}
dp[0]=0;
dp[1]=abs(arr[0]-arr[1]);
for(i=2;i<n;i++)
dp[i]=min(dp[i-1]+abs(arr[i-1]-arr[i]),dp[i-2]+abs(arr[i-2]-arr[i]));
cout<<dp[n-1];
return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define all(x) (x).begin(), (x).end()
using ll = long long;
using namespace std;
template <typename T> using vec = std::vector<T>;

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

    vec<int> A(N);
    rep(i, N) cin >> A[i];
    sort(all(A), greater<int>());

    function<bool(int)> isOK = [&](int test_num) {
        int zan = K;
        rep(i, N) {
            if (A[i] > test_num) { zan -= (A[i] / test_num);}
            if (zan < 0) return false;
        }
        return true;
    };

    function<int()> nibutan = [&]() {
        int ng = 0;
        int ok = A[0];

        while (abs(ok - ng) > 1) {
            int mid = (ok + ng) / 2;

            if (isOK(mid)) ok = mid;
            else
                ng = mid;
        }
        return ok;
    };
    cout << nibutan() << endl;
}


Measured memory_bytes: 4048
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <time.h>
#define int long long
#define endl '\n'
#define INF 1000000000000000000
#define EPS 1e-10
#define PI 3.141592653589793238
#define all(a) a.begin(),a.end()
#define rep(i, n) for (int i = 0; i < (n); i++)
#define pb push_back
#define double long double
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<P, ll> PP;
typedef complex<double> com;
template<class T, class S> bool chmax(T &a, const S &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T, class S> bool chmin(T &a, const S &b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll n, ll m) { return (m ? gcd(m, n%m) : n); }
ll lcm(ll n, ll m) { return n / gcd(n, m)*m; }


signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(20);
	//modcalc();

	string s;
	cin >> s;
	if (s[2] == s[3] && s[4] == s[5]) cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 256
#[allow(unused_imports)]
use std::cmp::{max, min};
use std::io::{stdin, stdout, BufWriter, Write};

#[derive(Default)]
struct Scanner {
    buffer: Vec<String>,
}

impl Scanner {
    fn next<T: std::str::FromStr>(&mut self) -> T {
        loop {
            if let Some(token) = self.buffer.pop() {
                return token.parse().ok().expect("Failed parse");
            }
            let mut input = String::new();
            stdin().read_line(&mut input).expect("Failed read");
            self.buffer = input.split_whitespace().rev().map(String::from).collect();
        }
    }
}

fn main() {
    let mut scan = Scanner::default();
    let out = &mut BufWriter::new(stdout());

    let n: i32 = scan.next();
    let mut a = [[[0; 10]; 3]; 4];
    for _ in 0..n {
        let b: usize = scan.next();
        let f: usize = scan.next();
        let r: usize = scan.next();
        let v: i32 = scan.next();
        a[b-1][f-1][r-1] += v;
    }
    for b in 0..4 {
        for f in 0..3 {
            for r in 0..10 {
                write!(out, " {}", a[b][f][r]).ok();
            }
            writeln!(out, "").ok();
        }
        if b < 3 {
            writeln!(out, "####################").ok();
        }
    }
}



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

// #define int long long
#define rep(i, n) for (long long i = (long long)(0); i < (long long)(n); ++i)
#define reps(i, n) for (long long i = (long long)(1); i <= (long long)(n); ++i)
#define rrep(i, n) for (long long i = ((long long)(n)-1); i >= 0; i--)
#define rreps(i, n) for (long long i = ((long long)(n)); i > 0; i--)
#define irep(i, m, n) for (long long i = (long long)(m); i < (long long)(n); ++i)
#define ireps(i, m, n) for (long long i = (long long)(m); i <= (long long)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) long long(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const ll INF = 1e9;
const ll MOD = 1e9+7;
const ll LINF = 1e18;

ll n,A,B,C;
vll l;

ll ans=LINF;
void dfs(ll a, ll b, ll c, ll cnt, ll cost){
  if(cnt==n){
    if(a==0||b==0||c==0) return;
    ll tmp=cost+abs(A-a)+abs(B-b)+abs(C-c);
    chmin(ans,tmp);
    return;
  }
  
  dfs(a,b,c,cnt+1,cost);
  dfs(a+l[cnt],b,c,cnt+1,a?cost+10:cost);
  dfs(a,b+l[cnt],c,cnt+1,b?cost+10:cost);
  dfs(a,b,c+l[cnt],cnt+1,c?cost+10:cost);
  
}

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  cin>>n>>A>>B>>C;
  l.resize(n);
  rep(i,n) cin>>l[i];
  dfs(0,0,0,0,0);
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){int n,m,i,s,c,ans,k;
cin>>n>>m;
int a[n];
for(i=0;i<n;i++){a[i]=-1;}
for(i=0;i<m;i++){cin>>s>>c;
s--;
    if(a[s]!=-1&&a[s]!=c){cout<<"-1";return 0;}
    a[s]=c;
}
if(n==1){cout<<max(0,a[0]);return 0;}
if(n==1&&m==0){cout<<"0";return 0;}
if(!a[0]){cout<<"-1";return 0;}
if(a[0]==-1){a[0]=1;}
k=0;
for(i=0;i<n;i++){a[i]=max(k,a[i]);}
for(i=0;i<n;i++){cout<<a[i];}
    return 0;}

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

int main() {
  int n,x;
  cin>>n>>x;
  vector<int> s(n);
  s[0]=0;
  for(int i=1; i<=n; i++) {
    int h; cin>>h;
    s[i]=s[i-1]+h;
    if(s[i]>x) {
      cout<<i;
      return 0;
    }
  }
  cout<<n+1;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#ifdef _DEBUG
#define _GLIBCXX_DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
// typedef __int128_t Int;
#define DBG 1
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define loop(n) rep(loop, (0), (n))
#define all(c) begin(c), end(c)
const int INF =
    sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
const double PI = acos(-1);
const double EPS = 1e-9;
using pii = pair<int, int>;
template <class T> bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T> bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

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

  int N, K;
  cin >> N >> K;
  int ans = 0;
  rep(b, 1, N + 1) {
    dump(ans);
    ans += N / b * max(b - K, 0ll);
    if (N % b >= K) {
      ans += N % b - K + 1;
      if (K == 0)
        ans--;
    }
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
int n,a[N],b[N],pos,pos2;
vector<int> v;
inline bool cmp(const int &i,const int &j) {
	return i > j;
}
signed main() {
	scanf("%lld",&n);
	for(int i = 1;i <= n;++i)
		scanf("%d",a+i);
	for(int i = 1;i <= n;++i)
		scanf("%d",b+i);
	sort(b+1,b+n+1,cmp);
	for(int i = 1;i <= n;++i)
		if(a[i] == b[i]) {
			pos = i;
			break;
		}
	if(!pos) {
		puts("Yes");
		for(int i = 1;i <= n;++i)
			printf("%d ",b[i]);
		return puts(""),0;
	}
	for(int i = 1;i <= n;++i)
		if(a[i] != a[pos] && b[i] != a[pos])
			v.push_back(i);
		else if(a[i] == b[i]) pos2 = i;
	if(v.size() >= pos2-pos+1) {
		puts("Yes");
		int cur = 0;
		for(int i = pos;i <= pos2;++i)
			swap(b[i],b[v[cur++]]);
		for(int i = 1;i <= n;++i)
			printf("%d ",b[i]);
		return puts(""),0;
	}
	else puts("No");
	return 0;
}


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

using namespace std;

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

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

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


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

  string s; cin >> s;
  int w; cin >> w;
  for(int i=0;i<SZ(s);i += w) {
    cout << s[i];
  }
  cout << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h> 
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
 
using namespace std; 
using namespace __gnu_pbds;
 
typedef long long ll;
typedef double db;
typedef long double ld;
typedef string str;
 
typedef pair<int,int> pi;
typedef pair<ll, ll> pll;
typedef pair<db, db> pdb;
typedef pair<ld, ld> pld;
typedef pair<str, str> pstr;
 
typedef vector<int> vi; 
typedef vector<ll> vll; 
typedef vector<db> vdb; 
typedef vector<ld> vld;
typedef vector<str> vstr; 
typedef vector<pi> vpi;
typedef vector<pll> vpll; 
typedef vector<pdb> vpdb; 
 
#define fi first
#define se second
#define mp make_pair
#define pf push_front 
#define pb push_back
#define ins insert 
#define eb emplace_back 
#define fbo find_by_order
#define ook order_of_key
#define rsz resize
#define lb lower_bound 
#define ub upper_bound 

#define len(s) (int)s.length()
#define sz(v) (int)v.size()
#define all(v) v.begin(), v.end()
#define srt(v) sort(all(v))

#define rep(a, b, c) for(int a=b; a<c; a++) 
#define per(a, b, c) for(int a=b; a>c; a--) //do not include boundaries on the right
#define repn(a, b, c) for(int a=b; a<=c; a++) 
#define pern(a, b, c) for(int a=b; a>=c; a--) //include boundaries on the right
 
#define yes cout << "YES"<< "\n" 
#define no cout << "NO" << "\n" 
#define out(x) cout << x << "\n"
#define outs(x) cout << x << " "
#define el cout << "\n"

#define navi ios_base::sync_with_stdio(false); cin.tie(NULL)    
 
const ll mod = 1e9+7;
const double eps = 1e-9;

int main(){
	navi;
	ll n; cin >> n;
  ll a[111111];
  ll sum=0;
  rep(i,0,n){
   a[i]=0;
  }
  rep(j,0,n){
   ll m; cin >> m;
    a[m]++;
    sum+=m;
  }
  ll q; cin >> q;
  rep(k,0,q){
    ll x, y; cin >> x >> y;
    sum+=a[x]*(y-x);
    a[y]+=a[x];
    a[x]=0;
    out(sum);
  }
}


Measured memory_bytes: 4444
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        a: u64,
        b: u64,
    }
    let a = if a == 1 {14} else {a};
    let b = if b == 1 {14} else {b};

    println!("{}", if a > b {"Alice"} else if a < b {"Bob"} else {"Draw"});
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using ll=long long;
using namespace std;
#define rep(i, n) for(ll i=0; i<n; i++)
#define Rep(i, j, n) for(ll i=j; i<n; i++)
#define all(vec) vec.begin(), vec.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;}
ll MM = 1000000000; ll mod = MM + 7; ll MMM=9223372036854775807;//2^63 -1
ll GCD(ll x, ll y){ if(y == 0) return x; else return GCD(y, x % y);}
ll LCM(ll x, ll y){ return x / GCD(x, y) * y;}
int dh[4] = {-1, 0, 0, 1};
int dw[4] = {0, -1, 1, 0}; 
using P = pair<int, int>;
const double pi = acos(-1.0);

using Graph = vector<vector<ll>>;

int main(){
  int n,m,x;
  cin>>n>>m>>x;
  vector<int>a(m);
  rep(i,m)cin>>a[i];
  int f=0,l=0;
  rep(i,m){
  if(a[i]<x)f++;
  else l++;
  }  
  if(f>l)cout<<l<<endl;
  else cout<<f<<endl;
    
  return 0;
}


Measured memory_bytes: 3620
#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> VI;
typedef pair<int, int> ipair;
typedef tuple<int, int, int> ituple;

// const int INF = (int)2e9;
// const int MOD = (int)1e9 + 7;
// const double EPS = 1e-10;

#define MAX_N 100000 + 2
  int n;
  ll a[MAX_N];

  ll startPlus(){
    ll ans = 0;
    // 1つめを正から始める
    ll current = a[0];
    if (current <= 0){
      ans += -current + 1;
      current = 1;
    }
    bool isPlus = false;

    for (int i = 1; i < n; i++){
      current += a[i];
      if (isPlus){
        if (current <= 0){
          ans += -current + 1;
          current = 1;
        }
      }
      else{
        if (current >= 0){
          ans += current + 1;
          current = -1;
        }
      }
      // printf("i = %d, current = %lld\n", i, current);
      isPlus = !isPlus;
    }

    return ans;
  }
  ll startMinus(){
    ll ans = 0;
    // 1つめを負から始める
    ll current = a[0];
    // printf("current = %lld\n", current);
    if (current >= 0){
      ans += current + 1;
      current = -1;
    }
    // printf("ans = %lld\n", ans);
    bool isPlus = true;

    for (int i = 1; i < n; i++){
      current += a[i];
      if (isPlus){
        if (current <= 0){
          ans += -current + 1;
          current = 1;
        }
      }
      else{
        if (current >= 0){
          ans += current + 1;
          current = -1;
        }
      }
      isPlus = !isPlus;
    }

    return ans;
  }

void exec(){
  cin >> n;
  for (int i = 0; i < n; i++){
    scanf("%lld", &a[i]);
  }

  ll low = startMinus();
  ll high = startPlus();
  // printf("minus = %lld, plus = %lld\n", low, high);
  cout << min(low, high) << endl;

}

void solve(){
  int t = 1;
  // scanf("%d", &t);
  for (int i = 0; i < t; i++){
    exec();
  }
}

int main(){
  solve();
  return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); ++i)
#define fi first
#define se second
#define INF 1000000009
#define lINF 1000000000000000009
using ll = long long;

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

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

int main(){
  int n;
  cin>>n;
  vector<int>d(n);
  rep(i,n)cin>>d[i];
  if(d[0]!=0){
    cout<<0<<endl;
    return(0);
  }
  vector<int>cnt(n+1,0);
  rep(i,n){
    cnt[d[i]]++;
  }
  if(cnt[0]!=1){
    cout<<0<<endl;
    return(0);
  }
  sort(d.begin(),d.end());
  mint ans=1;
  rep2(i,1,n){
    ans*=cnt[d[i]-1];
  }
  cout<<ans.x<<endl;
  return(0);
}
  


Measured memory_bytes: 1024
#define _USE_MATH_DEFINES
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 30;
const int MOD = 1e9 + 7;

int main() {
  int A, B, C;
  cin >> A >> B >> C;
  if (C % __gcd(A, B) == 0) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
  return 0;
}


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

int main() {
  
  int64_t K, A, B; cin >> K >> A >> B;
  
  if (K < A + 1 || B - A < 2) { cout << K + 1 << endl; return 0; }
  
  int64_t ans = B + ((K - A + 1) / 2 - 1) * (B - A);
  
  if ((K - A + 1) % 2 == 0) cout << ans << endl;
  
  else cout << ans + 1 << endl;
  
}

Measured memory_bytes: 3652
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
using namespace std;
typedef  long long int lint;
typedef pair<int, int> P;
typedef pair<lint, lint> LLP;
typedef pair<char, char>CP;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define llower(v,hoge) *lower_bound(v.begin(), v.end(), hoge)
#define lupper(v,hoge) *upper_bound(v.begin(), v.end(), hoge)
const lint MOD = pow(10, 9) + 7;



int main() {
	int Q = pow(10, 9);
	int N, K, S;
	cin >> N >> K >> S;
	if (S == Q) {
		rep(i, K) {
			cout << Q << ' ';
		}
		rep(i, N - K) {
			cout << 1 << ' ';
		}
	}
	else {
	if (K == N) {
		rep(i, N) {
			cout << S << ' ';
		}
		cout << endl;
	}
	else {
		if (S != 1) {
			rep(i, K + 1) {
				if (i % 2 == 0) {
					cout << 1 << ' ';
				}
				else {
					cout << S - 1 << ' ';
				}
			}
			rep(i, N - K - 1) {
				cout << Q << ' ';
			}
			cout << endl;
		}
		else {
			rep(i, K) {
				cout << 1 << ' ';
			}
			rep(i, N - K) {
				cout << Q << ' ';
			}
			cout << endl;
		}
	}
	}
}


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

int main() {

    int n, a, b;
    scanf("%d%d%d", &n, &a, &b);

    if (n * a < b) {
        printf("%d", n * a);
    } else {
        printf("%d", b);
    }


    return 0;


}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (ll i = 0; i < n; i++)
#define Rep(i, r, n) for (ll i = r; i < n; i++)
#define pb push_back
#define MOD 1000000007
#define INF 1000000000
#define EPS 0.0000000001
typedef long long ll;

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

    int n;
    cin>>n;
    vector<pair<int,int>> a(n);
    vector<pair<int,int>> b(n);
    rep(j,2){
        rep(i,n){
            if(j==0){
                cin>>a[i].second>>a[i].first;
            }
            else{
                cin>>b[i].first>>b[i].second;
            }
        }
    }
    sort(all(b));//bはｘで昇順
    sort(rall(a));//aはｙで降順
    vector<int> c(n);
    ll ans=0;
    rep(i,n){
        rep(j,n){
            if(c[j]==1){
                continue;
            }
            if(a[j].second<b[i].first&&a[j].first<b[i].second){
                ans++;
                c[j]++;
                break;
            }
        }
    }

    cout<<ans<<endl;




}

Measured memory_bytes: 256
#include<iostream>
#include<cstring>
using namespace std;
int main(){
  char a[10000],b[3]={'a'};
  while(cin>>a){
    int joi=0,ioi=0,n;
    n = strlen(a);
    for(int i=0;i<=n;i++){
      b[0] = b[1];
      b[1] = b[2];
      b[2] = a[i];
      if(b[0]=='J'&&b[1]=='O'&&b[2]=='I') joi++;
      if(b[0]=='I'&&b[1]=='O'&&b[2]=='I') ioi++;
    }
    cout << joi << endl << ioi << endl;
  }
  return 0;
}

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

int main() {
	double r, pai, s, l;
	pai = 3.141592653589;
	cin >> r;
	
	s = r*r*pai;
	l = 2*r*pai;
	
	printf("%f %f\n", s, l);
	
   	return 0;
}

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

int main() {
  int N,K,x,sum;
  cin >> N >> K;
  for (int i=0;i<N;i++){
   cin >> x;
   if (x < K-x) 
    sum += 2*x;
   else
    sum += 2*(K-x);
  }
  cout << sum << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <utility>
#include <string>

int main() {
		
	// recieve |V| and |E|
	int V, E; std::cin >> V >> E;

	// adjacency list
	std::vector<std::vector<std::pair<int, int>>> G(V);

	for(int i = 0; i < E; i++) {
		// recieve edges
		int u, v, d; std::cin >> u >> v >> d;
		u--; v--;
		G[u].push_back({v, d});
		G[v].push_back({u, d});
	}
	
	// recieve freqencies
	std::vector<int> freq(V);
	for(int i = 0; i < V; i++) std::cin >> freq[i];
	
	int Tmax; std::cin >> Tmax;

	for(int t = 0; t < Tmax; t++) {

		// the number of new order
		int Nnew; std::cin >> Nnew;
		for(int j = 0; j < Nnew; j++) {
			int new_id, dst; std::cin >> new_id >> dst;
		}
	
		// the number of items transfered into the car at time t.
		int Nput; std::cin >> Nput;
		for(int j = 0; j < Nput; j++) {
			int put_id; std::cin >> put_id;
		}

    // insert your code here to get more meaningful output
		// you have to output a command here
		std::cout << -1 << std::endl; // stay

		std::string verdict; std::cin >> verdict;
		if(verdict == "NG") {
			return 1;
		}

		// the number of orders that have been delivered at time t.
		int Nachive; std::cin >> Nachive;
		for(int j = 0; j < Nachive; j++) {
			int achive_id; std::cin >> achive_id;
		}
		
	}

	return 0;
}


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

class dice
{
public:
    int F[6];
    int q;
    dice();
    void roll_a();
    void roll_b();
    bool check(const dice& d);
};

dice::dice()
{
    for(int i = 0; i < 6; i++) cin >> F[i];
    q = F[0] * F[5] + F[1] * F[4] + F[2] * F[3]; // invariant.
}

void dice::roll_a()
{
    static int i;
    i = F[0]; F[0] = F[2]; F[2] = F[1]; F[1] = i;
    i = F[3]; F[3] = F[4]; F[4] = F[5]; F[5] = i;
}

void dice::roll_b()
{
    static int j;
    j = F[0]; F[0] = F[5]; F[5] = j;
    j = F[1]; F[1] = F[3]; F[3] = j;
    j = F[2]; F[2] = F[4]; F[4] = j;
}
 
bool dice::check(const dice& d)
{
    static int l, m;
    if((d.F[0] != F[0]) || (d.F[5] != F[5])) return false;

    for(l = 1; l <= 4; l++){
        for(m = 1; m <= 4; m++){
            if(d.F[m] != F[(l * m) % 5]) break;
        }
        if(m == 5) return true;
    }
    return false;
}

int main()
{
    dice d1 = dice();
    dice d2 = dice();
    bool eq;

	if(d1.q != d2.q){
		eq = false;
	}else{
        for(int i = 0; i < 2; i++){
            eq = d1.check(d2);
            if(!eq){ d1.roll_a(); eq = d1.check(d2); }
            if(!eq){ d1.roll_a(); eq = d1.check(d2); }
            if(eq || (i == 1)) break;
            d1.roll_b();
        }
    }

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

    return 0;
}

Measured memory_bytes: 1156
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (n); i++)
#define MOD 1000000007
#define INF 1e9
#define All(x) (x).begin(), (x).end()
typedef long long ll;
using namespace std;

bool kaibun(int a){
  string s=to_string(a);
  for(int i=0;i<(int)s.size()/2;i++){
    if(s[i]!=s[s.size() - i - 1]){
      return false;
    }
  }
  return true;
}

int main() {
  int a,b;
  cin>>a>>b;
  int ans=0;
  for(int i=a;i<=b;i++){
    if(kaibun(i))ans++;
  }
  cout<<ans<<"\n";

  return 0;
}


Measured memory_bytes: 256
n = int(input())

if n <= 9:
    print(n)
    
elif 10 <= n <= 99:
    print(9)
    
elif 100 <= n <= 999:
    print(n - 99 + 9)
    
elif 1000 <= n <= 9999:
    print(909)
    
elif 10000 <= n <= 99999:
    print(n - 9999 + 909)
    
elif 100000 <= n:
    print(90909)

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

int main(){
int N,a,b,c;
cin>>N;
for(int i=0;i<N;i++){
cin>>a>>b>>c;
if(a*a+b*b==c*c||b*b+c*c==a*a||c*c+a*a==b*b){
cout<<"YES"<<endl;} else{cout<<"NO"<<endl;}}}

Measured memory_bytes: 1152
#include<bits/stdc++.h>
#define pb push_back
#define f first
#define s second
#define mp make_pair
using namespace std;
typedef long long int ll;
int main(){
    int n;
    cin>>n;
    string str;
    cin>>str;
    int w[n],e[n];
    for(int i=0;i<n;++i){w[i]=0;e[i]=0;}
    if(str[n-1]=='E')e[n-1]=1;
    if(str[0]=='W')w[0]=1;
    for(int i=n-2;i>=0;--i){
        if(str[i]=='E')e[i]=e[i+1]+1;
        else e[i]=e[i+1];
    }
    for(int i=1;i<n;++i){
        if(str[i]=='W')w[i]=w[i-1]+1;
        else w[i]=w[i-1];
    }
    ll max=ll(1e18);
    for(int i=0;i<n;++i)if(e[i]+w[i]-1<max)max=e[i]+w[i]-1;
    cout<<max<<endl;
}

Measured memory_bytes: 3076
#include <stdio.h>
#include <stdlib.h>
int main(){
    int a, b, d, r;
    double f;
    scanf("%d %d", &a, &b);
    d=a/b;
    r=a%b;
    f=(double)a/(double)b;
    printf("%d %d %f\n", d, r, f);
    return 0;
}

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

using namespace std;

int main()
{
    int n,m;
    while(cin >> n >> m){
        if(n == 0 && m == 0)return 0;
        vector<int> vec(n);
        for(int i = 0;i < m;i++){
            for(int j = 0;j < n;j++){
                int c;cin >> c;
                vec.at(j) += c;
            }
        }
        cout<<*max_element(vec.begin(), vec.end())<<endl;
    }
    return 0;
}



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

  unsigned long long cnt = 0;
  while(H>1){
    H/=2;
    cnt++;
  }
  cnt++;

  unsigned long long a = 1;
  REP(i,cnt){
    a*=2;
  }
  cout << a - 1 << endl;
}

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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); 

#define ll long long
#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define mp make_pair
#define pu push
#define pp pop_back
#define in insert
#define ld long double
#define endl '\n'
#define forn(low,high,i) for(i=low;i<high;i++)
#define forrev(high,low,i) for(i = high; i>= low;i--)
#define trace(x) cerr << #x << ": " << x << " " << endl;
#define all(v) v.begin(),v.end()
#define sz(v) (int)v.size()
#define line cout << __LINE__;
#define prv(a) for(auto x : a) cout << x << ' ';cout << '\n';
#define decimal_digits cout << fixed << setprecision(15);
#define sp cout << " ";
#define dbg2(a,b) cerr << #a << " = " << a << " " << #b << " = " << b << '\n';        
#define debug(x) cerr << __LINE__ << ' ' << #x << " = " << x << '\n';

typedef unordered_map<int,int> umi;
typedef unordered_map<ll,ll> uml;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;


clock_t time_p = clock();

void ktj(){
  time_p = clock() - time_p;
  cerr << "Time elapsed : " << (float)(time_p)/CLOCKS_PER_SEC << "\n";
}

int main(){
  fastio

  ll a,b,c,d;
  cin >> a >> b >> c >> d;
  ll x,y,z;
  ll g = c * (d / __gcd(c,d));
  // cerr << g << '\n';
  x = b / c - (a - 1) / c;
  y = b / d - (a - 1) / d;
  z = b / g - (a - 1) / g;
  // cerr << x << ' ' << y << ' ' << z << '\n';
  ll tot = b - a + 1;

  cout << tot - (x + y - z) << '\n';

  ktj();
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		char c = sc.next().charAt(0);
		char[] list = {'a','e','i','o','u' };
		for(int i=0; i<list.length; i++){
			if(c == list[i]){
				System.out.println("vowel");
				return;
			}

		}
		System.out.println("consonant");
	}
}



Measured memory_bytes: 10192
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for i2 in range(j)] for i3 in range(k)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from collections import Counter # a = Counter(A).most_common()
#from itertools import accumulate #list(accumulate(A))

H, W = mi()
S = [input() for _ in range(H)]

dij = [[0, 1], [1, 0], [0, -1], [-1, 0]]
for i in range(H):
    for j in range(W):
        if S[i][j] == '#':
            flag = 0
            for dj, di in dij:
                if -1 < i + di < H and -1 < j + dj < W:
                    if S[i + di][j + dj] == '#':
                        flag = 1
                        break
            if not flag:
                print('No')
                exit()
print('Yes')

Measured memory_bytes: 3064