akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <bitset>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stdio.h>
#include <string>
#include <vector>

#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using LP = pair<ll, ll>;
const double PI = 3.1415926535897932;

/* a と b の最大公約数を返す関数 */
long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}

int main()
{
	string S;
	cin >> S;

	bool a1 = S[2] == S[3];
	bool a2 = S[4] == S[5];

	if (a1 && a2) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;
}


Measured memory_bytes: 3640
/*
* @Author Silviase(@silviasetitech)
* For ProCon
*/

import java.util.*;
import java.lang.*;
import java.math.*;

class Main{

    static int n;
    static int c;
    static int k;
    static int m;
    static int height;
    static int width;
    static int lef;
    static int rig;
    static String s;
    static String anss;
    static int[] times;
    static long ans;
    static int[] w;
    static int[] ww;
    static boolean[] visit;
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        
        height = sc.nextInt();
        width = sc.nextInt();
        String[] s = new String[height+2];
        boolean[][] bool = new boolean[height+2][width+2];
        boolean ans = true;
        for (int i = 0; i < height+2; i++) {
            for (int j = 0; j < width+2; j++) {
                bool[i][j] = false;
            }
        }
        

        for (int i = 1; i <= height; i++) {
            s[i] = sc.next();
            for (int j = 1; j <= width; j++) {
                bool[i][j] = (s[i].charAt(j-1)=='#');
            }
        }
        for (int i = 1; i <= height; i++) {
            for (int j = 1; j < width; j++) {
                if (bool[i][j]) {
                    if ( bool[i-1][j] || bool[i+1][j] || bool[i][j-1] || bool[i][j+1] ) {
                        continue;
                    }else{
                        ans = false;
                    }
                }
            }
        }

        if (ans) {
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }

        
        sc.close();
    }

    public static long gcd(long a, long b) {
        
        if (a < b) {
            long tmpp = a;
            a = b;
            b = tmpp;
        }
        if (b == 0) {
            return a;
        }else{
            return gcd(b, a%b);
        }
    }

    public static long lcm(long a, long b) {
        long gcd = gcd(a,b);
        return a/gcd*b;
    }

    public static void dfs(int placenow) {
        // if went all -> success! 
        // if not went all -> fail...
        
        /*
         dfs
         Go All Place that there is way to and not having been yet. 

         if island 1 is start point, dfs(1);
         if there is way to island 2 and island 3,
         - island 2 changes non-visited -> visited, and dfs(2).
         - island 3 changes non-visited -> visited, and dfs(3).
         

        */

        visit[placenow] = true;
        boolean success = true;
        for (int i = 0; i < n; i++) {
            if (visit[i] == false) { // not go all place
                success = false;
                break;
            }
        }
        if (success) {
            ans++;
            visit[placenow] = false;
            return;
        }

        for (int i = 0; i < m; i++) {
            if (w[i] == placenow && visit[ww[i]] == false ) {
                dfs(ww[i]);
            }else if(ww[i] == placenow && visit[w[i]] == false){
                dfs(w[i]);
            }else{
                continue;
            }
        }
        visit[placenow] = false;
        return;
    }

}



Measured memory_bytes: 23764
import math
import itertools

k = int(input())
l = range(1, k+1)

cnt = sum(l)
two = list(itertools.combinations(l, 2))
for li in two:
    gcd = 1 if 1 in li else math.gcd(li[0], li[1])
    cnt += gcd*6

if k > 2:
    three = list(itertools.combinations(l, 3))
    for li in three:
        gcd = 1 if 1 in li else math.gcd(math.gcd(li[0], li[1]), li[2])
        cnt += gcd*6

print(cnt)

Measured memory_bytes: 104216
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 2 * 1e6 + 10;
const int NP = 2750132;
typedef long long ll;

int main()
{
    // #ifndef ONLINE_JUDGE
    //     freopen("input.txt", "r", stdin);
    //     freopen("output.txt", "w", stdout);
    // #endif
    int n, k;
    scanf("%d%d", &n, &k);
    int mn = n/k;
    int mx = (n/k) + (n % k);
    printf("%d\n", mx - mn);
}

Measured memory_bytes: 256
#include<iostream>
    using namespace std ;
    int main(){
        int a,b,c;
        cin>>a>>b>>c;
        if(a==max(max(a,b),c)){
            cout<<10*a+b+c<<endl;
            return 0;
        }
        if(b==max(max(a,b),c)){
            cout<<10*b+a+c<<endl;
            return 0;
        }
        if(c==max(max(a,b),c)){
            cout<<10*c+b+a<<endl;
        return 0;
    }
        return 0 ;
    }

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

using namespace std;

#define mp make_pair
#define pb push_back
#define ll long long

#define maxN 333

int n, i, j, k;
int dist[maxN][maxN];
bool any;
ll ans;

int main()
{
   // freopen("test.in","r",stdin);

    cin >> n;
    for (i = 1; i <= n; i++)
        for (j = 1; j <= n; j++)
            cin >> dist[i][j];

    for (i = 1; i <= n; i++) {
        for (j = i + 1; j <= n; j++) {
            any = false;

            for (k = 1; k <= n; k++) {
                if (k == i || k == j) continue;
                if (dist[i][j] > dist[i][k] + dist[k][j]) {
                    cout << -1;
                    return 0;
                }

                if (dist[i][j] == dist[i][k] + dist[k][j])
                    any = true;
            }

            if (!any) ans += 1LL * dist[i][j];
        }
    }

    cout << ans;


    return 0;
}


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

int main()
{
  	int n;
    cin >> n;
    
    int *arr = new int[n];
    for(int i = 0; i < n; i++)
    {
       	cin >> arr[i];
    }
    
    int dp[n];
    for(int i = 0; i < n; i++)
    {
        dp[i] = INT_MAX;
    } 
    
    dp[0] = 0;
    dp[1] = abs(arr[1] - arr[0]);
  
    for(int i = 2; i < n; i++)
    {
        dp[i] = min(dp[i-2] + abs(arr[i-2] - arr[i]), dp[i-1] + abs(arr[i-1] - arr[i]));
    }
    
    cout<<dp[n-1]<<"\n";
    return 0;
}

Measured memory_bytes: 4340
# coding: utf-8

H = int(input().rstrip())
Ai = [int(i) for i in input().rstrip().split()]

