akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
 
using namespace std;
using ll = long long;
// #define int ll
using PII = pair<int, int>;
 
#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
 
template<typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<typename T> bool IN(T a, T b, T x) { return a<=x&&x<b; }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }
 
template<typename T> vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts) { 
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type
fill_v(T &t, const V &v) { t=v; }
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t, const V &v ) { for(auto &e:t) fill_v(e,v); }
 
template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a){
  out<<'('<<a.first<<','<<a.second<<')'; return out;
}
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
  for(T& x: vec) {is >> x;} return is;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
  out<<'['; for(T i: a) {out<<i<<',';} out<<']'; return out;
}
 
int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0}; // DRUL
const int INF = 1<<30;
const ll LLINF = 1LL<<60;
const int MOD = 1000000007;

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

  ll n, k;
  cin >> n >> k;
  vector<ll> a(n);
  vector<vector<ll>> g(n);
  ll ret = 0;
  REP(i, n) {
    cin >> a[i];
    a[i]--;
    if(i == 0 && a[i] != 0) {
      a[i] = 0;
      ret++;
    }
    if(i) {
      g[a[i]].push_back(i);
      g[i].push_back(a[i]);
    }
  }

  function<ll(ll,ll)> dfs = [&](ll v, ll p) {
    vector<ll> vec;
    for(auto to: g[v]) {
      if(to == p) continue;
      vec.push_back(dfs(to, v) + 1);
    }
    ll ma = 0, cnt = 0;
    for(auto i: vec) {
      if(i == k) cnt++;
      else chmax(ma, i);
    }
    // cout << v << " " << vec << " " << ma << " " << cnt << endl;
    if(v) ret += cnt;
    return ma;
  };

  dfs(0, -1);
  cout << ret << endl;

  return 0;
}


Measured memory_bytes: 17408
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, ac=0, wa=0, tle=0, re=0;
  cin >> n;
  for(int i=0; i<n; i++){
    string tmp;
    cin >> tmp;
    if(tmp=="AC")
      ac++;
    else if(tmp=="WA")
      wa++;
    else if(tmp=="TLE")
      tle++;
    else
      re++;
  }
  cout << "AC x "<<ac<<endl;
  cout << "WA x "<<wa<<endl;
  cout << "TLE x "<<tle<<endl;
  cout << "RE x "<<re;
  return 0;
}

Measured memory_bytes: 3628
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;
const int mod=1000000007;

int main(){
	int n,a,in[52]={};
	cin>>n>>a;
	FORQ(i,1,n){
		cin>>in[i];
		in[i]-=a;
	}
	LL dp[52][5000][2];
	int idx=1;
	FOR(j,0,52)FOR(k,0,5000)FOR(i,0,2)dp[j][k][i]=0LL;
	dp[0][2500][0]=1LL;
	FORQ(i,1,n){
		FORQ(j,0,i){
			FOR(k,-i*49,i*49+1){
				dp[j][k+2500][idx]+=dp[j][k+2500][idx^1];
				if(j!=0)dp[j][k+2500][idx]+=dp[j-1][k+2500-in[i]][idx^1];
			}
		}
		idx^=1;
		FORQ(j,0,i){
			FOR(k,-i*49,i*49+1){
				dp[j][k+2500][idx]=0;
			}
		}
	}
	LL ans=0LL;
	FORQ(j,0,n){
		ans+=dp[j][2500][idx^1];
	}
	cout<<ans-1;
    return 0;
}


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

int main(){
	int n,m;
	cin>>n>>m;
	
	int arr[n+1];
	int fnum=-1;
	int znum=-1;
	int sums=0;
	
	
	for(int i=1;i<=n;i++){
		arr[i]=m+i-1;
		if(arr[i]==0){
			fnum=1;
		}else if(arr[i]<0){
			znum=1;
		}
		sums+=arr[i];
	}
	//330 printf("%d\n",sums);
	sort(arr+1,arr+1+n);
	if(znum==1 && fnum==-1){//ÓÐ¸ºÊýÃ»ÓÐ0 
		sums-=arr[n];
	}else if(znum=-1 && fnum==-1){//Ã»¸ºÊýÃ»0 
		sums-=arr[1];
	}
	printf("%d",sums);
	
	return 0;
}








//5 2
//-1 1 1











 

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

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

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

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

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

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

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

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

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

use std::cmp::{max, min};

