akhauriyash/Code-Regression huggingface dataset:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()


def main():
    gcd = fractions.gcd
    N = I()
    A = LI()
    left = [1] * N
    right = [1] * N
    left[0] = A[0]
    right[N-1] = A[N-1]
    ans = -1

    for i in range(1, N):
        left[i] = gcd(A[i], left[i-1])
    for j in range(N-2, -1, -1):
        right[j] = gcd(A[j], right[j+1])
    for i in range(N):
        if i-1<0:
            ans = max(ans, right[i+1])
            continue
        if i+1 >= N:
            ans = max(ans, left[i-1])
            continue
        ans = max(ans, gcd(left[i-1], right[i+1]))

    print(ans)

main()


'''

N = int(input())
S = list(input())

ans = 0
s_count = 0
if len(S) == 1:
    print(ans)
elif len(S) == 2:
    if S == ['#', '.']:
        print("1")
    else:
        print("0")
elif len(S) == 3:
    for i in range(len(S)-1):
        if S[i] == '#' and S[i+1] == '.':
            ans += 1
    print(ans)
            
else:
    for c in S[:-1]:
        if c=='#':
            s_count += 1
    for i in range(len(S)-3):
        if S[i:i+4] == ['.','#','.','.']:
            S[i:i+4] = ['.','.','.','.']
            
        elif S[i:i+4] == ['.','#','.','#']:
            S[i:i+4] = ['.','#','#','#']

        elif S[i:i+4] == ['#','#','.','.']:
            S[i:i+4] = ['#','#','#','.']

        elif S[i:i+4] == ['#','#','.','#']:
            S[i:i+4] = ['#','#','#','#']
        else:
            continue
        ans += 1

    print(min(s_count, ans, len(S)-s_count))
print(S)
'''


Measured memory_bytes: 16544
#include<bits/stdc++.h>
#define For(i,j,k)  for(ll i=j;i<=k;++i)
#define Dow(i,j,k)  for(ll i=k;i>=j;--i)
#define ll long long
using namespace std;
inline char gc(){
    static char buf[100000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}
#define gc getchar
inline ll read()
{
	ll t=0,f=1;char c=gc();
	while(!isdigit(c))  {if(c=='-') f=-1;c=gc();}
	while(isdigit(c))   t=t*10+c-'0',c=gc();
	return t*f;
}
inline void write(ll x){if(x<0) {putchar('-');write(-x);return;}if(x>=10)    write(x/10);putchar(x%10+'0');}
inline void writeln(ll x){write(x);puts("");}
inline void write_p(ll x){write(x);putchar(' ');}

ll n,mod=1e9+7,fac[1000010],N[1000010],ans,f[1000010],sum;
ll ksm(ll x,ll y){ll ans=1;while (y){if (y&1)(ans*=x)%=mod;(x*=x)%=mod;y>>=1;}return ans;}
ll	p(ll n,ll m){return fac[n]*N[m]%mod;}
ll C(ll n,ll m){return fac[n]*N[m]%mod*N[n-m]%mod;}
int main()
{
	n=read();
	if (n==2){puts("1");return 0;}
	fac[0]=1;
	For(i,1,n)
		fac[i]=fac[i-1]*i%mod;
	N[n]=ksm(fac[n],mod-2);
	Dow(i,0,n-1)N[i]=N[i+1]*(i+1)%mod;
	for (ll i=1;i<n;i++)if (i*2>=n)
	{
		f[i]=C((n-2-(i*2-n))/2+i*2-n,i*2-n)*fac[i]%mod*fac[n-1-i]%mod;
		(ans+=(f[i]-f[i-1])*i%mod+mod);
		ans%=mod;
	}
	writeln(ans);
}

Measured memory_bytes: 21632
import java.util.*;class Main{public static void main(String[]r){Scanner sc=new Scanner(System.in);int i,u,n=sc.nextInt(),m=sc.nextInt(),x=sc.nextInt(),w=Integer.MAX_VALUE,q=Integer.MAX_VALUE;int[]a=new int[n],b=new int[m];for(i=0;i<n;i++)w=(w<(a[i]=sc.nextInt()))?w:a[i];for(i=0;i<m;i++)q=(q<(b[i]=sc.nextInt()))?q:b[i];u=q+w;for(i=0;i<x;i++)u=(u<(q=a[sc.nextInt()-1]+b[sc.nextInt()-1]-sc.nextInt()))?u:q;System.out.println(u);}}

Measured memory_bytes: 152476
#include <bits/stdc++.h>
#define rep(i,n) for (int i = (0); i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define show(x) cout << #x << " = " << (x) << endl
#define show2(x,y) cout << #x << " = " << (x) << ", " << #y << " = " << (y) << endl
#define show3(x,y,z) cout << #x << " = " << (x) << ", " << #y << " = " << (y) <<  ", " << #z << " = " << (z) << endl
#define showv(v) rep(i,v.size()) printf("%d%c", v[i], i==v.size()-1?'\n':' ')
#define showv2(v) rep(j,v.size()) showv(v[j])
#define showt(t,n) rep(i,n) printf("%d%c", t[i], i==n-1?'\n':' ')
#define showt2(t,r,c) rep(j,r) showt(t[j],c)
#define showvp(p) rep(i,p.size()) printf("%d %d\n", p[i].first, p[i].second);
#define printv(v) rep(i,v.size()) printf("%d\n", v[i])
#define printt(t,n) rep(i,n) printf("%d\n", t[i])
#define incl(v,x) find(rng(v),x)!=v.end()
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
typedef vector<pii> vp;
typedef vector<tiii> vt;
const int mod = 1000000007;
const double EPS = 1e-9;
const int INF = (1<<30)-1;
const ll INFLL = (1LL<<62)-1;
#define dame { puts("No"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
inline int in() { int x; scanf("%d",&x); return x;}
//cout << fixed << setprecision(10);
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 () {
  string s;
  cin >> s;

  auto check = [&](string s) {
    if (s[0] != 'A') return false;
    int C = 0;
    for (int i = 2; i < sz(s)-1; ++i) {
      if (s[i] == 'C') C++;
    }
    if (C != 1) return false;
    int upper = 0;
    rep(i,sz(s)) {
      if ('A'<=s[i] && s[i]<='Z') upper++;
    }
    if (upper != 2) return false;
    return true;
  };

  if (check(s)) puts("AC");
  else puts("WA");
  return 0;
}

Measured memory_bytes: 256
n=int(input())
active_list=[list(map(int,input().split())) for _ in range(n)]
dp=[[0,0,0] for _ in range(n)]
for i in range(3):
    dp[0][i]=active_list[0][i]
for j in range(n-1):
    for k in range(3):
        dp[j+1][k]=max(dp[j][k-1]+active_list[j+1][k],dp[j][k-2]+active_list[j+1][k])
print(max(dp[-1]))


Measured memory_bytes: 104736
/*
https://abc106.contest.atcoder.jp/
*/

#include <iostream>
#include <cstring>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iomanip>
using namespace std;

int main()
{
 	ios::sync_with_stdio(false);
	long long int N;
	int i,j;
	long long k;
	int n;
	string a;
	while(cin>>a>>k)
	{
		n=a.size();
		
		for(i=0;i<n;i++)
		{
			j=a[i]-'0';
			if(j!=1)
				break;
		}
		
		if(k<=i)
		{
			cout<<a[k-1]<<endl;
			continue;
		}
		
		char p=j+'0';
		cout<<p<<endl;
		
		
		
	}
	
	
	
	
	
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n=sc.nextInt();
        int m=sc.nextInt();
        int l=sc.nextInt();
        int matrix_A[][]=new int[n][m];
        int matrix_B[][]=new int[m][l];
        for(int i=0;i<n;i++) {
            for (int j = 0; j < m; j++) {
                matrix_A[i][j]=sc.nextInt();
            }
        }

        for(int i=0;i<m;i++) {
            for (int j = 0; j < l; j++) {
                matrix_B[i][j]=sc.nextInt();
            }
        }


        for(int i=0;i<n;i++) {
            for (int j = 0; j < l; j++) {
                long C=0;
                for (int k = 0; k < m; k++) {
                    C += matrix_A[i][k] * matrix_B[k][j];
                }
                if(j<l-1)System.out.print(C+" ");
                else System.out.println(C);
            }
        }
    }
}


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

