akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using VI = vector<int>;
using VL = vector<ll>;
using loop = int;
template<class T> using PQ = priority_queue<T, vector<T>, greater<T>>;
#define FOR(i,a,n) for(loop (i)=(a);(i)<(n);++(i))
#define eFOR(i,a,n) for(loop (i)=(a);(i)<=(n);++(i))
#define rFOR(i,a,n) for(loop (i)=(n)-1;(i)>=(a);--(i))
#define erFOR(i,a,n) for(loop (i)=(n);(i)>=(a);--(i))
#define each(i, a) for(auto &i : a)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
#define out(y,x) ((y) < 0 || h <= (y) || (x) < 0 || w <= (x))
#define line cout << "------------------------\n" 
#define ENDL(i,n) ((i) == (n) - 1 ? "\n" : " ")
#define stop system("pause") //comment out this on AOJ.
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
constexpr ld eps = 1e-10;
constexpr ld pi = 3.1415926535897932;
template<class T>inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; }return false; }
template<class T>inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; }return false; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& is, vector<T>& v) { for (auto& elemnt : v)is >> elemnt; return is; }
template<class T, class U>inline istream& operator>>(istream& is, pair<T, U>& p) { is >> p.first >> p.second; return is; }
template<class T>inline vector<T> vec(size_t a) { return vector<T>(a); }
template<class T>inline vector<T> defvec(T def, size_t a) { return vector<T>(a, def); }
template<class T, class... Ts>inline auto vec(size_t a, Ts... ts) { return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...)); }
template<class T, class... Ts>inline auto defvec(T def, size_t a, Ts... ts) { return vector<decltype(defvec<T>(def, ts...))>(a, defvec<T>(def, ts...)); }

int main() {
    init();

    int n; cin >> n;
    map<int, int> ma;
    FOR(i, 0, n) {
        int d; cin >> d;
        ++ma[d];
    }
    int m; cin >> m;
    FOR(i, 0, m) {
        int t; cin >> t;
        if (ma[t] == 0) {
            cout << "NO\n";
            return 0;
        }
        else --ma[t];
    }
    cout << "YES\n";
}

Measured memory_bytes: 9600
using System;
using System.Linq;
using System.Collections.Generic;
using System.IO;


class Program
{
    public static long Read()
    {
        return long.Parse(Console.ReadLine());
    }

    public static long[] Reads()
    {
        return Console.ReadLine().Split().Select(long.Parse).ToArray();
    }

    public static void Main()
    {
        var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
        Console.SetOut(sw);

        var n = Read();
        if (n % 2 == 0)
            Console.WriteLine(n / 2 - 1);
        else
            Console.WriteLine((n - 1) / 2);
         
        
        Console.Out.Flush();
    }
}


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

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

int main() {
    int n, k;
    cin >> n >> k;
    vector<int> a(n, 0);
    int d, tmp;

    rep(i, k) {
        cin >> d;
        rep(j, d) {
            cin >> tmp;
            tmp--;
            a[tmp]++;
        }
    }
    int ans = 0;
    rep(i,n){
        if(!a[i]) ans++;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3596
#include<cstdio>

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

using namespace std;

int main(){
	for(int n;scanf("%d",&n),n;){
		int a[1000],b[1000],c[1000],d[1000];
		rep(i,n) scanf("%d%d%d%d",a+i,b+i,c+i,d+i);

		int p,q,r,s; scanf("%d%d%d%d",&p,&q,&r,&s);
		bool ok=false;
		rep(i,n){
			if(b[i]<=p
			&& c[i]<=q
			&& d[i]<=r
			&& 4*b[i]+9*c[i]+4*d[i]<=s) printf("%d\n",a[i]), ok=true;
		}
		if(!ok) puts("NA");
	}

	return 0;
}

Measured memory_bytes: 0
/**
*    author:  y_takano
*    created: 18.06.2020 15:32:54
**/

#include <bits/stdc++.h>

using namespace std;

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

  vector<int> arr(3);
  cin >> arr.at(0) >> arr.at(1) >> arr.at(2);

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

  cout << arr.at(0) << ' ' << arr.at(1) << ' ' << arr.at(2) <<  endl;

  return 0;
}


Measured memory_bytes: 3156
n=int(input())
a=list(map(int,input().split()))
x4=0
x2=0
y=0
for i in range(len(a)):
    if a[i]%4==0:
        x4+=1
    elif a[i]%2==0:
        x2+=1
    else:
        y+=1
if x4>=y:
    print("Yes")
elif x4>=(y-1) and x2==0:
    print("Yes")
else:
    print("No")


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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

#define ld long double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

//-------------------------------------------------

bool dp[100500];

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

    dp[0] = true;
    for(int i=0; i<=x; i++){
        if (!dp[i]) continue;
        rep(j,6){
            dp[i+100+j] = true;
        }
    }

    if (dp[x]){
        cout<<"1\n";
    }else{
        cout<<"0\n";
    }
    return 0;
}


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

using namespace std;

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

#define REP(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, a, b) for(int i=(a); i<(b); ++i)
#define FORR(i, a, b) for(int i=(b)-1; i>=(a); --i)

#define DEBUG(x) cout<<#x<<": "<<(x)<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'
#define ALL(a) (a).begin(), (a).end()

template<typename T> inline void CHMAX(T& a, const T b) {if(a<b) a=b;}
template<typename T> inline void CHMIN(T& a, const T b) {if(a>b) a=b;}

constexpr ll MOD=1000000007ll;
// constexpr ll MOD=998244353ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

const double EPS=1e-11;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  // cout<<setprecision(10)<<fixed;
  int n, x[125];
  cin>>n;
  REP(i, n){
    cin>>x[i];
  }
  int ans=1e9;
  REP(i, 101){
    int tmp=0;
    REP(j, n){
      tmp+=(x[j]-i)*(x[j]-i);
    }
    CHMIN(ans, tmp);
  }
  cout<<ans<<'\n';
  return 0;
}


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

constexpr int mod = 1e9+7;
int n, m;
vector<int> a, dp;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cin >> n >> m;
	dp.resize(n+1, 0);
	a.resize(n+1, 0);
	for(int i=0; i<m; ++i){
		int t; cin >> t;
		a[t] = 1;
	}
	dp[0] = 1;
	for(int i=1; i<=n; ++i){
		if(a[i] == 0){
			dp[i] = dp[i-1] + dp[i-2];
			dp[i] %= mod;
		}
	}
	cout << dp[n] << "\n";
}


