akhauriyash/Code-Regression huggingface dataset:
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
use std::io::{Write, BufWriter};
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    ($($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)*}
    };
}

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

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

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

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

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

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

fn solve() {
    let M:i64 = 1_000_000_007;
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($($format:tt)*) => (write!(out,$($format)*).unwrap());
    }
    input! {
        n: usize,
        m: usize,
        a: [usize; m],
    }
    let mut dp = vec![0; n+1];
    dp[0] = 1;
    dp[1] = 1;
    for i in 0..m{
        dp[a[i]] = -1;
        if(a[i]<=1){
            dp[a[i]] = 0;
        }
    }
    for i in 2..n+1{
        if(dp[i]==-1) {
            dp[i] = 0;
            continue;
        }
        dp[i] = dp[i-1] + dp[i-2];
        dp[i] %= M;
    }
    puts!("{}",dp[n]);
}

fn main() {
    // In order to avoid potential stack overflow, spawn a new thread.
    let stack_size = 104_857_600; // 100 MB
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}


Measured memory_bytes: 10492
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;

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

  string s1,s2,s3;
  cin >> s1 >> s2 >> s3;

  s1 = toupper(s1.at(0));
  s2 = toupper(s2.at(0));
  s3 = toupper(s3.at(0));
  cout << s1 << s2 << s3 << endl;
  return 0;
}


Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  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 "bits/stdc++.h"

#define REP(i,num) for(int i=0;i<(num);++i)
#define LOOP(i) while(i--)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto pitr=c.begin();pitr!=c.end();++pitr){cout<<*pitr;if(next(pitr,1)!=c.end())cout<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){ T x; cin >> x; return (x); }
template<typename T=int,typename C=vector<T>>
C vecin(int N){ C x(N);REP(i,N){ x[i]=in<T>(); }return move(x); }

void vout(){ cout << endl; }
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){ cout << ' ' << h;vout(forward<Tail>(t)...); }
void out(){ cout << endl; }
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){ cout << h;vout(forward<Tail>(t)...); }

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);

	int N=in();
	vector<pair<int,int>> P(N);
	REP(i,N){
		int X=in(),L=in();
		P[i].first=X-L;
		P[i].second=X+L;
	}
	sort(ALL(P),PAIRCOMP(second,<));
	int R=-(2*atcoder_mod),S=0;
	REP(i,N){
		if(R<=P[i].first){
			R = P[i].second;
			S++;
		}
	}
	out(S);
	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define pr(s) std::cout << s << std::endl
#define prb(s) std::cout << s
using namespace std;


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


  int n;
  cin >> n;

  pr((n >= 1000 ? "ABD" : "ABC"));

  return 0;
}


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

#define M_PI       3.14159265358979323846   // pi

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> VI;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> t3;
typedef tuple<ll, ll, ll, ll> t4;
typedef tuple<ll, ll, ll, ll, ll> t5;

#define rep(a,n) for(ll a = 0;a < n;a++)
#define repi(a,b,n) for(ll a = b;a < n;a++)

using namespace std;

static const ll INF = 1e15;

int main() {
	int n, q;
	cin >> n >> q;
	vector<vector<int>> g(n);
	rep(i, n - 1) {
		int a, b;
		cin >> a >> b;
		a--; b--;
		g[a].push_back(b);
		g[b].push_back(a);
	}
	vector<ll> add(n, 0);
	rep(i, q) {
		ll a, v;
		cin >> a >> v;
		a--;
		add[a] += v;
	}
	vector<ll> score(n, 0);
	function<void(int, int, int)> dfs = [&](int current, int parent, ll s) {
		ll cs = s + add[current];
		score[current] = cs;
		for (auto child : g[current]) {
			if (child == parent) continue;
			dfs(child, current, cs);
		}
	};
	dfs(0, -1, 0);
	rep(i, n) {
		cout << score[i] << " ";
	}
	cout << endl;
	return 0;
}


Measured memory_bytes: 39108
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val numbers = mutableListOf<Int>()
    for (i in 0 until n) {
        numbers.add(readLine()!!.toInt())
    }

    val maxNumber = numbers.fold(initial = 0, operation = { a, b -> Math.max(a,b)})
    val maxNumberCount = numbers.filter { it == maxNumber }.size

    val sortedNumbers = numbers.sorted().reversed()

    for (i in 0 until n) {
        if (numbers[i] < maxNumber) {
            println(maxNumber)
        } else if (numbers[i] == maxNumber){
            if (maxNumberCount > 1) {
                println(maxNumber)
            } else {
                println(sortedNumbers[1])
            }
        }
    }
}

