akhauriyash/Code-Regression huggingface dataset:
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
  	long x=sc.nextLong();
  	long i=0,j=0;
  	
  	for(long a=0;a<1000;a++){
  		for(long b=-1000;b<a;b++){
  			if((long)(Math.pow(a,5)-Math.pow(b,5))==x){
  				i=a;
  				j=b;
  				break;
  			}
  		}
  	}
  	System.out.print( i + " " + j );
  }
}

Measured memory_bytes: 38840
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <random>
#include <iterator>

using namespace std;

#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(v) reverse((v).begin(),(v).end())
#define ANS(ans) cout<<(ans)<<endl;
#define UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
typedef vector<int> VI;
typedef pair<int, int> P;

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  for (int i = 0; i < (n); ++i)

int ans = 0;

void calc_mizuyari(VI v) {
	if (v.size() == 0) {
		return;
	}
	int m = *min_element(v.begin(), v.end());
	if (m != 0) {
		REP(i, v.size()) {
			v[i] -= m;
		}
		ans += m;
	}
	int i = 0;
	VI vec(0);
	while (i<v.size()) {
		if (v[i] == 0) {
			calc_mizuyari(vec);
			vec.clear();
		}
		else {
			vec.push_back(v[i]);
		}
		i++;
	}
	calc_mizuyari(vec);

	return;
}

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

	VI v(n);

	REP(i, n) {
		cin >> v[i];
	}

	calc_mizuyari(v);

	ANS(ans);

	return 0;

}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
 
string s, t;
vector<char> ans;
int dp[3005][3005];
int sl, tl;
 
// dp[i][j] = length of lcs for s[0...i] and t[0...j]
 
int rec(int sp, int tp)
{
    if (sp == sl || tp == tl)
        return 0;
 
    if (dp[sp][tp] != -1)
        return dp[sp][tp];
 
    if (s[sp] == t[tp])
    {
        dp[sp][tp] = max(rec(sp + 1, tp), rec(sp, tp + 1));
        dp[sp][tp] = max(dp[sp][tp], rec(sp + 1, tp + 1) + 1);
    }
    else
    {
        dp[sp][tp] = max(rec(sp, tp + 1), rec(sp + 1, tp));
    }
    return dp[sp][tp];
}
 
void print(int sp, int tp)
{
    if (sp == sl || tp == tl)
        return;
 
    if (s[sp] == t[tp])
    {
        if (dp[sp + 1][tp + 1] + 1 >= dp[sp + 1][tp] && dp[sp + 1][tp + 1] + 1 >= dp[sp][tp + 1])
        {
            cout << s[sp];
            print(sp + 1, tp + 1);
        }
        else if (dp[sp + 1][tp] >= dp[sp + 1][tp + 1] + 1 && dp[sp + 1][tp] >= dp[sp][tp + 1])
            print(sp + 1, tp);
        else
            print(sp, tp + 1);
    }
    else
    {
        if (dp[sp + 1][tp] >= dp[sp][tp + 1])
            print(sp + 1, tp);
        else
            print(sp, tp + 1);
    }
    return;
}
 
int main()
{
    cin >> s >> t;
    sl = s.size(), tl = t.size();
    for (int i = 0; i < 3005; i++)
        for (int j = 0; j < 3005; j++)
            dp[i][j] = -1;
    ans.clear();
 
    rec(0, 0);
    print(0, 0);
    cout << endl;
    return 0;
}

Measured memory_bytes: 35968
#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-1; i >= 0; i--)
#define ALL(x) x.begin(),x.end()

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

const int mod = 1e9+7;
const int INF = 1e9+1;
const int MAX = 1e5;

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

struct edge {int to, cost;}; // 辺
// vector<edge> graph[MAX]; // 隣接リスト
// bool visit[MAX]; // 訪問の有無

int n, w; // 変数
struct item {int value, weight;};
item items[100];
int dp[100][MAX+1];
int ans = 0;

int dp_solve() {
    rep(i, n) {
        rep(j, MAX+1) {
            if (j == 0) dp[i][j] = 0;
            else dp[i][j] = INF;
        }
    }
    rep(i, n) {
        rep(j, MAX+1) {
            if (j == 0) continue;
            if (i == 0) {
                if (j == items[i].value && items[i].weight <= w) {
                    dp[i][j] = items[i].weight;
                }
            } else {
                dp[i][j] = dp[i-1][j];
                if (j-items[i].value >= 0) {
                    int x = dp[i-1][j-items[i].value] + items[i].weight;
                    if (x <= w) {
                        dp[i][j] = min(dp[i][j], x);
                    }
                }
            }
        }
    }
    rep(i, MAX+1) {
        if (dp[n-1][i] == INF) continue;
        ans = max(ans, i);
    }
    return ans;
}

int main() {
// input
    cin >> n >> w;
    rep(i, n) {
        cin >> items[i].weight;
        cin >> items[i].value;
    }
// solve
    int ans = dp_solve();
// output
    cout << ans << "\n";
}

Measured memory_bytes: 42696
#include<iostream>
#include<stdlib.h>

using namespace std;

int main()
{
	int k,n;
	int max=0;
	cin>>k>>n;
	int *a=new int[n];
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
	}

	
	for(int i=0;i<n-1;i++)
	{
		if(a[i+1]-a[i]>max)max=a[i+1]-a[i];
	}
	if(k-a[n-1]+a[0]>max)max=k-a[n-1]+a[0];
	cout<<k-max;
	return 0;
 } 

Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <vector>
#define _USE_MATH_DEFINES
#include <math.h>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <stdlib.h>
#include <functional>
#include <string>
#include <array>
#include <map>
#include <queue>
#include <limits.h>
#include <set>
#include <stack>
#include <random>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <nmmintrin.h>
#include <chrono>
const double EPS = 1e-8;
#define Scan(a) int a;scanf("%d", &a);
#define ScanS(a) char a[500];scanf("%s", a);
#define rep(i,s,n) for(int i = (s); (n) > i; i++)
#define REP(i,n) rep(i,0,n)
#define RANGE(x,a,b) ((a) <= (x) && (x) <= (b))
#define DUPLE(a,b,c,d) (RANGE(a,c,d) || RANGE(b,c,d) || RANGE(c,a,b) || RANGE(d,a,b))
#define INCLU(a,b,c,d) (RANGE(a,c,d) && (b,c,d))
#define PW(x) ((x)*(x))
#define ALL(x) (x).begin(), (x).end()
#define MODU 1000000007
#define bitcheck(a,b)   ((a >> b) & 1LL)
#define bitset(a,b)      ( a |= (1LL << b))
#define bitunset(a,b)    (a &= ~(1LL << b))
#define MP(a,b) make_pair((a),(b))
#define Manh(a,b) (abs((a).first-(b).first) + abs((a).second - ((b).second))
#define pritnf printf
#define scnaf scanf
#define itn int
#ifdef _MSC_VER
#define __builtin_popcount _mm_popcnt_u32
#define __builtin_popcountll _mm_popcnt_u64
#endif
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a%b);
}
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T &val) {
	std::fill((T*)array, (T*)(array + N), val);
}

