akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <cstdio>
#include <vector>
using namespace std;

int main() {
    while(true) {
        int n,m; scanf("%d%d", &n, &m);
        if(n==0 && m==0) break;
        vector<pair<int,int> > vt(m);
        for(int j = 0; j < m; j++) vt[j].second = j;
        for(int i = 0; i < n; i++) {
            for(int j = 0; j < m; j++) {
                int x; scanf("%d", &x);
                vt[j].first -= x;
            }
        }
        sort(vt.begin(), vt.end());
        for(int j = 0; j < m; j++) printf("%d%c", vt[j].second+1, " \n"[j+1==m]);
    }
    return 0;
}

Measured memory_bytes: 0
import kotlin.system.exitProcess

fun main(args: Array<String>) {

    val n = readLine()!!.toInt()
    val a = readLine()!!.split(" ").map { it.toInt() }

    val s = a.sorted()
    for(i in 0 until n-1) {
        if(s[i] == s[i+1]) {
            println("NO")
            exitProcess(0)
        }
    }

    println("YES")
}

Measured memory_bytes: 81064
#include "bits/stdc++.h"
using namespace std;
const int MAX = 700000;
const int MOD = 1000000007;

long long  fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
/*第二引数で第一引数を割ったときの切り上げの計算*/
long long int maxtime(long long int x, long long int y){
	return(x + y - 1) / y;

}
/*最大公約数*/
long long int lcm(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;

	if (number2 > number1) {
		m = number2;
		n = number1;
	}
	long long int s = -1;
	while (s != 0) {
		s = m % n;
		m = n;
		n = s;
	}
	return m;
}
/*最大公倍数*/
long long int gcd(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;
	return m / lcm(m, n) * n;
}
/*逆元計算*/
long long int  modinv(long long a, long long m) {
	long long int b = m, u = 1, v = 0;
	while (b) {
		long long int t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
// index が条件を満たすかどうか
vector<long long int >meguru;
bool isOK(int index, int key) {
	if (meguru[index] >= key) return true;
	else return false;
}
// 汎用的な二分探索のテンプレ
int binary_search(int key) {
	int left = -1; //「index = 0」が条件を満たすこともあるので、初期値は -1
	int right = (int)meguru.size(); // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は a.size()
	/* どんな二分探索でもここの書き方を変えずにできる！ */
	while (right - left > 1) {
		int mid = left + (right - left) / 2;

		if (isOK(mid, key)) right = mid;
		else left = mid;
	}
	/* left は条件を満たさない最大の値、right は条件を満たす最小の値になっている */
	return right;
}
long long modpow(long long a, long long n, long long mod) {
	long long res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}
int main() {
	string s1, s2, s3;
	cin >> s1 >> s2 >> s3;
	char a  = toupper(s1[0]);
	char b = toupper(s2[0]);
	char c = toupper(s3[0]);
	cout << a << b << c ;
}


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

using namespace std;

using ll = long long;
using ld = long double;
using P = pair<string, int>;
constexpr ld EPS = 1e-12;
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr int MOD = 1e9 + 7;

template <typename T>
void printv(const vector<T> &v)
{
    int sz = v.size();
    for (int i = 0; i < sz; i++)
    {
        cout << v[i] << " \n"[i == sz - 1];
    }
}

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

    int n;cin>>n;
    set<int> st;
    for (int i = 0; i < n; i++)
    {
        int x;
        cin >> x;
        st.insert(x);
    }
    int res = 0;
    int q;
    cin >> q;
    for (int i = 0; i < q; i++)
    {
        int x;
        cin >> x;
        if (st.find(x) != st.end())
            res++;
    }
    cout << res << endl;
}



Measured memory_bytes: 3172
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<iomanip>
using namespace std;
char s[100010];
long long l,ans;
int main()
{
	cin>>s;
	l=strlen(s);
	for(int i=1;i<l;i++)
	{
		if(s[i-1]!=s[i])
		{
			ans++;
		} 
	}
    cout<<ans<<endl;
 	return 0;
}


Measured memory_bytes: 384
//b.c B-Foods Loved by Everyone
#include<stdio.h>

int main(void){
    int n,m;
    scanf("%d %d",&n,&m);
    int buf[m];
    for(int i=0;i<m;++i){
        buf[i] = 0;
    }
    for(int i=0;i<n;++i){
        int k;
        scanf("%d",&k);
        int a[k];
        for(int i=0;i<k;++i){
            scanf("%d",&a[i]);
            buf[a[i]-1]++;
        }
    }

    int ans=0;
    for(int i=0;i<m;++i){
        if(buf[i]==n){
            ans++;
        }
    }
    printf("%d\n",ans);
    return 0;
}

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

int main() {
    int e;
    while(cin >> e, e) {
        int mini = 2 << 28;
        for(int i = 0; i * i * i <= e; i++) {
            int z = i * i * i;
            for(int j = 0; j * j <= e - z; j++) {
                mini = min(mini, i + j + (e - z - j * j));
            }
        }
        cout << mini << endl;
    }
}

Measured memory_bytes: 1160
import itertools
import math

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

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

ans = 0
if N == 0 or N ==1:
    ans +=0
else:
    ans +=combinations_count(N, 2)

if M == 0 or M ==1:
    ans +=0
else:
    ans +=combinations_count(M, 2)

    
print(ans)

Measured memory_bytes: 3064
# -*- coding: utf-8 -*-
n,m,c = map(int, input().split())
bl = list(map(int, input().split()))

res = 0
for _ in range(n):
    al = list(map(int, input().split()))
    s = sum([al[i]*bl[i] for i in range(m)])+c
    if s>0:
        res += 1

print(res)


Measured memory_bytes: 3060
import java.util.Scanner;
import java.util.Arrays;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[] a = new int[n];
    int ans = 0;
    int sumAlice = 0;
    int sumBob = 0;

    for (int cnt = 0; cnt < n; cnt++) {
      a[cnt] = sc.nextInt();
    }
    Arrays.sort(a);

    for (int cnt = 0; cnt < n; cnt++) {
      int tmp = a[n - cnt -1];
      if (cnt % 2 == 0) {
        sumAlice += tmp;
      }
      else{
        sumBob += tmp;
      }
    }
    ans = sumAlice - sumBob;
    System.out.println(ans);
    sc.close();
  }
}

Measured memory_bytes: 35936
#include <iostream>

using namespace std;

int main()
{
    int n;
    int m;
    int a[10000];

    cin >> n >> m;
    for (int i = 0; i < m; i++)
    {
        cin >> a[i];
    }

    int sum = 0;
    for (int i = 0; i < m; i++)
    {
        sum = sum + a[i];
    }

    if (n - sum < 0)
    {
        cout << -1 << endl;
    }
    else
    {
        cout << n - sum << endl;
    }

    return 0;
}