Measured memory_bytes: 1024
n = int(input())
scaffold = list(map(int, input().split()))
dp = [10 ** 4 * 10 ** 5] * n
dp[0] = 0
dp[1] = abs(scaffold[0] - scaffold[1])

for i in range(2, n):
    cost_1 = abs(scaffold[i - 1] - scaffold[i]) + dp[i - 1]
    cost_2 = abs(scaffold[i - 2] - scaffold[i]) + dp[i - 2]
    dp[i] = min(dp[i], cost_1, cost_2)
    
ans = dp[-1]
print(ans)


Measured memory_bytes: 13980
#include <iostream>
using namespace std;
int main(void){
   double W,H;
   double x,y;
   cin >> W >> H >> x >> y;
   double ans2 = 0;
   double ans1 = 0;
   ans1 = W*H/2;
   if(W/2==x&&H/2==y){
       ans2 = 1;
   }
   
   cout << ans1 << " "<< ans2 << endl;
   

}


Measured memory_bytes: 256
#include<cctype>
#include<cstdio>
#include<cstring>

int main(void){
  char str[1001];

  while(1){
    scanf("%s",str);
    if(str[0]=='0')break;
    int sum=0;
    for(int i=0;i<strlen(str);i++){
      sum+=(str[i]-'0');
    }
  printf("%d\n",sum);}
  
}



Measured memory_bytes: 2720
asd = raw_input()
asdd = asd.split()
n = int(asdd[0])
m = int(asdd[1])
if n == 1:
    print (m+1)%1000000007
    exit(0)

x=(m+1)/(n-1)
print (2*((m+1)*x-x*(n-1)*(x+1)/2)+m+1)%1000000007

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

int main() {
    const int INF = 1 << 30;
    vector<int> dp1(1000000, INF), dp2(1000000, INF);
    dp1[0] = dp2[0] = 0;
    for (int i = 0; i < 1000000; ++i) {
        for (int j = 1; ; ++j) {
            int num = j * (j + 1) * (j + 2) / 6;
            if (i + num >= 1000000) break;
            dp1[i + num] = min(dp1[i + num], dp1[i] + 1);
            if (num % 2 == 1) dp2[i + num] = min(dp2[i + num], dp2[i] + 1);
        }
    }
    int n;
    while (cin >> n, n) {
        cout << dp1[n] << " " << dp2[n] << endl;
    }
}


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

#define fr first
#define sc second
#define mk make_pair
#define pb push_back
#define ll long long
#define OK puts("OK");
#define sz(s) (int)s.size()
#define all(s) s.begin(), s.end()

using namespace std;

const int N = 3 * 1e5 + 10;
const int inf = 1e9 + 7;

int tests, res;

ll  sum, mx = -inf, mn = inf, u[30];

main()
{
    //freopen(".in", "r", stdin); freopen(".out", "w", stdout);
    string s;
    cin >> s;
    ll n = sz(s);
    ll ans = n * ( n - 1 ) / 2;
    for( int i = 0; i < n; i ++ )
    {
        u[s[i]] ++;
    }
    for( int i = 'a'; i <= 'z'; i ++ )
    {
        ans -= u[i] * (u[i] - 1) / 2;
    }
    cout << ans + 1;
}


Measured memory_bytes: 640
using System;
class main
{
    static void Main(String[] args)
    {
        double n = double.Parse(Console.ReadLine());
        double b = 100000;
        for (int i = 0; i < n; i++)
        {
            b = b * 1.05;
            b = (Math.Ceiling(b / 1000))*1000;
        }
        Console.WriteLine(b);
    }
}

Measured memory_bytes: 18032
#include <iostream>
#include <string>
#include <sstream>

using namespace std;

//long abs(long f) {
//  return f >= 0 ? f : -f;
//}

int main(void){
  string str;
  getline(cin, str);
  int N = stoi(str);
  getline(cin, str);
  istringstream iss(str);
  iss >> str;
  long T = stoi(str);
  iss >> str;
  long A = stoi(str);
  getline(cin, str);
  iss = istringstream(str);
  long minDT = 9223372036854775807;
  int minIdx = 0;
  for (int i = 0; i < N; i++) {
    iss >> str;
    long H = stoi(str);
    if (abs(((long)(A*1000 - (T*1000 - H * 6)))) < minDT) {
      minDT = abs(A*1000 - (T*1000 - H * 6));
      minIdx = i;
    }
  }
  cout << minIdx + 1 << endl;
  return 0;
}

Measured memory_bytes: 256
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
mod2 = 998244353
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

n,k = inpl()
a = inpl()
dp = [INF] * (n+5)
dp[0] = 0
for i in range(n-1):
    for j in range(1,k+1):
        if i+j > n-1:
            break
        dp[i+j] = min(dp[i+j], dp[i] + abs(a[i+j]-a[i]))
print(dp[n-1])

Measured memory_bytes: 80668
#include<bits/stdc++.h>
using namespace std;
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define READ freopen("in.txt","r",stdin)
#define WRITE freopen("out.txt","w",stdout);
#define pb push_back
#define mem(arr,val) memset(arr,val,sizeof(arr))
#define sf(x) scanf("%d",&x)
#define sf2(x,y) scanf("%d %d",&x,&y)
#define sf3(x,y,z) scanf("%d %d %d",&x,&y,&z)
#define sl(x) scanf("%lld",&x)
#define sl2(x,y) scanf("%lld %lld",&x,&y)
#define sl3(x,y,z) scanf("%lld %lld %lld",&x,&y,&z)
#define sd(x) scanf("%lf",&x);
#define pii pair<int,int>
#define pLL pair<long long,long long>
#define ff first
#define sn second
#define PRINT_CASE  printf("Case %d: ",tc++)
#define PRINT_CASENL  printf("Case %d:\n",tc++)
#define mx 100005
#define lnd tree[ind<<1]
#define rnd tree[(ind<<1)+1]
#define cnd tree[ind]
#define lndp b,(b+e)>>1,(ind<<1)
#define rndp ((b+e)>>1)+1,e,(ind<<1)+1
#define IN(a,x,y) (a>=x && a<=y)
typedef long long ll;
typedef long long int lln;
ll INF=1<<28;
//typedef long long lld;
const double pi=acos(-1.0);
int fx[]={1,-1,0,0}; //direction array
int fy[]={0,0,1,-1};
int dir[4][2]={1,0,-1,0,0,-1,0,1};
const long double EPS=1e-7;
//#define INF 10000
ll gcd(ll a,ll b)
{
    if(b==0)
        return a;
    else
        return gcd(b,a%b);
}
ll lcm(ll a,ll b)
{
    return a/gcd(a,b)*b;
}