using namespace std;
typedef long long ll;
#define all(v) (v).begine(), (v).end()
#define pb push_back
#define vector <int> vi
#define in(n) cin >> n
#define out(n) cout << n << '\n'
#define rep(i, n) for (ll i = 0; i < (n); i++)
const int inf = 1000000000;

void solve()
{
    char a;
    in(a);
    if (a - 'a' < 26 && a - 'a' >= 0)
    {
        out('a');
    }
    else
    {
        out('A');
    }
}

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

Measured memory_bytes: 3632
#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{HashMap, HashSet};
#[allow(unused_imports)]
use std::io::*;
#[allow(unused_imports)]
use std::str::*;

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

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

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

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

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

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

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let cin = stdin();
    let cin = cin.lock();
    let s: String = cin
        .bytes() // Bytes
        .map(|c| c.expect("failed reading char") as char)
        .skip_while(|c| c.is_whitespace()) // c が whitespace である限り skip
        .take_while(|c| !c.is_whitespace()) // c が whitespace でない限り要素を返す
        .collect();
    s.parse().ok().expect("failed parsing")
}

fn main() {
    let a: usize = read();
    let b: usize = read();
    let c: usize = read();
    let mut x = 0;
    x += (a == b) as usize;
    x += (b == c) as usize;
    x += (a == c) as usize;
    if x == 1 {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 4352
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {in_n: usize, in_m: usize, in_q: usize, in_queries: [[usize; 4]; in_q]};
    let mut array = [1; 11];
    let mut score = 0;

    while array[0] == 1 {
        for i in 1..in_n + 1 {
            if array[i] == 0 {
                array[i] = array[i - 1];
            }
        }

        let mut s = 0;

        for q in in_queries.iter() {
            if array[q[1] as usize] - array[q[0] as usize] == q[2] {
                s += q[3];
            }
        }

        score = if s > score { s } else { score };

        array[in_n] += 1;

        for i in (1..in_n + 1).rev() {
            if array[i] == in_m + 1 {
                array[i] = 0;
                array[i - 1] += 1;
            }
        }
    }

    println!("{}", score);
}


Measured memory_bytes: 2156
#include <stdio.h>
int n,Matrix[100][100],weight[100],parent[100];
char color[100];


int Prim(){
  int i,j,node,minimum,sum=0;
  //initialization
  for(i=0;i<n;i++){
    weight[i]=2001;
    parent[i]=-1;
    color[i]='w';
  }

  weight[0]=0;

  while(1){
    minimum=2001;
    node=-1;

    for(i=0;i<n;i++){
      if(minimum>weight[i] && color[i]!='b'){
        node=i;
        minimum=weight[i];
      }
    }

    if(node==-1)break;
    color[node]='b';

    for(i=0;i<n;i++){
      if(color[i]!='b' && Matrix[node][i]!=2001){
        if(weight[i]>Matrix[node][i]){
          weight[i]=Matrix[node][i];
          parent[i]=node;
          color[i]='g';
        }
      }
    }
  }
  
  for(i=0;i<n;i++)
    if(parent[i]!=-1)sum+=Matrix[i][parent[i]];
  
  return sum;
}

int main(){
  int i,j,key;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      scanf("%d",&key);
      if(key==-1)Matrix[i][j]=2001;
      else Matrix[i][j]=key;
    }
  }


  printf("%d\n",Prim());

  return 0;
}



Measured memory_bytes: 2112
#pragma GCC optimize("Ofast")
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<string.h>
#include<math.h>
#include<map>
#include<iomanip>
#include<queue>

using namespace std;

int main(){	
	
	int n;
	long long k;
	cin >> n >> k;
	vector<long long> L(n);
	for(int i=0;i<n;i++)cin >> L[i];
	int ma=*max_element(L.begin(),L.end());
	
	long long start=0;
	long long end=ma;
	long long mid;
	while(end-start>1){
		mid=(start+end)/2;
		long long cnt=0;
		for(int i=0;i<n;i++){
			long long cut=(L[i]-1)/mid;
			if(cut<0)cnt=0;
			cnt+=cut;
		}
		if(cnt>k)start=mid;
		else end=mid;
	}
	cout << end << endl;
	return 0;
}


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

const int N = 3e5 + 5;
char s[N];
int x[N], y[N];

int main() {
    int n;
    scanf("%d", &n);
    scanf("%s", s + 1);

    for(int i = 1; i <= n; ++i) {
        if(s[i] == 'W') x[i] = 1;
        else y[i] = 1;
    }

    for(int i = 1; i <= n; ++i) x[i] += x[i - 1];
    for(int i = n; i >= 1; i--) y[i] += y[i + 1];

    int res = n;
    for(int i = 1; i <= n; ++i) res = min(res, x[i - 1] + y[i + 1]);
    printf("%d\n", res);
}

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

