akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
#define MAXN 100009
#define INF 1000000007
#define mp(x,y) make_pair(x,y)
#define all(v) v.begin(),v.end()
#define pb(x) push_back(x)
#define wr cout<<"----------------"<<endl;
#define ppb() pop_back()
#define tr(ii,c) for(__typeof((c).begin()) ii=(c).begin();ii!=(c).end();ii++)
#define ff first
#define ss second
#define my_little_dodge 46
#define debug(x)  cerr<< #x <<" = "<< x<<endl;
using namespace std;

typedef long long ll;
typedef pair<int,int> PII;
template<class T>bool umin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T>bool umax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
vector<PII>adj[MAXN];
int ans[MAXN];
void dfs(int nd,int pr,int dis){
	ans[nd]=dis;
	tr(it,adj[nd])
		if(it->ff!=pr)
			dfs(it->ff,nd,(dis+it->ss)%2);			
}
int main(){
    //freopen("file.in", "r", stdin);
	int n;
	scanf("%d",&n);
	for(int i=1;i<n;i++){
		int u,v,w;
		scanf("%d%d%d",&u,&v,&w);
		adj[u].pb(mp(v,w));
		adj[v].pb(mp(u,w));	
	}
	dfs(1,-1,0);
	for(int i=1;i<=n;i++)
		printf("%d\n",ans[i]);
	return 0;
}


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


int main(){


int h1,m1,h2,m2,k;
cin >> h1 >> m1 >> h2 >> m2 >> k;

int ans = h2*60 + m2 - h1 * 60 - m1 -k ;

cout << ans << endl;


}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
 
#define MP make_pair
#define PB push_back
#define ALL(x)      (x).begin(),(x).end()
#define REP(i,n)    for(int i=0;i<(n);i++)
#define REP1(i,n)   for(int i=1;i<(n);i++)
#define REP2(i,d,n) for(int i=(d);i<(n);i++)
#define RREP(i,n)   for(int i=(n);i>=0;i--)
#define CLR(a)      memset((a),0,sizeof(a))
#define MCLR(a)     memset((a),-1,sizeof(a))
#define RANGE(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))
 
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI > VVI;
typedef vector<string> VS;
typedef vector<LL> VLL;
typedef pair<int,int> PII;
 
const int INF = 0x3f3f3f3f;
const LL INFL = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-9;
 
const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};

int main() {
    int N, x;
    VI memo;
    cin >> N;

    REP(i, N) {
        cin >> x;
        memo.PB(x);
    }

    sort(ALL(memo), greater<int>());
    int a = 0, b = 0;
    REP(i, N) {
        if(i%2 == 0) {
            a += memo[i];
        } else {
            b += memo[i];
        }
    }

    cout << (a-b) << endl;
}

Measured memory_bytes: 256
"""
i-1行目の右端のマスとi行目の左端のマスが隣接しており、
それらの行においてはそれ以外のマスは隣接していないこと。

以上を満たした場合に'Possible'を出力すればよさそう。
"""
H, W = map(int, input().split())
table = [input() for _ in range(H)]
for i in range(1, H):
    li_pre = [i for i, x in enumerate(table[i - 1]) if x == "#"]
    li_now = [i for i, x in enumerate(table[i]) if x == "#"]
    if len(set(li_pre) & set(li_now)) == 1 and li_pre[-1] == li_now[0]:
        continue
    else:
        print('Impossible')
        exit()
print('Possible')


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

const int N = 2e5+7;

vector<int> v[N];
queue<pair<int, int> > q;

int bfs(int x, int y) {
	q.push({x, 0});
	bool vis[N];
	memset(vis, 0, sizeof(vis));
	while(q.size()) {
		int a = q.front().first, cost = q.front().second; q.pop();

		if (vis[a]) continue;
		if (a == y) return cost;
		vis[a] = 1;

		for(auto i : v[a]) q.emplace(i, cost+1);
	}
}

int main() {
	ios::sync_with_stdio(0); cin.tie(0);
	int n, m; cin >> n >> m;
	for(int i=0; i<m; i++) {
		int a, b;
		cin >> a >> b;
		v[a].push_back(b);
		v[b].push_back(a);
	}
	int tmp = bfs(1, n);
	// cout << tmp << "\n";
	if (tmp == 2) cout << "POSSIBLE" << "\n";
	else cout << "IMPOSSIBLE" << "\n";
}

Measured memory_bytes: 13040
#include <vector>
#include <algorithm>
#include <iostream>
#include <cassert>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <cstdio>
#include <ctime>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <cassert>
#include <bitset>
#include <stack> 

#define INFLL 2000000000000000000
#define INF 2000000000
#define MOD 998244353 
#define BASE 77747
#define PI acos(-1.0)
#define MAXLEN 29

using namespace std;

typedef pair <int, int> pii;
typedef long long ll;
typedef vector <ll> vll;

int n;
int arr[100000];
ll sum = 0;

int main() {
	cin >> n;
	for (int i = 0; i < n; i++) cin >> arr[i];
	sort(arr, arr + n);
	int f = n / 2;
	int l = 0, r = n - 1;
	ll cur1 = 0, cur2 = 0;
	bool ff = true;
	while (l <= r) {
		if (ff) {
			if (l == n / 2) {
				l++;
				continue;
			}
			cur1 += abs(arr[f] - arr[l]);
			f = l;
			l++;
			ff = !ff;
		} else {
			if (r == n / 2) {
				r--;
				continue;
			}
			cur1 += abs(arr[f] - arr[r]);
			f = r;
			r--;
			ff = !ff;
		}
	}
	ff = false;
	f = n / 2;
	l = 0, r = n - 1;
	while (l <= r) {
		if (ff) {
			if (l == n / 2) {
				l++;
				continue;
			}
			cur2 += abs(arr[f] - arr[l]);
			f = l;
			l++;
			ff = !ff;
		} else {
			if (r == n / 2) {
				r--;
				continue;
			}
			cur2 += abs(arr[f] - arr[r]);
			f = r;
			r--;
			ff = !ff;
		}
	}
	cout << max(cur1, cur2) << endl;
	return 0;
}


Measured memory_bytes: 640
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<utility>
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll INF = mod * mod;
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
#define stop char nyaa;cin>>nyaa;

