akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

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

    while (true) {
      a = scanner.nextInt();
      b = scanner.nextInt();
      if (a == 0 && b == 0) break;
      for (int i = 0; i < a; ++i) {
        for (int j = 0; j < b; ++j) System.out.printf("#");
        System.out.println();
      }
      System.out.println();
    }
  }
}


Measured memory_bytes: 57868
N,X,Y = map(int,input().split())

# L[距離]　組の数を格納する
L = [0 for _ in range(N)]

# i,j の間の最短距離 d 
for i in range(1,N):
    for j in range(i+1,N+1):
        d = min( abs(j-i), abs(X-j) + 1 + abs(Y-i), abs(Y-j) + 1 + abs(X-i))
        L[d] += 1

for k in range(1,N):
    print(L[k])

Measured memory_bytes: 3444
#include<stdio.h>
int main(void)
{
	int n,a,b;
	scanf("%d",&n);
	scanf("%d",&a);
	scanf("%d",&b);
	char s[n];
	scanf("%s",s);
	int i,w=0;
	int f=0;
	for(i=0;i<n;i++){
		if(s[i]=='c')
			printf("No\n");
		else if(s[i]=='a'){
			if(w<a+b){
				printf("Yes\n");
				w++;
			}
			else{
				printf("No\n");
			}
		}
		else{
			f++;
			if(w<a+b && f<=b){
				printf("Yes\n");
				w++;
			}
			else{
				printf("No\n");
			}
		}
	}
	return 0;
}

Measured memory_bytes: 640
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <stack>
#include <vector>

using namespace std;

using Pair = pair<int, int>;
using lint = long long;

// const int mod = 1e9 + 7;
// const int mod = 998244353;

template <typename T> vector<T> make_v(size_t a) { return vector<T>(a); }

template <typename T, typename... Ts> auto make_v(size_t a, Ts... ts) {
  return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
#include <utility>
#include <vector>
struct UnionFind {
  std::vector<int> par, siz;
  void init(int n) {
    par.resize(n);
    for (int i = 0; i < n; i++)
      par[i] = i;
    siz.resize(n, 1);
  }
  UnionFind(int n) {
    init(n);
  }
  int root(int n) {
    if (par[n] == n)
      return n;
    else
      return par[n] = root(par[n]);
  }
  bool issame(int x, int y) {
    return (root(x) == root(y));
  }
  bool marge(int a, int b) {
    if (issame(a, b))
      return false;
    else {
      a = root(a), b = root(b);
      if (siz[a] < siz[b]) std::swap(a, b);
      siz[b] += siz[a];
      par[a] = par[b];
      return true;
    }
  }
  int size(int n) {
    return siz[root(n)];
  }
};
#define rep(i, n) for (int i = 0; i < (n); i++)
int main(){
  int n;
  cin>>n;
  int m;
  cin>>m;
  UnionFind uf(n);
  rep(i,m){
    int a,b;
    cin>>a>>b;
    uf.marge(a-1,b-1);
  }
  int ret=0;
  rep(i,n)ret=max(ret,uf.size(i));
  cout<<ret<<endl;
}


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

int main(){
bool a[1000001]{};
a[0]=a[1]=true;
for(int b=2;b<1000001;b++){
	if(!a[b]){
		for(int c=b*2;c<1000001;c+=b)a[c]=true;
	}
}
int x,y;
while(scanf("%d%d",&x,&y),x|y){
	bool u[1000000]{};
	u[0]=true;
	int p;
	for(int g=0;g<x;g++){
		scanf("%d",&p);
		for(int q=p;q<=y;q++)if(u[q-p])u[q]=true;
	}
	for(int h=y;h!=-1;h--){
		if(u[h]&&a[h]==false){printf("%d\n",h);break;}
		if(h==0)printf("NA\n");
	}
}
}

Measured memory_bytes: 5052
#include <iostream>

using namespace std;

int num[10001];

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

    int n;
    int cnt = 0;

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

    for (int i = 0; i < n; i++) {
        while (num[i] % 2 == 0) {
            num[i] /= 2;
            cnt++;
        }
    }

    cout << cnt;

    return 0;
}

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

int main(){

  int a,b,c,d;
  cin >> a >> b >> c >> d;
 if( (abs(b - a) <= d)&&(abs(c - b) <=  d) || (abs(c - a)<= d) ){
  cout << "Yes" << endl;}

  else{
 cout << "No"<< endl;
}
 return 0;
}

Measured memory_bytes: 256
using System;

namespace ConsoleApplication17
{
    class Program
    {
        static void Main(string[] args)
        {
            int a,b; 
            string[] str = Console.ReadLine().Split(' '); 
            a = int.Parse(str[0]);
            b = int.Parse(str[1]); 
            Console.WriteLine( a * b + " " + 2*(a + b));
         }
     }
    
}

Measured memory_bytes: 9032
s = input()
t = input()

ans = "UNRESTORABLE"

i = 0

while i < len(s)-len(t)+1:
    if s[i] == t[0] or s[i] == "?":
        flag = True
        for j in range(1,len(t)):
            if s[i+j] == "?" or s[i+j] == t[j]:
                continue
            else:
                flag = False
                break
        if flag:
            tmps = ""
            k = 0
            while k < len(s):
                if k < i or k >= i+len(t):
                    if s[k] == "?":
                        tmps += "a"
                        k += 1
                    else:
                        tmps += s[k]
                        k += 1
                else:
                    tmps += t
                    k += len(t)
            ans = tmps
    i += 1

print(ans)



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

using namespace std;

#define INF 1000000007
#define LINF (1LL << 60)
#define PI 3.14159265358979

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

inline i64 mod(i64 a, i64 m) { return (a % m + m) % m; }

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



int n, t[101], d[101], v[101];
int sp[40404];
void solve(){
	cin >> n;
	for(int i = 1; i <= n; ++i){
		cin >> t[i];
		t[i] *= 2;
		d[i] = d[i-1]+t[i];
	}
	for(int i = 1; i <= n; ++i){
		cin >> v[i];
		v[i] *= 2;
		fill(sp+d[i-1], sp+d[i], v[i]); //max
	}
	
	for(int i = 1; i <= n; i++){
		if(v[i] > v[i-1]){
			for(int j = d[i-1]; j < d[i]; ++j){
				chmin(sp[j], v[i-1]+j-d[i-1]);
			}
		}
		if(v[i] > v[i+1]){
			for(int j = d[i+1]; j >= d[i]; --j){
				chmin(sp[j], v[i+1]+d[i+1]-j);
			}
		}
	}
	for(int i = 1; i < 40000; ++i){
		chmin(sp[i], sp[i-1]+1);
	}
	for(int i = 40000; i > 0; --i){
		chmin(sp[i], sp[i+1]+1);
	}
	
	i64 ans = 0;
	for(int i = 1; i < 40000; i++){
		ans += sp[i];
		
	}
	printf("%.10f\n", ans/4.0);
}

