akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int main() {
	int n;
	cin >> n;
	vector<int> a(n),b(n);
	for(int i=0;i<n;i++)
	{
		cin >> a.at(i);
		b.at(i)=a.at(i);
	}
	sort(b.begin(),b.end());
	int mm=b.at(n-1),mn=b.at(n-2);
	for(int i=0;i<n;i++)
	{
		if(a.at(i)==mm)
		{
			cout << mn << endl;
		}
		else
		{
			cout << mm << endl;
		}
	}
}


Measured memory_bytes: 4828
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<cmath>
using namespace std;
#define REP(i, limit) for(int i=0; i< limit; ++i)
#define FOR(i, j, limit) for(int i=j; i< limit; ++i)
#define DUMP(a) REP(d,a.size()){cout<<a[d];if(d!=a.size()-1)cout<<" ";else cout<<endl;}
#define LL long long
int INF = 2147483647;
LL LINF = 9223372036854775807;
LL MOD = 1000000007;
typedef pair<int, int>P;
typedef pair<LL, LL>PL;
typedef vector<int> vi;
typedef vector<LL> vl;


int main(){
  string s;
  cin>>s;
  int n;
  n=s.size();
  reverse(s.begin(), s.end());
  vector<string> t={"dream", "dreamer", "erase", "eraser"};
  REP(i, 4){
    reverse(t[i].begin(), t[i].end());
  }

  int itr=0;
  bool work;
  while(itr<n){
    work = false;
    REP(i, 4){
      int tn = t[i].size();
      if(itr+tn-1 <n){
        if(s.substr(itr, tn) == t[i]){
          itr += tn;
          work = true;
          continue;
        }
      }
    }
    if(work) continue;
    cout<<"NO"<<endl;
    return 0;
  }
  cout<<"YES"<<endl;

  return 0;
}


Measured memory_bytes: 512
import java.util.Scanner;

public class Main {
	private static Scanner sc;
	
	public static void main(String[] args) {
		sc = new Scanner(System.in);
		int a = sc.nextInt();
		String op = sc.next();
		int b = sc.nextInt();
		
		for (;!op.equals("?");) {
			int ans = 0;
			switch (op) {
			case "+":
				ans = a + b;
				break;
			case "-":
				ans = a - b;
				break;
			case "*":
				ans = a * b;
				break;
			case "/":
				if (a == 0) {
					break;
				}
				ans = a / b;
			}
			System.out.println(ans);
			a = sc.nextInt();
			op = sc.next();
			b = sc.nextInt();
		}
	}
}

Measured memory_bytes: 26100
n,m=map(int, input().split())
a=list(map(int,input().split())) 
b=[a[0]]
for i in range(1,n):
    b.append(b[-1]+a[i])
c=[b[i]%m for i in range(n)]
ans=0
import collections
k=list(collections.Counter(c).items())
for x in k:
    j=True
    if x[0]==0:
        ans+=x[1]*(x[1]+1)//2
        j=False
    if x[1]>1 and j:
        ans+=(x[1]-1)*x[1]//2
print(ans)

Measured memory_bytes: 21288
using System;

namespace atcoderA
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            int[] input = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
            int a = input[0];
            int b = input[1];
            int c = input[2];
            Console.WriteLine(b - a == c - b ? "YES" : "NO");
        }
    }
}

Measured memory_bytes: 11092
# import bisect
# import heapq
# from copy import deepcopy
# from collections import deque
# from collections import Counter
# from itertools import accumulate
# from itertools import permutations
# import numpy as np
# import math
# mod = 10**9 + 7

# n = int(input())

# s = deque(input())
# q = int(input())

# a, b = map(int, input().split())
a = list(map(int, input().split()))

print('bust' if sum(a)>=22 else 'win')


Measured memory_bytes: 2940
//
//AtCoder Beginner Contest 143
//B - TAKOYAKI FESTIVAL 2019
//

#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <ctime>
#include <queue>
#include <map>
#include <set>
#include <tuple>
#include <functional>
#include <cassert>

using namespace std;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define SIZE(x) (int)(x).size()
#define SIZEL(x) (ll)(x).size()
#define MSG(a) cout << #a << " " << a << endl;

using ll = long long;
using ld = long double;

const double PI = 3.14159265358979323846;

ll gcd(ll x, ll y) { return (x % y)? gcd(y, x % y): y; }    //最大公約数
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }            //最小公倍数

int main()
{
    int n;

    cin >> n;

    int d[n];
    REP(i, n) cin >> d[i];

    int ans = 0;
    REP(i, n){
        FOR(j, i+1, n-1){
            ans += d[i]*d[j];
        }
    }

    cout << ans << endl;

    return 0;
}


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