int cnt[1 << 20];
void solve() {
	int n; cin >> n;
	vector<bool> b(1 << n, false);
	rep(i, 1<<n) {
		int t; cin >> t;
		b[i] = t;
	}
	rep(i, (1 << n) - 1) {
		if (!b[i])continue;
		rep(j, n) {
			if ((i&(1 << j)) == 0) {
				int s = i ^ (1 << j);
				cnt[s]++;
			}
		}
	}
	int ans = 0;
	rep(i, (1 << n)) {
		if ((!b[i]) && cnt[i]) {
			cout << -1 << endl; return;
		}
		if (b[i] && !cnt[i]) {
			ans++;
		}
	}
	cout << ans << endl;
}
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	solve();
	//stop
		return 0;
}


Measured memory_bytes: 7240
#include <bits/stdc++.h>
#define Int int64_t

using namespace std;

int main() {
	int N, M;
	string s;
	cin >> N >> M >> s;

	int now = N;
	set<int> st;
	for (int i = 0; i < s.size(); ++i) {
		if (s[i] == '0') { st.insert(i); }
	}
	vector<int> ans;
	while (now > 0) {
		int target = *st.lower_bound(now - M);
		if (target >= now) {
			cout << "-1\n";
			return 0;
		}
		ans.push_back(now - target);
		now = target;
	}
	reverse(ans.begin(), ans.end());
	for (int i = 0; i < ans.size(); ++i) {
		cout << ans[i] << (i < ans.size() - 1 ? " " : "\n");
	}

	return 0;
}


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

int main(){
  ll a,b,c;
  cin >> a >> b >> c;
  if(c-a-b>0 && 4*a*b<(c-a-b)*(c-a-b)){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 3608
use std::io;


fn read_line() -> String {
    let mut line = String::new();

    io::stdin().read_line(&mut line)
        .expect("Failed to read line");
    return line;
}
fn to_i(s: &str) -> i64 {
    return s.trim().parse()
        .expect("Please type a number!");
}

fn main() {

    let l1 = read_line();
    let l2 = read_line();
    let l3 = read_line();
    let l4 = read_line();
    let l5 = read_line();
    let l6 = read_line();
    let a: i64 = to_i(&l1);
    let b: i64 = to_i(&l2);
    let c: i64 = to_i(&l3);
    let d: i64 = to_i(&l4);
    let e: i64 = to_i(&l5);
    let k: i64 = to_i(&l6);

    let mut v = Vec::new();
    v.push(a);
    v.push(b);
    v.push(c);
    v.push(d);
    v.push(e);
    let n = v.len();
    let mut fail = false;
    for i in 0..n {
        for j in i+1..n {
            let l = v[j]-v[i];
            // println!("{} {} {}",i,j,l);
            if l>k {
                fail = true;
                break;
            }
        }
    }
    
    if fail {
        print!(":(");
    } else {
        print!("Yay!");
    }
    


}   

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

int main() {
  string S;
  cin >> S;
  for(int i=0 ; i<S.size() ; i+=2){
    if(S.at(i)=='L'){
      cout  << "No" << endl;
      return 0;
    }
  }
  for (int i=1 ; i<S.size() ; i+=2){
    if (S.at(i)=='R'){
      cout << "No" << endl;
      return 0;
    }
  }
 cout << "Yes" << endl;
}


Measured memory_bytes: 256
#include <vector>
#include <iostream>
#include <cmath>
#include <map>
#include <algorithm>
#include <fstream>
#include <unistd.h>
#include <string>
#include <numeric>
#include <queue>
#include <deque>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
typedef vector<P> vp;
typedef vector<PL> vpl;
typedef vector<vector<P>> vvp;
const int INF = 1001001001;
const ll LINF = 1e18;
const string endstr = "\n";
#define FOR(i, a, b) for(ll i = (a); i < b; i++)
#define REP(i, n) for(ll i = 0; i < n; i++)

template <typename T>
T gcd(T a, T b) {
    return (a == 0) ? b : gcd(b%a, a);
}
template <typename T>
T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}

bool p_comp_fs(const P p1, const P p2){ return p1.first < p2.first;};
bool p_comp_fg(const P p1, const P p2){ return p1.first > p2.first;};
bool p_comp_ss(const P p1, const P p2){ return p1.second < p2.second;};
bool p_comp_sg(const P p1, const P p2){ return p1.second > p2.second;};
template <typename T>
vector<T> uniquen(vector<T> vec){
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
    return vec;
}


int main(){
    ll N, T; cin >> N >> T;
    vl ts(N, 0); REP(i, N) cin >> ts[i];
    ll ret = 0;
    ll i = 0;
    while(i < N){
        ll st = ts[i];
        ll e_idx = i;
        while(e_idx + 1 < N && ts[e_idx] + T >= ts[e_idx + 1]){
            e_idx++;
        }
        ret += ts[e_idx] + T - st;
        i = e_idx + 1;
    }
    cout << ret << endstr;
    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll MOD = 1000000007;
const long long INF = 1LL << 60;

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

int main()
{   
    char c; cin >> c;
    printf("%c\n",c+1);
}
    

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

int main()
{
	ll x,k,d;
	cin >> x >> k >> d;
	x = abs(x);
	ll t= 0;
	t = min(x/d,k);
	x -= t*d;
	k -= t;
	if(k==0)
	{
		cout<<x<<endl;
		return 0;
	}
	k%=2;
	if(k)cout<<abs(x-d)<<endl;
	else cout<<x<<endl;
}


Measured memory_bytes: 3632
def dfs(c, i, j)
  c[i][j] = 0
  (-1..1).each{|di|
    (-1..1).each{|dj|
      if (0...c.size).include?(i+di) && (0...c[0].size).include?(j+dj) && c[i+di][j+dj] == 1
        dfs(c, i+di, j+dj)
      end
    }
  }
end

loop {
  w, h = gets.split.map &:to_i
  break if w == 0
  c = h.times.map{ gets.split.map &:to_i }
  count = 0
  h.times{|i|
    w.times{|j|
      if c[i][j] == 1
        dfs(c, i, j)
        count += 1
      end
    }
  }
  puts count
}


Measured memory_bytes: 15808
/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;



/* Name of the class has to be "Main" only if the class is public. */
public class Main
 
 
{
    static Scanner in = new Scanner(System.in);
    
    public static void solve()
    {
        double r=in.nextDouble();
        
        System.out.println(2*Math.PI*r);
    }
    

    
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		
		int t=1;
		//in.nextLine();
		
		while(t>0)
		{
		    
		    solve();
		    t--;
		}
		
		
	
	//	System.out.println(x);
	}
}


Measured memory_bytes: 37232
/*
　　こんにちは。あたしはｶｳｶﾞｰﾙ。
　　RedcoderになるためAtCoderを巡る旅をしてます。

　　　 　＿_
　　　 ヽ|＿_|ノ　　　　ﾓｫ
　　　　||‘‐‘||ﾚ　　_)_, ―‐ 、
　　　　/(Ｙ (ヽ＿ /・ ヽ　　   ￣ヽ
　　　　∠ ＿ ゝ　 ｀^ヽ ﾉ.::::_(ノヽ
　　　　 _/ヽ　 　　  /ヽ￣￣￣/ヽ
*/

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define dump(x) cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE") << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << endl

#define rep(i, n) REP(i, 0, n)                  // 0, 1, ..., n-1
#define REP(i, x, n) for(int i = x; i < n; i++) // x, x + 1, ..., n-1
#define FOREACH(x, a) for(auto &(x) : (a))

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()

#define COUT(x) cout << (x) << endl

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

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

    string s;
    cin >> s;
    Yes(s[2] == s[3] && s[4] == s[5]);
}