Measured memory_bytes: 3672
#include<bits/stdc++.h>
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define PI 3.141592653589793238462643383279502884L
#define make_unique(vec) vec.resize(distance(vec.begin(),unique(vec.begin(),vec.end())))
#define Sort(vec) sort(vec.begin(),vec.end())
#define RSort(vec) sort(vec.rbegin(),vec.rend())
#define endl "\n"
#define tr1(i) cout<<i<<endl;
#define tr2(i,j) cout<<i<<" "<<j<<endl;
#define tr3(i,j,k) cout<<i<<" "<<j<<" "<<k<<endl;
#define vvi vector<vector<int> > 
#define vvl vector<vector<ll> >
#define all(st) st.begin(),st.end()
#define vpl vector<pair<ll,ll> >
#define vpi vector<pair<int,int> >
#define pi pair<int,int>
#define pl pair<ll,ll>
#define al vector<list<int> >
#define vs vector<string>
#define vb vector<bool>
#define vi vector<int>
#define vl vector<ll>
#define vc vector<char>
#define rep(i,l,r) for(int i=l;i<r;i++)
#define repit(st) for(auto it=st.begin();it!=st.end();it++)
#define ull unsigned long long int
#define eb emplace_back
#define pb push_back
#define ll long long int
#define minf -(1e18)
#define inf 1e18
#define f first
#define se second
#define mod 1000000007
#define mx 100001
using namespace std;
ll mi(ll n,ll m){ll pw=n%m;ll ex=m-2;ll ans=1;while(ex){if(ex&1) ans = ans*pw%m;pw = pw*pw%m;ex>>=1;}return ans%mod;}
ll pw(ll a,ll n){ll pw=a%mod;ll ex=n;ll ans=1;while(ex){if(ex&1) ans = ans*pw%mod;pw = pw*pw%mod;ex>>=1;}return ans%mod;}
template<typename T>istream &operator>>(istream &is, vector<T> &v) { for (T &t : v) is >> t; return is; }
template<typename T>ostream &operator<<(ostream &os, const vector<T> &v) { for (const T &t : v) {os << t <<" ";} os << '\n'; return os; }
void show(ll x){cout<<x<<" ";}
ll gcd(ll a,ll b){return b==0?a:gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
ll max(ll a,ll b){return a>b?a:b;}
ll min(ll a,ll b){return a<b?a:b;}
ll Abs(ll x){return x>0?x:(-x);}
ll Ceil(ll a,ll b){return a/b+(a%b!=0);}
#define bs binary_search
#define lb lower_bound
#define ub upper_bound
#define mkp make_pair
//#define d double
void solve(){
	string s,t;
	cin>>s;
	cin>>t;
	ll m=s.length();
	ll n=t.length();
	vector<vector<ll>> dp(m+1,vector<ll>(n+1));
	for(int i=1;i<=m;i++){
		for(int j=1;j<=n;j++){
			if(s[i-1]==t[j-1]) dp[i][j]=dp[i-1][j-1]+1;
			else dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
		}
	}
	int i=m,j=n;
	string ans;
	while(i!=0 && j!=0){
		if(s[i-1]==t[j-1]){
			ans+=s[i-1];
			i--;j--;
		}
		else{
			if(dp[i][j]==dp[i-1][j]) i--;
			else j--;
		}
	}
	reverse(all(ans));
	cout<<ans;
	
}
int32_t main(){
int t=1;
//cin>>t;
while(t--){
	solve();
}
 
}

Measured memory_bytes: 70784
#include<stdio.h>
#include<string.h>
#define MAX 2000000
#define INFTY 1000000000

int H,A[MAX+1];

void maxHeapify(int i){
    int l = 2 * i;
    int r = 2 * i  +1;
    int largest,t;
    
    // 左の子、自分、右の子で値が最大のノードを選ぶ
    if(l<=H && A[l]>A[i]) largest=l;
    else largest=i;
    if(r<=H && A[r]>A[largest]) largest=r;
    
    if(largest != i){
        t=A[i];
        A[i]=A[largest];
        A[largest]=t;
        maxHeapify(largest);
    }
}


int extract(){
    int maxv;
    if(H<1) return -INFTY;
    maxv = A[1];
    A[1]=A[H--];
    maxHeapify(1);
    return maxv;
}

void increaseKey(int i, int key) {
    if ( key < A[i] ) return;
    int tmp;
     A[i] = key;
    while ( i > 1 && A[i / 2] < A[i] ) {
        tmp = A[i];
        A[i]=A[i/2];
        A[i/2]=tmp;
       
        i = i / 2;
         }
     }

void insert(int key) {
  H++;
    A[H] = -INFTY;
    increaseKey(H, key);
}

int main(){
int key;
 char com[10];

 while ( 1 ) {
     scanf("%s", com);
     if ( com[0] == 'e' && com[1] == 'n' ) break;
     if ( com[0] == 'i' ) {
         scanf("%d",&key);
         insert(key);
     }else{
         printf("%d\n",extract());
     }
 }
    return 0;
}




Measured memory_bytes: 5656
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
 
int main(){
    ll n,k; cin>>n>>k;
    const ll mod = 998244353;
    vector<pair<ll,ll>> s(k);
    rep(i,k) cin>>s[i].first>>s[i].second;
    vector<ll> dp(n+1,0);
    dp[0] = 1;
    dp[1] = -1;
    rep(i,n){
        ll now = dp[i] = (dp[i]%mod+mod)%mod;
        dp[i+1] += now;
 
        rep(j,k){
            ll l = s[j].first;
            ll r = s[j].second;
            if(i+l<n) dp[i+l] += now;
            if(i+r<n) dp[i+r+1] -= now;
        }
    }
    cout << dp[n-1] << endl;
}

Measured memory_bytes: 4824
//  SMOKE SHISHA PLAY FIFA  // 
#include<bits/stdc++.h>
using namespace std;

typedef long long int ll;
typedef long double ld;

#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL);
#define pll pair<ll,ll>
#define MP make_pair
#define ff first
#define ss second
#define PB push_back
#define mod 1000000007
#define lp(i,start,end) for(ll i=start;i<=end;i++) 
#define deb1(a) cout<<#a<<" = "<<(a)<<endl;
#define deb2(a,b) cout<<#a<<" = "<<(a)<<", "<<#b<<" = "<<(b)<<endl;
#define deb3(a,b,c) cout<<#a<<" = "<<(a)<<", "<<#b<<" = "<<(b)<<", "<<#c<<" = "<<(c)<<endl;


ll modu(ll a, ll b)
{
	ll ans =1;
	while(b>0)
	{
		if(b&1)
		ans = (ans*a)%mod;
		b/=2;
		a = (a*a)%mod;
	}
	return ans;
}

int main()
{
	fastio
	ll n;
	cin>>n;
	if(n)
		cout<<"0"<<endl;
	else
		cout<<"1"<<endl;
	return 0;	
}


Measured memory_bytes: 3660
#include <bits/stdc++.h>
#include <boost/format.hpp>
#include <boost/integer/common_factor_rt.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/optional.hpp>

#ifdef DEBUG
#include "libs/debug.cpp"
#define DEBUG 1
#else
#define DEBUG 0
#endif

#define rep(i, n) repr((i), 0, (n))
#define repr(i, a, t) reps((i), (a), (t), 1)
#define reps(i, a, t, s) for (long long (i) = (a); (i) < (long long)(t); (i) += (s))
#define rrep(i, n) rrepr((i), (n) - 1, 0)
#define rrepr(i, a, t) rreps((i), (a), (t), 1)
#define rreps(i, a, t, s) for (long long (i) = (a); (i) >= (long long)(t); (i) -= (s))
#define each(v, c) for (auto &&(v) : (c))
#define all(c) (c).begin(), (c).end()

using namespace std;
namespace mp = boost::multiprecision;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using ml = mp::cpp_int;
template<typename T>
using optional = boost::optional<T>;
const auto none = boost::none;
const long long MOD = 1e9 + 7;
const long long INF = 1e18;

ll H, W, K;
ll dist(ll h, ll w) {
  auto v = vector<ll>{h, w, H - h - 1, W - w - 1};
  return ceil(*min_element(all(v)) / (ld) K) + 1;
}

int main() {
  cout << fixed << setprecision(10);
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  ifstream ifs;
  if (DEBUG) {
    ifs.open("src/_in.txt");
    cin.rdbuf(ifs.rdbuf());
  }

  cin >> H >> W >> K;
  vector<string> A;
  rep (i, H) {
    string v0;
    cin >> v0;
    A.push_back(v0);
  }

  ll sh, sw;
  rep (h, H) {
    rep (w, W) {
      if (A[h][w] == 'S') {
        sh = h;
        sw = w;
      }
    }
  }

  vector<vector<bool>> seen(H, vector<bool>(W, false));
  seen[sh][sw] = true;

  // K 回でどこまでいけるか
  deque<tuple<ll, ll, ll>> que;
  que.push_back(make_tuple(sh, sw, K));
  vector<ll> dh = {0, 1, 0, -1};
  vector<ll> dw = {1, 0, -1, 0};
  ll ans = dist(sh, sw);
  while (!que.empty()) {
    ll sh, sw, k;
    tie(sh, sw, k) = que.front();
    que.pop_front();
    if (k <= 0) continue;

    rep (i, 4) {
      ll h = sh + dh[i];
      ll w = sw + dw[i];
      if (!(0 <= h && h < H && 0 <= w && w < W)) continue;
      if (A[h][w] == '#') continue;
      if (seen[h][w]) continue;
      ans = min(ans, dist(h, w));
      seen[h][w] = true;
      que.push_back(make_tuple(h, w, k - 1));
    }
  }

  cout << ans << "\n";
}

Measured memory_bytes: 1152
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"
using namespace std;

//#define int long long
#define DBG 1
#define dump(o) if(DBG){cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) if(DBG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#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 each(it,c) for(auto it=(c).begin();it!=(c).end();it++)
#define all(c) c.begin(),c.end()
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9 + 7);
const double EPS = 1e-10;