for i, a in enumerate(Ai):
    print("node " + str(i+1) + ":",end=" ")
    print("key = " + str(Ai[i]),end=", ")
    if i != 0:
        print("parent key = " + str(Ai[(i+1)//2-1]),end=", ")
    if 2*(i+1) <= H:
        print("left key = " + str(Ai[2*(i+1)-1]),end=", ")
    if 2*(i+1) + 1 <= H:
        print("right key = " + str(Ai[2*(i+1)]),end=", ")
    print()
    


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

int main(){
    int n ;
    cin >> n;
    vector<int> d(n);
    for(int i = 0; i < n; i++){
        cin >> d[i];
    }
    sort(d.begin(), d.end());
    cout << (d[n/2] - d[n/2-1]) << endl;
    return 0;
}

Measured memory_bytes: 640
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);

		while (true) {
			int n = scan.nextInt();
			int m = scan.nextInt();
			int p = scan.nextInt();
			int[] x = new int[100];
			int sumMem = 0;
			int sumGold = 0;
			int givingSumGold = 0;
			int givenGold = 0;

			if (n == 0 && m == 0 && p == 0)
				break;

			for (int i = 0; i < n; i++) {
				x[i] = scan.nextInt();
				sumMem += x[i];
			}

			sumGold = sumMem * 100;
			givingSumGold = sumGold * (100 - p);

			if (x[m - 1] != 0) {
				givenGold =  givingSumGold / (x[m - 1]*100);
				System.out.println(givenGold);
			} else {
				System.out.println(0);
			}

		}

		scan.close();
	}
}

Measured memory_bytes: 27700
n = gets.to_i
b_array = gets.split.map(&:to_i)
b_array.unshift(10000000)
b_array.push(10000000)
a_array = Array.new(n, 0)

(n-1).times do |i|
  a_array[i] = [b_array[i], b_array[i+1]].min
end

puts a_array.inject(:+) + [b_array[-2], b_array[-1]].min

Measured memory_bytes: 3836
T = list(input())
N = len(T)
for i in range(N):
    if T[i] == '?':
        if 0 <= i-1 and T[i-1] == 'P':
            T[i] = 'D'

T = list(''.join(T).replace('??', 'PD'))

for i in range(N):
    if T[i] == '?':
        if i+1 < N and T[i+1] == 'D':
            T[i] = 'P'

t = ''.join(T).replace('?', 'D')
print(t)

Measured memory_bytes: 85868
def main():
    N = int(input())
    T, A = map(int, input().split())
    H = [int(a) for a in input().split()]
    dmin = 10**9
    ind = 0
    for i in range(N):
        t = T - H[i] * 0.006
        d = abs(t - A)
        if d < dmin:
            dmin = d
            ind = i
    print(ind+1)
main()

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

constexpr double EPS = 1e-8;
constexpr double INF = 1e10;

struct point {
	double x, y;
	point(double x = 0.0, double y = 0.0):x(x), y(y) {}
	point(const point &p):x(p.x), y(p.y) {}

	point operator+(const point &p) const {
		return point(x + p.x, y + p.y);
	}

	point operator-(const point &p) const {
		return point(x - p.x, y - p.y);
	}

	point operator*(double s) const {
		return point(x * s, y * s);
	}

	bool operator==(const point &p) const {
		return abs(x - p.x) < EPS && abs(y - p.y) < EPS;
	}
};

istream &operator>>(istream &is, point &p) {
	return is >> p.x >> p.y;
}

double norm(const point &p) {
	return p.x * p.x + p.y * p.y;
}

double dot(const point &a, const point &b) {
	return a.x * b.x + a.y * b.y;
}

vector<double> solve_quadratic_equation(double a, double b, double c) {
	if(abs(a) <= EPS) {
		if(abs(b) <= EPS) {
			if(abs(c <= EPS)) throw 0;
			return vector<double>();
		}
		return vector<double>(1, - c / b);
	}

	const double d = b * b - 4 * a * c;
	if(d < -EPS) return vector<double>();

	vector<double> res;
	res.push_back((-b - sqrt(d)) / (2 * a));
	res.push_back((-b + sqrt(d)) / (2 * a));
	return res;
}

double get_t(const point &c_p, double v, const point &t_p, const point &t_v) {
	if(c_p == t_p) return 0.0;

	const point d = t_p - c_p;

	const double a = norm(t_v) - v * v;
	const double b = 2 * dot(d, t_v);
	const double c = norm(d);
	const auto ans = solve_quadratic_equation(a, b, c);

	double res = INF;
	for(const auto &e : ans) {
		if(e >= 0.0) res = min(res, e);
	}
	return res == INF ? -1.0 : res;
}

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

	for(int n, m; cin >> n >> m && n;) {
		vector<point> d_p(n);
		vector<double> d_v(n);

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

		vector<int> cnt(n, 0);
		while(m--) {
			point f_p, f_v;
			cin >> f_p >> f_v;

			double min_time = INF;
			int win_d = -1;
			vector<double> catch_t(n);

			for(int i = 0; i < n; ++i) {
				catch_t[i] = get_t(d_p[i], d_v[i], f_p, f_v);
				if(catch_t[i] < -EPS) continue;
				if(min_time > catch_t[i] + EPS) {
					min_time = catch_t[i];
					win_d = i;
				}
			}

			assert(win_d != -1);

			++cnt[win_d];
			for(int i = 0; i < n; ++i) {
				if(catch_t[i] < -EPS) continue;
				d_p[i] = d_p[i] + ((f_p + f_v * catch_t[i]) - d_p[i]) * (min_time / catch_t[i]);
			}
		}

		for(int i = 0; i < n; ++i) {
			cout << cnt[i] << (i + 1 == n ? "\n" : " ");
		}
	}

	return EXIT_SUCCESS;
}

Measured memory_bytes: 1268
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int arr[]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  int k;
  cin>>k;
  cout<<arr[k-1]<<endl;
}

Measured memory_bytes: 256
#![allow(unused_imports, unused_macros, dead_code)]

macro_rules! min {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        it.next().map(|z| it.fold(z, |x, y| min!(x, y)))
    }};
    ($x:expr) => ($x);
    ($x:expr, $($ys:expr),*) => {{
        let t = min!($($ys),*);
        if $x < t { $x } else { t }
    }}
}
macro_rules! max {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        it.next().map(|z| it.fold(z, |x, y| max!(x, y)))
    }};
    ($x:expr) => ($x);
    ($x:expr, $($ys:expr),*) => {{
        let t = max!($($ys),*);
        if $x > t { $x } else { t }
    }}
}
macro_rules! ewriteln {
    ($($args:expr),*) => { let _ = writeln!(&mut std::io::stderr(), $($args),*); };
}
macro_rules! trace {
    ($x:expr) => { ewriteln!(">>> {} = {:?}", stringify!($x), $x) };
    ($($xs:expr),*) => { trace!(($($xs),*)) }
}
macro_rules! put {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        if let Some(x) = it.next() { print!("{}", x); }
        for x in it { print!(" {}", x); }
        println!("");
    }};
    ($x:expr) => { println!("{}", $x) };
    ($x:expr, $($xs:expr),*) => { print!("{} ", $x); put!($($xs),*) }
}