Measured memory_bytes: 61548
#include <iostream>
using namespace std;
int main(void){
    int a,b,c,d;
    cin >> a >> b >> c >>d;
    if(c-a<=d && c>a){
        cout << "Yes" << endl;
    }else if(a-c<=d && a>c){
        cout << "Yes" << endl;
    }else if(a<=b && b<=c && b-a<=d && c-b<=d){
        cout << "Yes" << endl;
    }else if(c<=b && b<=a && a-b<=d && b-c<=d){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <queue>
#include <cstring>
#include <vector>
using namespace std;
int t[200005][2];
vector<int> g[200005];
bool used[200005];
queue<int> v;
int main() {
  int n,m;
  string s;
  cin >> n >> m >> s;
  for(int i = 0; i < m; i++) {
    int a,b;
    cin >> a >> b;
    a--,b--;
    g[a].push_back(b);
    g[b].push_back(a);
    if(s[a] == 'A') t[b][0]++;
    if(s[a] == 'B') t[b][1]++;
    if(s[b] == 'A') t[a][0]++;
    if(s[b] == 'B') t[a][1]++;
  }
  for(int i = 0; i < n; i++) {
    if(t[i][0] == 0 || t[i][1] == 0) {
      v.push(i);
      used[i] = true;
    }
  }
  int ans = v.size();
  // cout << ans << endl;
  while(!v.empty()) {
    int u = v.front();
    v.pop();
    int tmp = s[u] - 'A';
    for(int i = 0; i < g[u].size(); i++) {
      int e = g[u][i];
      t[e][tmp]--;
      if((t[e][0] == 0 || t[e][1] == 0) && !used[e]) {
	v.push(e);
	ans++;
	used[e] = true;
      }
    }
  }
  // cout << ans << endl;
  if(ans == n) cout << "No" << endl;
  else cout << "Yes" << endl;
}

  
  


Measured memory_bytes: 12548
#include <cstdio>
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define all(a) (a).begin(), (a).end()

using ll = long long;

constexpr ll mod = 998244353, MAX_N = 300000;

ll N, A, B, K;
ll fact[MAX_N+5], inv[MAX_N+5];

ll powMod( ll a, ll b )
{
  ll ret = 1;

  while( b > 0 )
  {
    if( b & 1 )
      ret = (ret*a) % mod;

    a = (a*a) % mod;
    b >>= 1;
  }

  return ret;
}

int main()
{
  scanf( "%lld%lld%lld%lld", &N, &A, &B, &K );

  fact[0] = 1;
  rep( i, N )
    fact[i+1] = (i+1)*fact[i] % mod;

  rep( i, N+1 )
    inv[i] = powMod( fact[i], mod-2 );

  ll ans = 0;
  for( ll x = 0; A*x <= K && x <= N; ++x ) if( (K-A*x) % B == 0 )
  {
    ll y = (K-A*x)/B;

    if( y > N )
      continue;

    ans = (ans + fact[N]*inv[N-x]%mod*inv[x]%mod*fact[N]%mod*inv[N-y]%mod*inv[y]%mod ) % mod;
  }

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

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

int main(){
	string S;
	unsigned long K;
	cin>>S>>K;
	char ans='1';
	for(unsigned long i=0;i<K;++i){
		if(S[i]!='1'){
			ans=S[i];
			break;
		}
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#define N 5

using namespace std;
void output_array_int(int*,int,char);
void input_array_int(int*,int);

int main(){
  int W,H,x,y,r;

  cin>>W>>H>>x>>y>>r;

  if(W>=x+r&&x-r>=0&&H>=y+r&&y-r>=0){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }

  return 0;
}

void output_array_int(int * a,int n,char ch){
  int i;

  for(i=0;i<n;i++){
    cout<<*(a+i);
    if(i<(n-1)){
      cout<<ch;
    }
  }

  cout<<endl;

  return;
}

void input_array_int(int *a,int n){
  int i;

  for(i=0;i<n;i++){
    cin>>*(a+i);
  }
}

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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

ll N,A,B;
ll H[101010];

int ok(ll num) {
	ll tot=0;
	int i;
	FOR(i,N) {
		ll left=H[i]-num*B;
		if(left>0) tot+=(left+A-1)/A;
	}
	return tot<=num;
}

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N>>A>>B;
	A-=B;
	FOR(i,N) cin>>H[i];
	ll ret=(1LL<<30)-1;
	for(i=29;i>=0;i--) if(ok(ret-(1LL<<i))) ret -= 1LL<<i;
	cout<<ret<<endl;
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n';
	FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	solve(); return 0;
}


Measured memory_bytes: 1024
import java.io.IOException;
import java.util.Arrays;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) throws IOException {
        // write your code here
        Scanner sc = new Scanner(System.in);
        int[] n = Arrays.stream(sc.nextLine().split(" ", 0)).mapToInt(x -> Integer.parseInt(x)).toArray();

        boolean b = false;
        if (n[0] + n[1] == n[2]) {
            System.out.println("Yes");
            b = true;
        } else if (n[1] + n[2] == n[0]) {
            System.out.println("Yes");
            b = true;
        } else if (n[0] + n[2] == n[1]) {
            System.out.println("Yes");
            b = true;
        }

        if (!b) {
            System.out.println("No");
        }
    }
}


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

const int MAXN = 400;
const int R = 4;
const int W = 7;
const int di[] = {0,1,0,-1};
const int dj[] = {1,0,-1,0};
int N;
int F[MAXN][R][R];
bool dp[MAXN][R][R][W][W][W][W];

int main() {
  while(cin >> N && N) {
    for(int k = 0; k < N; ++k)
      for(int i = 0; i < R; ++i)
        for(int j = 0; j < R; ++j)
          cin >> F[k][i][j];
    memset(dp, 0, sizeof(dp));
    dp[0][1][1][0][0][0][0] = 1;
    bool ok = false;
    for(int k = 0; k < N; ++k)
      for(int i = 0; i < R; ++i)
        for(int j = 0; j < R; ++j)
          for(int a = 0; a < W; ++a)
            for(int b = 0; b < W; ++b)
              for(int c = 0; c < W; ++c)
                for(int d = 0; d < W; ++d) {
                  if(!dp[k][i][j][a][b][c][d]) continue;
                  for(int s = 0; s < 4; ++s)
                    for(int l = 0; l <= 2; ++l) {
                      if(k == 0 && l) continue;
                      int ni = i + di[s] * l;
                      int nj = j + dj[s] * l;
                      if(ni < 0 || ni + 1 >= R) continue;
                      if(nj < 0 || nj + 1 >= R) continue;
                      if(F[k][ni][nj]) continue;
                      if(F[k][ni][nj+1]) continue;
                      if(F[k][ni+1][nj]) continue;
                      if(F[k][ni+1][nj+1]) continue;
                      int na = (ni == 0 && nj == 0 ? 0 : a + 1);
                      int nb = (ni == 0 && nj+1 == R-1 ? 0 : b + 1);
                      int nc = (ni+1 == R-1 && nj == 0 ? 0 : c + 1);
                      int nd = (ni+1 == R-1 && nj+1 == R-1 ? 0 : d + 1);
                      if(max(max(na,nb),max(nc,nd)) >= W) continue;
                      dp[k+1][ni][nj][na][nb][nc][nd] = true;
                      if(k+1 == N) ok = true;
                    }
                }
    cout << ok << endl;
  }
  return 0;
}

Measured memory_bytes: 16200
enki_list_1 = ["A","T"]
enki_list_2 = ["C","G"]

b = input()
if (b=="A") or (b=="T"):
  enki_list_1.remove(b)
  print(enki_list_1[0])
else:
  enki_list_2.remove(b)
  print(enki_list_2[0])

Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
int main(){
  ll N,M,R; cin>>N>>M>>R;
  vector<ll>X;
  for(int i=0; i<R; i++){
    ll r; cin>>r; X.push_back(r);
  }
  vector<vector<ll>>Z(N+1, vector<ll>(N+1,1e10));
  for(int i=0; i<M; i++){
    ll a,b,c; cin>>a>>b>>c;    
    Z[a][b]=c;
    Z[b][a]=c;
  }
  for(int i=0; i<=N; i++) Z[i][i]=0;
  for(int i=1; i<=N; i++){
    for(int j=1; j<=N; j++){
      for(int k=1; k<=N; k++){
        if(Z[j][i]==1e10 || Z[i][k]==1e10)continue;
        Z[j][k]=min(Z[j][k],Z[j][i]+Z[i][k]);
      }
    }
  }
  sort(X.begin(), X.end());
  ll ans=1e11;
  do{
    ll temp=0;
    for(int i=0; i<X.size()-1; i++){
      temp+=Z[X[i]][X[i+1]];
    }
    ans=min(ans,temp);
  }while(next_permutation(X.begin(), X.end()));
  cout<<ans<<endl;
}

Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
#include <queue>
#include <iterator>
#include <set>

using namespace std;

int N;
int p[50];

bool isSorted() {
    for (int i = 0; i < N - 1; ++i) {
        if(p[i] > p[i + 1]) return false;
    }    
    return true;
}

bool solve() {
    if (isSorted()) {
        return true;
    }
    for (int i = 0; i < N; ++i) {
        for (int j = i + 1; j < N; j++) {
            swap(p[i], p[j]);
            if(isSorted()) return true;
            else swap(p[i], p[j]);
        }
    }
    return false;
}

int main()
{
    cin >> N;
    for (int i = 0; i < N; ++i) {
        cin >> p[i];
    }
    if (solve()) {
        cout << "YES" << endl;
    }
    else {
        cout << "NO" << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
typedef long long LL;
int main() {
	int n = 0;
	std::cin >> n;
	if (n == 0 || n == 1 || n == 2) { std::cout << '1'<< std::endl; return 0; }
	for (int i = 1; i < n; i++) {
		if (i*i == n) {
			std::cout << i*i << std::endl;
			return 0;
		}
		else if (i*i > n) {
			std::cout << (i - 1)*(i - 1) << std::endl;
			return 0;
		}
	}
}

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

int n,s,t,cnt,ans; string S;
vector<pair<int,int>> trains;
vector<int> unit={36000,3600,0,600,60,0,10,1};
multiset<int> waiting;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    while(cin >> n,n){
        trains.clear();
        for (int i=0;i<n;++i){
            for (int j=0;j<2;++j){
                cin >> S; cnt=0;
                for (int k=0;k<8;++k){
                    if (k%3==2) continue;
                    cnt+=(S[k]-'0')*unit[k];
                }
                (!j?s:t)=cnt;
            }
            trains.emplace_back(s,t);
        }
        sort(trains.begin(),trains.end());
        waiting.clear();
        ans=0;
        for (int i=0;i<n;++i){
            auto itr=waiting.upper_bound(trains[i].first);
            if (itr==waiting.begin()) ++ans;
            else {waiting.erase(--itr);}
            waiting.insert(trains[i].second);
        }
        cout << ans << '\n';
    }
}


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


int main(){
    int n;
    cin >> n;
    vector<int> l(n*2);
    rep(i,2*n){
        cin >> l[i];
    }
    int sum = 0;
    sort(l.begin(),l.end());
    rep(i,2*n){
        if(i%2==0) sum += l[i];
    }
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 3620
import java.util.Scanner;

public class Main {

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

		int n = sc.nextInt();
		int m = sc.nextInt();
		int[][] A = new int[n][m];
		int[][] b = new int[m][1];
		int[][] c = new int[n][1];

		A = inputMat(A);
		b = inputMat(b);

		vec_multi(A, b, c);
		sc.close();


	}

	private static int[][] inputMat(int[][] a) {
		int[][] mat = new int[a.length][a[0].length];

		for (int i = 0; i < a.length; i++) {
			for (int j = 0; j < a[0].length; j++) {
				mat[i][j] = sc.nextInt();
			}
		}

		return mat;
	}

	private static void vec_multi(int[][] a, int[][] b, int[][] c) {

		for (int i = 0; i < c.length; i++) {
			for (int j = 0; j < a[0].length; j++) {
				c[i][0] += a[i][j] * b[j][0];
			}
		}

		for (int i = 0; i < c.length; i++) {
			System.out.println(c[i][0]);
		}

	}


}



Measured memory_bytes: 40728
#include <iostream>

#define MAX 100005
#define NIL -1

using namespace std;

struct Node
{
    int parent;
    int depth;
    int height;
    int left;
    int right;
};

struct Node T[MAX];
int n;

void setDepth(int u, int d){
    if(u==NIL) return;
    T[u].depth = d;
    if(T[u].right != NIL) setDepth(T[u].right, d+1);
    if(T[u].left != NIL) setDepth(T[u].left, d+1);
}

int setHeight(int u){
    int h1=0, h2=0;
    if(T[u].right != NIL) h1 = setHeight(T[u].right)+1;
    if(T[u].left != NIL) h2 = setHeight(T[u].left)+1;
    return T[u].height = (h1>h2 ? h1:h2);
}

int getSibling(int u){
    if(T[u].parent == NIL) return NIL;
    if(T[T[u].parent].left!=u && T[T[u].parent].left != NIL) return T[T[u].parent].left;
    if(T[T[u].parent].right!=u && T[T[u].parent].right != NIL) return T[T[u].parent].right;
    return NIL;
}

void preOrder(int u){
    if(u == NIL) return;
    cout << " " << u;
    preOrder(T[u].left);
    preOrder(T[u].right);
}

void inOrder(int u){
    if(u == NIL) return;
    inOrder(T[u].left);
    cout << " " << u;
    inOrder(T[u].right);
}

void postOrder(int u){
    if(u == NIL) return;
    postOrder(T[u].left);
    postOrder(T[u].right);
    cout << " " << u;
}

void printNode(int u){
    int i,c;
    cout << "node " << u << ": ";
    cout << "parent = " << T[u].parent << ", ";
    cout << "sibling = " << getSibling(u) << ", ";
    int deg = 0;
    if(T[u].left != NIL) deg++;
    if(T[u].right != NIL) deg++;
    cout << "degree = " << deg << ", ";
    cout << "depth = " << T[u].depth << ", ";
    cout << "height = " << T[u].height << ", ";

    if(T[u].parent == NIL) cout << "root" << endl;
    else  if(T[u].left == NIL && T[u].right == NIL) cout << "leaf" << endl;
    else cout << "internal node" << endl;



}

int main(){
    int v,l,r,root=0;
    cin >> n;
    for(int i=0; i<n; ++i) T[i].parent = NIL;

    for(int i=0; i<n; ++i){
        cin >> v >> l >> r;
        T[v].left = l;
        T[v].right = r;
        if( l != NIL) T[l].parent = v;
        if( r != NIL) T[r].parent = v;
    }

    for(int i = 0; i<n;++i){
        if(T[i].parent == NIL) root = i;
    }

    cout << "Preorder" << endl;
    preOrder(root);
    cout << endl;
    cout << "Inorder" << endl;
    inOrder(root);
    cout << endl;
    cout << "Postorder" << endl;
    postOrder(root);
    cout << endl;

    return 0;

}


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

int main(){
  double x1,y1,r1,x2,y2,r2,ans;
  int n;
  cin >> n;
  while(n--){
    cin >> x1 >> y1 >> r1 >> x2 >> y2 >> r2;
    double len = sqrt(pow(x1-x2,2) + pow(y1-y2,2));
    if( len + r2 < r1){
      ans = 2;
    } else if(len + r1 < r2){
      ans = -2;
    } else if(len <= r1 + r2){
      ans = 1;
    } else {
      ans = 0;
    }
    cout << ans << endl;
  }
}

Measured memory_bytes: 1280
#include <stdlib.h>
#include <stdio.h>
 
int main ( void ) {
    int i = 0;
 
    for (i = 0; i < 4; i++) {
         putchar(getchar());
    }
 
    putchar(' ');
 
    int c = getchar();
    while (c != '\n' && c != EOF) {
         putchar(c);
         c = getchar();
    } 
    putchar('\n');
 
    return EXIT_SUCCESS;
}


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

using namespace std;
typedef long long ll;

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

ll N, K, Q;
ll score[100005];
ll A[100005];

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

	rep(i, N) {
		score[i] = -Q + K;
	}

	rep(i, Q) {
		ll a;
		cin >> a;
		a--;
		score[a]++;
	}

	rep(i, N) {
		if(score[i] > 0) {
			cout << "Yes" << endl;
		} else {
			cout << "No" << endl;
		}
	}

}

Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  map<int,int> mp;
  for(int i=0;i<n;i++){
    int a;
    cin>>a;
    mp[a]++;
  }
  cin>>n;
  for(int i=0;i<n;i++){
    int a;
    cin>>a;
    mp[a]--;
    if(mp[a]<0){
      cout<<"NO"<<endl;
      return 0;
    }
  }
  cout<<"YES"<<endl;
}

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

#include <algorithm>
#include <cassert>
#include <cfloat>
#include <complex>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define Lower_bound(v, x) \
  distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) \
  distance(v.begin(), upper_bound(v.begin(), v.end(), x))

