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


public class Main{
           
    public static void main(String[] args){            
        
       Scanner sc = new Scanner(System.in);               
      
       int sx = sc.nextInt();
       int sy = sc.nextInt();
       int tx = sc.nextInt();
       int ty = sc.nextInt();
       
       String S = "";
       
       for(int i = 0;i < tx-sx;i++){
           S += "R";
       }
       
       for(int i = 0 ;i < ty-sy;i++){
           S += "U";
       }
       
       for(int i = 0 ; i < tx-sx;i++){
           S += "L";
       }
       
       for(int i= 0 ;i < ty-sy;i++){
           S += "D";
       }
       
       S += "D";
       
        for(int i = 0;i < tx-sx + 1;i++){
           S += "R";
       }
       
        for(int i = 0 ;i < ty-sy + 1;i++){
           S += "U";
       }
        S += "L";
        S +="U";
        
        for(int i = 0 ; i < tx-sx + 1;i++){
           S += "L";
       }
        
        for(int i= 0 ;i < ty-sy+1;i++){
           S += "D";
       }

        S += "R";
        
        System.out.println(S);
       
    }
                                       
}

Measured memory_bytes: 207044
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
using vll = vector<vl>;
using Pll = pair<ll, ll>;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(v) v.begin(), v.end()
#define sz(x) ((int) x.size())
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define F first
#define S second
const int MOD = 1e9+7;
const ll INF = 2e15;
template<class T> void print(const T& t){ cout << t << endl; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}

int main(){
  ll n, a, b, c, d;
  cin >> n >> a >> b >> c >> d;
  string s;
  cin >> s;
  s.insert(0, ".");
  bool OK = true;
  for (ll i = a; i < c; i++){
    if(s[i]=='#'&&s[i+1]=='#'){
      OK = false;
    }
  }
  for (ll i = b; i < d; i++){
    if(s[i]=='#'&&s[i+1]=='#'){
      OK = false;
    }
  }
  if(c>d){
    bool z = false;
    for (ll i = b-1; i < d; i++){
      if (s[i] == '.' && s[i + 1] == '.'&&s[i+2]=='.'){
        z = true;
      }
    }
    if(!z){
      OK = false;
    }
  }
  cout << (OK ? "Yes" : "No") << endl;
}


Measured memory_bytes: 3724
import java.util.Scanner;
public class Main {
     public static void main(String[] args) {
       Scanner ob=new Scanner(System.in);
       int n=ob.nextInt();
       char[] s=ob.next().toCharArray();
       int count=0;
       int  i=0,j=s.length-1;
for(;i<j;)
{
if(s[i]=='R'){++i;continue;}
if(s[j]=='W'){--j;continue;}
if(s[i]!=s[j]){
char temp=s[i];
s[i]=s[j];
s[j]=temp;
count++;
}
}
/*for(int k=0;k<s.length;k++){
    System.out.print(s[k]);
}*/
    System.out.println(count);
     } 
}

Measured memory_bytes: 31732
#include<iostream>
#include<cstdio>
#include<string>
#include<cstring>
#include<vector>
#include<algorithm>
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;

vector<int> x,y;
int num[5001][5001];

int index(vector<int> &v,int x){
	int l,r;
	l=-1;r=v.size();
	while(1<r-l){
		int m=(r+l)/2;
		if(v[m]<=x)l=m;
		else r=m;
	}
	return l;
}
int main(){
	vector<pair<int,int> > treasure;
	int n,m;
	int a,b,c,d;
	cin>>n>>m;

	//x.push_back(-1000000000);
	//y.push_back(-1000000000);
	rep(i,n){
		cin>>a>>b;
		x.push_back(a);
		y.push_back(b);
		treasure.push_back(make_pair(a,b));
	}
	sort(x.begin(),x.end());
	x.erase(unique(x.begin(),x.end()), x.end());
	sort(y.begin(),y.end());
	y.erase(unique(y.begin(),y.end()), y.end());
	rep(i,n){
		a = index(x,treasure[i].first);
		b = index(y,treasure[i].second);
		++num[a][b];
	}
	rep(i,x.size()){
		rep(j,y.size()){
			a=b=c=d=0;
			if(0<i&&0<j)a = num[i-1][j-1];
			if(0<i)b = num[i-1][j];
			if(0<j)c = num[i][j-1];
			d = num[i][j];
			num[i][j] = d+c+b-a;
		}
	}

	rep(i,m){
		int x1,y1,x2,y2;
		cin>>x1>>y1>>x2>>y2;
		x1 = index(x,x1-1);
		y1 = index(y,y1-1);
		x2 = index(x,x2);
		y2 = index(y,y2);
		a=b=c=d=0;
		if(x1!=-1&&y1!=-1)a = num[x1][y1];
		if(x1!=-1&&y2!=-1)b = num[x1][y2];
		if(x2!=-1&&y1!=-1)c = num[x2][y1];
		if(x2!=-1&&y2!=-1)d = num[x2][y2];
		cout<< d-c-b+a <<endl;
	}
	return 0;
}

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

typedef long long lint;
typedef pair<int, int> P;
#define REP(i, x, n) for(int i = x ; i < n ; ++i)
#define rep(i, n) for(int i = 0 ; i < n ; ++i)
#define repr(i, n) for(int i = n - 1 ; i >= 0 ; --i)
#define ALL(x) (x).begin(), (x).end()
#define SORT(x) sort((x).begin(), (x).end())

const int IINF = 1e9 + 10;
const long long LLINF = (long long)1e18 + 10;
const long long MOD = (long long)1e9 + 7;
const int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
const int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};
const double EPS = 1e-8;

