akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using ll  = long long;
#define int ll
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define erep(e,v) for(auto && e :v)
#define all(in) in.begin(), in.end()
#define MP make_pair
#define INF (sizeof(int) == 4 ? (int)1e9:(int)1e18)
#define EPS 0.0000000001
using namespace std;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<typename Head, typename Value> auto vectors(const Head &head, const Value &v) { return vector<Value>(head, v); }
template<typename Head, typename... Tail> auto vectors(Head x, Tail... tail) { auto inner = vectors(tail...); return vector<decltype(inner)>(x, inner); }
template<class T> void join(T a){for(auto itr :a){if(itr != *a.begin())cout << " "; cout << itr;} }
using ld  = long double;
using pii = pair<int,int>;
using piii = pair<int,pii>;
int W,H;
int dx[]={0,0,1,-1}, dy[]={1,-1,0,0};
bool valid(int x,int y){return (0<=x&&x<W)&&(0<=y&&y<H);}
auto f(int n){
    auto s = to_string(n);
    return (s.size() -1 )*9 + (s.front() - '0');
}
signed main(){
    int a,n,m; cin >> a >> n >> m;
    map<int,int>used;
    int maxi = f(m);
    int ans = 0;
    for(int i = 1; i <= maxi; i++){
        int num = (int)pow(i+a,n);
        auto s = to_string(num);
        int calc = 0;
        rep(j,s.size()){
            calc += s[j] - '0';
        }
        if(calc == i and num <= m and used[num] == 0){
            used[num]++;
            //cout << s << endl;
            //cout << calc << endl;
            ans++;
        }
    }
    cout << ans << endl;
}





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

int main() {
  int h, w, n;
  cin >> h >> w >> n;
  int base = max(h, w);
  int ans;
  if (n % base == 0) {
    ans = n / base;
  } else {
    ans = n / base + 1;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-

###
# main
if(__name__ == '__main__'):
    # input
    n, m, x = map(int, input().split(" "))

    book = []
    c_sum = 0
    sum_li = [0 for _ in range(m)]
    for i in range(n):
        b = list(map(int, input().split(" ")))
        book.append(b)
        c = b[0]
        c_sum += c
        for al in range(m):
            a = b[al+1]
            sum_li[al] += a

    ans = -1
    for al in range(m):
        if sum_li[al] < x:
            break
    else:
        q = []
        cost_list = [c_sum]
        init_list = [c_sum]
        for al in range(m):
            init_list.append(sum_li[al])
        q.append(init_list)

        for i in range(n):
            for tgt_cnt in range(len(q)):
                tgt = q[tgt_cnt]
                cost = tgt[0] - book[i][0]
                tgt_list = [cost]
                for al in range(m):
                    cp = tgt[al+1] - book[i][al+1]
                    if cp < x:
                        break
                    else:
                        tgt_list.append(cp)
                else:
                    cost_list.append(cost)
                    q.append(tgt_list)

        cost_list.sort()
        ans = cost_list[0]

    print(ans)

# else:
    # do nothing

Measured memory_bytes: 11352
import java.io.*;
import java.util.*;
import java.util.function.*;

final class Solver {
	static final Solver INSTANCE = new Solver();

	void solve(Supplier<String> sc) {
		int A = Integer.parseInt(sc.get());
		int P = Integer.parseInt(sc.get());
		System.out.println((P + A * 3) / 2);
	}
}

class Main {
	public static void main(String... args) {
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		Solver.INSTANCE.solve(new Supplier<String>() {
			StringTokenizer line;

			public String get() {
				while (line == null || !line.hasMoreTokens()) try {
					line = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new UncheckedIOException(e);
				}
				return line.nextToken();
			}
		});
	}
}

Measured memory_bytes: 21460
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}void pr(){ln;}
template<class A,class...B>void pr(const A &a,const B&...b){cout<<a<<(sizeof...(b)?" ":"");pr(b...);}
template<class A>void PR(A a,ll n){rep(i,n)cout<<(i?" ":"")<<a[i];ln;}
const ll MAX=1e9+7,MAXL=1LL<<61,dx[8]={-1,0,1,0,-1,-1,1,1},dy[8]={0,1,0,-1,-1,1,1,-1};
typedef pair<ll,ll> P;

ll d[11111111];

void Main() {
  ll n;
  R n;
  ll ans=1;
  for(ll i=2; i<=n; i++) {
    d[i]++;
    ans+=i*(d[i]+1);
    for(ll j=i*2; j<=n; j+=i) d[j]++;
  }
  pr(ans);
}

int main(){ios::sync_with_stdio(0);cin.tie(0);Main();return 0;}


Measured memory_bytes: 81736
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const ll mod = 1e9 + 7;

int main() {
    int N, M;
    cin >> N >> M;
    if(N == 0) N++;
    if(M == 0) M++;
    cout << N * (N - 1) / 2 + M * (M - 1) / 2;
    return 0;
}


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

int main() {
    int n;
    cin >> n;
    vector<string> A(n);
    for(int i=0;i<n;i++){
        cin >> A.at(i);
    }
    int c0=0,c1=0,c2=0,c3=0;
    for(int i=0;i<n;i++){
        if(A.at(i)=="AC"){
            c0++;
        }
        else if(A.at(i)=="WA"){
            c1++;
        }
        else if(A.at(i)=="TLE"){
            c2++;
        }
        else if(A.at(i)=="RE"){
            c3++;
        }
    }
    cout << "AC x " << c0 << endl;
    cout << "WA x " << c1 << endl;
    cout << "TLE x " << c2 << endl;
    cout << "RE x " << c3 << endl;
}

Measured memory_bytes: 6372
#include<stdio.h>

int main(){
  int N = 0;
  double P = 0;
  scanf("%d",&N);
  if (N%2==0){
    P = (double)(N/2)/N;
  }else{
    P = (double)((N+1)/2)/N;
  }
  printf("%lf",P);
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstring>
#include <chrono>
#include <complex>
#define fill(a,val) memset(a,val,sizeof(a))
#define REP(i,a,b) for (auto i = a; i != b; i++)
#define ll long long int
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vvi vector < vi >
#define pii pair<int,int>
#define pll pair<long long, long long>
#define mod 1000000007
#define inf 1000000000000000001;
#define all(c) c.begin(),c.end()
#define mp(x,y) make_pair(x,y)
#define mem(a,val) memset(a,val,sizeof(a))
#define eb emplace_back
#define f first
#define pb push_back
#define SQ(a) (a)*(a)
 
const int N = 10005;
using namespace std;
 
int main()
{
    std::ios::sync_with_stdio(false);
    //ll p = 1000000007; 
    
    int T = 1;
    //cin>>T;
    // cin.ignore(); must be there when using getline(cin, s)
    while(T--)
    {
          int n,m;
          cin>>n>>m;
          vi a(n);
          ll sum = 0;
          REP(i,0,n)
          {
            cin>>a[i];
            sum+=a[i];
          }
          sort(a.rbegin(),a.rend());
          float k = (float)sum/4;
          k = k/m;
          if(a[m-1] < k)
            cout<<"No";
          else
            cout<<"Yes";
          
    }
    return 0;
}

 

Measured memory_bytes: 3592
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep1(i,n) for(int i=1; i<=(n); ++i)
#define repi(i,a,b) for(int i=a; i<=(b); ++i)
#define rrep(i,n) for(int i=(n-1); i>=0; --i)
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define pb push_back
#define mp make_pair
#define to_s to_string
#define sz(v) (int)v.size()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )
#define pr(x) cout<<(x)<<'\n'
#define debug(x) cout << #x << ": " << (x) << '\n'
#define yes "Yes"
#define no "No"
using ll = long long;
using namespace std;
typedef pair<int,int> P;
struct aaa{aaa(){ cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);};}aaaaaaa;
int MOD = 1e9 + 7;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return (a*b)/gcd(a,b);}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int A,B,X;
int main(){
    cin >> A >> B >> X;
    if(X >= A && X <= A+B) pr("YES");
    else pr("NO");
}

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

