akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <string>
#include <sstream>
#include <algorithm>
#include <random>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#include <cassert>
#include <climits>
#include <bitset>
#include <functional>
#include <iomanip>

#define FOR_LT(i, beg, end) for (int i = beg; i < end; i++)
#define FOR_LE(i, beg, end) for (int i = beg; i <= end; i++)
#define FOR_DW(i, beg, end) for (int i = beg; end <= i; i--)

using namespace std;

unordered_multimap<int, int> edge;

void search_circle(int i, int n, deque<int>& ans)
{
	vector<int> score(n, -1);
	vector<int> prev(n, -1);

	score[i] = 0;
	queue<int> search;
	search.push(i);

	while (!search.empty()) {
		int c = search.front();
		search.pop();

		auto it = edge.find(c);
		while (it != edge.end() && it->first == c) {
			if (it->second == i) {
				int p = it->first;
				ans.push_front(p);
				while (p != i) {
					p = prev[p];
					ans.push_front(p);
				}
				return;
			}

			if (score[it->second] == -1) {
				score[it->second] = score[c] + 1;
				prev[it->second] = c;
				search.push(it->second);
			}

			it++;
		}
	}
}

void search(int n, deque<int>& ans) {
	FOR_LT(i, 0, n) {
		deque<int> cur;
		search_circle(i, n, cur);
		if (cur.size() == 0) continue;

		if (ans.empty() || cur.size() < ans.size()) {
			ans = cur;
		}
	}

	return;
}

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

	int n, m; cin >> n >> m;
	FOR_LT(i, 0, m) {
		int a, b; cin >> a >> b;
		edge.insert({ a - 1, b - 1 });
	}

	deque<int> ans;
	search(n, ans);
	if (ans.size() == 0) {
		cout << -1 << endl;
	}
	else {
		cout << ans.size() << endl;
		while (!ans.empty()) {
			cout << ans.front() + 1 << endl;
			ans.pop_front();
		}
	}

	return 0;
}

Measured memory_bytes: 384
width, height, num = map(int, input().rstrip("\n").split())
area = [0, width, 0, height]
for _ in range(num):
    x, y, a = map(int, input().rstrip("\n").split())
    area[a - 1] = [max, min][(a - 1) % 2](area[a - 1], [x, y][a > 2])

print(max(0, area[1] - area[0]) * max(0, area[3] - area[2]))


Measured memory_bytes: 3060
#include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
#include <algorithm>
using namespace std;

#define MAX_N 100
#define MAX_EDGE_COST 20000
int Graph[MAX_N+1][MAX_N+1];
int n;

int prim(int initial_vertex) {
  bool visited[n+1];
  for(int i=1;i<=n;i++) visited[i] = false;
  vector<int> vertexes;
  vertexes.push_back(initial_vertex);
  visited[initial_vertex] = true;
  int total_edge_cost = 0;
  while(vertexes.size() < n) {
    // find minimum edge cost in vertexes
    int minimum_edge_cost = MAX_EDGE_COST;
    int next_v;
    for(int i=0;i<vertexes.size();i++) {
      int v = vertexes[i];
      for(int j=1;j<=n;j++) {
        if(!visited[j]) {
          if(Graph[v][j] != -1) {
            if(Graph[v][j] < minimum_edge_cost) {
              minimum_edge_cost = Graph[v][j];
              next_v = j;
            }
          }
        }
      }
    }
    visited[next_v] = true;
    vertexes.push_back(next_v);
    total_edge_cost += minimum_edge_cost;
  }
  return total_edge_cost;
}

int main() {
  scanf("%d",&n);
  for(int i=1;i<=n;i++) {
    for(int j=1;j<=n;j++) {
      scanf("%d ",&Graph[i][j]);
    }
  }
  printf("%d\n",prim(1));
}

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

int main(void){

  int A,B;
  cin>>A>>B;
  if(A==B)
  cout<<"Draw"<<endl;
  else if(A==1)
  cout<<"Alice"<<endl;
  else if(B==1)
  cout<<"Bob"<<endl;
  else if(A>B)
  cout<<"Alice"<<endl;
  else
  cout<<"Bob"<<endl;
}

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

using namespace std;

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

  string a, b, c;

  cin >> a >> b >> c;

  cout << (a[a.size() - 1] == b[0] && b[b.size() - 1] == c[0] ? "YES" : "NO");
}

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

int main(void){
  int n;
  vector<tuple<string, int, int>> v;
  cin >> n;
  for(int i = 1;i<=n;i++){
    string c;
    int p;
    cin >> c >> p;
    v.push_back(make_tuple(c, p, i));
  }
  sort(v.begin(), v.end(), []( auto & a, auto & b )
        {
          if(get<0>(a) == get<0>(b)) return get<1>(a) > get<1>(b);
          else return get<0>(a) < get<0>(b);
        });
  for(auto a : v){
    cout << get<2>(a) << endl;
  }
  return 0;
}

Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

//https://qiita.com/tubo28/items/e6076e9040da57368845
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n:usize = read();
    let k:usize = read();
    let a:Vec<u64> = (0..n).map(|_| read()).collect();
    for i in k..n{
        //println!("i{} k{} i-k{}",i,k,i-k);
        let oldest = a[i-k];
        if oldest < a[i] {
            println!("Yes");
        }else{
            println!("No");
        }
    }
}


Measured memory_bytes: 3584
#include <stdio.h>

int main(void){
	int a, b;

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

	if (a > b){
	printf("a > b\n");
}
	else if(a < b){
	printf("a < b\n");
}
	else if(a = b){
	printf("a == b\n");
}
	return 0;
}

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

int main() {
  int H, W;
  cin >> H >> W;
  vector<char> ff(W+2, '#');
  vector<char> lf(W+2, '#');
  vector<string> pic(H);
  for(int i = 0; i < H; i++){
    cin >> pic.at(i);
  }
  
  for(int i = 0; i < W+2; i++){
    cout << ff.at(i);
  }
  cout << endl;
  for(int i = 0; i < H; i++){
    cout << "#" << pic.at(i) << "#" << endl;
  }
  for(int i = 0; i < W+2; i++){
  cout << lf.at(i);  
  }
    cout << endl;
  
}


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

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

  int c = 0;
  for(int x=0; x<=k; x++) {
    for(int y=0; y<=k; y++) {
      int z = s - x - y;
      if(0 <= z && z <= k) c++;
    }
  }

  cout << c << endl;
}

