akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include<iostream>
using namespace std;
#define ll long long int
#define printDoublePrecision(x,y) cout<<fixed<<setprecision(y)<<x

unordered_map<string,double> um;

double dp[301][301][301];

double sushii(int* a,int n,int d1,int d2,int d3){
    int count = d1 + d2 + d3;

    if(count == 0){
        return 0;
    }
    if(dp[d1][d2][d3] >= 0){
        return dp[d1][d2][d3];
    }

    double prob = (double) n / count;
    double avg = 0;
    
    if(d1 != 0){
        double x_one = sushii(a,n,d1 - 1,d2,d3);
        avg += d1 * x_one;
    }
    if(d2 != 0){
        double x_two = sushii(a,n,d1 + 1,d2 - 1,d3);
        avg += d2 * x_two;
    }
    if(d3 != 0){
        double x_three = sushii(a,n,d1,d2 + 1,d3 - 1);
        avg += d3 * x_three;
    }
    // cout<<avg<<endl;
    avg = (double) avg / count;
    avg = avg + prob;
    dp[d1][d2][d3] = avg; 
    return avg;
}


double sushi(int * a,int n){
    int count = 0;
    // int null_count = 0;
    string stat;
    for(int i=0;i<n;i++){
        if(a[i] != 0){
            count++;
        }
        stat.push_back(a[i]);
    }

    if(um.count(stat) > 0){
        return um[stat];
    }
    // cout<<"count "<<count<<endl;
    if(count == 0){
        return 0;
    }

    double prob = (double) n /count;
    // cout<<"prob"<<prob<<endl;
    double avg = 0;
    for(int i=0;i<n;i++){
        int b[n];
        string tempp;
        for(int i=0;i<n;i++){
            b[i] = a[i];
            tempp.push_back(b[i]);
        }
        if(b[i] > 0)
        {
            b[i] -= 1;
            tempp[i] =  tempp[i] - 1;
            double temp= sushi(b,n);
            // sort(tempp.begin(),tempp.end());
            // do{
            //     um[tempp] = temp;
            // }while(next_permutation(tempp.begin(),tempp.end()));
            um[tempp] = temp;
            // cout<<"temp "<<temp<<endl;
            avg += temp;
        }
    }
    avg = (double) avg / count;
    avg = avg + prob;
    // cout<<avg<<endl;
    sort(stat.begin(),stat.end());
    do{
        um[stat] = avg;
    }while(next_permutation(stat.begin(),stat.end()));
    return avg;
}

int main(){
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++) { cin>>a[i]; }
    // printDoublePrecision(sushi(a,n),14);
    // cout<<endl;
    int d0 = 0,d1 = 0,d2 = 0,d3 = 0;
    for(int i=0;i<n;i++){
        if(a[i] == 1){
            d1++;
        }
        if(a[i] == 2)
        {
            d2++;
        }
        if(a[i] == 3){
            d3++;
        }
    }
    memset(dp,-1,sizeof(dp));
    printDoublePrecision(sushii(a,n,d1,d2,d3),14);
    cout<<endl;
    return 0;
}

Measured memory_bytes: 216884
#include <stdio.h>
#include <stdlib.h>

int main( int argc, char *argv[] )
{
    long long n, k;
    long long r1, r2;

    scanf( "%lld %lld", &n, &k );

    r1 = n % k;
    r2 = k - r1;

    if( r1 < r2 ) printf( "%lld\n", r1 );
    else          printf( "%lld\n", r2 );
}


Measured memory_bytes: 128
import numpy as np

n, m, c = [int(x) for x in input().split(' ')]
b = np.asarray([int(x) for x in input().split(' ')])

a = np.ndarray((n, m), dtype=np.int32)
for i in range(n):
    a[i] = [int(x) for x in input().split(' ')]


s = np.sum(a * b, axis=1)
print(np.sum(s + c > 0))


Measured memory_bytes: 12428
#include <iostream>
using namespace std;
int main(void)
{
	int d;
	cin >> d;
	while(d--){
		int n;
		cin >> n;
		int h[110];
		for(int i=0;i < n; i++){
			cin >> h[i];
		}
		int up=0;
		int down=0;
		for(int i=1;i < n; i++){
			if(h[i]>h[i-1]){
				if(h[i]-h[i-1]>up){
					up = h[i] - h[i-1];
				}
			}
			if(h[i] < h[i-1]){
				if(h[i-1]-h[i]>down){
					down = h[i-1] - h[i];
				}
			}
		}
		cout << up << " " << down << endl;
	}
	return 0;
}

Measured memory_bytes: 868
# abc112_b.py
N, T = map(int,input().split())
C = [map(int,input().split()) for i in range(N)]
ans = 10001
for c,t in C:
    if t <= T and ans > c:
        ans = c
if ans <1001:
    print(ans)
else:
    print("TLE")

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define ll long long
const int N=100005;
using namespace std;
int a[10],x;
int main(){
	for(int i=1;i<=5;i++)
	{
		cin>>a[i];
		if(a[i]==0) x=i;
	}
	cout<<x;
    return 0;
}

Measured memory_bytes: 3632
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws Exception {
//		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	//	String line = br.readLine();
		Scanner scan = new Scanner(System.in);
		int a = Integer.parseInt(scan.next());
		int x = a*800;
		int y = a/15*200;
		System.out.println(x-y);

	}
}

Measured memory_bytes: 21972
#include<stdio.h>
#include<string.h>
#define LENGTH 100005

typedef struct pp{
  char name[100];
  int t;
}P;

P Q[LENGTH];
int head,tail,n;

void enqueue(P x){
  Q[tail]= x;
  tail=(tail+1) % LENGTH;
}

P dequeue(){
  P x =Q[head];
  head=(head+1)%LENGTH;
  return x;
}

int min(int a,int b){return a<b ? a:b;}


int main(){

  int elaps=0,c;
  int i,q;

  P u;
  scanf("%d %d", &n, &q);

  for (i=1;i<=n;i++){
    scanf("%s",Q[i].name);
    scanf("%d",&Q[i].t);
  }
  head=1;tail=n+1;

  while(head != tail){
    u=dequeue();
    c=min(q,u.t);
    u.t -= c;
    elaps += c;
    if (u.t>0)enqueue(u);
    else{
      printf("%s %d\n",u.name,elaps);
    }
  }

  return 0;
}



Measured memory_bytes: 11924
#include <bits/stdc++.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

