akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for(long long i=0; i<n; i++)
#define Rep(i,n) for(long long i=1; i<n; i++)
#define ll long long
#include <math.h>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <queue>
#include <set>
#include <vector>


using namespace std;
#define PI acos(-1)
using P =pair<int,int>;

ll ketasu(ll a){
   ll num=1;
   while(a/10){
       num++;
       a/=10;
   }
   return num;
}

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

ll kosuu(ll a){
    ll sum=0;
    for(ll i=1;i*i<=a;i++){
        if(a%i==0){
            if(a!=1&&i*i!=a){
            sum+=2;
            }else{
             sum++;   
            }
        }
    }
    return sum;
}
ll M=1000005;

const int INF =1000000000;
vector<int> to[1000005];

int main()
{
ll a;
string b;
cin>>a>>b;
ll c=(b[0]-'0')*100+(b[2]-'0')*10+(b[3]-'0');


cout<<a*c/100<<endl;
}



Measured memory_bytes: 27032
import java.util.*;

public class Main {

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

	public void run() {
		Scanner sc = new Scanner(System.in);
		long k = sc.nextLong();
		int n=50;
		long a[] = new long[n];
		for(int i=0; i<n; i++) {
			a[i]=i;
		}
		long cnt = k/n;
		for(int i=0; i<n; i++) {
			a[i]+=cnt;
		}
		int amari = (int)(k%n);
		for(int i=0; i<amari; i++) {
			a[i] += 50;
			a[i] -= (amari-1);
		}
		for(int i=amari; i<n; i++) {
			a[i] -= (amari);
		}
		Arrays.sort(a);
		System.out.println(n);
		for(int i=0; i<n; i++) {
			if(i>0) System.out.print(" ");
			System.out.print(a[i]);
		}
		System.out.println();
		sc.close();
	}
}


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

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            var line = System.Console.ReadLine();
            var l = line.Split(' ');
            var N = int.Parse(l[0]);
            var K = int.Parse(l[1]);

            var line2 = System.Console.ReadLine();
            var l2 = line2.Split(' ');
            ulong[] H = new ulong[N];
            for(int i=0; i<N; i++)
            {
                H[i] = ulong.Parse(l2[i]);
            }
            Array.Sort(H);

            ulong sum = 0;
            for(int i=0; i<N-K; i++)
            {
                sum += H[i];
            }

            Console.Write("{0}", sum);
        }
    }
            
}


Measured memory_bytes: 33536
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, n, s) for (int i = (s); i < (n); i++)
#define MOD 1000000007
typedef long long ll;
using namespace std;
using Graph = vector<vector<int>>;

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

    return b ? gcd(b, a % b) : a;
}
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<int> A(N);
    vector<int> idx(N);
    rep(i, N)
    {
        cin >> A[i];
    }

    vector<int> left(N + 1, 0), right(N + 1, 0);
    for (int i = 0; i < N; i++)
    {
        left[i + 1] = gcd(left[i], A[i]);
    }
    for (int i = N - 1; i >= 0; i--)
    {
        right[i] = gcd(right[i + 1], A[i]);
    }

    int ans = 0;
    rep(i, N)
    {
        int l = left[i];
        int r = right[i + 1];
        ans = max(ans, gcd(l, r));
    }
    cout << ans << endl;
  //  system("pause");
    return 0;
}

Measured memory_bytes: 1792
/// referenced: https://beta.atcoder.jp/contests/abc110/submissions/3387967
#include <bits/stdc++.h>
#define int int64_t
using namespace std;
const int MOD=1000000007;
int power(int a,int n){
  if(n==0)return 1;
  const int half=power(a,n/2);
  int ans=half*half%MOD;
  if(n%2==1){
    ans*=a;
    ans%=MOD;
  }
  return ans;
}
int nCr(int n,int r){
  if(r>n-r)return nCr(n,n-r);
  int mul=1;
  int div=1;
  for(int i=0;i<r;i++){
    mul*=n-i;
    mul%=MOD;
    div*=i+1;
    div%=MOD;
  }
  int ans=mul*power(div,MOD-2)%MOD;
  return ans;
}
main(){
  int N;
  int M;
  cin>>N>>M;
  int ret=1;
  for(int i=2;i*i<=M;i++){
    int cnt=0;      // Number of prime factor i in M.
    while(M%i==0){  // M has factor i.
      cnt++;
      M/=i;         // Removes factor i from M.
    }
    if(cnt==0)continue;  // i wasn't a factor.
    ret*=nCr(cnt+N-1,N-1);
    ret%=MOD;
  }
  if(M!=1){
    ret*=N;
    ret%=MOD;
  }
  cout<<ret<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
   int n,t;
   cin >> n >> t;
   int ans = 1e9;
   for(int i=0;i<n;i++){
      int c,T;
      cin >> c >> T;
      
      if(c < ans && T <=t){
         ans = c;

      }
   }
   if(ans == 1e9){
      cout << "TLE" <<endl;

   }
   else cout << ans  << endl;
}

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

int dfs(int a,int b){
    int ak=floor(log10(a)+1),bk=floor(log10(b)+1);//a,bの桁数
    if(bk==ak){//これ以上桁数を増やせない
        if(b<=a){
            vector<int> v(3,0);
            int c=b;
            for(int i=0;i<ak;i++){
                int tmp=c%10;
                if(tmp==3){
                    v[0]=1;
                }else if(tmp==5){
                    v[1]=1;
                }else if(tmp==7){
                    v[2]=1;
                }
                c/=10;
            }
            if(v[0]==1 && v[1]==1 && v[2]==1){
                return 1;
            }else{//753全て現れない場合
                return 0;
            }
        }else{//aと桁数は一致したが，aより大きい場合は無効
            return 0;
        }
    }else if(bk<ak){//aよりまだ桁数が小さい場合
        vector<int> v(3,0);
        int c=b;
        for(int i=0;i<ak;i++){
            int tmp=c%10;
            if(tmp==3){
                v[0]=1;
            }else if(tmp==5){
                v[1]=1;
            }else if(tmp==7){
                v[2]=1;
            }
                c/=10;
        }
        if(v[0]==1 && v[1]==1 && v[2]==1){
            return (1+dfs(a,b*10+3)+dfs(a,b*10+5)+dfs(a,b*10+7));
        }else{//753全て現れない場合
            return (dfs(a,b*10+3)+dfs(a,b*10+5)+dfs(a,b*10+7));
        }
    }else{
        return 0;
    }
}