fn main() {
    input! {
        n: usize,
        abc: [(i64, i64, i64); n],
    }

    let mut tbl = vec![vec![0; n + 1]; 3];

    for i in 0..n {
        let t = [abc[i].0, abc[i].1, abc[i].2];
        for j in 0..3 {
            let h = t[j];
            let mut p = 0;
            for k in 0..3 {
                if j == k {
                    continue;
                }
                p = std::cmp::max(p, tbl[k][i]);
            }
            tbl[j][i + 1] = p + h;
        }
    }

    let ans = max(tbl[0][n], max(tbl[1][n], tbl[2][n]));

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


Measured memory_bytes: 10492
def grouping(a, b)
  group_a = [1, 3, 5, 7, 8, 10, 12]
  group_b = [4, 6, 9, 11]
  if group_a.include?(a) && group_a.include?(b)
    puts "Yes"
  elsif group_b.include?(a) && group_b.include?(b)
    puts "Yes"
  elsif a == 2 && b == 2
    puts "Yes"
  else
    puts "No"
  end
end

a, b= gets.chomp.split(" ").map(&:to_i)
grouping(a, b)

Measured memory_bytes: 1788
#include<bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
using namespace std;
vector< pair<int,int> >v;

int solve(int a,int b)
{
    return abs(a-b);
}
int main()
{
    //cout<<solve(1,2,3,4)<<endl;
    int a,b;
    cin>>a>>b;
    int ans = max(a+b,max(a-b,a*b));
    cout<<ans;
    return 0;
}


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

// in-short-use macros

#define ll long long int
#define ld long double
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define mod 1000000007

//container-use 

typedef vector< ll > vl;
typedef vector< vl > vvl;
typedef pair< ll,ll > pll;
typedef vector<pair<ll,ll > > vpl;
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(typeof((c).begin() i = (c).begin(); i != (c).end(); i++)
#define present(c,x) ((c).find(x) != (c).end())
#define rep(i,a,b) for (int i = a; i <= b; i++)

//main function here

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
  
    ll n,k;
    cin>>n>>k;
    ld m=log(n),b=log(k);
    cout<<floor(m/b)+1<<"\n";
  return 0;
 }

Measured memory_bytes: 512
#include<iostream>
#include<cmath>
#include<numeric>
#include<string>
#include<algorithm>
#include<vector>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<n;i++)
#define int64 long long 
using namespace std;

int main(){
  int n,m,ans;
  cin>>n>>m;
  if(n==1){
    ans=m;
  }else{
    rep1(i,(m/n)+1){
      if(m%i==0){
        ans=i;
      }
    }
  }
  cout<<ans<<endl;
}


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

using namespace std;

struct SegTree {
    vector<int> node;
    int n;
    SegTree(int sz) {
        n = 1;
        while (sz > n) n *= 2;
        node.resize(2 * n - 1, 0);
    }
    void add(int p, int x) {
        p += n-1;
        node[p] += x;
        do {
            p = (p-1) / 2;
            node[p] += x;
        } while (p);
    }
    int get(int a, int b, int k = 0, int l = 0, int r = -1) {
        if (r < 0) r = n;
        if (b <= l || r <= a) return 0;
        if (a <= l && r <= b) {
            return node[k];
        }
        return get(a, b, k * 2 + 1, l, (l + r) / 2) + get(a, b, k * 2 + 2, (r + l) / 2, r);
    }
};

int main()
{
    int n, q;
    cin >> n >> q;
    SegTree s(n);
    if (n == 1) {
        int s = 0;
        while (q--) {
            int c, x, y;
            cin >> c >> x >> y;
            if (c == 0) {
                s += y;
            } else {
               cout << s << endl;
            }
        }
        return 0;
    }
    while (q--) {
        int c, x, y;
        cin >> c >> x >> y;
        if (c == 0) {
            s.add(x-1, y);
        } else {
            cout << s.get(x-1, y) << endl;
        }
    }
}


Measured memory_bytes: 3852
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>
#include<complex>

using namespace std;

#define ll long long
#define ld long double
#define INF 1e9
#define LINF (ll)INF*INF
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(int i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

#define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

const double PI=acos(-1);
const double EPS=1e-9; //うまくいかなかったらゆるめる

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef pair<pii,int> ppi;
typedef pair<int,pii> pip;
typedef vector<pii> vp;
typedef vector<vi> vvi;

int gcd(int a, int b){if(b==0) return a;return gcd(b,a%b);}
int lcm(int a, int b){return a/gcd(a,b)*b;}


signed main(void) {
    string s,t;
    int n,a,b,c,d,e,x,y;
    cin >> a >> b;
cout << a*b << endl;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
struct Sieve
{
    vector<int> smallest_factor;
    vector<int> smallest_power;
    vector<int> moebius;
    vector<int> totient;
    vector<bool> prime;
    vector<ll> primes;
    Sieve(int m) : smallest_factor(m + 1), smallest_power(m + 1), moebius(m + 1), totient(m + 1), prime(m + 1, true)
    {
        moebius[1] = totient[1] = 1;
        prime[0] = prime[1] = false;

        for (int i = 2; i <= m; i++)
        {
            if (prime[i])
            {
                smallest_factor[i] = i;
                smallest_power[i] = 1;
                moebius[i] = -1;
                totient[i] = i - 1;
                primes.push_back(i);
            }

            for (int p : primes)
            {
                if (p > smallest_factor[i] || i * p > m)
                    break;
                prime[i * p] = false;
                smallest_factor[i * p] = p;
                smallest_power[i * p] = smallest_factor[i] == p ? smallest_power[i] + 1 : 1;
                moebius[i * p] = smallest_factor[i] == p ? 0 : -moebius[i];
                totient[i * p] = smallest_factor[i] == p ? p * totient[i] : (p - 1) * totient[i];
            }
        }
    }
};

int main()
{
    ll a,b;
    cin >> a >> b;
    if(a<b){
        swap(a,b);
    }
    ll A = a;
    Sieve sieve(1001000);
    set<ll> s;
    set<ll> ans;
    s.insert(1);
    for(int i = 0;sieve.primes[i]*sieve.primes[i]<=A;i++){
        while(a%sieve.primes[i]==0){
            s.insert(sieve.primes[i]);
            a/=sieve.primes[i];
        }
    }
    s.insert(a);
    for(auto i:s){
        if(b%i==0){
            ans.insert(i);
        }
    }
    cout << ans.size() <<endl;
    return 0;
}

Measured memory_bytes: 17144
from collections import *
from operator import mul

n = int(input())
A = list(map(int, input().split()))
q = int(input())


A_dic = Counter(A)
A_sum = sum(A)

for _ in range(q):
    b, c = map(int, input().split())
    tmp = A_dic[b]
    A_dic[c] += tmp
    A_dic[b] = 0
    A_sum += tmp*(c - b)
    print(A_sum)

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

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<pdd> vdd;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define mem(a,b) memset(a, b, sizeof(a) )
#define all(x) (x).begin(),(x).end()
#define INF 1000000000000
#define MOD 1000000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }
inline ll modInverse(ll a) { return modPow(a, MOD-2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }

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

int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}

int main(){
	int n;cin>>n;
	vl a(n);
	rep(i,n){
		cin>>a[i];
	}
	sort(all(a));
	if(a[n-1]%2==1){
		int l=a[n-1]/2,r=a[n-1]/2+1,ans=1e9;
		rep(i,n){
			if(abs(ans-l)>abs(l-a[i])){
				ans=a[i];
			}
			if(abs(ans-r)>abs(r-a[i])){
				ans=a[i];
			}
		}
		cout<<a[n-1]<<" "<<ans<<endl;
	}
	else{
		int m=a[n-1]/2,ans=1e9;
		rep(i,n){
			if(abs(ans-m)>abs(m-a[i])){
				ans=a[i];
			}
		}
		cout<<a[n-1]<<" "<<ans<<endl;
	}
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define pll pair<ll,ll>
#define x first
#define y second
#define mod 1e9+7
#define f(i,a,b) for(ll i=a;i<b;i++)
#define rof(i,a,b) for(ll i=a;i>b;i--)

ll lcm(ll a, ll b){
    return a / __gcd(a, b) * b;
}
//memset can initialize to 0 or -1 ONLY
// memset(a,0,sizeof(a[0][0])*n*n); //2D array
//memset(a, 0, sizeof(a));  //1D array
//memset(str, 't', sizeof(str)); // string
void solve()
{
    unordered_map<long,long> m;
  long n;cin>>n;
  long a[n];
  f(i,0,n) {cin>>a[i];m[a[i]]++;}
  long long int ans[n];
  memset(ans,0,sizeof(ans));
    long long int value=0;
    for(auto i=m.begin();i!=m.end();i++)
    value+=((i->second)*((i->second)-1))/2;
    
    f(i,0,n) 
    {ans[i]=value;
    
        ans[i]-=(m[a[i]]*(m[a[i]]-1))/2;
        ans[i]+=max(0L,((m[a[i]]-1)*(m[a[i]]-2))/2);
    }
    f(i,0,n) cout<<ans[i]<<endl;
}
int main()
{

ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    ll t=1;
   // cin>>t;
    while(t--)
    {
    
    solve();
    
    }

}

Measured memory_bytes: 12104
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define enld '\n'
#define rep(i,n) for(int i=0; i<(n); i++)
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("Ofast")
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
constexpr ll mod = 1000000007;
constexpr ll mod2 = 998244353;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[6] = {1, 0, -1, 0,1,1};
const int dy[6] = {0, 1, 0, -1,1,-1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
// ---------------------------------------------------------------------------



int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll N;
    cin >> N;
    ll ans = 0;
    for(ll i=2; i*i<=N; i++){
        if(N%i == 0){
            int cnt = 0;
            while(N%i == 0){
                cnt++;
                N /= i;
            }
            ll now = 0;
            for(int j=1; j<=300; j++){
                now += j;
                if(cnt < now){
                    ans += j-1;
                    break;
                }
            }
        }
    }
    if(N != 1){
        ans += 1;
    }
    cout << ans << "\n";
    return 0;
}

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

int gcd(int a, int b){
	if(a < b){
		int buf = a;
		a = b;
		b = buf;
	}

	if(a % b == 0)return b;
	else return gcd(b, a % b);

};

int main(){
	int a,b;

	cin >> a;
	cin >> b;

	cout << gcd(a,b) << endl;



	return 0;
}

Measured memory_bytes: 1160
<?php
fscanf(STDIN, "%d %d", $n, $m);

$xArray = [];
$yArray = [];
$zArray = [];

for ($i = 0; $i < $n; $i++) {
	fscanf(STDIN, "%d %d %d", $x, $y, $z);
	$xArray[] = $x;
	$yArray[] = $y;
	$zArray[] = $z;
}

$scoreArray1 = [];
for ($i = 0; $i < $n; $i++) {
	$scoreArray1[] = $xArray[$i] + $yArray[$i] + $zArray[$i];
}
rsort($scoreArray1);
$score1 = 0;
for ($i = 0; $i < $m; $i++) {
	$score1 += $scoreArray1[$i];
}

$scoreArray2 = [];
for ($i = 0; $i < $n; $i++) {
	$scoreArray2[] = $xArray[$i] + $yArray[$i] - $zArray[$i];
}
rsort($scoreArray2);
$score2 = 0;
for ($i = 0; $i < $m; $i++) {
	$score2 += $scoreArray2[$i];
}

$scoreArray3 = [];
for ($i = 0; $i < $n; $i++) {
	$scoreArray3[] = $xArray[$i] - $yArray[$i] + $zArray[$i];
}
rsort($scoreArray3);
$score3 = 0;
for ($i = 0; $i < $m; $i++) {
	$score3 += $scoreArray3[$i];
}

$scoreArray4 = [];
for ($i = 0; $i < $n; $i++) {
	$scoreArray4[] = $xArray[$i] - $yArray[$i] - $zArray[$i];
}
rsort($scoreArray4);
$score4 = 0;
for ($i = 0; $i < $m; $i++) {
	$score4 += $scoreArray4[$i];
}

$scoreArray5 = [];
for ($i = 0; $i < $n; $i++) {
	$scoreArray5[] = 0 - $xArray[$i] + $yArray[$i] + $zArray[$i];
}
rsort($scoreArray5);
$score5 = 0;
for ($i = 0; $i < $m; $i++) {
	$score5 += $scoreArray5[$i];
}

$scoreArray6 = [];
for ($i = 0; $i < $n; $i++) {
	$scoreArray6[] = 0 - $xArray[$i] + $yArray[$i] - $zArray[$i];
}
rsort($scoreArray6);
$score6 = 0;
for ($i = 0; $i < $m; $i++) {
	$score6 += $scoreArray6[$i];
}


$scoreArray7 = [];
for ($i = 0; $i < $n; $i++) {
	$scoreArray7[] = 0 - $xArray[$i] - $yArray[$i] + $zArray[$i];
}
rsort($scoreArray7);
$score7 = 0;
for ($i = 0; $i < $m; $i++) {
	$score7 += $scoreArray7[$i];
}

$scoreArray8 = [];
for ($i = 0; $i < $n; $i++) {
	$scoreArray8[] = 0 - $xArray[$i] - $yArray[$i] - $zArray[$i];
}
rsort($scoreArray8);
$score8 = 0;
for ($i = 0; $i < $m; $i++) {
	$score8 += $scoreArray8[$i];
}

$array = [ $score1, $score2, $score3, $score4, $score5, $score6, $score7, $score8];

$answer = max($array);
echo $answer,"\n";


Measured memory_bytes: 4604
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;

const int M = 1000005;
int main()
{
    int n, ans = 0;
    cin >> n;
    vector<int>a(n);
    vector<int>cnt(M);
    rep(i,n) cin >> a[i];
    sort(a.begin(),a.end());
    //Σi = 1~M M/1 -> O(MlogM) ∵1/xの積分で分かる
    rep(i,n){
        if(cnt[a[i]] != 0){
            cnt[a[i]] = 2;
        }else{
            for(int j = a[i]; j < M; j += a[i]){
                cnt[j]++;
            }
        }
    }
    rep(i,n){
        if(cnt[a[i]] == 1) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 8000
import java.util.*;

class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        
        int a = sc.nextInt();
        int b = sc.nextInt();
        
        if(a == b) {
            System.out.println("a == b");
        }else if(a > b){
            System.out.println("a > b");
        }else{
            System.out.println("a < b");
        }
    }
}


Measured memory_bytes: 26224
#include<stdio.h>
int main()
{
	int N, K, A[200001], B[200001];
	int i, j, k, l, m;
	
	
	/////////////////////////
	// Scan the imput:
	scanf("%d %d",&N,&K);
	
	for (i=1;i<=N;i++){
		scanf("%d",&A[i]);
	}
	////////////////////////
	
	
	///////////////////////////
	// Sort the numbers:
	// B[j] is the number of appearances of the number j.
	for (j=1;j<=N;j++){
		B[j]=0; // :initaly, everything is zero.
	} 
	
	for (i=1;i<=N;i++){
		B[A[i]]=B[A[i]]+1; // If the i-th number is A[i], we are increasing the counter by 1.
	}
	///////////////////////////
	
	
	//////////////////////////////////////////
	// Now, we sort B[j]'s. We count which values of B[j] appeared how many times.
	for (j=1;j<=N;j++){A[j]=0; }
	
	for (j=1;j<=N;j++){
		A[B[j]]=A[B[j]]+1;
	}
	//for (j=1;j<=N;j++){printf("%d\n",C[j]);}
	/////////////////////////////////////////
	
	//////////////////////////////
	// L is the number of different numbers.
	int L=0;
	for (j=1;j<=N;j++){
		L=L+A[j];
	} 
	if (L<=K){printf("0"); return 0;}
	//////////////////////////////
			
			
			
	////////////////////////////////
	// Now we remove some numbers:
	int answ=0;
	for (j=1;j<=N;j++){ //printf("\n%d",answ);
		if (K+A[j]<L){ L=L-A[j];
			answ=answ+j*A[j];
		}
		else {answ=answ+j*(L-K); j=N+1; }
	}
	////////////////////////////////
	
	printf("%d",answ);
	return 0;
}



Measured memory_bytes: 1664
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
using ll = long long;
using ull = unsigned long long; 
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
//constexpr long long MOD = 998244353LL;
template<class T, class U> inline bool chmax(T &a, U b) { if (a < b) { a = b; return true;} return false; }
template<class T, class U> inline bool chmin(T &a, U b) { if (a > b) { a = b; return true;} return false; }
////////////////////////////////////////////////////////////////////////////////////////////////////////////

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int K; cin >> K;
    string S; cin >> S;
    int N = S.size();
    if (N <= K) {
        cout << S << ln;
        return 0;
    }
    string ans = S.substr(0,K);
    ans += "...";
    cout << ans << ln;
}

Measured memory_bytes: 3660
#include <stdio.h>

int main(void) {
    int a, b, n, sum;
    int i, digit5, digit4, digit3, digit2, digit1, tmp, tmpSum;
    int ret;
	
    ret = scanf("%d %d %d", &n, &a, &b);
    
    sum = 0;
    
    for(i = a; i <= n; i++){
    	digit5 = i / 10000;
    	tmp = i % 10000;
    	digit4 = tmp / 1000;
    	tmp = tmp % 1000;
    	digit3 = tmp / 100;
    	tmp = tmp % 100;
    	digit2 = tmp / 10;
    	digit1 = tmp % 10;
    	tmpSum = digit5 + digit4 + digit3 + digit2 + digit1;
    	if( (tmpSum >= a) && (tmpSum <= b) ) {
    		sum += i;
    	}
    }
	
    printf("%d\n", sum);
	
    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long a,b,s,t;
	int q,i;
	scanf("%d",&q);
	for(i=0;i<q;i++)
	{
		scanf("%lld %lld",&a,&b);
		s=a*b;
		t=(int)sqrt(s);
		if(t*t==s)
		{
			if(a==b)
				printf("%d\n",(a-1)*2);
			else
				printf("%d\n",(t-1)*2-1);
		}
		else
		{
			if(s<=t*(t+1))
			{
				printf("%d\n",t*2-1-1);
			}
			else if(s>t*(t+1))
			{
				printf("%d\n",t*2-1);
			}
		}
	}
	return 0;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.Scanner;
public class Main {
    private enum hoge{
        AC,
        WA,
        TLE,
        RE;
    }
    public static void main(String[] args) {
        InputStream in = System.in;
        Scanner scanner = new Scanner(in);

        int ac = 0;
        int wa = 0;
        int tle = 0;
        int re = 0;

        int next = scanner.nextInt();
        for (int i = 0; i <= next; i++) {
            String s = scanner.nextLine();
            if (s.equals(hoge.AC.toString())) {
                ac++;
            }else if(s.equals(hoge.WA.toString())){
                wa++;
            }else if(s.equals(hoge.TLE.toString())){
                tle++;
            }else if(s.equals(hoge.RE.toString())){
                re++;
            }
        }
        scanner.close();
        System.out.println( String.format("AC x %s", ac) );
        System.out.println( String.format("WA x %s", wa) );
        System.out.println( String.format("TLE x %s", tle) );
        System.out.println( String.format("RE x %s", re) );
    }

}

Measured memory_bytes: 59216
/*
  _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
 |                                                                 |
 |   author : thanos1399     Language : C ++                         | 
 |   college : MSIT                                                | 
 | _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |  
*/
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
#include <bits/stdc++.h>
using namespace std ;
#define TEST            int t ; cin>>t; while(t--)
#define line            cout<<endl;
#define loop(i,a,b)     for(long long int i=a;i<b;i++)
#define loopIn(i,a,b)   for(long long int i=a;i<=b;i++)
#define MAX_SIZE        1000000
#define ff              first
#define ss              second
#define pb              push_back
#define ll              long long int  
#define mp              make_pair
#define vt              vector<tup>
#define vtt             vector<vt >
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
 
 
void Sieve( int *prime , int n){
	for(int i=0;i<n;i++){
		prime[i] = 0;
	}
	for(int i=2;i<n;i++){
		prime[i] = 1 ;
	}
	for(int i=4;i<n;i+=2){
		prime[i] = 0;
	}
	for(int i=3;i<n;i++){
		if(prime[i]==1){
		for(int j=i*i;j<n;j+=i){
			prime[j] = 0;
		}
	}
  }
  return ;
}
 
 
bool sortbysec(const pair<int,int> &a, 
              const pair<int,int> &b) 
{ 
    return (a.second < b.second); 
} 
 
void input(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif
}
int main(){
	input();
	ll n;
	cin>>n;
	vector<ll>dp;
	for(int i=1;i<=n;i++){
		if(i%5==0 && i%3==0) continue ;
		else if(i%3==0) continue ;
		else if(i%5==0) continue;
		else dp.push_back(i);
	}
	unsigned long long int  sum =0;
	for(int i=0;i<dp.size();i++){
		sum = (sum + dp[i]) ;
	}
	cout<<sum<<endl;
	
}


Measured memory_bytes: 11612
#include<bits/stdc++.h>
#define NUM 1000000007
using namespace std;

typedef long long unsigned llu;

int main(){
    llu n,sum=0;
    cin>>n;
    llu arr[n];
    
    for(llu i=0;i<n;i++){
        cin>>arr[i];
        sum+=arr[i];
    }
    llu res=0;
    for(llu i=0;i<n;i++){
        sum-=arr[i];
        llu temp = ((sum%NUM)*arr[i])%NUM;
        res = (temp + res)% NUM;
    }   
    cout<<res<<endl;
    
}

Measured memory_bytes: 5184
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using str = string;

int main(){
  int n; cin >> n;
  float tmp;
  vector<float> b(n);
  for(int i=0; i<n; i++){
    cin >> tmp;
    b[i] = 1.0 / tmp;
  }
  float ans = 1.0/accumulate(b.begin(), b.end(), 0.0);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        String[] lines = getStdin();
        String str = lines[0];
        String[] str1 = str.split(" ");
        int ver = Integer.parseInt(str1[0]);
        int par = Integer.parseInt(str1[1]);
        int area;
        int surr;

        area = ver * par;
        surr = (2 * ver) + (2 * par);

        System.out.println(area + " " + surr);
    }
  
  private static String[] getStdin() {
    Scanner scanner = new Scanner(System.in);
    ArrayList<String> lines = new ArrayList<>();
    while (scanner.hasNext()) {
      lines.add(scanner.nextLine());
    }
    return lines.toArray(new String[lines.size()]);
  }
  
}



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


ll func(ll a) {
    if( a%2 == 0 )
        return a/2;
    else
        return 3*a + 1;
}

void solve(long long s){

    set<ll> pq;
    pq.insert(s);

    ll a = s;
    for (ll i = 0; i < 1000002; i++)
    {
        a = func(a);
        if(pq.count(a) > 0){
            cout << i+2 << endl;
            break;
        }
        pq.insert(a);
    }
    

}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long s;
    scanf("%lld",&s);
    solve(s);
    return 0;
}


Measured memory_bytes: 256
s = int(input())
count = 1
st = set()
st.add(s)
while True:
  count += 1
  if s % 2 == 1:
    a  = 3*s + 1
  else:
    a = s / 2
  if a in st:
    break
  st.add(s)
  s = a
print(count)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define	fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define input(n,arr)    for(int i=0;i<n;i++)cin>>arr[i]; // 0 => n
#define	pi 3.14159265358979323846
#define	endl "\n"
#define f first
#define s second

typedef long long ll;
typedef unsigned long long ull;
const ll INF=1e18; 
const int N = 1e5+5 , oo=0x3f3f3f3f , mod=1e9+7;
void file(){freopen("out.txt","w",stdout);/*freopen("in.txt","r",stdin);*/}
int a[N];

int main(){
	fast
	ll a,b,n;
	cin>>a>>b>>n;
	if(a==0){
		cout<<b/n+1<<endl;
		return 0;
	}
	if(a==b){
		if(n==a)
			cout<<1;
		else
			cout<<0;
	return 0;
	}

	cout<<b/n-(a%n==0?a/n-1:a/n);
	
	return 0;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
int n,nn,m,ans=0;
int k[112];
vector <int> d[11];
vector <bool> l(11);
bool check()
{
	for(int i=0;i<n;i++)
	{
		int cnt=0;
		for(int j=0;j<d[i].size();j++)
		cnt+=(int)l[d[i][j]];
//		cout <<cnt<<endl;
		if(cnt%2!=k[i])
		return false;
	}
	return true;
}
void dfs(int now)
{
	if(now==nn)
	{
		if(check())
		{
			ans++;
//			puts("YES");
		}
//		else
//		puts("NO");
		return ;
	}
//	cout <<now<<endl;
	l[now]=true;
	dfs(now+1);
//	cout <<now<<endl;
	l[now]=false;
	dfs(now+1);
}
void go()
{
	cin >>nn>>n;
	for(int i=0;i<n;i++)
	{
		cin >>m;
		for(int j=0;j<m;j++)
		{
			int l;
			cin >>l;
			l--;
			d[i].push_back(l);
		}
	}
	for(int i=0;i<n;i++)
	{
		cin >>k[i];
	}
	dfs(0);
	cout <<ans<<endl;
}
int main()
{
	go();
	return 0;
}

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

int main() {
  long long N;
  cin >> N;
  vector<int> A(N), B(N), C(N);
  for (int i=0; i<N; i++) cin >> A.at(i);
  for (int i=0; i<N; i++) cin >> B.at(i);
  for (int i=0; i<N; i++) cin >> C.at(i);
  sort(A.begin(), A.end());
  sort(C.begin(), C.end());
  long long ans = 0;
  for (int i=0; i<N; i++) {
    auto IterA = lower_bound(A.begin(), A.end(), B.at(i));
    auto IterC = upper_bound(C.begin(), C.end(), B.at(i));
    if (IterA-A.begin()<=N&&C.end()-IterC<=N) ans += (long long)(IterA-A.begin())*(C.end()-IterC);
    else if (IterA-A.begin()>N&&C.end()-IterC<=N) ans += N*(C.end()-IterC);
    else if (IterA-A.begin()<=N&&C.end()-IterC>N) ans += (IterA-A.begin())*N;
    else ans += N*N;
  }
  cout << ans << endl;
}


Measured memory_bytes: 1408
N, Y = map(int, input().split())

# 10000x + 5000y + 1000z = Y
# x + y + z = N
flg = False
loopCnt = 0
for x in range(N+1):
    for y in range(N+1):
        z = N - x - y
        total = 10000*x + 5000*y + 1000*z
        if total == Y and z >= 0:
            print(x, y ,z)
            loopCnt += 1
            flg = True
            break
    if flg:
        break    

if loopCnt == 0:
    print(-1, -1, -1)

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

int main () 
{
    int n;
    std::cin >> n;
    
    int a[n];
    for (int i = 0; i < n; i++) 
    {
        std::cin >> a[i];
    }
    sort(a, a+n);
    
    int ai, aj;
    ai = a[n - 1];
    double max = (double)ai / 2;
    aj = 0;
    
    for (int i = 0; i < n; i++) 
    {
        if ((abs(a[i] - max) < abs(aj - max)))
        {
            aj = a[i];
        }
    }
    
    std::cout << ai << " " << aj << std::endl;
    
    return 0;
}

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

#define TRACE(x) x
#define WATCH(x) TRACE(cout << #x" = " << x << endl)
#define WATCHR(a, b) TRACE(for (auto it=a; it!=b;) cout << *(it++) << " "; cout << endl)
#define WATCHC(V) TRACE({cout << #V" = "; WATCHR(V.begin(), V.end());})

#define all(x) (x).begin(), (x).end()

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vs = vector<string>;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

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

    string s;
    cin >> s;

    ll ans = 0;
    int A = 0;

    for (int i = 0; i < s.size(); i++) {
        if (s[i] == 'A') A++;
        else if (s[i] == 'B') {
            if ((i + 1) < s.size() && s[i + 1] == 'C') {
                ans += A;
                i++;
            } else A = 0;
        } else A = 0;
    }

    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 720
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;cin>>n;
  string s;cin>>s;
  int cnt=1;
  rep(i,n-1){
    if(s[i]!=s[i+1])cnt++;
  }
  
  cout<<cnt<<endl;
}

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

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:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        l: chars,
    }

    let mut sum = 0;
    for x in l {
        sum = sum + x.to_digit(10).unwrap();
    }
    println!("{}", sum);
}


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

