akhauriyash/Code-Regression huggingface dataset:
import sys
import math

from collections import defaultdict
from collections import deque
def load(vtype=int):
    return vtype(input().strip())
def load_list(seplator=" ", vtype=int):
    return [vtype(v) for v in input().strip().split(seplator)]
def exit():
    import sys
    sys.exit(0)
def perm_sub(li, used):
    if len(li) == len(used):
        return [deque()]
    k = []
    for i in range(len(li)):
        if i in used:
            continue
        used.add(i)
        sub_list = perm_sub(li, used)
        for sub in sub_list:
            sub.appendleft(li[i])
        k.extend(sub_list)
        used.discard(i)
    return k
def perm_li(li):
    return perm_sub(li, set())
def perm_n(n):
    return perm_sub(list(range(n)), set())
def join_i(li, sep=""):
    return sep.join([str(e) for e in li])
def li2n(li):
    n, base = 0, 1
    for i in range(len(li)-1, -1, -1):
        n += li[i] * base
        base *= 10
    return n
def sli2ili(li):
    return [int(s) for s in li] 
def prime_list(n):
    li = [i for i in range(2, n+1)]
    for i in range(len(li)):
        if li[i] >= int(math.sqrt(n)):
            break
        if li[i] == -1:
            continue
        for j in range(i+1, len(li)):
            if li[j] % li[i] == 0:
                li[j] = -1
    return [n for n in li if n != -1]
def gcd(a, b):
    a, b = max(a, b), min(a, b)
    while True:
        r = a % b
        if r == 0: return b
        a, b = b, r
def lcm(a, b):
    return int(a * b / gcd(a,b))
def all_subset(li):
    s = []
    n = len(li)
    for bit in range(0, (1<<(n+1))):
        ss = set()
        for i in range(0, n):
            if (bit & (1 << i)):
                ss.add(li[i])
        s.append(ss)
    return s

n = load()
H = load_list()

for i in range(n-2, -1, -1):
    if H[i] - H[i+1] > 1:
        print('No')
        exit()
    if H[i] - H[i+1] == 1:
        H[i] -= 1

print('Yes')

Measured memory_bytes: 15016
import sys
import math
stdin = sys.stdin
mod = 10**9 + 7

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
sa = lambda h: [list(map(int, stdin.readline().split())) for i in range(h)]


a, b = na()

if a > 2 * b:
    print(a - 2*b)
else:
    print(0)

Measured memory_bytes: 3060
using System;
using System.Text;

public class Program
{
    public static void Main(string[] args)
    {
        // 文字列の入力
        string u = Console.ReadLine();

        StringBuilder x = new StringBuilder();
        for (int i = 0; i < u.Length; i++) x.Append("x");
            Console.WriteLine(x.ToString());
    }
}


Measured memory_bytes: 11092
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()) {
            String s = sc.next();
            int ans = 0;
            for (char ch : s.toCharArray()) {
                ans += ch == '+' ? 1 : -1;
            }
            System.out.println(ans);
        }
    }
}


Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define sz(x) (int)x.size()
typedef pair<int,int>pii;
const int mxN=2e5,M=1e9+7;
    
int a,b,c,d;
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin>>a>>b>>c>>d;
    int k=0;
    while(a>0 && c>0){
        if(k==0){
            c-=b;
            k=1;
        }   
        else{
            k=0;
            a-=d;
        }
    }
    if(a<=0)cout<<"No";
    else cout<<"Yes";
}

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

using namespace std;

#define intt long long
#define FAST ios_base::sync_with_stdio(0); cin.tie(0);

const int N = 10000005;

int n;

int divs[N];

int main() {

	FAST;

	cin >> n;
	for (int i = 1; i <= n; i ++) {
		for (int j = i; j <= n; j += i) {
			divs[j] ++;
		}
	}
	intt ans = 0;
	for (int i = 1; i <= n; i ++) {
		ans += 1LL * i * divs[i];
	}
	cout << ans << '\n';
	return 0;
}

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

const int L = 128;

int n, cnt[65];

inline char get(int x)
{
	if(x >= 0 && x < 26) return x + 'A';
	if(x >= 26 && x < 52) return x - 26 + 'a';
	return x - 52 + '0';
}

inline int query(vector<int> t)
{
	string s = "";
	for(int i = 0; i < t.size(); i++) s += get(t[i]);
	printf("? %s\n", s.c_str());
	fflush(stdout);
	int x; 
	scanf("%d", &x);
	return x;
}

inline vector<int> solve(int l, int r)
{
	if(l == r)
	{
		vector<int> t;
		for(int i = 0; i < cnt[l]; i++) t.push_back(l);
		return t;
	}
	int mid = (l + r) >> 1;
	vector<int> tl = solve(l, mid), tr = solve(mid + 1, r);
	vector<int> res;
	int x = 0, y = 0;
	while(x < tl.size() && y < tr.size())
	{
		vector<int> t(res);
		t.push_back(tl[x]);
		for(int i = y; i < tr.size(); i++) t.push_back(tr[i]);
		if(query(t) != n - t.size()) res.push_back(tr[y ++]);
		else res.push_back(tl[x ++]);
	}
	while(x < tl.size()) res.push_back(tl[x ++]);
	while(y < tr.size()) res.push_back(tr[y ++]);
	return res;
}

int main()
{
	for(int i = 0; i < 62; i++)
	{
		vector<int> t;
		for(int j = 1; j <= L; j++) t.push_back(i);
		int x = query(t);
		cnt[i] = L - x;
		n += cnt[i];
	}
	
	vector<int> ans = solve(0, 61);

	string s = "";
	for(int i = 0; i < ans.size(); i++) s += get(ans[i]);
	printf("! %s\n", s.c_str());
	fflush(stdout);
	return 0;
}


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

int a, b, c, d;

int main(){
  cin >> a >> b >> c >> d;
  cout << min(a, b) + min(c, d) << endl;
  return 0;
}


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

int main(){
   int a, b, i, j;
   char map[102][102];
   
   while(1){
      cin >> a >> b;
      if(a+b==0) break;
      
      for(i=0; i< a; i++){
         for(j=0; j< b; j++){
            cin >> map[i][j];
         }
      }
      i=0,j=0;
      while(1){
         if(map[i][j]=='.'){
            cout << j << " " << i << endl;
            break;
         }else if(map[i][j]=='#'){
            cout << "LOOP" << endl;
            break;
         }else if(map[i][j]=='>'){
            map[i][j]='#';
            j++;
         }else if(map[i][j]=='<'){
            map[i][j]='#';
            j--;
         }else if(map[i][j]=='^'){
            map[i][j]='#';
            i--;
         }else if(map[i][j]=='v'){
            map[i][j]='#';
            i++;
         }
      }
   }
   return 0;
}