int main(){
    int n;
    cin>>n;
    cout<<dfs(n,0)<<endl;
    return 0;
}
    

Measured memory_bytes: 512
package main

import (
	"fmt"
	"strings"
	"strconv"
)

func main() {
	var h, w int
	fmt.Scan(&h, &w)

	mmm := make([]string, h)
	ms := make([][]string, h)
	for i := 0; i < h; i++ {
		fmt.Scan(&mmm[i])
	}
	for i := 0; i < h; i++ {
		ms[i] = strings.Split(mmm[i], "")
	}

	inRange := func(row int, col int) bool {
		return 0 <= row && row < h && 0 <= col && col < w
	}

	isBom := func(s string) bool {
		return s == "#"
	}

	checkAround := func(i int, j int) (count int) {
		for k := -1; k <= 1; k++ {
			for l := -1; l <= 1; l++ {
				ik := i + k
				jl := j + l
				if inRange(ik, jl) && isBom(ms[ik][jl]) {
					count++
				}
			}
		}
		return
	}

	for i := 0; i < h; i++ {
		for j := 0; j < w; j++ {
			if ms[i][j] == "." {
				ms[i][j] = strconv.Itoa(checkAround(i, j))
			}
		}
	}

	for i := 0; i < h; i++ {
		fmt.Println(strings.Join(ms[i], ""))
	}
}


Measured memory_bytes: 640
n=int(input())
a=list(map(int,input().split()))
a.sort(reverse=True)
ans=0
b=-1
for i in a:
  if i==b:
    if ans!=0:
      ans*=i
      break
    else:
      ans=i
      b=-1
      continue
  b=i
print(ans)

Measured memory_bytes: 19948
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
#define rep(i,n) for (ll i=0;i<(n);++i)
#define rep2(i,a,b) for (ll i=(a);i<(b);++i)
#define debug(x) cout << #x << '=' << x << endl
#define all(v) (v).begin(),(v).end()
const ll MOD=1e9+7;
//const ll MOD=998244353;
const ll INF=1e9;
const ll IINF=1e18;
const double EPS=1e-8;
const double pi=acos(-1);

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

const int MAX_N=2e5+10;

int N,Q;
vector<vector<int>> G(MAX_N);
vector<ll> cnt(MAX_N,0);

void dfs(int v,int p){
    for (int u:G[v]){
        if (u==p) continue;
        cnt[u]+=cnt[v];
        dfs(u,v);
    }
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N >> Q;
    rep(i,N-1){
        int a,b; cin >> a >> b; --a,--b;
        G[a].emplace_back(b);
        G[b].emplace_back(a);
    }
    rep(i,Q){
        int p; ll x; cin >> p >> x;
        cnt[--p]+=x;
    }
    dfs(0,-1);
    rep(i,N){
        cout << cnt[i];
        if (i!=N-1) cout << ' ';
        else cout << endl;
    }
}

Measured memory_bytes: 24320
s = input()
flag = 0

if s[0] == s[1] and s[2] == s[3]:
    if s[1] != s[2]:
        flag = 1
elif s[0] == s[2] and s[1] == s[3]:
    if s[1] != s[2]:
        flag = 1
elif s[0] == s[3] and s[1] == s[2]:
    if s[0] != s[1]:
        flag = 1

if flag == 1:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 3064
#include "bits/stdc++.h"
using namespace std;
#define int long long

signed main() {
	//int n, m;
	char s;
	cin >> s;
	//vector<tuple<int, int, int>> t(m);
	//vector<int> p(m);
	//vector<int> y(m);
	//for (size_t i = 0; i < m; i++)
	//{
	//	cin >> p[i];
	//	cin >> y[i];	
	//}

	if(s == 'A') cout << 'T' << endl;
	if (s == 'C') cout << 'G' << endl;
	if (s == 'G') cout << 'C' << endl;
	if (s == 'T') cout << 'A' << endl;

}




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n)  for (int i = 0; i < (int) (n); i++)
#define REP1(i, n) for (int i = 1; i <= (int) (n); i++)
#define all(x)     (x).begin(), (x).end()
#define SZ(x)      ((int) (x).size())
using ll = long long;