signed main() {
	vector<int>v(3, 0);
	int sankaku(0), chokkaku(0), eikaku(0), donkaku(0);
	while (cin >> v[0] >> v[1] >> v[2]) {
		sort(all(v));
		if (v[0] + v[1] > v[2]) {
			sankaku++;
			if (v[0] * v[0] + v[1] * v[1] == v[2] * v[2])chokkaku++;
			else if (v[0] * v[0] + v[1] * v[1] < v[2] * v[2])donkaku++;
			else eikaku++;
		}
		else break;
		//cout << sankaku << " " << chokkaku << " " << eikaku << " " << donkaku << endl;

	}
	cout << sankaku << " " << chokkaku << " " << eikaku << " " << donkaku << endl;
	return 0;
}

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

int main(){

    ll n,z,w;

    cin>> n >> z >> w;

    vector<ll> a(n);

    rep(i,n){
        cin >> a[i];
    }
    if(n==1){
        cout << abs(a[0]-w) << endl;
        return 0;
    }

    ll t1=abs(w-a.back());
    ll t2=abs(a.back()-a[a.size()-2]);
    ll ans=max(t1,t2);

    cout << ans <<endl;

    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader reader = new BufferedReader(new InputStreamReader(
				System.in));
		int second = Integer.parseInt(reader.readLine());
		if (second >= 0 && second < 86400) {
			int hh = second / 3600;
			int mm = (second % 3600) / 60;
			int ss = second % 60;
			System.out.println(hh + ":" + mm + ":" + ss);
		}
	}
}

Measured memory_bytes: 24368
#include<bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  long long a,b;
  cin >> a;
  for(int i = 0;i<N-1;++i){
    cin >> b;
    long long m,n,temp;
    m = (a > b ) ? a : b;  
    n = (b > a ) ? a : b;  
    while(m % n != 0){
      temp = n;
      n = m % n;
      m = temp;
    }
    if(a>b) a = b * (a / n);
    else a = a * (b/ n);
  }
  cout << a << endl;
}

Measured memory_bytes: 256
n,m = map(int, input().split())
ppp = []
ppm = []
pmp = []
mpp = []

for _ in range(n):
    x,y,z = map(int, input().split())
    ppp.append(x+y+z)
    ppm.append(x+y-z)
    pmp.append(x-y+z)
    mpp.append(-x+y+z)
else:
    p0 = abs(sum(sorted(ppp)[:m]))
    p1 = abs(sum(sorted(ppm)[:m]))
    p2 = abs(sum(sorted(pmp)[:m]))
    p3 = abs(sum(sorted(mpp)[:m]))
    p4 = sum(sorted(ppp,reverse=True)[:m])
    p5 = sum(sorted(ppm,reverse=True)[:m])
    p6 = sum(sorted(pmp,reverse=True)[:m])
    p7 = sum(sorted(mpp,reverse=True)[:m])
    print(max(p0,p1,p2,p3,p4,p5,p6,p7))

Measured memory_bytes: 3192
#include <stdio.h>

