akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define LI list<int>
#define vct vector
#define D(a) (double)(a)
#define vi vct<int>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vvi vct<vi>
#define vll vct<ll>
#define vvll vct<vll>
#define vpii vct<pii>
#define vpll vct<pll>
#define vb vct<bool>
#define vs vector<string>
#define all(a) a.begin(),a.end()
#define allr(a) a.rbegin(),a.rend()
#define mp(a,b) make_pair(a,b)
#define pb push_back
#define ff first
#define ss second
#define bg begin()
#define UNIQUE(X) (X).erase(unique(all(X)),(X).end())
#define ft cout<<"for test"<<endl;
#define read(v,a,n) for(int i=a; i<n; i++)cin>>v[i];
#define print(v) for(auto it:v)cout<<it<<' '; cout<<endl;
#define PI 2*acos(0.0)
#define yes cout<<"Yes"<<endl
#define no cout<<"No"<<endl
#define FIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define t_c int test,cs=1;cin>>test;while(test--)
#define rt return true
#define rf return false

///................function.....................///
#define siz(s) (int)(s.size())
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define dbg(a) cout << #a << " = " << a << " ";
///...........knight moves.....................///
///int dx[] = {+1,+1,-1,-1,+2,+2,-2,-2};
///int dy[] = {+2,-2,+2,-2,+1,-1,+1,-1};
const ll mod=1000000007;
ll lcm(ll a, ll b)
{
    return (a*b)/(ll)(__gcd(a,b));
}
int main()
{
    FIO;

    ll a=0LL,i,n,ans=0LL;
    cin>>n;
    vll v(n);
    for(i=0; i<n; i++)
    {
        cin>>v[i];
        a+=v[i];
    }
    for(i=0; i<n; i++)
    {
        a-=v[i];
        ans = (ans + ((a%mod)*v[i])%mod);
        ans%=mod;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 4764
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::HashMap;
#[allow(unused_imports)]
use std::collections::VecDeque;
#[allow(unused_imports)]
use std::io::*;
#[allow(unused_imports)]
use std::mem::*;
#[allow(unused_imports)]
use std::str::*;
#[allow(unused_imports)]
use std::usize;

#[allow(unused_macros)]
macro_rules! read_cols {
    ($($t:ty),+) => {{
        let mut line = String::new();
        stdin().read_line(&mut line).unwrap();

        let mut it = line.trim()
            .split_whitespace();

        ($(
            it.next().unwrap().parse::<$t>().ok().unwrap()
        ),+)
    }}
}

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let mut line = String::new();
    stdin().read_line(&mut line).unwrap();
    line.trim().to_string().parse().ok().unwrap()
}

#[allow(dead_code)]
fn read_vec<T: FromStr>() -> Vec<T> {
    let mut line = String::new();
    stdin().read_line(&mut line).unwrap();

    line.trim()
        .split_whitespace()
        .map(|s| s.parse().ok().unwrap())
        .collect()
}

fn main() {
    let n: i64 = read();

    let ans: i64 = (1..n).map(|a| (n - 1) / a).sum();

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


Measured memory_bytes: 2156
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const string ln = "\n";
constexpr int INF = 1001001001;
constexpr int MOD = 1000000007;

struct UnionFind {
  // d[i] = 頂点番号iの親（の番号）
  // マイナスなら根（かつ、サイズ * -1 を示す（そうすると配列一つですむ））
  vector<int> d;

  // コンストラクタ
  // 頂点n個で初期化。最初は全部に根するので-1
  UnionFind(int n = 0) : d(n, -1) {}

  // 親の番号を返す
  int find(int x) {
    if (d[x] < 0) return x;  // 根ならそのまま頂点番号返す

    return d[x] = find(
               d[x]);  // 根じゃないなら親を返す（かつ計算量を削減のためメモ化する）
  }

  // 木と木をくっつける
  bool unite(int x, int y) {
    x = find(x);  // xの親の番号
    y = find(y);  // yの親の番号

    if (x == y) return false;  // 親が同じなら何もする必要はない

    // x のほうがサイズを大きくしたい
    if (-d[x] < -d[y]) swap(x, y);  // （*-1のサイズなので注意）

    // 小さいほうの木（y）を大きい方（x）にくっつける
    d[x] += d[y];
    d[y] = x;

    return true;
  }

  // 同じグループか
  bool same(int x, int y) { return find(x) == find(y); }

  // 頂点xのサイズ
  int size(int x) { return -d[find(x)]; }
};

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

  int n, m, k;
  cin >> n >> m >> k;

  UnionFind uf(n);

  vector<int> a(m), b(m), f(n, 0);
  for (int i = 0; i < m; i++) {
    cin >> a[i] >> b[i];
    a[i]--;
    b[i]--;
    uf.unite(a[i], b[i]);
    f[a[i]]++;
    f[b[i]]++;
  }

  vector<int> c(k), d(k);

  vector<vector<int>> blk(n);
  for (int i = 0; i < k; i++) {
    cin >> c[i] >> d[i];
    c[i]--;
    d[i]--;
    blk[c[i]].push_back(d[i]);
    blk[d[i]].push_back(c[i]);
  }

  for (int i = 0; i < n; i++) {
    int p = uf.find(i);
    int total = uf.size(p) - 1;
    total -= f[i];

    for (auto bk : blk[i]) {
      if(uf.same(i, bk)) {
        total--;
      }
    }

    cout<<total<<ln;
  }

  return 0;
}

Measured memory_bytes: 8320
#include<iostream>
#include<algorithm>

using namespace std;

typedef long long llint;

const int MAXN = 100005;

llint n, ind, sum, minind;
llint l[MAXN];
pair <llint, llint> p[MAXN];
llint sol[MAXN];

int main () {
	cin >> n;
	for (int i=1; i<=n; i++) {
		cin >> l[i];
		//l[i]=20-i;
		//cout << l[i] << " ";
		p[i]=make_pair(l[i], i);
	}
	sort(p+1, p+n+1);
	/*for (int i=1; i<=n; i++) {
		sum+=p[i].first;
		if (p[i].second==1) {
			ind=i;
			break;
		}
	}*/
	minind=p[n].second;
	for (int i=n; i>=ind+1; i--) {
		minind=min(minind, p[i].second);
		llint len=n-i+1;
		sol[minind]+=(p[i].first-p[i-1].first)*len;
	}
	//sol[1]+=sum+(n-ind)*p[ind].first;
	for (int i=1; i<=n; i++) {
		cout << sol[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 4224
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String str = sc.next();
		sc.close();

		if (str.contains("A") && str.contains("B")) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}

}


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

template <class T>
inline void read(T &x) {
    x = 0;
    char c = getchar();
    bool f = 0;
    for (; !isdigit(c); c = getchar()) f ^= c == '-';
    for (; isdigit(c); c = getchar()) x = x * 10 + (c ^ 48);
    x = f ? -x : x;
}

template <class T>
inline void write(T x) {
    if (x < 0) {
        putchar('-');
        x = -x;
    }
    T y = 1;
	int len = 1;
    for (; y <= x / 10; y *= 10) ++len;
    for (; len; --len, x %= y, y /= 10) putchar(x / y + 48);
}

const int MAXN = 1e9;
LL s;

int main() {
	read(s);
	const int x1 = 0, y1 = 0, x2 = MAXN, y2 = 1;
	int x3 = MAXN - ((s - 1) % MAXN + 1), y3 = (s - 1) / MAXN + 1;
	write(x1);
	putchar(' ');
	write(y1);
	putchar(' ');
	write(x2);
	putchar(' ');
	write(y2);
	putchar(' ');
	write(x3);
	putchar(' ');
	write(y3);
	putchar('\n');
	return 0;
}

Measured memory_bytes: 256
n = int(input())
s = [input() for i in range(n)]

ans = 0
count = {}
for i in range(n):
    c = ''.join(sorted(s[i]))
    count.setdefault(c,0)
    count[c] += 1
    if(count[c] > 0):
        ans += count[c] -1

print(ans)

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

int main() {
  int D, G;
  vector<int> sum(11, 0), p(11, 0), c(11, 0), dp(1001, 0);
  int i;
  cin >> D >> G;
  for(i = 1; i <= D; i++) {
    cin >> p.at(i) >> c.at(i);
  }
  for(i = 1; i <= D; i++) {
    sum.at(i) = sum.at(i - 1) + p.at(i);
  }
  for(i = 1; i <= D; i++) {
    for(int j = sum.at(i); j > 0; j--) {
      for(int k = 1; k <= p.at(i) && k <= j; k++) {
        dp.at(j) = max(dp.at(j), dp.at(j - k) + k * 100 * i + (k == p.at(i)) * c.at(i));
      }
    }
  }
  for(i = 1; dp.at(i) < G; i++);
  cout << i;
}


Measured memory_bytes: 256
#include <iostream>
#include <queue>
#include <set>
#include <tuple>
#include <array>

using namespace std;

const int dx[4] = {-4, -1, 1, 4};

typedef array<int,16> T;

struct Puzzle {
  T t;
  Puzzle () {
    for(int i = 0; i < 16; i++) t[i] = (i + 1) % 16;
  }
  Puzzle (T s) : t(s) {}
  bool move(int d) {
    int x = 0;
    for(int i = 0; i < 16; i++) if (t[i] == 0) x = i;
    if (d == 2 && x % 4 == 3) return false;
    if (d == 1 && x % 4 == 0) return false;
    int nx = x + dx[d];
    if (nx < 0 || nx > 15) return false;
    swap(t[x], t[nx]); x = nx;
    return true;
  }
  int eval() {
    int sum = 0;
    for(int i = 0; i < 4; i++){
      for(int j = 0; j < 4; j++){
       if (t[i*4+j] == 0) continue;
       int y = (t[i*4+j] + 15) % 16 / 4;
       int x = (t[i*4+j] + 3) % 4;
       sum += abs(i - y) + abs(j - x);
      }
    }
  return sum;
  }
  bool operator==(const Puzzle &r) { return t == r.t; }
  bool operator<(const Puzzle &r) const { return t < r.t; }
};

set<Puzzle> s;

int solve() {
  T field;
  for(int i = 0; i < 16; i++) cin >> field[i];
  Puzzle check;
  Puzzle puz(field);
  priority_queue<tuple<int,int,Puzzle>> que;
  if (puz == check) return 0;
  que.push(make_tuple(-puz.eval(), 0, puz));
  while (!que.empty()) {
    int num = get<1>(que.top());
    Puzzle b = get<2>(que.top());
    que.pop();
    for(int i = 0; i < 4; i++) {
      Puzzle nb = b;
      bool flag = nb.move(i);
      if (flag == true && s.find(nb) == s.end()) {
        if (nb == check) return num + 1;
        int ev = -nb.eval();
        s.insert(nb);
        que.push(make_tuple(ev - num - 1, num + 1, nb));
      }
    }
  }
  return -1;
}

signed main() {
  cout << solve() << endl;
}



Measured memory_bytes: 82040
use std::io::*;
use std::str::FromStr;
#[allow(unused_imports)]
use std::collections::*;

struct Scanner<R: Read> {
    reader: R,
}

#[allow(dead_code)]
impl<R: Read> Scanner<R> {
    fn new(reader: R) -> Scanner<R> {
        Scanner { reader: reader }
    }

    fn safe_read<T: FromStr>(&mut self) -> Option<T> {
        let token = self.reader
            .by_ref()
            .bytes()
            .map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        if token.is_empty() {
            None
        } else {
            token.parse::<T>().ok()
        }
    }

    fn read<T: FromStr>(&mut self) -> T {
        if let Some(s) = self.safe_read() {
            s
        } else {
            writeln!(std::io::stderr(), "Terminated with EOF").unwrap();
            std::process::exit(0);
        }
    }

    fn vec<T: FromStr>(&mut self, len: usize) -> Vec<T> {
        (0..len).map(|_| self.read()).collect()
    }

    fn mat<T: FromStr>(&mut self, row: usize, col: usize) -> Vec<Vec<T>> {
        (0..row).map(|_| self.vec(col)).collect()
    }
}

trait Joinable {
    fn join(self, sep: &str) -> String;
}

impl<U: ToString, T: Iterator<Item = U>> Joinable for T {
    fn join(self, sep: &str) -> String {
        self.map(|x| x.to_string()).collect::<Vec<_>>().join(sep)
    }
}

#[allow(unused_imports)]
use std::cmp::{min, max};

fn main() {
    std::thread::Builder::new()
        .stack_size(104_857_600)
        .spawn(solve)
        .unwrap()
        .join()
        .unwrap();
}

fn solve() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin);

    loop {
        let n = sc.read();
        let a: Vec<u64> = sc.vec(n);
        let s = a.iter().sum::<u64>();
        let ans = if s % 10 != 0 {
            s
        } else {
            if let Some(x) = a.iter().filter(|&x| x % 10 != 0).min() {
                s - x
            } else {
                0
            }
        };
        println!("{}", ans);
    }
}


