akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define db1(x) cout<<#x<<"="<<x<<'\n'
#define db2(x,y) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<'\n'
#define db3(x,y,z) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<","<<#z<<"="<<z<<'\n'
#define dbV(arr) cout << #arr << "=[ "; \
for(auto i:arr) cout << i << " "; cout << "]\n";
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define repF(i,a,n) for(int i = (a); i <= (n); ++i)
#define repB(i,a,n) for(int i = (a); i >= (n); --i)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vi vector<int>
#define vl vector<ll>
#define umii unordered_map<int,int>
#define umll unordered_map<ll,ll>
#define mii map<int,int>
#define mll map<ll,ll>
#define seti set<int>
#define setl set<ll>
#define pb push_back
#define F first
#define S second
#define MOD 1000000007
#define all(z) z.begin(),z.end()
using namespace std;
using ll = long long;

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	string s1, s2; cin >> s1 >> s2;
	int n = s1.length(), m = s2.length();
	int dp[n + 1][m + 1];
	repF(i, 0, n) {
		repF(j, 0, m) {
			if (!i or !j) dp[i][j] = 0;
			else if (s1[i - 1] == s2[j - 1]) dp[i][j] = 1 + dp[i - 1][j - 1];
			else dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]);
		}
	}
	string lcs;
	int i = n, j = m;
	while (i >= 1 and j >= 1) {
		if (s1[i - 1] == s2[j - 1]) {
			lcs.pb(s1[i - 1]);
			i--; j--;
		}
		else if (dp[i - 1][j] > dp[i][j - 1]) i--;
		else j--;
	}
	reverse(all(lcs));
	cout << lcs << endl;
	return 0;
}

Measured memory_bytes: 38852
#include <bits/stdc++.h>
#define PI 3.14159265359
#define NIL (-1)
#define LL long long
using namespace std;
const int64_t MOD = 1e9 + 7;
const int INF = INT_MAX;

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

	int cnt = 0;
	for (int i=0; i < 10; i++) {
		for (int j = 0; j < 10; j++) {
			for (int k = 0; k < 10; k++) {
				string s = to_string(i) + to_string(j) + to_string(k);
				//cout << s << endl;

				int itr = 2;
				for (int l = 0; l < S.size(); l++) {
					if (S[l] == s[itr]) itr--;
					if (itr < 0) break;
				}

				if (itr < 0) cnt++;
			}
		}
	}

	cout << cnt << endl;
}

Measured memory_bytes: 3748
#include "bits/stdc++.h"
using namespace std;
#define Rep(i,n) for(int i=0;i<(int)(n);i++)
#define For(i,n1,n2) for(int i=(int)(n1);i<(int)(n2);i++)
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define RREP(i,n) for(ll i=((ll)(n)-1);i>=0;i--)
#define FOR(i,n1,n2) for(ll i=(ll)(n1);i<(ll)(n2);i++)
#define RFOR(i,n1,n2) for(ll i=((ll)(n1)-1);i>=(ll)(n2);i--)
#define put(a) cout<<a<<"\n"
#define all(a)  (a).begin(),(a).end()
#define SORT(a) sort((a).begin(),(a).end())
#define oorret 0
#define oor(x) [&](){try{x;} catch(const out_of_range& oor){return oorret;} return x;}()
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
template<typename T1, typename T2> inline bool chmin(T1& a, T2 b) { if (a > b) { a = b; return 1; }return 0; }
template<typename T1, typename T2> inline bool chmax(T1& a, T2 b) { if (a < b) { a = b; return 1; }return 0; }


int main() {
	int n;
	cin >> n;
	vector<P> a(n);
	REP(i, n) {
		cin >> a[i].first;
		a[i].second = i;
	}
	sort(all(a));
	int index = a.back().second;
	REP(i, n) {
		if (i != index) {
			put(a.back().first);
		}
		else {
			put(a[n - 2].first);
		}
	}
	return 0;
}


Measured memory_bytes: 4736
#include<cstdio>
#include<iostream>
#include<vector>
#include<queue>
#include<bitset>
#include<string>
#include<stack>
#include<set>
#include<map>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<list>
#define X first
#define Y second
#define INF 987654321
#define PI 3.14159265358979323
#define MOD 1000000007LL
#define fup(i,a,b,c) for(int (i)=(a);(i)<=(b);(i)+=(c))
#define fdn(i,a,b,c) for(int (i)=(a);(i)>=(b);(i)-=(c))
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int, int> Pi;
typedef pair<ll, ll> Pll;
typedef vector<int> Vi;
typedef vector<ll> Vll;
typedef vector<Pi> VPi;
typedef vector<Pll> VPll;
ll fact[200001], inv[200001];
inline ll Com(int a, int b)
{
	return (((fact[a] * inv[b]) % MOD)*inv[a - b]) % MOD;
}
ll Pow(ll a, ll b)
{
	if (b == 1)return a;
	if (b & 1)return (a*Pow(a, b - 1)) % MOD;
	ll t = Pow(a, b / 2);
	return (t*t) % MOD;
}
int main() {
	fact[0] = inv[0] = 1;
	fup(i, 1, 200000, 1)
	{
		fact[i] = (fact[i - 1] * i) % MOD;
		inv[i] = Pow(fact[i], MOD - 2);
	}
	int h, w, a, b;
	scanf("%d%d%d%d", &h, &w, &a, &b);
	ll ans = 0;
	for (int i = b; i < w; i++)
		ans = (ans + Com(i + h - a - 1, i)*Com(h+w-3-(i + h - a - 1),a-1)) % MOD;
	printf("%lld", ans);
}

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

namespace ConsoleApplication49
{
    class Program
    {
        static void Main()
        {
            int s = 0;
            while (true)
            {
                string a = Console.ReadLine();
                if (a == null) break;
                if (a.Length == 1) { s++;continue; }
                for (int b = 0; b <(int)Math.Ceiling(a.Length / 2d); b++)
                {
                    if (a[b] != a[a.Length - 1 - b]) break;
                    if ((int)Math.Ceiling(a.Length / 2d) - 1 == b) { s++;break; }
                }
            }
            Console.WriteLine(s);
        }
    }
}

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

