akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define  rep(i, n) for(int i = 0; i < n; i++) 
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  INF 1LL << 60
typedef long long int LL;
typedef long long int ll;
#define pll pair<ll, ll>
#define F first
#define S second
const int MOD = 1000000007;
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; }
//sort(all(x))とするとソートできるよ
// 10^x は pow(10,(x)) 
// 任意のlogは　対数の底の変換を使う    log(N) / log(任意の底)

void pre(vector<int>& a,const int s,const int t){
    ++a[s];
    --a[t];
}

void imos(vector<int>& a){
    int sz = a.size();
    for(int i = 1;i <= sz;++i){
        a[i] += a[i-1];
    }
}

int main(){
    int N,C;cin >> N >> C;
    vector<int> s(N);
    vector<int> t(N);
    vector<int> c(N);
    rep(i,N)cin >> s[i] >> t[i] >> c[i],++t[i],--c[i];

    vector<vector<int>> rec(C,vector<int>(100010));
    rep(i,N){
        pre(rec[c[i]],s[i],t[i]);
    }
    rep(i,C){
        imos(rec[i]);
    }
    int ans = 0;
    rep(i,100010){
        int tmp = 0;
        rep(j,C)if(rec[j][i])tmp++;
        ans = max(ans,tmp);
    }

    cout << ans << endl;
}


Measured memory_bytes: 13568
[input_n, input_k] = map(int, input().split())

input_v = list(map(int, input().split()))

max_value = 0

for a in range(min(input_n, input_k) + 1):
    for b in range(min(input_n, input_k) - a + 1):
        if (b != 0):
            hold_jewelries = input_v[:a] + input_v[-b:]
        else:
            hold_jewelries = input_v[:a]
        hold_jewelries = sorted(hold_jewelries)

        remove_length = input_k - a - b
        hold_minus = sum(1 for value in hold_jewelries if value < 0)

        hold_value = sum(hold_jewelries[min(hold_minus, remove_length):])

        if (hold_value > max_value):
            max_value = hold_value

print(max_value)


Measured memory_bytes: 3064
import java.io.*;
import java.util.*;
class Main{
	static final long MOD = 1_000_000_007; // 10^9+7
    static final int MAX = 2_147_483_646; // intMax 
    static final int INF = 1_000_000_000; // 10^9  
    public static void main(String[] args) throws Exception {
		hayami saori = new hayami();
		int a = saori.saori_hayami();
		int b = saori.saori_hayami();
		int c = saori.saori_hayami();
		System.out.println((a+b)*c/2);
		
    }
}

class hayami implements Closeable {
	private final InputStream in = System.in;
	private final byte[] hayami = new byte[1024];
	private int Hayami = 0;
	private int saori = 0;
	private boolean HayamiSaori() {
		if (Hayami < saori) {
			return true;
		}else{
			Hayami = 0;
			try {
				saori = in.read(hayami);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (saori <= 0) {
				return false;
			}
		}
		return true;
	}
	private int SaoriHayami() { 
		if (HayamiSaori()) {
            return hayami[Hayami++];
         }else{
             return -1;
         }
	}
	private static boolean hayami_saori(int hayami) { 
		return 33 <= hayami && hayami <= 126;
	}
	public boolean hayamisaori() { 
		while(HayamiSaori() && !hayami_saori(hayami[Hayami])) Hayami++; return HayamiSaori();
	}
	public String nextHayami() {
		if (!hayamisaori()) throw new NoSuchElementException();
		StringBuilder hayamin = new StringBuilder();
		int saori = SaoriHayami();
		while(hayami_saori(saori)) {
			hayamin.appendCodePoint(saori);
			saori = SaoriHayami();
		}
		return hayamin.toString();
	}
	public long saorihayami() {//nextLong
		if (!hayamisaori()) throw new NoSuchElementException();
		long hayami = 0;
		boolean misao = false;
		int saori = SaoriHayami();
		if (saori == '-') {
			misao = true;
			saori = SaoriHayami();
		}
		if (saori < '0' || '9' < saori) {
			throw new NumberFormatException();
		}
		while(true){
			if ('0' <= saori && saori <= '9') {
				hayami *= 10;
				hayami += saori - '0';
			}else if(saori == -1 || !hayami_saori(saori)){
				return misao ? -hayami : hayami;
			}else{
				throw new NumberFormatException();
			}
			saori = SaoriHayami();
		}
	}
	public int saori_hayami() {//nextInt
		long hayami = saorihayami();
		if (hayami < Integer.MIN_VALUE || hayami > Integer.MAX_VALUE) throw new NumberFormatException();
		return (int) hayami;
	}
	public double Hayamin() { //nextDouble
		return Double.parseDouble(nextHayami());
	}
	public void close() {
		try {
			in.close();
		} catch (IOException e) {
		}
    }
    
}

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

int main(){
  bool g[21][21];
  int n;
  int x,y;
  while(cin>>n && n){
    int rx=10,ry=10,dx,dy,dxy;
    char ch;
    memset(g,0,sizeof(g));
    for(int i=0;i<n;i++){
      cin>>x>>y;
      g[x][y]=1;
    }
    cin>>n;
    for(int i=0;i<n;i++){
      cin>>ch>>dxy;
      if(ch=='N') { dx=0;dy=1;}
      else if(ch=='E') { dx=1;dy=0;}
      else if(ch=='S') { dx=0;dy=-1;}
      else {dx=-1;dy=0;}
      while(dxy--){rx+=dx;ry+=dy;g[rx][ry]=0;}
    }
    bool f=0;
    for(int i=0;i<21;i++)
      for(int j=0;j<21;j++){
        if(g[i][j]) f=1;
      }
    if(f) cout<<"No"<<endl;
    else cout<<"Yes"<<endl;
  }
  
  return 0;
}

Measured memory_bytes: 1152
# input
n = int(input())
edges = set(tuple(int(i) for i in input().split()) for _ in range(n-1))


from collections import deque


def make_connection(tree):
    con = [[] for _ in range(n+1)]
    for edge in tree:
        con[edge[0]].append(edge[1])
        con[edge[1]].append(edge[0])
    return con


def diameter(tree):
    c = make_connection(tree)
    _, s = farest(tree, c, 1)
    diam, _ = farest(tree, c, s)
    return diam


def farest(tree, con, i):
    dp = [None for _ in range(n+1)]
    dp[i] = 0
    cand_q = deque()
    cand_q.append(i)