Measured memory_bytes: 256
#include <stdio.h>
int main()
{
  int age;
  int a,b;
  
  scanf("%d", &age);
  
  if(age == 1){
    printf("Hello World\n");
  }
  else if(age == 2){
    scanf("%d %d", &a, &b);
    printf("%d", a + b);
  }
  
  return 0;
}

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

typedef long long ll;

ll n, m, res;
 
int main() {
	cin >> n >> m;
	while (n % 4 != 0 && n <= m) res ^= n++;
	while (m % 4 != 3 && n <= m) res ^= m--;
	cout << res;
	
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define vaibhav ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define mp make_pair
#define pb push_back
#define ll long long int
#define ld long double
#define M  998244353
// freopen("user1.dat", "r", stdin);
// freopen("user1.dat", "w", stdout);



int main()
{
	vaibhav
	int n;
	cin>>n;
	pair<int,int>p[n];
	for(int i=0;i<n;i++)
		cin>>p[i].first>>p[i].second;

	int co=0;

	int f=0;

	for(int i=0;i<n;i++)
	{
		if(p[i].first==p[i].second)
		{
			co++;
		}
		else
			co=0;


		if(co>=3)
			f=1;
	}

	if(f==0)
		cout<<"No\n";
	else
		cout<<"Yes\n";
	return 0;
}

Measured memory_bytes: 3648
#include <stdio.h>
#include <stdlib.h>

#define N_MAX 500001

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

typedef struct node *Node;
Node root = NULL;

void insert(int k){
    Node y = NULL;
    Node x = root;
    Node z;
    
    z = malloc(sizeof(struct node));
    z->key = k;
    z->right = NULL;
    z->left = NULL;
    while(x != NULL){
        y = x;
        if(z->key < x->key){
            x = x->left;
        }else{
            x = x->right;
        }
    }
    z->parent = y;

    if(y == NULL){
        root = z;
    }else if(z->key < y->key){
        y->left = z;
    }else{
        y->right = z;
    }
}

/* 中間順アルゴリズム */
void inorder(Node u){
    if(u == NULL){
        return;
    }
    inorder(u->left);
    printf(" %d",u->key);
    inorder(u->right);
}

/* 先行順アルゴリズム */
void preorder(Node u){
    if(u == NULL){
        return;
    }
    printf(" %d",u->key);
    preorder(u->left);
    preorder(u->right);
}

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




Measured memory_bytes: 25236
/*
    ????????°??§???????????¨????????????
*/

#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#include <limits.h>
#include <iostream>
#include <algorithm>
#include <string>
#include <iterator>
#include <vector>
#define LLU unsigned long long int
#define LL long long int
#define LD long double
using namespace std;
#define LLUmax ULLONG_MAX
#define LLmax LLONG_MAX
#define dmax INT_MAX
#define vd vector<int>
#define vLL vector<long long int>
#define vLLU vector<unsigned long long int> 
#define pb push_back
#define mp make_pair
#define fi first
#define sec second
#define debug printf("asd\n")
#define debugd(a) printf("--%d\n",a)
#define debugdd(a,b) printf("--%d %d\n",a,b)
#define debugarr(a,b) for(int i=0 ; i<b ; i++)printf("%d ",a[i]);printf("\n")
#define newline printf("\n")
#define forin(a,b,c) for(int a=b ; a<c ; a++)
#define forde(a,b,c) for(int a=b ; a<c ; a--)


inline void scd(int &a){scanf("%d",&a);}
inline void scdd(int &a,int &b){scanf("%d %d",&a,&b);}
inline void sctd(int &a,int &b,int &c){scanf("%d %d %d",&a,&b,&c);}
inline void scdlld(long int &a,long int &b){scanf("%I64d %I64d",&a,&b);}
inline void sclld(long long int &a){scanf("%I64d",&a);}

#define scarrd(a,b) for(int i=0 ; i<b ; i++)scanf("%d",&a[i])
#define prdlld(a,b) printf("%I64d %I64d",a,b)
#define prdd(a,b) printf("%d %d",a,b)
#define prd(a) printf("%d",a)
#define prarr(a,b) for(int i=0 ; i<b ; i++)printf("%d ",a[i])
#define iniarr(a,b) for(int i=0 ; i<b ;i++)a[i]=0
#define arr(a,b) int *a=(int *)malloc(b*sizeof(int))
#define llarr(a,b) long long int *a=(long long int *)malloc(b*sizeof(long long int))
#define st(a,b) char *a=(char *)malloc(b*sizeof(char))
#define grav 9.8
#define pi 3.14159265


int main()
{
	LL a,c;
	char b;
	scanf("%lld %c %lld",&a,&b,&c);
	while(b!='?')
	{
		if(b=='+')
		printf("%lld\n",a+c);
		else if(b=='-')
		printf("%lld\n",a-c);
		else if(b=='*')
		printf("%lld\n",a*c);
		else if(b=='/')
		printf("%lld\n",a/c);
		scanf("%lld %c %lld",&a,&b,&c);
	}
	return 0;
}

Measured memory_bytes: 3196
#include <bits/stdc++.h>
#define RANGE(i,n) for(int i=0;i<n;i++)
typedef long long ll;

using namespace std;

signed main() {
    int N;
    cin >> N;
    vector<int> V(N);
    RANGE(i,N) cin >> V[i];
    vector<int> C(N);
    RANGE(i,N) cin >> C[i];

    int res = 0;
    RANGE(i,N){
        if(V[i] > C[i]) res += V[i] - C[i];
    }
        
    cout << res << endl;
}


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

using namespace std;

#define ll long long
#define vi vector<int>
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

string S;

int main(){
    cin >> S;

    rep(i,S.size()){
        if(S[i]=='1') cout << '9';
        else cout << '1';
    }
    cout << endl;
}


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

int main()
{
    int n;
    cin >> n;
    n--;
    int l;
    for(l = 0; l < n; l++) if((n >> l) == 0) break;
    n++;
    int a[502][502];
    for(int k = 1; k <= l; k++){
        for(int i = 0; i < n; i++){
            for(int j = 0; j < n; j++){
                if((i % (1 << k)) / (1 << (k - 1)) != (j % (1 << k)) / (1 << (k - 1))) a[i][j] = k;
            }
        }
    }
    for(int i = 0; i < n; i++){
        for(int j = i + 1; j < n; j++) cout << a[i][j] << " ";
        cout << endl;
    }
}

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

using namespace std;
#define  ll long long
#define ld long double
#define f first
#define s second

int main()
{

    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    string s,s2,s3,s4;
    cin >> s >> s2;
    s3=s , s4=s2;
    reverse(s3.begin() , s3.end());
    reverse(s4.begin() , s4.end());

    if (s4 == s && s3 == s2) cout << "YES\n";
    else cout << "NO\n";
//
    return 0;
}

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

using namespace std;
const int N = 1e5+7;

int w[N],v[N];
long long dp[N];

int main()
{
	int n,W;
	cin>>n>>W;
	for(int i=1;i<=n;i++) cin>>w[i]>>v[i];
	for(int i=0;i<N;i++) dp[i] = 1e12;
	dp[0] = 0;
	for(int i=1;i<=n;i++){
		for(int j = N-2;j >= v[i];j --){ 
			dp[j] = min(dp[j-v[i]]+w[i],dp[j]);
		}
	}
	int ans = 0;
	for(int i=0;i<=N-2;i++){
		if(dp[i]<=W) ans = max(ans,i);
	}
	cout<<ans;
	return 0;
} 

Measured memory_bytes: 4420
# import numpy as np
# import math
# import copy
# from collections import deque
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(10000)


def main():
    H,W,K = map(int,input().split())
    c = [input().rstrip() for i in range(H)]

    res = 0

    for i in range(2**H):
        for j in range(2**W):
            cnt = 0
            for k in range(H):
                for l in range(W):
                    if ((i >> k) & 1) | ((j >> l) & 1):
                        continue
                    if c[k][l] == '#':
                        cnt += 1
            if cnt == K:
                res += 1

    print(res)



main()


Measured memory_bytes: 9196
import java.util.Scanner;

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

    if (a == b) {
      System.out.println("a == b");
    } else if (a > b) {
      System.out.println("a > b");
    } else {
      System.out.println("a < b");
    }
  }
}