Measured memory_bytes: 256
//#define LOCAL

#include <fstream>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <cstring>
#include <climits>
#include <set>

//#define int long long
typedef long long ll;
//#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,bg,ed) for(int i=(bg);i<(ed);i++)
#define REP(i,n) FOR(i,0,n)

#define MOD 1000000007

using namespace std;

typedef vector<int> V;
typedef vector<V> VV;

map<int, ll> cnt;
set<int> nums;

signed main()
{
#ifdef LOCAL
    ifstream in("input.txt");
    cin.rdbuf(in.rdbuf());
#endif

    ll N, K;
    ll a, b;

    cin >> N >> K;
    REP(i,N) {
        cin >> a >> b;
        nums.insert(a);
        cnt[a] += b;
    }

    ll sum = 0;
    auto it = nums.begin();
    for (; it!=nums.end(); it++) {
        sum += cnt[*it];
        if (K <= sum) break;
    }
    cout << *it << endl;

    return 0;
}


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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    ll N, M; cin >> N >> M;
    vector<ll> X(M); rep(i, M){cin >> X.at(i);}
    sort(X.begin(), X.end());
    // 分割が決まればコストは定まる(組の中で一番左からスタートして右へ移動)
    if (N >= M){
        cout << 0 << endl;
    } else {
        priority_queue<int> q;
        // 駒が1つなら自分でこの距離を全部歩く必要がある
        // 駒が1つ追加されると，一つ動かなければいけない区間が減る(ここで一番長い区間を切る)
        ll ans = X.at(M-1) - X.at(0);
        rep(i, M-1){q.push(X.at(i+1) - X.at(i));}
        rep(i, N-1){auto v = q.top(); q.pop(); ans -= v;}
        cout << ans << endl;
    }
}

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


Measured memory_bytes: 1660
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main () {
  int N, M, K;
  cin >> N >> M >> K;
  ll A[200002];
  ll B[200002];
  for (int i = 1; i <= N; i ++) cin >> A[i];
  for (int i = 1; i <= M; i ++) cin >> B[i];
  ll sum[200002];
  sum[0] = 0;
  for (int i = 1; i <= M; i ++) sum[i] = sum[i - 1] + B[i];
  sum[M + 1] = 1e15;
  A[0] = 0;
  B[0] = 0;
  int ans = 0;
  for (int i = 0; i <= N; i ++) {
    if (A[i] > K) break;
    K -= A[i];
    int ma = M + 1;
    int mi = 0;
    while (ma != mi) {
      int mu = (ma + mi) / 2;
      if (sum[mu] > K) ma = mu;
      else mi = mu + 1;
    }
    mi --;
    //cout << i << ' ' << mi << endl;
    ans = max(ans, i + mi);
  }
  cout << ans << endl;
}


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

#define DEBUG

// 型名の省略
typedef unsigned int uint;
typedef long long lint;
typedef unsigned long long ulint;

const int MOD = 1000000007;
const double PI=acos(-1.0);

// cinとcoutの高速化
#define endl "\n"
struct cinacc{cinacc(){cin.tie(0);ios::sync_with_stdio(false);}}cinaccc;
struct coutacc{coutacc(){cout.setf(ios::fixed);cout.precision(12);}}coutaccc;

// 繰り返し
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep_(i,n) for(int i=0;i<(int)(n-1);i++)
#define rep__(i,n) for(int i=n-1;i>=0;i--)

// メモリ関連
#define SZ(x) ((int)(x).size())
#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,63,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define MEMSET(v,h) memset((v),h,sizeof(h)

// 最大値と最小値を更新する
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}

// 素数判定
bool isPrime(int n){if(n<2)return false;else if(n==2)return true;else if(n%2==0)return false;double sqrtNum=sqrt(n);for(int i=3;i<=sqrtNum;i+=2)if(n%i==0)return false;return true;}

// ソート
template<class T>vector<T>sortVector(vector<T>v,bool b=true){if(b)sort(v.begin(),v.end());else sort(v.begin(),v.end(),greater<T>());return v;}

// Z-Algorithm O(|S|)
vector<int>z_algorithm(string s){vector<int>a(s.length());a[0]=s.size();for(ulint i=1,j=0,k;i<s.size();){while(i+j<s.size()&&s[j]==s[i+j])++j;a[i]=j;k=!!j;while(i+k<s.size()&&k+a[k]<j)a[i+k]=a[k],++k;i+=k+!j;j-=k;}return a;}

bool func(string s, int i) {
    if(s[i] == 'A' && s[i+1] == 'B' && s[i+2] == 'C') return true;
    return false;
}

int main(void) {
    int n;
    cin >> n;
    vector<int> p(n), q(n);
    rep(i, n) cin >> p[i];
    rep(i, n) cin >> q[i];
    
    int a = 0, b = 0;
    
    vector<int> v(n);
    for(int i = 1; i <= n; i++) v[i-1] = i;
    int i = 0;
    do {
        bool flg1 = true;
        bool flg2 = true;
        rep(j, n) {
            if(v[j] != p[j]) {
                flg1 = false;
                break;
            }
        }
        rep(j, n) {
            if(v[j] != q[j]) {
                flg2 = false;
                break;
            }
        }
        if(flg1) a = i;
        if(flg2) b = i;
        i++;
    } while( next_permutation(v.begin(), v.end()) );
    
    cout << abs(a-b);
    
    return 0;
}


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

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

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

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

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

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

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

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

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

fn main() {
    input! {
        n: usize,
        ai: [i64; n],
    }
    let mut ai = ai;
    ai.sort();
    let mut count_a = 0;
    let mut count_b = 0;
    for (i, item) in ai.iter().rev().enumerate() {
        if i % 2 == 0 {
            count_a += *item;
        } else {
            count_b += *item;
        }
    }
    println!("{}", count_a - count_b);
}