    while len(cand_q) > 0:
        u = cand_q.popleft()

        for v in con[u]:
            if dp[v] is None:
                cand_q.append(v)
                dp[v] = dp[u] + 1
    max_ = max(dp[1:])
    i_max = dp.index(max_)
    return max_, i_max


d = diameter(edges)


print('Second' if d % 3 == 1 else 'First')


Measured memory_bytes: 69988
#include <iostream>

int main(){
	int n;
	
	while(std::cin >> n){
		int count = 0;
		for(int a = 0; a < 10; ++a){
			for(int b = 0; b < 10; ++b){
				for(int c = 0; c < 10; ++c){
					for(int d = 0; d < 10; ++d){
						if(a + b + c + d == n){
							++count;
						}
					}
				}
			}
		}
		std::cout << count << std::endl;
	}
	
	return 0;
}

Measured memory_bytes: 1160
import static java.lang.Integer.parseInt;
import static java.lang.Long.parseLong;
import static java.lang.Math.min;
import static java.lang.System.exit;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {

	static void solve() throws Exception {
		int n = scanInt(), m = scanInt();
		char map[][] = new char[n][];
		for (int i = 0; i < n; i++) {
			map[i] = scanString().toCharArray();
		}
		int dyn[][] = new int[n][m];
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < m; j++) {
				int cans = Integer.MAX_VALUE;
				if (i == 0 && j == 0) {
					cans = map[0][0] == '#' ? 1 : 0;
				}
				if (i > 0) {
					cans = min(cans, dyn[i - 1][j] + (map[i][j] == '#' && map[i - 1][j] != '#' ? 1 : 0));
				}
				if (j > 0) {
					cans = min(cans, dyn[i][j - 1] + (map[i][j] == '#' && map[i][j - 1] != '#' ? 1 : 0));
				}
				dyn[i][j] = cans;
			}
		}
		out.print(dyn[n - 1][m - 1]);
	}

	static int scanInt() throws IOException {
		return parseInt(scanString());
	}

	static long scanLong() throws IOException {
		return parseLong(scanString());
	}

	static String scanString() throws IOException {
		while (tok == null || !tok.hasMoreTokens()) {
			tok = new StringTokenizer(in.readLine());
		}
		return tok.nextToken();
	}

	static BufferedReader in;
	static PrintWriter out;
	static StringTokenizer tok;

	public static void main(String[] args) {
		try {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
			solve();
			in.close();
			out.close();
		} catch (Throwable e) {
			e.printStackTrace();
			exit(1);
		}
	}
}