Measured memory_bytes: 26184
A,B,C,D=map(int,input().split())
E=0
F=0
if A%D==0:
  E=A//D
else:
  E=A//D+1
if C%B==0:
  F=C//B
else:
  F=C//B+1
if E>=F:
  print("Yes")
else:
  print("No")

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

char s[200], a[2];
int main() {
	bool b;
	int n, m;
	while (scanf("%d%d", &n, &m), n) {
		memset(s, 0, sizeof(s)); rep(i, n)s[i] = '#';
		rep(i, m) {
			scanf("%s", a);
			switch (a[0]) {
			case 'A':
				rep(i, n) { if (s[i] == '#') { s[i] = 'A'; break; } }
				break;
			case 'B':
				b = false;
				for (int i = n - 1; i >= 0; i--) {
					if (s[i] == '#' && (!i || s[i - 1] != 'A') && (i + 1 >= n || s[i + 1] != 'A')) {
						b = true; s[i] = 'B'; break;
					}
				}
				if (!b)rep(i, n) { if (s[i] == '#') { s[i] = 'B'; break; } }
				break;
			case 'C':
				b = false;
				rep(i, n) {
					if (s[i] != '#') {
						if (i + 1 < n&&s[i + 1] == '#') { s[i + 1] = 'C'; b = true; break; }
						if (i&&s[i - 1] == '#') { s[i - 1] = 'C'; b = true; break; }
					}
				}
				if (!b)s[n / 2] = 'C';
				break;
			case 'D':
				int k, Max = -1;
				rep(i, n) {
					if (s[i] != '#')continue;
					int cnt = INT_MAX;
					int t = i - 1;
					for (; t >= 0 && s[t] == '#'; t--);
					cnt = t == -1 ? INT_MAX : i - t;
					t = i + 1;
					for (; t < n&&s[t] == '#'; t++);
					cnt = min(cnt, t == n ? INT_MAX : t - i);
					if (Max < cnt) {
						k = i; Max = cnt;
					}
				}
				s[k] = 'D';
				break;
			}
		}
		printf("%s\n", s);
	}
}

Measured memory_bytes: 3080
#include<bits/stdc++.h>
using namespace std;
int n;
long long a[105]; 
int main()
{
	cin>>n;
	a[0]=2;
	a[1]=1;
	for(int i=2;i<=n;i++)
	{
		a[i]=a[i-1]+a[i-2];
	}
	cout<<a[n]<<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) {
		BufferedReader sc = new BufferedReader(new InputStreamReader(System.in));
		String m = "";
        String ans = "NO";
		try {
			m = sc.readLine();
		} catch (IOException e) {
			e.printStackTrace();
		}
		if (m.matches("^(dream|dreamer|erase|eraser)+$")) {
  		    ans = "YES";
        }

		System.out.println(ans);
	}
}


Measured memory_bytes: 33696
#include<stdio.h>
int main(){
  int a,b,c,k,t;
  scanf("%d%d%d%d",&a,&b,&c,&k);
  if(a<b){t=a;a=b;b=t;}if(a<c){t=a;a=c;c=t;}
  printf("%d",a*(1<<k)+b+c);
}


