akhauriyash/Code-Regression huggingface dataset:
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>
#include <cfloat>
#include <map>
#include <cassert>
#include <chrono>
#include <fstream>
#include <array>
using ll = long long;

//LLONG_MAX
//#define int long long
#define CONTAINS(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define REMOVE(v,a) (v.erase(remove((v).begin(), (v).end(), (a)), (v).end()))
#define REVERSE(v) (reverse((v).begin(), (v).end()))
#define LOWER_BOUND(v,a) (lower_bound((v).begin(), (v).end(), (a)))
#define UPPER_BOUND(v,a) (upper_bound((v).begin(), (v).end(), (a)))
#define REP(i, n) for (int (i)=0; (i) < (n); (i)++)
#define CONTAINS_MAP(m, a) (m).find((a)) != m.end()

#ifdef LOCAL
#define ASSERT_DEBUG
#endif
#ifdef ASSERT_DEBUG
#define ASSERT(cond) assert(cond)
#else
#define ASSERT(cond)
#endif

class Point
{
public:
	int x;
	int y;
	Point() { this->x = 0; this->y = 0; }
	Point(int x, int y) { this->x = x; this->y = y; }
};

//time_point<system_clock> _start_time = system_clock::now();
//ll time = duration_cast<milliseconds>(system_clock::now() - _start_time).count();


//const int R = 10000;
//const double START_TEMP = pow(50.0, 2);
//const double END_TEMP = 0;
//double temp = sqrt(START_TEMP + (END_TEMP - START_TEMP) * (ms / (double)1900));
//double probability = MIN(1.0, exp((score - new_score) / temp));
//bool force_next = probability > ((xorshift32() % R) / (double)R);
//if (force_next)

using namespace std;
using namespace chrono;

unsigned int xorshift32()
{
	static int s = 7;
	s ^= (s << 13);
	s ^= (s >> 17);
	s ^= (s << 15);
	return s;
}


const int D = 365;
const int N = 26;
int C[N];
int S[N][D];


int GetScore(int schedule[D])
{
	int score = 0;
	int last[N] = {};
	for (int d = 0; d < D; d++)
	{
		score += S[schedule[d]][d];
		last[schedule[d]] = d;
		for (int n = 0; n < 26; n++)
		{
			score -= C[n] * (d - last[n]);
		}
	}
	return score;
}




int main()
{
	int _;
	cin >> _;
	REP(n, N)
	{
		cin >> C[n];
	}
	REP(d, D)
	{
		REP(n, N)
		{
			cin >> S[n][d];
		}
	}

	int schedule[D] = {};
	time_point<system_clock> _start_time = system_clock::now();
	int prev_score = GetScore(schedule);
	int loop = 0;
	while (true)
	{
		loop++;
		ll time = duration_cast<milliseconds>(system_clock::now() - _start_time).count();
		if (time > 1950)
		{
			break;
		}

		int d = xorshift32() % D;
		int n = xorshift32() % N;
		int prev = schedule[d];
		schedule[d] = n;

		int score = GetScore(schedule);
		if (prev_score < score)
		{
			//cerr << time << ":" << loop << ":" << score << endl;
		}
		else
		{
			schedule[d] = prev;
		}

		prev_score = score;
	}


	int score = GetScore(schedule);
	cerr << score << endl;


	REP(i, D)
	{
		cout << (schedule[i] + 1) << endl;
	}
}

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

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

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

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

#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

int K;
bool ans=false;

void dfs(int idx, int A, int B, int C)
{
    if (idx==K){
        if (C>B && B>A) ans=true;
        return;
    }
    dfs(idx+1,A*2,B,C);
    dfs(idx+1,A,B*2,C);
    dfs(idx+1,A,B,C*2);
    dfs(idx+1,A,B,C);
}

//-------------------------------------------------

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int A,B,C; cin>>A>>B>>C;
    cin>>K;
    dfs(0,A,B,C);
    if (ans){
        cout<<"Yes\n";
    }else{
        cout<<"No\n";
    }
    return 0;
}


Measured memory_bytes: 3648
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;

//constexpr long long int MOD = 1000000007;
//constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
constexpr long long int MOD = 998244353;
constexpr double EPS = 1e-5;

//int N, M, K, T, H, W, L, R;
long long int N, M, K, T, H, W, L, R;


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

	cin >> K;
	while (K--)cout << "ACL";
	cout << endl;
}

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

// region template
#define rep(i, a, b) for (int i = (a); i < (b); ++i)
#define trav(a, x) for (auto &a : x)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;

ll gcd(ll a, ll b) { return __gcd(a, b); }

ll euclid(ll a, ll b, ll &x, ll &y) {
    if (b) { ll d = euclid(b, a % b, y, x);
        return y -= a/b * x, d; }
    return x = 1, y = 0, a;
}

typedef unsigned long long ull;
typedef long double ld;
ull mod_mul(ull a, ull b, ull M) {
    ll ret = a * b - M * ull(ld(a) * ld(b) / ld(M));
    return ret + M * (ret < 0) - M * (ret >= (ll)M);
}
ull mod_pow(ull b, ull e, ull mod) {
    ull ans = 1;
    for (; e; b = mod_mul(b, b, mod), e /= 2)
        if (e & 1) ans = mod_mul(ans, b, mod);
    return ans;
}

const ll mod = 1000000007;
struct Mod {
    ll x;
    Mod(ll xx) : x(xx) {}
    Mod operator+(Mod b) { return Mod((x + b.x) % mod); }
    Mod operator-(Mod b) { return Mod((x - b.x) % mod); }
    Mod operator*(Mod b) { return Mod((x * b.x) % mod); }
    Mod operator/(Mod b) { return *this * invert(b); }
    Mod invert(Mod a) {
        ll x, y, g = euclid(a.x, mod, x, y);
        assert(g == 1); return Mod((x + mod) % mod);
    }
    Mod operator^(ll e) {
        if (!e) return Mod(1);
        Mod r = *this ^ (e / 2); r = r * r;
        return e & 1 ? *this * r : r;
    }
};
// endregion

int ds(int x) {
    return x == 0 ? 0 : x % 10 + ds(x / 10);
}

