akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cctype>
#include <cstring>

namespace quick {
#define tp template<typename Type>
	namespace in {
		inline char getc() {
			static char buf[1<<21],*p1=buf,*p2=buf;
			return p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++;
		}
		inline int read(char *s) {
			*s=getc();
			while(isspace(*s)) {*s=getc();if(*s==EOF) return 0;}
			while(!isspace(*s)&&*s!=EOF) {s++;*s=getc();}
			*s='\0'; return 1;
		}
		tp inline int read(Type &x) {
			x=0;bool k=false;char c=getc();
			while(!isdigit(c)) {k|=(c=='-');c=getc();if(c==EOF) return 0;}
			while(isdigit(c)) {x=(x<<1)+(x<<3)+(c^48);c=getc();}
			x*=(k?-1:1); return 1;
		}
		template <typename Type,typename... Args>
		inline int read(Type &t,Args &...args) {
			int res=0;
			res+=read(t);res+=read(args...);
			return res;
		}
	}
	using in::read;
	namespace out {
		char buf[1<<21];int p1=-1;const int p2=(1<<21)-1;
		inline void flush() {
			fwrite(buf,1,p1+1,stdout);
			p1=-1;
		}
		inline void putc(const char &c) {
			if(p1==p2) flush();
			buf[++p1]=c;
		}
		inline void write(char *s) {
			while(*s!='\0') putc(*s),s++;
		}
		inline void write(const char *s) {
			while(*s!='\0') putc(*s),s++;
		}
		tp inline void write(Type x) {
			static char buf[30];int p=-1;
			if(x<0) {putc('-');x=-x;}
			if(x==0) putc('0');
			else for(;x;x/=10) buf[++p]=x%10+48;
			for(;p!=-1;p--) putc(buf[p]);
		}
		inline void write(const char &c) {putc(c);}
		template <typename Type,typename... Args>
		inline void write(Type t,Args ...args) {
			write(t);write(args...);
		}
	}
	using out::write;
	using out::flush;
	tp inline Type max(const Type &a,const Type &b) {
		if(a<b) return b;
		return a;
	}
	tp inline Type min(const Type &a,const Type &b) {
		if(a<b) return a;
		return b;
	}
	tp inline void swap(Type &a,Type &b) {
		a^=b^=a^=b;
	}
	tp inline Type abs(const Type &a) {
		return a>=0?a:-a;
	}
#undef tp
}
using namespace quick;

typedef long long ll;
const ll Inf=0x3f3f3f3f3f3f3f3f;
const int maxn=2000+10,inf=0x3f3f3f3f;
int n;
char s[maxn];

struct Edge {
	int v,next;
	Edge(const int &v,const int &next) :v(v),next(next) {}
	Edge() {}
}e[maxn<<1];
int head[maxn],k;
inline void AddEdge(const int &u,const int &v) {
	e[++k]=Edge(v,head[u]);
	head[u]=k;
}

ll f[maxn];//表示以i为根的子树所消除的个数
ll sum[maxn];//表示以i为根的子树中dist(i,v)之和,其中v为子树中有棋子的点
int cnt[maxn];
void dfs(const int &u,const int &fa) {
	int maxp=0;cnt[u]=s[u]-'0';
	for(int i(head[u]);i;i=e[i].next) {
		const int &v=e[i].v;
		if(v==fa) continue;
		dfs(v,u);
		cnt[u]+=cnt[v];
		sum[u]+=(sum[v]+=cnt[v]);
		if(sum[v]>sum[maxp]) maxp=v;
	}
	if(!maxp) return;
	if(sum[u]>=2*sum[maxp]) f[u]=sum[u]/2;
	else f[u]=sum[u]-sum[maxp]+min(f[maxp],(2*sum[maxp]-sum[u])/2);
}

int main(void) {
#ifndef ONLINE_JUDGE
	freopen("cc.in","r",stdin);
#endif
	read(n);read(s+1);
	for(int i(1);i<n;i++) {
		int u,v;
		read(u,v);
		AddEdge(u,v);
		AddEdge(v,u);
	}
	ll ans=Inf;
	for(int i(1);i<=n;i++) {
		memset(f,0,sizeof f);
		memset(sum,0,sizeof sum);
		dfs(i,0);
		if(!(sum[i]&1)&&f[i]*2==sum[i]) ans=min(ans,f[i]);
	}
	if(ans==Inf) ans=-1;
	write(ans,'\n');
	flush();
	return 0;
}


Measured memory_bytes: 1808
C = 1000000007

def permutarion(n)
  (1..n).inject(1) {|acc, i| (acc * i) % C}
end

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

result = if n == m
           permutarion(n) ** 2 * 2 % C
         elsif n == m + 1 || m == n + 1
           permutarion(m) * permutarion(n) % C
         else
           0
         end
         
puts result

Measured memory_bytes: 1788
S = list(input())
L = S[2:len(S)-1]
a = 0
for i in range(len(S)):
    if 65 < (ord(S[i])) <= 90:
        a = a+1

if L.count("C") == 1 and S[0] == "A" and a == 1:
    print("AC")
else:
    print("WA")

Measured memory_bytes: 3060
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>
#include<map>
#include<stack>
#include<queue>

using namespace std;
#define MAX 100005
static const int INF=1<<19;

int main(){
	int N,W;
	int dp[MAX];
	int ans=0;
	
	fill(dp,dp+MAX,-INF);
	dp[0]=0;
	
	scanf("%d %d",&N,&W);
	for(int i=0;i<N;i++){
		int v,w,m;
		scanf("%d %d %d",&v,&w,&m);
		for(int k=0;m>0;k++){
			int key=min(m,(1<<k));
			m-=key;
			for(int j=W;j>=key*w;j--){
				dp[j]=max(dp[j],dp[j-key*w]+key*v);
			}
		}
	}
	for(int i=0;i<=W;i++) ans=max(ans,dp[i]);
	printf("%d\n",ans);
}


Measured memory_bytes: 3624
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <limits.h>
#include <math.h>