int main()
{
  string s1, s2, s3;

  cin >> s1 >> s2 >> s3;

  cout << (char)(s1[0] - 0x20) << (char)(s2[0] - 0x20) << (char)(s3[0] - 0x20) << endl;
}


Measured memory_bytes: 256
import sys
import math

char = "abcdefghijklmnopqrstuvwxyz"

cnt = {}

for S in sys.stdin:
    for x in S:
        x = x.lower()
        if x not in cnt:
            cnt[x] = 0
        cnt[x] += 1
    
for c in char:
    sys.stdout.write(c + " : ")
    if c not in cnt:
        print 0
    else:
        print cnt[c]

Measured memory_bytes: 6392
#define _USE_MATH_DEFINES
#include<iostream>
#include<fstream>
#include<vector>
#include<string>
#include<algorithm>
#include<climits>
#include<numeric>
#include<cmath>
#include<cstring>
#include<deque>
#include<map>
#include<iomanip>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define VSORT(v) sort(v.begin(), v.end());
#define VE vector<int>
#define VEP vector<pair<int,int>>
#define llong long long
#define pb(a) push_back(a)
using namespace std;
const vector<VE> DIR{ {-1,0},{1,0},{0,-1},{0,1} };
const llong MOD = 1000000007;
long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}
template<class T>
int dp2csv(const vector<vector<T>> & dp, const string fname);
int range_check(int val, int min, int max) {
	if (val < min) {
		return -1;
	}
	if (val > max) {
		return -1;
	}
	return val;
}
template<class T,class T1>
bool array_find(const T& array, const T1& dst) {
	auto result = find(array.first(), array.end(), dst);
	if (result == array.end()) {
		return false;
	}
	else {
		return true;
	}
}
int main() {
	int n, m;
	cin >> n >> m;
	vector<int> pro(m);
	vector<bool> res(m);
	REP(i, m) {
		int tmp;
		cin >> tmp;
		pro[i] = tmp - 1;
		string tmps;
		cin >> tmps;
		if (tmps == "AC") {
			res[i] = true;
		}
		else {
			res[i] = false;
		}
	}
	vector<bool> sol(n,false);
	vector<int> was(n,0);
	REP(i, m) {
		if (res[i] == true && sol[pro[i]]== false) {
			sol[pro[i]] = true;
		}
		else if (res[i] == false && sol[pro[i]] == false) {
			was[pro[i]]++;
		}
	}
	int acs = 0;
	int waa = 0;
	REP(i, n) {
		if (sol[i] == true) {
			acs++;
			waa += was[i];
		}
	}
	cout << acs << " " << waa << endl;
	return 0;
}
template<class T>
int dp2csv(const vector<vector<T>> & dp, const string fname) {
	ofstream ofs(fname);
	if (ofs.fail()) { cerr << "cannot open file. :" + fname << endl; return -1; }
	for (auto dp_row : dp) {
		for (auto dp_cell : dp_row) {
			ofs << dp_cell << ",";
		}
		ofs << endl;
	}
	ofs.close();
	return 0;
}


Measured memory_bytes: 1024
$vwall = Array.new(30)
$hwall = Array.new(30)
$dx = [0,1,0,-1]
$dy = [1,0,-1,0]
def bfs(sy, sx, steps, q, h, w)
    for i in 0..3
        cy = sy + $dy[i]
        cx = sx + $dx[i]
        if cy.between?(0,h-1) && cx.between?(0,w-1) && steps[cy][cx] ==1000
            if i == 0
                next if sy == h-1 || $hwall[sy][sx] == 1
            elsif i == 1
                next if sx == w-1 || $vwall[sy][sx] == 1
            elsif i == 2
                next if sy == 0 || $hwall[sy-1][sx] == 1
            else
                next if sx == 0 || $vwall[sy][sx-1] == 1
            end
            q.push([cy,cx])
            steps[cy][cx] = steps[sy][sx] + 1
        end
    end
    while q.size > 0
        cy, cx = q.shift
        steps = bfs(cy,cx,steps,q,h,w)
    end
    return steps
end

while line = gets
    w, h = line.split.map(&:to_i)
    break if w == 0 && h == 0
    steps = Array.new(h).map{Array.new(w,1000)}
    steps[0][0] = 1
    h.times do |i|
        $vwall[i] = gets.split.map(&:to_i)
        break if i == h-1
        $hwall[i] = gets.split.map(&:to_i)
    end
    bfs(0, 0, steps, [], h, w)
    puts steps[h-1][w-1] == 1000 ? 0 : steps[h-1][w-1]
end

Measured memory_bytes: 6296
#include <algorithm>
#include <vector>
#include <iostream>
using namespace std;
vector<vector<int> > adj;
vector<int> A, ans, s;

void dfs(int i, int p) {
    int j = lower_bound(s.begin(), s.end(), A[i]) - s.begin();
    int save = s[j];
    s[j] = A[i];
    ans[i] = max(ans[i], j);
    for (int j : adj[i]) {
        if (j != p) { ans[j] = ans[i]; dfs(j, i); }
    }
    s[j] = save;
}

int main() {
    int n; cin >> n;
    adj.resize(n);
    A.resize(n);
    for (int &a : A) cin >> a;
    for (int i = 1; i < n; i++) {
        int u, v; cin >> u >> v;
        u--; v--;
        adj[u].push_back(v);
        adj[v].push_back(u);
    }
    ans.resize(n);
    s.resize(n, 1<<30);
    s[0] = 0;
    dfs(0, -1);
    for (int a : ans) cout << a << endl;
}