#define LL long long
#define LD long double
#define SC(t,x) static_cast<t>(x)
#define AR(t) vector < t >
#define PII pair < int, int >
#define PLL pair < LL, LL >
#define PIL pair < int, LL >
#define PLI pair < LL, int >
#define MP make_pair
#define PB push_back
#define PF push_front
#define POB pop_back
#define POF pop_front
#define PRF first
#define PRS second
#define INIT(ar,val) memset ( ar, val, sizeof ( ar ) )
#define lp(loop,start,end) for ( int loop = start; loop < end; ++loop )
#define lpd(loop,start,end) for ( int loop = start; loop > end; --loop )
#define lpi(loop,start,end) for ( int loop = start; loop <= end; ++loop )
#define lpdi(loop,start,end) for ( int loop = start; loop >= end; --loop )
#define qmax(a,b) (((a)>(b))?(a):(b))
#define qmin(a,b) (((a)<(b))?(a):(b))
#define qabs(a) (((a)>=0)?(a):(-(a)))

const int INF = 0x3fffffff;
const int SINF = 0x7fffffff;
const long long LINF = 0x3fffffffffffffff;
const long long SLINF = 0x7fffffffffffffff;
const int MAXN = 100007;

int n, S;
int p[MAXN];
int a[MAXN];
int ord[MAXN];
int m[2], sx[2][MAXN], sa[2][MAXN];