pii Dir[8] = {
	{ 0 ,1 },{ -1 ,0 },{ 1 ,0 },{ 0 ,-1 },
	{ 1 ,1 },{ 1 ,-1 },{ -1 ,1 },{ -1 ,-1 }
};


pii operator+(pii obj, pii obj2) {
	return MP(obj.first + obj2.first, obj.second + obj2.second);
}
pii operator-(pii obj, pii obj2) {
	return MP(obj.first - obj2.first, obj.second - obj2.second);
}

struct Edge {
	int from, to, weight;
};

typedef vector<vector<Edge>> Graph;
struct UnionFind {
	vector<int> data;
	UnionFind(int size) : data(size, -1) { }
	bool unionSet(int x, int y) { //ｘの入ってる集合と yの入ってる集合を併合
		x = root(x); y = root(y);
		if (x != y) {
			if (data[y] < data[x]) swap(x, y);
			data[x] += data[y]; data[y] = x;
		}
		return x != y;
	}
	bool findSet(int x, int y) { //xとyが同じ集合に入っているかどうかを判定
		return root(x) == root(y);
	}
	int root(int x) {
		return data[x] < 0 ? x : data[x] = root(data[x]);
	}
	bool isroot(int x) {
		return data[x] < 0;
	}
	int size(int x) {
		return -data[root(x)];
	}
};
int main() {
	int n;

	cin >> n;
	int ans = 0;
	bool bef = 0;
	REP(i, n) {
		int a;
		scanf("%d", &a);
		if (!bef && a == i + 1) {
			ans++;
			bef = true;
		}
		else
			bef = false;
	}

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

Measured memory_bytes: 256
#include<iostream>
    using namespace std;
    int main(void){
      string s;
      cin>>s;
      if(s[0] == s[1] && s[1]== s[2]){
        cout<<"Yes"<<endl;
      }else if(s[1]== s[2] && s[2] == s[3]){
        cout<<"Yes"<<endl;
      }else{
        cout<<"No"<<endl;
      }
      return 0;
    }

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define __ <<" "<<
#define ___ <<" "
#define bash push_back
#define ALL(x) x.begin(),x.end()
//#define int long long

struct IoSetup {
    IoSetup() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout <<fixed<<setprecision(12);
        cerr <<fixed<<setprecision(12);
    }
}IoSetup;

typedef long long ll;
typedef pair < int , int >  pii;
static constexpr const signed int INF = 0x3f3f3f3f;
static constexpr const signed long long LINF = 0x3f3f3f3f3f3f3f3fLL;
static constexpr const signed int SMOD = 1000000007;
static constexpr const signed int NMOD = 998244353;
static constexpr const signed int dx[]={1,0,-1,0,1,1,-1,-1};
static constexpr const signed int dy[]={0,-1,0,1,-1,1,-1,1};

inline bool inside(int x,int y,int w,int h){return (x>=0 && y>=0 && x<w && y<h);}
template<class T>bool chmax(T &a, const T &b){return(a<b?a=b,true:false);}
template<class T>bool chmin(T &a, const T &b){return(a>b?a=b,true:false);}
inline int qp(int a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}