Measured memory_bytes: 33656
#include<bits/stdc++.h>
using namespace std;
int main(){
    int a,b,c;
    cin>>a>>b>>c;
    if(a>=b&&a>=c&&b>=c)cout<<a*10+b+c;
    else if(a>=b&&a>=c&&c>=b)cout<<a*10+b+c;
    else if(b>=a&&b>=c&&a>=c)cout<<b*10+a+c;
    else if(b>=a&&b>=c&&c>=a)cout<<b*10+a+c;
    else if(c>=b&&c>=a&&a>=b)cout<<c*10+b+a;
    else if(c>=b&&c>=a&&b>=a)cout<<c*10+b+a;
return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main{
    public static void main(String[] args){
	new Main().run();
    }
    Scanner sc = new Scanner(System.in);

    void run(){
	int n = sc.nextInt();
	while(n>0){
	    solve();
	    n--;
	}
    }

    void solve(){
	double x1 = sc.nextDouble();
	double y1 = sc.nextDouble();
	double x2 = sc.nextDouble();
	double y2 = sc.nextDouble();
	double x3 = sc.nextDouble();
	double y3 = sc.nextDouble();

	/* 
	   中心を(a, b)として
	   a = (A-2b(y1-y2))/2(x1-x2) = (B-2b(y1-y3))/2(x1-x3)
	   b = (B(x1-x2)-A(x1-x3)) / 2C
	*/
	double A = x1*x1 - x2*x2 + y1*y1 - y2*y2;
	double B = x1*x1 - x3*x3 + y1*y1 - y3*y3;
	double C = (y1-y3)*(x1-x2) - (y1-y2)*(x1-x3);

	double b = (B*(x1-x2)-A*(x1-x3)) / (2*C);
	double a = (B*(y1-y2)-A*(y1-y3)) / (2*(-C));
	double r = Math.sqrt((x1-a)*(x1-a)+(y1-b)*(y1-b));

	System.out.printf("%.3f %.3f %.3f\n", a, b, r);
    }
}

Measured memory_bytes: 20688
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<list>
using namespace std;

const int MAX = 100010;

vector<int>G[MAX];
vector<int>RG[MAX];

int findRoot(int now){
  if(RG[now].size() == 0){
    return now;
  }
  return findRoot(RG[now][0]);
}

/*
int max_cost[MAX];
int parent[MAX];
void dfs(int pre, int now, int cost){
  if(cost > max_cost[now]){
    parent[now] = pre + 1;
    max_cost[now] = cost;
  }
  else {
    return;
  }
  for(int i = 0 ; i < G[now].size() ; i++){
    dfs(now, G[now][i], cost+1);
  }
}
*/

vector<int>topo;
bool used[MAX];

void dfs(int u){
  used[u] = true;
  for(int i = 0 ; i < G[u].size() ; i++){
    int v = G[u][i];
    if(!used[v])dfs(v);
  }
  topo.push_back(u);
}

int main(){
  int N,M;
  cin >> N >> M;
  for(int i = 0 ; i < N + M - 1 ; i++){
    int a,b;
    cin >> a >> b;
    a--;
    b--;
    G[a].push_back(b);
    RG[b].push_back(a);
  }
  int root = findRoot(0);

  int dp[N];
  int parent[N];
  for(int i = 0 ; i < N ; i++){
    used[i] = false;
    dp[i] = 0;
    parent[i] = -1;
  }
  parent[root] = 0;

  dfs(root);
  reverse(topo.begin(), topo.end());

  for(int i = 0 ; i < topo.size() ; i++){
    int now = topo[i];
    for(int j = 0 ; j < G[now].size() ; j++){
      if(dp[G[now][j]] < dp[now] + 1){
        dp[G[now][j]] = dp[now] + 1;
        parent[G[now][j]] = now+1;
      }
    }
  }

  for(int i = 0 ; i < N ; i++){
    cout << parent[i] << endl;
  }

  return 0;
}


Measured memory_bytes: 16252
N = int(input())
H = list(map(int, input().split()))
num, max = 0, 0
for i in range(N - 1):
    if H[i] >= H[i + 1]:
        num += 1
    else:
        if num > max:
            max = num
        num = 0
if num > max:
        max = num
print(max)

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

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod= int(1e9)+7;
using P = pair<ll,ll>;
using ld=long double;

vector<string>anslist;
void dfs(string s){
    if(s.size()==3){
        anslist.push_back(s);
        return;
    }
    s+='0';
    for (int i = 0; i < 10;++i) {
        dfs(s);
        s.back()++;
    }
}

int main(){
    dfs("");
//    for(auto p:anslist){
//        cout <<p<<endl;
//    }ok
    ll n;cin >>n;
    string s;cin >>s;
    ll ans=0;
    for(auto p:anslist){
        ll k=0;
        for (int i = 0; i < n; ++i) {
            if(s[i]==p[k]){
                k++;
            }
            if(k==3){
                ans++;
                break;
            }
        }
    }
    cout <<ans <<endl;
    return 0;
}


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

int main(){
  char inp;
  cin >> inp;
  vector<char> alpha(26);
  alpha = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};
  bool komoji = false;
  
  for(int i; i < 26; i++){
    if(inp == alpha.at(i)){
      komoji = true;
      break;
    }
  }
  
  if(komoji)
    cout << "a" << endl;
  else
    cout << "A" << endl;
  
  
}



Measured memory_bytes: 3588
N = int(input())
a = list(map(int, input().split()))

def calc_tmp_ans(tmp_ans, cum_sum):
    for i in range(1, N):
        #print(i, tmp_ans)
        prev_cum_sum = cum_sum
        cum_sum += a[i]
        if cum_sum * prev_cum_sum >= 0:
            tmp_ans += abs(cum_sum) + 1
            if prev_cum_sum > 0:
                cum_sum = -1
            else:
                cum_sum = 1
    return tmp_ans

ans = 1000000000000000
if a[0] == 0:
    ans = min(ans, calc_tmp_ans(1, 1))
    ans = min(ans, calc_tmp_ans(1, -1))
else:
    ans = min(ans, calc_tmp_ans(0, a[0]))
    if a[0] > 0:
        ans = min(ans, calc_tmp_ans(a[0] + 1, -1))
    else:
        ans = min(ans, calc_tmp_ans(abs(a[0]) + 1, 1))
print(ans)