int main()
{
  int n, d, x;
  std::cin >> n >> d >> x;
  int s = x;
  for (int i = 0; i < n; i++) {
    int a;
    std::cin >> a;
    s += (d - 1) / a + 1;
  }
  std::cout << s << std::endl;
  return 0;
}

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

int main(){
  int a,b;
  char op;
  cin >>a >>op >>b;
  if(op == '+') cout << a+b << endl;
  else cout << a-b << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <utility>
#include <stack>
#include <queue>
#include <vector>
#include <cmath>

#define pb push_back

using namespace std;

typedef long long ll;

int main()
{
        int a, b;
        while(cin >> a){
                cin >> b;
                if(a + b == 0) cout << 1 << endl;
                cout << (int)log10(a+b) + 1 << endl;
        }

        return 0;
}


Measured memory_bytes: 3364
a = int(input())

b = [1,2,3,4,5,6,7,8,9,10,12,14,15,16,18,20,21,24,25,27,28,30,32,35,36,40,42,45,48,49,56,63,64,72,81]
if(a in b):
  print("Yes")
  
else:
  print("No")

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
const int maxn=2e5+10;
struct node
{
    int val,id;
}a[maxn];
int b[maxn];
bool cmp(const node &A,const node &B)
{
    return A.val>B.val;
}
int main()
{
    int n;scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
        scanf("%d",&a[i].val);
        a[i].id=i;
        b[i]=a[i].val;
    }
    sort(a+1,a+n+1,cmp);
    for(int i=1;i<=n;i++)
    {
        if(i==a[1].id)
            printf("%d\n",b[a[2].id]);
        else
            printf("%d\n",b[a[1].id]);
    }

    return 0;
}


Measured memory_bytes: 3968
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int total = 0, max = 0;
        for (int i =0; i < N; i++) {
            int h = sc.nextInt();
            if (h >= max) {
                total++;
            }
            max = Math.max(max, h);
        }
        System.out.println(total);
    }
}


Measured memory_bytes: 35452
#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;

void Get_Val(int &Ret)
{
	Ret = 0;
	char ch;
	while (ch = getchar(), ch > '9' || ch < '0')
		;
	do
	{
		(Ret *= 10) += ch - '0';
	}
	while (ch = getchar(), ch >= '0' && ch <= '9');
}

const int Max_N(500050);

int N, F[Max_N][27], Anc[20][Max_N];
char S[Max_N];

void init()
{
	scanf("%s", S + 1), N = strlen(S + 1);
}

