akhauriyash/Code-Regression huggingface dataset:
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)
input = sys.stdin.readline
INF = 2**62-1
EPS = sys.float_info.epsilon

def read_int():
    return int(input())


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


def read_float():
    return float(input())


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


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap

def min_circle(XY):

    def cross(a, b):
        return a.real * b.imag - a.imag * b.real

    def cnv_img(XY):
        return [x + y*1j for x, y in XY]

    def make_circle(a, b):
        c = (a + b) / 2
        r2 = abs(a-c)**2
        return c, r2

    def make_circle3(a, b, c):
        A = abs(b - c)**2
        B = abs(c - a)**2
        C = abs(a - b)**2
        S = cross(b - a, c - a)
        p = (A * (B + C - A) * a + B * (C + A - B)
             * b + C * (A + B - C) * c) / (4 * S * S)
        r2 = abs(p-a)**2
        return p, r2

    def in_circle(p, c, r2):
        return abs(p-c)**2 <= r2 + EPS


    P = cnv_img(XY)
    random.shuffle(P)
    p1 = P[0]
    p2 = P[1]
    c, r2 = make_circle(p1, p2)

    for i in range(2, len(P)):
        if in_circle(P[i], c, r2):
            continue
        c, r2 = make_circle(P[0], P[i])
        for j in range(1, i):
            if in_circle(P[j], c, r2):
                continue
            c, r2 = make_circle(P[i], P[j])
            for k in range(j):
                if not in_circle(P[k], c, r2):
                    c, r2 = make_circle3(P[i], P[j], P[k])
    return c, r2


@mt
def slv(N, XY):
    _, r2 = min_circle(XY)
    return math.sqrt(r2)


def main():
    N = read_int()
    XY = [read_int_n() for _ in range(N)]
    print(slv(N, XY))


if __name__ == '__main__':
    main()


Measured memory_bytes: 59756
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main() {

    string str;
    cin >> str;

    vector<int> nums(str.length(), 0);

    int r_num = 0;
    int l_num = 0;
    char last_char = 'L';
    int pos = 0;
    for (int i = 0; i<str.length(); i++) {

        char this_char = str[i];

        if ((last_char == 'L') & (this_char == 'R')) {
            
            if (0 < r_num + l_num) {
                int l_pos = pos + r_num - 1;
                int r_pos = l_pos + 1;
                pos += r_num + l_num;
                nums[l_pos] += (r_num - r_num/2) + (l_num/2);
                nums[r_pos] += r_num/2 + (l_num - l_num/2);
            }

            r_num = 0;
            l_num = 0;

        }

        if (this_char == 'R') {
            r_num += 1;
        } else {
            l_num += 1;
        }

        last_char = this_char;
    }
    
    int l_pos = pos + r_num - 1;
    int r_pos = l_pos + 1;
    pos += r_num + l_num;
    nums[l_pos] += (r_num - r_num/2) + (l_num/2);
    nums[r_pos] += r_num/2 + (l_num - l_num/2);

    for (int i = 0; i<str.length(); i++) {
        cout << nums[i] << " ";
    }

    return 0;
}

Measured memory_bytes: 1024
import collections
 
#文字列を一文字ずつ取得したいとき
def inputStrOnebyOne():
    s = list(input())
    return s
 
#整数を一つずつリストに入れる
def inputOnebyOne_Int():
    a = list(int(x) for x in input().split())
    return a
 
def main():
    w = list(input())
    C = collections.Counter(w)

    ret = "Yes"
    for c in C.values():
        if c%2 == 1:
            ret = "No"
            break
    print(ret)
 
if __name__=='__main__':
    main()

Measured memory_bytes: 3316
using System;
using System.IO;
using System.Text;

class Program
{
    static void Main(string[] args) {
        var scan = new Scanner();
        var writer = new StreamWriter(Console.OpenStandardOutput()) {AutoFlush = false};
        Console.SetOut(writer);
        Console.WriteLine(Solve(scan));
        Console.Out.Flush();
    }
    static object Solve(Scanner scan) {
        var N = scan.NextInt();
        var A = new int[N];
        var a = new int[N];
        for (int i = 0; i < N; i++) {
            A[i] = a[i] = scan.NextInt();
        }
        Array.Sort(A);
        var sb = new StringBuilder();
        var max = A[^1];
        var next = A[^2];
        for (int i = 0; i < N; i++) {
            if (a[i] != max) {
                sb.Append(max).AppendLine();
                continue;
            }
            if (a[i] == max) sb.Append(next).AppendLine();
        }
        return sb.ToString();
    }
}