const M: i64 = 1_000_000_007;

fn main() {
    let mut sc = Scanner::new();
    let a: usize = sc.cin();
    let b: usize = sc.cin();
    let c: usize = sc.cin();
    let d: usize = sc.cin();
    let e: usize = sc.cin();
    let f: usize = sc.cin();

    let mut memo = vec![vec![0; 3003]; 3003];
    memo[0][0] = 1;

    for s in 0..3003 {
        for w_ in 0..30 {
            let w = w_ * 100;
            memo[s][w] = min!(memo[s][w], 1);
            if w + 100 * a < 3003 { memo[s][w + 100 * a] += memo[s][w]; }
            if w + 100 * b < 3003 { memo[s][w + 100 * b] += memo[s][w]; }
            if s + c < 3003 { memo[s + c][w] += memo[s][w]; }
            if s + d < 3003 { memo[s + d][w] += memo[s][w]; }
        }
    }

    let mut ans_w = 100 * a;
    let mut ans_s = 0;
    for s in 0..3003 {
        for w_ in 0..30 {
            let w = w_ * 100;
            if s + w > f { continue }
            if memo[s][w] == 0 { continue }
            if s * 100 > e * w { continue }
            if ans_s * (w + s) < s * (ans_w + ans_s) {
                ans_s = s;
                ans_w = w;
            }
        }
    }
    put!(ans_w + ans_s, ans_s);

}

use std::io::{self, Write};
use std::str::FromStr;
use std::collections::VecDeque;

struct Scanner { stdin: io::Stdin, buffer: VecDeque<String>, }
impl Scanner {
    fn new() -> Self { Scanner { stdin: io::stdin(), buffer: VecDeque::new() } }
    fn cin<T: FromStr>(&mut self) -> T {
        while self.buffer.len() == 0 {
            let mut line = String::new();
            let _ = self.stdin.read_line(&mut line);
            for w in line.split_whitespace() {
                self.buffer.push_back(String::from(w));
            }
        }
        self.buffer.pop_front().unwrap().parse::<T>().ok().unwrap()
    }
    fn chars(&mut self) -> Vec<char> { self.cin::<String>().chars().collect() }
    fn vec<T: FromStr>(&mut self, n: usize) -> Vec<T> { (0..n).map(|_| self.cin()).collect() }
}


Measured memory_bytes: 41212
N = int(input())
S = list(input())
Black_num,White_num = 0,0

for i in range(N):
 if(S[i] == '#'): Black_num += 1
 elif(S[i] == '.'): White_num += 1

tmp_Black_num,tmp_White_num = 0,0
#ans : 境界の左の黒の数 + 境界の右の白の数
ans1 = White_num #一番左を境界にした時の右の白の数
ans2 = Black_num #一番右を境界にした時の左の黒の数
ans = min(ans1,ans2)
for i in range(N):
 if(S[i] == '#'): tmp_Black_num += 1
 elif(S[i] == '.'): tmp_White_num += 1
 tmp = tmp_Black_num #境界より左の黒 
 tmp += White_num - tmp_White_num #境界より右の白
 ans = min(ans,tmp)
print(ans)

Measured memory_bytes: 4840
process.stdin.on('data', function(chunk) {
  var inputs = chunk.toString().trim().split(' ');
  var a = Number(inputs[0]);
  var b = Number(inputs[1]);
  var c = Number (inputs[2]);
  if (a<b && b<c ){
  	console.log('Yes');
  }else{
  	console.log('No');
  }
  // ????????????????????????
});
process.stdin.resume();
process.stdin.setEncoding('utf8');

Measured memory_bytes: 15504
program Project1;
             
{$APPTYPE CONSOLE}
         
uses
  SysUtils,math;
var
  fx,g,r,a,h,w,i,j,count,x,y,sw,m,n,b,c,soeji,sum,max,k,t,z:Integer;
  l:array of Integer;
  //l,l1,l2:int64;
  s,s123,s1,s2,s3:string;
  tf:Boolean;
  //nyu:TStringList;
  c1,c2,c3:char;
begin
  try
    { TODO -oUser -cConsole Main : ここにコードを記述してください }
    Read(a);
    Readln(b);

    if a*b mod 2 = 0 then
      Writeln('Even')
    else
      Writeln('Odd');

    Readln;
  except
    on E: Exception do
      Writeln(E.ClassName, ': ', E.Message);
  end;
end.

Measured memory_bytes: 128
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

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

    static class ABC092B {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int N = in.nextInt();
            int D = in.nextInt();
            int X = in.nextInt();
            int[] A = new int[N];
            int ans = X;
            for (int i = 0; i < N; i++) {
                A[i] = in.nextInt();
                int l = 0;
                for (int j = 0; j < D; j++) {
                    if (l == 0) {
                        ans++;
                        l = A[i] - 1;
                    } else {
                        l--;
                    }
                }
            }
            out.println(ans);
        }

    }
}



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

int main(){
  string S;
  cin>>S;
  bool ans=false;
  
  for(int i=0;i<3;i++){
  if(S.at(i)=='7'){
  ans=true;
  }
  }
  
  if(ans==true){
  cout<<"Yes"<<endl;
  }
  if(ans==false){
  cout<<"No"<<endl;
  }
}