Measured memory_bytes: 8572
#include<iostream>
#include<string>
#include<typeinfo>
#include<vector>
#include<algorithm>
#include<map>
#include<iomanip>
typedef long long int ll;
using namespace std;
int main()
{
	int n;
	cin >> n;
	vector<int> ascii(128,0);
	string s;
	cin >> s;
	for(int i=0; i<s.size(); i++){
		ascii.at(s.at(i))++;
	}
	for(int i=0; i<n-1; i++){
		cin >> s;
		vector<int> tmpascii(128,0);
		for(int j=0; j<s.size(); j++){
			tmpascii.at(s.at(j))++;
		}
		for(int j='a'; j<='z'; j++){
			if(tmpascii.at(j)<ascii.at(j)){
				ascii.at(j)=tmpascii.at(j);
			}
		}
	}

	for(int i='a'; i<='z'; i++){
		for(int j=0; j<ascii.at(i); j++){
			char c=i;
			cout << c;
		}
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<pii>
#define vll vector<pll>
#define all(v) v.begin(),v.end()
#define mem(v,x) memset(v,x,sizeof(v))
#define N 100005

using namespace std;

ll mod = 1e9+7;
void multiply(vector<vector<ll>>& a, vector<vector<ll>>& b){
    int n = a.size();
    vector<vector<ll>> c(n, vector<ll>(n));
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            ll val = 0;
            for(int k=0;k<n;k++){
                val = (val + a[i][k]*b[k][j])%mod;
            }
            c[i][j] = val;
        }
    }
    a = c;
}
ll power(vector<vector<ll>>& a, ll b){
    int n = a.size();
    vector<vector<ll>> res(n, vector<ll>(n));
    for(int i=0;i<n;i++){
        res[i][i] = 1;
    }
    while(b){
        if(b&1){
            multiply(res, a);
        }
        b >>= 1;
        multiply(a,a);
    }
    ll ans = 0;
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            ans = (ans + res[i][j])%mod;
        }
    }
    return ans;
}
int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	ll n,k;
	cin>>n>>k;
	vector<vector<ll>> a(n, vector<ll>(n));
	for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            cin>>a[i][j];
        }
	}
	cout<<power(a,k);
	return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

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

    vector<double> A(N);
    for (int i = 0; i < N; i++)
    {
        cin >> A.at(i);
    }

    double nume = 1;
    double deno = 0;

    for (int i = 0; i < N; i++)
    {
        deno += nume / A.at(i);
    }
    
    printf("%f", nume / deno);
}


