akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define int long long
#define all(a) a.begin(),a.end()
#define sz(a) a.size()
#define re return 
#define MP make_pair
#define pb push_back
#define pii pair<int,int>
#define se second
#define fi first
using namespace std;
int a[200005];
int n;
int ans;
signed main(){
	ios_base::sync_with_stdio(0);
	cin>>n;
	for(int i=0;i<n;i++) cin>>a[i];
	for(int i=1;i<n;i++){
		if(a[i]<a[i-1]){
			ans+=a[i-1]-a[i];
			a[i]=a[i-1];
		}
	}
	cout<<ans;
	re 0;
}

Measured memory_bytes: 5156
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
namespace AtCoder
{
    class Program
    {
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }
        static long Mod = (long)1e9 + 7;
        static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            var S = ReadLine();
            var N = S.Length;
            var all = (1 << (N - 1));
            var ans = 0L;
            for (var i = 0; i < all; ++i)
            {
                var mask = 1L;
                var plusPos = new List<int>() { 0 };
                for (var j = 0; j < N - 1; ++j, mask <<= 1) 
                {
                    if ((i & mask) != 0)
                        plusPos.Add(j + 1);
                }
                plusPos.Add(N);
                for (var j = 0; j < plusPos.Count - 1; ++j)
                {
                    var subS = S.Substring(plusPos[j], plusPos[j + 1] - plusPos[j]);
                    ans += long.Parse(subS);
                }
            }
            WriteLine(ans);
            //Out.Flush();
        }
    }
}

Measured memory_bytes: 13140
#include<stdio.h>

int main()
{
    int n,temp,even=0,app=0;

    scanf("%d",&n);

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

        if(temp%2==0)
        {
            even++;
            if(temp%3==0 || temp%5==0)
                app++;
        }
    }

    if(even==app)
        printf("APPROVED");
    else
        printf("DENIED");

    return 0;
}


Measured memory_bytes: 128
// #define DEBUGGING
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ALL(V) (V).begin(), (V).end()
#define ALLR(V) (V).rbegin(), (V).rend()

template <typename T> using V = vector<T>;
template <typename T> using VV = V<V<T>>;
using ll = int64_t;
using ull = uint64_t;
using PLL = pair<ll, ll>;

template <typename T> const T& var_min(const T &t) { return t; }
template <typename T> const T& var_max(const T &t) { return t; }
template <typename T, typename... Tail> const T& var_min(const T &t, const Tail&... tail) { return min(t, var_min(tail...)); }
template <typename T, typename... Tail> const T& var_max(const T &t, const Tail&... tail) { return max(t, var_max(tail...)); }
template <typename T, typename... Tail> void chmin(T &t, const Tail&... tail) { t = var_min(t, tail...); }
template <typename T, typename... Tail> void chmax(T &t, const Tail&... tail) { t = var_max(t, tail...); }
template <typename T> const T& clamp(const T &t, const T &low, const T &high) { return max(low, min(high, t)); }
template <typename T> void chclamp(T &t, const T &low, const T &high) { t = clamp(t, low, high); }

namespace init__ {

struct InitIO {
    InitIO() {
        cin.tie(nullptr);
        ios_base::sync_with_stdio(false);
        cout << fixed << setprecision(30);
    }
} init_io;

}

#ifdef DEBUGGING
// #include "../debug/debug.cpp"
#include "../../debug/debug.cpp"
#else
#define DEBUG(...) 0
#define DEBUG_SEPARATOR_LINE 0
#endif

template <typename T>
T make_v(T init) { return init; }

template <typename T, typename... Tail>
auto make_v(T init, size_t s, Tail... tail) {
#define rec make_v(init, tail...)
    return V<decltype(rec)>(s, rec);
#undef rec
}

bool check(const V<ll> &A, ll K, ll mod) {
    V<ll> modp, modm;
    ll N = A.size();
    for(auto &&ele : A) {
        ll tmp = ele % mod;
        if(tmp == 0) {
            N--;
            continue;
        }
        modp.push_back(tmp);
        modm.push_back((mod - tmp) % mod);
    }

    sort(ALL(modp));
    sort(ALL(modm));
    if(N == 0) return true;
    ll sump = modp[0], summ = modm[0];
    DEBUG(modp, modm);
    ll pidx = 1, midx = 1;
    while(pidx + midx < N) {
        if(sump < summ) {
            sump += modp[pidx];
            pidx++;
        } else {
            summ += modm[midx];
            midx++;
        }
    }
    DEBUG(make_tuple(mod, sump, summ, pidx, midx));
    if(abs(sump - summ) % mod) return false;
    return max(sump, summ) <= K;
}

