akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n,w;
    cin >> n >> w;
    ll weight[n];
    ll value[n];
    rep(i,n)
    {
        cin >> weight[i] >> value[i];
    }

    ll dp[n+1][w+1];
    rep(i,n+1) rep(j,w+1)
    {
        dp[i][j]=0;
    }

    REP(i,1,n+1) rep(j,w+1)
    {
        if  (j-weight[i-1] < 0)
        {
            dp[i][j] = dp[i-1][j];
        }
        else
        {
            dp[i][j] = max(dp[i-1][j], dp[i-1][j-weight[i-1]]+value[i-1]);
        }
    }
    cout << dp[n][w] << endl;
}


Measured memory_bytes: 79104
mod = 10 ** 9 + 7

n, k = gets.split.map(&:to_i)

a = [1] * (k+1)
# b = Array.new(k+1){|i| i }

ans = 0
(k/2).downto(1) do |i|
  cnt = ( k/i ).pow( n, mod )
  (i*2).step(k, i){|j| cnt = ( cnt - a[j] ) % mod }
  a[i] = cnt
  ans += i * cnt % mod
  # ans %= mod if ans >= mod
end

puts (ans + (k-k/2) * ( k + k/2+1) / 2 ) % mod

Measured memory_bytes: 15120
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define srt(i) sort(i.begin(), i.end())
#define rvt(i) sort(i.begin(), i.end(), greater<int>())

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

    cout << a*b << endl;
}


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

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

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

const int MAX_N = 3010;
const int MAX_T = 3010;
int A[MAX_N];
int B[MAX_N];

int dp1[MAX_N][MAX_T];
int dp2[MAX_N][MAX_T];

int main2() {
  CLR(dp1, 0);
  CLR(dp2, 0);

  int N = nextInt();
  int T = nextInt();

  REP(i, N) {
    A[i] = nextInt();
    B[i] = nextInt();
  }

  for (int i = 0; i < N; i++) {
    for (int j = T; j >= 0; j--) chmax(dp1[i+1][j], dp1[i][j]);
    for (int j = T; j >= 0; j--) {
      if (j + A[i] <= T) chmax(dp1[i+1][j + A[i]], dp1[i][j] + B[i]);
    }
  }
  for (int i = 0; i < N; i++) {
    for (int j = T; j >= 0; j--) chmax(dp2[i+1][j], dp2[i][j]);
    for (int j = T; j >= 0; j--) {
      if (j + A[N-1-i] <= T) chmax(dp2[i+1][j + A[N-1-i]], dp2[i][j] + B[N-1-i]);
    }
  }
  // REP(i, N+1) {
  //   REP(j, T+1) {
  //     cout << dp1[i][j] << " ";
  //   }
  //   cout << endl;
  // }
  // cout << endl;
  // REP(i, N+1) {
  //   REP(j, T+1) {
  //     cout << dp2[i][j] << " ";
  //   }
  //   cout << endl;
  // }
  // cout << endl;


  int ans = 0;
  for (int l = 0; l < N; l++) {
    int val = 0;
    for (int t = 0; t <= T-1; t++) {
      chmax(val, dp1[l][t] + dp2[N-1-l][T-1-t]);
    }
    chmax(ans, val + B[l]);
  }
  cout << ans << endl;
  return 0;
}

int main() {

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


Measured memory_bytes: 71040
#include<cstdio>
#include<algorithm>
using namespace std;
int main(){
    int n;
    while(scanf("%d",&n),n){
        int go[100001];
        for(int i = 0; i < n; i++){
            scanf("%d",&go[i]);
        }
        int con[100001]={0};
        con[0] = 1;
        for(int i = 1; i < n ; i++){
            if(i % 2 == 0){
                if(go[i-1] == go[i])con[i] = con[i-1]+1;
                else con[i] = 1;
            }
            else{
                if(go[i-1] == go[i])con[i] = con[i-1]+1;
                else{
                    int add = i-1-con[i-1];
                    int color = (go[i-1]==0)?1:0;
                    for(int j = i-1; j > i-1-con[i-1]; j--){
                        go[j] = color;
                    }
                    con[i] = con[i-1]+1+con[add];
                }
            }
        }
        int cnt = 0;
        for(int i = 0; i < n; i++)if(go[i] == 0)cnt++;
        printf("%d\n",cnt);
    }
    return 0;
}

Measured memory_bytes: 1816
//JSd
#include<iostream>
#include<set>
using namespace std;
int main(){
	set<int > s;
	s.insert(1);
	s.insert(2);
	s.insert(3);
int p,q;
cin>>p>>q;
s.erase(p);
s.erase(q);
cout<<(*(s.begin()))<<"\n";

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
typedef long long ll;
typedef pair<int, int> P;
typedef pair<pair<int, int>, int> PP;
typedef bitset<61> Bitset;
const ll INFL = 1LL << 60;
const ll MOD = 1000000007;
const int INF = INT_MAX;
const int MAX = 300000;
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); }
//------------------------------------------------------------------------------------------------------------------------------
const ll M = 26;
int main(void) {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;cin>>n;
    vector<ll>cnt(100010,0);
    ll ans = 0;
    for(int i = 0; i < n; i++) {
        ll a;cin>>a;
        cnt[a]++;
        ans += a;
    }
    int q;cin>>q;
    for(int i = 0; i < q; i++) {
        ll b,c;cin>>b>>c;
        ans -= b*cnt[b];
        ans += c*cnt[b];
        cnt[c] += cnt[b];
        cnt[b] = 0;
        cout<<ans<<endl;
    }
}


Measured memory_bytes: 3992
#define LOCAL

#include <map>
#include <unordered_map>
#include <unordered_set>
#include <set>
#include <vector>
#include <numeric>
#include <algorithm>
#include <iostream>
#include <string>
#include <cstring>
#include <sstream>
#include <functional>
#include <queue>
#include <deque>
#include <stack>
#include <cmath>
#include <iomanip>

using namespace std;

// From Errichto's Youtube stream
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

using int64 = long long;

/////////////////////
// Code starts here//
/////////////////////

int N;
vector<int> A;

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

    cin >> N;
    A.resize(N);

    map<int, int> pos[2];

    for (int i = 0; i < N; i++) {
        cin >> A[i];
        pos[i & 1][A[i]]++;
    }

    int result = N;

    vector<pair<int, int>> cand[2];

    for (int p = 0; p < 2; p++) {
        int mv = 0;
        
        for (auto entry : pos[p])
            cand[p].emplace_back(entry.second, entry.first);
        
        if (cand[p].size() == 1) {
            cand[p].emplace_back(0, -1);
        }

        sort(cand[p].rbegin(), cand[p].rend());
    }

    for (int i = 0; i < 2; i++) {
        for (int j = 0; j < 2; j++) {
            if (cand[0][i].second != cand[1][j].second) {
                result = min(result, N - cand[0][i].first - cand[1][j].first);
            }
        }
    }

    cout << result << "\n";

    return 0;
}