Measured memory_bytes: 22484
#include<bits/stdc++.h>
using namespace std;
int a[5];
int main(){
	int n;
	for(int i=0;i<3;i++){
		cin>>a[i];
	}
	cin>>n;
	sort(a,a+3);
	for(int i=0;i<n;i++){
		a[2]*=2;
	}
	cout<<a[0]+a[1]+a[2]<<endl;
	return 0;
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll A, B, ans;
int q;
int main()
{

	scanf("%d", &q);
	while(q--)
	{
		cin >> A >> B;
		if(A == 1 && B == 1)
		{
			puts("0");
			continue;
		}
		ll tot = A * B - 1;
		ll sqtot = sqrt(tot);
		while(sqtot * sqtot > tot) --sqtot;
		while((sqtot + 1) * (sqtot + 1) <= tot) ++sqtot;
		ll ans = 2 * sqtot - (sqtot == tot / sqtot);
		if(tot / A != tot / (A + 1) && (A == 1 || tot / A != tot / (A - 1))) --ans;
		if(tot / B != tot / (B + 1) && (B == 1 || tot / B != tot / (B - 1))) --ans;
		cout << ans << endl;
	}
	return 0;
}
		 
	

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
    int left = 0,right = 101,up = 101,down = 0;
    int w, h, num;
    cin >> w >> h >> num;

    int dotx, doty, judge;
    for(int i=0;i<num;i++){
        cin >> dotx >> doty >> judge;
        if(judge == 1){
            if(dotx > left){
                left = dotx;
            }
        }else if(judge == 2){
            if(dotx < right){
                right = dotx;
            }
        }else if(judge == 3){
            if(doty > down){
                down = doty;
            }
        }else if(judge == 4){
            if(doty < up){
                up = doty;
            }
        }
    }


    if(w < right){
        right = w;
    }
    if(h < up){
        up = h;
    }
    int height = up - down;
    int width = right - left;
    if(height < 0){
        height = 0;
    }
    if(width < 0){
        width = 0;
    }

    cout << height * width << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll T,n,a,b,c,d;
map<ll,ll> mp;
ll f(ll x){
    if(x==0)return 0;
    if(x==1)return d;
    if(x==2)return min(d+d,d+a);
    if(mp[x]>0)return mp[x];
    ll l2=(x-1)/2*2;
    ll r2=(x-1)/2*2+2;
    ll l3=(x-1)/3*3;
    ll r3=(x-1)/3*3+3;
    ll l5=(x-1)/5*5;
    ll r5=(x-1)/5*5+5;
    ll res=1e18;
    if(res/d>x)res=x*d;
    res=min(res,(x-l2)*d+a+f((x-1)/2));
    res=min(res,(r2-x)*d+a+f((x-1)/2+1));
    res=min(res,(x-l3)*d+b+f((x-1)/3));
    res=min(res,(r3-x)*d+b+f((x-1)/3+1));
    res=min(res,(x-l5)*d+c+f((x-1)/5));
    res=min(res,(r5-x)*d+c+f((x-1)/5+1));
    mp[x]=res;
    return res;
}
int main(void){
    cin>>T;
    while(T--){
        mp.clear();
        cin>>n>>a>>b>>c>>d;
        cout<<f(n)<<endl;
    }
}


Measured memory_bytes: 4744
import heapq

W, H = map(int, input().split(" "))
que = []
for _ in range(W):
    heapq.heappush(que, (int(input()), 'W'))

for _ in range(H):
    heapq.heappush(que, (int(input()), 'H'))

W += 1
H += 1
ans = 0
while que:
    cost, pos = heapq.heappop(que)
    if pos == 'W':
        ans += cost * H
        W -= 1
    else:
        ans += cost * W
        H -= 1

print(ans)

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

 /********* Credits *********/
 /// Coded by:             ///
 ///     - NikolaP         ///
 ///                       ///
 /// Compiler: C++ 14      ///
 /// Date: 11 - Sep - 2019 ///
 /***************************/

/** typedefs & #defines **/
//{

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

#define forn(i,n)    for(int i = 0 ; i < (int)(n) ; ++i)
#define forv(i,l,n)  for(int i = (int)(l) ; i < (int)(n) ; ++i)

#define all(x)     (x).begin(), (x).end()
#define allr(x)    (x).rbegin(), (x).rend()
#define mems(a,x)  memset((a),(int)(x),sizeof((a)))
#define memsb(a,x) memset((a),(bool)(x),sizeof((a)))

using namespace std;

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

//}

int n,c;
ll w[102];
ll val[102];
ll dp[102][(int)(1e5+4)];

ll f(ll i, ll weight){
    if(weight == 0) return 0;
    if(dp[i][weight] != -1) return dp[i][weight];
    if(i == n) return 0;
    ll temp;
    ll ans = 0;
    if(weight >= w[i]){
        temp = f(i+1,weight - w[i]) + val[i];
        if(temp > ans) ans = temp;
    }

    temp = f(i+1,weight);
    if(temp > ans) ans = temp;

    dp[i][weight] = ans;
    return dp[i][weight];
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(8);
    // cout << fixed;

    cin >> n >> c;
    forn(i,n){
        cin >> w[i] >> val[i];
    }
    mems(dp,-1);
    cout << f(0,c);
    return 0;
}


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

int main() {
  int H,W;
  cin >> H >> W;
  
  for (int i=0; i<W+2; i++) {
    cout << "#";
  }
  
  cout << endl;
  
  for (int i=0; i<H; i++) {
    cout << "#";
    
    vector<char> a(W);
    
    for (int j=0; j<W; j++) {
      cin >> a.at(j);
      
      cout << a.at(j);
    }
    
    cout << "#" << endl;
  }
    
  for (int i=0; i<W+2; i++) {
    cout << "#";
  }
  
  cout << endl;
}

Measured memory_bytes: 3624
#include <iostream>

using namespace std;

int main(int argc, char **argv)
{
	int n, m, c, j;
	
	while(1){
		cin >> n;
		if(n == 0){
			break;
		}
		m = 1000-n;
		c = 0;
		
		for(int i = 100; m != 0; i /= 10){
			j = 5 * i;
			if(m >= j){
				m -= j;
				c++;
			}
		
			while(m >= i){
				m -= i;
				c++;
			}
		}
		
		cout << c << endl;
	}
	
	return 0;
}

Measured memory_bytes: 0
#![allow(unused_parens)]
#![allow(unused_imports)]
#![allow(non_upper_case_globals)]


macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

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

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

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

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

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

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

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


#[cfg(debug_assertions)]
macro_rules! mydbg {
    //($arg:expr) => (dbg!($arg))
    ($arg:expr) => (println!("{:?}",$arg));
}


#[cfg(not(debug_assertions))]
macro_rules! mydbg {
    ($($arg:expr),*) => {};
}


use std::cmp;
use std::collections::HashMap;





fn main() {

    input! { 
       a: usize,
       b: usize,
    }

    
    let mut ans = vec![];
    let mut tmp = 1_i64;
    let mut keta = 0;
    let mut a= a;
    let mut b= b+1;
    while(true){ //1,2,4,8
        let hoge = 2_i64.pow(keta+1);
        let fuga = 2_i64.pow(keta);
        let mut a_m = (a as i64 / hoge) * fuga;
        
        if((a as i64) % hoge >= fuga){
            a_m += ((a as i64) % hoge) -fuga;
        }

        let mut b_m = (b as i64 / hoge) * fuga;
        if((b as i64) % hoge >= fuga){
            b_m += ((b as i64) % hoge) -fuga;
        }

        
        ans.push((b_m-a_m) % 2);



        keta += 1;
        tmp = tmp*2;

        if(tmp> b as i64){break;}
    }
    
    //ans.reverse();
    let mut ret = 0;
    let mut keta = 0;
    for item in ans{
        ret += item * 2_i64.pow(keta);
        keta += 1;
    }
    
    println!("{}",ret);


}


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

using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define erep(i, n) for (ll i = 0; i <= (ll)(n); ++i)
#define FOR(i,a,b) for (ll i = (a); i < (ll)(b); ++i)
#define EFOR(i,a,b) for (ll i = (a); i <= (ll)(b); ++i)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } }


int main() {
    int n; cin >> n;
    vector<vector<int>> string_count(n, vector<int>(26, 0));
    rep(i, n) {
        string s; cin >> s;
        rep(j, s.size()) {
            string_count[i][s[j]-'a']++;
        }
    }


    string ans = "";
    rep(j, 26) {
        int alph_min = INT_MAX;
        rep(i, n) chmin(alph_min, string_count[i][j]);
        ans += string(alph_min, 'a' + j) ;
    }

    cout << ans << endl;

    return 0;
}




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

int main(){
   int N;
   cin >> N;
   vector<int> W(N);
   for (int i=0; i<N; i++)
      cin >> W.at(i);

   vector<int> Abs;
   for (int i=1; i<N; i++){
      Abs.push_back(abs(accumulate(W.begin(), W.begin()+i, 0)-accumulate(W.begin()+i, W.end(), 0)));
   }
   sort(Abs.begin(), Abs.end());
   cout << Abs[0] << 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; 
#define pb          push_back
#define ff          first
#define ss          second
#define ll          int64_t
#define ld          long double
#define mod         1000000007
#define mod2        998244353
#define inf         1000000000000007
#define pi          3.14159265358979323846
#define nl          cout<<"\n"
#define dbg(x)      cerr<<#x<<" = "<<x<<"\n"
#define all(v)      v.begin(),v.end()
#define forn(i,a,b) for(int64_t i=int64_t(a);i<int64_t(b);++i)
#define forb(i,a,b) for(int64_t i=int64_t(a);i>=int64_t(b);--i)
#define fastio()    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);

template<typename T,typename U> static inline void amin(T &x,U y)   {if(y<x)x=y;}
template<typename T,typename U> static inline void amax(T &x,U y)   {if(x<y)x=y;}  

ll lcm(ll a,ll b)       {return (a*b)/__gcd(a,b);} 
ll count_digits(ll n)   {ll dig=floor(log10(n)+1);return dig;}
ll mpow(ll x,ll y,ll p) {ll r=1;x=x%p;while(y>0){if(y&1)r=(r*x)%p;y=y>>1;x=(x*x)%p;}return r;} 
string dec_bin_32(ll n) {string s;for(ll i=31;i>=0;i--){ll k=n>>i;s+=(k&1)?'1':'0';}return s;} 
string dec_bin_64(ll n) {string s;for(ll i=63;i>=0;i--){ll k=n>>i;s+=(k&1)?'1':'0';}return s;} 
ll mod_inv(ll a,ll m)   {ll m0=m,y=0,x=1;if(m==1)return 0;while(a>1){ll q=a/m,t=m;m=a%m,a=t;t=y;y=x-q*y;x=t;}if(x<0)x+=m0;return x;} 

//-------------------------------L_I_Erq34-------------------------------

const ll N=1007;
ll a[N][N],dp[N][N];

int main()
{
	fastio();
	ll z,n,m,t,k,i,j,l,d,h,r;
	ll row,col;
	cin>>row>>col;
	forn(i,1,row+1)
		forn(j,1,col+1)
		{
			char ch;
			cin>>ch;
			if(ch=='#')
				a[i][j]=-1;
		}
	dp[1][1]=1;
	forn(i,1,row+1)
		forn(j,1,col+1)
			if(a[i][j]^-1)
			{
				dp[i][j]+=(a[i-1][j]^-1)?dp[i-1][j]:(ll)0;
				dp[i][j]+=(a[i][j-1]^-1)?dp[i][j-1]:(ll)0;
				dp[i][j]%=mod;
			}
	cout<<dp[row][col]<<"\n";
	cerr<<"\nTime elapsed: "<<1000*clock()/CLOCKS_PER_SEC<<"ms\n";
	return 0;
}


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

using namespace std;

long long int k, n, a, b, c, h, sum;
const int maxn = 100 + 1;
int e[maxn][maxn];
int q[maxn];
int w[maxn];

int main()
{
	cin >> n;
	for (int i = 0; i < n * 2; i++) {
		cin >> q[i];
	}
	sort(q, q + (n * 2));
	for (int i = 0; i < 2 * n; i = i + 2) {
		sum += q[i]; 
	}
	cout << sum;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <cstdio>
#include <string>
#include <cmath>
#include <bits/stdc++.h>
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i,i0,n) for(int (i)=(i0);(i)<(n);(i)++)
#define FORR(i,i0,n) for(int (i)=(n)-1; (i)>=(i0);(i)--)
#define rn return
#define fi first
#define se second
typedef std::pair<int,int> P;
using namespace std;
using ll = long long;


int main(){
    int N,M; cin >> N >> M;
    if (M%2 == 1){cout << "-1"; rn 0;}
    vector<vector<int>> g(N);
    rep(i,M){
        int x,y;
        cin >> x >> y; x--;y--;
        g[y].push_back(x);
        g[x].push_back(y);
    }
    
    vector<pair<int,int>> ans;
    vector<int> degree(N,0);
    vector<int> depth(N,-1);
    
    function<void(int,int)> DFS=[&](int v, int pr){
        for(int u:g[v]){
            if (depth[u] == -1){
                depth[u] = depth[v] + 1;
                DFS(u,v);
            }
            else if(depth[u]>depth[v]) {
                degree[v]++;
                ans.emplace_back(v,u);
            }
        }
        if (degree[v]%2 == 1){
            ans.emplace_back(v,pr);
            degree[v]++;
        }
        else{
            if(pr!=-1){
                ans.emplace_back(pr,v);
                degree[pr]++;
            }
        }
    };
    

    
    depth[0] = 0;
    DFS(0,-1);
    
    for (auto& p:ans){
        cout << p.first + 1 << " " << p.second + 1 << endl;
    }
    rn 0;
}


int mainA(){
    int N;cin >> N;
    vector<int> a(N);
    map<int,int> cnt;
    rep(i,N) {cin >> a[i];cnt[a[i]]++;}
    if (cnt[0] == N) { cout << "Yes"; rn 0;}
    if (N%3!=0) { cout << "No"; rn 0;}
    
    vector<int> all;
    for(auto& e:cnt){
        rep(i,e.second/(N/3)) all.emplace_back(e.first);
    }
    if (all.size() == 3 && (all[0]^all[1]^all[2]) == 0){
        cout << "Yes";
    }
    else{
        cout << "No";
    }
    
    rn 0;
}


Measured memory_bytes: 14836
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
using namespace std;

int main() {
	int sx, sy, tx, ty;
	cin >> sx >> sy >> tx >> ty;
	string go0, back0, go1, back1;
	go0 = "";
	back0 = "";
	go1 = "LU";
	back1 = "RD";
	for (int i = 0; i < abs(ty - sy); i++) {
		go0 += 'U';
		back0 += 'D';
		go1 += 'U';
		back1 += 'D';
	}
	for (int i = 0; i < abs(tx - sx); i++) {
		go0 += 'R';
		back0 += 'L';
		go1 += 'R';
		back1 += 'L';
	}

	go1 += "RD";
	back1 += "LU";

	string path = go0 + back0 + go1 + back1;
	cout << path << endl;
	
}

Measured memory_bytes: 256
#include <cstdio>
#include <string>
  
class List
{
    int* data_; //[4000000];
    int begin_;
    int end_;
public:
    List()
    {
        data_ = new int[4000000];
        begin_ = 2000000;
        end_  = 2000000;
    }
    // ~List()
    // {
    //     delete[] data_;
    // }
    void Insert(int X)
    {
        --begin_;
        data_[begin_] = X;
    }
    void Delete(int X)
    {
        int Index = end_;
        for(int i = begin_; i < end_; ++i){
            if(X == data_[i]){
                Index = i;
                break;
            }
        }
        if(Index == end_) return;
        for(int i = Index; i < end_; ++i){
            data_[i] = data_[i+1];
        }
        end_--;
    }
    void DeleteFirst()
    {
        begin_++;
    }
    void DeleteLast()
    {
        end_--;
    }
    void Show()const
    {
        printf("%d", data_[begin_]);
        for(int i = begin_ + 1; i < end_; ++i){
            printf(" %d", data_[i]);
        }
        printf("\n");
    }
};
  
int main()
{
    List list;
    int n, X;
    std::scanf("%d\n", &n);
    char com[1024];
    for(int i = 0; i < n; ++i){
        std::fgets(com, 1024, stdin);
        if(com[6] == 'F'){
            list.DeleteFirst();
        }else
        if(com[6] == 'L'){
            list.DeleteLast();
        }else{
            int v = 0;
            for(int j = 7; com[j] >= '0' && com[j] <= '9'; ++j){
                v = v*10 + (com[j] - '0');
            }
            if(com[0] == 'i'){
                list.Insert(v);
            }else
            if(com[0] == 'd'){
                list.Delete(v);
            }
        }
    }
    list.Show();
    return 0;
}

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

int main(){
  string S,T;
  cin >> S >> T;
  
  int cnt = 0;
  rep(i,3){
    if(S.at(i) == T.at(i)) cnt++;
  }
  
  cout << cnt << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (size_t i = a; i < b; i++)
#define REP(i,b) FOR(i,0,b)
#define RFOR(i,a,b) for (size_t i = a-1; i >= b; i--)
#define RREP(i,a) RFOR(i,a,0)
#define INF 1e7

int myabs(int n){return n >= 0 ? n : -n;}

int x[111], y[111], h[111], val[111];

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

  REP(i,N) {
    cin>>x[i]>>y[i]>>h[i];
  }

  REP(i,101){
    REP(j,101){
      set<int> st;
      bool flag = true;
      REP(k,N) {
        val[k] = myabs(x[k]-i) + myabs(y[k]-j) + h[k];
        if (h[k] != 0)
          st.insert(val[k]);
      }
      int mxval = *st.begin();
      REP(k,N) {
        if (h[k] == 0 && val[k] - mxval < 0)
          flag = false;
      }
      if (st.size() == 1 && flag) {
        cout<<i<<" "<<j<<" "<<*st.begin()<<endl;
        return 0;
      }

      /*
      int val = myabs(x[0]-i) + myabs(y[0]-j) + h[0];
      if (val < 1 || h[0] )
        continue;
      FOR(k,1,N) {
        if (h[k] == 0)
          continue;
        if (val != myabs(x[k]-i) + myabs(y[k]-j) + h[k])
          break;
        if (k == N-1) {
          cout<<i<<" "<<j<<" "<<val<<endl;
          return 0;
        }
      }
      */
    }
  }

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<algorithm>
#include<cmath>
#include<string>
#include<functional>
using namespace std;
#define ms(x,y) memset(x, y, sizeof(x))
#define lowbit(x) ((x)&(-x))
#define sqr(x) ((x)*(x))
typedef long long LL;
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;
#define endl "\n";


void run_case() {
    int n, m;
    cin >> n >> m;
    vector<int> a(n+1, -1);
    for(int i = 0; i < m; ++i) {
        int s, c;
        cin >> s >> c;
        if(a[s] == -1 || a[s] == c) a[s] = c;
        else {
            cout << -1;
            return;
        }
    }
    if(n > 1 && a[1] == 0) cout << -1;
    else {
        if(a[1] == -1 && n == 1) {
            cout << 0;
            return;
        }
        if(a[1] == -1) a[1] = 1;
        for(int i = 1; i <= n; ++i) cout << (a[i] == -1?0:a[i]);
    }
}


int main() {
    ios::sync_with_stdio(false), cin.tie(0);
    cout.flags(ios::fixed);cout.precision(9);
    //int t; cin >> t;
    //while(t--)
    run_case();
    cout.flush();
    return 0;
}

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

using namespace std;
typedef unsigned long long ll;
const int INF = 1e9;
const ll mod = 1e9 + 7;

void setup(){
	#ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif	
}

int main(){
setup();
	ll T = 1;
	//cin >> T;	
	while (T--){
		ll n; cin >> n;
		ll ans = 0;
		vector<ll> a(n);
		for (int i = 0; i<n; i++) cin >> a[i];
		for (int i = 1; i<n; i++){
			if (a[i] < a[i-1]){
				ans+=a[i-1]-a[i];
				a[i] = a[i-1];
			}
		}
		cout << ans << endl;
	}
}

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

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

    if (b - a == c - b) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }

    return 0;
}

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

int main()
{
  int k, t;
  cin >> k >> t;

  int maxa = -1, a;

  for (int i = 0; i < t; i++){
    cin >> a;
    maxa = max(a, maxa);
  }

  if ((k + 1) / 2 >= maxa){
    cout << 0 << endl;
  } else {
    cout << maxa - (k - maxa + 1) << endl;
  }
}



Measured memory_bytes: 256
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

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

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

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

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

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

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

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

fn main() {
    input!(
        num: usize,
        tasks: [(usize,usize);num],
    );
    let result = solve(num,tasks);
    println!("{}",result);
}

pub fn solve(num: usize,tasks: Vec<(usize,usize)>) -> &'static str {
    let mut tasks = tasks;
    &tasks.sort_by(|&(a1,a2),&(b1,b2)| (a2,a1).cmp(&(b2,b1)));
    let (_,is_ok) = tasks.iter().fold((0,true),|(time,is_ok),&(time_to_take,dead)|
        {
            let time = time + time_to_take;
            (time,is_ok && time <= dead)
        }
    );
    if is_ok {"Yes"} else {"No"}
}