int main() {
    ll N, K;
    cin >> N >> K;
    V<ll> A(N);
    for(auto &&ele : A) cin >> ele;
    ll sum = accumulate(ALL(A), 0ll);
    ll ans = 1;
    for(ll i = 1; i * i <= sum; i++) {
        if(sum % i) continue;
        if(check(A, K, i)) chmax(ans, i);
        if(check(A, K, sum / i)) chmax(ans, sum / i);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define mod 1000000007ll
#define mod1 998244353ll
#define endl "\n"
#define inf (ll)1e18+1
using namespace std::chrono;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    ll n,m;
    cin>>n>>m;
    vector<pair<ll,string>> ar(m);
    for(ll x=0;x<m;x++){
        cin>>ar[x].first>>ar[x].second;
    }
    vector<pair<ll,ll>> dp(n+1);
    for(ll x=0;x<m;x++){
        if(ar[x].second=="AC"){
            dp[ar[x].first].first++;
        }else{
            if(dp[ar[x].first].first==0){
                dp[ar[x].first].second++;
            }
        }
    }
    ll c=0,p=0;
    for(ll x=1;x<=n;x++){
        if(dp[x].first>0){
            c++;
            p+=dp[x].second;
        }
        
    }
    cout<<c<<" "<<p<<endl;
    return 0;
}

Measured memory_bytes: 8064
#include<bits/stdc++.h>
#define lld long long int
#define ld long double
#define mod 1000000007
#define modd 998244353
#define all(v) v.begin(),v.end()
#define rep(i,a,b)	for(lld i=a;i<=b;i++)
#define repr(i,a,b) for(lld i=a;i>=b;i--)
#define ar array
#define pb push_back
#define mp make_pair
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
lld n,m;
lld arr[300000];
lld brr[300000];
lld sol(){
    sort(arr,arr+n,greater<lld>());
    lld ret=0;
    rep(i,0,n-1)brr[i]=0;
    rep(i,0,n-1){
        ret+=arr[i]/n;
        brr[i]=arr[i]/n;
    }
    rep(i,0,n-1)arr[i]=arr[i]%n+ret-brr[i];
    return ret;
}
int main()
{
     ios;
     lld TESTS,q,a,s,b,l,r,c,k,p,h,w,d,x,y,z,xs,ys,t;
     TESTS=1;
     //memset(brr,-1,sizeof(brr));
     //cin>>TESTS;
     while(TESTS--)
     {
         cin>>n;
         rep(i,0,n-1)cin>>arr[i];
         lld ans=0;
         lld x=sol();
         while(x){
            ans+=x;
            x=sol();
         }
         cout<<ans<<"\n";
     }
    return 0;
}


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

using namespace std;

typedef long long ll;

const int MAX_N = 2e5 + 10;
const ll BASE = 1e9;

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

int main() {
    scanf("%d", &N);
    for (int i = 1; i <= N; i++) {
        double _a; scanf("%lf", &_a);
        ll a = _a * BASE + 0.5;
        int cnt2 = 0, cnt5 = 0;
        while (a % 2 == 0) cnt2++, a /= 2;
        while (a % 5 == 0) cnt5++, a /= 5;
        mp[make_pair(cnt2, cnt5)]++;
    }
    ll ans = 0;
    for (auto i : mp) {
        for (auto j : mp) {
            if (i.first <= j.first && i.first.first + j.first.first >= 18 && i.first.second + j.first.second >= 18) {
                if (i.first == j.first) {
                    ans += i.second * (i.second - 1) / 2;
                } else {
                    ans += i.second * j.second;
                }
            }
        }
    }
    printf("%lld\n", ans);
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
#define REP(i, n) for(int i=0; i<n; i++)
#define REPi(i, a, b) for(int i=int(a); i<int(b); i++)
#define MEMS(a,b) memset(a,b,sizeof(a))
#define mp make_pair
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll MOD = 1e9+7;

int main(){
    ll N;
    cin >> N;
    vector<ll> A;
    REP(i,N){
        ll a;
        cin >> a;
        A.push_back(a);
        A.push_back(a);
    }
    sort(A.rbegin(), A.rend());

    ll ans = 0;
    for(int i = 1; i < N; i++){
        ans += A[i];
    }

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


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

#define rep(a,b) for(int a = 0;a < b;a++)
#define REP(i, x, n) for(int i = x; i < n; i++)
#define P(a) cout << a << endl
#define mp(a,b) make_pair(a,b)
#define ssort(v) sort(v.begin(),v.end())
#define rev(v) reverse(v.begin(),v.end())
#define vP(v) for(int i = 0;i < v.size();i++){cout << v[i];if(i != v.size()-1)cout << endl;}
#define vcin(v,n) rep(i,n){int a;cin >> a;v.pb(a);}

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

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

long long stoi(string str) {
	long long ret;
	stringstream ss; ss << str;
	ss >> ret;
	return ret;
}

ull gcd(ull a, ull b) {
	if (b > a)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a%b);
}
void solve() {
	int n;
	cin >> n;
	vector<int> v;
	int count = 0;
	rep(i, n) {
		int a;
		cin >> a;
		v.push_back(a);
	}
	rep(i, n-1) {
		if (v[i] == i+1) {
			swap(v[i], v[i + 1]);
			count++;
		}
	}
	if (v[n - 1] == n) {
		swap(v[n - 2], v[n - 1]);
		count++;
	}
	P(count);
}

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


Measured memory_bytes: 892
import java.util.*;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String n = sc.next();

    int sum = 0;

    for (int i = 0; i < n.length(); i++) {
      char c = n.charAt(i);
      String s = String.valueOf(c);
      int k = Integer.parseInt(s);
      sum += k;
    }

    if (Integer.parseInt(n) % sum == 0) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }

  }

}


