akhauriyash/Code-Regression huggingface dataset:
#define _USE_MATH_DEFINES
#include <vector>
#include <string>
#include <iostream>
#include <fstream>
#include <list>
#include <algorithm>
#include <sstream>
#include <set>
#include <math.h>
#include <cmath>
#include <map>
#include <stack>
#include <queue>
#include <stdio.h>
#include <string.h>
#include <numeric>
 
using namespace std;

typedef long long ll;

int a,b,c;
 
int main(){
 
cin>>a>>b>>c;

if(a==b&&b==c) cout<<1<<endl;

else if(a==b&&b!=c) cout<<2<<endl;
else if(b==c&&c!=a) cout<<2<<endl;
else if(a==c&&c!=b) cout<<2<<endl;

else cout<<3<<endl;


return 0;
 
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <limits.h>
#include <vector>
#include <numeric>

using namespace std;



bool gooddis(long long int n) {

	long long int a = 0;

	while (n >= a * a) {
		if (n == a * a)return true;
		a++;
	}

	return false;
}



vector<pair<long long int, long long int>> getPrimeElements(long long int num) {

	long long int firstnum = num;

	vector<pair<long long int, long long int>> result;
	pair<long long int, long long int> wk;

	if (num % 2 == 0) {
		wk.first = 2;
		wk.second = 0;
		while (num % 2 == 0) {
			wk.second++;
			num /= 2;
		}

		result.push_back(wk);
	}

	long long int waru = 3;

	while (true) {

		if (num % waru == 0) {
			wk.first = waru;
			wk.second = 0;
			while (num % waru == 0) {
				wk.second++;
				num /= waru;
			}

			result.push_back(wk);
		}
		waru += 2;

		if (waru * waru > num) break;

	}

	if (num != 1) {
		wk.first = num;
		wk.second = 1;
		result.push_back(wk);

	}

	return result;



}


int main()
{
    

	vector<pair<long long int, long long int>> a;

	long long int n, p;
	cin >> n >> p;

	a = getPrimeElements(p);

	long long int ans = 1;

	for (int i = 0; i < a.size(); i++) {
		long long int kosuu;
		kosuu = a[i].second / n;

		for (int j = 0; j < kosuu; j++)ans *= a[i].first;
	}

	cout << ans << endl;


	

	return 0;

}




Measured memory_bytes: 256
#include <iostream>
#define MAX 10001
using namespace std;
int main (void)
{
	int h, times;
	cin >> h >> times;
	int current_health = 0;
	while(times != 0){
		int a;
		cin >> a;
		current_health += a;
		times--;
	}
	if(current_health >= h)
		cout << "Yes" << endl;
	else 
		cout << "No" << endl;
	return 0;
}


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

using namespace std;

int main(){
  int n,x,k;
  cin >> n >> k;
  vector<int> v;
  for(int i=0;i<n;i++){
    cin >> x;
    v.push_back(x);
  }
  vector<bool> dp(k+1,false);
  for(int i=1;i<=k;i++){
    for(int j=0;j<v.size();j++){
      if(v[j]>i) break;
      if(dp[i-v[j]] == false) {
        dp[i] = true;
        break;
      }
    }
  }
  if(dp[k] == false) cout << "Second" << endl;
  else cout << "First" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
using namespace std;
vector<string> tmp;
int ans,cnt,n;
string s;
string rec(string x){
  while(1){
    //cout << x << endl;
    bool flag=false;
    sort(x.begin(),x.end());
    string a = x;
    if(a.empty()==1) while(a.front()!='0') a.erase(a.begin());
    int mn = atoi(a.c_str());
    reverse(x.begin(),x.end());
    int mx = atoi(x.c_str());
    x = to_string(mx-mn);
    if(x.size()!=n) x = '0'+x;
    //cout << mx << " " <<  mx << " " << x << endl;
    for(int i=0; i<tmp.size(); i++){
      //cout << tmp[i] << " ";
      if(x == tmp[i]){
        ans = i;
        flag = true;
	      break;
      }
    }
    tmp.push_back(x);
    cnt++;
    if(flag == false) return rec(x);
    else return x;
    }
  return 0;
}
int main(){
  while(1){
    cin >> s >> n;
    if(s == "0" && n == 0) break;
    cnt = 0;
    ans = 0;
    while(s.size() != n) s = '0'+s;
    tmp.push_back(s);
    s = rec(s);
    cout << ans << " "<< atoi(s.c_str()) << " " << cnt-ans << endl;
    tmp.clear();
  }
  return 0;
}



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

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

string BASE = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";

void solve(int n) {
    vector<int> k(n);
    rep(i,n) cin>>k[i];
    string s; cin>>s;

    string ans = "";
    rep(i,s.size()) {
        int p;
        if('a' <= s[i] and s[i] <= 'z')
            p = s[i] - 'a';
        else
            p = s[i] - 'A' + 26;

        ans += BASE[(p - k[i%n] + 52) % 52];
    }
    cout << ans << "\n";
}

int main() {
    for(int n; cin>>n && n; ) solve(n);
    return 0;
}

Measured memory_bytes: 3088
#include <bits/stdc++.h>
using namespace std;
struct edge {
    int to;     // 辺の行き先
    int weight; // 辺の重み
    edge(int t, int w) : to(t), weight(w) { }
};
using Graph = vector<vector<int>>;
using dou =long double;
string yes="yes";
string Yes="Yes";
string YES="YES";
string no="no";
string No="No";
string NO="NO";

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; }
#define rep(i, n)         for(int i = 0; i < (int)(n); i++)
#define brep(n)           for(int bit=0;bit<(1<<n);bit++)
#define erep(i,container) for (auto i : container)
#define irep(i, n)        for(int i = n-1; i >= (int)0; i--)
#define rrep(i,m,n) for(ll i = m; i < (ll)(n); i++)
#define reprep(i,j,h,w) rep(i,h)rep(j,w)
#define all(x) (x).begin(),(x).end()
#define VEC(type,name,n) std::vector<type> name(n);rep(i,n)std::cin >> name[i];
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define itn int
#define mp make_pair
#define sum(a) accumulate(all(a),0ll)
#define keta fixed<<setprecision
#define vvector(name,typ,m,n,a)vector<vector<typ> > name(m,vector<typ> (n,a))
#define vvvector(name,t,l,m,n,a) vector<vector<vector<t> > > name(l, vector<vector<t> >(m, vector<t>(n,a)));
#define vvvvector(name,t,k,l,m,n,a) vector<vector<vector<vector<t> > > > name(k,vector<vector<vector<t> > >(l, vector<vector<t> >(m, vector<t>(n,a)) ));
#define case std::cout << "Case #" <<qqq+1<<": "
#define res resize
#define as assign
#define ffor for(;;)
#define ppri(a,b) std::cout << a<<" "<<b << std::endl
#define pppri(a,b,c) std::cout << a<<" "<<b <<" "<< c<<std::endl
#define aall(x,n) (x).begin(),(x).begin()+(n)
 
typedef long long ll;
typedef pair<int,int> P;
//typedef long long T;
const int INF = 2000000000;
const ll INF64 = 922337203685477580ll;
const ll MOD = 1000000007ll;
const dou pi=3.141592653589793;
int main(){
    int n,m;
    std::cin >> n>>m;
    VEC(int,a,m);
    rep(i,m){
        n-=a[i];
    }
    std::cout << max(n,-1) << std::endl;
}

Measured memory_bytes: 3640
#include <stdio.h>
int main()
{
  int dice[2][6];
  int vector[3][4]={{0,2,5,3},{0,1,5,4},{1,2,4,3}};
  int i,j,k,l,m,c;
  for(i=0;i<2;i++)
  {
    for(j=0;j<6;j++)
    {
      scanf("%d",&dice[i][j]);
    }
  }
  for(i=0;i<2;i++)
  {
    for(j=0;j<4;j++)
    {
      int temp = dice[1][vector[i][0]];
      for(k=0;k<3;k++)
      {
	dice[1][vector[i][k]] = dice[1][vector[i][k+1]];
      }
      dice[1][vector[i][3]] = temp;
      c = 0;
      for(k=0;k<6;k++)
      {
	if(dice[0][k]==dice[1][k])c++;
      }
      if(c==6)break;
      for(m=0;m<3;m++){
	for(k=0;k<4;k++)
	{
	  int temp = dice[1][vector[m][0]];
	  for(l=0;l<3;l++)
	  {
	    dice[1][vector[m][l]] = dice[1][vector[m][l+1]];
	  }
	  dice[1][vector[m][3]] = temp;
	  c=0;
	  for(l=0;l<6;l++)
	  {
	    if(dice[0][l]==dice[1][l])c++;
	  }
	  if(c==6)break;
	}
	if(c==6)break;
      }
      if(c==6)break;
    }
    if(c==6)break;
  }
  if(c==6)printf("Yes\n");
  else printf("No\n");
  return 0;
}

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

/* → → → → → → → → → → → → → → → → → → → → → → → → → → → →
	→ → → → → → → → → → → → → → → → → → → → → → → → → → → → */

#define int long long int
#define ld long double
#define F first
#define S second
#define P pair<int,int>
#define pb push_back
#define endl '\n'

/* → → → → → → → → → → → → → → → → → → → → → → → → → → → →
	→ → → → → → → → → → → → → → → → → → → → → → → → → → → → */

void solve() {
	int a; cin >> a;
	cout << a + (a * a) + (a * a * a) << endl;
	return ;
}

int32_t main() {

	/* → → → → → → → → → → → → → → → → → → → → → → → → → → → →
	→ → → → → → → → → → → → → → → → → → → → → → → → → → → → */

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


	/* → → → → → → → → → → → → → → → → → → → → → → → → → → → →
	→ → → → → → → → → → → → → → → → → → → → → → → → → → → → */

	//int t;cin>>t;while(t--)
	solve();

	return 0;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#define fr(i,b,e) for(int i=(b); i<(e); ++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long int li;
typedef long long ll;

int chk(vector<int> a){
    int n=a.size();
    fr(i,0,n){
        cout << a.at(i);
    }
    cout << endl;
}

int gcd(int a,int b){ //a>b
    int tmp=a%b;
    a=b;
    b=tmp;
    if(b!=0){
        return gcd(a,b);
    }else{
        return a;
    }
}

ll power(ll a,ll n){
    if(n==1){
        return a;
    }
    else if(n&1==1){
        --n;
        return power(a,n)*a;
    }else{
        n=n>>1;
        return power(a,n)*power(a,n);
    }
}

int main(void){
    int n,k;
    cin >> n >> k ;
    string s;
    cin >> s;
    if(s.at(k-1)=='A'){
        s.at(k-1)='a';
    }else if(s.at(k-1)=='B'){
        s.at(k-1)='b';
    }else{
        s.at(k-1)='c';
    }
    cout << s << endl;
}


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

#define rep(i, n) for (int i = 0; i < (n); i++)
#define contains(v, t) (find(v.begin(), v.end(), t) != v.end())
#define MOD 1000000007
using ll = long long;
using ull = unsigned long long;

int main() {
  int h,w;
  cin>>h>>w;
  vector<vector<string>> v(h, vector<string>(w));
  vector<int> skipr(h, true), skipc(w, true);
  rep(i, h) {
    string s;
    cin>>s;
    rep(j, w) {
      v[i][j] = s[j];
      if (v[i][j] == "#") {
        skipr[i] = false;
        skipc[j] = false;
      }
    }
  }
  rep(i, h) {
    if (!skipr[i]) {
      rep(j, w) {
        if (!skipc[j]) {
          cout << v[i][j];
        }
      }
      cout << endl;
    }
  }
}


Measured memory_bytes: 768
#include<iostream>
#include<string>
#include<algorithm>    
#include<cmath>
#include<map>
#include<vector>
#include<math.h>
#include<stdio.h>
#include<stack>
#include<queue>
#include<tuple>
#include<cassert>
#include<set>
//#include<bits/stdc++.h>
#define int long long
using namespace std;
const int INF = 1000000000000000000;
const int mod = 1000000007;
int R[34567890], G[34567890], B[34567890];
signed main() {
	int n, r = 0, g = 0, b = 0, cnt = 0; string s; cin >> n >> s;
	for (int h = 0; h < n; h++) {
		if (s[h] == 'R') { R[r] = h; r++; }
		if (s[h] == 'G') { G[g] = h; g++; }
		if (s[h] == 'B') { B[h] = 1; b++; }
	}
	for (int h = 0; h < r; h++) {
		for (int i = 0; i < g; i++) {
			int ng = 0;
			if (R[h] < G[i]) {
				if (B[G[i] + abs(R[h] - G[i])] == 1) { ng++; }
				if (R[h] - abs(R[h] - G[i]) >= 0 && B[R[h] - abs(R[h] - G[i])] == 1) { ng++; }
				if ((R[h] + G[i]) % 2 == 0 && B[(R[h] + G[i]) / 2] == 1) { ng++; }
			}
			else {
				if (B[R[h] + abs(R[h] - G[i])] == 1) { ng++; }
				if (G[i] - abs(R[h] - G[i]) >= 0 && B[G[i] - abs(R[h] - G[i])] == 1) { ng++; }
				if ((R[h] + G[i]) % 2 == 0 && B[(R[h] + G[i]) / 2] == 1) { ng++; }
			}
			//cout << R[h] << ' ' << G[i] << ' ' << ng << endl;
			cnt += b - ng;
		}
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 3692
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AOJ
{
	class Program
	{
		static void Main(string[] args)
		{
			while (true)
			{
				var n = int.Parse(Console.ReadLine());
				if (n == 0) break;
				var m = int.Parse(Console.ReadLine()) - 1;
				var g = int.Parse(Console.ReadLine()) - 1;
				var d = int.Parse(Console.ReadLine());

				char[][] s = new char[d][];
				for (int i = 0; i < d; i++)
				{
					s[i] = Console.ReadLine().ToCharArray();
				}
				if (f(s, n, d, m) == g)
				{
					Console.WriteLine(0);
					continue;
				}

				bool flg = false;
				for (int i = 0; i < d; i++)
				{
					for (int j = 0; j < n - 1; j++)
					{
						if (flg || s[i][j] == '1')
							continue;

						if ((j == 0 || s[i][j - 1] == '0') && (j == n - 2 || s[i][j + 1] == '0'))
						{
							s[i][j] = '1';
							if (f(s, n, d, m) == g)
							{
								Console.WriteLine("{0} {1}", (i + 1), (j + 1));
								flg = true;
								break;
							}
							s[i][j] = '0';
						}
					}
				}
				if (!flg)
					Console.WriteLine("1");
			}
		}

		static int f(char[][] s, int n, int d, int start)
		{
			int r = start;
			for (int i = 0; i < d; i++)
			{
				if (r > 0 && s[i][r - 1] == '1')
					r--;
				else if (r < n - 1 && s[i][r] == '1')
					r++;
			}
			return r;
		}
	}
}

Measured memory_bytes: 5616
#include <bits/stdc++.h>
using namespace std;
 
int main(int argc , char* argv[]){
	int n , x ; cin >> n >> x;
	vector<int> l(n+2);
	vector<int> d(n+2);
	for(int i=1;i<=n+1;++i) cin >>l[i];
	l[0]=0;d[0]=0;
	for(int i=1;i<=n+1;++i){
		d[i]=d[i-1]+l[i-1];
	}
	int counter=0;
	for(int i=1;i<=n+1;++i){
		if(d[i]<=x) ++counter;
	}
	cout << counter << endl;
} 

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fr(i,a,b) for(register int i = a;i <= b;++i)
#define inf 0x3f3f3f3f
#define N 100010
#define M 200010
using namespace std;

struct edge{
	int to,nxt,w;
}e[M << 2];
int h[N],dis[N],vis[N];
int tot,n,m;

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

inline void add(int x,int y,int z){
	e[++tot] = (edge){y,h[x],z};
	h[x] = tot;
}

inline int spfa(int s){
	queue<int>q;
	q.push(s);vis[s] = 1;dis[s] = 0;
	while(q.size()){
		int x = q.front();q.pop();
		for(register int i = h[x];i;i = e[i].nxt){
			int p = e[i].to;
			if(dis[p] == inf){
				dis[p] = dis[x] + e[i].w;
				if(!vis[p])vis[p] = 1,q.push(p);
			}
			else if(dis[p] != dis[x] + e[i].w)return 0;
		}
	}
	return 1;
}

int main(){
	n = read();m = read();
	if(!m){printf("Yes");return 0;}
	fr(i,1,m){
		int x = read(),y = read(),z = read();
		add(x,y,z);add(y,x,-z);
	}
	memset(dis,inf,sizeof(dis));
	memset(vis,0,sizeof(vis));
	fr(i,1,n)
		if(!vis[i]){
			int x = spfa(i);
			if(!x){printf("No");return 0;}
		}
	printf("Yes");
	return 0;
}

Measured memory_bytes: 6784
#include <iostream>
#include <math.h>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <iomanip>
#include <string.h>

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

typedef long long lint;

using namespace std;

int gcd(int x, int y)
{
    int r;
    while((r = x % y) != 0)
    {
        x = y;
        y = r;
    }
    return y;
}

int main(){
  int N,X;
  cin>>N>>X;
  int x[N];
  REP(i,N){
    cin>>x[i];
    x[i]-=X;
  };
  int D=0;
  FOR(i,0,N){
    if(x[i]==0)continue;
    if(D==0)D=x[i];
    D=gcd(D,x[i]);
  }
  D=int(abs(D));
  cout<<D<<endl;
  return 0;
}


Measured memory_bytes: 640
import java.util.*;
// warm-up
public class Main {

	static boolean isPalindrome (String s) {
		int i=0, j=s.length()-1;
		boolean ok = true;
		while (i<j) {
			if (s.charAt(i++)!=s.charAt(j--)) {
				ok=false; break;
			}
		}
		return ok;
	}

	static void solve() {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt(), B = sc.nextInt(), t = 0;
		while (A<=B) if (isPalindrome(""+A++)) t++;
		System.out.println(t);
		sc.close();		
	}

	public static void main(String args[]) {
		solve();
	}

}

Measured memory_bytes: 43684
#include<cmath>
#include<stdio.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<functional>
#define INF 1e16
#define N (1000000000+7)
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,P> Q;

ll npow(ll x,ll power) {
	ll res = 1;
	ll k = power;
	ll y = x;
	while (k) {
		if (k & 1)res = (res*y);
		y = (y*y);
		k /= 2;
	}
	return res;
}

int main(void){
    int n;
    cin>>n;
    vector<ll>a(n+1);
    for(ll i=0;i<=n;i++)cin>>a[i];
    if(n==0){
        if(a[0]==1)cout<<1<<endl;
        else cout<<-1<<endl;
        return 0;
    }
    ll uncon = 0;
    ll p = 1;
    ll d = 1;
    ll ans = 0;
    vector<ll>l(n+1),r(n+1);
    l[n]=a[n],r[n]=a[n];
    for(ll i=n-1;i>=0;i--){
        if(i==0){
            l[i]=(l[i+1]+1)/2+a[i];
            r[i]=r[i+1]+a[i];
            if(1<l[i]){
                cout<<-1<<endl;
                return 0;
            }
        }
        else{
            ll num = (l[i+1]+1)/2;
            l[i]=num+a[i];
            r[i]=a[i]+r[i+1];
        }
    }
    ans = 1;
    ll abv = 1;
    for(ll i=1;i<=n;i++){
        ll now = min(2*abv,r[i]);
        ans+=now;
        abv = now-a[i]; 
    }
    cout<<ans<<endl;
    return 0;
}

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

int main(){
	int n, in, ans = 0;
	cin >> n;
	int sn10 = 0, sn10_min = 1001;
	rep(i, n){
		cin >> in;
		if(in % 10 == 0) ans += in;
		else{
			sn10 += in;
			sn10_min = min(sn10_min, in);
		}
	}
	if(sn10 == 0){
		cout << 0 << endl;
	}else{
		if(sn10 % 10 != 0){
			cout << ans + sn10 << endl;
		}else{
			cout << ans + sn10 - sn10_min << endl;
		}
	}
	
	cout << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fast ios::sync_with_stdio(0); cin.tie(0);
#define endl '\n'
#define MOD 1000000007
#define pb push_back
#define int long long int

using namespace std;

int32_t main(void) {
    fast;
    int n; cin>>n;
    double sum=0, x;
    while(n--) {
        cin>>x;
        sum += 1/x;
    }
    cout<<1/sum;
}



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

int main(void){
    int n;
    cin>>n;
    int x[n],y[n];
    for(int i=0;i<n;i++) cin>>x[i]>>y[i];

    map<pair<int,int>,int> mp;

    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            if(i==j) continue;
            int dx,dy;
            dx = x[j] - x[i];
            dy = y[j] - y[i];
            mp[make_pair(dx,dy)] ++;
        }
    }
    int ans=n;
    for(auto kv: mp){
        ans = min(ans, n - kv.second);
    }
    cout<<ans<<endl;

}

Measured memory_bytes: 384
import java.util.Scanner;
public class Main{
  public static void main(String[] args){
    Scanner s = new Scanner(System.in);
    int a = s.nextInt();
    int b = s.nextInt();

    int c = a+a;
    int d = a+b;
    int e = b+b;

    int[] f ={c,d,e};
    int max = f[0];
    for(int i = 0;i < f.length; i++){
      max = Math.max(max,f[i]);
    }
    if(c == d && c == e){
    System.out.println(max);
  }else{
    System.out.println(max -1);
  }
  }
}


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

int main(){
	string s;
  	cin>>s;
  	int n=0;
	for(int i=0;i<s.size();++i)n+=(int)(s[i]-'0');
  	int N=stoi(s);
  	if(N%n==0)cout<<"Yes"<<endl;
  	else cout<<"No"<<endl;
  	return 0;
}


Measured memory_bytes: 256
package main

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

func configure(scanner *bufio.Scanner) {
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 1000005), 1000005)
}
func getNextString(scanner *bufio.Scanner) string {
	scanned := scanner.Scan()
	if !scanned {
		panic("scan failed")
	}
	return scanner.Text()
}
func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}
func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}
func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}
func main() {
	fp := os.Stdin
	wfp := os.Stdout
	
	scanner := bufio.NewScanner(fp)
	configure(scanner)
	writer := bufio.NewWriter(wfp)
	defer func() {
		r := recover()
		if r != nil {
			fmt.Fprintln(writer, r)
		}
		writer.Flush()
	}()
	solve(scanner, writer)
}
func solve(scanner *bufio.Scanner, writer *bufio.Writer) {
	a := getNextInt(scanner)
	fmt.Fprintln(writer, a + a*a + a*a*a)
}