Measured memory_bytes: 1688
N, K = map(int,input().split())
A = list(map(int,input().split()))
n = A.index(min(A))
n2 = N-1-n
a,b = divmod(n,K-1)
c,d = divmod(n2,K-1)
if b == d == 0:
    print(a+c)
elif b+d < K:
    print(a+c+1)
else:
    print(a+c+2)

Measured memory_bytes: 14008
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i) 
#define PI acos(-1)
#define pcnt __builtin_popcountll
#define rng(a) a.begin(), a.end()
#define sz(x) (int)(x).size()
#define v(T) vector<T>
#define vv(T) v(v(T))
#define fi first
#define se second

using namespace std;
using ll = long long;
using P = pair<int, int>;
using LP = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;

template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) {if (a > b) { a = b; return true; } return false; }

ll INF = 1001001001;
ll LINF = 1001001001001001001ll;

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

    ll n, k;
    cin>>n>>k;

    if (k > (n - 1) * (n - 2) / 2) {
        cout<<-1<<endl;
        return 0;
    }
    ll c = (n - 1) * (n - 2) / 2;
    cout<<n - 1 + c - k<<endl;
    rep(i, n - 1) {
        cout<<1<<" "<<2 + i<<endl;
    }
    for (int i = 2; i < n + 1 && c > k; ++i) {
        for (int j = i + 1; j < n + 1 && c > k; ++j) {
            cout<<i<<" "<<j<<endl;
            c--;
        }
    }
}

Measured memory_bytes: 256
s = input()

def dfs(i, f, sum):
    if i == 3:
        if sum == 7:
            print(f + "=7")
            exit()
    else:
        dfs(i+1, f+"+"+s[i+1], sum + int(s[i+1]))
        dfs(i+1, f+"-"+s[i+1], sum - int(s[i+1]))

dfs(0, s[0], int(s[0]))

Measured memory_bytes: 3060
// Cakes and Donuts

#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <unordered_map>
#include <ios>
#include <iomanip>
#include <string>
#include <numeric>

using namespace std;

int n;

int main() {
    cin >> n;

    for (int cake = 0; cake <= 25; cake++) {
        for (int donuts = 0; donuts <= 18; donuts++) {
            if (cake * 4 + donuts * 7 == n) {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
    return 0;
}


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

using namespace std;

#define LL long long 
#define ULL unsigned long long 
#define LD long double 

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int n, d;
	cin>>n>>d;
	double x[n][d];
	for(int i=0; i<n; i++) {
		for(int j=0; j<d; j++)
			cin>>x[i][j];
	}
	int w = 0;
	for(int i=0; i<n; i++) {
		for(int j=0; j<i; j++) {
			double odl = 0.0;
			for(int z=0; z<d; z++) {
				double y = (x[i][z]-x[j][z])*(x[i][z]-x[j][z]);
				odl+=y;
			}
			int czyk = sqrt(odl);
			if((czyk*czyk)==odl)
				w++;
		}
	}
	cout<<w;
}


Measured memory_bytes: 256
#ARC72 C
n = int(input())
A = list(map(int, input().split()))
# print(A)

def get_ops(init_sign):
    prev_sign = init_sign
    sigma = A[0]
    operations = 0

    if A[0] == 0 and init_sign == '+':
        sigma = 1
        operations = 1
    elif A[0] == 0 and init_sign == '-':
        sigma = -1
        operations = 1
    elif A[0] > 0 and init_sign == '-':
        sigma = -1
        operations = A[0] + 1
    elif A[0] < 0 and init_sign == '+':
        sigma = 1
        operations = abs(A[0]) + 1
        
    for a in A[1:]:
        sigma += a
        if sigma >= 0 and prev_sign == '+':
            diff = sigma+1
            sigma -= diff
            operations += diff
        elif sigma <= 0 and prev_sign == '-':
            diff = abs(sigma)+1
            sigma += diff
            operations += diff
        if prev_sign == '+':
            prev_sign = '-'
        elif prev_sign == '-':
            prev_sign = '+'

    return operations

ops = 0
if A[0] > 0:
    ops = min(get_ops('+'), get_ops('-'))
elif A[0] < 0:
    ops = min(get_ops('+'), get_ops('-'))
else: # if A[0] is 0, try both case
    ops = min(get_ops('+'), get_ops('-'))

print(ops)

Measured memory_bytes: 14648
def printArrLine( arr ):
    print(' '.join(list(map(str,arr))))
    
def inputArrLine():
    return [int(i) for i in input().split()]
    
def insert( arr ):
    n = len(arr)
    printArrLine(arr)
    for i in range(1,n):
        v = arr[i]
        j = i-1
        while j >= 0 and arr[j] > v:
            arr[j+1] = arr[j]
            j = j-1
        arr[j+1] = v
        printArrLine(arr)

n = int(input())

ar = inputArrLine()

insert(ar)




Measured memory_bytes: 5608
$N=<>;
@y=map-$t+($t=$_),glob<>;
($M,$K)=glob<>;
for$i(0..59){
	if($i==0){
		@s=0..$N-1;
		@s[$_-1,$_]=@s[$_,$_-1]for glob<>
	}else{
		@s=map$s[$_],@s
	}
	if($K>>$i&1){
		@y=map$y[$_],@s
	}
}
print$z+=$_,$/for@y


Measured memory_bytes: 30216
#!/usr/bin/env python3

def calcExpectedValue(prob):
  return (prob+1)/2

def solve(n,k,p):
  expLst = [calcExpectedValue(prob) for prob in p]
  cum = [0]*(n+1)
  for i in range(n):
    cum[i+1] = cum[i] + expLst[i]
  ans = 0
  i = 0
  while i+k <= n:
    ans = max(ans,cum[i+k]-cum[i])
    i += 1
  return ans




def main():
  N,K = map(int,input().split())
  p = list(map(int,input().split()))
  print(solve(N,K,p))
  return

if __name__ == '__main__':
  main()


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

#define BeatMeScanf    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define tc(x)          int x; cin >> x; while(x--)
#define ll             long long
#define vi             vector<int>
#define pii            pair<int,int>
#define mii            map<int,int>
#define inf            1<<28
#define mem(x,y)       memset(x, y, sizeof(x))
#define ps(x,y)        fixed<<setprecision(y)<<x
#define show(val)      cout<< #val << " -> " << val << endl
#define Case           cout<< "Case "<< ++cs << ": "
#define all(v)         (v).begin(), (v).end()
#define rall(v)        (v).rbegin(), (v).rend()
#define MOD            1000000007
#define MAX            100005

int main()
{
	BeatMeScanf;

	double r;
	cin >> r;
	double ans = 2.00*acos(-1)*r;
	cout<< ps(ans, 20) <<'\n';
	return 0;
}


Measured memory_bytes: 3796
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<string>
#include<iostream>
#include<cctype>
#include<cstdio>
#include<vector>
#include<stack>
#include<queue>
#include <algorithm>
#include<math.h>
#include<set>
#include<map>
#include <sstream>
#include<iomanip>
#include <ctype.h>

//#include<bits/stdc++.h>





using namespace std;
int main() {


	int n;
	cin >> n;
	int ans = 0;
	
	for (int i = 1; i <= n; i++) {
		string p;
		p = to_string(i);
		int y; y = p.length();
		if (y % 2)ans++;
	}



	cout << ans << endl;
	

	return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		int[] points = new int[n];
		int sum = 0;
		
		for(int i=0; i<points.length; i++) {
			points[i] = sc.nextInt();
			sum += points[i];
		}
		sc.close();
		
		Arrays.sort(points);
		
		if(sum%10 != 0) {
			System.out.println(sum);
		}else {
			boolean isprint = false;
			for(int point: points) {
				if(point%10 != 0) {
					System.out.println(sum - point);
					isprint = true;
					break;
				}
			}
			
			if(!isprint) {
				System.out.print(0);
			}
		}
		
		

	}

}

Measured memory_bytes: 23764
#include<bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>

#define ll long long
//#define bint int1024_t
#define ld long double
#define vect vector<ll>
#define unmap unordered_map
#define pb push_back
#define F first
#define pll pair<ll,ll>
#define S second
#define pi 3.1415926536
#define mod int(1e9+7)
#define mp make_pair
//ios_base::sync_with_stdio(false);cin.tie(NULL);
#define testcases ll t; cin>>t; while(t--)

using namespace std;
//using namespace boost::multiprecision;
//using namespace __gnu_pbds;

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

    ll n, x = 0;
    cin>>n;
    vect v(n);

    for(ll& i:v) cin>>i,x^=i;
    for(ll& i:v) cout<<(x^i)<<" ";
    return 0;
}


