akhauriyash/Code-Regression huggingface dataset:
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
        x: i128
    }

    for i in -200i128..=200 {
        for j in -200i128..=200 {
            if i.pow(5) - j.pow(5) == x {
                println!("{} {}", i, j);
                return;
            }
        }
    }
}


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

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

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

	int A, B ,C; cin >> A >> B >> C;

	if(A == B && B == C) cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;

}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <iostream>
#include <climits>
#include <cfloat>


using namespace std;

bool data[12][12];

void DestroyIsland(int x, int y)
{
	data[y][x] = false;

	int dx[] = { 0, 1, 0, -1 };
	int dy[] = { 1, 0, -1, 0 };
	for (int i = 0; i < 4; ++i)
	{
		int tx = x + dx[i];
		int ty = y + dy[i];
		if (tx >= 0 && ty >= 0 && tx < 12 && ty < 12 && data[ty][tx])
			DestroyIsland(tx, ty);
	}
}

int main()
{
	while (!feof(stdin))
	{
		char buf[13];
		for (int i = 0; i < 12; ++i)
		{
			scanf("%s\n", buf);
			for (int j = 0; j < 12; ++j)
				data[i][j] = buf[j] == '1';
		}

		int n = 0;
		for (int y = 0; y < 12; ++y)
		{
			for (int x = 0; x < 12; ++x)
			{
				if (data[y][x])
				{
					++n;
					DestroyIsland(x, y);
				}
			}
		}
		printf("%d\n", n);
	}

	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define For(i, l, r) for(int i = (l), _end_ = (int)(r); i <= _end_; ++i)
#define Fordown(i, r, l) for(int i = (r), _end_ = (int)(l); i >= _end_; --i)
#define Set(a, v) memset(a, v, sizeof(a))
using namespace std;

bool chkmin(int &a, int b) {return b < a ? a = b, 1 : 0;}
bool chkmax(int &a, int b) {return b > a ? a = b, 1 : 0;}

inline int read() {
 int x = 0, fh = 1; char ch = getchar();
    for (; !isdigit(ch); ch = getchar() ) if (ch == '-') fh = -1;
    for (; isdigit(ch); ch = getchar() ) x = (x<<1) + (x<<3) + (ch ^ '0');
    return x * fh;
}

int main () {
	long long x, y;
	scanf ("%lld%lld", &x, &y);
	int ans = 0;
	for (; x <= y; x <<= 1LL, ++ ans);
	printf ("%d\n", ans);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
typedef long long ll;
using namespace std;
const ll INF = 1e9;
const ll MOD = 1e9 + 7;
#define repi(i, n, init) for (ll i = init; i < (n); i++)
int n, m, q;
vector<int> a, b, c, d;
int ans = 0;
void dfs(vector<int> A)
{
    if (A.size() == n)
    {
        int now = 0;
        repi(i, q, 0)
        {
            if (A[b[i] - 1] - A[a[i] - 1] == c[i])
                now += d[i];
        }
        ans = max(ans, now);
        return;
    }
    A.push_back(A.back());
    while (A.back() <= m)
    {
        dfs(A);
        A.back()++;
    }
}
int main()
{
    cin >> n >> m >> q;
    a = b = c = d = vector<int>(q);
    repi(i, q, 0)
    {
        cin >> a[i] >> b[i] >> c[i] >> d[i];
    }
    dfs(vector<int>(1, 1));
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3628
x=int(input())
y=int(input())
z=int(input())
result=int(input())
count=0
for i in range(x+1):
        for j in range(y+1):
            for k in range(z+1):
                    if (i*500+j*100+k*50)==result:
                        count+=1
                  
print(count)


Measured memory_bytes: 3060
a = int(input())
b = int(input())
c = int(input())
x = int(input())
count = 0
for ai in range(a+1):
    for bi in range(b+1):
        for ci in range(c+1):
            if 500*ai+100*bi+50*ci == x:
                count += 1
print(count)

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

int main(){
    int a, b, x;
    cin >> a >> b >> x;
    
    for(int i = 0; i <= b; i++){
        if(a + i == x){
            cout << "YES" << endl;
            return 0;
        }
    }

    cout << "NO" << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);++i)
#define rep(i,a,b) for(int i=a;i<(b);++i)
template<class T> inline bool chmin(T &a, T b){ if(a > b) { a = b; return true;} return false;}
template<class T> inline bool chmax(T &a, T b){ if(a < b) { a = b; return true;} return false;}
typedef long long ll;
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;


int A,B,T;

int main(){
    cin >> A >> B >> T;
    cout << T/A*B << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int w,a[11],b[11],x,i,j,k,kk,o=0,oo=0;
	for(i=1;i<=10;i++) scanf("%d",&a[i]);
	for(i=1;i<=10;i++) scanf("%d",&b[i]);
	for(i=1;i<10;i++){
		for(j=i+1;j<=10;j++){
			if(a[i]<a[j]){
				k=a[i];
				a[i]=a[j];
				a[j]=k;
			}
		}
	}
	for(i=1;i<=3;i++) o+=a[i];
	for(i=1;i<10;i++){
		for(j=i+1;j<=10;j++){
			if(b[i]<b[j]){
				kk=b[i];
				b[i]=b[j];
				b[j]=kk;
			}
		}
	}
	for(i=1;i<=3;i++) oo+=b[i];
	printf("%d %d\n",o,oo);
	return 0;
}

Measured memory_bytes: 2692
import java.util.Scanner;
public class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    long x = scan.nextLong();
    long m = 100;
    int ans = 0;
    while (m < x){
      m = m + m/100;
      ans++;
    }
    System.out.println(ans);
  }
}


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

using namespace std;


int main (void) 
{

  int N; // 直線（ボール）の数
  int K; // 装置B の起動位置:（K,i）

  int i;
  int A_dis, B_dis;
  int ans; // output

  cin >> N;
  cin >> K;
  vector<int> x(N); // ボールのx座標

  for(i=0; i<N; i++)
  {
    cin >> x.at(i);
  }
  ans = 0;

  for(i=0; i<N; i++)
  {

    A_dis = x.at(i) -0;
    B_dis = K -x.at(i);

    if( A_dis <= B_dis )
    {
      ans += A_dis *2;
    }
    else
    {
      ans += B_dis *2;
    }
    
  }

  cout << ans << endl;


  return 0;

}