Measured memory_bytes: 1820
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;

public class Main {
	private static final int MOD = 1000000007;

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] V = new int[N];
		int[] C = new int[N];
		sc.fill(V);
		sc.fill(C);

		long sum = 0;
		for (int i = 0; i < N; i++) {
			int diff = V[i] - C[i];
			if (diff > 0) {
				sum += diff;
			}
		}

		System.out.println(sum);
	}

	private static boolean isDebug = System.getProperty("sun.desktop") != null;

	private static void debug(Object... o) {
		if (isDebug) {
			System.err.println(Arrays.deepToString(o));
		}
	}

	public static class Scanner {
		private BufferedInputStream inputStream;

		public Scanner(InputStream in) {
			inputStream = new BufferedInputStream(in);
		}

		public char nextChar() throws IOException {
			return (char) skip();
		}

		public int nextInt() throws IOException {
			int num = 0;

			int read = skip();
			do {
				num = num * 10 + (read - 0x30);
			} while ((read = inputStream.read()) > 0x20);

			return num;
		}

		public void fill(int[] a) throws IOException {
			for (int i = 0; i < a.length; i++) {
				a[i] = nextInt();
			}
		}

		public void fill(int[] a, int[] b) throws IOException {
			if (a.length != b.length) {
				throw new IllegalArgumentException();
			}

			for (int i = 0; i < a.length; i++) {
				a[i] = nextInt();
				b[i] = nextInt();
			}
		}

		public long nextLong() throws IOException {
			long num = 0;

			int read = skip();
			do {
				num = num * 10 + (read - 0x30);
			} while ((read = inputStream.read()) > 0x20);

			return num;
		}

		public void fill(long[] a) throws IOException {
			for (int i = 0; i < a.length; i++) {
				a[i] = nextLong();
			}
		}

		public void fill(long[] a, long[] b) throws IOException {
			if (a.length != b.length) {
				throw new IllegalArgumentException();
			}

			for (int i = 0; i < a.length; i++) {
				a[i] = nextLong();
				b[i] = nextLong();
			}
		}

		public long[] nextLong(int n) throws IOException {
			long[] array = new long[n];
			for (int i = 0; i < n; i++) {
				array[i] = nextLong();
			}

			return array;
		}

		public String next() throws IOException {
			StringBuilder builder = new StringBuilder();

			int read = skip();
			do {
				builder.append((char) read);
			} while ((read = inputStream.read()) > 0x20);

			return builder.toString();
		}

		private int skip() throws IOException {
			int read;
			while ((read = inputStream.read()) <= 0x20)
				;

			return read;
		}
	}
}