Measured memory_bytes: 4756
#include <stdio.h>
#include <iostream>
#include <string.h>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <stdlib.h>
#include <time.h>
#include <limits.h>
#include <assert.h>
using namespace std;
int a, b, q;
long long s[100000], t[100000];
long long shrine(long long x) {
	int l = 0;
	int r = a;
	while (l < r) {
		int m = (l + r) / 2;
		if (s[m] < x) {
			l = m + 1;
		} else {
			r = m;
		}
	}
	long long res = LLONG_MAX;
	if (l < a) {
		res = min(res, abs(x - s[l]));
	}
	if (l > 0) {
		res = min(res, abs(x - s[l - 1]));
	}
	return res;
}
long long temple(long long x) {
	int l = 0;
	int r = b;
	while (l < r) {
		int m = (l + r) / 2;
		if (t[m] < x) {
			l = m + 1;
		} else {
			r = m;
		}
	}
	long long res = LLONG_MAX;
	if (l < b) {
		res = min(res, abs(x - t[l]));
	}
	if (l > 0) {
		res = min(res, abs(x - t[l - 1]));
	}
	return res;
}
long long shrine_temple(long long x) {
	int l = 0;
	int r = a;
	while (l < r) {
		int m = (l + r) / 2;
		if (s[m] < x) {
			l = m + 1;
		} else {
			r = m;
		}
	}
	long long res = LLONG_MAX;
	if (l < a) {
		res = min(res, abs(x - s[l]) + temple(s[l]));
	}
	if (l > 0) {
		res = min(res, abs(x - s[l - 1]) + temple(s[l - 1]));
	}
	return res;
}
long long temple_shrine(long long x) {
	int l = 0;
	int r = b;
	while (l < r) {
		int m = (l + r) / 2;
		if (t[m] < x) {
			l = m + 1;
		} else {
			r = m;
		}
	}
	long long res = LLONG_MAX;
	if (l < b) {
		res = min(res, abs(x - t[l]) + shrine(t[l]));
	}
	if (l > 0) {
		res = min(res, abs(x - t[l - 1]) + shrine(t[l - 1]));
	}
	return res;
}
int main() {
	scanf("%d %d %d", &a, &b, &q);
	for (int i = 0; i < a; i++) scanf("%lld", &s[i]);
	for (int i = 0; i < b; i++) scanf("%lld", &t[i]);
	for (int _q = 1; _q <= q; _q++) {
		long long x;
		scanf("%lld", &x);
		long long ans = min(shrine_temple(x), temple_shrine(x));
		printf("%lld\n", ans);
	}
	return 0;
}

Measured memory_bytes: 2816
vl=Array.new

while 1
	n=gets.split(" ")
	break if n[1]=="?"
	v = n[0].to_i + n[2].to_i if n[1] == "+"
	v = n[0].to_i - n[2].to_i if n[1] == "-"
	v = n[0].to_i * n[2].to_i if n[1] == "*"
	v = n[0].to_i / n[2].to_i if n[1] == "/"
	vl.push v
end

vl.each{|i| puts i}

Measured memory_bytes: 6104
#include<stdio.h>
#define MAX 100
#define W 0
#define G 1
#define B 2
#define INF (1<<21)

int n, M[MAX][MAX];

int prim(){
  int i, v, u, minv, d[MAX], p[MAX], color[MAX], sum=0;

  for(i=0; i<n; i++){
    d[i] = INF;
    p[i] = -1;
    color[i] = W;
  }

  d[0] = 0;

  while(1){
    minv = INF;
    u = -1;
    for(i=0; i<n; i++){
      if(minv > d[i] && color[i] != B){
	u = i;
	minv = d[i];
      }
    }
    if(u == -1) break;
    color[u] = B;
    for(v=0; v<n; v++){
      if(color[v] != B && M[u][v] != INF){
	if(d[v] > M[u][v]){
	  d[v] = M[u][v];
	  p[v] = u;
	  color[v] = G;
	}
      }
    }
  }
  for(i=0; i<n; i++){
    if(p[i] != -1) sum +=M[i][p[i]];
  }
  return sum;
}