int main() {
  int a,b;
  cin>>a>>b;
  if (a==1&&b!=1) cout<<"Alice"<<endl;
  else if (a!=1&&b==1) cout<<"Bob"<<endl;
  else if (a<b) cout<<"Bob"<<endl;
  else if (a>b) cout<<"Alice"<<endl;
  else cout<<"Draw"<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using vc = vector<char>;
using vvc = vector<vc>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;
#define rep(i, n) for (ll i = 0; i < (n); i++)
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
#ifndef ONLINE_JUDGE
    #define debug(x) cerr << #x << ": " << x << endl;
#else
    #define debug(x)
#endif

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

    ll N;
    cin >> N;
    vll A(N);
    rep(i,N) cin >> A[i];
    sort(A.begin(), A.end(), greater<ll>());

    ll ans = 0;
    ll cnt = 0;
    rep(i,N) {
        if(i == 0) {
            ans += A[i];
            cnt++;
            continue;
        }
        if(cnt == N-1) break;
        if(cnt == N-2) {
            ans += A[i];
            cnt++;
        }
        else {
            ans += 2 * A[i];
            cnt += 2;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 4776
#include <bits/stdc++.h>
#include <assert.h>
using namespace std;
using i64 = long long;

int main()
{
    i64 a, b, c;
    cin >> a >> b >> c;
    if (c <= a + b + 1)
        cout << b + c << endl;
    else
        cout << b + a + b + 1 << endl;
    return 0;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline
N, K = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
dp = [0] * (K + 1)
for i in range(K):
  for x in a:
    if i + x <= K:
      if dp[i] == 0: dp[i + x] = 1
if dp[-1]: print("First")
else: print("Second")

Measured memory_bytes: 41708
<?php
list($n)=ints();
$sum6=0;
$i=1;
while($i<=$n){
  $j=1;
  while($j<=$n){
    $memo[$i][$j]=$memo[$j][$i]=gcd($i, $j);
    ++$j;
  }
  ++$i;
}
$i=1;
while($i<=$n){
  $j=$i+1;
  while($j<=$n){
    $ij=$memo[$i][$j];
    $sum6+=$memo[$i][$j];
    $k=$j+1;
    while($k<=$n){
      $sum6+=$memo[$ij][$k];
      ++$k;
    }
    ++$j;
  }
  ++$i;
}
$sum1=(1+$n)*$n/2;
echo $sum6*6+$sum1;
function gcd($x,$y){return($x%$y)?gcd($y,$x%$y):$y;}
function ints(){return array_map('intval',explode(' ',trim(fgets(STDIN))));}

Measured memory_bytes: 18660
use std::str::FromStr;
use std::fmt::Debug;
use std::cmp;

fn read_as_vec<T>() -> Vec<T>
where T: FromStr, <T as FromStr>::Err : Debug{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().split_whitespace().map(|c| T::from_str(c).unwrap()).collect()

}

fn read_as_string() -> String{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

struct UnionFind{
    v: Vec<usize>
}

impl UnionFind{
    fn new(n: usize) -> UnionFind{
        let mut v: Vec<usize> = Vec::new();
        for i in 0..n{
         v.push(i);
        }
        UnionFind{v:v}
    }

    fn find(&mut self, i: usize) -> usize{
        if self.v[i] == i{
            i
        }else{
            let ni = self.v[i];
            self.v[i] = self.find(ni);
            self.v[i]
        }
    }

    fn union(&mut self, i: usize, j: usize){
        let root_i = self.find(i);
        let root_j = self.find(j);
        self.v[root_i] = root_j;
    }
    
}

struct CombMod{
    fac: Vec<u64>,
    inv: Vec<u64>,
    finv: Vec<u64>,
    mmod: u64,
}

impl CombMod{
    pub fn new(max: u64, m: u64) -> CombMod{
        let max: usize = max as usize;
        let mut fac: Vec<u64> = vec![0;max+1];
        let mut finv: Vec<u64> = vec![0;max+1];
        let mut inv: Vec<u64> = vec![0;max+1];

        fac[0] = 1;
        fac[1] = 1;
        finv[0] = 1;
        finv[1] = 1;
        inv[1] = 1;

        for i in 2..max+1{
            fac[i] = fac[i-1] * i as u64 % m;
            inv[i] = m - inv[m as usize %i] * (m/(i as u64)) % m;
            finv[i] = finv[i-1] * inv[i] % m;
        }
        
        CombMod{
            fac: fac,
            finv: finv,
            inv: inv,
            mmod: m,
        }
    }

    fn get(&self, n: u64, m: u64) -> u64{
        assert!(n >= m && n != 0 && m != 0);
        self.fac[n as usize] * self.finv[m as usize] % self.mmod
            * self.finv[(n-m) as usize] % self.mmod
    }
}

fn gcd(a: u32, b: u32) -> u32{
    if b == 0{
       return a;
    }

    return gcd(b, a%b);
}

fn main(){
    let n: usize = read_as_vec()[0];
    let a: Vec<u32> = read_as_vec();

    let mut l: Vec<u32> = vec![0;n];
    let mut r: Vec<u32> = vec![0;n];

    l[1] = a[0];
    for i in 2..n{
        l[i] = gcd(l[i-1], a[i-1]);
    }

    r[n-2] = a[n-1];
    for i in (0..(n-2)).rev(){
        r[i] = gcd(r[i+1], a[i+1]);
    }

    let mut ans = 0;
    for i in 0..n{
        ans = cmp::max(gcd(l[i], r[i]), ans);
    }

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


Measured memory_bytes: 6396
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll N = 1000000009;
void solve()
{
	ll n;
	cin>>n;
	if(n==0)
	{
		cout<<1<<endl;
		return;
	}
	cout<<0<<endl;return;
}
	

int main()
{
#ifndef ONLINE_JUDGE
	// for getting input from input.txt
	freopen("input.txt", "r", stdin);
	// for writing output to output.txt
	freopen("output.txt", "w", stdout);
#endif

	int t=1;
	//cin >> t;

	while (t--)
	{
		solve();
	}


	return 0;
}


Measured memory_bytes: 3620
#include "bits/stdc++.h"

#define rep(i, a) for (int i = 0; i < (a); ++i)
#define REP(i, a, b) for (int i = (a); i < (b); ++i)
#define vi vector<int>

#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0, a1, a2, a3, a4, x, ...) x
#define debug_1(x1) cerr << #x1 << ": " << x1 << endl
#define debug_2(x1, x2) cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << endl
#define debug_3(x1, x2, x3) cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " << x3 << endl
#define debug_4(x1, x2, x3, x4) cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " << x3 << ", " #x4 << ": " << x4 << endl
#define debug_5(x1, x2, x3, x4, x5) cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " << x3 << ", " #x4 << ": " << x4 << ", " #x5 << ": " << x5 << endl
#define debug(...) CHOOSE((__VA_ARGS__, debug_5, debug_4, debug_3, debug_2, debug_1, ~)) (__VA_ARGS__)

using namespace std;
using ll = long long;
using P = pair<int, int>;

void Main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  ll r, g, b;
  r = g = b = 0;
  for(char c: s) {if (c=='R') r++; else if (c=='G') g++; else b++;}
  ll ans = r * g * b; 
  rep(i, s.size()-2) {
    for (int j=i+2; j<s.size(); j+=2) if (s[i]!=s[(i+j)/2] && s[(i+j)/2]!=s[j] && s[j]!=s[i]) ans--;
  }
  cout << ans << endl;
}

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


Measured memory_bytes: 3640
//Ahadul Haque, MBSTU,ICT
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mk make_pair
#define TEST int test; cin >> test ;while(test--)
#define endl "\n"
int main()
{
    ll n;
    cin>>n;
    ll cnt=0,cnt1=0;
    for(int i=0;i<n;i++)
    {
        ll x,y;
        cin>>x>>y;
        if(x==y)
        {
            cnt++;
            if(cnt==3)
                cnt1=1;
        }
        else
            cnt=0;
    }
    if(cnt1==1)
        cout<<"Yes"<<endl;
        else
            cout<<"No"<<endl;


    return 0;
}







Measured memory_bytes: 3584
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <queue>
using namespace std;
typedef pair<int, int> P;
struct edge{
    int to;
    long long cost;
};
struct dijkstra{//priority_queueを用いる
    vector<vector<edge>> G;
    vector<long long> d;
    long long INF;
    int n;
    dijkstra(int N){
        G.resize(N);
        INF = 1e14;
        d.resize(N, INF);
        n = N;
    }
    void add(int x, int y, long long cost1){
        edge e1 = {x, -cost1}, e2 = {y, cost1};
        G[x].push_back(e2);
        G[y].push_back(e1);

    }
    void solve(){
        priority_queue<P, vector<P>, greater<P>> que;
        for(int s = 0; s < n; s++){
        if(d[s] != INF) continue;
        d[s] = 0;
        que.push(P(0, s));
        while(!que.empty()){
            P p = que.top();
            que.pop();
            int v = p.second;
            if(d[v] < p.first){
                cout << "No" << endl;
                return;
            }
            for(int i = 0; i < G[v].size(); i++){
                edge e = G[v][i];
                if(d[e.to] > d[v] + e.cost){
                    if(d[e.to] != INF){
                        cout << "No" << endl;
                        return;
                    }
                    d[e.to] = d[v] + e.cost;
                    que.push(P(d[e.to], e.to));
                }
                else if(d[e.to] < d[v] + e.cost){
                    cout << "No" << endl;
                    return;
                }
            }
        }
        }
        cout << "Yes" << endl;
    }
};
int main(){
    int N, M;
    cin >> N >> M;
    dijkstra di(N);
    for(int i = 0; i < M; i++){
        int L, R;
        long long D;
        cin >> L >> R >> D;
        L--;
        R--;
        di.add(L, R, D);
    }
    di.solve();
}

Measured memory_bytes: 17656
<?php
//error_reporting(0);
//$N = trim(fgets(STDIN));
list($N,$T) = explode(" ",trim(fgets(STDIN)));
//$v = explode(" ",trim(fgets(STDIN)));
for($i=0;$i<$N;$i++) {
  list($c[],$t[]) = explode(" ",trim(fgets(STDIN)));
}
$res = 1001;
for($i=0;$i<$N;$i++) {
  if ($t[$i]>$T) continue;
  if ($res > $c[$i]) {
    $res = $c[$i];
  }
}
if ($res == 1001) printf("TLE\n");
else printf("%d\n",$res);


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

using namespace std;


int main (void) 
{

  /* Variable_Proclamation */
  int N;    // input
  int T, A;
  int ans;  // output

  int i;    // subscript
  double ave_temp;
  double index, best_index;
  int    best_place;


  /* Input, Array_Proclamation */
  cin >> N;
  cin >> T >> A;
  vector<int> H(N);
  // vector<double> debug(N);


  for(i=0; i<N; i++)
  {
    cin >> H.at(i);
  }


  /* Initialize */
  ans = 0;
  best_index = 700;

  /* Calculation */

  for(i=0; i<N; i++)
  {
  
    ave_temp = T - H.at(i) * 0.006;
    index    = A - ave_temp;

    if(index < 0)
    {
      index *= -1;
    }

    if(best_index > index)
    {
      best_index = index;
      best_place = i+1;
    }

  }
  

  /* Output */
  cout << best_place << endl;


  return 0;

}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <stack>
#include <algorithm>

using namespace std;

enum COLOR {
  WHITE,
  GRAY,
  BLACK,
};

static const int NIL = -1;
static const int N = 100;

static int M[N][N] = {};

static inline int next(int u, int n, int next_array[]) {
  for (int v = next_array[u]; v < n; v++) {
    next_array[u] = v + 1;
    if (M[u][v]) {
      return v;
    }
  }
  return NIL;
}

static vector<int> u(N, 0);
static vector<COLOR> color(N, WHITE);
static int total_time = 0;
static vector<int> visit_time(N, 0), finish_time(N, 0);

static void dfs_visit(int r, int n) {
  vector<int> next_array(N, 0);

  stack<int> S;
  S.push(r);
  color[r] = GRAY;
  visit_time[r] = ++total_time;

  while (!S.empty()) {
    int u = S.top();
    int v = next(u, n, &next_array[0]);
    if (v != NIL) {
      if (color[v] == WHITE) {
        color[v] = GRAY;
        visit_time[v] = ++total_time;
        S.push(v);
      }
    } else {
      S.pop();
      color[u] = BLACK;
      finish_time[u] = ++total_time;
    }
  }
}

void dfs(int n) {
  for (int u = 0; u < n; u++) {
    if (color[u] == WHITE) {
      dfs_visit(u, n);
    }
  }
  
  for (int i = 0; i < n; i++) {
    cout << i + 1 << " " << visit_time[i] << " " << finish_time[i] << endl;
  }
}

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

  int number, count, value;
  for (int i = 0; i < n; i++) {
    cin >> number >> count;
    number--;
    for (int j = 0; j < count; j++) {
     cin >> value;
     value--;
     M[number][value] = 1; 
    }
  }
  
  dfs(n);

  return 0;
}



Measured memory_bytes: 3116
#include <bits/stdc++.h>
#include <stdio.h>
 
using namespace std;
 
#define int long long
#define rep(i, a, b) for (int i = (a); i < (b); ++i)
#define trav(i, a) for (auto &i: (a))
#define sz(x) (int)(x).size()
#define all(v) (v).begin(), (v).end()
#define fr(i, a, b) for (int i = (a); i <= (b); ++i)

void solve();

signed main () {
    clock_t beg = clock();
    cout << fixed << setprecision(15);
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    #ifdef LOCAL
    freopen("input.txt", "r", stdin);
    #endif 
    int t = 1; 
    // cin >> t;    
    int tt = t;
    while (t--) {
        // cout << "Case #" << tt - t << ": "; 
        solve();
    }
    cerr << "\nExecution time: " << (clock() - beg) / 1000 << '\n';
    return 0;
}
const int N = 2e5 + 5;
int p[N], sz[N];
int find (int n) {
    if (p[n] == n) 
        return n;
    return p[n] = find(p[n]);
}
void merge (int a, int b) {
    a = find(a), b = find(b);
    if (a == b)
        return;
    if (sz[a] < sz[b])
        swap(a, b);
    p[b] = a;
    sz[a] += sz[b];
}
void solve() {  
    int n, m;
    cin >> n >> m;
    for (int i = 1; i <= n; ++i) {
        p[i] = i, sz[i] = 1;
    }
    for (int i = 0; i < m; ++i) {
        int a, b;
        cin >> a >> b;
        merge(a, b);
    }
    int mx = 0;
    for (int i = 1; i <= n; ++i) {
        if (find(i) == i) {
            mx = max(mx, sz[i]);
        }
    }
    cout << mx;
}       

Measured memory_bytes: 6764
import java.util.*;
import java.lang.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		long a = sc.nextLong();
		long b = sc.nextLong();
		for( long i=1; i<=b; i++ ){
			if( (a*i)%b==0 ){
				System.out.println(a*i);
				break;
			}
		}
	}
}


Measured memory_bytes: 23764
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define All(v) (v).begin(),(v).end()
int dy[8] = {-1,0,1,0,-1,1,1,-1};
int dx[8] = {0,1,0,-1,1,1,-1,-1};
const int mod = 1000000007;
const int inf = mod*mod;
const int d5 = 100100;
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int x;
    cin>>x;
    set<int> a;
    for(int i=-200;i<=200;i++){
        int t=i*i*i*i*i;
        a.insert(t);
    }
    int n=0,m=0;
    bool ok=false;
    for(auto p:a){
        if(!ok){
            for(auto q:a){
                if(p-q==x){
                    n=p,m=q;
                    ok=true;
                    break;
                }
            }
        }
    }
    int r1=0,r2=0;
    for(int i=-200;i<200;i++){
        int t=i*i*i*i*i;
        if(t==n)r1=i;
        if(t==m)r2=i;
    }
    cout<<r1<<' '<<r2<<endl;
}

Measured memory_bytes: 3676
//Jai Bhole Ki
#include <bits/stdc++.h>
using namespace std;
#define fast static int fastline = []() { std::ios::sync_with_stdio(false); cin.tie(NULL); return 0; }();
#define ll long long
#define LL unsigned ll
#define pb push_back
#define pi pair<ll,ll>
#define debug(x) cout<<x<<"\n";
#define debug cout<<"debugged\n";
#define minval -2e9
#define maxval 1e9
long double PI =3.14159265358979323846;
 
const ll M=1e12;
const ll inf=1e18;
const ll ms=10000000;
fast;
ll ans,n,m;
void solve()
{
    cin>>n>>m;
    vector<vector<ll>> vc(n,vector<ll>(m,0));
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<m;j++)
        {
            cin>>vc[i][j];
        }
    }
    ll chk,temp;
    for(int i=0;i<n;i++)
    {
        for(int j=i+1;j<n;j++)
        {
            temp=0;
            for(int k=0;k<m;k++)
            {
                temp+=pow(vc[i][k]-vc[j][k],2);
            }
            ll chk=sqrt(temp);
            if(chk*chk==temp)
                ans++;
        }
    }
   cout<<ans<<endl;
    
}
int main()
{
 // freopen("input.txt","r",stdin);
//  freopen("output.txt","w",stdout);
    //int t;cin>>t;while(t--)
    {
        solve();
    }
    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
const double EPS = 1e-9;
#define INF (1LL<<60)
#define D double
#define fs first
#define sc second
#define int long long
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define RFOR(i,a,b) for(int i = (int)(b-1);i>=(int)(a);--i)
#define REP(i,n)  FOR(i,0,(n))
#define RREP(i,n) RFOR(i,0,(n))
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x)  cout << #x << " = " << (x) << endl;
#define SP << " " << 
typedef pair<int,int> P;
typedef vector<int> vec;
typedef vector<vector<int>> mat;
  