Measured memory_bytes: 1168
import java.util.Scanner;

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

        int a = scanner.nextInt(), b = scanner.nextInt(), c = scanner.nextInt();

        if (c <= a + b) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
        scanner.close();
    }
}

Measured memory_bytes: 21844
#include <iostream>
#include <cmath>
using namespace std;
int main( void )
{
  int n,t;
  double xa,ya,ra,xb,yb,rb,d;
  cin >> n;
  for( int i=0; i<n; i++ ){
    cin>>xa>>ya>>ra>>xb>>yb>>rb;
    d = sqrt( (xb-xa)*(xb-xa) + (yb-ya)*(yb-ya) );
    if( ra + rb < d ) t=0;
    else if( d + rb < ra ) t=2;
    else if( d + ra < rb ) t=-2;
    else t=1;
    cout << t << endl;
  }
  return 0;
}

Measured memory_bytes: 0
import java.util.Scanner;
import java.lang.StringBuilder;
import java.math.BigInteger;

public class Main{
  
  
  
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    
    int n;
    n = sc.nextInt();
    
    int[] nums = new int[n];
    boolean another_max = false;
    int max = 0;
    int max2 = 0;
    boolean second = true;
    for (int i=0; i!=n; i+=1){
      int num = sc.nextInt();
      nums[i] = num;
      if (i == 0) {
        max = num;
      }
      else if (i == 1){
        if (num < max){
          max2 = num;
        }
        else{
          max2 = max;
          max = num;
        }
      }
      else{
      if (num == max) another_max = true;
      
      if (num != max){
        if (num > max){
          max2 = max;
          max = num;
          another_max = false;
        }
        else if (num < max && num > max2){
          max2 = num;
        }
      }
      }
    }
    
    if (max2 == 0) max2 = max;
//    System.out.print(max + " " + max2 + " "+ another_max);
    StringBuilder sb = new StringBuilder();
    for (int i=0; i!=n; i+=1){
      if (nums[i] == max && !another_max) sb.append(max2 + "\n");
      else sb.append(max + "\n");
    }
    
    
    
    
    
    System.out.print(sb.toString());
    
    
  }
}

Measured memory_bytes: 89164
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n,m,q,a,lo,lo2,ans;
vector<ll>v,vv;
int main(void){
    cin>>n>>m>>q;
    v.push_back(-(1LL<<50));
    for(int i=0;i<n;i++){
        cin>>a;
        v.push_back(a);
    }
    v.push_back(1LL<<50);
    vv.push_back(-(1LL<<50));
    for(int i=0;i<m;i++){
        cin>>a;
        vv.push_back(a);
    }
    vv.push_back(1LL<<50);
    for(int i=0;i<q;i++){
        ans=1LL<<50;
        cin>>a;
        lo=lower_bound(v.begin(),v.end(),a)-v.begin();
        lo2=lower_bound(vv.begin(),vv.end(),a)-vv.begin();
        for(ll x:{v[lo-1],v[lo]}){
            for(ll y:{vv[lo2-1],vv[lo2]}){
                ans=min(ans,min(abs(a-x)+abs(x-y),abs(a-y)+abs(x-y)));
            }
        }
        cout<<ans<<endl;
    }
}

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

int main() {
  long long int x,y;
  cin>>x;
  y=0;
  for(long long int i=0;i<1000000000;i++){
    y+=i;
    if(x<=y){
      cout<<i<<endl;
      return 0;
    }
  }
}

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

using namespace std;
 
int main() {
	int a, b, c, d, e;
	cin >> a >> b >> c >> d >> e;
	if (a == 0)
		cout << 1 << '\n';
	if (b == 0)
		cout << 2 << '\n';
	if (c == 0)
		cout << 3 << '\n';
	if (d == 0)
		cout << 4 << '\n';
	if (e == 0)
		cout << 5 << '\n';
	
	
	
	
}


Measured memory_bytes: 3628
#include<iostream>
#include<cstdio>
#include<cmath>
#include<vector>
using namespace std;

#define EPS (1e-10)
#define equals(a, b) (fabs((a) - (b)) < EPS)

class Point{
	public:
		double x, y;

		Point(double x = 0, double y = 0): x(x), y(y) {}

		Point operator + (Point p){ return Point(x + p.x, y + p.y);}
		Point operator - (Point p){ return Point(x - p.x, y - p.y);}
		Point operator * (double a){ return Point(a * x, a * y);}
		Point operator / (double a){ return Point(x / a, y / a);}

		double abs(){ return sqrt(norm());}
		double norm(){ return x * x + y * y;}