Measured memory_bytes: 256
n,x=map(int,input().split())
a=list(map(int,input().split()))
ans=0
for i in range(len(a)):
    if a[i]>x:
        ans+=a[i]-x
        a[i]=x
nlist=[]
for i in range(1,len(a)):
    nlist.append(a[i]+a[i-1])

for i in range(len(nlist)):
    if nlist[i]>x:
        d=nlist[i]-x
        ans+=nlist[i]-x
        nlist[i]=x
        if i+1<len(nlist):
            nlist[i+1]-=d
print(ans)


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

#define N 111

int n, x;
bool vis[N];

int main() {
    scanf("%d %d", &x, &n);
    for(int i = 1, y; i <= n; i ++) scanf("%d", &y), vis[y] = 1;
    int y;
    for(int k = 0; ; k ++) {
        y = x - k;
        if(y <= 0 || !vis[y]) break;
        y = x + k;
        if(y >= N || !vis[y]) break;
    }
    printf("%d\n", y);
}


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

int w, h;
char a[21][21];
int dx[]{ 1,-1,0,0 }, dy[]{ 0,0,1,-1 };
int cnt;

void dfs(int x, int y) {
	a[x][y] = 0;
	rep(i, 4) {
		int nx = x + dx[i], ny = y + dy[i];
		if (0 <= nx&&nx < h && 0 <= ny&&ny < w&&a[nx][ny] == '.') {
			cnt++; dfs(nx, ny);
		}
	}
}
int main() {
	while (scanf("%d%d", &w, &h), w) {
		cnt = 1;
		rep(i, h)scanf("%s", a[i]);
		rep(i, h)rep(j, w) {
			if (a[i][j] == '@') {
				dfs(i, j);
				break;
			}
		}
		printf("%d\n", cnt);
	}
}

Measured memory_bytes: 3192
#include <bits/stdc++.h>
#define rep(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
#define int long long
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

bool large(char c){
	if('A'<=c && c<='Z') return true;
	return false;
}

char change(char c){
	if('A'<=c && c<='Z') c+='a'-'A';
	else if('a'<=c && c<='z') c+='A'-'a';
	return c;
}

signed main(){
	while(1){
		string s,ans="";
		char c;
		cin>>s>>c;
		if(c=='X') break;
		else if(c=='D'){
			if(large(s[0])) ans+=change(s[0]);
			else ans+=s[0];
			rep(i,1,s.size()){
				if(large(s[i])) ans=ans+'_'+change(s[i]);
				else ans+=s[i];
			}
		}else if(c=='U'){
			if(!large(s[0])) ans+=change(s[0]);
			else ans+=s[0];
			rep(i,1,s.size()){
				if(s[i]=='_'){
					ans+=change(s[i+1]);
					i++;
				}else ans+=s[i];
			}
		}else if(c=='L'){
			if(large(s[0])) ans+=change(s[0]);
			else ans+=s[0];
			rep(i,1,s.size()){
				if(s[i]=='_'){
					ans+=change(s[i+1]);
					i++;
				}else ans+=s[i];
			}
		}
		o(ans);
	}
}

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

long long A,B,D;
pair<long long,long long> cmp(pair<long long,long long> a,pair<long long,long long> b){
	if(a.first + a.second < b.first + b.second) return a;
	if(a.first * A + a.second * B < b.first * A + b.second * B) return a;
	return b;
}
int main(){
	while(cin >> A >> B >> D && (A||B||D) ){
		pair<long long,long long> ans(100001,100001);
		
		for(long long x = 0 ; x <= 100000 ; x++){
			if( (A*x+D)%B==0){
				long long y = (A * x+ D)/B;
				ans = cmp(ans,make_pair(x,y));
			}
		}
		for(long long x = 0 ; x <= 100000 ; x++){
			if( (B*x+D)%A==0){
				long long y = (B*x+D)/A;
				ans = cmp(ans,make_pair(y,x));
			}
		}
		for(long long x = 0 ; x <= 100000 ; x++){
			if( D-A*x >= 0 && (D-A*x)%B==0){
				long long y = (D-A*x)/B;
				ans = cmp(ans,make_pair(x,y));
			}
		}
		for(long long x = 0 ; x <= 100000 ; x++){
			if( D-B*x >= 0 && (D-B*x)%A==0){
				long long y = (D-B*x)/A;
				ans = cmp(ans,make_pair(y,x));
			}
		}
		cout << ans.first << " " << ans.second << endl;
	}
}

Measured memory_bytes: 872
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int N = Integer.parseInt(scan.next());
		int[] h = new int[N];
		for (int i = 0; i < N; i++) {
			h[i] = Integer.parseInt(scan.next());
		}
		int count = 0;
		boolean find;
		while (true) {
			find = false;
			for (int i = 0; i < N; i++) {
				if (h[i] != 0) {
					find = true;
					h[i]--;
				} else if (find && i != N - 1) {
					break;
				} else if (!find && i != N - 1) {
					continue;
				} else if (!find && i == N - 1) {
					System.out.println(count);
					return;
				}
			}
			count++;
		}
	}
}