signed main(){
  ios::sync_with_stdio(false);
  cout.tie(0);
  cout.precision(20);
  
  vector<int> a(3);
  REP(i,3) cin >> a[i];

  int sum = 0;
  
  REP(i, 3){
    sum += a[i]; 
  }

  cout << (sum >= 22 ? "bust" : "win") << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <queue>

using namespace std;

int main(int argc, char* argv[]) {
  int N;
  cin >> N;

  priority_queue<float> queue;
  for (int i = 0; i < N; ++i) {
    int tmp;
    cin >> tmp;
    queue.push(-tmp);
  }

  while (queue.size() > 1) {
    float a = queue.top();
    queue.pop();
    float b = queue.top();
    queue.pop();
    queue.push((a + b) / 2);
  }

  cout << -queue.top() << endl;

  return 0;
}

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

#define rep(i,n) for(long long int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(long long int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(long long int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define pb(q) push_back(q)
#define P pair<int,int>
#define Abs(a,b) max(a,b)-min(a,b)
#define YES(condition) if(condition){cout << "YES" << endl;}else{cout << "NO" << endl;}
#define Yes(condition) if(condition){cout << "Yes" << endl;}else{cout << "No" << endl;}
#define Cout(x) cout<<(x)<<endl

typedef long long ll;

using namespace std;

const int INF = 1e9,MOD = 1e9 + 7;
const ll LINF = 1e18;

//while(x!=0){
            //sum+=x%10;
           // x/=10;
        //}
        //各桁の和

//pair<int,int> p[100000];
//P r[100000];
//cin >> tmp;
//p[i]=make_pair(tmp,i);
//cout << p[i].second+1 << endl;//ペアの右側つまりiを出力

//s.find(w[i])==string::npos
//findの使い方

//for(int i=0;i<n;i++){
   // b[i]=x%2;
    //x/=2;
  //}二進数

long long int n,cnt=0,ans=0,a,b,c,cmp,data,m,h,w,x,y,xcmp,ycmp,sum=0;

string s;

vector<int> z;

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

       cin >> a >> b >> c;
       YES(b-a==c-b);
return 0;
}