Measured memory_bytes: 256
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def S(): return input().rstrip()
def LS(): return S().split()
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = 1e10

#solve
def solve():
    n, x, y = LI()
    dist = [[inf] * n for i in range(n)]
    edg = [[] for i in range(n)]
    for i in range(1, n):
        edg[i].append(i - 1)
        edg[i - 1].append(i)
    edg[x - 1].append(y - 1)
    edg[y - 1].append(x - 1)
    for i in range(n):
        dist[i][i] = 0
        q = [(0, i)]
        while q:
            s, p = heappop(q)
            for e in edg[p]:
                if dist[i][e] > dist[i][p] + 1:
                    dist[i][e] = dist[i][p] + 1
                    heappush(q, (dist[i][e], e))
    ans = [0] * n
    for i in range(n):
        for j in range(n):
            if dist[i][j] != inf:
                ans[dist[i][j]] += 1
    for ai in ans[1:]:
        print(ai//2)
    
    return


#main
if __name__ == '__main__':
    solve()


Measured memory_bytes: 139272
#include <stdio.h>
int main(void){
  int a;
  char buf[100];
  fgets(buf, sizeof(buf), stdin);
  sscanf(buf, "%d\n", &a);
  if (a%10==7){
    printf("Yes");
  }
  else if(a/100==7){
    printf("Yes");
  }
  else if((a/10)%10==7){
    printf("Yes");
  }
  else{
    printf("No");
  }
  return 0;
}

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

int num_groups, p[100000], n, m, a, b, c;
int par(int x) { return (p[x]==x)? x:p[x]=par(p[x]); }
bool isSameGroup(int a, int b) { return par(a) == par(b); }
void merge(int a, int b) {
    num_groups -= (!isSameGroup(a, b));
    p[par(a)] = par(b);
}
                   
int main() {
  cin >> n >> m;
  for (int i=0; i<n; i++) p[i] = i;
  num_groups = n;
  for (int i=0; i<m; i++) {
    cin >> a >> b >> c;
    merge(a-1, b-1);
  }
  cout << num_groups;
}


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

using namespace std;

void ask(const vector<int>& vec) {
	cout << "? ";
	for (int i = 0; i < vec.size(); ++i) {
		cout << vec[i];
		if (i < vec.size() - 1) { cout << " "; }
	}
	cout << endl;
}

void answer(const vector<string>& vec) {
	cout << "! ";
	for (int i = 0; i < vec.size(); ++i) {
		cout << vec[i][0];
	}
	cout << endl;
}

vector<int> build_vec(int N, int s) {
	vector<int> ret(N);
	for (int i = 0; i < N; ++i) { ret[i] = s + i; }
	return ret;
}

int main() {
	int N;
	cin >> N;

	vector<string> ans(2 * N, "x");
	
	string ls = "", rs = "";
	int l = 1, r = N + 1;
	vector<int> lv = build_vec(N, l);
	vector<int> rv = build_vec(N, r);
	ask(lv); cin >> ls;
	ask(rv); cin >> rs;

	while (r - l > 1) {
		int m = (l + r) / 2;

		auto mv = build_vec(N, m);
		string ms;
		ask(mv); cin >> ms;

		if (ms == ls) { l = m; }
		else { r = m; }
	}

	ans[l - 1] = ls;
	ans[r + N - 2] = rs;

	for (int i = 1; i <= 2 * N; ++i) {
		if (ans[i - 1] != "x") { continue; }

		vector<int> vec;
		vec.emplace_back(i);
		if (l <= i && i < r + N) {
			for (int j = 1; j < l; ++j) { vec.emplace_back(j); }
			for (int j = r + N; j <= 2 * N; ++j) { vec.emplace_back(j); }
		} else {
			for (int j = 1; j < N; ++j) { vec.emplace_back(l + j); }
		}
		ask(vec); cin >> ans[i - 1];
	}

	answer(ans);

	return 0;
}


Measured memory_bytes: 724
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n;
  cin >> n;
  int a = n / 1000;
  int b = n / 100 %10;
  int c = n / 10 % 10;
  int d = n  % 10;
  if( a + b + c + d == 7){
    cout << a << '+' << b << '+' << c << '+' << d << '=' << 7 <<endl;
  }
  else if( a + b + c - d == 7){
    cout << a << '+' << b << '+' << c << '-' << d << '=' << 7 <<endl;
  }
  else if( a + b - c + d == 7){
    cout << a << '+' << b << '-' << c << '+' << d << '=' << 7 <<endl;
  }
  else if( a + b - c - d == 7){
    cout << a << '+' << b << '-' << c << '-' << d << '=' << 7 <<endl;
  }
  else if( a - b + c + d == 7){
    cout << a << '-' << b << '+' << c << '+' << d << '=' << 7 <<endl;
  }
  else if( a - b + c - d == 7){
    cout << a << '-' << b << '+' << c << '-' << d << '=' << 7 <<endl;
  }
  else if( a - b - c + d == 7){
    cout << a << '-' << b << '-' << c << '+' << d << '=' << 7 <<endl;
  }
  else if( a - b - c - d == 7){
    cout << a << '-' << b << '-' << c << '-' << d << '=' << 7 <<endl;
  } 
}


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

int f(int n){
    if (n % 2 == 0){
        return n / 2;
    }
    else{
        return 3 * n + 1;
    }
}

int main(){
    int s;
    cin >> s;
    vector<int> a(1000000);
    a.at(0) = s;
    for (int i = 1; i < 1000000; i++){
        a.at(i) = f(a.at(i-1));
        bool finish = false;
        for (int j = 0; j < i; j++){
            if (a.at(i) == a.at(j)){
                finish = true;
                cout << i + 1 << endl;
                break;
            }
        }
        if (finish){
            break;
        }
    }
} 