int check(int n, int m, int k[], int s[10][10], int p[], int pattern)
{
    int i, j;
    int count;

    for (i = 0; i < m; i++) {
        count = 0;
        for (j = 0; j < k[i]; j++) {
            if (pattern & 1<<(s[i][j] - 1)) {
                count++;
            }
        }
        if ((count % 2) != p[i]) {return 0;}
    }

    return 1;
}

int main(int argc, char *argv[])
{
    int n, m;
    int k[10];
    int s[10][10];
    int p[10];
    int i, j;
    int ret;
    int ans;

    scanf("%d %d", &n, &m);

    for (i = 0; i < m; i++) {
        scanf("%d", &k[i]);
        for (j = 0; j < k[i]; j++) {
            scanf("%d", &s[i][j]);
        }
    }

    for (i = 0; i < m; i++) {
        scanf("%d", &p[i]);
    }

    ans = 0;

    for (i = 0; i < 1<<n; i++) {
        ret = check(n, m, k, s, p, i);
        if (ret) {ans++;}
    }

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

    return 0;
}


Measured memory_bytes: 128
n = int(input())
a = [0]+list(map(int, input().split()))+[0]
r = [0]
for i in range(n + 1):
    r.append(r[i] + abs(a[i + 1] - a[i]))
for i in range(1,n+1):
    print(r[i - 1]
          + abs(a[i + 1] - a[i - 1])
          + r[-1] - r[i+1])


Measured memory_bytes: 14040
#include<bits/stdc++.h>
using namespace std;
int f[100005];
int find(int x){
	if(f[x]==x)return x;
	return f[x]=find(f[x]);
}
int main(){
	int n,m,s=0;
	cin>>n>>m;
	int a,b;
	for(int i=1;i<=n;i++)f[i]=i;
	for(int i=1;i<=m;i++){
		cin>>a>>b;
		f[find(b)]=find(a);
	}
	for(int i=1;i<=n;i++){
		if(f[i]==i)s++;
	}
	s--;
	cout<<s;
}

Measured memory_bytes: 3984
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <climits>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define ALL(A)		(A).begin(),(A).end()
#define DUMP(A)    cout<<#A<<"="<<(A)<< endl
#define SIZE(A)    (int)((A).size())
using namespace std;
typedef long long ll;

int main(){
    int dp[100][100];
    int n;
    scanf("%d",&n);
    if(n==1){
        printf("0\n");
        return 0;
    }
    int ue[100],sita[100];
    for(int i=0;i<n;i++){
        scanf("%d%d",&ue[i],&sita[i]);
        dp[i][i]=0;
    }
    for(int kan=1;kan<=n-1;kan++){
        for(int i=0;i<n-kan;i++){
            int mi=INT_MAX;
            for(int j=i;j+1<=i+kan;j++){
                mi=min(mi,dp[i][j]+dp[j+1][i+kan]+ue[i]*sita[j]*ue[j+1]*sita[i+kan]);
            }
            dp[i][i+kan]=mi;
        }
    }
    printf("%d\n",dp[0][n-1]);
}

Measured memory_bytes: 0
import sys
import math
def input(): return sys.stdin.readline().rstrip()


def solve(x, y):
    if x == y:
        return 2*x-2
    else:
        k = x*y
        sqr = math.ceil(math.sqrt(k))-1
        return 2*sqr-2+(sqr*(sqr+1) < k)


def main():
    q=int(input())
    for _ in range(q):
        a,b=map(int, input().split())
        print(solve(a,b))



if __name__ == '__main__':
    main()

Measured memory_bytes: 9112
n,a = map(int,input().split())
x = list(map(int,input().split()))

dp = [[[0]*(n*a+1) for _ in range(n+1)] for _ in range(n+1)]
dp[0][0][0] = 1
for i in range(n):
    for j in range(i+1):
        for s in range(n*a + 1):
            dp[i+1][j][s] += dp[i][j][s]
            if s + x[i] <= n*a:
                dp[i+1][j+1][s+x[i]] += dp[i][j][s]
ans = 0
for j in range(1,n+1):
    ans += dp[n][j][j*a]
print(ans)


Measured memory_bytes: 92380
#include <stdio.h>

int main(void)
{
    char w[101];
    char c[26] = { 0 };

    scanf("%s", w);
    for (char *p = w; *p != '\0'; ++p) {
        ++c[*p - 'a'];
    }
    for (size_t i = 0; i < 26; ++i) {
        if (c[i] % 2 == 1) {
            puts("No");
            return 0;
        }
    }
    puts("Yes");

    return 0;
}


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

class Solve{
private:
    int n_     = 0;
    int s_     = 0;
    int result = 0;
    void dfs(int num, int sum, int cnt);
public:
    Solve(int num, int sum);
    int getSolve();
};

Solve::Solve(int num, int sum){
    n_ = num;
    s_ = sum;
    
    Solve::dfs(0,0,0);
}

void Solve::dfs(int num, int sum, int cnt){
    if(sum == s_ && cnt == n_){
        result++;
        return;
    }
    if(num == 10 || cnt == n_){
        return;
    }
    
    Solve::dfs(num+1, sum+num, cnt+1);
    Solve::dfs(num+1, sum, cnt);
}

int Solve::getSolve(){
    return result;
}