Measured memory_bytes: 23764
#include<iostream>
#include<cmath>
#include<algorithm>
using namespace std;
const int maxn = 3003;
int N,T;
int A[maxn],B[maxn];
int dp[maxn][maxn][2];
int main()
{
    cin>>N>>T;
    for(int i=1;i<=N;++i)
    {
        cin>>A[i]>>B[i];
    }
    for(int i=1;i<=N;++i)
    {
        for(int t=0;t<T;++t)
        {
            dp[i][t][1] = max(dp[i][t][1],dp[i-1][t][1]);
            dp[i][t][1] = max(dp[i][t][1],dp[i-1][t][0] + B[i]);
            if(t - A[i] >= 0 )
                dp[i][t][1] = max(dp[i][t][1],dp[i-1][t-A[i]][1] + B[i]); 

            dp[i][t][0] = max(dp[i][t][0],dp[i-1][t][0]);
            if(t - A[i] >= 0 )
                dp[i][t][0] = max(dp[i][t][0],dp[i-1][t-A[i]][0] + B[i]); 

            dp[i][t][1] = max(dp[i][t][1],dp[i][t][0]);
        }
    }
    cout<<dp[N][T-1][1]<<endl;
}

Measured memory_bytes: 70656
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp> 
//#include <ext/pb_ds/tree_policy.hpp>
//#include <functional> // for less
//using namespace __gnu_pbds;
using namespace std;
typedef long long  L;

#define max_(x, y) (((x) > (y)) ? (x) : (y))
#define min_(x, y) (((x) < (y)) ? (x) : (y))
#define ___ ios_base::sync_with_stdio(false);cin.tie(NULL);
#define Mx 200001
#define inf 1e15
const L MOD = 1e9+7;
const double pi = 2 * acos (0.0);

/*------------------------------Graph Moves----------------------------*/
//const int fx[]={+1,-1,+0,+0};
//const int fy[]={+0,+0,+1,-1};
//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move
//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move
//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move
/*---------------------------------------------------------------------*/


//typedef tree<L,null_type,less<L>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

L a1,a2,a3,a,b,b1,b2,b3,c,c1,c2,c3,d,d1,d2,d3,d4,d5,e1,e2,e3,f,h,k,l,m,n,m1,m2,n1,n2,o,p,p1,p2,p3,p4,
q,q1,q2,q3,q4,r,s,t,u,v,x,y,z,sum,mx=-inf,mn=inf,flg,flg1,flg2,id1,id2,id3,id4,lim;

double prec=0.0,curr=0.0;
L A[Mx+5],B[Mx+5];
void solve(){
    prec=1.0/((double)m*4.0);

    for(int i=0;i<n;i++){
        curr=((double)A[i]*1.0) /((double)c*1.0);
        if(curr>=prec)c1++;
    }
    if(c1>=m)printf("Yes\n");
    else printf("No\n");
}

int main()
{
    c=0;
    scanf("%lld%lld",&n,&m);
    for(int i=0;i<n;i++){
        scanf("%lld",&A[i]);
        c+=A[i];
    }
    solve();
    return 0;
}
/// empty() lld lld push_back() top() pop() insert() upper_bound() lower_bound() memset() max() min() scanf continue


Measured memory_bytes: 3684
#include <bits/stdc++.h>
        using namespace std;
        void init(){
        cin.tie(0);
        cin.sync_with_stdio(0);
       }

        int main()
        {   init();
         int n,k,d,res=0;
         cin>>n>>k;
         int count[n+1]={0};
         for(int i=0;i<k;i++){
            cin>>d;
            int a[d];
            for(int j=0;j<d;j++){
                cin>>a[j];
                count[a[j]]++;
            }
         }for(int i=1;i<=n;i++){
         if(count[i]==0)res++;}cout<<res;
         return 0;}

Measured memory_bytes: 3640
//check check check
#include<iostream>
#include<vector>
#include<algorithm>
#include<fstream>
#include<queue>
#include<cstring>
#include<map>
#include<iomanip>

#define ll long long
#define pb(x) push_back(x)

using namespace std;

typedef pair<int,int> ii;

const int NMAX = 1e5+5;

int v[NMAX],dp[NMAX];

int main()
{
    int N,i,j;

    cin>>N;

    for(i = 1 ; i <= N ; ++i)
    {
        cin>>v[i];
    }
    int maxim = 0;
    for(i = 1 ; i <= N ; ++i)
    {
        if(v[i-1] >= v[i])
            dp[i] = dp[i-1] + 1;
        else
            dp[i] = 1;

        maxim = max(dp[i] , maxim);
    }

    cout<<maxim-1;

}


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