int main() {
    cin.sync_with_stdio(0); cin.tie(0); cin.exceptions(cin.failbit);

    ll a, b, c, k; cin >> a >> b >> c >> k;
    if (k & 1) a *= -1, b *= -1, c *= -1;
    cout << (a - b) << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define N (int)(1e5+7)
#define inf (int)(1e9+7)
#define INF (long long) (1e18+7)
#define fastio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
const int M = (int)(2e6 + 239);

void solve(){
    int a,b,c,k;
    cin>>a>>b>>c>>k;
    long long ans=0;
    ans+=min(a,k);
    k=max(0,k-a);
    k=max(0,k-b);
    ans-=min(k,c);
    cout<<ans<<'\n';
    return;
}
 
int main(){
    fastio;
    solve();
    return 0;
}

Measured memory_bytes: 3648
#include <algorithm>
#include <iostream>
#include <map>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(), (x).end()
#define dbg(x) cerr << #x << ": " << x << endl
int main() {
  int n;
  cin >> n;
  map<string, int> mp;
  int cnt = 0;
  rep(i, n) {
    string s;
    cin >> s;
    mp[s]++;
    cnt = max(cnt, mp[s]);
  }
  for(auto x : mp)
    if(x.second == cnt) cout << x.first << endl;
  return 0;
}

Measured memory_bytes: 25216
#include <stdio.h>

int main(void){
  int i,n,m;
  int d[10];

  scanf("%d",&n);
  m = n;
  for(i=0; i<10; i++){
    d[i] = m%10;
    m /= 10;
  }
  for(i=0; i<10; i++) m += d[i];
  if(n%m){
    printf("No\n");
  }else{
    printf("Yes\n");
  }
}


Measured memory_bytes: 128
import java.io.*;
import java.util.*;

public class Main{
  public static void main(String[] args){
    try {
      Scanner sc = new Scanner(System.in);
      int a, b, c;
      a=Integer.parseInt(sc.next());
      b=Integer.parseInt(sc.next());
      c=Integer.parseInt(sc.next());

      System.out.println(Math.min(b/a, c));
    
      }catch (Exception e) {
      System.out.println("out");
    }
  }
}


Measured memory_bytes: 21844
import java.util.Scanner;

class Main
{
	public static void main(String args[])
	{
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		sc.nextLine();
		for (int i = 0; i < n; i++)
		{
			String str1 = sc.nextLine();
			String str2 = str1.replaceAll("Hoshino", "Hoshina");
			System.out.println(str2);
		}
	}
}

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

void bfs(vector<vector<int>> &graph,vector<bool> &checked,vector<int> &root,queue<int> &q,int k){
  for(int i=0;i<graph.at(k).size();i++){
    if(checked.at(graph.at(k).at(i))==false){
      checked.at(graph.at(k).at(i))=true;
      root.at(graph.at(k).at(i))=k+1;
      q.push(graph.at(k).at(i));
    }
  }
  q.pop();
  return;
}

int main(){
  int n,m;
  cin >> n >> m;
  vector<int> a(m);
  vector<int> b(m);
  vector<int> p(n);
  vector<vector<int>> graph(n,vector<int>(0));
  vector<bool> checked(n,false);
  vector<int> root(n,0);
  queue<int> q;
  q.push(0);
  for(int i=0;i<m;i++){
    cin >> a.at(i) >> b.at(i);
    a.at(i)--;
    b.at(i)--;
    graph.at(a.at(i)).push_back(b.at(i));
    graph.at(b.at(i)).push_back(a.at(i));
  }
  
  while(q.empty()==false){
    bfs(graph,checked,root,q,q.front());
  }
  
  cout << "Yes" << endl;
  for(int i=1;i<n;i++){
    cout << root.at(i) << endl;
  }
}

Measured memory_bytes: 12052
n,m = [int(x) for x in input().split()]
a=[]
b=[]
for i in range(n):
    a.append([int(x) for x in input().split()])
for j in range(m): 
    b.append(int(input()))
for a_row in a:
    print(sum([x*y for x,y in zip(a_row,b)]))


Measured memory_bytes: 6020
n = int(input())
a = [int(i) for i in input().split()]
x, y = a[0], sum(a) - a[0]
r = abs(x-y)
for i in range(1, n-1):
    x += a[i]
    y -= a[i]
    r = min(r, abs(x-y))
print(r)

Measured memory_bytes: 24812
#include <iostream>

using namespace std;

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

    int min=999999999;
    for (int i=0; i<N-K+1; i++) {
        int l = abs(x[i] - x[i+K-1]) + abs(x[i]);
        int r = abs(x[i] - x[i+K-1]) + abs(x[i+K-1]);
        if (min > l) min = l;
        if (min > r) min = r;
    }
    cout << min << "\n";
    return 0;
}


Measured memory_bytes: 640
import bisect

n = int(input())
l = sorted(list(map(int, input().split())))

ans = 0
for i in range(n-2):
    for j in range(i+1, n-1):
        ans += bisect.bisect_left(l, l[i]+l[j]) - (j+1)
        #print(l,i,j,bisect.bisect_left(l, l[i]+l[j]))
print(ans)



Measured memory_bytes: 9252
//
// Created by oraroa on 2019-07-25.
//

#include <bits/stdc++.h>
using namespace std;

int main(void){
    int w, a, b;
    int temp;
    cin >> w >> a >> b;
    if(a > b){
        swap(a,b);
    }
    temp = b - (a + w);
    if(temp >=0){
        cout << temp << endl;
    }else{
        cout << 0 << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    int N;
    cin>>N;
    for(int i=0;i<=25;i++){
        for(int j=0;j<=15;j++){
            if(i*4+j*7==N){cout<<"Yes"<<endl;exit(0);}
        }
    }
    cout<<"No"<<endl;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS

#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <list>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_set>
#include <unordered_map>
#include <array>
#include <cassert>
#include <bitset>
#include <cstdint>
using namespace std;
using LL = long long;

string S;
int N;
LL dp[123456][13];

int main() {
	dp[0][0] = 1;
	cin >> S;
	N = S.length();
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < 13; j++) {
			for (int k = 0; k < 10; ++k) {
				if (S[i] != '?' && '0' + k != S[i])continue;
				dp[i + 1][(j * 10 + k) % 13] += dp[i][j];
				dp[i + 1][(j * 10 + k) % 13] %= 1000000007;
			}
		}
	}
	cout << dp[N][5] << endl;
	return 0;
}

Measured memory_bytes: 10752
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <stack>
#include <queue>
#include <cmath>
#include <complex> // complex<double> a(1.2 , 2.3);// real(): 1.2, imag()2.3
using namespace std;

#define MOD 1000000007
#define ll long long
#define ld long double
#define FOR(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rmsame(a) sort(all(a)),a.erase(unique(all(a)), a.end())
#define rmvector(a,b) rep(i,a.size())rep(j,b.size())if(a[i]==b[j]){a.erase(a.begin()+i);i--;break;}
template<typename X> bool exist(vector<X> vec, X item){return find(all(vec), item)!=vec.end();}