using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;
using T = tuple<ll, ll, ll>;
using vll = vector<ll>;
using vP = vector<P>;
using vT = vector<T>;
using vvll = vector<vector<ll>>;
using vvP = vector<vector<P>>;
using dqll = deque<ll>;

ll dx[9] = {-1, 1, 0, 0, -1, -1, 1, 1, 0};
ll dy[9] = {0, 0, -1, 1, -1, 1, -1, 1, 0};

const ll INF = 1LL << 50;

static const long long mod = 1000000007;

const ll tS = 1LL << 20;

vll sT(tS, (1LL << 31) - 1);

void update(ll i, ll x) {
  i += tS / 2;
  sT[i] = x;
  while (true) {
    i /= 2;
    if (i == 0) break;
    sT[i] = min(sT[2 * i], sT[2 * i + 1]);
  }
}

ll find(ll l, ll r) {
  ll ans = INF;
  l += tS / 2;
  r += tS / 2 + 1;
  while (l < r) {
    if (l % 2 == 1) {
      chmin(ans, sT[l]);
      l++;
    }
    l /= 2;
    if (r % 2 == 1) {
      chmin(ans, sT[r-1]);
      r--;
    }
    r /= 2;
  }
  return ans;
}

int main() {
  ll n, q;
  cin >> n >> q;

  rep(i, q) {
    ll c, x, y;
    cin >> c >> x >> y;
    if (c == 0)
      update(x, y);
    else
      cout << find(x, y) << endl;
  }

  return 0;
}