Measured memory_bytes: 6524
#include <bits/stdc++.h>
using namespace std;
using ll= long long ;
using P = pair<ll,ll>;
#define rep(i,n) for (ll i = 0; i<(ll)(n); i++)
#define mod 1000000007
#define pi 3.141592653589793
typedef vector<ll> vcl;
 
ll gcd(ll a,ll b){
    if(b>a) swap(a,b);
    if(b==0) return a;
    return gcd(b,a%b);
}
ll lcm(ll a, ll b){
    ll g=gcd(a,b);
    return a/g*b;
}
ll rep_jijo(ll n,ll x){
    if(x==0) return 1;
    if(x%2==0){
        ll t =rep_jijo(n,x/2);
        return t*t%mod;
  }
  return n*rep_jijo(n,x-1)%mod;
}
 
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return 1;
    }
    return 0;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}

 
int main() {
   ll N;
   cin>>N;
   ll a[N][3];
   ll dp[N+1][3];
   rep(i,N){rep(j,3){
       a[i][j]=0;
   }
   }
   rep(i,N+1){rep(j,3){
       dp[i][j]=0;
    }}

   rep(i,N){
       rep(j,3){
           cin>>a[i][j];
       }
   }
 
   rep(i,N){
       rep(j,3){
           rep(k,3){
               if(j==k){
                   continue;
                   }
               
               dp[i + 1][k]=max(dp[i][j],dp[i][3-j-k])+a[i][k];
           }
       }
   }
   
   ll ans;
   ans=max(max(dp[N][0],dp[N][1]),dp[N][2]);
    cout << ans << endl;
   return 0;
}

Measured memory_bytes: 4992
#include<stdio.h>
#define N 100000

typedef struct{
  int parent;
  int left;
  int right;
}Node;

int depth(int);
int height(int);

Node node[N];

int main(){
  int i, j, n, id, child;

  scanf("%d", &n);
  for(i = 0;i < n;i++){
    node[i].parent = node[i].left = node[i].right = -1;
  }
  for(i = 0;i < n;i++){
    scanf("%d", &id);
    for(j = 0;j < 2;j++){
      scanf("%d", &child);
      if(child != -1){
        node[child].parent = id;
        if(j == 0){
          node[id].left = child;
        }
        else{
          node[id].right = child;
        }
      }
    }
  }

  for(i = 0;i < n;i++){
    printf("node %d: parent = %d, sibling = ", i, node[i].parent);
    if(node[i].parent == -1){
      printf("-1, ");
    }
    else{
      if(node[node[i].parent].right == -1){
        if(node[node[i].parent].left != -1 && node[node[i].parent].left != i){
          printf("%d, ", node[node[i].parent].left);
        }
        else{
          printf("-1, ");
        }
      }
      else{
        if(node[node[i].parent].right != i){
          printf("%d, ", node[node[i].parent].right);
        }
        else{
          printf("%d, ", node[node[i].parent].left);
        }
      }
    }

    printf("degree = ");
    if(node[i].left == -1){
      if(node[i].right == -1){
        printf("0, ");
      }
      else{
        printf("1, ");
      }
    }
    else{
      if(node[i].right == -1){
        printf("1, ");
      }
      else{
        printf("2, ");
      }
    }

    printf("depth = %d, height = %d, ", depth(i), height(i));

    if(node[i].parent == -1){
      printf("root\n");
    }
    else{
      if(node[i].left == -1){
        if(node[i].right != -1){
          printf("internal node\n");
        }
        else{
          printf("leaf\n");
        }
      }
      else{
        printf("internal node\n");
      }
    }
  }
  return 0;
}

int depth(int id){
  int dep = 0;
  while(1){
    if(node[id].parent == -1){
      return dep;
    }
    else{
      dep++;
      id = node[id].parent;
    }
  }
}

int height(int id){
  int hei, l = 0, r = 0;
  if(node[id].left == -1){
    if(node[id].right == -1){
      return 0;
    }
    else{
      r += height(node[id].right) + 1;
    }
  }
  else{
    l += height(node[id].left) + 1;
    if(node[id].right != -1){
      r += height(node[id].right) + 1;
    }
  }
  if(l < r){
    return r;
  }
  else{
    return l;
  }
}

Measured memory_bytes: 612
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1000000000LL;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
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; }

int main() {
  int d;
  cin >> d;
  string s = "Christmas";
  for(d; d < 25; d++)
    s += " Eve";
  
  cout << s << ln;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <math.h>
#include <vector>
#include <map>
#include <queue>
#include <utility>
#include <algorithm>
#include <string>
#include <set>
#include <random>
using namespace std;

int main() {
  int N;
  cin >> N;
  int a = 0;
  while (4 * a <= N) {
	  if ((N - 4 * a) % 7 == 0) {
		  cout << "Yes" << endl;
		  return 0;
		}
	  a++;
	}
  cout << "No" << endl;
  return 0;
}


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

using namespace std;
using namespace __gnu_pbds;

#define sim template < class c
#define ris return *this
#define dor > debug &operator<<
#define eni(x)                                                                        \
    sim > typename enable_if< sizeof dud< c >(0) x 1, debug & >::type operator<<(c i) \
    {
sim > struct rge
{
    c b, e;
};
sim > rge< c > range(c i, c j) { return rge< c >{i, j}; }
sim > auto dud(c *x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug
{
#ifdef XOX
    ~debug()
    {
        cerr << endl;
    }
    eni(!=) cerr << boolalpha << i;
    ris;
} eni(==) ris << range(begin(i), end(i));
}
sim, class b dor(pair< b, c > d)
{
    ris << "" << d.first << " --> " << d.second << "";
}
sim dor(rge< c > d)
{
    *this << "[";
    for (auto it = d.b; it != d.e; ++it)
        *this << ", " + 2 * (it == d.b) << *it;
    ris << "]";
}
#else
    sim dor(const c &)
    {
        ris;
    }
#endif
}
;
#define imie(...) "" << #__VA_ARGS__ " = " << (__VA_ARGS__) << ", "

#define F first
#define S second
#define endl '\n'
#define pb emplace_back
#define mp make_pair
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) (a * b) / gcd(a, b)
#define all(v) (v).begin(), (v).end()
#define lb(v, val) (lower_bound(v.begin(), v.end(), val) - v.begin())
#define ub(v, val) (upper_bound(v.begin(), v.end(), val) - v.begin())
#define fast                      \
    ios_base::sync_with_stdio(0); \
    cin.tie();                    \
    cout.tie()