using namespace std;

int main() {
    int N, K;
    cin >> N >> K;
    int h[100000];
    for (int i = 0; i < N; i++) {
        cin >> h[i];
    }

    sort(h, h + N);

    int diffMin = 1000000009;
    for (int i = 0; i < N - K + 1; i++) {
        diffMin = min(diffMin, h[i + K - 1] - h[i]);
    }

    cout << diffMin << endl;
}


Measured memory_bytes: 640
n, k = map(int, input().split())
mod = 10**9+7
m = min(n-1,k)
ans = 0

f = [1]
fi = [1]
for i in range(n):
    f.append(f[i]*(i+1) % mod)
    fi.append(pow(f[i+1], mod-2, mod))

def comb_mod(n, r, mod):
    return f[n] * fi[r] * fi[n-r] % mod

for m in range(m+1):
    ans += comb_mod(n, m, mod) * comb_mod(n-1, m, mod) % mod

print(ans%mod)

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

using ll = long long;
#define int long long
using P = pair<int, int>;

#define LOG(variable) cout << #variable":\t" << (variable) << endl
#define LOGCON(i, container) for(int (i) = 0; (i) < (container).size(); ++(i)) cout << (i) << ":\t" << (container)[(i)] << endl
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPS(i, r, n) for (int i = (r); i < (n); ++i)
#define REPR(i, n) for(int i = (n); i >= 0; --i) // from n to 0
#define REPRS(i, n, r) for(int i = (n); i >= (r); --i) // from n to r
#define REPOBJ(itr, obj) for(auto itr = (obj).begin(); itr != (obj).end() ; ++itr)
#define REPROBJ(itr, obj) for(auto itr = (obj).rbegin(), e = (obj).rend(); itr != e; ++itr)
#define COUTB(x) cout << (x) << "\n"
#define COUTS(x) cout << (x) << " "
#define PB push_back
#define SORT(obj) sort((obj).begin(), (obj).end())
#define SORTR(obj) sort((obj).begin(), (obj).end(), greater<>())
#define ALL(obj) (obj).begin(), (obj).end()
#define MOD 1000000007
#define PI (acos(-1))
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%MOD+MOD)%MOD){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= MOD) x -= MOD;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += MOD-a.x) >= MOD) x -= MOD;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= MOD; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime MOD
  mint inv() const { return pow(MOD-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}
int in() {int x; cin>>x; return x;}
string stin() {string s; cin>>s; return s;}
/***** MAIN *****/
signed main() {
  int n = in();
  int weis[n];
  REP(i,n) {
    cin >> weis[i];
  }
  map<int, int> left_mp, right_mp;
  REP(i,n) {
    ++left_mp[i - weis[i]];
    ++right_mp[i + weis[i]];
  }
  int ans = 0;
  for(auto& right : right_mp) {
    ans += right.second * left_mp[right.first];
  }
  cout << ans;
  cout << "\n";
  return 0;
}
/***** MAIN *****/


Measured memory_bytes: 39460
#include <iostream>
using std::cin;
using std::cout;

inline void shell_sort(unsigned a[], unsigned n){
  const unsigned gaps[] = {1,8,23,77,281,1073,4193,16577,65921,262913,1050113};
  // pow(4,i)+3*pow(2,i-1)+1 (prefixed with 1)

  const auto insertion_sort = [&](unsigned gap){
    unsigned count = 0;
    for(unsigned i = gap; i < n; i++){
      unsigned v = a[i];
      int j = i - gap;
      while(j >= 0 && a[j] > v){
        a[j+gap] = a[j];
        j -= gap;
        count++;
      }
      a[j+gap] = v;
    }
    return count;
  };

  unsigned gap_num = 0, count = 0;
  while(gaps[gap_num+1] < n) gap_num++;

  for(int i = gap_num; i >= 0; i--) count += insertion_sort(gaps[i]);

  cout << (gap_num+1) << '\n';

  for(; gap_num; gap_num--) cout << gaps[gap_num] << ' ';
  cout << gaps[0] << '\n';

  cout << count << '\n';
}

int main(){
  std::ios::sync_with_stdio(false);
  unsigned n,i;
  cin >> n;
  auto a = new unsigned[n];
  for(i = 0; i < n; i++) cin >> a[i];
  shell_sort(a,n);
  for(i = 0; i < n; i++) cout << a[i] << '\n';
  delete[](a);
}

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

using namespace std;

int cnt[100000];
bool used[100000];
//bool used_tree[100000];
vector<int> G[100000];

struct edge{
    int from, to, cnt;
};

vector<edge> T[100000];

struct UnionFind {
  vector<int> data;
  UnionFind(int size) : data(size, -1) { }
  bool unionSet(int x, int y) {
    x = root(x); y = root(y);
    if (x != y) {
      if (data[y] < data[x]) swap(x, y);
      data[x] += data[y]; data[y] = x;
    }
    return x != y;
  }
  bool findSet(int x, int y) {
    return root(x) == root(y);
  }
  int root(int x) {
    return data[x] < 0 ? x : data[x] = root(data[x]);
  }
  int size(int x) {
    return -data[root(x)];
  }
};

int a[100000];
int b[100000];
bool used_tree[100000];
//int rev[100000];

int dfs(int v){
    used[v] = true;
    int ans = 0;
    if(cnt[v]%2 == 1) ans++;
    for(int i = 0; i < T[v].size(); i++){
        if(!used[T[v][i].to]){
            int tmp = dfs(T[v][i].to);
            if(tmp %2 == 1){
                T[v][i].cnt++;
            }
            ans += tmp;
        }
    }
    return ans;
}

void dfs_out(int v){
    used[v] = true;
    for(int i = 0; i < T[v].size(); i++){
        if(!used[T[v][i].to]){
            int f = v;
            int t = T[v][i].to;
            if(T[v][i].cnt %2 == 0){
                cout << min(f, t)+1 << ' ' << max(f, t)+1 << endl;
            }else{
                cout << max(f, t)+1 << ' ' << min(f, t)+1 << endl;
            }
            dfs_out(T[v][i].to);
        }
    }
}

int main(){
    int N, M;
    cin >> N >> M;
    for(int i = 0; i < M; i++){
        int s, t;
        cin >> s >> t;
        s--;
        t--;
        if(s > t) swap(s, t);
        a[i] = s;
        b[i] = t;
        cnt[s]++;
    }
    int cnt_odd = 0;
    for(int i = 0; i < N; i++){
        if(cnt[i]%2 == 1) cnt_odd++;
    }
    if(cnt_odd%2 == 1){
        cout << -1 << endl;
        return 0;
    }
    UnionFind uf(N);
    for(int i = 0; i < M; i++){
        if(uf.root(a[i]) != uf.root(b[i])){
            uf.unionSet(a[i], b[i]);
            edge e1 = (edge){a[i], b[i], 0};
            edge e2 = (edge){b[i], a[i], 0};
            T[a[i]].push_back(e1);
            T[b[i]].push_back(e2);
            used_tree[i] = true;
            //cout << 'T' << endl;
        }
    }
    for(int i = 0; i < M; i++){
        if(!used_tree[i]){
            cout << a[i]+1 << ' ' << b[i]+1 << endl;
        }
    }
    //cout <<'H' << endl;
    dfs(0);
    for(int i = 0; i < N; i++) used[i] = false;
    dfs_out(0);
}

Measured memory_bytes: 18944
n,k=map(int,input().split())
x=[i for i in range(n+1)]
ans=0
xmin=0
xmax=0
for i in range(len(x)):
    xmin+=x[i]
    xmax+=x[-i-1]
    if i>=k-1:
        ans+=xmax-xmin+1


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

Measured memory_bytes: 16880
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<deque>
#include<map>
#include<queue>
#define inf 1000000007
#define maxn 2020
using namespace std;
typedef long long ll;
int read()
{
    int x=0,f=1;
    char ch=getchar();
    while(ch-'0'<0||ch-'0'>9){if(ch=='-') f=-1;ch=getchar();}
    while(ch-'0'>=0&&ch-'0'<=9){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
char ch[maxn][maxn];
int a[maxn][maxn];
int up[maxn][maxn];
int n,m,l[maxn][maxn],r[maxn][maxn];
int s[maxn],top;
int main()
{
    n=read();m=read();
    for(int i=1;i<=n;i++)  scanf("%s",ch[i]+1);
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=m;j++)
          if(ch[i][j]=='.')  a[i][j]=1;
    }
    n--;m--;
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=m;j++)
        {
            if((a[i][j]^a[i+1][j]^a[i][j+1]^a[i+1][j+1])==0)  a[i][j]=1;
            else                                              a[i][j]=0;            
        }

    }
    for(int i=1;i<=n+1;i++)  a[i][m+1]=0;
    for(int i=1;i<=m+1;i++)  a[n+1][i]=0;
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=m;j++)
        {
            if(!a[i][j])  continue;
            up[i][j]=up[i-1][j]+1;
        }
    }
    for(int i=1;i<=n;i++)
    {
        top=0;s[0]=0;
        for(int j=1;j<=m;j++)
        {
            while(top&&up[i][j]<=up[i][s[top]])  top--;
            l[i][j]=s[top]+1;
            s[++top]=j;
        }
    }
    for(int i=1;i<=n;i++)
    {
        top=0;s[0]=m+1;
        for(int j=m;j>=1;j--)
        {
            while(top&&up[i][j]<=up[i][s[top]])  top--;
            r[i][j]=s[top]-1;
            s[++top]=j;
        }
    }
    int ans=max(n,m)+1;
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=m;j++)
        {
            if(!a[i][j])  continue;
            ans=max(ans,(up[i][j]+1)*(r[i][j]-l[i][j]+2));
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 67968
#include <iostream>
#include <algorithm>
#include <limits>
#include <vector>
#include <map>
#include <cmath>
#include <limits>
#include <iomanip>
#include <numeric>
#include <queue>
#include <string.h>
#include <sstream>
#include <bitset>

#define ll long long int
#define ld long double
#define rep(i,n) for(ll i = 0;i < n;i++)
#define rep1(i,n) for(ll i = 1;i < n;i++)
#define co(x) cout << x << endl
#define cosp(x) cout << x << " "
#define all(x) x.begin(),x.end()
#define allr(x) x.begin(),x.end(),greater<ll>()
#define P pair<ll,ll>
#define pb push_back
#define mp make_pair
#define MOD 1000000007
#define INF 1ll << 60
#define PI 3.14159265359

using namespace std;

int main(){

	ll n,m;
	cin >> n >> m;

	vector<ll> p(m);
	vector<string> s(m);
	vector<int> flag(n+1,-1);
	vector<int> wa_vec(n+1,0);
	ll ac = 0,wa = 0;

	for(ll i = 0;i < m;i++){
		cin >> p[i] >> s[i];
	}

	for(ll i = 0;i < m;i++){
		if(s[i] == "AC"){
			if(flag[p[i]] == -1){
				flag[p[i]] = 1;
				wa += wa_vec[p[i]];
				ac++;
			}
		}
		else{
			if(flag[p[i]] == -1){
				wa_vec[p[i]]++;
			}
		}
	}

	cout << ac << " " << wa << endl;

	return 0;
}


Measured memory_bytes: 7296
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define int long long
#define double long double
#define all(a) a.begin(), a.end()
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; }
using namespace std;