int main(){
	while(1){
		int a,b;
		cin >> a >> b;
		if(a==0 && b==0) break;
		
		int rem = b-a;
		int ans[3] = {};
		ans[2] = rem/1000;
		rem %= 1000;
		ans[1] = rem/500;
		rem %= 500;
		ans[0] = rem/100;
		cout << ans[0] << " " << ans[1] << " " << ans[2] << endl;
	}
	return 0;
}


Measured memory_bytes: 3084
#include<iostream>
#include"bits/stdc++.h"
using namespace std;
#define ll long long
#define FOR(i, j, k, in) for (int i=j ; i<k ; i+=in)
#define RFOR(i, j, k, in) for (int i=j ; i>=k ; i-=in)
#define rep(i, j) FOR(i, 0, j, 1)
#define rrep(i, j) RFOR(i, j, 0, 1)
#define MP make_pair
#define PB push_back
#define INF (int)1e9
#define endl "\n"
#define MOD 1000000007
#define DEB(x) cout<<"##"<<x<<"##"<<endl;

void solve()
{
    int nr,ng,nb;
    cin>>nr>>ng>>nb;
    int r[nr],g[ng],b[nb];
    rep(i,nr)
    cin>>r[i];
    rep(i,ng)
    cin>>g[i];
    rep(i,nb)
    cin>>b[i];
    sort(r,r+nr);
    sort(g,g+ng);
    sort(b,b+nb);
}
void b()
{
    ll x,sum=100,t=0;
    cin>>x;
    while(sum<x)
    {
        sum+=sum*0.01;
        t++;
    }
    cout<<t;
}
int main() 
{
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
    cout.tie(NULL);
    #ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif
    b();
    return 0;
    int t;
    cin>>t;
    while(t--)
    b();
}


Measured memory_bytes: 3656
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define ALL(A) A.begin(), A.end()

using namespace std;

typedef long long ll;
typedef pair<int, int> P;

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int theta1, theta2; cin >> theta1 >> theta2;

	double t1 = (theta2 - theta1) / 2.;
	double t2 = (theta2 - 360 - theta1) / 2.;
	double t3 = (theta2 - theta1 + 360) / 2.;
	double t = 360.;
	t = (abs(t) > abs(t1) ? t1 : t);
	t = (abs(t) > abs(t2) ? t2 : t);
	t = (abs(t) > abs(t3) ? t3 : t);

	double res = theta1 + t;
	res = (res < 0. ? res + 360 : res);
	res = (res > 360 ? res - 360 : res);

	printf("%.1lf\n", res);

	return 0;
}

Measured memory_bytes: 3188
import sys
import math

r, c = map(int, raw_input().split())
b = [0 for i in xrange(c+1)]

for i in xrange(r):
    a = map(int, raw_input().split())

    for j in xrange(c):
        b[j] += a[j]
        sys.stdout.write(str(a[j]) + " ")
    print sum(a)

    b[c] += sum(a)

for j in xrange(c+1):
    sys.stdout.write(str(b[j]))
    if j < c:
        sys.stdout.write(" ")
print

Measured memory_bytes: 6424
using System;
using static System.Console;
using static System.Math;
using System.IO;
using System.Collections.Generic;
using System.Text;

namespace 水色コーダーに俺はなる{
    class Inonoa{

        /* ここに書け */
        static void Main(){
            long[] hwab = ILongs();

            for(int i=0;i<hwab[0];i++){
                StringBuilder sb = new StringBuilder();
                if(i>=hwab[0]-hwab[3]){
                    for(int j=0;j<hwab[1];j++){
                        if(j<hwab[2]){
                            sb.Append('1');
                        }else{
                            sb.Append('0');
                        }
                    }
                }else{
                    for(int j=0;j<hwab[1];j++){
                        if(j<hwab[2]){
                            sb.Append('0');
                        }else{
                            sb.Append('1');
                        }
                    }
                    
                }
                WriteLine(sb.ToString());
            }
        }

        static readonly long MOD = 1000000007;

        ///<summary>a_1, a_2, a_3, ...みたいなの</summary>
        static long[] ILongs(){
            string[] s = ReadLine().Split();
            long[] re = new long[s.Length];
            for(long i=0;i<s.Length;i++){
                re[i] = long.Parse(s[i]);
            }
            return re;
        }

        ///<summary>xooxoxoxxoxo...みたいなの</summary>
        static char[] IChars(){
            return ReadLine().ToCharArray();
        }

        ///<summary>n m とかをちょっとはやくかくだけ</summary>
        static string[] IStrings(){
            return ReadLine().Split();
        }

        ///<summary>n行の入力を取ったり</summary>
        static long[][] ILongLongs(long n){
            long[][] re = new long[n][];
            for(long i=0;i<n;i++){
                string[] s = ReadLine().Split();
                re[i] = new long[s.Length];
                for(long j=0;j<s.Length;j++){
                    re[i][j] = long.Parse(s[j]);
                }
            }
            return re;
        }

        ///<summary>n行の文字列を取ったり</summary>
        static char[][] ICharsChars(long n){
            char[][] re = new char[n][];
            for(long i=0;i<n;i++){
                re[i] = ReadLine().ToCharArray();
            }
            return re;
        }
    }
}

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

using namespace std;

typedef long long ll;
const ll INF = 1LL<<60;

ll gcd(ll a, ll b) {
  if(b == 0) return a;
  return gcd(b, a % b);
}

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }


