akhauriyash/Code-Regression huggingface dataset:
#include<algorithm>
#include<iostream>
#include<vector>
using namespace std;

int main(){
  int N,M;cin>>N>>M;
  int k[M];
  int s[M][N];
  for(int i=0;i<M;i++){
    cin>>k[i];
    for(int j=0;j<k[i];j++){
      cin>>s[i][j];
    }
  }
  vector<int> p(M);
  for(int i=0;i<M;i++){
    cin>>p[i];
  }

int ans=0;
  for(int bit=0;bit<(1<<N);bit++){
    int tmp=0;
    for(int i=0;i<M;i++){
    int cnt=0;
      for(int j=0;j<k[i];j++){
        if(bit&(1<<((s[i][j])-1))){
          cnt++;
        }
      }
      if(cnt%2==p[i]){
        tmp++;
      }
      }
      if(tmp==M){
        ans++;
    }

  }

  cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define rep(i,N) for(long long i = 0; i < (long long)(N); i++)
#define repr(i,N) for(long long i = (long long)(N) - 1; i >= 0; i--)
#define rep1(i,N) for(long long i = 1; i <= (long long)(N) ; i++)
#define repr1(i,N) for(long long i = (N) ; (long long)(i) > 0 ; i--)
#define each(x,v) for(auto& x : v)
#define all(v) (v).begin(),(v).end()
#define sz(v) ((int)(v).size())
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) long long __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
using namespace std; void solve();
using ll = long long; template<class T = ll> using V = vector<T>;
using vi = V<int>; using vl = V<>; using vvi = V< V<int> >;
constexpr int inf = 1001001001; constexpr ll infLL = (1LL << 61) - 1;
struct IoSetupNya {IoSetupNya() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); cerr << fixed << setprecision(7);} } iosetupnya;
template<typename T, typename U> inline bool amin(T &x, U y) { return (y < x) ? (x = y, true) : false; }
template<typename T, typename U> inline bool amax(T &x, U y) { return (x < y) ? (x = y, true) : false; }
template<typename T, typename U> ostream& operator <<(ostream& os, const pair<T, U> &p) { os << p.first << " " << p.second; return os; }
template<typename T, typename U> istream& operator >>(istream& is, pair<T, U> &p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator <<(ostream& os, const vector<T> &v) { int s = (int)v.size(); rep(i,s) os << (i ? " " : "") << v[i]; return os; }
template<typename T> istream& operator >>(istream& is, vector<T> &v) { for(auto &x : v) is >> x; return is; }
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
template<typename T>void die(T x){out(x); exit(0);}
#ifdef NyaanDebug
  #include "NyaanDebug.h"
  #define trc(...) do { cerr << #__VA_ARGS__ << " = "; dbg_out(__VA_ARGS__);} while(0)
  #define trca(v,N) do { cerr << #v << " = "; array_out(v , N);cout << endl;} while(0)
#else
  #define trc(...)
  #define trca(...)
  int main(){solve();}
#endif
 
#define inc(...) char __VA_ARGS__; in(__VA_ARGS__)
#define in2(N,s,t) rep(i,N){in(s[i] , t[i]);}
#define in3(N,s,t,u) rep(i,N){in(s[i] , t[i] , u[i]);}
using vd = V<double>; using vs = V<string>; using vvl = V< V<> >;
template<typename T>using heap = priority_queue< T , V<T> , greater<T> >;
 
using P = pair<ll,char>; using vp = V<P>;
constexpr int MOD = /**/ 1000000007; //*/ 998244353;
//////////////////
 
void solve(){
  inl(N);
  vl a(N); in(a);
  ll s = accumulate(all(a) , 0LL);
  ll one = N * (N + 1) / 2;
  if(s % one != 0) die("NO");
  ll time = s / one;
  // (差分) = time mod N
  ll rui = 0;
  rep(i , N){
    ll diff = a[(i + 1) % N] - a[i];
    if(time % N != (diff % N + N) % N) die("NO");
    rui += max(diff , 0LL);
  }
  // ruiは(N - 1) * time以下
  if(rui > (N - 1) * time) die("NO");
  out("YES");
  
}

Measured memory_bytes: 1024
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Runtime.InteropServices.ComTypes;
using System.Text;
using System.Threading;

class Program
{
    static void Main(string[] args)
    {
        long n = long.Parse(Console.ReadLine());
        long p = 1;
        int keta = 1;
        while(p * 26 < n)
        {
            p *= 26;
            n -= p;
            keta++;
        }
        n--;

        var a = new char[keta];
        for(int i = keta - 1; i >= 0; i--)
        {
            a[i] = 'a';
            if (n == 0) continue;
            a[i] += (char)(n % 26);
            n /= 26;
        }
        var ans = new string(a);
        Console.WriteLine(ans);


    }



}

Measured memory_bytes: 27496
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < int(n); i++)
#define rep1(i,n) for (int i = 1; i <= int(n); i++)
#define repR(i,n) for (int i = int(n)-1; i >= 0; i--)
#define rep1R(i,n) for (int i = int(n); i >= 1; i--)
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fst first
#define snd second
#define cauto const auto
#ifdef LOCAL
#define dump(...) cerr << "[" << __LINE__ << ":" << __FUNCTION__ << "] ", _dmp_(#__VA_ARGS__, __VA_ARGS__);
void _dmp_(const char*) { cerr << endl; }
template <class T, class... U>
void _dmp_(const char *s, T const& x, U const& ...y) { const char *o = "({[", *e = "]})"; for (int i = 0; *s != '\0'; cerr << *s++) { if (count(o,o+3,*s)) i++; if (count(e,e+3,*s)) i--; if (!i && *s == ',') break; } cerr << " = " << x; if (*s == ',') cerr << ", ", s++; _dmp_(s, y...); }
#else
#define dump(...)
#endif
using ll = long long;
#define int ll
template <class T> using pque_max = priority_queue<T>;
template <class T> using pque_min = priority_queue<T, vector<T>, greater<T> >;
#define CONAINER_OUTPUT os << "{"; for (auto const& x : v) os << " " << x; return os << " }";
template <class T> ostream& operator<<(ostream& os, vector<T> const& v) { CONAINER_OUTPUT }
template <class T> ostream& operator<<(ostream& os, deque<T> const& v) { CONAINER_OUTPUT }
template <class T> ostream& operator<<(ostream& os, set<T> const& v) { CONAINER_OUTPUT }
template <class T, class U> ostream& operator<<(ostream& os, map<T,U> const& v) { CONAINER_OUTPUT }
#undef CONAINER_OUTPUT
template <class T> istream& operator>>(istream& is, vector<T>& v) { for (auto& x : v) is >> x; return is; }
template <class T, class S> ostream& operator<<(ostream& os, pair<T,S> const& p) { return os << "(" << p.first << ", " << p.second << ")"; }
template <class T, class S> istream& operator>>(istream& is, pair<T,S> const& p) { return is >> p.first >> p.second; }
struct _Init_ { _Init_() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20); } } _init_;