ll gcd(ll a, ll b){if(b==0) return a; return gcd(b, a%b);}
ll lcm(ll a, ll b){return a/gcd(a,b)*b;}




int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll T;
    cin >> T;
    rep(i,T){
        ll a, b, c, d;
        cin >> a >> b >> c >> d;
        if(a < b){
            cout << "No" << endl ;
            continue;
        }
        if(d < b){
            cout << "No" << endl;
            continue;
        }
        if(c >= b){
            cout << "Yes" << endl;
            continue;
        }
        
        ll g = gcd(b,d);
        
        ll ans = b-g+(a%g);
        if(ans > c) cout << "No" << endl ;
        else cout << "Yes" << endl ;
        
    }
    
    //cout << fixed << setprecision(16) << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=332748118;
const int M=5e5+10;
#define inf 0x3f3f3f3f
//std::ios::sync_with_stdio(0);
int main()
{
    std::ios::sync_with_stdio(0);
      int n,x,t;
      cin>>n>>x>>t;
      if(n%x==0)
        cout<<n/x*t<<endl;
      else
        cout<<(n/x+1)*t<<endl;

}



Measured memory_bytes: 3628
/**
 * C - Welcome to AtCoder
 * https://atcoder.jp/contests/abc151/tasks/abc151_c
 **/
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<map>
#include<set>
#include<numeric>
#include<functional>
#include<sstream>
#include<iomanip>

using namespace std;

#define ll long long

int main() {
    int n, m; cin >> n >> m;
    map<int, map<string, int>> d;
    int c=0, p=0;
    for(int j=0; j<m; j++) {
        int num;
        string res;
        cin >> num >> res;
        if(res=="AC") {
            if(d[num].count(res)) {
                d[num][res] += 1; 
            } else {
                d[num][res] = 1;
            }
        } else {
            if(d[num].count("AC")==0) {
                if(d[num].count("WA")) {
                    d[num][res] += 1;
                } else {
                    d[num][res] = 1;
                }
                
            }
        }
    }
    for(int i=0; i<n; i++) {
        if(d[i+1]["AC"]>=1) {
            c++;
            p += d[i+1]["WA"];
        }
    }

    cout << c << " " << p << endl;
    return 0;
}

Measured memory_bytes: 31488
import java.util.Scanner;
public class Main {
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    double d = scan.nextInt();
    double t = scan.nextInt();
    double s = scan.nextInt();
    
    if(d/s <= t){
      System.out.println("Yes");
    }else{
      System.out.println("No");
    }
    
  }
}

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

int n, k, c, tp, fp, g, v[51];
set<pair<int, int> > s;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    cin >> n >> k;
    for(int i = 1; i <= n; ++i) {
        cin >> v[i];
    }
    for(int l = 1; l <= n; ++l) {
        for(int i = 1; i <= n; ++i) s.insert({v[i], i}); c = n;
        for(int r = l; r <= n + 1; ++r) {
            if(c <= k) {
                tp = 0;
                g = c - k + c;
                if(c)
                for(set<pair<int, int> >::iterator it = (--s.end()); ; --it) {
                    if((*it).first <= 0 && g <= 0) break;
                    tp += (*it).first;
                    --g;
                    if(it == s.begin()) break;
                }
            }
            fp = max(fp, tp);
            if(r <= n) s.erase(s.find({v[r], r})), --c;
        }
    }
    cout << fp << endl;
}

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

int main(){
    int c[3][3];
    int a[3],b[3];
    for(int i=0;i<3;++i){
        for(int j=0;j<3;++j)cin>>c[i][j];
    }
    a[0]=0;
    for(int i=0;i<3;++i){
        b[i]=c[0][i]-a[0];
    }
    a[1]=c[1][0]-b[0];
    a[2]=c[2][0]-b[0];
    for(int i=0;i<3;++i){
        for(int j=0;j<3;++j){
            if(c[i][j]!=a[i]+b[j]){
                cout<<"No"<<endl;
                return 0;
            }
        }
    }
    cout<<"Yes"<<endl;
    return 0;
}

Measured memory_bytes: 256
//marico el que lo lea
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <stdlib.h>
#include <assert.h>
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> ii;

void fastIO() {std::ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);}

#define pb push_back
#define all(obj) obj.begin(), obj.end()
#define ms(obj, val) memset(obj, val, sizeof(obj))
#define ms2(obj, val, sz) memset(obj, val, sizeof(obj[0])*sz)

#define fst first
#define snd second

template<typename T, typename U> inline void mnze(T &x, U y) {if(y < x) x = y;}
template<typename T, typename U> inline void mxze(T &x, U y) {if(x < y) x = y;}

void _scan( int &x ) { scanf("%d",&x); }
void _scan( long long &x ) { scanf("%lld",&x); }
void _scan( double &x ) { scanf("%lf",&x); }
void _scan( char &x ) { scanf(" %c",&x); }
void _scan( char *x ) { scanf("%s",x); }
template<typename T>
void _scan( vector<T> &v ){
	for(int i=0; i<(int)v.size(); i++) _scan(v[i]);
}
void scan() {}
template<typename T, typename... U>
void scan( T& head, U&... tail ) { _scan(head); scan(tail...);}

template<typename T> void _dbg(const char* sdbg, T h)
	{ cerr<<sdbg<<"="<<h<<"\n"; }
template<typename T, typename... U> void _dbg(const char* sdbg, T h, U... t) {
	while(*sdbg != ',')cerr<<*sdbg++;
	cerr<<"="<<h<<","; _dbg(sdbg+1, t...);
}

#ifdef LOCAL
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#define debugv(x) {{cerr<<#x<<" = "; for(auto _i:x) cerr<<_i<<", ";cerr<<"\n";}}
#define debuga(x, sz) {{cerr<<#x<<" = ";for(int _i=0;_i<sz;_i++)cerr<<x[_i]<<", ";cerr<<"\n";}}
#else
#define debug(...) (__VA_ARGS__)
#define debugv(x)
#define debuga(x, sz)
#define cerr if(0)cout
#endif

ll MOD = 1e9+7;

inline ll Msum(ll x){return x;}
template<typename... Rest>
inline ll Msum(ll x, Rest... rest){ return (x + Msum(rest...)) % MOD; }

inline ll Mprod(ll x){return x;}
template<typename... Rest>
inline ll Mprod(ll x, Rest... rest){ return x * Mprod(rest...) % MOD; }

inline ll Mnorm(ll x){ return (x%MOD + MOD) %MOD; }
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////