int main(){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	int t = 1;
	//cin >> t;
	while(t--){
		solve();
	}
	
	return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <cstdint>
#include <vector>
#include <algorithm>

template <size_t N>
struct FenwickTree {
	uint32_t vals[N + 1];
	FenwickTree() { 
		for (uint32_t i = 0;i <= N;i++) {
			vals[i] = 0;
		}
	}

	uint32_t query(uint32_t i) {
		uint32_t ans = 0;
		for (i++;i > 0;i -= i & (-i)) {
			ans += vals[i];
		}
		return ans;
	}

	void update(uint32_t i) { 
		for (i++;i <= N;i += i & (-i)) {
			vals[i]++;
		}
	}
};

FenwickTree<666> leftEnds;

struct Segment {
	uint32_t l, r;
	uint32_t ind;

	friend bool operator< (const Segment &a, const Segment &b) {
		return a.r < b.r;
	}
};

std::vector<Segment> updates;
std::vector<Segment> queries;

void input() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(nullptr);
	uint32_t n, m, q;
	std::cin >> n >> m >> q;

	updates.resize(m);
	for (uint32_t i = 0;i < m;i++) {
		std::cin >> updates[i].l >> updates[i].r;
		updates[i].ind = i;
		updates[i].l--;
		updates[i].r--;
	}

	queries.resize(q);
	for (uint32_t i = 0;i < q;i++) {
		std::cin >> queries[i].l >> queries[i].r;
		queries[i].ind = i;
		queries[i].l--;
		queries[i].r--;
	}

	std::sort(updates.begin(), updates.end());
	std::sort(queries.begin(), queries.end());
}

int main() {
	input();
	uint32_t uInd = 0;
	std::vector<uint32_t> ans;
	ans.resize(queries.size());

	for (uint32_t i = 0;i < queries.size();i++) {
		while ((uInd < updates.size()) && (updates[uInd].r <= queries[i].r)) {
			leftEnds.update(updates[uInd++].l);
		}
		ans[queries[i].ind] = uInd - leftEnds.query(queries[i].l - 1);
	}
	for (uint32_t i : ans) {
		std::cout << i << "\n";
	}

}


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

typedef long long ll;
const ll mod=1e9+7;
const int N=200000;

void Run()
{
     ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
}
ll a[N],s,res,f;
map<char,ll>mp;
vector<ll>v;
int main()
{
    Run();
    int x,y;
    cin>>x>>y;
    if(y%2==0)
    {
        if(4*x>=y&&y>=2*x)
        {
            cout<<"Yes";
            return 0;
        }
    }
    cout<<"No";
}


Measured memory_bytes: 3660
n = int(raw_input())
T, a = map(int, raw_input().split())
h = map(int, raw_input().split())

def avgt(t, x):
	return t - x * 0.006

res = 10000000.00
idx = 0
for i in xrange(n):
	val = avgt(T, h[i])
	if abs(val - a*1.00) < res:
		res = abs(val-a)
		idx = i
print idx+1


Measured memory_bytes: 2692
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <functional>
using namespace std;

#define Rep(b, e, i) for(int i = b; i <= e; i++)
#define rep(n, i) Rep(0, n-1, i)

typedef long long ll;
typedef pair<ll, ll> llP;
typedef pair<int, int> intP;
typedef std::priority_queue<int> IntPrioQueue; //Z->A
typedef std::priority_queue<int, std::vector<int>, std::greater<int> > IntReversePrioQueue; //A->Z

const int MAX = 20000;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<31-1;
const int MOD = 1000000007;

//dp[i番目まで][w以下] := 価値の最大値　
ll dp[128][MAX];
vector <int> wei, val;
void solve(void){
    int N, W;
    cin >> N >> W;
    rep(N, i) {
        int v, w; cin >> v >> w;
        val.push_back(v);
        wei.push_back(w);
    }
    rep(N, i) Rep(0, W, j) {
        if (wei[i] <= j) {
            dp[i+1][j] = max(dp[i][j], dp[i][j-wei[i]] + val[i]);
        }
        else dp[i+1][j] = dp[i][j];
    }
    cout << dp[N][W] << '\n';
}

int main(void){
  solve();
  return 0;
}



Measured memory_bytes: 11328
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,s,n) for(int i=(s); i<(n); i++)
#define all(v) v.begin(),v.end()
#define outve(v) for(auto i : v) cout << i << " ";cout << endl
#define outmat(v) for(auto i : v){for(auto j : i) cout << j << " ";cout << endl;}
#define in(n,v) for(int i=0; i<(n); i++){cin >> v[i];}
#define out(n) cout << (n) << endl
#define fi first
#define se second
#define pb push_back
#define mod 1000000007
#define infi 1900000000
#define infl 1100000000000000000
#define cyes cout << "Yes" << endl
#define cno cout << "No" << endl
#define csp << " " <<
#define outset(n) cout << fixed << setprecision(n);
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
template<typename T> using ve = vector<T>;
template<typename T> using pq2 = priority_queue<T>;
template<typename T> using pq1 = priority_queue<T,vector<T>,greater<T>>;




int main()
{

    int N;
    cin >> N;
    string s,t;
    cin >> s >> t;
    int ans = N*2;
    rep(i,N){
        if(s.substr(i,N-i) == t.substr(0,N-i)){
            ans = 2*N-(N-i);
            break;
        }
    }
    
    cout << ans << endl;
    
    
    
    

    return 0;
}


Measured memory_bytes: 256
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    l=[]
    n=int(input())
    s=input()
    imamade=0
    cnt=0
    for i in range(n):
        if s[i]!=imamade:
            cnt+=1
            imamade=s[i]
    print(cnt)
resolve()


Measured memory_bytes: 3316
def resolve():
    n = int(input())
    ans = 10 ** 9
    for i in range(1, n):
        a, b = i, n - i
        sa = sum([int(d) for d in str(a)])
        sb = sum([int(d) for d in str(b)])
        if sa + sb < ans:
            ans = sa + sb
    print(ans)


if __name__ == "__main__":
    resolve()


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

typedef struct node{
  int parent, left, right;
}Node;

Node T[MAX];
int depth[MAX];
int height[MAX];

int seekroot(int id){
    while (T[id].parent != NIL){
        id = T[id].parent;
    }
    return id;
}

void setDepth(int id, int d){
    depth[id] = d;
    if (T[id].left != NIL){
        setDepth(T[id].left, d+1);
    }
    if (T[id].right != NIL){
        setDepth(T[id].right, d+1);
    }
    return;
}