int main(){
    int n, s = 0;
    while(cin >> n >> s){
        if(n == 0 && s == 0){
            break;
        }else{
            Solve solve(n, s);
            cout << solve.getSolve() << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 3012
x, y = map(int,input().split())
a = [4,6,9,11]
b = [1,3,5,7,8,10,12]
if x == 2 or y == 2:
    print('No')
elif x in a and y in a:
    print('Yes')
elif x in b and y in b:
    print('Yes')
else:
    print('No')

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

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

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

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

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

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

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (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(unused_imports)]
use std::cmp::{min, max};

fn main() {
    input!{
        n: usize,
        mut v: [usize; n]
    }
    v.sort();
    let mut ans: usize = 0;
    for i in 0..n - 1 {
        let mut r = i;
        for j in i + 1..n {
            while r < n - 1 && v[i] + v[j] > v[r + 1] {
                r += 1;
            }
            ans += r - j;
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
fn main() {
    let n: usize = read();
    let mut v: Vec<(i32, i32)> = Vec::new();
    for _ in 0..n {
        v.push(read_tuple());
    }

    let mut cnt = 0.0;
    let mut ret = 0.0;
    for i in 0..n {
        for j in 0..n {
            if i == j { continue; }
            let (x1, y1) = v[i];
            let (x2, y2) = v[j];
            ret += d(x1, y1, x2, y2);
            cnt += 1.0;
        }
    }

    println!("{}", ret * (n as f64 - 1.0) / cnt);
}

fn d(x1: i32, y1: i32, x2: i32, y2: i32) -> f64 {
    let tmp = (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1);
    (tmp as f64).sqrt()
}

fn read_tuple() -> (i32, i32) {
    let v: Vec<i32> = read_vec();
    (v[0], v[1])
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().split_whitespace().map(|e| e.parse().ok().unwrap()).collect()
}

Measured memory_bytes: 4352
/*****/

#include <iostream>
#include <array>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <iomanip>	//cout << fixed << setprecision(桁数);
#include <stdexcept>

using namespace std;
using ll = long long;

#define nextline() (std::cerr << "\n")
#define debug(x) (#x " : " + (x))
#define debug_cout(x) (std::cerr << #x << " : " <<  (x) << "\n")
#define debug_tabCout(n, x) (std::cerr << strMulti("\t",n) << #x << " : " <<  (x) << "\n")
#define debug_headCout(h, x) (std::cerr << h << " : " <<  (x) << "\n")
#define debug_tabHeadCout(n, h, x) (std::cerr << strMulti("\t",n) << h << " : " <<  (x) << "\n")

#define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; i++)
#define rep1(i, n) for(int i=1, i##_len=(n); i<=i##_len; i++)
#define rrep(i, n) for(int i=(n)-1; i >= 0; i--)
#define rrep1(i, n) for(int i=(n); i > 0; i--)
#define all(x) (x).begin(), (x).end()
#define pair(a, b) make_pair(a, b);
//#define int long long
constexpr int INF = 2000000100;
constexpr ll DIV = 1000000007;	// 10e9+7
template<class T> bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> T divUp(T a, T b) { if (a % b == 0) { return a / b; } return a / b + 1; }
std::string strMulti(std::string t, int n) { std::string out = ""; for (int i = 0; i < n; i++) { out += t; } return out; }
template<class T> T math_P(T m, T n) { T ret = 1; for (T i = m; i > m - n; i--) { ret *= i; } return ret; }
template<class T> T math_C(T m, T n) { T ret = mathP(m, n); for (T i = 2; i <= n; i++) { ret /= i; } return ret; }
template<class T> bool compare_by_b(pair<T, T> a, pair<T, T> b) { if (a.second != b.second) { return a.second < b.second; } return a.first < b.first; }
template<class T> T math_gcd(T a, T b) { a = abs(a); b = abs(b); if (a < b) { std::swap(a, b); } T tmp; while (b != 0) { tmp = b; b = a % b; a = tmp; } return a; }
template<class T> T math_lcm(T a, T b) { a = abs(a); b = abs(b); if (a > b) { std::swap(a, b); } if (a == 1) { return b; } T i = a; while (i % b != 0) { i += a; } return i; }

/*****/

int Main()
{
	int N;
	cin >> N;
	array<vector<int>, 3> a;
	array<vector<ll>, 3> dp;
	rep(i, 3)
	{
		a[i] = vector<int>(N);
		dp[i] = vector<ll>(N + 1);
	}
	rep(i, N)
	{
		cin >> a[0][i] >> a[1][i] >> a[2][i];
	}

	rep(i, N)
	{
		rep(from, 3)
			rep(to, 3)
		{
			if (from == to)
				continue;
			chmax(dp[to][i + 1], dp[from][i] + a[to][i]);
		}
	}

	ll res = 0;
	rep(i, 3)	chmax(res, dp[i][N]);
	cout << res;

	return 0;
}

/*****/

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

	//std::cout << std::fixed << std::setprecision(10);

	Main();

	return 0;
}


Measured memory_bytes: 3840
#include<iostream>
#include<algorithm>
#include<vector>

using namespace std;

typedef long long ll;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int N;
	cin >> N;
	vector<ll>A(N);
	ll ans = 1e25;
	ll sum = 0, tmp = 0;
	for (int i = 0; i < N; i++){
		cin >> A[i];
		sum += A[i];
	}

	for (int i = 0; i < N; i++){
		tmp += A[i];
		if (i + 1 < N) {
			ans = min(ans, abs(sum - 2 * tmp));
		}
	}

	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;

int main()
{
        ll N; cin >> N;
        string S = to_string(N);
        ll sum = 0;
        for (int i = 0; i < S.length(); ++i) {
                sum += (S[i] - '0');
        }
        if (N % sum == 0) {
                cout << "Yes" << endl;
        }
        else {
                cout << "No" << endl;
        }



}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define REP(i,a,b) for(ll i=a;i<b;++i)
#define REPN(i,a,b) for(ll i=a;i<=b;++i)
#define db1(x) cout<<#x<<"="<<x<<'\n'
#define db2(x,y) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<'\n'
#define db3(x,y,z) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<","<<#z<<"="<<z<<'\n'
#define ll long long
const int M=1e9+7;
const int MAXN=17;


int main()
{/*
#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
#*/
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);

  int a,b,c;
  cin>>a>>b>>c;
  if((a==b && b!=c) || (b==c && c!=a) || (a==c && a!=b)) 
  cout<<"Yes\n";
  else 
  cout<<"No\n";

    return 0;
}

Measured memory_bytes: 256
#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;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define int long long
#define ar array
#define db long double
#define pow pw
const db pi = 3.14159265358979323846;
int pw(int a,int b){
    int ans=1;
    while(b){
    if (b%2) ans*=a;
    a*=a;
    b/=2;
    }
    return(ans);
}
const int mxn=1e5+7,INF=1e9+7;
int n,S;
int h[mxn],w[mxn];
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin>>n>>S;
    int sumv=0;
    for (int i=0;i<n;i++) 
    {
        cin>>w[i]>>h[i];
        sumv+=h[i];
    }
    vector<int> dp(sumv+1,INF);
    dp[0]=0;
    for (int i=0;i<n;i++)
    {
        for (int j=sumv;j>=h[i];j--) dp[j]=min(dp[j],dp[j-h[i]]+w[i]);
    }
    for (int i=sumv;i>=0;i--)
    if (dp[i]<=S) 
    {
        cout<<i;
        return 0;
    }
    return 0;
}

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

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

    map<string, int> varietyMap;

    for (int i = 0; i < n; ++i)
    {
        string input;
        cin >> input;

        if (!varietyMap.count(input))
        {
            varietyMap.insert(make_pair(input, 1));
        }
        else
        {
            ++varietyMap.at(input);
        }
    }

    cout << varietyMap.size() << endl;
}

Measured memory_bytes: 19228
// "header" {{{
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <deque>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <cstring>
#include <iomanip>
#include <tuple>

using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define all(x) (x).begin(),(x).end()
#define pii pair<int,int> 
#define int long long
#define setout(n,x) setw(n) << setfill(x)
#define Fixed fixed << setprecision(10)
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const long long mod = 1e9+7;

int gcd(int a,int b){ return b ? gcd(b,a % b) : a; }
int lcm(int a,int b){ return a / gcd(a,b) * b; }

inline double sqrt( const double &x) 
{
	double         xHalf = 0.5 * x;
	int64_t  tmp   = 0x5FE6EB50C7B537AAl - ( *(int64_t*)&x >> 1);
	double         xRes  = * (double*)&tmp;

	xRes *= ( 1.5 - ( xHalf * xRes * xRes ) );
	xRes *= ( 1.5 - ( xHalf * xRes * xRes ) );
	xRes *= ( 1.5 - ( xHalf * xRes * xRes ) );
	xRes *= ( 1.5 - ( xHalf * xRes * xRes ) );
	return xRes * x;
}
// }}}

signed main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<int> a(n+1),b(n+1),c(n+1);
	vector<vector<int> > dp(n+1,vector<int>(3));
	rep(i,n){
		cin >> a[i] >> b[i] >> c[i];
	}
	dp[0][0] = a[0];
	dp[0][1] = b[0];
	dp[0][2] = c[0];
	reps(i,n){
		dp[i][0] = max(a[i]+dp[i-1][1],a[i]+dp[i-1][2]);
		dp[i][1] = max(b[i]+dp[i-1][0],b[i]+dp[i-1][2]);
		dp[i][2] = max(c[i]+dp[i-1][0],c[i]+dp[i-1][1]);
	}
	cout << max({dp[n][0],dp[n][1],dp[n][2]}) << '\n';
	return 0;	
}


Measured memory_bytes: 8064
#include <bits/stdc++.h>
#include <cctype>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//template<typename key, typename val>
//using ordered_tree =
//  tree<key, val, std::less<>, rb_tree_tag, tree_order_statistics_node_update>;
using namespace std;
typedef long long int64;
typedef unsigned long long uint64;
typedef complex<double> comp;
const double pi = 3.14159265358979323846;
const int inf = (int)1e+9 + 2;
const int64 inf64 = (int64)1e+18 + 2;
const double dinf = 1e+20;
const int mod = 1'000'000'007;//*/998244353;
const int base = 2187;
const double eps = 1e-9;
const int N = 300'000;
const int LOGN = 19;

int n, m, k;

void solve(int) {
  int a, b, c;
  cin >> a >> b >> c;
  swap(a, b);
  swap(a, c);
  cout << a << ' ' << b << ' ' << c << '\n';
}

void precalc() {
}

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  precalc();
  int test = 1;
  //cin >> test;
  //auto start = chrono::high_resolution_clock::now();
  for (int i = 1; i <= test; ++i) {
    solve(i);
  }
  //cerr << chrono::duration_cast<chrono::milliseconds>(chrono::high_resolution_clock::now() - start).count() << '\n';
  return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define N 100010
int n,m,a,b,d[N];
vector<int> v[N];
int main(){
    scanf("%d%d",&n,&m);
    while(m--){
		scanf("%d%d",&a,&b);
		v[a].push_back(b);
    }
    for(int i=0;i<=n;i++)d[i]=0;
    for(int i=0;i<=n;i++){
		for(auto x:v[i])d[x]=max(d[x],d[i]+1);
		d[i+1]=max(d[i+1],d[i]);
    }
    printf("%d",d[n]);
    return 0;
}


Measured memory_bytes: 6144
def main():
    n, s = map(int, input().split())
    mod = 998244353
    a = list(map(int, input().split()))
    dp = [[0]*(s+1) for _ in range(n+1)]
    dp[0][0] = 1
    dio = dp[0]
    for i in range(1, n+1):
        ai = a[i-1]
        di = dp[i]
        for j in range(min(s+1, ai)):
            di[j] = (di[j]+2*dio[j])%mod
        for j in range(ai, s+1):
            di[j] = (di[j]+2*dio[j]+dio[j-ai])%mod
        dp[i] = di
        dio = di
    print(dp[n][s])
    
if __name__ == "__main__":
    main()

Measured memory_bytes: 132400
#include<iostream>
#include<algorithm>
#include<cstdio>
using namespace std;

int dp[1000],w[1000],v[1000],a,n,t=0;

int main(){

  while(cin >> a, a){

    t++;
    cin >> n;

    fill(dp,dp+a+1,0);

    for(int i=0;i<n;i++) scanf("%d,%d",&v[i],&w[i]);

    for(int i=0;i<n;i++){
      for(int j=a;j>=0;j--){
	if(j+w[i] <= a) dp[j+w[i]] = max(dp[j+w[i]],dp[j]+v[i]);
      }
    }

    int mv = 0;
    for(int i=0;i<=a;i++){
      if(dp[i] > dp[mv]) mv = i;
    }

    cout << "Case " << t << ":" << endl;
    cout << dp[mv] << endl << mv << endl;
  }

}

Measured memory_bytes: 1256
<?php
error_reporting(0);
//$A = explode(" ",trim(fgets(STDIN)));
//list($A,$B) = explode(" ",trim(fgets(STDIN)));
$N = trim(fgets(STDIN));
$A = explode(" ",trim(fgets(STDIN)));
$cv = array_count_values($A);
$remove=0;
foreach($cv as $k => $v) {
  if ($v == $k) continue;
  if ($v < $k) {
    $remove += $v;
  }
  if ($v > $k) {
    $remove += $v - $k;
  }
}
printf("%d\n",$remove);


Measured memory_bytes: 34212
#include<bits/stdc++.h>
using namespace std;
long long n,m,dp[100001],w,c,sol;
int main(){
cin>>n>>m;
for(int i=1;i<=n;i++){
cin>>w>>c;
for(int j=m;j>=w;j--)
if(dp[j-w])
dp[j]=max(dp[j],dp[j-w]+c);
dp[w]=max(dp[w],c);
}
for(int i=1;i<=m;i++)
sol=max(sol,dp[i]);
cout<<sol;
return 0;
}


Measured memory_bytes: 1024
/*****include*****/
#include <iostream>
#include <fstream>
#include <map>
#include <string>
#include <vector>
/*****デバッグ定義*****/
//#define DEBUG
/*****マクロ定義*****/

/*****名前空間*****/
using namespace std;

/*****グローバル変数置き場*****/

/*****その他関数置き場*****/

/*****main関数*****/
int main(){
	/*****ファイルオープン*****/
#ifdef DEBUG
	ofstream fout("output.txt");
	ifstream fin("input.txt");
	if(!fout || !fin){
		cout << "Can't open the file.\n";
		return 0;
	}
#endif
	/*****変数置き場*****/
	int p,q;
	map<int,int> remain;
	vector<int> answer;
	int counter;
	/*****処理部*****/
	while(1){
		counter = 0;
		answer.clear();
		remain.clear();
		cin >> p >> q;
		if(cin.eof())	break;
		while(p>q)
			p = p%q;
		remain[0] = p;
		while(1){
			p *= 10;
			answer.push_back(p/q);
			p=p%q;
			int i;
			for(i=0;i<counter;i++)
				if(remain[i] == p)	break;
			if(remain[i] == p)	break;
			if(p == 0)	break;
			remain[counter+1] = p;
			counter++;
		}
		for(int j=0;j<=counter;j++){
			cout << answer[j];
		}
		cout << endl;
		if(p!=0){
			for(int i=0;i<=counter;i++)
				if(remain[i] == p){
					if(remain[i+1] == p)	break;
					remain[i+1] = p;
				}
			for(int i=0;i<=counter;i++){
				if(remain[i] == p){
					cout << '^';
				}else
					cout << " ";
			}
			cout << endl;
		}
	}
	/*****処理終了後*****/
#ifdef DEBUG
	fout.close();
	fin.close();
#endif
	return 0;
}

Measured memory_bytes: 1220
#include <algorithm>
#include <iostream>
using namespace std;
using ll = long long;
ll mod = 1e9 + 7;

ll fp(ll b, ll n)
{
    ll ans = 1;
    while (n > 0)
    {
        if (n & 1)
            ans = ans * b % mod;
        n >>= 1;
        b = b * b % mod;
    }
    return ans % mod;
}

int main(void)
{
    ll n;
    cin >> n;
    cout << ((fp(10, n) + fp(8, n) + mod) % mod - (fp(9, n) * 2 % mod) + mod) % mod << endl;
    return 0;
}

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

  
int main(){
  string s;
  cin >> s;
  int ex=s.size()-2;
  VI dig(s.size());
  rep(i,s.size()){
    dig.at(i)=s.at(i)-'0';
  }
  VI th(ex);
  VI the(ex);
  rep(i,ex){
    th.at(i)=dig.at(i)*100+dig.at(i+1)*10+dig.at(i+2);
  }
  rep(i,ex){
    if(th.at(i)>=753) the.at(i)=th.at(i)-753;
    else if(th.at(i)< 753) the.at(i)=753-th.at(i);
  }
  int minn=100000;
  rep(i,ex){
    
    minn=min(minn,the.at(i));
  }
  cout << minn << endl;
}

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

ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
constexpr int mod = 1e9 + 7;

// clang-format off
struct mint {
  ll x; // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint &operator+=(const mint a) { if ((x += a.x) >= mod) x -= mod; return *this; }
  mint &operator-=(const mint a) { if ((x += mod - a.x) >= mod) x -= mod; return *this; }
  mint &operator*=(const mint a) { (x *= a.x) %= mod; return *this; }
  mint operator+(const mint a) const { mint res(*this); return res += a; }
  mint operator-(const mint a) const { mint res(*this); return res -= a; }
  mint operator*(const mint a) const { mint res(*this); return res *= a; }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t >> 1);
    a *= a; if (t & 1) a *= *this;
    return a; }
  mint inv() const { return pow(mod - 2); }
  mint &operator/=(const mint a) { return (*this) *= a.inv(); }
  mint operator/(const mint a) const { mint res(*this); return res /= a; }
  friend ostream &operator<<(ostream &os, const mint &a) { os << a.x; return os; }
  friend istream &operator>>(istream &is, mint &a) { is >> a.x; return is; }
};
struct combination {
  vector<mint> fact, ifact;
  combination(int n) : fact(n + 1), ifact(n + 1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i - 1] * i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i - 1] = ifact[i] * i;
  }
  mint operator()(int n, int k) { if (k < 0 || k > n) return 0; return fact[n] * ifact[k] * ifact[n - k]; }
};
// clang-format on