Measured memory_bytes: 3620
#include <iostream>
#include<time.h>
#include<string>
#include<cstring>
#include <cstdio>
#include<utility>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<bitset>
#include<queue>
#include<stack>
#include<set>
#include <limits>
#include <climits>
#include <numeric>
#include<cassert>
#include<cctype>
#include<iterator>
#include<unordered_map>
#include <cassert>
#include <bit>
#include <cstdint>
using namespace std;
typedef long long ll;
typedef unsigned long long LL;
typedef vector<ll>VI;
typedef vector<bool>VB;
typedef pair<ll,ll>P;
typedef pair<double,double>P_D;
#define VV(T) vector<vector<T>>
#define PI 3.1415926535897932384626433832795
#define rep(i, n) for (ll i = 0; i < (ll)n; i++)
#define reprev(i, n) for (ll i = (ll)n - 1; i >= 0; i--)
#define bitrep(bit,A) for(int bit=A; ;bit=(bit-1)&A)
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) (ll)((a).size())
#define c_max(a, b) (((ll)a)>((ll)b)?(a):(b))
#define c_min(a,b) (((ll)a)<((ll)b)?(a):(b))
#define chmax(x,a) x=c_max(x,a)
#define chmin(x,a) x=c_min(x,a)
#define vmax(v) *max_element(ALL(v))
#define vmin(v) *min_element(ALL(v))
#define SORT(c) stable_sort(ALL(c))
#define $(x) {cout<<#x<<" = " <<(x)<<endl;}
#define fi first
#define se second
#define MAX 100100//5
#define MAX2 200100
#define MAX_6 1001001//6
#define MAX_7 10010010//7
#define SENTINEL 2000000000//9
#define NIL -1
const int MOD = 1000000007;
#define INF 1<<30
#define INFTY 1LL<<61
#define MAX_INT INT_MAX
#define Endl '\n'
#define greater greater<int>()
inline ll GCD(ll a,ll b){return b?GCD(b,a%b):a;}
inline ll lcm(ll a,ll b){return a*b/GCD(a,b);}
using Edge=pair<int,ll>;
using Graph=vector<vector<ll> >;//ll or Edge
using Edge=pair<int,ll>;
//const int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
// g++ -o a a.cpp -Wall -lm -std=c++17
int main(){
    int n;cin>>n;
    int a[MAX];
    rep(i,n)cin>>a[i],a[i]*=2;
    ll offset=0;
    rep(i,n)offset=a[i]-offset;
    ll x=offset/2;

    ll cur=x;
    rep(i,n){
        cout<<cur<<" ";
        cur=a[i]-cur;
    }
    cout<<endl;
}

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

int main()
{
	int n, m;
	vector<int> vec;
	bool flag = true;
	int count = 0;

	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> m;
		vec.push_back(m);
	}

	while (flag)
	{
		flag = false;
		for (int i = n - 1; i > 0; --i)
		{
			if (vec[i] < vec[i - 1]){
				swap(vec[i], vec[i - 1]);
				flag = true;
				count++;
			}
		}
	}

	for (int i = 0; i < n; i++)
	{
		cout << vec[i];
		if (i != n - 1){
			cout << " ";
		}
		else{
			cout << endl;
		}
	}

	cout << count << endl;

	return 0;
}

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

int main(void) {
  string str;
  int n;
  string temp;
  cin >> n;
  getchar();
  for(int i = 0; i < n; i++) {
    getline(cin, str);
    for(int j = 0; j < (int)str.length()-6; j++) {
      if(str[j] == 'H') {
	temp = str.substr(j, 7);
	if(temp == "Hoshino") {
	  str[j+6] = 'a';
	}
      }
    }
    cout << str << endl;
  }
  return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
long arr[100000];
int main(){
int n,c=0,p=0;
cin>>n;
for(int i=0;i<n;i++){
cin>>arr[i];
if(arr[i]<=arr[i-1])++p;
else{
c=max(c,p);
p=0;
}
}
cout<<max(p,c)<<'\n';
}


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

int main() {
  long a, b, k;

  cin >> a >> b >> k;

  for (int i = 0; i < k && i + a <= b; i++) {
    cout << i + a << endl;
  }

  for (int i = k - 1; i >= 0; i--) {
    if (b - i <= a + k - 1) continue;
    cout << b - i << endl;
  }

  return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.util.stream.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        sc.next();
        Map<String,Integer> strMap = new HashMap<>();
        int max = 0;
        while(sc.hasNext()){
            String str = sc.next();
            if(strMap.containsKey(str)){
                strMap.put(str,strMap.get(str)+1);
            }else{
                strMap.put(str,1);
            }
            max = Math.max(strMap.get(str),max);
        }
        List<String> strList = new ArrayList<>();
        for(String key : strMap.keySet()){
            if(strMap.get(key) == max)strList.add(key);
        }
        strList.stream().sorted().forEach(System.out::println);
    }
}


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

using namespace std;
const int N = 300005;

long long res = LLONG_MIN, v;
long long n, a[N], F[N], B[N];
multiset <long long> L, R;

void init(){
	scanf("%lld",&n);
	for(int i = 0; i < 3 * n; i++){
		scanf("%lld",&a[i]);
	}
	v = 0;
	for(int i = 0; i < 3 * n; i++){
		L.insert(a[i]);
		v += a[i];
		if(i >= n){
			v -= *L.begin();
			L.erase(L.begin());
		}
		F[i] = v;
	}
	v = 0;
	for(int i = 3 * n - 1; i >= 0; i--){
		R.insert(a[i]);
		v += a[i];
		if(i < 2 * n){
			v -= *R.rbegin();
			R.erase(R.find(*R.rbegin()));
		}
		B[i] = v;
	}
	for(int i = n - 1; i < 2 * n; i++){
		res = max(res, F[i] - B[i + 1]);
	}
	cout << res << endl;
}

int main(){
	
	init();
	return 0;
}

Measured memory_bytes: 16640
#include <stdio.h>
#include <string.h>
 
char color[20][20];
int dp[2][1 << 20];
 