bool cmp(int a, int b)
{
    return a<b;
}

struct compare
{
  bool operator()(const int& l, const int& r)
  {
      return l>r;
  }
};
ll inf=1e18;
ll dp[200000][2][2][2];
int h[200000];
int A[200000],B[200000],C[200000];
int n,k;
ll fun(int pos,int a,int b,int c)
{
    if(pos==n)
        return 0;
    if(dp[pos][a][b][c]!=-1)
        return dp[pos][a][b][c];
    ll ans=-1;
    if(a)
    {
        ans=max(ans,(B[pos]+fun(pos+1,0,1,0)));
        ans=max(ans,(C[pos]+fun(pos+1,0,0,1)));
    }
    else if(b)
    {
        ans=max(ans,(A[pos]+fun(pos+1,1,0,0)));
        ans=max(ans,(C[pos]+fun(pos+1,0,0,1)));
    }
    else if(c)
    {
        ans=max(ans,(A[pos]+fun(pos+1,1,0,0)));
        ans=max(ans,(B[pos]+fun(pos+1,0,1,0)));
    }
    else
    {
        ans=max(ans,(A[pos]+fun(pos+1,1,0,0)));
        ans=max(ans,(B[pos]+fun(pos+1,0,1,0)));
        ans=max(ans,(C[pos]+fun(pos+1,0,0,1)));
    }
    return dp[pos][a][b][c]=ans;
}
int main()
{
//    READ;
    sf(n);
    for(int i=0;i<n;i++)
    {
        sf3(A[i],B[i],C[i]);
    }
    mem(dp,-1);
    cout<<fun(0,0,0,0)<<endl;
    return 0;
}


Measured memory_bytes: 22784
#import<bits/stdc++.h>
int i,m,n,t=2,a[100001];
main()
  {
  for(scanf("%d",&n);i<n;)scanf("%d",a+i++);
  std::sort(a,a+n);
  for(m=a[1]+1;t>1;)
    {
    m--;
    for(i=t=0;t<2&i<n;i++)t+=a[i]%m>0;
    }
  printf("%d",m);
  }

Measured memory_bytes: 640
loop do
    n = gets.to_i
    break if n== 0
    a = n.times.map{gets.to_i}
    dp = Array.new(n)
    a.each_with_index do |aa, i|
        if i == 0
            dp[0] = a[0]
            next
        end
        dp[i] = [a[i], a[i] + dp[i-1]].max
    end
    puts dp.max
end

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

using ll = long long;
using pii = pair<ll, ll>;
using vi = vector<ll>;
using vvi = vector<vi>;

template <class T>
using max_heap = priority_queue<T>;
template <class T>
using min_heap = priority_queue<T, vector<T>, greater<T>>;

template <class T, class U>
void chmax(T &a, U b) {
    if (a < b) a = b;
}
template <class T, class U>
void chmin(T &a, U b) {
    if (b < a) a = b;
}

#define rep(i, j, k) for (int i = j; i < k; i++)
#define all(obj) (obj).begin(), (obj).end()
#define rall(obj) (obj).rbegin(), (obj).rend()
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) cerr << #x << ": " << x << ", " << #y << ": " << y << endl;
#define int ll

const ll mod = 1e9 + 7;
const ll inf = (1LL << 60);

#include <iostream>

/* recursion ver
 *
long long gcd(long long a, long long b) {
    if (b == 0) return a;
    else return gcd(b, a % b);
}
*/

long long gcd(long long m, long long n) {

    if (m < n)
        std::swap(m, n);

    long long tmp;
    while (m % n != 0) {
        tmp = n;
        n = m % n;
        m = tmp;
    }

    return n;
}