Measured memory_bytes: 4352
package main

import "fmt"

func main() {
	var n int
	fmt.Scanln(&n)
	a := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&a[i])
	}
	fmt.Print(a[n-1])
	for i := n - 2; i >= 0; i-- {
		fmt.Printf(" %d", a[i])
	}
	fmt.Println("")
}


Measured memory_bytes: 1136
/*====Corycle====*/
#include<algorithm>
#include<iostream>
#include<iomanip>
#include<cstring>
#include<cstdlib>
#include<complex>
#include<cstdio>
#include<vector>
#include<cmath>
#include<ctime>
#include<stack>
#include<queue>
#include<map>
#define ll long long
using namespace std;
const int inf=0x3f3f3f3f;
const int N=1e5+5;
int read(){
	int s=0,f=1;char c=getchar();
	while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
	while(c>='0'&&c<='9'){s=s*10+c-'0';c=getchar();}
	return s*f;
}
int n,m,a[N],num[2][N],f[2][2],g[2][2];
int main(){
//	freopen("_.in","r",stdin);
//	freopen("_.out","w",stdout);
	n=read();
	for(int i=1;i<=n;i++){a[i]=read();num[i&1][a[i]]++;}
	for(int t=0;t<2;t++){
		for(int i=1;i<N;i++){
			if(f[t][0]<=num[t][i]){
				f[t][1]=num[t][g[t][1]=g[t][0]];
				f[t][0]=num[t][g[t][0]=i];
			}
			else if(f[t][1]<=num[t][i]){
				f[t][1]=num[t][g[t][1]=i];
			}
		}
	}
	if(g[0][0]!=g[1][0])printf("%d\n",n-f[0][0]-f[1][0]);
	else printf("%d\n",min(n-f[0][0]-f[1][1],n-f[0][1]-f[1][0]));
	return 0;
}

Measured memory_bytes: 4916
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i,m,n) for(ll i = (m); i < (n); i++)
#define all(v) v.begin(), v.end()
#define print(x) cout << (x) << endl

//宣言
int N,M,K;
vector<int> A,B,C,D;
vector<int> par,Rank,cnt;
vector<vector<int>> tomo,bro;

void init(int n){
    par = Rank = vector<int>(n,0);
    cnt = vector<int>(n,1);
    rep(i,n) par[i] = i;
}

int find(int x){
    if(par[x] == x){
        return x;
    }else {
        return par[x] = find(par[x]);
    }
}

void unite(int x,int y){
    x = find(x);
    y = find(y);
    if(x == y) return;

    if(Rank[x] < Rank[y]) {
        par[x] = y;
        cnt[y] += cnt[x];
    }else{
        par[y] = x;
        cnt[x] += cnt[y];
        if(Rank[x] == Rank[y]) Rank[x]++;
    }
}

bool same(int x,int y){
    return find(x) == find(y);
}

void solve(){

    init(N);
    rep(i,M){
        int a = A[i]-1,b = B[i]-1;
        unite(a,b);
    }

    rep(i,N){
        int koho = 0;
        int ipar = find(i);
        koho += cnt[ipar]-1;
        koho -= tomo[i].size();
        rep(j,bro[i].size()){
            if(same(i,bro[i][j])) koho--;
        }
        cout << koho;
        if(i == N-1) cout << endl;
        else cout << " ";
    }
}

int main() {
    //入力忘れるなよ～//vec = vector<ll>(N,0);もね
    cin >> N >> M >> K;
    tomo = bro = vector<vector<int>>(N);
    A = B = vector<int>(M);
    C = D = vector<int>(K);
    rep(i,M){
        cin >> A[i] >> B[i];
        tomo[A[i]-1].push_back(B[i]-1);
        tomo[B[i]-1].push_back(A[i]-1);
    }
    rep(i,K){
        cin >> C[i] >> D[i];
        bro[C[i]-1].push_back(D[i]-1);
        bro[D[i]-1].push_back(C[i]-1);
    }

    solve();
    return 0;
}


Measured memory_bytes: 14712
#include <cstdio>
#include <cstring>

int mp[16][16];
int dp[16][16];
int n,p,gx,gy;

int main() {
	scanf("%d",&n);
	for(int i=0;i<n;i++) {
		scanf("%d %d",&gx,&gy);
		scanf("%d",&p);
		memset(mp,0,sizeof(mp));
		for(int i=0;i<p;i++) {
			int x1,y1,x2,y2;
			scanf("%d %d %d %d",&x1,&y1,&x2,&y2);
			if(x1<x2) mp[x2][y2]|=2; else if(x1>x2) mp[x1][y1]|=2;
			if(y1<y2) mp[x2][y2]|=4; else if(y1>y2) mp[x1][y1]|=4;
		}
		memset(dp,0,sizeof(dp));
		dp[0][0]=1;
		for(int j=0;j<=gy;j++) {
			for(int i=0;i<=gx;i++) {
				if(!(mp[i][j]&2)&&(i-1)>=0) dp[i][j]+=dp[i-1][j];
				if(!(mp[i][j]&4)&&(j-1)>=0) dp[i][j]+=dp[i][j-1];
			}
		}
		if(dp[gx][gy]) printf("%d\n",dp[gx][gy]);
		else printf("Miserable Hokusai!\n");
	}
}

Measured memory_bytes: 1040
from sys import stdin
import math
inp = lambda : stdin.readline().strip()
 
s=inp()
t = inp()
ans = len(t)
for i in range(len(s)-len(t)+1):
    cur = len(t)
    for j in range(len(t)):
        if s[i+j] == t[j]:
            cur -= 1
    ans = min(ans, cur)
print(ans)

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

lint n, p;
string s;

// a^n mod pを計算　O(log n)
long long pow_mod(long long a, long long n, long long p) {
    if (n == 0) return 1;
    if (n & 1) return pow_mod(a, n - 1, p) * a % p;
    long long temp = pow_mod(a, n / 2, p);
    return temp * temp % p;
}