int main() {
  int n;
  cin >> n;
  vector<int> p(n);
  for (int i = 0; i < n; ++i) cin >> p[i];

  int num = 1;
  int m = p[0];
  for (int i = 1; i < n; ++i) {
    if (p[i] <= m) ++num;
    m = min(m, p[i]);
  }
  cout << num << endl;
}


Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <cmath>

#define long long long

using namespace std;

int main() {
    int m, d;
    cin >> m >> d;
    int cnt=0;
    for (int i=4; i<=m; i++) {
        int r = sqrt(m);
        for (int j=2; j<=r; j++) {
            if (i / j >= 10 || i % j != 0) continue;
            int d10 = j, d1 = i / j;
            if (d10 > d1) break;
            if (d1 + d10 * 10 <= d)
                cnt++;
            else 
                break;
            if (d1 != d10 && d1 * 10 + d10 <= d) cnt++;
        }
    }
    cout << cnt << '\n';
    return 0;
}

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

namespace ProductMax
{
    class Program
    {
        static void Main(string[] args)
        {
            var abcd = Console.ReadLine().Split(' ').Select(long.Parse).ToList();

            var ac = abcd[0] * abcd[2];
            var ad = abcd[0] * abcd[3];
            var bc = abcd[1] * abcd[2];
            var bd = abcd[1] * abcd[3];

            var resultList = new List<long> { ac, ad, bc, bd };

            Console.WriteLine(resultList.Max());
        }
    }
}