int main() {
  int n;
  cin >> n;
  if (n < 1000) {
    cout << "No" << endl;
  } else {
    int n4 = n / 1000;
    int n3 = (n - (n4 * 1000)) / 100;
    int n2 = (n - (n4 * 1000 + n3 * 100)) / 10;
    int n1 = n - (n4 * 1000 + n3 * 100 + n2 * 10);
    if ( n4 == n3 && n3 == n2) {
      cout << "Yes" << endl;
    } else if ( n3 == n2 && n2 == n1) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
int main()
{
  int len,i,num=0;
  char str[21],stack[21]={0,};
  scanf("%s",&str);
  len=strlen(str);
  for(i=0;i<len;i++){
	  if(num%2==0)
		  if(str[i]=='A') stack[num++]='A';
	  if(num%2==1)
		  if(str[i]=='Z') stack[num++]='Z';
  }
  if(num%2==1) stack[--num]='\0';
  if(num!=0) printf("%s\n",stack);
  else printf("-1\n");
  return 0;
}

Measured memory_bytes: 524
#include<cstdio>
#include<algorithm>
#include<cmath>
typedef long long ll;
int m;
template<typename T>
inline void read(T &x){
    x = 0; char ch = getchar(); int f = 1;
    for(;ch < '0' || ch > '9'; ch = getchar()) if(ch == '-') f = -1;
    for(;ch >= '0' && ch <= '9'; ch = getchar()) x = x * 10 + ch - '0';
    x *= f;
}
int main(){
    read(m);
    if(m >= 400 && m <= 599) printf("8\n");
    else if(m >= 600 && m <= 799) printf("7\n");
    else if(m >= 800 && m <= 999) printf("6\n");
    else if(m >= 1000 && m <= 1199) printf("5\n");
    else if(m >= 1200 && m <= 1399) printf("4\n");
    else if(m >= 1400 && m <= 1599) printf("3\n");
    else if(m >= 1600 && m <= 1799) printf("2\n");
    else printf("1\n");
    return 0;
}
/*

*/

Measured memory_bytes: 2996
#include <stdio.h>
#include <iostream>
#include <vector>

using namespace std;

int main(){
    
    string test;
    int a;
    int b;
    
    
    cin >> test;
    const char *input = test.c_str();
//    int size = test.size();
//    cout << size;
    for (int i = 0; i < test.size(); ++i){
        if ( input[i] == 'A'){
            a = i;
            while(true){
            for (int j = test.size() - 1; j >= 0; --j){
                if ( input[j] == 'Z'){
                    b = j;
                    int c = b - a +1;
                    cout << c << endl;
                    return 0;
                }
            }
            
            }
        }
    }
    
    

}


Measured memory_bytes: 640
#include<stdio.h>
int main()
{
	int n;
	scanf("%d", &n);
	int x;
	for (x = 0; x <= n; x++)
	{
		if ((int)(x * 1.08) == n)
		{
			printf("%d\n", x);
			return 0;
		}
	}
	printf(":(\n");
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
const int INF=INT_MAX,MOD=1e9+7;

int main(){
    int r; cin>>r;
    if(r<1200) cout<<"ABC"<<endl;
    else if(r<2800) cout<<"ARC"<<endl;
    else cout<<"AGC"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int a,b,c,d,e,f,k,g;
	scanf("%d %d %d %d",&a,&b,&c,&k);
	d=a-k;
	e=k-(a+b);
	if(a+b+c==0){
		printf("0\n");
	}
	else if(a==k){
		printf("%d",a);
	}
	else if(k<=a||k<=a+b){
			if(k<=a){
				printf("%d\n",k);
			}
			else printf("%d\n",a);
	}
	else {
		f=a-e;
		printf("%d\n",f);
	}
	return 0;
}

Measured memory_bytes: 1712
#include <bits/stdc++.h>
using namespace std;
 
int main() {
 	int a,b; 
  	cin >> a >> b;
  	if((a+b)%2 == 0){
  		cout << (a+b)/2 << endl;
    }else{
     	cout << (a+b)/2 +1 << endl; 
    }
}


Measured memory_bytes: 256
//#include <fsociety>
#include <cmath>
#include <deque>
#include <algorithm>
#include <iterator>
#include <list>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <unordered_set>
#include <stack>
#include <string>
#include <vector>
#include <fstream>
#include <iostream>
#include <stdio.h>
//end of libraries ;
//freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);
// ll lmax(ll o , ll w) {if(o>w)return o; return w;}
// ll lmin(ll o , ll w) {if(o<w)return o; return w;}
#define INF 3999999999999999999
#define N 3000003
#define F first
#define S second
#define pb push_back
#define ll long long
#define fcin ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
using namespace std;
double pi = 3.14159265359;
double a ;
int main(){
fcin;
	cin>>a;
	double ans = a*pi*2;
	cout<<ans<<endl;

}

Measured memory_bytes: 3780
#include <bits/stdc++.h>
#define rep(i,n) for(int i=1;i<=n;i++)
using namespace std;
int prime(int n){
   
    for(int i=2;i*i<n;i++)
        if(n%i==0){
            // cout << "non prime";
            return 0;}
    // cout << "prime";
    return 1;
}
int main()
{
    int n,flag=0;
    cin >> n;
    if(prime(n))
        cout << n;
    else{
        while(flag==0){
            n=n+1;
            flag=prime(n);
            
        }
        cout << n;
    }
        
    return 0;
    
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#pragma GCC optimize ("-O3")
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define ll long long
#define int long long
#define double long double
#define pb push_back
#define max(a,b) (a>b?a:b)
#define min(a,b) (a<b?a:b)
#define diff(a,b) (a>b?a-b:b-a)
const int N=1e6+5;
void pairsort(int a[], int b[], int n){
    pair<int, int> pairt[n];
    for (int i = 0; i < n; i++) 
    {
        pairt[i].first = a[i];
        pairt[i].second = b[i];
    }
    sort(pairt, pairt + n);
    for (int i = 0; i < n; i++) 
    {
        a[i] = pairt[i].first;
        b[i] = pairt[i].second;
    }
}
int gcd(int a, int b){
    if (b == 0)
        return a;
    return gcd(b, a % b); 
}
int isPrime(int n){
    if(n < 2)
        return 0;
    if(n < 4)
        return 1;
    if(n % 2 == 0 or n % 3 == 0)
        return 0;
    for(int i = 5; i*i <= n; i += 6)
        if(n % i == 0 or n % (i+2) == 0)
            return 0;
    return 1;
}
long long C(int n, int r) {
    if(r>n-r) 
        r=n-r;
    long long ans=1;
    for(int i=1;i<=r;i++){
        ans*=n-r+i;
        ans/=i;
    }
    return ans;
}
int mod = 1e9+7;
int modexpo(int x,int p){
    int res = 1;
    x = x%mod;
    while(p){
        if(p%2)
            res = res * x;
        p >>= 1;
        x = x*x % mod;
        res %= mod;
    }
    return res;
}
double l;
int32_t main()
{
    IOS;
    cin>>l,l/=3;
    cout<<fixed<<setprecision(10)<<l*l*l;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(v) v.begin(), v.end()
using ll = long long;
const ll MOD = 1e9+7; ll LLINF = 1LL << 60; int INF = INT_MAX;

//

int main(){
    string s; cin>>s;
    int cnt=0;
    rep(i,1,s.size()){
        if(s[i]!=s[i-1]) cnt++;
    }
    cout<<cnt<<endl;
}

Measured memory_bytes: 512
function Main(input) {
  input = input.split("\n");
  tmp = input[0].split("");
  real = input[1].split("");
  var answer = 0;
  for(var i=0;i<tmp.length;i++){
    if(tmp[i] === real[i]){
      answer++;
    }
  }
  console.log(answer);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
function main(input) {
  const A = parseInt(input.split(" ")[0], 10);
  const B = parseInt(input.split(" ")[1], 10);
  if(A%2==0||B%2==0){
    console.log("No");
  }else{
    console.log("Yes");
  }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));



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

using namespace std;

int main() {
    int N;
    cin >> N;
    vector<int> A(N);
    for (int i = 0; i < N; ++i) cin >> A[i];
    vector<int> S = A;
    sort(S.rbegin(), S.rend());
    for (int i = 0; i < N; ++i) {
        if (A[i] != S[0]) cout << S[0] << endl;
        else cout << S[1] << endl;
    }
    return 0;
}

Measured memory_bytes: 3200
/*
ID: wangjun30
LANG: C++11
TASK:
*/
#include<iostream>
#include<algorithm>
#include<array>
#include<unordered_map>
#include<map>
#include<set>
#include<list>
#include<stack>
#include<unordered_set>
#include<vector>
#include<bitset>
#include<queue>
#include<iomanip>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<climits>
//#include<fstream>
#define int long long
using namespace std;
//ifstream cin(".in");
//ofstream cout(".out");
signed main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	int x,ans=0;
	cin>>x;
	while(x>100){
		double KK=x/101.0*100.0;
		double CKK=ceil(KK);
		x=(int)(CKK);
		ans++;
	}
	cout<<ans;
	return 0;
}

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

int main() {
  long long N, A, B;
  cin >> N >> A >> B;

  if (A > B) {
    cout << 0 << endl;
    return 0;
  }
  if (N == 1 && A != B) {
    cout << 0 << endl;
    return 0;
  }
  if (N == 1 && A == B) {
    cout << 1 << endl;
    return 0;
  }

  long long ans = (B - A) * (N - 2) + 1;
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
#define REP(i,b,n) for(int i=b;i<n;i++)
#define rep(i,n)   REP(i,0,n)
const int N = 1000;
const int M = (1<<12);
int ans[2*N];

bool search(int n,int now,int bit,int *inp,const int m){
  if (now == n){
    rep(i,n+m-1)cout << ans[i];
    cout << endl;
    return true;
  }
  int nextbit=(bit*2)%(1<<m);
  if (__builtin_popcount(nextbit) == inp[now]){
    ans[now+m-1]=0;
    if (search(n,now+1,nextbit,inp,m))return true;
  }else if (__builtin_popcount(nextbit|1) == inp[now]){
    ans[now+m-1]=1;
    if (search(n,now+1,nextbit|1,inp,m))return true;
  }
  return false;
}

void solve(int n,int m,int *in){
  rep(i,(1<<m)){
    if (__builtin_popcount(i) == in[0]){
      for(int j=m-1;j>=0;j--){
	if (((1<<j)&i) != 0)ans[m-j-1]=1;
	else ans[m-j-1]=0;
      }
      if (search(n,1,i,in,m))return;
    }
  }
  cout <<"Goofy"<<endl;
}

main(){
  int n,m;
  static int in[N];
  while(cin>>n>>m && n){
    rep(i,n)cin>>in[i];
    rep(i,2*N)ans[i]=0;
    solve(n,m,in);
  }
  return false;
}

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

int n,W,i,j,w;
array<int,110> weight;
array<int,110> value;

//DPテーブル
array<array<int,10010>,110> dp;

int main(){
    cin>>n>>W;
    for(i=0;i<n;i++)cin>>value[i]>>weight[i];

    //DP初期条件: dp[0][w]=0
    for(w=0;w<=W;w++)dp[0][w]=0;

    //DPループ
    for(i=0;i<n;i++){
        for(w=0;w<=W;w++){
            if(w>=weight[i]){
                dp[i+1][w]=max(dp[i][w-weight[i]]+value[i],dp[i][w]);
            }else{
                dp[i+1][w]=dp[i][w];
            }
        }
    }
    cout<<dp[n][W]<<endl;
}


Measured memory_bytes: 7040
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long int ll;
const int INF = 1<<30;

int gcd(int a, int b){
  if(a>b)swap(a, b);
  if(a==0)return b;
  return gcd(b%a, a);
}

int main(){
  int n, x;cin>>n>>x;
  int ans;
  for(int i=0;i<n;i++){
  	int a;cin>>a;
    if(i==0)ans = abs(x-a);
    else ans = gcd(abs(a-x), ans);
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <iterator>
#include <cmath>
#include <set>
#include <deque> 
#include <string>


using namespace std;

const long long MOD = 1000000007;

long long n, k;
int a[2010];
int bigAll[2010];	//当前值比本节内其他值大的个数 
int bigHere[2010];	//当前值比本节内之后其他值大的个数


int main()
{
	scanf("%lld%lld", &n, &k);
	
	for (int i = 0 ; i < n ; i++)
		scanf("%d", &(a[i]));
		
	long long count = 0;
	for (int i = 0 ; i < n ; i++)
	{
		bigAll[i] = 0;
		for (int j = 0 ; j < n ; j++)
			if (a[i] > a[j])
				bigAll[i]++;
				
		bigHere[i] = 0;
		for (int j = i + 1 ; j < n ; j++)
			if (a[i] > a[j])
				bigHere[i]++;
				
		long long allCount = (((0 + (k - 1)) * k / 2) % MOD * bigAll[i]) % MOD;
		long long hereCount = k * bigHere[i] % MOD;
		
		count = (count + allCount) % MOD;
		count = (count + hereCount) % MOD;
				
	}
	

	printf("%lld\n", count);
	
	return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <cstring>

using namespace std;
#define vsort(v) sort(v.begin(), v.end());
#define asort(array) sort(array.begin(), array.end())
#define vunique(v) unique(v.begin(), v.end());
#define MAX_V 1000
#define INF 1e18
long long d[MAX_V];
struct edge {
	long long from, to, cost;
};

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int N, M;
	cin >> N >> M;
	fill(d, d + N, INF);
	d[0] = 0; // start

	edge E[M];

	for(int i = 0; i < M; i++) {
		long long a, b, c;
		cin >> a >> b >> c;
		E[i].from = a - 1;
		E[i].to = b - 1;
		E[i].cost = -c;
	}

	for(int i = 0; i < N; i++) {
		for(int j = 0; j < M; j++) {
			edge e = E[j];
			if(d[e.to] > d[e.from] + e.cost) {
				d[e.to] = d[e.from] + e.cost;
				if(i >= N - 1 && e.to == N - 1) {
					cout << "inf" << endl;
					return 0;
				}
			}
		}
	}
	cout << -d[N - 1] << endl;
}


Measured memory_bytes: 256
<?php
echo itp1_5_d(3, fgets(STDIN)) . PHP_EOL;
function itp1_5_d($i, $n){
    for($j = $i; $j <= $n; $j++){
        if($j % 3 === 0 || nepia($j))  return " " . $j . itp1_5_d($j+1, $n);
    }
}
function nepia($y){
    if($y % 10 === 3) return true;
    if($y < 10) return false;
    return nepia(intval($y/=10));
}


Measured memory_bytes: 12964
#include<iostream>
#include<vector>
#include<cmath>
#include<string>
#include<algorithm>
#include<map>
#include<utility>
#include<cstdio>
#include<bits/stdc++.h>

using namespace std;
using ll = long long;
const long long INF = 1LL<<60;

vector<ll> load[100005];

typedef pair<ll,ll> Pair;

int main(){

ll N;
vector<ll> furui(1e6);

cin >> N;

vector<ll> A(N);

for(ll i = 0;i < N;++i) cin >> A[i];

for(ll i : A){
    if(furui[i] >= 1){
         furui[i]++;
         continue;
    }
    for(ll j = i;j <= furui.size();j+=i)    furui[j]++;     
}

ll count = 0;

for(ll i = 0;i <A.size();++i){

    if(furui[A[i]] == 1) count++;

}

cout << count << endl;

return 0;

}   


Measured memory_bytes: 14812
#include <iostream>
#include <string>
#include <vector>
#include<algorithm>
#include<sstream>
using namespace std;

// m % a[i] の最大値は a[i]-1
// a[i]の最小公倍数を代入すればよい

int main() {
	int n;
	cin >> n;
	int a[n];
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	int total = 0;
	for (int i = 0; i < n; i++) {
		total += a[i];
	}
	cout << total - n << endl;

	return 0;
}

Measured memory_bytes: 256
/* author: Tarek */ 
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
typedef long double ld;
#define mp make_pair
int main()
{
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
char a;
cin>>a;
int k = (int)a;
k+=1;
cout<<(char)k<<endl;
       	return 0;
}



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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    vector<ll> A(N+1),sum(N+1,0);
    for (int i=0;i<N+1;++i) cin >> A[i];
    for (int i=N-1;i>=0;--i) sum[i]=sum[i+1]+A[i+1];
    if (N==0){
        cout << (A[0]==1?1:-1) << '\n';
        return 0;
    }
    if (A[0]!=0){
        cout << -1 << '\n';
        return 0;
    }
    ll ans=1,now=min(2LL,sum[0]);
    for (int i=1;i<N+1;++i){
        if (now<A[i]){
            cout << -1 << '\n';
            return 0;
        }
        ans+=now;
        now-=A[i];
        now=min(now*2,sum[i]);
    }
    cout << ans << '\n';
}

Measured memory_bytes: 4792
import java.io.*;
class Main {
    public static void main(String[] args) {
        try {
           BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
           int n = Integer.parseInt(reader.readLine());
           long fact = 1;
           for(int i = n;i >= 1;i--) {
                fact *= i;
           }
           System.out.println(fact);
         }
         catch(IOException e) {
          System.out.println(e);
         }
    }
}

Measured memory_bytes: 16860
#include<cstdio>
#define N 1005
#define mod 1000000007
int n,m;
char grid[N][N];
int dp[N][N];
void add(int &x,int y){x+=y;if(x>=mod)x-=mod;}
int main(){
	scanf("%d%d",&n,&m);
	for(int i=0;i<n;++i)scanf("%s",grid[i]);
	dp[0][0]=1;
	for(int i=0;i<n;++i)for(int j=0;j<m;++j){
		if(i&&grid[i-1][j]!='#')add(dp[i][j],dp[i-1][j]);
		if(j&&grid[i][j-1]!='#')add(dp[i][j],dp[i][j-1]);
	}
	printf("%d\n",dp[n-1][m-1]);
	return 0;
}

Measured memory_bytes: 5120
//#pragma GCC optimize("O3")
#include<bits/stdc++.h>
#define ll long long int
#define ull unsigned long long int
#define ld long double
#define pb push_back
#define pf pop_front
#define mp make_pair
#define mod 1000000007
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define mat vector<vector<int>>
#define all(x) x.begin(),x.end()
#define F first
#define S second
#define fo(i,n) for(int i=0;i<(n);i++)
#define inp(a) int a;cin>>a;
#define inpa(a,n)vector<int> a(n);fo(i,n)cin>>a[i];
#define printclock cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";
using namespace std;
#define int ll
#define INF (int)1e18


auto max(auto a){auto ans=a[0];for(auto i:a)if(i>ans)ans=i;return ans;}
auto min(auto a){auto ans=a[0];for(auto i:a)if(i<ans)ans=i;return ans;}
void print(auto a){for(auto i:a)cerr<<i<<' ';cerr<<'\n';}


signed main()
{
	fio
	inp(n)
	cout<<n*n<<'\n';
	printclock;
}

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


using namespace std;

const int MAX_V = 10000;

int par[MAX_V];
int p_rank[MAX_V];

void init(int n) {
    for (int i = 0; i < n; ++i) {
        par[i] = i;
        p_rank[i] = 0;
    }
}

int find_root(int x) {
    if (par[x] == x) {
        return x;
    } else {
        // update parent
        return par[x] = find_root(par[x]);
    }
}

void unite(int x, int y) {
    int x_root = find_root(x);
    int y_root = find_root(y);
    if (x_root == y_root) return;

    if (p_rank[x_root] < p_rank[y_root]) {
        par[x_root] = y_root;
    } else {
        par[y_root] = x_root;
        if (p_rank[x_root] == p_rank[y_root]) p_rank[x_root]++;
    }
}

bool same(int x, int y) {
    return find_root(x) == find_root(y);
}

struct edge { int u, v, cost; };

bool comp(const edge& e1, const edge& e2) {
    return e1.cost < e2.cost;
};

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

    int V, E;
    cin >> V >> E;

    edge es[E];
    for (int i = 0; i < E; ++i) {
        edge e{};
        cin >> e.u >> e.v >> e.cost;
        es[i] = e;
    }

    sort(es, es + E, comp);

    init(V);

    int res = 0;
    for (auto e :es) {
        if (!same(e.u, e.v)) {
            unite(e.u, e.v);
            res += e.cost;
        }
    }

    cout << res << '\n';

    return 0;
}



Measured memory_bytes: 4368
#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <numeric>
#include <algorithm>
#include <iomanip>
#define _USE_MATH_DEFINES
#include <cmath>
#include <math.h>
#include <stdio.h>
#include <tuple>
#include <thread>///////////////////

#define rep(i,m,n) for(int i=(m);i<(n);++i)
#define rem(i,m,n) for(int i=(m);i>(n);--i)
#define MOD 1000000007

using namespace std;

using ll = long long int;
using std::swap;

vector<int> v;
vector<int> w;
vector<long long int> vll;
vector<long long int> wll;
//vector<vector<int>> vec(50, vector<int>(4, 0));
vector<vector<int>> vv;

//int N, Y;
int mode = 0;

//tuple<int, int, int> calc(int A, int B, int C) {}



int main() {
	double A, B;
	cin >> A >> B;
	rep(i, 10, 1251) {
		double X,Y;
		X = i*0.08;
		Y = i*0.1;
		//cout << X << " " << Y << '\n';
		X = floor(X);
		Y = floor(Y);
		
		if (X == A && Y == B) {
			cout << i << '\n'; 
			return 0;
		}
	}
	cout << "-1" << '\n';
	return 0;
}

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

namespace C
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] nm = RArInt();
            int[][] joint = new int[nm[1]][];

            for (int i = 0; i < nm[1]; i++)
            {
                joint[i] = RArInt().Skip(1).Select(x => x - 1).ToArray();
            }

            int[] status = RArInt();

            int res = 0;
            for (int i = 0; i < (1 << nm[0]); i++)
            {
                if (IsOKPtn(i, joint, status)) res++;
            }
            Console.WriteLine(res);

        }

        private static bool IsOKPtn(int ptn, int[][] joint, int[] status)
        {
            for (int i = 0; i < joint.Count(); i++)
            {
                int cnt = 0;
                for (int k = 0; k < joint[i].Length; k++)
                {
                    if (((ptn >> joint[i][k]) & 1) == 1) cnt++;
                }
                if (cnt % 2 != status[i]) return false;
            }

            return true;
        }

        static string RSt() { return Console.ReadLine(); }
        static int RInt() { return int.Parse(Console.ReadLine().Trim()); }
        static long RLong() { return long.Parse(Console.ReadLine().Trim()); }
        static double RDouble() { return double.Parse(Console.ReadLine()); }
        static string[] RArSt(char sep = ' ') { return Console.ReadLine().Trim().Split(sep); }
        static int[] RArInt(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => int.Parse(e)); }
        static long[] RArLong(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => long.Parse(e)); }
        static double[] RArDouble(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => double.Parse(e)); }
        static string WAr<T>(IEnumerable<T> array, string sep = " ") { return string.Join(sep, array.Select(x => x.ToString()).ToArray()); }
    }
}