Measured memory_bytes: 13560
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <complex>
#include <string.h>
using namespace std;

//#define int long long
#define reps(i,s,n) for(int (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define rept(i,n) rep(i,(n)+1)
#define repst(i,s,n) reps(i,s,(n)+1)
#define reprt(i,n,t) for(int (i)=(n);(i)>=(t);--(i))
#define repr(i,n) reprt(i,n,0)
#define each(itr,v) for(auto &(itr):(v))
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define tmax(x,y,z) max(x,max(y,z))
#define tmin(x,y,z) min(x,min(y,z))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln '\n'
#define bln(i,n) (((i)==(n)-1)?'\n':' ')
#define dbg(x) cout<<#x" = "<<(x)<<ln<<flush
#define dbga(x,n) {cout<<#x" : ";for(int (i)=0;i<(n);++i){cout<<((x)[i])<<(i==((n)-1)?'\n':' ')<<flush;}}
#define zero(a) memset(a,0,sizeof(a))
#define unq(a) sort(all(a)),a.erase(unique(all(a)),a.end())

//typedef complex<double> P;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vst;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vector<int> > mat;

const ll inf = (ll)1e9+10;
const ll linf = (ll)1e18+10;
const ll mod = (ll)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};
const double eps = 1e-10;

ll mop(ll a,ll b,ll m=mod) {ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return r;}
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b) {return a*b/gcd(a,b);}
bool ool(int x,int y,int h,int w) {return((x<0)||(h<=x)||(y<0)||(w<=y));}
bool deq(double a,double b) {return abs(a-b)<eps;}

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;