Measured memory_bytes: 28248
#include<stdio.h>
#include<string.h>
#include<math.h>
typedef struct{
  int maxi;
  int maxj;
  double menseki;
}L;
int main(){
  int i,j,n,m=0,sump=0,summ=0,min,SS[20001],k=0,sum=0;
  char S[20000];
  L LL[10000];
  scanf("%s",S);
  n=strlen(S);
  min=0;
  SS[0]=0;
  for(i=0;i<n;i++){
    if(S[i]=='/')sump++;
    if(S[i]=='\\')summ--;
    SS[i+1]=sump+summ;
    if(min>SS[i+1]){
      min=SS[i+1];
    }
  }
  for(i=0;i<n+1;i++){
    SS[i]-=min;
  }
  for(i=0;i<n+1;i++){
    if(S[i]=='\\'){
      j=i+1;
      while(1){
	if(SS[i]==SS[j]){
	  LL[m].maxi=i;
	  LL[m].maxj=j;
	  m++;
	  i=j-1;
	  break;
	};
	j++;
	if(j==n+1)break;
      }
    }
  }
  
  for(i=0;i<m;i++){
    for(j=LL[i].maxi;j<LL[i].maxj;j++){
      if(S[j]=='\\' || S[j]=='/'){
	LL[i].menseki+=(1/2+fabs(SS[LL[i].maxi]-SS[j]));
      }
      if(S[j]=='_'){
        LL[i].menseki+=SS[LL[i].maxi]-SS[j];
      }
    }
  }
  for(i=0;i<m;i++){
    sum+=LL[i].menseki;
  }

  printf("%d\n%d",sum,m);
  for(i=0;i<m;i++){
    printf(" %d",(int)LL[i].menseki);
  }
  printf("\n");
  return 0;
}



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

