akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/adaptor/indexed.hpp>

using namespace std;
using namespace boost::adaptors;
using namespace std::string_literals;
using ll = int64_t;
using vecint = vector<int>;
using vecll = vector<ll>;
using boost::irange;

using T = tuple<ll,ll>;
T dfs1(const vector<vecint>& g, vector<T>& dp, ll m, int i, int p=-1) {
  ll already = 0;
  ll now = 1;
  for(auto&& to:g[i]) {
    if (to == p) continue;
    ll x,y;
    tie(x,y) = dfs1(g, dp, m, to, i);
    already += x + y;
    already %= m;
    now *= y + 1;
    now %= m;
  }
  dp[i] = make_tuple(already, now);
  return make_tuple(already, now);
}

void dfs2(const vector<vecint>& g, vector<T>& dp, vecll& ans, ll alp, ll nwp, ll m, int i, int p=-1) {
  ll already = alp;
  int n=g[i].size();
  vecll tmp1, tmp2;
  tmp1.push_back((alp + nwp) % m);
  tmp2.push_back((nwp + 1) % m);
  for(int j=n-1; j>=0; --j) {
    int to = g[i][j];
    if(to == p) continue;
    ll alc, nwc;
    tie(alc, nwc) = dp[to];
    already += alc;
    already %= m;
    ll nx1 = (tmp1.back() + (alc + nwc)) % m;
    tmp1.push_back(nx1);
    ll nx2 = tmp2.back() * (nwc + 1) % m;
    tmp2.push_back(nx2);
  }
  tmp1.pop_back();
  tmp2.pop_back();
  boost::reverse(tmp1);
  boost::reverse(tmp2);
  ll res = (alp + nwp) % m;
  ll ppal = 0;
  ll ppnw = 1;
  int cnt=0;
  for(auto&& j:irange(0,n)) {
    int to = g[i][j];
    if(to == p) continue;
    ll alc, nwc;
    tie(alc, nwc) = dp[to];
    ll tmp = (alc + nwc) % m;
    res += tmp;
    res %= m;
    ll alx = (ppal + tmp1[cnt]) % m;
    ll nwx = ppnw * tmp2[cnt] % m;
    dfs2(g, dp, ans, alx, nwx, m, to, i);
    ppal += alc + nwc;
    ppal %= m;
    ppnw *= nwc + 1;
    ppnw %= m;
    ++cnt;
  }
  ans[i] = res;
}

int main()
{
  ll n,m;
  cin>>n>>m;
  vector<vecint> g(n);
  for(auto&& i:irange(0l,n-1)) {
    int x,y;
    cin>>x>>y;
    --x;--y;
    g[x].push_back(y);
    g[y].push_back(x);
  }
  vector<T> dp1(n);
  ll x,y;
  tie(x,y) = dfs1(g, dp1, m, 0);
  vecll dp2(n);
  dfs2(g, dp1, dp2, 0, 0, m, 0);
  ll total = (x+y) % m;
  for(auto&& e:dp2) {
    cout<<(total+m-e)%m<<endl;
  }
  return 0;
}


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

using ll = long long;
using ull = unsigned long long;
using st = string;
using ch = char;
using db = double;
using bl = bool;
using vll = vector<long long>;
using vdb = vector<db>;
using vst = vector<st>;
using vch = vector<char>;
using vbl = vector<bl>;
using vvll = vector<vll>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;
using vvpll = vector<vpll>;
#define rep(i, m, n) for (ll i = (ll)(m); i < (ll)(n); i++)
#define vrep(i, vec) for(auto& i : vec)
#define vin(vec) for(auto& i : vec) cin >> i
#define all(v) v.begin(), v.end()
#define mkp(a, b) make_pair(a, b) 
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;}
const ll mod = 1000000007;
const ll inf = 1LL << 60;
const db pi = acos(-1.0L);

int main() {
  st s;
  cin >> s;
  cout << s.substr(0, 3) << endl;
}