void dp()
{
	memset(F, 0X3F, sizeof(F));
	memset(Anc, -1, sizeof(Anc));
	for (int i = N;i >= 1;--i)
	{
		for (int j = 0;j <= 26;++j)
			if (S[i] - 'a' == j)
				F[i][j] = i;
			else
				if (j - 1 >= 0 && F[i][j - 1] + 1 <= N)
					F[i][j] = min(F[i][j], F[F[i][j - 1] + 1][j - 1]);
		for (int j = 0;j <= 25;++j)
			if (F[i][26] + 1 <= N)
				F[i][j] = min(F[i][j], F[F[i][26] + 1][j]);
		Anc[0][i] = F[i][26] + 1;
	}
	for (int j = 1;j <= 19;++j)
		for (int i = 1;i <= N;++i)
			if (Anc[j - 1][i] == -1)
				Anc[j][i] = -1;
			else
				if (Anc[j - 1][i] > N)
					Anc[j][i] = -1;
				else
					Anc[j][i] = Anc[j - 1][Anc[j - 1][i]];
}

void work()
{
	int Q, l, r, u;
	Get_Val(Q);
	while (Q--)
	{
		Get_Val(l), Get_Val(r), u = l;
		for (int j = 19;j >= 0;--j)
			if (Anc[j][u] != -1 && Anc[j][u] <= r)
				u = Anc[j][u];
		if (Anc[0][u] == r + 1)
			printf("Yes\n");
		else
			printf("No\n");
	}
}

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

Measured memory_bytes: 92800
n, m = map(int, input().split())

a = []
for i in range(n):
  t = [int(num) for num in input().split()]
  a.append(t)

b = []
for i in range(m):
  t = int(input())
  b.append(t)

answer = []
for i in range(n):
  score = 0
  for j in range(m):
    score += a[i][j]*b[j]
  answer.append(score)

for a in answer:
  print(a)


Measured memory_bytes: 5980
import sys
h,w = map(int,input().split())
left = [[0 for x in range(w)]for _ in range(h)]
right = [[0 for x in range(w)]for _ in range(h)]
up = [[0 for x in range(w)]for _ in range(h)]
down = [[0 for x in range(w)]for _ in range(h)]
arr = []
for i in range(h):
    arr.append(sys.stdin.readline())
for i in range(h):
    s = 0
    for j in range(w):
        if arr[i][j]=='.':
            left[i][j]=s
            s+=1
        else:
            s=0
for i in range(h):
    s = 0
    s2 =0
    for j in range(w):
        if arr[i][j] == '.':
            left[i][j] = s
            s += 1
        else:
            s = 0
        if arr[i][w-1-j]=='.':
            right[i][w-1-j] = s2
            s2+=1
        else:
            s2=0
for i in range(w):
    s = 0
    s2 = 0
    for j in range(h):
        if arr[j][i] == '.':
            up[j][i] = s
            s+=1
        else:
            s=0
        if arr[h-1-j][i] == '.':
            down[h-1-j][i] = s2
            s2+=1
        else:
            s2=0
mm = 0
for i in range(h):
    for j in range(w):
        if arr[i][j] =='.':
            mm = max(mm,left[i][j]+right[i][j]+up[i][j]+down[i][j]+1)
print(mm)



Measured memory_bytes: 182024
#include<bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
#define REP2(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(v) (v).begin(),(v).end()
#define INF 2e9
typedef long long ll;

int main()
{
  int a,b,c;
  cin>>a>>b>>c;
  int v=0;
  if(a==b) v++;
  if(a==c || b==c) v++;
  cout<<3-v<<endl;
  
	return 0;
}

Measured memory_bytes: 256
n, k = map(int, input().split())
ls = list(range(1, n + 1))

for i in range(k):
    d = int(input())
    ls2 = list(map(int, input().split()))
    for j in range(d):
        if ls2[j] in ls:
            ls.remove(ls2[j])

print(len(ls))


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

#define REP(i, x, n) for (int i = x; i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x.size())
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define uniq(x) x.erase(unique(x.begin(), x.end()), x.end())
#define F first
#define S second
#define mp make_pair
#define eb emplace_back
#define pii pair<int, int>
#define pll pair<ll, ll>

using namespace std;

typedef long long ll;

/* --- INFやMODの値が適切か確認する --- */
// const int INF = 1 << 30;
// const ll INF = 1LL << 60;
// const ll MOD = 1000000007;

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a[i];

  int ans = 0;
  rep(i, n) {
    int j = i;

    while (j + 1 < n && a[j] == a[j + 1]) j++;
    if (j + 1 < n) {
      if (a[j] < a[j + 1])
        while (j + 1 < n && a[j] <= a[j + 1]) j++;
      else
        while (j + 1 < n && a[j] >= a[j + 1]) j++;
    }

    i = j;
    ans++;
  }

  cout << ans << endl;
}


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

using namespace std;


int main() {

	int n;
	cin >> n;

	int a, b;
	vector<int> aa;
	for (int i = 0; i < n; i++) {
		cin >> a ;
		if (a == 0) {
			cin >> b;
			aa.push_back(b);
		}
		if (a == 1) {
			cin >> b;
			cout << aa[b] << endl;;
		}
		if (a == 2) {
			aa.pop_back();
		}
	}

}


Measured memory_bytes: 3872
n,k=gets.split(" ").map(&:to_i)
x=gets.split(" ").map(&:to_i)
ans=[]
(n-k+1).times do |i|
  tmp=x.slice(i,k)
  if tmp[0]<0 && tmp[-1]>0
    if tmp[0].abs > tmp[-1].abs
      ans<<tmp[0].abs+2*tmp[-1].abs
    else
      ans<<2*tmp[0].abs+tmp[-1].abs
    end
  else
    if tmp[0]<0
      ans<<tmp[0].abs
    else
      ans<<tmp[-1].abs
    end
  end
end
puts ans.min