signed main() {

    int n;
    cin >> n;
    ll ans = 1, t;
    for(int i = 0; i < n; i++) {
        cin >> t;
        ans = ans / __gcd(ans, t) * t;
    }

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



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

#define mp make_pair
#define fst first
#define snd second

using namespace std;

typedef int32_t i32;
typedef uint32_t u32;
typedef int64_t i64;
typedef uint64_t u64;
typedef pair<int,int> pii;
typedef pair<i64,int> pli;
typedef pair<int,i64> pil;
typedef pair<i64,i64> pll;
typedef vector<int> vi;
typedef vector<i64> vl;

template <typename T>
T id(T b) {return b;};
template <class It>
bool all(It f,It l){return std::all_of(f,l,id<bool>);}
template <class It>
bool any(It f,It l){return std::any_of(f,l,id<bool>);}

const int MAX_N = 100000;
int n;
int aok[MAX_N], tak[MAX_N];
pii m[MAX_N];

int main()
{
  cin >> n;
  int a,b;
  for (int i = 0; i < n; i++) {
    cin >> a >> b;
    tak[i] = a; aok[i] = b;
    m[i] = mp(a+b,i);
  }

  sort(m,m+n);

  i64 p1 = 0, p2 = 0;
  for (int i = 0; i < n; i++) {
    pii p = m[n-1-i];
    if (i % 2 == 0) {
      p1 += tak[p.snd];
    } else {
      p2 += aok[p.snd];
    }
  }

  cout << p1 - p2 << endl;

  return 0;
}


Measured memory_bytes: 1792
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<deque>
#include<cmath>
#include<map>
#include<cstring>

using namespace std;
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LLINF = 1LL<<60;
#define P pair<ll, ll>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define print(x) cout << (x) << endl

class mint {
    long long x;
public:
    mint(long long x=0) : x((x%MOD+MOD)%MOD) {}
    mint operator-() const {
      return mint(-x);
    }
    mint& operator+=(const mint& a) {
        if ((x += a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator-=(const mint& a) {
        if ((x += MOD-a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator*=(const  mint& a) {
        (x *= a.x) %= MOD;
        return *this;
    }
    mint operator+(const mint& a) const {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint& a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint& a) const {
        mint res(*this);
        return res*=a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    // for prime MOD
    mint inv() const {
        return pow(MOD-2);
    }
    mint& operator/=(const mint& a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint& a) const {
        mint res(*this);
        return res/=a;
    }

    friend ostream& operator<<(ostream& os, const mint& m){
        os << m.x;
        return os;
    }
};

/* -- template -- */

int main() {
    ll A, B, N;
    cin >> A >> B >> N;
    ll t = min(B - 1, N);
    cout << (A * t - A * t % B) / B << endl;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
int main(void)
{
  int n, p[20000] = {}, q[20001] = {};
  cin >> n;
  for(int i = 0; i < n; i++){
    cin >> p[i];
    cout << 20000 * i + 1 << (i == n - 1 ? '\n' : ' ');
  }
  for(int i = 1; i <= n; i++){
    q[p[i - 1]] = i;
  }
  for(int i = 1; i <= n; i++){
    cout << (n - i) * 20000 + q[i] << (i == n ? '\n' : ' ');
  }
  return 0;
}

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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define bit(n) (1LL << (n))
#define sz(x) ((int)(x).size())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define en '\n'
#define pb push_back
#define mp make_pair

typedef long long ll;
using namespace std;

ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { ll g = gcd(a, b); return a / g * b; }
const int dx[4] = { 1, 0, -1,  0 };
const int dy[4] = { 0, 1,  0, -1 };
const int INF = (int)1e9;
const ll  inf = (ll)1e18;
const int mod = 1000000007;

struct aaa {
	aaa() {
		cin.tie(0);
		ios::sync_with_stdio(0);
		cout << fixed << setprecision(20);
	};
}aaaaa;


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

	cout << b + min(c, a + b + 1) << en;

	return 0;
}

Measured memory_bytes: 256
N = int(input())
# N = 2 * 10 ** 5
A = tuple(map(int, input().split()))
# A = [10 ** 9] * N
MOD = 10 ** 9 + 7
rev_sum_list = [0] * N
rev_sum_list[-1] = A[-1]
for i in range(N - 2, -1, -1):
    rev_sum_list[i] = (rev_sum_list[i + 1] + A[i]) % MOD
# print(rev_sum_list)
ans = 0
for i in range(1, N):
    ans += A[i - 1] * rev_sum_list[i]
    ans %= MOD
print(ans)

Measured memory_bytes: 31904
#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>

const int MOD = 1000000007, INF = 1111111111;
using namespace std;
using lint = long long;

template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
	for (int i = 0; i < (int)vec.size(); i++) {
		os << vec[i] << (i + 1 == vec.size() ? "" : " ");
	}
	return os;
}

#ifdef _DEBUG
template <class Head>
void dump(const char* str, Head &&h) { cerr << str << " = " << h << "\n"; };
template <class Head, class... Tail>
void dump(const char* str, Head &&h, Tail &&... t) {
	while (*str != ',') cerr << *str++; cerr << " = " << h << "\n";
	dump(str + 1, t...);
}
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else 
#define DMP(...) ((void)0)
#endif

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int K, X;
	cin >> K >> X;

	for (int i = X - K + 1; i < X + K; i++) cout << i << " ";

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i,x) for(int i=0,i##_len=(x);i<i##_len;++i)
#define rep(i,a,b) for(int i=(a),i##_len(b);i<i##_len;++i)
#define All(x) begin(x),end(x)
#define rAll(x) rbegin(x),rend(x)
using namespace std;
using ll = long long;

int main(){
    int N,X,Y;
    cin>>N>>X>>Y;
    X--;Y--;
    vector<int> ans(N);
    REP(i,N) rep(j,i+1,N){
        int dist=min(j-i,abs(i-X)+abs(j-Y)+1);
        ans[dist]++;
    }
    REP(i,N-1) cout<<ans[i+1]<<endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <map>
#include <vector>
#include <algorithm>
#include <functional>
using namespace std;

int main() {
	int N, dummy;
	dummy = scanf("%d", &N);

	vector<vector<long long>> TA;

	int tmp1, tmp2;
	TA.reserve(N);
	for (int i = 0; i < N; i++) {
		dummy = scanf("%d %d", &tmp1, &tmp2);
		vector<long long> v;
		v.push_back(tmp1);
		v.push_back(tmp2);
		TA.push_back(v);
	}

	for (int i = 0; i < N - 1; i++) {
	    long long tmp1 = (TA[i][0] / TA[i+1][0]) + ((TA[i][0] % TA[i+1][0] != 0) ? 1 : 0);
	    long long tmp2 = (TA[i][1] / TA[i+1][1]) + ((TA[i][1] % TA[i+1][1] != 0) ? 1 : 0);
	    
	    long long tmp = max(tmp1, tmp2);
	    
		TA[i+1][0] *= tmp;
		TA[i+1][1] *= tmp;
	}
	
	long long ans = TA[N-1][0] + TA[N-1][1];
	printf("%lld\n", ans);
	
	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
using namespace std;
int main() {
    int n, t, minv=2001, maxv=-1, diff;
    scanf("%d", &n);
    for (int i = 0; i < n; i++) {
        scanf("%d", &t);
        minv = min(minv, t);
        maxv = max(maxv, t);
    }
    diff = maxv - minv;
    diff = (diff % 2 == 0) ? diff/2 : diff/2+1;
    printf("%d\n", diff);
    return 0;
}



Measured memory_bytes: 2760
#include <bits/stdc++.h>//Carefully Crafted by hetp111
using namespace std;
#define int long long
#define double long double
#define all(v) (v).begin(),(v).end()
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int,int>
#define vii vector<pii>
#define MOD (1000000007)
#define MOD2 (998244353)
#define MOD3 (1000000009)
#define PI acos(-1)
#define eps (1e-8)
#define INF (1e18)
#define FASTER ios_base::sync_with_stdio(0);cin.tie(0)
template<class A,class B>ostream&operator<<(ostream&out,const pair<A,B>&a){return out<<"("<<a.first<<","<<a.second<<")";}
template<class A>ostream&operator<<(ostream&out,const vector<A>&a){for(const A &it:a)out<<it<<" ";return out;}
template<class A,class B>istream&operator>>(istream&in,pair<A,B>&a){return in>>a.first>>a.second;}
template<class A>istream&operator>>(istream&in,vector<A>&a){for(A &i:a)in>>i;return in;}
ifstream cinn("in.txt");ofstream coutt("out.txt");
int poww(const int &a,int b,const int &m=MOD){if(b==0)return 1;int x=poww(a,b/2,m);x=x*x%m;if(b&1)x=x*a%m;return x;}
int ceil(const int &a,const int &b){return (a+b-1)/b;}
////Read:
//Use __builtin_popcountll for ll;
//Check corner cases, n==1;
//
////Some function:
//__builtin_popcountll(), 

int prm[1000005];

bool isP(int n){
    return prm[n];
}

int fr[1000005];

signed main(){
    FASTER;
    
    memset(prm,1,sizeof prm);
    prm[1]=0;
    for(int i=2;i<=1e6;i++){
        for(int j=i*i;j<=1e6 && prm[i];j+=i){
            prm[j]=0;
        }
    }
    
    
    int n;cin>>n;
    vi v(n);cin>>v;
    
    for(int i:v)fr[i]++;
    
    if(n==1 || fr[1]==1){
        cout<<1;
        return 0;
    }
    
    int ans=0;
    for(int i:v){
        bool ok=1;
        for(int j=1;j*j<=i;j++){
            if(j==1){
                ok&=(fr[i/j]==1);
                ok&=(fr[j]==0);
                continue;
            }
            if(i%j==0){
                if(fr[i/j])ok=0;
                if(fr[j])ok=0;
            }
        }
        if(isP(i) && fr[i]>1)ok=0;
        ans+=ok;
    }
    cout<<ans;
}



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

int main() {
    int temp;
    std::vector<int> N;
    
    for (int i=0; i<4; ++i) {
        std::cin >> temp;
        N.push_back(temp);
    }
    
    std::sort(N.begin(), N.end());

    if (N[0]==1 && N[1]==4 && N[2]==7 && N[3]==9) {
        std::cout << "YES" << std::endl;
    } else {
        std::cout << "NO" << std::endl;
    }
}

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

template <typename T, typename U> void cmin(T &a, U b) {
  if (a > b) a = b;
}
template <typename T, typename U> void cmax(T &a, U b) {
  if (a < b) a = b;
}

signed main() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);

  int K;
  cin >> K;

  while (K--) cout << "ACL";
  cout << "\n";
}

Measured memory_bytes: 3604
import sys
sys.setrecursionlimit(10**9)


def input():
    return sys.stdin.readline().rstrip()


def main():
    H, W = map(int, input().split())
    S = [list(input()) for i in range(H)]
    ans = 0
    memo_y = [[float(-1)]*W for i in range(H)]
    memo_x = [[float(-1)]*W for i in range(H)]
    for y in range(H):
        for x in range(W):
            c = 0
            if S[y][x] == '.':
                c += 1
                c_x = 0
                c_y = 0
                tmp_x = [x]
                tmp_y = [y]
                if memo_x[y][x] == float(-1):
                    for i in range(1, x+1):
                        if S[y][x-i] == '.':
                            c_x += 1
                            tmp_x.append(i)
                        else:
                            break
                    for i in range(x+1, W):
                        if S[y][i] == '.':
                            c_x += 1
                            tmp_x.append(i)
                        else:
                            break
                    for i in tmp_x:
                        memo_x[y][i] = c_x
                else:
                    c_x += memo_x[y][x]
                if memo_y[y][x] == float(-1):
                    for i in range(1, y+1):
                        if S[y-i][x] == '.':
                            c_y += 1
                            tmp_y.append(i)
                        else:
                            break
                    for i in range(y+1, H):
                        if S[i][x] == '.':
                            c_y += 1
                            tmp_y.append(i)
                        else:
                            break
                    for i in tmp_y:
                        memo_y[i][x] = c_y
                else:
                    c_y += memo_y[y][x]
                c += c_x + c_y
            ans = max(ans, c)
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 393736
#include <iostream>
using namespace std;
int main() {
    long long int x,temp=0,temp1=0,temp2=0;
    cin>>x;
    if(x>=500)
    {
        temp=x/500;
        temp1=x-temp*500;
        temp2=temp1/5;
    }
    else if(x>=5 && x<500)
    {
        temp2=x/5;
    }
    cout<<((temp2*5)+(temp*1000));
    return 0;
}

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

int main()
{
    vector<vector<ll>> a(3, vector<ll>(3));
    rep(i, 3)
    {
        rep(j, 3)
        {
            cin >> a.at(i).at(j);
        }
    }
    ll N;
    cin >> N;
    vector<ll> b(N);
    rep(i, N)
    {
        cin >> b.at(i);
    }
    rep(i, N)
    {
        rep(j, 3)
        {
            rep(k, 3)
            {
                if (a.at(j).at(k) == b.at(i))
                {
                    a.at(j).at(k) = 0;
                }
            }
        }
    }
    string ans = "No";
    rep(i, 3)
    {
        if (a.at(i).at(0) == 0 && a.at(i).at(1) == 0 && a.at(i).at(2) == 0)
        {
            ans = "Yes";
            break;
        }
        if (a.at(0).at(i) == 0 && a.at(1).at(i) == 0 && a.at(2).at(i) == 0)
        {
            ans = "Yes";
            break;
        }
        if (a.at(0).at(0) == 0 && a.at(1).at(1) == 0 && a.at(2).at(2) == 0)
        {
            ans = "Yes";
            break;
        }
        if (a.at(0).at(2) == 0 && a.at(1).at(1) == 0 && a.at(2).at(0) == 0)
        {
            ans = "Yes";
            break;
        }
    }
    cout << ans << endl;
    return 0;
}

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

int main()
{
 int W,H,x,y,r;
 cin >> W >> H >> x >> y >> r;
 
 if(x-r>=0 && x+r<=W && y-r>=0 && y+r<=H)cout <<"Yes"<<endl;
 else{cout << "No"<<endl;} 
}

Measured memory_bytes: 3076
#include<stdio.h>
#include<string.h>

	
int main(){
	
	int n;
	scanf("%d",&n);
	char arr[n+1];
	
	scanf("%s",arr);
	
	int flag = 1;
	
	for(int i=0;i<(n/2);i++){
	if(arr[i] != arr[i + (n/2)]){
		flag = 0;
	}
}

	if(n%2 != 0){
		flag = 0;
	}

	if(flag == 1){
		printf("Yes");
	}
	else{
		printf("No");
	}
	
		return 0;
	}

Measured memory_bytes: 1724
N = gets.to_i
a = N.times.map { gets.to_i }

lh = {}
light = 1
cnt = 0
loop do
  # ボタン2にライトが点灯していたら終了
  if light == 2
    p cnt
    break
  end

  # ライトの付いたボタンを押す
  light = a[light-1]

  # 押したボタンを再度押したら無理ゲー
  if lh[light]
    p -1
    break
  end

  lh[light] = 1
  cnt += 1
end

Measured memory_bytes: 9084
#include <stdio.h>
int main(void){
    int no1, no2;
    
    while((scanf("%d %d", &no1, &no2))&&((no1!=0)||(no2!=0))){
        if(no1 > no2)
            printf("%d %d\n", no2, no1);
        else
            printf("%d %d\n", no1, no2);
    }
    return 0;
}


Measured memory_bytes: 600
#include<stdio.h>
int main(){
	double f,A,B;
	int a,b,d,r;
	
	scanf("%d %d",&a,&b);
	A=a;
	B=b;
	d=a/b;
	r=a%b;
	f=A/B;
	
	printf("%d %d %f",d,r,f);
	return 0;
}

Measured memory_bytes: 636
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <iomanip>
#include <queue>
#include <deque>
#include <map>
#include <unordered_map>
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define repr(e,x) for(auto& e:x)
using namespace std;
typedef long long ll;
typedef long double ld;

ll N;
ll A[200000];

int main(){
    cin>>N;
    rep(i,N) cin>>A[i];

    sort(A,A+N,greater<ll>());

    ll ans=A[0];
    N-=2;
    repn(i,(N+1)/2){
        if(2*i<=N) ans+=2*A[i];
        else ans+=A[i];
    }
    

    cout<<ans<<endl;
}

Measured memory_bytes: 5192
n, a, b = gets.split.map(&:to_i)
count_a = 0
count_b = 0

gets.chomp.each_char do |c|
  if c == 'a'
    if count_a + count_b < a + b
      count_a += 1
      puts 'Yes'
    else
      puts 'No'
    end
  elsif c == 'b'
    if count_a + count_b < a + b && count_b < b
      count_b += 1
      puts 'Yes'
    else
      puts 'No'
    end
  elsif c == 'c'
    puts 'No'
  end
end


Measured memory_bytes: 2428
#include<bits/stdc++.h>
#define fast ios::sync_with_stdio(false), cin.tie(0);
#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define endl '\n'

using namespace std;

int main()
{
    fast;
    ll n,m,i;
    cin>>n>>m;
    ll a[m],sum=0;
    for (i=0;i<m;i++)
    {
        cin>>a[i];
        sum+=a[i];
    }
    if (sum>n)
        cout<<"-1\n";
    else
        cout<<n-sum<<endl;
    return 0;
}

Measured memory_bytes: 3732
N = int(input())
A = list(map(int,input().split()))
def admit(A):
    for i in range(0,len(A)):
        if A[i] % 2 == 0:
            if A[i] % 3 != 0 and A[i] % 5 != 0:
                return 'DENIED'
    return 'APPROVED'
print(admit(A))

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

int main(){
  int N;
  cin >> N;
  
  int bot = N / 10;
  int top = N/1000;
  int und = N - top*1000;
  
  if(und % 111 == 0 || bot % 111 == 0){
    cout << "Yes" << endl;
  }
  else{
  cout << "No" << endl;
  }
}

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

int main() {
    int n, temp;
    cin >> n;
    vector<pair<int, int>> a(n);
    rep(i, n) {
        cin >> temp;
        a.at(i) = make_pair(temp, i + 1);
    }
    sort(a.begin(), a.end());
    rep(i, n) cout << a.at(i).second << " ";
    cout << endl;
}

Measured memory_bytes: 1664
def main():
    n = int(input())
    l_prm = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47]
    l_prm = [i for i in l_prm if i<=n/2]
    l_new = []
    for i in l_prm:
        a = n
        counter = 0
        b = a
        c=1
        while b!=0:
            b = a//i**c
            counter += b
            c += 1
        l_new.append(counter)
    ans=0
    def num(j,lst):
        return(len([i for i in lst if i>=j]))
    ans += num(4,l_new) * (num(4,l_new)-1)/2 *(num(2,l_new)-2)
    ans += num(14,l_new)*(num(4,l_new)-1)
    ans += num(24,l_new)*(num(2,l_new)-1)
    ans += num(74,l_new)
    print(int(ans))
if __name__ == '__main__':
    main()

Measured memory_bytes: 3064
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <stack>
#include <queue>
#define rep(i,l,r) for(int i=(l);i<=(r);++i)
#define per(i,r,l) for(int i=(r);i>=(l);--i)
using namespace std;
const int maxn=1e5+10;
typedef long long ll;
int n,f[maxn][60],dsy[maxn],fxk[maxn],m,x;ll ans,a[maxn],p[maxn],k; 
int main(){
	scanf("%d",&n);
	rep(i,1,n) scanf("%lld",&a[i]);
	rep(i,1,n-1) p[i]=a[i+1]-a[i],f[i][0]=i,fxk[i]=i;
	scanf("%d%lld",&m,&k);
	rep(i,1,m) scanf("%d",&x),swap(f[x-1][0],f[x][0]);
	rep(i,1,59) rep(j,1,n-1) f[j][i]=f[f[j][i-1]][i-1];
	per(i,59,0) if(k&(1ll<<i)){
		rep(j,1,n-1) dsy[j]=f[fxk[j]][i];
		rep(j,1,n-1) fxk[j]=dsy[j];
	}
	printf("%lld.0\n",a[1]);ans=a[1];
	rep(i,1,n-1) ans+=p[fxk[i]],printf("%lld.0\n",ans);
	return 0;
}

Measured memory_bytes: 27264
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A, B, C, a, b, c;
  cin >> A >> B >> C;
  
  a = A;
  b = B;
  c = C;
    A = b;
    B = a;
    A = c;
    C = b;
  cout << A << " " << B << " " << C << endl;
}

Measured memory_bytes: 3644
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll a,b,cnt=0;
ll gcd(ll x,ll y)
{
	while(y)
	{
		long long tmp=x%y;
		x=y;
		y=tmp;
	}
	return x;
}
bool isprime(ll x)
{
	if(x<2)
		return false;
	for(ll i=2;i*i<=x;i++)
		if(x%i==0)
			return false;
	return true;
}
int main()
{
	cin>>a>>b;
	ll x=gcd(a,b);
	if(x==1)
	{
		cout<<1<<endl;
		return 0;
	}
	if(isprime(x))
	{
		cout<<2<<endl;
		return 0;
	}
	for(ll i=2;i*i<=x;i++)
	{
		if(x%i)
			continue;
		++cnt;
		while(1)
		{
			if(x%i)
				break;
			x/=i;
		}
		if(isprime(x))
		{
			++cnt;
			break;
		}
	}
	cout<<cnt+1<<endl;
	return 0;
}

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

int mygcd(long long x,long long y){
    if(x <= y){
        if(x == 0)
            return y;
        else
            return mygcd(y%x,x);      
    }else{
        if(y == 0)
            return x;
        else
        {
            return mygcd(y,x%y);
        }
        
    }
}

int main(){
    long long A, B;
    long long lcm;

    cin >> A >> B;

    lcm = A * B / mygcd(A,B);

    cout << lcm << endl;


}

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

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, l;
    cin >> n >> l;
    vector<string> st;
    string s;
    for(int i=0; i<n; i++) {
        cin >> s;
        st.push_back(s);
    }
    sort(st.begin(), st.end());
    for(auto it=st.begin(); it!=st.end(); ++it) {
        cout << *it;
    }
    cout << '\n';
    return 0;
}

Measured memory_bytes: 3624
import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS
import Data.List

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

main = do
    [x,_] <- getIntList
    ps <- getIntList
    print . snd . head$ sort [(abs (x-i),i)|i <- [0..101], i `notElem` ps]

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

int main() {
	int s;
	cin >> s;
	string j = "Good";

	int a, b, c, d;
	a = s / 1000;
	b = (s - (1000 * a)) / 100;
	c = (s - (1000 * a + 100 * b)) / 10;
	d = s - (1000 * a + 100 * b + 10 * c);
	if (a == b || b == c || c == d) {
		j = "Bad";
	}

	cout << j << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		
		Scanner scan = new Scanner(System.in);
		int m1 = scan.nextInt();
		int d1 = scan.nextInt();
		int m2 = scan.nextInt();
		int d2 = scan.nextInt();

		if((m2-m1)==1) {
			System.out.println("1");
		}
		else {
			System.out.println("0");
		}
		
	}

}


Measured memory_bytes: 22228
o = input()
e = input()
l = []
for  i in range(max(len(o),len(e))):
        
        
    l.append(o[i])
    if len(o) - len(e) == 1 and i == len(o) - 1:
        break
        
    l.append(e[i])
print("".join(l))
    

Measured memory_bytes: 2940
import java.io.IOException;
import java.util.NoSuchElementException;

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws IOException {
        try (
            BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in))) {
            FastScanner fs = new FastScanner();

            final int N = fs.nextInt();

            int[] T = new int[N];

            int sm =0;

            for (int i = 0; i < N; i++) {
                T[i] = fs.nextInt();
                sm += T[i];
            }

            final int M = fs.nextInt();

            for (int i = 0; i < M; i++) {
                // 0-indexed
                int P = fs.nextInt() - 1;
                int X = fs.nextInt();
                int now = sm - T[P] + X;
                System.out.println(now);
            }
        }
    }
}