int main(void)
{
    int n,a,b,t1,t2,s=0,i;
    scanf("%d%d%d",&n,&a,&b);
    for(i=1;i<=n;i++){
        t1=i;
        t2=0;
        do{
            t2+=t1%10;
        }while(t1/=10);
        if(t2>=a&&b>=t2)s+=i;
    }
    printf("%d",s);
    return 0;
}

Measured memory_bytes: 128
#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;
#define lli long long int
#define llu unsigned long long int
#define pb push_back
#define rt return 0
#define endln "\n"
#define all(x) x.begin(), x.end()
#define sz(x) (lli)(x.size())
const lli MOD = 1e9 + 7;
// cout << fixed << setprecision(0) << pi <<endl;
// typedef tree<int, null_type, less<int>, rb_tree_tag,
//              tree_order_statistics_node_update>
//     new_data_set;
// for multiset
// typedef tree<int, null_type, less_equal<int>, rb_tree_tag,
//              tree_order_statistics_node_update>
//     new_data_set;
// order_of_key(val): returns the number of values less than val
// find_by_order(k): returns an iterator to the kth largest element (0-based)

void solve() {
    lli n, a, q;
    cin >> n;
    vector<lli> v;
    lli sum = 0;

    map<lli, lli> mp;
    for (lli i = 0; i < n; i++) {
        cin >> a;
        sum += a;
        mp[a]++;
        v.pb(a);
    }
    cin >> q;

    lli b, c;
    while (q--) {
        cin >> b >> c;
        lli val1 = mp[b];
        sum -= val1 * b;
        sum += val1 * c;
        mp[b] = 0;
        mp[c] += val1;
        cout << sum << endl;
    }
}

int main(void) {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    // lli t; cin >> t; while(t--)
    solve();
    rt;
}