const int mx = 100010;
const int inf = 1000000000000000;
struct edge{
    int from, to, sum;
    edge(int from = 0, int to = 0, int sum = 0) : from(from), to(to), sum(sum) {}
};

int N, M;
vector<edge> G[mx];
vector<edge> oddCycle;

int color[mx];
bool isBipartite(int v, int c){
    color[v] = c;
    for(edge e : G[v]){
        oddCycle.push_back(e);
        if(color[e.to] == c)return false;
        if(color[e.to] == 0 and !isBipartite(e.to, -c))return false;
        oddCycle.pop_back();
    }
    return true;
}

bool used[mx];
int number[mx];
void decideNumber(int v, int num){
    used[v] = true;
    number[v] = num;
    for(edge e : G[v]){
        if(!used[e.to])decideNumber(e.to, e.sum - num);
    }
}

bool doesContradict(){
    rep(i, N){
        for(edge e : G[i]){
            if(number[e.from] + number[e.to] != e.sum)return true;
        }
    }
    return false;
}

bool isAllPositive(){
    rep(i, N){
        if(number[i] <= 0)return false;
    }
    return true;
}

signed main(void){
    
    cin >> N >> M;
    rep(i, M){
        int u, v, s; cin >> u >> v >> s; u--; v--;
        G[u].push_back(edge(u, v, s));
        G[v].push_back(edge(v, u, s));
    }

    if(isBipartite(0, 1)){
        decideNumber(0, 1);
        if(doesContradict()){
            cout << 0 << endl;
            return 0;
        }
        int ansMax = inf, ansMin = -inf;
        rep(i, N){
            if(color[i] == 1)chmax(ansMin, 2 - number[i]);
            else chmin(ansMax, number[i]);
        }
        cout << max<int>(ansMax - ansMin + 1, 0) << endl;
    } else {
        reverse(all(oddCycle));
        int start = oddCycle[0].to;
        int sumAll = 0, sumOdd = 0;
        rep(i, (int)oddCycle.size()){
            sumAll += oddCycle[i].sum;
            if(i % 2 == 1)sumOdd += oddCycle[i].sum;
            if(oddCycle[i].from == start)break;
        }
        if(sumAll % 2 == 1){
            cout << 0 << endl;
            return 0;
        }
        decideNumber(start, sumAll / 2 - sumOdd);
        cout << ((!doesContradict() and isAllPositive()) ? 1 : 0) << endl;
        return 0;
    }

}