int main() {
    int i, j, k;
    int m, n;
    int n_bit;
    int *src = dp[0];
    int *dst = dp[1];
    int all_case = 1;
    int sum;
 
    scanf("%d %d", &m, &n);
    n_bit = 1 << n;
 
    for (i=0; i<m; i++) {
        for (j=0; j<n; j++) {
            scanf(" %c", &color[i][j]);
            if (color[i][j] == '?') {
                all_case *= 3;
                all_case %= 100000;
            }
        }
    }
 
    src[0] = 1;
    for (i=0; i<m; i++) {
        int *tmp;
 
        for (j=0; j<n; j++) {
            int bits;
 
            if (i == 0) {
                bits = 1 << j;
            } else {
                bits = 1 << n;
            }
 
            for (k=0; k < bits; k++) {
                int JO_state;
                int is_J;
                int JO_exists;
                int r_shifted;
                char c = color[i][j];
 
                if (!src[k]) continue;
                if (j > 0 && (k & (1 << j))) continue;
 
                JO_state = k & (~1);
                is_J = k & 1;
                JO_exists = k & (n_bit >> 1);
                r_shifted = (JO_state << 1) & (n_bit-1);
 
                if (c == 'J' || c == '?') {
                    dst[r_shifted | (0 << 1) | 1] += src[k];
                    dst[r_shifted | (0 << 1) | 1] %= 100000;
                }
 
                if (c == 'O' || c == '?') {
                    if (is_J && j > 0) {
                        dst[r_shifted | (1 << 1) | 0] += src[k];
                        dst[r_shifted | (1 << 1) | 0] %= 100000;
                    } else {
                        dst[r_shifted | (0 << 1) | 0] += src[k];
                        dst[r_shifted | (0 << 1) | 0] %= 100000;
                    }
                }
 
                if (!JO_exists && (c == 'I' || c == '?')) {
                    dst[r_shifted | (0 << 1) | 0] += src[k];
                    dst[r_shifted | (0 << 1) | 0] %= 100000;
                }
 
            }
 
            tmp = src;
            src = dst;
            dst = tmp;
            memset(dst, 0, sizeof(int) * (1 << 20));
        }
    }
 
    sum = 0;
    for (i=0; i<n_bit; i++) {
        sum += src[i];
        sum %= 100000;
    }
 
    if (all_case < sum) {
        all_case += 100000;
    }
 
    printf("%d\n", (all_case - sum)%100000);
}

Measured memory_bytes: 9224
#include<bits/stdc++.h>                                                                          
using namespace std;
int main()
{
  int A,B,C,K;
  cin >> A >> B >> C >> K;
  int max=0;
  if(A>max)
    max=A;
  if(max<B)
    max=B;
  if(max<C)
    max=C;
  int ans=max;
  for(int i=0; i<K; i++){
    ans*=2;
  }
  if(max==A){
    cout << B+C+ans << endl;
  }
  else if(max==B){
    cout << A+C+ans << endl;
  }
  else if(max==C){
    cout << A+B+ans << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <queue>

using namespace std;
 
typedef long long int ll;
 
ll MOD = 1000000007;
ll INF = 100000000000;
 
int main(){
 ll N,M;
 cin >>  N >> M;
 priority_queue<ll> Q;
 for(int i = 0;i < N;i++){
   ll a;cin >> a;
   Q.push(a);
 }
 for(int i = 0;i < M;i++){
   ll x = Q.top();
   Q.pop();
   Q.push(x/2);
  //  cout << Q.size() << ' ' << x/2 << endl;
 }

//  cout<<"-----------------"<<endl;
 ll ans = 0;
 for(int i = 0;i < N;i++){
  //  cout<<Q.top()<<endl;
   ans += Q.top();
   Q.pop();
 }
 cout << ans << endl;
}

Measured memory_bytes: 1400
/*
B
https://atcoder.jp/contests/abc137/tasks/abc137_b
*/
#include<bits/stdc++.h>
#include<iostream>
using namespace std;
int main() {
	int k, x;

	cin >> k >> x;

	for (int i = x - k + 1; i <= x + k - 1 ; i++) {
		cout << i << endl;
	}


	return 0;
}


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

const int MAX = 7368791 + 1;
int main() {
    int m, n;
    while (cin >> m >> n, m | n) {
        vector<bool> used(MAX);
        int idx = m;
        for (int i = 0; i < n; i++) {
            while (used[idx]) idx++;
            for (int k = 1; k * idx < used.size(); k++) {
                used[k * idx] = true;
            }
        }
        while (used[idx]) idx++;
        cout << idx << endl;
    }
    return 0;
}



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

struct Sweets{
    int no, p, q, r, c;
};

int main(){
    int n;
    while(cin >> n, n){
        struct Sweets sts[n];
        for(int i=0; i<n; ++i){
            int j, p, q, r;
            cin >> j >> p >> q >> r;
            sts[i].no = j;
            sts[i].p = p;
            sts[i].q = q;
            sts[i].r = r;
            sts[i].c = 4*p + 9*q + 4*r;
        }
        int p, q, r, c;
        cin >> p >> q >> r >> c;
        bool flug = false;
        for(int i=0; i<n; ++i){
            if(sts[i].p <= p && sts[i].q <= q && sts[i].r <= r && sts[i].c <= c){
                flug = true;
                cout << sts[i].no << endl;
            }
        }
        if (!flug) cout << "NA" << endl;
    }
    return 0;
}

Measured memory_bytes: 884
#define _USE_MATH_DEFINES

#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <bitset>
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef tuple<ll, ll, ll> tl3;



const int BIG_NUM = 1e9;
const ll INF = 1000000000000000000;
//const ll MOD = 1e9 + 7;
const ll MOD = 998244353;


int main() {
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	vector<vector<ll>> dp(c + 1, vector<ll>(d + 1));
	dp[a][b] = 1;

	for (int i = a; i <= c; i++) {
		for (int j = b; j <= d; j++) {
			if (i == a && j == b) {
				continue;
			}

			dp[i][j] = (dp[i][j] + dp[i - 1][j] * j) % MOD;
			dp[i][j] = (dp[i][j] + dp[i][j - 1] * i) % MOD;
			dp[i][j] = (dp[i][j] - dp[i - 1][j - 1] * (i - 1) * (j - 1)) % MOD;
			dp[i][j] = (dp[i][j] + MOD) % MOD;
		}
	}
	cout << dp[c][d] << endl;
}

Measured memory_bytes: 73572
import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int result;
        while(true){
            int H = sc.nextInt();
            int W = sc.nextInt();
            if(H==0 && W==0)break;
            for(int i=0;i<H;i++){
                for(int j=0;j<W;j++){
                    result=i+j;
                    if(result % 2 == 0){
                        System.out.print("#");
                    }
                    else System.out.print(".");
                }
              System.out.println();
            }
            System.out.println();
        }
    }
}


Measured memory_bytes: 32844
#include<stdio.h>
#define MAX 1000000000000000000
int main(){
  int n,i,flag=0;
  unsigned long long a[100001]={0},an;
  
  scanf("%d",&n);

  for(i=0;i<n;i++){
    scanf("%llu",&a[i]);
  }
  an=a[0];
  for(i=1;i<n;i++){
    if(a[i]==0){
      flag=1;
    }
    an=an*a[i];
  }
  if(an>MAX){
    printf("-1");
  }else if(flag==0 && an==0){
    printf("-1");
  }else{
    printf("%llu",an);
  }
    return 0;
}


