akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)
#define req(i,n) for(int i = 1;i <=n;i++)
#define pai 3.14159265358979323846
const int INF = 1001001001;
typedef long long ll;
int A[3][3], N;
bool punched[3][3];
bool ok[3][3];
//using Graph = vector<vector<int>>;


const int MOD = 1000000007;
typedef pair<int,int> P;

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

}

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

//素数判定
bool is_prime(long long N) {
    if (N == 1) return false;
    for (long long i = 2; i * i <= N; ++i) {
        if (N % i == 0) return false;
    }
    return true;
}

// 素因数分解
vector<pair<long long, long long> > prime_factorize(long long n) {
    vector<pair<long long, long long> > res;
    for (long long p = 2; p * p <= n; ++p) {
        if (n % p != 0) continue;
        int num = 0;
        while (n % p == 0) { ++num; n /= p; }
        res.push_back(make_pair(p, num));
    }
    if (n != 1) res.push_back(make_pair(n, 1));
    return res;
}

// 10進数から2進数
int binary(int bina){
    int ans = 0;
    for (int i = 0; bina>0 ; i++)
    {
        ans = ans+(bina%2)*pow(10,i);
        bina = bina/2;
    }
    return ans;
}









int main() {
  ll n;
  cin >> n;
  ll sum = 0;
  for (int i = 1;i <= 1000000;i++){
    for (int j = 1;j <= 1000000;j++){
      if (i * j < n){
        sum++;
      }
      else break;
    }
  }
  cout << sum << endl;
}


Measured memory_bytes: 3716
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n); i++)
#define Clear(a) a = decltype(a)();
typedef long long ll;
typedef vector<vector<ll>> vvl;
typedef vector<ll> vl;
typedef vector<vector<char>> vvc;
typedef vector<char> vc;
typedef pair<ll,ll> pll;
typedef priority_queue<string> priquestring;
typedef priority_queue<int> priqueint;
typedef priority_queue<ll> priquell;
typedef priority_queue<char> priquechar;
typedef priority_queue<string,vector<string>,greater<string>> rpriquestring;
typedef priority_queue<int,vector<int>,greater<int>> rpriqueint;
typedef priority_queue<ll,vector<ll>,greater<ll>> rpriquell;
typedef priority_queue<char,vector<char>,greater<char>> rpriquechar;
ll max(ll x,ll y){
if(x>y)return x;
else return y;
}
ll min(ll x,ll y){
  return x+y-max(x,y);
}

const ll big=1000000007;
int exp(int x,int y){
    if(y==0)return 1;//0^0=1
    if(x==1||x==0)return x;
    if(y%2==1)return (exp(x,y-1)*x)%big;
    int t=exp(x,y/2);
    return (t*t)%big;
}
void chmin(ll a,ll b){
    if(a>b)a=b;
    return;
}

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


int main(){
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    cout << fixed << setprecision(10);
    /*--------------------------------*/
    
    int h,w;cin >> h >> w;
    vector<vector<char>> a(h,vector<char>(w));
    queue<pair<int,int>> q;
    rep(i,h)rep(j,w){
        cin >> a[i][j];
        if(a[i][j]=='#')q.push(pair<int,int>(i,j));
    }
    
    int cnt=-1;
    while(!q.empty()){
        int n=q.size();
        rep(i,n){
            pair<int,int> now=q.front();q.pop();
            rep(j,4){
                int nx=now.first+dx[j];int ny=now.second+dy[j];
                if(nx<0||ny<0||nx>=h||ny>=w)continue;
                if(a[nx][ny]=='#')continue;
                q.push(pair<int,int>(nx,ny));a[nx][ny]='#';
            }
        }
        cnt++;
    }
    cout << cnt << endl;
}

Measured memory_bytes: 9488
import sys
input=lambda: sys.stdin.readline().rstrip()
mod=10**9+7
n_max=2*(10**6+1)
F,FI=[0]*(n_max+1),[0]*(n_max+1)
F[0],FI[0]=1,1
for i in range(n_max):
  F[i+1]=(F[i]*(i+1))%mod
FI[n_max-1]=pow(F[n_max-1],mod-2,mod)
for i in reversed(range(n_max-1)):
  FI[i]=(FI[i+1]*(i+1))%mod
def comb(x,y):
  return (F[x]*FI[x-y]*FI[y])%mod
x,y=map(int,input().split())
if (x+y)%3!=0:
  print(0)
else:
  n=(x+y)//3
  if x<n or y<n:
    print(0)
  else:
    print(comb(n,x-n))

Measured memory_bytes: 161396
require 'pp'

n, k = gets.chomp!.split(" ").map(&:to_i)
all_sushi = []
group_max = {}

n.times do |i|
    t, d = gets.chomp!.split(" ").map(&:to_i)
    all_sushi[i] = [d, t]
    group_max[t] ||= 0
    group_max[t] = group_max[t] < d ? d : group_max[t]
end
all_sushi.sort!.reverse!
sorted_group_max = group_max.sort {|a, b| b[1] <=> a[1]}.to_h

#pp all_sushi
#pp sorted_group_max

# 大きいほうからK個取り出す
max_point = 0
max_comb = {}
others = []
k.times do |i|
    max_point += all_sushi[i][0]
    if max_comb[all_sushi[i][1]] == nil
        max_comb[all_sushi[i][1]] = all_sushi[i][0]
    else
        others << all_sushi[i][0]
    end
end

max_comb.each do |x, _|
    sorted_group_max.delete(x)
end

#pp max_point
#pp max_comb
#pp others
#pp sorted_group_max

tmp_max = max_point 
tmp_kind = max_comb.size
tmp_point = tmp_max + tmp_kind ** 2
ans = tmp_point

others.reverse_each do |o|
    k, v = sorted_group_max.first
    break if k == nil
    sorted_group_max.delete(k)
    tmp_kind += 1
    tmp_max = tmp_max - o + v
    tmp_point = tmp_max + tmp_kind ** 2
    if tmp_point > ans
        ans = tmp_point
    end
end

puts ans


Measured memory_bytes: 29296
#include <bits/stdc++.h>
#define ll long long int
#define ull unsigned long long int

using namespace std;



int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);cout.tie(NULL);
    ll N,D;
    cin>>N>>D;
    cout<<ceil((double)N/(2.0*(double)D+1.0))<<"\n";


    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip> // << fixed << setprecision(xxx)
#include <algorithm> // do { } while ( next_permutation(A, A+xxx) ) ;
#include <vector>
#include <string> // to_string(nnn) // substr(m, n) // stoi(nnn)
#include <complex>
#include <tuple> // get<n>(xxx)
#include <queue>
#include <stack>
#include <map> // if (M.find(key) != M.end()) { }
#include <set> // S.insert(M);
// if (S.find(key) != S.end()) { }
// for (auto it=S.begin(); it != S.end(); it++) { }
// auto it = S.lower_bound(M);
#include <random> // random_device rd; mt19937 mt(rd());
#include <cctype>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib> // atoi(xxx)
using namespace std;