int l;
vector<pair<pair<int,int>, int> > p;

signed main() {
	cin >> l;
	int mx = 32 - __builtin_clz(l) - 1;
	rep(i,mx) p.push_back({{i,i+1},1<<(mx-i-1)});
	for(int i=mx-1;i>=0;i--) {
		int v = mx-i-1;
		if (l&1<<i) p.push_back({{0,v+1},(l>>(i+1))<<(i+1)});
	}
	rep(i,19) p.push_back({{i,i+1},0});

	cout << 20 << ' ' << p.size() << endl;
	each(i,p) cout << i.first.first+1 << ' ' << i.first.second+1 << ' ' << i.second << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin>>N;
  int i=N%10;
  if(i==3)cout<<"bon"<<endl;
  else if(i==0||i==1||i==6||i==8)cout<<"pon"<<endl;
  else cout<<"hon"<<endl;
}


Measured memory_bytes: 3528
#include <iostream>
#include <vector>
#include <queue>

using namespace std;

int main()
{
  bool firstFlag = true;
  int N, u, k, v, frontNum, ansNum;
  int depth = 0;

  cin >> N;
  vector<vector<int> > G(N, vector<int>(N, 0));
  vector<int> ansList(N, -1);
  queue<int> q, r;

  for (int i = 0; i < N; i++){
    cin >> u >> k;
    for (int j = 0; j < k; j++){
      cin >> v;
      G[u - 1][v - 1] = 1;
    }
  }
  q.push(0);
  ansList[0] = 0;
  while(!q.empty()){
    frontNum = q.front();
    q.pop();
    for (int i = 0; i < N;i++){
      if(G[frontNum][i] == 0)continue;
      if(ansList[i] != -1)continue;
      ansList[i] = ansList[frontNum] + 1;
      q.push(i);
    }
  }
  for (int i = 0; i < ansList.size();i++){
    cout << i + 1 << " " << ansList[i] << endl;
  }
  return 0;
}


