akhauriyash/Code-Regression huggingface dataset:
#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;
int main(void)
{
  LL a,b;
  cin >> a >> b;
  if(a*b>0)
    if(a>0||(b-a)%2) cout << "Positive" << endl;
    else cout << "Negative" << endl;
  else cout << "Zero" << endl;
  return 0;
}



Measured memory_bytes: 256
//  ____            _                  _                       _       _
// |  _ \ _   _ ___| |_    ___ _ __   | |_ ___ _ __ ___  _ __ | | __ _| |_ ___
// | |_) | | | / __| __|  / __| '_ \  | __/ _ \ '_ ` _ \| '_ \| |/ _` | __/ _ \
// |  _ <| |_| \__ \ |_  | (__| |_) | | ||  __/ | | | | | |_) | | (_| | ||  __/
// |_| \_\\__,_|___/\__|  \___| .__/___\__\___|_| |_| |_| .__/|_|\__,_|\__\___|
//                            |_| |_____|               |_|

//https://github.com/manta1130/Competitive_Programming_Template_Rust

#[macro_use]
mod input {

    use std;
    use std::io;

    const SPLIT_DELIMITER: char = ' ';

    #[macro_export]
    #[allow(unused_macros)]
    macro_rules! input {
    ( $($x:expr ),*) => {
        {
            let temp_str = input_line_str();
            let mut split_result_iter = temp_str.split_whitespace();
                $(
                let buf_split_result = split_result_iter.next();
                let buf_split_result = buf_split_result.unwrap();
                    ($x) = buf_split_result.parse().unwrap();
                )*
        }
    };
}

    #[allow(dead_code)]
    pub fn input_line_str() -> String {
        let mut s = String::new();
        io::stdin().read_line(&mut s).unwrap();
        s.trim().to_string()
    }

    #[allow(dead_code)]
    pub fn p<T>(t: T)
    where
        T: std::fmt::Display,
    {
        println!("{}", t);
    }

    #[allow(dead_code)]
    pub fn input_vector2d<T>(line: usize) -> Vec<Vec<T>>
    where
        T: std::str::FromStr,
    {
        let mut v: Vec<Vec<T>> = Vec::new();

        for _ in 0..line {
            let vec_line = input_vector();
            v.push(vec_line);
        }
        v
    }

    #[allow(dead_code)]
    pub fn input_vector<T>() -> Vec<T>
    where
        T: std::str::FromStr,
    {
        let mut v: Vec<T> = Vec::new();

        let s = input_line_str();
        let split_result = s.split(SPLIT_DELIMITER);
        for z in split_result {
            let buf = match z.parse() {
                Ok(r) => r,
                Err(_) => panic!("Parse Error"),
            };
            v.push(buf);
        }
        v
    }

    #[allow(dead_code)]
    pub fn input_vector_row<T>(n: usize) -> Vec<T>
    where
        T: std::str::FromStr,
    {
        let mut v = Vec::with_capacity(n);
        for _ in 0..n {
            let buf = match input_line_str().parse() {
                Ok(r) => r,
                Err(_) => panic!("Parse Error"),
            };
            v.push(buf);
        }
        v
    }

    pub trait ToCharVec {
        fn to_charvec(&self) -> Vec<char>;
    }

    impl ToCharVec for String {
        fn to_charvec(&self) -> Vec<char> {
            self.to_string().chars().collect::<Vec<_>>()
        }
    }
}

use input::*;

fn main() {
    let s = input_line_str().to_charvec();
    let mut f = 0;
    let mut t = s.len() - 1;
    let mut ans = 0;
    while f < t {
        if s[f] != s[t] {
            ans += 1;
        }
        f += 1;
        t -= 1;
    }
    p(ans);
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
	using namespace std;
	#define dhoom ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);  
	typedef long long ll;
	typedef long double ld;
	const ll inf = 1e18;
	const int nax = 2e6 + 7;
	const ll mod = 1e9 + 7;
	//ll tree[4 * nax];
	//9uS-22RSwk7gQqh
	ll gcd(ll a , ll b){
		if(b == 0) return a;
		return gcd(b , a % b);	
	}
	ll lcm(ll a , ll b){
		ll g = gcd(a , b);
		ll lc = (a/g) * b;
		return lc;
	}
	//char a[55][55];
	int dx[] = {1,0,-1,0,1,1,-1,-1};
	int dy[] = {0,1,0,-1,1,-1,-1,1};
	int main()
	{
		dhoom;
		int n;
		cin >> n;
		int x = n/10;
		int y = n % 1000;
		if(x % 111 == 0 || y%111 == 0)
			cout << "Yes" << endl;
		else 
			cout << "No" << endl;
		return 0;
	}


Measured memory_bytes: 256
package main

import (
	"fmt"
  "math"
  //"sort"
	//"strconv"
)
func pow(p, q int) int {
    return int(math.Pow(float64(p), float64(q)))
}
func main() {
  var N,M int
  fmt.Scanf("%d %d",&N,&M);
  s := make([]int, M)
  c := make([]int, M)


  m := map[int]int{}

  for i:=0; i<M; i++{
    fmt.Scanf("%d %d",&s[i],&c[i]);
    if s[i]==1&&c[i]==0{
      if N==1{
        fmt.Print("0")
        return
      }
      fmt.Print("-1")
      return
    }
    if m[s[i]]==0{
      m[s[i]]=c[i]
    }else{
      if m[s[i]]!=c[i]{
        fmt.Print("-1")
        return
      }
    }
  }

  var ans int
  for key, value := range m{
    if key==1{
      ans+=value*pow(10,N-1)
    }else if key==2{
      ans+=value*pow(10,N-2)
    }else{
      ans+=value*pow(10,N-3)
    }
  }
  if N==3{
    if m[1]==0{
      ans+=100
    }
  }else if N==2{
    if m[1]==0{
      ans+=10
    }
  }


  fmt.Print(ans)

}


Measured memory_bytes: 512
#include <iostream>
#define ll long long
#define fr(n) for(int i = 1; i <= n; i++) d[i] = -1;

using namespace std;

const int NMAX = 1e5 + 20;
ll d[NMAX];

ll n, g, p;
ll GMAX;
ll last;

int main()
{
    cin >> n >> GMAX;
    fr(1e5 + 5);
    last = d[0] = 0;
    for(int i = 1; i <= n; i++) {
        cin >> g >> p;
        for(int j = last; j >= 0; j--) {
            if(d[j] + g > GMAX) continue;
            if(d[j] != -1) {
                if(d[j + p] > d[j] + g || d[j + p] == -1) {
                    d[j + p] = d[j] + g;
                    if(j + p > last)
                        last = j + p;
                }
            }
        }
    }
    cout << last;
    return 0;
}


Measured memory_bytes: 4356
/*

This Submission is to determine how many 120/240 min const. delivery point there are.

//info
120 req. steps <= 5
*/
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;
typedef string::const_iterator State;
#define Ma_PI 3.141592653589793
#define eps 0.00000001
#define LONG_INF 1e18
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define MOD 1000000007
#define seg_size 262144
#define REP(a,b) for(long long a = 0;a < b;++a)

unsigned long xor128() {
	static unsigned long x = time(NULL), y = 362436069, z = 521288629, w = 88675123;
	unsigned long t = (x ^ (x << 11));
	x = y; y = z; z = w;
	return (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)));
}
int main() {
#define int long long
	int n;
	cin >> n;
	string s;
	cin >> s;
	long long ans = 1;
	long long plus = 0;
	long long minus = 0;
	long long now_itr = 0;
	for (int i = 0; i < s.length(); ++i) {
		if (s[i] == 'B') {
			if (now_itr % 2 == 0) {
				//choose plus 1!
				plus++;
				now_itr++;
			}
			else {
				//must choose -1
				ans *= now_itr;
				ans %= MAX_MOD;
				minus++;
				now_itr--;
			}
		}
		else {
			//White
			if (now_itr % 2 == 1) {
				plus++;
				now_itr++;
			}
			else {
				ans *= now_itr;
				ans %= MAX_MOD;
				minus++;
				now_itr--;
			}
		}
	}
	if (plus != minus) ans = 0;
	for (long long i = 2; i <= n; ++i) {
		ans *= i;
		ans %= MAX_MOD;
	}
	cout << ans << endl;
}