Measured memory_bytes: 256
number = 4
fare = [int(input()) for a in range(number)]

fare_added = []
fare_added.append(fare[0] + fare[2]) #A + C
fare_added.append(fare[0] + fare[3]) #A + D
fare_added.append(fare[1] + fare[2]) #B + C
fare_added.append(fare[1] + fare[3]) #B + D
 
fare_min = min(fare_added)

print(fare_min)

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

int main(){
  string s;
  cin >> s;
  cout << s[0] << s[1] << s[2] << endl;
  return 0;
}


Measured memory_bytes: 3580
#include <bits/stdc++.h>
#ifdef HIRO
#define d(f_, ...) printf((f_), ##__VA_ARGS__)
#else
#define d(f_, ...)
#endif

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<long long, long long> pllll;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector< pair<int, int> > vii;
typedef vector< pair<long long, long long> > vllll;
typedef map<int, int> mii;
typedef map<long long, long long> mllll;
typedef queue<int> qi;
typedef queue< pair<int, int> > qp;
#define mp make_pair
#define pi 3.14159265358979323846
#define MAX max_element
#define MIN min_element
#define all(v) v.begin(), v.end()
#define gt(T) greater<T>()
#define sum(v) accumulate(v.begin(), v.end(), 0ll)
#define uni(v) do{ \
  sort(v.begin(), v.end()); \
  decltype(v)::iterator result = unique(v.begin(), v.end()); \
  v.erase(result, v.end()); \
}while(0)
#define fi(init, n) for(int i = init; i < n; ++i)
#define fj(init, n) for(int j = init; j < n; ++j)
#define fk(init, n) for(int k = init; k < n; ++k)
#define zero(x) memset(x, 0, sizeof(x))
#define negative(x) memset(x, ~0, sizeof(x))
#define bitsum(x) __builtin_popcount(x)
const ll MOD = 1e9 + 7;
const int INF = 1e9;
const int di[] = { 0, 1, 0, -1 };
const int dj[] = { 1, 0, -1, 0 };