		bool operator < (const Point &p) const{
			return x != p.x ? x < p.x : y < p.y;
		}

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

struct Segment {
	Point p1, p2;
};
typedef Segment Line;

class Circle{
	public:
		Point c;
		double r;
		Circle(Point c = Point(), double r = 0.0): c(c), r(r) {}
};

typedef Point Vector;
typedef vector<Point> Polygon;

double dot(Vector a, Vector b){
	return a.x * b.x + a.y * b.y;
}
double cross(Vector a, Vector b){
	return a.x * b.y - a.y * b.x;
}

Point getCrossPoint(Segment s1, Segment s2){
	Vector base = s2.p2 - s2.p1;
	double d1 = abs(cross(base, s1.p1 - s2.p1));
	double d2 = abs(cross(base, s1.p2 - s2.p1));
	double t = d1 / (d1 + d2);
	return s1.p1 + (s1.p2 - s1.p1) * t;
}

int main(void){
	int q;
	Segment s1, s2;

	scanf("%d", &q);
	for(int i = 1; i <= q; i++){
		cin >> s1.p1.x >> s1.p1.y >> s1.p2.x >> s1.p2.y >> s2.p1.x >> s2.p1.y >> s2.p2.x >> s2.p2.y;
		Point ans = getCrossPoint(s1, s2);
		printf("%.8lf %.8lf\n", ans.x, ans.y);
	}

	return 0;
}

Measured memory_bytes: 3284
/*************************************************************************
  >         File: A.cc
  >       Author: lyyllyyl
  >         Mail: riho.yoshioka@yandex.com
  > Created Time: Mon 10 Oct 2016 11:58:18 AM CST
*************************************************************************/
#include <bits/stdc++.h>

int a[111111];

int main() {
  std::ios::sync_with_stdio(0);
  int n;
  std::cin >> n;
  for (int i = 0; i < n; ++i) std::cin >> a[i];
  int now = 1;
  using LL = long long;
  LL ans = 0;
  for (int i = 0; i < n; ++i) {
    if (a[i] == now) {
      now++;
      continue;
    }
    int k = (a[i] - 1) / now;
    ans += k;
    a[i] = 1;
    if (a[i] == now) now++;
    //std::cerr << "# i << ' ' << now << ' ' << ans # is " << i << ' ' << now << ' ' << ans << std::endl;
  }
  std::cout << ans << std::endl;

  return 0;
}


Measured memory_bytes: 640
// J'aime
// Chemise Blanche

#include <bits/stdc++.h>
using namespace std;

#define int long long

#define ii pair<int,int>
#define fi first
#define sc second

#define all(x) (x).begin(),(x).end()
#define dbg(x) cerr << __LINE__ << " > " << #x << " = " << (x) << endl

void MAIN() {
  int r; cin >> r;
  if (r < 1200) cout << "ABC" << '\n';
  else if (r < 2800) cout << "ARC" << '\n';
  else cout << "AGC" << '\n';
}

signed main() {
#ifdef _DEBUG
  // freopen("in" , "r", stdin );
  // freopen("out", "w", stdout);
#endif
  ios::sync_with_stdio(0); cin.tie(0);
  int T = 1;
  // cin >> T;
  while (T--) MAIN();
}


Measured memory_bytes: 3644
#include <iostream>
#include <string>
using namespace std;
int main()
{
	int n; cin >> n ;
	while(n--)
	{
		int score=0; int out=0; int run=0;
		string str;
		while(cin>>str)
		{
			if(str=="HIT") {run++; if(run>=4) {run--; score++;} }
			else if(str=="HOMERUN") {score+=run+1; run=0;}
			else if(str=="OUT") out++;
			if(out>=3) break;
		}
		cout << score << endl;
	}
}

Measured memory_bytes: 1212
N = int(input())
L = list(map(int, input().split()))
long = sum(L)
ans = long
sum1 = 0
sum2 = long
for i in range(N):
	sum1 += L[i]
	sum2 -= L[i]
	ans = min(abs(sum1-sum2), ans);
print(ans)

Measured memory_bytes: 25508
#include <iostream>

using namespace std;

int main(){
    int h,w;
    int i,j;
    
    while(1){
    
        cin >> h >> w;
        
        if(h == 0 && w == 0){
            break;
        }
    
        for(i = 0;i < h;i++){
            for(j = 0;j < w;j++){
                if(i == 0 || i == h -1){
                    cout << '#';
                }else{
                    if(j == 0 || j == w - 1){
                        cout << '#';
                    }else{
                        cout << '.';
                    }
                }
            }
            cout << endl;
        }
        
        cout << endl;
    }
    
    return 0;
}


Measured memory_bytes: 3068
n = int(input())
s = input()
kinds = []
for i in range(1,n):
    # print(s[0:i],s[i:])
    l = s[0:i]
    r = s[i:]
    dubles = []
    for i in list(l):
        for j in list(r):
            if i == j:
                dubles +=[i]
    # print(dubles)
    # print(set(dubles))
    kinds += [len(set(dubles))]
    
    
print(max(kinds))

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <algorithm>
#include <numeric>
#include <climits>
#define LIM 1000007
#define ll long long
using namespace std;
int main() {
  int s, k, cnt = 0;
  cin >> k >> s;
  for (int i = 0; i <= k; i++) {
    for (int m = 0; m <= k; m++) {
      int re = s - i - m;
      if (0 <= re && re <= k) {
        cnt++;
      }
    }
  }
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 256
n = int(input())
s = input()
s = s[:n]
words = []

for i in range(n):
	a = list(s[:i])
	b = list(s[i:])
	aset = set(a)
	bset = set(b)
	c = len(aset & bset)
	words.append(c)

print(max(words))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

vector<string> split(const string &s, char delim) {
  vector<string> elems;
  string item;
  for (char ch: s) {
    if (ch == delim) {
      if (!item.empty()) {
        elems.push_back(item);
      }
      item.clear();
    }
    else {
      item += ch;
    }
  }
  if (!item.empty()) {
    elems.push_back(item);
  }
  return elems;
}

string to_str_with_zero(int i, int w) {
  ostringstream sout;
  sout << std::setfill('0') << std::setw(w) << i;
  string s = sout.str();
  return s;
}

int letter_to_int(char c) {
  return tolower(c) - 'a';
}

int compare_array(vector<int> a1, vector<int>a2) {
  if (a1.size() != a2.size()) {
    return a1.size() - a2.size();
  }
  for (int i=0; i<a1.size(); i++) {
    if (a1.at(i) != a2.at(i)) {
      return a1.at(i) - a2.at(i);
    }
  }
  return 0;
}

int gcd(int a, int b) {
  if(a % b == 0) {
    return b;
  }
  return gcd(b, a % b);
}

char int_to_char(int a) {
  if (a == -1) {
    return 'z';
  }
  else {
    return 'a' + a;
  }
}

long nCr(int n, int r) {
    long ans = 1;
    for (int i = n; i > n - r; --i) {
        ans = ans*i;
    }
    for (int i = 1 ; i < r + 1; ++i) {
        ans = ans / i;
    }
    return ans;
}

long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m; 
    if (u < 0) u += m;
    return u;
}

int divide_count(int a, int divider) {
  int r = 0;
  while(a % divider == 0) {
    a /= divider;
    r++;
  }
  return r;
}

bool is_prime(int a) {
  int i = 2;
  while(i * i <= a) {
    if(a % i == 0) {
      return false;
    }
    i++;
  }
  return true;
}

int main() {
  std::cout << std::setprecision(9);
  int n, k;
  cin >> n >> k;

  vector<int> a(n);
  for(int i=0; i<n; i++) {
    cin >> a[i];
    if(i >= k) {
      if(a[i] > a[i - k]) {
        cout << "Yes" << endl;
      }
      else {
        cout << "No" << endl;
      }
    }
  }
}

Measured memory_bytes: 4052
import math

def hensa(n, S):
 m = sum(S)/n
 x = 0
 for i in S:
  x += (i - m) ** 2
 hensa = math.sqrt(x / n)
 return hensa

n = int(input())
while n != 0:
 S = list(map(int, input().split()))
 print("{0:04f}".format(hensa(n, S)))
 n = int(input())

Measured memory_bytes: 7760
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] A = new int[N];
		for(int i = 0;i < N;++i)
			A[i] = sc.nextInt();
		sc.close();
		
		int max = A[0];
		int min = A[0];
		for(int i = 1;i < N;++i) {
			if(max < A[i])
				max = A[i];
			if(min > A[i])
				min = A[i];
		}
		System.out.println((max - min));
	}
}


Measured memory_bytes: 22740
#include <iostream>

using namespace std;

int main(void){
  int w,h,x,y,r;
  
  cin >> w >> h >> x >> y >> r;
  if((0<=x-r && x+r<=w)&&(0<=y-r && y+r<=h))  cout << "Yes\n";
  else  cout << "No\n";

}

Measured memory_bytes: 1128
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 1e9;

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

  ll x = 1000;
  for (int i = 0; i < n-1; ++i) {
    if (a[i] < a[i+1]) {
      ll k = x / a[i];
      x %= a[i];
      x += k * a[i+1];
    }
  }
  cout << x << endl;
}