Measured memory_bytes: 2516
#include<bits/stdc++.h>
using namespace std;
int main () {
    array<int, 12> a{1, 3, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1};
    int x, y;
    cin >> x >> y;
    a[x - 1] == a[y - 1] ? cout << "Yes" : cout << "No";

}

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

int getNumOfDigit(int n)
{
	int ret = 1;
	
	while (n / 10 > 0) {
		ret++;
		n = n / 10;
	}
	return ret;
}

int main(void)
{
	int a, b;
	int sum;
	char line[128];
	char *p;
	
	while (fgets(line, sizeof(line), stdin) != NULL) {
		p = strtok(line, " ");
		if (p != NULL) {
			a = atoi(p);
		}
		p = strtok(NULL, " ");
		if (p != NULL) {
			b = atoi(p);
		}
		
		printf("%d\n", getNumOfDigit(a + b));
	}
	return 0;
}

Measured memory_bytes: 0
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():
    mod=10**9+7
    N,K=map(int,input().split())
    ans=0
    for i in range(K,N+2):
        ans+=(2*N-i+1)*i//2-(i-1)*i//2+1
    print(ans%mod)

resolve()

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

#define pb push_back
#define ppp pop_back
#define pii pair<int, int>
#define fi first
#define se second

typedef complex<int> point;
#define x real
#define y imag

const ll p = 998244353;
const int N = 205;

set<vector<int>> lines;
point a[N];

int cross(point a, point b) {
	return (conj(a) * b).y();
}

ll add(ll a, ll b) {
	a += b;
	if (a >= p) a -= p;
	if (a < 0) a += p;
	return a;
}

ll binpow(ll a, ll b) {
	ll res = 1;
	while (b) {
		if (b & 1) res = res * a % p;
		a = a * a % p;
		b >>= 1;
	}
	return res;
}

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
#ifdef LOCAL
	freopen("input.txt", "r", stdin);
#endif
	int n;
	cin >> n;
	for (int i=1; i<=n; i++) {
		int x, y;
		cin >> x >> y;
		a[i] = {x, y};
	}
	ll ans = add(binpow(2, n), add(-n, -1));
	for (int i=1; i<=n; i++) {
		for (int j=i+1; j<=n; j++) {
			vector<int> line;
			for (int k=1; k<=n; k++) {
				if (cross(a[i] - a[k], a[j] - a[k]) == 0) line.pb(k);
			}
			if (lines.count(line)) continue;
			lines.insert(line);
			int k = line.size();
			ans = add(ans, -add(binpow(2, k), add(-k, -1)));
		}
	}
	cout << ans << "\n";
    return 0;
}


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

#define ll long long
#define mtv(kit) cout<<#kit<<" - "<<kit<<"\n";
#define ff first
#define ss second
#define pb push_back
#define rep(i,a,b) for(i=a;i<b;i++)
#define pii pair<ll , ll>
#define all(x) x.begin(),x.end()
#define nl "\n"
#define ump unordered_map

void doit(){	
	ll n, i, ans = 0, lb, hb, mid, j;
	cin >> n;
	vector<ll>v(n);
	for(i = 0; i < n; i++)cin >> v[i];
	sort(all(v));
	rep(i,0,n-2){
		rep(j,i + 1,n - 1){
			ll cur = v[i] + v[j], in;
			if(v[j + 1] >= cur)
				continue;
			if(v[n - 1] < cur){
				ans += n - j - 1;
				continue;
			}
			lb = j + 1, hb = n - 1;
			while(lb <= hb){
				mid = (lb + hb) / 2;
				if(v[mid] < cur){
					in = mid;
					lb = mid + 1;
				}
				else
					hb = mid - 1;
			}
			ans += in - j;
		}
	}
	cout << ans << nl;
}

int main() {
#ifndef ONLINE_JUDGE
//    freopen("input1.txt","r",stdin);
//    freopen("output1.txt","w",stdout);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t = 1;
	// cin >> t;
    for(ll i = 1; i <= t; i++){
        doit();
    }
}