template<typename T>
T gcd(T a, T b) {
	return b ? gcd(b, a % b) : a;
}
template<typename T>
T lcm(T a, T b) {
	return a / gcd(a, b) * b;
}
template<typename T>
int finder(vector<T> vec, T number) {
	auto itr = find(vec.begin(), vec.end(), number);
	size_t index = distance(vec.begin(), itr);
	if (index != vec.size()) return 1;
	else return 0;
}
ll frac(ll n){
	if (n == 0) return 1;
	return (n * frac(n - 1)) % MOD;
}
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;
}

int main(int argc, char** argv) {
#ifdef HIRO
  string quiz(argv[1]);
  string id(argv[2]);
  string filename("input/" + quiz + "/" + id + ".txt");
  ifstream fin(filename);
  if (fin.peek() == ifstream::traits_type::eof()) {
    cout << "No input.";
    return 0;
  }
  ifstream cin(filename);
  std::cin.rdbuf(cin.rdbuf());
#endif
  ll ans = 0;
  // ll n;
  // cin >> n;
  ll n, k;
  cin >> n >> k;
  // ll n, m, k;
  // cin >> n >> m >> k;
  ll arr[n], order[n], all[n], ordersum = 0, allsum = 0;
  zero(order);
  zero(all);

  fi(0, n)
    cin >> arr[i];

  fi(0, n)
    fj(0, n) {
      if(arr[i] > arr[j]) {
        all[i]++;
        if(i < j)
          order[i]++;
      }
    }
  fi(0, n) {
    (ordersum += order[i]) %= MOD;
  }
  fi(0, n) {
    (allsum += all[i]) %= MOD;
  }
  (ans += k * ordersum) %= MOD;
  (ans += (((k * (k - 1) / 2) % MOD) * allsum) % MOD ) %= MOD;
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 256
n = int(input())
h = list(map(int, input().split()))
h.append(0)
count = 0
for j in range(100):
    work = []
    temp = []
    for el in h:
        if el == 0:
            if temp != []:
                m = min(temp)
                count += m
                for i in range(len(temp)):
                    temp[i] -= m
                temp.append(0)
                work.append(temp)
                temp = []
        else:
            temp.append(el)
    h = []
    for w in work:
        for el in w:
            h.append(el)
print(count)


Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <cmath>
#include <vector>
#define ll long long
#define mp(a,b) make_pair(a,b)
#define si(n) scanf("%d",&n)
#define sl(n) scanf("%lld",&n)
using namespace std;

int solve(string s,int x){
  int n = s.length();
  bool a1[26],a2[26];
  int c1=0;
  memset(a1,false,sizeof(a1));
  memset(a2,false,sizeof(a2));
  for(int i=0;i<=x;i++){
    if(a1[s[i]-'a']==false){
      a1[s[i]-'a']=true;
    }
  }
  for(int i=x+1;i<n;i++){
    if(a2[s[i]-'a']==false){
      a2[s[i]-'a']=true;
    }
  }
  for(int i=0;i<26;i++){
    if(a1[i]==true && a2[i]==true)
      c1+=1;
  }
  return c1;
}


int main(){
  int n;
  string s;
  cin >> n >> s;
  int ans = -1;
  for(int i=0;i<s.length()-1;i++){
    ans = max(ans,solve(s,i));
  }
  cout << ans << endl;
}


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

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

    int* array =  new int[N];
    int* darray =  new int[N];
    for (int i = 0; i < N; i++)
    {
        int value;
        cin >> value;
        array[i] = value;
    }


    for (int i = 0; i < N; i++)
    {
        int dist;
        if(i != N-1)
            dist = array[i+1] - array[i];
        else
            dist = (K - array[i]) + array[0];
        darray[i] = dist;
    //    cout << dist << ",";
    }

//cout << "\n";
    int min = -1;
    int sum = 0;
    for (int i = 0; i < N-1; i++)
    {
        sum += darray[i];
    }
    for (int i = 0; i < N; i++)
    {
        sum -= darray[i];
        sum += darray[(N-1+i) % N];
        //cout << "-" << sum << "-";
        if (min == -1)
            min = sum;
            else
            {
                if (min > sum)
                min = sum;
            }
            
    }
    
    
    cout << min;
    

    
    return 0;
}

Measured memory_bytes: 1792
#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <vector>
#include <bitset>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> ipair;
typedef pair<ll, ll> lpair;
typedef tuple<int, int, int> ituple;

// const int INF = INT_MAX;
// const ll INF = LLONG_MAX;
// const int MOD = ((int)1e9 + 7);
// const ld EPS = (1e-10);
#define PI acosl(-1)
#define MAX_N (100000 + 2)

void exec(){
  bitset<4000005> bs(1);
  int n, a, sum = 0;

  cin >> n;
  for (int i = 0; i < n; i++) {
    scanf("%d", &a);

    sum += a;
    bs = bs | (bs << a);
  }

  int ans = 0;
  for (int i = (sum / 2 + (sum % 2)); i <= sum; i++) {
    if (bs.test(i)) {
      ans = i;
      break;
    }
  }

  cout << ans << endl;

}

void solve(){
  int t = 1;
  // scanf("%d", &t);
  for (int i = 0; i < t; i++){
    exec();
  }
}

int main(){
  solve();
  return 0;
}


Measured memory_bytes: 2176
import java.util.Arrays;
import java.util.Scanner;

class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);			//文字の入力
		int[] a = new int[3];
		for(int i = 0;i < 3;i++){
			a[i] = sc.nextInt();
		}
		Arrays.sort(a);
		
		int ans =a[0]*a[1]/2;
		System.out.println(ans);
	}


}

class Pair implements Comparable{
	int from;		//p
	int end;		//y
	int num;
	int bango;
	@Override
	public int compareTo(Object other) {
		Pair otherpair = (Pair)other;

		return from - otherpair.from;
	}
}



Measured memory_bytes: 23124
#include<bits/stdc++.h>
using namespace std;
	
long long n,a[100005],ans=0;
bool vis[100005];
int main(){
	while(scanf("%d",&n)!=EOF){
	memset(vis,false,sizeof(vis));
	ans=0;
	for(int i=1;i<=n;i++)cin>>a[i];	
	for(int i=1;i<=n;i++){
		if(a[i])vis[i]=true;
		ans = ans+(a[i]/2);
		a[i]%=2;	
		}
	for(int i=2;i<=n;i++){
		if(a[i]&&a[i-1]){
			a[i]=0;
			a[i-1]=0;
			ans++;
		}
		else if(a[i-1]&&a[i]==0&&vis[i]){
			a[i-1]--;
			a[i]++;
		}
	}
	cout<<ans<<endl;	
	}
}