Measured memory_bytes: 3588
// luogu-judger-enable-o2
#include<bits/stdc++.h>
using namespace std;
int n,k,e,u,w;
int main(){
    cin>>n>>k>>e;
    w=e;
    for(int i=2;i<=n;i++){
        cin>>u;
        e=__gcd(e,u);      
        w=max(u,w);
    }
    if(k%e==0&&k<=w){
        cout<<"POSSIBLE"<<endl;
    }
    else{
        cout<<"IMPOSSIBLE"<<endl;
    }
    return 0;
}

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

int main(){
    
    int n;
    int t = 0;
    int h = 0;
    
    cin >> n;
    
    for (int i = 0;i < n; i ++) {
        
        string taro,hana;
        
        cin >> taro >> hana;
        
        if ( taro == hana ) {
            
            t += 1;
            h += 1;
            
        } else if ( taro < hana ) {
            
            h += 3;
            
        } else if ( taro > hana ) {
            
            t += 3;
            
        }
        
    }
    
    cout << t << ' ' << h << endl;
    
    return 0;
    
   
}


Measured memory_bytes: 3172
use std::io::{stdin, Read};

macro_rules! parse {
    ($it: ident) => {
        $it.next().unwrap().parse().unwrap()
    };
    ($it: ident,2) => {
        (parse!($it), parse!($it))
    };
    ($it: ident,3) => {
        (parse!($it), parse!($it), parse!($it))
    };
    ($it: ident,4) => {
        (parse!($it), parse!($it), parse!($it), parse!($it))
    };
    ($it: ident, $n: ident) => {
        (&mut $it).take($n).map(|e| e.parse().unwrap()).collect();
    };
}

fn main() {
    let mut s = String::new();
    stdin().read_to_string(&mut s).unwrap();
    let mut it = s.split_whitespace();
    let (n, k): (f64, f64) = parse!(it, 2);
    println!("{}", (n.log(k).floor() as usize) + 1);
}


Measured memory_bytes: 4352
import java.util.Scanner;

public class Main {
  static Scanner sc = new Scanner(System.in);

  public static void main(String[] args) {
    int N = sc.nextInt();
    while (N > 0) {
      int sum = 0;
      for (int i = 1; ; i++) {
        sum += i;
        if (sum >= N) {
          System.out.println(i);
          N -= i;
          break;
        }
      }
    }
  }

}


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

/*(k%2 == 0)ならkとk+1の排他的論理和が1であることに注目  つまりAからBは全部でB-A+1個の連続した自然数列となっているため、もし、(B-A+1)%2 = 0 -> (B-A+1) / 2 = odd -> 1 else even -> 0、(B-A+1)%2 = 1 ならば、 1とB乃至は0とBの排他的論理和を出力*/