#define min3(x, y, z) (x < y ? (x < z ? x : z) : (y < z ? y : z))
#define max3(x, y, z) (x > y ? (x > z ? x : z) : (y > z ? y : z))
#define MAX_N int(1e6 + 7)
#define MAX_M int(1e6 + 7)
#define MAX_V int(1e6 + 7)
#define oo int(1e9 + 217)
#define MOD int(1e9 + 7)
using ll = long long;
using vi = vector< int >;
using vl = vector< ll >;
using vpii = vector< pair< int, int > >;
using pii = pair< int, int >;

typedef tree<
    int,
    null_type,
    less< int >,
    rb_tree_tag,
    tree_order_statistics_node_update >
    oset;

void solve()
{
}

int main()
{
    fast;
    int d, t, s;
    cin >> d >> t >> s;
    if (s * t >= d)
        puts("Yes");
    else
        puts("No");
}

Measured memory_bytes: 3620
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b;
  cin>>a>>b;
  if((a+b)%2==0)
  {
    cout<<(a+b)/2;
  }
  else
  {
    cout<<"IMPOSSIBLE";
    return 0;
  }
}

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

#define se second
#define fi first
#define mk(a,b) make_pair(a,b)

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

int N;
vector<pii> V;
vector<int> cmp;
int L[200010],R[200010];
ll dp[200010] = {0};
ll mod = 1000000007;
ll sum[200010] = {0};

ll SUM(int i)
{
    if(i < 0)return 0;
    return sum[i];
}

int main()
{
    scanf("%d",&N);
    for(int i = 0; i < N; i++)
    {
        int a,b;
        scanf("%d%d",&a,&b);
        V.push_back(mk(a,b));
        cmp.push_back(b);
    }

    sort(V.begin(),V.end());
    sort(cmp.begin(),cmp.end());
    cmp.erase(unique(cmp.begin(),cmp.end()),cmp.end());

    for(int i = 0; i < N; i++)V[i].se = upper_bound(cmp.begin(),cmp.end(),V[i].se) - cmp.begin();

    int mem = 0;
    for(int i = 0; i < N; i++)
    {
        mem = max(mem,V[i].se);
        L[i] = mem;
    }
    mem = 1001001001;
    for(int i = N - 1; i >= 0; i--)
    {
        mem = min(mem,V[i].se);
        R[i] = mem;
    }

    V.clear();
    for(int i = 0; i < N; i++)V.push_back(mk(L[i],R[i]));
    sort(V.begin(),V.end());
    for(int i = 0; i < N; i++)swap(V[i].fi,V[i].se);

    dp[0] = sum[0] = 1;
    int id = 0;
    for(int i = 1; i <= N; i++)
    {
        sum[i] = sum[i - 1];
        while(id != N && V[id].se == i)
        {
            int l = V[id].fi,r = V[id].se;
            dp[r] += (SUM(r) - SUM(l - 2) + mod) % mod;
            dp[r] %= mod;
            sum[r] = (dp[r] + sum[r - 1]) % mod;
            id++;
        }
    }
    printf("%lld\n",dp[N]);
    return 0;
}


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

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


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

ll dp[105][2][4];

int main2() {
  string S; cin >> S;
  int M = S.size();
  int K; cin >> K;

  CLR(dp, 0);
  dp[0][0][0] = 1;
  REP(i, M) {
    REP(f, 2) {
      REP(k, K+1) {
        // cout << i << " " << f << " " << k << " -> " << dp[i][f][k] << endl;
        REP(d, 10) {
          int nf = f || (S[i]-'0' > d);
          int nk = k + (!!d);
          if ((f || S[i]-'0' >= d) && nk <= K) {
            dp[i+1][nf][nk] += dp[i][f][k];
          }
        }
      }
    }
  }
  ll ans = dp[M][0][K] + dp[M][1][K];
  cout << ans << endl;
  return 0;
}