int main(){
	double L; scan(L);
	L /= 3;
	printf("%.10lf\n", L*L*L);

}


Measured memory_bytes: 256
import numpy as np
N, M = list(map(int, input().split()))
mtr = np.zeros((N, N), dtype=np.bool)
for _ in range(M):
    a, b = list(map(int, input().split()))
    mtr[a-1][b-1] = 1
    mtr[b-1][a-1] = 1
def v(i=0):
    return [_i for _i, _j in enumerate(mtr[i]) if _j]
def search_path(node, done):
    _d = done.copy()
    _d[node] = True
    if False not in _d:
        return [True]
    flag = [False]
    _v = [_i for _i in v(node) if not _d[_i]]
    if _v == []:
        return [False]
    return(np.concatenate([search_path(_i, _d) for _i in _v]))
print(list(search_path(0, np.zeros(N, dtype=np.bool))).count(True))

Measured memory_bytes: 12420
#pragma region Header
#ifdef DEBUG
#include "debug.hpp"
#else
#define NDEBUG
#define debug(...)
#define IFD(...)
#endif
#include <utility>
#include <cstdint>
#include <cmath>
#include <cassert>
#include <vector>
#include <array>
#include <deque>
#include <queue>
#include <stack>
#include <tuple>
#include <set>
#include <map>
#include <unordered_map>
#include <bitset>
#include <string>
#include <functional>
#include <algorithm>
#include <numeric>
#include <stdexcept>
#include <iostream>
#include <iomanip>
using namespace std;
using i32 = int32_t;
using i64 = int64_t;
using u32 = uint32_t;
using u64 = uint64_t;
#define rep(i, n) for (int i = 0; i < static_cast<int>(n); ++i)
#define repd(i, n) for (int i = static_cast<int>(n) - 1; i >= 0; --i)
#define FOR(i, a, b) for (int i = static_cast<int>(a); i <= static_cast<int>(b); ++i)
#define FORD(i, b, a) for (int i = static_cast<int>(b); i >= static_cast<int>(a); --i)
template <typename T>
int SZ(T const &x)
{
    return static_cast<int>(x.size());
}
template <class T>
bool chmax(T &a, T const &b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}
template <class T>
bool chmin(T &a, T const &b)
{
    if (b < a)
    {
        a = b;
        return true;
    }
    return false;
}
#pragma endregion

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

    int n;
    cin >> n;
    i64 x, d;
    cin >> x >> d;

    if (d == 0)
    {
        cout << (x == 0 ? 1 : n + 1) << '\n';
        return 0;
    }
    else if (d < 0)
    {
        x = x + (n - 1) * d;
        d = -d;
    }

    int cyc = n + 1;
    FOR(i, 1, n)
    {
        if (x * i % d == 0)
        {
            cyc = i;
            break;
        }
    }

    auto st = [&x, &d](int cnt) {
        return cnt * x + (i64)cnt * (cnt - 1) / 2 * d;
    };
    auto en = [&n, &x, &d](int cnt) {
        return cnt * x + (i64)cnt * (2 * n - 1 - cnt) / 2 * d + d;
    };

    vector s(cyc, map<i64, int>());
    rep(cnt, n + 1)
    {
        int j = cnt % cyc;
        ++s[j][st(cnt)];
        --s[j][en(cnt)];
    }

    i64 ans = 0;
    rep(j, cyc)
    {
        i64 pos;
        int cur = 0;
        for (auto &[v, b] : s[j])
        {
            if (cur <= 0 and cur + b > 0)
            {
                pos = v;
            }
            else if (cur > 0 and cur + b <= 0)
            {
                ans += (v - pos) / d;
            }

            cur += b;
        }
    }

    cout << ans << '\n';

    return 0;
}


Measured memory_bytes: 37476
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <tuple>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;

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

int main() {
    ll k;
    cin >> k;

    ll ans = 0;
    exrep(a, 1, k) {
        exrep(b, 1, k) {
            exrep(c, 1, k) {
                ll d = gcd(a, b);
                ll e = gcd(c, d);
                ans += e;
            }
        }
    }
    
    out(ans);
    re0;
}

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

#define F first
#define S second
#define MP make_pair
#define PB emplace_back

using namespace std;

const int N = 1e6+100;

long long int a[N], t[N];

long long int wop(long long int x, long long int y) {
    long long int ret=1;
    for(;y>=1;y/=2) {
        if(y&1)ret*=x;
        x*=x;
    }
    return ret;
}

bool PA(string s) {
    for(int i = 0 ; i < s.size() ; i++ ) {
        if(s[i]!=s[s.size()-i-1])return 0;
    }
    return 1;
}

int main () {
    long long int n;
    cin >> n;
    for(int i = 0 ; i < n ; i++ ) {
        cin >> a[i];
        t[a[i]]++;
    }
    long long int ans=0;
    for(int i = 1 ; i <= n ; i++ ) {
        ans+=(t[i]*(t[i]-1))/2;
    }
    for(int i = 0 ; i < n ; i++ ) {
        cout << ans-t[a[i]]+1 << '\n';
    }
}


Measured memory_bytes: 7296
/*
	Created on 19-09-20 17:30

	@author: roastedcoder
*/

#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
const int MOD = 1e9 + 7;
const int INF = INT_MAX;
const int MX = 2e5 + 5;
#define all(x) x.begin(), x.end()
#define int long long
#define endl "\n"
#define pb push_back
#define roastedcoder ios_base::sync_with_stdio(false); cin.tie(NULL);
//__________________________________________________________________


int32_t main() {
	roastedcoder
	int n; cin>>n;
	int a[n], b[n];
	for(int i = 0; i<n; i++) {
		cin>>a[i]>>b[i];
	}
	//cout<<a[0]<<" "<<b[0]<<endl;
	int cnt = 0, tmp = 0;
	for(int i = 0; i<n; i++) {
		if(a[i] == b[i]) {
			tmp += 1;
		}
		else if(a[i] != b[i]) {
			cnt = max(cnt, tmp);
			tmp = 0;
		}
	}
	cnt = max(cnt, tmp);
	//cout<<cnt<<endl;
	cnt>=3 ? cout<<"Yes\n" : cout<<"No\n";
}

//__________________________________________________________________
/*
Sample Input:
5
1 2
6 6
4 4
3 3
3 2

Sample Output:
Yes

*/
/*
MY NOTES:
  int for long long
  Don't make Segment Tree and Fenwick Tree 0-based you FOOL.
  Always try to exhaust the time being provided and PACE yourself.
  First think Greedily not DPily, LOL... Who says that :P
  Greedy solution is better than DP solution, if you can find one.
  DP is OP.
*/

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