class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        } else {
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() {
        if (hasNextByte()) return buffer[ptr++];
        else return -1;
    }
    private static boolean isPrintableChar(int c) {
        return 33 <= c && c <= 126;
    }
    public boolean hasNext() {
        while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;
        return hasNextByte();
    }
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true) {
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            } else if(b == -1 || !isPrintableChar(b)) {
                return minus ? -n : n;
            } else {
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
            throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() {
        return Double.parseDouble(next());
    }
}


Measured memory_bytes: 22484
#define _USE_MATH_DEFINES
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <string>
#include <vector>
#include <utility>
#include <complex>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <tuple>
#include <bitset>
#include <limits>
#include <algorithm>
#include <array>
#include <random>
#include <complex>
#include <regex>
#include <iomanip>
using namespace std;
typedef long double ld;
typedef long long ll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define fcout cout << fixed << setprecision(10)
#define rep(i,n)    for(int i=0; i<(int)n; i++)
#define mp(a,b) make_pair(a,b)
#define pb push_back
#define all(x) x.begin(), x.end()
#define F first
#define S second
const ll inf = 1e18;
const ll mod = 1e9 + 7;

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

// mod. m での a の逆元 a^(-1) を計算する。
ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

ll modpow(ll a, ll n){
    ll res = 1;
    while(n>0){
        if(n&1){
            res = res * a % mod;
        }
        a = a * a % mod;
        n >>=1;
    }
    return res;
}