Measured memory_bytes: 3628
;; -*- coding: utf-8 -*-
(eval-when (:compile-toplevel :load-toplevel :execute)
  (sb-int:defconstant-eqx OPT
    #+swank '(optimize (speed 3) (safety 2))
    #-swank '(optimize (speed 3) (safety 0) (debug 0))
    #'equal)
  #+swank (ql:quickload '(:cl-debug-print :fiveam) :silent t)
  #-swank (set-dispatch-macro-character
           ;; enclose the form with VALUES to avoid being captured by LOOP macro
           #\# #\> (lambda (s c p) (declare (ignore c p)) `(values ,(read s nil nil t)))))
#+swank (cl-syntax:use-syntax cl-debug-print:debug-print-syntax)
#-swank (disable-debugger) ; for CS Academy

;; BEGIN_INSERTED_CONTENTS
(declaim (inline read-schar))
(defun read-schar (&optional (stream *standard-input*))
  (declare #-swank (sb-kernel:ansi-stream stream)
           (inline read-byte))
  #+swank (read-char stream nil #\Newline) ; on SLIME
  #-swank (code-char (read-byte stream nil #.(char-code #\Newline))))

(defmacro dbg (&rest forms)
  #+swank
  (if (= (length forms) 1)
      `(format *error-output* "~A => ~A~%" ',(car forms) ,(car forms))
      `(format *error-output* "~A => ~A~%" ',forms `(,,@forms)))
  #-swank (declare (ignore forms)))

(defmacro define-int-types (&rest bits)
  `(progn
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "UINT~A" b)) () '(unsigned-byte ,b))) bits)
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "INT~A" b)) () '(signed-byte ,b))) bits)))
(define-int-types 2 4 7 8 15 16 31 32 62 63 64)

(declaim (inline println))
(defun println (obj &optional (stream *standard-output*))
  (let ((*read-default-float-format* 'double-float))
    (prog1 (princ obj stream) (terpri stream))))

(defconstant +mod+ 1000000007)

;;;
;;; Body
;;;

(defun main ()
  (declare #.OPT)
  (let* ((h (read))
         (w (read))
         (dp (make-array 1001 :element-type 'uint31 :initial-element 0)))
    (declare (uint16 h w))
    (setf (aref dp 1) 1)
    (dotimes (_ h)
      (loop for x from 1 to w
            do (setf (aref dp x)
                     (if (char= #\. (read-schar))
                         (let ((sum (+ (aref dp x) (aref dp (- x 1)))))
                           (if (>= sum +mod+)
                               (- sum +mod+)
                               sum))
                         0)))
      (read-schar))
    (println (aref dp w))))

#-swank (main)


Measured memory_bytes: 22372
#[allow(unused_imports)]
use std::char::*;
#[allow(unused_imports)]
use std::cmp::*;
use std::io::*;
use std::str::FromStr;

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

#[derive(PartialEq, PartialOrd)]
pub struct Total<T>(pub T);

impl<T: PartialEq> Eq for Total<T> {}

impl<T: PartialOrd> Ord for Total<T> {
    fn cmp(&self, other: &Total<T>) -> std::cmp::Ordering {
        self.0.partial_cmp(&other.0).unwrap()
    }
}

//const MAX:usize = 100006;
//const INF:u64 = u64::max_value();

fn main() {
    let r:u32 = read();

    println!("{}", 3*r.pow(2));

    
}

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

typedef long long int llint;

int main()
{
  llint x, y;
  cin>> x >> y;

  llint cnt = 0;
  for(llint i = x; i <= y; i *= 2) {
    cnt++;
  }

  cout<< cnt <<endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
#include <string.h>
using namespace std;

int main() {
	bool flag = true;
	int N, M, ans = 0, a[50] = {}, b[50] = {}, C[50] = {}, k = 0;
	cin >> N >> M;
	for (int i = 0; i < M; i++)
	{
		cin >> a[i] >> b[i];
		C[a[i]-1]++;
		C[b[i]-1]++;
	}
	while (flag)
	{
		flag = false;
		for (int i = 0; i < N; i++)
		{
			if (C[i]==1)
			{
				flag = true;
				C[i] = 0;
				ans++;
				k = i;
				break;
			}
		}
		for (int i = 0; i < M; i++)
		{
			if (a[i] == k + 1)
			{
				C[b[i] - 1]--;
			}
			if (b[i] == k + 1)
			{
				C[a[i] - 1]--;
			}
		}
	}
	/*for (int i = 0; i < N; i++)
	{
		if (C[i]<=0)
		{
			
		}
	}*/
	cout << ans;
	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 repr(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)

int main(){
  string s;
  string t;
  bool ans=false;
  cin>>s;
  cin>>t;
  rep(i,s.size()){
    s=s.back()+s.substr(0,s.size()-1);
    if(s==t){
      ans=true;
    }

  }
  if(ans==1){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static final int BIG_NUM = 2000000000;
	public static final int MOD = 1000000007;

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int V = sc.nextInt();
		int E = sc.nextInt();

		int min_dist[][] = new int[V][V];

		for(int i = 0; i < V; i++){
			for(int k = 0; k < V; k++){
				if(i == k){
					min_dist[i][k] = 0;
				}else{
					min_dist[i][k] = BIG_NUM;
				}
			}
		}

		int from,to,cost;

		for(int loop = 0; loop < E; loop++){
			from = sc.nextInt();
			to = sc.nextInt();
			cost = sc.nextInt();

			min_dist[from][to] = Math.min(min_dist[from][to],cost);
		}

		for(int mid = 0; mid < V; mid++){
			for(int start = 0; start < V; start++){
				if(min_dist[start][mid] == BIG_NUM)continue;
				for(int goal = 0; goal < V; goal++){
					if(min_dist[mid][goal] == BIG_NUM)continue;
					min_dist[start][goal] = Math.min(min_dist[start][goal], min_dist[start][mid]+min_dist[mid][goal]);
				}
			}
		}


		boolean FLG = true;

		for(int i = 0; i < V; i++){
			if(min_dist[i][i] < 0){
				FLG = false;
				break;
			}
		}

		if(!FLG){System.out.println("NEGATIVE CYCLE");
			return;
		}

		StringBuilder ans = new StringBuilder();

		for(int i = 0; i < V; i++){
			if(min_dist[i][0] != BIG_NUM){

				ans.append(Integer.toString(min_dist[i][0]));
			}else{
				ans.append("INF");
			}
			for(int k = 1; k < V; k++){
				if(min_dist[i][k] != BIG_NUM){

					ans.append(" ").append(Integer.toString(min_dist[i][k]));
				}else{
					ans.append(" ").append("INF");
				}
			}
			ans.append("\n");
		}
		System.out.print(ans.toString());
	}
}




Measured memory_bytes: 59936
#include <stdio.h>
#define MAX 10000
#define NIL -1

struct NODE{
  int p,left,right;
};
struct NODE Tree[MAX];
int n;

void inorder(int);
void preorder(int);
void postorder(int);
  int main(){
  int i,j,v,l,r,root=0;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    Tree[i].p=NIL;
  }
  for(i=0;i<n;i++){
    scanf("%d%d%d",&v,&l,&r);
       Tree[v].left=l;
    Tree[v].right=r;
    if(l!=NIL)Tree[l].p=v;
    if(r!=NIL)Tree[r].p=v;
  }
  for(i=0;i<n;i++){
    if(Tree[i].p==NIL)root=i;
  }

  printf("Preorder\n");
  preorder(root);
    printf("\n");
      printf("Inorder\n");
  inorder(root);
  printf("\n");
  printf("Postorder\n");
  postorder(root);
  printf("\n");
  return 0;
}
void preorder(int x){
  if(x==NIL)return;
  printf(" %d",x);
  preorder(Tree[x].left);
  preorder(Tree[x].right);
}
void inorder(int x){
  if(x==NIL)return;
  inorder(Tree[x].left);
  printf(" %d",x);
  inorder(Tree[x].right);
}
void postorder(int x){
      if(x==NIL)return;
  postorder(Tree[x].left);
  postorder(Tree[x].right);
  printf(" %d",x);
}



Measured memory_bytes: 2096
# ABC133 D - Rain Flows into Dams
si = lambda: input()
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

N = ni()
A = nl()

A_even = []
M = [0]*N

for i in range(N):
    if i%2 == 1:
        A_even.append(A[i])

M[0] = sum(A)-2*sum(A_even)

for i in range(N-1):
    M[i+1]=2*A[i]-M[i]

print(*M)


Measured memory_bytes: 14148
#include <bits/stdc++.h>
using namespace std;
 
int main(){
 long n;
  cin >> n;
  double x[n+10];
  string u[n+10];
  for (int i=0;i<n;i++){
  cin >> x[i] >> u[i];
  }
  
  double ans = 0;
  
  for (int i=0;i<n;i++){
  if (u[i] == "BTC") {
    ans += 380000.0*x[i];
  }
else {
  ans += x[i];
}
  }
  cout << ans << endl;
}

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

using namespace std;
using LL = long long;
using P = pair<int, int>;

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

#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

const int INF = (int)1e9;
const LL INFL = (LL)1e18;
const int MOD = (int)1e9 + 7;

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

    string s;
    cin >> s;

    if(s[0] == s[s.size()-1]){
        if(s.size() % 2 == 0){
            cout << "First" << endl;
        }else{
            cout << "Second" << endl;
        }
    }else{
        if(s.size() % 2 == 0){
            cout << "Second" << endl;
        }else{
            cout << "First" << endl;
        }
    }
}

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

int main() {
  int x ;
  cin >> x;
  vector<pair<int, int>> A;
  for (int i = 1; i <= x; i++)
  {
    int a;
    cin >> a;
    A.push_back(make_pair(a, i));
  }
  sort(A.begin(), A.end());
for (int i = 0; i < x; i++)
{
  cout << A[i].second << " " ;
}
cout << endl;
  
  return 0;
}

Measured memory_bytes: 1780
import heapq

L, R = map(int, input().split())

if R - L >= 2019:
    print(0)
else:
    answer = 5000
    for i in range(L, R + 1):
        for j in range(i + 1, R + 1):
            if (i * j) % 2019 < answer:
                answer = (i * j) % 2019
    print(answer)

Measured memory_bytes: 40556
program panasonic2020C
    implicit none
    integer(8)::a,b,c
    read*,a,b,c
    if(c-a-b>=0.and.4*a*b<(c-a-b)**2)then
        print'(A)',"Yes"
    else
        print'(A)',"No"
    end if
end program panasonic2020C

Measured memory_bytes: 256
class UnionFind:
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def root(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.root(self.parents[x])
            return self.parents[x]

    def unite(self, x, y):
        rx = self.root(x)
        ry = self.root(y)
        if rx == ry:
            return
        if self.parents[x] > self.parents[y]:
            rx, ry = ry, rx
        self.parents[rx] += self.parents[ry]
        self.parents[ry] = rx

    def same(self, x, y):
        rx = self.root(x)
        ry = self.root(y)
        return rx == ry

    def size(self, x):
        return -self.parents[self.root(x)]

    def group_size(self):
        return {i: -v for i, v in enumerate(self.parents) if v < 0}

n, m = map(int, input().split())
uf = UnionFind(n)
for _ in range(m):
    a, b = map(lambda x: int(x)-1, input().split())
    uf.unite(a, b)
print(max(uf.group_size().values()))


Measured memory_bytes: 31500
#include <iostream>
#include <cstring>
#include <stdlib.h>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <math.h>
#include <string>
#include <map>
#include <cstdlib>
#include <sstream>
#include <bitset>
using namespace std;

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


class UnionFind {
public:
	//親の番号を格納する。親だった場合は-(その集合のサイズ)
	vector<int> Parent;
 
	//作るときはParentの値を全て-1にする
	//こうすると全てバラバラになる
	UnionFind(int N) {
		Parent = vector<int>(N, -1);
	}
 
	//Aがどのグループに属しているか調べる
	int root(int A) {
		if (Parent[A] < 0) return A;
		return Parent[A] = root(Parent[A]);
	}
 
	//自分のいるグループのノード数を調べる
	int size(int A) {
		return -Parent[root(A)];//親をとってきたい]
	}
 
	//AとBをくっ付ける
	bool connect(int A, int B) {
		//AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
		A = root(A);
		B = root(B);
		if (A == B) {
			//すでにくっついてるからくっ付けない
			return false;
		}
 
		//大きい方(A)に小さいほう(B)をくっ付けたい
		//大小が逆だったらひっくり返しちゃう。
		if (size(A) < size(B)) swap(A, B);
 
		//Aのサイズを更新する
		Parent[A] += Parent[B];
		//Bの親をAに変更する
		Parent[B] = A;
 
		return true;
	}
};


int main()
{
    int N,M,K;
    cin >> N >> M >> K;
    UnionFind Uni(N);
    vector<int> neg(N,1);
    for(int i=0,a,b; i<M; i++){
        cin >> a >> b;
        a--;b--;
        neg[a]++;
        neg[b]++;
        Uni.connect(a,b);
    }
    for(int i=0,c,d; i<K; i++){
        cin >> c >> d;
        c--;d--;
        if(Uni.root(c)==Uni.root(d)){
            neg[c]++;
            neg[d]++;
        }
    }
    for(int i=0; i<N; i++){
        cout << Uni.size(i)-neg[i];
        if(i!=N) cout << " ";
    }
    cout << endl;



    return 0;
}

Measured memory_bytes: 3896
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<sstream>
#include<vector>
using namespace std;
using uint = unsigned int;
using ll = long long;
const int M = 1e9 + 7;
const ll MLL = 1e18L + 9;
#pragma unused(M)
#pragma unused(MLL)
#ifdef LOCAL
#include"basic.hpp"
#else
template <class... T> void printl(T&&...){ }
template <class... T> void printc(T&&...){ }
template <class... T> void prints(T&&...){ }
#endif

int main(){
    int x, y;
    cin >> x >> y;
    int diff = abs(abs(y) - abs(x));
    int ans;
    if(x == y){
        ans = 0;
    }else if(x < y){
        ans = y - x;
        if(x < 0 && y > 0){
            ans = min(ans, 1 + diff);
        }
    }else{
        if(x > 0 && y > 0){
            ans = min(x + y + 1, 2 + diff);
        }else if(x < 0 && y < 0){
            ans = 2 + diff;
        }else{
            ans = 1 + diff;
        }
    }
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rrep(i,n) for(int (i)=((n)-1);(i)>=0;(i)--)
#define itn int
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
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; }
const long long INF = 1LL << 60;
const int MOD = 1000000007;
signed main(void){
    int n,m; cin>>n>>m;
    vector <int> a(n); 
    rep(i,n) cin>>a[i];
    sort(a.begin(),a.end());
    reverse(a.begin(),a.end());
    priority_queue <int> pq;
    rep(i,n){
        pq.push(a[i]);
    }
    while(m){
        int tmp = pq.top(); pq.pop();
        tmp /=2;
        m--;
        pq.push(tmp);
    }
    int ans = 0;
    while(!pq.empty()){
        ans += pq.top(); pq.pop();
    }
    cout<<ans<<endl;
}


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

using namespace std;
#define rep_i(i, n) for (int i = 0; i < (n); ++i)
#define rep_ll(i, n) for (long long i = 0; i < (n); ++i)
#define r_rep_i(i, start, end) for (int i = (start); i < (end); ++i)
#define r_rep_ll(i, start, end) for (long long i = (start); i < (end); ++i)
#define debug_vi(v) copy((v).begin(), (v).end(), ostream_iterator<int>(cout, " "));
#define debug_vll(v) copy((v).begin(), (v).end(), ostream_iterator<long long>(cout, " "));
#define debug_vd(v) copy((v).begin(), (v).end(), ostream_iterator<double>(cout, " "));
#define sort_v(v) sort((v).begin(), (v).end()); //昇順
#define d_sort_vi(v) sort((v).begin(), (v).end(), greater<int>()); //降
#define d_sort_vd(v) sort((v).begin(), (v).end(), greater<double>()); //昇順
#define say(t) cout << (t) << endl;
#define sum_vi(v) accumulate((v).begin(), (v).end(), 0);
#define sum_vll(v)accumulate((v).begin(), (v).end(), 0LL);

int main(){
  int n;cin >> n;
  vector<int> nums(n);
  rep_i(i, n){
    cin >> nums[i];
  }
  int m;
  cin >> m;
  vector<int> nums2(m);
  rep_i(i, m){
    cin >> nums2[i];
  }
//   sort_v(nums);
//   sort_v(nums2);

  rep_i(i, min(n, m)){
    // if(nums[i] == 0 && nums2[i] != 0){
    //   say(0);
    //   return 0;
    // }
    if(nums[i] < nums2[i]){
      say(1);
      return 0;
    }
    if(nums[i] > nums2[i]){
      say(0);
      return 0;
    }
  }
  if(nums.size() < nums2.size()){
    say(1);
    return 0;
  }
  say(0);
}


Measured memory_bytes: 3116
#include <bits/stdc++.h>
using namespace std;
using int64 = long long;
#define int int64
#define rep(i, n) for(int i=0; i<n; i++)
#define FOR(i, a, b) for(int i=a; i<b; i++)
#define SORT(x) sort(x.begin(), x.end())
#define GSORT(x) sort(x.begin(), x.end(), greater<int>())
#define mk make_pair
#define fi first
#define se second
#define pb push_back
#define ALL(x) x.begin(), x.end()
#define V(T) vector<T>
typedef pair<int, int> P;
typedef pair<P, P> PP;
typedef vector<int> vi;
typedef vector<vi> vvi;
int max(int a, int b) {if(b>a) return b; else return a;}
int min(int a, int b) {if(b<a) return b; else return a;}


signed main() {
    string s;
    cin >> s;
    
    if(s[0]==s[1] && s[1]==s[2]) cout << "Yes";
    else if(s[1]==s[2] && s[2]==s[3]) cout << "Yes";
    else cout << "No";
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <array>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <tuple>
#include <bitset>
#include <memory>
#include <cmath>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <numeric>
#include <climits>
#include <cfloat>

bool search(const int state, const int last, const std::vector<std::string> &dominos, std::vector<std::vector<char>>& memo) {
	if (state == memo[last].size() - 1) return true;
	if (memo[last][state] >= 0) return memo[last][state] == 1;
	memo[last][state] = 0;
	for (auto i = 0; i < dominos.size(); ++i) if ((state & (1 << i)) == 0) {
		if (dominos[i].front() - '0' == last) {
			auto res = search(state | (1 << i), dominos[i].back() - '0', dominos, memo);
			if (res) {
				memo[last][state] = 1;
				return true;
			}
		}
		if (dominos[i].back() - '0' == last) {
			auto res = search(state | (1 << i), dominos[i].front() - '0', dominos, memo);
			if (res) {
				memo[last][state] = 1;
				return true;
			}
		}
	}
	return false;
}

int main() {
	int n;
	while (std::cin >> n) {
		std::vector<std::string> dominos(n); for (auto& domino : dominos) std::cin >> domino;
		std::vector<std::vector<char>> can_make(10, std::vector<char>(1 << n, -1));
		auto can = false;
		for (auto i = 0; i < n; ++i) {
			if (search(1 << i, dominos[i].back() - '0', dominos, can_make)) {
				std::cout << "Yes\n";
				can = true;
				break;
			}
			if (search(1 << i, dominos[i].front() - '0', dominos, can_make)) {
				std::cout << "Yes\n";
				can = true;
				break;
			}
		}
		if (!can) std::cout << "No\n";
	}
}




Measured memory_bytes: 5692
/*
 ▓█████▄  ▄████▄  ▓██   ██▓ ██▓███   ██░ ██ ▓█████  ██▀███
▒██▀ ██▌▒██▀ ▀█   ▒██  ██▒▓██░  ██▒▓██░ ██▒▓█   ▀ ▓██ ▒ ██▒
 ░██   █▌▒▓█    ▄   ▒██ ██░▓██░ ██▓▒▒██▀▀██░▒███   ▓██ ░▄█ ▒
 ░▓█▄   ▌▒▓▓▄ ▄██▒  ░ ▐██▓░▒██▄█▓▒ ▒░▓█ ░██ ▒▓█  ▄ ▒██▀▀█▄
 ░▒████▓ ▒ ▓███▀ ░  ░ ██▒▓░▒██▒ ░  ░░▓█▒░██▓░▒████▒░██▓ ▒██▒
  ▒▒▓  ▒ ░ ░▒ ▒  ░   ██▒▒▒ ▒▓▒░ ░  ░ ▒ ░░▒░▒░░ ▒░ ░░ ▒▓ ░▒▓░
  ░ ▒  ▒   ░  ▒    ▓██ ░▒░ ░▒ ░      ▒ ░▒░ ░ ░ ░  ░  ░▒ ░ ▒░
  ░ ░  ░ ░         ▒ ▒ ░░  ░░        ░  ░░ ░   ░     ░░   ░
    ░    ░ ░       ░ ░               ░  ░  ░   ░  ░   ░
  ░      ░         ░ ░
*/
//focus less on how much problem you should solve within a fixed time and focus more on getting the problem solved and
//learning something from it
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#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 ll long long int
#define ld long double
#define vi vector<ll>
#define vii vector <pair<ll,ll> >
#define sedes set <ll, greater <ll> >
#define seasc set <ll>
#define pb push_back
#define mkp make_pair
#define ff first
#define ss second
#define MOD 1000000007
#define prec(n) fixed<<setprecision(n)
#define maxpq priority_queue<int>
#define minpq priority_queue<int, vector<int>, greater<int> >
#define umap unordered_map<ll, ll>
#define map map<ll, ll>
#define autoit(x,it) for(auto it = x.begin(); it != x.end(); it++)
#define mems(a, i) memset(a, i, sizeof(a))
#define endl '\n'
#define all(v) v.begin(),v.end()
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
#define printx(x) printf("%lld\n",x);
#define printxy(x,y) cout << x << y <<endl;
#define printxyz(x,y,z) cout << x << y << z <<endl;
#define deba(a) cout << #a << a << endl;
#define debab(a,b) cout << #a << a << #b << b << endl;
int main()
{
	fast;
#ifndef ONLINE_JUDGE
	freopen("/home/kushagra/Desktop/Kushagra/input.txt", "r", stdin);
	freopen("/home/kushagra/Desktop/Kushagra/output.txt", "w", stdout);
#endif
	ll n, d, cnt = 0;
	cin >> n >> d;
	while (n--)
	{
		double x, y;
		cin >> x >> y;
		double d1 = pow(x, 2) + pow(y, 2);
		double d2 = sqrt(d1);
		// deba(d2);
		if (d2 <= d)
			cnt++;
	}
	cout << cnt;
	return 0;
}

Measured memory_bytes: 3824
use proconio::{
   fastout, input,
   marker::{Bytes, Chars, Isize1, Usize1},
};

fn main() {
   input! {
      k:usize,
      s:Chars,
   }
   if s.len() > k {
      for i in 0..k {
         print!("{}", s[i]);
      }
      println!("...");
   } else {
      for i in &s {
         print!("{}", i);
      }
      println!("");
   }
}


Measured memory_bytes: 2152
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second

const int mx=100010;
const ll mod=1e9+7;

int main(){
  int h,w;
  cin >> h >> w;
  vector<vector<int>> d(h, vector<int>(w));
  rep(i,h)rep(j,w){
    cin>>d[i][j];
  }

  vector<pair<P,P>> a;
  rep(i,h)rep(j,w-1){
    if(d[i][j]%2==0) continue;
    a.push_back({{i,j},{i,j+1}});
    d[i][j]--;
    d[i][j+1]++;
  }
  rep(i,h-1){
    if(d[i][w-1]%2==0) continue;
    a.push_back({{i,w-1},{i+1,w-1}});
    d[i][w-1]--;
    d[i+1][w-1]++;
  }

  cout << a.size() << endl;
  for(auto it:a){
    cout << it.F.F+1 << " " << it.F.S+1 << " " << it.S.F+1 << " " << it.S.S+1 << endl;
  }

  return 0;
}

Measured memory_bytes: 5232
#include<iostream>
using namespace std;
int main()
{
  int N,M;
  cin>>N>>M;
  int L[M],R[M];
  for(int i=0;i<M;i++){
    cin>>L[i]>>R[i];
  }
  int tmp_min=R[0];
  int tmp_max=L[0];
  
  for(int i=1;i<M;i++){
    tmp_min=tmp_min<R[i] ? tmp_min:R[i];
    tmp_max=tmp_max>L[i] ? tmp_max:L[i];
  }
  if(tmp_max<=tmp_min){
    cout<<tmp_min-tmp_max+1;
  }
  else{
    cout<<0;
  }
}

Measured memory_bytes: 1024
#!python3.8
# -*- coding: utf-8 -*-
# abl/abl_a
import sys

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [i2s() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    K = i2n()
    print('ACL' * K)
    return

main()


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

#define irep(i,n)  for(int i=0;i<(n);i++)
#define irepy(i,n) for(int i=1;i<=(n);i++)
#define jrep(j,n)  for(int j=0;i<(n);j++)
#define jrepy(j,n) for(int j=1;i<=(n);j++)

int main(){
  int a,b;
  cin >> a >> b;
  if(a>=10 || b>=10){
    cout << "-1" <<endl;
    return 0;
  }
  cout << a*b <<endl;
  
  return 0;


}


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

int main() {
	int n;
	scanf("%d", &n);
	for (int i = 1; i <= n; i++)
		for (int j = i + 1; j <= n; j++)
			printf("%d%c", __builtin_ctz(i ^ j) + 1, " \n"[j == n]);
	return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <vector>

using namespace std;

int main() {
  int n = 0;
  cin >> n;
  vector<int> in(n);
  vector<bool> check(n, false);
  for (int i=0; i<n; i++) {
    cin >> in.at(i);
    in.at(i)--;
  }
  int count = 0;
  int now = 0;
  check.at(0) = true;
  while (true) {
  	now = in.at(now);
    count++;
    if (now == 1) {
      cout << count << endl;
      return 0;
    }
    else if (check.at(now)) {
      cout << -1 << endl;
      return 0;
    }
    check.at(now) = true;
  }
  return 0;
}


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

int main(){
  int x;
  cin >> x;
  vector<ll> vec(250);
  rep(i,240){
    ll sum = 1;
    rep(j,5) sum *= (i - 120);
    vec.at(i) = sum;
  }
  rep(i,240)rep(j,240){
    if (x == vec.at(i) - vec.at(j)){
      printf("%d %d\n", i - 120, j - 120);
      return 0;
    }
  }
  cout << "error" << endl;
  return 0;
}


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

int a,b;


int main()
{
    scanf("%d %d",&a,&b);
    double x = (a+b)*1.0/2;
    if(x == (int)x)
        printf("%d\n",(int)x);
    else
        printf("IMPOSSIBLE\n");
    return 0;
}


Measured memory_bytes: 256
def has_duplicates(seq):
    return len(seq) != len(set(seq))

if __name__ == '__main__':
    N = input()
    A = list(map(int, input().split()))
    if(has_duplicates(A)==True):#重複アリ
        print("NO")
    elif(has_duplicates(A)==False):#重複ナシ
        print("YES")

Measured memory_bytes: 27204
#include<bits/stdc++.h>
#define rep(i,j,k) for(int i=(j);i<(k);i++)
#define mp make_pair
#define sz(a) (int)(a).size()
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<double,double> pdd;
typedef long double ld;
//----head----
const int N=100005;
vector<int> V[N];
int dp[N],dep[N],father[N];
int dfs(int a,int fa,int deep)
{
	father[a]=fa;
	dep[a]=deep;
	int ans=1;
	rep(i,0,sz(V[a]))
	{
		int nex=V[a][i];
		if(nex==fa)continue;
		ans+=dfs(nex,a,deep+1);
	}
	return dp[a]=ans;
}
int main()
{
	int n;
	scanf("%d",&n);
	rep(i,1,n)
	{
		int a,b;
		scanf("%d%d",&a,&b);
		V[a].pb(b);
		V[b].pb(a);
	}
	dfs(1,-1,-1);
	int po=n;
	int step=dep[n]/2;
	while(step--)po=father[po];
	puts(dp[1]-dp[po]>dp[po]?"Fennec":"Snuke");
	return 0;
}


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

using namespace std;

int main(void) {
  int N; cin >> N;
  int subNum[N];

  memset(subNum, 0, sizeof(subNum));

  for (int i = 0; i < N-1; ++i) {
    int a; cin >> a;
    subNum[a-1]++;
  }

  for (int i = 0; i < N; i++) {
    cout << subNum[i] << endl; 
  }

  return 0;
}

Measured memory_bytes: 4416
from sys import exit, stderr, stdin
input = stdin.readline
# setrecursionlimit(10**7)

def debug(var, name="hoge"):
    print(name +":" + str(type(var)) + " = " + repr(var), file=stderr)
    return


def main():
    A, B = [int(n) for n in input().split()]
    print(max(A-B, A+B, A*B))



if __name__ == "__main__":
    main()


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

int main() {
	string S, K = "keyence";
	bool check = false;
	cin >> S;
	for (int i = 0; i <= 7; i++) {
		if (S.substr(0, i) == K.substr(0, i) && S.substr(S.size() - 7 + i, 7 - i) == K.substr(i, 7 - i)) {
			check = true;
		}
	}
	if (check) cout << "YES" << endl;
	else cout << "NO" << endl;
}

Measured memory_bytes: 256
# import math
# import statistics
a=input()
#b,c=int(input()),int(input())
c=[]
for i in a:
   c.append(i)
# e1,e2 = map(int,input().split())
#f = list(map(int,input().split()))
#g = [input() for _ in range(a)]
count=0
if "AC" in a :
    print("Yes")
else:
    print("No")

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

int k, n, a[1001], ans;

int main(void) {
    cin >> n >> k;
    for (int i=0; i<n; ++i)
        cin >> a[i];
    sort(a, a+n);
    for (int i=0; i<k; ++i)
        ans+=a[i];
    cout << ans << '\n';
}


Measured memory_bytes: 3640
#define rep(i, a, b) for(int i = a; i < (int)(b); i++)
#include <bits/stdc++.h>

typedef long long ll;
using namespace std;
template<class T> inline void chmax(T &a, const T &b) {if(a < b) a = b;}
template<class T> inline void chmin(T &a, const T &b) {if(a > b) a = b;}
const long long INF = 1LL<<60;
const long long MOD = (ll)1e9+7;
const long long MAX = (ll)1e5+100;


int main(void) {
   ll A,B;
   cin>>A>>B;
   ll Ans[100][100];
   ll now = 0;
   while(1) {
      if (A==1) break;
      rep(j,0,100)Ans[now][j] = 0;
      now++;
      rep(j,0,100)Ans[now][j] = 0;
      rep(j,0,min((ll)50,A-1)) Ans[now][2*j] = 1;
      A -= min((ll)50,A-1);
      now++;
   }
   rep(j,0,100)Ans[now][j] = 0;
   now++;

   while(1) {
      if (B==1) break;
      rep(j,0,100)Ans[now][j] = 1;
      now++;
      rep(j,0,100)Ans[now][j] = 1;
      rep(j,0,min((ll)50,B-1)) Ans[now][2*j] = 0;
      B -= min((ll)50,B-1);
      now++;
   }
   rep(j,0,100)Ans[now][j] = 1;
   now++;
   cout<<now<<" "<<100<<endl;
   rep(i,0,now) {
      rep(j,0,100) {
         if (Ans[i][j]) cout<<'.';
         else cout<<'#';
      }
      cout<<endl;
   }


   return 0;
}

Measured memory_bytes: 256
f = input().rstrip().split()
stack = []
for i in f:
    if i == "+":
        l = len(stack)
        a = stack.pop(l - 2) + stack.pop(l - 2)
        stack.append(a)
    elif i == "-":
        l = len(stack)
        a = stack.pop(l - 2) - stack.pop(l - 2)
        stack.append(a)
    elif i == "*":
        l = len(stack)
        a = stack.pop(l - 2) * stack.pop(l - 2)
        stack.append(a)
    else:
        j = int(i)
        stack.append(j)
print(stack[0])


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

int main() {
int a,b;
cin >> a>> b;

 char c[a+b+1];

for(int i = 0;i < a+b+1;i++){
  cin >> c[i];
  }

bool ans = true;
 for(int i = 0;i < a+b+1;i++){
  if(i == a&&c[i]!='-'){
    ans = false;
    }

  else if(i != a&&c[i] < '0'||c[i] >'9'){
   ans = false;
    }
 }  

 if(ans){
  cout << "Yes" <<endl;
 } 
 else{
  cout << "No" <<endl;
 }
}

Measured memory_bytes: 256
a,b,c,x,y = map(int,input().split())
if x < y:
    big = b
    dd = y-x
else:
    big = a
    dd = x-y


sol_1 = a*x + b*y
sol_2 = c*min(x,y)*2 + big*dd
sol_3 = c*max(x,y)*2
print(min(sol_1,sol_2,sol_3))

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define FOR(i, n) for(ll i = 0; i < n; i++)
#define FORR(i, n) for(ll i = n; i >= 0; i--)
#define FORS(i, m, n) for(int i = m;i < n;i++)
#define ALL(v) accumulate(v.begin(),v.end(),0)
#define SORT(v) sort(v.begin(),v.end())
#define OUT(n) (cout << n << endl)
#define IN1(a) (cin >> a)
#define IN2(a,b) (cin >> a >> b)
#define IN3(a,b,c) (cin >> a >> b >> c)
#define IN4(a,b,c,d) (cin >> a >> b >> c >> d)
using namespace std;
typedef long long ll;

int main(){
  ll n,ans=0;
  string ss;
  IN1(n);
  FORS(i,1,n+1){
    ss = to_string(i);
    if ((ss.size()) % 2 == 1)
    {
      ans++;
    }
    
  }
  OUT(ans);
}

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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

int dy[]={-1,0,1,0};
int dx[]={0,-1,0,1};


const int INF=1001001001;

int H,W;
char fld[55][55];

int dist[55][55];

signed main(){
    cin>>H>>W;
    rep(i,H)cin>>fld[i];

    fill_n(*dist,55*55,INF);
    dist[0][0]=0;

    queue<pint>que;
    que.push({0,0});
    while(que.size()){
        int y,x;
        tie(y,x)=que.front();
        que.pop();
        rep(d,4){
            int ny=y+dy[d];
            int nx=x+dx[d];
            if(ny<0||ny>=H||nx<0||nx>=W||fld[ny][nx]=='#'||dist[ny][nx]!=INF)continue;
            dist[ny][nx]=dist[y][x]+1;
            que.push({ny,nx});
        }
    }

    int ans=dist[H-1][W-1];
    if(ans==INF){
        cout<<-1<<endl;
        return 0;
    }


    int cnt=0;
    rep(i,H)rep(j,W)if(fld[i][j]=='.')cnt++;

    cout<<cnt-ans-1<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<set>
#include<map>

#define INF 1000000007
#define LINF 1000000000000000007

using namespace std;

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

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

Int lcm(Int x, Int y){
	return x * y / gcd(x, y);
}

Int x, y;

int main(){
	cin >> x >> y;
	int c = 0;
	for(Int i = x; i <= y; i *= 2){
		c++;
	}
	
	cout << c << endl;
	
	return 0;
}

Measured memory_bytes: 256
# include <bits/stdc++.h>
 
using namespace std;
 
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
    ~debug() { cerr << endl; }
    eni(!=) cerr << boolalpha << i; ris; }
    eni(==) ris << range(begin(i), end(i)); }
    sim, class b dor(pair < b, c > d) {
    ris << "(" << d.first << ", " << d.second << ")";
    }
    sim dor(rge<c> d) {
    *this << "[";
    for (auto it = d.b; it != d.e; ++it)
        *this << ", " + 2 * (it == d.b) << *it;
    ris << "]";
    }
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
 
# define forn(i, n) for (ll i = 0; i < int(n); i++)
# define rfor(n, i) for (ll i = (n - 1); i >= 0; --i)
# define all(V) V.begin(), V.end()
# define rall(V) V.rbegin(), V.rend()
# define len(V) (int)V.size()
# define ll long long
# define ld long double
# define ff first
# define ss second
# define pb push_back
# define mp make_pair
# define endl '\n'
# define M_PI 3.14159265358979323846

const int MAX_N = 100;
vector<int> xy(MAX_N);
 
void solve()
{
        ll n, k; cin >> n >> k;
        if(k == 1) cout << 0;
        else
        {
                ll p = n % k;
                cout << min(abs(p - k), p);
        }
        
        //cout << __gcd(n, k);
}
 
int main()
{
        ios_base::sync_with_stdio(0);
        cin.tie(0);
        cout.tie(0);
        solve();
}

Measured memory_bytes: 3664
import functools

import os

INF = float('inf')


def inp():
    return int(input())


def inpf():
    return float(input())


def inps():
    return input()


def inl():
    return list(map(int, input().split()))


def inlf():
    return list(map(float, input().split()))


def inls():
    return input().split()


def inpm(line):
    return [inp() for _ in range(line)]


def inpfm(line):
    return [inpf() for _ in range(line)]


def inpsm(line):
    return [inps() for _ in range(line)]


def inlm(line):
    return [inl() for _ in range(line)]


def inlfm(line):
    return [inlf() for _ in range(line)]


def inlsm(line):
    return [inls() for _ in range(line)]


def debug(fn):
    if not os.getenv('LOCAL'):
        return fn

    @functools.wraps(fn)
    def wrapper(*args, **kwargs):
        print('DEBUG: {}({}) -> '.format(
            fn.__name__,
            ', '.join(
                list(map(str, args)) +
                ['{}={}'.format(k, str(v)) for k, v in kwargs.items()]
            )
        ), end='')
        ret = fn(*args, **kwargs)
        print(ret)
        return ret

    return wrapper


a, b = inl()
print('Possible' if (a + b) % 3 == 0 or a%3==0 or b%3==0 else 'Impossible')


Measured memory_bytes: 3572
#include<bits/stdc++.h>
#define rep(i,n) for (int i=0; i<n; i++)
#define REP(i,x,n) for (int i=x; i<n; i++)
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
using ll = long long;
const int mod =1'000'000'007;

int main(){
    double a, b;
    cin >> a >> b;
    
    rep(i,1300){
        int x, y;
        x = i * 0.08;
        y = i * 0.1;
        if (x == a && y == b){
            cout << i << endl;
            return 0;
        }
    }
    cout << -1 << endl;
    return 0;
}


Measured memory_bytes: 3696
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF=1e18,MOD=1e9+7;
const int iINF=1e9;
int main(){
    ll ans=0,n,p_b=0,p_c=0,sum_b=0;
    cin>>n;
    vector<ll>a(n),b(n),c(n),cnt_b(n);
    for(int i=0;i<n;i++)cin>>a[i];
    for(int i=0;i<n;i++)cin>>b[i];
    for(int i=0;i<n;i++)cin>>c[i];
    sort(a.begin(),a.end());
    sort(b.begin(),b.end());
    sort(c.begin(),c.end());
    for(int i=0;i<n;i++){
        while(p_c<n&&b[i]>=c[p_c])p_c++;
        cnt_b[i]=n-p_c;
    }
    for(int i=n-1;i>0;i--){
        cnt_b[i-1]+=cnt_b[i];
    }
    for(int i=0;i<n;i++){
        while(p_b<n&&a[i]>=b[p_b])p_b++;
        ans+=cnt_b[p_b];
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3328
#include<cstdio>
#include<algorithm>
using namespace std;

#define MAXN 100000
int N;
int A[MAXN+5],cnt[2][MAXN+5];

int main(){
    scanf("%d",&N);
    for(int i=1;i<=N;i++)
        scanf("%d",A+i);
    for(int i=1;i<=N;i++)
        cnt[i%2][A[i]]++;
    int c1=0,c2=0;
    for(int i=1;i<=MAXN;i++){
        if(cnt[0][i]>cnt[0][c1])
            c1=i;
        if(cnt[1][i]>cnt[1][c2])
            c2=i;
    }
    if(c1!=c2)
        printf("%d",N-cnt[0][c1]-cnt[1][c2]);
    else{
        int tmp1=0,tmp2=0;
        for(int i=1;i<=MAXN;i++){
            if(i!=c1)
                tmp1=max(tmp1,cnt[0][i]);
            if(i!=c2)
                tmp2=max(tmp2,cnt[1][i]);
        }
        printf("%d",min(N-cnt[0][c1]-tmp2,N-cnt[1][c2]-tmp1));
    }
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; ++i)
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define ALL(vec) vec.begin(), vec.end()
#define rALL(vec) vec.rbegin(), vec.rend()
using namespace std;
using ll = long long;

int main() {
    int N, M, X;
    cin >> N >> M >> X;
    vector<vector<int>> vec(N, vector<int>(M + 1));
    rep(i, N) rep(j, M + 1) cin >> vec[i][j];
    int ans = 1e9;
    for (int bit = 0; bit < (1 << N); ++bit) {
        vector<int> tmp(M);
        int sum = 0;
        bool flag = true;
        for (int i = 0; i < N; ++i) {
            if (bit & (1 << i)) {
                rep(j, M) {
                    tmp[j] += vec[i][j + 1];
                }
                sum += vec[i][0];
            }
        }
        rep(i, M) if (tmp[i] < X) flag = false;
        if (flag) ans = min(ans, sum);
    }
    if (ans == 1e9) ans = -1;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define sf scanf
#define pf printf
#define pb push_back
#define mp make_pair
#define PI ( acos(-1.0) )
#define mod 1000000007
#define maxn 100005
#define IN freopen("C.in","r",stdin)
#define OUT freopen("output.txt","w",stdout)
#define FOR(i,a,b) for(i=a ; i<=b ; i++)
#define DBG pf("Hi\n")
#define INF 1000000000
#define i64 long long int
#define eps (1e-8)
#define xx first
#define yy second
#define ln 17
#define off 2

using namespace __gnu_pbds;
using namespace std ;

typedef tree< i64, null_type, less<i64>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

i64 a[55] ;

int main()
{
    i64 i , j , k , l , m , n ;

    scanf("%lld",&n) ;

    for(i=1 ; i<=50 ; i++) a[i] = 49 + n/50 ;

    k = n%50 ;

    for(i=1 ; i<=50-k ; i++) a[i] -= k ;

    for(i=50-k+1 ; i<=50 ; i++) a[i] = a[i] + 50 - (k-1) ;

    printf("50\n") ;

    for(i=1 ; i<=50 ; i++){
        printf("%lld",a[i]) ;
        if(i==50) printf("\n") ;
        else printf(" ") ;
    }

    return 0 ;
}


Measured memory_bytes: 256
//هوالحق
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> PII;
typedef long long ll;

template<typename T>
T In() {
   T x;
   cin >> x;
   return x;
}

int main() {
   ios::sync_with_stdio(false), cin.tie(nullptr);
   int n = In<int>(), m = In<int>();
   multiset<int> S;
   for(int i = 0; i < n; i++) S.insert(-In<int>());
   for(int i = 0; i < m; i++){
      int p = *S.begin();
      S.erase(S.begin());
      S.insert(p / 2);
   }
   ll r = 0;
   for(auto i : S) r -= i;
   cout << r;
   return cout << endl, 0;
}

Measured memory_bytes: 4992
#include <iostream>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <algorithm>
#include <climits>
using namespace std;

void solve(string s)
{
    set<string> answer;
    answer.insert(s);

    for(unsigned i=1; i<s.size(); ++i){
        string s1 = s.substr(0, i);
        string s2 = s.substr(i);
        string sr1 = s1;
        string sr2 = s2;
        reverse(sr1.begin(), sr1.end());
        reverse(sr2.begin(), sr2.end());
        answer.insert(s1 + sr2);
        answer.insert(sr1 + s2);
        answer.insert(sr1 + sr2);
        answer.insert(s2 + s1);
        answer.insert(s2 + sr1);
        answer.insert(sr2 + s1);
    }

    reverse(s.begin(), s.end());
    answer.insert(s);

    cout << answer.size() << endl;
}

int main()
{
    int n;
    cin >> n;
    for(int i=0; i<n; ++i){
        string s;
        cin >> s;
        solve(s);
    }
}

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

using ll = long long;
using ull = unsigned long long;

const double PI = acos(-1);
const int inf = 2e9;
const ll INF = 2e18;
const ll MOD = 1e9+7;

#define sz(s) (s).size()
#define pb push_back
#define fi first
#define se second
#define REP(i,n) for (int i = 0; i<n; i++)
#define ALL(a) begin(a), end(a)

int main (void) {
    string s,t;
    cin>>s>>t;
    if (s.size() < t.size()) {
        cout<<"UNRESTORABLE"<<endl;
        return 0;
    }

    reverse(ALL(s));
    reverse(ALL(t));
    bool restorable = false;
    string ans = s;
    REP(i,s.size()-t.size()+1) {
        int l = i, r = i+t.size()-1;
        bool exchange = true;

        for (int j=0,k=l;j<t.size();j++,k++) {
            if (t[j] != s[k] && s[k] != '?') {
                exchange = false;
                break;
            }
        }
        if (exchange) {
            for (int j=0,k=i;j<t.size();j++,k++) {
                if (s[k] == '?') ans[k] = t[j];
            }

            restorable = true;
            break;
        }
    }

    if (!restorable) {
        cout<<"UNRESTORABLE"<<endl;
        return 0;
    }

    reverse(ALL(ans));
    REP(j,ans.size()) {
        if (ans[j] == '?') ans[j] = 'a';
    }

    cout<<ans<<endl;

    return 0;
}

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

void dfs(int i, vector<int>& V, unordered_map<int, unordered_map<int, long long>>& E){
    for(auto itr = E[i].begin(); itr != E[i].end(); ++itr){
        int k = itr->first;
        long long w = itr->second;
        if (V[k] >= 0) continue;
        if (w % 2 == 1) V[k] = 1 - V[i];
        else V[k] = V[i];
        dfs(k, V, E);
    }
}

int main(){
    int n;
    cin >> n;
    int u, v;
    long long w;
    unordered_map<int, unordered_map<int, long long>> E;
    for(int i = 0; i < n - 1; i++){
        cin >> u >> v >> w;
        E[u][v] = w;
        E[v][u] = w;
    }
    vector<int> V(n + 1, -1);
    V[1] = 0;
    dfs(1, V, E);
    for (int i = 1; i <= n; i++) cout << V[i] << endl;
}


Measured memory_bytes: 22308
#include<stdio.h>
int main(){
  int A, B, P, Q;
    
  scanf("%d",&A);
  scanf("%d",&B);
   P = (A*3)+B;
  
  if((P % 2) == 0)
    printf("%d",P/2);
  else{
    Q = (P-1)/2;
    printf("%d",Q);
  }
}

Measured memory_bytes: 128
from collections import defaultdict

n, m = map(int, input().split())
py = []
lst = [[] for _ in range(n)]
for _ in range(m):
    tmp = list(map(int, input().split()))
    py.append((tmp[0], tmp[1]))
    lst[tmp[0] - 1].append(tmp[1])
dic = {}
for i, l in enumerate(lst):
    l.sort()
    for j, num in enumerate(l):
        dic[(i + 1, num)] = "{:06}".format(i + 1) + "{:06}".format(j + 1)
for l in py:
    print(dic[l])


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

int main() {
    cin.tie(nullptr); ios::sync_with_stdio(false);
    int n; cin >> n;
    vector<int> a(n);
    rep(i,n)cin >> a[i];
    rep(i,n)a[i]-=i+1;
    vector<int> c = a;
    sort(a.begin(),a.end());
    int b;
    if (a.size()%2 == 1)b =  a[n/2];
    else b = (a[n/2] + a[n/2-1])/2;
    ll ans = 0;
    rep(i,n){
        ans += abs(a[i]-b);
    }
    cout << ans << endl;
}

Measured memory_bytes: 1792
using System;
using System.IO;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Numerics;
using System.Threading.Tasks;
using System.Text.RegularExpressions;
using static System.Math;
using MethodImplOptions = System.Runtime.CompilerServices.MethodImplOptions;
using MethodImplAttribute = System.Runtime.CompilerServices.MethodImplAttribute;

static class P
{
    static void Main()
    {
        var ni = Console.ReadLine().Split().Select(int.Parse).ToArray();
        Console.WriteLine(ni[0] - ni[1] + 1);
    }
}


Measured memory_bytes: 13396
N = int(input())
Ai = list(map(int, input().split()))

flag = False
for i in Ai:
  if i % 2 == 0:
    if i % 3 == 0 or i % 5 == 0:
      continue
    else:
      flag = True
      print('DENIED')
      break

if(not flag):
  print('APPROVED')

Measured memory_bytes: 2940