int main(){
    int k, t;
    cin >> k >> t;
    int maxi = 0;
    rep(i, t){
        int a;
        cin >> a;
        maxi = max(maxi, a);
    }
    int ans = max(maxi - 1 - (k - maxi), 0);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MX=100010, inf=2e9;
ll n, m, ans=0;
int main(){
	cin>>n>>m;
	if(n>m) swap(n,m);
	if(n==1){
		if(m==1) ans=1;
		else ans=m-2;
	}
	else{
		ans=(n-2)*(m-2);
	}
	cout<<ans;
	return 0;
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()

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

const long long INF = 3e18 + 12;
const int inf = 1e9;

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

  if (a == 1 || b == 1) {
    cout << 1 << endl;
    return 0;
  }

  if ((a * b % 2) == 0) {
    cout << (a * b) / 2 << endl;
    return 0;
  } else {
    cout << (a * b + 1) / 2 << endl;
  }

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define F first
#define S second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define pb push_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#ifdef leowang
#define debug(...) do{\
	fprintf(stderr,"%s - %d : (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
	_DO(__VA_ARGS__);\
}while(0)
template<typename I> void _DO(I&&x){cerr<<x<<endl;}
template<typename I,typename...T> void _DO(I&&x,T&&...tail){cerr<<x<<", ";_DO(tail...);}
#else
#define debug(...)
#endif
template<typename T1,typename T2>
ostream& operator<<(ostream& out,pair<T1,T2> P){
	out<<'('<<P.F<<','<<P.S<<')';
	return out;
}
//}}}
const ll maxn=300005;
const ll maxlg=__lg(maxn)+2;
const ll INF64=8000000000000000000LL;
const int INF=2000000000;
const ll MOD=ll(1e9+7);
const double PI=acos(-1);
//const ll p=880301;
//const ll P=31;
/*
ll mypow(ll a,ll b){
	ll res=1LL;
	while(b){
		if(b&1) res=res*a%MOD;
		else a=a*a%MOD;
		b>>=1;
	}
	return res;
}
*/
ll ans[55];

int main()
{
	//IOS;
	ll k;
	cin>>k;
	int n=50;
	for(int i=0;i<50;i++) ans[i]=k/n+49;
	k%=n;

	for(int i=0;i<k;i++){
		ans[i]+=n;
		REP(j,n) ans[j]--;
	}
	cout<<n<<'\n';
	REP(i,n) cout<<ans[i]<<' ';

	return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<climits>
#include<iostream>
#include<sstream>
#include<utility>
#include<map>
#include<vector>
#include<queue>
#include<algorithm>
#include<set>
#include<stack>
using namespace std;
typedef long long ll;
typedef pair<int,int>P;

ll bsch(ll t,ll a,ll bt,ll ba)
{
	ll l=0,r=1000000000000000000/max(a,t),m;
	for(;r-l>1;)
	{
		m=(r+l)/2;
		if(bt<=t*m&&ba<=a*m)
			r=m;
		else
			l=m;
	}
	return r;
}

int main()
{
	ll N,T,A,t=1,a=1,r;
	scanf("%lld",&N);
	for(int i=0;i<N;i++)
	{
		scanf("%lld%lld",&T,&A);
		r=bsch(T,A,t,a);
		t=T*r;
		a=A*r;
	}
	printf("%lld\n",t+a);
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a) for(int i = 0; i < (a); i++)
#define ALL(a) (a).begin(),(a).end()
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const int MOD = 1e9 + 7;

signed main(){
    ll a,b,c;
    cin >> a >> b >> c;
    if(a % 2 == 0 || b % 2 == 0 || c % 2 == 0) cout << 0 << endl;
    else cout << min(a * b, min(b * c, c * a)) << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>

using namespace std;
int main(){
    int h,w;

    while(1){
        cin >> h >> w;
        if(h == 0 && w == 0){
            break;
        }else{
            for(int i = 0; i < h; i++){
                for(int j = 0; j < w; j++){
                    cout << "#" << flush;
                }
                cout << endl;
            }
            cout << endl;
        }
    }
}


Measured memory_bytes: 3100
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repd(i,a,b) for (int i = (a); i < (b); i++)
#define INF LLONG_MAX
#define mod 1000000007
typedef long long ll;
int main(void)
{
	string S;
	cin >> S;
  if(S[2]==S[3] && S[4] == S[5]) cout << "Yes" << endl;
  else cout << "No" << endl;
	return 0;
}


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

# define pb push_back
# define ll long long

using namespace std;

ll z , o ;

	
int main() {

	ll n , a , b ;
	cin >> n >> a >> b ;
	ll c = a + b ;
	ll t = n / c ;
	ll u = n % c ;
	ll h = min( u , a ) ;
	cout << ( t * a ) + h ; 

}


Measured memory_bytes: 256
import sys


def I(): return int(sys.stdin.readline().rstrip())


def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))


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


def LS(): return list(sys.stdin.readline().rstrip().split())


a,b = LI()
if a<b:
    print('a < b')
elif a>b:
    print('a > b')
elif a==b:
    print('a == b')


Measured memory_bytes: 5604
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repl(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define reprl(i, n) for(ll i = n; i >= 0; i--)
#define fori(i, m, n) for(int i = m; i < (int)n; i++)
#define forl(i, m, n) for(ll i = m; i < (ll)n; i++)
#define all(v) v.begin(), v.end()
ll gcd(ll a,ll b) {
  return b? gcd(b,a%b): a;  
}
ll lcm(ll a,ll b) {
  return a*b/gcd(a,b);
}
bool isLowerCase(char c){
  return (c>='a'&&c<='z');
}
const string stringFrom(bool ans){
  return (ans?"YES":"NO");
}
int main() {
  int a,b,x;cin>>a>>b>>x;
  bool ans=false;
  if(x<a){
    ans=false;
  }else if(x<=a+b){
    ans=true;
  }else{
    ans=false;
  }
  cout << stringFrom(ans) << endl;
  return 0;
}


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

using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
constexpr ll TEN(int n) { return (n==0) ? 1 : 10*TEN(n-1); }
template<class T> using V = vector<T>;
template<class T> using VV = V<V<T>>;

template<class D>
struct Hungarian {
    V<D> le, ri;
    V<int> perm;

    Hungarian(const VV<D> &c) {
        int n = int(c.size()), m = int(c[0].size());
        assert(n <= m);
        le = V<D>(n, D(0)); ri = V<D>(m, D(0));
        perm = V<int>(n);
        V<int> tori(n, -1), tole(m, -1);

        auto cost = [&](int l, int r) { return c[l][r] + le[l] + ri[r]; };
        for (int l = 0; l < n; l++) {
            V<bool> leu(n), riu(m);
            V<int> tr(m, -1), mai(m, l);
            leu[l] = true;

            while (true) {
                int b = -1;
                D d = numeric_limits<D>::max();
                for (int j = 0; j < m; j++) {
                    if (!riu[j] && cost(mai[j], j) < d) {
                        b = j;
                        d = cost(mai[j], j);
                    }
                }
                for (int i = 0; i < n; i++) if (leu[i]) le[i] -= d;
                for (int j = 0; j < m; j++) if (riu[j]) ri[j] += d;
                tr[b] = mai[b];
                int c = tole[b];
                if (c == -1) {
                    while (b != -1) {
                        int a = tr[b], z = tori[a];
                        tole[b] = a;
                        tori[a] = b;
                        b = z;
                    }
                    break;
                }
                riu[b] = leu[c] = true;
                for (int j = 0; j < m; j++) {
                    if (cost(c, j) < cost(mai[j], j)) {
                        mai[j] = c;
                    }
                }
            }
        }
        perm = tori;
    }    
};

using D = double;
const D PI = acos(D(-1)), EPS = 1e-10;
using P = complex<D>;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(20) << fixed;

    D ans = 0;

    int n;
    cin >> n;
    V<P> up(n), dw(n);
    D x, y;
    cin >> x >> y;
    for (int i = 0; i < n; i++) {
        cin >> x >> y; up[i] = P(x, y);
        cin >> x >> y; dw[i] = P(x, y);
        ans += abs(up[i]-dw[i]);
    }

    int l = int(up.size()), r = int(dw.size());
    VV<D> cost(l, V<D>(r));
    for (int i = 0; i < l; i++) {
        for (int j = 0; j < r; j++) {
            cost[i][j] = abs(up[i] - dw[j]);
        }
    }
    auto perm = Hungarian<D>(cost).perm;
    for (int i = 0; i < l; i++) {
        ans += cost[i][perm[i]];
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 3896
/*
ID: anonymo14
TASK: wormhole
LANG: C++                 
*/
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pair<int,int>> vpii;

#define F first
#define S second
#define PU push
#define PUF push_front
#define PUB push_back
#define PO pop
#define POF pop_front
#define POB pop_back

#define REP(i,a,b) for(int i=a; i<=b; i++)

#define MOD 1000000007

void solve(int test_case) {//223
	int d,n;
	cin>>d>>n;
	if(n==100)n++;
	string ans = to_string(n);
	while(d--)ans+="00";
	cout<<ans;
}

int main() {
	
	////// FILE BASED IO////
	//freopen("wormhole.in", "r", stdin);
	//freopen("wormhole.out", "w", stdout);
	///////////////
	
	ios::sync_with_stdio(0);
	cin.tie(0);
	int t=1;
	//cin>>t;
	REP(i,1,t) {
		solve(i);
	}
	return 0;
}	


Measured memory_bytes: 3696
#include <iostream>
#include <vector>
using namespace std;
using ll = long long;

void max_str(string &s, string t)
{
    if (s == "-")
        s = t;
    else if (s.size() < t.size())
        s = t;
    else if (s.size() == t.size() && s < t)
        s = t;
}

int match[10] = {2, 5, 5, 4, 5, 6, 3, 7, 6};
int N, M;
string dp[10100];

int main()
{
    cin >> N >> M;
    vector<int> A(M);
    for (int i = 0; i < M; i++)
    {
        cin >> A[i];
    }
    for (int i = 0; i < 10010; i++)
    {
        dp[i] = "-";
    }
    dp[0] = "";
    for (int i = 0; i <= N; i++)
    {
        if (dp[i] == "-")
            continue;
        for (auto a : A)
        {
            max_str(dp[i + match[a - 1]], dp[i] + (char)('0' + a));
        }
    }
    cout << dp[N] << endl;
}

Measured memory_bytes: 44800
#include<iostream>
#include<vector>
#include<atcoder/segtree>

using namespace std;
using namespace atcoder;

int64_t vi;
int64_t op(int64_t a,int64_t b){return a<b?b:a;}
int64_t e(){return -1;}
bool f(int64_t aj){return aj<vi;}

int32_t main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n,q;
  cin>>n>>q;
  vector<int64_t> a(n);
  for(auto& ai:a)cin>>ai;
  
  using RMQ = segtree<int64_t,op,e>;
  RMQ seg(a);
  
  while(q--){
    int t;cin>>t;
    if(t==1){
      int x,v;cin>>x>>v;x--;
      seg.set(x,v);
    }
    if(t==2){
      int l,r;cin>>l>>r;l--;r--;
      cout<<seg.prod(l,r+1)<<'\n';
    }
    if(t==3){
      int x;cin>>x>>vi;x--;
      int res = seg.max_right<f>(x);
      cout<<res+1<<'\n';
    }
  }
}


Measured memory_bytes: 9020
#include<iostream>
using namespace std;
int main() {
    int G;
    //cin >> G;
    while(1) {
    int ans = 10000000;
    cin >> G;
    if (G==0)break;
    for (int a = 0; a <= 25; ++a){
      for (int b = 0; b <= 16; ++b){
	for (int c = 0; c <= 10; ++c){
	  
	  int k = 200 * a + 300 * b + 500 * c;
	  if (k != G) continue;
	  
	  // cout << a << " " << b << " " << c << endl; 
	  int s = a % 5;
	  int S = a - s;
	  int x = 380 * 0.8 * S + 380 * s;

	  int t = b % 4;
	  int T = b - t;
	  int y = 550 * 0.85 * T + 550 * t;

	  int u = c % 3;
	  int U = c - u;
	  int z = 850 * 0.88 * U + 850 * u;

	  int g = x + y + z;

          //int h[] = {g};
          //int min = h[0];
          //for (int i = 0; i < 10000000; i++){
	  //  if (h[i] < min)
	  //    min = h[i];
	  //}
	  //cout << min << endl;
	  // もしgがansより小さければansをgに書き換える
	  if (g < ans){
	    ans = g;
	      }
	    }
          }
        }
      cout << ans << endl;  
    }
  return 0;
}
    
    
 



Measured memory_bytes: 2992
#include <stdio.h>
#include <string.h>
#define MAX 1001

typedef struct{
  char str1[MAX];
  char str2[MAX];
} STR;

int c[MAX+1][MAX+1];
int m,n;

int LCSLength(char *X, char *Y){
  int i,j;
  
  m = strlen(X);
  n = strlen(Y);
  
  for(i=1; i <= m; i++) c[i][0] = 0;
  for(j=0; j <= n; j++) c[0][j] = 0;

  for(i=1; i <= m; i++){
    for(j=1; j <= n; j++){
      if(X[i-1] == Y[j-1]){
	c[i][j] = c[i-1][j-1] + 1;
      } else {
	if(c[i-1][j] >= c[i][j-1]){
	  c[i][j] = c[i-1][j];
	} else {
	  c[i][j] = c[i][j-1];
	}
      }
    }
  }

  return c[m][n];
}

int main(){
  int n,i;

  scanf("%d",&n);
  
  STR str[n];
  int C[n];

  for(i=0; i < n; i++){
    scanf("%s",str[i].str1);
    scanf("%s",str[i].str2);
    C[i] = LCSLength(str[i].str1,str[i].str2);
  }
  for(i=0; i < n; i++){
    printf("%d\n",C[i]);
  }

  return 0;
}



Measured memory_bytes: 5672
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#include<iomanip>
#include<set>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-7
#define mp(a1,a2) make_pair(a1,a2)
typedef long long ll;
typedef long double ld;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=1e+18+1;
int INF=1e+9+1;
int main(){
	int N;
	ll A[100001],B[100001]={};
	scan(N);
	rep(i,N+1){
		scan(A[i]);
	}
	rep(i,N){
		scan(B[i]);
	}
	ll ans=0;
	for(int i=N;i>=0;i--){
		ans+=min(A[i],B[i]);
		A[i]-=min(A[i],B[i]);
		if(i>0){
			ans+=min(A[i],B[i-1]);
			B[i-1]-=min(A[i],B[i-1]);
		}
	}
	prin(ans);
	return 0;
}


Measured memory_bytes: 1792
# Problem D - Disjoint Set of Common Divisors

import fractions

# 約数を列挙する関数
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    divisors.sort()
    return divisors

# 素因数分解
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

# input
A, B = map(int, input().split())
C = fractions.gcd(A, B)
if A==1 or B==1:
    print(1)
elif C==1:
    print(1)
else:
    arr = factorization(C)
    print(len(arr) + 1)


Measured memory_bytes: 64108
#include <bits/stdc++.h>
using namespace std;
int main() {
  int X;
  cin >> X;
  long A, B;
  long fA, fB;
  for (A = -150; A < 150; A++) {
    fA = A*A*A*A*A;
    for (B = -150; B < 150; B++) {
      fB = B*B*B*B*B;
      if (fA - fB == X) {
        break;
      }
    }
    if (fA - fB == X) {
      break;
    }
  }
  cout << A << ' '<< B << endl;
  return 0;
}

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

int main() {
  string str;
  cin >> str;
  
  int count = 0;
  int i = 0;
  
  while (i < 15) {
    if (str[i] == 'x') {
      count++;
    }
    i++;
  }
  
  if (count < 8) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
  
  return 0;
}

Measured memory_bytes: 256
c1 = gets.split.map(&:to_i);
c2 = gets.split.map(&:to_i);
c3 = gets.split.map(&:to_i);

if c1[1] - c1[0] == c2[1] - c2[0] and c2[1] - c2[0] == c3[1] - c3[0]
    if c1[2] - c1[1] == c2[2] - c2[1] and c2[2] - c2[1] == c3[2] - c3[1]
        if c1[0] - c1[2] == c2[0] - c2[2] and c2[0] - c2[2] == c3[0] - c3[2]
            if c2[0] - c1[0] == c2[1] - c1[1] and c2[1] - c1[1] == c2[2] - c1[2]
                if c3[0] - c2[0] == c3[1] - c2[1] and c3[1] - c2[1] == c3[2] - c2[2]
                    if c1[0] - c3[0] == c1[1] - c3[1] and c1[1] - c3[1] == c1[2] - c3[2]
                        puts "Yes"
                        exit
                    end
                end
            end
        end
    end
end

puts "No"
    

Measured memory_bytes: 1788
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <set>
#include <stack>
using ll = long long;
using uint = unsigned int;
using graph = std::vector<std::vector<ll>>;
using wGraph = std::vector<std::vector<std::pair<ll,ll>>>;
#define rep(i,n) for (int i=0; i < int(n); i++)

using namespace std;
ll MOD7 = 1000000007;
ll MOD9 = 1000000009;
vector<ll> InputVec(ll N){
    vector<ll> A(N);
    for (int i = 0; i < N; ++i) {
        cin >> A[i];
    }
    return A;
}
void OutputVec(vector<ll> A){
    for (int i = 0; i < A.size(); ++i) {
        cout << A[i] << ",";
    }
    cout << endl;
}
vector<vector<ll>> InputVec2d(ll H,ll W){
    vector<vector<ll>> A(H);
    for (int yi = 0; yi < H; ++yi) {
        A[yi] = vector<ll>(W);
    }
    for (int yi = 0; yi < H; ++yi) {
        for (int xi = 0; xi < W; ++xi) {
            cin >> A[yi][xi];
        }
    }
    return A;
}
vector<vector<char>> InputVec2dStr(ll H,ll W){
    vector<vector<char>> A(H);
    for (int yi = 0; yi < H; ++yi) {
        A[yi] = vector<char>(W);
    }
    for (int yi = 0; yi < H; ++yi) {
        string S;
        cin >> S;
        for (int xi = 0; xi < W; ++xi) {
            A[yi][xi] = S[xi];
        }
    }
    return A;
}
void OutputVec2d(vector<vector<ll>> A){
    for (int yi = 0; yi < A.size(); ++yi) {
        for (int xi = 0; xi < A[yi].size(); ++xi) {
            cout << A[yi][xi] << ",";
        }
        cout << endl;
    }
}
graph InputGraph(ll N,ll M){
    graph G(N);
    for (int i = 0; i < M; ++i) {
        ll a,b;
        cin >> a >> b;
        a--;b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    return G;
}
graph InputDGraph(ll N,ll M){
    graph G(N);
    for (int i = 0; i < M; ++i) {
        ll a,b;
        cin >> a >> b;
        a--;b--;
        G[a].push_back(b);
    }
    return G;
}
void OutputGraph(graph G){
    for (int i = 0; i < G.size(); ++i) {
        cout << i << ":";
        for (int j = 0; j < G[i].size(); ++j) {
            cout << G[i][j]<< ",";
        }
        cout << endl;
    }
}
void OutputAnswerBool(bool b,bool isUpperCase = false){
    if(b){
        if(isUpperCase){
            cout << "YES" << endl;
        }else{
            cout << "Yes" << endl;
        }
    }else{
        if(isUpperCase){
            cout << "NO" << endl;
        }else{
            cout << "No" << endl;
        }
    }
}

int main() {
    ll A,B,C,K;
    cin >> A >> B >> C >> K;
    ll result = (A-B) * ((K % 2 == 0) ? 1 : -1);
    cout << result << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

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

        int a = scan.nextInt();
        int b = scan.nextInt();
        int c = scan.nextInt();

        if (a < b && b< c) {
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }

    }
}



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

using namespace std;

int main() {
	int T, ar[200];
	cin >> T;
	
	for(int i = 0; i < T; i++) {
		cin >> ar[i];
	}
	sort(ar, ar+T);
	int j1 = ar[0],j2 = ar[T-1], sum = 0, temp = INT_MAX; 
	while(j1 <= j2) {
		for(int i = 0; i < T; i++) {
			sum += (ar[i] - j1) * (ar[i] - j1);
		}	
		temp = min(sum, temp);
		sum = 0;
		j1++;
	}
	
	cout << temp << endl;	
	return 0;
}






Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define F first
#define S second
#define forn(i, n) for (int i = 0; i < (int)n; i++)
#define pb push_back
#define fastIO ios::sync_with_stdio(0), cin.tie(0);
#define endl '\n'
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> pii;
int main() {
#ifdef LOCAL
    // freopen("in.txt", "r", stdin);
    // freopen("out.txt", "w", stdout);
#else
    fastIO;
#endif
    int n;
    cin >> n;
    int mx = 0;
    int ans = 0;
    forn(i, n) {
        int cur = i + 1;
        int cnt = 0;
        while (cur % 2 == 0) {
            cur /= 2;
            cnt++;
        }
        if (cnt >= mx) {
            mx = cnt;
            ans = i + 1;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 384
//#include <bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <stdio.h>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <time.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

ll N, M;
ll A[int(1e5 + 5)], sum[int(1e5 + 5)];
map<ll, ll> mp;

int main(){
  scanf("%lld%lld", &N, &M);
  mp[0]++;
  for (int i = 1; i <= N; i++){
    scanf("%lld", A+i);
    sum[i] = sum[i-1] + A[i];
    sum[i] %= M;
    mp[sum[i]]++;
  }


  ll ans = 0;
  for (int i = 0; i <= N; i++){
    mp[sum[i]]--;
    ans += mp[sum[i]];
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 9100
import java.math.BigInteger;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        Main m = new Main();
        m.resolve(scan);
        scan.close();
    }

    final private void resolve(Scanner scan) {
        double x = scan.nextDouble();
        long tmp = 100;
        long cnt = 0;
        while (tmp < x) {
            cnt++;
            tmp = (long) (tmp + tmp * 0.01);
        }
        System.out.println(cnt);
    }
}

Measured memory_bytes: 37360
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define F first
#define S second
#define int long long
#define ull  unsigned long long
#define pb push_back

using namespace std;
using namespace __gnu_pbds;
typedef  tree< int , null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

const int N = 110000;
int a[N];
main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //freopen("input.txt",  "r", stdin);
    //freopen("output.txt", "w", stdout);
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++) cin >> a[i];
    int ans = 0;
    for (int i = 1; i <= n; i++){
        if (a[i] == i){
            swap(a[i], a[i + 1]);
            ans++;
        }
    }
    cout << ans;
}


Measured memory_bytes: 1024
import queue
import math
import copy
"""
N = int(input())
#S = input()
# (N,M) = (int(i) for i in input().split(" "))
# A = [int(i) for i in input().split()]
A = []
for i in range(N):
	A.append(int(input()))

print(A)

"""

N = int(input())
A = [input().split() for i in range(N)]
S = input()
ans = -1
for a in A:
	if ans != -1:
		ans += int(a[1])
	if a[0] == S:
		ans = 0
print(ans)

Measured memory_bytes: 4208
/*** author: yuji9511 ***/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using lpair = pair<ll, ll>;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i=(m);i<(n);i++)
#define rrep(i,m,n) for(ll i=(m);i>=(n);i--)
#define printa(x,n) for(ll i=0;i<n;i++){cout<<(x[i])<<" \n"[i==n-1];};
void print() {}
template <class H,class... T>
void print(H&& h, T&&... t){cout<<h<<" \n"[sizeof...(t)==0];print(forward<T>(t)...);}

ll msb(ll v){
    v = v | (v >> 1LL);
    v = v | (v >> 2LL);
    v = v | (v >> 4LL);
    v = v | (v >> 8LL);
    v = v | (v >> 16LL);
    v = v | (v >> 32LL);
    return v ^ (v >> 1LL);
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    ll A[100010];
    rep(i,0,N) cin >> A[i];
    ll ans = 0;
    rep(d,0,60){
        ll cnt = 0;
        rep(i,0,N){
            if((A[i]>>d)&1) cnt++; 
        }
        if(cnt % 2 == 1){
            ans += (1LL<<d);
            rep(i,0,N){
                if((A[i]>>d)&1){
                    A[i] -= (1LL<<d);
                }
            }
        }
    }
    vector<ll> V;
    rep(i,0,N){
        for(auto &v: V) if(msb(v) & A[i]) A[i] ^= v;
        if(A[i] > 0){
            for(auto &v: V) if(msb(A[i]) & v) v ^= A[i];
            V.push_back(A[i]);
            sort(V.begin(), V.end(), greater<ll>());
        }
    }

    ll res = 0;
    for(auto &v: V) res ^= v;
    ans += res * 2;
    print(ans);


    

}

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


#define FOR(i, start, end) for(uint64_t i=start; i<end; i++)
#define REP(i, n) FOR(i, 0, n)

// 最大公約数gcd
// 最小公倍数lcm=m*n/gcd
uint64_t gcd(uint64_t m, uint64_t n) {
  uint64_t temp;
  while (m % n != 0){
    temp = n;
    n = m % n;
    m = temp;
  }
  return n;
}

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

void comb(vector<vector <uint64_t> > &v){
  for(uint64_t i = 0;i <v.size(); i++){
    v[i][0]=1;
    v[i][i]=1;
  }
  for(uint64_t k = 1;k <v.size();k++){
    for(uint64_t j = 1;j<k;j++){
      v[k][j]=(v[k-1][j-1]+v[k-1][j]);
    }
  }
}

// 掛け算オーバーフロー判定
bool is_product_overflow(uint64_t a, uint64_t b) {

	uint64_t prod = a * b;
	
	return (prod / b != a);
}

//素因数分解
void primeFactorization(uint64_t a, list<uint64_t> &factors){ //素因数分解を出力するプログラム
  long i,sq;
  if(a%2==0){ //偶数の場合
    factors.push_back(2);
    primeFactorization(a/2,factors); //2で割った値で再帰
    return;
  }
  sq = sqrt(a);
  for(i=3;i<=sq;i+=2){ //3以上√a以下の奇数の場合
	if(a%i==0){
	  factors.push_back(i);
      primeFactorization(a/i,factors); //割れた値で再帰
      return;
	}
  }
  //偶数でも3以上√a以下の奇数の場合でも割り切れない場合
  if(a!=1){ //aが1でないなら、a自身は素数
    factors.push_back(a);
  }
}

// 円周率
// M_PI

// #include <iomanip> // setprecisionを使用するのに必要
// cout << std::fixed << std::setprecision(15) << y << endl;

// 昇順
// priority_queue<int, vector<int>, greater<int> > queue;

signed main() {
  int64_t h,w;
  while(true){
      cin >> h >> w;
      if(h==0&&w==0) break;
      for(int y=0;y<h;y++){
          for(int x=0;x<w;x++){
              if((x+y)%2==0) cout << "#";
              else cout << ".";
          }
          cout << endl;
      }
      cout << endl;
  }

  return 0;
}


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

int main(int argc, char const* argv[])
{
  char a, b;
  cin >> a >> b;
  if (a=='H') {
    cout << b << endl;
  } else {
    if (b=='H') {
      cout << 'D' << endl;
    } else {
      cout << 'H' << endl;
    }
  }
  return 0;
}


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

int main(){
	int n, square[15][15], count = 0;
	while(std::cin >> n, n){
		count = 0;
		memset(square, 0, sizeof(square));

		int x = n/2, y = n/2+1;
		square[y][x] = ++count;
		while(count != n*n){
			x++, y++;
			while(x < 0 || x >= n || y < 0 || y >= n || square[y][x] != 0){
				if(x >= n)x = 0;
				if(x < 0)x = n-1;
				if(y >= n)y = 0;
				if(square[y][x])x--, y++;
			}
			square[y][x] = ++count;
		}

		for(int i=0;i<n;i++){
			for(int j=0;j<n;j++){
				printf("%4d", square[i][j]);
			}
			puts("");
		}
	}
}

Measured memory_bytes: 0
N = int(input())
L = list(map(int,input().split()))
from itertools import combinations
Ms = list(combinations(L,3))
cnt = 0
for M in Ms:
    L1,L2,L3 = M[0],M[1],M[2]
    if L1!=L2 and L2!=L3 and L1!=L3:
        if abs(L1-L2) < L3 and L3 < L1+L2:
            cnt+=1
print(cnt)


Measured memory_bytes: 87028
import math

k=int(input())
ans=0
for a in range(1,k+1):
    for b in range(1,a+1):
        for c in range(1,b+1):
            if (a==b) and (b==c):
                ans+=math.gcd(a,math.gcd(b,c))
            if ((a!=b) and (b==c)) or ((a==b) and (b!=c)):
                ans+=3*math.gcd(a,math.gcd(b,c))
            if ((a!=b) and (b!=c)):
                ans+=6*math.gcd(a,math.gcd(b,c))
print(ans)

Measured memory_bytes: 9212
N=int(input())
A_1 = list(map(int, input().split()))
A_2 = list(map(int, input().split()))
sum=0
for k in range(1,N+1):
    sum_2=0
    for i in range(0,k): 
        sum_2=sum_2+A_1[i]
    for j in range(k-1,N):
        sum_2=sum_2+A_2[j]
    if sum<sum_2:    
        sum=sum_2    
print(sum)

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

#define REP(i, n) for (ll (i) = 0 ; (i) < (ll)(n) ; ++(i))
#define REPN(i, m, n) for (ll (i) = m ; (i) < (ll)(n) ; ++(i))
#define REP_REV(i, n) for (ll (i) = (ll)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (ll (i) = (ll)(n) - 1 ; (i) >= m ; --(i))

#define INF 2e9
#define INF_LL 1LL<<60
#define ll long long

typedef pair<int, int> P;

int main(){
    int a, b;
    cin >> a >> b;
    
    if(a < b) {
        REP(i, b) cout << a;
    } else if(a > b) {
        REP(i, a) cout << b;
    } else {
        int tmp = min(a, b);
        REP(i, tmp) {
            cout << a;
        }
    }

    cout << endl;

    return 0;
}

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

using pii = pair<int,int>;
using ll = long long;
#define rep(i, j) for(int i=0; i < (int)(j); i++)
#define repeat(i, j, k) for(int i = (j); i < (int)(k); i++)
#define all(v) v.begin(),v.end()
#define debug(x) cerr << #x << " : " << x << endl

template<class T> bool set_min(T &a, const T &b) { return a > b  ? a = b, true : false; }
template<class T> bool set_max(T &a, const T &b) { return a < b  ? a = b, true : false; }
// vector
template<class T> istream& operator >> (istream &is , vector<T> &v) { for(T &a : v) is >> a; return is; }
template<class T> ostream& operator << (ostream &os , const vector<T> &v) { for(const T &t : v) os << "\t" << t; return os << endl; }
// pair
template<class T, class U> ostream& operator << (ostream &os , const pair<T, U> &v) { return os << "<" << v.first << ", " << v.second << ">"; }

const int INF = 1 << 30;
const ll INFL = 1LL << 60;


class Solver {
  public:
    bool solve() {
        int X; cin >> X;
        vector<int> dp(X + 100);
        dp[0] = 1;
        rep(i, dp.size()) {
            if(dp[i]) {
                rep(j, 6) {
                    if(i + 100 + j < dp.size()) {
                        dp[i + 100 + j] = 1;
                    }
                }
            }
        }
        cout << (dp[X] ? 1 : 0) << endl;
        return 0;
    }
};

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


Measured memory_bytes: 640
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

            Scanner scanner = new Scanner(System.in);
            String input = scanner.nextLine();
            String[] inputs = input.split(" ");

            int n = Integer.parseInt(inputs[0]);
            int x = Integer.parseInt(inputs[1]);

            String lineStr = scanner.nextLine();
            String[] lines = lineStr.split(" ");
            int[] line = new int[n];

            for (int i = 0;i < n;i++) {
                 
                line[i] = Integer.parseInt(lines[i]);
            }

            int answer = 1;
            int distance = 0;

            for (int i =0;i< n;i++) {

                distance  = distance + line[i];
                
                if (distance > x) {
                    break;
                } 

                answer++;

            }

            System.out.println(answer);
            
            scanner.close();
    }
}

Measured memory_bytes: 22100
// In the name of God

#include <bits/stdc++.h>

using namespace std;

const int N = 1e5+5;

long long a[N];

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	long long n, k, q;
	cin >> n >> k >> q;
	while(q--) {
		int x;
		cin >> x;
		x--;
		a[x+1]--;
		a[0]--;
		a[x]++;
	}
	for(int i=1;i<n;i++) {
		a[i] += a[i-1];
	}
	for(int i=0;i<n;i++) {
		if(a[i] <= -k) {
			cout << "No\n";
		}
		else cout << "Yes\n";
	}
	return 0;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < n; ++i)