Measured memory_bytes: 21488
//Author: Fuadul Hasan(fuadul202@gmail.com)
//BSMRSTU,Gopalganj
#include<bits/stdc++.h>
using namespace std;int tc = 1;
#define happy ios::sync_with_stdio(false);
#define coding  cin.tie(0);
#define mp make_pair
#define ll long long
#define Pi atan(1)*4
#define pb  push_back
#define vpr vector<pr> 
#define pr pair<int, int> 
#define vi std::vector<int>
#define vll std::vector<ll>
#define YES printf("YES\n");
#define NO printf("NO\n");
#define Yes printf("Yes\n");
#define No printf("No\n");
#define all(n) n.begin(),n.end()
#define point(x) setprecision(x)
#define Test printf("Case %d: ",tc++);
#define Unique(c) (c).resize(unique(all(c))-(c).begin())
#define vout(v) for (auto z: v) cout << z << " "; cout << endl;

const int M = 1e9 + 7;
const ll  Inf = (ll)2e18 + 5;
const int N   = 2e5 + 5;

int solve() 
{
	//happy coding
	
	int n;
	cin>>n;
	for(int i = 128;i>=-128 ;i --){
		for(int j= -128;j<=128;j++){
			ll a = pow((ll)i,5);
			ll b = pow((ll)j,5);
			if(a-b==(ll)n){
				//cout<<a<<" "<<b<<endl;
				cout<<i<<" "<<j<<endl;
				return 0;
			}
		}
	}


	
	return 0;
}
int main(){
	int test = 1;
	//scanf("%d", &test);
	while (test--)solve();return 0;
}

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

int main()
{
  int n;
  cin>>n;
  vector<int> a(n);
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  deque<int> b;
  for(int i=0;i<n;i++){
    if(i%2==0){
      b.push_front(a[i]);
    }
    else b.push_back(a[i]);
  }
  if(n%2==0){
    reverse(b.begin(),b.end());
  }
  for(auto &e: b){
    cout<<e<<" ";
  }
  
}

Measured memory_bytes: 3840
#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; }

#define rep(i,cc,n) for(int i=cc;i<n;++i)
#define lrep(i,cc,n) for(long long i=cc;i<n;++i)
#define sqrep(i,cc,n) for(long long i=cc;i*i<=n;++i)
#define rrep(i,cc,n) for(long i=cc;i>n;--i)
#define pii pair<int, int>
#define pll pair<long long, long long>
 
using ll = long long;

const vector<int> dx = {1, 0, -1, 0};
const vector<int> dy = {0, 1, 0, -1};
const double PI = 3.1415926535;
const ll inf = 1001001001;
const ll e9  = 1000000000;
const ll mod = 1000000007;

int main(){
    vector<ll>v(3);
    rep(i, 0, 3)cin >> v[i];
    sort(v.begin(),v.end());
    ll a, b, c;
    a = v[0], b = v[1], c = v[2];
    if(a%2==1||b%2==1||c%2==1){
        cout << 0 << endl;
        return 0;
    }
    if(a==b&&b==c){
        cout << -1 << endl;
        return 0;
    }
    int ans = 0;
    while(a%2==0&&b%2==0&&c%2==0){
        ll tempa = (b+c)/2;
        ll tempb = (a+c)/2;
        ll tempc = (a+b)/2;
        a = tempa;
        b = tempb;
        c = tempc;
        ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3616
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a, b, c;
		
		a = sc.nextInt();
		b = sc.nextInt();
		c = sc.nextInt();
		
		a = b - a;
		c -= b;
		
		if(a == c)System.out.println("YES");
		else System.out.println("NO");
		sc.close();
	}

}


Measured memory_bytes: 22868
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define FORR(i,m,n) for(int i = m - 1; i >= n; i--)
#define ALL(v) v.begin(), v.end()
#define itn int
#define Yes() cout << "Yes" << endl
#define No() cout << "No" << endl
#define YES() cout << "YES" << endl
#define NO() cout << "NO" << endl
template<typename T, typename U>
inline bool CMAX(T &m, U x) { if (m < x) { m = x; return true; } return false; }
template<typename T, typename U>
inline bool CMIN(T &m, U x) { if (m > x) { m = x; return true; } return false; }