Measured memory_bytes: 3152
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"strconv"
)

var (
	readString func() string
	stdout     *bufio.Writer
)

func init() {
	readString = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = readInt()
	}
	return b
}

func readLengthAndSlice() (int, []int) {
	n := readInt()
	return n, readIntSlice(n)
}

func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(stdout, f, args...)
}

func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(stdout, args...)
}

func eprintln(args ...interface{}) (int, error) {
	return fmt.Fprintln(os.Stderr, args...)
}

// readString() string
// readInt() int
// readIntSlice(n int) []int
// readLengthAndSlice() []int

// -----------------------------------------------------------------------------

func main() {
	defer stdout.Flush()
	s := []byte(readString())
	a := int(s[0] - '0')
	b := int(s[1] - '0')
	c := int(s[2] - '0')
	d := int(s[3] - '0')

	for _, i := range []bool{true, false} {
		for _, j := range []bool{true, false} {
			for _, k := range []bool{true, false} {
				v := a
				var opi, opj, opk string
				if i {
					v += b
					opi = "+"
				} else {
					v -= b
					opi = "-"
				}
				if j {
					v += c
					opj = "+"
				} else {
					v -= c
					opj = "-"
				}
				if k {
					v += d
					opk = "+"
				} else {
					v -= d
					opk = "-"
				}
				if v == 7 {
					printf("%d%s%d%s%d%s%d=7\n", a, opi, b, opj, c, opk, d)
					return
				}
			}
		}
	}
}

// -----------------------------------------------------------------------------


Measured memory_bytes: 640
#include<bits/stdc++.h>
#define long long long
using namespace std;
const int N=1e6;
int n;
vector<string>v;
void dfs(int i,char c,int msk,string s)
{
  //cout<<s<<endl;
  if(i==n)
  {
    v.push_back(s);return ;
  }
  if(msk&(1<<i))
  {
    dfs(i+1,c,msk,s);return ;
  }

  int nxt=0;
  for(int j=0;j<n;j++)
    if(!(msk&(1<<j)))nxt|=(1<<j);
  nxt^=(1<<i);

  for(int sub=nxt; ;sub=(sub-1)&nxt)
  {
    string tmp=s;tmp[i]=c;
    for(int j=0;j<n;j++)if(sub&(1<<j))tmp[j]=c;
    dfs(i+1,c+1,(msk|(1<<i))|sub,tmp);
    if(sub==0)break;
  }
}
int main()
{
  ios_base::sync_with_stdio(0);cin.tie(0);
  cin>>n;string s;s.resize(n);
  dfs(0,'a',0,s);
  sort(v.begin(),v.end());//cout<<v.size()<<endl;
  for(auto x:v)cout<<x<<"\n";

  return 0;
}