#define repR(i, n) for(ll i = n; i >= 0; ++i)
#define FDS(i, n) for(ll i = 0; i < n; ++i)
#define FDSR(i, n) for(ll i = n; i >= 0; ++i)
#define FOR(i, m, n) for(ll i = m; i < n; ++i)
#define FORR(i, m, n) for(ll i = m;i >= n;--i)
#define VSORT(v) sort(v.begin(), v.end());
#define VREV(v) reverse(v.begin(), v.end());
#define INF 999999999
#define itn ll
#define ednl endl
using namespace std;
typedef long long ll;template<typename Typell>Typell G_C_D(Typell a, Typell b){if (a < 0) a = -a;if (b < 0) b = -b;while (b != 0) {a %= b;if (a == 0) return b;b %= a;}return a;}template<typename Typell>
Typell G_C_D(const std::vector<Typell> &list){Typell a = list[0];for (size_t i = 1; i < list.size(); ++i) {a = G_C_D(a, list[i]);}return a;}template<typename Typell>Typell L_C_M(Typell a, Typell b) {if( a == 0 && b == 0)return 0;return a / G_C_D(a, b) * b;}
template<typename Typell>Typell L_C_M(const std::vector<Typell> &list){Typell a = list[0];for (size_t i = 1; i < list.size(); ++i) {a = L_C_M(a, list[i]);}return a;}
ll mod = 1000000007;
int main(){
	cin.tie(0);ios::sync_with_stdio(false);
	string S;
	cin>>S;
	ll ans=0;
	ll sub=0;
	for(int i=0;i<(1<<(S.size()-1));i++){
		FDS(j,S.size()){
			sub=sub*10+S[j]-'0';
			if((i>>j)&1){
				ans+=sub;
				sub=0;
			}
		}
		ans+=sub;
		sub=0;
	}
	cout<<ans<<endl;
}

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