I = []

for i in range(n):
  I.append(list(map(int, input().split())))
    
ans = 10000000000000
  
for i in range(1<<n):
  u = [0] * m
  c = 0
  for j in range(n):
    if (i>>j) % 2 == 1:
      for k in range(m):
        u[k] += I[j][k+1]
      c += I[j][0]
        
  flag = 1
  for e in u:
    if e < x:
      flag = 0
      
  if min(u) < x:
    continue
  else:
    ans = min(ans, c)

if ans == 10000000000000:
  print(-1)
else:
  print(ans)

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

const int _ = 1e7 + 7;
bool nprm[_]; int arr[_] , N; vector < int > ch[2] , Ed[3003];

void shai(int mx){
	nprm[1] = 1;
	for(int i = 2 ; i <= mx ; ++i)
		if(!nprm[i]) for(int j = i ; j <= mx / i ; ++j) nprm[i * j] = 1;
}

int match[3003]; bool vis[3003];

bool dfs(int x){
	for(int i = 0 ; i < Ed[x].size() ; ++i)
		if(!vis[Ed[x][i]]){vis[Ed[x][i]] = 1; if(match[Ed[x][i]] == -1 || dfs(match[Ed[x][i]])){match[Ed[x][i]] = x; return 1;}}
	return 0;
}

int main(){
	scanf("%d" , &N); int mx = 0; for(int i = 1 , p ; i <= N ; ++i){scanf("%d" , &p); arr[p] = 1; mx = max(mx , p + 1);}
	shai(mx); for(int i = 1 ; i <= mx ; ++i) if(arr[i] ^ arr[i - 1]) ch[i & 1].push_back(i);
	for(int i = 0 ; i < ch[0].size() ; ++i)
		for(int j = 0 ; j < ch[1].size() ; ++j)
			if(!nprm[abs(ch[1][j] - ch[0][i])]) Ed[i].push_back(j);
	memset(match , -1 , sizeof(match)); int ans = 0;
	for(int i = 0 ; i < ch[0].size() ; ++i){memset(vis , 0 , sizeof(vis)); ans += dfs(i);}
	cout << (ans + ((ch[0].size() - ans) / 2 + (ch[1].size() - ans) / 2) * 2 + ((ch[0].size() - ans) & 1) * 3); return 0;
}

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

using namespace std;

int main()
{
	int n;
	cin>>n;
	long long int arr[n];
	for(int i = 0;i<n;i++)
	{
		cin>>arr[i];
	}
	sort(arr,arr+n);
	long long int c= arr[n-1];
	int j = n-2;
	int filled = 2;
	while(1)
	{
		//cout<<"loop ran"<<endl;
		if(filled >= n)
			break;

		c += arr[j];
		filled++;
		if(filled >= n)
			break;
		
		c += arr[j];
		filled++;
				j--;
	}
	cout<<c<<endl;
	//for(int i = 0;i<n;i++)
	//	cout<<arr[i]<<" ";
	//cout<<endl;
	return 0;

}

Measured memory_bytes: 5168
x, y, a, b, c = map(int, input().split())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))
p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)
ip = 0
iq = 0
ir = 0
ans = 0
while ip+iq+ir<x+y:
    tp = 0 if ip>=x else p[ip]
    tq = 0 if iq>=y else q[iq]
    tr = 0 if ir==c else r[ir]
    if tp >= tq and tp >= tr:
        ans += tp
        ip += 1
    elif tq >= tp and tq >= tr:
        ans += tq
        iq += 1
    else:
        ans += tr
        ir += 1
print(ans)

Measured memory_bytes: 22560
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#pragma warning(disable:4996)
#include <stdio.h>
#include <string>
#include <stdlib.h>
#include <math.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <functional>
#include <stack>
#include <queue>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <list>
#include <set>
#include <map>
#include <iomanip> 
#include <ctime>
#include <numeric>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

const double PI = 3.14159265358979323846;
const int MAX = 1e10;
const int MOD = 1e9+7;

const ll INF = 1e9;


int main(int argc, char *args[]) {
	string s, t; cin >> s >> t;
	int a, b; cin >> a >> b;
	string u; cin >> u;
	if (u == s)--a;
	if (u == t)--b;
	cout << a << " " << b << endl;
}

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

int main()
{
    double n;
    cin >> n;

    int x = ceil(n / 1.08);
    if (floor(x * 1.08) == n) {
        cout << x << endl;
    } else {
        cout << ":(" << endl;
    }
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <limits>
#include <cmath>
#include <cassert>

using namespace std;
using ll = long long;

const int INF = 1<<30;
const int MOD = (int)1e9 + 7;
const int MAX_N = (int)1e5 + 5;
#define debug(x) cout << #x << ": " << x << endl

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, Q;
    while(cin >> N >> Q, N or Q)
    {
        vector<int> state(N, -1);
        while(Q--)
        {
            char ch; int id; cin >> ch >> id;
            if(ch == 's')
            {
                int w; cin >> w;
                int cnt = 0, place = 0;
                for(int i = 0; i < N; i++)
                {
                    if(state[i] != -1) cnt = 0, place = i + 1;
                    else
                    {
                        cnt++;
                        place = min(place, i);
                    }
                    if(cnt == w) break;
                }
                if(cnt == w)
                {
                    for(int i = place; i - place < w; i++)
                    {
                        state[i] = id;
                    }
                    cout << place << endl;
                }
                else cout << "impossible" << endl;
            }
            else
            {
                for(int i = 0; i < N; i++) if(state[i] == id) state[i] = -1;
            }
        }
        cout << "END" << endl;
    }
    return 0;
}




Measured memory_bytes: 3192
import java.util.*;

public class Main{
  public static void main(String[] arg){
    Scanner sc = new Scanner(System.in);
    int x = sc.nextInt();
    int a = sc.nextInt();
    int b = sc.nextInt();
    String ans;
    if(a >= b){
      ans = "delicious";
    }else if(b-a<=x){
      ans = "safe";
    }else{
      ans = "dangerous";
    }
    System.out.println(ans);
  }
}


Measured memory_bytes: 21460
from collections import defaultdict
N, = map(int, input().split())
dd = defaultdict(int)
cc = dict()
nrm = dict()
ss = []
for _ in range(N):
  xs = list(map(int, input().split()))
  cnd = [tuple(xs[j:]+xs[:j])for j in range(4)]
  x = min(cnd)
  for item in cnd:
    nrm[item] = x
  dd[x] += 1
  cc[x] = (4 if x[0]==x[1]else 2)if x[0]==x[2]and x[1]==x[3]else 1
  ss.append(x)