Measured memory_bytes: 22484
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <cstdio>
#include <cstring>
using namespace std;

int main()
{
    cin.tie(0);

    int n;
    cin >> n;
    vector<int64_t> as(n);
    for (auto &a: as) {
        cin >> a;
    }

    vector<pair<int64_t, int64_t>> ord;
    for (int i = 0; i < n; i++) {
        ord.emplace_back(as[i], i);
    }

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

    set<int64_t> ss;
    ss.insert(-1);
    ss.insert(n);

    int64_t ans = 0;

    for (auto &p: ord) {
        auto it = ss.lower_bound(p.second);
        auto up = *it;
        auto lo = *--it;
        auto m = p.second;

        // cout << p.first << ": " << up << ", " << lo << ", " << d * (d + 1) / 2 << endl;

        ans += p.first * (m - lo) * (up - m);

        ss.insert(p.second);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 14316
#include <iostream>

#define MOD (1000 * 1000 * 1000 + 7)
#define REV (500000004)

int pow(int value, int rank) {
    if( rank == 0 ) { return 1; }
    int result = pow((int)(((long long) value) * value % MOD), rank / 2);
    if( rank % 2 == 1 ) { result = (((long long) result) * value % MOD); }
    return result;
}

int rev(int value) {
    return pow(value, MOD - 2);
}

int main() {

    int B, W;
    std::cin >> B >> W;

    long long remB = 0;
    long long remW = 0;
    long long comB = 0;
    long long comW = 0;
    long long pow2 = 1;
    long long div = REV;

    if( rev(2) != REV ) {
        std::cout << rev(2) << ": rev error..." << std::endl;
    }

    for( int i = 1; i <= B + W; ++i ) {
        if( i == B + 1 ) {
            comB = 1;
        }
        else {
            comB = comB * (i - 2) % MOD * rev(i - B - 1) % MOD;
        }
        remB = (remB * 2 + comB) % MOD;
        if( i == W + 1 ) {
            comW = 1;
        }
        else {
            comW = comW * (i - 2) % MOD * rev(i - W - 1) % MOD;
        }
        remW = (remW * 2 + comW) % MOD;
        std::cout << (pow2 + remW - remB + MOD) % MOD * div % MOD << std::endl;
        pow2 = pow2 * 2 % MOD;
        div = div * REV % MOD;
    }

}

Measured memory_bytes: 2176
use std::io;

fn main() {
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    let mut iter = buf.trim().split_whitespace();
    let A: i64 = iter.next().unwrap().parse().unwrap();
    let B: i64 = iter.next().unwrap().parse().unwrap();
    if A <= 8 && B <= 8{
        println!("Yay!")
    } else {
        println!(":(")
    }
}

Measured memory_bytes: 4352
N = int(input())
A = list(map(int,input().split()))

C = 1000
S = 0

for i in range(N-1):
    if A[i] < A[i+1] and C >= A[i+1]:
        S = C // A[i]
        C = C % A[i]
    elif A[i] > A[i+1] and S > 0:
        C += A[i]*S
        S = 0

if S > 0:
    C += S*A[-1]

print(C)


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

using namespace std;

#define sp ' '
#define endl '\n'
#define st first
#define nd second
#define pb push_back
#define mp make_pair
#define forn(YY, yy) for(long long int yy = 0; yy < YY; ++yy)
#define prn(XX) cout << XX << endl
#define prs(XX) cout << XX << " "

typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<vpll> vvpll;

const long long int MOD = 1e9 + 7;
const long long int INF = 2e9 + 13;
const long long int mINF = -2e9 - 13;
const double PI = 3.14159265358979;
const double EPS = 1e-9;

int main(int argc, char **argv){
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

    ll A, B, K;
    cin >> A >> B >> K;

    if(A >= K){ cout << A-K << sp << B << endl; }
    else{
        K -= A;
        if(K >= B){ cout << 0 << sp << 0 << endl; }
        else{ cout << 0 << sp << B - K << endl; }
    }

    return 0;
}

//cikisir



Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] x = new int[n];
		int[] y = new int[n];
		for(int i = 0; i < n; i++) {
			x[i] = sc.nextInt();
			y[i] = sc.nextInt();
		}
		double num = 0;
		double sum = 0;
		for(int i = 0; i < n; i++) {
			for(int j = i; j < n - 1; j++) {
				num = 0;
				int dx = x[j + 1] - x[i];
				int dy = y[j + 1] - y[i];
				num += dx * dx + dy * dy;
				sum += Math.sqrt(num);
			}
		}
		//System.out.println(sum / factorial(n));
		System.out.println(sum * 2 / n);

	}

	public static int factorial(int n) {
		if(n == 0) {
			return 1;
		}
		return n * factorial(n - 1);
	}


}