int main(){
    int n,k;
    cin >> n >> k;
    vll a(n);
    rep(i,n) cin >> a[i];
    sort(all(a));
    int l=0, r = n-1;
    int count = k;
    ll ans=1;
    if(a[n-1] < 0 && k%2==1){
        rep(i,k){
            ans *= a[n-i-1];
            ans %= mod;
        }
    }else{
        while(1){
            if(count == 1){
                ans *= a[r];
                ans %= mod;
                break;
            }
            ld ltmp=1, rtmp=1;
            ltmp *= a[l]; ltmp *= a[l+1];
            rtmp *= a[r]; rtmp *= a[r-1];
            if(ltmp <= rtmp){
                ans *= a[r];
                ans %= mod;
                r-=1;
                count-=1;
            }else{
                ans *= a[l];
                ans %= mod;
                ans *= a[l+1];
                ans %= mod;
                l+=2;
                count-=2;
            }
            if(count == 0) break;
        }
    }

    if(ans < 0) ans += mod;
    cout << ans << endl;
}



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

using namespace std;

#define sz(v)           ((int)((v).size()))
#define clr(v, d)       memset(v, d, sizeof(v))
#define rep(i, v)       for(int i=0; i<sz(v); ++i)
#define lp(i, n)        for(int i=0; i<(int)(n); ++i)
#define lpi(i, j, n)    for(int i=(j); i<(int)(n); ++i)
#define lpd(i, j, n)    for(int i=(j); i>=(int)(n); --i)
#define INF             1000000000