Measured memory_bytes: 1152
#include <cstdio>
#include <iostream>
#include <cstring>
#include <algorithm>
#include <queue>
using namespace std;


const int N = 123;
int a[N];
int ans[N];
int main() {
	int n;
	cin >> n;
	for(int i = 1; i <= n; i++) cin >> a[i];
	for(int i = n; i >= 1; i --) {
		int p = a[i];
		for(int j = 1; j <= n; j ++)  { 
			if(ans[j] == 0) p --;
			if(p == 0) {
				ans[j] = a[i];
				break;
			}
		}
	}

	bool flag = 0;
	for(int i = 1; i <= n; i ++) if(ans[i] == 0) flag = 1;
    if(flag) puts("-1");
	else for(int i = 1; i <= n; i ++) printf("%d\n", ans[i]);
}


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

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

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

  sort(P.begin(),P.end());
  int o = 0,t = 0,th = 0;
  for(int i = 0;i < N;i++) {
    if(P.at(i) <= A) o++;
    else if(P.at(i) > A && P.at(i) <= B) t++;
    else th++;
  }

  cout << min(o,min(t,th)) << endl;

}



Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <cmath>
#include <complex> // complex<double> a(1.2 , 2.3);// real(): 1.2, imag()2.3
using namespace std;

#define MOD 1000000007
#define ll long long
#define ld long double
#define FOR(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rmsame(a) sort(all(a)),a.erase(unique(all(a)), a.end())
#define rmvector(a,b) rep(i,a.size())rep(j,b.size())if(a[i]==b[j]){a.erase(a.begin()+i);i--;break;}
#define first_more_idx(ve, num) upper_bound(all(ve), num)-ve.begin() // idx = first_more_idx(ve,num); if(idx = ve.size()) , then not exist
#define first_lessequal_idx(ve, num) lower_bound(all(ve), num)-ve.begin()
#define pq_pair_tB priority_queue <pair<ll,ll>, vector<pair<ll,ll> > , greater<pair<ll,ll> > >
#define pq_pair_ts priority_queue <pair<ll,ll> > // only sort first param
template<typename X> bool exist(vector<X> vec, X item){return find(all(vec), item)!=vec.end();}
ll gcd(ll a, ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a, ll b){return a/gcd(a,b)*b;}
ll power(ll x, ll n){if(n == 0) return 1;return  (n%2)? x*power(x, n-1)%MOD : power(x*x%MOD, n/2);}

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

    ll N, D;
    cin >> N >> D;
    cout << N / (D * 2 + 1) + (N % (D * 2 + 1) != 0) << endl;


    //cout << fixed << setprecision(16) << ans << endl;
    return 0;
}


Measured memory_bytes: 256
using System;
namespace std 
{
    public class MainClass 
    {
        public static void Main() 
        {
            while(true) 
            {
                var input = Console.ReadLine().Split(' ');
                int h = int.Parse(input[0]);
                int w = int.Parse(input[1]);
                if (h <= 0 || w <= 0) {
                    break; 
                }
                string frame = new string('#', w);
                string mid = "#" + new string('.', w -2) + "#";

                Console.WriteLine(frame);
                for (int i = 0; i < h -2; i++) {
                    Console.WriteLine(mid); 
                }
                Console.WriteLine(frame);
                Console.WriteLine();
            }
        }
    }
}

Measured memory_bytes: 8820
string = input()
predicted_value = 0
last_colour = bool(int(string[0]))
for s in string[1:]:
    was_white = bool(int(s))
    if last_colour == was_white:
        predicted_value += 1
        last_colour = not was_white
    else:
        last_colour = was_white
print(predicted_value)

Measured memory_bytes: 3188
#include <stdio.h>
#define MAX 100

int main(){
  int n, i, j, k, l;
  int arr1[MAX][MAX], arr2[MAX];

  scanf("%d", &n);

  for( i=1; i<=n; i++){
    scanf("%d %d", &arr2[i-1], &arr2[i]);
  }

  for( i=1; i<=n; i++) arr1[i][i] = 0;

  for( l=2; l<=n; l++){
    for( i=1; i<=n-l+1; i++){
      j = i + l - 1;
      arr1[i][j] = 500000000;
      
      for( k = i; k<=j-1; k++){
	if( arr1[i][j] >= arr1[i][k] + arr1[k+1][j] + arr2[i-1] * arr2[k] * arr2[j] ) arr1[i][j] = arr1[i][k] + arr1[k+1][j] + arr2[i-1] * arr2[k] * arr2[j];
      }
    }
  }

  printf("%d\n", arr1[1][n]);

  return 0;
}

Measured memory_bytes: 636
S = input()
T = input()

slen = len(S)
tlen = len(T)

maxnum = -1
for i in range(slen-tlen+1):
    match = 0
    for j in range(tlen):
        if S[i+j] == T[j]:
            match += 1
    if maxnum < match:
        maxnum = match

print(tlen - maxnum)

Measured memory_bytes: 9060
#include<bits/stdc++.h>
#define de(x) cout<<#x<<"="<<x<<endl;
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define repd(i,a,b) for(int i=a;i>=(b);--i)
#define ll long long
#define mt(a,b) memset(a,b,sizeof(a))
#define fi first
#define se second
#define inf 0x7f
#define pii pair<int,int>
#define pdd pair<double,double>
#define pdi pair<double,int>
#define mp(u,v) make_pair(u,v)
#define sz(a) a.size()
#define ull unsigned long long
#define ll long long
#define pb push_back
const int maxn = 100010;
const double EPS = 1e-6;
using namespace std;
ll a[100010];
bool cmp(ll a,ll b)
{
	return a>b;
}
int main()
{
	int n;
	scanf("%d",&n);
	rep(i,0,n) scanf("%lld",a+i);
	sort(a,a+n,cmp);
	ll x=0,y=0;
	int flag=0;
	rep(i,1,n)
	{
		if(a[i]==a[i-1]&&flag==0) 
		{
			x=a[i];
			flag++;
			//de(x);
			i++;
			continue;
		}
		if(a[i]==a[i-1]&&flag==1) 
		{
			y=a[i];
			flag++;
			//de(y);
			i++;
			break;
		}		
	}
	if(flag==2) printf("%lld\n",x*y);
	else printf("0\n");
	return 0;
}



Measured memory_bytes: 1024
n = int(input())
a = list(map(int,input().split()))
a.sort()
aminus = []
aplus = []
p = 0
q = 0
for i in a:
    if i >= 0:
        aplus.append(i)
        p += 1
    elif i < 0:
        aminus.append(i)
        q += 1