Measured memory_bytes: 23764
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define N 1000000007
string mat[1001];
vector<vector<int>> dp(1001,vector<int>(1001,-1));
int n,x,y,m;
int solve(int i,int j){
    if(dp[i][j]!=-1){return dp[i][j];}
    if((i==n-1 && j==m-1)){return 1;}
    if( i>=n || j>=m || mat[i][j]=='#'){return 0;}
    dp[i][j] = (solve(i+1,j)+solve(i,j+1))%N;
    return dp[i][j]%N;
}

int main()
{   
    cin>>n>>m;
   
    for(int i=0;i<n;i++){
        cin>>mat[i];
    }
    cout<<solve(0,0);

}

Measured memory_bytes: 5376
using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;

namespace ConsoleApplication2
{
    class Program
    {

        static void Main(string[] args)
        {

            int[] charTbl = new int[26];
            string alpha = "abcdefghijklmnopqrstuvwxyz";

            string line = null;
            while ((line = Console.ReadLine()) != null)
            {
                if (line.Length == 0)
                    break;

                foreach (char ch in line)
                {
                    if (char.IsLower(ch))
                    {
                        charTbl[ch - 'a']++;
                    }
                    else if (char.IsUpper(ch))
                    {
                        charTbl[ch - 'A']++;
                    }
                }

            }

            for (int i = 0; i < charTbl.Length; i++)
            {
                Console.WriteLine(alpha[i] + " : " + charTbl[i]);
            }

        }
    }
}

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