Measured memory_bytes: 10128
const main = (input) => {
  input = input.split(' ');
  const A = parseInt(input[0], 10);
  const B = parseInt(input[1], 10);
  
  if(A == 1) A = 14;
  if(B == 1) B = 14;
  
  if (A>B) {
    console.log("Alice");
  }else if(A<B) {
    console.log("Bob");
  }else{
    console.log("Draw");
  }
  
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 7372
import java.util.Scanner;
public class Main {
	static int mod=1000000007;
	static Scanner scan=new Scanner(System.in);
	static int gcd (int a, int b) {return b>0?gcd(b,a%b):a;}
	static long lcm (int a, int b) {return a*b/gcd(a,b);}
	static int max(int a,int b) {return a>b?a:b;}
	static int min(int a,int b) {return a<b?a:b;}
	static long factorial(int i) {return i==1?1:i*factorial(i-1);}
	static int lower_bound(int a[],int key) {
		int low=0,high=a.length;
		while(low<high) {
			int mid=((high-low)/2)+low;
			if(a[mid]<=key)low=mid+1;
			else high=mid;
		}
		return high;
		}
	static int upper_bound(int a[],int key) {
		int low=0,high=a.length;
		while(low<high) {
			int mid=((high-low)/2)+low;
			if(a[mid]<key)low=mid+1;
			else high=mid;
		}
		return high;
		}
	static boolean isPrime (int n) {
		if (n==2) return true;
		if (n<2 || n%2==0) return false;
		double d = Math.sqrt(n);
		for (int i=3; i<=d; i+=2)if(n%i==0){return false;}
		return true;
	}
	static int upper_division(int a,int b) {
		if(a%b==0) {
			return a/b;
		}
		else {
			return a/b+1;
		}
	}
	static long lupper_division(long a,long b) {
		if(a%b==0) {
			return a/b;
		}
		else {
			return a/b+1;
		}
	}
	static long lmax(long a,long b) {return Math.max(a, b);}
	static long lmin(long a,long b) {return Math.min(a, b);}
	static int[] setArray(int a) {
		int b[]=new int[a];
		for(int i=0;i<a;i++) {
			b[i]=scan.nextInt();
		}
		return b;
	}
	static String reverce(String str) {
		String strr="";
		for(int i=str.length()-1;i>=0;i--) {
			strr+=str.charAt(i);
		}
		return strr;
	}
	public static void main(String[]args){
		int a=scan.nextInt();
		int min=1145141919;
		int sum=0;
		for(int i=0;i<a;i++) {
			int x=scan.nextInt();
			sum+=x;
			if(x%10!=0&&min>x)min=x;
		}
		if(sum%10==0) {
			if(min==1145141919) {
				System.out.println(0);
			}
			else {
				System.out.println(sum-min);
			}
		}
		else {
			System.out.println(sum);
		}
	}
}

Measured memory_bytes: 21844
#include<iostream>
#include<vector>
#include<string>
#include<cstdlib>
#include<sstream>
#include<queue>
#include<deque>
#include<cmath>
#include<algorithm>
#include<stack>
#include<map>
#include<set>
#include<iomanip>
#define INF 2147483647
#define lli long long int
#define MOD 1000000007
#define pb push_back

using namespace std;
typedef vector<int> vi;
typedef vector< vector<int> > vvi;
typedef pair<int,int> pii;
typedef vector<pair<int,int>> vpii;
int main() {
	int n; cin >> n;
	string seq; 
	bool f = false;
	for (int i = 0; i < n; i++) {
		char n; cin >> n;
		seq += n;
		if (n == '0'){
			f = true;
		}
	}
	if (!f) {
		cout << 0 << endl;
		return 0;
	}

	//cout << stoi(seq) << endl;
	int ans;
	for (int i = 0; i < n; i++) {
		int check = pow(10,i);
		for (int k = pow(10,i); k < pow(10,i+1); k++) {
			bool flag = false;
			for (int j = 0; j < n-i; j++) {
				//cout << "sub start" << endl;
				//cout << "i = " << i << " j = " << j << endl;
				//cout << seq.substr(j,i+1) << endl;
				//cout << "sub end" << endl;
				//cout << "k = " << k << endl;
				if (stoi(seq.substr(j,i+1)) == check){
					check++;
					flag = true;
					break;
				}
			}
			if (!flag) {
				cout << check << endl;
				return 0;
			}
		}
	}

	return 0;
}

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

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

int main() {
    int a, b, c; cin >> a >> b >> c;
    cout << a + b + c + max(a, max(b, c))*9 << endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#define abs(a) (a>0) ? (a) : (-(a))

int gcd(int x,int y);

int main()
{
    int n,x,i,city[100010],ans;
	scanf("%d %d",&n,&x);
	city[0]=x;
	scanf("%d",&(city[1]));
	ans=abs((city[1]-city[0]));
	for(i=2;i<=n;i++)
	{
		scanf("%d",&(city[i]));
		ans=gcd(ans,abs((city[i]-city[i-1])));
	}
    printf("%d",ans);
}


int gcd(int x,int y)
{
	if(x<y)return gcd(y,x);
	else return ((y!=0) ? gcd(y,x%y) : x);
}

Measured memory_bytes: 512
#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;
signed main(void){
    double x[4],y[4],x0,y0;
    while(cin>>x[0]>>y[0]){
    for(int i=1;i<3;i++)
        cin>>x[i]>>y[i];
    cin>>x0>>y0;
    x[3]=x[0],y[3]=y[0];
    int l=0,r=0;
    for(int i=0;i<3;i++){
        double ax=x[i+1]-x[i],ay=y[i+1]-y[i];
        double px=x[i]-x0,py=y[i]-y0;
        if(ax*py-ay*px<0)
            r=1;
        else
            l=1;
    }
    cout<<(l!=r ? "YES" : "NO")<<endl;
	}
    return 0;
}

Measured memory_bytes: 1216
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import java.util.Scanner;


public class Main {
	
	public static class Walk{
		int x,y;
		
		public Walk(int x, int y){
			this.x = x;
			this.y = y;
		}
	}
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		while(true){
			final int w = sc.nextInt();
			final int h = sc.nextInt();
			
			if(w == 0 && h == 0){
				break;
			}
			
			int[][] map = new int[h][w];
			
			final int sx = sc.nextInt() - 1;
			final int sy = sc.nextInt() - 1;
			
			final int gx = sc.nextInt() - 1;
			final int gy = sc.nextInt() - 1;
			
			final int n = sc.nextInt();
			
			for(int i = 0; i < n; i++){
				final int color = sc.nextInt();
				final int d = sc.nextInt();
				final int x = sc.nextInt() - 1;
				final int y = sc.nextInt() - 1;
				
				for(int j = 0; j < (d == 0 ? 2 : 4); j++){
					for(int k = 0; k < (d == 0 ? 4 : 2); k++){
						map[y + j][x + k] = color;
					}
				}
			}
			
//			for(int j = 0; j < h; j++){
//				for(int k = 0; k < w; k++){
//					System.out.print(map[j][k] + " ");
//				}
//				System.out.println();
//			}
			
			boolean[][] is_visited = new boolean[h][w];
			LinkedList<Walk> queue = new LinkedList<Walk>();
			//int color = map[sy][sx];
			
			if(map[sy][sx] != map[gy][gx]){
				System.out.println("NG");
				continue;
			}
			
			queue.add(new Walk(sx,sy));
			while(!queue.isEmpty()){
				Walk k = queue.poll();
				
				if(is_visited[k.y][k.x]){
					continue;
				}else if(k.x == gx && k.y == gy){
					is_visited[k.y][k.x] = true;
					break;
				}else{
					is_visited[k.y][k.x] = true;
				}
				
				if(k.x != 0 && !is_visited[k.y][k.x - 1] && map[k.y][k.x] == map[k.y][k.x - 1]){
					queue.add(new Walk(k.x - 1, k.y));
				}
				
				if(k.x != w - 1 && !is_visited[k.y][k.x + 1] && map[k.y][k.x] == map[k.y][k.x + 1]){
					queue.add(new Walk(k.x + 1, k.y));
				}
				
				if(k.y != 0 && !is_visited[k.y - 1][k.x] && map[k.y][k.x] == map[k.y - 1][k.x]){
					queue.add(new Walk(k.x, k.y - 1));
				}
				
				if(k.y != h - 1 && !is_visited[k.y + 1][k.x] && map[k.y][k.x] == map[k.y + 1][k.x]){
					queue.add(new Walk(k.x, k.y + 1));
				}
			}
		
			if(is_visited[gy][gx]){
				System.out.println("OK");
			}else{
				System.out.println("NG");
			}
		}

	}

}

Measured memory_bytes: 12000
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> pll;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i < b; i++)
#define pb push_back
const ll mod = 1000000007;

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

    vvl G(n);
    rep(i, m) {
        ll a, b;
        cin >> a >> b;
        a--;  b--;
        G[a].pb(b);
    }

    ll sv, tv;
    cin >> sv >> tv;
    sv--;  tv--;

    vvl dist(n, vl(3, -1));  // dist[i][j] : 移動距離がmod3でjとなる頂点svから頂点iまでの最短距離
    queue<pll> Q;

    dist[sv][0] = 0;
    Q.push(make_pair(sv, 0));
    while(!Q.empty()) {
        ll v = Q.front().first;
        ll c = Q.front().second;
        Q.pop();
        for(auto u : G[v]) {
            ll nc = (c + 1)%3;
            if(dist[u][nc] != -1) {
                continue;
            }
            dist[u][nc] = dist[v][c] + 1;
            Q.push(make_pair(u, nc));
        }
    }
    
    ll ans = dist[tv][0];
    if(ans != -1) {
        ans /= 3;
    }
    
    cout << ans << endl;
    return 0;
}

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

signed main(){
  string S,T,U;
  int A,B;
  cin>>S>>T>>A>>B>>U;
  if(S==U){
    cout<<A-1<<" "<<B<<endl;
  }else{
    cout<<A<<" "<<B-1<<endl;
  }
}

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  vector<int> n(4);
  for(int i = 0; i < 4; i++) cin >> n.at(i);
  
  sort(n.begin(), n.end());
  
  if(n.at(0) == 1 && n.at(1) == 4 && n.at(2) == 7 && n.at(3) == 9){
    cout << "YES\n";
  }
  else cout << "NO\n";
}

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

using namespace std;

int main(){
    int n;
    cin >> n;
    vector<pair<long long, long long>> a(n);
    for(int i = 0; i < n; i++){
        long long x, y;
        cin >> x >> y;
        a[i] = {x, y};
    }
    sort(begin(a), end(a), [](auto x, auto y){return x.first + x.second > y.first + y.second;});
    long long b = 0, c = 0;
    for(int i = 0; i < n; i++){
        if(i % 2 == 0) b += a[i].first;
        else c += a[i].second;
    }
    cout << b - c << endl;
    return 0;
}


Measured memory_bytes: 1792
use std::io;
use std::collections::BTreeSet;

fn main() {
    let (n, y) = {
        let v = read_values::<usize>();
        (v[0], v[1])
    };
    for i in 0..2001 {
        if i > n || 10000 * i > y {
            continue;
        }
        for j in 0..4001 {
            if n < i + j {
                continue;
            }
            let sum = 10000 * i + 5000 * j + (n - i - j) * 1000;
            if sum == y {
                println!("{} {} {}", i, j, n - i - j);
                return;
            }
        }
    }
    println!("-1 -1 -1");
}