void init ();
void input ();
void work ();



int main()
{
	init();
	input();
	work();
}



void init ()
{
	// Init Everything Here
	
	ios::sync_with_stdio ( false );
}

void input ()
{
	// input method
	
	scanf ( "%d%d", &n, &S );
	lpi ( i, 1, n ) scanf ( "%d%d", &p[i], &a[i] );
}

void work ()
{
	// main work
	
	lpi ( i, 1, n ){
		if ( p[i] < S ){
			++m[0];
			sx[0][m[0]] = i, sa[0][m[0]] = a[i];
		}else break;
	}
	lpd ( i, n, 0 ){
		if ( p[i] > S ){
			++m[1];
			sx[1][m[1]] = i, sa[1][m[1]] = a[i];
		}
	}
	
	if ( !m[0] || !m[1] ){
		cout << ( qmax ( S - p[1], 0 ) + qmax ( p[n] - S, 0 ) ) << endl;
		return;
	}
	
//	lp ( t, 0, 2 ){
//		cerr << t << " : " << endl;
//		lpi ( i, 1, m[t] ) cerr << sx[t][i] << " " << sa[t][i] << endl;
//	}
	
	int ns = 0, np[2] = { 1, 1 }, ka = 0;
	LL ca = sa[1][1];
	while ( np[0] <= m[0] && np[1] <= m[1] ){
		if ( sa[ns][np[ns]] > ca || ( sa[ns][np[ns]] == ca && ns == 0 ) ){
			ord[++ka] = sx[ns^1][np[ns^1]++];
			ca += sa[ns][np[ns]];
			ns ^= 1;
		}else{
			ord[++ka] = sx[ns][np[ns]];
			ca += sa[ns][np[ns]++];
		}
	}
	ord[++ka] = sx[ns^1][np[ns^1]];
//	lpi ( i, 1, ka ) cerr << ord[i] << " "; cerr << endl;
	
	LL ans = 0;
	int cp = S;
	lpd ( i, ka, 0 ){
		ans += qabs ( cp - p[ord[i]] );
		cp = p[ord[i]];
	}
	
	cout << ans << endl;
}

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