#define DEBUG 0 // change 0 -> 1 if we need debug.
// insert #if<tab> by my emacs. #if DEBUG == 1 ... #end

typedef long long ll;

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

// const int C = 1e6+10;
const ll MOD = 1000000007;

typedef tuple<int, int> state;

int N, M;
vector<state> V[310];

ll DP[310][310][310];

int main () {
  cin >> N >> M;
  for (auto i = 0; i < M; ++i) {
    int l, r, x;
    cin >> l >> r >> x;
    V[r].push_back(state(l, x));
  }
  fill(&DP[0][0][0], &DP[0][0][0]+310*310*310, 0);
  DP[1][1][0] = 3;
  for (auto i = 1; i <= N; ++i) {
    for (auto e : V[i]) {
      int l = get<0>(e);
      int clr = get<1>(e);
      if (clr == 1) {
        for (auto j = l+1; j <= i; ++j) {
          for (auto k = 0; k < j; ++k) {
            DP[i][j][k] = 0;
          }
        }
      } else if (clr == 2) {
        for (auto j = 1; j <= i; ++j) {
          for (auto k = 0; k < j; ++k) {
            if (!(j > l && l >= k)) {
              DP[i][j][k] = 0;              
            }
          }
        }        
      } else {
        for (auto j = 1; j <= i; ++j) {
          for (auto k = 0; k <= l; ++k) {
            DP[i][j][k] = 0;
          }
        }        
      }
    }
    /*
    for (auto j = 1; j <= i; ++j) {
      for (auto k = 0; k < j; ++k) {
        cerr << "DP[" << i << "][" << j << "][" << k << "] = "
             << DP[i][j][k] << endl;
      }
    }
    */
    if (i == N) break;
    for (auto j = 1; j <= i; ++j) {
      for (auto k = 0; k < j; ++k) {
        DP[i+1][j][k] += DP[i][j][k];
        DP[i+1][j][k] %= MOD;
        DP[i+1][i+1][k] += DP[i][j][k];
        DP[i+1][i+1][k] %= MOD;
        DP[i+1][i+1][j] += DP[i][j][k];
        DP[i+1][i+1][j] %= MOD;
      }
    }
  }
  ll sum = 0;
  for (auto j = 1; j <= N; ++j) {
    for (auto k = 0; k < j; ++k) {
      sum += DP[N][j][k];
      sum %= MOD;
    }
  }
  cout << sum << endl;
}


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

using namespace std;
using ll = long long;
using vl = vector<ll>;
using pll = pair<ll, ll>;

#define rep(i, n) for (ll i = 0, xxx_rep_end = (n); i < xxx_rep_end; ++i)
#define all(x) (x).begin(), (x).end()