Measured memory_bytes: 10892
#C-755
#復習課題
n=int(input())
lists=[3,5,7]
def caliculate(n):
    if n==1:
        return lists
    elif n>=2:
        listsed=[0]*(3**n)

        index=0
        x=caliculate(n-1)

        for i in x:
            listsed[index]=10*i+3
            index+=1
            listsed[index]=10*i+5
            index+=1
            listsed[index]=10*i+7
            index+=1
        return listsed
ans=0
for i in range(1,10):
    for some in caliculate(i):
        if all( str(i) in str(some) for i in lists) and some<=n:
            ans+=1
print(ans)

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

int main(){
	long long int test=1;
	//cin>>test;
	while(test--){
	    int s,w;
	    cin>>s>>w;
	    if(w>=s)cout<<"unsafe\n";
	    else cout<<"safe\n";
	}
	return 0;
}

Measured memory_bytes: 3632
#define _USE_MATH_DEFINES
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <string>
#include <vector>
#include <utility>
#include <complex>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <tuple>
#include <bitset>
#include <limits>
#include <algorithm>
#include <array>
#include <random>
#include <complex>
#include <regex>
#include <iomanip>
using namespace std;
typedef long double ld;
typedef long long ll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define fcout cout << fixed << setprecision(10)
#define rep(i,n)    for(int i=0; i<(int)n; i++)
#define mp(a,b) make_pair(a,b)
#define pb push_back
#define all(x) x.begin(), x.end()
#define F first
#define S second
const ll inf = 1e18;
const ll mod = 1e9 + 7;

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