int SetHeight(int id){
    int h1, h2;
    h1 = h2 = 0;
    if (T[id].left != NIL){
        h1 = SetHeight(T[id].left) + 1;
    }
    if (T[id].right != NIL){
        h2 = SetHeight(T[id].right) + 1;
    }

    height[id] = max(h1, h2);
    return height[id];
}

int main(){
    int n;
    cin >> n;
    rep(i, n){
        T[i].parent = NIL;
        T[i].left = NIL;
        T[i].right = NIL;
        depth[i] = NIL;
        height[i] = NIL;
    }

    int id;
    int l;
    int r; 

    rep(i, n){
        cin >> id >> l >> r;
        if (l != -1){
            T[id].left = l;
            T[l].parent = id;
        }
        if (r != -1){
            T[id].right = r;
            T[r].parent = id;
        }
    }

    int root = seekroot(0);
    setDepth(root, 0);
    int rootheight = SetHeight(root);

    int p, s, deg, dep, h;
    char type[20];

    rep(i, n){
        id = i;
        p = T[id].parent;
        if (p == NIL){
            s = NIL;
        }else{
            s = T[T[id].parent].left;
            if (s == id) s = T[T[id].parent].right;
        }
        deg = 0;
        if(T[id].left != NIL) deg++;
        if(T[id].right != NIL) deg++;
        dep = depth[id];
        h = height[id];
        if (dep == 0){
            strcpy(type, "root");
        }else if (h == 0){
            strcpy(type, "leaf");
        }else{
            strcpy(type, "internal node");
        }

        printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, %s\n", id, p, s, deg, dep, h, type);
    }

    return 0;
}


Measured memory_bytes: 3160
import java.util.*;
public class Main {
  
  public static double cal(double h){
    if(h == 1.0){
      return 1.0;
    }
    else
    {
      return cal(Math.floor(h/2))*2 + 1.0;
    }
  }
  
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
	double h = sc.nextDouble();
    System.out.println(String.format("%.0f", cal(h)));
  }
}

Measured memory_bytes: 25300
# Aさんは a[m] 地点、Bさんは b[m] 地点、Cさんは c[m] 地点
# 二人の人間は、距離が d[m] 以内のとき直接会話可能
# A・Cが直接的に会話ができる or A・Bさんが直接会話でき、かつB・Cが直接会話できる
# 会話できるなら Yes を, できないなら No を出力せよ。

a,b,c,d = map(int , input().split())
# print(a)
# print(b)
# print(c)
# print(d)

# aとcの差の絶対値がd以下
if abs(c-a) <= d:
    print('Yes')
# aとbの差の絶対値がd以下かつbとcの差の絶対値がd以下
elif abs(b-a) <= d and abs(c-b) <= d:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 9100
#include<iostream>
using namespace std;int main(){int a,i,n,m,p[3000]={0};for(;;){cin>>n>>m;if(n==0&&m==0)break;int w=0,s=0;for(i=0;i<n;i++)cin>>p[i];for(i=0;i<m;i++){cin>>a;w+=a;if(p[w]!=0&&s==0)w+=p[w];if(w>=n-1&&s==0)s=i+1;}cout<<s<<endl;}}

Measured memory_bytes: 0
#include<stdio.h>
int main(){
    int A,B;
    scanf("%d %d",&A,&B);
    if(A+B>=A-B && A+B>=A*B){
        printf("%d\n",A+B);
    }
    else if(A-B>=A+B && A-B>=A*B){
        printf("%d\n",A-B);
    }
    else{
        printf("%d\n",A*B);
    }
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) FOR(i,0,n)
#define repr(i,n) for(int i=(n)-1;0<=i;--i)
#define all(v) begin(v),end(v)
#define dump(x) cerr<<#x<<": "<<(x)<<endl
using namespace std;
using vint = vector<int>;
using vvint = vector<vint>;
using ll = long long;
using vll = vector<ll>;
template <class T> void chmin(T& a, const T& b) { a = min(a, b); }
template <class T> void chmax(T& a, const T& b) { a = max(a, b); }


void solve(long long N, long long M, std::vector<long long> A){
    priority_queue<ll> pq;
    rep(i, N) pq.push(A[i]);
    rep(i, M) {
        ll a = pq.top();
        pq.pop();
        pq.push(a / 2);
    }
    ll sum = 0;
    rep(i, N) {
        sum += pq.top();
        pq.pop();
    }
    cout << sum << endl;
}

// Generated by atcoder-tools ver.1.1.6
int main(){
    long long N;
    scanf("%lld",&N);
    long long M;
    scanf("%lld",&M);
    std::vector<long long> A(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&A[i]);
    }
    solve(N, M, std::move(A));
    return 0;
}


Measured memory_bytes: 2168
#!/usr/bin/python3
# -*- coding:utf-8 -*-

from collections import defaultdict
import sys
sys.setrecursionlimit(10**7)

def main():
  n, m = map(int, input().strip().split())
  memo = [-1] * (n+1)
  graph = defaultdict(list)

  for _ in range(m):
    x, y = map(int, input().strip().split())
    graph[y].append(x)

  def rec(v):
    if memo[v] != -1:
      return memo[v]

    lp = 0
    for t in graph[v]:
      lp = max(lp, rec(t)+1)
    memo[v] = lp
    return memo[v]

  lp = 0
  for v in range(1, n+1):
    lp = max(lp, rec(v))
  print(lp)


if __name__=='__main__':
  main()

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

const int MOD = (int)1e9+7;

int main(){
	int N,K,Q;
	cin >> N >> K >> Q;
	vector<int> A(Q);
	for(int i=0;i<Q;i++)	cin >> A.at(i);

	vector<int> ans(N,0);
	for(int i=0;i<Q;i++){
		ans.at(A.at(i)-1)++;
	}
	for(int i=0;i<N;i++){
		if(K-Q+ans.at(i)>0)	cout << "Yes" << endl;
		else	cout << "No" << endl;
	}

	return 0;
}


Measured memory_bytes: 1408
#include <iostream>
#include <vector>
#include <algorithm>

int main() {
  unsigned long n;
  std::cin >> n;
  std::vector<long long> a(n);
  for (auto &i : a) { std::cin >> i; }
  std::sort(a.begin(), a.end());
  auto odd = a.back() % 2 == 1;
  auto med = a.back() / 2;
  auto min = a.back();
  auto ans = a.back();
  for (auto i : a) {
    if (i == a.back()) { continue; }
    if (i > med) {
      if (odd) {
        if (min > (i - med) - 1) {
          min = (i - med) - 1;
          ans = i;
        }
      } else {
        if (min > (i - med)) {
          min = i - med;
          ans = i;
        }
      }
    } else {
      if (min > (med - i)) {
        min = med - i;
        ans = i;
      }
    }
  }
  std::cout << a.back() << " " << ans << std::endl;
  return 0;
}