Measured memory_bytes: 7796
s = input()
m1 = '00'<s[:2]<'13'
m2 = '00'<s[2:]<'13'
if m1 and m2:
    print('AMBIGUOUS')
elif not m1 and m2:
    print('YYMM')
elif m1 and not m2:
    print('MMYY')
else:
    print('NA')

Measured memory_bytes: 3060
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <cstdio>
#include <algorithm>
#include <functional>
#include <string>
#include <numeric>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;

#define rep(i, a, N) for(int i = a; i < N; i++)

int N;
int dp[100010];

int dfs(int n) {
    if (dp[n] != -1) return dp[n];
    if (n == 0) return 0;

    int ret = n;

    for (int i = 1; i <= n; i *= 6)
        ret = min(ret, dfs(n - i) + 1);
 
     for (int i = 1; i <= n; i *= 9)
        ret = min(ret, dfs(n - i) + 1);

    return dp[n] = ret;
}

int main() {
    cin >> N;

    rep(i, 0, 100010) dp[i] = -1;
    cout << dfs(N) << endl;
}


Measured memory_bytes: 5376
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <utility>
#define INF 0x3f3f3f3f
#define MOD 1000000007
using namespace std;
int dx[4]={0,0,-1,1};
int dy[4]={-1,1,0,0};

int main(){
	int N;
	cin>>N;
	int harau,morau;
	harau=N*800;
	morau=(N/15)*200;
	cout<<harau-morau<<endl;
	return 0;
}

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

public class Main {

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

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		Cube cube = new Cube(br);
		//char[] act = br.readLine().toCharArray();
		//cube.roll(act);
		int count = Integer.parseInt(br.readLine());
		for(int i = 0; i < count; i++){
			cube.search(br);
		}
		//System.out.println(cube.top);
	}
}

class Cube {
	String[] num;
	String top;
	String center;
	String back;
	String bottom;
	String right;
	String left;
	String temp;

	Cube(BufferedReader br) throws IOException {
		num = br.readLine().split(" ");
		this.top = num[0];
		this.center = num[1];
		this.right = num[2];
		this.left = num[3];
		this.back = num[4];
		this.bottom = num[5];
	}

	void south() {
		temp = this.top;
		this.top = this.back;
		this.back = this.bottom;
		this.bottom = this.center;
		this.center = temp;
	}

	void north() {
		temp = this.top;
		this.top = this.center;
		this.center = this.bottom;
		this.bottom = this.back;
		this.back = temp;
	}

	void east() {
		temp = this.top;
		this.top = this.left;
		this.left = this.bottom;
		this.bottom = this.right;
		this.right = temp;
	}

	void west() {
		temp = this.top;
		this.top = this.right;
		this.right = this.bottom;
		this.bottom = this.left;
		this.left = temp;
	}

	void roll(char[] act) {
		for (int i = 0; i < act.length; i++) {
			switch (act[i]) {
			case 'S':
				south();
				break;
			case 'N':
				north();
				break;
			case 'E':
				east();
				break;
			case 'W':
				west();
				break;
			}
		}
	}

	public void search(BufferedReader br) throws IOException {
		String[] numList = br.readLine().split(" ");
		for (int i = 0; i < 6; i++) {
			if (i == 3) {
				this.east();
				}
			if (numList[1].equals(this.center)){
				break;
				} else {
				this.north();
				}
		}
		while (true) 
			if (numList[0].equals(this.top)) {
				break;
				} else {
				this.west();
				}
		System.out.println(right);
	}
}

Measured memory_bytes: 24240
module app;

import core.bitop;

import std.algorithm;
import std.array;
import std.bigint;
import std.container.rbtree;
import std.conv;
import std.stdio;
import std.string;
import std.traits;

struct Input
{
	string n;
}

void parseInput(T)(out Input input, T adapter)
{
	with (input)
	{
		n = adapter.readln();
	}
}

struct Output
{
}

auto main2(Input* input)
{
	int sum = 0;
	foreach (c; input.n)
		sum += c - '0';
	return (sum % 9) == 0 ? "Yes" : "No";
}

alias retType = ReturnType!main2;
static if (!is(retType == void))
{
	unittest { writeln("begin unittest"); }
	auto _placeholder_ = ReturnType!main2.init;

	unittest // example1
	{
		string example =
`123456789`;
		if (example.empty) return;
		Input input = void;
		parseExample(input, example);
		auto result = main2(&input);
		printResult(result);
		assert(result == "Yes");
	}

	unittest // example2
	{
		string example =
`0`;
		if (example.empty) return;
		Input input = void;
		parseExample(input, example);
		auto result = main2(&input);
		printResult(result);
		assert(result == "Yes");
	}

	unittest // example3
	{
		string example =
`31415926535897932384626433832795028841971693993751058209749445923078164062862089986280`;
		if (example.empty) return;
		Input input = void;
		parseExample(input, example);
		auto result = main2(&input);
		printResult(result);
		assert(result == "No");
	}

	unittest { writeln("end unittest"); }

	void parseExample(out Input input, string example)
	{
		parseInput(input, new StringAdapter(example));
	}
}

class StdinAdapter
{
	// readf!"%s"は使えない
	// https://issues.dlang.org/show_bug.cgi?id=19820
	uint readf(alias format, A...)(auto ref A args) { return std.stdio.readf!format(args); }
	string readln() { return std.stdio.readln().strip(); }
}

class StringAdapter
{
	import std.format;
	string _s;
	this(string input) { _s = input; }
	uint readf(alias format, A...)(auto ref A args) { return _s.formattedRead!format(args); }
	string readln()
	{
		auto i = _s.countUntil("\n");
		if (i == -1) i = _s.length;
		string ret = _s[0..i];
		_s = _s[i..$];
		return ret;
	}
}

void printResult(T)(T result)
{
	static if (isFloatingPoint!T) writefln("%f", result);
	else writeln(result);
}