Measured memory_bytes: 10832
N, K = map(int, input().split())
A = list(map(int, input().split()))

class Bit:
    def __init__(self, n):
        self.size = n
        self.tree = [0] * (n + 1)

    def sum(self, i):
        ret = 0
        while i > 0:
            ret += self.tree[i]
            i -= i & -i
        return ret

    def add(self, i, x):
        while i <= self.size:
            self.tree[i] += x
            i += i & -i

inter = 0
for i in range(N):
    ai = A[i]
    for j in range(i + 1):
        aj = A[j]
        if ai > aj:
            inter += 1

bit = Bit(2000)

intra = 0
for i in range(len(A)):
    a = A[i]
    bit.add(a, 1)
    intra += i + 1 - bit.sum(a)

# print(inter, intra)

mod = 10**9 + 7

ans = (intra * K * (K + 1) // 2) % mod
ans += (inter * (K - 1) * K // 2) % mod
print(ans % mod)


Measured memory_bytes: 41692
#include <iostream>
#include<bits/stdc++.h>
#include<string>
using namespace std;
string s = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
void shift(int n){
    for(int i=0;i <26;++i){
        int cnt = 0;
        char ch=s[i];
        while (cnt<n){
            if(ch=='Z'){
                ch='A';
            }
            else {++ch;}
            cnt++;
}
    s[i]=ch;
}
}


int main()
{
    int n;
    string ss;
    cin>> n>>ss;
    shift(n);
    for (int i=0; i< ss.size(); ++i){
        cout<<s[ss[i]-'A'];
    }}



Measured memory_bytes: 256
import java.util.*;

class Range {
    public static void main(String...args) {
        final Scanner sc = new Scanner(System.in);
        final int a = sc.nextInt();
        final int b = sc.nextInt();
        final int c = sc.nextInt();
        System.out.println(a < b && b < c ? "Yes" : "No");
    }
}
public class Main {
    public static void main(String... args) {
        Range.main();
    }
}

Measured memory_bytes: 17304
//Radhe Radhe
#include<bits/stdc++.h>
#define ll long long
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define mod 1000000007
using namespace std;

int main()
{
    fast_io
    ll a;
    cin>>a;
    cout<<3*a*a<<endl;
   return 0;
}





Measured memory_bytes: 3640
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
 int A,B,C;
  cin>>A>>B>>C;
  int temp=A-B;
  if(temp>=C)
    cout<<0<<endl;
  else
    cout<<C-temp<<endl;
  return 0;
}


Measured memory_bytes: 256
import sys
from collections import defaultdict

def ip():
    return sys.stdin.readline()


def ipl():
    return sys.stdin.readline().split()


def solve():
    x, n = map(int, ipl())
    li = list(map(int, ipl()))
    freq = defaultdict(int)
    for i in li:
        freq[i] = 1
    i, j = x, x
    while freq[i]:
        i -= 1
    while freq[j]:
        j += 1
    if abs(i - x) < abs(j - x):
        print(i)
    elif abs(i - x) == abs(j - x):
        print(min(i, j))
    else:
        print(j)


if __name__ == "__main__":
    solve()

Measured memory_bytes: 64908
#include<bits/stdc++.h>
using namespace std;
vector<int> prime;
vector<bool> tmp(100004, true);
void sieve(){
	for(int i=2;i*i<100004;i++){
		if(tmp[i]){
			for(int j=i*i;j<100004;j+=i) tmp[j] = false;
		}
	}
	for(int i=2;i<100004;i++) if(tmp[i]) prime.push_back(i);
}

int main(){
  ios_base::sync_with_stdio(0); cin.tie(0);
  sieve();
  int n; cin >> n;
  auto idx = lower_bound(prime.begin(), prime.end(), n);
  cout << prime[idx-prime.begin()] << "\n";
  return 0;
}

Measured memory_bytes: 384
n = int(input())
w = list(map(int, input().split()))

s = sum(w)
k = 0
i = 0
while(True):
    k += w[i]
    if k >= s / 2:
        x = i
        break
    i += 1

l = k - w[x]
a = min(abs(s/2 - k), abs(s/2 - l))
ans = a * 2
print(int(ans))



    






    









                                        




    




        


    







        



Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define vlli vector<ll>
#define vi vector<int>
#define vs vector<string>
#define vplli vector< pair< ll,ll> >
#define plli pair< ll,ll >
#define vps vector< pair< string, string> >
#define vpi vector< pair< int, int> >
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define fast ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define forn(i,a,n) for(ll i=a;i<n;i++)
#define forr(i,n,a) for(ll i=n-1;i>=a;i--)
#define scan(arr,a,n) for(ll i=(a);i<(n);i++)cin>>(arr)[i];
#define print(arr,a,n) for(ll i=(a);i<(n);i++)cout<<(arr)[i]<<" ";

const ll inf = 1e18;

ll add(ll x, ll y) {ll res = x + y; return (res >= mod ? res - mod : res);}
ll mul(ll x, ll y) {ll res = x * y; return (res >= mod ? res % mod : res);}
ll sub(ll x, ll y) {ll res = x - y; return (res < 0 ? res + mod : res);}
ll power(ll x, ll y) {ll res = 1; x %= mod; while (y) {if (y & 1)res = mul(res, x); y >>= 1; x = mul(x, x);} return res;}
ll mod_inv(ll x) {return power(x, mod - 2);}


int main(){
    fast;
    #ifndef ONLINE_JUDGE
    freopen("input1.txt","r",stdin);
    freopen("output1.txt","w",stdout);
    #endif
    ll n;
    cin>>n;
    ll a, b, x = 0, mx = 0;
    forn(i, 0, n){
        cin>>a>>b;
        if(a==b)x++;
        else x=0;
        mx = max(mx, x);
    }
    //cout<<mx<<endl;
    if(mx>2){
        cout<<"Yes"<<endl;
    } else {
        cout<<"No"<<endl;
    }
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define MM 1000000000
#define mod MM+7
#define INF (ll)1e18
#define PI acos(-1.0)
#define NIL -1
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};
int digit(ll m){
    if(1 <= m && m < 10) return 1;
    else if(10 <= m && m < 100) return 2;
    else if(100 <= m && m < 1000) return 3;
    else if(1000 <= m && m < 10000) return 4;
    else if(10000 <= m && m < 100000) return 5;
    else if(100000 <= m && m < 1000000) return 6;
    else if(1000000 <= m && m < 10000000) return 7;
    else if(10000000 <= m && m < 100000000) return 8;
    else if(100000000 <= m && m < 1000000000) return 9;
    else return 10;
}
int main(){
    ll n; cin >> n;
    int ans = digit(n);
    for(ll i = 1LL; i*i <= n; i++){
        if(n%i != 0) continue;
        if(n%i == 0){
            ll k = n/i;
            int mx = max(digit(i),digit(k));
            ans = min(mx, ans);
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
import sys


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    n = int(readline())
    cnt = 0
    for i in range(1, n // 2 if n % 2 == 0 else n // 2 + 1):
        if n - i <= n:
            cnt += 1
    print(cnt)


if __name__ == '__main__':
    solve()


Measured memory_bytes: 38384
n = int(input())

ans = []

while n > 0:
    if n%26 != 0:
        a = chr(n%26+96)
        ans.append(a)
        n = n//26
    else:
        ans.append('z')
        n = n//26-1

ans = "".join(ans[::-1])
print(ans)    

Measured memory_bytes: 9188
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
using namespace std;
using Graph = vector<vector<int>>;
typedef long long ll;
typedef pair<long long,int> P;

int main(){
    int n;
    cin >> n;
    ll t[n], a[n];
    rep(i, n) cin >> t[i] >> a[i];
    ll ans = 0;
    ll T = t[0], A = a[0];
    
    for (int i = 1; i < n; i++){
        ll ta = (A + a[i] - 1) / a[i];
        ll tt = (T + t[i] - 1) / t[i];
        A = a[i] * max(ta, tt);
        T = t[i] * max(ta, tt);
    }
    cout << A + T << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <limits.h>
int main(){
    int a,b,c,i,k;
    scanf("%d %d %d %d",&a,&b,&c,&k);
    for(i=1; i<=k; i++){
        if(a>=b){
            b*=2;
            continue;
        }
        if(b>=c){
            c*=2;
            continue;
        }
    }
    if(a<b && b<c){
        printf("Yes");
        return 0;
    }
    printf("No");
    return 0;
}

Measured memory_bytes: 1736
from sys import exit, stderr, stdin
input = stdin.readline
def debug(var, name="hoge"):
    print(name +":" + str(type(var)) + " = " + repr(var), file=stderr)
    return


def main():
    N,D = [int(n) for n in input().split()]
    ans = 0
    X = [[0 for __ in range(D)] for _ in range(N)]
    for i in range(N):
        X[i] = [int(n) for n in input().split()]
    # print(X)
    for i in range(N):
        d = 0
        for j in range(i+1,N):
            d = sum([pow(y-z,2) for y,z in zip(X[i],X[j])])
            # print(d)
            d **= 0.5
            if d/1 == d//1:
                ans += 1
    print(ans)
if __name__ == "__main__":
    main()


Measured memory_bytes: 38384
from collections import deque
from itertools import product
import sys
import math
import numpy as np
import bisect

sys.setrecursionlimit(200000)
input = sys.stdin.readline


def read():
    N = int(input().strip())
    A = list(map(int, input().strip().split()))
    return N, A


def argsort(seq):
    return sorted(range(len(seq)), key=seq.__getitem__)

def solve(N, A):
    # x: i-A[i]の列
    X = np.array([i-A[i] for i in range(N)], dtype=np.int)
    # y: i+A[i]の列
    Y = np.array([i+A[i] for i in range(N)], dtype=np.int)
    keys = np.argsort(X)
    X = X[keys]  # x[i] <= x[i+1]
    Y = Y[keys]
    ans = 0
    for y in Y:
        l = bisect.bisect_left(X, y)
        r = bisect.bisect_left(X, y+1)
        ans += r - l
    return ans


if __name__ == '__main__':
    inputs = read()
    outputs = solve(*inputs)
    print("{}".format(outputs))


Measured memory_bytes: 50980
//CodeFestival Final-A Submarine
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<stdbool.h>
#define inf 1072114514
#define llinf 4154118101919364364
#define mod 1000000007
#define pi 3.1415926535897932384

int max(int a,int b){if(a>b){return a;}return b;}
int min(int a,int b){if(a<b){return a;}return b;}
int zt(int a,int b){return max(a,b)-min(a,b);}
int round(int a,int b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}
int ceil(int a,int b){if(a%b==0){return a/b;}return (a/b)+1;}
int gcd(int a,int b){int c;while(b!=0){c=a%b;a=b;b=c;}return a;}
int lcm(int a,int b){int c=gcd(a,b);a/=c;return a*b;}
int nCr(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
int fact(int a){int i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}
int pow(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}
long long llmax(long long a,long long b){if(a>b){return a;}return b;}
long long llmin(long long a,long long b){if(a<b){return a;}return b;}
long long llzt(long long a,long long b){return llmax(a,b)-llmin(a,b);}
long long llround(long long a,long long b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}
long long llceil(long long a,long long b){if(a%b==0){return a/b;}return (a/b)+1;}
long long llgcd(long long a,long long b){long long c;while(b!=0){c=a%b;a=b;b=c;}return a;}
long long lllcm(long long a,long long b){long long c=llgcd(a,b);a/=c;return a*b;}
long long llnCr(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
long long llfact(long long a){long long i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}
long long llpow(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}
double dbmax(double a,double b){if(a>b){return a;}return b;}
double dbmin(double a,double b){if(a<b){return a;}return b;}
double dbzt(double a,double b){return dbmax(a,b)-dbmin(a,b);}
int sortfncsj(const void *a,const void *b){if(*(int *)a>*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}
int sortfnckj(const void *a,const void *b){if(*(int *)a<*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}
int llsortfncsj(const void *a,const void *b){if(*(long long *)a>*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}
int llsortfnckj(const void *a,const void *b){if(*(long long *)a<*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}
int dbsortfncsj(const void *a,const void *b){if(*(double *)a>*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}
int dbsortfnckj(const void *a,const void *b){if(*(double *)a<*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}

int main(void){
    int i,l,p=0;
    char s[64],t[16]="AKIHABARA";
    scanf("%s",s);
    l=strlen(s);
    for(i=0;i<9;i++){
        while(p<=l){
            if(s[p] == t[i]){p++;break;}
            if(t[i] == 'A'){break;}
            else{printf("NO\n");return 0;}
            if(p==l){printf("NO\n");return 0;}
        }
    }
    if(p==l){printf("YES\n");}else{printf("NO\n");}
    return 0;
}

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

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;

#define F first
#define S second

const int MAXN = 1e6 + 10;
const int MOD = 1e9 + 7;

int ss[MAXN], tt[MAXN];

int pw(int a, int b){
	int ret = 1;
	while (b){
		if (b & 1)
			ret = 1ll*ret*a%MOD;
		b >>= 1;
		a = 1ll*a*a%MOD;
	}
	return ret;
}

int choose(int a, int b){
	if (min(a, b) < 0) return 0;
	if (b > a) return 0;
	return 1ll*ss[a]*tt[b]%MOD*tt[a-b]%MOD;
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	ss[0] = 1;
	for (int i = 1; i < MAXN; i++) ss[i] = 1ll*ss[i-1]*i%MOD;
	tt[0] = 1;
	for (int i = 1; i < MAXN; i++) tt[i] = 1ll*tt[i-1]*pw(i, MOD-2) % MOD;

	int n; cin >> n;
	int ans = 1ll*ss[n-1]*(n-1) % MOD;
	for (int k = 1; k < n-1; k++){
		int sm = n-2;
		sm -= k-1;
		if (sm < 0) continue;
		if (k-1 < sm) continue;
		int temp = choose(k-1, sm);
		temp = 1ll*temp*ss[k]%MOD*ss[n-1-k]%MOD;
		ans = (ans + MOD - temp) % MOD;
	}
	cout << ans << "\n";
	return 0;
}


Measured memory_bytes: 8064
#include <bits/stdc++.h>
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define SORT(a) sort(a.begin(), a.end())
#define REVERSE(a) reverse(a.begin(), a.end())
#define int long long
#define INF 1000000000000000
using namespace std;

typedef vector<int> vec;
typedef vector<vec> mat;
typedef pair<int, int> Pii;

template<typename T>
void readvec(vector<T> &a);
void readindex(vector<int> &a);

int calcans(vec a){
    int n = a.size();
    int ans = 0;
    int s = a[0];
    FOR(i, 1, n){
        if(s > 0 && s + a[i] >= 0){
            ans += s + a[i] + 1;
            s = -1;
        }else if(s < 0 && s + a[i] <= 0){
            ans += 1 - s - a[i];
            s = 1;
        }else{
            s += a[i];
        }
    }
    return ans;
}

signed main(){

    int n; cin >> n;
    vec a(n); readvec(a);
    vec a2 = a;
    int ansp, ansn, num;

    num = 0;
    if(a[0] <= 0){
        num = 1 - a[0];
        a[0] = 1;
    }
    ansp = calcans(a) + num;

    num = 0;
    if(a2[0] >= 0){
        num = 1 + a2[0];
        a2[0] = -1;
    }
    ansn = calcans(a2) + num;
    

    cout << min(ansp, ansn) << endl;
    
    return 0;
}


template<typename T>
void readvec(vector<T> &a){
    REP(i, a.size()){
        cin >> a[i];
    }
}
void readindex(vector<int> &a){
    REP(i, a.size()){
        cin >> a[i];
        a[i]--;
    }
}

Measured memory_bytes: 2572
#pragma GCC optimize("Ofast")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
#define int long long int
using namespace std;

void desperate_optimization(bool submitting=true,int precision=10)
{
  if(!submitting) return;
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cout.setf(ios::fixed);
  cout.setf(ios::showpoint);
  cout.precision(precision);
}
int32_t main()
{
  desperate_optimization(false);
  //freopen("input.txt","r",stdin);
  int n;
  cin>>n;
  int arr[n][3];
  for(int i=0;i<n;i++) cin>>arr[i][0]>>arr[i][1]>>arr[i][2];
  for(int i=1;i<n;i++)
  {
    arr[i][0]+=max(arr[i-1][1],arr[i-1][2]);
    arr[i][1]+=max(arr[i-1][0],arr[i-1][2]);
    arr[i][2]+=max(arr[i-1][0],arr[i-1][1]);
  }
  int answer=0;
  for(int i=0;i<3;i++) answer=max(answer,arr[n-1][i]);
  cout<<answer;



  return 0;
}

Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
int main(){int a,b;cin>>a>>b;vector<int>c(a,0);int x;for(int i=0;i<b*2;i++){cin>>x;c.at(x-1)++;}for(int i=0;i<a;i++)cout<<c.at(i)<<endl;}

Measured memory_bytes: 256
import scala.math._

object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val x, y = sc.next

  val ans = if (x < y) "<" else if (x > y) ">" else "="

  println(ans)

  ///////////////////////////////////////////

  def bigIterator(start: BigInt, end: BigInt, step: BigInt = 1) =
    Iterator.iterate(start)(_ + step).takeWhile(_ <= end)

  def lcm(a :Int, b :Int): Int =
    a / gcd(a, b) * b

  def lcm(a :Long, b :Long): Long =
    a / gcd(a, b) * b

  def gcd(a: Int, b: Int): Int =
    if (b == 0) a else gcd(b, a % b)

  def gcd(a: Long, b: Long): Long =
    if (b == 0) a else gcd(b, a % b)

  def setOrUpdated[A, B](a: Map[A, B], key: A, value: B, f: (B, B) => B) =
    a.get(key) match {
      case Some(v) => a.updated(key, f(value, v))
      case _ => a + (key -> value)
    }
}

Measured memory_bytes: 27212
#from numpy import*
#from scipy import*
from collections import* #defaultdict Counter deque appendleft
from fractions import gcd
from functools import* #reduce
from itertools import* #permutations("AB",repeat=2) combinations("AB",2) product("AB",2) groupby
from operator import mul
from bisect import* #bisect_left bisect_right
from heapq import* #heapify heappop heappushpop
from math import factorial,pi
from copy import deepcopy
import sys
#input=sys.stdin.readline  #危険！基本オフにしろ！
sys.setrecursionlimit(10**6)


def main():
    a,b=map(int,input().split())
    g=[list(map(int,input().split()))for i in range(a)]
    h=[int(input())for i in range(b)]
    for i in g:
        print(sum(s*t for s,t in zip(i,h)))

if __name__ == '__main__':
    main()


Measured memory_bytes: 7368
import java.io.*;
import java.util.HashMap;
import java.util.Map;
import java.util.StringTokenizer;
import java.util.concurrent.atomic.AtomicInteger;

public class Main {

    private static FastReader in = new FastReader(System.in);
    private static PrintWriter out = new PrintWriter(System.out);

    private static final long MOD = (long) 1e9 + 7;

    public static void main(String[] args) {
        solve();
        out.flush();
    }

    private static void solve() {
        int n = in.nextInt();
        int odds = n % 2 == 0 ? n / 2 : (n + 1) / 2;

        out.println((double) odds / (double) n);
    }

    // https://www.geeksforgeeks.org/fast-io-in-java-in-competitive-programming/
    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader(InputStream inputStream) {
            br = new BufferedReader(new
                    InputStreamReader(inputStream));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException  e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

        // https://qiita.com/masakinpo/items/5f77f2a879578a85a0bb
        public int[] nextIntArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

        public long[] nextLongArray(int n) {
            long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = nextLong();
            return a;
        }
    }
}


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

int main(){
	string s;cin >> s;
	int n = s.length();
	int ans = 0;
	for(int i = 1;i < n;i++){
		if(s[i] == s[i - 1]){
			s[i] = (s[i] == '0' ? '1' : '0');
			ans++;
		}
	}
	cout << ans;
}
// make pair, tuple
// make pair, tuple
// 
// __gcd(int, int);
// lcm = a * b / __gcd(a, b);
// 
// bool isPrime(int n){
//       if(n <= 1)return false;
//       if(n <= 3)return true;
//       if(n % 2 == 0 || n % 3 == 0)return false;
//       for(int i = 5;i * i <= n;i += 6){
//             if(n % i == 0 || n % (i + 2) == 0)return false;
//       }
//       return true;
// }
// int countSubString(string s, string temp){
//       int ans = 0;
//       size_t f = s.find(temp);
//       while(f != string::npos){
//             ans++;
//             f = s.find(temp, f + 1);
//       }
//       return ans;
// }
// 
// #Count leading & trailing zero of an integer bits
// __builtin_clz(n);
// __builtin_clzll(n);
//
// #Count 1s bits of an integer
// __builtin_popcount(n);
// __builtin_popcountll(n);
//
// #Error checking
// assert(n == 3);
// 
// #Error Printing
// cerr << "Some thing";

// #binary exponentiation
// long long binpow(long long a, long long b) {
//     long long res = 1;
//     while (b > 0) {
//         if (b & 1)
//             res = res * a;
//         a = a * a;
//         b >>= 1;
//     }
//     return res;
// }


Measured memory_bytes: 512
n = int(input())
x = 100
s = 0
for i in range(n):
    a = int(input())
    s += a
    if a % 10:
        x = min(x, a)
if s % 10:
    print(s)
elif x == 100:
    print(0)
else:
    print(s - x)


Measured memory_bytes: 3316
N=int(input())
A=[int(input()) for i in range(N)]
A.sort()
a=0
t=1
for i in range(1,N):
    if A[i-1]==A[i]:
        t+=1
    else:
        if t%2==1:
            a+=1
        t=1
if t%2==1:
    a+=1
print(a)

Measured memory_bytes: 7388
#include <iostream>
#include <algorithm>
using namespace std;
int a[100005];
int main()
{
    int n;
    cin >> n;
    for(int i = 0;i < n;i++)cin >> a[i];
    sort(a,a+n);
    long long a1 = 0,a2 = 0;
    for(int i = n-1;i>0;i--)
    {
        if(a[i] == a[i-1])
        {
            if(a1 == 0)a1 = a[i];
            else {a2 = a[i];break;}
            i--;
        }
    }
    if(a1&&a2)cout << a1*a2;
    else cout << 0;
    return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <cstdio>
using namespace std;

const long long B=1000000000000000003LL;
const long long P=1000000000000000031LL;

long long pow_binary_mod(long long x,long long y,long long mod){
	long long z=1;
	for(;y;y>>=1){
		if((y&1)!=0)z=(__int128_t)z*x%mod;
		x=(__int128_t)x*x%mod;
	}
	return z;
}

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

	int N;
	string s;
	cin>>N>>s;
	long long Brev=pow_binary_mod(B,P-2,P);
	vector<long long> o(N+1),p(N+1);p[0]=1;
	for(int i=1;i<=N;i++){
		p[i]=p[i-1];o[i]=o[i-1];
		if(s[i-1]=='<'){
			p[i]=(__int128_t)p[i]*Brev%P;
		}else if(s[i-1]=='>'){
			p[i]=(__int128_t)p[i]*B%P;
		}else if(s[i-1]=='+'){
			o[i]=(o[i]+p[i])%P;
		}else if(s[i-1]=='-'){
			o[i]=(o[i]-p[i]+P)%P;
		}
	}
	map<long long,int>m;
	long long r=0;
	for(int i=N;i>=1;i--){
		m[o[i]]++;
		r+=m[((__int128_t)o[N]*p[i-1]+o[i-1])%P];
	}
	printf("%lld\n",r);
}

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

const int maxn=2000005;
struct EDGE
{
    int v, w, next;
}e[maxn];
int cnt;
int head[maxn]={};
void Add(int u, int v, int w){
    e[cnt].v = v;
    e[cnt].w = w;
    e[cnt].next = head[u];
    head[u] = cnt++;
}
int dp[2][maxn]={};
int n,ans;
void dfs(int u,int fa){
    //cout<<u<<endl;
    for(int i=head[u];i!=-1;i=e[i].next)if(e[i].v!=fa){
        int v=e[i].v,w=e[i].w;
        dfs(v,u);
        if(dp[0][v]+w>dp[0][u]){
            dp[1][u]=dp[0][u];
            dp[0][u]=dp[0][v]+w;
        }
        else if(dp[0][v]+w>dp[1][u]) dp[1][u]=dp[0][v]+w;
    }
    ans=max(ans,dp[0][u]+dp[1][u]);
    return;
}
int main()
{
    scanf("%d",&n);
    memset(dp,0,sizeof(dp));ans=0;cnt=0;
    memset(head,-1,sizeof(head));
    for(int i=0;i<n-1;i++){
        int u, v;
        scanf("%d%d",&u,&v);
        Add(u,v,1);
        Add(v,u,1);
    }
    dfs(1,-1);
    //cout<<ans<<endl;
    ans++;
    if(ans%3==0||ans%3==1)cout<<"First"<<endl;
    else cout<<"Second"<<endl;
    return 0;
}



Measured memory_bytes: 40832
#include <iostream>

using namespace std;

int main()
{
	int tc; cin>>tc;
	while(tc--){
		int m,n; cin>>m>>n;
		int cnt=0;
		for(int a=-150;a<=150;a++)
			for(int b=-150;b<=150;b++){
				if(a==0 && b==0)
					continue;
				if((a*m-b*n)%(a*a+b*b)==0 && (a*n+b*m)%(a*a+b*b)==0)
					cnt++;
			}
		cout<<(cnt==8?"P":"C")<<endl;
	}
}

Measured memory_bytes: 1148