Measured memory_bytes: 1656
#include <algorithm>
#include <climits>
#include <cmath>
#include <iostream>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <vector>

const int mod = 1e9 + 7;
const int kmax = 510000;

long long fact[kmax], fact_inv[kmax], inv[kmax];

void init_comb()
{
    fact[0] = fact[1] = 1;
    fact_inv[0] = fact_inv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < kmax; i++) {
        fact[i] = fact[i - 1] * i % mod;
        inv[i] = mod - inv[mod % i] * (mod / i) % mod;
        fact_inv[i] = fact_inv[i - 1] * inv[i] % mod;
    }
}

long long comb(int n, int r)
{
    if (n < r) {
        return 0;
    }

    if (n < 0 || r < 0) {
        return 0;
    }

    return fact[n] * (fact_inv[r] * fact_inv[n - r] % mod) % mod;
}

int main()
{
    std::string s, t;
    std::cin >> s >> t;

    std::sort(s.begin(), s.end());
    std::sort(t.begin(), t.end());

    std::vector<int> char_num_s;

    char previous = '\0';
    for (auto c : s) {
        if (previous != c) {
            char_num_s.push_back(1);
            previous = c;
        } else {
            char_num_s.back()++;
        }
    }

    previous = '\0';
    std::vector<int> chat_num_t;
    for (auto c : t) {
        if (previous != c) {
            chat_num_t.push_back(1);
            previous = c;
        } else {
            chat_num_t.back()++;
        }
    }

    std::sort(char_num_s.begin(), char_num_s.end());
    std::sort(chat_num_t.begin(), chat_num_t.end());

    if (char_num_s == chat_num_t) {
        std::cout << "Yes" << std::endl;
    } else {
        std::cout << "No" << std::endl;
    }
}


Measured memory_bytes: 776
// https://abc106.contest.atcoder.jp/tasks/abc106_d

#include <iostream>
#include <string.h>
using namespace std;

int N;