Measured memory_bytes: 3640
def cmb(n, r, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % p

p = 10 ** 9 + 7
N = 10 ** 6  # N は必要分だけ用意する
fact = [1, 1]
factinv = [1, 1]
inv = [0, 1]
 
for i in range(2, N + 1):
    fact.append((fact[-1] * i) % p)
    inv.append((-inv[p % i] * (p // i)) % p)
    factinv.append((factinv[-1] * inv[-1]) % p)

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

ans = 0

if k >= n-1:
    print(cmb(2*n-1,n,p))
else:

    for i in range(k+1):
        ###i:0人の部屋の数
        x = cmb(n,i,p)###0人の部屋の選び方
        y = cmb(n-1,i,p)
            ###0人でないn-i個の部屋にn人が入る時の人数の組み合わせ
            ###各部屋に1人以上入るので, それを上回る分についてのみ考える
            ###すなわち, n-(n-i)=i人についての組み合わせを考える
            ###人間i人, 仕切りn-i-1個
        ans += (x*y)%p
        ans %= p

    print(ans)




Measured memory_bytes: 127560
# from pprint import pprint
# import math
# import collections

# n = int(input())
a, b = map(int, input().split(' '))


# a = list(map(int, input().split(' ')))

# 素因数分解
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n ** 0.55 // 1)) + 1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr.append([i, cnt])

    if temp != 1:
        arr.append([temp, 1])

    if arr == []:
        arr.append([n, 1])

    return arr


fact_a = set([f[0] for f in factorization(a)])
fact_b = set([f[0] for f in factorization(b)])

ans = fact_a & fact_b
ans.add(1)

# print(fact_a, fact_b)
print(len(ans))


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

I n;vector<vector<I>> vw,dp;
I c1,c2;

void dfs(I i){
    I j=i/2;
    if(i>1){
        for(I k=c2;k+1;k--){
            if(dp[j-1][k]or!k){
                I ne=k+vw[i-1][1];
                if(ne<=c2)dp[i-1][ne]=max(dp[j-1][k]+vw[i-1][0],dp[i-1][ne]);
            }
            dp[i-1][k]=dp[j-1][k];
        }
    }
    if(i*2<=min(c1,n))dfs(i*2);
    if(i*2+1<=min(c1,n))dfs(i*2+1);
}

signed main(){
    cin>>n;
    vw.resize(n);
    REP(i,n){I x,y;cin>>x>>y;vw[i]={x,y};}
    c1=1<<10;c2=100000;
    dp.resize(c1);REP(i,c1)dp[i].resize(c2+1);
    dp[0][vw[0][1]]=vw[0][0];
    dfs(1);
    REP(i,c1)REP(j,c2)dp[i][j+1]=max(dp[i][j],dp[i][j+1]);
    I q;cin>>q;
    REP(i,q){
        I v,l;cin>>v>>l;
        vector<I> cand;
        while(v>c1){
            cand.push_back(v);
            v=v/2;
        }
        I r=cand.size();
        I ans=0;
        REP(j,1<<r){
            I v_sub=0;I w_sub=0;
            REP(k,r){
                if(j>>k&1){
                    v_sub+=vw[cand[k]-1][0];
                    w_sub+=vw[cand[k]-1][1];
                }
            }
            if(w_sub<=l)ans=max(ans,dp[v-1][l-w_sub]+v_sub);
        }
        cout<<ans<<endl;
    }
}


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

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

int main(void)
{
    int s,w; cin>>s>>w;
    if(w>=s)cout<<"unsafe"<<endl;
    else cout<<"safe"<<endl;
    return 0;
}

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

int main(){
	int n,m,ch,comp,max=0;
	int lastB=0,lastR=0;
	string temp;

	cin >>n;
	string arrayB[n];
	int countB[n];
	for(int i=0;i<n;i++){
		cin >>temp;
		for(ch=0;ch<lastB;ch++){
			if(temp==arrayB[ch]){
				countB[ch]++;
				break;
			}
		}
		if(ch==lastB){
			arrayB[lastB]=temp;
			countB[lastB]=1;
			lastB++;
		}
	}
	cin >>m;
	string arrayR[m];
	int countR[m];
	for(int i=0;i<m;i++){
		cin >>temp;
		for(ch=0;ch<lastR;ch++){
			if(temp==arrayR[ch]){
				countR[ch]++;
				break;
			}
		}
		if(ch==lastR){
			arrayR[lastR]=temp;
			countR[lastR]=1;
			lastR++;
		}
	}
	for(int i=0;i<lastB;i++){
		comp=0;
		for(int j=0;j<lastR;j++){
			if(arrayB[i]==arrayR[j])comp=countR[j];
		}
		comp=countB[i]-comp;
		if(max<comp)max=comp;
	}
	cout<<max<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int min(int i, int j){return (i<=j)?i:j;}
int main(void){
  for(;;){
    int n,m;
    cin >> n >> m;
    if(n==0 && m==0){return 0;}
    int a[n]; int b[n];
    for(int i=0;i<n;i++){cin >> a[i];}
    for(int i=0;i<n;i++){cin >> b[i];}
    
    int c[n];
    for(int i=0;i<n;i++){
      c[i]=(b[i]-a[i]>=0)?(b[i]-a[i]):(b[i]-a[i]+m);
    }
    
    int dp[2][n];
    for(int j=0;j<n;j++){
      dp[0][j]=c[0]+j*m;
    }
    
    for(int i=0;i<n-1;i++){
      for(int j=0;j<n;j++){
	if(c[i+1]>c[i]){
	  dp[1][j]=(j+1<n)?(min(dp[0][j]+c[i+1]-c[i],dp[0][j+1])):(dp[0][j]+c[i+1]-c[i]);
	}else{
	  dp[1][j]=(j-1>=0)?(min(dp[0][j-1]+m+c[i+1]-c[i],dp[0][j])):(dp[0][j]);
	}
      }

      for(int j=0;j<n;j++){
	dp[0][j]=dp[1][j];
      }
    }

    int ans=n*m;
    for(int j=0;j<n;j++){
      if(ans>dp[0][j]){
	ans=dp[0][j];
      }
    }

    cout << ans << endl;
  }
}


Measured memory_bytes: 3108
x1, y1, x2, y2 = map(int, input().split())
res = ""

res += "U" * (y2-y1)
res += "R" * (x2-x1)
res += "D" * (y2-y1)
res += "L" * (x2-x1)
res += "L" + "U" * (y2-y1 + 1)
res += "R" * (x2-x1 + 1) + "D"

res += "R" + "D" * (y2-y1 + 1)
res += "L" * (x2-x1 + 1) + "U"


print(res)


Measured memory_bytes: 38256
#include <iostream>
#include <string>
#include <regex>
 
int main() {
    std::string str;
    std::cin>>str;
    std::regex re(("(hi)+"));
    std::smatch m;
    bool flg =false;
 
    while (std::regex_match(str, m, re) ){
        flg=true;
      	break;
    }
  	
    if(flg){
      std::cout << "Yes"<<std::endl;
    }else{
      std::cout << "No"<<std::endl;
    }
  
 
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=5e18;

int main() {
  ll n;
  cin >> n;
  vec a(n+1);
  for(ll i=1;i<=n;i++) cin >> a[i];
  set<ll> cnt;
  ll id=1;
  cnt.insert(1);
  ll ans=0;
  while(1) {
    if(cnt.count(a[id])) {
      cout << -1 << endl;
      return 0;
    }
    ans++;
    if(a[id]==2) {
      cout << ans << endl;
      return 0;
    }
    cnt.insert(a[id]);
    id=a[id];
  }
}

Measured memory_bytes: 5760
#include<bits/stdc++.h>
#define F(a,b,c,d) for (register int a=b;a<=c;a+=d)
#define FD(a,b,c,d) for (register int a=b;a>=c;a-=d)
using namespace std;
int main(){
	int n,m;
	cin>>n>>m;
	cout<<(m-n+1)*(m-n)/2-m<<endl;
	return 0;
}



Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))
 
using namespace std;
 
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
 
const ll INF=1e9+7;

int main(){
    ll a,b;
    cin >> a >> b;
    if(a!=0) a--;
    ll p=0;
    ll q=0;
    if(a%2==0){
        p=(((a+1)/2)%2)+a;
    }
    else{
        p=((a+1)/2)%2;
    }
    if(b%2==0){
        q=(((b+1)/2)%2)+b;
    }
    else{
        q=((b+1)/2)%2;
    }
    ll ans=p^q;
    cout << ans << endl;
    
    return 0;
} 

Measured memory_bytes: 256
import java.io.*;

public class Main{
    public static void main(String[] args){
        try{
            BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
            int i = 0;
            String line;
            line = reader.readLine();
            String[] charactor = line.split("",line.length());
            String[] output;
            String tmp;
            output = new String[line.length()];
            for(i = 0; i < line.length(); i++){
                tmp = charactor[i];
                tmp = tmp.toLowerCase();
                if(charactor[i].equals(tmp) == true){
                    output[i] = charactor[i].toUpperCase();
                }else if(charactor[i].equals(tmp) == false){
                    output[i] = charactor[i].toLowerCase();
                }else{
                    output[i] = charactor[i];
                }
            }
            for(i = 0; i < line.length(); i++){
                System.out.print(output[i]);
            }
            System.out.print("\n");

        } catch (NumberFormatException e) {
            System.out.println(e);
        } catch (IOException e) {
            System.out.println(e);
        }
    }
}


Measured memory_bytes: 25704
str = input()
n,k = [int(x) for x in str.split()]
str = input()
list = [int(x) for x in str.split()]
ans = 1000000000
for i in range(0,n - k + 1):
	a = list[i]
	b = list[i + k - 1]
	if (a < 0) & (b > 0): #优先级需要加括号
	    ans = min(ans,min(b - a * 2,b * 2 - a))
	else:
		ans = min(ans,max(abs(a),abs(b)))
print(ans)

Measured memory_bytes: 15064
#include <iostream>
#include <functional>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <queue>
#include <map>
#include <iomanip>
#include <complex>
#include <random>
#include <bitset>
#include <list>
// #include <prettyprint.hpp>
using namespace std;
#define repi(i,n) for(int i=0;i<n;++i)
#define rep(i,n) for(ll i=0;i<n;++i)
#define repinvi(i,n) for(int i=n-1;i>=0;--i)
#define sll(n) scanf("%lld", &n);
#define sii(n) scanf("%d", &n);
#define slf(n) scanf("%lf", &n);
#define pll pair<ll,ll>
#define pii pair<int,int>
#define psi pair<si,si>
typedef long long ll;
typedef double lf;
typedef short int si;

vector<vector<ll>> field(3, vector<ll>(3, 0));
vector<ll> coord1 = {0, 4, 8};
vector<ll> coord2 = {2, 4, 6};
void Main(){
    ll A, B, C, K;
    cin >> A >> B >> C;
    cin >> K;
    ll num = 0;
    while(B<=A){
        B *= 2;
        ++num;
    }

    while(C <= B){
        C *= 2;
        ++num;
    }
    if(num<=K){
        cout << "Yes" <<endl;
    }else{
        cout << "No" << endl;

    }

}

int main(){
    Main();
}

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

#define ll long long int
#define watch(x) cout << (#x) << " is " << (x) << endl
#define f(i,x,n)  for(int i=x;i<n;i++)
#define FASTIO cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(false);
#define eb(x) emplace_back(x)
#define mp(a,b) make_pair(a,b)
#define sz(a) int((a).size())
#define mod 1000000007
#define tr(c,i) for(typeof((c)).begin() i = (c).begin(); i != (c).end(); i++)
#define inf LLONG_MAX
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }


void seethis(vector<ll>vect)
{
    for(ll x:vect)
        cout<<x<<" ";
    cout<<"\n";
}

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}
//LCM
int lcm(int a, int b) {  return a * (b / __gcd(a, b)); }

//For sort by second
bool cmp(const pair<int,int> &a)
{ return a.first<a.second; }

//Tree
/* const int MAXN = 1e5 + 5;
vector<ll> adj[MAXN];*/

//ModPower
ll modpower(ll a,ll b,ll c)
{
	ll res=1;
	while(b)
	{
		if(b&1LL)
			res=(res*a)%c;
		a=(a*a)%c;
		b>>=1;
	}
	return res;
}

int main()
{
	FASTIO;
	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif
	ll x,n;
	 cin>>x>>n;

	 vector<ll>vect;
	 set<ll>se;
	 for(int i=0;i<n;i++)
	 {
	 	ll p;
	 	 cin>>p;
	 	 se.insert(p);
	 	 vect.push_back(abs(x-p));
	 }
	 sort(vect.begin(),vect.end());
	 ll ans=mod;
	 for(int i=0;i<n;i++)
	 {
	 	if(se.find(x-i)==se.end())
	 	{
	 		ans=x-i;
	 		break;
	 	}
	 	else if(se.find(x+i)==se.end())
	 	{
	 		ans=x+i;
	 		break;
	 	}

	 }
	 if(ans==mod)
	 {
	 	ans=x-n;
	 	cout<<ans<<"\n";
	 }
	 else
	 	cout<<ans<<"\n";




	 	



	
	return 0;
}

Measured memory_bytes: 3616
#include <iostream>
#include <cstring>
#include <stack>
using namespace std;

stack<char> stacky;

int solve(string X, int N, int ans) {
      for(int i=0; i<N; i++) {
            if(X[i] == 'S') stacky.push('S');
            else {      // encounter 't'
                  if(!stacky.empty()) stacky.pop(); 
                  else ans++;
            }
      }
      ans += stacky.size();
      return ans;
}

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

      string X;
      cin >> X;
      int N = X.size();
      
      cout << solve(X, N, 0) << endl;
}

Measured memory_bytes: 3400
from bisect import *
from collections import *
from fractions import gcd
from math import factorial
from itertools import *
from heapq import *
import copy




N=int(input())
A=list(map(int,input().split()))
A=[0]+A

S=[0 for i in range(N+1)]
for i in range(1,N+1):
    S[i]=A[i]+S[i-1]


def main(i,t,last):

    value=(S[last]-S[i])-(S[i]-S[t])
    if value>0:
        return(value)
    else:
        return(-value)

lst=[0,0,0,0]
ide_max=2*(10**9)

returndata=ide_max
for n in range(2,N-1):
    for t in [0,n]:
        passflag=0
        st=1+t
        if t==0:
            end=n-1
            last=n
        else:
            end=N
            last=N

        for z in [st,end]:
            if not main(z,t,last):
                Re=z
                passflag=1
        if not passflag:
            while 1:
                #print(st,end,"mae")
                if st+3<end:
                    idx1=(st*2+end)//3
                    idx2=(st+end*2)//3
                    idx1v=main(idx1,t,last)
                    idx2v=main(idx2,t,last)
                    if idx1v>idx2v:
                        st=idx1
                    else:
                        end=idx2
                else :
                    value=ide_max
                    for i in range(st,end+1):
                        D=main(i,t,last)
                        if value>D:
                            value=D
                            Re=i
                    break
        if t==0:
            lst[0]=S[Re]-S[t]
            lst[1]=S[n]-S[Re]
        else:
            lst[2]=S[Re]-S[t]
            lst[3]=S[N]-S[Re]
    returndata=min(max(lst)-min(lst),returndata)
print(returndata)


Measured memory_bytes: 118388