namespace Algorithm
{
    class Program
    {
        const int BuildCount = 4;
        const int FloorCount = 3;
        const int RoomCount = 10;
        const int InputValueCount = 4;
        const string Separate = "####################";

        static void Main(string[] args)
        {
            var builds = CreateInputModel();
            Calc(ref builds);
            Output(builds);
        }

        static int[][][] CreateInputModel()
        {
            var builds = new int[BuildCount][][];
            for (var i = 0; i < BuildCount; i++)
            {
                var twoDimensions = new int[FloorCount][];
                for (var j = 0; j < FloorCount; j++)
                {
                    twoDimensions[j] = new int[RoomCount];
                }
                builds[i] = twoDimensions;
            }

            return builds;
        }

        static void Calc(ref int[][][] builds)
        {
            var n = int.Parse(Console.ReadLine());

            var line = new int[InputValueCount];
            for (var i = 0; i < n; i++)
            {
                line = Console.ReadLine().Split().Select(s => int.Parse(s)).ToArray();

                builds[line[0] - 1][line[1] - 1][line[2] - 1] += line[3];
            }
        }

        static void Output(int[][][] builds)
        {
            for (var i = 0; i < BuildCount; i++)
            {
                for (var j = 0; j < FloorCount; j++)
                {
                    for (var k = 0; k < RoomCount; k++)
                    {
                        Console.Write($" {builds[i][j][k]}");
                    }
                    Console.WriteLine();
                }
                if (i < BuildCount - 1) Console.WriteLine(Separate);
            }
        }
    }

}