int main(){
    cin.tie(0);
   	ios::sync_with_stdio(false);
    
    ll D, N;
    cin >> D >> N;

    ll base = 0;
    if(D==0){
        base = 1;
    }else if(D==1){
        base = 100;
    }else if(D==2){
        base = 10000;
    }

    if( N < 100){
    cout << N * base << endl;
    }else{
        cout << (N+1) * base << endl;
    }

    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder
{

    static class Program
    {
        static void Main()
        {
            Solve();

            Console.ReadKey();
        }

        static void Solve()
        {
            var N = GetInt();
            List<int> a = new List<int>();
            for(int i=1;Math.Pow(6,i)<= N; i++)
            {
                a.Add((int)Math.Pow(6, i));
            }
            for (int i = 1; Math.Pow(9, i) <= N ; i++)
            {
                a.Add((int)Math.Pow(9, i));
            }
            a = a.OrderBy(o => o).ToList();

            var dp = Enumerable.Repeat(99999999999, N + 1).ToArray();
            dp[0] = 0;
            for(int i = 1; i < N + 1; i++)
            {
                dp[i] = dp[i - 1] + 1;
                for(int j=0; j<a.Count && 0 <= i-a[j]; j++)
                {
                    dp[i] = Math.Min(dp[i], dp[i - a[j]] + 1);
                }
            }
            var ans = dp[N];

            Console.WriteLine(ans); 
        }


        static public string GetStr() { return Console.ReadLine(); }
        static public int GetInt() { return int.Parse(Console.ReadLine()); }
        static public long GetLong() { return long.Parse(Console.ReadLine()); }
        static public string[] GetStrArray() { return Console.ReadLine().Split(' '); }
        static public int[] GetIntArray() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
        static public long[] GetLongArray() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
        static public List<double> GetDoubleList() { return Console.ReadLine().Split(' ').Select(double.Parse).ToList(); }
        static public void WriteObjects<T>(IEnumerable<T> values) { foreach (var o in values) { Console.Write(o + " "); } }
        static string yesno(this bool b) { return b ? "yes" : "no"; }
        static string YesNo(this bool b) { return b ? "Yes" : "No"; }
        static string YESNO(this bool b) { return b ? "YES" : "NO"; }

        static bool eq<T, U>() => typeof(T).Equals(typeof(U));
        static T ct<T, U>(U a) => (T)Convert.ChangeType(a, typeof(T));
        static T cv<T>(string s) => eq<T, int>() ? ct<T, int>(int.Parse(s))
                           : eq<T, long>() ? ct<T, long>(long.Parse(s))
                           : eq<T, double>() ? ct<T, double>(double.Parse(s))
                           : eq<T, char>() ? ct<T, char>(s[0])
                                             : ct<T, string>(s);
        static void Multi<T>(out T a) => a = cv<T>(GetStr());
        static void Multi<T, U>(out T a, out U b)
        {
            var ar = GetStrArray(); a = cv<T>(ar[0]); b = cv<U>(ar[1]);
        }
        static void Multi<T, U, V>(out T a, out U b, out V c)
        {
            var ar = GetStrArray(); a = cv<T>(ar[0]); b = cv<U>(ar[1]); c = cv<V>(ar[2]);
        }
    }
}

Measured memory_bytes: 13792
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits.h>
#include <climits>
#include <map>
#include <unordered_map>
#include <cmath>
#include <set>
#include <iterator>
#include <deque>
#include <assert.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
ull min(ull x, ull y){ if (x<y) return x; return y;}
ull max(ull x, ull y){ if (x<y) return y; return x;}
ll min(ll x, ll y){ if (x<y) return x; return y;}
ll max(ll x, ll y){ if (x<y) return y; return x;}
double min(double x, double y){ if (x<y) return x; return y;}
double max(double x, double y){ if (x<y) return y; return x;}
ull gcd(ull x, ull y){
    if (!x) return y;
    if (!y) return x;
    if (x>y) swap(x,y);
    return gcd(x, y%x);
}
ull inv(ull a, ull c){ // a,c are coprime and a<c
    if (a==1){
        return 1;
    }
    return ((c-(c/a))*inv(c%a,c))%c;
}


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

    map<int, ll> cnts;

    int n;
    cin>>n;
    vector<ll> a(n,0);

    ll sum = 0;
    for (int i = 0; i < n; i++){
        cin>>a[i];
        cnts[a[i]]++;
    }

    for (map<int,ll>::iterator it = cnts.begin(); it != cnts.end(); ++it){
        ll cnt = it->second;
        sum += cnt*(cnt-1)/2;
    }

    for (int i = 0; i < n; i++){
        ll cnt = cnts[a[i]];
        ll s = sum - (cnt*(cnt-1))/2;
        cnt--;
        if (cnt) s += (cnt*(cnt-1))/2;
        cout<<s<<"\n";
    }

    return 0;
    
}



Measured memory_bytes: 11136
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1e9+7,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<int,int> P;

void Main() {
  ll n;
  R n;
  int a[n];
  rep(i,n) R a[i];
  int dp[n+1];
  fill(dp,dp+n+1,-MAX);
  rep(i,n) dp[a[i]]=max(1,dp[a[i]-1]+1);
  int ans=0;
  rep(i,n+1) ans=max(ans,dp[i]);
  pr(n-ans);
}

int main(){ios::sync_with_stdio(0);cin.tie(0);Main();return 0;}


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

int main(){
  int n,t;
  int a[100005]={};
  cin>>n>>t;
  for(int i=0;i<n;i++){
    int l,r;
    cin>>l>>r;
    a[l]++;
    a[r]--;
  }

  int ans=0;
  for(int i=0;i<t;i++){
    ans=max(ans,a[i]);
    a[i+1]+=a[i];
  }
  cout<<ans<<endl;
  
  return 0;
}



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