int main(){
    long n,cnt=0;
    cin >> n;
    map<long,long> a;
    for(int i=0;i<n;i++){
        long d;
        cin >> d;
        a[d]++;
        cnt += d;
    }
    long q;
    cin >> q;
    for(int i=0;i<q;i++){
        long b,c;
        cin >> b >> c;
        cnt += (c-b)*a[b];
        a[c]+=a[b];
        a[b]=0;
        cout << cnt << endl;
    }
}


Measured memory_bytes: 9512
Alphabet = []
Alphabet.append("a")
Alphabet.append("b")
Alphabet.append("c")
Alphabet.append("d")
Alphabet.append("e")
Alphabet.append("f")
Alphabet.append("g")
Alphabet.append("h")
Alphabet.append("i")
Alphabet.append("j")
Alphabet.append("k")
Alphabet.append("l")
Alphabet.append("m")
Alphabet.append("n")
Alphabet.append("o")
Alphabet.append("p")
Alphabet.append("q")
Alphabet.append("r")
Alphabet.append("s")
Alphabet.append("t")
Alphabet.append("u")
Alphabet.append("v")
Alphabet.append("w")
Alphabet.append("x")
Alphabet.append("y")
Alphabet.append("z")
S = list(input())
S = list(set(S))
for i in range(len(S)) :
    for j in range(len(Alphabet)) :
        if S[i] == Alphabet[j] :
            Alphabet[j] = "-1"
if Alphabet.count("-1") == len(Alphabet) :
    print("None")
else :
    for k in range(len(Alphabet)) :
        if Alphabet[k] != "-1" :
            print(Alphabet[k])
            break
            
            

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


int main(){
	int n, a, b;
	cin >> n >> a >> b;
	for(int i = n; i <= b; i += n){
		if(i >= a && i <= b){
			cout << "OK" << endl;
			exit(0);
		}
	}
	cout<< "NG" <<endl;
	return 0;
}

Measured memory_bytes: 3596
N,Y=map(int,input().split())
L=[[h,i,N-h-i] for h in range(N+1) for i in range(N+1) if h*1000+i*5000+(N-h-i)*10000==Y and (N-h-i)>=0]
#print(L)
if len(L)>0:
    print(L[0][2],L[0][1],L[0][0])
else:
    print(-1,-1,-1)

Measured memory_bytes: 3064
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    if len(x) == 0:
        return []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

def pow_k(x, n):
    ans = 1
    while n:
        if n % 2:
            ans *= x
        x *= x
        n >>= 1
    return ans

"""
def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2

    if rr == mid:
        return ll
    if (ここに評価入れる):
        rr = mid
    else:
        ll = mid+1
"""

n,d = m()
co = 0
for i in range(n):
    x,y = m()
    if x**2 + y ** 2 <= d**2:
        co += 1
print(co)

Measured memory_bytes: 74268
#include <stdio.h>
#include <stdlib.h>
#define NIL NULL

struct node{
    struct node *right;
    struct node *left;
    struct node *parent;
    int key;
};

typedef struct node *Node;

Node root;

void insert(int key){

    Node z;
    Node y = NIL;
    Node x = root;

    z = malloc(sizeof(struct node));

    z->key = key;
    z->left = NIL;
    z->right = NIL;

    while( x != NIL ){
        y = x;

        if( z->key < x->key ){
            x = x->left;
        }else{
            x = x->right;
        }

        z->parent = y;

    }

    if( y == NIL ){
        root = z;
    }else if( z->key < y->key ){
        y->left = z;
    }else{
        y->right = z;
    }

}