Measured memory_bytes: 18500
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

const int INF = INT_MAX / 2;

int main()
{
    for(int c=1; ; ++c){
        int n, w;
        cin >> n >> w;
        if(n == 0 && w == 0)
            return 0;

        vector<int> a(n);
        for(int i=0; i<n; ++i)
            cin >> a[i];

        vector<int> dp(n+1, INF);
        dp[0] = 0;

        for(int i=0; i<n; ++i){
            int s = 0;
            for(int j=i; j<n; ++j){
                s += a[j];
                if(j < n - 1)
                    dp[j+1] = min(dp[j+1], dp[i] + abs(s - w));
                else
                    dp[j+1] = min(dp[j+1], dp[i] + max(0, s - w));
            }
        }

        cout << "Case " << c << ": " << dp[n] << endl;
    }
}

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

//long long
using ll = long long;

// pair<int, int>
using PII = pair<int, int>;

//最大値、mod
const int MOD = 1000000007;
const int INF = 1000000000;
const long long LINF = 1e18;

//出力系
#define print(x) cout << x << endl
#define prints(x) cout << fixed << setprecision(10) << x << endl
#define printc(x) cout << setw(2) << setfill('0') << x << endl;
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
 
// begin() end()
#define all(x) (x).begin(),(x).end()

//for
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