int main(){
  int64_t  A, B;
  cin >> A >> B;

  if(A % 2 == 0){                 //Aが偶数なら、Aから個数を超えない最大の偶数値個のXORを計算
    if((B-A+1)%2 == 0){
      if(((B-A+1)/2)%2 == 1)
        cout << 1 << endl;
      else
        cout << 0 << endl;
    }else{
      if(((B-A)/2)%2 == 1)
        cout << (B ^ 1) << endl;
      else
        cout << B << endl;
    }
  }else{                                     //Aが奇数なら、Aを除いた部分とAの排他的論理和を考える
    if((B-A+1)%2 == 0){
      if(((B-A-1)/2)%2 == 1)
        cout << (A ^ 1 ^ B) << endl;
      else
        cout << (A ^ 0 ^ B) << endl;
    }else{
      if(((B-A)/2)%2 == 1)
        cout << (A ^ 1) << endl;
      else
        cout << (A ^ 0) << endl;
    }
  }

  return 0;

  
    
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
using namespace std;
int f[1000005]={0};
const int N = 1000001;
int p[1000001];
bool vis[N];
int get_prime() {
    vis[1]=1;
    int k=0;
    for(int i=2;i<N;i++){
        if(!vis[i]) p[k++]=i;
        for(int j=0;j<k&&p[j]*i<N;j++){
            vis[p[j]*i]=1;
            if(i%p[j]==0) break;
        }
    }
    return k;
}
signed main() {
    for(int i=1;i<=N;i++){
        vis[i]=false;
    }
	get_prime();
	int n;
	cin>>n;
	int a[n+1];
	for(int i=1;i<=n;i++){
		cin>>a[i];
		for(int j=0;p[j]*p[j]<=a[i];j++){
			if(a[i]%p[j]==0){
				f[p[j]]++;
			}
			while(a[i]%p[j]==0){
				a[i]/=p[j];
			}
		}
		if(a[i]){
			f[a[i]]++;
		}
	}
	int maxv=0;
	for(int i=2;i<=1000005;i++){
		maxv=max(maxv,f[i]);
	}
	if(maxv==1||maxv==0){
		cout<<"pairwise coprime";
	}
	else if(maxv==n){
		cout<<"not coprime";
	}
	else{
		cout<<"setwise coprime";
	}

	return 0;
}


Measured memory_bytes: 20632
using System;
using System.Linq;
using System.Collections.Generic;

class MyClass
{
    public static void Main(string[] args)
    {
        var input = Console.ReadLine().Split().Select(int.Parse).ToArray();
        var max = input.Max();
        if (max == input[0])
        {
            Console.WriteLine("A");
        }
        else if (max == input[1])
        {
            Console.WriteLine("B");
        }
        else
        {
            Console.WriteLine("C");
        }
    }
}



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

using namespace std;

#ifdef ZTDebug
#define In scanf_s
#else
#define In scanf
#endif // ZTDebug

#define Ind(d) In("%d", &d)
#define Ind2(a, b) In("%d%d", &a, &b)
#define InD(d) int d; In("%d", &d);
#define InD2(a, b) int a, b; In("%d%d", &a, &b);
#define InDN(n, v) for (auto _i = 0; _i < n; ++_i) In("%d", &v[_i]);
#define OutDNLine(n, v) for (auto _i = 0; _i < n; ++_i) printf("%d%c", *(v + _i), _i + 1 == n ? '\n' : ' ');

typedef double db;
typedef long long LL;
typedef pair<int, int> pii;

const db eps = 1e-6;
const int oo = 0x3f3f3f3f;

const int Max = 200010;
void inc(int s[], int x) {
    while (x < Max) {
        ++s[x];
        x += x & -x;
    }
}
int read(int s[], int x) {
    auto res = 0;
    while (x > 0) {
        res += s[x];
        x -= x & -x;
    }
    return res;
}
int ct[Max];
int main() {
    int n;
    LL k;
    cin >> n >> k;
    vector<pair<LL, int>> vs;
    auto s = 0LL;
    vs.push_back(make_pair(s, 1));
    for (auto i = 1; i <= n; ++i) {
        InD(h);
        s += h;
        vs.push_back(make_pair(s - i * k, i + 1));
#ifdef ZTDebug
        cout << "\t" << s - i * k << endl;
#endif // ZTDebug
    }

    auto r = 0LL;
    sort(vs.begin(), vs.end());
    memset(ct, 0, sizeof(ct));
    for (auto i = 0; i < vs.size();) {
        auto d = vs[i].first;
        auto j = i;
        for (; i < vs.size() && vs[i].first == d; ++i) inc(ct, vs[i].second);
        for (auto k = j; k < i; ++k) {
            auto c = read(ct, vs[k].second - 1);
            r += c;
#ifdef ZTDebug
            cout << "\t" << vs[k].second - 1 << ": " << c << endl;
#endif // ZTDebug
        }
#ifdef ZTDebug
        cout << "[" << j << "," << i - 1 << "] " << d << " : " << r << endl;
#endif // ZTDebug
    }

    cout << r << endl;

#ifdef ZTDebug
    system("pause");
#endif // ZTDebug
    return 0;
}


Measured memory_bytes: 6512
import java.util.*;
public class Main {
	public static void main(String[]args) {
		Scanner sc = new Scanner(System.in);
			int p = sc.nextInt();
			int q = sc.nextInt();
			int r = sc.nextInt();
				
			int a = p+q;
			int b = r+q;
			int c = p+r;
			System.out.println(Math.min(a, Math.min(b, c)));
	}
}

Measured memory_bytes: 21844
N = int(input())

t_prev = 0
x_prev = 0
y_prev = 0

ans = "Yes"

for i in range(N):
  t_now, x_now, y_now = map(int, input().split())
  t_diff = abs(t_now - t_prev)
  x_diff = abs(x_now - x_prev)
  y_diff = abs(y_now - y_prev)
  
  t_prev = t_now
  x_prev = x_now
  y_prev = y_now
  
  if t_diff < x_diff + y_diff:
    ans = "No"
    
  if t_diff % 2 != (x_diff + y_diff) % 2:
    ans = "No"
    
print(ans)

Measured memory_bytes: 3064
#ifdef LOCAL
//#define _GLIBCXX_DEBUG
#endif
//#pragma GCC target("avx512f,avx512dq,avx512cd,avx512bw,avx512vl")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> Pi;
typedef vector<ll> Vec;
typedef vector<int> Vi;
typedef vector<string> Vs;
typedef vector<P> VP;
typedef vector<vector<ll>> VV;
typedef vector<vector<int>> VVi;
typedef vector<vector<vector<ll>>> VVV;
typedef vector<vector<vector<vector<ll>>>> VVVV;

#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define PER(i, a, b) for(ll i=(a); i>=(b); i--)
#define rep(i, n) REP(i, 0, n)
#define per(i, n) PER(i, n, 0)
const ll INF=1e18+18;
const ll MOD=1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
#define ALL(v) v.begin(), v.end()
#define rALL(v) v.rbegin(), v.rend()
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a,b)
#define Each(a,b) for(auto &a :b)
#define rEach(i, mp) for (auto i = mp.rbegin(); i != mp.rend(); ++i)
#ifdef LOCAL
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbgmap(mp) cerr << #mp << ":"<<endl; for (auto i = mp.begin(); i != mp.end(); ++i) { cerr << i->first <<":"<<i->second << endl;}
#define dbgarr(n,m,arr) rep(i,n){rep(j,m){cerr<<arr[i][j]<<" ";}cerr<<endl;}
#define dbgdp(n,arr) rep(i,n){cerr<<arr[i]<<" ";}cerr<<endl;
#define dbgmint(n,arr) rep(i,n){cerr<<arr[i].x<<" ";}cerr<<endl;
#define dbgarrmint(n,m,arr) rep(i,n){rep(j,m){cerr<<arr[i][j].x<<" ";}cerr<<endl;}
#else
#define dbg(...)
#define dbgmap(...)
#define dbgarr(...)
#define dbgdp(...)
#define dbgmint(...)
#define dbgarrmint(...)
#endif
#define out(a) cout<<a<<endl
#define out2(a,b) cout<<a<<" "<<b<<endl
#define vout(v) rep(i,v.size()){cout<<v[i]<<" ";}cout<<endl
#define Uniq(v) v.erase(unique(v.begin(), v.end()), v.end())
#define fi first
#define se second

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

template<typename T1, typename T2>
ostream &operator<<(ostream &s, const pair<T1, T2> &p) { return s<<"("<<p.first<<", "<<p.second<<")"; }

template<typename T>istream& operator>>(istream&i,vector<T>&v)
{rep(j,v.size())i>>v[j];return i;}

// vector
template<typename T>
ostream &operator<<(ostream &s, const vector<T> &v) {
    int len=v.size();
    for(int i=0; i<len; ++i) {
        s<<v[i];
        if(i<len-1) s<<"	";
    }
    return s;
}

// 2 dimentional vector
template<typename T>
ostream &operator<<(ostream &s, const vector<vector<T> > &vv) {
    int len=vv.size();
    for(int i=0; i<len; ++i) {
        s<<vv[i]<<endl;
    }
    return s;
}

int solve(){
    ll a,v;
    ll b,w;
    cin>>a>>v>>b>>w;
    ll d = abs(a-b);
    if(v <= w){
        YES(false);
        return 0;
    }
    ll t;
    cin>>t;
    dbg(d);
    ll diff = v-w;
    dbg(diff);
    YES(d <= t*diff);
    return  0;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<std::setprecision(10);
    solve();
}


Measured memory_bytes: 3640
N = int(input())

A = map(int, input().split())

num = [[0, 0] for _ in range(60)]

for Ai in A:
    for digit in range(60):
        if (Ai >> digit) & 1:
            num[digit][1] += 1
        else:
            num[digit][0] += 1

res = 0
for i, p in enumerate(num):
    res += (1 << i) * p[0] * p[1]

m = 10 ** 9 + 7
print(res % m)


Measured memory_bytes: 122808
import itertools as it
import collections as col
import heapq as hq
import sys
import copy as cp
sys.setrecursionlimit(10**9)
input = sys.stdin.readline


def dump(*objects):
    print(*objects, file=sys.stderr)


N = int(input())
A = [0] + list(map(int, input().split())) + [0]
dump(N, A)
B = cp.deepcopy(A)
C = cp.deepcopy(A)
for i in range(1, len(A)):
    dump(i)
    B[i] = B[i-1] + abs(A[i]-A[i-1])
for i in range(len(A)-2, -1, step=-1):
    dump(i)
    C[i] = C[i+1] + abs(A[i]-A[i+1])
dump(A, B, C)
for i in range(1, N+1):
    dump(i, B[i-1] + B[N+1] - B[i+1] + abs(A[i-1]-A[i+1]))
    print(B[i-1] + C[i+1] + abs(A[i-1]-A[i+1]))