// mod.m での a の逆元 a^(-1) を計算する。
ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while(b){
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

ll modpow(ll a, ll n){
    ll res = 1;
    while(n>0){
        if(n&1){
            res = res * a % mod;
        }
        a = a * a % mod;
        n >>=1;
    }
    return res;
}


int main(){
    int n;
    cin >> n;
    int f[10010] = {0};
    for(int x=1; x<=100; x++){
        for(int y=1; y<=100; y++){
            for(int z=1; z<=100; z++){
                int tmp = x*x + y*y + z*z + x*y + y*z + z*x;
                if(tmp < 10010){
                    f[tmp]++;
                }
            }
        }
    }
    rep(i,n){
        cout << f[i+1] << endl;
    }
}



Measured memory_bytes: 3604
import sys
import itertools

sys.setrecursionlimit(10**6)
readline = sys.stdin.readline

def main():
    N, K = map(int, readline().split())
    A = list(map(int, readline().split()))
    
    K = min(50, K)
    for i in range(K):
        B = [0]*N
        for j in range(N):
            st = max(0, j - A[j])
            ed = j + A[j] + 1
            B[st] += 1
            if ed < N:
                B[ed] -= 1
        Bcum = itertools.accumulate(B)
        A = list(Bcum)
    print(*A)

if __name__ == "__main__":
    main()


Measured memory_bytes: 183452
import sys
from collections import defaultdict, Counter, deque
from itertools import accumulate, permutations, combinations
from operator import itemgetter
from bisect import bisect_left, bisect_right, bisect
from heapq import heappop, heappush
from fractions import gcd
from math import ceil, floor, sqrt, cos, sin, pi
from copy import deepcopy

# If you use recursive call, uncomment this code
#sys.setrecursionlimit(10**6)

def main():
    k = int(input())
    s = input()
    if len(s) <= k:
        print(s)
    else:
        print(s[:k] + "...")

if __name__ == '__main__':
    main()


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

int main() {
  int N;
  cin>>N;
  if(N==0) {
    puts("0");
    return 0;
  }
  
  string ans;
  while(N!=0){
    if(N%2!=0){
      N--;
      ans = '1' + ans;
    }
    else ans = '0' + ans;
    N /= -2;
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 764
#include <bits/stdc++.h>
using namespace std;
 
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define FOR(e, c) for (auto &e : c)
#define SORT(v, n) sort(v, v + n);
#define vsort(v) sort(v.begin(), v.end());
#define rvisort(v) sort(v.begin(), v.end(), greater<int>());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define rv(s) reverse(s.begin(),s.end());
 
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using vpii = vector<pii>;
using vs = vector<string>;
using vd = vector<double>;
using ul = unsigned long;
 
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T, class C> void chmin(T& a, C b){ a<b?:a=b; }

int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }

int vtotal(vi& v){
  int total=0;
  rep(i,v.size()) total+=v[i];
  return total;
}

void printv(vi& v){
  rep(i,v.size()) cout << v[i] << " ";
  cout << endl;
}

int main()
{
  cin.tie( 0 );
  ios::sync_with_stdio( false );
  
  int n;cin>>n;
  vi a(n);
  rep(i,n)cin>>a[i];
  
  vi left(n+1,0), right(n+1,0);
  rep(i,n){
    left[i+1]=GCD(left[i],a[i]);
  }
  rrep(i,n){
    right[i]=GCD(right[i+1],a[i]);
  }
  int ans=0;
  rep(i,n){
    int now=GCD(left[i],right[i+1]);
    chmax(ans,now);
  }
  cout(ans);
}

Measured memory_bytes: 1408
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#define pi 3.14159265358979323846264338327950



int main() {
    int a, b; std::cin >> a >> b;
    std::string s; std::cin >> s;
    bool flag = true;
    for (int i = 0; i < s.size(); i++) {
        if ((s.at(i) == '-' && i != a) || (s.at(i) != '-' && i == a))
            flag = false;
    }
    std::cout << (flag ? "Yes" : "No");
}

Measured memory_bytes: 3624
// 基本テンプレート
 
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
using namespace std;
 
#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define int long long int
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
typedef pair<int, int> pii;
typedef long long ll;
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1001001001001001LL;
const ll MOD = 1000000007LL;
 
int cnt[5];
signed main() {
    string pat = "MARCH";
    int N; cin >> N;
    for(int i=0; i<N; i++) {
        string s; cin >> s;
        if(pat.find(s[0]) != string::npos) {
            cnt[ pat.find(s[0]) ]++;
        }
    }

    int ans = 0;
    vector<int> v = {0, 0, 1, 1, 1};
    do {
        int ad = 1;
        for(int i=0; i<5; i++) {
            if(v[i] == 0) continue;
            else ad *= cnt[i];
        }
        ans += ad;
    }while(next_permutation(v.begin(), v.end()));
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import itertools

n=int(input())
c=list(map(int, input().split())) 
c.sort()
ans = 0

for r in itertools.combinations(c, 3):
    if r[0] + r[1] > r[2] and r[0] != r[1] and r[1] != r[2] and r[2] != r[0]:
        ans += 1
        #print(r)

print(ans)

Measured memory_bytes: 9176
// explanation
// https://scrapbox.io/esaka-sandbox/Educational_DP_Contest_%2F_DP_%E3%81%BE%E3%81%A8%E3%82%81%E3%82%B3%E3%83%B3%E3%83%86%E3%82%B9%E3%83%88_-_O_-_Matching

package main

import (
	"bufio"
	"fmt"
	"math/bits"
	"os"
)

// Mod -
const Mod = int(1e9) + 7 // mod

func main() {
	var N int
	fmt.Scanf("%d", &N)

	a := make([][]int, N)
	for i := 0; i < N; i++ {
		a[i] = make([]int, N)
		for j := 0; j < N; j++ {
			a[i][j] = ReadInt()
		}
	}
	dp := make([]int, 1<<N)
	dp[0] = 1
	for s := 0; s < (1 << N); s++ {
		i := bits.OnesCount(uint(s))
		for j := 0; j < N; j++ {
			if s>>j&1 == 0 && a[i][j] == 1 {
				nextS := s | 1<<j
				dp[nextS] += dp[s]
				dp[nextS] %= Mod
			}
		}
	}
	fmt.Println(dp[1<<N-1])
}

var reader = bufio.NewReader(os.Stdin)

// Scan -
func Scan(a ...interface{}) {
	if _, err := fmt.Fscan(reader, a...); err != nil {
		panic(err)
	}
}

// ReadInt -
func ReadInt() (i int) { Scan(&i); return }


Measured memory_bytes: 18844
#include <stdio.h>
#include<string.h>
int are(int a){return a>0?a:-a;}
int main(void){
    char po[114514];
    scanf("%s",po);
    int unti=strlen(po);
    int start=0;
    int end=unti-1;
    int ans=0;
    int maestart=0;
    int maeend=unti-1;
    while(start<=end){
        if(po[start]=='x')start++;
        else{
            if(po[end]=='x')end--;
            else{
                if(po[start]!=po[end]){printf("-1");return 0;}
                else {
                    ans+=are(start-maestart-(maeend-end));
                    maestart=start;
                    maeend=end;
                    start++;
                    end--;
                }
            }
        }
    }
    printf("%d",ans);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n) for(int i=1;i<=(n);i++)
#define lol long long
#define SUM(n) ((n)+1)*(n)/2 //1〜nまでの総和を求める式
#define mp make_pair
#define fi first
#define se second
#define pu push_back
#define SYOU(x) fixed<<setprecision(x+1) //小数点桁数を指定する
#define abs(x,y) max(x,y)-min(x,y)
#define all(v) v.begin(),v.end()
#define UPDigit(a,b) (a+b-1)/b //小数点切り上げ
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const int MOD=int(1e9)+7; 
using namespace std;
using pii = pair<lol, lol>;
typedef vector<int> vit;

//最大公約数
lol gcd(lol x, lol y){ return (y != 0 ? gcd(y, x % y) : x); }
//最小公倍数
lol lcm(lol x, lol y){ return ((x * y) / gcd(max(x, y), min(x, y))); }

signed main(void){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  int n, k;
  cin >> n >> k;
  lol ans = 0, l, r, memo = n;
  l = r = 0;
  rep(i, k){
    l += i;
    r += memo;
    //cout << i << " " << l << " " << memo << " " << r << '\n';
    memo --;
  }
  for(int i = k;i <= n;i ++){
    ans = (ans + (r - l) + 1) % MOD;
    //cout << i << " " << l << " " << memo << " " << r << " " << ans << '\n';
    l += i;
    r += memo;
    memo --;
  }
  ans = (ans + 1) % MOD;
  cout << ans << '\n';
  return 0;
}


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

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

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

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

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

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

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

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

void Main() {
  int N; cin >> N;
  vector<int> L(2 * N);
  rep(i, 0, 2 * N) cin >> L[i];
  sort(all(L));
  int res = 0;
  rep(i, 0, N){
    res += L[2 * i];
  }
  cout << res << endl;
}

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

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

  Main();
}


Measured memory_bytes: 256
#include<iostream>
    #include<algorithm>
    #include<string>
    #include<cmath>
    #include<vector>
    #include<map>
    using namespace std;
    int main() {
        int N, K;
        cin >> N >> K;
        long long ans = K;
        for(int i = 0; i < N-1; i++)
            ans *= K-1;
        cout << ans << endl;
        return 0;
    }

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

#define ld long double
#define ll long long
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define MP make_pair
ll MOD = 1e9+7;
//ll MOD = 998244353;
ll INF = 1e18;
void chmin(ll &a,ll b){if(a>b)a=b;}
void chmax(ll &a,ll b){if(a<b)a=b;}
void pmod(ll &a,ll b){a=(a+b)%MOD;}
void qmod(ll &a,ll b){a=(a*b)%MOD;}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
void ans(bool x,ll y,ll z){if(x)cout<<y<<endl;else cout<<z<<endl;}
void anss(bool x,string y,string z){if(x)cout<<y<<endl;else cout<<z<<endl;}   
ll gcd(ll x,ll y){ll r;while((r=x%y)!=0){x=y;y=r;}return y;}

int main(){
  ll i,j,o;
  ll res=0,res1=0,res2=INF,buf=0,buf1=0,buf2=0,buf3=0,buf4=0;
  bool judge = true;
  string s;cin>>s;
  vector<ll> a(s.size()+1),b(s.size()+1);
  a[0]=1;
  b[0]=1;
  buf=0;
  for(i=1;i<=s.size();i++){
    a[i]=(a[i-1]*3)%MOD;
    b[i]=(b[i-1]*2)%MOD;
  }
  for(i=0;i<s.size()-1;i++){
    if(s[i]=='1'){
      buf2=b[buf];
      qmod(buf2,a[s.size()-i-1]);
      pmod(res,buf2);
      buf++;
    }
  }
  if(s[s.size()-1]=='0')pmod(res,b[buf]);
  else pmod(res,b[buf]*3);
  cout<<res<<endl;
  return 0;
}

Measured memory_bytes: 2048
// AOJ1193
#include <bits/stdc++.h>
#define endl "\n"
#define rep(i,n) for(int i=0;i<int(n);i++)
#define e_b emplace_back
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> ipair;
typedef pair<ll,ll> lpair;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v) //vectorの中身を見る
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
void map_p(map<int,int>& d){cout<<"map: ";for(auto a : d){cout<<"{"<<a.first<<":"<<a.second<<"}";}cout<<endl;} //mapの中身を見る
void set_p(set<int>& d){cout<<"set: ";for(int a : d){cout<<a<<" ";}cout<<endl;} //setの中身を見る


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(12);

    int h;
    while(cin>>h){
        if(h==0) break;
        vector<vector<int>> ban(h,vector<int>(5,0));
        int score=0;
        rep(i,h){
            rep(j,5){
                cin>>ban[i][j];
            }
        }
        bool flag=true;
        while(flag){ //消せるものがあるまで続く。
            flag=false;
            // 各行に消せるものがあるかチェック
            rep(i,h){ 
                int cur=ban[i][0],ren=1,max_del=-1;
                for(int j=1;j<5;j++){
                    if(cur==ban[i][j]) ren++;
                    else{
                        if(3<=ren){
                            score+=cur*ren;
                            for(int k=j-1;k>=(j-1)-(ren-1);k=k-1) ban[i][k]=0;
                            max_del=max(max_del,cur);
                            // cout<<cur<<endl;
                        }
                        cur=ban[i][j],ren=1;
                    }
                }
                if(3<=ren){
                    score+=cur*ren;
                    for(int k=4;k>=4-(ren-1);k=k-1) ban[i][k]=0;
                    max_del=max(max_del,cur);
                    // cout<<cur<<endl;
                }
                if(1<=max_del) flag=true;
            }
            // 各列を下に詰める
            rep(j,5){ //列
                for(int i=h-1;i>=0;i=i-1){
                    if(ban[i][j]>=1) continue;
                    int now=i-1;
                    while(now>=0){
                        if(ban[now][j]>=1){
                            ban[i][j]=ban[now][j],ban[now][j]=0;
                            break;
                        }
                        now--;
                    }
                }
            }
        }
        cout<<score<<endl;
    }
    return 0;
}