Measured memory_bytes: 4096
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

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

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef unsigned long long ULL;

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

#define MP make_pair
#define EACH(i,c) for(auto i: c)
#define SORT(c) sort((c).begin(),(c).end())

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

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


	printf("%.10f\n", 2 * N * M_PI);


	return 0;
}


Measured memory_bytes: 3692
#include <stdio.h>
 
int main(void){
    // Your code here!
long long int a[200001];
long long int b[200001];
int n,m,k;
   
   a[0]=0;
   b[0]=0;
   
   
    scanf("%d %d %d",&n,&m,&k);
    for(int i=1;i<=n;i++){
        scanf("%lld",&a[i]);
        a[i]+=a[i-1];
    }
     for(int i=1;i<=m;i++){
        scanf("%lld",&b[i]);
        b[i]+=b[i-1];
    }
 
int max=0;
int jbest=m;
 
for(int i=0;i<=n;i++){
    for(int j=jbest;m>=0;j--){
        if(a[i]+b[j]<=k){
            if(i+j>max){
            max=i+j;
            }
            jbest=j;
            break;
        }
    }
}
 
 
    /*
    for(int i=0;i<n;i++){
        printf("%lld ",a[i]);
    }
     for(int i=0;i<m;i++){
        printf("%lld ",b[i]);
    }*/
    
   printf("%d",max);
}

Measured memory_bytes: 4856
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define all(v) v.begin(), v.end()
#define mp make_pair
#define INF 1e9

void init()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(20);
}

int main()
{
    init();
    int n;
    cin>>n;
    string s;
    int ac=0,wa=0,tle=0,re=0;
    rep(i,n){
        cin>>s;
        if (s=="AC")ac++;
        if (s == "WA")wa++;
        if (s == "TLE")tle++;
        if (s == "RE")re++;
    }
    cout << "AC" << " x " << ac << endl;
    cout << "WA"<< " x " << wa << endl;
    cout << "TLE"<< " x " << tle << endl;
    cout << "RE"<< " x " << re << endl;
}


Measured memory_bytes: 3656
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>

using namespace std;

int n = 0, H[2000002];

void maxHeapify (int i) {
  int l = i * 2;
  int r = i * 2 + 1;
  int largest;

  if (l <= n && H[i] < H[l])
    largest = l;
  else
    largest = i;
  if (r <= n && H[largest] < H[r])
    largest = r;

  // cout << "maxHeapify: " << i << " " << largest << endl;

  if (largest != i) {
    swap(H[i], H[largest]);
    maxHeapify(largest);
  }
}

void insertToCorrect (int i) {
  int n = i, m = floor(i / 2), temp;

  while (n > 1 && H[m] <= H[n]) {
    swap(H[m], H[n]);
    temp = n;
    n = m;
    m = float(m / 2);

    // cout << "n = " << n << " m = " << m << endl;
  }
}

void insert (int i) {
  H[++n] = i;

  // cout << "n = " << n << endl;

  if (n > 1)
    insertToCorrect(n);
}

int main () {
  int m;
  string s;

  while (cin >> s) {
    if (s == "end")
      break;
    
    if (s == "insert") {
      cin >> m;
      
      insert(m);
    } else if (s == "extract") {
      int max = H[1];

      // for (int i = 1; i <= n; i++)
      //   cout << H[i] << " ";
      // cout << endl;
      
      if (n > 1) {
        H[1] = H[n--];
        maxHeapify(1);
      }

      cout << max << endl;

      // for (int i = 1; i <= n; i++)
      //   cout << H[i] << " ";
      // cout << endl;
    }
  }
  
  return 0;
}


Measured memory_bytes: 7108
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}
void neg() {cout << - 1 << endl;}
void unhap() {cout << ":(" << endl;}

int main() {
  int n;
  cin >> n;
  vector<string> w(n);
  for (int i = 0; i < n; i++) cin >> w.at(i);
  for (int i = 0; i < n; i++) {
    if (i > 0 && w.at(i).at(0) != w.at(i - 1).at(w.at(i - 1).size() - 1)) {
      No();
      return 0;
    }
    for (int j = 0; j < i; j++) {
      if (w.at(i) == w.at(j)) {
        No();
        return 0;
      }
    }
  }
  Yes();
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    long n; cin >> n;
    long ans = 0;
    vector<long> v(n);
    for(int i=0;i<n;i++)cin >> v[i];
    long m = -1;
    for(int i=0;i<n;i++){
        if(m < v[i])m = v[i];
        else ans += (m-v[i]);
    }
    cout << ans << endl;
}

Measured memory_bytes: 4840
//هوالحق
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 100022, DLT = 1000000007;

ll P[N];