exit(0)


Measured memory_bytes: 118800
x,y,a,b,c=map(int,input().split())
p=sorted(list(map(int,input().split())))[a-x::]
q=sorted(list(map(int,input().split())))[b-y::]
r=sorted(list(map(int,input().split())))[::-1]
p.append(10**9)
q.append(10**9)
if c<x+y:
  r+=[0]*(x+y-c)
i=0
j=0
ans=0
for k in range(x+y):
  if r[k]>p[i] and i<x and p[i]<=q[j]:
    ans+=r[k]
    i+=1
  elif r[k]>q[j] and j<y:
    ans+=r[k]
    j+=1
  else:
    break
if i==x:
  p1=0
else:
  p1=sum(p[i:x])
if j==y:
  q1=0
else:
  q1=sum(q[j:y])
print(ans+p1+q1)

Measured memory_bytes: 22504
#include <bits/stdc++.h>
using namespace std;
#define all(a) (a).begin(),(a).end()
#define cinv(v,n) for(size_t i=0;i<(n);i++){cin>>(v)[i];}
#define nvec(type,v,n) vector<type> v(n);cinv(v,n)
#define npairs(type1,type2,v,n) vector<pair<type1,type2>> v(n);for(size_t i=0;i<(n);i++){cin>>v[i].first>>v[i].second;}
#define ntuples(type1,type2,type3,v,n) vector<tuple<type1,type2,type3>> v(n);for(size_t i=0;i<(n);i++){cin>>get<0>(v[i])>>get<1>(v[i])>>get<2>(v[i]);}

#define min_index(v) size_t(min_element(all(v))-(v).begin())
#define max_index(v) size_t(max_element(all(v))-(v).begin())
#define min_e(v) *min_element(all(v))
#define max_e(v) *max_element(all(v))

#define count_le(v,a) size_t(upper_bound(all(v),a)-(v).begin())
#define count_lt(v,a) size_t(lower_bound(all(v),a)-(v).begin())
#define count_ge(v,a) size_t((v).end()-lower_bound(all(v),a))
#define count_gt(v,a) size_t((v).end()-upper_bound(all(v),a))

#define order(neq_sl) [](const &auto s, const &auto l){return neq_sl;}
#define make_lr(v,type,l,r) vector<type> l(n+1),r(n+1);FOR(i,n){l[i+1]=l[i]+v[i];r[i+1]=r[i]+v[n-1-i];}

#define acm accumulate
#define SUM(v) acm(all(v),0l)

int main() {
  int n,k;
  cin>>n>>k;
  nvec(long, x, n);
  long x_=1000000000;
  for (size_t i = 0; i < n-(size_t)k+1; i++) {
    x_=min(x_,x[i+k-1]-x[i]+min(abs(x[i+k-1]),abs(x[i])));
  }
  cout<<x_;
}

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

using namespace std;
using llong = long long;
using ldbl = long double;
using lpair = pair<llong, llong>;

#define ALL(x) x.begin(), x.end()

template<typename T>
constexpr T inf = static_cast<T>(pow(10, static_cast<int>(log10(numeric_limits<T>::max())))) + 7;
constexpr llong mod = 998244353;

template<typename T>
struct segment_tree {
  int n;
  T op;
  vector<T> node;
  function<T(T,T)> fnc;

  segment_tree() = default;
  segment_tree(int n, T init, function<T(T,T)> fnc, T op = T()) :
    n(n),
    op(op),
    node(n*2, init),
    fnc(fnc)
  {}
  segment_tree(vector<T> v, function<T(T,T)> f, T o = T()) {
    n = v.size();
    op = o;
    fnc = f;
    node.resize(n*2);

    for (int i = 0; i < n; i++)
      node[i+n] = v[i];
    for (int i = n-1; i >= 1; i--)
      node[i] = fnc(node[2*i], node[2*i+1]);
  }

  void set(int x, T val) {
    x += n;
    node[x] = val;
    while (x >>= 1)
      node[x] = fnc(node[x*2], node[x*2 + 1]);
  }

  void update(int x, T val) {
    x += n;
    node[x] = fnc(node[x], val);
    while (x >>= 1)
      node[x] = fnc(node[x*2], node[x*2 + 1]);
  }

  T get(int x, int y) {
    T val = op;
    for (x += n, y += n-1; x <= y; x >>= 1, y >>= 1) {
      if (x&1)
        val = fnc(val, node[x++]);
      if (y&1^1)
        val = fnc(val, node[y--]);
    }

    return val;
  }
};

llong N; 
vector<lpair> XD;
vector<llong> X, B, bombed, dp;
segment_tree<llong> st;

llong solve(llong idx) {
  if (idx == N) return 1;
  if (dp[idx] != -1) return dp[idx];

  llong ret = (solve(idx + 1) + solve(bombed[idx] + 1)) % mod;

  return dp[idx] = ret;
}

int main() {
  cin >> N;
  XD.resize(N);
  for (auto &in: XD) {
    cin >> in.first >> in.second;
  }
  sort(ALL(XD));

  cerr << endl;
  for (auto xd: XD) {
    X.push_back(xd.first);
    B.push_back(xd.first + xd.second);
    cerr << X.size() - 1 << " " << X.back() << " " << B.back() << endl;
  }
  cerr << endl;

  st = segment_tree<llong>(B, [](llong a, llong b){return max(a, b);}, -inf<llong>);
  segment_tree<llong> maxi(N, -1, [](llong a, llong b){return max(a, b);}, -inf<llong>);
  bombed.resize(N);
  for (llong i = N - 1; i >= 0; --i) {
    llong right = --(lower_bound(ALL(X), B[i])) - X.begin();
    bombed[i] = max(maxi.get(i, right + 1), i);
    maxi.set(i, bombed[i]);
    cerr << i << " " << bombed[i] << endl;
  }

  dp.resize(N, -1);
  cout << solve(0) << endl;

  return 0;
}

Measured memory_bytes: 22088
fun calc(n:Int, m:Int): Int {
    if (n <= 0)  return 0
    return n/m + if(n%m!=0) 1 else 0
}

fun main(args: Array<String>) {
    val (N,K) = readLine()!!.split(" ").map { it.toInt() }
    val a = readLine()!!.split(" ").map{it.toInt()}

    val pos = a.indexOf(1)
    val left = pos
    val right = a.size - left - 1

    val cnt = (0 until K).map {
        val l = left - it
        val r = right - (K-1-it)

        val lc = calc(l,K-1)
        val rc = calc(r,K-1)

        lc + rc + 1
    }.min()

    println(cnt)
}

Measured memory_bytes: 49720
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val array = readLine()!!.split(" ").map { it.toInt() } as MutableList<Int>
    val (sortedArray, exchanges) = bubbleSort(n, array)
    println(sortedArray.joinToString(" "))
    println(exchanges)
}