void main()
{
	Input input = void;
	parseInput(input, new StdinAdapter());
	static if (is(retType == void))
		main2(&input);
	else
	{
		auto result = main2(&input);
		printResult(result);
	}
}


Measured memory_bytes: 2804
from sys import stdin

def main():
    from collections import defaultdict
    from math import sqrt
    input = stdin.readline

    h = defaultdict(int)
    h[2] = 1
    for i in range(3, 100000, 2):
        for j in range(3, int(sqrt(i)) + 1, 2):
            while i % j == 0:
                h[j] = 1
                i //= j
        if i > 1:
            h[i] = 1
    k = [0] * 100001
    for key in h.keys():
        if (key + 1) / 2 in h and h[(key + 1) / 2] == 1:
            k[key] = 1
    for i in range(1, 100001):
        k[i] += k[i - 1]
    q = int(input())
    for _ in range(q):
        l, r = map(int, input().split())
        print(k[r] - k[l - 1])
main()

Measured memory_bytes: 7896
N=int(input())
L=list(map(int, input().split(" ")))

L.sort()

counter=0

for i in L:
  for j in L:
    if i==j:
      continue
    for k in L:
      if i==k or j==k:
        continue
      else:
        if i+j>k and j+k>i and k+i> j:
          counter=counter+1

print(counter//6)

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

int main() {
    for (int i = 0; i < 10000; i++) {
        int x_i;
        cin >> x_i;
        if (x_i == 0) break;
        else cout << "Case " << i + 1 << ": " << x_i << endl;
    }
}


Measured memory_bytes: 3020
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
const int maxn=100010;
#define MP make_pair
#define PB push_back
#define lson o<<1,l,mid
#define rson o<<1|1,mid+1,r
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define ROF(i,a,b) for(int i=(a);i>=(b);i--)
#define MEM(x,v) memset(x,v,sizeof(x))
inline ll read(){
	char ch=getchar();ll x=0,f=0;
	while(ch<'0' || ch>'9') f|=ch=='-',ch=getchar();
	while(ch>='0' && ch<='9') x=x*10+ch-'0',ch=getchar();
	return f?-x:x;
}
int main(){
	int a=read(),b=read();
	printf("%d\n",(a+b-1)/b);
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String args[]) {

		Scanner sc = new Scanner(System.in);
		int D = sc.nextInt();
		int N = sc.nextInt();

		if(N == 100) N = 101;
		System.out.println((long)(N * Math.pow(100, D)));
	}

}


Measured memory_bytes: 22996
import itertools
import sys
import numpy as np
input = lambda: sys.stdin.readline().strip()

def main():
    N,K = map(int,input().split())
    itadura = list()
    sunuke_list = [i for i in range(1,N+1)]
    A = list()
    for _ in range(N):
        d = input()
        A.append(map(int,input().split()))
    for ls in A:
        for j in ls:
            itadura.append(j)
    ans = set(sunuke_list) - set(itadura)
    print(len(ans))




main()


Measured memory_bytes: 27168
import std.stdio, std.string, std.conv, std.range, std.algorithm, std.functional;

void main() {
    auto N = readln.chomp.to!long;
    bool[][] shop;
    foreach (i; 0..N) {
        shop ~= readln.split.map!(s => s == "1").array;
    }
    long[][] P;
    foreach (i; 0..N) {
        P ~= readln.split.to!(long[]);
    }

    long func(bool[] b) {
        if (b.length < 10) return max(func(b ~ true), func(b ~ false));
        if (b.all!(a => !a)) {
            return long.min;
        }
        auto po = sum(iota(N).map!(i =>
            P[i][iota(10).count!(j => b[j] && shop[i][j])]));
        return po;
    }

    writeln(func([]));
}


Measured memory_bytes: 508
N = int(input())
S1 = input()
S2 = input()
mod = 10**9+7

if S1[0] != S2[0]:
  ans = 6
  i = 2
else:
  ans = 3
  i = 1
  
while i<N:
  if S1[i] != S2[i]:
    if S1[i-1] != S2[i-1]:
      ans *= 3
    else:
      ans *= 2
    i += 2
    
  else:
    if S1[i-1] != S2[i-1]:
      pass
    else:
      ans *= 2
    i += 1
  ans = ans%mod
  
print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;

char F(char C){
    if(C!='Z')return (char)C+1;
    else return 'A';
}


int main(){
    ll N;
    cin >> N;
    cout<<N*N<<endl;
}




Measured memory_bytes: 256
main(a,b,c,d,e,f){
	for(;scanf("%d%d%d%d%d%d",&a,&b,&c,&d,&e,&f),a|b|c|d|e|f;){
		a+=d,b+=e,c+=f,d=(a-1)/3,a-=d*3,e=(b-1)/3,b-=e*3,d+=e,f=(c-1)/3,c-=f*3;
		e=(a==3)+(b==3)+(c==3);if(a>b)a=b;if(a>c)a=c;
		printf("%d\n",d+f+(a>e?a:e));
	}
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(int i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(int i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(int i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define uniq(x) (x).erase(unique((x).begin(), (x).end()), (x).end())

const int INF = 1e9;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n, m;
    cin >> n >> m;
    vector<pair<int, int>> key;
    int dpl = 1 << n;
    vector<int> dp(dpl, INF);
    
    rep(i, m) {
        int a, b, k = 0;
        cin >> a >> b;
        
        rep(ii, b) {
            int c;
            cin >> c;
            k += 1 << (c - 1);
        }
        
        key.emplace_back(k, a);
    }
    
    dp[0] = 0;
    
    rep(i, m) {
        rep(ii, dpl) {
            dp[ii | key[i].first] = min(dp[ii] + key[i].second, dp[ii | key[i].first]);
        }
    }
    
    if (dp[dpl - 1] == INF) {
        cout << -1 << endl;
    }
    else {
        cout << dp[dpl - 1] << endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
	int t,a,b;
	cin>>t>>a>>b;
	if(t*a<b)
	{
		cout<<t*a;
		return 0;
	}
	else if(t*a>b)
	{
		cout<<b;
		return 0;
	}
	else
	{
		cout<<b;
		return 0;
	}
	return 0;
}

Measured memory_bytes: 256