typedef long long ll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;

void init(){
	std::ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
}

const int N = 1e5+5;

int arr[N];
ll sol[N];


int main()
{
	init();
	int n;
	cin >> n;
	int sign = 1;
	for(int i = 0; i < n; ++i){
		cin >> arr[i];
		sol[0] += ((ll) sign * arr[i]);
		sign *= -1;
	}
	cout << sol[0] << " ";
	for(int i = 1; i < n; ++i){
		sol[i] = 2 * arr[i - 1] - sol[i - 1];
		cout << sol[i] << " ";
	}

	return 0;
}


Measured memory_bytes: 2560
#include <stdio.h>
#include<string.h>
#define LEN 100005

typedef struct pp{
	char name[100];
	int t;
} P;

P Q[LEN];
int head , tail, n;

void enqueue( P x )
{
	Q[tail] = x;
	tail = (tail +1) % LEN;	
}

P dequeue()
{
	P x = Q[head];
	head = (head+1)%LEN;
	return x;
}

int min( int a, int b){
	return a < b ? a : b ; //返回最小值 
}

int main()
{
	int elaps = 0 , c;
	int i , q;
	P u;
	scanf("%d %d",&n , &q);
	for( i = 1; i <=n; i++ )
	{
		scanf("%s",Q[i].name);
		scanf("%d", &Q[i].t);
	}
	head = 1 ;
	tail = n+1;
	
	while( head != tail)
	{
		u = dequeue();
		c = min(q , u.t);
		u.t -= c; //计算剩余的所需时间 
		elaps += c;
		if( u.t > 0 ) enqueue(u);
		else{
			printf("%s %d\n", u.name, elaps);
		} 
	}
	return 0;
}