template <class T> void quit(T const& x) { cout << x << endl; exit(0); }
template <class T> bool chmin(T& x, T const& y) { if (x > y) { x = y; return true; } return false; }
template <class T> bool chmax(T& x, T const& y) { if (x < y) { x = y; return true; } return false; }
#define YesNo(c) ((c) ? "YES" : "NO")
////////////////////////////////

int32_t main() {
    string s,t; cin >> s >> t;

    vector<int> x(1+s.size()), y(1+t.size());
    rep (i,s.size()) x[i+1] = x[i] + (s[i] == 'A' ? 1 : -1);
    rep (i,t.size()) y[i+1] = y[i] + (t[i] == 'A' ? 1 : -1);
 
    int q; cin >> q;
    while (q--) {
        int a,b,c,d; cin >> a >> b >> c >> d;
        int xx = x[b]-x[a-1];
        int yy = y[d]-y[c-1];
        cout << YesNo((xx-yy)%3 == 0) << endl;
    }
}


Measured memory_bytes: 2512
/*
*          Name : chaitanya
*
*     Institute : ANITS,Visakhapatnam
*
*/
#include<cstdio>
#include<iostream>
#include<sstream>
#include<fstream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<complex>
#include<cstring>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<numeric>
#include<limits>
#include<climits>
#include<cfloat>
#include<functional>
#include<iterator>
#include <random>
#define inf  1000000000
#define all(x) begin(x),end(x)
#define ll long long int
#define ff first
#define ss second
#define pb push_back
const ll mod = 1000000007;
#pragma GCC optimization ("O3")
const int N = 1000010;
using namespace std;
int main()
{
 
    // freopen("input.txt","r",stdin);
    // freopen("output.txt","w",stdout);
     //ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    int n;
    ll s = 0;
    cin >> n;
    for (int i = 1; i <= n; ++i)
    {
        for (int j = 1; j <= n; ++j)
        {
            for (int k = 1; k <= n; ++k)
            {
                int d = __gcd(j,k);
                s += __gcd(i,d);
            }
        }
    }
    cout << s;
    return 0;
} 

Measured memory_bytes: 3636
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
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; }

class union_find {
    private:
        vector<int> par;
        vector<int> ran;
        vector<ll> size;
    public:
        union_find(int n);
        int find(int x);
        void unite(int x, int y);
        bool same(int x, int y);
        ll show_size(int x);
};

union_find::union_find(int n){
    par.resize(n);
    ran.resize(n);
    size.resize(n);
    rep(i,n) par[i] = i;
    rep(i,n) ran[i] = 0;
    rep(i,n) size[i] = 1;
};

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

void union_find::unite(int x, int y) {
    x = find(x);
    y = find(y);
    if(x == y) return;
    ll t = show_size(x)+show_size(y);
    size[x] = size[y] = t;
    if(ran[x] < ran[y]){
        par[x] = y;
        //size[y] += size[x];
    }
    else{
        par[y] = x;
        //size[x] += size[y];
        if(ran[x] == ran[y]) ran[x]++;
    }
};

ll union_find::show_size(int x) {
    if(par[x] == x) return size[x];
    return show_size(par[x] = find(par[x]));
}

bool union_find::same(int x, int y) {
    return (find(x) == find(y));
};

int main(int argc, char const *argv[]) {
    int n, m;
    cin >> n >> m;
    vector<int> a(m);
    vector<int> b(m);
    rep(i,m){
        int A, B;
        cin >> A >> B;
        a[i] = --A; b[i] = --B;
    }
    vector<ll> ans(m);
    union_find uf(n);
    ll fai = ((ll)n*(n-1))/2;
    ans[m-1] = fai;
    for(int i = m-2; i >= 0; --i){
        if(!uf.same(a[i+1], b[i+1])){
            ans[i] = ans[i+1]-uf.show_size(a[i+1])*uf.show_size(b[i+1]);
            uf.unite(a[i+1], b[i+1]);
        }
        else ans[i] = ans[i+1];
    }
    rep(i, m) cout << ans[i] << endl;
    return 0;
}


Measured memory_bytes: 4480
#include<stdio.h>

int main(){
    int n;
    scanf("%d", &n);
    char s[n+1], t[n+1];
    scanf("%s %s", s, t);
    for(int i=0; i<n; i++){
        printf("%c%c", s[i], t[i]);
    }

    return 0;
}

Measured memory_bytes: 128
import sys
def input():
    return sys.stdin.readline()[:-1]
inf=float("inf")
x,y=map(int,input().split())
li=[0,300000,200000,100000]
for i in range(210):
    li.append(0)
if x==1 and y==1:
    print(1000000)
else:
    print(li[x]+li[y])

Measured memory_bytes: 38384
import java.util.Scanner;
public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		 int N = sc.nextInt();
		 int count = 0;
		 int P[] = new int[N];
		 int Pj = 0;
		 for(int i=0; i<N; i++) {
			P[i]= sc.nextInt();
			Pj = P[0];
		 }
		 for(int i=0; i<N; i++) {
			if(P[i]<=Pj) {
				count++;
				Pj = P[i];
				}
		 }
		 System.out.println(count);
    }
}