int main() {
    cin >> n >> p >> s;
    if (p == 2 || p == 5) {
        lint ans = 0;
        for (int i = 0; i < n; i++) {
            lint c = s[i] - '0';
            if (c % p == 0) {
                ans += i + 1;
            }
        }
        cout << ans << endl;
        return 0;
    }
    lint sum = 0;
    map<lint, lint> count;
    count[0]++;
    for (int i = 0; i < n; i++) {
        int c = s[n - 1 - i] - '0';
        sum = sum + c * pow_mod(10, i, p);
        sum %= p;
        count[sum]++;
    }
    lint ans = 0;
    for (auto e : count) {
        lint temp = e.second;
        ans += temp * (temp - 1) / 2;
    }
    cout << ans << endl;
}

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

int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);

	int W;
	int D;
	int N;

	cin >> W >> D >> N;

	const int INF = int(1e9) + 20;
	vector<vector<int>> height(W, vector<int>(D, -INF));
	for (int z = 0; z < N; z++) {
		int a, b, c; cin >> a >> b >> c;
		a--, b--;
		height[a][b] = c;
	}
	auto oldHeight = height;

	for (int i = 0; i < W; i++) {
		for (int j = 1; j < D; j++) {
			height[i][j] = max(height[i][j], height[i][j-1] - 1);
		}
		for (int j = D-2; j >= 0; j--) {
			height[i][j] = max(height[i][j], height[i][j+1] - 1);
		}
	}
	for (int j = 0; j < D; j++) {
		for (int i = 1; i < W; i++) {
			height[i][j] = max(height[i][j], height[i-1][j] - 1);
		}
		for (int i = W-2; i >= 0; i--) {
			height[i][j] = max(height[i][j], height[i+1][j] - 1);
		}
	}

	for (int i = 0; i < W; i++) {
		for (int j = 0; j < D; j++) {
			if (oldHeight[i][j] == -INF) continue;
			if (height[i][j] != oldHeight[i][j]) {
				cout << "No" << '\n';
				exit(0);
			}
		}
	}

	long long ans = 0;
	for (int i = 0; i < W; i++) {
		for (int j = 0; j < D; j++) {
			ans += height[i][j];
		}
	}

	cout << ans << '\n';
	return 0;
}



Measured memory_bytes: 3232
#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)

int main()
{
    int x, a, b;
    cin >> x >> a >> b;
    cout << x-a-((int)(x-a)/b)*b << "\n";
    return 0;
}


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

#define stirng string
#define vvi vector<vector<int>>
#define vi vector<int>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;

const int inf = 1e9 + 7;

int main() {
	long long int d,m;
	cin >> d >> m;
	int s = pow(100,d);
	//cout << s << endl;
	if(m == 100){
		cout << 101*s << endl;
	}
	else{
		cout << m*s << endl;
	}
	return 0;
}


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

int main() {
    string s;
    cin >> s;
    if(s[0] == s[1] || s[1] == s[2] || s[2] == s[3]) {
        cout << "Bad" << endl;
        return 0;
    }
    cout << "Good" << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pb push_back
#define lowbit(x) ((x)&(-x))
#define inf 0x3f3f3f3f
#define endl "\n"
#define MP(x,y) (make_pair(x,y))
#define pll pair<int,int>
#define pi 3.1415926535
using namespace std;
char s[4005];
vector<int> a[10];
char str[] = "RGB";
int main(){
    int n;
    scanf("%d",&n);
    scanf("%s",s);
    for(int i=0;i<n;i++){
        if(s[i] == 'R') a[0].pb(i);
        if(s[i] == 'G') a[1].pb(i);
        if(s[i] == 'B') a[2].pb(i);
    }
    ll sum = 0;
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n-1;j++){
            if(s[i] == s[j]) continue;
            int x;
            if(s[i]!='R' && s[j]!='R') x = 0;
            if(s[i]!='G' && s[j]!='G') x = 1;
            if(s[i]!='B' && s[j]!='B') x = 2;
            sum+=a[x].end()-lower_bound(a[x].begin(),a[x].end(),j);
            if(j+j-i<n){
                if(s[j+j-i] == str[x]) sum--;
            }
        }
    }
    cout<<sum<<endl;
}


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