Measured memory_bytes: 12728
n, m, l = map(int, input().split())
a1 = [[] for _ in range(n)]
a2 = [[] for _ in range(m)]

for i in range(n):
    a1[i] = list(map(int, input().split()))

for j in range(m):
    a2[j] = list(map(int, input().split()))
    
for i in range(n):
    line = []
    for j in range(l):
        c = 0
        for k in range(m):
            c += a1[i][k]*a2[k][j]
        line.append(str(c))
    print(" ".join(line))


Measured memory_bytes: 6244
#include<cstdio>
#include<algorithm>
#include<functional>
using namespace std;
int main(void)
{
	int i,j,p,n,m,a[1000],sum,mi,mx,p2;
	scanf("%d %d",&n,&m);
	for(i=0;i<n;i++)	scanf("%d",&a[i]);
	sum=0;
	p=0;
	while(1)	{
		mi=a[p];	mx=a[p];
		p=(p+1)%n;
		for(i=1;i<m;i++)	{
			mi=min(mi,a[p]);
			mx=max(mx,a[p]);
			p=(p+1)%n;
		}
		sum+=mx-mi;
		if(p==0)	break;
	}
	printf("%d\n",sum);
	return 0;
}


Measured memory_bytes: 2748
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>

using namespace std;

#define INF 0X3F3F3F3F

int findm(int n)
{
	int cnt=0;
	while(n)
	{
		cnt++;
		n/=10;
	}
	//printf("%d\n",cnt);
	return cnt;
}

int findn(long long n)
{
	int nn=sqrt(n),ans=INF;
	for(int i=1;i<=nn;i++)
	{
		if(n%i==0)
		{
			//printf("%d %d\n",i,n/i);
			ans=min(ans,max(findm(i),findm(n/i)));
		}
	}
	return ans;
}

int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	long long n;
	scanf("%lld",&n);
	printf("%d\n",findn(n));
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<utility>
#include<set>
#include<stack>
#include<list>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cstring>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<cmath>
#include<cctype>


#define pb push_back
#define mp make_pair
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define ren(i,a,b) for(int i=a;i>=b;i--)
#define ff first
#define ss second
#define pll pair<long long int,long long int>
#define pii pair<int,int>
#define vll vector<long long int>
#define vii vector<int>
#define gi(n) scanf("%d",&n)
#define gll(n) scanf("%lld",&n)
#define gstr(n) scanf("%s",n)
#define gl(n) cin >> n
#define oi(n) printf("%d",n)
#define oll(n) printf("%lld",n)
#define ostr(n) printf("%s",n)
#define ol(n) cout << n
#define os cout<<" "
#define on cout<<"\n"
#define o2(a,b) cout<<a<<" "<<b
#define all(n) n.begin(),n.end()
#define present(s,x) (s.find(x) != s.end())
#define cpresent(s,x) (find(all(s),x) != s.end())
#define tr(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++)
using namespace std;

typedef unsigned long long int ull;
typedef long long int ll;
typedef vector<vector<ll> > mat;

int b[1000005]={0};

int main()
{ios_base::sync_with_stdio(false);
int n;
cin>>n;
vector<pii> v;

set<int> s;
rep(i,1,n)
{
	int x;
	cin>>x;
	v.pb(mp(x,i));
	s.insert(x);
}
sort(all(v));

rep(i,0,n-1)
{
	int c=0;
	rep(j,1,v[i].ff-1)
	{
		if(c==v[i].ss-1)break;
		if(!b[j])
		{
			c++;
			b[j]=v[i].ss;
		}
	}
	if(c!=v[i].ss-1)
	{
		ol("No");
		return 0;
	}
	b[v[i].ff]=v[i].ss;
}

ren(i,n-1,0)
{
	int c=0;
	rep(j,v[i].ff+1,n*n)
	{
		if(c==n-v[i].ss)break;
		if(!b[j])
		{
			c++;
			b[j]=v[i].ss;
		}
	}
	if(c!=n-v[i].ss)
	{
		ol("No");
		return 0;
	}
}

ol("Yes\n");
rep(i,1,n*n)
{
	ol(b[i]);os;
}

return 0;
}


Measured memory_bytes: 2176
p = int(input())
A = [[1]*p for _ in range(p)]
a = list(map(int,input().split()))
for n in range(p):
    for m in range(p-1):
        A[n][m+1] = n*A[n][m]%p

c = [0]*p
f = [1]*p

for n in range(1,p):
    f[n] = n*f[n-1]%p

for m in range(p):
    c[m] = f[p-1]*pow(f[m],p-2,p)*pow(f[p-1-m],p-2,p)%p

b = [0]*p

for n in range(p):
    if a[n] == 0:
        continue
    b[0] += 1
    b[0] %= p
    for m in range(p):
        b[m] -= A[n][p-1-m]*c[m]*(1-(m%2)*2)
        b[m] %= p