Measured memory_bytes: 640
N, X = map(int,input().split(" "))
x = map(int, input().split(" "))
d = [abs(i-X) for i in x]
d_min = min(d)
def func(d_min,d):
  for i in range(d_min+1,0,-1):
    a=True
    for k in d:
      if k%i == 0:
        continue
      else:
        a = False
        break
    if a:
      return i
print(func(d_min,d)) 

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

namespace ALDS1_1
{
    class Program
    {
        private static string Join(int[] a)
        {
            var r = "";
            for(int i = 0; i < a.Length; i++)
            {
                r += a[i].ToString();
                if(i != a.Length - 1) r += ' ';
            }
            return r;
        }

        static void Main()
        {
            int n = int.Parse(Console.ReadLine());
            var a = Console.ReadLine().Split().Select(int.Parse).ToArray();
            for(int i = 0; i < n; i++)
            {
                int v = a[i], j = i - 1;
                while (j >= 0 && a[j] > v)
                    a[j + 1] = a[j--];
                a[j + 1] = v;
                Console.WriteLine(Join(a));
            }
        }
    }
}

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

int main() {
  int X, Y, Z;
  cin >> X >> Y >> Z;
  cout << Z << " " << X << " " << Y << endl;
}

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



int main(){
    int n,m,k;
    cin >> n >> m >> k;
    vector<vector<int>> G(n);
    rep(i,m){
        int a,b;
        cin >> a >> b;
        --a;--b;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    vector<int> label(n),cnt(n),cand(n);
    int num = 0;
    rep(i,n){
        if(label[i]==0){
            ++num;
            queue<int> q;
            q.push(i);
            label[i] = num;
            cnt[num]++;
            while(q.size()){
                int v = q.front();
                q.pop();
                for(auto nv:G[v]){
                    //cout <<v <<" "<<nv << endl;
                    if(label[nv]!=0) continue;
                    q.push(nv);
                    label[nv] = num;
                    cnt[num]++;
                }
            }
        }
    }
    rep(i,n) {
        cand[i] = cnt[label[i]] - G[i].size() - 1;
        
    }

    rep(i,k) {
        int a,b;
        cin >> a >> b;
        --a;--b;
        if(label[a]==label[b]){
            cand[a]--;
            cand[b]--;
        }
    }
    rep(i,n) cout << cand[i] <<" ";
    cout << endl;
}

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

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

    int ans = 0;

    while(n != 0){
        n /= k;
        ans++;
    }

    cout << ans << endl;

    return 0;
    
}

Measured memory_bytes: 256
use proconio::{fastout, input};
use std::collections::HashSet;

#[fastout]
fn main() {
  input! {
    x: i32,
    n: i32,
    a: [i32;n],
  }
  let mut nums = HashSet::new();
  
  for i in a {
    nums.insert(i as i32);
  }
  
  let mut ans=0;
  
  for i in 0..=100 {
    if !nums.contains(&(x - i)) {
      ans = x - i;
      break;
    }
    if !nums.contains(&(x + i)) {
      ans = x + i;
      break;
    }
  }
  
  println!("{}",ans);
}


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

int main(){
	int N;
	cin>>N;
	map<int,int> arr;
	int tmp;
	for(int i=0;i<N;++i){
		cin>>tmp;
		if(arr[tmp]==0)arr[tmp]=1;
		else arr.erase(tmp);
	}
	cout<<arr.size()<<endl;
}


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

///******************************** C o n t a i n e r ********************************///

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;

///*********************************** C o n s t ***********************************///

const int       N=1e6+3;
const double    PI = acos(-1);
const ll        MOD=1000000007;                 ///1e9+7
ll dx[] = {+1, 0, -1, 0, +1, +1, -1, -1};       ///first 4 for adjacent
ll dy[] = {0, +1, 0, -1, +1, -1, +1, -1};
ll dx8[]= {+1, +1, -1, -1, +2, +2, -2, -2};    ///knights move
ll dy8[]= {+2, -2, +2, -2, +1, -1, +1, -1};

///********************************** M a r c o ***********************************///