int main(){
  int i, j, e, s;
  
  scanf("%d",&n);
  for(i=0; i<n; i++){
    for(j=0; j<n; j++){
      scanf("%d",&e);
      if(e == -1) M[i][j] = INF;
      else M[i][j] = e;
    }
  }

  s = prim();
  
  printf("%d\n",s);

  return 0;
}

Measured memory_bytes: 636
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner in = new Scanner(System.in);
        int n=in.nextInt();
        int[][] array = new int[n][2];
        for(int i=0;i<n;i++){
            array[i][1] = in.nextInt();
            array[i][0] = in.nextInt();
        }
        Arrays.sort(array, (a,b) -> Integer.compare(a[0],b[0]));
        int time=0,flag=0;
        for(int i=0;i<n;i++){
            time+=array[i][1];
            if(time>array[i][0]){
                flag=1;
                break;
            }
        }
        if(flag==1){
            System.out.println("No");
        }else{
            System.out.println("Yes");
        }
    }
}

Measured memory_bytes: 106652
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
int main()
{
    int n;
    cin>>n;
    int a[n+1],b[n+1],c[n];
    stack<int>s;
    int temp=-1;
    for(int i=0;i<n;i++){
        cin>>a[i];
        if(temp==a[i]-1){
            s.push(temp);
        }
        temp=a[i];
    }
    int sum=0;
    for(int i=0;i<n;i++){
        cin>>b[i];
        sum+=b[i];
    }
    for(int i=0;i<n-1;i++) cin>>c[i];
    while(!s.empty()){
        int x=s.top();
        s.pop();
        sum+=c[x-1];
    }
    cout<<sum;
}


Measured memory_bytes: 256
def gs() gets.chomp end
def gi() gets.to_i end
def gsmi() gets.chomp.split.map(&:to_i) end

def desc(ar) ar.sort!{|x,y|y<=>x} end
def min(a,b) a<=b ? a : b end
def max(a,b) a>=b ? a : b end
def sum(ar) ar.inject(:+) end


n = gi # 3 * 10**3
as = gsmi # 10**5

puts sum(as)-n


Measured memory_bytes: 14256
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <map>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
int r = 0;
int gcd(int a,int b) {
	if (b == 0)return a;
	else r++;
	return (gcd(b, a%b));
}
int main()
{
	map<int,int> a;
	int n,k;
	cin>>n;
	rep(i, n)
	{
		cin>>k;
		a[k]++;
		if (a[k] > 1)
		{
			cout<<"NO"<<endl;
			return 0;
		}
	}
	cout<<"YES"<<endl;
	return 0;
}

Measured memory_bytes: 9600
#include <bits/stdc++.h>
#define rep(i, a) for (int i = (int)0; i < (int)a; ++i)
#define rrep(i, a) for (int i = (int)a - 1; i >= 0; --i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define RREP(i, a, b) for (int i = (int)a - 1; i >= b; --i)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define popcount __builtin_popcount
using ll = long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 60;

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

ll gcd(ll n, ll m)
{
	ll tmp;
	while (m != 0)
	{
		tmp = n % m;
		n = m;
		m = tmp;
	}
	return n;
}

ll lcm(ll n, ll m)
{
	return abs(n) / gcd(n, m) * abs(m); //gl=xy
}

using namespace std;

void solve()
{
	ll x,k,d;
	cin>>x>>k>>d;
	if(k<=1e18/d&&abs(x)>=k*d){
		cout<<abs(x)-k*d;
		return;
	}
	ll dis=abs(x)-abs(x)/d*d;
	ll cnt=k-abs(x)/d;
	if(cnt%2==0){
		cout<<dis;
	}
	else{
		cout<<min(dis+d,abs(dis-d));
	}
}

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


Measured memory_bytes: 3664
void main(){
  import std.stdio, std.string, std.conv, std.algorithm;

  int n, q; rd(n, q);
  auto tree=new SquareRootDecomposition(n);
  while(q--){
    auto args=readln.split.to!(int[]);
    if(args[0]==0){
      tree.update(args[1], args[2]+1, args[3]);
    }else{
      writeln(tree.rmin(args[1], args[2]+1));
    }
  }
}

class SquareRootDecomposition{
  import std.algorithm;
  int D=1, nil=-1;
  int[] val, buc, laz;
  this(int n){
    while(D*D<n) D++;
    val.length=D*D;
    buc.length=laz.length=D;
    fill(val, (1<<31)-1);
    fill(buc, (1<<31)-1);
    fill(laz, nil);
  }

  void update(int ql, int qr, int x){
    foreach(k; 0..D){
      int l=k*D, r=(k+1)*D;
      if(r<=ql || qr<=l){
        // 
      }else if(ql<=l && r<=qr){
        buc[k]=x;
        laz[k]=x;
      }else{
        push(k);
        foreach(i; max(l, ql)..min(r, qr)) val[i]=x;
        buc[k]=reduce!(min)(val[l..r]); 
      }
    }
  }

  int rmin(int ql, int qr){
    int ret=(1<<31)-1;
    foreach(k; 0..D){
      int l=k*D, r=(k+1)*D;
      if(r<=ql || qr<=l){
        // 
      }else if(ql<=l && r<=qr){
        chmin(ret, buc[k]);
      }else{
        push(k);
        foreach(i; max(l, ql)..min(r, qr)) chmin(ret, val[i]);
      }
    }
    return ret;
  }

  void push(int k){
    if(laz[k]<0) return;
    val[(k*D)..((k+1)*D)]=laz[k];
    laz[k]=-1;
  }

  void chmin(T)(ref T l, T r){
    if(l>r) l=r;
  }
}

void rd(T...)(ref T x){
  import std.stdio, std.string, std.conv;
  auto l=readln.split;
  assert(l.length==x.length);
  foreach(i, ref e; x) e=l[i].to!(typeof(e));
}


Measured memory_bytes: 3676
#include <bits/stdc++.h>
using namespace std;
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef pair<int, int> Pint;
typedef pair<int64_t, int64_t> Pll;

int main() {
    int64_t N, M, count = 0, ans = 0;
    cin >> N >> M;
    vector<Pll> A(N);
    for (int i = 0; i < N; i++) {
        cin >> A.at(i).first >> A.at(i).second;
    }
    sort(ALL(A));
    for (int i = 0; count < M; i++) {
        if (A.at(i).second + count <= M) {
            ans += A.at(i).first * A.at(i).second;
            count += A.at(i).second;
        }
        else {
            ans += A.at(i).first * (M - count);
            break;
        }

    }
    cout << ans << endl;
}


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