Measured memory_bytes: 60220
#include <bits/stdc++.h>
using namespace std;
int n, v[21], a[21], s, x, y;
int main(){
	cin >> n;
	for(int i = 0; i < n;i ++){
		cin >> v[i];
	}
	for(int i = 0; i < n; i ++){
		cin >> a[i];
	}
	for(int i = 0; i < n; i ++){
		if(v[i] <= a[i]){
			continue;
		}
		x += v[i];
		
	}
	for(int  j = 0; j < n; j ++){
		if(v[j] <= a[j]){
			continue;
		}
		y += a[j];
	}
	
	cout << x - y; 
}

Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<vector>
#include<algorithm>
#include<cstdio>
#include <string>
#include <complex>
#include <functional>
using namespace std;
typedef pair<int,int> P;

int main(){
    int n,a[101],X;
    while(1){
    cin >> n;
    if(n==0)break;
    for(int i=0;i<n;i++){
        cin >> a[i];
    }
    cin >> X;
    int high=n-1,low=0,cnt=0;
    while(high>=low){
        cnt++;
        int center=(low+high)/2;
        if(a[center]==X) break;
        else if(a[center]<X) low=center+1;
        else high=center-1;
    }
    cout << cnt << endl;
    }
}


Measured memory_bytes: 3080
#include <bits/stdc++.h>
using namespace std;
/*{{{*/  //template
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
constexpr int INF = numeric_limits<int>::max()/2;
constexpr long long LINF = numeric_limits<long long>::max()/3;
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define sz(x) (int)(x).size()
#define debug(x) cerr<<#x<<":"<<x<<endl
#define debug2(x,y) cerr<<#x<<","<<#y":"<<x<<","<<y<<endl
//struct fin{ fin(){ cin.tie(0); ios::sync_with_stdio(false); } } fin_;
struct Double{ double d; explicit Double(double x) : d(x){} };
ostream& operator<<(ostream& os,const Double x){ os << fixed << setprecision(20) << x.d; return os; }
template<typename T> ostream& operator<<(ostream& os,const vector<T>& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os, const map<T,U>& mp){ os << "{"; for(auto& p : mp){ os << p << ","; } os << "}"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os,const pair<T,U>& p){ os << "(" << p.first << ","<< p.second <<")"; return os; }
template<typename T> ostream& operator<<(ostream& os,const set<T>& st){ os<<"{"; for(T v:st) os<<v<<","; os <<"}"; return os; }
template<typename T,typename U> inline void chmax(T &x,U y){ if(y>x) x = y; }
template<typename T,typename U> inline void chmin(T &x,U y){ if(y<x) x = y; }
using ll = long long;
using ull = unsigned long long;
using pii = std::pair<int,int>;
using vi = std::vector<int>;
typedef vector<vi> vvi;
ll gcd(ll a,ll b){ if(b==0) return a; else return gcd(b,a%b); }
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n - 1); }
//constexpr double eps = 1e-14; 
constexpr double eps = 1e-10; 
constexpr ll mod = 1e9+7;
const int dx[]={1,0,-1,0} ,dy[] = {0,1,0,-1};
/*}}}*/