int main() {
  int n, m;
  cin >> n >> m;
  vector<vector<int>> condition(m, vector<int> (2));
  vector<int> num(n, 0);
  
  
  rep(i, m) {
    int s, c;
    cin >> s >> c;
    
    if(num[n-s] != 0 && num[n-s] != c) { //条件の不備
      cout << -1 << endl;
      return 0;
    }
    
    if(n != 1 && s == 1 && c == 0) { //頭が0
      cout << -1 << endl;
      return 0;
    }
    
    num[n-s] = c;
  }
  
  if(num[n-1] == 0 && n != 1) num[n-1] = 1;
  
  int ans = 0;
  rep(i, n) {
    ans += num[i] * pow(10, i);
  }
  
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
typedef long long LL;
#define SORT(c) sort((c).begin(),(c).end())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

using namespace std;
vector<string> field;
int y,x;
bool solve(void){
  for(;;){
    if(field[y][x]=='l') return false;
    if(field[y][x]=='.') return true;
    if(field[y][x]=='^') field[y--][x]='l';
    if(field[y][x]=='v') field[y++][x]='l';
    if(field[y][x]=='<') field[y][x--]='l';
    if(field[y][x]=='>') field[y][x++]='l';
  }
}   
int main(void)
{
  for(;;){
    int h,w;
    cin >> h >> w;
    if(!h&&!w) return 0;
    y=0; x=0;
    field.resize(h);
    REP(i,h) cin >> field[i];
    if(solve()) cout << x << ' ' << y << endl;
    else cout << "LOOP" << endl;
  }
}

Measured memory_bytes: 1236
#!/usr/bin/env python3
import sys


def solve(N: int, S: "List[str]"):
    D=dict()
    M=1
    for s in S:
        if s in D:
            D[s] = D[s]+1
            if M < D[s]:
                M=D[s]
        else:
            D[s] = 1
    L = list()
    for d in D:
        if D[d] == M:
            L.append(d)
    LL = sorted(L)
    for ll in LL:
        print(ll)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    S = [next(tokens) for _ in range(N)]  # type: "List[str]"
    solve(N, S)

if __name__ == '__main__':
    main()


Measured memory_bytes: 35224
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
const ll mod = 1000000007;
const ll mod998 = 998244353;
const ll intmax = 2147483647;
const ll llmax = 9223372036854775807;
const char sp = ' ';

ll A, B, K;

int main() {
	cin >> A >> B >> K;
	cout << max(0ll, A - K) << sp << max(0ll, min(B, B - (K - A))) << endl;
}

Measured memory_bytes: 256
N = input()
num_list = list(map(int, input().split(" ")))

def devision(num_list, count):
    new_num_list = []
    for num in num_list:
        if num%2 ==0:
            new_num_list.append(num//2)
        else:
            print(count)
            return
    count += 1
    return devision(new_num_list, count)

devision(num_list, 0)            

Measured memory_bytes: 3188
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define INF 1LL << 62
#define MOD 1000000007ll
#define EPS 1e-10
#define REP(i, m) for (int i = 0; i < m; i++)
#define FOR(i, n, m) for (int i = n; i < m; i++)
#define ALL(v) v.begin(),v.end() 
#define pb push_back
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
typedef long double ld;

int main(){
  ll n, m;
  cin >> n >> m;
  if(n == 1 && m == 1) cout << 1 << endl;
  else if(n == 1) cout << m-2 << endl;
  else if(m == 1) cout << n-2 << endl;
  else cout << (m-2) * (n-2) << endl;
  return 0;
}


Measured memory_bytes: 764
#                               #
    # author : samars_diary #
    # 19-09-2020 │ 17:40:08 #
#                               #

import sys, os.path

if(os.path.exists('input.txt')):
    sys.stdin = open('input.txt',"r")
    #sys.stdout = open('output.txt',"w")

sys.setrecursionlimit(10 ** 5)

def mod(): return 10**9+7
def i(): return sys.stdin.readline().strip()
def ii(): return int(sys.stdin.readline())
def li(): return list(sys.stdin.readline().strip())
def mii(): return map(int, sys.stdin.readline().split())
def lii(): return list(map(int, sys.stdin.readline().strip().split()))

#print=sys.stdout.write

def solve():
    a=ii() ; p = q = 0 ;
    for _ in range(a):
        a,b=mii()
        if a==b:
            p+=1
            if p>q:
                q=p
        else: 
            p=0
    if q>=3: print('Yes')
    else: print('No')

for _ in range(1):
    solve()

Measured memory_bytes: 9220
#include<iostream>
#include<cstring>
#include<cmath>
using namespace std;
int main()
{
	long long n,a[3][3],b[3][3]={0},k,i,j,sum=0,l;
	for(i=0;i<3;i++)
	{
		for(j=0;j<3;j++)
		cin>>a[i][j];
	}
	cin>>n;
	for(l=0;l<n;l++)
	{
		cin>>k;
		for(i=0;i<3;i++)
		{
			for(j=0;j<3;j++)
			{
				if(k==a[i][j])
					b[i][j]++;
			}
		}
	}
	if(b[0][0]>0&&b[0][1]>0&&b[0][2]>0)
		sum++;
	if(b[1][0]>0&&b[1][1]>0&&b[2][2]>0)
		sum++;
	if(b[2][0]>0&&b[2][1]>0&&b[2][2]>0)
		sum++;
	if(b[0][0]>0&&b[1][0]>0&&b[2][0]>0)
		sum++;
	if(b[0][1]>0&&b[1][1]>0&&b[2][1]>0)
		sum++;
	if(b[0][2]>0&&b[1][2]>0&&b[2][2]>0)
		sum++;
	if(b[0][0]>0&&b[1][1]>0&&b[2][2]>0)
		sum++;
	if(b[0][2]>0&&b[1][1]>0&&b[2][0]>0)
		sum++;
	if(sum>0)
		cout<<"Yes";
	else
		cout<<"No";
 } 

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        MyScan in = new MyScan(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskD solver = new TaskD();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskD {
        public void solve(int testNumber, MyScan in, PrintWriter out) {
            String s = in.next();
            int k = in.nextInt();
            int[][][] pos = new int[k + 1][s.length() + 1][s.length()];

            for (int i = 0; i < s.length(); i++) {
                pos[0][1][i] = 1;
            }
            for (int r = 2; r <= s.length(); r++) {
                for (int l = 0; l <= s.length() - r; l++) {
                    int e = l + r - 1;
                    boolean match = s.charAt(l) == s.charAt(e);
                    if (match) {
                        for (int i = 0; i <= k; i++) {
                            pos[i][r][l] = Math.max(2 + pos[i][r - 2][l + 1], pos[i][r][l]);
                        }
                    } else {
                        for (int i = 0; i <= k; i++) {
                            pos[i][r][l] = Math.max(pos[i][r][l], pos[i][r - 1][l]);
                            pos[i][r][l] = Math.max(pos[i][r - 1][l + 1], pos[i][r][l]);
                        }
                        for (int i = 0; i < k; i++) {
                            pos[i + 1][r][l] = Math.max(pos[i + 1][r][l], 2 + pos[i][r - 2][l + 1]);
                        }
                    }
                }
            }
            int max = 0;
            for (int l = 0; l <= k; l++) {
                max = Math.max(max, pos[l][s.length()][0]);
            }
            out.println(max);


        }

    }

    static class MyScan {
        BufferedReader br;
        StringTokenizer st;

        MyScan(BufferedReader br) {
            this.br = br;
        }

        public MyScan(InputStream in) {
            this(new BufferedReader(new InputStreamReader(in)));
        }

        public void findToken() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
        }

        public String next() {
            findToken();
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 166872
using System;
using System.Linq;

namespace ABC127B
{
    class Program
    {
        static void Main(string[] args)
        {
            var line = Console.ReadLine().Split(' ').ToArray();
            int r = int.Parse(line[0]);
            int D = int.Parse(line[1]);
            int x = int.Parse(line[2]);

            int z = x;

            for(var i = 0; i < 10; i++)
            {
                int y = 0;
                y = r * z - D;
                Console.WriteLine(y);
                z = y;
            }
        }
    }
}


Measured memory_bytes: 13268
S = input()
if len(S) < 26:
    for i in range(26):
        c = chr(i + ord('a'))
        if c not in S:
            print(S + c)
            break
else:
    tmp = 26
    for i in range(len(S) - 1, 0, -1):
        if ord(S[i - 1]) < ord(S[i]):
            break
        tmp = i
    tmp -= 1
    if tmp == 0:
        print(-1)
    else:
        c = ord(S[:tmp][-1])
        suf = S[tmp:]
        print(S[:tmp - 1] + chr(min([ord(si) for si in suf if ord(si) > c])))


Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cstdio>
#include <numeric>

#define rep(i, n) for(int i = 0;i < (int)(n); i++)
#define pb push_back
typedef long long ll;

using namespace std;


int main() {
    ll n,k;
    cin >> n >> k;
    vector<ll> x(n);
    long long min1 = 10000000000;
    rep(i, n) {
        cin >> x[i];
    }
    sort(x.begin(),x.end());

    for(ll left = 0; left < n; left++){
        ll right = left + k - 1;
        if(right > n - 1) break;
        ll cost1 = abs(x[left]) + abs(x[right] - x[left]);
        ll cost2 = abs(x[right]) + abs(x[left] - x[right]);
        min1 = min(min1,min(cost1,cost2));
    }
    cout << min1 << endl;
    return 0;
}


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

struct BIT
{
  i64 n;
  vector<i64> bit;

  BIT(i64 _n)
  {
    n = _n;
    bit.resize(n);
    fill(bit.begin(), bit.end(), 0);
  }

  void add(i64 idx, i64 x)
  {
    for (i64 i = idx; i <= n; i += i & -i)
      bit[i] += x;
  }

  i64 sum(i64 end)
  {
    i64 ret = 0;
    for (i64 i = end; i >= 1; i -= i & -i)
      ret += bit[i];
    return ret;
  }
};

int main()
{
  i64 n, k;
  cin >> n >> k;
  vector<i64> a(n + 1);
  for (i64 i = 1; i <= n; i++)
  {
    cin >> a[i];
    a[i] += (i ? a[i - 1] : 0LL) - k;
  }
  vector<i64> sorted_a = a;
  sort(sorted_a.begin(), sorted_a.end());
  i64 ans = 0;
  BIT bit(n + 2);
  for (i64 i = n; i >= 0; --i)
  {
    i64 idx = lower_bound(sorted_a.begin(), sorted_a.end(), a[i]) - sorted_a.begin() + 1;
    if (i != n)
      ans += n - i - bit.sum(idx - 1);
    bit.add(idx, 1);
  }
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 5212
n = int(input())
s_list = [input() for _ in range(n)]

letter_dict = {}
count = 0

for s in s_list:
    sort_list = [l for l in s]
    sort_list.sort()
    sort_str = ''.join(sort_list)
    if hash(sort_str) in letter_dict:
        letter_dict[hash(sort_str)] += 1
    else:
        letter_dict[hash(sort_str)] = 1

for k,v in letter_dict.items():
    count += v*(v-1)//2

print(count)

Measured memory_bytes: 22876
#include <iostream>
#include <sstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <stdio.h>
#include <iomanip>

using namespace std;

//typedefリスト
typedef vector<long long int> vint;
typedef vector<string> vstr;
typedef long long int llint;

int main(void) {
	int ans = 0;
	string S, T;
	cin >> S >> T;
	for (int i = 0; i < 3; i++) {
		if (S[i] == T[i])ans++;
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(void){
  int s[3],i;
  for(i=0;i<=3;i++){
    scanf("%d",&s[i]);
  }
  if(s[0]==1||s[1]==1||s[2]==1||s[3]==1){
    if(s[0]==9||s[1]==9||s[2]==9||s[3]==9){
      if(s[0]==7||s[1]==7||s[2]==7||s[3]==7){
        if(s[0]==4||s[1]==4||s[2]==4||s[3]==4){
          printf("YES");
        }
        else printf("NO");
      }
      else printf("NO");
    }
    else printf("NO");
  }
  else printf("NO");
  return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<array>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<functional>
#include<limits>
#include<list>
#include<map>
#include<numeric>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<queue>
#include<vector>
using namespace std;

using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=(n)-1;i>=0;i--)
#define ALL(a) (a).begin(),(a).end()
#define DUMP(o) {cerr<<#o<<" "<<o<<endl;}
#define DUMPC(o) {cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
const int MOD = 1e9 + 7;

signed main() {
	while (true) {
		char f[11][11];
		int x = -1, y = -1;
		REP(i, 8)REP(j, 8) {
			if (!(cin >> f[j][i]))return 0;
			if (f[j][i] == '1'&&x == -1) {
				x = j; y = i;
			}
		}
		string ans;
		if (f[x + 3][y] == '1') {
			ans = "C";
		}
		else if (f[x][y + 3] == '1') {
			ans = "B";
		}
		else if (f[x + 1][y] == '1') {
			//AEG
			if (f[x][y + 1] == '0') ans = "E";
			else if (f[x + 1][y + 1] == '1') ans = "A";
			else ans = "G";
		}
		else {
			//DF
			if (f[x + 1][y + 1] == '1') ans = "F";
			else ans = "D";
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 3108
import core.bitop;
import std.algorithm;
import std.ascii;
import std.bigint;
import std.conv;
import std.functional;
import std.format;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.random;
import std.typecons;
 
alias sread = () => readln.chomp();
alias Point2 = Tuple!(long, "y", long, "x");
 
T lread(T = long)()
{
    return readln.chomp.to!T();
}
 
T[] aryread(T = long)()
{
    return readln.split.to!(T[])();
}
 
void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}

void main()
{
    auto a = lread();
    writeln(a/2 * (a/2 + a%2));
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
//size_t f = string::npos
//make pair, tuple

int main(){
      int a = -1;
      int b = -1;
      int n;cin >> n;
      int arr[n + 5];
      int arrp[n + 5];
      int arrq[n + 5];
      int c = 1;
      for(int i = 0;i < n;i++)cin >> arrp[i];
      for(int i = 0;i < n;i++)cin >> arrq[i];
      for(int i = 0;i < n;i++)arr[i] = i + 1;
      do{
            if(a == -1 || b == -1){
                  for(int i = 0;i < n;i++){
                        if(arr[i] != arrp[i])break;
                        else if(i == n - 1)a = c;
                  }
                  for(int i = 0;i < n;i++){
                        if(arr[i] != arrq[i])break;
                        else if(i == n - 1)b = c;
                  }
            }
            else break;
            c++;
      }while(next_permutation(arr, arr + n));
      cout << abs(b - a);
}

Measured memory_bytes: 256
def main():
    n = int(input())
    aa = list(map(int, input().split()))
    bb = [0] * n
    i_bb = 0
    i_aa = n - 1
    while i_aa >= 0:
        bb[i_bb] = aa[i_aa]
        i_aa -= 2
        i_bb += 1
    i_aa += 1
    if i_aa < 0:
        i_aa += 2
    while i_aa < n:
        bb[i_bb] = aa[i_aa]
        i_aa += 2
        i_bb += 1
    print(' '.join(str(b) for b in bb))


if __name__ == '__main__':
    main()


Measured memory_bytes: 29604
#include <bits/stdc++.h>
using namespace std;
 
int main(){long long a,b;int k;cin>>a>>b>>k;
           if(k%2==0){
           for(int i=0;i<k/2;i++){
             if(a%2==0){a=a/2;b+=a;}
              else{a--;a=a/2;b+=a;}
             
             if(b%2==0){b=b/2;a+=b;}
              else{b--;b=b/2;a+=b;}}}
           
           else if(k==1){
             if(a%2==0){a=a/2;b+=a;}
              else{a--;a=a/2;b+=a;}}
           
           else{
             for(int i=0;i<(k-1)/2;i++){
             if(a%2==0){a=a/2;b+=a;}
              else{a--;a=a/2;b+=a;}
               
             if(b%2==0){b=b/2;a+=b;}
              else{b--;b=b/2;a+=b;}}
             
             if(a%2==0){a=a/2;b+=a;}
              else{a--;a=a/2;b+=a;}}
          cout<<a<<' '<<b;}

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

typedef long long ll;
typedef pair<ll,ll> P;

const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;

#define rep(i, a, b) for(ll (i) = (a); (i) < (b);++i)

ll gcd(ll x, ll y)
{
  if (x % y == 0)
  {
    return y;
  }
  return gcd(y, x % y);
}

int main()
{
  ll A, B;
  cin >> A >> B;
  cout << (B-A)+B << endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main {
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		String str;
		int am, pm;
		
		for(int i = 0; i < 9; i++){
			str = scan.next();
			am = scan.nextInt();
			pm = scan.nextInt();
			
			System.out.println(str + " " + (am + pm) + " " + (am * 200 + pm * 300));
		}
	}
}

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

int main() {
  int n;
  std::cin >> n;
  double s = 0;

  for (int i = 0; i < n; i++) {
    std::string x, u;
    std::cin >> x >> u;

    if (u == "JPY") {
      s += std::atoi(x.c_str());
    } else {
      s += std::stod(x) * 380000.0;
    }
  }

  std::cout << s << std::endl;
  return 0;
}


Measured memory_bytes: 256
#!/usr/local/bin python
# -*- coding: utf-8 -*-
#
# ~/PycharmProjects/atcoder/B-GreedyTakahashi.py
#
a, b, k = map(int, input().split())

if a >= k:
    a = a - k
else:
    k = k -a
    a = 0
    if b >= k:
        b = b - k
    else:
        k = k - b
        b = 0

print(a, b)

Measured memory_bytes: 2940
import std.algorithm, std.container, std.conv, std.math, std.range, std.typecons, std.stdio, std.string;

auto rdsp(){return readln.splitter;}
void pick(R,T)(ref R r,ref T t){t=r.front.to!T;r.popFront;}
void readV(T...)(ref T t){auto r=rdsp;foreach(ref v;t)pick(r,v);}

void main()
{
  int a, b; readV(a, b);
  writeln(a - (a > b));
}


Measured memory_bytes: 256
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;

struct Info{
	Info(){
		to = dist = cost = 0;
	}

	bool operator<(const struct Info &arg) const{
		return dist < arg.dist;
	};
	Info(int arg_to,int arg_dist,int arg_cost){
		to = arg_to;
		dist = arg_dist;
		cost = arg_cost;
	}

	int to,dist,cost;
};

int N,M,min_dist[10001],min_cost[10001];

vector<Info> V[10001];

void func(){

	for(int i = 1; i <= N; i++){
		V[i].clear();
		min_dist[i] = BIG_NUM;
		min_cost[i] = BIG_NUM;
	}

	int from,to,dist,cost;

	for(int i = 0; i < M; i++){
		scanf("%d %d %d %d",&from,&to,&dist,&cost);
		V[from].push_back(Info(to,dist,cost));
		V[to].push_back(Info(from,dist,cost));
	}

	priority_queue<Info> Q;

	min_dist[1] = 0;
	min_cost[1] = 0;

	for(int i = 0; i < V[1].size(); i++){
		min_dist[V[1][i].to] = V[1][i].dist;
		min_cost[V[1][i].to] = V[1][i].cost;
		Q.push(Info(V[1][i].to,V[1][i].dist,V[1][i].cost));
	}

	int min_index;

	while(!Q.empty()){
		//if(Q.top().dist > min_dist[Q.top().to] || Q.top().cost > min_cost[Q.top().to]){
		if(Q.top().dist > min_dist[Q.top().to]){
			Q.pop();
		}else{
			min_index = Q.top().to;
			Q.pop();

			for(int i = 0; i < V[min_index].size(); i++){
				if(min_dist[V[min_index][i].to] > min_dist[min_index]+V[min_index][i].dist){
					min_dist[V[min_index][i].to] = min_dist[min_index]+V[min_index][i].dist;
					min_cost[V[min_index][i].to] = V[min_index][i].cost;
					Q.push(Info(V[min_index][i].to,min_dist[V[min_index][i].to],min_cost[V[min_index][i].to]));
				}else if(min_dist[V[min_index][i].to] == min_dist[min_index]+V[min_index][i].dist && min_cost[V[min_index][i].to] > V[min_index][i].cost){
					min_cost[V[min_index][i].to] = V[min_index][i].cost;
					//Q.push(Info(V[min_index][i].to,min_dist[V[min_index][i].to],min_cost[V[min_index][i].to]));
				}
			}
		}
	}

	int ans = 0;

	for(int i = 2; i <= N; i++)ans += min_cost[i];

	printf("%d\n",ans);

}

int main(){

	while(true){
		scanf("%d %d",&N,&M);
		if(N == 0 && M == 0)break;

		func();
	}

	return 0;
}

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

int main() {
  string s;
  cin>>s;
  if(s[0]==s[1] || s[1]==s[2] || s[2]==s[3]) cout<<"Bad"<<endl;
  else cout<<"Good"<<endl;
  return 0;
}


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

using namespace std;

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

  int n;
  cin >> n;
  int x;
  cin >> x;
  int ans = INT_MIN;
  int minv = x;
  for (int i = 1; i < n; i++) {
    cin >> x;
    ans = max(ans, x - minv);
    minv = min(minv, x);
  }
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 3176
#include <iostream>
#include <cstdio>

using namespace std;

typedef long long LL;

const int N = 1000;

char s[N];

int main() {
	bool ok = true;
	scanf("%s", s);
	int n = strlen(s);
	for (int i = 0; i < n; i++) {
		if (s[i] == '7') {
			printf("Yes");
			return 0;
		}
	}
	puts("No");
	return 0;
}

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


/// File input & output /////
#define fRead(x)        freopen("x.txt","r",stdin)
#define fWrite(x)       freopen ("x.txt","w",stdout)

#define mt              make_tuple
#define ld              long double
#define ll              long long
#define ull             unsigned long long
#define ff              first
#define ss              second
#define pb              push_back
#define INF             2e16
#define PI              acos(-1.0)
#define mp              make_pair
#define pii             pair<int,int>
#define pll             pair<LL,LL>


#define min3(a,b,c)     min(a,min(b,c))
#define max3(a,b,c)     max(a,max(b,c))
#define min4(a,b,c,d)   min(a,min(b,min(c,d)))
#define max4(a,b,c,d)   max(a,max(b,max(c,d)))
#define SQR(a)          ((a)*(a))
#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 REP(i,b)        for(int i=0;i<b;i++)
#define MEM(a,x)        memset(a,x,sizeof(a))
#define ABS(x)          ((x)<0?-(x):(x))

#define SORT(v)         sort(v.begin(),v.end())
#define REV(v)          reverse(v.begin(),v.end())


#define FASTIO        ios_base::sync_with_stdio(0);cin.tie(nullptr);




///..................Sort by second element in a pair in decending order............. ///
bool SortbySecDesc(const pair<long long,long long > &a, const pair<long long,long long > &b)
{
    return a.second>b.second;
}

///.........................first element of pair in descending order..........................//////
bool sortinrev(const pair<int,int> &a,
               const pair<int,int> &b)
{
       return (a.first > b.first);
}



///.............................................................TEMPLATE................................................./////


//long long  Prime[3000000],nPrime;
//long long  mark[10000002];
//
//void seive(long long int n)
//{
//	long long int i,j,limit=sqrt(n*1.0)+2;
//	mark[1]=1;
//	for(i=4; i<=n ;i+=2)
//	mark[i]=1;
//	Prime[nPrime++]=2;
//	for(i=3; i<=n; i+=2)
//	{
//		if(!mark[i])
//		{
//			Prime[nPrime++]=i;
//			if(i<=limit)
//			{
//				for(j=i*i; j<=n ;j+=i*2)
//				{
//					mark[j]=1;
//				}
//			}
//		}
//	}
//}


ll cnt[1000006];


int main()
{
    FASTIO;

    ll n;

    cin >> n;

    ll a[n+1];


    ll sum = 0;


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

        sum += a[i];


        cnt[a[i]]++;
    }




    int q;



    cin >> q;

    while(q--)
    {

        ll b , c;



        cin >> b >> c;

       // maxi = max(maxi,c);








        sum += ((c-b)*cnt[b]);

        cnt[c] = cnt[b] + cnt[c];


        cnt[b] = 0;


        cout << sum << endl;









    }





    return 0;
}



Measured memory_bytes: 5120
if __name__ == '__main__':
    l, r = map(int, input().split())
    if r - l >= 2018:
        print(0)
    else:
        ll = l % 2019
        rr = r - l + ll
        ans = 2019
        for i in range(ll, rr):
            for j in range(i + 1, rr + 1):
                ans = min(ans, i * j % 2019)
        print(ans)

Measured memory_bytes: 40684
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define debug(var) do{cout << #var << " : "; view(var);}while(0)
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
template<class T> void view(T e) {cout << e << endl;}
template<class T> void view(const vector<T> &v) {for(const auto &e : v){cout << e << " ";} cout << endl;}
template<class T> void view(const vector<vector<T>> &vv) {for(const auto &v : vv){view(v);}}
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const int inf = 1e9;
const ll inf_l = 1e18;
const int MAX = 1e5;

int main() {
    int a, b, c; cin >> a >> b >> c;
    int k; cin >> k;
    int ct = 0;
    while (b <= a) {
        b *= 2;
        ct++;
    }
    while (c <= b) {
        c *= 2;
        ct++;
    }
    if (ct <= k) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 3644