//最大公約数 
unsigned gcd(unsigned a, unsigned b) {
  if(a < b) return gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

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

// a = max(a, b), a = min(a, b)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

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

int main(){
    int H, W, A, B;
    cin >> H >> W >> A >> B;
    vector<string>S(H);
    REP(i, H){
        int cnt = 0;
        if(i < B){
            while(cnt < W){
                if(cnt < A) S.at(i) += '0';
                else S.at(i) += '1';
                cnt++;
                
            }
        }else{
            while(cnt < W){
                if(cnt < A) S.at(i) += '1';
                else S.at(i) += '0';
                cnt++;
                }
            
        }
    }
    REP(i, H)print(S.at(i));
    return 0;
}

Measured memory_bytes: 2304
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;
using LLONG = long long;
const LLONG MOD = 1000000007;

bool isOK(int l1, int l2, int l3)
{
	if (l1 == l2 || l2 == l3 || l3 == l1) return false;
	return l1 + l2 > l3 && l2 + l3 > l1 && l3 + l1 > l2;
}

int main()
{
	int N; cin >> N;
	vector<int> ls(N); for (auto &li : ls) cin >> li;
	int ans = 0;
	for (int i = 0; i < N; ++i) {
		for (int j = i + 1; j < N; ++j) {
			for (int k = j + 1; k < N; ++k)
			{
				if (isOK(ls[i], ls[j], ls[k])) ++ans;
			}
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 3632
#include<stdio.h>

int main(){
	int i, n;
	int a[100];
	scanf("%d",&n);
	for(i = 0;i < n; i++){
		scanf("%d",&a[i]);
		}
		for(i = n-1;i > 0;i--){
		printf("%d ",a[i]);
	}
	printf("%d\n",a[0]);
	return 0;
}



Measured memory_bytes: 2100
#include <iostream>
#include<vector>
#include<queue>
#include<algorithm>
#include<string>
#include<math.h>

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

using namespace std;

int main() {
    float n,d;
    cin >> n >>d;
    cout << ceil((n /(2*d+1))) << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int original;
int maxx = 1000000007;
int n;
int l;
int absd(int i)
{
  int now = original - i - l;
  return abs(original - now);
}
int main()
{
	// #ifndef ONLINE_JUDGE
 //    freopen("input.txt", "r", stdin);
 //    freopen("output.txt", "w", stdout);
	// #endif
  	cin>>n>>l;
	original = (n*(n-1))/2 + n*l;
	int low=0,h=n-1;
	int ind=maxx;
	while((h-low)>=3)
	{
	   	int m1 = low +(h-low)/3;
	    int m2 = h -(h-low)/3;
	    int f1 = absd(m1);
	    int f2 = absd(m2);
	    if(f1 < f2)
	      h = m2;
	    else
	      low = m1;
	}
	int minans=maxx;
	for(int i=low;i<=h;i++)
	{
	    if(minans > absd(i))
	     {
	     	minans = absd(i);
	     	ind = i;
	     }
	}
	// cout<<original<<"\n";
	int fin = original - ind-l;
	cout<<fin;
	return 0;
}

Measured memory_bytes: 256
input = STDIN.gets.chomp!
N, D = input.split(" ").map!(&:to_i)
tensol = []
ans_num = 0
N.times do |i|
  tensol << STDIN.gets.chomp!.split(" ").map!(&:to_i)
end
tensol.combination(2).to_a.each do |l|
  sum = 0
  D.times do |i|
    sum += (l[0][i] - l[1][i]).abs**2
  end
  if (sum**(1/2.0)).to_s[-2, 2] == ".0" then
    ans_num += 1
  end
end
p ans_num

Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef long double LD;
#define maxn 100005
#define Mod 1000000007
typedef pair<int,int> PII;
typedef map<int,int> MII;
typedef vector<int> VI;
typedef vector<vector<int>> VII;
typedef vector<long long> VLL; 
#define For(i,a,b) for(int i = (a); i < (b); ++i)
#define Rep(i,b,a) for(int i = (b); i >= (a); --i)
#define all(a) (a).begin(), (a).end()
#define __builtin_popcountll bitCountLL
#define __builtin_popcount bitCount
//__builtin_ctz 末尾0的个数, __builtin_clz 前导0的个数
//__builtin_ffs 最后一个1的位置
const int INF = 2e9;
const LL ML = 4e18;

void solve() {
    int n,k;
    cin >> n >> k;
    VI a(n);
    For(i,0,n) cin >> a[i];
    sort(all(a));
    int sum = 0;
    For(i,0,k) sum += a[i];
    cout << sum;
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
	//cout.precision(30); cout << fixed;
	//freopen("D:\\data_in.txt", "r", stdin);
    solve();
    
    /*clock_t start,finish;
    start = clock();
   
    finish = clock();
    cout << "\n" << (double)(finish - start) / (double)(CLOCKS_PER_SEC) * 1000 << "ms" << endl;
    */
    return 0;
}

/***************************************************************
 question:
 idea:
 tag:
 record:
 ***************************************************************/


Measured memory_bytes: 3648
#include<iostream>
using namespace std;
int gcd(int a,int b){
  if(b==0){
    return a;
  }
  else{
    return gcd(b,a%b);
  }
}
int main(){
  int i,res,n,x,a[100010];
  scanf("%d %d\n",&n,&x);
  for(i=0;i<n;i++){
    scanf("%d ",&a[i]);
    a[i]=abs(x-a[i]);
  }
  res=a[0];
  for(i=1;i<n;i++){
    res=gcd(res,a[i]);
  }
  printf("%d\n",res);
  return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    string s;
    cin >> s;
    for(int i=0; i<s.size(); i++){
        s[i] += n;
        if(s[i] > 'Z'){
            cout << char(s[i] - 26);
        }else{
            cout << s[i];
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define fort(i,n) for (int i = 1; i <= n; ++i)
#define pi pair<int,int>
#define pb push_back
#define sz size()
#define er erase
#define fr first
#define sc second
#define rc(x) return cout << x, 0
using namespace std;

int n,p[15],m,s;

int32_t main()
{
    ios_base :: sync_with_stdio(0); cin.tie(); cout.tie();
    cin >> n;
    fort (i,n)
    {
        cin >> p[i];
        m=max(m,p[i]), s+=p[i];
    }
    cout << s-m/2;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
LL dp[305][305][305];
int h[305];
int main(){
    memset(dp, -1, sizeof(dp));
    int n, k;
    scanf("%d%d", &n, &k);
    vector<int> v;
    v.push_back(-1);
    v.push_back(0);
    for(int i=1;i<=n;i++){
        scanf("%d", &h[i]);
        v.push_back(h[i]);
    }
    sort(v.begin(), v.end());
    v.erase(unique(v.begin(), v.end()), v.end());
    for(int i=1;i<=n;i++){
        h[i] = lower_bound(v.begin(), v.end(), h[i]) - v.begin();
        if(i == 1){
            for(int j=1;j<v.size();j++){
                if(j == h[i]) dp[i][j][0] = v[j];
                else dp[i][j][1] = v[j];
            }
        }
        else{
            for(int j=1;j<v.size();j++){
                for(int l=0;l<=k;l++){
                    if(dp[i-1][j][l] == -1) continue;
                    int add = 0;
                    if(h[i] > j) add = v[h[i]]-v[j];
                    if(dp[i][h[i]][l] == -1 || dp[i][h[i]][l] > dp[i-1][j][l] + add){
                        dp[i][h[i]][l] = dp[i-1][j][l] + add;
                    }
                    if(dp[i][j][l+1] == -1 || dp[i][j][l+1] > dp[i-1][j][l]){
                        dp[i][j][l+1] = dp[i-1][j][l];
                    }
                }
            }
        }
        for(int j=1;j<v.size();j++){
            for(int l=0;l<=k;l++){
                if(dp[i][j][l] == -1) continue;
            }
        }
    }
    LL ans = 1e18;
    for(int j=1;j<v.size();j++){
        for(int l=0;l<=k;l++){
            if(dp[n][j][l] == -1) continue;
            ans = min(ans, dp[n][j][l]);
        }
    }
    printf("%lld\n", ans);
}

Measured memory_bytes: 221952
#include<bits/stdc++.h>
#define ll long long
using namespace std;
signed main() {
  ll a;
  cin >> a;
  int n = a % 10;
  if(n == 2 || n==4 || n==5 || n==7 || n==9){
    cout<<"hon\n";
  }else if(n==0 || n==1 || n==6 || n==8){
    cout<<"pon\n";
  }else{
    cout<<"bon\n";
  }
  return 0;
}


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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repr(i,n) for(int (i)=(n);(i)>0;(i)--)
#define rrep(i,n,m) for(int (i)=(n);(i)<(m);(i)++)
#define rrepr(i,n,m) for(int (i)=(n);(i)>(m);(i)--)
#define SORT(s) sort((s).begin(),(s).end())
#define SORTR(s,t) sort((s).begin(),(s).end(),greater<t>())

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pii> vpii;
typedef vector<vector<int>> vvi;

const int INF = 1000000000;
const ll LINF = 1000000000000000000ll;
const double PI = acos(-1.0);
const double EPS = 1e-10;

const ll MOD = 1000000007ll;
const int MAX=510000;

int N; vi A;
void input()
{
    cin>>N;
    rep(i,N){
        int a; cin>>a; A.emplace_back(a);
    }
    return;
}

void solve()
{
    bool f=true;
    rep(i,N){
        if(A[i]%2!=0) continue;
        if(A[i]%3!=0 && A[i]%5!=0){
            f=false;
            break;
        }
    }
    if(f) cout<<"APPROVED"<<endl;
    else cout<<"DENIED"<<endl;
    return;
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    input();
    solve();
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<cstdio>
#include<stdlib.h>
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<string>
#include<cmath>
#include<vector>
#include<stack>
#include<queue>
#include<time.h>
#include<set>
#include<map>
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i>b;i--)
#define vint vector<int> 
#define vvint vector<vint>
#define ct(a) cout<<a<<endl
using namespace std;
typedef long long ll;
const ll INF = 1e9 + 7;
const ll mod = 1e9 + 7;

ll a[5];

int main() {
	cin >> a[0] >> a[1] >> a[2] >> a[3] >> a[4];
	int max = 10,sum=0;
	FOR(i, 0, 5) {
		if (a[i] % 10 != 0) {
			if (max > a[i] % 10)max = a[i] % 10;
			a[i] += 10 - (a[i] % 10);
		}
		sum += a[i];
	}

	cout << sum-10+max << endl;
	return 0;
}

Measured memory_bytes: 256
from fractions import gcd
from functools import reduce

N = int(input())
T = []
for i in range(N):
    T.append(int(input()))
def lcm_base(x, y):
    return(x*y)//gcd(x,y)
def lcm(numbers):
    return reduce(lcm_base, numbers, 1)

print(lcm(T))


Measured memory_bytes: 5628
from heapq import heappush,heappop
import queue
import re
import math
import functools


def i_raw():
    return int(input())

def ss_raw():
    return input().split()

def is_raw():
    return list(map(int, ss_raw()))

INF = 1<<29

def make1d_arr(n,val=INF):
    return [val for i in range(n)]

def make2d_arr(h,w,val =INF):
    return [[val for i in range(w)]for i in range(h)]

def gcd (a,b):
    if(b==0):
        return a
    return gcd(b,a%b)


def main():
    H,N = is_raw()
    ABs = [is_raw() for _ in range(N)]
    MA = max([ab[0] for ab in ABs])
    dp = [INF]*(H+MA+1)
    dp[0]=0
    for h in range(1,len(dp)):
        for ab in ABs:
            a,b = ab
            if h < a:
                continue
            dp[h] = min(dp[h],b+dp[h-a])
    return min([dp[h] for h in range(H,len(dp))])


print(main())


Measured memory_bytes: 42472
#include<iostream>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;
typedef pair<int,int> p;

int dist(int a,int b){
	if(a<b)return a+60-b;
	else return a-b;
}

bool noon(int h,int m){
	if(h*60+m>=11*60 && h*60+m<15*60)return true;
	else return false;
}

bool evening(int h,int m){
	if(h*60+m>=18*60 && h*60+m<21*60)return true;
	else return false;
}

bool night(int h,int m){
	if((h*60+m>=21*60 && h*60+m<24*60)||(h*60+m<2*60))return true;
	else return false;
}

bool last(int h,int m,int s){
	if(h*60+m+s>=2*60)return false;
	else return true;
}

int main(){
	int n;
	while(cin>>n,n){
		int hh,mm,MM,dif;
		p lunch,dinner,midnight;
		lunch=dinner=midnight=p(0,0);
		rep(i,n){
			scanf("%d:%d %d",&hh,&mm,&MM);
			dif=dist(MM,mm);
			if(noon(hh,mm)){
				if(dif<=8)lunch.first++;
				lunch.second++;
			}else if(evening(hh,mm)){
				if(dif<=8)dinner.first++;
				dinner.second++;
			}else if(night(hh,mm)){
				if(dif<=8 /*&& last(hh,mm,MM)*/)midnight.first++;
				midnight.second++;
			}
		}
		int l=(double)lunch.first/(double)lunch.second*100;
		int d=(double)dinner.first/(double)dinner.second*100;
		int m=(double)midnight.first/(double)midnight.second*100;
		if(lunch.second==0)cout<<"lunch no guest"<<endl;
		else 	cout<<"lunch "<<l<<endl;
		if(dinner.second==0)cout<<"dinner no guest"<<endl;
		else	cout<<"dinner "<<d<<endl;
		if(midnight.second==0)cout<<"midnight no guest"<<endl;
		else	cout<<"midnight "<<m<<endl;
	}
	return 0;
}

Measured memory_bytes: 1240
#include<cstdio>
#include<iostream>
#include<map>
using namespace std;
#define LL long long
LL H,W,N;
LL ans[10];
LL dx[]={-2,-2,-2,-1,-1,-1,0,0,0};
LL dy[]={-2,-1,0,-2,-1,0,-2,-1,0};
map<LL,LL> m;
void slove(LL x,LL y)
{
    LL a,b;
    LL id;
    for(int i=0;i<9;i++){
        a=x+dx[i];
        b=y+dy[i];
        if(a<1 || b<1 || a>H-2 || b>W-2)   continue;
        id=(H-2)*(b-1)+a;//对每个小矩形进行编号
		//左上角的位置就只能在(h-2)*(w-2)的矩形区域内
		//每一行有w-2个元素 a-1
        m[id]++;
    }
}
int main(){
    LL x,y;
    scanf("%lld %lld %lld",&H,&W,&N);
    for(int i=1;i<=N;i++)
	{
        scanf("%lld %lld",&x,&y);
        slove(x,y);
    }
    ans[0]=(H-2)*(W-2);//总数
    LL temp;
	map<LL,LL>::iterator it=m.begin();
    for(it=m.begin();it!=m.end();it++){
        temp=it->second;
        ans[temp]++;
        ans[0]--;
    }
    for(int i=0;i<=9;i++)
        cout<<ans[i]<<endl;
    return 0;
}

Measured memory_bytes: 56448
#include <stdio.h>
int main(void)
{
	int S;
	int s,h,m;
	scanf("%d",&S);
	h=S/3600;
	m=(S%3600)/60;
	s=((S%3600)%60);
	printf("%d:%d:%d\n",h,m,s);
    return 0;
}


Measured memory_bytes: 2144
import math
 
K = int(input())
 
output = 0
 
for i in range(1,K+1):
	for j in range(1,K+1):
		gcd_ij = math.gcd(i,j)
		for k in range(1,K+1):
			output += math.gcd(gcd_ij,k)
 
print(output)

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

int main() {
	
    int count, limit;
    cin >> count >> limit;
	
    //cout << count << " " << limit;

    int minCost = 1000;
    bool bTLE = false;
    for(; count > 0; count-- )
    {
        int cost, time;
        cin >> cost >> time;

        if(time <= limit)
        {
            if(cost < minCost)
            {
                minCost = cost;
            }
            bTLE = true;
        }
    }

    if(bTLE)
    {
        cout << minCost;
    }
    else
    {
        cout << "TLE";
    }

    cout << endl;

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iomanip>
using namespace std;
typedef long long ll;
typedef long  l;
typedef pair<int,int> P;
#define rep(i,n) for(int i=0;i<n;i++)
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
const double PI=3.141592653589;
const int INF=1000000007;
const ll LMAX=1000000000000001;
ll gcd(ll a,ll b){if(a<b)swap(a,b);ll c=a%b;while(c!=0){a=b;b=c;c=a%b;}return b;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
int dx[]={-1,0,1,0};
int dy[]={0,1,0,-1};


int main(){
  int n; cin>>n;
  ll k; cin>>k;
  map<int,ll> map;
  rep(i,n){
    int a,b; cin>>a>>b;
    map[a]+=b;
  }
  ll sum=0;
  for(auto itr=map.begin();itr!=map.end();itr++){
    sum+=itr->sc;
    if(sum>=k){
      cout<<itr->fs<<endl;
      return 0;
    }
  }

  return 0;
}


Measured memory_bytes: 4224