template <class T1, class T2>
inline bool chmax(T1 &a, const T2 &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T1, class T2>
inline bool chmin(T1 &a, const T2 &b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

constexpr ll INF = 0x3f3f3f3f3f3f3f3fLL;
constexpr ll mod = 1000000007;

ll cal(ll a, ll b, ll x) {
    return (a * x  / b) - (a * (x / b));
}

int main() {
    ll A, B, N;
    cin >> A >> B >> N;
    if (B - 1 <= N) {
        cout << cal(A, B, B - 1) << endl;
    } else {
        cout << cal(A, B, N) << endl;
    }
}

Measured memory_bytes: 3628
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <set>
using namespace std;
int main() {
  int a, b, x;
  cin >> x >> a >> b;
  if(abs(x-a) > abs(x-b)) cout << "B" << endl;
  else cout << "A" << endl;
}

Measured memory_bytes: 256
import java.util.*;

class Main {
        public static void main(String args[]) {
                Scanner sc = new Scanner(System.in);
                int n = sc.nextInt();
                int m = sc.nextInt();
                int ans = 0;
                for (int i = 0; i < n; i++) {
                        int memo = 0;
                        for (int j = 0; j < m; j++) {
                                int x = sc.nextInt();
                                if (x == 1) {
                                        memo++;
                                }
                        }
                        ans = Math.max(memo, ans);
                }
                System.out.println(ans);
        }
}

Measured memory_bytes: 26992
#include <iostream>
#include <cmath>
#include <algorithm>
#include <functional>

using namespace std;


int main()
{
	int n;
	cin >> n;
	
	int *a;
	a = new int[n];
	int total_A = 0;
	int total_B = 0;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	sort(a, a + n, greater<int>());

	for (int i = 0; i < n; i++) {
		if (i % 2 == 0) {
			total_A += a[i];
		}
		else {
			total_B += a[i];
		}
	}

	cout << total_A - total_B << endl;
	

	return 0;
	
}

Measured memory_bytes: 256
"""
最小全域木
クラスカル法
"""

#自分の木の根を探し返す、根を直接の親にする
def find(x, par_lst):
  if par_lst[x] == x:
    return x

  root = find(par_lst[x], par_lst)
  par_lst[x] = root
  return root

while True:
  n = int(input())
  if not n:
    break
  m = int(input())

  edges = []
  for _ in range(m):
    a, b, d = map(int, input().split(","))
    edges.append((d // 100 - 1, a, b))

  #コストでソート済みの辺リスト
  edges.sort()
  
  #各ノードの親のリスト
  par_lst = [i for i in range(n)]
  ans = 0
  
  #コストの低い辺からチェック
  for d, a, b in edges:
    par_a = find(a, par_lst)
    par_b = find(b, par_lst)

    #親が違うなら併合
    if par_a != par_b:
      par_lst[par_a] = par_b
      ans += d

  print(ans)


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

#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define pf printf
#define sc scanf
#define sf(num) scanf("%d",&num)
#define sff(num1,num2) scanf("%d %d",&num1,&num2)
#define sfff(num1,num2,num3) scanf("%d %d %d",&num1,&num2,&num3);
#define sl(num) scanf("%lld",&num)
#define sll(num1,num2) scanf("%lld %lld",&num1,&num2)
#define slll(num1,num2,num3) scanf("%lld %lld %lld",&num1,&num2,&num3);
#define rep(i,n) for(i=1;i<=n;i++)
#define rep0(i,n) for(i=0;i<n;i++)
#define reps(i,a,n) for(i=a;i<=n;i++)
#define pb push_back
#define mpp make_pair
#define MOD 1000000007
#define fi first
#define se second
#define N 100005
#define mem(ara,n) memset(ara,n,sizeof(ara))
#define memb(ara) memset(ara,false,sizeof(ara))
#define all(x) (x).begin(),(x).end()
#define sq(x) ((x)*(x))
#define pi pair<int,int>
#define pii pair<pair<int,int>,pair<int,int> >
#define db(x) cout<<#x<<" :: "<<x<<"\n";
#define dbb(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\n";
#define fr freopen("input.txt","r",stdin);
#define fw freopen("output.txt","w",stdout);
#define TIME cerr<<"Time : "<<(double)clock()/(double)CLOCKS_PER_SEC<<"s\n";
typedef long long int ll;
using namespace std;
int main()
{
    string a;
    cin>>a;
    if(a[0]==a[1] || a[1]==a[2] || a[2]==a[3])
        pf("Bad");
    else
        pf("Good");
}


Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author aryssoncf
 */



// Taken from: https://github.com/bqi343/USACO/blob/master/Implementations/content/contest/templateShort.cpp

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ull> vul;
typedef vector<ll> vl;
typedef vector<pii> vpii;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define F0R(i, a) FOR(i,0,a)
#define ROF(i, a, b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i, a) ROF(i,0,a)
#define trav(a, x) for (auto& a: x)

#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rsz resize

#define mp make_pair
#define pb push_back
#define f first
#define s second

const int MOD = 1e9 + 7; // 998244353; // = (119<<23)+1
const int MX = 2e5 + 5;

template<class T>
bool ckmin(T &a, const T &b) {
    return a > b ? a = b, 1 : 0;
}

template<class T>
bool ckmax(T &a, const T &b) {
    return a < b ? a = b, 1 : 0;
}

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


//
// Created by aryssoncf on 28/10/2019.
//

#include <type_traits>


#include <iterator>
#include <utility>

template<typename T>
constexpr auto hasBegin(int) -> decltype(std::begin(std::declval<T>()), true) {
    return true;
}

constexpr bool hasBegin(...) {
    return false;
}

template<typename T>
using IsContainer = std::integral_constant<bool, hasBegin<T>(0)>;


#ifndef JHELPER_EXAMPLE_PROJECT_IO_HPP
#define JHELPER_EXAMPLE_PROJECT_IO_HPP

#endif //JHELPER_EXAMPLE_PROJECT_IO_HPP

template<typename T>
std::istream &operator>>(std::istream &is, std::vector<T> &vec) {
    for (T &element: vec) {
        is >> element;
    }
    return is;
}

template<typename T, typename U>
std::istream &operator>>(std::istream &is, std::pair<T, U> &p) {
    is >> p.first;
    is >> p.second;
    return is;
}

template<class X, class Y>
std::ostream &operator<<(std::ostream &os, std::pair<X, Y> const &p) {
    return os << p.first << " " << p.second;
}

template<class Ch, class Tr, class Container>
std::basic_ostream<Ch, Tr> &operator<<(std::basic_ostream<Ch, Tr> &os, Container const &x) {
    bool first = true;
    for (auto &y : x) {
        if (first) {
            first = false;
        } else {
            os << " ";
        }
        os << y;
    }
    return os;
}

using namespace std;

class CSentou {
public:
    void solve(std::istream &in, std::ostream &out) {
        int n, t;
        in >> n >> t;
        vi T(n);
        in >> T;
        int res = 0;
        FOR(i, 0, n) {
            res += min(i + 1 < n ? T[i + 1] - T[i] : INT_MAX, t);
        }
        out << res << '\n';
    }

    void setup() {}
};


int main() {
    std::ios_base::sync_with_stdio(false);
    CSentou solver;
    solver.setup();
    std::istream &in(std::cin);
    std::ostream &out(std::cout);
    in.tie(nullptr);
    out << std::fixed;
    out.precision(20);
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,n) for(long long i=0;i<n;++i)
#define P pair<ll,ll>
#define Graph vector<vector<ll>>
#define fi first
#define se second
constexpr ll INF=(1ll<<60);
constexpr ll mod=1000000007;
constexpr double pi=3.14159265358979323846;
template<typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
    vector<ll> a(5);
    ll k;
    rep(i,5) cin>>a[i];
    cin>>k;

    sort(a.begin(),a.end());
    if(a[4]-a[0]>k){
        cout<<":("<<endl;
    }else{
        cout<<"Yay!"<<endl;
    }

    return 0;
}

Measured memory_bytes: 3556
#include<iostream>
#include<cmath>

int main(){
	int d;
	while(std::cin >> d){
		int S=0;
		int d3 = d*d*d;
		for(int i=1; i<600/d; ++i){
			S += d3*i*i;
		}
		std::cout << S << std::endl;
	}
	return 0;
	
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define REPR(i,n) for (int i=(int)(n)-1;i>=0;--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define valid(y,x,h,w) (0<=y&&y<h&&0<=x&&x<w)
#define tpl(...) make_tuple(__VA_ARGS__)
const int INF = 0x3f3f3f3f;
const double EPS = 1e-8;
const double PI = acos(-1);
const int dy[] = {-1,0,1,0};
const int dx[] = {0,1,0,-1};
typedef long long ll;
typedef pair<int,int> pii;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<typename Ch,typename Tr,typename C,typename=decltype(begin(C()))>basic_ostream<Ch,Tr>& operator<<(basic_ostream<Ch,Tr>&os,
const C& c){os<<'[';for(auto i=begin(c);i!=end(c);++i)os<<(i==begin(c)?"":" ")<<*i;return os<<']';}
template<class S,class T>ostream&operator<<(ostream &o,const pair<S,T>&t){return o<<'('<<t.first<<','<<t.second<<')';}
template<int N,class Tp>void output(ostream&,const Tp&){}
template<int N,class Tp,class,class ...Ts>void output(ostream &o,const Tp&t){if(N)o<<',';o<<get<N>(t);output<N+1,Tp,Ts...>(o,t);}
template<class ...Ts>ostream&operator<<(ostream&o,const tuple<Ts...>&t){o<<'(';output<0,tuple<Ts...>,Ts...>(o,t);return o<<')';}
template<class T>void output(T t,char z=10){if(t<0)t=-t,putchar(45);int c[20];

  int k=0;while(t)c[k++]=t%10,t/=10;for(k||(c[k++]=0);k;)putchar(c[--k]^48);putchar(z);}
template<class T>void outputs(T t){output(t);}
template<class S,class ...T>void outputs(S a,T...t){output(a,32);outputs(t...);}
template<class T>void output(T *a,int n){REP(i,n)cout<<a[i]<<(i!=n-1?',':'\n');}
template<class T>void output(T *a,int n,int m){REP(i,n)output(a[i],m);}
template<class T>bool input(T &t){int n=1,c;for(t=0;!isdigit(c=getchar())&&~c&&c-45;);
if(!~c)return 0;for(c-45&&(n=0,t=c^48);isdigit(c=getchar());)t=10*t+c-48;t=n?-t:t;return 1;}
template<class S,class ...T>bool input(S&a,T&...t){input(a);return input(t...);}
template<class T>bool inputs(T *a, int n) { REP(i,n) if(!input(a[i])) return 0; return 1;}

int w[1000];
int v[1000];
ll dp[101][100001];

int main() {
  int n,W;
  while(input(n,W)) {
    REP(i,n) {
      input(w[i],v[i]);
    }
    memset(dp,0x3f,sizeof(dp));
    dp[0][0] = 0;
    REP(i,n) {
      REP(j,100001) {
        chmin(dp[i+1][j], dp[i][j]);
        if (j+v[i]<=100000)
          chmin(dp[i+1][j+v[i]], dp[i][j] + w[i]);
      }
    }
    int ans = 0;
    REP(i,100001) {
      if (dp[n][i] <= W)
        chmax(ans, i);
    }
    cout << ans << endl;
  }
}


Measured memory_bytes: 79232
def main():
    N = int(input())
    L = []
    for i in range(N):
        xi, li = map(int, input().split())
        s = xi - li
        f = xi + li
        L.append((f, s))
    
    L.sort()

    ans = 0
    finish = -float("inf")
    for i in L:
        if finish <= i[1]:
            ans += 1
            finish = i[0] 

    print(ans)

if __name__ == "__main__":
    main()



Measured memory_bytes: 16976
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.StringTokenizer;

public class Main {

	FastScanner in;
	PrintWriter out;

	void solve() {
		int n = in.nextInt();

		ArrayList<Integer> deliciouses = new ArrayList<Integer>();
		while (n-- > 0) {
			deliciouses.add(in.nextInt());
		}

		int delPoint = 0;
		for (int i = 0; i < deliciouses.size(); i++) {
			for (int j = i + 1; j < deliciouses.size(); j++) {
				delPoint = delPoint + deliciouses.get(i) * deliciouses.get(j);
			}
		}

		out.println(delPoint);

	}

	void run() {
		try {
			in = new FastScanner(new File("Main.in"));
			out = new PrintWriter(new File("Main.out"));

			solve();

			out.close();
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		}
	}

	void runIO() {

		in = new FastScanner(System.in);
		out = new PrintWriter(System.out);

		solve();

		out.close();
	}

	class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		public FastScanner(File f) {
			try {
				br = new BufferedReader(new FileReader(f));
			} catch (FileNotFoundException e) {
				e.printStackTrace();
			}
		}

		public FastScanner(InputStream f) {
			br = new BufferedReader(new InputStreamReader(f));
		}

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

		boolean hasMoreTokens() {
			while (st == null || !st.hasMoreTokens()) {
				String s = null;
				try {
					s = br.readLine();
				} catch (IOException e) {
					e.printStackTrace();
				}
				if (s == null)
					return false;
				st = new StringTokenizer(s);
			}
			return true;
		}

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

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

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

	public static void main(String[] args) {
		new Main().runIO();
	}
}


Measured memory_bytes: 21332
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main()
{
    int a,b;
    char s[100];
    while(scanf("%d%d",&a,&b)!=EOF)
    {
        sprintf(s,"%d",a+b);
        printf("%d\n",strlen(s));
    }
    return 0;
}

Measured memory_bytes: 1040
import java.util.*;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    String t = sc.next();
    int a = sc.nextInt();
    int b = sc.nextInt();
    String u = sc.next();
    int c = a;
    int d = b;

    if (s.equals(u)) {
      c = a - 1;
    } else if (t.equals(u)) {
      d = b - 1;
    }
    System.out.println(c + " " + d);
  }
}

Measured memory_bytes: 21972
#include<iostream>
#include<map>
using namespace std;
typedef long long ll;
map<char,int>vis;
int main(){
	string s;
	cin>>s;
	int sum=0;
	for(int i=0;i<s.size();i++){
		if(vis[s[i]]==1) sum++;
		vis[s[i]]++;
	}
	if(sum==2) puts("Yes");
	else puts("No");
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define xx first
#define yy second
#define mp make_pair
#define pb push_back
#define mset(x, y) memset(x, y, sizeof x)
#define mcpy(x, y) memcpy(x, y, sizeof x)
using namespace std;

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

inline int Read()
{
	int x = 0, f = 1, c = getchar();
	for (; !isdigit(c); c = getchar())
		if (c == '-')
			f = -1;
	for (;  isdigit(c); c = getchar())
		x = x * 10 + c - '0';
	return x * f;
}

const int MAXN = 105;

int n, m, x, y, a[MAXN];

int main()
{
#ifdef wxh010910
	freopen("data.in", "r", stdin);
#endif
	n = Read(), m = Read();
	if (m == 1)
	{
		a[1] = Read();
		if (a[1] == 1)
			puts("1\n1\n1");
		else
			printf("%d\n2\n1 %d\n", a[1], a[1] - 1);
		return 0;
	}
	for (int i = 1; i <= m; i ++)
		if ((a[i] = Read()) & 1)
			if (!x)
				x = i;
			else if (!y)
				y = i;
			else
				return puts("Impossible"), 0;
	if (x)
		swap(a[1], a[x]);
	if (y)
		swap(a[y], a[m]);
	for (int i = 1; i <= m; i ++)
		printf("%d%c", a[i], i == m ? '\n' : ' ');
	printf("%d\n", m - (a[m] == 1));
	printf("%d ", a[1] + 1);
	for (int i = 2; i < m; i ++)
		printf("%d ", a[i]);
	if (a[m] ^ 1)
		printf("%d", a[m] - 1);
	putchar(10);
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	int N = sc.nextInt();
	int sum = 0;
	int max = 0;
	int arr[] = new int[N];
		for(int i=0; i<N; i++){
		arr[i] = sc.nextInt();
		sum = sum + arr[i];
			if(max<arr[i]){
			max=arr[i];
			}
		}
		if(max*2<sum){
		System.out.println("Yes");
		}else{
		System.out.println("No");
		}
	}
}
		

  
	

Measured memory_bytes: 23380
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int a,b;
    string s;
    cin>>a>>b;
    cin>>s;
    if(s[a]!='-')
    {
        cout<<"No"<<endl;
        return 0;
    }
    for(int i=0;i<a+b;i++)
    {
        if(i==a)
        {
            continue;
        }
        if(s[i]<'0' || s[i]>'9')
        {
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(LL i=0;i<N;++i)
typedef long long int LL;

std::vector<std::vector<LL>>G1, G2;
std::set<std::pair<LL, LL>>path;
std::vector<bool>vis;
std::vector<LL>outs;
std::vector<std::pair<LL, LL>>ans;

void dfs1(LL v)
{
	for (LL u : G1[v])
	{
		if (!vis[u])
		{
			path.insert(std::make_pair(v, u));
			vis[u] = true;
			dfs1(u);
		}
	}
}

void dfs2(LL v, LL p)
{
	if (vis[v]) return;
	vis[v] = true;
	for (LL u : G2[v]) dfs2(u, v);
	if (p != -1)
	{
		if (outs[v] % 2 == 0)
		{
			++outs[p];
			ans.push_back(std::make_pair(p, v));
		}
		else
		{
			++outs[v];
			ans.push_back(std::make_pair(v, p));
		}
	}
}

int main()
{
	LL N, M;
	in >> N >> M;
	std::vector<LL>A(M), B(M);
	rep(i, M) in >> A[i] >> B[i];

	G1.resize(N + 1);
	vis.resize(N + 1);
	rep(i, M)
	{
		G1[A[i]].push_back(B[i]);
		G1[B[i]].push_back(A[i]);
	}
	vis[1] = true;
	dfs1(1);

	G2.resize(N + 1);
	vis.clear(); vis.resize(N + 1);
	outs.resize(N + 1);
	rep(i, M)
	{
		auto it1 = path.find(std::make_pair(A[i], B[i]));
		auto it2 = path.find(std::make_pair(B[i], A[i]));
		if (it1 != path.end()) G2[A[i]].push_back(B[i]);
		else if (it2 != path.end()) G2[B[i]].push_back(A[i]);
		else
		{
			++outs[A[i]];
			ans.push_back(std::make_pair(A[i], B[i]));
		}
	}
	dfs2(1, -1);

	if (M % 2 == 1) out << -1 << std::endl;
	else
	{
		rep(i, ans.size()) out << ans[i].first << " " << ans[i].second << std::endl;
	}
}


Measured memory_bytes: 31984
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <map>
#include <cstdio>
#include <string>
#include <cstdlib>
#include <cstring>
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
typedef string str;
typedef std::pair<ll,ll> pl;
typedef std::map<string, ll> msl;
typedef std::map<ll, ll> mll;
typedef std::vector<ll> vl;
const long double EPS = 1e-9;
 
#define rep(i, n) for(ll (i) = 0; (i) < (n) ; (i)++ )
#define For(i, a, b) for(ll (i) = (a); (i) < (b) ; (i)++ )
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define tol(c) char((c)+0x20)
#define tou(c) char((c)-0x20)
#define pb push_back
#define mp make_pair
#define pr(a) cout << (a)
#define prl(a) cout << (a) << endl
#define prl2(a,b) cout << (a) << " " << (b) << endl
#define prs(a) cout << (a) << " "
#define yn(condition) if ((condition)) prl("Yes"); else prl("No");
#define YN(condition) if ((condition)) prl("YES"); else prl("NO");
#define rpr(i,n,ans) rep((i),(n)) prs((ans[(i)]))
#define cpr(i,n,ans) rep((i),(n)) prl((ans[(i)]))
#define in1(a) cin >> (a)
#define in2(a,b) cin >> (a) >> (b)
#define in3(a,b,c) cin >> (a) >> (b) >> (c)
#define in4(a,b,c,d) cin >> (a) >> (b) >> (c) >> (d)
#define rin1(i,n,a) rep((i),(n)) cin >> (a[(i)])
#define rin2(i,n,a,b) rep((i),(n)) cin >> (a[(i)]) >> (b[(i)])
#define rin3(i,n,a,b,c) rep((i),(n)) cin >> (a[(i)]) >> (b[(i)]) >> (c[(i)])
#define e1 first
#define e2 second
#define ctol(c) ll((c)) - ll('0')
#define ltos(n) to_string((n))
#define items(kv, v) for(auto &(kv): (v))
#define ndig(N, n) ctol(ll(ltos((N))[ll(ltos((N)).length()) - (n)]))
#define beto(a,b,c) (a) < (b) && (b) < (c)
#define betc(a,b,c) (a) <= (b) && (b) <= (c)
#define rsort(a,n) sort(a,a+n,greater<>())
 
const ll mod = 1e9 + 7;
const ll INF = mod * mod;
const ll MAX_N = 100;
 
int main(void){
    ll a,b,c,d;
    str s;

    in1(s);
    rep(i,s.length()) if (s[i] == ',') s[i] = ' ';
    prl(s);

    return 0;
}

Measured memory_bytes: 256
#include"bits/stdc++.h"
#include<boost/multi_array.hpp>
#include<boost/optional.hpp>
#include<boost/range/irange.hpp>
#include<boost/range/algorithm.hpp>
#include<boost/range/adaptor/reversed.hpp>
#include<boost/operators.hpp>
namespace adaptor = boost::adaptors;
template<class T>using p_queue = std::priority_queue<T, std::vector<T>, std::greater<>>;

void Main()
{
	int N, K;
	std::cin >> N >> K;
	std::vector<int> vec(N);
	for (auto& v : vec)
	{
		std::cin >> v;
	}
	std::vector<int> reversed(N);
	for (auto i : boost::irange(0, N))
	{
		reversed[N - 1 - i] = vec[i];
	}
	int max = 0;
	for (int a = 0; a <= std::min(N, K); ++a)
	{
		for (int b = 0; b <= std::min(N, K) - a; ++b)
		{
			std::vector<int> target;
			int sum = 0;
			for (int i : boost::irange(0, a))
			{
				target.emplace_back(vec[i]);
				sum += vec[i];
			}
			for (int i : boost::irange(0, b))
			{
				target.emplace_back(reversed[i]);
				sum += reversed[i];
			}
			max = std::max(max, sum);
			boost::sort(target);
			for (int i = 0; i < std::min<int>(K - (a + b), target.size()); ++i)
			{
				sum -= target[i];
				max = std::max(max, sum);
			}
		}
	}
	std::cout << max << std::endl;
}

int main()
{
	std::cin.tie(nullptr);
	std::ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	Main();
}

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

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);  
	
	const long long INF = 1e18 + 1;
	long long x, y; cin >> x >> y;
	long long rx = -1 * x, ry = -1 * y;
	long long case1 = 0, case2 = 1, case3 = 1, case4 = 2;
	if(y - x < 0) case1 = INF;
	else case1 += y - x;
	if(y - rx < 0) case2 = INF;
	else case2 += y - rx;
	if(ry - x < 0) case3 = INF;
	else case3 += ry - x;
	if(ry - rx < 0) case4 = INF;
	else case4 += ry - rx;
	cout << min(min(case1, case2), min(case3, case4)) << endl; 	
		
	
	return 0;	
}
  

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int E[300003] ,W [300003] ;
char tmp [300003] ;
int n;
int main ()
{
    ios::sync_with_stdio (false) ;
    while (cin>> n)
    {
        int lw ,le ;
        lw=le=0;
        int ans =n;
        fill (E,E+n,0) ;
        fill (W,W+n,0) ;
        cin>>tmp ;
        for (int i=0;i<n;i++)
        {

            if (tmp[i]=='W') lw ++ ;

            W[i]=lw;
        }
        for (int i=n-1;i>=0;i--)
        {
            if (tmp[i]=='E') le ++ ;
            E[i]=le;
        }
        for (int i=0;i<n;i++)
        {
            if (i==0) ans =min (ans, E[i+1]) ;
            else if (i==n-1) ans =min (ans, W[i-1] ) ;
            else
            ans = min (ans, E[i+1] +W[i-1] ) ;
        }
        cout<<ans<<endl ;

    }
    return 0;
}

Measured memory_bytes: 2944
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>

using namespace std;

int main() {
	int k, x;
	cin >> k >> x;


	for (int i = -k + 1; i <= k - 1; i++) {
		if (i != -k + 1) {
			cout << " ";
		}
		cout << x + i;
	}
	cout << endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <utility>
#include <string>
#include <vector>
#include <list>

using namespace std;
int a(int A, int B, int C){

    int max_c = B / A;

    return min(max_c, C);


}

int b(int A, int B, int K){
    int count = 0;
    int i = min(A,B) + 1; // kitanai
    while(count < K){
        i--;
        if (A % i == 0 && B % i == 0){
            count++;
        }

    }

    return i;
}


int c(string S){


    int red_num = 0;
    int bl_num = 0;
    for(auto p = S.begin(); p != S.end(); p++){
        if (*p == '0'){
            red_num++;
        }else if(*p == '1' ){
            bl_num++;
        }
    }

    return 2*min(red_num, bl_num);



}

int main(){
    int A,B,K; cin >> A >> B >> K;

    cout << b(A,B,K);

    return 0;

}


Measured memory_bytes: 888
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        String[] asis = reader.readLine().split("");
        String[] tobe = reader.readLine().split("");
        int i = 0;
        int count =0;
        for (String s : asis) {
            if (!s.equals(tobe[i])) {
                count++;
            }
            i++;
        }
        System.out.println(count);

    }
}

Measured memory_bytes: 63688
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

const (
	initialBufSize = 100000
	maxBufSize     = 10000000
)

var (
	sc = bufio.NewScanner(os.Stdin)
	wt = bufio.NewWriter(os.Stdout)
)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	i, _ := strconv.Atoi(next())
	return i
}

func nextInts(n int) []int {
	slice := make([]int, n)
	for i := 0; i < n; i++ {
		slice[i] = nextInt()
	}
	return slice
}

func nextFloat64() float64 {
	f, _ := strconv.ParseFloat(next(), 64)
	return f
}

func nextFloat64s(n int) []float64 {
	slice := make([]float64, n)
	for i := 0; i < n; i++ {
		slice[i] = nextFloat64()
	}
	return slice
}

func putf(format string, a ...interface{}) {
	fmt.Fprintf(wt, format, a...)
}

func puts(a ...interface{}) {
	fmt.Fprintln(wt, a...)
}

func max(nums ...int) int {
	ret := nums[0]
	for _, v := range nums {
		if v > ret {
			ret = v
		}
	}
	return ret
}

func sum(a []int) int {
	ret := 0
	for _, v := range a {
		ret += v
	}
	return ret
}

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, initialBufSize), maxBufSize)
	defer wt.Flush()

	const MAX = 1000000001

	n := nextInt()
	a, b, c := nextInts(n), nextInts(n), nextInts(n)
	sort.Sort(sort.IntSlice(a))
	sort.Sort(sort.IntSlice(b))
	sort.Sort(sort.IntSlice(c))

	sb, sc := make([]int, n), make([]int, n)
	for ai, bi := 0, 0; bi < n; bi++ {
		for ai < n && a[ai] < b[bi] {
			sb[bi]++
			ai++
		}
		if bi > 0 {
			sb[bi] += sb[bi-1]
		}
	}
	for bi, ci := 0, 0; ci < n; ci++ {
		for bi < n && b[bi] < c[ci] {
			sc[ci] += sb[bi]
			bi++
		}
		if ci > 0 {
			sc[ci] += sc[ci-1]
		}
	}

	puts(sum(sc))
}