int main() {
	int N;
	cin >> N;
	int64_t a = 2,b = 1,c = 0;
	if(N == 1)
	{
		cout << b << endl;
	}
	else
	{
	for(int i = 1;i < N ;i++)
	{
		c = b + a;
		a = b;
		b = c;
    }
    cout << c << endl;
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <random>
#include <string>
#include <bitset>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <cstring>
#include <cstdlib>
#include <cctype>

#define REP(i, n) for(int i = 0; i < n; ++i)
#define REPR(i, n) for(int i = n; i >= 0; --i)
#define FOR(i, m, n) for(int i = m; i < n; ++i)
#define FORR(i, m, n) for(int i = m; i >= n; --i)
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define INF 999999999

using namespace std;

typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

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

llong pow(int x, int n) {
    llong ans = x;
    if (n == 0) return 1;

    for(int i = 0; i < n - 1; i++) {
        ans *= x;
    }

    return ans;
}

void swap(int *X, int *Y){
    int t = *X; *X = *Y; *Y = t;
}

const static int MAX = 8 + 1;

int n, m, cnt = 0;
bool visited[MAX];
vector<int> Adj[MAX];

bool check() {
    REP(i, n + 1) {
        if (!visited[i]) return false;
    }

    return true;
}

void dfs(int v) {
    visited[v] = true;
    if (check()) {
        cnt += 1;
        visited[v] = false;
        return;
    }

    for (int i = 0; i < Adj[v].size(); ++i) {
        if (!visited[Adj[v][i]]) dfs(Adj[v][i]);
    }

    visited[v] = false;
}

int main() {
    int a, b;
    cin >> n >> m;
    REP(i, m) {
        cin >> a >> b;
        Adj[a].push_back(b);
        Adj[b].push_back(a);
    }

    memset(visited, 0, sizeof(n + 1));
    visited[0] = 1;
    dfs(1);

    cout << cnt << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define STI(s) atoi(s.c_str())
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int
template <class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;} return 0;}
template <class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;} return 0;}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const ll MOD = 1000000007;
const double EPS = 1e-9;
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;