fun bubbleSort(n: Int, array: MutableList<Int>): Pair<List<Int>, Int> {
    var head = 0
    var exchanges = 0
    while (head < n - 1) {

        for (j in n - 1 downTo head + 1) {
            if (array[j] < array[j - 1]) {
                val small = array[j]
                val large = array[j - 1]
                array[j] = large
                array[j - 1] = small
                exchanges++
            }
        }
        head ++
    }
    return array to exchanges
}


Measured memory_bytes: 32148
A, B, C, X, Y = map(int, input().split(" "))

prices = []
if X > Y:
    half_max_count = X + 1
else:
    half_max_count = Y + 1

# 3 for文はダメなので削減する
# sliceで半分にできる多分。
for i in range(0, half_max_count):
    a_price = int(X - i) * A if (int(X - i) >= 0) else 0
    b_price = int(Y - i) * B if (int(Y - i) >= 0) else 0
    half_price = 2 * i * C
    price = half_price + a_price + b_price
    prices.append(price)
print(min(prices))


Measured memory_bytes: 45296
#include <bits/stdc++.h>
//#include "Header.h"

#define pi 3.14159265358979323846264

#define ll long long
#define fori(n) for(long long i=0;i<n;i++)
#define forj(n) for(long long j=0;j<n;j++)

#define sp(n) setprecision(n)
#define d7 1000000007
#define mkp make_pair
#define mkt make_tuple

using namespace std;

bool isPrime(long long k){
    if(k<=1){return false;}
    if(k==2){return true;}
    if(k%2==0){return false;}
    long long i = 3;
   while (i*i <= k) {if (k % i == 0) {return false;}i += 2;}
return true;
}

ll binomialCoeff(ll n, ll k){
    ll C[n + 1][k + 1];ll i, j;
    for (i = 0; i <= n; i++){
        for (j = 0; j <= min(i, k); j++)
        {if (j == 0 || j == i) C[i][j] = 1;
            else C[i][j] = (C[i - 1][j - 1] + C[i - 1][j]);}}
    return C[n][k];
 }

ll gcd(ll a, ll b){if (b == 0)
        return a;return gcd(b, a % b);}

ll srihrg(ll n,ll k,ll m){
    ll ans;
    ans=1;
    fori(k){
        ans=(ans*n)%m;
    }
    return ans;
}

ll kk=1;
void dfsi(vector<bool> &vis, vector<ll> adj1[], ll n, ll start, vector<ll> &pre, vector<ll> &pos){
    vis[start]=true;
    pre[start]=kk;kk++;
    for(ll i: adj1[start]){
        if(!vis[i]){
            vis[i]=true;
            dfsi(vis,adj1,n,i,pre,pos);
        }
    }
    pos[start]=kk;kk++;
}

void bfsi(vector<ll> &dis, vector<ll> adj[], ll s, vector<ll> &parent){
    dis[s]=-1;
    queue<ll> q;
    q.push(s);
    while(!q.empty()){
        ll z=q.front();
        q.pop();
        for(ll v:adj[z]){
            if(dis[v]==0){
            q.push(v);
            dis[v]=-dis[z];
                parent[v]=z;}
        }
    }
}

void make_set(ll v, vector<ll> &parent, vector<ll> &krank) {
    parent[v] = v;
    krank[v] = 0;
}

ll find_set(ll v,vector<ll> &parent, vector<ll> &krank) {
    if (v == parent[v])
        return v;
    return parent[v] = find_set(parent[v], parent, krank);
}

void union_sets(ll a, ll b,vector<ll> &parent, vector<ll> &krank) {
    a = find_set(a,parent,krank);
    b = find_set(b,parent,krank);
    if (a != b) {
        if (krank[a] < krank[b])
            swap(a, b);
        parent[b] = a;
        if (krank[a] == krank[b])
            krank[a]++;
    }
}

void dijkstra(ll s, vector<ll> &dist, vector<ll> &parent, ll n, vector<pair<ll,ll>> adj[]){
    dist[s]=0;
    vector<bool> u(n,false);
    fori(n){
        ll v=-1;
        forj(n){
            if(!u[j] &&(v==-1||(dist[j]<dist[v]))) v=j;
        }
        if(dist[v]==d7) break;
        u[v]=true;
        for(auto j:adj[v]){
            ll a,b;
            a=j.first;
            b=j.second;
            if(dist[v]+b<dist[a]){
                dist[a]=dist[v]+b;
                parent[a]=v;
            }
        }
    }
}


int main(int argc, const char * argv[]) {
 //cout<<"Om\n";
 //Praise to Lord
 //make cin/cout faster
 ios_base::sync_with_stdio(false);
 cin.tie(NULL);
// code now
   
    ll n,m;
    cin>>n>>m;
    ll k=1;
    while(n>0){
        k=min(2*k,k+m);
        n--;
    }
    cout<<k;
    
//code ends
    return 0;
}


Measured memory_bytes: 256
#include <math.h>
#include <iostream>
#include <vector>
using namespace std;
 
int main() {
  int N, K;
  cin >> N >> K;
  vector<int> a(N, 0);
  for (int i = 0; i < N; ++i) cin >> a[i];
 
  vector<vector<long long int>> table(N + 1, vector<long long int>(K + 1, 0));
  int mod = pow(10, 9) + 7;
  for (int i = 1; i <= N; ++i) {
    for (int j = 0; j <= K; ++j) {
      if (i == 1) {
        if (a[0] >= j)
          table[i][j] = 1;
        else
          table[i][j] = 0;
      } else if (j == 0) {
        table[i][j] = 1;
      } else {
        table[i][j] = table[i - 1][j];
        if (j > a[i - 1]) table[i][j] -= table[i - 1][j - a[i - 1] - 1];
        table[i][j] += mod;
        table[i][j] %= mod;
        table[i][j] += table[i][j - 1];
        table[i][j] %= mod;
      }
    }
  }
  cout << table[N][K];
}

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

int main() {
    int n,ans=0;cin>>n;
    string str;cin>>str;
    
    if(n%2==1)ans=-1;
    for(int i=0;i<n/2;++i){
        if(str[i]!=str[n/2 +i])ans=-1;
    }
    if(ans==0)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;

//    cout<<ans<<endl;

	return 0;
}

Measured memory_bytes: 256
import os
import sys

import numpy as np
from heapq import heappop, heappush