typedef long long lint;
typedef long double ldouble;
const int INF = 1e9;
const lint LINF = 1e18;
const int MOD = 1e9+7;
int main(){
    int n,m;
    cin >> n >> m;
    vector<int> num(n,-1);
    
    REP(i,m){
        int keta,val;
        cin >> keta >> val;
        if(num[keta - 1] != -1 && num[keta - 1] != val){
            cout << -1 << endl;
            return 0;
        }
        if(n != 1 && keta == 1 && val == 0){
            cout << -1 << endl;
            return 0;
        }
        num[keta - 1] = val;
    }
    if(n == 1){
        if(num[0] == -1)
            num[0] = 0;
        cout << num[0] << endl;
    }else if(n == 2){
        if(num[0] == -1)
            num[0] = 1;
        if(num[1] == -1)
            num[1] = 0;
        cout << num[0] << num[1] << endl;
    }else if(n == 3){
        if(num[0] == -1)
            num[0] = 1;
        if(num[1] == -1)
            num[1] = 0;
        if(num[2] == -1)
            num[2] = 0;
        cout <<num[0] << num[1] <<num[2] << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define LL long long
#define REP(i,n) for(int i=0;i<(n);++i)
#define lp(i,n) for(int i=0;i<(n);++i)
#define REPA(i,n) for(int i=1;i<(n);++i)
#define foreach(i, n) for(auto &i:(n))
#define PII pair<int,int>
#define PLI pair<long long, int>
#define PLL pair<long long, long long>
#define MOD ((int)1e9 + 7)
#define INF ((int)1e9)
#define INFLL ((LL)1e18)
#define ALL(x) (x).begin(),(x).end()
#define BIT(x) (1 << (x))
using namespace std;

int main(){
	int N;
	cin >> N;
	vector<vector<PLL>> roads(N+1);
	REP(i, N-1){
		int a, b, c;
		cin >> a >> b >> c;
		roads[a].push_back({b, c});
		roads[b].push_back({a, c});
	}
	int Q;
	int K;
	cin >> Q >> K;
	vector<LL> fast(N+1, INF);
	fast[K]=0;
	queue<PLL> que;
	que.push({K, 0});
	while(!que.empty()){
		PLL d = que.front();
		que.pop();
		fast[d.first]=d.second;
		foreach(i, roads[d.first]){
			if(fast[i.first]!=INF)continue;
			que.push({i.first, i.second+d.second});
		}
	}
	REP(i, Q){
		int x, y;
		cin >> x >> y;
		cout << fast[x]+fast[y] << endl;
	}
}


Measured memory_bytes: 10736
H, W = map(int,input().split())
grid = ['.'*(W+2)]
for _ in range(H):
    tmp = input()
    tmp = '.' + tmp + '.'
    grid.append(tmp)
grid.append('.'*(W+2))
for i in range(1,H+1):
    for k in range(1,W+1):
        if grid[i][k] == '.':
            continue
        if grid[i][k+1] != '#' and grid[i][k-1] != '#':
            if grid[i+1][k] != '#' and grid[i-1][k] != '#':
                print('No')
                exit()
print('Yes')

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int a[200000],tmp[200000];
int main()
{
	int n,i;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%d",&a[i]);
		tmp[i]=a[i];
	}
	sort(tmp,tmp+n);
	for(i=0;i<n;i++)
	{
		if(a[i]<=tmp[n/2-1])
			printf("%d\n",tmp[n/2]);
		else
			printf("%d\n",tmp[n/2-1]);
	}
	return 0;
}

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

int a,b,c,d,d1,d2,d3;

int main(){
	cin >> a >> b >> c >> d;
	d1 = abs(b-a);
    d2 = abs(c-b);
  	d3 = abs(a-c);
	if(d1 <= d && d2 <= d)cout << "Yes"<<endl;
  	else if(d3 <= d)cout << "Yes"<<endl;
  	else cout <<"No"<<endl;

}

Measured memory_bytes: 256
n = int(input())
p = list(map(int,input().split()))
ans_list = []

for i in range(1,n-1):
    if p[i-1]<p[i]<p[i+1] or p[i+1] < p[i] < p[i-1] :
        ans_list.append(i)
print(len(ans_list))

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

int main() {
    int n;
    cin>>n;
    int x = n%10;
    if(x == 2 || x == 4 || x==5 || x == 7 || x==9)
        cout<<"hon\n";
    else if(x == 0 || x == 1 || x == 6 || x ==8)
        cout<<"pon\n";
    else if(x ==3)
        cout<<"bon\n";
    return 0;
}

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

 using namespace std;

 int main() {
   string S, ans;
   int i, j;

   cin >> S;

   ans = "yes";
   for (i = 0; i < S.length() - 1; i ++) {
     for (j = i + 1; j < S.length(); j++) {
       if (S.at(i) == S.at(j)) {
         ans = "no";
         break;
       }
     }
     if (ans == "no") break;
   }
   cout << ans << endl;
 }


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
using namespace std;
long long int dp[100000][13];
long long int n;
int main(){
	string s;
	cin >> s;
	n = s.size();
	long long int p = 1; //10^nを13で割った余り
	long long int num;
	for(int i = 0;i < 100000;i++){
		for(int j = 0;j < 13;j++){
			dp[i][j] = 0;
		}
	}
	if(s[n - 1] == '?'){
		for(int i = 0;i < 10;i++){
			dp[n - 1][i] = 1;
		}
	}else{
		dp[n - 1][s[n - 1] - '0'] = 1;
	}
	for(int i = 1;i < n;i++){
		p = (p * 10) % 13;
		if(s[n - i - 1] == '?'){
			for(int k = 0;k < 10;k++){
				for(int j = 0;j < 13;j++){
					dp[n - i - 1][(j + (p * k) % 13) % 13] += dp[n - i][j];
					dp[n - i - 1][(j + (p * k) % 13) % 13] %= 1000000007;
				}
			}
		}else{
			num = s[n - i - 1] - '0';
			for(int j = 0;j < 13;j++){
				dp[n - i - 1][(j + (p * num) % 13) % 13] = dp[n - i][j];
			}
		}
	}
	long long int sum = 0;
	cout << dp[0][5] << endl;
}

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

#ifdef _PRINTDEBUG
  #include "lib/printdebug.hpp"
#else
  #define printdebug(...) 1
#endif
#define I1000000007 (1000000007)
#define I998244353   (998244353)
#define IINF             (1<<28)
#define LINF           (1LL<<60)
#define ALL(a)         (a).begin(), (a).end()
#define rep(i, n)      REP(i, 0, (n))
#define repc(i, n)     REPC(i, 0, (n))
#define REP(i, n, m)   for (int i = (int)(n); i <  (int)(m); i++)
#define REPC(i, n, m)  for (int i = (int)(n); i <= (int)(m); i++)
#define REPCM(i, n, m) for (int i = (int)(n); i >= (int)(m); i--)
#define yesno(cond)       YESNO((cond), "Yes", "No")
#define YESNO(cond, a, b) cout << ((cond) ? (a) : (b)) << "\n"
template<class T> inline bool chmin(T& a, const T& b) {
  if (a > b) { a = b; return true; } else return false;
}
template<class T> inline bool chmax(T& a, const T& b) {
  if (a < b) { a = b; return true; } else return false;
}

namespace solver {
  using namespace std;
  using ll = long long;

  ll N, X;
  vector<ll> A;
  vector<ll> memo;

  void init() {
    cin >> N >> X;
    A.resize(N);
    memo.resize(N);
    rep(i, N) {
      cin >> A[i];
      memo[i] = A[i];
    }
  }

  void solve() {
    ll minv = LINF;
    rep(k, N) {
      ll ans = 0;
      rep(i, N) {
        chmin(memo[i], A[(i-k+N)%N]);
        ans += memo[i];
      }
      ans += k*X;
      chmin(minv, ans);
    }
    cout << minv << "\n";
  }
}

int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  solver::init();
  solver::solve();
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin>>n;
  int a[n];
  for(int i=0; i<n; i++)
    cin>>a[i];
  int dp[n];
  dp[0]=0;
  dp[1]=abs(a[1]-a[0]);
  for(int i=2; i<n; i++)
  {
    dp[i]=min(dp[i-1]+abs(a[i]-a[i-1]),dp[i-2]+abs(a[i]-a[i-2]));
  }
  cout<<dp[n-1];
}