Measured memory_bytes: 23252
#include<bits/stdc++.h>
using namespace std;
int n,a[11111];
int main(){
	scanf("%d",&n);
	for(int i=0; i<n; i++){
		scanf("%d",&a[i]);
	}
	int res = 0;
	for(int i=0,j; i<n; i=j){
		for(j=i; j<n && a[j]==a[i]; j++);
		res += (j-i)/2;
	}
	printf("%d\n",res);
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define MP make_pair
#define PB push_back
#define PII pair<int,int>
#define ll long long
int N=INT_MAX;
const ll INF=1e18L+5;
map<int ,int>my;
//vector<PII>v[1000005];

int main(){
    int n,w;
    cin>>n>>w;
    vector<ll>dp(w+1,0);
    for(int i=0;i<n;i++){
        ll weight,value;
        cin>>weight>>value;
        for(int j=w-weight;j>=0;j--){
            dp[j+weight]=max(dp[j+weight],dp[j]+value);
        }
    }
    ll ans=0;
    for(ll i:dp){
        ans=max(ans,i);
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 1024
s = input()
s = s[::-1]
t = input()
t = t[::-1]
tmp = -1
l = len(t)
ls = len(s)
for i in range(ls-l+1):
    for j in range(l):
        if s[i+j] != t[j] and s[i+j] != '?':
            break
        if j == l-1 and tmp == -1:
            tmp = i
if tmp == -1:
    print("UNRESTORABLE")
    exit()
s = s[:tmp] + t + s[tmp+len(t):]
s = s[::-1]
print(s.replace('?','a'))
            

Measured memory_bytes: 3064
n,d = list(map(int, input().split()))
x = list([list(map(int,input().split())) for i in range(n)])

_d=d**2

ans=0
for i in x:
    if  i[0]**2+i[1]**2<=_d:
        ans+=1
    else:
        pass

print(ans)

Measured memory_bytes: 46960
/******************************************
******************************************/
#include <bits/stdc++.h>
using namespace std;
#define LL long long
#define N 100005
#define MOD 1000000007
#define dd double
#define fin for(int i = 0; i < n; i++)
#define fiab for(int i=a;i<b;i++)
#define fi1b for(int i=1;i<=b;i++)
#define pb push_back
#define mp make_pair
#define clr(x) x.clear()
#define sz(x) ((int)(x).size())
#define F first
#define S second
int m;
// long frog1(int i){
//  if(i>=n-1){
//      return 0;
//  }
//  else{
//      if(i<n-2){
//      return(min(abs(h[i+1]-h[i])+frog1(i+1),abs(h[i+2]-h[i])+frog1(i+2))); 
// }else if(i==n-2){
//  return(abs(h[n-1]-h[n-2])+frog1(n-1));


// }
// }}
LL max(LL a,LL b){
  return((a>b)?a:b);
}LL min(LL a,LL b){
  return((a<b)?a:b);
}
LL Abs(LL a){
  return(max(a,-a));
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
ios_base& scientific (ios_base& str);

//  #ifndef ONLINE_JUDGE
//     // for getting input from input.txt
//     freopen("input.txt", "r", stdin);
//     // for writing output to output.txt
//     //this can be opted out if you want to print the output to the sublime console
//     freopen("output.txt", "w", stdout);
// #endif
     
int n,k;

     cin>>n>>k; 
     LL dp[n+5];
     LL h[n+5];
     fin{
        cin>>h[i];
     }
     for(int i=0;i<=n;i++){
        dp[i]=1e9;
     }
      dp[0]=0;
      dp[1]=Abs(h[1]-h[0]);
      for(int i=2;i<n;i++){
         
        for(int j = i - 1; j >= max(0, i - k); j--)
             {
                dp[i]=min(dp[i],dp[j]+Abs(h[i]-h[j])); 
            }
        } 
        
      

            cout<<dp[n-1]<<endl;
return 0;
}


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

int main(){
	ll h,w,n; cin >> h >> w >> n;
	ll painted = 0;
	ll paint = 0;
	while(true){
		paint++;
		if(w >= h){
			painted += w;
			h--;
		}
		else{
			painted += h;
			w--;
		}
		if(painted >= n){
			cout << paint << endl;
			break;
		}
	}
}

Measured memory_bytes: 256
n = int(raw_input())
a = [int(raw_input()) for i in range(n)]
res = 0
m = 0
for i, e in enumerate(a):
    if e - (m+1) > 0:
        t = e - (m+1)
        if t % (m+1) == 0:
            res += t / (m+1)
            m = min(m, e - t)
        else:
            res += t / (m+1) + 1
    else:
        m = max(e, m)
    if m == 0:
        m += 1
print res


Measured memory_bytes: 8964
#include <iostream>
#include <numeric>
#include <string>
#include <algorithm>
#include <vector>
#include <cstdlib>
#include <cmath>
#include <utility>

#define repd(i,a,b); for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define ll long long int
 
int gcm(int a, int b) {
	int result = a;
	int k = 0;
	int n = b;
	do {
		k = result % n;
		result = n;
		n = k;
	} while(k != 0);
	return result;
}
 
using namespace std;
int main() {
  int n,x; cin >> n >> x;
  int p[n]; 
  rep(i,n){
    cin >> p[i];
  }
  int g=p[0]-x;
  rep(j,n){
    g=gcm(g,p[j]-x);
  }
  cout << abs(g);
  
  
 
 return 0;
}

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

int main(){
    long long N;
    int K;
    cin >>N>>K;
    if(N==0){
        cout <<1<<endl;
        return 0;
    }
    for(int i=0;i<50;i++){
        if(N==pow(K,i)){
            cout<<i+1;
            return 0;
        }
        if(N<pow(K,i)){
            cout <<i;
            return 0;
        }
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
using namespace std;

int main(int argc,char const* argv[])
{
  string s;
  int n,sn;
  vector <int> decidec(26,51);
  int length=0;
  cin >> n;
  for(int i=0;i<n;i++)
    {
      cin >> s;
      sn=s.size();
      vector <int> alphac(26,0);
      for(int i=0;i<sn;i++)
	{
	  alphac[s[i]-'a']++;
	}
      for(int i=0;i<26;i++)
	{
	  if(alphac[i]<decidec[i]) decidec[i]=alphac[i];
	}
    }
  for(int i=0;i<26;i++)
    {
      length+=decidec[i];
    }
  string ans;
  for(int i=0;i<26;i++)
    {
      for(int j=1;j<=decidec[i];j++)
	{
	  ans+='a'+i;
	}
    }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <string>
#include <vector>
#include <iomanip>
#include <iostream>
#include <algorithm>
#include <functional>
using namespace std;
int H, W; string s[9];
int main() {
	cin >> H >> W;
	for (int i = 0; i < H; i++) cin >> s[i];
	int cnt = 0;
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			if (s[i][j] == '#') cnt++;
		}
	}
	cout << (cnt == H + W - 1 ? "Possible" : "Impossible") << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n,arr[100009];
int main(){
    cin>>n;
    for(int i=0;i<2*n;i++)cin>>arr[i];
    sort(arr,arr+2*n);
    int ans = 0;
    for(int i=0;i<2*n;i+=2){
        ans += arr[i];
    }
    cout<<ans<<endl;
}


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

#define MOD (1000000000+7)

int main() {
	int N, M;

	cin >> N >> M;
	vector<int> a( N + 1 );
	for( int i = 0; i < M; i++ ) {
		int j;
		cin >> j;
		a[j]++;
	}

	vector<long long> dp( N + 1 );
	dp[0] = 1;
	for( int i = 0; i < N; i++ ) {
		for( int j = i + 1; j <= min( i + 2, N ); j++ ) {
			if( a[j] == 0 ) {
				dp[j] += dp[i];
				dp[j] %= MOD;
			}
		}
	}
	long long ans = dp[N];

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1408
#include "bits/stdc++.h"
using namespace std;
#define Would
#define you
#define all(n)  n.begin(),n.end()
#define rall(n) n.rbegin(),n.rend()
typedef long long ll;
const ll INF = 1e18;
const ll MOD = 1e9 + 7;
const double EPS = 1e-10;
const double pi = acos(-1);//3.1415926535897932384626433832795028...
const ll SIZE = 1 << 17;
int dx[] = { 1,0,-1,0 }, dy[] = { 0,1,0,-1 }, alp[30];
ll fac[200005], finv[200005], inv[200005];
vector<ll>dij;
struct edge { ll to, cost; };
vector<vector<edge> >G;

ll mod_pow(ll a, ll b) {
	ll res = 1, mul = a;
	for (int i = 0; i < 31; ++i) {
		if (b >> i & 1) {
			res *= mul;
			res %= MOD;
		}
		mul = (mul * mul) % MOD;
	}
	return res;
}

void addedge(int from, int to, int cost) {
	G[from].push_back({ to,cost });
	G[to].push_back({ from,cost });
}

template<typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }

template<typename T, typename... Ts>
auto make_v(size_t a, Ts... ts) {
	return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}

template<typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T & t, const V & v) { t = v; }

template<typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T & t, const V & v) {
	for (auto& e : t) fill_v(e, v);
}

template<typename T>
void outp(vector<T>v) {
	for (int i = 0; i < v.size(); ++i) {
		cout << v[i];
		if (i != v.size() - 1) { cout << " "; }
	}
}

double add(double a, double b) {
	if (abs(a + b) < EPS * (abs(a) + abs(b))) { return 0; }
	return a + b;
}

int main() {
	long double a, b, c;
	cin >> a >> b >> c;
	long double mon = c / a;

	long double mon2 = (2 * mon) / b;

	if (mon2 < a) {
		cout << setprecision(20) << atan2(b, mon2) * (180 / pi) << endl;
	}
	else {
		long double mon3 = (2 * mon) / a - b;
		cout << setprecision(20) << atan2(b - mon3, a) * (180 / pi) << endl;
	}
}


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

n,m=map(int,input().split())
L=list(map(int,input().split()))

def gcd(a,b):
    while b:
        a,b=b,a%b
    return a

def lcm(a,b):
    return (a*b)//gcd(a,b)

def count2(x):
    c=0
    while x%2==0:
        x//=2
        c+=1
    return c

c2=count2(L[0])
LCM = 1

for i in L:
    if count2(i)!=c2:
        print(0)
        sys.exit()
    LCM = lcm(i//2,LCM)
    if LCM>m:
        print(0)
        sys.exit()
print(max(0,(m-LCM)//(2*LCM)+1))




Measured memory_bytes: 84748
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;

const ll INF64 = 1LL << 60;
const int INF32 = 1 << 29;
const int MOD = 1000000007;

// Lib
//

int main(){
#ifdef MYLOCAL
    ifstream in("input.txt");
    cin.rdbuf(in.rdbuf());
#endif
    string S; cin >> S;
    map<char, bool> mp;
    for (int i = 0; i < S.size(); ++i){
        mp[S[i]] = true;
    }

    bool flag = true;
    if (mp['N'] != mp['S']){
        flag = false;
    }
    if (mp['W'] != mp['E']){
        flag = false;
    }

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


Measured memory_bytes: 256
#include <cstdlib>
#include <iostream>
#include <unordered_map>



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

  std::unordered_map<int, int> path;

  for (int i = 0; i < 3; i++) {
    int a, b;
    std::cin >> a >> b;
    path[a]++;
    path[b]++;
  }

  int n1 = 0, n2 = 0;
  for (int i = 1; i <= 4; i++) {
    if (path[i] == 1) {
      n1++;
    } else if (path[i] == 2) {
      n2++;
    }
  }
  std::cout << (n1 == 2 && n2 == 2 ? "YES" : "NO") << std::endl;

  return EXIT_SUCCESS;
}


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

int main(void){
    int n;
    int y, m, d;
    cin >> n;
    rep(loop, n) {
        cin >> y >> m >> d;
        int day = 0;
        day += d;
        day += 20 * (m-1);
        if(y%3 != 0) day -= (m-1)/2;
        day += 590 * ((y-1) / 3);
        day += 195 * ((y-1) % 3);
        cout << 196471-day << endl;
    }
}

Measured memory_bytes: 1160
s = gets.to_i

if s < 3
  puts 0
else
  size = s / 3
  answer = 1
  (2..size).each do |n|
    rest = s - (3 * n)
    if rest.zero?
      answer += 1
    else
      a = n + rest - 1
      b = rest
      answer += (a - b + 1..a).inject(1, :*) / (1..b).inject(1, :*)
    end
  end

  puts answer % (10 ** 9 + 7)
end


Measured memory_bytes: 18364
N, A, B = gets.chomp.split.map(&:to_i)
ans = 0
for i in 1...N+1
  t = i
  s = 0
  while t > 0
    s += t%10
    t /= 10
  end
  if s >= A && s <= B
    ans += i
  end
end
puts(ans)

Measured memory_bytes: 1916
#include <iostream>
#include <array>
#include <algorithm>
#include <map>
#include <vector>
#include <list>
#include <cmath>
#include <stack>
#include <queue>
#include <climits>

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

const int mod = 1000000007;
struct mint {
	ll x; // typedef long long ll;
	mint(ll 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;
	}
};

struct combination {
	vector<mint> fact, ifact;
	combination(int n) :fact(n + 1), ifact(n + 1) {
		fact[0] = 1;
		for (int i = 1; i <= n; ++i) fact[i] = fact[i - 1] * i;
		ifact[n] = fact[n].inv();
		for (int i = n; i >= 1; --i) ifact[i - 1] = ifact[i] * i;
	}
	mint operator()(int n, int k) {
		if (k < 0 || k > n) return 0;
		return fact[n] * ifact[k] * ifact[n - k];
	}
} comb(2000005);

mint g(int r, int c) {
	return comb(r + c + 2, r + 1) - 1;
}

bool comp(int i, int j) {
	return i > j;
}

int main()
{
	int a, b, c;
	cin >> a >> b >> c;
	int m = min(a - b, c);
	cout << (c - m);
}


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

const ll mod=1e9+7;
ll fastpow(ll a, ll n)
{
    if(n == 0) return 1;
    ll x = fastpow(a, n/2);
    ll ans = x * x % mod;
    if(n % 2 == 1) ans = ans *a % mod;
    return ans%mod;
}

ll C(ll n,ll m) {
    if(n < m) return 0;
    ll res = 1;
    for(ll i=1; i<=m; i++) {
        ll a = (n+i-m)%mod;
        ll b = i%mod;
        res = res*(a*fastpow(b,mod-2)%mod)%mod;
    }
    return res;
}

ll Lucas(ll n,ll m) {
    if(m == 0) return 1;
    return C(n%mod, m%mod) * Lucas(n/mod,m/mod)%mod;
}

ll n,a,b;
int main(){
    cin>>n>>a>>b;
    ll ans=fastpow(2,n)-Lucas(n,a)-Lucas(n,b)-1;
   while(ans<0) {
        ans+=mod;
    }
    cout<<ans%mod;
    return 0;
}


Measured memory_bytes: 256
while True :
    try :
        a = [int(_) for _ in input().split()]
        b = [int(_) for _ in input().split()]
        hit, blow = 0, 0
        for _ in range(4) :
            if a[_] == b[_] : hit += 1
            elif b[_] in a : blow += 1
        print(hit, blow)
    except : break

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



int main() {
	int N;
	cin >> N;
	string S , T;
	cin >> S >> T;

	string ans;
	for (int i = 0; i < N; i++) {
		ans.push_back(S[i]);
		ans.push_back(T[i]);
	}
	
	cout << ans << endl;
}


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

int main(){
    int A,B;
    cin>>A>>B;
    int res=-1;
    for(int i=0;i<1200;i++){
        if(i*8/100==A && i*10/100==B){
            res=i;
            break;
        }
    }
    cout<<res<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())

struct UnionFind {
    UnionFind() {}
    UnionFind(int n) {
        resize(n);
    }
    
    void resize(int n) {
        par.resize(n, -1);
    }
    
    int root(int x) {
        if (par[x] < 0) return x;
        return par[x] = root(par[x]);
    }
    
    bool merge(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        if (rx == ry) return false;
        if (par[rx] > par[ry]) swap(rx, ry);
        par[rx] += par[ry];
        par[ry] = rx;
        return true;
    }
    
    bool is_same(int x, int y) {
        return (root(x) == root(y));
    }
    
    int size(int x) {
        return -par[root(x)];
    }
    
private:
    vector<int> par;
};

const ll d[4][2] = {{0, -1}, {1, 0}, {0, 1}, {-1, 0}};
ll h, w;
vector<string> s;
vector<vector<bool>> visited;
UnionFind uf;
vector<vector<ll>> cnt;

void dfs(ll y, ll x, bool root = false) {
    if (visited[y][x]) return;
    visited[y][x] = true;
    if (root) cnt[uf.root(y * w + x)][(s[y][x] == '#') ? 1 : 0]++;
    rep(i, 4) {
        ll nx = x + d[i][0];
        ll ny = y + d[i][1];
        if ((nx < 0) || (nx >= w) || (ny < 0) || (ny >= h)) continue;
        if (visited[ny][nx]) continue;
        if (s[y][x] == s[ny][nx]) continue;
        uf.merge(y * w + x, ny * w + nx);
        cnt[uf.root(ny * w + nx)][(s[ny][nx] == '#') ? 1 : 0]++;
        dfs(ny, nx);
    }
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // std::ifstream in("input.txt");
    // std::cin.rdbuf(in.rdbuf());
    cin >> h >> w;
    s.resize(h);
    rep(i, h) cin >> s[i];
    visited.resize(h, vector<bool>(w, false));
    uf = UnionFind(h * w);
    cnt.resize(h * w, vector<ll>(2, 0));
    rep(i, h) {
        rep(ii, w) {
            if (s[i][ii] == '#') dfs(i, ii, true);
        }
    }
    ll ans = 0;
    rep(i, h * w) {
        if ((cnt[i][0] == 0) || (cnt[i][1] == 0)) continue;
        ans += cnt[i][0] * cnt[i][1];
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 39808
#include <stdio.h>

#define swap(type, x, y) do { type t = x; x = y; y = t; } while (0)

typedef struct {
	int id;
	char pat;
	int num;
} Card;

void BubbleSort(Card *c, int n)
{
	int i, j;
	for (i = 0; i < n - 1; i++)
	{
		for (j = n - 1; j >= i + 1; j--)
		{
			if ((c + j)->num < (c + j - 1)->num)
			{
				swap(Card, *(c + j), *(c + j - 1));
			}
		}
	}
}

void SelectionSort(Card *c, int n)
{
	int i, j, m;
	for (i = 0; i < n - 1; i++)
	{
		m = i;
		for (j = i; j < n; j++)
		{
			if ((c+j)->num < (c+m)->num) m = j;
		}
		swap(Card, *(c + i), *(c + m));
	}
}

void copy(Card *c1, Card *c, int n)
{
	int i;
	Card *cp, *cp1;
	for (i = 0; i < n; i++)
	{
		cp = c + i;
		cp1 = c1 + i;

		cp1->id = cp->id;
		cp1->pat = cp->pat;
		cp1->num = cp->num;
	}
}

void dump(const Card *c, int n)
{
	int i;

	for (i = 0; i < n; i++)
	{
		printf("%c%d", (c + i)->pat, (c + i)->num);
		if (i < n - 1) printf(" ");
	}
	printf("\n");
}

int isStable(Card *c, int n)
{
	Card w = { -1,' ',-1 };
	Card *cp;
	int i = 0;
	int f = 1;

	while (i < n && f)
	{
		cp = (c + i);
		if (cp->num == w.num && cp->id < w.id) f = 0;
		w.num = cp->num;
		w.id = cp->id;
		i++;
	}

	return f;
}

void checkStable(Card *c, int n)
{
	if (isStable(c, n)) printf("Stable\n");
	else printf("Not stable\n");
}

int main()
{
	int n, i;
	char w[3];
	Card c[36], c1[36];

	scanf("%d", &n);
	for (i = 0; i < n; i++)
	{
		scanf("%2s", w);
		c[i].id = i;
		c[i].pat = w[0];
		c[i].num = w[1] & 0x0F;
	}

	copy(c1, c, n);
	BubbleSort(c1, n);
	dump(c1, n);
	checkStable(c1, n);
	
	copy(c1, c, n);
	SelectionSort(c1, n);
	dump(c1, n);
	checkStable(c1, n);

	return 0;
}

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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}


int nextInt() { int x; scanf("%d", &x); return x;}
ll nextLong() { ll x; scanf("%lld", &x); return x;}

const int MAX_N = 112345;
ll a[MAX_N];
ll b[MAX_N];

int main2() {
  int A = nextInt();
  int B = nextInt();
  int M = nextInt();
  REP(i, A) a[i] = nextInt();
  REP(i, B) b[i] = nextInt();

  ll minA = *min_element(a, a+A);
  ll minB = *min_element(b, b+B);
  ll ans = minA + minB;
  REP(i, M) {
    int x = nextInt() - 1;
    int y = nextInt() - 1;
    ll c = nextInt();
    chmin(ans, a[x] + b[y] - c);
  }
  cout << ans << endl;
  return 0;
}

int main() {

#ifdef LOCAL
  for (;!cin.eof();cin>>ws)
#endif
    main2();
  return 0;
}

Measured memory_bytes: 1792
S = input()
flag1 = True
flag2 = True
num = int(S)

if S.startswith("00"):
    flag1 = False
elif num // 100 > 12:
    flag1 = False
if S.endswith("00"):
    flag2 = False
elif num % 100 > 12:
    flag2 = False
    
if flag1 == True and flag2 == True:
    print("AMBIGUOUS")
elif flag1 == False and flag2 == False:
    print("NA")
elif flag1 == False:
    print("YYMM")
else:
    print("MMYY")

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
void run_case(){
    string s;
    cin>>s;
    int n=s.length();
    cout<<s;
    if(s[n-1]=='s')cout<<"es";
    else cout<<"s";


}
int main(){
	ios_base::sync_with_stdio(false),cin.tie(nullptr);
    int t=1;
    while(t--){
        run_case();

    }
}



Measured memory_bytes: 3660
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define vi vector<ll>
#define vvi vector<vi>
#define BITLE(n) (1LL<<((ll)n))
#define SHIFT_LEFT(n) (1LL<<((ll)n))
#define SUBS(s,f,t) ((s).substr((f)-1,(t)-(f)+1))
#define ALL(a) (a).begin(),(a).end()
using namespace std;
ll dp[111111][2];
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s;cin>>s;
  ll n = s.size();
  dp[0][1] = 1;
  for(int i=0;i<n;i++){
    if(s[i] == '0'){
      dp[i+1][1] = dp[i][1];
      dp[i+1][0] = dp[i][0]*3;
      dp[i+1][0]%=MOD;
    }else{
      dp[i+1][1] = (dp[i][1]*2)%MOD;
      dp[i+1][0] = (dp[i][1]+dp[i][0]*3)%MOD;
    }
  }
  cout<<(dp[n][1]+dp[n][0])%MOD<<endl;
  return 0;
}


Measured memory_bytes: 2000
#include <iostream>
#include <list>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>

typedef long long ll;

using namespace std;
int main(){
	int N;
    string S;
    cin >> N;
    cin >> S;
    int x = 0;
    int ans = 0;
    for (int i = 0; i < N; i++) {
    	if (S[i] == 'I') {
    		x++;
    	}
    	else {
    		x--;
    	}
    	if (x > ans) {
    		ans = x;
    	}
    } 
    cout << ans << endl;
}


Measured memory_bytes: 256
using System;
using System.Linq;
class Program
{
    static void Main()
    {
        //int[] input = Array.ConvertAll(Console.ReadLine().Split(),int.Parse);
        int input=int.Parse(Console.ReadLine());
        //string a = Console.ReadLine();
        Console.WriteLine(input==3||input==5||input==7?"YES":"NO");
        Console.ReadLine();
    }
}


Measured memory_bytes: 13140
#include <cstdio>

int a,n,maxv;
long long res;

int main()
{
    scanf("%d",&n);
    for(int i=0;i<n;i++)
    {
        scanf("%d",&a);
        if(a>maxv)maxv=a;
        else res+=maxv-a;
    }
    printf("%lld\n",res);
    return 0;
}

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

int n, q;
string name[100100];
int tim[100100];
pair<string, int>pd[100100];
int main()
{
  queue<int>Q;
  queue<string>NA;
  int m;
  int end = 0;
  cin >> n >> q;
  for(int i = 0; i < n; ++i){
    cin >> name[i] >> tim[i];
    pd[i] = make_pair(name[i], tim[i]);
    Q.push(tim[i]);
    NA.push(name[i]);
  }
  while(!Q.empty()){
    if(Q.front() > q){
      end += q;
      m = Q.front() - q;
      Q.pop();
      Q.push(m);
      string s = NA.front();
      NA.pop();
      NA.push(s);
    }else{
      end += Q.front();
      Q.pop();
      cout << NA.front() << " " << end << endl;
      NA.pop();
    }
  }
}


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

typedef long long ll;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define each(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); ++itr)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second

typedef pair<int,int> pi;

const int N=100;
const int INF=123456789;
struct edge{ int to,cost; };
vector<edge> G[N];
int d[N],par[N];

int main()
{
    int n,m;
    scanf(" %d %d", &n, &m);

    set<pi> used;
    rep(i,m)
    {
        int a,b,c;
        scanf(" %d %d %d", &a, &b, &c);
        --a;
        --b;
        G[a].pb(edge{b,c});
        G[b].pb(edge{a,c});
    }

    rep(i,n)
    {
        fill(d,d+N,INF);
        fill(par,par+N,-1);

        // dijkstra
        priority_queue<pi,vector<pi>,greater<pi>> que;
        d[i]=0;
        que.push(pi(0,i));
        while(!que.empty()){
            pi p=que.top();
            que.pop();
            int v=p.se;
            if(d[v]<p.fi) continue;
            rep(j,G[v].size())
            {
                edge e=G[v][j];
                if(d[e.to]>d[v]+e.cost)
                {
                    d[e.to]=d[v]+e.cost;
                    que.push(pi(d[e.to],e.to));
                    par[e.to]=v;
                }
            }
        }

        rep(j,n)if(i!=j)
        {
            int a=j, b=par[j];
            if(a>b) swap(a,b);
            used.insert(pi(a,b));
        }
    }

    cout << m - used.size() << endl;
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>  
#include<iostream>  
#include<algorithm>  
#include<cstdlib>  
#include<cstring>
#include<string>
#include<climits>
#include<vector>
#include<cmath>
#define LL long long

using namespace std;

inline char nc(){
  static char buf[100000],*p1=buf,*p2=buf;
  if (p1==p2) { p2=(p1=buf)+fread(buf,1,100000,stdin); if (p1==p2) return EOF; }
  return *p1++;
}

inline void read(int &x){
  char c=nc(),b=1;
  for (;!(c>='0' && c<='9');c=nc()) if (c=='-') b=-1;
  for (x=0;c>='0' && c<='9';x=x*10+c-'0',c=nc()); x*=b;
}

inline void read(LL &x){
  char c=nc(),b=1;
  for (;!(c>='0' && c<='9');c=nc()) if (c=='-') b=-1;
  for (x=0;c>='0' && c<='9';x=x*10+c-'0',c=nc()); x*=b;
}

int wt,ss[19];
inline void print(int x){
	if (x<0) x=-x,putchar('-'); 
	if (!x) putchar(48); else {for (wt=0;x;ss[++wt]=x%10,x/=10);for (;wt;putchar(ss[wt]+48),wt--);}
}
inline void print(LL x){
	if (x<0) x=-x,putchar('-');
	if (!x) putchar(48); else {for (wt=0;x;ss[++wt]=x%10,x/=10);for (;wt;putchar(ss[wt]+48),wt--);}
}

int main()
{
    string s;
	cin>>s;
    int a,z;
    for (int i=0;i<s.size();i++)
        if (s[i]=='A') {a=i;break;}
    for(int i=s.size()-1;i>=0;i--)
        if (s[i]=='Z') {z=i;break;}
    cout<<z-a+1<<endl;
}

Measured memory_bytes: 640
a,b = map(int,input().split())
l = []
if a % 4 != 0:
    for i in range(a-1,-6,-1):
        l.append(i)
        if i % 4 == 0:
            break
if b % 4 != 3:
    for i in range(b+1,10**12+5):
        l.append(i)
        if i % 4 == 3:
            break
# print(l)
ans = 0
for i in l:
    ans = ans ^ i
print(ans)

Measured memory_bytes: 61848
package main

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

func min(a ...int) int {
	m := a[0]
	for i, v := range a {
		if i == 0 {
			continue
		}
		if m > v {
			m = v
		}
	}
	return m
}

func max(a ...int) int {
	m := a[0]
	for i, v := range a {
		if i == 0 {
			continue
		}
		if m < v {
			m = v
		}
	}
	return m
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

var sc = bufio.NewScanner(os.Stdin)

func main() {
	// Code for C - /\/\/\/
	var n int
	fmt.Scan(&n)

	sc.Split(bufio.ScanWords)
	v := make([]int, n)
	temp1 := make(map[int]int, n)
	temp2 := make(map[int]int, n)

	var count1, count2 int
	for i := 0; i < n; i++ {
		v[i] = nextInt()
		if i%2 == 0 {
			temp1[v[i]]++
			count1++
		} else {
			temp2[v[i]]++
			count2++
		}
	}
	temp1[1000000] = 0
	temp2[1000000] = 0

	sortTemp1 := make([]int, 0)
	for _, v := range temp1 {
		sortTemp1 = append(sortTemp1, v)
	}
	sort.Sort(sort.Reverse(sort.IntSlice(sortTemp1)))

	sortTemp2 := make([]int, 0)
	for _, v := range temp2 {
		sortTemp2 = append(sortTemp2, v)
	}
	sort.Sort(sort.Reverse(sort.IntSlice(sortTemp2)))

	var maxNum1 int
	for i, v := range temp1 {
		if v == sortTemp1[0] {
			maxNum1 = i
		}
	}

	var maxNum2 int
	for i, v := range temp2 {
		if v == sortTemp2[0] {
			maxNum2 = i
		}
	}

	var ans int
	if maxNum1 != maxNum2 {
		fmt.Println(count1 - temp1[maxNum1] + count2 - temp2[maxNum2])
	} else {
		/*
			if len(temp1) == 1 && len(temp2) == 1 {
				ans = min(count1+count2-temp2[maxNum2], count1-temp1[maxNum1]+count2)
				fmt.Println(ans)
			} else if len(temp1) == 1 && len(temp2) != 1 {
				for i, v := range temp2 {
					if v == sortTemp2[1] {
						maxNum2 = i
					}
				}
				fmt.Println(count1 - temp1[maxNum1] + count2 - temp2[maxNum2])
			} else if len(temp1) != 1 && len(temp2) == 1 {
				for i, v := range temp1 {
					if v == sortTemp1[1] {
						maxNum1 = i
					}
				}
				fmt.Println(count1 - temp1[maxNum1] + count2 - temp2[maxNum2])
			} else {
		*/
		var maxNum1New, maxNum2New int
		for i, v := range temp1 {
			if v == sortTemp1[1] {
				maxNum1New = i
			}
		}
		for i, v := range temp2 {
			if v == sortTemp2[1] {
				maxNum2New = i
			}
		}
		ans = min(count1-temp1[maxNum1]+count2-temp2[maxNum2New], count1-temp1[maxNum1New]+count2-temp2[maxNum2])
		fmt.Println(ans)
		//}
	}
}


Measured memory_bytes: 11072
import java.util.Scanner;

public class Main {

	static Scanner scanner;

	public static void main(String[] args) {
	    scanner = new Scanner(System.in);

        int n=gi();
        long[] T=new long[n];
        
        long s = 1;
        for (int i=0; i< n; i++) {
            T[i]=gl();
            s = (s/uclid(s, T[i])) * T[i];
        }

	    System.out.println(s);

//        if (s>L[n-2]) {
//        	System.out.println("Yes");
//        }else {
//        	System.out.println("No");
//        }
	}


	public static long uclid(long m, long n) {
    	if (m<n) {
			m^=n;
			n^=m;
			m^=n;
		}

		while(true) {
			long t=m%n;
			if (t==0) {
				return n;
			} else {
				m=n;
				n=t;
			}
		}
    }

	// 文字列として入力を取得
	public static String gs() {
		return scanner.next();
	}

	// intとして入力を取得
	public static int gi() {
		return Integer.parseInt(scanner.next());
	}

	// longとして入力を取得
	public static long gl() {
		return Long.parseLong(scanner.next());
	}

	// doubleとして入力を取得
	public static double gd() {
		return Double.parseDouble(scanner.next());
	}
}

Measured memory_bytes: 35596
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
typedef long long ll;
namespace mp = boost::multiprecision;
using Mint = mp::cpp_int;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = int(a); i < int(b); i++)
#define all(v) v.begin(), v.end()
#define uni(v) v.erase(unique(all(v)), v.end())
#define sort_g(v) sort(all(v), greater<int>())
#define dump(x) cerr << #x << ' ' << '=' << ' ' << x << endl

bool is_even(string S) {
    int l = S.size() / 2;
    string sub_1 = S.substr(0, l);
    string sub_2 = S.substr(l, l);
    if(sub_1 == sub_2) return true;
    else return false;
}

int main() {
    int N;
    cin >> N;
    vector<int> B(N);
    rep(i, N) {
        int P;
        cin >> P;
        B.at(i) = P - 1;
    };

    int cnt = 0;
    int pos = 0;
    while(true) {
        if(pos == 1) {
            cout << cnt << endl;
            break;
        }
        if(cnt > N) {
            cout << -1 << endl;
            break;
        }
        pos = B.at(pos);
        cnt++;
    }
}

Measured memory_bytes: 640
#include<iostream>
#include<map>
#include<string>
#include<set>
#include<vector>
using namespace std;

int solve(){
  int h, a;  cin >> h >> a;
  int ans = h/a;
  if(h%a!=0)  ans++;
  cout << ans << endl;
}

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


Measured memory_bytes: 256
def ans(an, n, N, X, x, inx):
  N -= inx * x ** (n + 1)
  if n == 0:
    an += X[N]
    return an
  
  an += X[N // x**n]
  inx = N // x**n
  n -= 1
  return ans(an, n, N, X, x, inx)
N = int(input())
X = "abcdefghijklmnopqrstuvwxyz"
an = ""
x = 26
n = 1
inx = 0
while N > x * ((x**n - 1)//(x - 1)):
  n += 1
n -= 1
N -= x * ((x**n - 1)//(x - 1)) + 1
print(ans(an, n, N, X, x, inx))

Measured memory_bytes: 9220
#include <bits/stdc++.h>
#define D(x) cout << #x << "=" << x << endl
#define De(...)
using namespace std; 

int _; 

int n,a[105],ans=0;
 
int main()
{
	//for(scanf("%d",&_);_;_--)
	scanf("%d",&n);
	for(int i=0;i<n;i++)
	{
		scanf("%d",a+i);
		if(i%2 == 0 && a[i]%2 == 1)
			ans++;
	} 
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 3752
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef tuple<ll,ll,ll> T;
const long long INF = 1LL<<60;
const int MOD = 1000000000+7;
#define rev(s) (string((s).rbegin(), (s).rend()))
template < typename T > inline string toString( const T &a ) { ostringstream oss; oss << a; return oss.str(); };
// cout << fixed << setprecision(10) << ans << endl;
// *min_element(c + l, c + r) *max_element(c + l, c + r)
// int dx[8]={1,1,0,-1,-1,-1,0,1};
// int dy[8]={0,1,1,1,0,-1,-1,-1};
// int dx[4]={1,0,-1,0};
// int dy[4]={0,1,0,-1};
// struct Edge {
//   int to, id;
//   Edge(int to, int id): to(to), id(id) {}
// };

vector<int> Z_algo(string S) {
  int N = S.size();
  vector<int> Z(N,0);
  int left = 0;
  for(int i = 1;i<N;i++) {
    int gap = i - left;
    if(i + Z[gap] < left + Z[left]) {
      Z[i] = Z[gap];
    } else {
      int j = max(0,left + Z[left] - i);
      while(i+j < N && S[i+j] == S[j]) j++;

      Z[i] = j;
      left = i;
    }  
  }
  Z[0] = N;
  return Z;
}

int main(){
  int N;cin>>N;
  string S;cin>>S;
  int ans = 0;
  rep(i,N-1) {
    string T = S.substr(i);
    auto Z = Z_algo(T);
    rep(j,T.size()-1) {
      ans = max(ans,min(j+1,Z[j+1]));
    }
  }
  cout<<ans<<endl;
}

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

//{{{
/********************************************************************/
struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast;

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vector<int> > vii;
typedef queue<int> qi;
typedef stack<int> si;
typedef deque<int> dqi;

#define reps(i, a, b) for (int i = a; i < b; ++i)
#define rep(i, n) reps(i, 0, n)
#define REPS(i, a, b) reps(i, a, b)
#define REP(i, n) rep(i, n)
#define deps(i, a, b) for (int i = a; i >= b; --i)
#define dep(i, n) deps(i, n, 0)
#define DEPS(i, a, b) deps(i, a, b)
#define DEP(i, n) dep(i, n)

#define pf push_front
#define pb push_back
#define mp make_pair
#define fst first
#define FST fst
#define sec second
#define SEC sec
#define sz(obj) ((int)(obj).size())
#define all(v) (v).begin(), (v).end()
#define ALL(v) all(v)
#define endl '\n'

const int INF = 999999999;
const int MOD = 1e9 + 7;
const int dx[] = {0, 1, 0, -1, 1, 1, -1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

inline bool inside(int y, int x, int H, int W) { return y >= 0 && x >= 0 && y < H && x < W; }
inline int in() { int x; std::cin >> x; return x; }
template <typename T>
void print(std::vector<T>& v, char c = ' ') {
  REP(i, v.size()) {
    if (i != 0) std::cout << c;
    std::cout << v[i];
  }
  std::cout << '\n';
}
template <typename T> void print(T x) { std::cout << x << '\n'; }

/****************************************************************/
//}}}

int n;
bool f;
string s;
string ans[4] = {"SS", "SW", "WS", "WW"};
signed main()
{
  cin >> n >> s;
  rep(l, 4) {
    reps(i, 1, n - 1) {
      string t;
      if (s[i] == 'o') {
        if (ans[l][i] == 'S') t = ans[l][i - 1];
        else t = (ans[l][i - 1] == 'S' ? "W" : "S");
      }
      else {
        if (ans[l][i] == 'S') t = (ans[l][i - 1] == 'S' ? "W" : "S");
        else t = ans[l][i - 1];
      }
      ans[l] += t;
    }
    bool nemui = true;
    rep(i, n) {
      if (s[i] == 'o') {
        if (ans[l][i] == 'S' and ans[l][(i - 1 + n) % n] != ans[l][(i + 1 + n) % n]) nemui = false;
        if (ans[l][i] == 'W' and ans[l][(i - 1 + n) % n] == ans[l][(i + 1 + n) % n]) nemui = false;
      }
      else {
        if (ans[l][i] == 'S' and ans[l][(i - 1 + n) % n] == ans[l][(i + 1 + n) % n]) nemui = false;
        if (ans[l][i] == 'W' and ans[l][(i - 1 + n) % n] != ans[l][(i + 1 + n) % n]) nemui = false;
      }
    }
    f = nemui;
    if (f) {
      print(ans[l]);
      return (0);
    }
  }
  print(-1);

  return (0);
}

Measured memory_bytes: 976
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;
typedef string::const_iterator State;
#define Ma_PI 3.141592653589793
#define eps 0.00000001
#define LONG_INF 1e18
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define MOD 1000000007
#define seg_size 262144
#define REP(a,b) for(long long a = 0;a < b;++a)
int main() {
	int a, b, c;
	cin >> a >> b >> c;
	cout << max(c - (a - b),0) << endl;
}

Measured memory_bytes: 768
function main(input) {
   input = input.trim();
  const a = input.split(" ").map(Number);
  console.log(Math.max(a[0]+a[1], Math.max(a[0]-a[1], a[0]*a[1])));
  
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 29488