Measured memory_bytes: 3108
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define In_The_Name_Of_Allah_The_Merciful ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define Alhamdulillah return 0;
#define debug(n) cerr << "[" << #n << " = " << n << "]" << endl
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define F_OR(i, a, b, s) for (int i = (a); ((s) > 0 ? i < (b) : i > (b)); i += (s))
#define F_OR1(e) F_OR(i, 0, e, 1)
#define F_OR2(i, e) F_OR(i, 0, e, 1)
#define F_OR3(i, b, e) F_OR(i, b, e, (b)<(e)?1:-1)
#define F_OR4(i, b, e, s) F_OR(i, b, e, s)
#define GET5(a, b, c, d, e, ...) e
#define F_ORC(...) GET5(__VA_ARGS__, F_OR4, F_OR3, F_OR2, F_OR1)
#define lp(...) F_ORC(__VA_ARGS__)(__VA_ARGS__)
#define each(x, a) for (auto &x: a)
#define pb push_back
template<class A> void read(vector <A>& v);
template<class A, size_t S> void read(array <A, S>& a);
template<class T> void read(T& x) {
    cin >> x;
}
void read(double& d) {
    string t;
    read(t);
    d=stod(t);
}
void read(long double& d) {
    string t;
    read(t);
    d=stold(t);
}
template<class H, class... T> void read(H& h, T&... t) {
    read(h);
    read(t...);
}
template<class A> void read(vector<A>& x) {
    each(a, x)
        read(a);
}
template<class A, size_t S> void read(array<A, S>& x) {
    each(a, x)
        read(a);
}