Measured memory_bytes: 13524
#include <set>
#include <vector>
#include <iostream>
using namespace std;

int main() {
	int n;
	cin >> n;
	vector<int> a(n);
	vector<int> pos(n);
	set<int> s;
	
	for(int i = 0; i < n; i++){
		cin >> a[i];
		pos[a[i]-1] = i;
	}
	
	s.insert(-1);
	s.insert(n);
	
	unsigned long long ans = 0;
	
	for(int i = 0; i < n; i++){
		auto ite = s.lower_bound(pos[i]);
		int r = *ite - pos[i];
		int l = pos[i] - *(--ite);
		ans += (long long)r * l * (i+1);
		s.insert(pos[i]);
	}
	
	cout << ans << endl;
	
	return 0;
}

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

typedef long long int ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector< pair<int,int> > vpii;
typedef vector< pair<ll,ll> > vpll;
typedef vector< vector<int> > matrix;

#define SET(Ar,val) memset(Ar,val,sizeof(Ar))
#define rep(i,val,n)  for(int i=val;i<n;i++)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define LMAX LONG_LONG_MAX
#define LMIN LONG_LONG_MIN
#define IMAX INT_MAX
#define IMIN INT_MIN
#define M 1000000007

/*--------------------------------------------------------------------------------------------------------------------------------*/