void pre(Node z){

    if( z == NIL ){
        return;
    }

    printf(" %d",z->key);
    pre(z->left);
    pre(z->right);

}

void ino(Node z){

    if( z == NIL ){
        return;
    }

    ino(z->left);
    printf(" %d",z->key);    
    ino(z->right);

}

Node find(Node u, int key){

      if( u == NIL || key == u->key ){
          return u;
      }  

      if( key < u->key ){
        return find(u->left,key);
      }else{
        return find(u->right,key);
      }


}


int main(){

    int n;
    int i;
    int key;
    char order[8];

    scanf("%d",&n);

    for( i = 0 ; i < n ; i++ ){
        scanf("%s",order);

        if( order[0] == 'i' ){
            scanf("%d",&key);
            insert(key);
        }else if( order[0] == 'p' ){

            ino(root);
            printf("\n");
            pre(root);
            printf("\n");

        }else if( order[0] == 'f' ){

            scanf("%d",&key);

            if( find(root,key) == NIL ){
                printf("no\n");
            }else{
                printf("yes\n");
            }


        }

    }

    return 0;

}

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

constexpr int64_t MOD = 1e9 + 7;

using namespace std;

bool is_agc(string& str) {
	if(str.find("AGC") != string::npos) return true;
	for(int i = 0; i < str.length() - 1; i++) {
		string tmp = str;
		swap(tmp[i], tmp[i+1]);
		if(tmp.find("AGC") != string::npos) return true;
	}
	
	return false;
}

int main() {
	int n;
	cin >> n;
	
	vector<map<string,int>> dp(n+1, map<string,int>());
	
	dp[0]["TTT"] = 1;
	
	for(int i = 0; i < n; i++) {
		for(auto& last : dp[i]) {
			for(char c : {'A', 'C', 'G', 'T'}) {
				string test = last.first + c;
				if(!is_agc(test))(dp[i+1][test.substr(1,3)] += last.second) %= MOD;
			}
		}
	}
	
	int sum = 0;
	
	for(auto& last : dp[n]) {
		(sum += last.second) %= MOD;
	}
	
	cout << sum;

	return 0;
}

Measured memory_bytes: 896
#include "bits/stdc++.h"
using namespace std;
typedef long long int ll;
typedef vector<ll> vl;
typedef pair<ll, ll> PP;
#define rep(i,n) for(ll i = 0; i < ll(n); i++)
#define all(v) v.begin() , v.end()
#define inputv(v,n) rep(i,n){\
    ll x;\
    cin>>x;\
    v.push_back(x);\
    }
const ll INF = 999999999999999;
const ll MOD = 1000000007;
ll a, b, c, d, e, f, p, t, x, y, z, q, m, n, r, h, k, w, l, ans = 0;
int main() {
	cin >> x >> y;
	cout << x*y/__gcd(x, y) << endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc=new Scanner(System.in);
        char[] s=sc.next().toCharArray();
        int count=0;
        for(int i=0;i<s.length/2;i++){
            if(s[i]!=s[s.length-1-i])count++;
        }
        System.out.println(count);
    }
}


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

typedef long long ll;
typedef unsigned long long ull;

struct UnionFind {
    vector<ll> parents;
    UnionFind(ll N): parents(N) {
        for(ll i = 0;i < N;i++) parents[i] = i;
    }
    ll root(ll x) {
        stack<ll> a;
        ll current = x;
        while(parents[current] != current) {
            a.push(current);
            current = parents[current];
        }
        for(ll i = 0;i < a.size();i++) {
            ll temp = a.top();
            a.pop();
            parents[temp] = current;
        }
        return current;
    }
    void unite(ll x, ll y) {
        x = root(x);
        y = root(y);
        if(x == y) return;
        parents[x] = y;
    }
    bool same(ll x, ll y) {
        x = root(x);
        y = root(y);
        if(x == y) return true;
        return false;
    }
};

int main(void) {
    ll N, M;
    vector<ll> p;
    cin >> N >> M;
    p.resize(N);
    UnionFind u(N);
    for(ll i = 0;i < N;i++) cin >> p[i];
    for(ll i = 0;i < M;i++) {
        ll a, b;
        cin >> a >> b;
        u.unite(a - 1, b - 1);
    }
    ll count = 0;
    for(ll i = 0;i < N;i++) {
        if(u.same(i, p[i] - 1)) count++;
    }
    cout << count << endl;
    return 0;
}


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

namespace ABC122C
{
    static class MainClass
    {

        static int[] nq;

        public static void Main(string[] args)
        {
            nq = Array.ConvertAll(Console.ReadLine().Split().ToArray(), int.Parse);
            string s = Console.ReadLine();

            int n = nq[0];
            int[] aclst = new int[n];
            int tmp = 0;
            aclst[0] = tmp; 
            for(int i = 0; i < n-1; i++)
            {
                if (s[i] == 'A' && s[i + 1] == 'C')
                {
                    tmp++;
                }
                aclst[i + 1] = tmp;
            }
            var anslst = new List<int>();
            for(int i = 0; i < nq[1]; i++)
            {
                int[] lr = Array.ConvertAll(Console.ReadLine().Split().ToArray(), int.Parse);
                anslst.Add(aclst[lr[1] - 1] - aclst[lr[0] - 1]);
                
            }

            anslst.ForEach(Console.WriteLine);

        }
    }
}


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

int main(){
    int a, b, c, d;
    int L, R;
    cin >> a >> b >> c >> d;
    L=a+b;
    R=c+d;
    if(L>R){
        cout << "Left" << endl;
    }else if(L<R){
        cout << "Right" << endl;
    }else if(L==R){
        cout << "Balanced" << endl;
    }else{

    }
    return 0;
}

Measured memory_bytes: 256
import sys
def input(): return sys.stdin.readline().rstrip()
from collections import Counter