const int di[8] = {0 , 0 , 1 , -1 , 1 , 1 , -1 , -1};
const int dj[8] = {1 , -1 , 0 , 0 , 1 , -1 , 1 , -1};


void Suhaib_Sawalha (){

    string s;
    read(s);
    cout << (s == "ABC" ? "ARC" : "ABC");

}

int main(){
                                In_The_Name_Of_Allah_The_Merciful   /* بسم الله الرحمن الرحيم  */
#ifndef ONLINE_JUDGE
    freopen("SuhaibSawalha1.txt","r",stdin);
#endif
// int _;cin>>_;for(int i=1;i<=_;++i,cout<<'\n')
        Suhaib_Sawalha();
                                         Alhamdulillah                    /* الحمد لله */
}


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

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

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

	vector<P> res;
	if (N % 2 == 0) {
		for (int i = 1; i <= N; ++i) {
			for (int j = i + 1; j <= N; ++j) {
				if (i + j == N + 1) { continue; }
				res.push_back(P(i, j));
			}
		}
	} else {
		for (int i = 1; i <= N; ++i) {
			for (int j = i + 1; j <= N; ++j) {
				if (i + j == N) { continue; }
				res.push_back(P(i, j));
			}
		}
	}

	cout << res.size() << endl;
	for (int i = 0; i < res.size(); ++i) {
		cout << res[i].first << " " << res[i].second << endl;
	}

	return 0;
}


Measured memory_bytes: 384
#include <stdio.h>

int main(void){
  
  int a,b,c;
  scanf("%d",&a);
  
  if(a==1){
    printf("Hello World");
  }
  
  else if(a==2){
    scanf("%d",&b);
    scanf("%d",&c);
    printf("%d",b+c);
  }

  return 0;
}


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

long long gcd(long long a, long long b) {
    long long i;
    long long n, ans;
    if ( a < b )
	    n = a;
    else
	    n = b;
    for (i = 1; i <= n; i++)
	    if ( !(a % i) && !(b % i) ) 
	        ans = i;
    return ans;
}

int main(){
    long long a, b; cin >> a >> b;
    long long ans;
    ans = a * b / gcd( a, b );
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
    int n;
    cin>>n;
    int ar[n+2];
    long long sum=0;
    ar[0]=0;
    ar[n+1]=0;
    for(int i=1;i<=n;i++)
    {
        cin>>ar[i];
        sum+=abs(ar[i]-ar[i-1]);
    }
    sum+=abs(0-ar[n]);
    //cout<<sum<<endl;
    long long res=0;
    long long res1=0;
    long long tem=sum;
    for(int j=1;j<=n;j++)
    {
        sum=tem;
        res+=abs(ar[j]-ar[j-1])+abs(ar[j+1]-ar[j]);
        //cout<<"abs(ar[j]-ar[j-1])="<<abs(ar[j]-ar[j-1])<<"   abs(ar[j+1]-ar[j])="<<abs(ar[j+1]-ar[j])<<endl;
        res1+=abs(ar[j+1]-ar[j-1]);
        //cout<<"res="<<res<<" res1="<<res1<<endl;
        sum-=res;
        sum+=res1;

        cout<<sum<<endl;
        sum=0;
        res=0;
        res1=0;
    }



    return 0;
}


Measured memory_bytes: 1664
n = int(input())
s = input()

def make_list(li):
    for i in range(2, n):
        if li[i-1] == 'S':
            if s[i-1] == 'o':
                li[i] = li[i-2]
            else:
                if li[i-2] == 'S':
                    li[i] = 'W'
                else:
                    li[i] = 'S'
        else:
            if s[i-1] == 'o':
                if li[i-2] == 'S':
                    li[i] = 'W'
                else:
                    li[i] = 'S'
            else:
                li[i] = li[i-2]

    hantei(li)

def hantei(li):
    flag = True
    for i in range(2):
        if li[-i] == 'S':
            if s[-i] == 'o':
                if li[-1-i] != li[1-i]:
                    flag = False
            else:
                if li[-1-i] == li[1-i]:
                    flag = False
        else:
            if s[-i] == 'o':
                if li[-1-i] == li[1-i]:
                    flag = False
            else:
                if li[-1-i] != li[1-i]:
                    flag = False

    if flag:
        print_list(li)

def print_list(li):
    for i in li:
        print(i, end = '')
    exit()

li = [[''] * n for _ in range(4)]
li[0][0] = 'S'
li[0][1] = 'S'
li[1][0] = 'S'
li[1][1] = 'W'
li[2][0] = 'W'
li[2][1] = 'S'
li[3][0] = 'W'
li[3][1] = 'W'

for i in range(4):
    make_list(li[i])

print(-1)


Measured memory_bytes: 7924
from collections import deque
n,m = map(int,input().split())
G = [[] for _ in range(n)]
for i in range(m):
    s,t = map(int,input().split())
    s -= 1
    t -= 1
    G[s].append(t)
    G[t].append(s)

uni = [-1]*n
stk = deque()
def dfs(u,c):
    stk.append(u)
    while stk:
        u = stk.pop()
        uni[u] = c
        for v in G[u]:
            if uni[v] != -1: continue
            stk.append(v)

c = 0
for i in range(n):
    if uni[i] == -1:
        dfs(i,c)
        c += 1

q = int(input())
ans = ["no"]*q
for i in range(q):
    s,t = map(int,input().split())
    s -= 1
    t -= 1
    if uni[s] == uni[t]: ans[i] = "yes"

print("\n".join(ans))


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