Measured memory_bytes: 1024
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
if sum(a)<sum(b):
  print(-1)
  exit(0)
t=sum(a)-sum(b)
l=[]
for i in range(n):
  if a[i] >= b[i]:
    l.append(a[i]-b[i])
l.sort()
ans=0
for x in l:
  t-=x
  if t<0:
    break
  ans+=1
print(n-ans)

Measured memory_bytes: 19536
#include<stdio.h> 
int main(){
  int n, i;
  int A[100000];
  scanf("%d", &n);
  for (i = 1;i <= n;i++){
    scanf("%d", &A[i]);
  }
  for (i = 1; i <= n; i++) {
    printf("node %d: key = %d, ", i, A[i]);
    if(i / 2 >= 1) printf("parent key = %d, ", A[i/2]);
    if(i*2 <= n) printf("left key = %d, ", A[i*2]);
    if(i*2+1 <= n) printf("right key = %d, ", A[i*2+1]);
    printf("\n");
  }  
  return 0;
}

Measured memory_bytes: 604
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
const ll mod=1000000007;
const int MAX_N = 1000;         // n の最大値
 
// nCk を取得
double nCk(int n, int k) {
double res=1.0;
for(int i=0; i<n; i++){
res*=0.5;}
for(int i=0; i<k; i++){
res*=(double)(n-i);
res/=(double)(k-i);
}
return res;}
 
int main() {
ll n;
cin>>n;
ll a[n]={};
for(ll i=0; i<n; i++){
cin>>a[i];}
ll rui[n]={};
rui[0]=a[0];
for(ll i=1; i<n; i++){
rui[i]=rui[i-1]+a[i];}
ll ma=rui[n-1];
ll ca=0;
ll ans =1000000000000;
for(ll i=0; i<n; i++){
if(ma - rui[i] >= rui[i]){
ca = ma -rui[i] -rui[i];}
else {
ca = ( rui[i] - (ma - rui[i]));}
ans = min(ca , ans);}
cout <<ans<< endl;
return 0;}



Measured memory_bytes: 6760
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N,M;
  cin >> N >> M;
  vector<int> A(N);
  for(int i=0;i<N;i++){
    A[i] = 0;
  }
  for(int i=0;i<M;i++){
    int a, b;
    cin >> a >> b;
    if(a == 1&&b==0 && N!= 1){
      cout << -1 << endl;
      return 0;
    }
    if(A[a-1] != 0 && A[a-1] != b){
      cout << -1 << endl;
      return 0;
    }else{
      A[a-1] = b;
    }
  }
  if(A[0] == 0 && N!=1)A[0] = 1;
  for(int i=0;i<N;i++){
    cout << A[i];
  }
  cout << endl;
}
  


Measured memory_bytes: 256
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")
    };
}

use std::cmp;

fn main() {
    input! {
        n: usize,
        abc: [[i64; 3]; n],
    }

    // dp[i][j]: i日目にjの活動を行ったときの幸福度の総和の最大値
    let mut dp = vec![vec![0_i64; 3]; n];
    dp[0][0] = abc[0][0];
    dp[0][1] = abc[0][1];
    dp[0][2] = abc[0][2];

    for i in 1..n {
        for j in 0..3 {
            for k in 0..3 {
                if j == k {
                    continue;
                }
                dp[i][j] = cmp::max(dp[i][j], dp[i - 1][k] + abc[i][j]);
            }
        }
    }

    println!("{}", dp[n - 1].iter().max().unwrap());
}

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

using namespace std;
const int N = 1e5 + 5;
int arr[N];

int main() {
    //freopen("in.txt", "rt", stdin);
    int n, q, x;
    scanf("%d %d", &n, &q);
    priority_queue<int> pq;
    for (int i = 0; i < n; ++i) {
        scanf("%d", arr + i);
    }
    sort(arr, arr + n);
    int a, b;
    vector<pair<int, int>> vec;
    int z = 0;
    while (q--) {
        scanf("%d %d", &a, &b);
        vec.emplace_back(b, a);
    }
    sort(vec.rbegin(), vec.rend());
    long long ans = 0;
    vector<int> nv;
    for (auto p:vec) {
        while (p.second && nv.size() < n) {
            nv.push_back(p.first);
            p.second--;
        }
    }
    while (nv.size() < n) nv.push_back(0);
    for (int i = 0; i < n; ++i) {
        ans += max(arr[i], nv[i]);
    }
    printf("%lld", ans);
}

Measured memory_bytes: 2292
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll n,a,b;
ll x,y;