fn read_line() -> String {
    let stdin = io::stdin();
    let mut buf = String::new();
    stdin.read_line(&mut buf).unwrap();
    buf
}

fn read_values<T>() -> Vec<T> where T: std::str::FromStr, T::Err: std::fmt::Debug {
    read_line()
        .split(' ')
        .map(|a| a.trim().parse().unwrap())
        .collect()
}

Measured memory_bytes: 4352
import math

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())


def R(n):
    return (10 - n % 10) % 10


def S(n):
    if n % 10 == 0:
        return n
    return (1 + n // 10) * 10


Sum = sum(map(S, [a, b, c, d, e]))
Max = max(map(R, [a, b, c, d, e]))

print(Sum - Max)


Measured memory_bytes: 3316
N = int(input())
Ls = list(map(int, input().split()))

ans = 0
# リストの頭からループし、1つ目の値を保持する
for i in range(len(Ls)- 2):
    first_side = Ls[i]

    for j in range(i + 1, len(Ls)):
        second_side = Ls[j]
        # 2つ目の値が1つ目と異なる値なら
        if first_side != second_side:
            #2つ目の値以降のリストの中に含まれる、条件を満たす数を数える
            ans = ans + len([i for i in Ls[j+1:] if i != first_side and i != second_side and first_side + second_side > i and first_side + i > second_side and second_side + i > first_side])

print(ans)


Measured memory_bytes: 9160
def popcount(x):
  r, q = 0, x
  while x:
    r += 1
    x &= x - 1
  return r, q
 
n = int(input())
r = range(n)
a = [[0, 0] for _ in r]
for i in r:
  for _ in range(int(input())):
    x, y = map(int, input().split())
    a[i][y] |= 1 << (x - 1)
l = (1 << n) - 1 
b = sorted(map(popcount, range(1, l + 1)))
ans = next((i for i, x in reversed(b)
           if all(a[j][0] & x == a[j][1] & l - x == 0 for j in r if x >> j & 1)), 0)
print(ans)


Measured memory_bytes: 6500
//package impQuestions;


import java.util.*;


public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String str,ans;
		str = sc.next();
		if(str.endsWith("s")) ans = str+"es";
		else ans = str+"s";
		System.out.println(ans);
	}

}


Measured memory_bytes: 38428
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define reps(i, n) for (int i = 1; i <= (n); ++i)
#define repd(i, n) for (int i = (n)-1; i >= 0; --i)
#define repds(i, n) for (int i = (n); i > 0; --i)
#define loop(i, x, n) for (int i = (x); i < (n); ++i)
#define loops(i, x, n) for (int i = (x); i <= (n); ++i)
#define loopd(i, x, n) for (int i = (x); i > (n); --i)
#define loopds(i, x, n) for (int i = (x); i >= (n); --i)
#define itrep(i, a) for (auto i = begin(a); i != end(a); ++i)
#define itrepd(i, a) for (auto i = rbegin(a); i != rend(a); ++i)
#define each(i, x) for (auto &&i : x)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define sz(a) ((int)a.size())
#define pow2(n) (n * n)
#define int ll
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
template <class T>
using p_queue = priority_queue<T, vector<T>, greater<T>>;
constexpr ll inf = static_cast<ll>(1e18);
constexpr int iinf = static_cast<int>(1e9);
constexpr double dinf = 1e10;
constexpr ld ldinf = 1e18;
constexpr double eps = 1e-8;
ll mod = static_cast<ll>(1e9 + 7);
template <class T, class... Args>
constexpr void mins(T &a, Args... args) { a = min<T>({a, args...}); }
template <class T, class... Args>
constexpr void maxs(T &a, Args... args) { a = max<T>({a, args...}); }
template <class F>
class FixPoint : private F {
public:
    explicit constexpr FixPoint(F &&f) : F(std::forward<F>(f)) {}
    template <class... Args>
    constexpr decltype(auto) operator()(Args &&... args) const { return F::operator()(*this, std::forward<Args>(args)...); }
};
template <class F>
constexpr decltype(auto) funcs(F &&f) { return FixPoint<F>{std::forward<F>(f)}; }
template <class T>
std::vector<T> vecs(int n, T &&val) { return std::vector<T>(std::forward<int>(n), std::forward<T>(val)); }
template <class... Args>
decltype(auto) vecs(int n, Args &&... args) { return std::vector<decltype(vecs(std::forward<Args>(args)...))>(std::forward<int>(n), vecs(std::forward<Args>(args)...)); }
template <class V, class T>
void fill(V &x, const T &val) { x = val; }
template <class V, class T>
void fill(vector<V> &vec, const T &val) {
    for (auto &&v : vec)
        fill(v, val);
}

void solve() {
    int x;
    cin >> x;
    cout << lcm(x, 360) / x << endl;
}

signed main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
    cout.flush();
    return 0;
}

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

bool IsEcho(int N, string s){
    if(N%2!=0){
        return false;
    }
    else {
        if(s.substr(0,N/2)==s.substr(N/2,N/2)){
        return true;
        }
        else{
        return false;
        }
    }
}