def f(ff, gg):
  a,b,c,d=ff
  e,h,g,f=gg
  tl = [(a,e,f,b), (b,f,g,c), (c,g,h,d), (d,h,e,a)]
  q = defaultdict(int)
  for p in tl:
    if p not in nrm:
      return 0
    q[nrm[p]] += 1
  r= 1
  for p, c in q.items():
    for i in range(c):
      r *= dd[p]-i
    r *= cc[p]**c
  return r
r = 0
for i in range(N):
  ff = ss[i]
  dd[ff]-=1
  for j in range(i+1, N):
    sl = ss[j]
    x, y, z, w = sl
    dd[sl]-=1
    r += sum(f(ff,tuple(sl[j:]+sl[:j]))for j in range(4))
    dd[sl]+=1
print(r)

Measured memory_bytes: 62680
#include <algorithm>
#include <bitset>
#include <cmath>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <vector>

#define INF 1e9
#define MOD 1000000007
#define ll long long
using namespace std;
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
typedef unsigned long long ull;
typedef pair<ll, ll> pr;
// ll t[100004],d[100004];
// vector<int>t[100004];
ll num[100004];
pr p[100004];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n, k, ti;
  ll d;
  cin >> n >> k;
  for (ll i = 0; i < n; i++) {
    cin >> ti >> d;
    p[i] = make_pair(d, ti - 1);
    //    t[ti-1].push_back(d);
  }
  fill(num, num + n, 0LL);
  sort(p, p + n, greater<pr>());
  // for(int i=0;i<n;i++){
  //     sort(t[i].begin(),t[i].end(),greater<ll>());
  // }
  // for(int i=0;i<n;i++){
  //     cout<<p[i].first<<" "<<p[i].second<<endl;
  // }
  ll tmp = 0;
  for (ll i = 0; i < k; i++) {
    tmp += p[i].first;
    num[p[i].second]++;
  }
  ll s = 0;
  for (ll i = 0; i < n; i++) {
    if (num[i] != 0) {
      s++;
    }
  }
  tmp += s * s;
  ll l = k - 1;  // to remove
  ll r = k;      // to add
  ll ans = tmp;
  //   for (ll i = s + 1; i <= k; i++) {
  while (1) {
    // move l to index of element to remove
    while (l >= 0 && num[p[l].second] <= 1) {
      l--;
    }
    if (l < 0) {  // no more candidates exit
      break;
    }

    // move r to index of element to add
    while (r < n && num[p[r].second] > 0) {
      r++;
    }
    if (r >= n) {  // no more candidates exit
      break;
    }

    // swap elements and calculate new score
    num[p[r].second]++;
    num[p[l].second]--;
    s++;
    tmp += p[r].first - p[l].first - (s - 1) * (s - 1) + s * s;
    ans = max(ans, tmp);
    r++;
    l--;
  }
  // cout<<tmp<<endl;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long long ll;
const int MH = 110;
int gr[MH][MH];
bool vs[MH][MH];
ii p[MH][MH];
ii s,t;
int main() {
	//ios::sync_with_stdio(0);cin.tie(0);
	int h,w;
	cin >> h >> w;
	memset(gr,0,sizeof(gr));
	for(int i=0;i<h;i++) {
		for(int j=0;j<w;j++) {
			char ch;
			cin >> ch;
			if(ch == 'S') {s = {i,j};gr[i][j] = 1;}
			if(ch == 'T') {t = {i,j};gr[i][j] = 1;}
			if(ch == 'o') {gr[i][j] = 1;}
		}
	}
	bool bc = ((s.first == t.first) || (s.second == t.second));
	int ct = 0;
	while(1) {
		if(bc) break;
		memset(vs,false,sizeof(vs));
		queue<ii> q;
		q.push({s.first,s.second});
		vs[s.first][s.second] = true;
		while(!q.empty() && !vs[t.first][t.second]) {
			int r = q.front().first,c = q.front().second;q.pop();
			for(int i=0;i<w;i++) {
				if(gr[r][i]) {
					if(vs[r][i]) continue;
					vs[r][i] = true;
					p[r][i] = {r,c};
					q.push({r,i});
				}
			}
			for(int i=0;i<h;i++) {
				if(gr[i][c]) {
					if(vs[i][c]) continue;
					vs[i][c] = true;
					p[i][c] = {r,c};
					q.push({i,c});
				}
			}
		}
		if(!vs[t.first][t.second]) {break;
		}
		ct++;
		ii u = p[t.first][t.second];
		while(u != s) {
			gr[u.first][u.second] = 0;
			u = p[u.first][u.second];
		}
	}
	if(bc) {ct = -1;}
	cout << ct << '\n';
}

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

void dfs(std::vector<std::vector<int> > &map, std::stack<std::pair<int, int> > &st, int &number) {
    int dy[8] = {-1, -1, -1, 0, 0, 1, 1, 1};
    int dx[8] = {-1, 0, 1, -1, 1, -1, 0, 1};
    std::pair<int, int>  coord;
    coord.first = st.top().first;
    coord.second = st.top().second;
    map[coord.first][coord.second] = 0;
    st.pop();
    for (int i = 0; i < 8; i++) {
        if (map[coord.first + dy[i]][coord.second + dx[i]] == 1) {
            st.push(std::make_pair(coord.first + dy[i], coord.second + dx[i]));
            dfs(map, st, number);
        }
    }
    return;
}

int main(void) {
    int w;
    int h;
    int number;
    while (std::cin >> w >> h) {
        if (w == 0 && h == 0) {
            break;
        }
        std::stack<std::pair<int, int> > st;
        number = 0;
        std::vector<std::vector<int> > map(h + 2, std::vector<int>(w + 2, 0));
        for (int i = 1; i <= h; i++) {
            for (int j = 1; j <= w; j++) {
                std::cin >> map[i][j];
            }
        }
        for (int i = 1; i <= h; i++) {
            for (int j = 1; j <= w; j++) {
                if (map[i][j] == 1) {
                    st.push(std::make_pair(i, j));
                    map[i][j] = 0;
                    dfs(map, st, number);
                    number++;
                }
            }
        }
        std::cout << number << std::endl;
    }
    return 0;
}

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