bool flg;
int main(){
	cin>>n>>a>>b;
	int t=(a-b)&1;
	if(!t){
		if(a>b)cout<<(a-b)/2<<endl;
		else cout<<(b-a)/2<<endl;
	}
	if(t){
		if(a<b)swap(a,b);
		x=min(n-a,n-b)+(a-b+1)/2;
		y=min(a,b)+(a-b)/2;
		cout<<min(x,y)<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Diagnostics;
using System.Numerics;

namespace PaizaSkillCheck
{
    public class Program
    {
        public static void Main(string[] args)
        {
            string[] line = Console.ReadLine().Split(' ');

            int t = int.Parse(line[0]);
            int x = int.Parse(line[1]);

            Console.WriteLine((double)t / (double) x);
            Console.ReadLine();
        }
    }

}


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

int main(){
  int k;
  cin >> k;
  cout << ((k+1)/2) * (k/2) <<endl;
}



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

int main() {
  int n;
  cin>>n;
  vector<int>a(n);
  vector<int>b(n);
  vector<int>c(n);
  for(int i=0;i<n;i++) cin>>a[i];
  for(int i=0;i<n;i++) cin>>b[i];
  for(int i=0;i<n;i++) cin>>c[i];
  sort(a.begin(),a.end());
  sort(b.begin(),b.end());
  sort(c.begin(),c.end());
  long long ans=0;
  for(int i=0;i<n;i++){
    int x=b[i];
    auto y=upper_bound(c.begin(),c.end(),x);
    long long mini=distance(y,c.end());
    auto z=lower_bound(a.begin(),a.end(),x);
    long long l=distance(a.begin(),z);
    ans+=mini*l;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=3e5+5,mod=1e9+7;
int n,k,m,a[N];
ll f[N],invf[N];
ll inv(ll x){return x==1?1:(mod-mod/x)*inv(mod%x)%mod;}
ll C(int n,int m)
{
    return f[n]*invf[n-m]%mod*invf[m]%mod;
}
ll qpow(ll a,ll n)
{
    ll ans=1;
    while(n)
    {
        if(n&1) ans=ans*a%mod;
        a=a*a%mod;
        n>>=1;
    }
    return ans;
}
int vis[N];
bool check()
{
    int t=0;
    for(int i=1;i<=m;i++)
    {
        vis[a[i]]++;
        if(vis[a[i]]==1) t++;
        if(i>k)
        {
            vis[a[i-k]]--;
            if(vis[a[i-k]]==0) t--;
        }
        if(t==k) return true;
    }
    return false;
}
bool distinct()
{
    memset(vis,false,sizeof(vis));
    for(int i=1;i<=m;i++)
    {
        vis[a[i]]++;
        if(vis[a[i]]==2) return false;
    }
    return true;
}
ll dp[N][405],g[N][405];
ll solve1()
{
    dp[0][0]=1;
    for(int i=1;i<=n;i++)
    {
        ll s=0,t=0;
        for(int j=k-1;j>=1;j--)
        {
            (s+=dp[i-1][j])%=mod;
            (t+=g[i-1][j])%=mod;
            (dp[i][j]+=dp[i-1][j-1]*(k-(j-1)))%=mod;
            (g[i][j]+=g[i-1][j-1]*(k-(j-1)))%=mod;
            (dp[i][j]+=s)%=mod;
            (g[i][j]+=t)%=mod;
            if(j>=m) (g[i][j]+=dp[i][j])%=mod;
        }
    }
    ll ans=0;
    for(int i=1;i<=k;i++) (ans+=g[n][i])%=mod;
    return ans%mod*inv(C(k,m)*f[m]%mod)%mod;
}
ll solve2()
{
    memset(vis,0,sizeof(vis));
    int s=0,t=0;
    for(int i=1;i<=m;i++)
    {
        vis[a[i]]++;
        if(vis[a[i]]==2) break;
        s++;
    }
    memset(vis,0,sizeof(vis));
    for(int i=m;i>=1;i--)
    {
        vis[a[i]]++;
        if(vis[a[i]]==2) break;
        t++;
    }
    dp[0][s]=1;
    g[0][t]=1;
    for(int i=1;i<=n;i++)
    {
        ll s=0,t=0;
        for(int j=k-1;j>=1;j--)
        {
            (s+=dp[i-1][j])%=mod;
            (t+=g[i-1][j])%=mod;
            (dp[i][j]+=dp[i-1][j-1]*(k-(j-1)))%=mod;
            (g[i][j]+=g[i-1][j-1]*(k-(j-1)))%=mod;
            (dp[i][j]+=s)%=mod;
            (g[i][j]+=t)%=mod;
        }
    }
    for(int i=0;i<=n;i++)
        for(int j=1;j<=k;j++)
    {
        (dp[i][j]+=dp[i][j-1])%=mod;
        (g[i][j]+=g[i][j-1])%=mod;
    }
    ll ans=0;
    for(int i=m;i<=n;i++)
        ans=(ans+dp[i-m][k]*g[n-i][k])%mod;
    return ans;
}
int main()
{
    f[0]=invf[0]=f[1]=invf[1]=1;
    for(int i=2;i<N;i++) f[i]=f[i-1]*i%mod,invf[i]=(mod-mod/i)*invf[mod%i]%mod;
    for(int i=2;i<N;i++) invf[i]=invf[i-1]*invf[i]%mod;
    scanf("%d%d%d",&n,&k,&m);
    for(int i=1;i<=m;i++) scanf("%d",&a[i]);
    ll ans=(n-m+1)*qpow(k,n-m)%mod;
    if(check()){printf("%lld\n",ans);return 0;}
    if(distinct()) ans=(ans+mod-solve1())%mod;
    else ans=(ans+mod-solve2())%mod;
    printf("%lld\n",ans);
}


Measured memory_bytes: 170240
import java.util.Scanner;

public class Main {
	public static void main(String[]args){
		Scanner sc=new Scanner(System.in);
		int k=1;
		while(k==1){
			int a=sc.nextInt();	
			String op=sc.next();
			int b=sc.nextInt();
			if(op.equals("+"))
				System.out.println(a+b);
			else if(op.equals("-"))
				System.out.println(a-b);
			else if(op.equals("*"))
				System.out.println(a*b);
			else if(op.equals("/"))
				System.out.println(a/b);
			else
				break;
		}
		
	}

}


Measured memory_bytes: 26400
#include <bits/stdc++.h>
#include <sys/types.h>
#include <unistd.h>

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

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

using ll=long long;
using R=long double;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

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

const pid_t pid = getpid();
// Problem Specific Parameter:
const int limit = 100010;
int win[limit];
int n,a[110];

int rec(int m){
	int &ret = win[m];
	if(ret >= 0) return ret;
	ret = 0;
	rep(i,n){
		if(m - a[i] >= 0 and rec(m - a[i]) == 0){
			ret = 1;
		}
	}
	return ret;
}

int main(void){
	int k;
	cin >> n >> k;
	rep(i,k+1) win[i] = -1;
	rep(i,n) cin >> a[i];
	puts(rec(k)?"First":"Second");
	return 0;
}

Measured memory_bytes: 5376
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for i2 in range(j)] for i3 in range(k)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from itertools import accumulate #list(accumulate(A))
import math
N = ii()

print(math.pi*2*N)

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


signed main() {
    int H, W;
    cin >> H >> W;


    int mi = 1e10;
    rep(i, H) {
        int h = i+1;

        if((H-h)%2==0 || W%2==0) {
            mi = min(mi, max(h*W, (H-h)*W/2)-min(h*W, (H-h)*W/2));
        } else {
            int th=(H-h)/2+1;
            int tth = th-1;
            int tw = W/2+1;
            int ttw = tw-1;
            mi = min(mi, max(h*W, th*W)-min(h*W, tth*W));
            mi = min(mi, max(h*W, (H-h)*tw) - min(h*W, (H-h)*ttw));
        }
    }

    rep(i, W) {
        int w = i+1;
        
        if((W-w)%2==0 || H%2==0) {
            mi = min(mi, max(w*H, (W-w)*H/2)-min(w*H, (W-w)*H/2));
        } else {
            int th = H/2+1;
            int tth = th-1;
            int tw = (W-w)/2+1;
            int ttw = tw-1;
            mi = min(mi, max(H*w, H*tw) - min(H*w, H*ttw));
            mi = min(mi, max(H*w, th*(W-w)) - min(H*w, tth*(W-w)));
        }
    }

    cout << mi << endl;

    return 0;
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int,input().split()))
import collections
c = collections.Counter(a)
a = list(set(a))
n = len(a)
a = sorted(a)
B = [True]*(a[-1]+1)
ans = 0
for i in range(n):
    if B[a[i]]:
        if c[a[i]] == 1:
            ans += 1
        j = 2
        while a[i]*j <= a[-1]:
            B[a[i]*j] = False
            j += 1
print(ans)

Measured memory_bytes: 44448
<?php
fscanf(STDIN,"%d%d",$H,$W);
if($H%3==0||$W%3==0){
    echo 0;exit;
}
$minDiff = min($H,$W);
foreach([[$H,$W],[$W,$H]] as list($w, $h)){
    $small = floor($w / 3.0) * $h;
    $large = ($w - floor($w / 3.0)) * ceil($h/2.0);
    $minDiff = min($minDiff, $large-$small);

    $large = ceil($w / 3.0) * $h;
    $small = ($w - ceil($w / 3.0)) * floor($h/2.0);
    $minDiff = min($minDiff, $large-$small);
}
echo $minDiff;


Measured memory_bytes: 4856
import math
a, b, x = map(int, input().split())
c = x/a**2  # c : height of water

if c >= b/2:
    tanth = 2*(b-c)/a
    deg = math.atan(tanth)*180/math.pi
else:
    tanth = b**2/(2*a*c)
    deg = math.atan(tanth)*180/math.pi

print(deg)

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

int main() {
	static long long N, A[100000], B[100000], count = 0;
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}
	sort(A, A + N);
	if (N % 2 == 0) {
		for (int i = 0; i < N; i++) {
			if (i % 2 == 0) B[i] = A[(N - i - 2) / 2];
			else B[i] = A[(N * 2 - i - 1) / 2];
		}
		for (int i = 1; i < N; i++) {
			count += abs(B[i] - B[i - 1]);
		}
	}
	else {
		long long count1 = 0, count2 = 0;
		B[0] = A[(N - 1) / 2];
		for (int i = 1; i < N; i++) {
			if (i % 2 == 0) B[i] = A[(i - 2) / 2];
			else B[i] = A[(N + i) / 2];
		}
		for (int i = 1; i < N; i++) {
			count1 += abs(B[i] - B[i - 1]);
		}
		for (int i = 1; i < N; i++) {
			if (i % 2 == 1) B[i] = A[(i - 1) / 2];
			else B[i] = A[(N * 2 - i) / 2];
		}
		for (int i = 1; i < N; i++) {
			count2 += abs(B[i] - B[i - 1]);
		}
		count = max(count1, count2);
	}
	cout << count;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
typedef long long ll;
using namespace std;
int static fast = [](){
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0); return 0;
}();

int main() {
    vector<int> arr(3, 0);
    for(int i = 0; i < 3; i++)
        cin >> arr[i];
    int m = *min_element(arr.begin(), arr.end());
    int M = *max_element(arr.begin(), arr.end());
    cout << M - m << endl;
    return 0;
}



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

vector<ll> divisor(ll n)
{
  vector<ll> res;
  for (ll i=1; i*i<=n; i++) {
    if (n%i == 0) {
      res.push_back(i);
      if (i != n/i) res.push_back(n/i);
    }
  }
  sort(res.begin(), res.end());
  return res;
}

int main()
{
  ll N; cin >> N;
  vector<ll> d = divisor(N);

  ll ans = pow(10, 13);
  for (auto v:d) {
    ans = min(ans, v+N/v-2);
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 384
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0;i < (int)(n);i++)
using ll = long long;
const ll MOD=1000000007;
//const ll MOD=998244353;
const long long INF = 1LL << 60;
const double pi=acos(-1.0);

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



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

  ll N; cin>>N;
  vector<ll> A(N); rep(i,N) cin>>A[i];
  
  sort(A.begin(),A.end());
  ll ans=0;
  if(N%2==0){
    for(int i=N/2;i<N;i++) ans+=(i==N/2?1:2)*A[i];
    rep(i,N/2) ans-=(i==N/2-1?1:2)*A[i];
    cout<<ans<<endl;
  }
  else{
    for(int i=(N+1)/2;i<N;i++) ans+=2*A[i];
    rep(i,(N+1)/2) ans-=((N+1)/2-2<=i?1:2)*A[i];
    //cout<<ans<<endl;
    
    ll sans=0;
    for(int i=N/2;i<N;i++) sans+=(i<=N/2+1?1:2)*A[i];
    rep(i,N/2) sans-=2*A[i];
    
    chmax(ans,sans);
    cout<<ans<<endl;
  }
  
  return 0;
}

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

void solve(long long N){
    cout << pow(N, 3) << '\n';
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    long long N;
    scanf("%lld",&N);
    solve(N);
    return 0;
}


Measured memory_bytes: 256
function Main(input) {
  var lines = input.split('\n');
  var line_1 = lines[1].split(' ');
  var N = Number(lines[0]);
  var D = Number(line_1[0]);
  var X = Number(line_1[1]);
  var A = [];
  for (var i = 0; i < N; i ++) {
    A[i]=Number(lines[i + 2]);
  }
  var count = X;
  for (var i = 0; i < N; i ++) {
    count += Math.ceil(D / A[i]);
  }
  console.log(count);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 7372