template <class T> T modpower(T a,T b,T MOD)
{
    T ans=1;
    while(b!=0)
    {
        if(b%2==1)
        ans=(ans*a)%MOD;
        a=(a*a)%MOD;
        b/=2;
    }
    return ans;
}

void init()
{
    int a,b,c;
    cin >> a >> b >> c ;
    if(a+b>=c)
        cout << "Yes";
    else
        cout << "No";
}

int main()
{
    clock_t time1=clock();
	/*#ifndef ONLINE_JUDGE
	//freopen("abc_091.in","r",stdin);
	#else
	//ONLINE_JUDGE
	#endif*/
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
    init();
    clock_t time2 = clock();
    cerr <<"Time: " <<(double)(time2-time1)/CLOCKS_PER_SEC <<" seconds" <<endl;
	return 0;
}


Measured memory_bytes: 256
let rec f a b c =
  if a mod 2 + b mod 2 + c mod 2 > 0 then 0
  else if a = b && b = c then -1
  else 1 + f (b/2+c/2) (c/2+a/2) (a/2+b/2)
let _ = Printf.printf "%d\n" @@ Scanf.scanf "%d %d %d" f


Measured memory_bytes: 384
#!/usr/bin/env python3
import sys

def main():
    N, M, K = map(int, input().split())
    p = 998244353

    # n-1Crとmの開錠を計算する
    X = max(N,M)+1
    a = [None] * X
    inva = [None] * X
    a[0] = 1

    for i in range(1, X):
        a[i] = i * a[i-1] % p

    inva[X-1] = pow(a[X-1],p-2,p)
    for i in range(X-1):
        inva[X-i-2] = inva[X-i-1] * (X-i-1) % p

    ans = 0
    for i in range(K+1):
        tmp = (a[N-1] * inva[i] % p) * inva[N-1-i] % p
        tmp = tmp * (M * pow(M-1,N-i-1,p) % p) % p 
        ans = (ans + tmp) % p
    print(ans % p)