def main():
    n=int(input())
    A=[int(_) for _ in input().split()]
    ac=Counter(A)
    aci=list(ac.items())
    aci.sort()
    ans="No"
    if aci[0]==(0,n):
        ans="Yes"
    elif n%3==0 and len(aci)==2:
        if aci[0]==(0,n//3) and aci[1][1]==n//3*2:
            ans="Yes"
    elif n%3==0 and len(aci)==3:
        if aci[0][1]==aci[1][1] and aci[1][1]==aci[2][1] and aci[0][0]^aci[1][0]^aci[2][0]==0:
            ans="Yes"  
    print(ans)


if __name__=='__main__':
    main()

Measured memory_bytes: 15512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
 
int main(void){
    ll w, a, b;
    cin >> w >> a >> b;
    
    int ans = 0;
    if(a<b){
        if(abs((a+w)-b) < abs(a-b)) {
            if (b - (a + w) < 0) {
                ans = 0;
            } else {
                ans = abs((a+w)-b);
            }
        
        
        }else if (abs((a+w)-b) >= abs(a-b)){
            if (a-b < 0) {
                ans = 0;
            } else {
                ans = abs(a-b);
            }
        }
    } else if (a>=b){
        if(abs(a-(b+w)) < abs(a-b)) {
            if (a - (b + w) < 0) {
                ans = 0;
            } else {
                ans = abs(a - (b+w));
            }
        }else if (abs(a-(b+w)) >= abs(a-b)){
            if (a-b < 0) {
                ans = 0;
            } else {
                ans = abs(a-b);
            }
        }
    }
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i,n) for(ll i=0;i<n;i++)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define fi first
#define se second
#define endl "\n"

template<typename T> inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){int len=d.size();rep(i,len){s<<d[i];if(i<len-1) s<<" ";}return s;}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){int len=d.size();rep(i,len){s<<d[i]<<endl;}return s;}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T> ostream& operator<<(ostream& s,const multiset<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){s<<"{"<<endl;for(auto itr=m.begin();itr!=m.end();++itr){s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;}s<<"}"<<endl;return s;}

const ll mod=1e9+7;
const ll inf=1e17;
const int INF=1e9;
const double EPS=1e-10;
const double PI=acos(-1);

struct state{
    int cnt,l,r;
};

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    string s;
    cin>>s;
    int n=s.size();
    vector<vector<int>> g(26);
    rep(i,n){
        int now=s[i]-'a';
        g[now].push_back(i);
    }
    for(auto vec:g){
        if(vec.size()<=1) continue;
        rep(i,vec.size()-1){
            if(vec[i+1]-vec[i]<=2){
                cout<<vec[i]+1<<' '<<vec[i+1]+1<<endl;
                return 0;
            }
        }
    }
    cout<<-1<<' '<<-1<<endl;
}

Measured memory_bytes: 1104
#include<bits/stdc++.h>
#include<stdio.h>
using namespace std;
int main()
{
    int a;
    double pi,ans;
    cin>>a;
    pi=3.1415926;
    ans= 2*pi*a;
   // printf("%.6lf\n",ans);
    cout<<ans<<endl;
}


Measured memory_bytes: 3788
#include <bits/stdc++.h>
using namespace std;
const int N=1e5+10;
int  a[N],flag[N];
int main()
{
	cin.tie(0);cout.tie(0);ios::sync_with_stdio(0);
	string s;
	cin>>s;
	int l=s.size();
	for(int i=0;i<l;i++)
	{
		if(s[i]!=s[l-1-i]){cout<<"No";return 0;}
	}
	for(int i=0;i<(l-1)/2;i++)
	{
		if(s[i]!=s[(l-1)/2-i-1]){cout<<"No";return 0;}
	}
		for(int i=(l+3)/2-1;i<l;i++)
	{
		if(s[i]!=s[l-i-1]){cout<<"No";return 0;}
	}

	cout<<"Yes";
		return 0;
}


Measured memory_bytes: 256
package main

import (
	"io"
	"os"

	"fmt"
)

func Solve(in io.Reader, out io.Writer) {
	var a, b int
	fmt.Fscan(in, &a, &b)

	if a > b {
		fmt.Fprintln(out, a-1)
	} else {
		fmt.Fprintln(out, a)
	}
}

func main() {
	Solve(os.Stdin, os.Stdout)
}


Measured memory_bytes: 512
def xgcd(a, b):
    x0, y0, x1, y1 = 1, 0, 0, 1
    while b != 0:
        q, a, b = a // b, b, a % b
        x0, x1 = x1, x0 - q * x1
        y0, y1 = y1, y0 - q * y1
    return a

N = int(input())
A = list(map(int, input().split()))
gcd = xgcd(A[0],A[1])
for i in range(2,N):
    gcd = xgcd(gcd,A[i])
print(gcd)

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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define ALL(a) (a).begin(), (a).end()
#define rALL(a) (a).rbegin(), (a).rend()
#define SZ(x) ((int)(x).size())
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 28;
const ll INF64 = 1ll << 55;
const int mod = 1000000007;
//const int mod = 998244353;

template <class T>inline bool chmin(T &a, const T b)
{
  if (a > b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline bool chmax(T &a, const T b)
{
  if (a < b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline void line_out(const vector<T> vec) {
  int n = SZ(vec);
  rep(i, n) {
    cout << vec[i];
    if(i < n-1) cout << " ";
  }
  cout << endl;
  return;
}

struct mint
{
  ll x; // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint &operator+=(const mint a)
  {
    if ((x += a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator-=(const mint a)
  {
    if ((x += mod - a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator*=(const mint a)
  {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const
  {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const
  {
    mint res(*this);
    return res -= a;
  }
  mint &operator++()
  {
    if ((x += 1) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator--()
  {
    if ((x += mod - 1) >= mod)
      x -= mod;
    return *this;
  }
  mint operator*(const mint a) const
  {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const
  {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const
  {
    return pow(mod - 2);
  }
  mint &operator/=(const mint a)
  {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const
  {
    mint res(*this);
    return res /= a;
  }
};


int main()
{
  char x, y; cin >> x >> y;
  if(x > y) cout << ">" << endl;
  else if(x < y) cout << "<" << endl;
  else cout << "=" << endl;
}

Measured memory_bytes: 3504