int main(){
    //ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    P[0] = 1;
    for(int i = 1; i < N; i++) P[i] = (P[i-1] * 3) % DLT;
    string s;
    cin >> s;
    reverse(s.begin(), s.end());
    ll r = 1;
    for(int i = 0; i < s.size(); i++){
        if(s[i] == '1')
            r = (2 * r + P[i]) % DLT;
    }
    cout << r;
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fst first
#define snd second
#define all(cont) cont.begin(), cont.end()
#define foreach(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define fore(i,a,b) for(int i=a,almo5t=b;i<almo5t;++i)
#define SZ(x) ((int)x.size())
#define EPS 1e-9
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define FIN std::ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

const int N = 0;

typedef long long int ll;

using namespace std;

int main(){
    int n;cin>>n;
    ll values[n];
    ll acum[n+1];
    acum[0] = 0;
    fore(i,0,n){cin>>values[i];acum[i+1]=acum[i]+values[i];}
    ll ans = 100000000000000;
    fore(i,0,n-1){
        ans = min(ans,abs((acum[n]-acum[i+1])-acum[i+1]));
        //cout<<acum[i+1]<<" ";
    }
    cout<<ans;
	return 0;
}

Measured memory_bytes: 3328
#include<iostream>
#include<string.h>
using namespace std;
int main()
{
	int h=0,b=0;
	char s[4], s2[4];
	while (true){
		cin >> s >> s2;
		if (strlen(s)==1){
			return 0;
		}
		h = 0, b = 0;
		for (int i = 0; i < 4; i++){
			if (s[i] == s2[i]){
				h++;
				s[i] = '-';
				s2[i] = '-';
			}
		}
		for (int i = 0; i < 4; i++){
			for (int i2 = 0; i2 < 4; i2++){
				if (i != i2&&s[i] != '-'&&s2[i2] != '-'&&s[i]==s2[i2]){
					b++;
				}
			}
		}
		cout << h << " " << b << endl;
	}
}

Measured memory_bytes: 1140
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;

public class Main {

	public static void main(String[] args) {

		FastScanner sc = new FastScanner();
		int N = sc.nextInt();
		int M = sc.nextInt();
		int C = sc.nextInt();

		int[] B = new int[M];

		for (int i = 0; i < M; i++)
			B[i] = sc.nextInt();

		int[][] A = new int[N][M];

		for (int i = 0; i < N; i++) {
			for (int j = 0; j < M; j++) {
				A[i][j] = sc.nextInt();
			}
		}

		int count = 0;

		for (int i = 0; i < N; i++) {
			int s = 0;
			for (int j = 0; j < M; j++) {
				s += A[i][j] * B[j];
			}
			if (s + C > 0)
				count++;
		}
		System.out.println(count);

	}
	//以下、自作ライブラリ

	//最大公約数
	public static long gcd(long a, long b) {
		if (a < b)
			return gcd(b, a);
		long c = 0;
		c = a % b;
		if (c == 0)
			return b;
		return gcd(b, c);
	}

	//最小公倍数
	public static long lcm(long m, long n) {
		return m * n / gcd(m, n);
	}

	//素数判定
	public static boolean isPrime(int n) {
		if (n < 2)
			return false;
		if (n == 2)
			return true;
		if (n % 2 == 0)
			return false;

		for (int i = 3; i * i <= n; i += 2) {
			if (n % i == 0)
				return false;
		}
		return true;
	}
}

//以下、高速スキャナークラス
class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}

	private int readByte() {
		if (hasNextByte())
			return buffer[ptr++];
		else
			return -1;
	}

	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}

	public boolean hasNext() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
		return hasNextByte();
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	public long nextLong() {
		if (!hasNext())
			throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}

	public int nextInt() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
			throw new NumberFormatException();
		return (int) nl;
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}
}


Measured memory_bytes: 21332
def check(y,x):
    if 0<=y<=n-1 and 0<=x<=n-1:
        return True
    return False

n,m=map(int,raw_input().split())
a=[raw_input() for _ in xrange(n)]
b=[raw_input() for _ in xrange(m)]
for i in xrange(n):
    for j in xrange(n):
        cnt=0
        for k in range(m):
            for l in xrange(m):
                if check(k+i,l+j):
                    if a[k+i][l+j]==b[k][l]:
                        cnt+=1
        if cnt==m*m:
            print("Yes")
            exit()
print("No")


Measured memory_bytes: 33384
#include<iostream>
using namespace std;
int main(){
  int a,b[100],i;
  cin >> a;
  for(i=0;i<a;i++){
    cin >> b[i];
  }
  i--;
  for(;i>=0;i--){
    cout << b[i];
    if(i==0){
      break;
    }
    cout << " ";
  }
  cout <<endl;  
  return 0;
}

Measured memory_bytes: 1160
import java.util.*;
import java.io.*;
class Main{
  public static void main(String arg[])throws Exception{
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	String inps[] = br.readLine().split(" ");
    int n = Integer.parseInt(inps[0]);
    int m = Integer.parseInt(inps[1]);
    ArrayList <Integer> graph[] = new ArrayList[n];
    for(int i=0;i<n;i++)
      graph[i] = new ArrayList <Integer>();
    
    int degree[] = new int[n];
    for(int i=0;i<m;i++){
      inps = br.readLine().split(" ");
      int x = Integer.parseInt(inps[0]) - 1;
      int y = Integer.parseInt(inps[1]) - 1;
      graph[x].add(y);
      degree[y]++;
    }
    Queue <Node> bfs = new LinkedList();
    for(int i=0;i<n;i++)
      if(degree[i] == 0) bfs.add(new Node(i,1));
    int max_depth = 1;
    Node temp [] = new Node[n];
    for(int i=0;i<n;i++) temp[i] = new Node(i,1);
    while(!bfs.isEmpty()){
      Node curr = bfs.poll();
      for(int i=0;i<graph[curr.index].size();i++){
        Node c_temp = temp[graph[curr.index].get(i)];
        degree[c_temp.index]--;
        c_temp.depth = Math.max(c_temp.depth, curr.depth + 1);
        if(degree[c_temp.index] == 0) bfs.add(c_temp);
        max_depth = Math.max(max_depth, curr.depth + 1);
      }
    }
    
    System.out.println(max_depth-1);
    }
}
class Node{
  int depth;
  int index;
  public Node(int i, int d){
    depth = d;
    index = i;
  }
}

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