if __name__ == '__main__':
    main()


Measured memory_bytes: 24676
#include<bits/stdc++.h>
using namespace std;
int H,heap[2000001];
void maxHeapify(int i){
    int l,r,largest;
    l = i * 2;
    r = i * 2 + 1;
    if( l <= H && heap[l] > heap[i] ) largest = l;
    else largest = i;
    if( r <= H && heap[r] > heap[largest] ) largest = r;

    if( largest != i ){
        swap(heap[i],heap[largest]);
        maxHeapify(largest);
    }
}
int main(){
    scanf("%d",&H);
    for( int i = 1; i <= H; ++i ) scanf("%d",&heap[i]);
    for( int i = H/2; i >= 1; --i ) maxHeapify(i);
    for( int i = 1; i <= H; ++i ) printf(" %d",heap[i]);
    puts("");
    return 0;
}



Measured memory_bytes: 5080
//Lamp 

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define int long long
#define rep(i,x,y) for(ll i=x;i<y;i++)
#define nvarep(n,a) ll n;cin>>n;vector<ll>a(n);rep(i,0,n)cin>>a[i]
#define vecrep(n,a,type) vector<type>a(n);rep(i,0,n)cin>>a[i]
#define YN(flag) (flag?"Yes":"No")
#define lcm(a,b) (a/__gcd(a, b)*b)
#define range(a) (a).begin(),(a).end() 
#define pb push_back
#define mp make_pair
#define nnn "\n"
#define spa " "
using p = pair<ll,ll>;
using graph = vector<vector<ll>>;
const int inf = 2147483647;//2*10^9
const ll INF = 9223372036854775807;//9*10^18

vector<string> pictureframe(vector<string> md,char fm){
    int w=md[0].size();
    int h=md.size();
    string s(w+2,fm);
    vector<string>picfm(h+2,s);
    rep(i,1,h+1)rep(j,1,w+1)picfm[i][j]=md[i-1][j-1];
    return picfm;
}

signed main (){
    int h,w,ans=0;cin>>h>>w;
    vector<string>s(h);
    rep(i,0,h)cin>>s[i];
    s=pictureframe(s,'#');
    vector<vector<int>>r(h+2,vector<int>(w+2,0))
                      ,l(h+2,vector<int>(w+2,0))
                      ,u(h+2,vector<int>(w+2,0))
                      ,d(h+2,vector<int>(w+2,0));
    rep(i,1,h+1)rep(j,1,w+1){
        if(s[i][j]=='.')l[i][j]=l[i][j-1]+1;
        if(s[i][j]=='.')u[i][j]=u[i-1][j]+1;
    }
    for(int i=h;i>=1;i--)for(int j=w;j>=1;j--){
        if(s[i][j]=='.')r[i][j]=r[i][j+1]+1;
        if(s[i][j]=='.')d[i][j]=d[i+1][j]+1;
    }
    rep(i,1,h+1)rep(j,1,w+1)ans=max(ans,l[i][j]+r[i][j]+d[i][j]+u[i][j]-3);
    cout<<ans<<nnn;
    return 0;
}

Measured memory_bytes: 132768