ll ans=0;

void calc(string s){
    vll v;
    s+='+';
    ll tmp=0;
    ll pos=0;
    while(pos<s.size()){
        if(s[pos]=='+'){
            v.push_back(tmp);
            tmp=0;
            pos++;
        }
        tmp*=10;
        tmp+=s[pos]-'0';
        pos++;
    }
    rep(i,v.size()){
        ans+=v[i];
    }
}

string s;

void rec(string t,int pos){
    
    int alpha=0;
    rep(i,t.size()){
        if(t[i]<='9'&&t[i]>='0'){
            alpha++;
        }
    }
    if(alpha==s.size()){
    // cout<<t<<endl;
        calc(t);
        return;
    }
    
    rec(t+s[pos],pos+1);
    rec(t+'+'+s[pos],pos+1);
    return;
}

int main(void) {

    cin>>s;

    rec("",0);

    fin(ans/2);


}


Measured memory_bytes: 384
from math import gcd

from math import factorial as f

from math import ceil, floor, sqrt
import math

import bisect
import re
import heapq

from copy import deepcopy
import itertools
from itertools import permutations

from sys import exit

ii = lambda: int(input())
mi = lambda: map(int, input().split())
li = lambda: list(map(int, input().split()))

yes = "Yes"
no = "No"