int main(){

  int a,b;
  int c[3];
  cin >> a >> b;
  c[0] = a+b;
  c[1] = a-b;
  c[2] = a*b;
  sort(c,c+3);
  cout << c[2] << endl;


}



Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder_20190707_1
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.ReadLine();

            string[] a = Console.ReadLine().Split(' ');                      

            double answer = 0;

            for(int i = 0; i < a.Length; i++)
            {
                answer += 1 / double.Parse(a[i]);
            }

            Console.WriteLine((1 / answer).ToString());
        }
    }
}


Measured memory_bytes: 11092
Imports System
 
Public Class Test
	Public Shared Sub Main()
        Dim s() As String
        s = Split(Console.ReadLine())
        Dim n, m As Integer
        n = s(0)
        m = s(1)
        Console.WriteLine((100 * n + 1800 * m) * 2 ^ m)
	End Sub
End Class

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

#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef complex<double> point;
#define xx real()
#define yy imag()

#define REP(i, a, b) for(int i = (a); i < (int)(b); i++)
#define REPN(i, a, b) for(int i = (a); i <= (int)(b); i++)
#define FA(it, x) for(__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define SZ(x) (int)(x).size()
#define BE(x) (x).begin(), (x).end()
#define SORT(x) sort(BE(x))
#define _1 first
#define _2 second

#define x1 gray_cat_x1
#define y1 gray_cat_y1

template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

#define file "I1"

const double EPS = 1e-9;
const double PI = acos(-1.);
const int INF = 1e9;
const ll MOD = 1e9 + 7;

const int MAXN = 1e5 + 5;

vi g[MAXN];

int used[MAXN];

int fl = 0;

void dfs(int s, int col){
	used[s] = col;
	REP(i, 0, SZ(g[s])){
		int to = g[s][i];
		if (used[to] == used[s]){
			fl = 1;
		}
		if (!used[to]){
			dfs(to, 3 - col);
		}
	}
}

void solve(){
	int n, m;
	scanf("%d%d", &n, &m);
	REP(i, 0, m){
		int a, b;
		scanf("%d%d", &a, &b);
		g[a].pb(b);
		g[b].pb(a);
	}
	ll ans = 0ll;
	ll cnt1 = 0ll;
	ll cnt2 = 0ll;
	ll cnt0 = 0ll;
	REPN(i, 1, n){
		if (SZ(g[i]) == 0){
			cnt0++;
			continue;
		}
		if (!used[i]){
			fl = 0;
			dfs(i, 1);
			if (fl){
				cnt1++;
			} else {
				cnt2++;
			}
		}
	}
	ans = cnt0 * (2 * n - cnt0) + 2 * cnt2 * cnt2 + 2 * cnt1 * cnt2 + cnt1 * cnt1;
	printf("%lld\n", ans);
}   

int main(){

    //freopen(file".in", "r", stdin); freopen(file".out", "w", stdout);
    int t = 1;
    //cin >> t;
    while(t--){
        solve();    
    }
}


Measured memory_bytes: 10880
#include <iostream>
#include <math.h>
#include <numeric>
#include <vector>
#include <map>
#include <algorithm>
#include <set>
#include <queue>
#include <tuple>
#include <functional>
#include <cstring>

#define PI 3.14159265359
#define INF 1e9
#define LINF 1e18
#define IMOD 1000000007 
#define irep(i,n) for(int  i = 0; i < n; i++)
#define irep2(i,a,n) for(int i = a; i < n; i++)
#define lrep(i,n) for(long long  i = 0; i < n; i++)
#define lrep2(i,a,n) for(long long i = a; i < n; i++)

typedef long long ll;
typedef std::vector<int> v_int;
typedef std::vector<std::vector<int> > v2_int;
typedef std::vector<ll> v_ll;
typedef std::vector<std::vector<ll> > v2_ll;
typedef std::vector<std::string> v_string;
typedef std::vector<std::vector<std::string> > v2_string;
typedef std::vector<bool> v_bool;
typedef std::vector<std::vector<bool> > v2_bool;
typedef std::pair<ll, ll> pll;

using namespace std;

int main() 
{
    ll x;
    cin >> x;

    ll ans = x / 11;
    ans *= 2;
    if(x % 11 != 0) {
        if (x % 11 < 7) {
            ans++;
        } else {
            ans+=2;
        }
    }

    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <iomanip>

#define int long long int
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )

using namespace std;

typedef pair<int, int> P;

const int INF = 1e15;
const int MOD = 1e9+7;

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

    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];

    int c[4] = {};
    int sum = 0;
    rep(i, n){
        c[a[i]]++;
        sum += a[i];
    }

    vector<vector<vector<double>>> dp(n + 1, vector<vector<double>>(n + 1, vector<double>(n + 1)));
    for(int i = 0; i <= n; i++){
        for(int j = 0; j <= n; j++){
            for(int k = 0; k <= n; k++){
                if(i + j + k != 0){
                    dp[i][j][k] += (double)n / (double)(i + j + k);
                    if(i < n && j > 0){
                        dp[i+1][j-1][k] += dp[i][j][k] * (double)(i + 1) / (double)(i + j + k);
                    }
                    if(j < n && k > 0){
                        dp[i][j+1][k-1] += dp[i][j][k] * (double)(j + 1) / (double)(i + j + k);
                    }
                }
                if(k < n){
                    dp[i][j][k+1] += dp[i][j][k] * (double)(k + 1) / (double)(i + j + k + 1);
                }
            }
        }
    }
    cout << fixed << setprecision(10) << dp[c[3]][c[2]][c[1]] << endl;

    return 0;
}


Measured memory_bytes: 216832
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> VI;
typedef vector<VI> VVI;
typedef pair<ll, ll> P;
#define FOR(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(i,n)  FOR(i,0,n)
#define PRINT(V) for (auto v : (V)) cout << v << " "
#define ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const ll INF = numeric_limits<ll>::max();
int main()
{
    string s; cin >> s;
    int n = 0;
    rep(i, s.size()){
        n += s[i] - '0';
    }
    cout << ((n%9 == 0)?"Yes":"No") << endl;
    return 0;
}

Measured memory_bytes: 3780