int main(){
    vector<int> n;
    for(int i=0;i<4;i++){
        int x;
        cin>>x;
        n.push_back(x);
    }
    sort(n.begin(),n.end());
    vector<int> res={1,4,7,9};
    cout<<(n==res ? "YES" : "NO")<<endl;
    return 0;
}

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

using namespace std;
using ll =long long;
using vi = vector<int>; 
using vvi = vector<vi>; 
using vl = vector<ll>; 
using vvl = vector<vl>; 
using vs = vector<string>;
using vvs = vector<vs>; 
using vc = vector<char>;
using vvc = vector<vc>; 
using vb = vector<bool>;
using vvb = vector<vb>; 

#define rep(i,n) ;for( int i =0; i < n ; i ++)
#define all(a) a.begin(),a.end()
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define f(i,a,b) for(int i=a;i<b;i++)
#define pri(a)  printf("%.14lf\n",a);
#define MOD 1000000007
bool is_int_lround(double x){
  return std::lround(x)==x;
}
ll keta(ll x){
  ll n=0;
  while(x>0){
    x /=10 ;
    n ++;
  }
  return n;
}

ll conbi(int n,int m){
  
  cin>>n>>m;
  vector<ll> a(100);
  a[0] =1;
  for(int i=0;i<14;i++){
    a[i+1]=a[i]*(i+1);
  }
  return a[n] /(a[m] *a[n-m]);
}

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;//繰り返し二乗法
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
ll kaijo(ll x){
  ll z=1;
  while(x>0){
    z *=x;
    z %=MOD;
    x--;
  }
  return z;
}
ll yakusu_num(ll n){
  vl yakusu(n+1,1);
  for(ll i=2;i*i<=n;i++){ 
    while(n%i==0){
      n /=i;
      yakusu[i]++;
    }
  }
  if(n!=1)yakusu[n]++;
  ll num=1;
  for(ll i=0;i <=n;i++){
    num*=yakusu[i];
  }
  return num;
}