#define INF 1e9
#define llINF 1e18
#define MOD 1e9+7
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
using namespace std;
int main(){
  string s,ss;cin>>s>>ss;bool f=false;
  for(int i=0;i<s.size();i++){
    if(s.compare(ss)==0){
      f=true;
    }
    string sss=s[s.size()-1]+s.substr(0,s.size()-1);
    s=sss;
  }
  if(f)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>


int main(){
    int n;
    int max_=0;
    int ans=0;
    scanf("%d",&n);
    for(int i=1;i<=n;i++){
        int m;
        scanf("%d",&m);
        if(i==1)
            max_=m;
        if(m<=max_){
            ans++;
            max_=m;
        }
    }
   printf("%d",ans);
    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long long ll;
typedef pair<ll, ll> PLL;
typedef vector<int> VI;
typedef vector<char> VC;
typedef vector<double> VD;
typedef vector<string> VS;
typedef vector<ll> VLL;
typedef vector<PLL> VP;
const static int INF = 1000000000;
const static int MOD = 1000000007;
const int dx[4]={1, 0, -1, 0};
const int dy[4]={0, 1, 0, -1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define rep(i,n) for (ll i=0; i<(ll)(n); i++)
#define repd(i,n) for (ll i=n-1; i>=0; i--)
#define rept(i,m,n) for(ll i=m; i<n; i++)
#define stl_rep(itr, x) for (auto itr = x.begin(); itr != x.end(); ++itr)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define PF push_front
#define PB push_back
#define SORT(V) sort((V).begin(), (V).end())
#define RVERSE(V) reverse((V).begin(), (V).end())
#define paired make_pair
#define PRINT(V) for(auto v : (V)) cout << v << " "
//charを整数に
int ctoi(char c) { if (c >= '0' && c <= '9') { return c - '0'; } return 0; }
// 累積和 for (int i = 0; i < N; ++i) s[i+1] = s[i] + a[i]; 
void cum_sum(int N,vector<double> a, vector<double> &s){ for(int i=0; i<N; i++){ s[i+1]=s[i]+a[i];}}
//ユークリッドの控除法
ll gcd(ll a,ll b){
    if(b == 0) return a;
    return gcd(b,a%b);
}
//最小公倍数
ll lcm(ll a,ll b){
    ll g = gcd(a,b);
    return a / g * b; // Be careful not to overflow
}
//素数判定
bool is_prime(long long n) {
    if (n <= 1) return false;
    for (long long p = 2; p * p <= n; ++p) {
        if (n % p == 0) return false;
    }
    return true;
}
int getdigit(ll num){
    unsigned digit=0;
    while(num!=0){
        num /= 10;
        digit++;
    }
    return digit;
}
//空白文字も入力 getline(cin, S);
//桁数指定 setprecision

int main()
{
    ios::sync_with_stdio(0); 
    cin.tie(0); 
    cout.tie(0);
    ll L,R,d;
    cin >> L >> R >> d;
    ll count=0;
    rept(i,L,R+1){
        if(i%d==0){
            count++;
        }
    }
    cout << count << endl;
}

Measured memory_bytes: 3576
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline

n = int(input())
ans = [0] * 4

for i in range(n):
    s = input().rstrip()
    if s == 'AC': ans[0] += 1
    if s == 'WA': ans[1] += 1
    if s == 'TLE': ans[2] += 1
    if s == 'RE': ans[3] += 1

print('AC x', ans[0])
print('WA x', ans[1])
print('TLE x', ans[2])
print('RE x', ans[3])


Measured memory_bytes: 9128
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MOD 1000000007
#define INF 1e9
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()

typedef pair<int,int> P;

P f(int x){
    int a=x%10;
    int b=0;
    while(x){
        b=x;
        x/=10;
    }
    return P(a,b);
}

int main(){
    int n;
    cin>>n;
    map<P,int> freq;
    for(int i=1;i<=n;i++){
        P p=f(i);
        freq[p]++;
    } 
    ll ans=0;
    for(int i=1;i<=n;i++){
        P p=f(i);
        P q(p.second,p.first);
        ans+=freq[q];
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include"bits/stdc++.h"
#ifdef _DEBUG
#define DBG(n) n
#else
#define DBG(n)
#endif
#define INF          1e9
#define INFLL        1e18
#define EPS          1e-9
#define MOD          1000000007
#define REP(i,n)     for(ll i=0,i##_len=(n);i<i##_len;++i)
#define REP1(i,n)    for(ll i=1,i##_len=(n);i<=i##_len;++i)
#define REPR(i,n)    for(ll i=(n)-1;i>=0;--i)
#define REPR1(i,n)   for(ll i=(n);i>0;--i)
#define REPC(i,obj)  for(auto i:obj)
#define ALL(obj)     (obj).begin(),(obj).end()
#define SETP(n)      cout<<fixed<<setprecision(n)
#define VV(T,h,w)    move(vector<vector<T>>(h,move(vector<T>(w))))
#define VVI(T,h,w,i) move(vector<vector<T>>(h,move(vector<T>(w,i))))
using namespace std;
using ll = long long;
template<typename T = ll>inline T in() { T ret; cin >> ret; return ret; }

class union_find {
private:
	vector<ll> par, sz, rank;
	ll cnt;
public:
	union_find(ll n) : par(n), sz(n), rank(n)
	{
		cnt = n;
		REP(i, n) {
			par[i] = i;
			sz[i] = 1;
			rank[i] = 0;
		}
	}
	ll find(ll x)
	{
		return par[x] == x ? x : par[x] = find(par[x]);
	}
	void unite(ll x, ll y)
	{
		x = find(x);
		y = find(y);
		if (x != y) {
			if (rank[x] < rank[y]) {
				par[x] = y;
				sz[y] += sz[x];
			} else {
				par[y] = x;
				sz[x] += sz[y];
				if (rank[x] == rank[y]) {
					rank[x]++;
				}
			}
			cnt--;
		}
	}
	bool same(ll x, ll y)
	{
		return find(x) == find(y);
	}
	ll size(ll n)
	{
		return sz[find(n)];
	}
	ll count()
	{
		return cnt;
	}
};

signed main()
{
	ll n = in(), m = in();
	union_find uf(n);
	vector<pair<ll, ll>>path(m);
	REP(i, m) {
		ll a = in() - 1, b = in() - 1;
		path[i] = make_pair(a, b);
	}

	vector<ll>ans(m + 1); ans[m] = n * (n - 1) / 2;
	REPR(i, m) {
		if (!uf.same(path[i].first, path[i].second)) {
			ans[i] = ans[i + 1] - uf.size(path[i].first) * uf.size(path[i].second);
			uf.unite(path[i].first, path[i].second);
		} else {
			ans[i] = ans[i + 1];
		}
	}

	REP1(i, m) {
		cout << ans[i] << endl;
	}
}

Measured memory_bytes: 6016
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<bitset>
#include<deque>
#include<functional>
#include<iterator>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<utility>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define a first
#define b second
#define sz(x) (ll)((x).size())
#define pb push_back
#define mp make_pair
#define bg begin()
#define ed end()
#define all(x) (x).bg,(x).ed
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rep1(i,n) for(ll i=1;i<=(n);i++)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(ll i=(n);i>=1;i--)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
const ll MOD=1000000007;
const ll INF=1000000000000000;
template<class T> inline bool chmin(T& a, T b){if(a>b){a=b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b){if(a<b){a=b;return true;}return false;}
ll maxx(ll x,ll y,ll z){return max(max(x,y),z);}
ll minn(ll x,ll y,ll z){return min(min(x,y),z);}
ll gcd(ll x,ll y){if(x%y==0) return y;else return gcd(y,x%y);}
ll lcm(ll x,ll y){return x*(y/gcd(x,y));}
ll digsz(ll x){if(x==0) return 1;else{ll ans=0;while(x){x/=10;ans++;}return ans;}}
ll digsum(ll x){ll sum=0;while(x){sum+=x%10;x/=10;}return sum;}
vector<ll> pw2(62,1);vector<ll> pw10(19,1);
ll mod_pow(ll x,ll n,ll mod){
    ll res=1;
    while(n>0){
        if(n&1) res=res*x%mod;
        x=x*x%mod;
        n>>=1;
    }
    return res;
}

int main(){
    {rep1(i,61) pw2[i]=2*pw2[i-1];}
    {rep1(i,18) pw10[i]=10*pw10[i-1];}
    
    string s; cin>>s;
    ll ans=0;
    
    //[0] [1] ...... [sz(s)-1]
    // 2   0   .....    9
    
    vector<ll> M(sz(s)+1,0);
    rrep(i,sz(s)){
        M[i]=(M[i+1]+(ll)(s[i]-'0')*mod_pow(10,sz(s)-1-i,2019))%2019;
    }
    
    //[i]~[j]が2019
    // == M[i]-M[j]が2019の倍数
    
    vector<ll> X(2019,0);
    rep(i,sz(M)){
        X[M[i]]++;
    }
    
    rep(i,sz(X)) ans+=(X[i]-1)*X[i]/2;
    cout<<ans<<endl;
}



Measured memory_bytes: 5224
#include <iostream>

int main(void){
    int ans = 0;
    std::string S;
    std::cin >> S;
    int N = S.size();

    for (int i = 1; i < N; ++i){
        std::string s = S.substr(0, N - i);
        int n = s.size();
        if (n % 2 == 0){
            if (s.substr(0, n / 2) == s.substr(n / 2, n / 2)){
                ans = n;
                break;
            }
        }
    }

    std::cout << ans << std::endl;

    return 0;
}


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

#define fst first
#define snd second
#define ll long long
#define ld long double
#define pb push_back
#define emp emplace_back
#define pii pair<int, int>
#define usg unsigned
#define sg signed
#define mp make_pair

using namespace std;

void setIO(){
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
}

const ld PI = 4*atan((ld)1);
const int INF = 1e9+7;
const ll _INF = 1e18+7;


int main(){
	setIO();
	// g > r
	// b > g
	// b > g > r
	int r, g, b, k;
	cin >> r >> g >> b >> k;
	while (g <= r) k--, g*=2;
	while (b <= g) k--, b*=2;
	if (k < 0) cout << "No\n";
	else cout << "Yes\n";
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, j, n) for (ll i = j; i < n; i++)
#define all(x) (x).begin(),(x).end()
#define INF (1000000000)
#define MOD (1000000007)
#define MAX (100000)
#define pii pair<int, int>

/////////////////////////////////////////////////////////

class XY{
public:
  ll x, y;
  XY() {x = y = 0;}
  XY(ll u, ll v) {x = u; y = v;}
};

class e{
public:
  ll a, b;
  e() {a = b = -1;}
  e(ll u, ll v) {a = u; b = v;}
};

template<typename T1, typename T2>
void chmin(T1 &a, T2 b) {if(a > b) a = b;}
template<typename T1, typename T2>
void chmax(T1 &a, T2 b) {if(a < b) a = b;}

template<typename T1, typename T2>
ll mypow(T1 a, T2 n){
  if(n == 0) return 1;
  if(n == 1) return a;
  if(n % 2) return a * mypow(a, n - 1);
  ll tmp = mypow(a, n / 2);
  return tmp * tmp;
}

template<typename T>
int BS(vector<T> V, int left, int right, T key){
  int mid = (left + right) / 2;
  if(V[mid] <= key) left = mid;
  else right = mid;
  if(right - mid == 1) return left;
  else return BS(V, left, right, key);
}

ll comb(ll n, ll r){
	ll res = 1;
  rep(i, 0, r){
    res *= n - i;
    res /= i + 1;
  }
  return res;
}

template<typename T>
T euclid(T a, T b){
  if(b == 0) return a;
  else return euclid(b, a % b);
}

/////////////////////////////////////////////////////////

void Main() {
  string S; cin >> S;
  vector<string> vs;
  string tmp = "";
  rep(i, 0, S.size()){
    if(S.substr(i, 1) == "A"){
      tmp = tmp + "A";
      continue;
    }
    if(i < S.size() - 1){
      if(S.substr(i, 2) == "BC"){
        tmp = tmp + "B";
        i++;
        continue;
      }
    }
    vs.push_back(tmp);
    tmp = "";
  }
  vs.push_back(tmp);

  ll res = 0;
  for(auto s : vs){
    int cnt = 0;
    for(int i = s.size() - 1; i >= 0; i--){
      if(s[i] == 'A'){
        res += s.size() - 1 - i - cnt;
        cnt++;
      }
    }
  }
  cout << res << endl;
}

/////////////////////////////////////////////////////////

int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << std::fixed << std::setprecision(15);

  Main();
}


Measured memory_bytes: 5388
#include <stdio.h>
#include <string.h>
#include <limits.h>

#define N 16
#define MIN(A,B) \
  ( (B) < (A) ? (B) : (A) )

static int k_operafan[ 1 << N ];
static int d[ N ][ N ];
static int b[ N ];
static int n;

static int
dpFSA (
  const int s
  )
{
  int i, j;

  if ( s == 0 ) return ( 0 );

  if ( ~k_operafan[ s ] ) ;
  else
  {
    k_operafan[ s ] = INT_MAX;

    for ( j = 0; j < n; ++j )
    {
      int co = b[ j ];

      if ( !( s & ( 1 << j ) ) ) continue ;

      for ( i = 0; i < n; ++i )
      {
        if ( s & ( 1 << i ) ) continue ;
        co = MIN( co, d[ j ][ i ] );
      }

      k_operafan[ s ] = MIN(
        k_operafan[ s ],
        dpFSA ( s & ~( 1 << j ) ) + co
        );
    }
  }

  return ( k_operafan[ s ] );
}

/** Application main entry point. */
int
main (
  int     argc,
  char  * argv[ ]
  )
{
  int i, j;

  for ( ; ; )
  {
    scanf ( "%d", &n );
    if ( !( n ) ) break ;

    for ( j = 0; j < n; ++j )
    {
      scanf ( "%d", &b[ j ] );
      for ( i = 0; i < n; ++i )
      {
        scanf ( "%d", &d[ j ][ i ] );
      }
    }
    
    memset ( k_operafan, -1, sizeof ( k_operafan ) );
    printf ( "%d\n", dpFSA ( ( 1 << n ) - 1 ) );
  }

  return ( 0 );
}

Measured memory_bytes: 668
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
int main()
{
    int n;

    cin >> n;
    
    int a, b, c;
    
    a = (n - n % 100) / 100;
    b = (n - (n - n % 100) - n % 10) / 10;
    c = n % 10;
    
    if (a == 1) a = 9;
    else a = 1;
    if (b == 1) b = 9;
    else b = 1;
    if (c == 1) c = 9;
    else c = 1;
    
    cout << a * 100 + b * 10 + c << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 1000001;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

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

ll lcm(ll a, ll b) {
	return a / gcd(a, b) *b;
}

struct edge {
	ll ind;
	ll to;
	ll d;
};


///////////////////////////


int main() {

	ll N, K;
	cin >> N >> K;

	vector<ll> l(N + 1);
	repn(i, N) cin >> l[i];
	
	sort(++l.begin(), l.end(), greater<ll>());

	ll ans = 0;

	repn(i, K) ans += l[i];

	cout << ans;

	system("PAUSE");

}


Measured memory_bytes: 504
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define FORD(i,a,b) for(int i=a;i>=b;i--)
#define FORL(i,x) for(int i=head[x];i;i=nxt[i])
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define PB push_back
#define MP make_pair
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }



int main() {
  int a,b;
  cin >> a >> b;
  if(a>9 || b>9){
    cout << -1 << endl;
  }
  else{
    cout << a*b << endl;
  }

}



Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int x[100000], y[100000], n, mx, my; bool unused[100000];
int solve(int lx, int ly, int rx, int ry) {
	for (int i = 0; i < n; i++)unused[i] = false;
	for (int i = 0; i < n; i++) {
		if (lx <= x[i] && x[i] <= rx && ly <= y[i] && y[i] <= ry)unused[i] = true;
	}
	int ex = 1000000, ey = 1000000, sx = 0, sy = 0;
	for (int i = 0; i < n; i++) { if (unused[i] == false) { ex = min(ex, x[i]); ey = min(ey, y[i]); sx = max(sx, x[i]); sy = max(sy, y[i]); } }
	return max(sx - ex, sy - ey);
}
bool solve(int r) {
	return (solve(0, 0, r, r) <= r || solve(0, my - r, r, my) <= r || solve(mx - r, 0, mx, r) <= r || solve(mx - r, my - r, mx, my) <= r);
}
int main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> x[i] >> y[i]; int r1 = x[i] - y[i], r2 = x[i] + y[i]; x[i] = r1; y[i] = r2; mx = min(mx, x[i]); my = min(my, y[i]);
	}
	for (int i = 0; i < n; i++) { x[i] -= mx; y[i] -= my; }mx = 0; my = 0;
	for (int i = 0; i < n; i++) { mx = max(mx, x[i]); my = max(my, y[i]); }
	int L = 0, R = 1000000, M;
	while (true) {
		M = (L + R) / 2; bool U1 = solve(M - 1), U2 = solve(M);
		if (U1 == false && U2 == true) { cout << M << endl; break; }
		if (U1 == true)R = M;
		if (U2 == false)L = M;
	}
	return 0;
}

Measured memory_bytes: 3928
#include <cstdio>
#include <string>
#include <iostream>
#include <math.h>
 
 
using namespace std;
#define ASCII 48
 
int log_(int a, int b, int c = 0) {
	if (a <= b)return c;
	b *= 2;
	c++;
	log_(a, b, c);
}
 
 
int main() {
	int N, K;
	cin >> N >> K;
 
	double dice = 0;
 
	double allSum = 0;
	for (int i = 0; i < N; i++) {
		dice = (double)i + 1;
		int count = log_(K, dice);
		allSum += (1.0 / (double)N) * pow(1.0 / 2.0, (double)count);
	}
 
	printf("%.12f\n", allSum);
 
	return 0;
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.util.NoSuchElementException;
import java.io.InputStream;

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

    static class BCraneAndTurtle {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int x = in.nextInt();
            int y = in.nextInt();
            String ans = "No";
            for (int i = 0; i <= x; i++) {
                if ((i * 4) + ((x - i) * 2) == y) {
                    ans = "Yes";
                    break;
                }
            }

            out.println(ans);
        }

    }

    static class Scanner {
        private final InputStream in;
        private final byte[] buffer;
        private int ptr;
        private int buflen;

        public Scanner(InputStream in) {
            this.in = in;
            this.buffer = new byte[1024];
            this.ptr = 0;
            this.buflen = 0;
        }

        private boolean hasNextByte() {
            if (ptr < buflen) return true;
            else {
                ptr = 0;
                try {
                    buflen = in.read(buffer);
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (buflen <= 0) return false;
            }
            return true;
        }

        private byte readByte() {
            if (hasNextByte()) return buffer[ptr++];
            return -1;
        }

        private boolean isPrintableChar(byte c) {
            return '!' <= c && c <= '~';
        }

        private void skipUnprintable() {
            while (hasNextByte() && !isPrintableChar(buffer[ptr])) {
                ptr++;
            }
        }

        public boolean hasNext() {
            skipUnprintable();
            return hasNextByte();
        }

        public int nextInt() {
            if (!hasNext()) throw new NoSuchElementException();
            int n = 0;
            boolean minus = false;
            byte b = readByte();
            if (b == '-') {
                minus = true;
                b = readByte();
            }
            if (b < '0' || '9' < b) throw new NumberFormatException();
            while (true) {
                if ('0' <= b && b <= '9') {
                    n *= 10;
                    n += b - '0';
                } else if (b == -1 || !isPrintableChar(b)) {
                    return minus ? -n : n;
                } else {
                    throw new NumberFormatException();
                }
                b = readByte();
            }
        }

    }
}



Measured memory_bytes: 25516
#include <stdio.h>
#include <math.h>

int main(){

int arr[3], min1, min2, min3, min;
scanf("%d %d %d", arr, arr+1, arr+2);

min1=abs(arr[2]-arr[1])+abs(arr[1]-arr[0]);
min2=abs(arr[2]-arr[0])+abs(arr[1]-arr[0]);
min3=abs(arr[2]-arr[0])+abs(arr[2]-arr[1]);

min=(min1>min2?min2:min1);
min=(min>min3?min3:min);

printf("%d", min);

}

Measured memory_bytes: 128
/**
 *      purpose : 
 *      author  : 𝒌𝒚𝒐𝒎𝒖𝒌𝒚𝒐𝒎𝒖𝒑𝒖𝒓𝒊𝒏
 *      created : 
**/

#include <iostream>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <complex>
#include <numeric>
#include <bitset>
#include <cassert>
#include <cctype>
#include <functional>
#include <iomanip>
#include <random>
#include <utility>

using namespace std;

using int64 = long long;
#define debug(_) cerr << #_ << ": " << (_) << '\n'
template<typename T> inline void chmin(T &a, T b) { if (a > b) a = b; return; }
template<typename T> inline void chmax(T &a, T b) { if (a < b) a = b; return; }
template<typename T> ostream& operator<<(ostream& os, const vector<T>& vec) { os << '{'; for (size_t i = 0; i < vec.size(); ++i) { os << vec[i]; if (i != vec.size() - 1) os << ','; } os << '}'; return os; }
template<typename T, typename U> ostream& operator<<(ostream& os, const pair<T, U>& p) { return os << '{' << p.first << " " << p.second << '}'; }

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

  int n; cin >> n;
  vector<int> order(n);
  iota(order.begin(), order.end(), 0);

  vector<double> x(n), y(n);
  for (int i = 0; i < n; ++i) cin >> x[i] >> y[i];

  double ans = 0;

  do {
    double t = 0;
    for (int i = 0; i < n - 1; ++i) {
      t += hypot(x[order[i]] - x[order[i + 1]], y[order[i]] - y[order[i + 1]]);
    }
    ans += t;

  } while (next_permutation(order.begin(), order.end()));

  double fac = 1;
  for (int i = 1; i <= n; ++i) {
    fac *= static_cast<double>(i);
  }

  ans /= fac;

  cout << setprecision(15) << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<ll>;
using vs = vector<string>;
#define  rep(i,n) for(ll i = 0; i < (n); ++i)
#define  red(i,n) for(ll i = (n)-1; i >= 0; --i)
#define  all(a)   begin(a),end(a)
#define  pb(a)    push_back(a)
#define  yn(a)    cout << ( (a)?"Yes\n":"No\n" );
inline ll gcd(ll a,ll b) { return b?gcd(b,a%b):a; }
const ll INF = 1e9+9, LINF = 1e18;

int main()
{
    ll n,x=0,mi=INF;
    string s;
    cin>>n>>s;
    ll a[n]={0},b[n]={0};
    rep(i,n){
        a[i]=x;
        if(s[i]=='W')x++;
    }
    x=0;
    red(i,n){
        b[i]=x;
        if(s[i]=='E')x++;
    }
    rep(i,n)mi=min(a[i]+b[i],mi);
    cout<<mi<<endl;
    
    return 0;
}


Measured memory_bytes: 5380
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>

using namespace std;
typedef long long ll;

long long GCD(long long x, long long y)
{
    if (y == 0)
        return x;
    else
        return GCD(y, x % y);
}

int main()
{
    ll n;
    cin >> n;
    vector<ll> a(n);
    vector<int> memo(1000005);
    for (ll i = 0; i < n; i++)
    {
        cin >> a[i];
        memo[a[i]]++;
    }
    string anstext1 = "pairwise coprime";
    string anstext2 = "setwise coprime";
    string anstext3 = "not coprime";
    vector<ll> gcc_acc(n + 1);
    bool flagA = true;

    for (int i = 2; i < 1000005; i++)
    {
        ll cnt = 0;
        for (int j = i; j < 1000005; j += i)
        {
            cnt += memo[j];
        }
        if (cnt > 1)
        {
            flagA = false;
            break;
        }
    }

    for (ll i = 0; i < n; i++)
    {
        gcc_acc[i + 1] = GCD(a[i], gcc_acc[i]);
        if (i == 0)
            continue;
    }
    string anstext;
    if (flagA)
    {
        anstext = anstext1;
    }
    else
    {
        if (gcc_acc[n] == 1LL)
        {
            anstext = anstext2;
        }
        else
        {
            anstext = anstext3;
        }
    }
    cout << anstext << endl;
    return 0;
}

Measured memory_bytes: 22728