def main():
    a = 'ACL'
    n = ii()
    ans = ''
    for i in range(n):
        ans += a
    print(ans)


main()


Measured memory_bytes: 9948
#include <iostream>
#include <vector>
using namespace std;
int main() {
  string s;
  cin >> s;
  int n = s.size();
  vector<vector<long long>> dp(100005, vector<long long>(13));
  long long ans = 0;
  dp.at(0).at(0) = 1;
  for (int i = 0; i < n; ++i) {
    int c;
    if (s.at(i) == '?') c = -1;
    else c = s.at(i) - '0';
    for (int j = 0; j < 10; ++j) {
      if (c != -1 and c != j) continue;
      for (int k = 0; k < 13; ++k) {
        dp.at(i + 1).at((k * 10 + j) % 13) += dp[i][k];
      }
    }
    for (int j = 0; j < 13; ++j) dp.at(i + 1).at(j) %= 1000000007ll;
  }
  cout << dp[n][5] << endl;
  return 0;
}



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

Measured memory_bytes: 600
N,S,j;
long d[3001];
main(A)
{
	scanf("%d%d",&N,&S);
	for(;~scanf("%d",&A);N--)
	{
		d[0]++;
		for(j=S;j>=A;d[j--]%=998244353)d[j]+=d[j-A]*(j<S?:N);
	}
	printf("%d",d[S]);
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
const int mod=1e9+7;
using LL=long long;
using std::cout;using std::endl;using std::cin;
using std::vector;using std::string;using std::set;using std::multiset;
using std::pair;using std::map;
using std::min;using std::max;
using std::make_pair;using std::swap;
std::ostream& operator<<(std::ostream& os,std::map<int,int>& obj){for(std::map<int,int>::iterator itr=obj.begin();itr!=obj.end();itr++){os<<itr->first<<"^"<<itr->second<<" ";}return os;}
std::ostream& operator<<(std::ostream& os,std::vector<std::map<int,int>>& obj){for(auto itr=obj.begin();itr!=obj.end();itr++){os<<*itr<<std::endl;}return os;}
std::ostream& operator<<(std::ostream& os,std::vector<int>& obj){for(auto itr=obj.begin();itr!=obj.end();itr++){os<<*itr<<" ";}return os;}
std::ostream& operator<<(std::ostream& os,std::vector<std::vector<int>>& obj){for(auto itr=obj.begin();itr!=obj.end();itr++){os<<*itr<<std::endl;}return os;}

namespace ndifix{
template<class T> void sort(T &v){std::sort(v.begin(),v.end());}
template<class T> void rsort(T &v){std::sort(v.rbegin(),v.rend());}

}


int main(){
  string s;cin>>s;
  ndifix::sort(s);
  if(s[0]==s[1] && s[2]==s[3] && s[1]!=s[2])cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}


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

#define whole(f, x, ...)                                 \
  ([&](decltype((x)) whole) {                            \
    return (f)(begin(whole), end(whole), ##__VA_ARGS__); \
  })(x)

using namespace std;
using ll = long long;

void solve() {
  string s;
  cin >> s;
  reverse(s.begin(), s.end());
  vector<int> v(2019);

  // int t = s[0] - '0';
  // int ten = 10;
  // ++v[t];

  int t = 0, ten = 1;
  ++v[t];

  for (auto &c : s) {
    t += ten * (c - '0');
    t %= 2019;
    ++v[t];
    ten *= 10;
    ten %= 2019;
  }

  ll ans = 0;
  for (int i : v) {
    ans += i * (i - 1) / 2;
  }

  cout << ans << endl;
}

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);

  solve();
  return 0;
}


Measured memory_bytes: 3704