int main(){
  ll N;cin>>N;
  bool zero =false;
  vl a(N);
  rep(i,N){
    cin>>a[i];
    if(a[i]==0)zero=true;
  }
  ll ans =0;
  rep(i,N){
    ans+=abs(a[i]);
  }

  if(zero){
    cout<<ans<<endl;
  }
  else{
    ll minu=0;
    rep(i,N){
      if(a[i]<0)minu++;
    }
    ll unko =1000000001;
    rep(i,N){
      unko =min(unko,abs(a[i]));
    }
    if(minu%2 ==0){
      cout<<ans<<endl;
    }
    else if(minu%2==1){
      cout<<ans-2*unko<<endl;
    }
  }
}

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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

int N=50;
int K=250;
int A[50][50];

int cnt;
vpint ans;

int q(int y1,int x1,int y2,int x2){

    /*int res=0;
    for(int y=y1;y<y2;y++)for(int x=x1;x<x2;x++)res+=A[y][x];
    return res;
*/

    cout<<"? "<<y1<<" "<<x1<<" "<<y2-1<<" "<<x2-1<<endl;
    int p;cin>>p;
    return p;
}

void dfs(int y1,int x1,int y2,int x2){
    if(y1==y2)return;
    if(x1==x2)return;

    int p=q(y1,x1,y2,x2);
    cnt++;
    if((y2-y1)*(x2-x1)==p){
        for(int y=y1;y<y2;y++)for(int x=x1;x<x2;x++)ans.pb({y,x});
        return;
    }
    if(p==0)return;
    int y3=(y1+y2)/2;
    int x3=(x1+x2)/2;

    dfs(y1,x1,y3,x3);
    dfs(y1,x3,y3,x2);
    dfs(y3,x1,y2,x3);
    dfs(y3,x3,y2,x2);
}