int main() {
    int n, k; cin >> n >> k;
    vector<pair<int, int>> p(n);
    vector<int> x, y;

    for(int i = 0; i < n; ++i) {
        cin >> p[i].first >> p[i].second;
        x.push_back(p[i].first);
        y.push_back(p[i].second);
    }

    sort(p.begin(), p.end());
    long long ans = numeric_limits<long long>::max();

    for(int y_left : y)
        for(int y_right : y)
            for(int x_up : x) {
                int many = 0;
                for(int i = 0; i < n; ++i) {
                    if(p[i].first >= x_up and p[i].second >= y_left and p[i].second <= y_right) {
                        many += 1;
                        if(many >= k) {
                            ans = min(ans, 1LL * (y_right - y_left) * (p[i].first - x_up));
                        }
                    }
                }
            }

    cout << ans << "\n";
}

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

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

	int x, a;
	scanf("%d %d", &x, &a);
	puts(x < a ? "0" : "10");
	return 0;
}

Measured memory_bytes: 3676
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<string>
#include<sstream>
#include<iomanip>
#include<utility>
#include<cmath>
#include<set>
#include<list>
#include<queue>
#include<stack>
#include<deque>
#include<map>
#include<set>
#include<cstring>
#include<iterator>
#include<bitset>
using namespace std;
 
struct edge {int /*from,*/to,cost;};
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,pair<int,int> > PP;
typedef vector<int> VI;
typedef vector<long long int> VL;
typedef vector<edge> VE;
static const int MOD = 1000000007;
//static const int INF = 2147483647;
//static const long long INF = 9223372000000000000;
//static const long long INF = 9223372000000000000/2;
//static const int INF = 1000010000;
//int dx4[4] = {0,1,0,-1}, dy4[4] = {-1,0,1,0};
//int dx5[5] = {-1,0,0,0,1}, dy5[5] = {0,-1,0,1,0};
//int dx8[8] = {-1,0,1,1,1,0,-1,-1}, dy8[8] = {1,1,1,0,-1,-1,-1,0};
//int dx9[9] = {-1,0,1,1,1,0,-1,-1,0}, dy9[9] = {1,1,1,0,-1,-1,-1,0,0};
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define np next_permutation
#define pq priority_queue
#define UB upper_bound
#define LB lower_bound
#define all(x) (x).begin(),(x).end()
#define SZ(a) int((a).size())
#define LEN(a) int((a).length())
#define MAX(a,b,c) max((a),max((b),(c)))
#define MIN(a,b,c) min((a),min((b),(c)))
#define SORT(c) sort((c).begin(),(c).end())
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REP1(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREP1(i,x) for(int i=((int)(x));i>0;i--)
#define int ll

signed main(){
    int64_t x,y;
    scanf("%lld%lld",&x,&y);

    int ans = 0;
    while(x*((int64_t)pow(2,ans))<=y){
        ans++;
    }

    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 256
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;

fn main() {
    input! {
        n: usize,
        z: i64, w: i64,
        a: [i64; n],
    }
    let mut res = (w - a[n - 1]).abs();
    if n > 1 {
        res = std::cmp::max(res, (a[n - 2] - a[n - 1]).abs());
    }
    println!("{}", res);
}


Measured memory_bytes: 2232
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

//
// # Examples
//
// # integers
// input! { n: usize, m: usize, ... }
//
// # array
// input! { n: usize, v: [i32; n], }
//
// # matrix
// input! { n: usize, m: usize, mat: [[]] }
//
// # string
// input! { s: chars }
//
// 3 4
// ####
// #..#
// .#.#
//
// input!{
//     h: usize,
//     w: usize,
//     board: [chars; h],
// }

// https://practice.contest.atcoder.jp/tasks/practice_1
//fn main() {
//    input!{
//        a: usize, b: usize, c: usize,
//        foo: chars,
//    }
//    let s: String = foo.into_iter().collect();
//    println!("{} {}", a+b+c, s);
//}

fn main() {
    input! { n: usize, x: [usize; if n==1 { 0 } else { 2 }]}
    if n == 1 {
        println!("{}", "Hello World");
    } else if n == 2 {
        println!("{}", x[0]+x[1]);
    }
}

Measured memory_bytes: 4352
K = int(input())

from math import gcd

def g(a,b,c):
  return gcd(gcd(a,b),c)

a = 0
for i in range(1,K+1):
  for j in range(1,K+1):
    for k in range(1,K+1):
      a += g(i,j,k)

print(a)

Measured memory_bytes: 68008
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <iomanip>

int n;

using namespace std;


int main(){
    int a,b;
    while(cin>>a>>b){
        float ab = (float)a*(float)b;
        cout<<setprecision(16)<<ab/3.305785<<endl;
       
    }
}

Measured memory_bytes: 1232
N = int(input())
A = [int(i) for i in input().split()]
count = [0 for _ in range(N+1)]

if N % 2 == 0:
    if len(set(A)) != int(N/2):
        print(0)
        exit()
else:
    if len(set(A)) != int(N/2)+1:
        print(0)
        exit()

for i in A:
    count[i] += 1

#print(count)

res = 1
for i in range(N+1):
    if count[i] == 2:
        res *= 2
    else:
        if count[i] != 0:
            if N % 2 == 1 and i != 0: 
                print(0)
                exit()

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

Measured memory_bytes: 14008
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <iomanip>
#include <queue>
#include <climits> 
#include <time.h>

int main()
{
    long R;
    std::cin >> R;
    std::cout << 3.14159265358979*R*2 << std::endl;
    return 0;
}

Measured memory_bytes: 3784