int main() {

  string input;

  while(true) {

    int map[13][13] = {0};
    int ans = 0;
    int cnt = 1;

    for ( int i = 0; i < 12; i++ ) {

      if ( getline( cin, input ) ) {
      }else {
	return 0;
      }

      for ( int j = 0; j < 12; j++ ) {

	if ( input[j] == '1' ) {

	  if ( map[j][i+1] != 0 && map[j+1][i] != 0 && map[j][i+1] != map[j+1][i] ) {

	    ans--;

	    int a = map[j][i+1];
	    int b = map[j+1][i];

	    for ( int x = 0; x < 12; x++ ) {
	      for ( int y = 0; y < 12; y++ ) {

		if ( map[x+1][y+1] == b ) map[x+1][y+1] = a;

	      }
	    }

	  }
	  if ( map[j][i+1] != 0 ) {
	    map[j+1][i+1] = map[j][i+1];
	  }else if ( map[j+1][i] != 0 ) {
	    map[j+1][i+1] = map[j+1][i];
	  }else {
	    map[j+1][i+1] = cnt;
	    cnt++;
	    ans++;
	  }

	}

      }

    }

    cout << ans << endl;

    getline( cin, input );

  }

  return 0;

}

Measured memory_bytes: 1172
/*
	@Raghul

	Created : Long ago

*/
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	ll n;
	string s;
	map <string, int> m;
	cin>>n;
	cin>>s;
	m[s]++;
	char last = s[s.length()-1];
	for(int i=1;i<n;i++){	
		cin>>s;
		if(m[s]==1||last!=s[0]){
			cout<<"No";
			return 0;
		}
		last = s[s.length()-1];
		m[s]++;
	}
	cout<<"Yes";
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i = (a); i < (b); ++i)
#define rrep(i,a,b) for(int i = (b); i --> (a);)
#define all(v) (v).begin(),(v).end()
#define trav(x,v) for(auto &x : v)
#define sz(v) int(v.size())
typedef vector<int> vi;
typedef long long ll;
typedef pair<int,int> pii;

int main(){
	cin.sync_with_stdio(0);
	cin.tie(0);

	int n;
	cin >> n;
	vector<vi> gr(n);
	rep(_,1,n){
		int a, b;
		cin >> a >> b;
		--a, --b;
		gr[a].push_back(b);
		gr[b].push_back(a);
	}
	function<pii(int,int)> far = [&](int v, int par){
		pii ans(-1,v);
		trav(u, gr[v]) if(u != par){
			ans = max(ans, far(u, v));
		}
		++ans.first;
		return ans;
	};
	int u = far(0, -1).second;
	int diam = far(u, -1).first;
	cerr << diam << endl;
	cout << (diam%3 == 1 ? "Second" : "First") << endl;
}


Measured memory_bytes: 26880
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
#include <vector>
#include <string>
#include <map>
using namespace std;
long long ans;
int n;
int co[100010];
priority_queue<int> q_s, q_b;
int main()
{
	int i, j;
	scanf("%d", &n);
	int last = 0;
	for (i = 1; i <= n; i++)
	{
		scanf("%d", &co[i]);
		ans += abs(co[i] - last);
		last = co[i];
	}
	ans += abs(co[n]);
	co[0] = 0;
	co[n + 1] = 0;
	for (i = 1; i <= n; i++)
	{
		long long now = ans;
		now -= abs(co[i] - co[i - 1]);
		now -= abs(co[i + 1] - co[i]);
		now += abs(co[i + 1] - co[i - 1]);
		printf("%lld\n", now);
	}
	return 0;
}


Measured memory_bytes: 1664
import java.util.*;

public class Main{

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

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

int main() {
  int N, M;
  cin >> N >> M;
  
  vector<int> A(N);
  for (int i = 0; i < M; i++) {
    int a, b;
    cin >> a >> b;
    A.at(a-1)++;
    A.at(b-1)++;
  }
  
  for (int i = 0; i < N; i++) {
    cout << A.at(i) << endl;
  }
}


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

using namespace std;

#define ALL(x) (x).begin(), (x).end()
#define ALLTRUE(xs) all_of(ALL(xs),[](bool x){return x;})
#define AND(x,y,z) set_intersection((x).begin(),(x).end(),(y).begin(),(y).end(),inserter((z),(z).end()))
#define ANYTRUE(xs) any_of(ALL(xs),[](bool x){return x;})
#define CONCAT(x,y) (x).insert((x).end(),(y).begin(),(y).end())
#define DUMP(xs) for (auto x:xs) cout<<x<<' ';cout<<endl
#define FOR(i,a,b) for (int i=(int)(a);i<(int)(b);++i)
#define OR(x,y,z) set_union((x).begin(),(x).end(),(y).begin(),(y).end(),inserter((z),(z).end()))
#define OUT(x) cout<<x<<endl
#define REP(i,n) FOR(i,0,n)

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<int> VECINT;
typedef vector<ll> VECLL;

int N,K;
ll dp[50][50][101];
ll VS[50];

void init() {
  REP(i,50)REP(j,50)REP(k,101) dp[i][j][k] = -1;
  REP(i,N) cin>>VS[i];
}

ll dfs(int l, int r, int k, vector<ll> owns) {
  if (dp[l][r][k]!=-1) return dp[l][r][k];

  if (k==0) {
    dp[l][r][k] = accumulate(ALL(owns),0LL);
    return dp[l][r][k];
  }

  ll res = accumulate(ALL(owns),0LL);;

  // もう一つしかない場合
  if (l<r) {
    owns.push_back(VS[l]);
    res = max(res, dfs(l+1,r,k-1,owns));
    owns.pop_back();
    owns.push_back(VS[r]);
    res = max(res, dfs(l,r-1,k-1,owns));
    owns.pop_back();
  } else if (l==r && l==0) {
    owns.push_back(VS[l]);
    res = max(res, dfs(l+1,r,k-1,owns));
    owns.pop_back();
  } else if (l==r && l==N-1) {
    owns.push_back(VS[r]);
    res = max(res, dfs(l,r-1,k-1,owns));
    owns.pop_back();
  }

  // ownsはマイナスで保存してある
  if (!owns.empty()) {
    sort(ALL(owns));
    reverse(ALL(owns));
    owns.pop_back();
    res = max(res, dfs(l,r,k-1,owns));
  }

  dp[l][r][k] = res;
  return res;
}

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

  // DFSxDP
  // 行動の選択肢は右・左からとるか石を返すか何もしないか
  // それらのmaxを取ってDFS
  // dp[l][r][k]：l~rの範囲でk回行動できる時の最大価値
  vector<ll> owns;
  OUT(dfs(0,N-1,K,owns));

  return 0;
}

Measured memory_bytes: 2304
#![allow(non_snake_case)]
#![allow(unused_imports)]

use proconio::input;
use std::cmp::{max, min};
use std::collections::{HashMap, HashSet};