int main() {

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using pll = pair<ll, ll>;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define rrep(i, m, n) for(ll i = m; i > n; i--)
#define Rep(i, m, n) for(ll i = m; i < n; i++)
#define all(vec) vec.begin(), vec.end()
#define lmax(x, y) max<ll>(x, y)
#define lmin(x, y) min<ll>(x, y)
#define tmax(x, y, z) lmax((x), lmax((y), (z)))
#define tmin(x, y, z) lmin((x), lmin((y), (z)))
#define MINUS(a) memset(a, 0xff, sizeof(a))
#define ZERO(a) memset(a, 0, sizeof(a))
const ll INF = 1LL << 60;
const ll MM = 1000000000; const ll MOD = MM + 7; const ll MMM=9223372036854775807;//2^63 -1
#define ADD(a,b) a = (a + ll(b)) % MOD
#define MUL(a,b) a = (a * ll(b)) % MOD
ll GCD(ll x, ll y){ if(y == 0) return x; else return GCD(y, x % y);}
ll LCM(ll x, ll y){ return x / GCD(x, y) * y;}
template<class T> inline bool chmin(T& a, T b){ if(a > b){ a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b){ if(a < b){ a = b; return true;} return false;}
template<typename A, size_t N, typename T> void FILL(A (&array)[N], const T &val){ fill( (T*)array, (T*)(array+N), val );}
// struct edge{ ll from, to, cost; };
// struct edge{ ll to, cost; };
// using Graph = vector<vector<ll>>;  // 重み無し
// using Graph = vector<edge>;  // 辺
// using Graph = vector<vector<edge>>;  // 重み付き
ll dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
ll ddx[8] = {1, 1, 0, -1, -1, -1, 0, 1}, ddy[8] = {0, 1, 1, 1, 0, -1, -1, -1};
//cout << fixed << setprecision(10);
// priority_queue<ll, vector<ll>, greater<ll>> pq;


map<ll, ll> prime_factor(ll n){
    map<ll, ll> res;
    for(ll i=2; i*i<=n; i++){
        while(n%i == 0){
            ++res[i];
            n /= i;
        }
    }
    if(n != 1) res[n] = 1;
    return res;
}

ll ta[1000000];

int main(){
    ll n; cin >> n;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    ll x = 0;
    rep(i, n){
        x = GCD(x, a[i]);
    }
    if(x == 1){
        rep(i, n){
            auto mp = prime_factor(a[i]);
            for(auto p: mp){
                if(ta[p.first] != 0){
                    cout << "setwise coprime" << endl;
                    return 0;
                }
                ta[p.first]++;
            }
        }
        cout << "pairwise coprime" << endl;
        return 0;
    }
    cout << "not coprime" << endl;
}


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

int main(){
  ios_base::sync_with_stdio(0); cin.tie(0);
  int n,k; cin >> n >> k;
  (((n/2) + n%2) >= k) ? cout << "YES\n" : cout << "NO\n";
  return 0;
}

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

int main(){
    int r, d;
    int x[11];
    cin>>r>>d;
    cin>>x[0];
    for(int i=0;i<10;i++){
        x[i+1]=r*x[i]-d;
        cout<<x[i+1]<<endl;
    }
}


Measured memory_bytes: 256
//Code by Mukul Totla
#include<bits/stdc++.h>
using namespace std;
#define ll long long

int main()
{   

  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  ll n,i;
  cin>>n;
  ll arr[n];
  for(i=0; i<n; i++)
    cin>>arr[i];
  ll minm=arr[0];
  ll ans=1;
  for(i=1; i<n; i++)
  {
    if(arr[i]<minm)
    {
      ans++;
      minm=arr[i];
    }
  }
  cout<<ans;
  return 0;
}

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

int ans(int n, vector<int> &dp, vector<int> &h, int i, int prev){
	if(i==n-1){
		return 0;
	}
	else if(i >= n)
		return 100000;

	if(dp[i] != -1)
		return dp[i];

	else{
		if(i+1 == n-1)
			return abs(h[i]-h[i+1]);

		else
			dp[i] = min(abs(h[i]- h[i+1]) + ans(n, dp, h, i+1, h[i]), abs(h[i]- h[i+2]) + ans(n, dp, h, i+2, h[i]));
	}
	return dp[i];

}

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

	vector<int> h(n);
	for(int i = 0 ; i < n ; i++)
		cin >> h[i];

	vector<int> dp(n, -1);

	int a = ans(n, dp, h, 0, h[0]);

	cout << a << endl;
}

Measured memory_bytes: 4992
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <bits/stdc++.h>
 
#if DEBUG
    #include "debug.h"
#else
    #define debug(args...)
#endif    

using namespace std;

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


#define M 1000000 
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define fill(a,x) memset(a,x,sizeof(a))
#define F first
#define S second
#define FOR(i,a,b) for(int i = a; i<=b; ++i)
#define NFOR(i,a,b) for(int i = a; i>=b; --i)
#define fast ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0)
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int INF = INT_MAX;
const int mod = 1e9+7;

const int N = 2e5 + 10;
inline int add(int x,int y){
  x += y;
  if(x >= mod) x -= mod;
  return x;
}
inline int mul(int x,int y){
  x = (1LL * x * y) % mod;
  return x;
}
clock_t time_p=clock();



int32_t main(){
	fast;

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


	int n;
	cin >> n;
	vector<int>a(n);
	FOR(i,0,n-1)cin >> a[i];
	sort(all(a));
	ll ans = 0;
	FOR(i,0,n-1) {
		FOR(j,i+1,n-1) {
			int sum = a[i] + a[j];
			int diff = -a[i] + a[j];
			int val = lower_bound(all(a),sum) - upper_bound(all(a),diff);
			if(a[i] > diff)val--;
			if(a[j] > diff)val--;
			ans = ans + val;
		}
	}
	cout << ans/3 << "\n";

	time_p=clock()-time_p;
	cerr<<"\nTime Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";

	return 0;
}

Measured memory_bytes: 256
import java.io.PrintWriter;
import java.util.Scanner;

class Main{
    private static final Scanner sc = new Scanner(System.in);
    private static final PrintWriter out = new PrintWriter(System.out);
    public static void main(String[] Args){
        final int r = Integer.parseInt(sc.next());
        final int c = Integer.parseInt(sc.next());
        final int[][] cells = new int[r+1][c+1];
        for(int i = 0; i<r; i++){
            for(int j = 0; j<c; j++){
                final int num = Integer.parseInt(sc.next());
                cells[i][j] = num;
                cells[r][j] += num;
                cells[i][c] += num;
                cells[r][c] += num;
            }
        }
        for(final int[] cell:cells){
            boolean first = true;
            for(final int element:cell){
                if(first) first = false;
                else out.print(' ');
                out.print(element);
            }
            out.println();
        }
        out.flush();
    }
}

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

int main() {
	int A[101][101];
	int w, h, n;
	cin >> w >> h >> n;
	for (int i =0 ; i <= h; i++) {
		for (int j = 0; j <= w; j++)A[i][j] = 0;
	}

	for (int i = 0; i < n; i++) {
		int x, y, a;
		int sy, sx, gy, gx;
		cin >> x >> y >> a;
		if (a == 1) {
			sy = h; sx = 1; gy = 0; gx = x;
		}
		else if (a == 2) {
			sy = h; sx = x+1; gy = 0; gx = w;
		}
		else if (a == 3) {
			sy = y; sx = 1; gy = 0; gx = w;
		}
		else if (a == 4) {
			sy = h; sx = 1; gy = y; gx = w;
		}
		//cout << sy << ' ' << gy << ' ' << sx << ' ' << gx << endl;
		for (int j = sy; j > gy; j--) {
			for (int k = sx; k <= gx; k++)A[j][k] = 1;
		}

		/*for (int j = h; j >= 1; j--) {
			for (int k= 1; k <= w; k++)cout << A[j][k] << ' ';
			cout << endl;
		}
		cout << endl;*/
	}

	int res = 0;
	for (int i = h; i >= 1; i--) {
		for (int j = 1; j <= w; j++){
			if (A[i][j] == 0)res++;
		}
	}
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 256
/*************************************************************************
	> File Name: A.cpp
	> Author: Knowledge_llz
	> Mail: 925538513@qq.com 
	> Created Time: 2020/4/12 19:55:02
 ************************************************************************/

#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<algorithm>
#define For(i,a,b) for(register int i=(a);i<=(b);++i)
#define LL long long
using namespace std;
int read(){
	char x=getchar(); int u=0,fg=0;
	while(!isdigit(x)){ if(x=='-') fg=1; x=getchar(); }
	while(isdigit(x)){ u=(u<<3)+(u<<1)+(x^48); x=getchar(); }
	return fg?-u:u;
}
int main()
{
	LL sum=0;
	int n;
	scanf("%d",&n);
	For(i,1,n){
		if(i%3==0) continue;
		if(i%5==0) continue;
		sum+=(LL)i;
	}
	printf("%lld\n",sum);
	return 0;
}


Measured memory_bytes: 3844
#include<stdio.h>
int main()
{
    int n;
    scanf("%d",&n);
    int b=0;
    int t=n;
    while(n)
    {
        b+=n%10;
        n/=10;
    }
    if(t%b==0)
        printf("Yes");
    else
        printf("No");
    return 0;
}


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

int main()
{
    std::int64_t X, N;
    std::cin >> X >> N;

    std::vector<std::int64_t> ns(110);
    std::iota(ns.begin(), ns.end(), std::int64_t(-1));

    for(std::int64_t i=0; i<N; ++i)
    {
        std::int64_t p;
        std::cin >> p;
        ns.erase(std::find(ns.begin(), ns.end(), p));
    }

    std::int64_t ans = 1000000;
    std::int64_t min_dist = 10000000;
    for(const auto n : ns)
    {
        const auto dist = std::abs(n - X);
        if(dist < min_dist)
        {
            min_dist = dist;
            ans = n;
        }
        else if(dist == min_dist && n < ans) // not needed
        {
            ans = n;
        }
    }

    std::cout << ans << std::endl;

    return 0;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;

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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;
typedef pair<int, i_i> iii;
int N, M, L;
vector<iii> paths[100];
int dist[100][101];

void solve() {
    for(int i = 0; i < N; i++) paths[i].clear();
    for(int i = 0; i < M; i++) {
        int a, b,d, e;
        cin >> a >> b >> d >> e;
        a--;
        b--;
        paths[a].push_back({b, {d, e}});
        paths[b].push_back({a, {d, e}});
    }
    for(int i = 0; i < N; i++) {
        for(int j = 0; j <= L; j++) {
            dist[i][j] = 1e9;
        }
    }
    dist[0][L] = 0;
    priority_queue<iii, vector<iii>, greater<iii>> que;
    que.push({0, {0, L}});
    while(!que.empty()) {
        auto tmp = que.top();
        que.pop();
        int pos = tmp.second.first;
        int l = tmp.second.second;
        for(auto tmp : paths[pos]) {
            int to = tmp.first;
            if(chmin(dist[to][l], dist[pos][l] + tmp.second.second)) {
                que.push({dist[to][l], {to, l}});
            }
            if(l >= tmp.second.first) {
                if(chmin(dist[to][l-tmp.second.first], dist[pos][l])) {
                    que.push({dist[to][l-tmp.second.first], {to, l - tmp.second.first}});
                }
            }
        }
    }
    int ans = 1e9;
    for(int l = 0; l <= L; l++) {
        chmin(ans, dist[N-1][l]);
    }
    cout << ans << endl;
}

int main() {
    //cout.precision(10);
    cin.tie(0);
    ios::sync_with_stdio(false);
    while(cin >> N >> M >> L) {
        if(N == 0) break;
        solve();
    }
    return 0;
}


Measured memory_bytes: 3460
#define EPS (1e-10)
#define equals(a, b) (fabs((a) - (b)) < EPS)
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;

class Point {
 public:
  double x, y;

  Point(double x = 0, double y = 0): x(x), y(y) {}

  Point operator + (Point p) { return Point(x + p.x, y + p.y); }
  Point operator - (Point p) { return Point(x - p.x, y - p.y); }
  Point operator * (double a) { return Point(a * x, a * y); }
  Point operator / (double a) { return Point(x / a, y / a); }

  double abs() { return sqrt(norm()); }
  double norm() {return x * x + y * y; }

  bool operator < (const Point &p) const {
    return x != p.x ? x < p.x : y < p.y;
  }

  bool operator == (const Point &p) const {
    return fabs(x - p.x) < EPS && fabs(y - p.y) < EPS;
  }

};

typedef Point Vector;

double dot(Vector a, Vector b) {
  return a.x * b.x + a.y * b.y;
}

double cross(Vector a, Vector b) {
  return a.x * b.y - a.y * b.x;
}

struct Segment {
  Point p1, p2;
};

typedef Segment Line;

static const int COUNTER_CLOCKWISE = 1;
static const int CLOCKWISE = -1;
static const int ONLINE_BACK = 2;
static const int ONLINE_FRONT = -2;
static const int ON_SEGMENT = 0;

int ccw(Point p0, Point p1, Point p2) {
  Vector a = p1 - p0;
  Vector b = p2 - p0;
  if (cross(a, b) > EPS) return COUNTER_CLOCKWISE;
  if (cross(a, b) < -EPS) return CLOCKWISE;
  if (dot(a, b) < -EPS) return ONLINE_BACK;
  if (a.norm() < b.norm()) return ONLINE_FRONT;
  return ON_SEGMENT;
}

bool intersect(Point p1, Point p2, Point p3, Point p4) {
  return (ccw(p1, p2, p3) * ccw(p1, p2, p4) <= 0 &&
          ccw(p3, p4, p1) * ccw(p3, p4, p2) <= 0);
}

bool intersect(Segment s1, Segment s2) {
  return intersect(s1.p1, s1.p2, s2.p1, s2.p2);
}

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

  cout << fixed;
  for (int i = 0; i < n; i++) {
    Segment s1, s2;
    cin >> s1.p1.x >> s1.p1.y >> s1.p2.x >> s1.p2.y;
    cin >> s2.p1.x >> s2.p1.y >> s2.p2.x >> s2.p2.y;
    if (intersect(s1, s2)) cout << 1 << endl;
    else cout << 0 << endl;
  }
  return 0;
}



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

#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = (n)-1; i >= 0; i--)
#define rep1(i,n) for(int i = 1; i <= (n); i++)
#define rrep1(i,n) for(int i = (n); i > 0; i--)

#define ll long long
#define pi pair<int, int>
#define pll pair<ll, ll>

#define MOD 1000000007
#define INF 1000000000000000LL

using namespace std;

int main(){

  int n;cin>>n;
  vector<int>a(n);
  rep(i, n)cin>>a[i];

  vector<ll>dp(n+1);

  dp[0]=1000;
  for(int i=1; i<n; i++)for(int j=0; j<i; j++){
    dp[i] = max<ll>(dp[j], dp[j]/a[j]*a[i]+dp[j]%a[j]);
  }

  cout<<dp[n-1]<<endl;

//for(auto c:dp)cout<<c<<' ';cout<<endl;

  return 0;
}

Measured memory_bytes: 3604
#include<stdio.h>

int main(void){
int i;
int h;
int w;
for(i=0;i<=1000;i++){
    scanf("%d %d",&h,&w);
    if(h==0&&w==0){
        break;
    }
    for(int a=1;a<=h;a++){
        for(int b=1;b<=w;b++){
            printf("#");
        }
        printf("\n");
    }
    printf("\n");
}
return 0;
}


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

using namespace std;
using ll = long long;
using vl = vector<ll>;
using vvl = vector<vl>;
using vs = vector<string>;

using pll = pair<ll,ll>;
using vpl = vector<pll>;
using vvpl = vector<vpl>;

using tll = tuple<ll,ll,ll>;
using vtl = vector<tll>;

using vb = vector<bool>;
using vvb = vector<vb>;

using ld = long double;
using vd = vector<ld>;
using vvd = vector<vd>;
using vvvd = vector<vvd>;

#define R(a,i) for(ll a=0; a < (i); (a)++)
#define FOR(a,i,j) for(ll a=(i); a < (j); (a)++)
#define RD(a,i) for(ll a=(i)-1; (a) >= 0; (a)--)
#define FORD(a,i,j) for(ll a=(j)-1; (a) >= (i); (a)--)

#define xx first
#define yy second
#define pb push_back
#define eb emplace_back

#define all(X) begin(X),end(X)
#define sz(X) (X).size()

const ll oo = 0x3f3f3f3f3f3f3f3f;
const ld eps = 1e-9;

#define DBG 0
#define TR(X) {if(DBG) cerr << (#X) << " = " << (X) << "\n";}
#define TRM(X,i,j) {if(DBG) cerr << (#X) << "[" << i << "][" << j << "] = " << (X[i][j]) << "\n";}
#define TRP(X,i,j) {if(DBG) cerr << (#X) << "[" << i << "][" << j << "] = (" << (X[i][j]).xx << ", " << (X[i][j]).yy << ")\n";}
#define hline {if(DBG) cerr << "----------------------------------------------------------------------" << "\n";}
#define PK(X) {if(DBG) cerr << (X) << "\n";}

const ll mod = 1e9+7;

template <class T>
void myMin(T& a, T b){
	a = min(a,b);
}

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

	ll N;
	cin >> N;

	vl compatible(N, 0);

	FOR(i,0,N){
		FOR(j,0,N){
			ll s;
			cin >> s;
			if(s == 1){
				compatible[i] |= 1LL << j;
			}
		}
		TR(bitset<24>(compatible[i]));
	}

	vvl dp(N+1, vl(1LL << N, 0));

	dp[0][0] = 1;
	FOR(i,0,N){
		FOR(j,0,(1LL << N)){
			hline;
			TRM(dp, i, j);
			TR(__builtin_popcount(j));
			if(__builtin_popcount(j) != i)
				continue;

			FOR(k,0,N){
				if((1LL << k) & compatible[i]){
					dp[i+1][j | (1LL << k)] += dp[i][j];
					dp[i+1][j | (1LL << k)] %= mod;

					TR(bitset<24>(j | (1LL << k)));
					TR(dp[i+1][j | (1LL << k)]);
				}
			}
		}
	}

	cout << dp[N][(1LL << N) - 1] << endl;
}


Measured memory_bytes: 377216
#include<stdio.h>
int main()
{
	int s,a,b;

	scanf("%d",&s);
	a=s/100;
	b=s%100;
	
	if((a>12)&&(b>12)){
		printf("NA\n");
		return 0;
	}
	else if((a>0)&&(b>0)&&(a<13)&&(b<13)){
		printf("AMBIGUOUS\n");
		return 0;
	}
	else if((b>0)&&(b<13)){
		printf("YYMM\n");
		return 0;
	}	
	else if((a>0)&&(a<13)){
		printf("MMYY\n");
		return 0;
	}
	else{
		printf("NA\n");
		return 0;
	}
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define all(v) v.begin(), v.end()
    
int main(){
    int n;
    cin >> n;
    vector<int> l(n);
    rep(i,n) cin >> l[i];
    sort(all(l));

    int ans=0;

    for(int i=0; i<n-2; i++){
        for(int j=i+1; j<n-1; j++){
            bool ok = true;
            int tmp = j+1;
            while(ok){
                if((l[i] < (l[j] + l[tmp])) && (l[j] < (l[i] + l[tmp])) && (l[tmp] < (l[i] + l[j]))){
                    ans ++;
                    tmp++;
                }
                else{
                    ok = false;
                }
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3584
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <algorithm>
using namespace std;
int main(){
  string ans[8]={"AAA","AA","A","B","C","D","E","NA"};
  double a,b;
  while(cin>>a>>b){
    int aa,bb;
    if(a<35.50)aa=0;
    else if(a<37.50)aa=1;
    else if(a<40.00)aa=2;
    else if(a<43.00)aa=3;
    else if(a<50.00)aa=4;
    else if(a<55.00)aa=5;
    else if(a<70.00)aa=6;
    else aa=7;
    if(b<71.00)bb=0;
    else if(b<77.00)bb=1;
    else if(b<83.00)bb=2;
    else if(b<89.00)bb=3;
    else if(b<105.00)bb=4;
    else if(b<116.00)bb=5;
    else if(b<148.00)bb=6;
    else bb=7;
    int res=max(aa,bb);
    cout<<ans[res]<<endl;
  }
}

Measured memory_bytes: 1232
#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 brep(index,num) for(int index=num-1;index>=0;index--)
#define brep1(index,num) for(int index=num;index>0;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)
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
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(){
	string S;
	int K;
	scan(S>>K);
	int N=S.size();
	int now=1;
	string T=S+S,T3=T+S,T4=T3+S;
	ll ss=0,st=0,st3=0,st4=0;
	rep(i,N-1){
		if(S[i]==S[i+1]){
			now++;
		}
		else{
			if(now>1) ss+=now/2;
			now=1;
		}
	}
	if(now>1) ss+=now/2;
	now=1;
	rep(i,2*N-1){
		if(T[i]==T[i+1]){
			now++;
		}
		else{
			if(now>1) st+=now/2;
			now=1;
		}
	}
	if(now>1) st+=now/2;

	now=1;
	rep(i,3*N-1){
		if(T3[i]==T3[i+1]){
			now++;
		}
		else{
			if(now>1) st3+=now/2;
			now=1;
		}
	}
	if(now>1) st3+=now/2;

	now=1;
	rep(i,4*N-1){
		if(T4[i]==T4[i+1]){
			now++;
		}
		else{
			if(now>1) st4+=now/2;
			now=1;
		}
	}
	if(now>1) st4+=now/2;

	if(K==1) prin(ss);
	else if(K==2) prin(st);
	else if(K==3) prin(st3);
	else if(K==4) prin(st4);
	else if(K%2) prin(ss+(st3-ss)*(K-1)/2);
	else prin(st+(st4-st)*(K/2-1));
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(){
  int a,b,c,k;
  scanf("%d%d%d%d",&a,&b,&c,&k);
  int i,max=a,tmp;
  if(max<b)max=b;
  if(max<c)max=c;
  tmp=a+b+c-max;
  for(i=0;i<k;i++)max*=2;
  printf("%d",max+tmp);
  return 0;
}
  

Measured memory_bytes: 128
n, m = gets.split.map!(&:to_i)

k = n / 2

if n.odd?
  m.times { |i| puts [k - i, k + 1 + i] * " " }
else
  l = m.succ / 2
  (0...l).each { |i| puts [i + 1, n - i] * " " }
  (l...m).each { |i| i -= l - 1; puts [k - i, k + i] * " " }
end

load __FILE__ unless $stdin.eof?


Measured memory_bytes: 14396
#include <stdio.h>
typedef long long int ll;
constexpr int kN = int(2E5 + 10);
 
ll x[kN], y[kN];
 
int main() {
	int n, ans = 0;
	ll d;
	scanf("%d%lld", &n, &d);
	d *= d;
	for (int i = 1; i <= n; i++) scanf("%lld%lld", &x[i], &y[i]);
	for (int i = 1; i <= n; i++) if (x[i] * x[i] + y[i] * y[i] <= d) ans++;
	printf("%d\n", ans);
	
}

Measured memory_bytes: 4832
N = int(input()) #num of test case
for i in range(N):
    #one test case
    x1, y1, x2, y2, x3, y3 = map(float, input().split())
    #vertices
    a = complex(x1, y1)
    b = complex(x2, y2)
    c = complex(x3, y3)
    #make c = 0 by parallel transformation
    a -= c
    b -= c
    
    z0 = abs(a)**2 * b - abs(b)**2 * a
    z0 /= a.conjugate() * b - a * b.conjugate()
    
    #inverse parallel transformation
    z = z0 + c
    zx = "{0:.3f}".format(z.real)
    zy = "{0:.3f}".format(z.imag)
    r  = "{0:.3f}".format(abs(z0))
    print(zx, zy, r)

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

int main() {
    cin.tie(nullptr); ios::sync_with_stdio(false);
    int a, b; cin >> a >> b;
    cout << a*b << endl;
}

Measured memory_bytes: 3640
#include <stdio.h>

int gcd(int ,int );

int main(){
  int x,y,res;

  scanf("%d%d",&x,&y);

  res = gcd(x,y);

  printf("%d\n",res);
  
  return 0;
}

int gcd(int x,int y){
  int n,d;
  
  if(x > y){
    n = y;
    d = x % y;
  }
  else{
    n = x;
    d = y % x;
  }

  //printf("%d %d\n",n,d);

  if(d == 0){
    return n;
  }

  if(d != 0){
    return gcd(n,d);
  }
}



Measured memory_bytes: 2140
#include <stdio.h>

int main()
{
    int a, b, c, k, max, i, sum;
    scanf("%d%d%d", &a, &b, &c);
    scanf("%d", &k);
    
    max = a;
    sum = b + c;
    if(max < b){
        max = b;
        sum = c + a;
    }
    if(max < c){
        max = c;
        sum = a + b;
    }
    for(i=0; i < k; i++){
        max *= 2;
    }
    printf("%d\n", sum+max);
    
    return 0;
}


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

int main()
{
  int i, n, cnt = 0;
  cin >> n;
  int s[n+5];

  for(i = 1; i <= n; i++)
  	 cin >> s[i];

  for(i = 1; i <= n; i++)
    {
      if(s[i] != i) cnt ++;
    }

    if(cnt <= 2) cout << "YES";
    else cout << "NO";
   
}

Measured memory_bytes: 3616
from sys import stdin


def main():
    _, *pps = get_params()
    p, *ps = sorted(pps, reverse=True)
    print(solve(p, ps))


def get_params():
    return map(int, read_stdin().split('\n'))


def read_stdin():
    return stdin.read().strip()


def solve(p, ps):
    return p // 2 + sum(ps)


main()


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
int in(){int x; scanf("%d",&x); return x;}
static const int MAX = 100;


int main(){
  int N = in();
  double T = in(), t, mint = 100000; 
  int A = in(), h, num;

  rep(i, N){
    h = in();
    t = T - h*0.006;

    if(abs(A-t) < mint){
      mint = abs(A-t);
      num = i+1;
    }
  }
  
  cout << num << endl;
}


Measured memory_bytes: 256
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;
typedef long long ll;

#define REP(i, n) for(ll i=0;i<(ll)(n);i++)
#define RREP(i, n) for(ll i=(ll)(n-1);i>=0;i--)
#define FOR(i, a, b) for(ll i=(ll)(a); i<=(ll)(b); i++)
#define RFOR(i, a, b) for(ll i=(ll)(a);i>=(ll)(b); i--)
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((ll)(x).size())
#define INF 1000000000000
#define MOD 10000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

typedef struct{
	ll X;
	ll Y;
	ll P;
}Village;

ll N;

signed main()
{
	cin >> N;
	Village Vs[N];
	REP(i, N){
		cin >> Vs[i].X >> Vs[i].Y >> Vs[i].P;
	}
	ll Smax = pow(2, N);
	ll cost[Smax];
	REP(i, Smax){
		vector<int> tmp;
		int num=i;
		REP(k, N){
			if((num&1)==1){
				tmp.PB(k);
			}
			num/=2;
		}
		ll minS=INF;
		ll sum;
//		for(auto v : tmp){
//			sum += abs(Vs[v].X)*Vs[v].P;
//		}
//		minS = min(minS, sum);
//		if(minS == 0){
//			cost[i] = 0;
//			continue;
//		};
//		sum = 0;
//		for(auto v : tmp){
//			sum += abs(Vs[v].Y)*Vs[v].P;
//		}
//		minS = min(minS, sum);
//		if(minS == 0){
//			cost[i] = 0;
//			continue;
//		};
		for(auto v : tmp){
			sum = 0;
			for(auto vv : tmp){
				sum += min(min(abs(Vs[vv].X-Vs[v].X), abs(Vs[vv].X)), abs(Vs[vv].Y))*Vs[vv].P;
			}
			minS = min(minS, sum);
		if(minS == 0) break;
		}
		for(auto v : tmp){
			sum = 0;
			for(auto vv : tmp){
				sum += min(min(abs(Vs[vv].Y-Vs[v].Y), abs(Vs[vv].Y)), abs(Vs[vv].X))*Vs[vv].P;
			}
			minS = min(minS, sum);
		if(minS == 0) break;
		}
		cost[i] = minS;
	}
	ll dp[Smax][N];
	REP(i, Smax){
		dp[i][0] = cost[i];
	}
	for(int i=1; i<N; i++){
		REP(k, Smax){
			ll tmp = INF;
			for(ll c=k; c>=0; c--){
				c &= k;
				tmp = min(tmp, dp[k&(~c)][i-1]+cost[c]);
			}
			dp[k][i] = tmp;
		}
	}
	ll sum=0;
	REP(i, N){
		sum += min(abs(Vs[i].X), abs(Vs[i].Y))*Vs[i].P;
	}
	cout << sum << endl;
	REP(i, N){
		cout << dp[Smax-1][i] << endl;
	}
}


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

int main() {
  int N,l,r,sum;
  cin >> N;
  sum = 0;
  for (int i = 0; i < N; i++) {
    cin >> l >> r;
    sum += (r - l + 1);
  }
  cout << sum << endl;
}

Measured memory_bytes: 3564
import sys
import numpy as np
from collections import Counter
# 全探索なら、 2**6 * 2**6 （4000）
#            > 4000 * (6**2)
# bit全探索でOK
# ------------------------------------------
h, w, num = map(int, input().split())
data = []
for _ in range(h):
    # 一文字ずつListへ格納
    temp = list(input())
    data.append(temp)
#data = [input() for _ in range(h)]
# print(data)

'''
count = Counter(data)
most = count.most_common()
print(most)
'''
ans = 0

# 縦の全Loop
for i in range(2 ** h):
    for j in range(2 ** w):
        #print(i, j)
        *temp, = data
        temp = np.array(temp)
        for k in range(h):
            if (i >> k & 1):
                temp[k, :] = 'aa'

        for l in range(w):
            if (j >> l & 1):
                temp[:, l] = 'aa'

        count = np.where(temp == '#')[0]
        #print(count, len(count))
        if (len(count) == num):
            # print('add')
            ans += 1
        else:
            pass


print(ans)


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

using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int,int>;
#define rep(i,n) for(ll i = 0;i < (ll)n;i++)
#define ALL(x) (x).begin(),(x).end()
#define MOD 1000000007



int main(){
  
  int n,k;
  cin >> n >> k;
  if(n == 2){
    if(k != 2)cout << "No" << endl;
    else {
      cout  << "Yes" << endl;
      rep(i,3)cout << i+1 << endl;
    }
    return 0;
  }
  if(k == 1 || k == 2*n-1){
    cout << "No" << endl;
    return 0;
  }
  cout << "Yes" << endl;
  deque<int> dq;
  if(k != 2){
    dq.push_back(k);
    dq.push_back(k-1);
    dq.push_front(k+1);
    dq.push_front(k-2);
    ll l = n-3;
    int i;
    for(i = 1;i <= 2*n-1;i++){
      if(l == 0)break;
      if(abs(i-k) <= 1 || i == k-2)continue;
      dq.push_front(i);
      l--;
    }
    for(;i <= 2*n-1;i++){
      if(abs(i-k) <= 1 || i == k-2)continue;
      dq.push_back(i);
    }
  }else{
    dq.push_back(k);
    dq.push_back(k+1);
    dq.push_front(k-1);
    dq.push_front(k+2);
    ll l = n-3;
    int i;
    for(i = 1;i <= 2*n-1;i++){
      if(l == 0)break;
      if(abs(i-k) <= 1 || i == k+2)continue;
      dq.push_front(i);
      l--;
    }
    for(;i <= 2*n-1;i++){
      if(abs(i-k) <= 1 || i == k+2)continue;
      dq.push_back(i);
    }
  }
  rep(i,2*n-1){
    cout << dq.front() << endl;
    dq.pop_front();
  }


  
  


  return 0;
}

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

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

const int len[6] = {5,7,5,7,7,-1};

int main() {
	int n;
	while (cin >> n) {
		if (n == 0) break;
		vector< string > s(n);
		for_(i,0,n) cin >> s[i];
		
		for_(i,0,n) {
			int p = 0, sum = 0;
			for_(j,i,n) {
				sum += s[j].size();
				if (sum > len[p]) break;
				if (sum == len[p]) {
					sum = 0;
					++p;
				}
			}
			
			if (p == 5) {
				cout << i + 1 << endl;
				break;
			}
		}
	}
}

Measured memory_bytes: 3132
#include <bits/stdc++.h>
#define ll long long
#define all(x) x.begin(),x.end()
#define TESTCASES 0

using namespace std;

int n;
string s;

int Go(){

  scanf("%d",&n); cin >> s;

  ll Ans = 0;


  for(int i = 0 ; i < n ; ++i){
    char c = s[i];

    ll L1 = 0, L2 = 0;
    ll R1 = 0, R2 = 0;

    for(int j = 0 ; j < i; ++j){
      if(c == 'R'){
        if(s[j] == 'G') L1++;
        if(s[j] == 'B') L2++;
      }
      if(c == 'G'){
        if(s[j] == 'R') L1++;
        if(s[j] == 'B') L2++;
      }
      if(c == 'B'){
        if(s[j] == 'R') L1++;
        if(s[j] == 'G') L2++;
      }
    }

    for(int j = i + 1 ; j < n; ++j){
      if(c == 'R'){
        if(s[j] == 'G') R1++;
        if(s[j] == 'B') R2++;
      }
      if(c == 'G'){
        if(s[j] == 'R') R1++;
        if(s[j] == 'B') R2++;
      }
      if(c == 'B'){
        if(s[j] == 'R') R1++;
        if(s[j] == 'G') R2++;
      }
    }

    Ans += L1 * R2;
    Ans += L2 * R1;
  }

  for(int i = 0 ; i < n ; ++i){
    char c = s[i];

    for(int j = 0 ; j < i ; ++j){
      int len = i - j;
      if(n < i + len + 1) continue;
      if(s[j] != c && s[j] != s[i + len] && s[i + len] != c) Ans--;
    }
  }

  printf("%lld\n",Ans);

  return 0;
}


int main(){

  int t;
  if(TESTCASES) scanf("%d",&t); 
  else          t = 1;
  
  while(t--) Go();
} 

Measured memory_bytes: 3836