int main() {
  int n, k;
  cin >> n >> k;
  vector <bool> flag(n, false);
  REP(i, k) {
	int d;
	cin >> d;
	REP(j, d) {
	  int a;
	  cin >> a;
	  flag[a - 1] = true;
	}
  }
  int ans = 0;
  REP(i, n) {
	if (!flag[i]) {
		ans++;
	  }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3588
N=int(input())
a=list(map(int, input().split()))

b=len([i for i in a if i%2==0])

c=[]
for i in a:
    if i%2==0 and (i%3==0 or i%5==0) :
        c.append(i)

if len(c)==b:
    print('APPROVED')
else:
    print('DENIED')

Measured memory_bytes: 3060
n, m = gets.chomp.split(' ').map(&:to_i)
res = Array.new(n, 'WA')
pena_arr = Array.new(n, 0)
pena = 0
accu = 0

if m==0
  print("0 0")
else
  m.times do
    p, s = gets.chomp.split(' ')
    p = p.to_i
    if res[p-1]=='WA' && s=='WA'
      pena_arr[p-1] += 1
    elsif res[p-1]=='WA' && s=='AC'
      accu += 1
      pena += pena_arr[p-1]
      res[p-1] = 'AC'
    end
  end
  print(accu, ' ', pena)
end


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

int add(int x, int y){
    return x+y;
}

int main (){
    int a ,b, c;
    cin >> a >> b >> c;
    if(add(a,b)<=add(a,c)&& add(a,b)<= add(b,c)){
        cout << add(a,b) << endl;
    }else if(add(a,c) <= add(b,c)){
        cout << add(a,c) << endl;
    }else{
        cout << add (b,c) << endl;
    }
}

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


def solve(S: str):
    obj = {
        "Sunny": "Cloudy",
        "Cloudy": "Rainy",
        "Rainy": "Sunny"
    }
    print(obj[S])
    return

# 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)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    solve(S)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
 
int main() {
    vector<int> a = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    //rep(i,32) cin >> a[i];
    int k;
    cin >> k;
    cout << a[k-1] << endl;
    return 0;
}


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

#define rep(i, N) for (int i = 0; i < (N); i++)
#define all(a) (a).begin(), (a).end()
#define pb push_back

using ll = long long;
using i_i = tuple<int, int>;

bool zero(vector<int> a) {
    for (int x: a) if (x) return false;
    return true;
}

int main() {
    int H, W, N;
    cin >> H >> W >> N;
    vector<vector<int>> a(H, vector<int>(W));
    int i = 0;
    rep(y, H) {
        string s; cin >> s;
        rep(x, W) if (s[x] == '#') a[y][x] = ++i;
    }
    for (int y = 0; y + 1 < H; y++) if (zero(a[y + 1])) a[y + 1] = a[y];
    for (int y = H - 1; y - 1 >= 0; y--) if (zero(a[y - 1])) a[y - 1] = a[y];
    rep(y, H) {
        for (int x = 0; x + 1 < W; x++) if (!a[y][x + 1]) a[y][x + 1] = a[y][x];
        for (int x = W - 1; x - 1 >= 0; x--) if (!a[y][x - 1]) a[y][x - 1] = a[y][x];
    }
    rep(y, H) {
        rep(x, W) cout << a[y][x] << ' ';
        cout << endl;
    }
}


Measured memory_bytes: 1152
import sys
input = sys.stdin.readline
n = int(input())
h = tuple(map(lambda x:int(x)-1,input().split()))
a = tuple(map(int,input().split()))

#update(i,x):Aiをxに更新する
def update(i,x):
    k = i + num - 1
    while k >= 0:
        seg[k] = max(x,seg[k])
        k = (k-1)//2

#query(a,b,0,0,num):[a,b)の最大値
def query(a,b,k,l,r):
    if r <= a or b <= l:
        return -float("inf")
    elif a <= l and r <= b:
        return seg[k]
    else:
        return max(query(a,b,2*k+1,l,(l+r)//2),query(a,b,2*k+2,(l+r)//2,r))

#初期化
#num : nより大きい最小の2のべき乗
num = 1
while num <= n:
    num *= 2
seg = [0]*(2*num-1)

#dp[i]:i番目が最後となる時の美しさの最大値
dp = [a[0]] + [0]*(n-1)
update(h[0],a[0])
for i in range(1,n):
    dp[i] = max(0,query(0,h[i],0,0,num))+a[i]
    update(h[i],dp[i])

print(max(dp))


Measured memory_bytes: 122532
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Atc_0035
{
    class Program
    {
        static void Main(string[] args)
        {
            var s = Console.ReadLine();

            if (s == "22")
            {
                Console.WriteLine("Christmas Eve Eve Eve");

            }
            else if (s == "23")
            {
                Console.WriteLine("Christmas Eve Eve");
            }
            else if (s == "24")
            {
                Console.WriteLine("Christmas Eve");
            }
            else if (s == "25")
            {
                Console.WriteLine("Christmas");
            }

        }
    }
}


Measured memory_bytes: 25608
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define INF (ll)1e18+4
#define md 1000000007
#define mx 10000000
#define mk make_pair
#define __builtin_popcountll(x) one(x)
#define pi pair<int,int>
#define ss second
#define ff first
#define pb emplace_back 
#define all(s) s.begin(),s.end()
#define rall(x) (x).rbegin(), (x).rend()
#define trav(x, a) for (auto& x: a)
#define fr(i,a,b) for(int i=a;i<=b;i++)
#define rep(i,a,b) for(int i=a;i<b;i++)
#define per(i,a,b) for(int i=a;i>b;i--)
#define rf(i,a,b) for(int i=a;i>=b;i--)
#define sz(x) ((long long)x.size())
#define mez(s) memset(s,0,sizeof s)
#define mex(s) memset(s,-1,sizeof s)
#define metr(s) memset(s,true, sizeof s)
typedef vector<int> vi; 
typedef vector<ll>vl;
typedef map<int,int> mp;
typedef queue<int> que;
typedef vector<pi> vp;
//const int md=1e9+7;
bool ab[22][22];
void solve(){
	int n;
	cin>>n;
	rep(i,0,n)rep(j,0,n)cin>>ab[i][j];
    vl dp(1<<n);
    dp[0] = 1;
    for(int mask = 0; mask < (1 << n) - 1; ++mask) {
        int a = __builtin_popcount(mask);
        for(int b = 0; b < n; ++b) {
            if(ab[n-1-a][b] && !(mask & (1 << b))) {
                int m2 = mask|(1 << b);
                dp[m2]=(dp[m2]+dp[mask])%md;
            }
        }
    }
	cout<<dp[(1<<n)-1]<<"\n";
}
int main(){
//freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);
ios::sync_with_stdio(false);
cin.tie(0);
   int t=1;
   //cin>>t;
     while(t--){
     	solve();
	 }
     return 0;
}


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

int main(){
    vector<vector<int>> cij(3,vector<int>(3));
    rep(i,3){
        cin>> cij[i][0] >> cij[i][1] >> cij[i][2];
    }

    vector<int> row_sum(3,0);
    vector<int> col_sum(3,0);
    for(int k:{0, 1, 2}){
        for(int j:{0, 1, 2}){
            row_sum[k] += cij[k][j];
            col_sum[j] += cij[k][j];
        }
    }

    int sum1 = row_sum[0] - row_sum[1];
    int sum2 = row_sum[1] - row_sum[2];
    int sum3 = row_sum[2] - row_sum[0];

    if(sum1%3!=0 || sum2%3 !=0|| sum3%3 !=0){
        cout << "No" << endl;
        return 0;
    }

    sum1 = col_sum[0] - col_sum[1];
    sum2 = col_sum[1] - col_sum[2];
    sum3 = col_sum[2] - col_sum[0];

    if(sum1%3!=0 || sum2%3 !=0|| sum3%3 !=0){
        cout << "No" << endl;
        return 0;
    }

    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 3624
n=int(input())
if n%2==0:
    print(n*(n-2)//2)
else:
    print((n-1)*(n-3)//2+n-1)
    for i in range(n-1):
        print(i+1,n)
    n-=1
for i in range(1,n):
    for j in range(i+1,n+1):
        if i+j!=1+n:
            print(i,j)

Measured memory_bytes: 44528
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <time.h>
#define ll long long
#define double long double
#define itn int
#define endl '\n'
#define co(ans) cout<<ans<<endl;
#define COYE cout<<"YES"<<endl;
#define COYe cout<<"Yes"<<endl;
#define COye cout<<"yes"<<endl;
#define CONO cout<<"NO"<<endl;
#define CONo cout<<"No"<<endl;
#define COno cout<<"no"<<endl;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define ALL(V) ((V).begin(),(V).end())
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define INF ((1LL<<62)-(1LL<<31))
#define EPS 1e-10
#define PI 3.141592653589793238
#define MOD 1000000007
#define MAX 5100000
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;}
using namespace std;

int main(){
  ll N,K,ans=0;
  cin>>N>>K;
  
  for(int i=K; i<=N+1; ++i){
    ans+=i*(N-i+1)+1;
    ans%=MOD;
  }
  
  cout<<ans<<endl;
}

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

#define each(i, c) for (auto& i : c)
#define mkp(a, b) make_pair(a, b)

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> Pll;
const ll MOD = 1e9+7;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << ": " << p.second << ")"; return os; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ", "; os << ")"; return os; }
template<typename K, typename V> ostream& operator << (ostream& os, map<K, V> m) { os << "{"; each (i, m) os << i << ", "; os << "}"; return os; }

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

  vector<ll> d(k);
  for (ll i = 0; i < k; ++i) {
    cin >> d[i];
  }
  vector<ll> m(10);
  for (ll i = 0; i < k; ++i) {
    m[d[i]] = 1;
  }

  ll ans = n;
  while (true) {
    bool ok = true;
    string s = to_string(ans);
    for (ll i = 0; i < s.size(); ++i) {
      ll x = s[i]-'0';
      if (m[x]) {
        ok = false;
        break;
      }
    }

    if (ok) break;
    ++ans;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#pragma comment(linker,"/stack:16777216")
#include<iostream>
#include<cstdio>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<list>
#include<stack>
#include<queue>
#include<deque>
#include<functional>
#include<utility>
#include<algorithm>
#include<sstream>
#include<cstring>
#include<cmath>
#include<cctype>
#include<exception>
#include<climits>
#include<cfloat>
#include<iomanip>
#include<bitset>
#include<streambuf>
#include<cstdlib>
#include<ctime>
//#include"functions.h"
//#include"highprecision.h"
#define pb push_back
#define pf push_front
#define ppb pop_back
#define mp make_pair
#define np next_permutation
#define fi first
#define sc second
#define vi vector<int>
#define vll vector<long long>
#define vvi vector<vector<int> >
#define vpi vector<pair<int,int> >
#define pii pair<int,int>
#define pll pair<long long,long long>
#define pff pair<float,float>
#define pdd pair<double,double>
#define psi pair<string,int>
#define pis pair<int,string>
#define ppi pair<pii,int>
#define pdi pair<pii,pii>
#define LN 84757
#define INF 1e9
#define LLINF 1e18
#define MAXINT 0x7fffffff
#define MAXLL 0x7fffffffffffffff
#define EPS 1e-5
#define DEPS 1e-9
#define LDEPS 1e-13
#define MOD 1000000007
#define E 2.7182818284
#define PI 3.1415926535
#define rep(a,b) for(int a=0;a<b;a++)
#define rep(a,b) for(int a=0;a<b;a++)
#define forn(a,n) for(int a=1;a<=n;a++)
#define forr(a,n) for(int a=n;a>=1;a--)
#define repn(a,n,p) for(int a=0;a<n;a+=p)
#define repr(a,n) for(int a=n-1;a>=0;a--)
#define foreach(a,b) for(__typeof(b.begin())a=b.begin();a!=b.end();a++)
#define fillemp(a) memset(a,0,sizeof(a))
#define fillinf(a) memset(a,0x3f,sizeof(a))
#define frestream freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define stdf(a,b) freopen(a,"r",stdin);freopen(b,"w",stdout);
#define inputf(a) freopen(a,"r",stdin);
#define outputf(a) freopen(a,"w",stdout);
#define sz(a) a.size()
#define all(a) a.begin(),a.end()
#define MOD 1000000007
typedef long long ll;
typedef long double ld;
using namespace std;

int main(int argc,char** argv){
	int a;
	cin>>a;
	cout<<a+a*a+a*a*a;
	return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<P,int> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

ll Pow(ll n,ll p){
	ll r=1;
	for(;p>0;p>>=1){
		if(p&1) r=(r*n)%mod;
		n=(n*n)%mod;
	}
	return r;
}

const int M=2000005;
ll F[M];

void Init(){
	F[0]=1;
	for(int i=1;i<M;i++) F[i]=F[i-1]*i%mod;
}

ll Div(ll n,ll m){
	return n*Pow(m,mod-2)%mod;
}

ll nCk(ll n,ll k){
	return Div(F[n],F[n-k]*F[k]%mod);
}

ll nPk(ll n,ll k){
	return nCk(n,k)*F[k]%mod;
}

ll n,k;

int main(){
	cin>>n>>k;
	int t=0;
	for(int i=0;i<n;i++){
		ll x,y;
		cin>>x>>y;
		if(x*x+y*y<=k*k) t++;
	}
	cout<<t<<endl;
}

Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
#define PB push_back
#define ZERO (1e-10)
#define INF int(1e9+1)
#define CL(A,I) (memset(A,I,sizeof(A)))
#define DEB printf("DEB!\n");
#define D(X) cout<<"  "<<#X": "<<X<<endl;
#define EQ(A,B) (A+ZERO>B&&A-ZERO<B)
typedef long long ll;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii;
#define IN(n) int n;scanf("%d",&n);
#define FOR(i, m, n) for (int i(m); i < n; i++)
#define F(n) FOR(i,0,n)
#define FF(n) FOR(j,0,n)
#define FT(m, n) FOR(k, m, n)
#define aa first
#define bb second
void ga(int N,int *A){F(N)scanf("%d",A+i);}
int N,A[20];
map<ii,ll> dp[20][20];
ll dyn(int b,int e,int x,int y){
    if(b+1==e)return 0;
    if(dp[b][e].count({x,y}))return dp[b][e][{x,y}];
    ll v=1e18;
    FT(b+1,e)v=min(v,A[k]*ll(x+y)+dyn(b,k,x,x+y)+dyn(k,e,x+y,y));
    return dp[b][e][{x,y}]=v;
}
int main(void){
    scanf("%d",&N),ga(N,A);
    printf("%lld\n",dyn(0,N-1,1,1)+*A+A[N-1]);
    return 0;
}


Measured memory_bytes: 16640
#include<cstdio>
#include<cstring>
#include<cctype>
#include<cmath>
#include<algorithm>
#define ll long long
using namespace std;
int read()
{
    char c;int s=0,t=1;
    while(!isdigit(c=getchar()))if(c=='-')t=-1;
    do{s=s*10+c-'0';}while(isdigit(c=getchar()));
    return s*t;
}
/*------------------------------------------------------------*/
const int inf=0x3f3f3f3f;

int n;

int main()
{
    scanf("%d",&n);
    int a=n%10,b=n/10%10,c=n/100%10;
    if(a==c)printf("Yes");else printf("No");
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define ll long long
#define space putchar(' ')
#define endl putchar('\n')
#define debug puts("------------------------")
using namespace std;
inline void read(int &a) {a=0;int c=getchar(),b=1; while(c>'9'||c<'0') {if(c=='-')b=-1;c=getchar();} while(c>='0'&&c<='9') a=(a<<3)+(a<<1)+c-48,c=getchar();a*=b; }
inline int  Rem() {int a=0,c=getchar(),b=1; while(c>'9'||c<'0') {if(c=='-')b=-1;c=getchar();} while(c>='0'&&c<='9') a=(a<<3)+(a<<1)+c-48,c=getchar();return a*=b; }
inline void write(int x) {if(x>9)write(x/10);putchar('0'+x%10);}
inline void W(int x) {if(x<0){putchar('-'),x=-x;}write(x);}
/**/
/*I love Korosensei forever.*/
/**/
int main()
{
	// freopen("test.in","r",stdin);
	// freopen("test.out","w",stdout);
	int a,b,c;
	read(a);read(b);read(c);
	if(a>b) swap(a,b);
	int cnt=0;
	for(int i=a;i;i--)
	{
		if(a%i==0&&b%i==0) cnt++;
		if(cnt==c)
		{
			cout<<i;
			break;
		}
	}
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <cassert>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>
#include <iomanip>
#include <iterator>
 
using namespace std;
 
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
 
#define FOR(i,n) for(int i = 0; i < (n); i++)
#define sz(c) ((int)c.size())

typedef unsigned long long ull;
const int INF = (int)1e8;

int t[1000000 + 1];

void init(){
	int n = 1000000 + 1;
	t[1] = 1;
	for(int i = 1; i < n; i++){
		if(t[i]){
			if(i*2<n) t[i*2] = 1;
			if(i*3<n) t[i*3] = 1;
			if(i*5<n) t[i*5] = 1;
		}
	}
	for(int i = 1; i <= n; i++) t[i] += t[i-1];
}

int main(){
	init();
	int n;
	while(cin>>n,n){
		int m; cin>>m;
		int ans = t[m]-t[n-1];
		cout << ans << endl;
	}

	return 0;
}

Measured memory_bytes: 5064
#include<stdio.h>

main()
{
	int x,y,kaunta,answer;

	x = y = 1;
	
	for(kaunta = 10;x < kaunta;x++){
		for(;y < kaunta;y++){
			answer = x * y;
			printf("%dx%d=%d\n",x,y,answer);
			}
		y = 1;
		}
	return(0);
}

Measured memory_bytes: 0
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<random>

using namespace std;

/*
ソート：sort(v.begin(),v.end(), 0)
合計：accumulate(v.begin(),v.end(), 0)
最小値：*min_element(v.begin(),v.end())
最大値：*max_element(v.begin(),v.end())
最大公約数：__gcd(a,b)
*/

int main(int argc, char const *argv[]){
    int n;
    vector<int> a, b;
    cin >> n;
    for(int i=0;i<n;i++){
        int _a;
        cin >> _a;
        a.push_back(_a);
        b.push_back(_a);
    }
    sort(b.begin(),b.end());
    for(int i=0;i<n;i++){
        if(a[i]==b[n-1]){
            cout << b[n-2] << endl;
        }else{
            cout << b[n-1] << endl;
        }
    }
    

    return 0;
}

Measured memory_bytes: 3436
#include <iostream>
#include <algorithm>
#include <queue>
#include <vector>
#define pq priority_queue

using namespace std;

int main() {
    int n, m;
    cin >> n >> m;
    vector<pair<int, int>> jobs(n);
    pq<int, vector<int>, greater<int>> taken_jobs; //min pq
    for (int i = 0; i < n; i++) {
        int d, r;
        cin >> d >> r;
        jobs[i] = make_pair(d, r);
    }
    sort(jobs.begin(), jobs.end(), greater<pair<int, int>>()); //sorts by days taken
    int rew = 0;
    for (int i = 0; i < n; i++) {
        int j_rew = jobs[i].second;
        if (taken_jobs.size() + jobs[i].first <= m) {
            rew += j_rew;
            taken_jobs.push(j_rew);
        }
        else if (!taken_jobs.empty() && j_rew > taken_jobs.top()) {
            //Note: will always fit, as it is sorted by days (descending),
            //and if taken_jobs is not empty, it will always be able to fit.
            rew -= taken_jobs.top();
            rew += j_rew;
            taken_jobs.pop();
            taken_jobs.push(j_rew);
        }
    }
    std::cout << rew;
}

Measured memory_bytes: 4632
n=int(input())
a=[int(i) for i in input().split()]
b=[int(i) for i in input().split()]
c=[int(i) for i in input().split()]
a.sort()
b.sort()
c.sort()

ans=0
p=0
q=0

for i in b:
    while p<n and a[p]<i:
        p+=1
    while q<n and c[q]<=i:
        q+=1
    ans+=p*(n-q)

print(ans)

Measured memory_bytes: 23296
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int arr[10][10]={0},i,n,y,x,sum=0,j;
	cin >> n;
	for(j=1;j<=n;j++)
	{
		i =j;
		x = i%10;
		while(i/10 != 0)
			i = i/10;
		y = i;
		arr[y][x] +=1; // [First number][Last number]
	}
	sum=0;
	for(i=0;i<10;i++)
	{
		for(j=0;j<10;j++)
			sum += arr[i][j]*arr[j][i];
	}
	cout << sum << endl;
	return 0;
}

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


int main(){
  ll X,K,D;
  cin >> X >> K >> D;
  if(X<0)X=abs(X);
  if(abs(X)>= K*D && K*D>=0){
    cout << abs(X)-K*D << endl;
    return 0;
  }

  ll N = X / D;
  K -= N;
  X -= N * D;
  if(K%2){
    cout << abs(X-D) << endl;
  }else{
    cout << X << endl;
  }
}



Measured memory_bytes: 3632
#include <bits/stdc++.h>
  using namespace std;
  using lint = long long int;
  template<class T = int> using V = vector<T>;
  template<class T = int> using VV = V< V<T> >;
  template<class T> void assign(V<T>& v, int n, const T& a = T()) { v.assign(n, a); }
  template<class T, class... U> void assign(V<T>& v, int n, const U&... u) { v.resize(n); for (auto&& i : v) assign(i, u...); }

  const double eps = 1e-10;
  const double inf = 1e+10;
  const double pi = acos(-1.0);
  int sgn(double a) { return a < -eps ? -1 : a > eps; }
  using P = complex<double>;
  namespace std {
    istream& operator>>(istream& i, P& p) { double x, y; i >> x >> y; p = P(x, y); return i; }
    ostream& operator<<(ostream& o, const P& p) { o << real(p) << ' ' << imag(p); return o; }
    bool operator<(const P& p, const P& q) { return sgn(real(p) - real(q)) ? sgn(real(p) - real(q)) < 0 : sgn(imag(p) - imag(q)) < 0; }
    bool operator>(const P& p, const P& q) { return q < p; }
    bool operator<=(const P& p, const P& q) { return !(p > q); }
    bool operator>=(const P& p, const P& q) { return !(p < q); }
  }
  bool eq(const P& p, const P& q) { return !(p < q) and !(p > q); }
  double dot(const P& p, const P& q) { return real(conj(p) * q); }
  double cross(const P& p, const P& q) { return imag(conj(p) * q); }

  int intCC(const P& o1, double r1, const P& o2, double r2) {
    double d = abs(o1 - o2);
    if (sgn(d - (r1 + r2)) > 0) return 4;
    if (sgn(d - (r1 + r2)) == 0) return 3;
    if (sgn(d - abs(r1 - r2)) > 0) return 2;
    if (sgn(d - abs(r1 - r2)) == 0) return 1;
    return 0;
  }

  V<P> tangent(const P& o, double r, const P& p) {
    double d = abs(p - o);
    P q1 = o + r * r / (d * d) * (p - o);
    P q2 = r * sqrt(max(d * d - r * r, 0.0)) / d / abs(p - o) * (p - o) * P(0.0, 1.0);
    return V<P>({q1 + q2, q1 - q2});
  }

  V<P> common_tangent(const P& o1, double r1, const P& o2, double r2) {
    V<P> res;
    int k = intCC(o1, r1, o2, r2);
    if (k == 4) {
      V<P> ps = tangent(o1, r1 + r2, o2);
      for (auto&& p : ps) res.push_back(o1 + r1 / abs(p - o1) * (p - o1));
    }
    if (k == 3) res.push_back(o1 + r1 / abs(o2 - o1) * (o2 - o1));
    if (k >= 2) {
      if (sgn(r1 - r2) > 0) {
        V<P> ps = tangent(o1, r1 - r2, o2);
        for (auto&& p : ps) res.push_back(o1 + r1 / abs(p - o1) * (p - o1));
      } else if (sgn(r1 - r2) < 0) {
        V<P> ps = tangent(o2, r2 - r1, o1);
        for (auto&& p : ps) res.push_back(o1 + r1 / abs(p - o2) * (p - o2));
      } else {
        res.push_back(o1 + r1 / abs(o2 - o1) * (o2 - o1) * P(0.0, 1.0));
        res.push_back(o1 + r1 / abs(o2 - o1) * (o2 - o1) * P(0.0, -1.0));
      }
    }
    if (k == 1) {
      if (sgn(r1 - r2) > 0) res.push_back(o1 + r1 / abs(o2 - o1) * (o2 - o1));
      else res.push_back(o1 + r1 / abs(o1 - o2) * (o1 - o2));
    }
    return res;
  }

  int main() {
    cin.tie(NULL); ios::sync_with_stdio(false);
    P o1, o2; double r1, r2; cin >> o1 >> r1 >> o2 >> r2;
    V<P> res = common_tangent(o1, r1, o2, r2);
    sort(res.begin(), res.end());
    cout << fixed << setprecision(10);
    for (auto&& p : res) cout << p << '\n';
  }


Measured memory_bytes: 3368
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n';
#define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

int main(void)
{
    IOS
    int a, b;
    cin >> a >> b;
    int c = b-a - 1;
    while(c > 0) {
        a -= c;
        c--;
    }

    OUT(-a)

    return 0;
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define debug(x) cerr << #x << ": " << x << '\n'

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

const long long INF = 3e18 + 12;
const int inf = 1e9;

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

  int a, b;
  cin >> a >> b;
  string c;

  cin >> c;

  bool flag = true;

  rep(i, a) {
    if (!(c[i] >= '0' && c[i] <= '9')) {
      flag = false;
      debug(flag);
    }
  }

  if (c[a] != '-') flag = false;

  repi(i, a + 1, a + b) {
    if (!(c[i] >= '0' && c[i] <= '9')) {
      flag = false;
    }
  }

  if (flag) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }

  return 0;
}

Measured memory_bytes: 256
import java.math.BigDecimal;
import java.util.Scanner;
public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????
	/**	??£???????¨????
	 *  ax + by = c
	 *  dx + ey = f???????§£???
	 *  
	 * x=(c*e-b*f)/(a*e-b*d)
    ???????????????y=(f*a-c*d)/(a*e-d*b)
????????????*/
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()) {
			
			double a = sc.nextDouble();	//a
			double b = sc.nextDouble();	//b
			double c = sc.nextDouble();	//c
			double d = sc.nextDouble();	//d
			double e = sc.nextDouble();	//e
			double f = sc.nextDouble();	//f
			
			double x=(c*e-b*f)/(a*e-b*d);
			double y=(f*a-c*d)/(a*e-d*b);
			//?????¨?????\????????????
			BigDecimal xx = new BigDecimal(x);
			BigDecimal yy = new BigDecimal(y);
		    BigDecimal xxx = xx.setScale(3, BigDecimal.ROUND_HALF_UP);
		    BigDecimal yyy = yy.setScale(3, BigDecimal.ROUND_HALF_UP);
			
			System.out.print(xxx + " ");
			System.out.println(yyy);
		}
		
	}

}

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



int main() {
  ll n,m;
  cin >> n>>m;
  ll ans=0;
  if(n==1 && m==1){cout << 1 << endl; return 0;}
  if(n<=2 && m<=2){cout << 0 << endl; return 0;}
  if(n==1 && m>2){cout << m-2 << endl; return 0;}
  if(m==1 && n>2){cout << n-2 << endl; return 0;}
  if(n>2 && m>2){ans=(n-2)*(m-2);}
  cout << ans << endl;
}

Measured memory_bytes: 256
/*
これを入れて実行
g++ code.cpp
./a.out
 */

#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <algorithm>
#include <utility>
#include <set>
#include <cmath>
#include <tuple>
#include <iomanip>

using namespace std;
typedef long long ll;

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

const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;

bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}

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


int main(void){
    int n, m;

    cin >> n >> m;

    vector<pair<int,int>> d(n);

    for(int i = 0; i < n; i++){
        cin >> d[i].first >> d[i].second;
    }

    sort(d.begin(), d.end());

    ll price = 0;
    int total = 0;

    bool finished = false;
    for(int i = 0; i < n; i++){
        for(int j = 0; j < d[i].second; j++){
            price += d[i].first;
            total++;
            if(total == m){
                finished = true;
                break;
            }
        }
        if(finished)break;
    }

    cout << price << endl;
}



Measured memory_bytes: 1024
using System;
using System.Collections.Generic;

public static class Program
{
	public class MyQueue<T>
	{
		private Stack<T> _stack1;
		private Stack<T> _stack2;

		public MyQueue()
		{
			_stack1 = new Stack<T>();
			_stack2 = new Stack<T>();
		}

		public void Enqueue(T x)
		{
			_stack1.Push(x);
		}

		public T Dequeue()
		{
			if (_stack2.Count > 0)
			{
				return _stack2.Pop();
			}
			while (_stack1.Count > 0)
			{
				_stack2.Push(_stack1.Pop());
			}
			return _stack2.Pop();
		}

		public int Count
		{
			get { return _stack1.Count + _stack2.Count; }
		}
	}


	public class Process
	{
		public string name;
		public int time;
	}

	public static void Main()
	{
		var lineList = Console.ReadLine().Split(' ');
		int n = int.Parse(lineList[0]);
		int q = int.Parse(lineList[1]);
		var queue = new MyQueue<Process>();
		for (int i = 0; i < n; i++)
		{
			lineList = Console.ReadLine().Split(' ');
			var process = new Process()
			{
				name = lineList[0],
				time = int.Parse(lineList[1])
			};
			queue.Enqueue(process);
		}
		int time = 0;
		while (queue.Count > 0)
		{
			var process = queue.Dequeue();
			if (process.time <= q)
			{
				time += process.time;
				Console.WriteLine(string.Format("{0} {1}", process.name, time));
			}
			else
			{
				time += q;
				process.time -= q;
				queue.Enqueue(process);
			}
		}
	}
}



Measured memory_bytes: 18464
import itertools
n = int(input())
L=sorted(list(map(int,input().split())), reverse=True)

ans = 0
'''for i,l in enumerate(L):
	for j,s1 in enumerate(L[i+1:]):
		for k,s2 in enumerate(L[j+1:]):
			if l<s1+s2:
				ans += 1
'''
for i,j,k in itertools.combinations(L, 3):
	l = sorted([i,j,k])
	if l[0]+l[1]>l[2] and l[0]!=l[1]!=l[2]!=l[0]:
		#print(l)
		ans +=1
print(ans)

Measured memory_bytes: 9212
def sub(i,li):
    j = i + 1
    sub_max = 0
    for k in range(len(li) - j):
        if sub_max < abs(li[j] - li[i]):
            sub_max = abs(li[j] - li[i])
        j += 1
    return sub_max

n = int(input())
li = list(map(int,input().split()))
max_num = 0
for i in range(len(li)):
    a = sub(i,li)
    if a > max_num:
        max_num = a
print(max_num)

Measured memory_bytes: 3064
#include<iostream>
#define ll long long
using namespace std;

ll N,T;

ll gcd(ll a,ll b){
  ll tmp;

  while(a%b != 0){
    tmp = b;
    b = a%b;
    a = tmp;
  }
  return b;
}

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



int main(){
  cin >> N;
  ll ans = 1ll;
  for(int i = 0; i < N; i++){
    cin >> T;

    ans = lcm(ans,T);
  }

  cout << ans << endl;
  return 0;

}

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

using namespace std;
#define int long long
#define all(a) (a).begin(), (a).end()
#define ms(a,v) memset(a, v, sizeof(a))
#define sz(v) ((int)(v).size())
#define mp make_pair
#define pb push_back
#define prev biiiiirl_sai_de_casa_comi_pra_caralho
#define next trapezio_descendente
#define index eh_ele_que_nos_vai_buscar
#define left aqui_eh_37_anos_porra
#define R32 ({int32_t x; scanf("%d", &x); x;})
#define RL ({long long x; scanf("%lld", &x); x;})
#define RC ({char x; scanf(" %c", &x); x;})
#define RI RL
#define ff first
#define ss second
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef long long ll;

int32_t main(){
  int n  = RI;
  vector<int> a;
  for(int i = 0; i < 3*n; i++) a.pb(RI);

  sort(all(a));

  int ptr = 0;
  int sum = 0;
  while(ptr < a.size()){
    ptr++;
    a.pop_back();
    sum += a.back();
    a.pop_back();
  }

  cout << sum << endl;
}


Measured memory_bytes: 6384
// I SELL YOU...! 
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<chrono>
#include<iomanip>
#include<map>
#include<set>
#define MOD 1000000007
#define MAX 300000
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
void init_io(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(10);
}
signed main(){
  init_io();
  ll n;
  cin >> n;
  vector<ll> c(n+1),dp(MAX,0),sum(MAX,0);
  c[0] = MAX-1;
  for(int i=1;i<=n;i++){
    cin >> c[i];
  }
  dp[0] = 1;
  for(int i=1;i<=n;i++){
    dp[i] = dp[i-1];
    if(c[i-1]!=c[i]){
      dp[i] += sum[c[i]];
      dp[i] %= MOD;
      sum[c[i]] += dp[i-1];
      sum[c[i]] %= MOD;
    }
  }
  cout << dp[n]<<endl;
}


Measured memory_bytes: 6528
#include <cstdio>
#include <cctype>

int main() {
  int alphabet[30] = {};
  char ch;
  while (scanf("%c", &ch) != EOF) {
    ch = tolower(ch);
    alphabet[ch - 'a']++;
  }

  for (int i = 0; i < 26; i++) {
    printf("%c : %d\n", 'a' + i, alphabet[i]);
  }
  
  return 0;
}


Measured memory_bytes: 2756
import java.util.*;class Main{public static void main(String[]z){int i,e,d,c,a,u=174;int[]x=new int[u];for(i=0,e=2;i<u;x[i++]=e++)l:for(;;e++){for(int y:x)if(y>0&&e!=y&&e%y<1)continue l;break;}Scanner s=new Scanner(System.in);for(;(a=s.nextInt())>0;System.out.println(u))for(d=s.nextInt(),i=s.nextInt(),c=-1;i-->0;)o:for(;;){c++;for(int y:x)if((u=a+c*d)!=y&&(u==1||u%y<1))continue o;break;}}}

Measured memory_bytes: 12000
O = gets.chomp.split("")
E = gets.chomp.split("")

output = ""

oi = 0
ei = 0

for i in 0..(O.size + E.size - 1)
  if (i+1).odd? then
    output += O[oi]
    oi += 1
  else
    output += E[ei]
    ei += 1
  end
end

puts output

Measured memory_bytes: 1788
#define _USE_MATH_DEFINES

#include <cmath>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <limits>
#include <cstring>
#include <string>
#include <queue>
#include <map>
#include <set>
#include <bitset>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;

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

class edge {
public:
    int from, to;
    ll cost;

    edge(int t, ll c) : from(-1), to(t), cost(c) {}

    edge(int f, int t, ll c) : from(f), to(t), cost(c) {}

    bool operator<(const edge &e) const {
        return cost < e.cost;
    }

    bool operator>(const edge &e) const {
        return cost > e.cost;
    }
};

vector<vector<edge>> g;
int color[100010];

void dfs(int v, int p, int c) {
    color[v] = c;
    for (auto &e : g[v]) {
        if (e.to == p) continue;
        if (e.cost % 2 == 0) dfs(e.to, v, c);
        else dfs(e.to, v, 1 - c);
    }
}

int main() {
    /*
    ios::sync_with_stdio(false);
    cin.tie(0);
    */
    int n;
    cin >> n;
    g.resize(n);
    for (int i = 0; i < n - 1; ++i) {
        int u, v;
        ll w;
        cin >> u >> v >> w;
        --u, --v;
        g[u].emplace_back(v, w);
        g[v].emplace_back(u, w);
    }
    dfs(0, -1, 0);
    for (int i = 0; i < n; ++i) {
        cout << color[i] << "\n";
    }
}

Measured memory_bytes: 10368
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())




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

	string s;
	int ans = INF;
	cin >> s;
	rep(i, s.size()-2) {
		int x = atoi(s.substr(i, 3).c_str());
		ans = min(ans, abs(x - 753));
	}
	cout << ans << endl;


	return 0;
}

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

int main(){
    string s; cin >> s;
    if(s=="hi" || s == "hihi" || s=="hihihi" || s == "hihihihi" || s == "hihihihihi"){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define ll long long int
int main()
{
    ll n,d;
    cin>>n>>d;
    vector<pair<ll,ll>> v;
    ll a,b;
    for(int i=0;i<n;i++){
        cin>>a>>b;
        v.pb({a,b});
    }
    ll fins = 0;
    for(int i=0;i<n;i++){
        a = v[i].first;
        b = v[i].second;
        double ans = a*a+b*b;
        ans=sqrt(ans);
        //cout<<ans<<endl;
        if(ans<=d)
            fins++;
    }
    cout<<fins<<endl;
    return 0;
}


Measured memory_bytes: 7516
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<utility>
#include<cmath>
#include<climits>
#include<queue>
#include<stack>
#include<numeric>
using namespace std;

typedef long long ll;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)


int main(){
  vector<int> a(3);
  rep(i, 3) cin >> a[i];
  int sum = 0;
  int m = 0;
  for(int i = 0; i < 3; ++i){
    m = max(m, a[i]);
    sum += a[i];
  }

  sum -= m;

  cout << sum << endl;



}


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

typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
#define ALL(obj) (obj).begin(),(obj).end()

#define P pair<int,int>
#define V vector<int>
#define M map<int,int>
#define S set<int>
#define PQ priority_queue<int>
#define PQG priority_queue<int,V,greater<int>>

#define pb(a) push_back(a)
#define mp make_pair

#define dump(x)  cout << #x << " = " << (x) << "\n";
#define COUT(x) cout<<(x)<<"\n"

int func(int n)
{
    if (n == 0)
    {
        return 0;
    }
    return n + func(n - 1);
}

int main()
{
    int a, b = 0;
    cin >> a >> b;

    COUT(func(b - a) - b);


    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#define MAX 500001
#define NIL NULL

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

Node root;

void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

  while(x!=NIL){
    y=x;
    if(z->key<x->key) x=x->left;
    else x=x->right;
  }
  z->parent=y;

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

void inorder(Node x){
  if(x!=NIL){
    inorder(x->left);
    printf(" %d",x->key);
    inorder(x->right);
  }
}

void preorder(Node x){
  if(x!=NIL){
    printf(" %d",x->key);
    preorder(x->left);
    preorder(x->right);
  }
}
int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    }
    else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    } 
  }

  return 0;
}

Measured memory_bytes: 24040