long long lcm(long long m, long long n) { return m * n / gcd(m, n); }

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

    int K;
    cin >> K;

    int ans = 0;
    rep(i, 1, K + 1) rep(j, 1, K + 1) rep(k, 1, K + 1) {
        ans += gcd(i, gcd(j, k));
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3652
/*プログラミングコンペティションサイト AtCode は、プログラミングコンテストを定期的に開催しています。
AtCode で次に開催されるコンテストは ABC と呼ばれ、レーティングが 1200
未満の参加者のレーティングが変動します。
その次に開催されるコンテストは ARC と呼ばれ、レーティングが 2800
未満の参加者のレーティングが変動します。そのさらに次に開催されるコンテストは AGC と呼ばれ、
すべての参加者のレーティングが変動します。高橋くんの AtCode でのレーティングはR
です。彼のレーティングが変動する次のコンテストは何でしょうか？*/

#include <stdio.h>

int main(void){
  int rate;
  scanf("%d",&rate);
  if(rate<1200){
    printf("ABC");
  }else if(rate<2800){
    printf("ARC");
  }else{
    printf("AGC");
  }
  return 0;
}

Measured memory_bytes: 128
N = int(input())
H = list(map(int, input().split()))
H = H[::-1]

for i in range(N - 1):
    if H[i] + 1 == H[i + 1]:
        H[i + 1] -= 1

    elif H[i] >= H[i + 1]:
        continue

    else:
        print('No')
        break
else:
    print('Yes')


Measured memory_bytes: 14396
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;

struct item
{
	//weight, value
	ll w = 0, v = 0;
	item(ll a = 0, ll b = 0)
	{
		w = a;
		v = b;
	}
};

const ll INF = 1e15;
ll n, cap;
vector<item> items;
bool cached[100][100001];
ll memo[100][100001];

ll knap(ll i, ll sum)
{
	if (sum < 0)
		return INF;
	if (sum == 0)
		return 0LL;
	if (i == n)
		return INF;
	if (cached[i][sum])
		return memo[i][sum];

	ll res1 = knap(i + 1, sum - items[i].v) + items[i].w;
	ll res2 = knap(i + 1, sum);
	ll res = min(res1, res2);
	cached[i][sum] = true;
	memo[i][sum] = res;
	return res;
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin >> n >> cap;
	items = vector<item>(n);
	for (int i = 0; i < n; i++)
	{
		ll w, v;
		cin >> w >> v;
		items[i] = item(w, v);
	}
	for (ll i = 100000; i >= 0; i--)
	{
		ll reqcap = knap(0, i);
		if (reqcap <= cap)
		{
			cout << i;
			break;
		}
	}
}

Measured memory_bytes: 91236
#include<iostream>
#include<cstring>
#include<vector>
#include<algorithm>
using namespace std;
#define SZ(v) ((int)(v).size())
#define rep(i,n) for(int i=0;i<(n);i++)
#define foreach(it,c) for(__typeof(c.begin()) it=c.begin();it!=c.end();it++)
#define all(v) (v).begin(),(v).end()
typedef long long ll;
typedef unsigned uint;
const int INF=0x3f3f3f3f;
int inline in(){int x=0,c;for(;(uint)((c=getchar())-'0')>=10;)
{if(c=='-')return -in();if(!~c)throw ~0;}do{x=(x<<3)+(x<<1)+(c-'0');}
while((uint)((c=getchar())-'0')<10);return x;}
int main(){
	int a,b;
	cin>>a>>b;
	string t1="",t2="";
	for(int i=1;i<=a;i++)t2+=(b+'0');
	for(int i=1;i<=b;i++)t1+=(a+'0');
	if(t1>t2)cout<<t2<<endl;
	else cout<<t1<<endl;
	return 0;
}


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

int main(){
  	int x,y;
	cin >> x >> y;
  	double a,b;
  	a = (4.0*x-y)/2.0;
  	b = (y-2.0*x)/2;
  	if((double)a - (int)a == 0 && (double)b-(int)b == 0 && a>=0 && b >= 0){
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    } 
}

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


int main(){


  int n,m;
  cin>>n>>m;
  
  vector<int> height(n+1);

  
  
  for (int i=1;i<=n;i++){
    int tmp;
    cin>>tmp;
    height.at(i)=tmp;
  }
  
  vector<vector<int>> group(n+1,vector<int>(0));
  
  for (int i=0;i<m;i++){
    int a,b;
    cin>>a>>b;
    
    group.at(a).push_back(b);
    group.at(b).push_back(a);
  }
  
  int answer=0;
  
  for (int i=1;i<=n;i++){
    int size;
    size=int(group.at(i).size());
    
    int  count=1;
    
    for (int j=0;j<size;j++){
      if (height.at(i)<=height.at(group.at(i).at(j))){
        count=0;
        break;
      }
    }
    
    answer+=count;
  }
  
  cout<<answer<<endl;
  
    
    
        
      
    
  
  
  
  
    
  
}

Measured memory_bytes: 8804
def power(x, a):
    if a == 0:
        return 1
    elif a == 1:
        return x
    elif a % 2 == 0:
        return power(x, a//2) **2 % mod
    else:
        return power(x, a//2) **2 * x % mod

def modinv(x):
    return power(x, mod-2)

def binomial_coefficients(n, k):
    numera = 1  
    denomi = 1  

    for i in range(k):
        numera *= n-i
        numera %= mod
        denomi *= i+1
        denomi %= mod
    return numera * modinv(denomi) % mod

n,a,b=map(int,input().split())
mod=1000000007
print((pow(2,n,mod)-1-binomial_coefficients(n, a)-binomial_coefficients(n, b))%mod)

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

typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;

// #define OJ
#define pb push_back
#define F first
#define S second

#define WLL(t) while(t--)
#define FOR(i,a,b) for(int i = a; i < b; i++)
#define STF(i, a, b) for(size_t i = a; i < b; i++)
#define RFOR(i, a, b) for(int i = a; i >= b; i--)
#define SRF(i, a, b) for(size_t i = a;i >= b;i--)

#define ALL(v) v.begin(),v.end()
#define PRECISION(x) cout<<fixed<<setprecision(x)
#define FASTIO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define READ freopen("input.txt", "r", stdin)
#define WRITE freopen("output.txt", "w", stdout)
#define MOD 1000000007

#define TO(v, type) static_cast<type>(v)

void solve(ll a, ll b, ll c, ll d);
int main()
{
#ifdef OJ
	READ;
	WRITE;
#endif

	FASTIO;
	ll a{}, b{}, c{}, d{};
	cin >> a >> b >> c >> d;
	solve(a, b, c, d);
	return 0;
}
void solve(ll a, ll b, ll c, ll d)
{
	cout << max(max(a * c, a * d), max(b * c, b * d)) << '\n';
}

Measured memory_bytes: 3612
#include<stdio.h>
int main(){
int a, b;
scanf("%d %d", &a, &b);
if(a == b){
printf("a == b\n");
}
else if(a > b){
printf("a > b\n", a, b);
}
else {
printf("a < b\n", a, b);
}
return 0;
}


Measured memory_bytes: 2104
#include <iostream>
#include <set>
#include <string>
#include <algorithm>
using namespace std;

int main(){
  string input;
  string ans;
  int n;
  set<string> train;
  string left, right;

  cin >> n;
  for(int k=0; k<n; k++){
    train.clear();
    cin >> input;
    for(int i=1; i<=input.length()-1; i++){
      left = input.substr(0, i);
      right = input.substr(i, input.length()-1);
   
      train.insert(left+right);//ss
      train.insert(right+left);
     
      reverse(right.begin(), right.end());
      train.insert(left+right);//sr
      train.insert(right+left);
      
      reverse(left.begin(), left.end());
      train.insert(left+right);//rr
      train.insert(right+left);

      reverse(right.begin(), right.end());
      train.insert(left+right);//rs
      train.insert(right+left);
    }
    cout << train.size() << endl;
  }
  return 0;
}

Measured memory_bytes: 996
fun main(args: Array<String>) {
    val (x1, y1, x2, y2) = readLine()!!.split(" ").map(String::toInt)

    val x = x2 - x1
    val y = y2 - y1


    println("${x2 - y} ${y2 + x} ${x1 - y} ${y1 + x}")
}

Measured memory_bytes: 36004
import sys,bisect,heapq

mod = 10**9+7
dd = ((-1, 0), (0, -1), (1, 0), (0, 1))

def I(): return(int(sys.stdin.readline()))
def LI(): return([int(x) for x in sys.stdin.readline().split()])
def IR(n): return([I() for _ in range(n)])
def S(): return(input())

def GCD(a,b):
    while(a%b != 0):
        a,b = b,a%b
    return b

def LCM(a,b):
    return a*b//GCD(a,b)

def main():
    N = I()
    A = IR(N)
    r = 0
    o = 0
    for a in A:
        if o==0:
            r += a//2
            o = a%2
        else:
            if a%2 == 1:
                r += (a+1)//2
                o = 0
            elif a>=2:
                r += a//2
                o = 1
            else:
                o = 0
    return r

if __name__ == "__main__":
    print(main())


Measured memory_bytes: 44252
package main

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

func dfs(graph [][]bool, visited []bool, index int) int {
	allVisited := true
	for _, v := range visited {
		if v == false {
			allVisited = false
		}
	}
	if allVisited {
		return 1
	}
	ret := 0
	for i, v := range visited {
		if graph[index][i] == false {
			continue
		}
		if v {
			continue
		}
		visited[i] = true
		ret += dfs(graph, visited, i)
		visited[i] = false
	}
	return ret
}

func solve() {
	n := scanInt()
	m := scanInt()
	graph := make([][]bool, n)
	visited := make([]bool, n)
	for i := 0; i < len(graph); i++ {
		graph[i] = make([]bool, n)
	}
	for i := 0; i < m; i++ {
		a, b := scanInt(), scanInt()
		a--
		b--
		graph[a][b] = true
		graph[b][a] = true
	}
	visited[0] = true
	fmt.Println(dfs(graph, visited, 0))
	return
}

var sc = bufio.NewScanner(os.Stdin)

func scanString() string {
	sc.Scan()
	return sc.Text()
}
func scanInt() int {
	sc.Scan()
	a, err := strconv.Atoi(sc.Text())
	if err != nil {
		fmt.Println(err)
	}
	return a
}
func scanFloat64() float64 {
	f, _ := strconv.ParseFloat(scanString(), 64)
	return f
}
func Permute(nums []int) [][]int {
	n := factorial(len(nums))
	ret := make([][]int, 0, n)
	permute(nums, &ret)
	return ret
}
func permute(nums []int, ret *[][]int) {
	*ret = append(*ret, makeCopy(nums))

	n := len(nums)
	var i, j int
	for {
		for i = n - 2; i >= 0; i-- {
			if nums[i] < nums[i+1] {
				break
			}
		}
		if i < 0 {
			return
		}
		for j = n - 1; ; j-- {
			if nums[j] > nums[i] {
				break
			}
		}
		nums[i], nums[j] = nums[j], nums[i]
		for k, l := i+1, n-1; k < l; {
			nums[k], nums[l] = nums[l], nums[k]
			k++
			l--
		}
		*ret = append(*ret, makeCopy(nums))
	}
}

func factorial(n int) int {
	ret := 1
	for i := 2; i <= n; i++ {
		ret *= i
	}
	return ret
}
func makeCopy(nums []int) []int {
	return append([]int{}, nums...)
}
func gcd(a int, b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}
func main() {
	sc.Split(bufio.ScanWords)
	solve()
}


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

int main() {
  int n, m;
  cin >> n >> m;
  vector<pair<int, int> > ans;
  if (n%2) {
    for (int l = 1, r = n-1; l < r; l++, r--) {
      ans.push_back(make_pair(l,r));
    }
  } else {
    bool flag = false;
    for (int l = 1, r = n-1; l < r; l++, r--) {
      if (!flag && r-l <= n/2) {
        --r;
        flag = true;
      }
      ans.push_back(make_pair(l,r));
    }
  }
  for(int i = 0; i < m; i++) {
    printf("%d %d\n", ans[i].first, ans[i].second);
  }
  return 0;
}

Measured memory_bytes: 4316
s = input()

if s[0] == s[1] and s[2] == s[3] and s[0] != s[2]:
    print('Yes')
elif s[0] == s[2] and s[1] == s[3] and s[0] != s[1]:
    print('Yes')     
elif s[0] == s[3] and s[1] == s[2] and s[0] != s[1]:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3064
s = input()

if s[0] == s[1]:
    if s[1] == s[2]:
        print('No')
    elif s[2] == s[3]:
        print('Yes')
    else:
        print('No')
else:
    if s[0] == s[2]:
        if s[1] == s[3]:
            print('Yes')
        else:
            print('No')
    elif s[0] == s[3]:
        if s[1] == s[2]:
            print('Yes')
        else:
            print('No')
    else:
        print('No')


Measured memory_bytes: 3064
#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>


using namespace std;
typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;

#define REP(i,n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i,a,b) for(int i = (a); i < (int)(b); ++i)
#define ALL(c) (c).begin(), (c).end()
#define SIZE(v) ((int)v.size())

#define pb push_back
#define mp make_pair
#define mt make_tuple

vector<int> a;

int binary_search(int K){
  int l = 0;
  int r = 1e9+1;
  while(r - l > 1){
    int cnt = 0;
    int mid = (r + l) / 2;
    for(const auto& e: a){
      if(e > mid){cnt += (e-1) / mid;}
    }
    if(cnt <= K){r = mid;}
    if(cnt > K){l = mid;}
  }
  /* left は条件を満たさない最大の値、right は条件を満たす最小の値になっている */
  return r;
}

int main(void)
{
  int N, K;
  cin >> N >> K;
  for(int i=0;i<N;i++){
    int in;
    cin >> in;
    a.push_back(in);
  }
  cout << binary_search(K) << endl;
  return 0;
}


Measured memory_bytes: 4276
def n_gram(seq, n):
    return {seq[i: i+n] for i in range(len(seq) - n + 1)}

def main(s, k):
    tmp = set()
    for i in range(1, 6):
        tmp = tmp | n_gram(s, i)
    substr = sorted(list(tmp))
    print(substr[k-1])

if __name__ == '__main__':
    main(input(), int(input()))

Measured memory_bytes: 4804
import sys
input = sys.stdin.readline

def get_sieve_of_eratosthenes(n):
    if not isinstance(n, int):
        raise TypeError('n is int type.')
    if n < 2:
        raise ValueError('n is more than 2')
    prime = [2]
    limit = int(n**0.5) #ルートn以上で割れることはない
    data = [i + 1 for i in range(2, n, 2)] #最初から3スタートの奇数にしておく
    while True:
        p = data[0]
        if limit < p: #ここでイコールが入るとlimitが素数の時にlimit^2が残ってダメ。
            return prime + data
        prime.append(p) #ここで一番最初に取り出した素数を加える。
        data = [e for e in data if e % p != 0] #残りでその素数で割れない数字を取得。

MAX = pow(10,6)
#L = get_sieve_of_eratosthenes(MAX)

def factorization(n):
    arr = []
    temp = n
    if temp%2 == 0:
      cnt = 0
      while temp%2 == 0:
        cnt += 1
        temp//=2
      arr.append(2)
    for i in range(3, int(-(-n**0.5//1))+1,2):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append(i)
 
    if temp!=1:
        arr.append(temp)
 
    return arr

#XX = factorization(121)
#print(XX)
import math
N = int(input())
A = list(map(int,input().split()))
GCD = math.gcd(A[0],A[1])
for i in range(2,N):
  GCD = math.gcd(GCD,A[i])
  if GCD == 1:
    break
if GCD != 1:
  print("not coprime")
  exit()
A.sort()
SET = set([])
for x in A:
  SL = factorization(x)
  for yakusu in SL:
    if yakusu not in SET:
      SET.add(yakusu)
    else:
      print("setwise coprime")
      exit()
print("pairwise coprime")

Measured memory_bytes: 174516
#include <bits/stdc++.h>
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define rep(i, s, N) for(ll i{s}; i < N; i++)
#define rem(i, N, s) for(ll i{N}; i > s; i--)
using namespace std;using ll = long long int;using ld = long double;using P = pair<ll,ll>;const int MOD = (int)1e9+7;const string rt = "\n";const string sp = " ";/* 最大公約数 */template<typename T> T gcd(T a, T b){return b != 0 ? gcd(b, a % b) : a;}/* UnionFind */template<typename T> struct UnionFind{vector<T> par;UnionFind(T n) : par(n, -1){}void init(T n){par.assign(n, -1);}T root(T x){if (par[x] < 0) return x;else return par[x] = root(par[x]);}bool issame(T x, T y){return root(x) == root(y);}bool merge(T x, T y){x = root(x); y = root(y);if(x == y) return false;if(par[x] > par[y]) swap(x, y);par[x] += par[y];par[y] = x;return true;}int size(int x) {return -par[root(x)];}};/* コンビネーション */template<typename T> ll combpm(T N_, T C_) {const int NUM_=400001;static ll fact[NUM_+1],factr[NUM_+1],inv[NUM_+1];if (fact[0]==0) {inv[1]=fact[0]=factr[0]=1;for (int i=2;i<=NUM_;++i) inv[i] = inv[MOD % i] * (MOD - MOD / i) % MOD;for (int i=1;i<=NUM_;++i) fact[i]=fact[i-1]*i%MOD, factr[i]=factr[i-1]*inv[i]%MOD;}if(C_<0 || C_>N_) return 0;return factr[C_]*fact[N_]%MOD*factr[N_-C_]%MOD;}/* 多次元ベクター */template<class T>vector<T> multi_vector(size_t a){return vector<T>(a);}template<class T, class... Ts>auto multi_vector(size_t a, Ts... ts){return vector<decltype(multi_vector<T>(ts...))>(a, multi_vector<T>(ts...));}/* テスト関数 */void test(ll n){cout << "test" << n << endl;}/* 小数点以下 */void fixsp(ll n){cout << fixed << setprecision(n);}void defsp(ll n){cout << defaultfloat << setprecision(n);}/* 重み付きUnionFind */struct WUnionFind {vector<int> par;vector<int> rank;WUnionFind(int n = 1) {init(n);}void init(int n = 1) {par.resize(n); rank.resize(n);for (int i = 0; i < n; ++i) par[i] = i, rank[i] = 0;}int root(int x) {if (par[x] == x) {return x;}else {int r = root(par[x]);return par[x] = r;}}bool issame(int x, int y) {return root(x) == root(y);}bool merge(int x, int y) {x = root(x); y = root(y);if (x == y) return false;if (rank[x] < rank[y]) swap(x, y);if (rank[x] == rank[y]) ++rank[x];par[y] = x;return true;}};/* IO高速化 */void fastio(){ios::sync_with_stdio(false);cin.tie(NULL);}
/* ここからコード開始 */

int main(){
  fastio;
  ll D;
  cin >> D;
  if(D == 25) cout << "Christmas" << rt;
  if(D == 24) cout << "Christmas Eve" << rt;
  if(D == 23) cout << "Christmas Eve Eve" << rt;
  if(D == 22) cout << "Christmas Eve Eve Eve" << rt;
}

Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <algorithm>
using namespace std;
map<int,int> dp;
int ans;
int main(){
    int n,w;
    cin>>n>>w;
    dp[0]= 0;
    for(int i=1;i<=n;i++){
        int a,b;cin>>a>>b;
        for(auto x=dp.rbegin();x!=dp.rend();x++){
            int nextw = x->first+a;
            int nextval = x->second+b;
            
            if(nextw<=w){
                dp[nextw] = max(dp[nextw],nextval);
                ans=  max(ans,dp[nextw]);
            }
        }
        
    }
    cout<<ans<<endl;
    
    
}

Measured memory_bytes: 384
while True:
    s = input()
    if s == "#": break
    g, y, m, d = s.split()

    if (int(y) == 31 and int(m) > 4) or int(y) > 31:
        print("?", int(y)-30, m, d)
    else:
        print(g, y, m, d)




Measured memory_bytes: 5600
#include<stdio.h>
#include <string.h>
int main(){
	char kata[101];
	int angka;
	scanf("%d", &angka);
	scanf("%s", &kata);
	int panjangKata = strlen(kata);
	
	
	if(panjangKata>angka){
		kata[angka] = '\0';
		for(int i=0; kata[i] != '\0'; i++){
			printf("%c", kata[i]);
		}
		printf("...");
	}
	
	else {
		printf("%s", kata);
	}
	

	return 0 ;
}

Measured memory_bytes: 1728
#include <iostream>
#include<cstdio>
#include <cctype>
using namespace std;

int main(){

    char ch;
    int cnt[26] ={};

    while(cin>>ch){
        ch = tolower(ch);
        if(isalpha(ch)){
            cnt[ch-'a']++;
        }
    }
    for(int i=0;i<26;i++){
        printf("%c : %d\n", i+'a', cnt[i]);
    }
    return 0;
    
}


Measured memory_bytes: 3132
H, W = map(int, input().split())
arr = []
count=0
for j in range(H):
    a=list(input())
    if '#' in a:
        arr.append(a)
    else:
        count=count+1
        pass

#print(arr)
arr=list(map(list, zip(*arr)))
#print(arr)
num=[]
for j in range(W):
#    print(j, arr[j])
    if '#' in arr[j]:
        pass
    else:
        num.append(j)  

#print(num)
num.reverse()
#print(num)

for i in num:
    del arr[i]
arr=list(map(list, zip(*arr)))

for i in range(H-count):
    print("".join(arr[i]))

Measured memory_bytes: 3188
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int a = Integer.parseInt(sc.next());
		int b = Integer.parseInt(sc.next());
		if (a <= b || a <= (b * 2)) {
			System.out.println("0");
		} else {
			System.out.println(a - (b * 2));
		}
		sc.close();
	}
}

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

int digit(int x){
  int y=0;
  while(x>0){
    y++;
    x/=10;
  }
  return y;
}

int main(){
  int n,m;
  cin>>n>>m;
  vector<pair<int,ll>> vec(m);
  vector<pair<int,ll>> vecb(m);
  for(int i=0;i<m;i++){
    int j;
    ll k;
    cin>>j>>k;
    vec[i]=make_pair(j,k);
    vecb[i]=vec[i];
  }
  sort(vecb.begin(),vecb.end());
  map<pair<int,ll>,int> ma;
  for(int i=0;i<m;i++){
    if(i==0){
      ma[vecb[i]]=1;
    }
    else{
      if(vecb[i].first==vecb[i-1].first){
        ma[vecb[i]]=ma[vecb[i-1]]+1;
      }
      else{
        ma[vecb[i]]=1;
      }
    }
  }
  for(int i=0;i<m;i++){
    for(int j=0;j<6-digit(vec[i].first);j++){
      cout<<0;
    }
    cout<<vec[i].first;
    for(int j=0;j<6-digit(ma[vec[i]]);j++){
      cout<<0;
    }
    cout<<ma[vec[i]]<<endl;
  }
}

Measured memory_bytes: 10880
#include<bits/stdc++.h>
#define rep(i,n) for(int (i) = 0;(i) < (n);(i)++)
using namespace std;
typedef long long ll;
// cd test ; rm -R ./*; cd ..


int main(void) {
  int n;
  cin >> n;
  
  map<string, int> mp;

  int ans = 0;

  rep (i, n) {
    string s;
    cin >> s;

    int sz = s.size();
    
    if (s[0] == 'B') {
      if (s[sz - 1] == 'A') mp["BA"]++;
      else mp["BX"]++;
    }
    if (s[sz - 1] == 'A' && s[0] != 'B') mp["XA"]++;

    rep (i, s.size() - 1) {
      if (s[i] == 'A' && s[i + 1] == 'B' ) ans++;
    }

  }
  
  if (mp["XA"] == 0 && mp["BX"] == 0 && mp["BA"] != 0) {
    ans += mp["BA"] - 1;
  }
  else {
    ans += mp["BA"] + min(mp["XA"], mp["BX"]);
  }

  cout << ans << endl;
  
  return 0;
}

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

int main(){
  char b;
  cin >> b;
  
  if(b=='A') cout << 'T' << endl;
  if(b=='C') cout << 'G' << endl;
  if(b=='G') cout << 'C' << endl;
  if(b=='T') cout << 'A' << endl;
  
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

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


Measured memory_bytes: 26360
#include <bits/stdc++.h>
#define REP(i, e) for(int (i) = 0; (i) < (e); ++(i))
#define FOR(i, b, e) for(int (i) = (b); (i) < (e); ++(i))
#define ALL(c) (c).begin(), (c).end()
#define PRINT(x) cout << (x) << "\n"
using namespace std;
using ll = long long; using pint = pair<int, int>; using pll = pair<ll, ll>;
const long long MOD = 1000000007;

class UnionFind{
    public:
        UnionFind(int N) : parent(N), rank(N), set_size(N){
            for(int i = 0; i < N; i++){
                parent[i] = i;
                rank[i] = 1;
                set_size[i] = 1;
            }
            set_num = N;
        }

        int find(int x){
            if(parent[x] == x){
                return x;
            }
            return parent[x] = find(parent[x]);
        }

        bool merge(int m, int n){
            int x = find(m);
            int y = find(n);
            if(x == y){
                return false;
            }
            if(rank[x] < rank[y]){
                parent[x] = y;
            }else if(rank[x] > rank[y]){
                parent[y] = x;
            }else{
                parent[y] = x;
                rank[x]++;
            }
            int s = set_size[x] + set_size[y];
            set_size[x] = set_size[y] = s;
            set_num--;
            return true;
        }

        bool equivalent(int x, int y){
            return find(x) == find(y);
        }

        int size(int x){
            return set_size[find(x)];
        }

        int count(){
            return set_num;
        }

    private:
        vector<int> parent;
        vector<int> rank;
        vector<int> set_size;
        int set_num;
};


signed main(){
    ll N, M;
    cin >> N >> M;
    UnionFind uf(N);
    ll A, B;
    REP(i, M){
        cin >> A >> B;
        A--; B--;
        uf.merge(A, B);
    }
    ll ans = 0;
    REP(i, N){
        ans = max(ans, (ll)uf.size(i));
    }
    PRINT(ans);
    return 0;
}

Measured memory_bytes: 5632
#include<bits/stdc++.h>
#define IOS   ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define Test IOS long long t;cin >> t;while(t--)
using namespace std;
typedef long long v99;
int main()
{
    int a,b;cin>>a>>b;
    cout<<a*b<<endl;
    return 0;
}


Measured memory_bytes: 3624
#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);
	int a;
	cin>>a;
	int b=a*a;
	int c=b*a;
	cout<<a+b+c;
	return 0;
	
	
}

Measured memory_bytes: 3608
import java.util.*;
 
public class Main{
	public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long dp[][] = new long[100100][3];
        int a[][] = new int[n][3];
        
        for(int i=0; i<n; i++){
            for(int j=0; j<3; j++){
                a[i][j] = sc.nextInt();
            }
        }

        for(int i=1; i<=n; i++){
            for(int j=0; j<3; j++){
                for(int k=0; k<3; k++){
                    if(k==j) continue;
                    dp[i][k] = Math.max(dp[i][k], dp[i-1][j]+a[i-1][k]);
                }
            }
        }
        long ans = 0;
        for(int j=0; j<3; j++){
            ans = Math.max(dp[n][j], ans);
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 103104
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}
 
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};
 
    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}
 
macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
 
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
 
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
 
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
 
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main(){
  input!{
    s: chars
  };
  
  if s[0]=='7' || s[1]=='7' || s[2]=='7' {
    println!("Yes");
  }else{
    println!("No");
  }
}


Measured memory_bytes: 2128
#include<iostream>
#define int long long

using namespace std;

int32_t main (){
  
int n,d;
int count=0;
cin>>n>>d;
int x,y;
while(n--)
{cin>>x>>y;
if ((x*x+y*y)<=d*d)
{count++;}
}

cout<<count<<endl;

return 0;
}
  



Measured memory_bytes: 3648
#include<cstdio>
#include<cstdlib>
#include<vector>


using namespace std;
using vi=vector<int>;

#define F_SIZE 100


void calc(vi&x, vi&y, vi&h, int&cx, int&cy, int&ch)
{
	int n=x.size();
	int b=0;
	int h_max=-1;

	for(int i=0;i<n;i++)
	{
		if(h[i]>0) b=i;
		if(h_max<h[i]) h_max=h[i];
	}

	for(cx=0;cx<=F_SIZE;cx++)
	{
		for(cy=0;cy<=F_SIZE;cy++)
		{
			int is_ok=1;

			ch=h[b]+abs(cx-x[b])+abs(cy-y[b]);
			if(ch<h_max) continue;
			for(int i=0;i<n;i++)
			{
				if(max(ch-abs(cx-x[i])-abs(cy-y[i]), 0)!=h[i]) is_ok=0;
			}
			if(is_ok) return;
		}
	}
}


int main(void)
{
	int n;

	while(scanf("%d", &n)==1)
	{
		vi x(n), y(n), h(n);

		for(int i=0;i<n;i++)
		{
			scanf("%d%d%d", &x[i], &y[i], &h[i]);
		}

		int cx=-1, cy=-1, ch=-1;
		calc(x, y, h, cx, cy, ch);

		printf("%d %d %d\n", cx, cy, ch);
	}

	return 0;
}


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

using namespace std;

int ct(int x, int n, int s)
{
	if (x == 10){
		return (s == 0 && n == 0);
	}
	
	return (ct(x + 1, n - 1, s - x) + ct(x + 1, n, s));
}

int main()
{
	int n, s;
	
	while (scanf("%d %d", &n, &s) && n){
		printf("%d\n", ct(0, n, s));
	}
	
	return (0);
}

Measured memory_bytes: 1188
N, X, M = map(int, input().split())

R = [-1] * M
R[X % M] = 0
A = [0] + [X % M]
a = X
for i in range(1, N):
  a **= 2
  a %= M
  if R[a] == -1:
    R[a] = i
    A += [A[-1] + a]
  else:
    print(X - X % M + (A[-1] - A[R[a]]) * ((N - R[a]) // (i - R[a])) + A[R[a] + (N - R[a]) % (i - R[a])])
    exit()
print(A[-1] + X - X % M)

Measured memory_bytes: 70096
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;

public static class P
{
    public static void Main()
    {
        var abcd = Console.ReadLine().Split().Select(int.Parse).ToArray();
        var sum = abcd.Sum();
        var min = int.MaxValue;
        for (int i = 0; i < abcd.Length; i++)
        {
            for (int j = i + 1; j < abcd.Length; j++)
            {
                var a = abcd[i] + abcd[j];
                var b = sum - a;
                min = Min(min, Abs(a - b));
            }
        }
        Console.WriteLine(min);
    }
}



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

int main(){
  int H1,W1,H2,W2,K;
  cin >> H1 >> W1 >> H2 >> W2 >> K;
  cout << (H2 - H1) * 60 + W2 - W1 - K; 
  return 0;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll a[100001];
int n,k;
ll dp[100001];
ll cal(int i)
{
    if(i==n)
    return 0;
    if(i>n)
    return 1000000;
    if(dp[i]!=-1)
    return dp[i];
    ll ans=INFINITY;
    for(int j=i+1;j<=i+k;j++)
    {
        ans=min(ans,cal(j)+abs(a[i]-a[j]));
    }
    dp[i]=ans;
    return ans;
}
int main()
{
    cin>>n>>k;
    for(int i=1;i<=n;i++)
    cin>>a[i];
    memset(dp,-1,sizeof(dp));
    ll ans=cal(1);
    cout<<ans;
}



Measured memory_bytes: 6528
import sys
input = sys.stdin.readline


def warshall_floid(graph: list) -> list:
    """warshall-floid法: 各頂点から各頂点への最短距離を求める
    計算量: O(V^3)
    """
    n = len(graph)
    INF = 10 ** 18
    dp = [[INF] * n for i in range(n)]
    for i in range(n):
        dp[i][i] = 0
    for i in range(n):
        for j, cost in graph[i]:
            dp[i][j] = cost

    for k in range(n):
        for i in range(n):
            for j in range(n):
                dp[i][j] = min(dp[i][j], dp[i][k] + dp[k][j])
    return dp
  

v, e = map(int, input().split())
info = [list(map(int, input().split())) for i in range(e)]
INF = 10 ** 18

graph = [[] for i in range(v)]
for a, b, cost in info:
    graph[a].append((b, cost))

dp = warshall_floid(graph)

is_negative = False
for i in range(v):
    if dp[i][i] < 0:
        is_negative = True

if is_negative:
    print("NEGATIVE CYCLE")
else:
    for res in dp:
        print(*[num if num < 10**12 else "INF" for num in res])


Measured memory_bytes: 8404
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <cmath>
#include <tuple>
using namespace std;
#define fio ios::sync_with_stdio(0),cin.tie(0);
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

int N,M,K;
int a,b,c;
int inp[300005];
int main(){
	int cnt=0;
	scanf("%d %d %d",&a,&b,&K);
	for(int i=100;i>=1;i--){
		if(a%i==0 && b%i==0){
			cnt++;
		}
		if(cnt==K) return !printf("%d",i);
	}


}

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

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define IN(a, b, x) (a<=x&&x<b)
#define MP make_pair
#define PB push_back
const int INF = (1LL<<30);
const ll LLINF = (1LL<<60);
const double PI = 3.14159265359;
const double EPS = 1e-12;
const int MOD = 1000000007;
#define int ll

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }

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

unordered_map<int, int> cnt;
signed main(void)
{
  int n;
  cin >> n;
  int ma1 = 0, ma2 = 0;
  REP(i, n) {
    int a;
    cin >> a;
    cnt[a]++;
    if(cnt[a] == 2 || cnt[a] == 4) {
      if(ma1 < a) {
        ma2 = ma1;
        ma1 = a;
      } else if(ma2 < a) {
        ma2 = a;
      }
    }
  }

  cout << ma1 * ma2 << endl;

  return 0;
}


Measured memory_bytes: 4388