typedef long long ll;
typedef pair<int,int> P;
typedef map<int,int> M;
typedef vector<int> V;
typedef queue<int> Q;
typedef pair<long,long> PLL;
typedef map<long,long> MLL;
typedef vector<long long> VLL;
typedef vector<pair<int,int>> VP;
typedef vector<vector<int>> VV;
#define INF (int)(1e9+1)
#define MAXX (int)1.1529215e+18
#define inf 999999
#define EPS (1e-7)
#define MOD (ll)(1e9+7)
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define REP(i,n) for(int i=1;i<=(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n-1);i>=0;i--)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define ALL(a)  a.begin(),a.end()
#define RALL(a) a.begin(),a.end(),greater<int>()
#define PRALL(a) a.begin(),a.end(),greater<pair<int,int>>()
#define ROT(a) a.begin(),a.begin()+1,a.end()
#define RROT(a) a.begin(),a.end()-1,a.end()
#define PB push_back
#define MP make_pair
#define PI acos(-1.0)
//printf("myco\n");//for debug
/*--------------------------------------------*/
int main(){
    int n,d;cin>>n>>d;
    vector<vector<int>>x(n,vector<int>(d));
    rep(i,n){
        rep(j,d){
            cin>>x[i][j];
        }
    }
    int ans=0;
    rep(i,n-1){
        for(int j=i+1;j<n;j++){
            int distdist=0;
            rep(k,d){
                distdist+=pow(x[i][k]-x[j][k],2);
            }
            //printf("dis=%d\n",distdist);
            if(floor(sqrt(distdist))==sqrt(distdist))ans++;
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a, b, c, x;
		a = sc.nextInt();
		b = sc.nextInt();
		c = sc.nextInt();
		x = sc.nextInt();
		int count = 0;
		for (int i = 0; i <= a; i++) {
			for (int j = 0; j <= b; j++) {
				for (int k = 0; k <= c; k++) {
					if (i * 500 + j * 100 + k * 50 == x)
						count ++;
				}
			}
		}
		System.out.println(count);
	}

}


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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, k, r, s, p;
  string t;
  cin >> n >> k >> r >> s >> p >> t;
  int ans = 0;
  map<char, bool> flag;
  for (int i = 0; i < n; i++) {
    if (i >= k && t[i] == t[i - k]) {
      t[i] = 'x';
      continue;
    }
    if (t[i] == 'r') {
      ans += p;
    } else if (t[i] == 's') {
      ans += r;
    } else {
      ans += s;
    }
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 3708
# -*- coding: utf-8 -*-
"""
AtCoder A
"""
 
import sys, math, random
import numpy as np
 
# N = int(input())
# A = list(map(int,input().split())) # N row 1 column
# A = [int(input()) for _ in range(N)] # 1 row N column
# S = str(input()) # str(input()) == input() -> 'abc'
# S = list(input()) # abc -> ['a','b','c']
# S.replace('ABC','X') # "testABCABC" -> "testXX"
# S=numpp.assaray(S)=="#"
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]
 
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LLS(): return [list(sys.stdin.readline().rstrip()) for _ in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
 
 
 
def main():
    N=I()
    H=LI()
    prev=-100
    for i in H:
        if prev-i>1:
            print("No")
            exit()
        elif prev-i==1:
            prev=i+1
        else:
            prev=i
        # print (prev)
    print("Yes")
 
 
 
if __name__ == "__main__":
    main()

Measured memory_bytes: 23896
from itertools import combinations

N = int(input())
name=[]
m,a,r,c,h=0,0,0,0,0
for i in range(N):
    si = input()
    if si[0] in ['M', 'A', 'R', 'C', 'H']:
        name.append(si)
        if si[0]=='M':
            m+=1
        if si[0]=='A':
            a+=1
        if si[0]=='R':
            r+=1
        if si[0]=='C':
            c+=1
        if si[0]=='H':
            h+=1

if name==[]:
    print(0)
    exit()

names=dict({'m':m,'a':a,'r':r,'c':c,'h':h})
ans=0
for n in list(combinations(['m','a','r','c','h'],3)):
    ans += names[n[0]] * names[n[1]] * names[n[2]]
print(ans)

Measured memory_bytes: 9780
# ARC102 C
N, K = list(map(int, input().split()))
ans = 0
list_n = [0]*K

for i in range(1, N+1):
    list_n[i % K] += 1

for a in range(K):
    b = (K - a) % K
    c = b
    if (b + c) % K == 0:
        ans += list_n[a] * list_n[b] * list_n[c]
print(ans)


Measured memory_bytes: 4596
def main():
    from collections import deque
    n, x, y = map(int,input().split())
    g = [[] for _ in range(n)] 
    for i in range(n-1):

        g[i] += i+1,
        g[i+1] += i,
    g[x-1] += y-1,
    g[y-1] += x-1,
    a = [0]*n
    for start in range(n):
        d = [-1] * n
        d[start] = 0
        q = deque([start])
        add,pop = q.append,q.popleft
        while q:
            v = pop()
            for nv in g[v]:
                if d[nv] < 0:
                    d[nv] = d[v]+1
                    add(nv)
        for i in d:
            a[i] += 1
        # d.append(dist)
    # d = np.array(d).flatten()
    # for i in range(1,n):
    #     # print(int(np.count_nonzero(d==i)/2))
    #     print(int(ans[i]/2))
    print(' '.join(str(i//2) for i in a[1:]))
main()

Measured memory_bytes: 3944
#include <iostream>

using namespace std;

int main(){
  unsigned long long int N, a[5], min, ans=5;
  int i;
  cin >> N;
  for(i=0; i<5; i++) cin >> a[i];
  for(i=0; i<5; i++){
    if(i==0) min = a[i];
    else{
      if(min > a[i]) min = a[i];
    }
  }
  if(N % min != 0) ans += N/min;
  else ans += N/min-1;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
import sys

n = int(input())

ai = []
for i in range(0, n):
    ai.append(int(input()))

count = 0
iter = 0
r = 1

if len(ai) == 1:
    print(ai[0] - 1)
    sys.exit()

while True:
    if iter == 0 and ai[0] > 1:
        count += ai[0] - 1
        ai[0] = 1
    else:
        while ai[iter] <= r + 1:
            r = max(r, ai[iter])
            iter += 1
            if iter >= len(ai):
                print(count)
                sys.exit()
        div = int(ai[iter] / (r + 1))
        mod = ai[iter] % (r + 1)
        if mod == 0:
            count += div - 1
            ai[iter] = 1
        else:
            count += div
            ai[iter] = mod


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

using namespace std;

typedef long long ll;

const int INF = 1000000000;

int main()
{
  int N; scanf("%d", &N);
  vector<ll> A(N);
  for (int i = 0; i < N; ++i) {
    scanf("%lld", &A[i]);
  }
  ll sum = 0;
  ll ans = 0;
  for (int l = 0, r = 0; l < N; ++l) {
    while (r < N and (sum + A[r]) == (sum ^ A[r])) {
      sum ^= A[r];
      ++r;
    }
    ans += (r - l);
    if (l == r) { ++r; }
    else { sum ^= A[l]; }
  }
  printf("%lld\n", ans);
  return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for (int i = s; i < (int)(n); i++)
#define out(x) cout << x << endl;
#define INF 1ll<<60;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

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

int main(){
    int h, w; cin >> h >> w;
    vector<string> a(h);
    rep(i, h) cin >> a[i];

    rep(i, h){
        rep(j, 2){
            out(a[i]);
        }
    }
}

Measured memory_bytes: 3640
/**   Created by: Marcos Portales
          Codeforces User: marcosportales
          Country: Cuba
          Copyright                    */
#include<bits/stdc++.h>
using namespace std;
/// Pragmas:
#pragma GCC optimize("Ofast","unroll-loops","omit-frame-pointer","inline") //Optimization flags
#pragma GCC option("arch=native","tune=native","no-zero-upper") //Enable AVX
#pragma GCC target("avx2") //Enable AVX
/// Macros:
#define int long long
#define f first
#define s second
#define db(x) cerr << #x << ": " << (x) << '\n';
#define pb push_back
#define lb lower_bound
#define up upper_bound
#define all(x) x.begin() , x.end()
#define rall(x) x.rbegin() , x.rend()
#define enl '\n'
#define vi vector<int>
#define sz(a) int((a).size())
#define rep(i,x,y) for(int i=x;i<y;i++)
typedef pair<int,int> ii;
typedef long double ld;
typedef unsigned long long ull;
/// Constraints:
const int maxn = 400010;
const int mod = 1000000007;
const ld eps = 1e-9;
const int inf = ((1ll<<31ll)-1ll);
const int INF = 2000000000000000000ll;
const ld pi = acos(-1);
/// Prime Numbers:
// 2, 173, 179, 181, 197, 311, 331, 737, 1009, 2011, 2027, 3079, 4001, 10037, 10079, 20011, 20089;
// 100003, 100019, 100043, 200003, 200017, 1000003, 1000033, 1000037, 1000081;
// 2000003, 2000029, 2000039, 1000000007, 1000000021, 2000000099;
/// Functions:
#define lg2(x) 31 - __builtin_clz(x)
#define lgx(x,b) ( log(x) / log(b) )
/// Red-Black Tree Template ---------------------------------
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//typedef tree < long long ,  null_type ,  less<long long> ,  rb_tree_tag ,  tree_order_statistics_node_update > ordered_set;
/// Quick Pow------------------------------------------------
int qpow(int b,int e){
    if( !e ) return 1;
    if( e & 1 ) return qpow(b,e-1) * b % mod;
    int pwur = qpow(b,e>>1);
    return (pwur * pwur) % mod;
}
int modinv(int x){
    return qpow(x,mod-2);
}
/// My Code -------------------------------------------------

string s[101];

int32_t main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    cout.setf(ios::fixed); cout.precision(0);
    srand(time(NULL));

    //freopen("a.in","r",stdin);
    //freopen("a.in","w",stdout);

    int n,m;
    cin>>n>>m;
    for(int i=0;i<n;i++){
        cin>>s[i];
    }
    for(int i=0;i<n;i++){
        cout<<s[i]<<'\n';
        cout<<s[i]<<'\n';
    }


    return 0;
}


Measured memory_bytes: 3636
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <vector>
#include <algorithm>
using namespace std;

int rec[2000][1010];

int main(void){
	int N, M, r, q;
	while(1){
		memset(rec, 0, sizeof(rec));
		cin >> N >> M;
		if(!N) break;
		cin >> r;
		for(int i = 0; i < r; i++){
			int t, n, m, s;
			cin >> t >> n >> m >> s;
			if(s)
				rec[t][n] = m;
			else
				for(int tt = t - 1; rec[tt][n] != m; tt--) rec[tt][n] = m;
		}
		
		cin >> q;
		
		for(int t = 0; t < q; t++){
			int ans = 0;
			int ts, te, m;
			cin >> ts >> te >> m;
			for(int j = ts; j < te; j++){
				int f = 0;
				for(int i = 1; i <= N; i++){
					if(rec[j][i] == m) f = 1;
				}
				if(f) ans++;
			}
			cout << ans << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 9056
# coding:utf-8

import sys
import math
import time
#import numpy as np
import collections
from collections import deque
from collections import Counter
import queue
import copy
import bisect
import heapq
import itertools



sys.setrecursionlimit(10**7)
#N, Q = map(int, input().split())
#G = [list(input()) for i in range(H)]
#INF = V * 10001
#A = [int(i) for i in input().split()]
#AB = [list(map(int, input().split())) for _ in range(K)]

N = int(input())
A =  [int(i) for i in input().split()]
ans = 1
flag = 0

for i in range(N):
    ans *= A[i]
    if(10**18<ans):
        flag = 1
        break

if(0 in A):
    print(0)
elif(flag == 1):
    print(-1)
else:
    print(ans)


Measured memory_bytes: 87800
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		var sc = new Scanner(System.in);
		var n = sc.nextInt();
		var m = sc.nextInt();
		var k = sc.nextInt();
		var a = new int[n];
		var b = new int[m];
		for (int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
		}
		for (int i = 0; i < m; i++) {
			b[i] = sc.nextInt();
		}
		sc.close();

		var amax = 0;
		var sum = 0L;
		for (int i = 0; i < n; i++) {
			sum += a[i];
			if (sum > k) {
				sum -= a[i];
				break;
			}
			amax++;
		}

		var bmax = 0;
		for (int i = 0; i < m; i++) {
			sum += b[i];
			if (sum > k) {
				sum -= b[i];
				break;
			}
			bmax++;
		}

		//System.out.printf("%d %d %d\r\n", amax, bmax, sum);

		var max = amax + bmax;
		for (int i = amax - 1; i >= 0; i--) {
			sum -= a[i];
			for (int j = bmax; j < m; j++) {
				sum += b[j];
				if (sum > k) {
					sum -= b[j];
					break;
				}
				bmax++;
				max = Math.max(max, i + j + 1);
				//System.out.printf("%d %d %d\r\n", i, j + 1, sum);
			}
		}
		System.out.println(max);
	}
}


Measured memory_bytes: 62980
#include<iostream>
using namespace std;
int main()
{
    int x,a,b;
    cin>>x>>a>>b;
    if(b<=a){
        cout<<"delicious"<<endl;
    }else if(b<=a+x){
                cout<<"safe"<<endl;

    }else{
                cout<<"dangerous"<<endl;


    }
    return 0;


}


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

int main() {
	string s;
	getline(cin, s);

	for (int i = 0; i < s.size(); i++) {
		char ch = s.at(i);
		if (ch >= 'a' && ch <= 'z') {
			int n = (int)ch;
			n -= 32;
			s.at(i) = (char)n;
		}
		else {
			continue;
		}
	}

	cout << s << endl;
}


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

int main() {
 int N;
 cin >> N;
 bool q = false;
 int count = 0;
 for (int i = 0; i < N; i++) {
   int a, b;
   cin >> a >> b;
   if (a == b) count++;
   else count = 0;
   
   if (count  == 3) q = true;
 }
  
 if (q) cout << "Yes";
 else cout << "No";
   

}
  


Measured memory_bytes: 3616
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define endl "\n"
using namespace std;

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

    int n;
    cin >> n;
    int a=n%1000;
    if (a==0)
    {
        cout << "0" << endl;
    }
    else
    {
        cout << 1000-a << endl;
    }

    return 0;
}

Measured memory_bytes: 3600
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
long long dp[101][101*101];
int n, k;
long long powe[101];
long long mod = 1000000007;
long long go(int now, int flow){
    if(now==0){
        return 0LL;
    }
    if(dp[now][flow]!=-1){
        return dp[now][flow];
    }
    long long ret = 0LL;
    for(int i = 0; i<=k; i++){
        int here = flow+i;
        int pre = ret;
        int a, b;
        if(i>now){
            a = here; 
            b = go(now-1,flow);
            ret += (long long)here*powe[now-1]+go(now-1,flow);
        }
        else{
            a = here%now;
            b = go(now-1,flow+here/now);
            ret +=(long long)(here%now)*powe[now-1]+go(now-1,flow+here/now);
        }
        ret %= mod;
        int th = ret-pre;
    }
    dp[now][flow] = ret;
    return ret;
}
int main() {
    std::ios::sync_with_stdio(false);
    cin.tie(0);
    
    cin >> n >> k;
    powe[0] = 1LL;
    for(int i = 1; i<=n; i++){
        powe[i] = powe[i-1]*(long long)(k+1);
        powe[i] %= mod;
    }
    for(int i = 0; i<=100; i++){
        for(int j = 0; j<101*101; j++){
            dp[i][j] = -1LL;
        }
    }
    cout << go(n,0) << endl;
    return 0;
}

Measured memory_bytes: 8320
n,m = (int(i) for i in input().split())
ks = e = [[int(i) for i in input().split()] for i in range(m)]
p = [int(i) for i in input().split()]

on = []
for x in ks:
    o = 0
    for s in x[1:]:
        o += 2**(s-1)
    on.append(o)

res = 0
for x in range(2**n):
    flg = True
    for i,o in enumerate(on):
        if p[i] != bin(o&x).count("1") % 2:
            flg = False
            break

    if flg:
        res += 1
       
print(res)

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

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

int main()
{
  int n, m;
  cin >> n >> m;
  vector<int> x(m);
  vector<int> y(m);
  vector<int> z(m);
  for(int i = 0; i < m; i++)
  {
    cin >> x[i] >> y[i] >> z[i];
    x[i]--;
    y[i]--;
  }
  vector<vector<int>> graph(n, vector<int>());
  for(int i = 0; i < m; i++)
  {
    graph[x[i]].push_back(y[i]);
    graph[y[i]].push_back(x[i]);
  }
  vector<bool> flag(n, false);
  auto dfs = [&](int start){
    if(flag[start]) return 0;
    stack<int> s;
    s.push(start);
    flag[start] = true;
    while(!s.empty()){
      int c = s.top();
      s.pop();
      for(int i = 0; i < graph[c].size(); i++)
      {
        int next = graph[c][i];
        if(!flag[next])
        {
          flag[next] = true;
          s.push(next);
        }
      }
    }
    return 1;
  };
  int result = 0;
  for(int i = 0; i < n; i++)
  {
    result += dfs(i);
  }
  cout << result << endl;
}


Measured memory_bytes: 7672
#include<stdio.h>
int main(){
	int n,a[100],i,j;
	scanf("%d",&n);
	for(i=0;n>i;i++){
		scanf("%d",&a[i]);
	}
	for(i=n-1;i>=0;i--){
	printf("%d",a[i]);
	if(i!=0)printf(" ");
	else printf("\n");
	}
	return 0;
}


Measured memory_bytes: 2056
#include <iostream>
#include <string>
#include <queue>
#include <vector>
#include <algorithm>
#include <math.h>
#include <map>
#include <iomanip>
#include <queue>
#include <numeric>

using namespace std;

int main() {
	
	int N, sum = 0;
	cin >> N;
	vector<int> s(N);

	for (int i = 0; i < N; i++) {
		cin >> s[i];
		sum += s[i];
	}

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

	int i = 0;

	while (i != N) {
		if (sum % 10 != 0) {
			break;
		}
		else {
			if (s[i] % 10 != 0) {
				sum -= s[i];
				break;
			}
			else {
				i++;
				if (i == N) {
					sum = 0;
					break;
				}
			}
		}
	}

	cout << sum;

	return 0;
}


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

using namespace std;

int main(){

	#ifndef ONLINE_JUDGE
    	freopen("D:/Programming/input.txt", "r", stdin);
    	freopen("D:/Programming/output.txt", "w", stdout);
	#endif

	int t;cin>>t;
	long long int ans=1;
	unsigned long long int a;
	unsigned long long int req = 1000000000000000000/ans;
	bool flag=1;
	while(t--){
		if(flag){
			cin>>a;
			if(a>req){ans=-1;flag=0;}
			else {
				ans*=a;
				//cout<<req<<endl;
				req = 1000000000000000000/ans;
			}
		}
		else {
			cin>>a;
			if(a==0){ans=0;break;}
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3608
#include<iostream>
#include<vector>
#include<cstdio>
#include<string>
#include<numeric>
#include<algorithm>
#include<complex>
#include<queue>
#include<stdlib.h>
#include<map>
#include<cmath>
#include<iomanip>

#define ll long long

using namespace std;

int main(){
    double N,K;
    cin >> N >> K;
    int k;
    double l;
    double keep=0.000;
    double j;
    for(int i=1;i<=N;i++){
        j=1.0;
        l=1.0;
        k=0;
        while(K-(i*j)>0){
            j*=2.0;
            k++;
        }
        for(int p=0;p<k;p++){
            l/=2.0;
        }
        keep+=l/N;
        //printf("%0.10lf\n",l/N);
    }
    printf("%0.12lf\n",keep);
    return 0;
}


Measured memory_bytes: 256
const Main = () => {
    // const line = '2119';
    const lines = require('fs').readFileSync('/dev/stdin', 'utf8');
    const line = lines.split('\n')[0];
    const mod = {};
    for (let i = 1; i < 2019; i ++) {
        mod[i] = -1;
    }
    mod[0] = 0;
    let count = 0;
    for (let i = line.length - 1, m = 0, k = 1; 0 <= i; i--) {
        const n = parseInt(line[i], 10);
        m = ((n * k) + m) % 2019;
        k = (k * 10) % 2019;
        // console.log(m);
        mod[m] ++;
        count += mod[m];
    }
    console.log(count);
}

Main();

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

const int MAX_VAL = 1e4;
int main() {
    int H, N; cin >> H >> N;
    vector<int> A(N), B(N);
    rep(i, N) {
        cin >> A[i] >> B[i];
    }

    int limit = max(H * 2, MAX_VAL) + 1;
    vector<int> dp(limit, 1e9);
    dp[0] = 0;
    
    rep(i, N) {
        for (int j = A[i]; j < limit; j++) {
            dp[j] = min(dp[j], dp[j - A[i]] + B[i]);
        }
    }

    int ans = 1e9;
    for (int i = H; i < limit; i++) {
        if (dp[i] != 1e9) {
            ans = min(ans, dp[i]);
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <deque>
#include <algorithm>
#include <numeric>
#include <string>
#include <cstring>
#include <list>
#include <unordered_set>
#include <tuple>
#include <cmath>
#include <limits>
#include <type_traits>
#include <iomanip>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <set>
#include <bitset>
#include <regex>
#include <random>
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
#define rep(i,n)for(ll i=0;i<n;++i)
#define exout(x) printf("%.10f\n", x)
const double pi = acos(-1.0);
const ll MOD = 1000000007;
const ll INF = 1e10;
const ll MAX_N = 1010;

//組み合わせの余りを求める
ll fac[MAX_N], finv[MAX_N], inv[MAX_N];

void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX_N; i++) {
		fac[i] = fac[i - 1] * i;
	}
}

// 二項係数計算
long long COM(ll n, ll k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	if (n > k * 2) {

	}
	return fac[n] / (fac[k] * fac[n - k]);
}

ll dp[201010][2];
ll dx[4] = { 0,0,-1,1 };
ll dy[4] = { -1,1,0,0 };
char c[10][10];
bool flag[10][10];
bool flag2[10][10];

//long longしか使わない
//素数は1より大きい
int main() {
	ll n;
	cin >> n;
	vector<ll>d(n);
	rep(i, n) {
		cin >> d[i];
		if (d[0] != 0) {
			cout << 0 << endl;
			return 0;
		}
		if (i > 0 && d[i] == 0) {
			cout << 0 << endl;
			return 0;
		}
	}
	sort(d.begin(), d.end());
	ll kaburi = 0;
	ll res = 1;
	vector<ll>seki;
	for (ll i = 1;i < n;++i) {
		if (d[i] == d[res])kaburi++;
		else {
			if (d[i] != d[res] + 1) {
				cout << 0 << endl;
				return 0;
			}
			else {
				seki.push_back(kaburi);
				kaburi = 1;
				res = i;
			}
		}
	}
	seki.push_back(kaburi);
	ll k = seki.size();
	ll ans = 1;
	rep(i, k-1) {
		ll target = seki[i];
		ll kakeru = seki[i + 1];
		while (kakeru > 0) {
			ans *= seki[i];
			ans %= 998244353;
			kakeru--;
		}
		ans %= 998244353;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 4864
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
 
int main() {
    vector<int> v;
    int a,b,c;
    cin>>a>>b>>c;
    v.push_back(a);
    v.push_back(b);
    v.push_back(c);
    sort(v.begin(),v.end());
    if(v[0]==5 && v[1]==5 && v[2]==7){
        cout<<"YES"<<endl;
    }
    else{
        cout<<"NO"<<endl;
    }
}

Measured memory_bytes: 3608
import sys
sys.setrecursionlimit(10**7)
def dfs(v,c):
  i=1
  for w in e[v]:
    e[w]-={v}
    c=c*dfs(w,k-i-(v>0))%(10**9+7)
    i+=1
  return c
n,k,*t=map(int,open(0).read().split())
e=[set()for _ in[0]*n]
for a,b in zip(t[::2],t[1::2]):
  e[a-1]|={b-1}
  e[b-1]|={a-1}
print(dfs(0,k))

Measured memory_bytes: 109144
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define DUMP(x)  cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for(ll i = m; i < n; i++)
#define IFOR(i, m, n) for(ll i = n - 1; i >= m; i-- )
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define FOREACH(x,a) for(auto& (x) : (a) )
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) ll(x.size())

void print_array(vector<ll>& a){
  ll n = SZ(a);
  REP(i,n){
    cout << a[i] << " \n"[i==n-1];
  }
  exit(0);
}

// ll gcd (ll a, ll b){
//   if(b == 0) return a;
//   return gcd(b, a%b);
// }

// void test(vector<ll>& a){
//   ll m = SZ(a), sum = 0;
//   ll G = a[0];
//   set<ll> st;
//   REP(i,m) {
//     assert(1<= a[i] && a[i]<=30000);
//     st.insert(a[i]);
//     G = gcd(a[i],G);
//     sum += a[i];
//   }
//   assert(SZ(st)==m);
//   assert(G==1);
//   REP(i,m){
//     assert(gcd(a[i],sum)>1);
//   }
// }

// void print_array(vector<ll>& a){
//   test(a);
//   exit(0);
// }

void solve(ll n){
  vector<ll> ans;
  if(n==3){
    ans = {2,5,63};
    print_array(ans);
  }
  if(n==4){
    ans = {2,5,20,63};
    print_array(ans);
  }
  if(n==5){
    ans = {2,3,4,6,9};
    print_array(ans);
  }
  //n>=6, n=4k+r
  ll k = n/4;
  ll r = n%4;
  FOR(i,1,k+1){
    ans.push_back(6*i-4);
    ans.push_back(6*i-3);
    ans.push_back(6*i-2);
    ans.push_back(6*i);
  }
  FOR(i,1,4){
    if(r>=i) ans.push_back(6*k+1+i);
  }
  //帳尻合わせ
  ll sum = 0;
  k++;
  REP(i,SZ(ans)) sum += ans[i];
  if(sum%6==5){
    if(n==19997) ans.push_back(6*(k-1)+4);
    else ans.push_back(6*k+4);
    ans.erase(ans.begin()+5); //9を消す
  }
  if(sum%6==3){
    ans.push_back(6*k);
    ans.erase(ans.begin()+5); //9を消す
  }
  if(sum%6==2){
    ans.push_back(6*k);
    ans.erase(ans.begin()+4); //8を消す
  }
  print_array(ans);
}

int main(){
  ll n; cin >> n;
  solve(n);
}

Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cstring>
#include <stack>
#include <utility>
#include <map>
#include <cmath>
#include <stack>
#include <queue>
#include <deque>
#include <cstdlib>
#include <set>
#include <chrono>
#include <climits>
#include <unordered_map>
#include <iomanip> 

#define pii pair<int,int>
#define vi vector<int>
#define ll long long
#define pb push_back
#define mp make_pair
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL)
#define repf(i,st,end,inc) for(int i = st; i < end; i += inc)
#define repb(i,st,end,dec) for(int i = st; i >= end; i -= dec) 

#define MOD 1000000007

#define trace1(a) cout << a << endl;
#define trace2(a,b) cout << a << " | " << b << endl;
#define trace3(a,b,c) cout << a << " | " << b << " | " << c << endl;
#define trace4(a,b,c,d) cout << a << " | " << b << " | " << c << " | "<< d << endl;

using namespace std;
using namespace std::chrono;


int main(){
	fast;
	#ifdef LOCAL_PROJECT
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
	#endif

	auto start = high_resolution_clock::now(); 

	int r;
	cin >> r;
	cout << r*r << endl;

	auto stop = high_resolution_clock::now(); 
	auto duration = duration_cast<microseconds>(stop - start);	
	// cout << endl;
	// cout << fixed << setprecision(9) << double(duration.count()) / 1000000 << endl; 

	return 0;
}


Measured memory_bytes: 256
from math import gcd

k = int(input())

result = 0
for a in range(1, k + 1):
    if a == 1:
        result += k ** 2
        continue
    for b in range(1, k + 1):
        if b == 1:
            result += k
            continue
        for c in range(1, k + 1):
            result += gcd(gcd(a, b), c)

print(result)


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

using namespace std;

typedef pair<int,int> P;
typedef long long ll; 

#define int ll

const ll mod = 1e9 + 7;


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

	ll t1 = (b+1)/2;
	ll t2 = b/2;
	ll u1 = (a+1)/2;
	ll u2 = a/2;

	ll ans = t1*u1 + t2*u2;

	if(a==1 || b==1) ans = 1;

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3652
import java.util.*;

public class Main {

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

        int n = sc.nextInt();
        int m = sc.nextInt();

        Set<Integer> set = new HashSet<Integer>();

        for (int i = 0; i < m; i++) {
            int a = sc.nextInt();
            for (int j = 0; j < a; j++) {
                set.add(sc.nextInt());
            }
        }

        System.out.println(n - set.size());

        sc.close();
    }

}

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

int main() {
	int A,B;
	cin >> A >> B;
	string k = "Bob";
	if(A == B)
	{
		k = "Draw";
	}
	else if(A == 1 ||(B != 1 && A > B))
	{
		k = "Alice";
	}
    cout << k << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <unordered_map>
#include <functional>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cstdlib>

using namespace std;
typedef long long llong;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<llong, llong> pll;

const int MAXN = 1e5 + 1;
int n, m;
int a[MAXN];
int b[MAXN];
vector<int> edge[MAXN];
int ord[MAXN];
int par[MAXN];
int need[MAXN];
llong cost[MAXN];
bool visited[MAXN];
bool ch[MAXN];

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

int main() {
	ios_base::sync_with_stdio(false); cin.tie(0);
	int x, y;
	cin >> n >> m;
	for (int i = 1; i <= n; ++i) {
        cin >> a[i] >> b[i];
	}
	while (m--) {
        cin >> x >> y;
        edge[x].push_back(y);
        edge[y].push_back(x);
	}
	for (int i = 0; i < n; ++i) {
        ord[i] = i + 1;
	}
	sort(ord, ord + n, [&](int i, int j) {
        return a[i] - b[i] < a[j] - b[j];
    });
    
    for (int it = 0; it < n; ++it) {
        int x = ord[it];
        visited[x] = 1;
        vector<int> qs;
        for (int i : edge[x]) {
            if (!visited[i]) continue;
            i = find(i);
            if (!ch[i]) {
                qs.push_back(i);
                ch[i] = 1;
            }
        }
        
        need[x] = max(a[x] - b[x], 0);
        cost[x] = b[x];
        for (int i : qs) {
            need[x] = min((llong)need[x], max((llong)need[i], a[x] - b[x] - cost[i]));
            cost[x] += cost[i];
            par[i] = x;
            ch[i] = 0;
        }
    }
    
    int i = find(1);
    printf("%lld\n", cost[i] + need[i]);
	
	return 0;
}


Measured memory_bytes: 9212
let readInt _ = stdin.ReadLine() |> int

let d = Map []

let rec solve d (arr: int []) current =
    let c = current - 1
    let next = arr.[c]
    if next = 2 then
        d |> Map.count |> (+) 1
    elif d |> Map.containsKey next then
        -1
    else
        let newMap = d |> Map.add next next
        solve newMap arr next


()
|> readInt
|> fun x -> [| 1 .. x |]
|> Array.map readInt
|> solve d
<| 1
|> printfn "%d"


Measured memory_bytes: 54052
#include <bits/stdc++.h>
using namespace std;
int main(){
   int a,b;
   cin>>a>>b;
   int kaito=0;
   for(int i=0;i<=a;i++){
       for(int j=0;j<=a;j++){
        if(0<=b-i-j&&b-i-j<=a){
         kaito++;   
        }
       }
   }
   cout<<kaito<<endl;
}

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


void solve(long long A, long long B){
    if(B % A == 0){
        cout << A + B << endl;
    }else{
        cout << B - A << endl;
    }
}

int main(){
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    solve(A, B);
    return 0;
}


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

using namespace std;
using ll = long long;

#define REP(i, n) for (ll i = 0; i < n; i++)
#define INF 9223372036854775807
#define all(x) (x).begin(), (x).end()

ll ts = 1000000007;

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

  ll n;
  cin >> n;

  ll l, t, ans = 0;

  REP(i, n) {
    cin >> l >> t;

    ans += t - l + 1;
  }

  cout << ans << "\n";
}

Measured memory_bytes: 256
x = int(input())

for ch in range(1, 3501):
    for cn in range(1, 3501):
        a = ch*cn
        if 4*ch*cn % x:
            continue
        b = 4*ch*cn//x - cn - ch
        if b > 0 and a % b == 0:
            print(ch, cn, a//b)
            print()
            exit()

Measured memory_bytes: 67960