print(' '.join([str(x) for x in b]))

Measured memory_bytes: 114652
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
const ll LINF=0x1fffffffffffffff;
const int INF=0x3fffffff;
const int MOD=1000000007;
#define VAR(type,...) type __VA_ARGS__;in(__VA_ARGS__)
#define VEC(type,name,size) vector<type> name(size);each(x, name)in(x)
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define rrep(i,a,b) for(int i=(a-1);i>=(b);--i)
#define each(x,v) for(auto &x:(v))
#define all(x) (x).begin(),(x).end()
#define print(x) cout<<(x)<<endl
void in(){} template<class T,class... U> void in(T &t,U &...u){cin>>t;in(u...);}
void solve();
int main(){cin.tie(0);ios::sync_with_stdio(0);solve();}

void solve() {
  VAR(int, H, W, N);
  VEC(int, a, N);
  int c = 0;
  rep(i, 0, H) {
    string s;
    rep(j, 0, W) {
      if (i % 2) {
        s = to_string(c + 1) + " " + s;
      } else {
        s += to_string(c + 1) + " ";
      }
      if (--a[c] == 0) c++;
    }
    print(s);
  }
}


Measured memory_bytes: 384
#include<iostream>
#include<vector>
#include<string>
#include<array>
#include<algorithm>
#include<list>
#include<cmath>
#include<iomanip>
#include<queue>
#include<functional>
#include<climits>
#include<iterator>
#include<unordered_map>

//#include"GraphAlgorithm.hpp"
//#include"DataStructure.hpp"
//using namespace graph_algorithm;
//using namespace data_structure;

using namespace std;

const double pi=4*atan(1.0);

int mod=1000000007;

pair<int,int> get_height(int root,const vector<vector<pair<int,int>>>& WeightEdges){
	if(WeightEdges.empty() || root<0 || WeightEdges.size()-1<root)return make_pair(-1,-1);

	pair<int,int> ans=make_pair(0,0);
	vector<bool> IsVisit(WeightEdges.size(),false);
	queue<pair<int,int>> Q;
	Q.push(make_pair(root,0));
	IsVisit[root]=true;

	while(!Q.empty()){
		auto now=Q.front();
		Q.pop();

		bool is_leaf=true;
		for(const auto& val:WeightEdges[now.first]){
			if(!IsVisit[val.first]){
				IsVisit[val.first]=true;
				is_leaf=false;
				Q.push(make_pair(val.first,now.second+val.second));
			}
		}

		if(is_leaf){
			if(now.second>ans.second){
				ans=now;
			}
		}
	}

	return ans;
}

pair<int,int> get_height_dfs_helper(int root,const vector<vector<pair<int,int>>>& WeightEdges,vector<bool>& IsVisit){
	if(WeightEdges.empty() || root<0 || WeightEdges.size()-1<root)return make_pair(-1,-1);

	IsVisit[root]=true;
	pair<int,int> ans=make_pair(-1,-1);
	for(const auto& val:WeightEdges[root]){
		if(!IsVisit[val.first]){
			auto tmp=get_height_dfs_helper(val.first,WeightEdges,IsVisit);
			if(ans.second<tmp.second+val.second){
				tmp.second+=val.second;
				ans=tmp;
			}
		}
	}

	if(ans.first<0)return make_pair(root,0);
	else return ans;
}

pair<int,int> get_height_dfs(int root,const vector<vector<pair<int,int>>>& WeightEdges){
	if(WeightEdges.empty() || root<0 || WeightEdges.size()-1<root)return make_pair(-1,-1);

	vector<bool> IsVisit(WeightEdges.size(),false);
	return get_height_dfs_helper(root,WeightEdges,IsVisit);
}

int main() {
	int n;
	cin>>n;
	vector<vector<pair<int,int>>> Edges(n);
	for(int i=0;i<n-1;++i){
		int u,v,w;
		cin>>u>>v>>w;
		Edges[u].push_back(make_pair(v,w));
		Edges[v].push_back(make_pair(u,w));
	}

	auto farthest=get_height_dfs(0,Edges);
	farthest=get_height_dfs(farthest.first,Edges);

	cout<<farthest.second<<endl;

	//system("pause");
	return 0;
}

Measured memory_bytes: 15960
using System;

namespace ConsoleApplication26
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            double a = double.Parse(input[0]);
            double b = double.Parse(input[1]);
            double c = double.Parse(input[2]);
            double h = b * Math.Sin(c * (Math.PI / 180));
            double S = (a * (b * Math.Sin(c * (Math.PI / 180)))) / 2;
            double x = Math.Sqrt(Math.Pow(h, 2) + Math.Pow(a - b * Math.Cos(c * (Math.PI / 180)), 2));
            double L = a + b + x;
            Console.WriteLine("{0:f5}", S);
            Console.WriteLine("{0:f5}", L);
            Console.WriteLine("{0:f5}", h);
        }
    }
}

Measured memory_bytes: 9496
#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <math.h>
#include <algorithm>
using namespace std;

int main() {
  int N,A;
  cin >> N >> A;
  vector<int> L(N);
  vector<int> D(N+1);
  D[0] = 0;
  int cnt=1;
  
  for(int i=0; i<N; ++i) cin >> L[i];
  for(int i=0; i<N; ++i){
    D[i+1] = D[i] + L[i];
    if(D[i+1] <= A) ++cnt;
  }
  cout << cnt << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mod 1000000007
#define ll long long int
#define pb(x) push_back(x)
#define MP(x,y) make_pair(x,y)
using namespace std;
ll pow(ll a, ll b, ll m)
{
	if(b==0)
		return(1);
	ll sol=pow(a,b/2,m);
	sol=(sol*sol)%m;
	if(b%2==1)
		sol=(sol*a)%m;
	return(sol);
}
string s;
void solve()
{
	int a,b,c,sol=0;
	cin>>a>>b>>c;
	sol=a*100+b*10+c;
	if(sol%4==0)
	{
		cout<<"YES";
	}
	else
	{
		cout<<"NO";
	}
}

int main()
{
    int t=1,num=1;
    //cin>>t;
    while(t--)
    {	
        solve();
        //printf("Case #%d: %s\n",num,s);
		//num++;
    }
    return 0;
}


Measured memory_bytes: 256