ans = []
cou = 0
if aplus and aminus:
    now = aminus[0]
    for i in range(p-1):
        ans.append((now,aplus[i]))
        now = now - aplus[i]
    aminus[0] = now
    now = aplus[p-1]
    for i in range(q):
        ans.append((now,aminus[i]))
        now = now - aminus[i]
    cou = now
elif aplus:
    now = aplus[0]
    for i in range(1,p-1):
        ans.append((now,aplus[i]))
        now = now - aplus[i]
    ans.append((aplus[p-1],now))
    cou = aplus[p-1] - now
elif aminus:
    now = aminus[q-1]
    for i in range(q-1):
        ans.append((now,aminus[i]))
        now = now - aminus[i]
    cou = now

print(cou)
for i in range(n-1):
    print(*ans[i])


Measured memory_bytes: 24792
#include<iostream>
#define MOD 1000000007
using namespace std;
int n,Q,i,j,A[3005],jum,sum,x,y,Prob[3005][3005],q,val;

int pu(int a, int b)
{
    int i,rez=1;
    for(i=0; (1<<i)<=b; i++)
    {
        if((1<<i)&b)
            rez=(1LL*rez*a)%MOD;
        a=(1LL*a*a)%MOD;
    }
    return rez;
}

int main()
{
    ios::sync_with_stdio(false);
    cin>>n>>Q;
    for(i=1; i<=n; i++)
        cin>>A[i];
    for(i=1; i<=n; i++)
        for(j=i+1; j<=n; j++)
        {
            if(A[i]==A[j])
            {
                Prob[i][j]=Prob[j][i]=0;
                continue;
            }
            if(A[i]>A[j])
            {
                Prob[i][j]=1;
                Prob[j][i]=0;
            }
            else
            {
                Prob[i][j]=0;
                Prob[j][i]=1;
            }
        }
    jum=pu(2,MOD-2);
    for(q=1; q<=Q; q++)
    {
        cin>>x>>y;
        for(i=1; i<=n; i++)
        {
            if(i==x || i==y)
                continue;
            val=(((1LL*jum*Prob[i][x])%MOD)+((1LL*jum*Prob[i][y])%MOD))%MOD;
            Prob[i][x]=Prob[i][y]=val;
            val=(((1LL*jum*Prob[x][i])%MOD)+((1LL*jum*Prob[y][i])%MOD))%MOD;
            Prob[x][i]=Prob[y][i]=val;
        }
        val=(((1LL*jum*Prob[x][y])%MOD)+((1LL*jum*Prob[y][x])%MOD))%MOD;
        Prob[x][y]=Prob[y][x]=val;
    }
    for(i=1; i<=n; i++)
        for(j=i+1; j<=n; j++)
            sum=(sum+Prob[i][j])%MOD;
    cout<<(1LL*sum*pu(2,Q))%MOD<<"\n";
    return 0;
}


Measured memory_bytes: 35456
import java.util.*;
import static java.lang.Math.*;
import java.math.BigInteger;

public class Main {

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int n = sc.nextInt();
		int[] l = new int[n];
		for(int i = 0; i < n; i++){
		    l[i] = sc.nextInt();
		}

		// 計算
	    int result = 0;
	    Arrays.sort(l);
	    for(int i = 0; i < n; i++){
		    for(int j = i + 1; j < n; j++){
		        for(int k = j + 1; k < n; k++){
		            if(l[k] - l[j] < l[i]) result++;
		        }
		    }
		}

		// 出力
		System.out.println(result);
        
	}
}


Measured memory_bytes: 27216
#include <bits/stdc++.h>
#include <cmath>
typedef unsigned long long ULL;
typedef long long LL;
typedef unsigned long UL;
typedef unsigned int UI;
typedef unsigned short US;
typedef unsigned char UC;
#define RNG(v) (v).begin(), (v).end()
#define REP(v, e) for(UI v = 0U; v < e; ++v)
#define REP_(v, s, e) for(UI v = s; v < e; ++v)
#define REPV(v, e) for(v = 0; v < e; ++v)
#define REPV_(v, s, e) for(v = s; v < e; ++v)
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
    int tt=1;
    //cin>>tt;
    while(tt--)
    {   
        int n;cin>>n;
        cout<<n+n*n+n*n*n;
    }
        
    return 0;
}

Measured memory_bytes: 3612
#include<bits/stdc++.h>
using namespace std;
int main()
{
   long long int m,n,x,y,i;
    cin>>m>>n;
    x=n;
    y=m;
    for(i=2;i<=m;i++)
    {

       x=x*10+n;
    }
    for(i=2;i<=n;i++)
    {
        y=y*10+m;
    }
    if(x<y)
      cout<<y<<endl;
     else
        cout<<x<<endl;
      return 0;
    }


Measured memory_bytes: 256
n = int(input())
lis = []
cou1 = 0
cou2 = 0
cou4 = 0
li = list(map(int,input().split()))
for i in range(n):
    if li[i] % 2 == 0:
        if li[i] % 4 == 0:
            cou4 += 1
        else:
            cou2 += 1
    else:
        cou1 += 1
if cou2 >= 1:
    if cou1 <= cou4:
        print("Yes")
    else:
        print("No")
else:
    if cou1 <= cou4 + 1:
        print("Yes")
    else:
        print("No")

Measured memory_bytes: 14228
#include<stdio.h>
#define N 100
#define WHITE 0
#define GRAY 1
#define BLACK 2
 
void dfs(void);
void visit(int);
 
int G[N][N],n,d[N],f[N],color[N],time;
 
int main(){
   int i,j,k,u,v;
  scanf("%d",&n);
  for(i = 0; i < n; i++){
    for(j = 0; j < n; j++){
      G[i][j] = 0;
    }
  }
  for(i = 0; i < n; i++){
    scanf("%d%d",&u,&k);
    u=u-1;
    for(j = 0; j < k; j++){
      scanf("%d",&v);
      v=v-1;
      G[u][v] = 1;
    }
  }
  dfs();
  return 0;
}
  void dfs(){
    int i;
    for(i = 0; i < n; i++) color[i] = WHITE;
    time = 0;
    for(i =0 ; i < n; i++){
      if(color[i] == WHITE) visit(i);
    }
    for( i = 0; i < n; i++){
      printf("%d %d %d\n",i+1,d[i],f[i]);
    }
  }
  void visit(int u){
    int i;
    color[u] = GRAY; 
    d[u] = ++time;
    for(i = 0; i < n; i++){
      if(G[u][i] == 0) continue;
      if(color[i] == WHITE){
    visit(i);
      }
    }
    color[u] = BLACK;
    f[u] = ++time;
  }

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