int main(){
    int N,M; cin >> N >> M;
    ll X; cin >> X;

    vector<int> C(N);
    vector<vector<int>> a(N,vector<int>(M));
    rep(i,N){
        cin >> C[i];
        rep(j,M) cin >> a[i][j];
    }

    ll ans = LINF;
    for(int mask=0;mask<(1<<N);mask++){
        ll cost = 0;
        vector<ll> b(M,0);
        rep(i,N){
            if(mask & (1<<i)){
                cost += C[i];
                rep(j,M){
                    b[j] += a[i][j];
                }
            }
        }
        bool ok = true;
        rep(j,M){
            if(b[j] < X){
                ok = false;
            }
        }

        if(ok){
            ans = min(ans, cost);
        }
    }
    if(ans == LINF){
        cout << -1 << endl;
        return 0;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3632
#include<iostream>
#include<vector>
#include<string>
#include<map>
#include<set>
#include<algorithm>
 
using namespace std;
 
typedef long long int Int;
 
int main(void) {
    int N;
    cin>>N;

    vector<int> A(N+2);
    A[0] = A[N+1] = 0;
    int sum = 0;
    for(int i = 1;i <= N;i++) {
        cin>>A[i];
        sum+=abs(A[i]-A[i-1]);
    }
    sum+=abs(A[N+1]-A[N]);
 
    for(int i = 1;i <=N;i++) {
        cout<<sum-abs(A[i]-A[i-1])-abs(A[i+1]-A[i])+abs(A[i-1]-A[i+1])<<endl;
    }
 
    return 0;
}

Measured memory_bytes: 1664
#define _USE_MATH_DEFINES
#include <iostream>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>
#include <cfloat>
#include <map>
#include <set>
#include <array>
#include <stdio.h>
#include <string.h>
#include <random>
using ll = long long;
using ull = unsigned long long;
using namespace std;
#define int long long
#define CONTAINS_VEC(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define REMOVE(v,a) (v.erase(remove((v).begin(), (v).end(), (a)), (v).end()))
#define REVERSE(v) (reverse((v).begin(), (v).end()))
#define ARY_REVERSE(v,a) (reverse((v), (v)+(a)))
#define REP(i, n) for (int (i)=0; (i) < (n); (i)++)
#define REPE(i, n) for (int (i)=0; (i) <= (n); (i)++)
#define CONTAINS_MAP(m, a) (m).find((a)) != m.end()
#define CONTAINS_SET(m, a) (m).find((a)) != m.end()
void YesNo(bool b) { cout << (b ? "Yes" : "No") << endl; }
//void YESNO(bool b) { cout << (b ? "YES" : "NO") << endl; }
void Yes() { cout << "Yes" << endl; }
void No() { cout << "No" << endl; }


signed main()
{
	int x;
	cin >> x;
	cout << ((x == 0) ? 1 : 0) << endl;
}




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

int line[501];
double dp[101][101];
double tmp[101][101];

int main() {
  int h,n,p,m,k,a,b;
  memset(line, -1, sizeof(line));

  cin>>h>>n>>p>>m>>k;
  int em = h;
  p--;
  for(int i=0; i<m; ++i) {
    cin>>a>>b;
    b--;
    line[a] = b;
    em--;
  }
  if (n==2) {
    cout << 1 << endl;
    return 0;
  }
  
  for(int j=0; j<=k; ++j)
    for(int l=0; l<n; ++l)
      dp[j][l] = 0.0;

  dp[0][p] = 1.0;

  for(int i=h; i>0; --i) {

    for(int j=0; j<=k; ++j)
      for(int l=0; l<n; ++l)
        tmp[j][l] = 0.0;

    if(line[i] == -1) {
      for(int j=0; j<=k; ++j) {
        double p = (double)(k-j) / em;
        if (p>=1) p = 1;
        double p1 = 1.0 / (n-1);
        
        for(int l=0; l<n-1; ++l) {
          tmp[j+1][l] += dp[j][l+1] * p*p1;
          tmp[j+1][l+1] += dp[j][l] * p*p1;
        }
        
        for (int l=0; l<n; ++l) {
          double hoge = n-3;
          if (l==0 || l==n-1) hoge = n-2;
          tmp[j+1][l] += dp[j][l] * p * hoge/(n-1);
          tmp[j][l] += dp[j][l] * (1-p);
        }
      }
      em--;
    }else{
      for(int j=0; j<=k; ++j) {
        for(int l=0; l<n; ++l) {
          if(line[i] == l) {
            tmp[j][l+1] += dp[j][l];
          }else if(line[i] == l-1) {
            tmp[j][l-1] += dp[j][l];
          }else{
            tmp[j][l] += dp[j][l];
          }
        }
      }
    }

//    cout<<i<<endl;
    for(int j=0; j<=k; ++j) {
      for(int l=0; l<n; ++l) {
        dp[j][l] = tmp[j][l];
        //      cout<<dp[j][l]<<" ";
      }
//      cout<<endl;
    }
  }

  double ans = 0;
  for(int i=0; i<n; ++i) ans = max(ans, dp[k][i]);
  printf("%.12f\n", ans);
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
#define ll long long
#define clr(x,i) memset(x,i,sizeof(x))
using namespace std;
const int N=100005;
const ll mod=1e9+7,inv2=5e8+4;
inline int read()
{
    int x=0,f=1; char ch=getchar();
    while(ch<'0'||ch>'9') {if(ch=='-') f=-1; ch=getchar();}
    while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
    return x*f;
}
int n,a[N],fac[N];
double x[N],y[N];
int main()
{
	scanf("%d",&n);
	fac[0]=1;
	for(int i=1;i<=n;i++){
		scanf("%lf%lf",&x[i],&y[i]);
		a[i]=i; fac[i]=fac[i-1]*i;
	}
	double ans=0;
	do{
		double now=0;
		for(int i=1; i<n; i++) now+=sqrt((x[a[i]]-x[a[i+1]])*(x[a[i]]-x[a[i+1]])+(y[a[i]]-y[a[i+1]])*(y[a[i]]-y[a[i+1]]));
		ans+=now;
	}
	while(next_permutation(a+1, a+n+1));
	ans/=(double)fac[n];
	printf("%.8lf\n",ans);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
const ll mod = 1000000007;
const ll INF = 1001001001;
const ll LINF = 1001001001001001001;

void prvec(vector<ll> vec){ //for debug
    ll n = vec.size();
    cout << "------------------------------------\n" ;
    rep(i,n) cout << i << " " << vec.at(i) << "\n";
    cout << "------------------------------------\n" ;
}

void pr2d(vector<vector<ll>> vec){ // for debug
    ll h = vec.size();
    ll w = vec.at(0).size();
    cout << "------------------------------------\n" ;
    rep(i,h){
        rep(j,w){
            cout << vec.at(i).at(j) << " ";
        }
        cout << "\n";
    }
    cout << "------------------------------------\n" ;
}

int main(){
    string s,t; cin >> s >> t;
    ll ss = s.size(), ts = t.size();
    bool flag = true;
    if(ss+1!=ts) flag = false;
    rep(i,ss){
        if(s.at(i)!=t.at(i)) flag = false;
    }
    if(flag){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

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

int main() {
  ll a,b,c,k;
  cin>>a>>b>>c>>k;
  /////
  ll ans=0;
  if(k<a){
    ans+=k;
  }
  else{
    ans+=a;
    k-=a;
      if(k<b){}
      else{
        k-=b;
        ans-=k;
      }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3632
#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 INF = 1001001001;
const int MX = 200005;

int main(){
    int n;
    cin >> n;
    vector<int> a(n), b(n), c(n);
    rep(i,n) cin >> a[i] >> b[i] >> c[i];
    int dp[MX][3];
    dp[0][0] = 0;
    dp[0][1] = 0;
    dp[0][2] = 0;
    for(int i=1;i<=n;i++){
        dp[i][0] = max(dp[i-1][1] + a[i-1], dp[i-1][2] + a[i-1]);
        dp[i][1] = max(dp[i-1][0] + b[i-1], dp[i-1][2] + b[i-1]);
        dp[i][2] = max(dp[i-1][0] + c[i-1], dp[i-1][1] + c[i-1]);
    }
    int ans = max(dp[n][0], max(dp[n][1], dp[n][2]));
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3584
#include <iostream>

using namespace std;

int main()
{
    string s;
    cin >> s;
    bool first_letter;
    if (s[0]=='A'){
        first_letter=true;
    }else{
        first_letter=false;
    }
    bool second_letter;
    if (s[1]!='C' && s[s.size()-1!='C']){
        second_letter=true;
    }else{
        second_letter=false;
    }
    bool last_letter;
    if (s[s.size()-1]!='C'){
        last_letter=true;
    }else{
        last_letter=false;
    }
    int n=0;
    for (int i=0;i<s.size();i++){
        if (s[i]=='C'){
            n++;
        }
    }
    bool consequance;
    if (n==1){
        consequance=true;
    }else{
        consequance=false;
    }
    bool lowercase=true;
    for (int j=0;j<s.size();j++){
        if (int(s[j])<=90){
            if (s[j]=='A'){
            }else if (s[j]=='C'){
            }else{
                lowercase=false;
            }
        }
    }
    if (first_letter==true && second_letter==true && last_letter==true && consequance==true && lowercase==true){
        cout << "AC";
    }else{
        cout << "WA";
    }
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<cstring>
#include<math.h>
#include<bitset>
#include<queue>
#include<set>
#include<iomanip>
#include<math.h>
// #include<bits/stdc++.h>
using namespace std;
#define ll long long
constexpr long long int INFLL = 1001001001001001LL;
constexpr int INFI = 1000000007;

int main(){
  int N;
  cin >> N;
  string S;
  cin >> S;
  int count=0;
  for(int i=0; i<1000; i++){
    int a,b,c;
    a = i/100;
    b = (i-(i/100)*100)/10;
    c = i%10;
    for(int j=0; j<N; j++){
      int s = S[j] - '0';
      if(s == a){
        for(int k=j+1; k<N; k++){
          s = S[k] - '0';
          if(s == b){
            for(int l=k+1; l<N; l++){
              s = S[l] - '0';
              if(s == c){
                count++;
                break;
              }
            }
            break;
          }
        }
        break;
      }
    }
  }
  cout << count << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(x) begin(x), end(x)
#define _ << ' ' <<
using namespace std;
using ll = long long;


int main()
{
    int n;
    cin >> n;
    for (int i = 0; i <= 1e7; ++i)
        if (i * 108 / 100 == n)
            return cout << i, 0;
    cout << ":(";
}


Measured memory_bytes: 3608
n = int(input())

vs = list(map(int, input().split()))

v_odd = {}
v_even = {}

for i in range(n):
    if i % 2 == 0:
        v = vs[i]
        if v in v_even:
            v_even[v] += 1
        else:
            v_even[v] = 1
    else:
        v = vs[i]
        if v in v_odd:
            v_odd[v] += 1
        else:
            v_odd[v] = 1

odd_sort = sorted(v_odd.items(), key=lambda x: -x[1])
even_sort = sorted(v_even.items(), key=lambda x: -x[1])

if odd_sort[0][0] == even_sort[0][0]:
    if len(odd_sort) >= 2:
        oddnext = odd_sort[1][1]
        if len(even_sort) >= 2:
            evennext = even_sort[1][1]
            ans = min(n-oddnext-even_sort[0][1], n-odd_sort[0][1]-evennext)
        else:
            ans = min(n-oddnext-even_sort[0][1], n-odd_sort[0][1])
    else:
        if len(even_sort) >= 2:
            evennext = even_sort[1][1]
            ans = min(n-odd_sort[0][1]-evennext, n-even_sort[0][1])
        else:
            ans = n // 2


else:
    ans = n - odd_sort[0][1] - even_sort[0][1]

print(ans)




Measured memory_bytes: 22368
#include<iostream>
#include<string>

int main(){
	int A,ans(1);
  	std::cin >> A;
  	std::string d;
  	std::cin >> d;
  	for(int i = 0 ; i < A - 1 ; i ++){
     	if(d[i] != d[i + 1]) ans ++;
    }
  	std::cout << ans << "\n";
}

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

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define watch(a) { std::cout << #a << " = " << a << "\n"; }
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }
template<class T, class V> istream& operator>> (istream& ist, pair<T, V>& p) { return ist >> p.first >> p.second; }
template<class T> ostream& operator<< (ostream& ost, pair<T, T>& p) { return ost << p.first << ", " << p.second; }
template<class T> istream& operator>> (istream& ist, vector<T>& vs) { for(auto& e: vs) ist >> e; return ist; }

typedef long long ll;
int const inf = INT_MAX / 2;

// 3234566667

vector<int64_t> ans;

void dfs(deque<int8_t>& val) {
  auto insert = [](deque<int8_t> val){
    auto digits = std::accumulate(val.begin(), val.end(), 0LL, [&val](auto acc, auto digit){
      return 10 * acc + digit;
    });
    ans.push_back(digits);
  };

  if (val.size() == 9) {
    REP(i, 1, 4) if (abs(val[0] - i) <= 1) {
      val.push_front(i);
      insert(val);
      val.pop_front();
    }
  }
  else {
    rep(i, 10) if (val.empty() || abs(val[0] - i) <= 1) {
      val.push_front(i);
      if (i) {
        insert(val);
      }
      dfs(val);
      val.pop_front();
    }
  }
}

int main() {
  deque<int8_t> val;
  dfs(val);
  sort(ans.begin(), ans.end());
  int K; cin >> K;
  assert(K <= ans.size());
  cout << ans[K - 1] << "\n";
}


Measured memory_bytes: 1404
#[allow(dead_code)]
fn main() {
    let mut str = i::str();
    let vecs:Vec<char> =str.as_str().chars().collect();
    let mut sum:i64=0;
    let mut gsuu = 0;
    let mut psuu =0;
    for x1 in vecs {
        if (gsuu>psuu){
            psuu+=1;
            if (x1=='g'){
                sum+=1;
            }else{
                sum+=0;
            }
        }else{
            gsuu+=1;
            if (x1=='g'){
                sum+=0;
            }else{
                sum+=-1;
            }
        }
    }
    println!("{}",sum);
}


#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::{HashMap, HashSet, VecDeque};
#[allow(unused_imports)]
use std::io::*;
#[allow(unused_imports)]
use std::num::*;
#[allow(unused_imports)]
use std::str::*;

#[allow(dead_code)]
mod i {
    use super::*;

    pub fn read<T: FromStr>() -> T {
        stdin()
            .bytes()
            .map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>()
            .parse::<T>()
            .ok()
            .unwrap()
    }

    pub fn str() -> String {
        read()
    }

    pub fn s() -> Vec<char> {
        str().chars().collect()
    }

    pub fn i() -> i64 {
        read()
    }

    pub fn u() -> usize {
        read()
    }

    pub fn u2() -> (usize, usize) {
        (read(), read())
    }

    pub fn u3() -> (usize, usize, usize) {
        (read(), read(), read())
    }

    pub fn f() -> f64 {
        read()
    }

    pub fn c() -> char {
        read::<String>().pop().unwrap()
    }

    pub fn iv(n: usize) -> Vec<i64> {
        (0..n).map(|_| i()).collect()
    }
    pub fn strv(n: usize) -> Vec<String> {
        (0..n).map(|_| str()).collect()
    }

    pub fn iv2(n: usize) -> Vec<(i64, i64)> {
        (0..n).map(|_| iv(2)).map(|a| (a[0], a[1])).collect()
    }

    pub fn uv(n: usize) -> Vec<usize> {
        (0..n).map(|_| u()).collect()
    }

    pub fn uv2(n: usize) -> Vec<(usize, usize)> {
        (0..n).map(|_| uv(2)).map(|a| (a[0], a[1])).collect()
    }

    pub fn uv3(n: usize) -> Vec<(usize, usize, usize)> {
        (0..n).map(|_| uv(3)).map(|a| (a[0], a[1], a[2])).collect()
    }

    pub fn fv(n: usize) -> Vec<f64> {
        (0..n).map(|_| f()).collect()
    }

    pub fn cmap(h: usize) -> Vec<Vec<char>> {
        (0..h).map(|_| s()).collect()
    }
}


Measured memory_bytes: 2668
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define pf push_front

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
double pi = 3.141592653589793;
ll mod = 1000000007;
ll INF = 1000000001;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;



int main(){
    int a, b, ans;
    cin >> a >> b;
    if(a >= 10 || b >= 10){
        ans = -1;
    }else{
        ans = a * b;
    }    
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define o(a) cout << a << endl
#define int long long
using namespace std;
typedef pair<int, int> P;
 
const int INF = 6e9;
 
int n, m;
int d[110][110];
 
void init(int n){
    rep(i, 0, n){
        rep(j, 0, n){
            d[i][j] = INF;
            if(i == j) d[i][j] = 0;
        }
    }
}
 
void warshall_floyd(){
    rep(k, 0, n){
        rep(i, 0, n){
            rep(j, 0, n){
                d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
            }
        }
    }
}
 
signed main(){
    cin >> n >> m;
    init(n);
    rep(i, 0, m){
        int a, b, c;
        cin >> a >> b >> c;
        d[a][b] = c;    
    }
    warshall_floyd();
    rep(i, 0, n){
        if(d[i][i] != 0){
            cout << "NEGATIVE CYCLE" << endl;
            return 0;
        }
    }
    rep(i, 0, n){
        rep(j, 0, n){
            if(j != 0) cout << " ";
            if(d[i][j] >= 3e9) cout << "INF";
            // if(d[i][j] == INF) cout << "INF";
            else cout << d[i][j];
        }
        cout << endl;
    }
}

Measured memory_bytes: 3172
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <iostream>

using namespace std;

int main()
{
    string s;
    cin>>s;
    int count=0;
    for(int i=0;i<s.size();i++){
        count+=s.at(i)-'0';
    }
if(count%9==0)
cout<<"Yes";
else cout<<"No";
    return 0;
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> a(n);
  set<int> b;
  for (int i = 0; i < n; i++){
    cin >> a[i];
    b.insert(a[i]);
  }
  if (a.size() != b.size())
    cout << "NO\n";
  else
    cout << "YES\n";

  return 0;
}


Measured memory_bytes: 10368
/*
[abc168] D - .. (Double Dots)
*/

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
#define ALL(c) (c).begin(), (c).end()

const int MAX_N = 2e5;

class UnionFind {
public:
    vector<int> data;
    UnionFind(int size) : data(size, -1) {}
    bool unite(int x, int y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (data[y] < data[x]) swap(x, y);
        data[x] += data[y];
        data[y] = x;
        return true;
    }
    bool same(int x, int y) { return root(x) == root(y); }
    int root(int x) { return data[x] < 0 ? x : (data[x] = root(data[x])); }
    int size(int x) { return -data[root(x)]; }
};

int N, M;
vector<int> g[MAX_N];
int ans[MAX_N];

bool solve() {
    UnionFind uf(N);
    queue<int> q;

    q.push(0);
    while (!q.empty()) {
        int v = q.front();
        q.pop();
        for (int to : g[v]) {
            if (!uf.same(v, to)) {
                uf.unite(v, to);
                q.push(to);
                ans[to] = v;
            }
        }
    }

    return true;
}

int main() {
    cin >> N >> M;
    for (int i = 0; i < M; i++) {
        int a, b;
        cin >> a >> b;
        g[a - 1].push_back(b - 1);
        g[b - 1].push_back(a - 1);
    }

    if (solve()) {
        cout << "Yes" << endl;
        for (int i = 1; i < N; i++) {
            cout << ans[i] + 1 << endl;
        }
    } else {
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 13044
#include <stdio.h>

int main( void ) {
	int i, a, b, first = 1, exist;

	while ( scanf( "%d %d", &a, &b ), a ) {
		if ( !first )
			putchar( '\n' );

		exist = 0;
		for ( i = ( ( a - 1 ) / 4 + 1 ) * 4; i <= b; i += 4 )
			if ( !( i % 4 ) && i % 25 || !( i % 400 ) ) {
				printf( "%d\n", i );

				exist = 1;
			}
		if ( !exist )
			puts( "NA" );

		first = 0;
	}

	return 0;
}

Measured memory_bytes: 616
n = int(input())
s = input()

a = False
b = False

sw = [None] * n

sw[0] = True
sw[1] = True

def next(s,sw,j,i):
    if s[i] == 'o':
        return not (sw[j] ^ sw[i])
    else:
        return sw[j] ^ sw[i]

def printsw(sw,n):
    s = ''
    for i in range(n):
        if sw[i]:
            s += 'S'
        else:
            s += 'W'
    print(s)

flag = True

for j in range(4):
    for i in range(2,n):
        sw[i] = next(s,sw,i-2,i-1)

    zero = next(s,sw,n-2,n-1)
    one = next(s,sw,n-1,0)
    if zero == sw[0]:
        if one == sw[1]:
            printsw(sw,n)
            flag = False
            break

    sw[0] = not sw[0]
    if j == 1:
        sw[1] = False

if flag:
    print(-1)


Measured memory_bytes: 4212
/*=======================
Author    : Shounak Dey
=======================	*/

#include<bits/stdc++.h>

using namespace std;

using ll = long long int;
using ull = unsigned long long int;

#define PB push_back
#define MK make_pair
#define SZ(a) (int)(sizeof(a))
#define F first
#define S second
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define REP(i,n) for(int i=0;i<n;i++)
#define read(n) scanf("%d",&n)
#define readl(n) scanf("%lld",&n)
#define readul(n) scanf("%llu",&n);


#define SORTV(a) sort(a.begin(),a.end())
#define TEST int Test;cin >> Test;while(Test--)
#define gcd(a,b) __gcd(a,b)
#define ffs(a) __builtin_ffs(a) // find first set
#define clz(a) __builtin_clz(a) // count leading zeroes
#define ctz(a) __builtin_ctz(a) // count trailing zeroes
#define popc(a) __builtin_popcount(a) // count set bits
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL)


#define error(args...) { vector<string> _v = split(#args, ','); err(_v.begin(), args); }

vector<string> split(const string& s, char c) {
	vector<string> v;
	stringstream ss(s);
	string x;
	while (getline(ss, x, c))
		v.emplace_back(x);
	return move(v);
}

void err(vector<string>::iterator it) {}
template<typename T, typename... Args>
void err(vector<string>::iterator it, T a, Args... args) {
	cerr << it -> substr((*it)[0] == ' ', it -> length()) << " = " << a << '\n';
	err(++it, args...);
}

int main()
{
	fast_io;
	int ans=0;
	int n,m,c;
	cin >> n >> m >> c;
	vector<vector<int>> s(n,vector<int>(m));
	vector<int> b(m);
	REP(i,m)
		cin >> b[i];
	REP(i,n){
		REP(j,m)
			cin >> s[i][j];
		int val=0;
		REP(j,m)
			val += s[i][j] * b[j];
		val += c;
		ans += (val>0);
	}
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    cin >> s;
    int bg,ed;
    for(int i = 0;i < s.size();i++)
    {
        if(s[i] == 'A')
        {
            bg = i;
            break;
        }
    }
    for(int i = s.size() - 1;i >= 0;i--)
    {
        if(s[i] == 'Z')
        {
            ed = i;
            break;
        }
    }
    cout << ed - bg + 1;

    return 0;
}

Measured memory_bytes: 640
//Don't have to see. start------------------------------------------
var read = require('readline').createInterface({
  input: process.stdin, output: process.stdout
});
var obj; var inLine = [];
read.on('line', function(input){inLine.push(input);});
read.on('close', function(){
  obj = init(inLine);
  console.error('\n↑入力 ↓出力');
  Main();
});
function makeClone(obj){return (obj instanceof Set) ? new Set(Array.from(obj)) : JSON.parse(JSON.stringify(obj));}
function nextInt(){return myconv(next(),1);} function nextStrArray(){return myconv(next(),2);}
function nextIntArray(){return myconv(next(),4);} function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();}
function init(input){  
  return {
    list : input, index : 0, max : input.length,
    hasNext : function(){return (this.index < this.max);},
    next : function(){if(this.hasNext()){return this.list[this.index++];}else{throw 'ArrayIndexOutOfBoundsException ‚There is no more input';}}
  };
}
function myout(s){console.log(s);}
function myerr(s){console.error('debug:' + require('util').inspect(s,false,null));}
//param "no" is
//unknown or outlier : return i. 1: parseInt.
//2: split space. 4: split space and parseInt.
//6: split 1 character. 7: split 1 character and parseInt.
//8: join space. 9: join nextline. 0: join no character.
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(' ');case 4:return i.split(' ').map(Number);case 6:return i.split('');case 7:return i.split('').map(Number);case 8:return i.join(' ');case 9:return i.join('\n');case 0:return i.join('');default:return i;}}catch(e){return i;}}

//Don't have to see. end------------------------------------------
function Main(){
  var s = next();
  if(s[s.length - 1] == "s"){
    myout(s + "es");
  }else{
    myout(s + "s");
  }
}

Measured memory_bytes: 30084
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) {
		FastScanner sc = new FastScanner(System.in);
		long a = sc.nextLong();
		double b = sc.nextDouble();
		BigDecimal ab = new BigDecimal(String.valueOf(a));
		BigDecimal bb = new BigDecimal(String.valueOf(b));
		BigDecimal abb = ab.multiply(bb);
		BigDecimal abbd = abb.setScale(0, RoundingMode.DOWN);
		System.out.println(abbd.toPlainString());
		
	}
	
	static class FastScanner {
		private BufferedReader reader = null;
	    private StringTokenizer tokenizer = null;
	    public FastScanner(InputStream in) {
	        reader = new BufferedReader(new InputStreamReader(in));
	        tokenizer = null;
	    }

	    public String next() {
	        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
	            try {
	                tokenizer = new StringTokenizer(reader.readLine());
	            } catch (IOException e) {
	                throw new RuntimeException(e);
	            }
	        }
	        return tokenizer.nextToken();
	    }

	    public String nextLine() {
	        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
	            try {
	                return reader.readLine();
	            } catch (IOException e) {
	                throw new RuntimeException(e);
	            }
	        }

	        return tokenizer.nextToken("\n");
	    }

	    public long nextLong() {
	        return Long.parseLong(next());
	    }

	    public int nextInt() {
	        return Integer.parseInt(next());
	    }

	    public double nextDouble() {
	         return Double.parseDouble(next());
	     }

	    public int[] nextIntArray(int n) {
	        int[] a = new int[n];
	        for (int i = 0; i < n; i++)
	            a[i] = nextInt();
	        return a;
	    }

	    public long[] nextLongArray(int n) {
	        long[] a = new long[n];
	        for (int i = 0; i < n; i++)
	            a[i] = nextLong();
	        return a;
	    }
	}
}


Measured memory_bytes: 33560
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <ctime>
#include <cstring>
#include <functional>
#include <iostream>
#include <iomanip>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <regex>
#include <vector>

#define fix(n)          cout<<fixed<<setprecision(n)
#define rep(i,n)        for (int i = 0; i < (n); ++i)
#define all(a)          (a).begin(), (a).end()
#define sort(a)         sort(all(a))
#define uniq(a)         sort(a);(a).erase(unique(all(a), (a).end())
#define reverse(a)      reverse(all(a))
#define ctos(c)         string(1, (c))
#define out(d)          cout << (d)
#define outl(d)         std::cout<<(d)<<"\n"
#define YES()           cout << "YES" << endl
#define NO()            cout << "NO" << endl
#define Yes()           cout << "Yes" << endl
#define No()            cout << "No" << endl
#define ceil(x, y)      ((x + y - 1) / (y))
#define debug(x)        cerr << #x << ": " << (x) << '\n'
#define debug2(x, y)    cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << '\n'
#define debug3(x, y, z) cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << ", " << #z << ": " << (z) << '\n'
#define dbg(v)          for (size_t _ = 0; _ < v.size(); ++_){ cerr << #v << "[" << _ << "] : " << v[_] << '\n'; }
#define pb              push_back
#define fst             first
#define int             long long

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

const ll MOD = 1000000007; // 10^9 + 7
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

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

vector<P> factor(ll n) {
  vector<P> ret;
  ll q = n;
  for (ll d = 2; d * d <= n; d++) {
    if (q % d > 0) continue;
    ll cnt = 0;
    while (q % d == 0) {
      cnt++;
      q /= d;
    }
    ret.push_back(make_pair(d, cnt));
  }
  if (q > 1) ret.push_back(make_pair(q, 1));
  return ret;
}

void solve() {
  ll a, b; cin >> a >> b;
  ll g = gcd(a, b);
  outl(factor(g).size() + 1);
}

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  srand((unsigned)time(NULL));
  fix(12);

  solve();
}


Measured memory_bytes: 632
#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <climits>
#include <cmath>
#include <complex>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <iomanip>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <cstdint>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
#define MP make_pair
#define PB push_back
#define inf 1000000007
#define rep(i,n) for(int i = 0; i < (int)(n); ++i)
#define all(x) (x).begin(),(x).end()

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}
 
template<class T> inline bool chmax(T &a, T b){
    if(a<b){
        a = b;
        return true;
    }
    return false;
}

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

int p[200][200];
int main(){
    int n;
    cin >> n;
    string s;
    rep(i,n){
        cin >> s;
        ll c = 0;
        int x = 0;
        bool f = 0;
        rep(k,s.size()){
            if(f){
                c*=10;
                c += s[k]-'0';
                x++;
            }else{
                if(s[k]=='.'){
                    f = 1;
                    continue;
                }
                c *= 10;
                c += s[k]-'0';
            }
        }
        int a = 0 ,b = 0;
        while(c%2==0){
            c /= 2;
            a++;
        }
        while(c%5==0){
            c /= 5;
            b++;
        }
        a -= x;
        b -= x;
        p[a+100][b+100]++;
    }
    ll res = 0;
    rep(i,200){
        rep(j,200){
            if(p[i][j]!=0){
                ll c = p[i][j];
                int x = 200-i;
                int y = 200-j;
                for(int k=x;k<200;k++){
                    for(int l=y;l<200;l++){
                        if(k==i&&l==j){
                            res += c*(p[k][l]-1);
                        }else{
                            res += c*p[k][l];
                        }
                    }
                }
            }
        }
    }
    cout << res/2 << endl;
    return 0;
}

Measured memory_bytes: 3140
#include<stdio.h>
int main()
{
	long long int a, b, c;
	scanf("%lld %lld %lld", &a, &b, &c);
	if (c - a - b < 0)
		printf("No\n");
	else if (4 * a * b >= (c - a - b) * (c - a - b))
		printf("No\n");
	else
		printf("Yes\n");
	return 0;
}

Measured memory_bytes: 128
n,p=map(int,input().split())
ans=1
flag=0
if n==1:
  print(p)
  flag+=1
def prime_factors(p):
    i = 2
    factors = []
    while i * i <= p:
        if p % i:
            i += 1
        else:
            p //= i
            factors.append(i)
    if n > 1:
        factors.append(p)
    return factors
primelist=prime_factors(p)
set=list(set(primelist))
for i in set:
    if primelist.count(i)//n>=1:
      ans=ans*(i**(primelist.count(i)//n))
    else:
      pass
if flag==0:
  print(ans)

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

int main(){

  char c[201];
  char work[201];
  int m,h;
  int l;


  while(1){
    cin >> c;
    if(c[0]=='-')
      break;

    l=strlen(c);

    cin >> m;

    for(int i=0; i<m; i++){
      cin >> h;

      for(int j=0; j<h; j++)
	work[j] = c[j];

      for(int j=0; j<l-h; j++)
	c[j]=c[j+h];

      // cout << "swift:" << c << endl;

      for(int j=l-h; j<l; j++)
	c[j] = work[j-(l-h)];

      //cout << "complte:" << c << endl;

    }

    cout << c << endl;

  }

  return 0;
}

Measured memory_bytes: 1160