int main(){
    int N; cin >> N;
    string S; cin >> S;
    if(IsEcho(N,S)==true){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <climits>
#include <ctime>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <set>
#include <map>
#include <iostream>
#include <deque>
#include <complex>
#include <string>
#include <iomanip>
#include <sstream>
#include <bitset>
#include <valarray>
#include <iterator>
using namespace std;
typedef long long int ll;
typedef unsigned int uint;
typedef unsigned char uchar;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;

#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RFOR(i,c) for(__typeof((c).rbegin())i=(c).rbegin();i!=(c).rend();i++)
#define ALL(container) container.begin(), container.end()
#define RALL(container) container.rbegin(), container.rend()
#define SZ(container) ((int)container.size())
#define mp(a,b) make_pair(a, b)
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {
os<<"["; FOR(it,t) {if(it!=t.begin()) os<<","; os<<*it;} os<<"]"; return os;
}
template<class T> ostream& operator<<(ostream &os, const set<T> &t) {
os<<"{"; FOR(it,t) {if(it!=t.begin()) os<<","; os<<*it;} os<<"}"; return os;
}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}

const int INF = 1<<28;
const double EPS = 1e-8;
const int MOD = 1000000007;

void dijkstra(const vector< vector<pii> > &g, int s, vector<int> &ret){
	int n = g.size();
	ret = vector<int>(n, INF);
	priority_queue<pii, vector<pii>, greater<pii> > dp;
	dp.push(pii(0, s));
	ret[s] = 0;
	while(!dp.empty()){
		int s = dp.top().second;
		dp.pop();
		FOR(it, g[s]){
			int t = it->first;
			if(ret[t] > ret[s]+it->second){
				ret[t] = ret[s]+it->second;
				dp.push(pii(ret[t], t));
			}
		}
	}
}
int n, m, s, g1, g2;
main(){
	int n;
	while(cin >> n >> m >> s >> g1 >> g2, n){
		vector< vector<pii> > g(n), rg(n);
		REP(i, m){
			int u, v, c;
			cin >> u >> v >> c;
			g[u-1].push_back(pii(v-1, c));
			rg[v-1].push_back(pii(u-1, c));
		}
		vi r1,r2,r3;
		dijkstra(g, s-1, r1);
		dijkstra(rg, g1-1, r2);
		dijkstra(rg, g2-1, r3);
		int ans = INF;
		REP(i, n) ans = min(ans, r1[i] + r2[i] + r3[i]);
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 1256
from math import sqrt
from itertools import accumulate


def common_divisors(x):
    ret = []
    for i in range(1, int(sqrt(x)) + 1):
        if x % i == 0:
            ret.append(i)
            ret.append(x // i)

    return ret


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

sm = sum(a)
cd = common_divisors(sm)

ans = 1
for ecd in cd:
    r = [e % ecd for e in a]
    r.sort()
    acc = [0] + list(accumulate(r))
    for i in range(1, n + 1):
        sub = acc[i-1]
        add = ecd * (n - i + 1) - (acc[n] - acc[i-1])
        if sub == add:
            if sub <= k:
                ans = max(ans, ecd)

print(ans)


Measured memory_bytes: 3188
#include<stdio.h>
#include<iostream>
#include<string>

#define MAX 500000

struct node {
	int key;
	int parent, left, right;
} T[MAX];
int root;

void PrePrint(int t) {
	if (t == -1) return;
	printf(" %d", T[t].key);
	PrePrint(T[t].left);
	PrePrint(T[t].right);
}

void InPrint(int t) {
	if (t == -1) return;
	InPrint(T[t].left);
	printf(" %d", T[t].key);
	InPrint(T[t].right);
}

void initNode(int n) {
	root = -1;
	for (int i = 0; i < n; i++) {
		T[i].key = -1;
		T[i].parent = -1;
		T[i].left = -1;
		T[i].right = -1;
	}
}

void insert(int z) {
	int y = -1; // xの親
	int x = root;
	while (x != -1) {
		y = x;
		if (T[z].key < T[x].key) x = T[x].left;
		else x = T[x].right;
	}
	T[z].parent = y;

	if (y == -1) root = z;
	else if (T[z].key < T[y].key) T[y].left = z;
	else T[y].right = z;
}

bool find(int k) {
	int x = root;
	while (x != -1) {
		if (T[x].key == k) return true;
		if (T[x].key < k) x = T[x].right;
		else x = T[x].left;
	}
	return false;
}

int main() {
	int n = 0;
	scanf("%d", &n);
	initNode(n);
	for (int i = 0; i < n; i++) {
		std::string com;
		std::cin >> com;
		if (com[0] == 'i') {
			int k = 0;
			scanf("%d", &k);
			T[i].key = k;
			insert(i);
		}
		else if (com[0] == 'p') {
			InPrint(root);
			printf("\n");
			PrePrint(root);
			printf("\n");
		}
		else if (com[0] == 'f') {
			int k = 0;
			scanf("%d", &k);
			if (find(k)) {
				printf("yes\n");
			}
			else {
				printf("no\n");
			}
		}
	}
}



Measured memory_bytes: 10944
#include <iostream>

using namespace std;

int main()
{
	int n, b, f, r, v;
	int house[4][3][10] = { 0 };
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> b >> f >> r >> v;
		house[b - 1][f - 1][r - 1] += v;
	}
	for (int i = 0; i < 4; i++) {
		for (int j = 0; j < 3; j++) {
			for (int k = 0; k < 10; k++) {
				cout << " " << house[i][j][k];
			}
			cout << endl;
		}
		if (i < 3) {
			cout << "####################" << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 1168
#include <bits/stdc++.h>
using namespace std;
typedef long long lint;
typedef pair<int,int> P;
const int    INF=(int)1e9;
const int    MOD=(int)1e9+7;
const double EPS=(double)1e-10;
struct Accelerate_Cin{
    Accelerate_Cin(){
        cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);
    };
};



int main(){
  int A,B;
  cin>>A>>B;
  string s;
  cin>>s;

  for(int t=0;t<s.size();t++){
    if(t==A){
      if(s[t]!='-'){
        cout<<"No"<<"\n";
        return 0;
      }
    }else{
      if(s[t]=='-'){
        cout<<"No"<<"\n";
        return 0;
      }
    }
  }

  cout<<"Yes"<<"\n";
  return 0;
}


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

#define ll long long
#define INF 1<<31-1
#define LNF 9223372036854775807
#define PI 3.14159265358979
#define MIN(x,y) ((x)<(y)?(x):(y))
#define MAX(x,y) ((x)<(y)?(y):(x))
#define FOR(i,a,n) for(i=a;i<n;i++)
#define MOD 1000000007
//#define MOD 998244353
#define NUM 200010
 
void swap(int* a,int* b){int tmp=*a;*a=*b;*b=tmp;}
int abs(int a){if(a<0)return -a;return a;}
int dup(int a,int d){if(a%d==0)return a/d;else return a/d+1;}
int mod(int a,int m){if(a<0)return a%m+m;else return a%m;}

void swapl(ll* a,ll* b){ll tmp=*a;*a=*b;*b=tmp;}
ll absl(ll a){if(a<0)return -a;return a;}
ll dupl(ll a,ll d){if(a%d==0)return a/d;else return a/d+1;}
ll modl(ll a,ll m){if(a<0)return a%m+m;else return a%m;}

ll GCD(ll a,ll b){ll c=1,tmp=MAX(a,b);b=MIN(a,b);a=tmp;while(c!=0){c=a%b;a=b;b=c;}return a;}
ll LCM(ll a,ll b){return a*b/GCD(a,b);}

ll factorial(ll n, ll m) {return n < m ? 1 : n*factorial(n-1, m);}

int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}

typedef struct
{
    ll X;
    ll H;
} XF;

int xf_upll(const void*a, const void*b){return((XF*)a)->X<((XF*)b)->X?-1:((XF*)a)->X>((XF*)b)->X?1:0;}

ll bearchm(ll x,XF a[],ll n){
    ll st=0,fi=n-1,te;
    while(st<=fi){
        te=(st+fi)/2;
        if(a[te].X<x){st=te+1;}else{fi=te-1;}
    }
    return st;
}

int main(){
  ll N, D, A;
  ll sum=0, w, m;
  XF list[200000];
  ll k[200001]={0};
  

  scanf("%lld%lld%lld", &N, &D, &A);

  for (int i = 0; i < N; i++)
  {
      scanf("%lld%lld", &(list+i)->X,&(list+i)->H);
  }

  qsort(list, N, sizeof(XF), xf_upll);
  list[N].X = INF;
    for (int i = 0; i < N; i++)
    {
        w -= k[i];
        m = (list[i].H - w + A -1)/A;
        m = m < 0 ? 0 : m;
        w += m*A;
        sum += m;
        
        k[bearchm(list[i].X + 2*D + 1, list, N+1)] += m*A;
    }
    printf("%lld", sum);

  return 0;
}

Measured memory_bytes: 7932
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep1(i, n) for(ll i = 1; i < (ll)(n); i++)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#define INF (1e9)
#define PI (acos(-1))
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl

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> inline auto __lcm(T& a, T& b) 
{ return a * b / __gcd(a, b); }

template<typename T> void remove(std::vector<T>& vector, unsigned int index)
{ vector.erase(vector.begin() + index); }


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

  int sum = a + b + c;
  if (sum >= 22) print("bust");
  else print("win");

  return 0;
}


Measured memory_bytes: 256
n = int(input())
a = [int(i) for i in input().split()]

minus = sum(i <= 0 for i in a) #0以下の数
#m = [i for i in a if i <= 0] #負の数リスト
#s = [i for i in a if i > 0] #正の数リスト
abs = [abs(i) for i in a] #リストの数を絶対値に変換
  
if minus%2 == 0 or 0 in a:
  print(sum(abs))
else:
  abs[abs.index(min(abs))] *= -1
  print(sum(abs))
  

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

const double PI = acos(-1.0);

int main(){
    int a,b,h,m;
    cin >> a >> b >> h >> m;
    double ha = (double)(h*60 + m)/720*(PI*2);
    double ma = (double)m/60*(PI*2);
    double angle = ha - ma;
    double ans = sqrt(a*a+b*b-2.0*a*b*cos(angle));
    cout << fixed << setprecision(10) << ans << endl;
}

Measured memory_bytes: 4104
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define LLMAX (1ll << 60) - 1
#define INTMAX (1 << 30) - 1
#define MOD 1000000007 
#define NMAX 1000*100+1

#define numberOfSetBits(S) __builtin_popcount(S) // __builtin_popcountl(S) __builtin_popcountll(S)
#define MSET(x,y) memset(x,y,sizeof(x))
#define gcd(a,b) __gcd(a,b)
#define all(x)  x.begin(),x.end()
#define isOn(S, j) (S & (1 << j))
#define endl '\n'
#define setBit(S, j) (S |= (1 << j))
#define clearBit(S, j) (S &= ~(1 << j))
#define toggleBit(S, j) (S ^= (1 << j))
#define print(x)    for(auto it:x) cout<<it<<' '; cout<<endl;
#define printii(x)  for(auto it:x) cout<<it.F<<' '<<it.S<<'\t';  cout<<endl;
#define in(x,n)   for(int e=0;e<n;e++){ll y;cin>>y;x.pb(y);}

#define vi vector<ll>
#define vvi vector<vi>
#define ii pair<ll,ll>
#define pll pair<ll,ll>
#define vii vector<ii>
#define vvii vector<vii>
#define viii vector<pair<ii,ll>>
#define pb push_back
#define F first
#define S second
#define mp make_pair
#define mc(a,b,c) mp(mp(a,b),c)
struct mint {
    typedef decay<decltype(MOD)>::type T; 
    T v; explicit operator T() const { return v; }
    mint() { v = 0; }
    mint(ll _v) { 
        v = (-MOD < _v && _v < MOD) ? _v : _v % MOD;
        if (v < 0) v += MOD;
    }
    friend bool operator==(const mint& a, const mint& b) { 
        return a.v == b.v; }
    friend bool operator!=(const mint& a, const mint& b) { 
        return !(a == b); }
    friend bool operator<(const mint& a, const mint& b) { 
        return a.v < b.v; }   
    mint& operator+=(const mint& m) { 
        if ((v += m.v) >= MOD) v -= MOD; 
        return *this; }
    mint& operator-=(const mint& m) { 
        if ((v -= m.v) < 0) v += MOD; 
        return *this; }
    mint& operator*=(const mint& m) { 
        v = (ll)v*m.v%MOD; return *this; }
    mint& operator/=(const mint& m) { return (*this) *= inv(m); }
    friend mint pow(mint a, ll p) {
        mint ans = 1; assert(p >= 0);
        for (; p; p /= 2, a *= a) if (p&1) ans *= a;
        return ans;
    }
    friend mint inv(const mint& a) { assert(a.v != 0); 
        return pow(a,MOD-2); }
        
    mint operator-() const { return mint(-v); }
    mint& operator++() { return *this += 1; }
    mint& operator--() { return *this -= 1; }
    friend mint operator+(mint a, const mint& b) { return a += b; }
    friend mint operator-(mint a, const mint& b) { return a -= b; }
    friend mint operator*(mint a, const mint& b) { return a *= b; }
    friend mint operator/(mint a, const mint& b) { return a /= b; }
};
vi a,b;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,t,m,z;
    mint ans = 0;
    cin>>n>>m;
    in(a,n);
    in(b,m);
    sort(all(a));
    sort(all(b));
    mint x=0,y=0;
    for(int i=0;i<n-1;i++){
        mint x1 = a[i+1]-a[i];
        x+=(i+1)*(n-i-1)*x1;
    }
    for(int i=0;i<m-1;i++){
        mint x2 = b[i+1]-b[i];
        y+=(i+1)*(m-i-1)*x2;
    }
    ans = x*y;
    cout<<ans.v;
    


    return 0;
}

Measured memory_bytes: 2676
#include<iostream>
#include<vector>
using namespace std;
int main() {
  int N,M;
  cin >> N >> M;
  vector<int> A(N,-1);
  int i,s,c;
  bool F = true;
  for(i=0;i<M;i++) {
    cin >> s >> c;
    if(A[s-1] < 0 || A[s-1] == c)A[s-1] = c;
    else F = false;
  }
  if(N != 1 && A[0] == 0)F = false;
  if(N == 1 && A[0] == -1)A[0] = 0;
  if(!F)cout << -1 << endl;
  else {
    cout << (A[0]==-1?1:A[0]);
    for(i=1;i<N;i++)cout << (A[i]==-1?0:A[i]);
    cout << endl;
  }
}

Measured memory_bytes: 256