int main(){
    int cake = 4, donuts = 7;
    string ans = "No";
    cin >> N;
    
    for ( int i = 0; i*cake <= N; i++ ) {
        if ((N-i*cake)%donuts == 0) {
            ans = "Yes";
        }
    }
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
import sys

def gcd(a, b):
	if a < b:
		a, b = b, a
	if not b:
		return a
	return gcd (b, a % b)
	
n = int(input())
a = list(map(int, input().split()))
l = [0 for i in range(100004)]
r = [0 for i in range(100004)]

for i in range(1, n+1):
	l[i] = gcd(l[i-1], a[i-1])


for i in reversed(range(1, n+1)):
	r[i] = gcd(r[i+1], a[i-1])

ans = 0
for i in range(1, n+1):
	ans = max(ans, gcd(l[i-1], r[i+1]))
	
print(ans)

Measured memory_bytes: 14584
#include <iostream>
#include <map>
#include <algorithm>
#include <queue>
using namespace std;

#define INF 1<<20
#define MAX_V 20

struct Edge{ int to, cost; };

typedef pair<int, int> Pii; // cost, vertex

int V;
int d[MAX_V];

vector<Edge> G[MAX_V];

int dijkstra(int s, int t) {
  priority_queue<Pii> Q;
  fill(d, d+V, INF);
  d[s] = 0;
  Q.push(Pii(0, s));

  while(!Q.empty()) {
    Pii p = Q.top(); Q.pop();
    int v = p.second;
    
    if(d[v] < p.first) continue;
    
    for(int i=0; i<G[v].size(); i++) {
      Edge e = G[v][i];
      
      if(d[e.to] > d[v]+e.cost) {
	d[e.to] = d[v]+e.cost;
	Q.push(Pii(d[e.to], e.to));
      }
    }
  }

  return d[t];
}

int main() {
  
  int m;
  cin >> V >> m;
  char dd;

  for(int i=0; i<m; i++) {
    int a, b, c, d;
    cin >> a >> dd >> b >> dd >> c >> dd >> d;
    a--, b--;
    G[a].push_back( (Edge){b, c} );
    G[b].push_back( (Edge){a, d} );
  }
  
  int x1, x2, y1, y2;
  cin >> x1 >> dd >> x2 >> dd >> y1 >> dd >> y2;
  x1--, x2--;

  int ret = y1-y2;
  ret -= dijkstra(x1, x2);
  ret -= dijkstra(x2, x1);
  
  cout << ret << endl;
  return 0;
}

Measured memory_bytes: 1220
N = int(input())
from collections import deque
def main():
    ans = 0
    targets = deque()
    targets.append('3')
    targets.append('5')
    targets.append('7')
    while targets:
        s = targets.popleft()
        if int(s) <= N:
            if '3' in s and '5' in s and '7' in s:
                ans += 1
            targets.append(s+'3')
            targets.append(s+'5')
            targets.append(s+'7')

    print(ans)
main()

        





Measured memory_bytes: 75820
using System;
using System.Collections.Generic;

namespace ABC135_C
{
    class Program
    {
        static void Main(string[] args) {
            long n = long.Parse(Console.ReadLine());
            string[] input1 = Console.ReadLine().Split();
            string[] input2 = Console.ReadLine().Split();

            List<long> alist = new List<long>();
            List<long> blist = new List<long>();
            for (long i = 0; i < n; i++) {
                alist.Add(long.Parse(input1[i]));
                blist.Add(long.Parse(input2[i]));
            }
            alist.Add(long.Parse(input1[n]));

            long ans = 0;
            for (int i = 0; i < n; i++) {
                if (alist[i] >= blist[i]) {
                    ans += blist[i];
                } else {
                    blist[i] -= alist[i];
                    ans += alist[i];

                    if (alist[i + 1] >= blist[i]) {
                        alist[i + 1] -= blist[i];
                        ans += blist[i];
                    } else {
                        ans += alist[i + 1];
                        alist[i + 1] = 0;
                    }
                }
            }

            Console.WriteLine(ans);
        }
    }
}

Measured memory_bytes: 34012
table = [[35.5, 71.0, :AAA], [37.5, 77.0, :AA], [40.0, 83.0, :A], [43.0, 89.0, :B],
         [50.0, 105.0, :C], [55.0, 116.0, :D], [70.0, 148.0, :E]]

$<.readlines.map {|l| l.split.map(&:to_f)}.each do |a, b|
  catch :jump do
    table.each do |ta, tb, cname|
      if a < ta and b < tb
        puts cname
        throw :jump
      end
    end
    puts "NA"
  end
end


Measured memory_bytes: 6844
'use strict';
    (function(stdin) {
      //declare function

      //declare variable
      var inputs = stdin.toString().trim().split(' ');
      var a = parseInt(inputs[0]);
      var b = parseInt(inputs[1]);
      var c = parseInt(inputs[2]);
      //main
      if (a < b) {
        if (b < c) {
          console.log('Yes');
          return
        }
      }
      console.log('No');
      //display
      //console.log(inputs);
    })(require('fs').readFileSync('/dev/stdin', 'utf8'))

Measured memory_bytes: 15608
import sys
import numpy as np
from collections import Counter, deque

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    n = int(input())
    A = np.array(list(map(int, input().split())))

    res = 0
    while not any(np.mod(A, 2)):
        res += 1
        A //= 2

    print(res)


if __name__ == '__main__':
    resolve()


Measured memory_bytes: 20336
parseInt(x)=parse(Int, x)
parseMap(x::Array{SubString{String},1})=map(parseInt, x)

const hpl = Array{Int64}[]

function hom_product(l1, i, depth, N, M)
    if depth == N
        append!(hpl, [l1])
    else
        for j in i:M
            l2 = copy(l1)
            append!(l2, j)
            hom_product(l2, j, depth+1, N, M)
        end
    end
end

function main()
    N,M,Q = readline() |> split |> parseMap
    D = Tuple{Int,Int,Int,Int}[(0,0,0,0) for i in 1:Q]
	for i in 1:Q
		a,b,c,d = readline() |> split |> parseMap
		D[i] = (a,b,c,d)
    end
    ans = 0

    hom_product([], 1, 0, N, M)

    for l in hpl
        score = 0
        for i in 1:Q
            if l[D[i][2]] - l[D[i][1]] == D[i][3]
                score += D[i][4]
            end
        end
        ans = max(score,ans)
    end
    println(ans)
end

main()


Measured memory_bytes: 229280
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vs = vector<string>;
using pll = pair<ll, ll>;
using vp = vector<pll>;
template<class T> using V = vector<T>;
template<class T> using VV = vector<vector<T> >;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define repb(i, n) for(ll i = (n)-1; i >= 0; i--)
#define repr(i, a, b) for(ll i = (a); i < (b); i++)
#define reprb(i, a, b) for(ll i = (a)-1; i >= (b); i--)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((ll)(x).size())
const ll MOD = 1000000007;
const ll INF = 100000000000000000LL;
inline ll GCD(ll a, ll b){ return b?GCD(b, a % b):a; }
inline ll LCM(ll a, ll b){ return a/GCD(a, b)*b; }
inline ll powint(unsigned long long x, ll y){ ll r=1; while(y){ if(y&1) r*=x; x*=x; y>>=1; } return r; }
inline ll powmod(ll x, ll y, ll m = MOD){ ll r=1; while(y){ if(y&1) r*=x; x*=x; r%=m; x%=m; y>>=1; } return r; }
template<class T>bool chmax(T &a, const T &b){ if(a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b){ if(b<a) { a=b; return 1; } return 0; }
#ifdef OJ_LOCAL
#include "dump.hpp"
#else
#define dump(...) ((void)0)
#endif

int main(){
    cin.tie(0); ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    ll n, k;
    cin >> n >> k;
    vll a(n);
    rep(i, n){
        cin >> a[i];
    }
    vll acc(n+1), acc2(n+1);
    acc[0] = 0;
    acc2[0] = 0;
    repr(i, 1, n+1){
        acc[i] = acc[i-1] + a[i-1];
        acc2[i] = acc2[i-1] + max(0ll, a[i-1]);
    }
    dump(acc);
    dump(acc2);
    ll ans = 0;
    rep(i, n-k+1){
        ll tmp = 0;
        tmp += max(0ll, acc[i+k]-acc[i]);
        tmp += acc2[n]-acc2[i+k];
        tmp += acc2[i];
        dump(tmp);
        chmax(ans, tmp);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 2560
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Practice
{
    class Program
    {
        private static int ReadAndParseInt()
        {
            return int.Parse(Console.ReadLine());
        }
        private static int[] ReadAndParseIntArr()
        {
            return Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
        }
        private static long ReadAndParseLong()
        {
            return long.Parse(Console.ReadLine());
        }
        private static long[] ReadAndParseLongArr()
        {
            return Array.ConvertAll(Console.ReadLine().Split(' '), long.Parse);
        }
        static void Main(string[] args)
        {
            SolveA(args);
            //SolveB(args);
            //SolveC(args);
            //SolveD(args);


        }
        private const long MOD = 1000000007;
        static void SolveA(string[] args)
        {
            var ab = ReadAndParseIntArr();
            int a = ab[0];
            int b = ab[1];
            int cnt = 0;
            for(int i=a;i<=b;++i)
            {
                string sz = i.ToString();
                if( sz[0] == sz[4] && sz[1] == sz[3])
                {
                    cnt++;
                }
            }
            Console.WriteLine(cnt);
        }
    }
}

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

#define int long long
#define ct(n) cout << n << endl;
#define cts(n) cout << n << " ";
#define cte cout << endl;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define repo(i,o,n) for(int i=o;i<n;i++)
#define repm(i,n) for(int i=n-1;i>=0;i--)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define sperase(v,n) (v).erase(remove(all(v), n), (v).end());
#define vdelete(v) (v).erase(unique(all(v)), (v).end());
#define vcopy(v1,v2) copy((v1).begin(), (v1).end(), back_inserter((v2)));
#define pb(n) push_back(n);

int a,b,c;

main() {
    cin >> a >> b >> c;
    if (a <= c && c <= b) ct("Yes")
    else ct("No")
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <vector>
#include <algorithm>
#include <cmath>
#include <chrono>

using namespace std;

int main(int argc, const char * argv[]) {

    ios::sync_with_stdio(false);
    cin.tie(0);

    int x, y; cin >> x >> y;
    
    int64_t ans = 0;
    if (abs(x) == abs(y)) {
        if (x == y) ans = 0;
        else ans = 1;
    } else if (abs(x) < abs(y)) {
        int64_t dis = abs(y) - abs(x);
        if (x >= 0 && y >= 0) ans = dis;
        if (x >= 0 && y < 0) ans = dis + 1;
        if (x < 0 && y >= 0) ans = dis + 1;
        if (x < 0 && y < 0) ans = dis + 2;
    } else {
        int64_t dis = abs(x) - abs(y);
        if (x > 0 && y > 0) ans = dis + 2;
        if (x > 0 && y <= 0) ans = dis + 1;
        if (x <= 0 && y > 0) ans = dis + 1;
        if (x <= 0 && y <= 0) ans = dis;
    }
    
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
import fractions
def amari(a):
    return a - a // C - a // D + a // L
A, B, C, D = map(int,input().split())
L = (C * D) // fractions.gcd(C, D)
E = amari(L)
K = B - A + 1
counter = amari(B - K // L * L) - amari(A - 1)
print((K // L) * E + counter)


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


int main() {

    
    int N; cin >> N;
    int A[N]; rep(i,N) cin >> A[i];

    int r[N] = {-1};
    int l[N] = {-1};

    int current_left_max = A[0];
    for(int i = 0; i < N; i++){
        current_left_max = max(current_left_max, A[i]);
        l[i] = max(current_left_max, l[i]);
    }

    int current_right_max = A[N-1];
    for(int i = N-1; i>=0; i--){
        current_right_max = max(current_right_max, A[i]);
        r[i] = max(current_right_max, r[i]);
    }


    for(int i = 0; i < N; i++){
        if(i == 0) cout << r[i+1] << endl;
        else if(i == (N-1)) cout << l[i-1] << endl;
        else cout << max(l[i-1], r[i+1]) << endl;
    }


    return 0;
}

Measured memory_bytes: 5940
#include <bits/stdc++.h>
using namespace std;
int ans;
int main()
{
	int N,M;
	scanf("%d%d",&N,&M);
	for(int i=1;i<=N;i++)
	{
		int a;
		scanf("%d",&a);
		if(a>=M)
		{
			ans++;
		}
	}
	printf("%d",ans);
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)
#define TO_STRING(VariableName) # VariableName
#define LOG(x) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<endl;
#define LOG2(x,y) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<endl;
#define LOG3(x,y,z) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<" "<<TO_STRING(z)<<"="<<z<<endl;
#define LOG4(w,x,y,z) if(DEBUG)cout<<TO_STRING(w)<<"="<<w<<" "<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<" "<<TO_STRING(z)<<"="<<z<<endl;
 
template<class T>bool chmax(T & a, const T & b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }

#define BASE 50

void solve(){

	lli k;
	cin>>k;

	vector<lli> a(BASE,BASE-1);

	REP(i,0,BASE)a[i] += (k/BASE);

	k%=BASE;
	lli left = BASE - 1 -k;

	REP(i,0,BASE){
		if(i<k)a[i]++;
		else a[i]-=k;
	}

	cout<<BASE<<endl;
	REP(i,0,BASE)cout<<a[i]<<" ";
	return ;

}

int main(){

	lli q;
	q=1;
	while(q--)solve();

    return 0;
}

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

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

  int plan_a, plan_b;

  plan_a = A * N;
  plan_b = B;

  if(plan_a > plan_b){
    cout << plan_b << endl;
  } else {
    cout << plan_a << endl;
  }
}


Measured memory_bytes: 256
sx, sy, tx, ty = gets.chomp.split.map(&:to_i)

yy = (ty - sy).abs
xx = (tx - sx).abs

ans = []
yy.times do
  ans.push('U')
end
xx.times do
  ans.push('R')
end
yy.times do
  ans.push('D')
end
xx.times do
  ans.push('L')
end
ans.push('L')
(yy+1).times do
  ans.push('U')
end
(xx+1).times do
  ans.push('R')
end
ans.push('D')
ans.push('R')
(yy+1).times do
  ans.push('D')
end
(xx+1).times do
  ans.push('L')
end
ans.push('U')

puts ans.join('')


Measured memory_bytes: 2428
#include "bits/stdc++.h"

using namespace std;
int a[10000];
int b[500];
int cnt = 0;

int main()
{
	int r,i;
	cin >> r;
	for(int k = 0;k < r;k++){
		cin >> a[k];
	}
	cin >> i;
	for(int f = 0;f < i;f++){
		cin >> b[f];
	}
	for(int y = 0;y < i;y++){
		for(int t = 0;t < r;t++){
			if(b[y] == a[t]){
				cnt++;
				break;
			}
		}
	}
	cout << cnt << endl;


	return 0;
}

Measured memory_bytes: 3132
#include <bits/stdc++.h>
using namespace std;
typedef pair <int,int> pii;

const int N=1e6+50;
int n,m,a[N],c[N],ori[3],now[3];
char s[N];

inline void calc(int &b1,int &b2,int &c1,int &c2,int last=0) {
	b1=b2=c1=c2=0;
	for(int i=1;i<=n;i++) 
		if(!a[i]) {
			int len=i-last-1;
			if(len==1) (a[i-1]==1) ? ++b1 : ++c1;
			else if(len>1) ++b2, ++c2;
			last=i;
		}
	if(last!=n) {
		int len=n-last;
		if(len==1) (a[n]==1) ? ++b1 : ++c1;
		else ++b2, ++c2;
	}
	b2+=b1, c2+=c1;
}

inline void solve_equal() {
	int res=0;
	for(int i=1;i<=n;i++) {
		if(a[i]==1) ++res;
		else if(!a[i]) --res;
	}
	
	m=0; a[n+1]=4; a[0]=4;
	for(int i=1;i<=n;i++) {
		if(!res) a[++m]=a[i];
		else if(!a[i]) a[++m]=a[i];
		else {
			if(((a[i]|a[m])==3) && !(a[m-1]==0 && a[i+1]==0)) --m, --res;
			else a[++m]=a[i]; 
		}
	}
	
	for(int i=1;i<=m;i++) putchar(ori[a[i]]+'A');
}

inline void solve1() {
	memset(c,0,sizeof(c));
	for(int i=1;i<=n;i++) ++c[a[i]];
	int res=c[2]-c[1], last=0; m=0; a[n+1]=0;
	
	for(int i=1;i<=n+1;i++) {
		if(!res) {if(i<=n) a[++m]=a[i];}
		else if(!a[i]) {
			int len=i-last-1;
			if(len>1 && res) {
				int bg=last+1, ed=i-1;
				if(res && a[bg]==2) ++bg, --res;
				if(res && a[ed]==2) --ed, --res;
				while(bg<=ed) a[++m]=a[bg++];
			} else if(i-1){
				a[++m]=a[i-1];
			} last=i; if(i!=n+1) a[++m]=a[i];
		} 
	} n=m;
}

int main() {
	scanf("%s",s+1);
	n=strlen(s+1);
	for(int i=1;i<=n;i++)
		if(s[i]!=s[m]) s[++m]=s[i], a[m]=s[i]-'A', ++c[a[m]];
	if(m<3) return puts(""),0;
	n=m; pii tmp[3];
	for(int i=0;i<=2;i++) tmp[i]=pii(c[i],i);
	sort(tmp,tmp+3);
	for(int i=0;i<=2;i++) ori[i]=tmp[i].second, now[tmp[i].second]=i;
	for(int i=1;i<=m;i++) a[i]=now[a[i]];
	
	if(tmp[1].first==tmp[2].first) return solve_equal(),0;
	
	int b1,c1,b2,c2; calc(b1,b2,c1,c2);
	
	if(b2<c1) {
		static int del[N]; 
		int res=c1-b2, last=0;
        if(res && a[1]==2 && a[2]==0) {
        	--res; --n;
        	for(int i=1;i<=n;i++) a[i]=a[i+1];
        }
        if(res && a[n]==2 && a[n-1]==0) --res, --n;
		if(tmp[0].first<res) return puts(""),0;
		for(int i=1;i<=n && res;i++) 
			if(!a[i]) {
				int len=i-last-1;
				if(len==1 && a[i-1]==2) del[i]=1, --res;
                last=i;
			}
		m=0; a[0]=3;
		for(int i=1;i<=n;i++) if(!del[i] && a[i]!=a[m]) a[++m]=a[i];
		n=m; memset(c,0,sizeof(c));
		for(int i=1;i<=n;i++) ++c[a[i]];
		if(c[1]==c[2]) solve_equal();
		solve1(), solve_equal();
	} else solve1(), solve_equal();
}

Measured memory_bytes: 12928
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define int long long
#define inf 1000000007
#define LINF 100000000000000007LL
#define ll long long
using namespace std;
ll par[214514];
ll rankk[214514];
ll wsz[214514];
ll bsz[214514];
ll fld[214514];
ll used[214514];
void init(int n){
	for(int i=0;i<n;i++){
		par[i] = i;
		rankk[i]=0;
		if( fld[i] == 1 ) bsz[i]++;
		else wsz[i]++;
	}
}
ll find(ll x){
	if(par[x] == x){
		return x;
	}else{
		return par[x] = find(par[x]);
	}
}
void unite(ll x, ll y){
	x = find(x);
	y = find(y);
	if(x==y)return;
	if(rankk[x]<rankk[y]){
		par[x]=y;
		wsz[y] += wsz[x];
		bsz[y] += bsz[x];
	}else{
		par[y]=x;
		wsz[x] += wsz[y];
		bsz[x] += bsz[y];
		if(rankk[x]==rankk[y])rankk[x]++;
	}
}
signed main(){
	int h,w;
	cin>>h>>w;
	vector<string> v(h);
	for(int i=0;i<h;i++){
		cin>>v[i];
		for(int j=0;j<w;j++){
			if( v[i][j] == '#' ) fld[i*w+j] = 1;
		}
	}
	init(h*w);
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			if( i != h-1 ){
				if( v[i][j] != v[i+1][j]){
					unite( i*w+j, (i+1)*w+j );
				}
			}
			if( j != w-1 ){
				if( v[i][j] != v[i][j+1] ){
					unite( i*w+j, i*w+j+1 );
				}
			}
		}
	}
	int ans = 0;
	for(int i=0;i<h*w;i++){
		int p = find(i);
		if( used[p] == 0 ){
			used[p] = 1;
			ans += wsz[p]*bsz[p];
			//cout<<p<<" "<<wsz[p]<<" "<<bsz[p]<<endl;
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 9472
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
typedef long long int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define MOD (1000000007)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1}; // 移動方向

ll n;
vector<ll> a;

void input(){
  cin >> n;
  a.resize(3*n);
  for(ll i=0;i<3*n;i++) cin >> a[i];
}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  input();
  sort(a.begin(), a.end(), greater<>());
  ll ans = 0;
  for(int i=1;i<2*n;i+=2){
    ans += a[i];
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 2560
/* Author : Aaryan Srivastava ^__^ */ 
#include <bits/stdc++.h>
#include <random>
#include <chrono>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
#define pb push_back
#define mp make_pair
#define ff first
#define ss second   
#define rep(i,n) for(int (i) = 0 ; i < (n) ; i++)
#define repA(i,x,y) for(int i = (x) ; i <= (y) ; i++)
#define repD(i,x,y) for(int i = (x) ; i >= (y) ; i--)
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).end()
#define setval(a,val) memset(a,val,sizeof(a))
#define Randomize mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define trav(x , a) for(auto &x : a)
#define sz(a) ((int)a.size())
typedef long long ll ; 

#define int ll

using namespace std;

const int N = 3e5 +5 ;
const int mod = 1e9 + 7 ;
const ll inf = 1e18 ;
const int SZ = 101 ;
const double eps = 1e-9 ;
using namespace __gnu_pbds;
using ordered_set =  tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ;

typedef pair<int, int> pii; 
typedef pair<int , pii> ipii ;
typedef pair<pii , int> piii ; 
typedef unsigned long long ull ;
typedef long double ld;

ll po(ll x,ll y,ll p = mod) {ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}

void solve()
{
    int r;
    cin >> r;

    ld res = 2. * acos(-1) * r;
    cout << fixed << setprecision(5) << res ;
}   

     
int32_t main(int32_t argc, char *argv[])
{
    ios::sync_with_stdio(0);    
    cin.tie(0); cout.tie(0);
    int TC = 1, t = 0;
    //cin >> TC ;
    while(t++ < TC)
    {
        //cout << "Case #" << t << ": " ;
        solve();
        cout << "\n" ;
    }
    return 0;
}

Measured memory_bytes: 3804
#include<iostream>
#include<string>
#include<algorithm>	
#include<cmath>
using namespace std;
int main() {
	int n, m, a, b, c, d, e, f, sum, num; 
	cin >> n >> m >> a >> b >> c >> d >> e >> f;
	sum = n * c + m * d + n / 10 * e + m / 20 * f;
	num = a * c + b * d + a / 10 * e + b / 20 * f;
	if (sum > num) { cout << "hiroshi" << endl; }
	if (num > sum) { cout << "kenjiro" << endl; }
	if (sum == num) { cout << "even" << endl; }
	cin >> n;
}



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

using vi = vector<int>;
using vl = vector<long long int>;
using vii = vector<vector<int>>;
using vll = vector<vector<long long int>>;
#define pb push_back;
#define mp make_pair;

vector<bool>vis;
vii a;

ll powM(ll a,ll b,ll m)
{
    ll ans=1;
    a%=m;
    while(b)
        {
            if(b&1)ans=ans*a%m;
            a=a*a%m;
            b>>=1;
        }
        return ans;
}

void dfs(vii a,ll x)
{
  vis[x]=true;
  for(int i=0;i<a[x].size();i++)
  {
    if(vis[a[x][i]]==false)
    {
      vis[a[x][i]]=true;
      dfs(a,a[x][i]);
    }
  }
  ll cnt=0;
 // for(int i=1;i<=n;i++)if(vis[i]==false)cnt++;
  //  return cnt;
}

int main(){
      ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.precision(2);
cout<<fixed;

int n,x,y;cin>>n>>x>>y;
vector<int>v[n+1];
vector<bool> vis(n+1,0);
vector<int>level(n+1,0);
for(int i=1;i<n;i++)
{
  v[i].push_back(i+1);
  v[i+1].push_back(i);
  
}
v[x].push_back(y);
v[y].push_back(x);

queue<int>q;
q.push(1);
while(!q.empty())
{
  int temp=q.front();
  q.pop();
  vis[temp]=true;
  for(int i=0;i<v[temp].size();i++)
  {
if(vis[v[temp][i]]==false)
{
  vis[v[temp][i]]=true;
  level[v[temp][i]]=level[temp]+1;
  q.push(v[temp][i]);
  }
}

}

map<int,int>m;
for(int i=1;i<n;i++)
{
  for(int j=i+1;j<=n;j++)
  {
    m[abs(level[i]-level[j])]++;
  }
}
//cout<<m[0]<<"\n";

for(int i=1;i<=n-1;i++)cout<<m[i]<<"\n";

return 0;


}
*/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

using vi = vector<int>;
using vl = vector<long long int>;
using vii = vector<vector<int>>;
using vll = vector<vector<long long int>>;
#define pb push_back;
#define mp make_pair;
ll powM(ll a,ll b,ll m)
{
    ll ans=1;
    a%=m;
    while(b)
        {
            if(b&1)ans=ans*a%m;
            a=a*a%m;
            b>>=1;
        }
        return ans;
}



int main(){
      ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.precision(2);
cout<<fixed;
int n,x,y;cin>>n>>x>>y;
vi a(n+1);
map<int,int>m;
int cnt=1;
/*for(int i=1;i<=x;i++)
  {
    a[i]=cnt;
    cnt++;
}
for(int i=y;i<=n;i++)
{
  a[i]=cnt;
  cnt++;
}*/
for(int i=1;i<n;i++)
{
  for(int j=i+1;j<=n;j++)
  {
    int temp=min(abs(i-x)+1+abs(j-y),abs(j-i));
    m[temp]++;
  }
}
for(int i=1;i<=n-1;i++)cout<<m[i]<<"\n";

return 0;



}


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

int main() {
  ll a, b, k;
  cin >> a >> b >> k;
  if(a-k >= 0){
    a-=k;
    cout << a << " " << b << endl;
    return 0;
  }
  else {
    b = max(b-k+a, (ll)0);
    cout << 0 << " " << b << endl;
    return 0;
  }
}

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

#define endl '\n'
#define pb push_back
#define ll long long
#define len(X) ((int)(X).size())
#define all(X) (X).begin(), (X).end()
#define deb(X) cout << #X << " " << X << '\n'

void solve(int test_case) {
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    cout << max({a*c, a*d, b*c, b*d}) << endl;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int t = 1;
    // cin >> t;
    for(int tc = 1; tc <= t; ++tc) solve(tc);
}


Measured memory_bytes: 3636
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<map>
#include<tuple>


#define MOD 1000000007
#define rep(i,k,N) for(int i=k;i<N;i++)
#define MP make_pair
#define MT make_tuple //tie,make_tuple は別物
#define PB push_back

typedef long long ll;

using namespace std;

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

int main(){
    int N;
    cin>>N;
    vector<int> A(N);
    map<int,int> m;
    rep(i,0,N){
        cin>>A[i];
        m.insert(make_pair(A[i],i+1));
    }
    
    rep(i,1,N+1){
        cout<<m[i]<<" ";
    }

    return 0;
}

Measured memory_bytes: 5888
#include <iostream>

using namespace std; 

int main()
{
  int A, B, C, X, Y;
  cin >> A >> B >> C >> X >> Y;

  int price = A * X + B * Y;
  for (int c = 2; c < max(X, Y) * 2 + 1; c += 2)
  {
    int newPrice = C * c + max(0, (X - c / 2) * A) + max(0, (Y - c / 2) * B);
    if (newPrice < price)
    {
      price = newPrice;
    }
    else 
    {
      break; 
    }
  }

  cout << price << endl;
}

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

using namespace std;
#define LL  long long

const int MAXN = 2e5+10;
const int MAXNUM = 1e9+10;
LL N;
LL A[MAXN];
map<LL, LL> mii;

int main()
{
    cin >> N;
    
    for(LL i=1; i<=N; i++) {
        cin >> A[i];
    } 

    for(LL i=1; i<=N; i++) {
        LL t = A[i] + i;
        mii[t]++;
    }

    LL ans = 0;
    for(LL j=1; j<=N; j++) {
        LL t = j-A[j];
        ans += mii[t];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 27860
def solve():
    N,A,B,C,D = [int(s)-1 for s in input().split() if s]
    S = input()
    N += 1
    
    flag = True
    for i in range(A+1, max(C,D)-1):
        if S[i] == '#' and S[i+1] == '#':
            flag = False
    
    if flag and C > D:
        flag = False
        for i in range(B-1, D):
            if S[i] == '.' and S[i+1] == '.' and S[i+2] == '.':
                flag = True
    
    print('Yes' if flag else 'No')

solve()

Measured memory_bytes: 3572
N = int(input())
b = []
c = [0]*N
count_flag=0
b = list(map(int, input().split()))
#print(b)
for count in range(N):
  for i in range(N-count):
    if count_flag == count and b[N-1-count-i]==N-1-count-i+1 :
      c[N-1-count]=N-1-count-i+1
      b.pop(N-1-count-i)
      count_flag+=1
if count_flag == N:
  for i in range(N):
    print(c[i])
else:print(-1)

Measured memory_bytes: 3064
#include<stdio.h>
#include<string.h>
int main(void)
{
    char a[4],b[4];
    char temp;

    scanf("%s %s",a,b);
    temp=a[0];
    a[0]=a[2];
    a[2]=temp;
    if(strcmp(a,b)==0){
        printf("YES\n");
    }
    else{
        printf("NO\n");
    }
    return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include <string>
#include <bits/stdc++.h>
#define ll long long int
#define ld long double
#define pb push_back
#define endl "\n"
#define mp make_pair
#define sz(v) (int)(v.size())
#define len(s) (int)(s.length())
#define M 1000000007
#define all(v) v.begin(),v.end()
#define fr(a,b,c) for(ll i=a;i<=b;i+=c)
#define inarr(arr,n); for(ll i=0;i<n;i++) cin >> arr[i];
#define outarr(arr,n); for(ll i=0;i<n;i++) cout<<arr[i]<<" ";
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
ll power(ll a,ll n) 
{
    if(n==0){
        return 1;
    }
    ll p=power(a,n/2) % M;
    p = (p * p) % M;
    if (n%2==1)
    {
        p=(p*a)%M;
    }
    return p;
}
ll gcd(ll a, ll b) 
{ 
    if (a == 0) 
        return b; 
    return gcd(b % a, a); 
}
int main(){
    ios;
    string s;
    cin>>s;
    ll ans=0;
    if(s[0]=='R' && s[1]=='R'&& s[2]=='R'){
        ans=3;
    }
    else if(s[0]=='R' && s[1]=='R'){
        ans=2;
    }
    else if(s[1]=='R' && s[2]=='R'){
        ans=2;
    }
    else if(s[0]=='R' || s[1]=='R' || s[2]=='R'){
        ans=1;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3580