#define pb push_back
#define F first
#define S second
#define test int tc; cin>>tc; while(tc--)
#define forn(i,n) for(i=0;i<n;i++)
#define rforn(i,n) for(i=n-1;i>=0;i--)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define sz(x) x.size()
#define el <<'\n'
#define sp <<' '
#define print(a) {for(auto x:a)cout<<x<<" ";cout<<endl;}
#define mem(a,b) memset(a, b, sizeof(a))
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define sqr(a) (a)*(a)

#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define fraction() cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);

///*********************************** F u n c t i o n ***********************************///

ll powmod(ll a,ll b){ll p=MOD;a%=p;if(!a) return 0;ll pr=1;while(b>0){if(b&1){pr*=a;pr%=p;--b;}a*=a;a%=p;b/=2;}return pr;}
ll modinverse(ll a){return powmod(a,MOD-2);}
bool isPrime(ll n){ if(n<=1)return false;if(n<=3)return true;if(n%2==0 or n%3==0)return false;for(ll i=5;i*i<=n;i+=6){if(n%i==0 or n%(i+2)==0)return false;}return true;}
void seive(bool a[]){ll mx=sqrt(N),ii,jj;for(ii=3;ii<=mx;ii+=2)if(!a[ii])for(jj=ii*ii;jj<=N;jj+=2*ii)a[jj]=true;}
void numofdiv(ll a[]){ll mx=sqrt(N),ii,jj;for(ii=1;ii<=mx;ii++){for(jj=ii*ii;jj<=N;jj+=ii){if(jj==ii*ii) a[jj]++; else a[jj]+=2;}}}
void sumofdiv(ll a[]){ll mx=sqrt(N),ii,jj;for(ii=1;ii<=mx;ii++){for(jj=ii*ii;jj<=N;jj+=ii){if(jj==ii*ii) a[jj]+=ii; else a[jj]+=ii+jj/ii;}}}

///**************************************************** C o d e ****************************************************///
///-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=///


void _case()
{
    ll n,i,ans=0;
    cin>>n;
    ll a[n+1]={0},b[n+1]={0},c[n+1]={0};
    for(i=1;i<=n;i++) cin>>a[i];
    for(i=1;i<=n;i++) cin>>b[i];
    for(i=1;i<n;i++) cin>>c[i];
    for(i=1;i<=n;i++) {
        ans+=b[a[i]];
        if(i>1 and a[i]-1==a[i-1]) ans+=c[a[i-1]];
    }
    cout<<ans el;
}

main()
{
    fastio();
    _case();

}


///Thank you.


///Brainless_Loco Terminates Here!


Measured memory_bytes: 3656
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
use std::io::{Write, BufWriter};
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

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

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

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

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

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

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

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

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

fn solve() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($($format:tt)*) => (write!(out,$($format)*).unwrap());
    }
    input! {
        n: usize,
        d: i64,
        a: [i64; n],
    }
    let mut g = vec![Vec::new(); 2 * n];
    for i in 0 .. n {
        g[i].push((n + i, a[i]));
        g[n + i].push((i, a[i]));
    }
    for i in 0 .. n - 1 {
        g[n + i].push((n + i + 1, d));
        g[n + i + 1].push((n + i, d));
    }
    let mut que = BinaryHeap::new();
    const INF: i64 = 1 << 50;
    let mut dp = vec![(INF, 2 * n); 2 * n];
    for i in 0 .. n {
        que.push((0, i, i));
    }
    let mut tot = 0;
    while let Some((dist, v, w)) = que.pop() {
        let dist = -dist;
        if dp[w].0 == INF {
            dp[w] = (dist, v);
            for &(u, cost) in g[w].iter() { 
                que.push((-dist - cost, v, u));
            }
        } else {
            // dp[w].1 and v meets
            if v != dp[w].1 {
                tot += dp[w].0 + dist;
            }
        }
    }
    puts!("{}\n", tot / 2);
}

fn main() {
    // In order to avoid potential stack overflow, spawn a new thread.
    let stack_size = 104_857_600; // 100 MB
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}


Measured memory_bytes: 71160
from itertools import *

def loop(n):
  yield from repeat(n, (n-1)>>1)
  if n & 1 == 0:
    yield n >> 1
  yield from repeat(0)

def branch(n, l):
  if n:
    yield 0
    a, b = divmod(l-3, 2)
    s = 1
    for i in range(n+a+b):
      yield s
      if i < a:
        s += 2
      elif b and i==a:
        s += 1
      if n <= i:
        s -= 2
      elif i==n-1:
        s -= 1
  yield from repeat(0)

def b_to_b(n):
  yield n
  yield from range(n, 0, -1)
  yield from repeat(0)

N, X, Y = map(int, input().split())
L = Y - X + 1
for p in islice(zip(loop(L), branch(X-1, L), branch(N-Y, L), b_to_b(N-L)), N-1):
  print(sum(p))


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

typedef long long int ll;
typedef long double ld;
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define MOD (ll)(1e9 + 7)
#define vi vector<int>
#define vii vector<vector<int> >
#define vl vector<ll>
#define vll vector<vector<ll> >
#define vc(T, nm) vector<T> nm
#define pb push_back
#define popb pop_back
#define si set<int>
#define sl set<ll>
#define F first
#define S second
#define pii pair<int, int>
#define mp make_pair
#define ins insert
#define ers erase
#define endl "\n"
#define mul(a, b) ((a % MOD) * (b % MOD)) % MOD
#define adr(a, b) ((a % MOD) + (b % MOD)) % MOD
#define FORA(x, s, e, inc) for(ll x = s; x != e; x += inc)
#define ROFA(x, s, e, inc) for(ll x = s; x != e; x -= inc)
#define FOR(x, s, e) FORA(x, s, e, 1)
#define ROF(x, s, e) ROFA(x, s, e, 1)
#define loop(x, n) FOR(x, 0, n)
#define rd1(t, a) 					t a; cin >> a;
#define rd2(t, a, b) 				rd1(t, a); rd1(t, b); 
#define rd3(t, a, b, c) 			rd2(t, a, b); rd1(t, c);
#define rd4(t, a, b, c, d) 			rd3(t, a, b, c); rd1(t, d);
#define rd5(t, a, b, c, d, e) 		rd4(t, a, b, c, d); rd1(t, e);
#define rd6(t, a, b, c, d, e, f) 	rd5(t, a, b, c, d, e); rd1(t, f);
#define rdA(t, nm, len)				t nm[len]; loop(i, len) {cin >> nm[i];}
#ifdef DEBUG
	#define deb(v) cout << endl << #v << ": " << v << endl
	#define db1(v) cout << endl << #v << ": " << "[ "; for(auto x: v) {cout << x << " ";}; cout << "]" << endl;
	#define db2(v) cout << endl << #v << ": " << endl; for(auto r: v) {cout << "[ "; for(auto x: r) {cout << x << " ";}; cout << "]" << endl;};
	#define dbl cout << "-------------------------------" << endl