fn main() {
    input! {
        N: usize,
        D: [(usize, usize); N],
    }

    for i in 0..(N - 2) {
        if D[i].0 == D[i].1 && D[i + 1].0 == D[i + 1].1 && D[i + 2].0 == D[i + 2].1 {
            println!("Yes");
            return;
        }
    }
    println!("No");
}


Measured memory_bytes: 2160
#include <stdio.h>
#define NOT_FREE 1
#define FREE -1
#define N 8

int B[N][N], row[N], col[N],dpos[2 * N - 1], dneg[2 * N - 1], row[N];//?????????????????????????¨?


void init(){
  int i;
  for(i = 0; i < N; i++) row[i] = col[i] = FREE;
  for(i = 0; i < 2 * N - 1; i++) dpos[i] = dneg[i] = FREE;
}

void printBoard(){
  int i, j;

  for(i = 0; i < N; i++){
    for(j = 0; j < N; j++){
      if(B[i][j]){
	if(row[i] != j){
	  //printf("%d %d %d\n", i, j, row[i]);
	  return;
	}
      }
    }
  }
  for(i = 0; i < N; i++){
    for(j = 0; j < N; j++){
      if(row[i] == j)	printf("Q");
      else printf(".");
    }
    printf("\n");
  }
}

void putQueen(int i){
  int j; 

  if(i == N){ //????????????????????????
    printBoard();
  }
  for(j = 0; j < N; j++){
    // ???????????????
    if(col[j] == NOT_FREE || dpos[i+j] == NOT_FREE || dneg[i-j+N-1] == NOT_FREE) continue;
    // ??????
    row[i] = j;
    col[j] = dpos[i+j] = dneg[i-j+N-1] = NOT_FREE;
    // ?¬???????
    putQueen(i+1);
    // ????????????????????????
    col[j] = dpos[i+j] = dneg[i-j+N-1] = FREE;
  }
  //??±???
}
			  
int main()
{
  int k, r, c, i, j;

  init();

  for(i = 0; i < N; i++)
    for(j = 0; j < N; j++) B[i][j] = 0;
  
  scanf("%d", &k);
  for(i = 0; i < k; i++){
    scanf("%d %d", &r, &c);
    B[r][c] = 1;
  }
  putQueen(0);

  return 0;
}

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

int main()
{
    int n,x,z,y,sum,t,c;
    while(~scanf("%d%d%d%d",&n,&x,&z,&y))
    { c=0;
    if(n<=x)
    {
        sum=n;
    }
    else
        sum=x;
    if(z<=y)
    {
        t=z;
    }
    else
        t=y;
    c=sum+t;
    printf("%d\n",c);
    }
    return 0;
}


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

typedef long long LL;

using std::swap;

const int N=3e5+10;
const LL Inf=1e18;

struct Node {
	LL x,y;
	Node (LL x=0ll,LL y=0ll):x(x),y(y){}
	Node operator - (const Node &A) const { return Node(x-A.x,y-A.y); }
}que[N];

int n,t[N];
LL f[N],l[N],r[N],sum[N];

void Init() {
	scanf("%d",&n);
	for (int i=1;i<=n;++i) scanf("%d",&t[i]);
}

LL Cross(const Node &A,const Node &B){ return A.x*B.y-A.y*B.x; }

bool better(const Node &p1,const Node &p2,int v) { return p1.y-v*p1.x>p2.y-v*p2.x; }

bool better(const Node &A,const Node &B,const Node &C) { return Cross(B-A,C-A)>=0; }

void prepare(LL *f,int *t) {
	sum[0]=0ll; for (int i=1;i<=n;++i) sum[i]=sum[i-1]+t[i];
	int head=1,tail=0; que[++tail]=Node(0,0);
	for (int i=1;i<=n;++i) {
		while (tail>head && better(que[tail-1],que[tail],i)) --tail;
		f[i]=std::max((que[tail].y+1ll*i*i-2ll*sum[i]+i-que[tail].x*i)/2,f[i-1]);
		Node p(2ll*i,2*f[i]+1ll*i*i-i+2ll*sum[i]);
		while (tail>head && better(que[tail-1],que[tail],p))  tail--;
		que[++tail]=p;
	}
}

LL put[N];
void Divide(int l,int r,LL *lv,LL *rv) {
	if (l==r) { f[l]=std::max(f[l],lv[l-1]+rv[l+1]-t[l]+1); return ; }
	int mid=(l+r)>>1;
	int head=1,tail=0;
	for (int i=l-1;i<mid;++i) {
		Node p(2ll*i,2*lv[i]+1ll*i*i-i+2ll*sum[i]);
		while (tail>head && better(que[tail-1],que[tail],p))  tail--;
		que[++tail]=p;
	}
	for (int i=mid;i<=r;++i) {
		while (tail>head && better(que[tail-1],que[tail],i)) --tail;
		put[i]=(que[tail].y+1ll*i*i-2ll*sum[i]+i-que[tail].x*i)/2+rv[i+1];
	}
	f[r]=std::max(put[r],f[r]);
	for (int i=r-1;i>=mid;--i) 
		put[i]=std::max(put[i],put[i+1]),f[i]=std::max(put[i],f[i]);
	Divide(l,mid,lv,rv); Divide(mid+1,r,lv,rv);
}

void Solve() {
	prepare(l,t); 
	for (int i=1;i<=n/2;++i) swap(t[i],t[n-i+1]);
	prepare(r,t);
	for (int i=1;i<=n/2;++i) swap(t[i],t[n-i+1]),swap(r[i],r[n-i+1]);
	
	for (int i=1;i<=n;++i) f[i]=1-t[i];
	
	sum[0]=0ll; for (int i=1;i<=n;++i) sum[i]=sum[i-1]+t[i];
	Divide(1,n,l,r);
	for (int i=1;i<=n/2;++i) swap(t[i],t[n-i+1]),swap(l[i],l[n-i+1]),swap(r[i],r[n-i+1]),swap(f[i],f[n-i+1]);
	sum[0]=0ll; for (int i=1;i<=n;++i) sum[i]=sum[i-1]+t[i];
	Divide(1,n,r,l);
	for (int i=1;i<=n/2;++i) swap(t[i],t[n-i+1]),swap(l[i],l[n-i+1]),swap(r[i],r[n-i+1]),swap(f[i],f[n-i+1]);
	
	int m,p,x;
	scanf("%d",&m);
	for (int i=1;i<=m;++i) {
		scanf("%d%d",&p,&x);
		printf("%lld\n",std::max(l[p-1]+r[p+1],f[p]+t[p]-x));
	}
}

int main() {
	Init();
	Solve();
	return 0;
}

Measured memory_bytes: 20224