signed main(){
    /*
    vector<pint>v;
    rep(i,N)rep(j,N)v.pb({i,j});
    srand((unsigned)time(NULL));
    random_shuffle(all(v));

    for(int i=0;i<K;i++){
        A[v[i].fi][v[i].se]=1;
    }*/

    int tmp;
    cin>>tmp;cin>>tmp;cin>>tmp;
    int mod;cin>>mod;

    dfs(0,0,N,N);

    rep(i,K)A[ans[i].fi][ans[i].se]=1;
    int p=1;
    int res=0;
    rep(i,N)rep(j,N){
        res=(res+p*A[i][j])%mod;
        p=p*2%mod;
    }

    cout<<"! "<<res<<endl;
    return 0;
}


Measured memory_bytes: 720
#include <iostream>
#include <string.h>
#include <algorithm>
#include <cstring>
#include <math.h>
#define ll long long
ll gcd(ll a,ll b){
    ll s=1,c;
    while(a&&b){
        if((~a&1)&&(~b&1))
            a>>=1,b>>=1,s<<=1;
        else if(~a&1)a>>=1;
        else if(~b&1)b>>=1;
        else if(a>b)a=a-b;
        else c=b-a,b=a,a=c;
    }
    if(!a)return b*s;
    if(!b)return a*s;
}
using namespace std;
int main(){
	int n;
	cin>>n;
	int a[n+1];
	int ans=0;
	for(int i=1;i<=n;i++){
		cin>>a[i];
		if(i%2!=0&&a[i]%2!=0)
			ans++;
	}
	cout<<ans;
}