using namespace std;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
template<class T> inline T sqr(T x) {return x*x;}

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;

#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define mp make_pair
#define each(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define exist(s,e) ((s).find(e)!=(s).end())
#define range(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  range(i,0,n)
#define clr(a,b) memset((a), (b) ,sizeof(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

const double eps = 1e-10;
const double pi  = acos(-1.0);
const ll INF =1LL << 62;
const int inf =1 << 29;

int main(void){
    for(int n, m, c, s, g; cin >> n >> m >> c >> s >> g, n;){
        s--, g--;

        vector<vvi> minDist_only(c, vvi(n, vi(n, inf)));
        rep(cc, c) rep(i, n) minDist_only[cc][i][i] = 0;
        rep(i, m){
            int x, y, d, cc; cin >> x >> y >> d >> cc;
            x--, y--; cc--;

            minDist_only[cc][x][y] = min(minDist_only[cc][x][y], d);
            minDist_only[cc][y][x] = min(minDist_only[cc][y][x], d);
        }

        vi p(c);
        rep(i, c) cin >> p[i];

        vvi q(c), r(c);
        rep(i, c){
            q[i] = vi(p[i] - 1);
            r[i] = vi(p[i]);

            for(auto && qq : q[i]) cin >> qq;
            for(auto && rr : r[i]) cin >> rr;
        }

        vvi cost(c, vi(20001));
        rep(cc, c){
            int idx = 0;
            range(d, 1, cost[cc].size()){
                if(idx != p[cc] - 1 && d > q[cc][idx]) idx++;

                cost[cc][d] = cost[cc][d - 1] + r[cc][idx];
            }
        }

        rep(cc, c){
            rep(k, n) rep(i, n) rep(j, n)
                minDist_only[cc][i][j] = min(minDist_only[cc][i][j], minDist_only[cc][i][k] + minDist_only[cc][k][j]);

            rep(i, n){
                rep(j, n){
                    if(minDist_only[cc][i][j] >= inf) continue;

                    assert(minDist_only[cc][i][j] >= 0 && minDist_only[cc][i][j] < 20001);
                    minDist_only[cc][i][j] = cost[cc][minDist_only[cc][i][j]];
                }
            }
        }

        vvi minDist(n, vi(n, inf));
        rep(cc, c) rep(i, n) rep(j, n) minDist[i][j] = min(minDist[i][j], minDist_only[cc][i][j]);
        rep(k, n) rep(i, n) rep(j, n) minDist[i][j] = min(minDist[i][j], minDist[i][k] + minDist[k][j]);

        if(minDist[s][g] == inf) cout << -1 << endl;
        else cout << minDist[s][g] << endl;
    }

	return 0;
}

Measured memory_bytes: 3752
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(x),end(x)
#define show(obj) {for(auto x:obj)cout<<x<<' ';cout<<endl;}
#define line "----------"
typedef long long ll;
typedef pair<int,int> ip;
typedef pair<ll,ll> lp;
const int inf = 1001001000;
const ll INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

int main(){
	int N,a;
	cin>>N>>a;
	int sum = 0;
	int nin = inf;
	rep(i,N){
		sum += a + i;
		if(abs(nin) > abs(a+i))nin = a+i;
	}
	cout<<sum - nin<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	ll n;
	cin>>n;
	ll a[n+5];
	for(ll i=1;i<=n;i++)
	{
		cin>>a[i];
	}
	ll ans[n+4];
	for(ll i=1;i<=n;i++)
	{
		ans[i]=-1;
	}
	ll cnt=0;
	for(ll i=n;i>0;i--)
	{
		ll val=0;
		for(ll j=2*i;j<=n;j+=i)
		{
			val+=ans[j];
		}
		if ((val%2)==a[i])
		{
			ans[i]=0;
		}
		else
		{
			cnt++;
			ans[i]=1;
		}
	}
	cout<<cnt<<"\n";
	for(ll i=1;i<=n;i++)
	{
		if (ans[i]==1)
			cout<<i<<" ";
	}

}

Measured memory_bytes: 3968
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
 
#define ll long long int
#define fast ios_base::sync_with_stdio(false)
#define fast_input cin.tie(NULL)
#define fast_output cout.tie(NULL)
#define vi vector<long long int> 
#define pb push_back
#define pa pair<long long int ,long long int> 
#define f(a,x,b) for(int a=x;a<b;a++)
#define fr(a,x,b) for(int a=x;a>=b;a--)
#define sort(x) sort(x.begin(),x.end());
#define siz(a) (int)a.size()
#define mod 1000000007
#define F first
#define S second
#define um unordered_map<ll,ll>
#define ordered_set tree<pa, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
vector<ll> spf(1000001,-1);
ll isprime[1000001];
ll cnt[1000001];
void solve()
{
	ll n;
	cin>>n;
	vi v(n);
	ll gcc;
	f(i,0,n)
	{
		cin>>v[i];
		if(i==0)
		{
			gcc=v[i];
		}
		gcc=__gcd(gcc,v[i]);
	}
    if(gcc!=1)
	{
		cout<<"not coprime"<<endl;
		return;
	}
	isprime[0]=1;
	isprime[1]=1;
	for(int j=2;j*j<=1000000;j++)
	{
	  if(isprime[j]==0)
	  {
      for(int i=j*j;i<=1000000;i+=j)
	  {
		  spf[i]=j;
		  isprime[i]=1;
	  }
	  }
	}
	f(i,0,n)
	{
		vi re;
		ll sp=spf[v[i]];
		if(sp==-1&&v[i]>1)
		{
           cnt[v[i]]++;
		}
		while(sp!=-1)
		{
			re.pb(sp);
			cnt[sp]++;
			while(v[i]%sp==0)
			{
				v[i]/=sp;
			}
			sp=spf[v[i]];
			if(sp==-1&&v[i]>1)
			{
             cnt[v[i]]++;
			}
		}
		// for(ll d:re)
		// {
		// 	cout<<d<<" ";
		// }
		// cout<<endl;
	}
	ll fl=0;
	f(i,2,1000001)
	{
		if(isprime[i]==0&&cnt[i]>1)
		{
			fl=1;
			break;
		}
	}
	if(fl)
	{
		cout<<"setwise coprime"<<endl;
	}
	else
	{
		cout<<"pairwise coprime"<<endl;
	}
}
int main() {
	fast;
	fast_input;
	fast_output;
	// ll t;
	// cin>>t;
	// f(i,0,t)
	// {
        //  cout<<"Case #"<<i+1<<":"<<" ";
	     solve();
	// }
	return 0;
}

Measured memory_bytes: 34264