class Scanner
{
    string[] s;
    int i;
    public Scanner() {
        s = new string[0];
        i = 0;
    }
    public string Next() {
        if (i < s.Length) return s[i++];
        string str = Console.ReadLine();
        while (str == "") str = Console.ReadLine();
        s = str.Split(' ', StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return Next();
        i = 0;
        return s[i++];
    }
    public int NextInt() => int.Parse(Next());
}

Measured memory_bytes: 48764
#include <stdio.h>
#include <math.h>

int main(){
    int n,i,tempi,ans,sum=0;
  	float avr,min,temp;

    scanf("%d",&n);
    int a[n];

    for(i=0;i<n;i++){
        scanf("%d",&a[i]);
      	sum+=a[i];
    }
  
  	avr=sum*1.0/n;
  	min=1<<29;
    tempi=0;
  
  	for(i=0;i<n;i++){
      temp=fabsf(a[i]-avr);
      if(min>temp){
        min=temp;
        tempi=i;
      }
    }
    
    printf("%d",tempi);
    return 0;
}

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

using namespace std;

char s[12345];

int main() {
  scanf("%s", s);
  int len = strlen(s);
  long long ans = 0;
  for (int t = 0; t < (1 << (len - 1)); t++) {
    long long num = s[0] - '0';
    for (int i = 0; i < len - 1; i++) {
      if (t & (1 << i)) {
        ans += num;
        num = 0;
      }
      num = num * 10 + s[i + 1] - '0';
    }
    ans += num;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
vector<int> primes;
vector<bool> isPrime;
int main() {
  isPrime.assign(555556, true);
  for (int i = 2; i <= 55555; i++) {
    if (isPrime[i]) {
      if (i % 5 == 1) primes.push_back(i);
      for (int j = 2 * i; j <= 55555; j += i) {
        isPrime[j] = false;
      }
    }
  }
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    if (i) printf(" ");
    printf("%d", primes[i]);
  }
  printf("\n");
  return 0;
}

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

#define vec(v) vector<int>(v)
#define be(v) (v).begin(), (v).end()
#define pb(q) push_back(q)
#define mapci(mp) map<char*,int>(mp)
#define mapcc(mp) map<char*,char*>(mp)
typedef long long ll;
using namespace std;

int main() {
    ll n,m,ans=0;
    cin>>n;
    ll a[n],b[n];
    for(int i=0;i<n;i++){
        cin>>a[i]>>b[i];
    }
    for(int i=n-1;i>=0;i--){
        m=(a[i]+ans)%b[i];
        if(m!=0){
            ans+=b[i]-m;
        }
    }
    cout << ans<<endl;
    return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <iomanip>
#include <stack>
#include <array>
#include <deque>
#include <forward_list>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <algorithm>
#include <iterator>
#include <string>
#include <cstring>
//#include <fstream>
#include <complex>
#define _USE_MATH_DEFINES
#include <cmath>
#include <math.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=n;i>0;i--)
#define arep(a,i,n) for(int i=(a);i<(n);i++)
#define SORT(v) sort((v).begin(),(v).end())
const ll INF = (1LL << 50);
typedef pair<int, int> P;

int main() {

	int N;
	cin >> N;

	string s, t;
	cin >> s >> t;

	REP(i, N) {
		cout << s[i] << t[i];
	}

	return 0;

}

Measured memory_bytes: 256
from fractions import gcd
import collections

a, b = map(int, input().split())

gcd = gcd(a, b)


def prime_factorize(n):
    a = list()
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a


c = collections.Counter(prime_factorize(gcd))
print(len(c.keys()) + 1)






Measured memory_bytes: 64108
ts = [int(raw_input()) for i in range(5)]

def up(i):
    one = int(str(i)[-1])
    if one == 0:
        return i
    else:
        return i + (10 - one)

t = sum([up(i) for i in ts])
ones = [int(str(s)[-1]) for s in ts]
while True:
    try:
        ones.remove(0)
    except:
        break
if not len(ones) == 0:
	m = min(ones)
	print int(t-(10-m))
else:
  	print int(t)

Measured memory_bytes: 2568
def num():
    return int(input())
def nums():
    return list(map(int,input().split()))
import string
numbers = "0123456789"
alphabets = string.ascii_letters # a-z+A-Zをロード
characters = numbers + alphabets
 
def base_cvt(value, n=2):
    try:
        tmp = int(value)
    except:
        raise ValueError('Invalid value:', value)
 
    if n < 2 or n > len(characters):
        raise ValueError('Invalid n:', value)
 
    result = ''
    tmp = int(value)
    while tmp >= n:
        idx = tmp%n
        result = characters[idx] + result
        tmp = int(tmp / n)
    idx = tmp%n
    result = characters[idx] + result
    return result

N = num()
X = nums()
def get_cost(l,pos):
    cost = 0
    for xi in l:
        cost += (xi - pos)**2
    return cost
costs = set()
for i in range(min(X)-1,max(X)+1):
    costs.add(get_cost(X,i))
print(min(costs))

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

using namespace std;
using p = pair<long long, int>;
#define INF 100000000

int main(){
	int n,k;
	cin >> n >> k;
	int a[n] = {0};
	int d;
	rep(i,k){
	cin >> d;
		rep(i,d){
			int c; cin >> c; c--;
			a[c]++;
		}
	}
	int count = 0;
	rep(i,n) if(a[i] == 0) count++;
	
	 cout << count << endl;
	
}

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

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
#define int ll
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<vvc> vvvc;
typedef pair<int, int> pii;
typedef pair<pii, pii> piii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector< vi > vvi;
typedef vector< vvi > vvvi;
typedef vector<short> vs;
typedef vector<vs> vvs;
typedef vector<vvs> vvvs;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<ld> vld;
typedef vector<vld> vvld;
typedef vector<vvld> vvvld;
typedef vector<string> vst;
typedef vector<vst> vvst;
typedef pair<ld, ld> pld;

#define inmin(a, b) a = min(a, (b))
#define inmax(a, b) a = max(a, (b))
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define sqr(x) ((x) * (x))
#define fori(i, n) for(int i = 0; i < int(n); ++i)
#define SZ(a) ((int)((a).size()))
#define triple(T) tuple<T, T, T>
#define quad(T) tuple<T, T, T, T>
#define watch(x) cerr << (#x) << " = " << (x) << endl;

#ifdef RUS_HOME
#define cerr cout
#else
#define cerr if (false) cerr
#endif

const double PI = 2 * acos(0.0);
#define rand shittttty_shit
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
mt19937_64 rng_64(chrono::steady_clock::now().time_since_epoch().count());

const string DIGITS = "0123456789";
const string ALPH = "abcdefghijklmnopqrstuvwxyz";


template <class T0, class T1>
inline ostream & operator << (ostream &out, pair<T0, T1> &a) {
    return out << "{" << a.first << ", " << a.second << "}";
}

template <class T0, class T1>
inline istream & operator >> (istream &in, pair<T0, T1> &a) {
    return in >> a.first >> a.second;
}

template <class T0, class T1, class T2>
inline ostream & operator << (ostream &out, tuple<T0, T1, T2> &a) {
    return out << "{" << get<0>(a) << ", " << get<1>(a) << ", " << get<2>(a) << "}";
}

template <class T0, class T1, class T2, class T3>
inline ostream & operator << (ostream &out, tuple<T0, T1, T2, T3> &a) {
    return out << "{" << get<0>(a) << ", " << get<1>(a) << ", " << get<2>(a) << ", " <<  get<3>(a) << "}";
}

template<class T>
inline ostream & operator << (ostream &out, vector<T> &a) {
    out << "[";
    fori (i, a.size())
        out << a[i] << vector<string>{", ", "]  "}[i + 1 == a.size()];
    return out;
}


void smain();



signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
#ifdef RUS_HOME
    freopen("input", "r", stdin);
    //freopen("output.txt", "w", stdout);
    clock_t start = clock();
#endif
    cout << setprecision(12) << fixed;
    smain();
#ifdef RUS_HOME
    cout << "\n\n\n\nTOTAL EXECUTION TIME: " << float( clock () - start ) /  CLOCKS_PER_SEC << endl;
#endif
    return 0;
}

const int MOD=1e9+7,N=1e5,M=18,oo=1e9;



void smain() {

    int a,b,c,d;
    cin>>a>>b>>c>>d;
    int v=max(max(a*c,b*d),max(a*d,b*c));
    if((a<=0&&b>=0)||(c<=0&&d>=0))
        inmax(v,0LL);
    cout<<v;

}



Measured memory_bytes: 3700
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<queue>
#include<deque>
#include<cmath>
#include<map>
#include<unordered_map>
#include<set>
#include<cstring>
#include<iomanip> //cout << fixed << setprecision(15) << x << endl;

using namespace std;
typedef long long ll;
const ll INF = 1e9 + 6;
const ll MOD = 1e9 + 7;
const ll LLINF = 1LL<<60;
#define Pint pair<int, int>
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rnr(i,a,b) for(int i=int(a);i>=int(b);i--)
#define rep(i,b) rng(i,0,b)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
/* -- template -- */

int main() {
    int N, K, C; cin >> N >> K >> C;
    string S; cin >> S;
    int l[N + 1], r[N + 1];
    l[0] = 0;
    r[N] = 0;
    rep(i, N) {
        if(S[i] == 'x') {
            l[i + 1] = l[i];
        }else {
            if(i - C < 0) {
                l[i + 1] = 1;
            } else {
                l[i + 1] = l[i - C] + 1;
            }
        }
    }
    for(int i = N - 1; i >= 0; --i) {
        if(S[i] == 'x') {
            r[i] = r[i + 1];
        }else {
            if(i + C + 1 > N) {
                r[i] = 1;
            }else {
                r[i] = r[i + C + 1] + 1;
            }
        }
    }
    vector<int> ans;
    rep(i, N) {
        if(S[i] == 'o'){
            if(l[i] + r[i + 1] < K) {
                ans.pb(i + 1);
            }
        }
    }
    for(int v : ans) {
        cout << v << endl;
    }
}


Measured memory_bytes: 5880
#include<iostream>
#include<map>
using namespace std;
int N,K,S,T,A[50];
long c[51][51],P[51],ans,now;
main()
{
	cin>>N>>K>>S>>T;
	for(int i=0;i<N;i++)cin>>A[i];
	c[0][0]=1;
	for(int i=0;i++<N;)
	{
		c[i][0]=1;
		for(int j=0;j++<K;)P[i]+=c[i][j]=c[i-1][j-1]+c[i-1][j];
	}
	for(int U=0;U<1<<18;U++)
	{
		map<int,int>M;
		for(int i=0;i<N;i++)~A[i]&S||A[i]&~T||M[A[i]&U]++;
		now=0;
		for(auto p:M)now+=P[p.second];
		if(!(~U&S||U&~T))ans+=__builtin_parity(U&~S)?-now:now;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 3680
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define invrepr(i,a,b) for(int i=b-1;i>=a;i--)
#define invrep(i,n) invrepr(i,0,n)
const int MOD=1e9+7;
 
int main() {
    string s;
    cin >> s;
    int n=s.size();
    int ans=100;
    rep(i,26) {
        int tans=0;
        int now=0;
        rep(j,s.size()) {
            if (s[j]==char('a'+i)) {
                tans=max(tans,j-now);
                now=j+1;
            }
        }
        tans=max(tans,n-now);
        ans=min(ans,tans);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
# include <bits/stdc++.h>
using namespace std;
# define FOR(i, a, b) for (int i = a; i <= b; ++i)
# define FDR(i, a, b) for (int i = a; i >= b; --i)
# define push_back pb
# define make_pair mp
# define lch p<<1, l, mid
# define rch p<<1|1, mid + 1, r
# define mem(a, b) memset(a, b, sizeof(a))
# define first fi
# define second se
# define MOD 1000000007
# define INF 1000000000
typedef long long i64;
typedef vector<int> VI;
typedef pair<int, int> PII;
const int N = 2005;

int a[N], b[N], c[N];
struct Node{int x, id;}node[N];

bool comp(Node a, Node b) {
    return a.x < b.x;
}
int main ()
{
    int n, K, Q;
    scanf("%d %d %d", &n, &K, &Q);
    for (int i = 1; i <= n; ++i) scanf("%d", a + i), node[i] = Node{a[i], i};
    sort(node + 1, node + n + 1, comp);
    int ans = node[Q].x - node[1].x;
    int l, r, mid;
    for (int i = 1; i <= n; ++i) {
        c[i + 1] = node[i].id;
        sort(c + 1, c + i + 2);
        for (int j = 0; j < i; ++j) b[j] = c[j + 2] - c[j + 1] - 1;
        b[i] = n - c[i + 1];
        int cnt = 0, mi = INF, ma = 0;
        for (int j = i + 1; j <= n; ++j) {
            l = 0; r = i + 1;
            while (l < r) {
                mid = (l + r + 1) / 2;
                if (c[mid] <= node[j].id) l = mid;
                else r = mid - 1;
            }
            if (b[l - 1] >= K) {
                --b[l - 1];
                mi = min(mi, node[j].x);
                ma = max(ma, node[j].x);
                ++cnt;
            }
            if (cnt == Q) break;
        }
        //printf("%d %d\n",i, cnt);
        if (cnt == Q) {
           // printf("%d %d %d\n",i, ma, mi);
            ans = min(ans, ma - mi);
        }
    }
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 384
n, a, b, k = map(int, input().split())
m = n // 2 + 1
mod = 998244353
comb = [1] * m
for i in range(1, m):
    comb[i] = comb[i - 1] * (n + 1 - i) * pow(i, mod - 2, mod)
    comb[i] %= mod
ans = 0
for i in range(n + 1):
    if a * i > k:
        break
    j = k - a * i
    if j % b == 0:
        j //= b
        if 0 <= j <= n:
            i, j = min(i, n - i), min(j, n - j)
            ans += comb[i] * comb[j]
            ans %= mod
print(ans)

Measured memory_bytes: 88108
#include<bits/stdc++.h>
using namespace std;
#define max(a,b) (a<b?b:a)
#define abs(x) (x<0?(-x):x)
#define F(i,L,R) for (int i = L; i < R; i++)
#define FE(i,L,R) for (int i = L; i <= R; i++)
#define RF(i,L,R) for (int i = L; i > R; i--)
#define RFE(i,L,R) for (int i = L; i >= R; i--)
#define getI(a) scanf("%d", &a)
#define getII(a,b) scanf("%d%d", &a, &b)
#define getIII(a,b,c) scanf("%d%d%d", &a, &b, &c)
#define VgetI(n) int (n); scanf("%d",&(n))
#define VgetII(n,m) int (n),(m); scanf("%d %d",&(n),&(m))
#define VgetIII(n,m,k) int (n),(m),(k); scanf("%d %d %d",&(n),&(m),&(k))
#define ll long long
#define INF 1000000000000000005
#define nINF -2000000000
#define MOD 1e9+7
#define PI 3.1415926535897932384626
int main(){
	int n;
	while(~getI(n)){
		bool flag=0;
		F(i,0,100) F(j,0,100) if(i*4+j*7==n) flag=1;
		printf("%s\n",flag==1?"Yes":"No");
	}
}


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

p = 0
ptotal = 0
x = 0
a = 100*n+1800*m
for i in range(1,100000):
    p = (1 - ptotal)*(1/2)**m
    x += a*i*p
    ptotal += p
x = round(x)
print(x)

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

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	int n,k; cin>>n>>k;
	vector<int>a(n+1,0);
	for(int i=0;i<k;++i){
		int d; cin>>d;
		for(int j=0;j<d;++j){
			int A; cin>>A;
			++a.at(A);
		}
	}
	cout<<count(a.begin()+1,a.end(),0)<<"\n"s;
}

Measured memory_bytes: 3656
n = int(input())
c = {
    'AC': 0,
    'WA': 0,
    'TLE': 0,
    'RE': 0,
}
for i in range(n):
    c[input()] += 1
print('AC x ' + str(c['AC']))
print('WA x ' + str(c['WA']))
print('TLE x ' + str(c['TLE']))
print('RE x ' + str(c['RE']))

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

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

    cin >> A >> B >> C >> X >> Y;

    int ans1 = max(X,Y)*2*C;
    int ans2 = (X > Y) ? min(X,Y)*2*C + (X-min(X,Y))*A : min(X,Y)*2*C + (Y-min(X,Y))*B;
    int ans3 = A*X + B*Y;

    ans = min(ans1,min(ans2,ans3));

    cout << ans << endl;
    return 0;

} 


Measured memory_bytes: 3632
import java.util.*;
public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		int[] a = new int[n+1];
		int max = 0;
		int max2 = 0;
		int[] ans = new int[n+1];
		
		for(int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
			if(a[i] > max) {
				max2 = max;
				max = a[i];
			} else if(a[i] > max2) {
				max2 = a[i];
			}
		}
		
		for(int i = 0; i < n; i++) {
			if(a[i] != max) {
				ans[i] = max;
			} else {
				ans[i] = max2;
			}
			System.out.println(ans[i]);
		}
		
	}

}


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

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

    vector<long long> C(N - 1);
    vector<long long> S(N - 1);
    vector<long long> F(N - 1);
    for (int i = 0; i < N - 1; i++) {
        cin >> C[i] >> S[i] >> F[i];
    }

    for (int i = 0; i < N - 1; i++) {
        long long t = C[i] + S[i];
        for (int k = i + 1; k < N - 1; k++) {
            if (t >= S[k] && t % F[k] == 0) {
                t += C[k];
            }
            else {
                if (t < S[k]) {
                    t = S[k] + C[k];
                }
                else {
                    t = t + (F[k] - t % F[k]) + C[k];
                }
            }
        }
        cout << t << endl;
    }

    cout << 0 << endl;
}

Measured memory_bytes: 256
<?php
	$output = array();
	while( true ) {
		list( $m, $f, $r ) = explode( ' ', trim( fgets( STDIN ) ) );
		if( -1 == $m && -1 == $f && -1 == $r ) { break; }
	
		$sum = $m + $f;
		if( -1 == $m || -1 == $f ) {
			array_push( $output, "F" );
		} else if( 80 <= $sum ) {
			array_push( $output, "A" );
		} else if( 65 <= $sum && $sum < 80 ) {
			array_push( $output, "B" );
		} else if( 50 <= $sum && $sum < 65 ) {
			array_push( $output, "C" );
		} else if( 30 <= $sum && $sum < 50 ) {
			if( 50 <= $r ) {
				array_push( $output, "C" );
			} else {
				array_push( $output, "D" );
			}
		} else {
			array_push( $output, "F" );
		}
	}
	print implode( PHP_EOL, $output );
?>

Measured memory_bytes: 6592
N,M = map(int,input().split())
L = []
for i in range(M):
  L.append(list(map(int,input().split())))
def find(x,par):
  if par[x] == x:
    return x
  else:
    return find(par[x],par)
def unite(x,y,par,rank):
  x = find(x,par)
  y = find(y,par)
  if x != y:
    if rank[x] < rank[y]:
      par[x] = y
    else:
      par[y] = x
      if rank[x] == rank[y]:
        rank[x] += 1
def same(x,y,par):
  return find(x,par) == find(y,par)
cnt = 0
for i in range(M):
  par = []
  rank = [0]*N
  for j in range(N):
    par.append(j)
  TF = [True]*M
  TF[i] = False
  for k in range(M):
    if TF[k] == True:
      unite(L[k][0]-1,L[k][1]-1,par,rank)
  flag = True
  for l in range(N):
    for m in range(N):
      if not same(l,m,par):
        flag = False
  if flag:
    cnt += 1
print(M-cnt)

Measured memory_bytes: 3064
package main

import (
	"fmt"
)

func main() {
	var S string
	fmt.Scan(&S)

	if S[0] != S[1] && S[0] != S[2] && S[1] != S[2] {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 512
#include<cstdio>
#include<string>
#include<cstring>
#include<utility>
#include<cmath>
#include<map>
#include<queue>
#include<set>
#include<algorithm>
#include<vector>
#include<iostream>
#define ll long long
#define pii pair<int,int>
#define mp make_pair
#define fi first
#define se second
#define inf 0x7fffffff
using namespace std;
int a[4][4];
int main()
{
	int i,j,k,n,m,x,y;
	for(i=1;i<=3;i++)
	{
		for(j=1;j<=3;j++)
		{
			scanf("%d",&a[i][j]);
		}
	}
	if(a[1][2]-a[1][1]==a[2][2]-a[2][1]&&a[2][2]-a[2][1]==a[3][2]-a[3][1]&&
	   a[1][3]-a[1][1]==a[2][3]-a[2][1]&&a[2][3]-a[2][1]==a[3][3]-a[3][1]&&
	   a[2][1]-a[1][1]==a[2][2]-a[1][2]&&a[2][2]-a[1][2]==a[2][3]-a[1][3]&&
	   a[3][1]-a[1][1]==a[3][2]-a[1][2]&&a[3][2]-a[1][2]==a[3][3]-a[1][3])
	{
		printf("Yes");
	}
	else
	{
		printf("No");
	}
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

static class PlasticBoard
{
    static void Main()
    {
        Func<int[], bool> isRight = 
            x => x[0] * x[0] + x[1] * x[1] == x[2] * x[2];
        Console.In.ReadToEnd()
            .Split( 
                new[] { '\r', '\n' },
                StringSplitOptions.RemoveEmptyEntries )
            .Select( x => Array.ConvertAll( x.Split( ',' ), int.Parse ) )
            .Select( x => new[] { isRight( x ), x[0] == x[1] } )
            .Select( x => x.Select( y => y ? 1 : 0 ).ToArray() )
            .Aggregate( (x, y) => new[] { x[0] + y[0], x[1] + y[1] } )
            .ToList()
            .ForEach( Console.WriteLine );
    }
}

Measured memory_bytes: 20356
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <queue>
using namespace std;
void file() {
    freopen("read.in", "r", stdin);
    freopen("write.out", "w", stdout);
}
const int N = 500010;
inline int read() {
    int sym = 0, res = 0;char ch = getchar();
    while (!isdigit(ch)) sym |= (ch == '-'), ch = getchar();
    while (isdigit(ch)) res = (res << 3) + (res << 1) + (ch ^ 48), ch = getchar();
    return sym ? -res : res;
}
int n, m;
int main() {
    n = read(); m = read(); if (n < m) swap(n, m);
    for (int i = 1; i <= n; i++) {
        printf("%d", m);
    }
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<bits/stdc++.h>
using namespace std;
const int INF = 1e9;
int n, m;
int k;


char s[1024];

int main() {
    vector <vector <int>> a;
    vector <vector <int>> dist;
    int n, m, k;
    k = max(n, m);
    scanf("%d %d", &n, &m);
    a.resize(n);

    pair <int, int> st, ed;

    scanf("%d %d", &st.first, &st.second);
    scanf("%d %d", &ed.first, &ed.second);
    -- st.first, -- st.second;
    -- ed.first, -- ed.second;

    for (int i = 0 ; i < n ; ++ i) {
        scanf("%s", s);
        for (int j = 0 ; j < m ; ++ j) {
            a[i].push_back(s[j] == '#' ? 0 : 1);
        }
    }
    dist.resize(n);
    for (int i = 0 ; i < n ; ++ i) {
        dist[i].resize(m, INF);
    }


    dist[st.first][st.second] = 0;
    deque <pair <int, int>> q;
    #define mp make_pair

    constexpr array <pair <int, int>, 4> MOVE = {mp(1, 0), mp(-1, 0), mp(0, 1), mp(0, -1)};

    q.push_back(st);
    while (!q.empty()) {
        auto [x, y] = q.front();
        q.pop_front();
        int cur_dist = dist[x][y];
        for (const auto &[i, j] : MOVE){
            int new_x = x + i, new_y = y + j;
            if (new_x >= 0 && new_x < n && new_y >= 0 && new_y < m && cur_dist < dist[new_x][new_y] && a[new_x][new_y]) {
                q.emplace_front(new_x, new_y);
                dist[new_x][new_y] = cur_dist;
            }
        }

        for (int i = -2 ; i <= 2 ; ++ i)
        for (int j = -2 ; j <= 2 ; ++ j) {
            int new_x = x + i, new_y = y + j;
            if (new_x >= 0 && new_x < n && new_y >= 0 && new_y < m && cur_dist + 1 < dist[new_x][new_y] && a[new_x][new_y]) {
                dist[new_x][new_y] = cur_dist + 1;
                q.emplace_back(new_x, new_y);
            }
        }

    }

    printf("%d\n", dist[ed.first][ed.second] == INF ? -1 : dist[ed.first][ed.second]);
}


Measured memory_bytes: 11820
#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;
}();
// freopen("input.txt", "r", stdin);

int main() {
    ll h, w, n, a, b;
    cin >> h >> w >> n;
    unordered_set<ll> black;
    unordered_set<ll> neibor;
    for(int k = 0; k < n; k++) {
        cin >> a >> b;
        a--; b--;
        black.insert(a*w+b);
        for(int i = -1; i <= 1; i++) {
            for(int j = -1; j <= 1; j++) {
                int aa = a + i;
                int bb = b + j;
                if (aa <= 0 || aa >= h-1 || bb <= 0 || bb >= w-1) {
                    continue;
                }
                neibor.insert(aa*w+bb);
            }
        }
    }
    ll acc = 0;
    vector<ll> ans(10, 0);
    for(ll from: neibor) {
        int cnt = 0;
        for(ll i = -1; i <= 1; i++) {
            for(ll j = -w; j <= w; j+=w) {
                if (black.count(from+i+j) > 0) {
                    cnt += 1;
                }
            }
        }
        if (cnt > 0) {
            ans[cnt] += 1;
            acc += 1;
        }
    }
    ans[0] = (h-2)*(w-2)-acc;
    for(int i = 0; i < 10; i++) {
        cout << ans[i] << endl;
    }
    return 0;
}




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

using namespace std;
//using namespace __gnu_pbds;

#define ll long long int
#define endl "\n"
#define db(x) cout<<#x<<" ->"<<x<<endl
#define db2(x,y) cout<<#x<<"->"<<x<<", "<<#y<<" -> "<<y<<endl
#define db3(x,y,z) cout<<#x<<" -> "<<x<<" , "<<#y<<" -> "<<y<<" , "<<#z<<" -> "<<z<<endl
#define db4(w,x,y,z) cout<<#w <<" -> " << w << " , " << #x<<" -> "<<x<<" , "<<#y<<" -> "<<y<<" , "<<#z<<" -> "<<z<<endl
#define prt(x) for(auto it = x.begin(); it!=x.end(); it++) { cout<<*it<<" "; } cout<< endl
#define IN freopen("input.txt","r",stdin)
//typedef tree< int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

int sz = -1;

ll dp[15][2][2][11];
vector< int > digit;
ll n;

void init(ll n){
    digit.clear();
    while(n){
        digit.push_back(n%10);
        n/=10;
    }
    reverse(digit.begin(),digit.end());
    sz = digit.size();
    return ;
}

ll recur(int pos,bool small,bool start,int prev){
    if(pos==sz){
        return 1;
    }
    if(dp[pos][small][start][prev]!=-1){
        return dp[pos][small][start][prev];
    }
    int lim = (small)?9:digit[pos];
    ll ret = 0;
    if(! start){ ///
        for(int i=0; i<=lim; i++){
            if(abs(prev-i) > 1 ){ continue ;}
            ret+=recur(pos+1, small | i<digit[pos] , 0, i);
        }
    }
    else{
        for(int i=1; i<=lim; i++){
            if(abs(prev-i) > 1 && prev!=0){ continue ;}
            ret+=recur(pos+1, small | i<digit[pos], 0, i);
        }
        ret+=recur(pos+1,1,1,0);
    }
    return dp[pos][small][start][prev]=ret;
}

int32_t main(){
    ios_base::sync_with_stdio(false); cin.tie(0);
//    IN;
    ll lo = 1 ;
    ll hi = (ll)1e12;
    cin >> n;
    ll ans = -1;
    while( lo <= hi){
        ll mid = (lo+hi) >> 1;
        init(mid);
        memset(dp,-1,sizeof(dp));
        ll cur = recur(0,0,1,0) - 1;
//        db2(cur,mid);
        if(cur >= n){
            hi = mid - 1;
            ans = mid;
        }
        else{
            lo = mid + 1;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
// Begin Header {{{
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i,n) for(ll i=0; i<n; i++)
#define loop(i, j, n) for(ll i=j; i<n; i++)
#define all(x) (x).begin(), (x).end()
constexpr int INF  = 0x3f3f3f3f;
const long long mod=1e9+7;
const long double PI = acos(-1);
template <class T>void UNIQUE(vector<T> &x){
	sort(all(x));
	x.erase(unique(all(x)), x.end());
}

// }}} End Header


int main() {
	ll n;
	cin >> n;
	vector<ll> ans;
	vector<ll> a(n);
	rep(i,n) cin >> a[i];
	for(ll i=1; i<=n; i+=2){
		ans.push_back(a[i-1]);
	}
	reverse(all(ans));
	for(ll i=2; i<=n; i+=2){
		ans.push_back(a[i-1]);
	}
	if(n%2 == 0) reverse(all(ans));
	for(auto x : ans) cout << x << " ";
	cout << endl;
	return 0;
}


Measured memory_bytes: 6880
#include <vector>
#include <string>
#include <stdlib.h>
#include <math.h>
#include <iostream>
#include <fstream>
#include <algorithm>
#include <sstream>
#include <map>
#include <unordered_map>
#include <ctime>
#include <cassert>
#include <cstring>
#include <sys/time.h>
#include <stdlib.h>
using namespace std;

int main(int argc, char *argv[]){
  int r;
  cin >> r;
  int a = r*r;
  cout << a << endl;
  return 0;
}


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

lli a, b, x;
lli res;

int main(void){
    cin >> a >> b >> x;
    lli c, d;
    c = a/x;
    d = b/x;
    res = d-c;
    if(a%x == 0) res++;
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 3608
#include <iostream>
#include <cstring>
#include <string>    
#include <vector>
#include <queue>
#include <map>
#include <algorithm>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
ll n, m;
string str;

int main(){
	cin >> n >> m;
	if(m == 1){cout << 0 << endl;;}
	else{cout << n-m << endl;}
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<cmath>
#include<stack>
#include<queue>
using namespace std;

#define bug printf("bug\n");
#define bug2(var) cout<<#var<<" "<<var<<endl;

typedef long long ll;

const int maxn = 300010;

int n;
ll a[maxn],pre[maxn],aft[maxn];

priority_queue<ll> y; // 大根堆 
priority_queue<ll, vector<ll>,greater<ll> > x; // 小根堆 

ll read(){ ll s=0,f=1; char ch=getchar(); while(ch<'0' || ch>'9'){ if(ch=='-') f=-1; ch=getchar(); } while(ch>='0' && ch<='9'){ s=s*10+ch-'0'; ch=getchar(); } return s*f; }

int main(){
	n = read();
	for(int i = 1;i <= 3*n ;i++) { a[i] = read(); }
	 
	for(int i = 1;i <= n;i++){
		x.push(a[i]);
		pre[i] = pre[i-1] + a[i];
	}
	
	
	for(int i = n + 1;i <= 2 * n; i++) {
		int cur = x.top(); 
		pre[i] = pre[i-1];
		if(a[i] > cur){
			x.pop();
			pre[i] -= cur;
			pre[i] += a[i];
			x.push(a[i]);
		}
	}
	
//	for(int i=1;i<=2*n;i++){
//		printf("%d ",pre[i]);
//	}printf("\n");
	
	for(int i = 3 * n; i >= 2 * n + 1 ;i--){
		y.push(a[i]);
		aft[i] = aft[i+1] + a[i];
	}
		
//	bug
	
	for(int i = 2 * n; i > n ;i--){
		int cur = y.top();
		aft[i] = aft[i+1];
		if(a[i] < cur){
			y.pop();
			aft[i] -= cur;
			aft[i] += a[i];
			y.push(a[i]);
		}
	}
	
//	for(int i=3*n;i>n;i--){
//		printf("%d ",aft[i]);
//	}printf("\n");
	
	ll ans = -1000000000000000ll;
	for(int i = n;i <= 2 * n;i++){
		ans = max(ans , pre[i] - aft[i+1]);
//		bug2(ans);
	}
	
	printf("%lld\n",ans);
	
	return 0;
}

Measured memory_bytes: 10460
#include<iostream>
using namespace std;
int main(){
 
  int  x,y;

  cin >> x >> y;

if(x==2 || y==2){
cout << "No" << endl;
}else if(x<=7 && x%2==0 ){
    if(y>=8 && y%2==1 ){
     cout << "Yes" << endl;
  }else if (y<=7 && y%2==0){
     cout << "Yes" << endl;
  }else{
     cout << "No" << endl;
  }
}else if(x<=7 && x%2==1){
  if((y<=7 && y%2==1) ||(y>=8 && y%2==0)){
    cout << "Yes" << endl;
   }else{
    cout << "No" << endl;
   } 
 }else if(x>=8 && x%2==0){
  if(y>=8 && y%2==0){
    cout <<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
 }else if(x>=8 && x%2==1){
  if(y>=8 && y%2==1){
    cout << "Yes" <<endl;
  }else{
    cout << "No" <<endl;
  }
 }
  return 0;
}


Measured memory_bytes: 256
/*ALDS1_2B*/

#include <iostream>
#define abs(a) (a<0?-(a):a)
#define square(x) ((x)*(x))
#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
#define swap(a,b) ((a!=b)?(a+=b,b=a-b,a-=b):0)
#define This
#define True true
#define False false
#define null Null


using namespace std;

int selectionSort(int[],int);

int main(){
    int n;
    cin>>n;
    int num[n];
    for(int i=0;i<n;i++){
        cin>>num[i];
    }
    cout<<selectionSort(num,n)<<endl;
    

}

int selectionSort(int num[],int N){
    int cnt=0;
    for(int i=0;i<N;i++){
        int minj=i;
        for(int j=i;j<N;j++){
            if(num[j]<num[minj]){
                minj=j;
            }
        }
        swap(num[i],num[minj]);
        if(i!=minj)cnt++;
    }
    for(int i=0;i<N-1;i++){
		cout<<num[i]<<" ";
	}
	cout<<num[N-1]<<endl;
    return cnt;
}


Measured memory_bytes: 3076
#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#define _USE_MATH_DEFINES
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;

int main() {
    int N;
    cin >> N;
    ll a[3 * N];
    for (int i = 0; i < 3 * N; i++) {
        cin >> a[i];
    }
    sort(a, a + 3 * N);
    ll ans = 0;
    for (int i = 0; i < N; i++) {
        ans += a[3 * N - (i + 1) * 2];
    }
    cout << ans << endl;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int X;
    cin >> X;
    int grade = -1;
    if (X <= 599)
    {
        grade = 8;
    }
    else if (X <= 799)
    {
        grade = 7;
    }
    else if (X <= 999)
    {
        grade = 6;
    }
    else if (X <= 1199)
    {
        grade = 5;
    }
    else if (X <= 1399)
    {
        grade = 4;
    }
    else if (X <= 1599)
    {
        grade = 3;
    }
    else if (X <= 1799)
    {
        grade = 2;
    }
    else
    {
        grade = 1;
    }
    cout << grade << endl;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define mrep(i,j,n) for(int i = j; i < n; i++)
#define reps(i,n) for(int i = 1; i <= n; i++)
#define rrep(i,n) for(int i = n-1; i >= 0; i--)
#define rreps(i,n) for(int i = n; i >= 1; i--)
#define co(x) cout << x <<endl
#define cs(x) cout << x <<" "
#define cer(x) cerr << x <<endl
#define ALL(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define ERASE(x,val) x.erase(remove(ALL(x), val), x.end())
#define pb push_back

typedef long long ll;
typedef unsigned long long ull;
using namespace std;
ll mod = 1e9 + 7;
template<class T>inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; }return false; }
template<class T>inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; }return false; }

int main()
{
	int n; cin >> n;
	vector<vector<int>> f(n, vector<int>(10));
	vector<vector<int>> p(n, vector<int>(11));
	rep(i, n)rep(j, 10)cin >> f[i][j];
	rep(i, n)rep(j, 11)cin >> p[i][j];

	int ans = -2000000000;
	int cnt = 0;
	reps(i, (1 << 10)-1)
	{
		int prof = 0;
		rep(j, n)
		{
			int d = 0;
			rep(k, 10)
			{
				if ((i & 1 << k)&& (f[j][k]))
				{
					d++;
				}
			}
			prof += p[j][d];
		}
		chmax(ans, prof);
		cnt++;
	}
	co(ans);
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define vi vector <int>
#define vl vector <ll>
#define dl pair <ll, ll>
#define ii pair <int, int>
#define vii vector <ii>
#define graph vector <vi>
#define REP(a, b) for (int i = a; i < b; i++)
#define REP2(a, b) for (int j = a, j < b; j++)
#define REPS(a, b, c) for (int i = a, i < b; i += c)

#define inf 1000000000

using namespace std;

int main() {
    ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);

    ll n, x, m;
    cin >> n >> x >> m;
   	vi residuo(m, 0);
    n--;
    residuo[x] = 1;
    ll suma = x;
    vl r;
    r.reserve(m);
    r.push_back(x);
    while (n) {
    	x *= x;
    	x %= m;
    	if (!x) {cout << suma << "\n"; return 0;}
    	if (residuo[x]) {
    		break;
    	}
    	suma += x;
    	r.push_back(x);
    	residuo[x] = 1;
    	n--;
    }
    reverse(r.begin(), r.end());
    while (r.back() != x) r.pop_back();
    ll seg = r.size();
    ll suma2 = 0;
    for (ll i : r) {
    	suma2 += i;
    }
    suma += ((n / seg) * suma2);
    reverse(r.begin(), r.end());
    n %= seg;
    REP(0, n) {
    	suma += r[i];
    }
    cout << suma << "\n";
    return 0;
}


Measured memory_bytes: 3980
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a,b,c;
  //入力 b=1円玉 a=支払い金額
  cin >> a >> b;
  //処理
  c = a % 500;
  if (b >= c) {
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  //出力
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
//g++ -std=c++11 

using namespace std;
typedef long long ll;

#define rep(i,n) for (long long i = 0; i < (n); ++i)
#define DIV 1000000007 //10^9+7

int main(){
	double r;
	cin >> r;
	cout << 3 * r * r << endl;
}


Measured memory_bytes: 3728
#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];
  }
  sort(a,a+n);
  for(int i=0; i<n; i++) {
    if(a[i]==a[i+1]) {
      cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES" << endl;
}

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

#define endl "\n"
#define int long long
#define vec(x) vector<x>
#define pb push_back
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pair<int,int>>
#define matrix(x) vector<vector<x>>
#define all(v) v.begin(),v.end()
#define mem(a,b) memset(a, b, sizeof a)
#define setBits(n) __builtin_popcountll(n)
#define prec(n) fixed<<setprecision(n)
#define ff first
#define ss second
#define print(x) for(auto it:x) cout<<it<<" ";
#define dbg(x) cerr<<#x<<" :: "<<x<<endl;
#define dbg2(x,y) cerr<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<endl;
const int INF = 1e9;
const int MOD = 1e9 + 7; 
const double pi = acos(-1);
int power(int a,int b,int m=MOD)
{int ans=1;while(b>0){if(b&1)ans=(ans*a)%m;a=(a*a)%m;b>>=1;}
return ans;}
int dir[]={-1, 0, 1, 0, -1};
int dx[]={1,1,0,-1,-1,-1, 0, 1};
int dy[]={0,1,1, 1, 0,-1,-1,-1};

const int N = 1e5+1;

void solve()
{
	int i,j,n,k;
	cin>>n>>k;
    vi a(n);
    for(i=0;i<n;i++)
    cin>>a[i];
    int dp[k+1]={0};
    for(i=1;i<=k;i++)
    {
        for(j=0;j<n;j++)
        if(i-a[j]>=0)
        dp[i]=dp[i] or !dp[i-a[j]];
    }
    if(dp[k])
    cout<<"First"<<endl;
    else
    cout<<"Second"<<endl;
}

int32_t main()
{
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	int t;
	t=1;
	//cin>>t;
	while(t--)
		solve();
}

Measured memory_bytes: 1024
END { load __FILE__ unless $stdin.eof? }

n, m = gets.split.map!(&:to_i)

nbrs = Array.new(n + 1) { [] }
m.times do
  u, v = gets.split.map!(&:to_i)
  nbrs[u] << v
  nbrs[v] << u
end

max_num = 0
(1..n).each do |i|
  q = nbrs[i]
  next unless q

  group = { i => true }
  while (j = q.pop)
    r = nbrs[j]
    next unless r
    group[j] = true
    nbrs[j] = nil
    q.concat(r)
  end
  num = group.size
  max_num = num if num > max_num

  nbrs[i] = nil
end

puts max_num


Measured memory_bytes: 47504
O = input()
E = input()

Olen = len(O)
Elen = len(E)

s = ""
for i in range( max(Olen, Elen) ):
    oc = O[i] if i < Olen else ""
    ec = E[i] if i < Elen else ""
    s += oc+ec

print(s)

Measured memory_bytes: 2940
#include <algorithm>
#include <cstdint>
#include <iostream>
#include <vector>
#include <utility>

using namespace std;

constexpr int64_t kMod = 1e9+7;

int main() {
  int64_t N;
  cin >> N;
  vector<pair<int64_t, int64_t>> ps(N);
  vector<pair<int64_t, int64_t>> zs(N);
  vector<pair<int64_t, int64_t>> ws(N);
  for (int64_t n = 0; n < N; ++n) {
    int64_t x, y;
    cin >> x >> y;
    ps[n] = {x, y};
    zs[n] = {x + y, n};
    ws[n] = {x - y, n};
  }
  sort(zs.begin(), zs.end());
  sort(ws.begin(), ws.end());
  
  int64_t dist_z = zs.back().first - zs.front().first;
  int64_t dist_w = ws.back().first - ws.front().first;

  cout << max(dist_z, dist_w) << endl;

  return 0;
}


Measured memory_bytes: 12664
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()
#define fi first
#define se second
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,K,Q,A,B;
string S;
const ll MOD = 998244353;
//const ll MOD = (1e+9) + 7;
const ll INF = 1LL<<60;
typedef pair<ll, ll> P;

int main() {
    ll C;
    string t;
    cin>>N>>K>>C>>t;
    S = "";
    rep(i,C + 1) S.push_back('x');
    S.append(t);
    rep(i,C + 1) S.push_back('x');
    N += (C + 1)* 2;
    vec numl(N, 0), numr(N, 0), nl(N, -1), nr(N, -1);
    int last = 0;
    rep(i, N) {
        if(S[i] == 'o') last = i;
        nl[i] = last;
    }
    last = N - 1;
    Rrep(i,N){
        if(S[i] == 'o') last = i;
        nr[i] = last;
    }
    vec tnl = nl, tnr = nr;
    rep(i,N) nr[i] = nr[min(N - 1, i + C + 1)];
    Rrep(i, N) nl[i] = nl[max(0LL, i - (C + 1))];
    numl[0] = numr[N - 1] = 0;
    reps(i,1,N) numl[i] = numl[nl[i]] + 1;
    Rrep(i, N - 1) numr[i] = numr[nr[i]] + 1;
    vec ans(0);
    map<ll, ll> mp;
    reps(i,C, N - C){
        if(numl[i] + numr[i] == K + 1 && S[i] == 'o') ++mp[numl[i] * N * 2 + numr[i]];
        //cout<<i - C<<' '<<numl[i]<<' '<<numr[i]<<endl;
    }
    reps(i,C, N - C) {
        if(numl[i] + numr[i] == K + 1 && S[i] == 'o' && mp[numl[i] * N * 2 + numr[i]] == 1) ans.push_back(i - C);
    }
    rep(i,ans.size()){
        cout<<ans[i]<<endl;
    }
}

Measured memory_bytes: 25460
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<queue>
#include<deque>
#include<cmath>
#include<map>
#include<unordered_map>
#include<set>
#include<cstring>
#include<iomanip> //cout << fixed << setprecision(15) << x << endl;

using namespace std;
typedef long long ll;
const ll INF = 1e9 + 6;
const ll MOD = 1e9 + 7;
const ll LLINF = 1LL<<60;
#define Pint pair<int, int>
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
/* -- template -- */

bool N, W, E, S;

int main() {
    string s; cin >> s;
    rep(i, s.size()) {
        if(s[i] == 'N') N = true;
        if(s[i] == 'W') W = true;
        if(s[i] == 'E') E = true;
        if(s[i] == 'S') S = true;
    }
    if(N && W && E && S || N && S && !E && !W || !N && !S && E && W)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>

using namespace std;

int partition(int A[], int p, int r) {
  int x = A[r];
  int i = p - 1;
  for (int j = p; j < r; j++) {
    if (A[j] <= x) {
      i++;
      // printf("swap A[%d]=%d & A[%d]=%d\n", i, A[i], j, A[j]);
      swap(A[i], A[j]);
    }
  }
  // printf("swap A[%d]=%d & A[%d]=%d\n", i + 1, A[i + 1], r, A[r]);
  swap(A[i + 1], A[r]);
  return i + 1;
}

int main() {
  int n;
  scanf("%d", &n);
  int A[n];
  for (int i = 0; i < n; i++) {
    scanf("%d", &A[i]);
  }
  int q = partition(A, 0, n - 1);
  for (int i = 0; i < n; i++) {
    if (i != 0) {
      printf(" ");
    }
    if (i == q) {
      printf("[%d]", A[i]);
    } else {
      printf("%d", A[i]);
    }
  }
  printf("\n");
}


Measured memory_bytes: 3148
#include <bits/stdc++.h>
#include<vector>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define MAX 400000
#define BEGIN 1
#define DEFAULT_VALUE 0
set<string> S;
char s[11];
int main()
{

    int n,i,j;
    char c;
    scanf("%d ",&n);
    for(i=0;i<n;i++)
    {
        for(j=0;j<11;j++)
        {
            scanf("%c",&c);
            if(!(c>='a'&&c<='z')) break;
            s[j]=c;
        }
        for(;j<11;j++)
        {
            s[j]='\0';
        }
        S.insert(s);
    }
    printf("%d",S.size());
    return 0;
}


Measured memory_bytes: 19332