Measured memory_bytes: 3612
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <set>
#include <numeric>
#include <cmath>

using namespace std;

typedef long long int lld;

const lld mod = 1e9+7;
const lld INF = 1e9;
const lld MAXN = 1e5;

vector<lld> fact,inv;


lld f(lld a,lld b, lld p)  // a^b mod pを求める
{
	if (b == 0)
	{
		return 1;
	}else if (b % 2 == 0)
	{
		lld d = f(a,b/2,p);  //a^b = a^(2k) = (a^k)^2  k = b / 2
		return ((d%mod) * d) % mod;
	}else
	{
		return ((a%mod) * f(a,b-1,p) % mod)%mod;
	}
}

void init(lld n)
{
	fact.resize(n+1,1);
	inv.resize(n+1,1);

	for(int i = 1; i < n+1; i++)  //　nまでの階乗を求める
	{
		fact[i] = fact[i-1] % mod * i % mod;
	}
}

lld comb(lld n,lld k)  //n_C_k
{
	lld x = 0;
	if (n < k)
	{
		return x;
	}
	x = ((fact[n]%mod) * (f(fact[k],mod-2,mod) % mod ) %mod) * (f(fact[n-k],mod-2,mod)% mod) % mod;
	return x;
}


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

	if (n == 1)
	{
		cout << 1 << endl;
		cout << 1 << endl;
		return 0;
	}
	vector<lld> a(n+2);

	for(int i = 1; i < n+2; i++)
	{
		cin >> a[i];
	}


	lld same=0,sum=0;

	for(int i = 1; i < n+2; i++)
	{
		sum += a[i];
	}

	same = sum - (n * (n+1)) / 2;

	lld left,right;
	bool ch = false;

	for(lld i = 1; i < n+2; i++)
	{
		if (a[i] == same)
		{
			if (!ch)
			{
				left = i;
				ch = true;
			}else
			{
				right = i;
				break;
			}
		}
	}
	//cout << "left = " << left << " right = " << right << endl;

	lld del = left + n - right;

	//cout << "del = " << del << endl;

	init(n+2);

	for(int i = 1; i < n+2; i++)
	{
		//cout << "n+1 = " << n+1 << " i = " << i << " ";
		//cout << comb(n+1,i) % mod << " - " << comb(n-right+left,i-1) << " = ";
		cout << (comb(n+1,i) - comb(n-right+left,i-1) + mod)%mod << endl;
	}

	return 0;
}


Measured memory_bytes: 3584
#include <iostream>
using namespace std;
int main()
{
    int a[10][10] = {0}, x = 1;
    int n;
    int ans = 0;
    cin >> n;
    for(int i = 1; i <= n; i++)
    {
        a[i % 10][i / x]++;
        if(i >= x * 10)
        {
            x *= 10;
        }
    }
    for(int i = 1; i <= 9; i++)
    {
        for(int j = 1; j <= 9; j++)
        {
            ans += a[i][j] * a[j][i];
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3608
#include<bits/stdc++.h>
#define dbug printf("I am here\n");
#define Fast ios_base::sync_with_stdio(false); cin.tie(0);
#define vs              v.size()
#define sot(v)        sort(v.begin(),v.end())
#define rev(v)        reverse(v.begin(),v.end())
#define ii                pair<int, int>
#define int              long long
#define ull              unsigned long long
#define pb              push_back
#define mpp          make_pair
#define Okay         0
#define pi               3.14159

const int inf = 1e6;
const int cont = 1e18;
using namespace std;

void solve(){
    int a, b, c, d;
    cin>>a>>b>>c>>d;
    cout<<max((a*b) , (c*d))<<endl;
}

int32_t main() {
    Fast;
    solve();
    return Okay;
}


Measured memory_bytes: 3608
import itertools
N,C=map(int,input().split())
ch =[[] for _ in range(C+1)]
time= [0]*(10**5+1)
for _ in range(N):
    s,t,c=map(int,input().split())
    ch[c].append(s)
    ch[c].append(t)
    
for i in range(1,C+1):
    ch[i].sort()

for i in range(1,C+1):
    for chi in range(len(ch[i])):
        if chi %2 == 0:
            if chi == 0:
                time[ch[i][chi]-1]+=1
            elif chi>1 and ch[i][chi-1]!=ch[i][chi]:
                time[ch[i][chi]-1]+=1
        elif chi %2 == 1:
            if chi==len(ch[i])-1:
                time[ch[i][chi]]-=1
            elif ch[i][chi+1] != ch[i][chi]:
                time[ch[i][chi]]-=1

integ_time = itertools.accumulate(time)
print(max(integ_time))


Measured memory_bytes: 18548
def main():
    from itertools import accumulate
    import sys
    n, q, s, *lr = sys.stdin.read().split()
    *query, = map(int, lr)
    c = [1 if s[i] == 'C' and s[i - 1] == 'A' else 0 for i in range(int(n))]
    a = tuple(accumulate(c))
    ans = ''
    for i,j in zip(*[iter(query)]*2):
        ans += str(a[j-1]-a[i-1]) + '\n'
    print(ans)

if __name__ == '__main__':
    main()


Measured memory_bytes: 30336