def solve(h, w, s, t, field):
    WARP = (-(w * 2 + 10), -(w * 2 + 9), -(w * 2 + 8), -(w * 2 + 7), -(w * 2 + 6),
            -(w + 6), -(w + 5), -(w + 3), -(w + 2),
            -2, 2,
            w + 2, w + 3, w + 5, w + 6,
            w * 2 + 6, w * 2 + 7, w * 2 + 8, w * 2 + 9, w * 2 + 10)
    WALK = (-(w + 4), -1, 1, w + 4)

    q = [(0, s)]
    visited = np.zeros((h + 4) * (w + 4), np.int8)
    while q:
        cost, v = heappop(q)
        if v == t:
            return cost
        if visited[v]:
            continue
        visited[v] = 1
        for d in WALK:
            if field[v + d] or visited[v + d]:
                continue
            heappush(q, (cost, d + v))
        for d in WARP:
            if field[v + d] or visited[v + d]:
                continue
            heappush(q, (cost + 1, d + v))

    return -1


if sys.argv[-1] == 'ONLINE_JUDGE':
    from numba.pycc import CC

    cc = CC('my_module')
    cc.export('solve', '(i8,i8,i8,i8,i1[:],)')(solve)
    cc.compile()
    exit()

if os.name == 'posix':
    # noinspection PyUnresolvedReferences
    from my_module import solve
else:
    from numba import njit

    solve = njit('(i8,i8,i8,i8,i1[:],)', cache=True)(solve)
    print('compiled', file=sys.stderr)

h, w = map(int, sys.stdin.readline().split())
ch, cw = map(int, sys.stdin.readline().split())
dh, dw = map(int, sys.stdin.readline().split())
field = np.ones((h + 4) * (w + 4), dtype=np.int8)
for i in range(h):
    line = sys.stdin.readline().strip()
    field[(i + 2) * (w + 4) + 2:(i + 2) * (w + 4) + w + 2] = list(map('.#'.index, line))
s = (ch + 1) * (w + 4) + cw + 1
t = (dh + 1) * (w + 4) + dw + 1
ans = solve(h, w, s, t, field)
print(ans)


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

#define name ""
#define ini freopen(name".inp","r",stdin); freopen(name".out","w",stdout)
#define foe(it,c) for (__typeof(c.begin()) it = c.begin(); it != c.end(); it++)
#define long long long 
#define db double 
#define pii pair <int, int>
#define pll pair <long, long>
#define all(c) c.begin(), c.end()
#define fastio ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)

const int INF = 1e9+7;
const int MOD = 1e9+7;
const int dx[4] = {0,0,-1,1};
const int dy[4] = {-1,1,0,0};

int main()
{
  fastio;
  string s; cin >> s;
  cout << (s[0] == s[1] && s[1] == s[2] ? "No" : "Yes");
  return 0;
}

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

ll dp[1005][1005]; // dp[i][j]:マス(i,j)に行く通り

int main() {
    int w, h;
    string s[1005];
    cin >> h >> w;
    REP(i,h) cin >> s[i];
    dp[0][0] = 1;
    REP(i,h){
        REP(j,w){
            dp[i][j] %= MOD;
            if(i+1<h && s[i+1][j]!='#') dp[i+1][j] += dp[i][j];
            if(j+1<w && s[i][j+1]!='#') dp[i][j+1] += dp[i][j];
        }
    }
    cout << dp[h-1][w-1]%MOD << endl;
    return 0;
}


Measured memory_bytes: 9088
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <stack>
#include <functional>

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
    #define eprintf(...) 42
#endif

#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define repp(i, m, n) for(int i = m, i##_len = (n); i < i##_len; ++i)
#define reprev(i, n) for(int i = (n-1LL); i >= 0; --i)
#define all(x) (x).begin(), (x).end()
template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
using namespace std;

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

constexpr int MOD = 1000000007;

// + - * / ^
int mod(int a)
{
    int res = a % MOD;
    if(res < 0) {
        return res + MOD;
    }
    return res;
}
int mul_mod(int a, int b)
{
    ll res = ((ll)a * (ll)b) % MOD;
    return mod((int)res);
}
int pow_mod(int a, int b)
{
    ll res = 1;
    while (b > 0) {
        if(b & 1) {
            res = res * (ll)a % (ll)MOD;
        }
        a = mul_mod(a, a);
        b >>= 1;
    }
    return (int)res;
}
int inv_mod(int a)
{
    return pow_mod(a, MOD - 2);
}
int div_mod(int a, int b)
{
    return mul_mod(a, inv_mod(b));
}

// ! C
constexpr int FAC_MAX = 200001;
ll fac[FAC_MAX], finv[FAC_MAX], inv[FAC_MAX];
void com_init()
{
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < FAC_MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
ll com_mod(int a, int b){
    if (a < b) return 0;
    if (a < 0 || b < 0) return 0;
    return fac[a] * (finv[b] * finv[a - b] % MOD) % MOD;
}

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, k;
    cin >> n >> k;
    vector<int> g[n];
    rep (i, n - 1) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    vector<P> dp(n);
    priority_queue<P> q;
    q.emplace(0, 0);
    dp[0].first = -1;
    while (!q.empty()) {
        P p = q.top(); q.pop();
        for (int i : g[p.second]) {
            if (dp[i].first == 0) {
                dp[i].first = p.second + 1;
                dp[i].second = p.first + 1;
                q.emplace(p.first + 1, i);
            }
        }
    }
    rep (i, n) eprintf("%d %d\n", dp[i].second, dp[i].first);
    sort(all(dp));
    int ans = k, now = k - 2;
    repp (i, 1, n) {
        if (dp[i].first != dp[i - 1].first) now = k - 2 + (dp[i].second == 1);
        else now--;
        ans = mul_mod(ans, now);
    }
    cout << ans << "\n";
    return 0;
}

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

int main(){
	while(1){
		int n;
		cin >> n;
		if(n==0) break;
		
		n = 1000-n;
		int ans = 0;
		int m[6] = {500, 100, 50, 10, 5, 1};
		for(int i=0; i<6; i++){
			ans += n/m[i];
			n %= m[i];
		}
		cout << ans << endl;
	}
	return 0;
}



Measured memory_bytes: 3096
#define _USE_NATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <random>
#include <tuple>


using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
#define EPS 1e-9
const int INF = 1050000000;
const long long LINF = 1LL << 60;
const ll MOD = 1e9 + 7;
const int MINF = -1050000000;

ll GCD(ll a,ll b) {
	if (b == 0) return a;

	return GCD(b,a%b);
}

ll LCM(ll a, ll b) {
	return a  / GCD(a, b) * b;
}

int main() {
	ll a, b;
	cin >> a >> b;
	//int test = GCD(a, b);
	ll ans = LCM(a, b);
	cout << ans << endl;
	return 0;
}


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


int main() {
    Int N, M;
    cin >> N >> M;
    priority_queue<Int> que;
    rep(i,N) {
        Int A;
        cin >> A;
        que.push(A);
    }

    while(M-->0) {
        Int X = que.top();
        que.push(X/2);
        que.pop();
    }

    Int ans = 0;
    while(!que.empty()) {
        Int Y = que.top();
        ans += Y;
        que.pop();
    }

    cout << ans << endl;
  
}


Measured memory_bytes: 1400