Measured memory_bytes: 7552
function main(input) {
  const tmp = input.trim().split(' ')
  const s = parseInt(tmp[0], 10)
  const w = parseInt(tmp[1], 10)

  if (w >= s) {
    console.log('unsafe')
  } else {
    console.log('safe')
  }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'))

Measured memory_bytes: 29604
#include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#include<cstring>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<fstream>

#define MOD (1000000007)

using namespace std;

typedef long long int Int;

constexpr Int TEN(int n) { return n == 0 ? 1 : 10 * TEN(n-1); }

Int dp[100000+10][2];
string L;

int main(void) {
    cin>>L;

    dp[0][0] = 1;
    for(int i = 0;i < L.size();i++) {
        //a+b == 0
        if(L[i] == '0') {
            dp[i+1][0] += dp[i][0];
            dp[i+1][1] += dp[i][1];
        } else {
            dp[i+1][1] += (dp[i][0] + dp[i][1]) % MOD;
        }

        //a+b == 1
        if(L[i] == '0') {
            dp[i+1][1] += dp[i][1] * 2 % MOD;
        } else {
            dp[i+1][1] += dp[i][1] * 2 % MOD;
            dp[i+1][0] += dp[i][0] * 2 % MOD;
        }
    }

    cout<<(dp[L.size()][0]+dp[L.size()][1]) % MOD<<endl;

    return 0;
}


Measured memory_bytes: 2048
#include <bits/stdc++.h>
#define M 100005
using namespace std;
int f[M], a[M], n, k;
int check(int d){
    int res = INT_MAX;
    for(int i = d - 1; i >= 0; --i){
        if(d - i > k){
            return res;
        }
        else{
            res = min(res, f[i] + abs(a[i] - a[d]));
        }
    }
    return res;
}
int main(){
    cin >> n >> k;
    for(int i = 0; i < n; ++i){
        cin >> a[i];
    }
    for(int i = 1; i < n; ++i){
        f[i] = check(i);
    }
    cout << f[n - 1];
    return 0;
}


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

using namespace std;

int main() {
    int n, m;
    cin >> n >> m;
    vector<int> l(m), r(m);
    for (int i = 0; i < m; i++) {
        cin >> l[i] >> r[i];
    }
    sort(l.rbegin(), l.rend());
    sort(r.begin(), r.end());
    cout << max(0, r[0] - l[0] + 1) << endl;
}

Measured memory_bytes: 1024
N,M = map(int, input().split())
A = [int(N) for N in input().split()]
list.sort(A, reverse = True)

sum = 0
i = 0
while i != N:
    sum += A[i]
    i += 1

vote = sum / (4 * M)

i = 0
while i != M:
    if A[i] < vote:
        print("No")
        break
    i += 1
    if i == M:
        print("Yes")


Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define sz(x) ((int)x.size())
#define pb push_back
#define ii pair<int,int>
#define ppb pop_back
#define orta ((bas+son)/2)
#define st first
#define nd second
#define ll long long
#define N 100005
#define inf 1000000000000000001
#define MOD 998244353 
using namespace std;

int n,m,v,p;
int a[N];
ll pre[N];

int main() {

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

	for(int i=1;i<=n;i++) scanf("%d",a+i);

	sort(a+1,a+1+n);
	int cnt=p;

	for(int i=1;i<=n;i++) pre[i]=pre[i-1]+a[i];

	for(int i=n-p;i>=1;i--) {

		int cur_v=v-1;
		int to_low=min(cur_v,i-1);
		cur_v-=to_low;
		int to_high=min(p-1,cur_v);
		cur_v-=to_high;

		int l=i+1,r=n-p+1;
		int target=a[i]+m;

		ll req=(ll)(r-l+1)*target-(pre[r]-pre[l-1]);

		if(a[r]>target || req<(ll)m*cur_v) break ;

		cnt++;

	}

	printf("%d",cnt);

}

Measured memory_bytes: 1408
function main()    
    N,M,X=parse.(Int,split(readline()))
    C=zeros(Int,N)
    A=zeros(Int,N,M)

    for i in 1:N
        tmp=parse.(Int,split(readline()))
        C[i]=tmp[1]
        A[i,:]=tmp[2:end]
    end

    minD=10^5*12+1
    for i in 1:2^N
        P=ones(Bool,N)
        for j in 1:N
            P[j]=count_ones(i & 2^(j-1))
        end
        flag10=true
        for j in 1:M
            if sum(P.*A[:,j]) < X
                flag10=false
                break
            end
        end
        
        if flag10 && (minD>sum(P.*C))
            minD = sum(P.*C)
        end
    end
    (minD==10^5*12+1) && (minD=-1)
    print(minD)
end
main()

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

int main(){
    bool n,s,e,w; n = s = e = w = false;
    string str; cin >> str;
    int len = str.length();
    for(int i = 0; i < len; i++){
        if(str[i] == 'S') s = true;
        if(str[i] == 'W') w = true;
        if(str[i] == 'E') e = true;
        if(str[i] == 'N') n = true;
    }
    if(!s^n && !e^w) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

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

int main() {
    int x; cin >> x;
    if(x == 1){
        cout << 0 << endl;
    } else {
        cout << 1 << endl;
    }

    return 0;
}

Measured memory_bytes: 3592
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
int a[1001];
int main(){
	int i,n,x=0;
	string s;
	cin>>n;
	cin>>s;
	for(i=0;i<n;i++)
	{
		if(s[i]=='I') 
		{
			x++;
			a[i]=x;
		 } 
		 if(s[i]=='D')
		 {
		 	x--;
		 	a[i]=x;
		 }
	}
	int max=a[0];
	for(i=0;i<n;i++)
	{
		if(a[i]>=max) max=a[i];
	 }
	 if(max<0) 
	 {
	 	cout<<0;
	 	return 0;
	  } 
	  cout<<max;
	return 0;
}


Measured memory_bytes: 256
n = gets.to_i
n.times{
  d = gets
  s = d.split(" ").map(&:to_i)
  if s[0] ** 2 + s[1] ** 2 == s[2] ** 2 then
    puts "YES"
  elsif s[1] ** 2 + s[2] ** 2 == s[0] ** 2 then
    puts "YES"
  elsif s[2] ** 2 + s[0] ** 2 == s[1] ** 2 then
    puts "YES"
  else
    puts "NO"
  end
}

Measured memory_bytes: 6116
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
using namespace std;
typedef long long ll;
const int maxn = 1e5+10;
ll a[maxn];
int main(int argc, const char * argv[]) {
    ll n, k;
    scanf("%lld%lld", &n, &k);
    for (int i = 0; i<n; i++) {
        scanf("%lld", &a[i]);
    }
    ll ans = 1e18;
    for(int i = 0; i<n-k+1; i++){
        ans = min(ans, a[i+k-1]-a[i]+min(abs(a[i]), abs(a[i+k-1])));
        //printf("%lld\n", ans);
    }
    printf("%lld\n", ans);
    return 0;
}

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

using namespace std;

//#include <ext/pb_ds/assoc_container.hpp> // Common file
//#include <ext/pb_ds/tree_policy.hpp>     // Including tree_order_statistics_node_updat
//using namespace __gnu_pbds;

typedef long long int ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef vector<string>vst;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef map<int,int> dct;
//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;


#define fastio ios_base::sync_with_stdio(false);cin.tie(0)
#define all(ct) ct.begin() , ct.end()
#define endl "\n"
#define fr(i,a) for(auto i:a)
#define f(i,a,b) for(int i=a;i<b;i++)
#define fd(i,a,b) for(int i=a;i>=b;i--)
#define pb push_back
#define in(d,v) d.find(v)!=d.end()
#define mp make_pair

const int mod = 1e9 + 7;
const ll inf = ll(1e18);
const int sz = 1e5+5;
const ll cfmod = 998244353;

int main() {
    //clock_t tm = clock();
    fastio;
    ll l,n,r,e,m,q,k,t=0,y,w;string s;
    cin>>n;
    cout<<ll(pow(n,3))<<endl;
    //cout<<((clock()-tm)*1.0)/CLOCKS_PER_SEC<<endl;
}

Measured memory_bytes: 384
#include<stdio.h>
#include<string.h>
int main()
{
	char s[200005];
	scanf("%s",s);
	int left,right;
	left=0;
	while(s[left]!='A')
	  left++;
	right=0;
	int i;
	for(i=0;i<strlen(s);i++)
	{
		if(s[i]=='Z')
		  right=i;
	}
	printf("%d\n",right-left+1);
	return 0;
}

Measured memory_bytes: 384
import numpy as np
# import math
# import copy
# from collections import deque
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(10000)
from numba import njit,i8


@njit(i8[:](i8,i8[:],i8[:],i8,i8,i8))
def SerchLoop(M,A,cnt,start,end,temp):
    for i in range(1,M+2):
        temp = A[i-1] ** 2
        temp %= M
        if cnt[temp] != 0:
            start = cnt[temp]
            end = i - 1
            break
        A[i] = temp
        cnt[temp] = i
    return np.append(np.append(A,start),end)


def main():
    N,X,M = map(int,input().split())

    A = [-1 for i in range(M+2)]
    A[0] = X
    A = np.array(A)

    start = -1
    end = -1

    cnt = [0 for i in range(M)]
    cnt[X] = 0
    cnt = np.array(cnt)

    C = SerchLoop(M,A,cnt,start,end,0)
    A = C[:-2]
    start = C[-2]
    end = C[-1]

    L = end - start + 1

    if start == -1:
        straight = [0 for i in range(N)]
        for i in range(N):
            straight[i] = straight[i-1] + A[i]
        res = straight[-1]
    elif start == 0:
        loop = [0 for i in range(L)]
        for i in range(L):
            loop[i] = loop[i-1] + A[start+i]
        res = (N // L) * loop[-1]
        if N % L != 0:
            res += loop[N % L - 1]
    else:
        straight = [0 for i in range(start)]
        for i in range(start):
            straight[i] = straight[i-1] + A[i]
        loop = [0 for i in range(L)]
        for i in range(L):
            loop[i] = loop[i-1] + A[start+i]
        if N >= start:
            res = straight[-1]
            N -= start
        else:
            res = straight[N-1]
            N = 0
        res += (N // L) * loop[-1]
        if N % L != 0:
            res += loop[N % L - 1]

    print(res)



main()


Measured memory_bytes: 123328
import math
import bisect
import collections
import itertools
def gcd(a,b):return math.gcd #最大公約数
def lcm(a,b):return (a*b) // math.gcd(a,b) #最小公倍数
def iin(): return int(input()) #整数読み込み
def imn(): return map(int, input().split()) #整数map取得
def iln(): return list(map(int, input().split())) #整数リスト取得
def iln_s(): return sorted(iln()) # 昇順の整数リスト取得
def iln_r(): return sorted(iln(), reverse=True) # 降順の整数リスト取得
def join(l, s=''): return s.join(l) #リストを文字列に変換
def perm(l, n): return itertools.permutations(l, n) # 順列取得
def comb(l, n): return itertools.combinations(l, n) # 組み合わせ取得
def divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    return divisors

S,T = input().split()

print(T+S)


Measured memory_bytes: 3568
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll,ll>;
using vl = vector<ll>;
using Map = map<ll,ll>;
using T = tuple<ll,ll,ll>;
using vvl = vector<vector<ll>>;
#define all(v) v.begin(), v.end()
#define prt(v) cout<<(v)<<"\n";
#define fi(v) get<0>(v)
#define se(v) get<1>(v)
#define th(v) get<2>(v)
#define endl "\n"
template <typename T> bool chmax(T &a, const T &b){if (a<b){a=b;return 1;}return 0;}
template <typename T> bool chmin(T &a, const T &b){if (a>b){a=b;return 1;}return 0;}
const ll INF=1LL<<60;
const ll MOD=1000000007;

//dp[i][j]はそれぞれiグラム、jグラム買うときの最小価格
vector<vector<ll>> dp(500, vector<ll>(500, INF));

signed main(void){
    cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    ll Ma;
    cin >> Ma;
    ll Mb;
    cin >> Mb;
    vector<ll> a(N,0);
    vector<ll> b(N,0);
    vector<ll> c(N,0);
    for(ll i=0;i<N;++i)cin>>a[i]>>b[i]>>c[i];
    dp[0][0]=0;
    //１つずつ商品を解禁
    for(ll i=0;i<N;++i){
        for(ll j=499;j>=a[i];--j){
            for(ll k=499;k>=b[i];--k){
                if(dp[j-a[i]][k-b[i]]==INF)continue;
                chmin(dp[j][k],dp[j-a[i]][k-b[i]]+c[i]);
            }
        }
    }
    ll ans=INF;
    ll A=Ma,B=Mb;
    while(A<500&&B<500){
        chmin(ans,dp[A][B]);
        A+=Ma;B+=Mb;
    }
    if(ans==INF)prt(-1)
    else prt(ans)

    return 0;
}


Measured memory_bytes: 2176
n,m=map(int,input().split())
*a,=map(int,input().split())
l=[list(map(int,input().split()))[::-1] for _ in range(m)]
a.sort()
d=[]
e=0
for c,b in sorted(l)[::-1]:
	d+=[c]*b
	e+=b
	if e>n:break
for i,(x,y) in enumerate(zip(a,d)):
	if x<y:a[i]=y
print(sum(a))

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

int N, K;

int main() {
  string S;
  cin>>N>>K;
  cin >> S;

  int tmp = 0;

  for (int i = 0; i < K; i++) {
    int lr_first = (int)S.find("LR", tmp);
    int rl_first = (int)S.find("RL", tmp);

    if (lr_first < rl_first && lr_first != -1 && rl_first != -1) {
      int rml = rl_first-lr_first;
      string S_tmp = S.substr(lr_first+1, rml);
      for (int ii = 0; ii < rml; ii++) {
        if (S_tmp[rml-1 - ii] == 'L')
          S[lr_first+1 + ii] = 'R';
        else
          S[lr_first+1 + ii] = 'L';
      }
      tmp = rl_first;

    } else if (rl_first < lr_first && lr_first != -1 && rl_first != -1) {
      int lmr = lr_first-rl_first;
      string S_tmp = S.substr(rl_first+1, lmr);
      for (int ii = 0; ii < lmr; ii++) {
        if (S_tmp[lmr-1 - ii] == 'L')
          S[rl_first+1 + ii] = 'R';
        else
          S[rl_first+1 + ii] = 'L';
      }
      tmp = lr_first;

    } else {
      int l_f = (int)S.find("L");
      int r_f = (int)S.find("R");
      if (l_f == -1 || r_f == -1) break;
      if (l_f < r_f) {
        int rml = r_f-l_f;
        string S_tmp = S.substr(l_f, rml);
        for (int ii = 0; ii < rml; ii++) {
          if (S_tmp[rml-1 - ii] == 'L')
            S[l_f + ii] = 'R';
          else
            S[l_f + ii] = 'L';
        }

      } else {
        int lmr = l_f-r_f;
        string S_tmp = S.substr(r_f, lmr);
        for (int ii = 0; ii < lmr; ii++) {
          if (S_tmp[lmr-1 - ii] == 'L')
            S[r_f + ii] = 'R';
          else
            S[r_f + ii] = 'L';
        }
      }
    }
  }

  int sum = 0;
  if (S[0] == 'R' && N > 1 && S[1] == 'R') sum++;
  if (S[N-1] == 'L' && N > 1 && S[N-2] == 'L') sum++;
  for (int i = 1; i < N-1; i++) {
    if ((S[i] == 'R' && S[i+1] == 'R') || (S[i] == 'L' && S[i-1] == 'L'))
      sum++;
  }

  cout << sum << endl;

  return 0;
}


Measured memory_bytes: 512