#else
	#define deb(v)
	#define db1(v)
	#define db2(v)
	#define dbl
#endif

void solve() {
    rd1(ll, k);
    rd2(ll, a, b);
    FOR(i, a, b + 1) {
        if(i % k == 0) {
            cout << "OK";
            return;
        }
    }
    
    cout << "NG";
}

int main() {
	
	fastio;

// 	rd1(ll, t);
	ll t = 1;

    while(t--) {
        solve();
    }



	return 0;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ul;
typedef signed long long ll;
ul over = 1000000007;

mt19937 mt(time(nullptr));
// uniform_int_distribution< int > rand_int(0, 10) // rand[0, 10] inclusive

int main(void)
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed;
  int h, w;
  cin >> h >> w;
  vector< string > s(h);
  for (int i=0; i<h; ++i) cin >> s[i];
  vector< vector< int > > t(h, vector< int >(w, 0));
  vector< vector< int > > b(h, vector< int >(w, 0));
  vector< vector< int > > l(h, vector< int >(w, 0));
  vector< vector< int > > r(h, vector< int >(w, 0));
  for (int i=0; i<h; ++i) {
    int sum = 0;
    for (int j=0; j<w; ++j) {
      if (s[i][j]=='#') sum=0;
      else {
        l[i][j] = sum;
        sum++;
      }
    }
  }
  for (int i=0; i<h; ++i) {
    int sum = 0;
    for (int j=w-1; j>=0; --j) {
      if (s[i][j]=='#') sum=0;
      else {
        r[i][j] = sum;
        sum++;
      }
    }
  }
  for (int j=0; j<w; ++j) {
    int sum = 0;
    for (int i=0; i<h; ++i) {
      if (s[i][j]=='#') sum=0;
      else {
        t[i][j] = sum;
        sum++;
      }
    }
  }
  for (int j=0; j<w; ++j) {
    int sum = 0;
    for (int i=h-1; i>=0; --i) {
      if (s[i][j]=='#') sum=0;
      else {
        b[i][j] = sum;
        sum++;
      }
    }
  }
  int ans = 0;
  for (int i=0; i<h; ++i) {
    for (int j=0; j<w; ++j) {
      if (s[i][j]=='#') continue;
      //cout << i << " " << j << " " << t[i][j] << " " << b[i][j] << " " << 
      ans = max(ans, 1+t[i][j]+b[i][j]+l[i][j]+r[i][j]);
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 67328
#include<iostream>
#include<string>
#include<vector>

int main() {
    int n, q;
    std::string s;
    std::cin >> n >> q >> s;
    
    std::vector<int> c(n + 1, 0);
    for (int i = 0; i < n - 1; i++) {
        if (s[i] == 'A' && s[i + 1] == 'C') c[i + 2] += 1;
        c[i + 3] += c[i + 2];
    }

    for (int i = 0; i < q; i++) {
        int l, r;
        std::cin >> l >> r;
        l--;
        r--;

        int ans = c[r + 1] - c[l];
        if (l > 0 && s[l - 1] == 'A' && s[l] == 'C') ans--;
        std::cout << ans << std::endl;
    }
}

Measured memory_bytes: 1408
#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;

#define NUM 0

int N;
ll* table;

void init(int first_N){
	while(N < first_N)N *= 2;
}

void update(int loc,ll value){
	loc += N-1;

	table[loc] = value;

	if(N == 1)return;

	int parent = (loc-1)/2;

	while(true){
		table[parent] = max(table[2*parent+1],table[2*parent+2]);

		if(parent == 0)break;
		else{
			parent = (parent-1)/2;
		}
	}
}


ll query(int search_left,int search_right,int node_id,int node_left,int node_right){

	if(search_right < node_left || search_left > node_right)return NUM;

	if(search_left <= node_left && search_right >= node_right){
		return table[node_id];
	}

	ll left_max = query(search_left,search_right,2*node_id+1,node_left,(node_left+node_right)/2);
	ll right_max = query(search_left,search_right,2*node_id+2,(node_left+node_right)/2+1,node_right);

	return max(left_max,right_max);
}


int main(){

	int first_N;
	table = new ll[263000];
	N = 1;

	scanf("%d",&first_N);

	init(100001);

	for(int i = 0; i <= 2*N-2; i++)table[i] = NUM;

	ll tmp,left_max,sum = 0;

	for(int loop = 0; loop < first_N; loop++){

		scanf("%lld",&tmp);

		left_max = query(0,tmp-1,0,0,N-1);

		update(tmp,left_max+tmp);

		sum += tmp;
	}

	ll ans = 0;

	for(int i = 1; i <= 100000; i++){
		ans = max(ans,table[N-1+i]);
	}

	printf("%lld\n",sum - ans);

	return 0;
}

Measured memory_bytes: 5220
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>

#define rep(i, j) FOR(i, 0, j)
#define FOR(i, j, k) for(int i = j; i < k; ++i)

using namespace std;

int main(){
  int n, page;
  vector< int >p;
  while(scanf("%d", &n) && n){
    p.clear();
    rep(i, n){
      scanf("%d", &page); 
      p.push_back(page);
    }
    p.push_back(0);
    int cnt = 0, start = 0, f = 1;
    rep(i, n){
      if(!start) start = p[i];
      if(p[i] + 1 == p[i+1]) cnt++;
      else{
	printf(f?"%d":" %d", start);
	if(cnt) printf("-%d", p[i]);
	cnt = start = f = 0;
      }
    }
    puts("");
  }
  return 0;
}

Measured memory_bytes: 1064
#include<stdio.h>

int main()
{
	int a , b , c;
	scanf( "%d %d %d" , &a , &b , &c);
	if(a<b && b<c)
	{
		printf("Yes\n");
	}
	else
	{
		printf("No\n");
	}
	
	return 0;
} 


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

int mod = 1000000007;
int64_t large = 9223372036854775807;

int main()
{
    int N;
    cin >> N;
    vector<int> list(N);
    for (int i = 0; i < N; i++)
    {
        cin >> list[i];
        list[i]--;
    }

    vector<vector<int>> menu(N, vector<int>(2));
    for (int i = 0; i < 2; i++)
    {
        for (int j = 0; j < N; j++)
        {
            cin >> menu[j][i];
        }
    }
    int ans = 0;
    for (int i = 0; i < N; i++)
    {
        ans += menu[list[i]][0];

        if (0 < i && list[i] == list[i - 1] + 1)
            ans += menu[list[i - 1]][1];
    }
    cout << ans;
}

Measured memory_bytes: 256
using System;

class Program
{
  static void Main(string[] args)
  {
    int a,b;
    string[] str = Console.ReadLine().Split(' ');
    a = int.Parse(str[0]);
    b = int.Parse(str[1]);
    
    if (b%a == 0)
    {
      Console.WriteLine(a+b);
    }else
    {
      Console.WriteLine(b-a);
    }
  }
}

Measured memory_bytes: 11092
/*********************
*  Author: xuziyuan  * 
*********************/

#include <bits/stdc++.h>

#define rt0 return 0
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define replet(c) for(char c='a';c<='z';c++) 
#define LL long long
#define pii pair <int,int>
#define pb push_back
#define fi first
#define se second
#define mpr make_pair
#define sqr(a) ((a)*(a))

using namespace std;

const LL MOD=1e9+7;

LL n,a[300010],res=0;

int main()
{
	cin>>n;
	rep(i,n) cin>>a[i];
	for(int i=n-1;i>=0;i--) res=-res+a[i];
	cout<<res<<' ';
	rep(i,n-1)
	{
		res=(a[i]-res/2)*2;
		cout<<res<<' ';
	}
	cout<<endl;
	rt0;
}

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


void solve(long long N, long long M, std::vector<long long> X){
  sort(X.begin(), X.end());
  vector<long long> tmp(M-1);

  if(N >= M) {
    cout << 0 << endl;
  }
  else {
    for(long long i = 0; i < (M-1); i++) {
      tmp[i] = abs(X[i+1] - X[i]);
    }

    sort(tmp.begin(), tmp.end(),greater<long long>());
    cout << accumulate(tmp.begin()+(N-1), tmp.end(), 0ll) << endl;

  }
}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
  scanf("%lld",&N);
  long long M;
  scanf("%lld",&M);
  std::vector<long long> X(M);
  for(int i = 0 ; i < M ; i++){
    scanf("%lld",&X[i]);
  }
    solve(N, M, std::move(X));
    return 0;
}


Measured memory_bytes: 1792
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using System.Globalization;
using System.Diagnostics;
using System.Threading.Tasks;



class Myon
{
    public Myon() { }
    public static int Main()
    {
        new Myon().calc();
        return 0;
    }

    Scanner cin;

    void calc()
    {
        cin = new Scanner();

        int x = cin.nextInt();
        if (x == 7 || x == 5 || x == 3)
        {
            Console.WriteLine("YES");
        }
        else Console.WriteLine("NO");
    }

}




class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}

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

vector<int> a, taro_win, jiro_win;

bool taro(int k);
bool jiro(int k);

bool taro(int k) {
    if (taro_win[k] != -1) return taro_win[k];
    for (int ai : a) {
        if (ai > k) break;
        if (!jiro(k - ai)) return taro_win[k] = true;
    }
    return taro_win[k] = false;
}

bool jiro(int k) {
    if (jiro_win[k] != -1) return jiro_win[k];
    for (int ai : a) {
        if (ai > k) break;
        if (!taro(k - ai)) return jiro_win[k] = true;
    }
    return jiro_win[k] = false;
}

int main() {
    int N, K; cin >> N >> K;
    a.resize(N);
    for (int i = 0; i < N; ++i) cin >> a[i];
    taro_win.assign(K + 1, -1); taro_win[0] = false;
    jiro_win.assign(K + 1, -1); jiro_win[0] = false;
    cout << (taro(K) ? "First" : "Second") << endl;
    return 0;
}

Measured memory_bytes: 5760
#include <stdio.h>
#pragma warning(disable : 4996)
int s, m, n, r, c;
int solve(int x) {
	int ret = 0;
	for (int i = 0; i * i <= x; i++) {
		for (int j = 0; i * i + j * j <= x; j++) {
			if (i * i + j * j == x) {
				ret++;
			}
		}
	}
	return ret;
}
int main() {
	scanf("%d", &s);
	for (int i = 0; i < s; i++) {
		scanf("%d%d", &m, &n);
		r = m * m + n * n; c = 0;
		for (int i = 1; i <= r; i++) {
			if (r % i == 0) {
				c += solve(i) * solve(r / i);
			}
		}
		printf("%c\n", c == 8 ? 'P' : 'C');
	}
	return 0;
}

Measured memory_bytes: 2604
#include<bits/stdc++.h>
#define pii pair<int, int>
#define F first
#define S second
#define mp make_pair
using namespace std;

const int N=3e5+5, M=1e5+5;
int n, m;
pii qr[N];
int ans[M], bgr, segt[4*M];

struct qrsrt
{
	bool operator()(const pii &a, const pii &b)
	{
		return b.S-b.F>a.S-a.F;
	}
};
void update(int idx, int l, int r, int x, int val)
{
	if(l>x || r<x) return;
	if(l==r)
	{
		segt[idx]+=val;
		return;
	}
	int mid=(l+r)/2;
	update(idx*2, l, mid, x, val);
	update(idx*2+1, mid+1, r, x, val);
	segt[idx]=segt[idx*2]+segt[idx*2+1];
}
int query(int idx, int l, int r, int st, int en)
{
	if(l>en || r<st) return 0;
	if(l>=st && r<=en) return segt[idx];
	int mid=(l+r)/2;
	return query(idx*2, l, mid, st, en) + query(idx*2+1, mid+1, r, st, en);
}
int main()
{
	cin >> n >> m;
	bgr=n;
	for(int i = 0; i < n; i++)
	{
		cin >> qr[i].F >> qr[i].S;
	}
	sort(qr, qr+n, qrsrt());
	int ptr=0;
	for(int i = 1; i <= m; i++)
	{
		while(ptr<n && qr[ptr].S-qr[ptr].F+1<i)
		{
			bgr--;
			update(1, 1, m, qr[ptr].F, 1);
			update(1, 1, m, qr[ptr].S+1, -1);
			ptr++;
		}
		ans[i]=bgr;
		for(int j = i; j <= m; j+=i)
		{
			ans[i]+=query(1, 1, m, 1, j);
		}
	}
	for(int i = 1; i <= m; i++)
	{
		cout << ans[i] << endl;
	}
}

Measured memory_bytes: 4736
#include <cstdio>
#include <cstring>
#include <vector>
#include <queue>
#include <cmath>
#include <string>
#include <algorithm>
#include <iostream>
#include <string>
#include <map>
#include <set>
#include <functional>
#include <iostream>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int n;
double p;
class edge{
public:
	int t;
	double c;
	edge(){}
	edge(int tt,double cc){
		t=tt;
		c=cc;
	}
};

vector<edge> G[100001];
int depth[100001];
int cnt[100001];
double sum=0.0;
bool flag[100001];

void dfs(int v,int d){
	flag[v]=true;
	depth[v]=d;
	for(int i=0;i<G[v].size();i++){
		if(!flag[G[v][i].t]){
			sum+=G[v][i].c*pow(p,(d+1.0));
			dfs(G[v][i].t,d+1);
		}
	}
}

int main(void){
	scanf("%lf",&p);
	scanf("%d",&n);
	for(int i=0;i<n-1;i++){
		int f,t,c;
		scanf("%d%d%d",&f,&t,&c);
		f--;
		t--;
		G[f].push_back(edge(t,(double)c));
		G[t].push_back(edge(f,(double)c));
	}
	memset(flag,false,sizeof(flag));
	dfs(0,0);
	for(int i=0;i<n;i++){
		cnt[depth[i]]+=1;
	}
	cnt[0]++;
	double res=0.0;
	for(int i=0;i<n;i++){
		res+=(double)cnt[i]*sum*pow(p,i);
	}
	printf("%.9f\n",res);
	return 0;
}

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

maxdivisiontimes = -1
while n != 0:
    flag = True
    checkcounter = 0
    checkno = n
    while flag == True:
        if checkno % 2 == 0:
            checkcounter += 1
        checkno = checkno // 2 
        if checkno == 1 or checkno == 0:
            flag = False
    if maxdivisiontimes < checkcounter:
        maxdivisiontimes = checkcounter
        maxdivisionno = n
    n -= 1
print(maxdivisionno)

Measured memory_bytes: 9188
icase=0
if icase==0:
    n=int(input())
    a0=list(map(int,input().split()))
    a1=list(map(int,input().split()))
elif icase==1:
    n=5
    a0=[3, 2, 2, 4, 1]
    a1=[1, 2, 2, 2, 1]
elif icase==2:
    n=4
    a0=[1, 1, 1, 1]
    a1=[1, 1, 1, 1]
elif icase==3:
    n=7
    a0=[3, 3, 4, 5, 4, 5, 3]
    a1=[5, 3, 4, 4, 2, 3, 2]
elif icase==4:
    n=1
    a0=[2]
    a1=[3]
    
if n==1:
    print(a0[0]+a1[0])
elif n==2:
    smax=a0[0]+a0[1]+a1[1]
    ssum=a0[0]+a1[0]+a1[1]
    print(max(smax,ssum))
else:
    
    s0=[a0[0]]
    s1=[a1[0]]

    for i in range(1,n):
        s0.append(s0[i-1]+a0[i])
        s1.append(s1[i-1]+a1[i])
    
    smax=s0[0]+s1[n-1]
    for i in range(1,n):
        ssum=s0[i]+s1[n-1]-s1[i-1]
        smax=max(ssum,smax)
    print(smax)    
    

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define REP(i, e) for(int (i) = 0; (i) < (e); ++(i))
#define FOR(i, b, e) for(int (i) = (b); (i) < (e); ++(i))
#define ALL(c) (c).begin(), (c).end()
#define PRINT(x) cout << (x) << "\n"
using namespace std;
using ll = long long; using pint = pair<int, int>; using pll = pair<ll, ll>;
template<typename T> auto compare = [](T x, T y) -> bool{return (x < y);};
const int MOD = 1000000007;

int N, K;
vector<pll> v;
ll M[100];

signed main(){
    cin >> N >> K;
    ll x, y;
    REP(i, N){
        cin >> x >> y;
        v.push_back(pll(x, y));
    }
    REP(i, N + 1) M[i] = LONG_LONG_MAX;
    sort(ALL(v));
    REP(k, N - 1){
        FOR(l, k + 1, N){
            ll y_min = min(v[k].second, v[l].second);
            ll y_max = max(v[k].second, v[l].second);
            ll sum = 0;
            REP(i, N){
                ll sum = 0;
                ll x_l = v[i].first;
                FOR(j, i, N){
                    ll x = v[j].first, y = v[j].second;
                    if(y_min <= y && y <= y_max){
                        sum++;
                        M[sum] = min(M[sum], (y_max - y_min) * (x - x_l));
                    }
                }
            }
        }
    }
    ll ans = LONG_LONG_MAX;
    FOR(i, K, N + 1) ans = min(ans, M[i]);
    PRINT(ans);
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<stack>
#include<cstring>
char a[100005];
using namespace std;
stack <char> s;
int main()
{
    int cnt=0;
    cin>>a;
    for(int i=0;i<=strlen(a)-1;i++)
    {
        if(s.empty()||s.top()==a[i])s.push(a[i]);
        else
        {
            s.pop();
            cnt+=2;
        }
    }
    printf("%d\n",cnt);
    return 0;
}


Measured memory_bytes: 512
s=input()
tmp=[0]
cnt=0
for i in range(len(s)):
    if s[i]=='<':
        tmp.append(tmp[i]+1)
    else :
        tmp.append(0)

for i in reversed(range(len(s))):
    if s[i]=='>':
        tmp[i]=max(tmp[i],tmp[i+1]+1)
print(sum(tmp))


Measured memory_bytes: 24096
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <set>
#include <queue>
#include <map>
#include <numeric>
#include <functional>
#include <math.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

#define INF ((int)1e9)
#define INFLL ((ll)1e18)
#define MOD (1000000007LL)


int main(int argc, const char * argv[]) {
    ios_base::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<string> S(N);
    for (int n = 0; n < N; ++n) {
        cin >> S[n];
    }
    
    int Res = 0;
    for (int n = 0; n < N; ++n) {
        for (int l = 0; l < S[n].length()-1; ++l) {
            if (S[n][l] == 'A' && S[n][l+1] == 'B') {
                ++Res;
            }
        }
    }
    
    int nBeginB = 0, nEndA = 0, nBoth = 0;
    for (int n = 0; n < N; ++n) {
        if (S[n][0] == 'B' && S[n][S[n].length()-1] == 'A') ++nBoth;
        else if (S[n][0] == 'B') ++nBeginB;
        else if (S[n][S[n].length()-1] == 'A') ++nEndA;
    }
    if (nBoth >= 1){
        Res += (nBoth-1);
        if (nEndA >= 1) {
            --nEndA;
            ++Res;
        }
        if (nBeginB >= 1) {
            --nBeginB;
            ++Res;
        }
    }
    Res += min(nEndA, nBeginB);
    
    cout << Res << endl;
    
    return 0;
}


Measured memory_bytes: 768
n,A,b,C,d=map(int,input().split())

if n%A==0:
    a=int(n/A)
else:
    a=int(n/A)+1
    
if n%C==0:
    c=int(n/C)
else:
    c=int(n/C)+1

if a*b>c*d:
    print(int(c*d))
else:
    print(int(a*b))


Measured memory_bytes: 5596
#include <bits/stdc++.h>
typedef long long ll;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define all(v) v.begin(), v.end()
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
const int INF = 1 << 30;
const ll INFll = 1ll << 60;
template <typename T>
bool chmax(T& a, const T& b) {
  if (a < b) {
    a = b;  // aをbで更新
    return true;
  }
  return false;
}
template <typename T>
bool chmin(T& a, const T& b) {
  if (a > b) {
    a = b;  // aをbで更新
    return true;
  }
  return false;
}

int main() {
  int A, B;
  cin >> A >> B;
  int ans = A < 2 * B ? 0 : A - 2 * B;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<string.h>
#include<cstdlib>
#include<map>
#include<fstream>
#include<string>
#include<sstream>
#include<iomanip>
#include<cmath>
#include<random>

using namespace std;

long long dp[3][100100] = {};
const long long INF = 1LL << 60;
#define MOD 1000000007

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

/**
* @fn
* 最大値を取ります.Vector<int>を渡すこと.
*/
long long int imax(vector<int> a) {
	int MAX = -10000000;
	for (int i = 0; i < a.size(); i++) {
		if (MAX < a.at(i)) MAX = a.at(i);
	}
	return MAX;
}

/**
* @fn
* 最小値を取ります.Vector<int>を渡すこと.
*/
long long int imin(vector<int> a) {
	int MIN = 1000000000;
	for (int i = 0; i < a.size(); i++) {
		if (MIN > a.at(i)) MIN = a.at(i);
	}
	return MIN;
}


long long int absmin(vector<int> a, long long int b) {
	int mini = 100000000;
	int d = 0;
	for (int i = 0; i < a.size(); i++) {
		if (mini > abs(a.at(i) - b)) {
			mini = abs(a.at(i) - b);
			d = i;
		}
	}
	return d;
}


long long int absmax(vector<int> a, long long int b) {
	int max = -100000000;
	int d = 0;
	for (int i = 0; i < a.size(); i++) {
		if (max < abs(a.at(i) - b)) {
			max = abs(a.at(i) - b);
			d = i;
		}
	}
	return d;
}

int gcd(int a, int b)
{
	if (a < b) swap(a, b);
	if (b < 1) return -1;
	if (a % b == 0) return b;
	return gcd(b, a % b);
}

void haerobatya(int start, int end, char level) {
	if (start > end) swap(start, end);
	for (int i = start; i <= end; i++) {
		if (i < 100) {
			cout << "https://atcoder.jp/contests/abc0" << i << "/tasks/abc0" << i << "_" << level << endl;
		}
		else {
			cout << "https://atcoder.jp/contests/abc" << i << "/tasks/abc" << i << "_" << level << endl;
		}
	}
}

long long int cntmod(long long int warareru, long long int mod) {
	long long int i = 0;
	for (i = 0;true; i++) {
		if (warareru % mod == 0 && warareru >= mod) {
			warareru /= mod;
		}
		else {
			return i;
		}
	}
}

//ここまでライブラリ
//ここから本文

long long int tpimin(vector<int> a) {
	int MIN = 1000000000;
	int number = 0;
	for (int i = 0; i < a.size(); i++) {
		if (MIN > a.at(i)) MIN = a.at(i);
		number = i;
	}
	return number;
}
int main() {
	long long l, r;
	cin >> l >> r;
	if (l + 2019 < r) {
		cout << 0 << endl;
		return 0;
	}
	long long mini = 1000000;
	for (long long  i = l; i < r; i++) {
		for (long long  j = i + 1; j <= r; j++) {
			mini = min((j * i) % 2019, mini);
		}
	}
	cout << mini << endl;

}

Measured memory_bytes: 256
from collections import deque
n = int(input())
edges = [[] for i in range(n)]
for i in range(n - 1):
    a, b = map(int, input().split())
    edges[a - 1].append(b - 1)
    edges[b - 1].append(a - 1)
ans = [0] * n
ans[0] = 1
ans[-1] = -1
Q = deque([0, n - 1])
while Q:
    p = Q.popleft()
    cur = ans[p]
    for v in edges[p]:
        if ans[v] == 0:
            ans[v] = cur
            Q.append(v)
if ans.count(1) > ans.count(-1):
    print("Fennec")
else:
    print("Snuke")

Measured memory_bytes: 26680
#include<bits/stdc++.h>
using namespace std;
int const nax = 3e5 + 10;
using ll = long long;
ll a[nax];
ll b[nax];

int main () {
    int n, m;
    ll k;
    int ans = 0;

    scanf("%d %d %lld", &n, &m, &k);

    for (int i = 1 ; i <= n ; ++ i) {
        scanf("%lld", a + i);
        a[i] += a[i - 1];
        if (a[i] <= k) {
            ans = i;
        }
    }

    ll cur_sum = 0;

    int bar = ans;

    for (int i = 1 ; i <= m ; ++ i) {
        scanf("%lld", b + i);
        cur_sum += b[i];

        ll res = k - cur_sum;

        if (res < 0) continue;

        while (bar > 0 && a[bar] > res) -- bar;

        ans = max(ans, i + bar);
    }

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


}
/*
    Good Luck
        -Lucina
*/


Measured memory_bytes: 6956
#include <stdio.h>

int main(void)
{
    int m, f, r;

    while (1){
        scanf("%d %d %d", &m, &f, &r);

        if (m == (-1) && f == (-1) && r == (-1)) break;

        if (m == (-1) || f == (-1)){
            printf("F\n");
        }else if (m + f >= 80){
            printf("A\n");
        }else if (m + f >= 65 && m + f < 80){
            printf("B\n");
        }else if (m + f >= 50 && m + f < 65){
            printf("C\n");
        }else if (m + f >= 30 && m + f < 50){
            if(r >= 50){
                printf("C\n");
            }else{
                printf("D\n");
            }
        }else if(m + f < 30){
            printf("F\n");
        }
    }

    return (0);
}


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

//repetition
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)

//container util
#define all(x) (x).begin(),(x).end()

//typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;

//const value
//const ll MOD = 1e9 + 7;
const ll INF = 1e15 ;
//const int dx[] = {0,1,0,-1};//{0,0,1,1,1,-1,-1,-1};
//const int dy[] = {1,0,-1,0};//{1,-1,0,1,-1,0,1,-1};

//conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
inline ll toLL(string s) {ll v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n,cmd;
  cin >> n;
  priority_queue<ll> left_que;
  priority_queue< ll, vector<ll>, greater<ll>>  right_que;

  ll bsum = 0;
  ll leftSum = 0;
  ll rightSum = 0;
  rep(query,n){
    cin >> cmd;
    if(cmd == 1){
      ll a,b;
      cin >> a >> b;
      bsum += b;
      if(left_que.size()  == 0){
        left_que.push(a);
        leftSum += a;
      }
      else if(left_que.top() > a){
        left_que.push(a);

        leftSum += a;
        // cout << "left" << endl;

        if(left_que.size() > (1 + right_que.size())){
          ll tmp = left_que.top();
          left_que.pop();
          right_que.push(tmp);
          leftSum -= tmp;
          rightSum += tmp;
        }
      }else if(left_que.top() <= a){
        // cout << "right" << endl;

        right_que.push(a);
        rightSum += a;
        if(right_que.size() > left_que.size()){
          ll tmp = right_que.top();
          right_que.pop();
          left_que.push(tmp);
          rightSum -= tmp;
          leftSum += tmp;
        }
        // cout << left_que.top() << ' '<< right_que.top();
      }

    }else if(cmd == 2){
      ll mid = left_que.top();
      // cout << "left " << mid * ll(left_que.size()) - leftSum << ", right " <<  - mid * ll(right_que.size()) + rightSum  << ' ' << bsum << endl;
      //cout << mid << endl;
      cout << mid << ' ' << mid * ll(left_que.size()) - leftSum - mid * ll(right_que.size()) + rightSum + bsum << endl;
    }
  }
  return 0;
}


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

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

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

  vector<int> s(m);
  vector<int> c(m);
  rep(i,m){
    cin >> s.at(i) >> c.at(i);
  }

  int ans = -1;
  
  rep(i,1000){
    {
      int keta=0;
      int now = i;
      while(now>0){
        now/=10;
        keta++;
      }
      if(i==0) keta=1;
      if(keta!=n) continue;
    }
    
    {
      string now = to_string(i);
      bool check=true;
      rep(j,m){
        int keta=s.at(j)-1;
        if((now.at(keta)-'0')!=c.at(j)) {check=false; continue;}
      }
      if(!check) continue;
    }

    ans = i;
    break;
  }

  cout << ans;
}

Measured memory_bytes: 3700
#include <bits/stdc++.h>
using namespace std;
int main() {
    int t = 0;
    int min = 10;
    for(int i = 0;i < 5;i++) {
        int a;
        cin >> a;
        if(a % 10 == 0) {
            t += a;
        }else {
            t += (a / 10) * 10 + 10;
        }
        if(a % 10 < min && a % 10 != 0) {
            min = a % 10;
        }
    }
    cout << t + min - 10 << endl;
}


Measured memory_bytes: 256
import sys
from collections import Counter
from collections import deque
import math
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

a,b=mp()
if a<=9 and b<=9:
    print(a*b)
else:
    print(-1)

Measured memory_bytes: 3316
#include <stdio.h>
int main(int argc, char const *argv[]) {
 int a, b, c;
 scanf("%d %d %d", &a, &b, &c);
 if (a < b && b < c) {
  printf("Yes\n");
 } else {
  printf("No\n");
 }
 return 0;
}

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

int main(void)
{
    int n, k;
    
    int i, j;
    
    long int fir = 1000000000;
    
    long int data[100000];
    long int sum[100000];
    long int kyo[100000];
    long int zet[100000];
    
    
    scanf("%d %d\n", &n, &k);
    
    for(i = 0; i < n; i++) {
        if(i == n - 1) {
            scanf("%ld", &data[i]);
        } else {
            scanf("%ld ", &data[i]);
        }
    }
    
    for(i = 0; i < 100000; i++) {
        sum[i] = 0;
        zet[i] = labs(data[i]);
        if(i < n - 1) {
            kyo[i] = labs(data[i + 1] - data[i]);
        }
    }
    
    for(i = 0; i < n - 1; i++) {
        //printf("%ld\n", kyo[i]);
    }
    
    
    
    for(i = 0; i < n - k + 1; i++) {
        for(j = i; j < i + k - 1; j++) {
            
            sum[i] += kyo[j];
            
        }
        
        if(zet[i]  <= zet[i + k - 1]) {
            sum[i] += zet[i];
        } else {
            sum[i] += zet[i + k - 1];
        }
        
        //printf("%d~%d:%ld\n", i, i + k - 1, sum[i]);
    }
    
    for(i = 0; i < n - k + 1; i++) {
        if(fir > sum[i]) {
            fir = sum[i];
        }
    }
    
    printf("%ld\n", fir);
    
    
    
    return 0;
}


Measured memory_bytes: 3328