Measured memory_bytes: 14648
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(n); ++i)
using namespace std;
using ll=long long;
int main(){
    int n;
    cin>>n;
    vector<int>a(n+1,1e9+1);
    for(int i=1; i<=n; ++i)cin>>a[i];
    sort(a.rbegin(),a.rend());
    ll ans=0;
    if(n%2==0){
        for(int i=1; i<=n/2; ++i){
            ans+=2*a[i];
        }
        for(int i=n; i>n/2; --i){
            ans-=2*a[i];
        }
        ans-=a[n/2]-a[n/2+1];
    }
    else{
        ll res1=0,res2=0;
        for(int i=1; i<=(n+1)/2; ++i){
            res1+=2*a[i];
            res2+=2*a[i];
        }
        for(int i=n; i>(n+1)/2; --i){
            res1-=2*a[i];
            res2-=2*a[i];
        }
        res1-=a[n/2]+a[n/2+1];
        res2+=(ll)-3*a[n/2+1]+a[n/2+2];
        ans=max(res1,res2);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 640
import java.util.Scanner;


public class Main {

	public static void main(String[] args)  {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		int[] a = new int[n];
		
		for(int i = 0 ; i < n ; i++) {
			a[i] = Integer.parseInt(sc.next());
		}
		
		Long ans = 0l;
		for(int i = 1 ; i < n ; i++) {
			
			if(a[i] < a[i-1]) {
				ans += a[i-1] - a[i];
				a[i] = a[i-1];
			}
		}
		
		System.out.println(ans);
	}

}




Measured memory_bytes: 49956
# -*- coding: utf-8 -*-
"""
Contents   : AtCoder Regular Contest 095 d問題
Author     : Kitaura Hiromi
LastUpdate : 20180414
Since      : 20180414
"""

# c(m, n) = (m+n)!/m!n!
# mが同じな場合、nはmの半分なら最大
# mが大きいほどc(m, n)は大きい

n = int(input())
a = list(map(int, input().split(" ")))

max_a = max(a)
tmp = 0
for i in range(n):
    if abs(max_a / 2 - tmp) > abs(max_a / 2 - a[i]):
        tmp = a[i]
print(max_a, tmp)

Measured memory_bytes: 14052
#include<iostream>
#include<vector>
#include<string>
#include<map>
#include<set>
#include<queue>
#include<algorithm>
#include<cstdio>
#include<cmath>
using namespace std;

struct element{
  pair<int, int> zahyo;
  int count;
  int pattern;
};

int main(){
  int H, W, scount = 0;
  char input;
  const int dW[] = {-1, 0, 1, 0};
  const int dH[] = {0, 1, 0, -1};
  cin >> H >> W;
  char S[50][50];
  bool C[50][50];
  for(int i = 0; i < H; i++){
    for(int j = 0; j < W; j++)C[i][j] = false;
  }
  for(int i = 0; i < H; i++){
    for(int j = 0; j < W; j++){
      cin >> input;
      S[i][j] = input;
      if(input == '#') scount++;
    }
  }
  pair<int, int> pl(0, 0);
  element p;
  p.zahyo = pl;
  p.count = 1;
  p.pattern = 1;
  queue<element> q;
  q.push(p);
  bool flag = false;
  while(q.size() > 0 && flag == false){
    element p = q.front();
    q.pop();
    for(int i = 0; i < 4; i++){
      element add;
      if(p.pattern == (i + 2) % 4) continue;
      else{
        int zahyoy, zahyox;
        zahyoy = p.zahyo.first + dH[i];
        zahyox = p.zahyo.second + dW[i];
        add.zahyo.first = zahyoy;
        add.zahyo.second = zahyox;
        if(zahyoy < 0 || zahyoy >= H || zahyox < 0 || zahyox >= W || S[zahyoy][zahyox] == '#' || C[zahyoy][zahyox] == true) continue;
        C[zahyoy][zahyox] = true;
        add.count = p.count + 1;
        add.pattern = i;
        if(add.zahyo.first == H-1 && add.zahyo.second == W-1){
          cout << (W*H)-add.count-scount << endl;
          flag = true;
        }else{
          q.push(add);
        }
      }
    }
  }
  if(flag == false) cout << -1 << endl;
  
  return 0;
}

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

// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

// forループ
#define REP(i,n) for(ll i=0; i<(ll)(n); ++i)

// 定数宣言
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

// グラフ表現
using Graph = vector<vector<int>>;

// グラフの辺表現
using Edge = map<pair<int,int>,int>;

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

// 最大公約数
ll gcd(ll a,ll b){
   if (a%b == 0) return(b);
   else return(gcd(b, a%b));
}

// 最小公倍数
ll lcm(ll a, ll b){
    return a*b/gcd(a, b);
}

int main()
{
    cout << fixed << setprecision(15);
    ll N;
    cin >> N;

    ll ans = 0;
    for(ll i=1; i<=N; i++){
        if((i%3 != 0) && (i%5 != 0)) ans+= i;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
        using namespace std;
   #define int long long
   #define PP pair<int,pair<int,int>>
const int MAX = 510000;
const int MOD =  998244353;
const int INV2 = (MOD+1)/2;

     signed main(){
    int n;
    cin>>n; 
    map<int,int>mp;
    int a[n+1]={},b[n+1]={},p[n+1];
    for(int i=0;i<n;i++){
      cin>>a[i];
      a[n]^=a[i];
    }
for(int i=0;i<n;i++){
      cin>>b[i];
      b[n]^=b[i];
    }
    for(int i=0;i<=n;i++)p[i]=a[i];
    sort(p,p+n+1);
    for(int i=0;i<=n;i++)mp[p[i]]=i;
    vector<int> hen[n+1];
    for(int i=0;i<n;i++){
      if(b[i]!=a[i]){
        if(mp.find(b[i])==mp.end()){
          cout<<-1;
          return 0;
        }
        hen[mp[b[i]]].push_back(mp[a[i]]);
        hen[mp[a[i]]].push_back(mp[b[i]]);
      }

    }
    sort(b,b+n+1);
    for(int i=0;i<=n;i++){
      if(b[i]!=p[i]){
        cout<<-1;
        return 0;
      }
    }
    int ans=0;
    
    
    for(int i=0;i<=n;i++)ans+=hen[i].size();
    //cerr<<ans<<endl;
    ans/=2;
    bool used[n+1]={};
    if(hen[mp[a[n]]].size()!=0)ans-=1;

    for(int i=0;i<=n;i++){
      if(used[i]==true||hen[i].size()==0)continue;
      ans++;
      queue<int> que;
      que.push(i);
      while(!que.empty()){
        for(auto&& itr :hen[que.front()])if(!used[itr]){
          used[itr]=true;
          que.push(itr);
        }
        que.pop();
      }
    }
    cout<<ans<<endl;

   

    


}


        


Measured memory_bytes: 14464
n,K=map(int,input().split())
a=list(map(int,input().split()))
c=[0]*40
ans=0

for aa in a:
  for k in range(40):
    if aa&(1<<k):c[k]+=1
x=0
for k in range(39,-1,-1):
  if x+(1<<k)>K:continue
  if c[k]<=n-c[k]:x+=(1<<k)

for aa in a:
  ans+=x^aa

print(ans)


Measured memory_bytes: 14620
import java.util.*;

public class Main{

	public static void main(String[] args){

		Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] time = new int[n];
        for(int i = 0; i < n ; i++){
          time[i] = sc.nextInt();
        }
      
        int m = sc.nextInt();
        int ans = 0;
        for(int i = 0; i < m ; i++){
          ans = 0;
          int tmp = sc.nextInt();
          int drink = sc.nextInt();
          ans += drink;
          for(int j = 0; j < n; j++){
            ans += time[j];
          }
          System.out.println(ans - time[tmp-1]);
        }
      
	}
}


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

using namespace std;
typedef long long ll;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n,m;
    cin>>n>>m;
    vector<vector<int> > g(n+1);
    int u,v;
    vector<pair<int,int> > edges(m);
    for(int i=0;i<m;i++)
    {
        cin>>u>>v;
        edges[i]={u,v};
        g[u].push_back(v);
        g[v].push_back(u);
    }
    int count=0;
    for(int i=0;i<edges.size();i++)
    {
        u=edges[i].first;v=edges[i].second;
        queue<int> q;
        vector<bool> vi(n+1);
        fill(vi.begin(),vi.end(),false);
        vi[u]=true;
        q.push(u);
        //cout<<u<<"->";
        while(!q.empty())
        {
            int tp=q.front();
           // cout<<tp<<"->";
            q.pop();
            for(int i=0;i<g[tp].size();i++)
            {
                if(tp==u&&g[tp][i]==v)continue;
                if(vi[g[tp][i]])continue;
                vi[g[tp][i]]=true;
                q.push(g[tp][i]);
            }
        }
        int temp=0;
        for(int i=1;i<vi.size();i++)
        {
            if(!vi[i])
            {
                temp=1;
                break;
            }
        }
        //cout<<'\n';
        if(temp)count++;
    }
    cout<<count<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define CINA(a,n); REP(i,(n)){ cin >> (a)[i]; }
#define CINA2(a,n,m); REP(i,(n)){ REP(j,(m)){cin >> (a)[i][j];} }
int ctoi(char c){ return ( (c>='0' && c<='9')? c - '0': 0 );}

int func(string x){
  int ans = 0;
  int N = x.size();
  for(int i=0;i<N;++i){
    ans += ctoi(x[i]);
  }
  return ans;
}

int main(){
  string N;
  while(cin>>N){
    if(N=="0"){break;}
    else{ cout << func(N) <<"\n";}
  }
}


Measured memory_bytes: 3076
#include <stdio.h>
#include <stdbool.h>

int n, m, t1, t2, t3, t4, a[5][4][11];;

int main() {
    scanf("%d ", &n);
    for (int i = 0; i < n; i++) {
        scanf("%d %d %d %d", &t1, &t2, &t3, &t4);
        a[t1][t2][t3] += t4;
    }
    for (int i = 1; i <= 4; i++) {
        for (int j = 1; j <= 3; j++) {
            for (int k = 1; k <= 10; k++) {
                printf(" %d", a[i][j][k]);
            }
            printf("\n");
        }
        if (i <= 3) {
            for (int j = 0; j < 20; j++) printf("#");
            printf("\n");
        }
    }
}


Measured memory_bytes: 2052
#include <bits/stdc++.h>
#include <regex>
#ifdef _DEBUG
#include "debug.h"
#endif
#define int ll
#define FOR(i, s, e) for (int i = int(s); i < int(e); ++i)
#define REP(i, e) FOR(i, 0, e)
#define mkpr make_pair
#define mktp make_tuple
#define tv(tp, i) get<(i)>(tp)
#define CLEAR(obj) obj = decltype(obj)()
#define var auto
#define OUT(type) type &
#define IN(type) const type &
#define self (*this)
#define in :
#define True true
#define False false
using namespace std; using str = string; using cstr = const str;
using ll = long long; using ull = unsigned long long; using cint = const int; using cll = const ll;
using vi = vector<int>; using vvi = vector<vi>; using vl = vector<ll>; using vvl = vector<vl>;
using vb = vector<bool>; using vvb = vector<vb>; using vd = vector<double>; using vvd = vector<vd>;
using vc = vector<char>; using vvc = vector<vc>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>; using pdd = pair<double, double>; using psl = pair<string, ll>;
using tiii = tuple<int, int, int>; using tlll = tuple<ll, ll, ll>;
static const int MGN = 10; static const int ARYSZ_MAX = (int)1e7;
static const ll LINF = LLONG_MAX/2;
#ifdef int
static const int INF = LINF;
#else
static const int INF = INT_MAX/2;
#endif
static double EPS = 1e-9;
static inline bool DBLEQ(double a, double b) {return abs(a - b) < EPS;}
static inline void EPR(str msg) {cerr << msg << endl;}
static inline void AST(bool exp, str msg) {if(!exp){EPR(msg);} assert(exp);}
static inline void TAST(bool exp, str msg) {if(!exp){EPR(msg);} while(!exp){}}


struct DFSVisitor {
    int N;
    int M;
    vvi ex;
    vb vis;
    DFSVisitor(IN(vvi) ex) {
        self.ex = ex;
        self.N = ex.size();
        self.M = 0;
        REP(i,N)
            FOR(j,i+1,N)
                if (self.ex[i][j]>0) self.M += 1;
        self.vis = vb(self.N, False);
    }
    int cnt;
    int res;
    int one_stroke_path(int s) {
        self.cnt = 0;
        self.res = 0;
        self.dfs(s);
        return self.res;
    }
    void dfs(int x, int px = - 1) {
        if (self.vis[x])
            return;
        self.vis[x] = True;
        self.cnt += 1;
        if (self.cnt == self.N)
            self.res += 1;
        REP(nx, self.N) {
            if (self.ex[x][nx] <= 0)
                continue;
            if (nx == px)
                continue;
            self.dfs(nx, x);
        }
        self.vis[x] = False;
        self.cnt -= 1;
    }
};


int32_t main(int32_t argc, char* argv[]) {
    cin.tie(0);
    ios::sync_with_stdio(false);
#ifdef IMPORT_SAMPLE
    vs args(argv, argv+argc);
    string sample = make_sample(args, "sample-1");
    ifstream ifs(sample); cin.rdbuf(ifs.rdbuf());
#endif


    int N,M; cin >> N>>M;
    vi A(M), B(M);
    REP(i,M) {
        cin >> A[i] >> B[i];
        A[i] -= 1; B[i] -= 1;
    }

    var ex = vvi(N, vi(N, 0));
    REP(i,M) {
        ex[A[i]][B[i]] = 1;
        ex[B[i]][A[i]] = 1;
    }

    var visitor = DFSVisitor(ex);

    int ans = visitor.one_stroke_path(0);

    cout << ans << endl;


    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <functional>
#include <cstdint>

int main() {
	int n;
	std::cin >> n;

	std::vector<int64_t> a(n), b(n), c(n);
	for (auto&& e : a)
		std::cin >> e;
	for (auto&& e : b)
		std::cin >> e;
	for (auto&& e : c)
		std::cin >> e;

	std::sort(a.begin(), a.end());
	std::sort(b.begin(), b.end());
	std::sort(c.begin(), c.end());

	int64_t ans = 0;
	for (auto&& e : b) {
		auto it1 = std::upper_bound(a.rbegin(), a.rend(), e, std::greater<>{});
		auto it2 = std::upper_bound(c.begin(), c.end(), e);
		
		if (it1 == a.rend() || it2 == c.end())
			continue;

		ans += (a.rend() - it1) * (c.end() - it2);
	}

	std::cout << ans << std::endl;
}

Measured memory_bytes: 2560
/* BISMILLAHIR RAHMANIR RAHIM */
#include<bits/stdc++.h>
using namespace std;
#define ll        long long
#define ull       unsigned long long
#define si(x)     scanf("%d", &x)
#define sll(x)    scanf("%lld", &x)
#define ssll(x,y)    scanf("%lld %lld", &x ,&y)
#define sd(x)     scanf("%lf", &x)
#define l0(i,n)   for(ll i=0; i<n; i++)
#define MAX       100005
#define maxn 	  200002
#define pb 		  push_back
#define mk 		  make_pair
#define endl	  "\n"
#define INF 	  1000000000
#define MOD		  1000000007
#define imie(...) "[" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "



int main ()
{
		ios::sync_with_stdio(0);
		cin.tie(0);
		//CODE TONOY
		int x;
		cin >> x;
		if(x>=400 && x<600) cout << 8 << endl;
		if(x>=600 && x<800) cout << 7 << endl;
		if(x>=800 && x<1000) cout << 6 << endl;
		if(x>=1000 && x<1200) cout << 5 << endl;
		if(x>=1200 && x<1400) cout << 4 << endl;
		if(x>=1400 && x<1600) cout << 3 << endl;
		if(x>=1600 && x<1800) cout << 2 << endl;
		if(x>=1800 && x<2000) cout << 1 << endl;
		return 0;  
}  


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

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

  int ans = 0;
  rep(b, 1<<n) {
    int s = 0;
    rep(i,n)  if(b&1<<i) {
      s += v[i] - c[i];
    }
    ans = max(ans, s);
  }
  cout << ans << endl;
}


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

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

ll fraction (ll n) {
    ll res = 1;
    for (ll i = n; i >= 1; i--) {
        res *= i;
    }
    return res;
}

const int MOD = 1000000007;

int main() {
    string w; cin >> w;
    bool can = true;
    for (char c = 'a'; c <= 'z'; c++) {
        ll cnt = 0;
        rep (i, w.size()) {
            if (c == w[i]) cnt++; 
        }
        if (cnt % 2 != 0) can = false;
    }
    if (can) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 256
#include<cstdio>

void swap(int *num1, int *num2) {
  int tmp = *num1;
  *num1 = *num2;
  *num2 = tmp;
}

int main() {
  int first, second, third;

  scanf("%d %d %d", &first, &second, &third);

  if (second < first) {
    swap(&first, &second);
  }
  if (third < second) {
    swap(&second, &third);
  }
  if (second < first) {
    swap(&first, &second);
  }

  printf("%d %d %d\n", first, second, third);
}



Measured memory_bytes: 2732
#include <iostream>
#include <map>
#include <vector>
#include <cassert>
#include <unordered_set>
#include <set>
#include <bitset>
#include <memory.h>
#include <algorithm>
#include <cmath>

using namespace std;

#define sqr(a) ((a)*(a))
#define all(a) (a).begin(), (a).end()

int main() {
    // freopen("input.txt", "r", stdin);
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    long long n;
    cin >> n;

    cout << n * n << "\n";
}

Measured memory_bytes: 256
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx,avx2,fma")
//#pragma GCC optimization ("unroll-loops")
#include <bits/stdc++.h>
#define pb push_back
#define all(a) a.begin(),a.end()
#define forn(i,n) for(int i=0;i<int(n);i++)
#define forr(i,n) for(int i=int(n-1);i>=0;i--)
#define fora(i,a,b) for(int i=int(a);i<=int(b);i++)
#define forb(i,a,b) for(int i=int(a);i>=int(b);i--)
#define mod 998244353 
using namespace std;
using ll=long long int;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<ll> vii;
typedef pair<ll ,ll> pii;

void solve()
{
	int n;
	cin>>n;
	int a[n],b[n];
	int cnt=0;
	int mx=0;
	forn(i,n)
	{
		cin>>a[i]>>b[i];
		if(a[i]==b[i])cnt++;
		else cnt=0;
		mx=max(cnt,mx);
	}
	if(mx>=3)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}

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


Measured memory_bytes: 3648
module Main where

import Control.Monad
ok :: (Int,Int) -> (Int,Int) -> [[Char]] -> Bool
ok (x,y) (h,w) s =
    (s !! y !! x == '.') || or [s !!(y+j)!!(x+i) == '#'|j <-[-1,0,1],i <- [-1,0,1] , abs(i-j) == 1,y+j < h,0<=y+j , x+i < w ,0<=x+i]

main :: IO ()
main = do
    [h,w] <- (map read . words) <$> getLine
    s <- replicateM h getLine
    if and [ok (i,j) (h,w) s | i <- [0..w-1],j <- [0..h-1]]
        then putStrLn "Yes"
        else putStrLn "No"
    return()

Measured memory_bytes: 1020
# coding: utf-8
N = int(input())
s = []
for i in range(N):
    s.append(input().strip())


def n_ab(s):
    n = len(s)
    output = 0
    for i in range(n - 1):
        if s[i] + s[i+1] == "AB":
            output += 1

    return output


output = 0
for i in range(N):
    output += n_ab(s[i])

n_b = 0
n_a = 0
n_b_a = 0
for i in range(N):
    if s[i][0] == "B":
        if s[i][-1] == "A":
            n_b_a += 1
        else:
            n_b += 1
    elif s[i][-1] == "A":
        n_a += 1

if n_b_a == 0:
    print(output + min([n_b, n_a]))
else:
    output += n_b_a - 1

    if n_a == 0:
        if n_b == 0:
            print(output)
        else:
            print(output+1)
    else:
        if n_b == 0:
            print(output+1)
        else:
            print(output + 2 + min([n_b - 1, n_a - 1]))


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

int main(){
  int m,nmin,nmax,p[200],gmax,n;
  while (1){
    cin >> m >> nmin >> nmax;
    if (m==0&&nmin==0&&nmax==0)return 0;
    for (int i=0;i<m;i++)cin >> p[i];
    gmax=-1;
    n=0;
    for (int i=nmax;i>=nmin;i--)
      if (p[i-1]-p[i]>gmax){
	n=i;
	gmax=p[i-1]-p[i];
      }
    cout << n << endl;
  }
  return 0;
}

Measured memory_bytes: 3052
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
template <class T> inline bool chmin(T &a, T b) {if (a > b){a = b;return true;}return false;}
template <class T> inline bool chmax(T &a, T b) {if (a < b){a = b;return true;}return false;}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    // int a,b,c; cin>>a>>b>>c;
    vector<int> a;
    rep(i, 3){
        int t; cin>>t;
        a.push_back(t);
    }
    int ans = 0;
    rep(i,3){
        rep(j,3){
            if(i==j) continue;
            int k = 3-i-j;
            ans = max(a[i]*10+a[j]+a[k], ans);
        }
    }
    cout << ans<< endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <string>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define REP(i, b, n) for (int i = (b); i < (n); i++)
using namespace std;
using ll = long long;
const ll M = 1000000007;

int main() {
	string s;
	cin >> s;
	if (s[s.size() - 1] == 's') cout << s + "es" << endl;
	else cout << s + "s" << endl;
}

Measured memory_bytes: 3632
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <iomanip> // setprecision
#include <complex> // complex
#include <functional>
#include <math.h> 
#define enld '\n'
using namespace std;
using ll = long long;
using P = pair<int,int>;
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
constexpr ll mod = 1000000007;
constexpr ll mod2 = 998244353;
const int dx[8] = {1, 0, -1, 0,1,1,-1,-1};
const int dy[8] = {0, 1, 0, -1,1,-1,1,-1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
// ---------------------------------------------------------------------------

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int N,M;
  cin >> N >> M;
  vector<int> A(N);
  for(int i=0; i<N; i++) cin >> A[i];
  vector<int> B(M);
  for(int i=0; i<M; i++) cin >> B[i];
  int ans = 0;
  for(int l=0; l<M; l++){
    int r = l;
    for(int i=0; i<N; i++){
      if(A[i] == B[r]){
        r++;
      }
    }
    chmax(ans,r-l);
  }
  cout << ans << "\n";
  return 0;
}


Measured memory_bytes: 3256
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner stdIn = new Scanner(System.in);

        double r = stdIn.nextDouble();

        System.out.printf("%.6f",r*r*Math.PI);
        System.out.print(" ");
        System.out.printf("%.6f",2*r*Math.PI);
        System.out.println();

        stdIn.close();
    }
}



Measured memory_bytes: 28148
from sys import stdout
printn = lambda x: stdout.write(str(x))
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True # and False
BIG = 999999999
R = 10**9 + 7

def ddprint(x):
  if DBG:
    print(x)

n = inn()
dst = [ [] for i in range(n) ]
for i in range(n-1):
    a,b = inm()
    dst[a-1].append(b-1)
    dst[b-1].append(a-1)
b = [0]
w = [n-1]
c = [0]*n
c[0] = 1
c[n-1] = -1
while len(b)>0 or len(w)>0:
    nxtb = []
    while len(b)>0:
        x = b.pop()
        for y in dst[x]:
            if c[y]==0:
                c[y] = 1
                nxtb.append(y)
    b = nxtb
    nxtw = []
    while len(w)>0:
        x = w.pop()
        for y in dst[x]:
            if c[y]==0:
                c[y] = -1
                nxtw.append(y)
    w = nxtw
print('Snuke' if sum(c)<=0 else 'Fennec')


Measured memory_bytes: 60652
#include<stdio.h>
int main()
{
	int a, b, d, r;
	double f;
	scanf("%d%d", &a, &b);
	d = a / b;
	r = a % b;
	f = 1.00000*a / b;
	printf("%d %d %lf\n", d, r, f);
	return 0;
}



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

using namespace std ; 

typedef long long LL ; 

int n ; 

const int MAXN = 1000010 ; 


struct Edge {
		
		int l, r, c, nxt ; 
} e[MAXN << 1] ; 

int ecnt = 0, hed[MAXN] ;

void addedge(int l, int r, int c) { 
		++ ecnt, e[ecnt].l = l, e[ecnt].r = r, e[ecnt].c = c, e[ecnt].nxt = hed[l], hed[l] = ecnt; 
}

LL dep[MAXN] ; 

int maxs[MAXN], siz[MAXN], maxw[MAXN], faw[MAXN] ; 

void DfsSiz(int x, int fr) { 

		siz[x] = 1 ; 

		for (int i = hed[x]; i; i = e[i].nxt) {  
				int to = e[i].r ;

				if (to ^ fr) {
						faw[to] = e[i].c ; 
						DfsSiz(to, x), siz[x] += siz[to], maxs[x] = max(maxs[x], siz[to]) ; 
						if (maxs[x] == siz[to]) maxw[x] = e[i].c; 
				}
		}
}

void DfsDep(int x, int fr) { 

		for (int i = hed[x]; i; i = e[i].nxt) {
				int to = e[i].r ; 
				if (to ^ fr) dep[to] = dep[x] + e[i].c, DfsDep(to, x) ; 
		}
}

int main() { 

		scanf("%d", &n) ; 

		for (int i = 1; i < n; i ++) { 

				int l, r, c ; 

				scanf("%d%d%d", &l, &r, &c) ;
				
				addedge(l, r, c), addedge(r, l, c) ; 
		}

		DfsSiz(1, 0) ; 

		int root = 0 ; 
		for (int i = 1; i <= n; i ++) { 
				if (maxs[i] <= n / 2  && n - siz[i] <= n / 2) root = i ;
		}

		DfsDep(root, 0) ;

		int t = max(maxs[root], n - siz[root]);  
			
		LL ans = 0 ;

		sort(dep + 1, dep + n + 1) ; 
		for (int i = 1; i <= n; i ++) ans += dep[i] << 1 ; 

		if (t == n / 2 && n % 2 == 0) {
			    if (maxs[root] == n / 2) ans -= maxw[root] ; 
				else ans -= faw[root] ; 	
		}
		else ans -= dep[2] ; 

		cout << ans << endl ; 
}





Measured memory_bytes: 25088