akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
#define rep(i,m,n) for(int i=m;i<n;i++)
#define co(n) cout<<n<<endl
#define all(n) (n).begin(),(n).end()
#define pb(n,m) n.push_back(m)
#define pi(n,m) n.insert(n.begin(),m);
#define ee(n) n.erase(n.end()-1)
#define eb(n) n.erase(n.begin())
using namespace std;
//using bint=boost::multiprecision::cpp_int;
typedef long long ll;
typedef unsigned long long ull;

int main(){
  int n,m=0; cin>>n;
  vector<int> a(n),x={};
  rep(i,0,n){
    cin>>a[i];
    m=max(m,a[i]);
  }
  vector<int> buc(m+1);
  rep(i,0,n) buc[a[i]]++;
  rep(i,0,buc.size()) if(buc[i]>0) pb(x,i);
  
  vector<bool> f(m+1,true);
  rep(i,0,x.size()){
    int c=2;
    while(x[i]*c<f.size()){
      f[x[i]*c]=false;
      c++;
    }
  }
  int ans=0;
  rep(i,0,x.size()){
    if(buc[x[i]]==1 && f[x[i]]==true) ans++;
  }
  co(ans);
  
  
  return 0;
}

Measured memory_bytes: 8884
/*                         _
                        _ooOoo_
                       o8888888o
                       88" . "88
                       (| -_- |)
                       O\  =  /O
                    ____/`---'\____
                  .'  \\|     |//  `.
                 /  \\|||  :  |||//  \
                /  _||||| -:- |||||_  \
                |   | \\\  -  /'| |   |
                | \_|  `\`---'//  |_/ |
                \  .-\__ `-. -'__/-.  /
              ___`. .'  /--.--\  `. .'___
           ."" '<  `.___\_<|>_/___.' _> \"".
          | | :  `- \`. ;`. _/; .'/ /  .' ; |
          \  \ `-.   \_\_`. _.'_/_/  -' _.' /
===========`-.`___`-.__\ \___  /__.-'_.'_.-'================

                  Please give me AC.
*/

#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <string>
#include <sstream>
#include <complex>
#include <bitset>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <chrono>
#include <random>

using namespace std;

using int64 = long long;
using uint64 = unsigned long long;
using vi = vector<int>;
using vl = vector<int64>;
using pii = pair<int, int>;
using pll = pair<int64, int64>;

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(v) (v).begin(), (v).end()
#define print(x) cout << (x) << '\n'
#define print2(x, y) cout << (x) << ' ' << (y) << '\n'
#define print3(x, y, z) cout << (x) << ' ' << (y) << ' ' << (z) << '\n'
#define printn(v) rep(i, (v).size() - 1) cout << (v)[i] << ' '; cout << (v)[n - 1] << '\n';
#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';}
// constant
const int INF = (1<<30) - 1;
const int64 INF64 = (1LL<<62) - 1;

template<typename T> T gcd(T a, T b) {
    if (a < b) return gcd(b, a);
    T r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

template<typename T> T lcm(const T a, const T b) {
    return a / gcd(a, b) * b;
}

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

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

// End of template.

int main() {
    cout << fixed << setprecision(15);
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    // cin.read(buf, sizeof buf); // 注意: ./a.out < in か pbp | ./a.out で入力すること

    int64 n, k;
    cin >> n >> k;
    if (n == k) {
        print(0);
        return 0;
    }

    if (n > k) {
        n = n % k;
    }

    if (k < 2 * n) n = abs(n - k);
    print(n);

    return 0;
}



Measured memory_bytes: 256
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int[] p = new int[N];
    for (int i = 0; i < N; i++) {
      p[i] = sc.nextInt();
    }
    Arrays.sort(p);
    int ans = 0;
    for (int i = 0; i < N - 1; i++) {
      ans += p[i];
    }
    ans += p[N - 1] / 2;
    System.out.println(ans); 
  }
}

Measured memory_bytes: 22996
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <deque>
using namespace std;

using VI = vector <int> ;
using VVI = vector <VI> ;

void group(VVI& adja, VVI& groups, VI& colors, int now, int color) {

    colors[now] = color;
    groups[color].push_back(now);

    for (int i = 0; i < adja[now].size(); ++i) {
        int nextv = adja[now][i];

        if (colors[nextv] == -1) {
            group(adja, groups, colors, nextv, (color+1)%2);
        }
    }

}

void color(VI& res, VI& set1, VI& set2) {
    int N = res.size();
    vector <int> cnt(3);
    vector <int> maxVal(3);
    cnt[0] = 3;
    cnt[1] = 1;
    cnt[2] = 2;

    // cout << "DEBUG " << set1.size() << " " << set2.size() << endl;

    maxVal[0] = N/3 * 3;
    maxVal[1] = (N-1)/3 * 3 + 1;
    maxVal[2] = (N-2)/3 * 3 + 2;
    // cout << "DEBUG VAL " << maxVal[0] << " " << maxVal[1] << " " << maxVal[2] << endl;

    if (set1.size() <= N/3) {
        for (int i = 0; i < set1.size(); ++i) {
            res[set1[i]] = cnt[0];
            cnt[0] += 3;
        }

        int idx = 0;
        for (int i = 0; i < 3; ++i) {
            while (cnt[i] <= maxVal[i]) {
                res[set2[idx++]] = cnt[i];
                cnt[i] += 3;
            }
        }
    } else {
        // cout << "CASE 2" << endl;
        vector <int> idx(2);
        // #mod 2 <= #mod 1, and |set1| <= |set2|

        while (cnt[2] <= maxVal[2]) {
            res[set1[idx[0]++]] = cnt[2];
            cnt[2] += 3;
        }

        while (cnt[1] <= maxVal[1]) {
            res[set2[idx[1]++]] = cnt[1];
            cnt[1] += 3;
        }

        while (idx[0] < set1.size()) {
            res[set1[idx[0]++]] = cnt[0];
            cnt[0] += 3;
        }

        while (idx[1] < set2.size()) {
            res[set2[idx[1]++]] = cnt[0];
            cnt[0] += 3;
        }
    }
}

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

    VVI adja(N);
    VVI groups(2);
    VI colors(N, -1);
    VI res(N);

    int root = 0;

    for (int i = 1; i < N; ++i) {
        int f;
        int t;
        scanf("%d %d", &f, &t);
        --f;
        --t;

        adja[f].push_back(t);
        adja[t].push_back(f);
    }

    group(adja, groups, colors, root, 0);

    if (groups[0].size() < groups[1].size()) {
        color(res, groups[0], groups[1]);
    } else {
        color(res, groups[1], groups[0]);
    }

    cout << res[0];
    for (int i = 1; i < res.size(); ++i) {
        cout << " " << res[i] ;
    }
    cout << endl;

    return 0;
}

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

double getE(int x) {
  return ((x+1.0)/2.0);
}

int main() {
  int K, N;
  cin >> N >> K;
  vector<int> p(N);
  rep(i, N) cin >> p[i];

  double ans = 0.0;
  rep(i, K) {
    ans += getE(p[i]);
  }

  double tmp = ans;
  for (int i = K; i < N; i++) {
    tmp -= getE(p[i-K]);
    tmp += getE(p[i]);

    ans = max(ans, tmp);
  }

  printf("%.10f\n", ans);


  return 0;
}


Measured memory_bytes: 1024
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <deque>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <ctime>
#include <iterator>
#include <bitset>
#include <numeric>
#include <list>
#include <iomanip>
using namespace std;
#define ll int64_t
const long MOD = 1e9 + 7;
const long LINF = 1e13;
const long LLINF = 1e18;
const long ALPHABET = 26;

template <class T>
void Swap(T& r, T& l) {
  T tmp = r;
  r = l;
  l = tmp;
}


int main() {

  long n,w,h,a,b,c,d;
  string s;

  cin >> a >> b >>c >> d;
  // vector<long> a(n);


  bool ans = false;

  if (a == 1 || b==1 || c==1|| d==1 ){
    if (a == 9 || b==9 || c==9|| d==9 ){
      if (a == 7 || b==7 || c==7|| d==7 ){
        if (a == 4 || b==4|| c==4|| d==4 )ans = true;
      }
    }
  }



  if (ans){
    cout << "YES" <<endl;
  }else{
    cout << "NO" <<endl;
  }
  // cout << "YES" <<endl;
  // cout << (ans)?"YES":"NO" ;


}




















Measured memory_bytes: 256
#include<bits/stdc++.h>
#define M 1000000007
#define pi ld(acos(-1.0))
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define Rep(i,n) for(int i=1;i<(int)(n);i++)
#define repp(i,a,b)  for(int i=a;i<=(int)(b);i++)
#define Repp(i,a,b)  for(int i=a;i>=(int)(b);i--)
#define cs ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define fi first
#define se second
#define ii pair<int,int>
#define bye(x) {cout<<x;return 0;}
typedef long long ll;
typedef long double ld;
using namespace std;
int main(){
    cs
    map<ll,ll> p;
    ll n,x,t=0;
    cin>>n;
    repp(i,1,n){
        cin>>x;
        t+=p[i-x];
        p[i+x]++;
    }
    cout<<t;
}

Measured memory_bytes: 26376
def cnt_div2(n):
    cnt=0
    while n%2==0:
        n//=2
        cnt+=1
    return cnt
def gcd(a,b):
    a,b = max(a,b),min(a,b)
    while b:
        a,b = b,a%b
    return a

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

N,M = map(int,input().split())
A = list(map(lambda x:int(x)//2,input().split()))

if(all(cnt_div2(A[0]) == cnt_div2(a) for a in A)):
    if N==1:
        lcm_A = A[0]
    else:
        lcm_A = lcm(A[0],A[1])
        for a in A[2:]:
            lcm_A = lcm(lcm_A,a)
    print(int((M/lcm_A+1)//2))
else:
    print(0)



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

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 998244353

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

ll mp[333][333];

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

    REP(i, 333)REP(j, 333)if(i != j)mp[i][j] = INF;

    ll n, m;cin >> n >> m;
    REP(i, m){
        ll a, b;cin >> a >> b;a--;b--;
        mp[a][b] = 0;
    }

    REP(k, 333)REP(i, 333)REP(j, 333)mp[i][j] = min(mp[i][j], mp[i][k] + mp[k][j]);

    REP(i, n){
        bool flag = false;
        REP(j, n){
            if(mp[i][j] == 0 && mp[j][i] == 0){
                if(flag)cout << " ";
                cout << (j + 1);
                flag = true;
            }
        }
        cout << endl;
    }

	return 0;
}



Measured memory_bytes: 4084
#include<bits/stdc++.h>
using namespace std;
int e[8]={2,10,3,9,4,8,6,12};
int o[8]={6,2,10,3,9,4,8,12};


int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n;
	cin>>n;
	if(n==3)	cout<<"2 5 63"<<endl;
	else{
		if(n&1){
			for(int i=0;i<n;i++)
				cout<<o[i&7]+(i>>3)*12<<' ';
		}
		else{
			for(int i=0;i<n;i++)
				cout<<e[i&7]+(i>>3)*12<<' ';
		}
	}
}


Measured memory_bytes: 384
while 1:
	s1=input().split('"')
	if s1[0]==".":
		break
	s2=input().split('"')
	
	cnt1=0
	cnt2=0
	flag=0
	
	if len(s1)!=len(s2):
		print("DIFFERENT")
	else:
		i=0
		while i<len(s1):
			if s1[i]==s2[i]:
				cnt1+=1
			elif i%2==0:
				print("DIFFERENT")
				flag=1
				break
			else:
				cnt2+=1
				if cnt2>1:
					print("DIFFERENT")
					break
			i+=1
				
		if flag==0 and cnt2==1:
			print("CLOSE")
		if cnt1==len(s1):
			print("IDENTICAL")


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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N,K;
    cin >> N >> K;
    ll A[200010];
    rep(i,0,N) cin >> A[i];
    vector<ll> pos[200010];
    rep(i,0,N) pos[A[i]].push_back(i);
    ll cur = 0;
    ll cnt = 0;
    while(1){
        if(cur == N) break;
        ll num = A[cur];
        ll p = upper_bound(pos[num].begin(), pos[num].end(), cur) - pos[num].begin();
        if(p == pos[num].size()){
            p = 0;
            cnt++;
        }
        // print(cur, pos[num][p]);
        cur = pos[num][p]+1;
    }
    cnt++;
    ll k = K % cnt;
    // print(k);
    cur = 0;
    cnt = 0;
    ll start = -1;
    while(1){
        if(cur == N) break;
        ll num = A[cur];
        ll p = upper_bound(pos[num].begin(), pos[num].end(), cur) - pos[num].begin();
        if(p == pos[num].size()){
            p = 0;
            cnt++;
            if(cnt == k){
                start = cur;
                break;
            }
        }
        // print(cur, pos[num][p]);
        cur = pos[num][p]+1;
    }
    if(start == -1){
        return 0;
    }
    // print(start);
    stack<ll> res;
    map<ll,ll> mp;
    rep(i,start,N){
        if(mp[A[i]] == 0){
            res.push(A[i]);
            mp[A[i]]++;
        }else{
            while(mp[A[i]] > 0){
                ll v1 = res.top();
                mp[v1]--;
                res.pop();
            }
        }
    }
    vector<ll> ans;
    while(not res.empty()){
        ans.push_back(res.top());
        res.pop();
    }
    reverse(ans.begin(), ans.end());
    printa(ans, ans.size());


}

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

namespace 水道料金
{
    class Program
    {
        static void Main(string[] args)
        {
            int a = int.Parse(Console.ReadLine());
            int b = int.Parse(Console.ReadLine());
            int c = int.Parse(Console.ReadLine());
            int d = int.Parse(Console.ReadLine());
            int p = int.Parse(Console.ReadLine());
            int ans = Math.Min(a * p, b + Math.Max(p - c, 0) * d);
            Console.WriteLine(ans);
        }
    }
}



Measured memory_bytes: 17880
#include "bits/stdc++.h"
using namespace std;
#define repi(i,a,b) for(int i=(a), i##_len=(b); i<i##_len; ++i)
#define rep(i,n) repi(i,0,n)
#define all(x) (x).begin(),(x).end()
#define vsort(v) sort((v).begin(), (v).end())
#define gsort(v) tsort(v); reverse((v).begin(), (v).end())
#define vrev(v) reverse((v).begin(), (v).end())
#define siz(v) ((int)(v).size())
#define ers(v, n) (v).erase((v).begin() + n)
#define vmin(v) *min_element(v.begin(), v.end())
#define vmax(v) *max_element(v.begin(), v.end())
#define cnt(v, x) count(all(v), x)
#define el "\n"
#define co(x) cout<<(x)<<el
#define coc(c, a, b) if(c)co((a));else co((b))
#define YES(c) coc(c,"YES", "NO")
#define Yes(c) coc(c,"Yes", "No")
#define yes(c) coc(c,"yes", "no")
#ifdef tqktmp_2
#define gc() getchar(); getchar()
#else
#define gc() 1
#endif
typedef long long lint;

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

template<class T>inline bool maxi(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>inline bool mini(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }

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

	lint n, a[100];
	cin >> n;
	rep(i, n) {
		cin >> a[i];
	}
	sort(&a[0], &a[n]);
	co(abs(a[n-1] - a[0]));
	gc();
}

Measured memory_bytes: 256
#include <iostream>
const int MAX_N = 100;
const int INF = 999999999;
const int WHITE = 0;
const int GRAY = 1;
const int BLACK = 2;
using namespace std;

int n;
int adj[MAX_N][MAX_N];
int color[MAX_N];
int d[MAX_N];

void dijkstra(int s) {
    for (int i = 0; i < n; i++) {
        color[i] = WHITE;
        d[i] = INF;
    }
    d[s] = 0;
    color[s] = GRAY;

    while (1) {
        int minv = INF;
        int u = -1;
        for (int i = 0; i < n; i++) {
            if (color[i] != BLACK && d[i] < minv) {
                minv = d[i];
                u = i;
            }
        }
        if (u == -1) break;

        color[u] = BLACK;
        for (int v = 0; v < n; v++) {
            if (color[v] != BLACK && adj[u][v] != INF) {
                if (d[v] > d[u] + adj[u][v]) {
                    d[v] = d[u] + adj[u][v];
                    color[v] = GRAY;
                }
            }
        }
    }
}

int main(void) {
    cin >> n;
    for (int i = 0; i < n; i++)
        for (int j = 0; j < n; j++) adj[i][j] = INF;

    for (int i = 0; i < n; i++) {
        int u, k; cin >> u >> k;
        for (int j = 0; j < k; j++) {
            int v, c; cin >> v >> c;
            adj[u][v] = c;
        }
    }

    dijkstra(0);

    for (int i = 0; i < n; i++) {
        cout << i << " " << d[i] << endl;
    }
    return 0;
}

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


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

  int n;
  cin >> n;
  int ac,wa,tle,re;
  ac = wa =tle = re = 0;

  rep(i,n){
    string s;
    cin >> s;
    if(s == "AC"){
      ac++;
    }
    else if(s=="WA"){
      wa++;
    }
    else if(s=="TLE"){
      tle++;
    }
    else if(s=="RE"){
      re++;
    }
  }
  cout << "AC x " << ac << endl;
  cout << "WA x " << wa << endl;
  cout << "TLE x " << tle << endl;
  cout << "RE x " << re << endl;

  
  return 0;
    

}


Measured memory_bytes: 3676
#include<iostream>
#include<stdio.h>

int f(int z){
	int m=0;
	for(int x=1;x<z;x++){
		for(int y=x;y<z;y++){
			if(x*x*x+y*y*y<=z*z*z && x*x*x+y*y*y>m)m=x*x*x+y*y*y;
		}
	}
	return z*z*z-m;
}
	
int main(){
	int z;
	while(1){
		scanf("%d",&z);
		if(z==0)break;
		printf("%d\n",f(z));
	}
	return 0;
}	

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

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

	for (int i = 1; i <= n; i++) {
		if (i % 3 == 0) cout << " " << i;
		else if (i % 10 == 3) cout << " " << i;
		else {
			for (int x = i / 10; x != 0; x /= 10) {
				if (x % 10 == 3) {
					cout << " " << i;
					break;
				}
		}
			
		}
	}
	cout << endl;

	return 0;
}



Measured memory_bytes: 3072
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
 int i,c,m,n,s;
 c=s=0;
 cin >> n >> m;
 int a[n];
 for(i=0;i<n;i++)
 {
  cin >> a[i];
  s+=a[i];
 }
 sort(a,a+n);
 for(i=(n-1);i>=0;i--)
 {
  if((4*m*a[i])>=s)
  c++;
 }
 if(c>=m)
 cout << "Yes";
 else
 cout << "No";
 return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
using namespace std;
long long gcd(long long a, long long b) {
	if (b == 0) return a;
	else return gcd(b, a % b);
}

int main() {
	long long A, B;
	cin >> A >> B;
	long long GCD = gcd(A, B);
	int ans = 1;
	for (long long i = 2, imax = (long long)sqrt(GCD) + 1; i <= imax; i++) {
		if (GCD % i == 0) ans++;
		while (GCD % i == 0) GCD /= i;
	}
	if (GCD > 1) ans++;
	cout << ans << endl;
}


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

int main(){
	char str[20];
	int i = 0;
	while(cin >> str[i]){
		i++;
	}
	for(int j = i-1; j >= 0; j--){
		cout << str[j];
	}
	cout << endl;
	return 0;
}

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

int keta(int a){
    if(a/10 == 0) return 1;
    return keta(a/10)+1;
}

int main(){
    int a,b;
    cin >> a >> b;
    int n = pow(10,keta(b))*a + b;
    if (sqrt(n) == int(sqrt(n))) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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

const int INF = 1e9+5;
int main() {
	// your code goes here
	int n;
	scanf("%d",&n);
	vector<int> h(n);
	for(int i = 0; i < n; i++){
	    scanf("%d",&h[i]);
	}
	vector<int> dp(n,INF);
	dp[0]=0;
	for(int i=0;i < n; i++){
	    for(int j : {i+1,i+2}){
	        if(j < n)
	            dp[j] = min(dp[j], dp[i] + abs(h[i]-h[j]));
	    }
	}
	cout<<dp[n-1]<<endl;
	return 0;
}


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

#if MYDEBUG
#include "lib/cp_debug.hpp"
#else
#define DBG(...) ;
#endif
#if __cplusplus <= 201402L
template <typename T>
T gcd(T a, T b) { return ((a % b == 0) ? b : gcd(b, a % b)); }
template <typename T>
T lcm(T a, T b) { return a / gcd(a, b) * b; }
#endif
using LL = long long;
constexpr LL LINF = 334ll << 53;
constexpr int INF = 15 << 26;
constexpr LL MOD = 1E9 + 7;

namespace Problem {
using namespace std;

class Solver {
 public:
  int n;
  Solver(LL n) : n(n){};

  void solve() {
    if(n==3 || n == 5 || n == 7 ) {
      cout<<"YES"<<endl;
    }else{
      cout<<"NO"<<endl;
    }
  }
};
class Solver2 {
 public:
  int n, m;
  Solver2(LL n, LL m) : n(n), m(m){};

  void solve() {
  }
};
}  // namespace Problem

int main() {
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(false);
  // std::cout << std::fixed << std::setprecision(12);
  long long n = 0;
  std::cin >> n;

  Problem::Solver sol(n);
  sol.solve();
  return 0;
}


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

using namespace std;

int main(void) {
    long long int N, A, B, C, D, E;
    cin >> N >> A >> B >> C >> D >> E;
    long long int minimun = min({A, B, C, D, E});
    cout << 4 + ((N+minimun-1) / minimun) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(void)
{
	int a, b, c, x, y;
	int price;

	cin >> a >> b >> c >> x >> y;

	if (x > y)
	{
		if (a > 2 * c)
		{
			price = c * 2 * x;
		}
		else if (a + b > 2 * c)
		{
			price = c * 2 * y + a * (x - y);
		}
		else
		{
			price = a * x + b * y;
		}
	}
	else
	{
		if (b > 2 * c)
		{
			price = 2 * y * c;
		}
		else if (a + b > 2 * c)
		{
			price = c * 2 * x + b * (y - x);
		}
		else
		{
			price = a * x + b * y;
		}
	}

	cout << price << endl;
 
	return 0;
}

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

using namespace std;

int main()
{
  int N, L[201];
  cin >> N;
  for(int i = 0; i < 2*N; i++) cin >> L[i];
  sort(L, L + 2*N, greater<int>());
  int ans = 0;
  for(int i = 0; i < 2*N; i+=2){
    ans += min(L[i], L[i+1]);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>

int top;
int Se[1000];

void push(int x){
  Se[top]=x;
  top++;
}

int pop(){
  top--;
  return Se[top];
 
}

int main(){
  int x;
  int n;
  char s[100];
  char c;
  int a,b,i;
  top=0;

  while(scanf("%s", s)!=EOF){
    if ( s[0] == '+' ){
      a=pop();
      b=pop();
      push(a + b);
    } else if ( s[0] == '-' ){
      b=pop();
      a=pop();
      push(a-b);
    } else if ( s[0] == '*' ){
      a=pop();
      b=pop();
      push(a*b);
    }else {
      x=atoi(s);
      push(x);
    }
  }

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

  return 0;
}
 



Measured memory_bytes: 2096
#include<iostream>
#include<vector>
using namespace std;
int main()
{
  // 整数の入力
  int N,T;
  cin >> N >> T;
  
  vector<int> cost;
  vector<int> time;
  int tmp_c,tmp_t;
  
  while(cin >> tmp_c >> tmp_t){           //行数指定がある場合はif文でも可
    cost.push_back(tmp_c);
    time.push_back(tmp_t);
  }
  
  int best_cost=10000;
  for(auto itr=time.begin();itr != time.end();++itr){
  	if(*itr <= T){
    	size_t index = std::distance( time.begin(), itr );
        best_cost = (cost[index] <= best_cost)? cost[index] : best_cost;
    }
  }
  
  if(best_cost == 10000){
    cout << "TLE" << endl;
  }else{
    cout << best_cost << endl;
  }
  
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
#include <stdio.h>
#include <ctype.h>
using namespace std;
#define pie 3.141592653589793238462643383279
#define mod 1000000007
#define INF 1145141919364364
#define int long long
#define all(vec) vec.begin(),vec.end()
#define P pair<int,int>
#define S second
#define F first

int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
bool prime(int x) {
	for (int i = 2; i <= sqrt(x); i++) {
		if (x%i == 0)return false;
	}
	return true;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2, mod) % mod;
}

int n, a[410];
int dp[410][410];
int cum[410];

signed main() {
	cin >> n;
	for (int i = 1; i <= n; i++)for (int j = i; j <= n; j++)dp[i][j] = INF;
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
		cum[i] = cum[i - 1] + a[i];
		dp[i][i] = 0;
	}
	for (int i = 1; i < n; i++) {
		for (int j = 1; j <= n - i; j++) {
			int mi = INF;
			for (int k = j + 1; k <= i + j; k++) {
				mi = min(mi, dp[j][k - 1] + dp[k][i + j]);
			}
			dp[j][i + j] = cum[i + j] - cum[j - 1] + mi;
		}
	}
	cout << dp[1][n] << endl;
}

Measured memory_bytes: 1536
n = int(input())
a = map(int, input().split())
colors = {}
for i in a:
    if i//400 <= 7:
        colors[i//400] = 1
    else:
        if 8 in colors:
            colors[8] += 1
        else:
            colors[8] = 1
if 8 in colors:
    if len(colors) == 1:
        print(1, sum(colors.values()))
    else:
        print(len(colors)-1, sum(colors.values()))
else:
    print(len(colors), len(colors))
        
    

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, from, to) for (int i = from; i < (to); ++i)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
using ll = long long;
using vin=vector<int>;
using vll=vector<ll>;
using P = pair<int, int>;
const int inf=1e9+7;
const ll INF=1e18;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

int main() {
  int n;
  cin>>n;
 map<string,int> ma;
  rep(i,0,n){
    string s;
    cin>>s;
    ma[s]++;
  }
  cout<<"AC x "<<ma["AC"]<<endl;
  cout<<"WA x "<<ma["WA"]<<endl;
  cout<<"TLE x "<<ma["TLE"]<<endl;
  cout<<"RE x "<<ma["RE"]<<endl;
}

Measured memory_bytes: 3628
#include<map>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;

typedef long long ll;
const int Maxn=1e5;

struct Trie {
	int son[2];
};
Trie t[Maxn+5];
int cnt=0;
void addstring(string tmp) {
	int rt=0;
	for(int i=0;i<(int)tmp.length();i++) {
		int ch=(int)tmp[i]-'0';
		if(!t[rt].son[ch])
			t[rt].son[ch]=++cnt;
		rt=t[rt].son[ch];
	}
}

int N;
ll L;
map<ll,int> g;
inline ll lowbit(ll x) {return x&(-x);}
void DFS(int rt,ll dep) {
	for(int i=0;i<2;i++) {
		if(t[rt].son[i]==0) {
			g[lowbit(L-dep+1)]^=1;
			continue;
		}
		DFS(t[rt].son[i],dep+1);
	}
}

int main() {
	#ifdef LOACL
	freopen("in.txt","r",stdin);
	freopen("out.txt","w",stdout);
	#endif
	scanf("%d %lld",&N,&L);
	for(int i=1;i<=N;i++) {
		string s;
		cin>>s;
		addstring(s);
	}
	DFS(0,1);
	for(map<ll,int>::iterator it=g.begin();it!=g.end();it++) {
		int t=it->second;
		if(t) {
			puts("Alice");
			return 0;
		}
	}
	puts("Bob");
	return 0;
}

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

int main() {
  int n;
  cin >> n;
  
  vector<int> price(n);
  
  for (int i = 0; i < n; i++) {
    cin >> price.at(i);
  }
  
  int sum = 0;
  
  sort(price.begin(), price.end());
  
  for (int i = 0; i < n-1; i++) {
    sum += price.at(i);
  }
  
  int discount = price.at(n-1) / 2;
  sum += discount;
  
  cout << sum << endl;
}

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


int main (){
    char b;
    cin>>b;
    if(b=='A'){
        cout<<'T'<<endl;
    }
    if(b=='T'){
        cout<<"A"<<endl;
    }
    if(b=='C'){
        cout<<"G"<<endl;
    }
    if(b=='G'){
        cout<<"C"<<endl;
    }
}

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

int main(){
    int n;
    cin >> n;
    vector<int> x(n);
    vector<int> y(n);
    for (int i = 0; i < n; i++) cin >> x[i] >> y[i];
    vector<pair<double, int>> order(n);
    for (int i = 0; i < n; i++){
        double p = atan2((double)y[i], (double)x[i]);
        order[i] = {p, i};
    }
    sort(order.begin(), order.end());
    double ans = 0;
    for (int i = 0; i < n; i++){
        long long tmp_x = 0;
        long long tmp_y = 0;
        for (int j = 0; j < n; j++){
            tmp_x += x[order[(i + j) % n].second];
            tmp_y += y[order[(i + j) % n].second];
            ans = max(ans, sqrt(tmp_x * tmp_x + tmp_y * tmp_y));
        }
        tmp_x = 0;
        tmp_y = 0;
        for (int j = 0; j < n; j++){
            tmp_x += x[order[(n + i - j) % n].second];
            tmp_y += y[order[(n + i - j) % n].second];
            ans = max(ans, sqrt(tmp_x * tmp_x + tmp_y * tmp_y));
        }
    }
    cout << setprecision(20) << ans << endl;
}

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

#define fi first
#define se second
#define pb push_back
#define ll long long

const int N = 5e4 + 7;

using namespace std;

int n , m;
ll used[N];
int cnt  , sum  , a , x , y;
int main(){
    ios_base::sync_with_stdio(false);
   ll a , b , c , d , e;
   cin >> a >> b >> c >> d >> e;
   cnt += a + b + c + d + e;
   cout << 15 - cnt;
}


Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = ll(1e12);
const ll mod = ll(1e9+7);
const double pi = acos(-1);
#define rep0(i,n) for(ll (i) = 0; (i) < (n); ++(i))
#define rrep0(i,n) for(ll (i) = (n) - 1; (i) >= 0; --(i))
#define rep1(i,n) for(ll (i) = 1; (i) <= (n); ++(i))
#define rrep1(i,n) for(ll (i) = (n); (i) >= 1; --(i))
#define nfor(i,a,b) for(ll (i) = (a); (i) < (b); ++(i))
#define pf(x) cout << (x) << endl
#define all(x) (x).begin(),(x).end()
#define yes pf("Yes")
#define no pf("No")
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,1,-1};

ll gcd(ll a,ll b){
    if(a < b)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 factorial(ll n){
    ll ans = 1;
    rep1(i, n){
        ans *= i;
        ans %= mod;
    }
    return ans;
}

ll power(ll a, ll b){
    ll ans = 1;
    a %= mod;
    while(b) {
        if(b & 1LL) ans = ans * a % mod;
        a = a * a % mod;
        b >>= 1;
    }
    return ans;
}

//modの値の確認をすること
int main(){
    ll n,ans = 0;
    cin >> n;
    vector<ll> s(n);
    rep0(i, n){
        ll a,b;
        cin >> a >> b;
        ans -= b;
        s[i] = a + b;
    }
    sort(all(s),greater<>());
    rep0(i, (n + 1) / 2)ans += s[i * 2];
    pf(ans);
    return 0;
}


Measured memory_bytes: 1024
n = input()
count = 0
first, second = n[:len(n)//2], n[(len(n)+1)//2:]
if first == reversed(second):
    print(count)
else:
    for x in range(len(first)):
        if first[x] != second[len(second)-x-1]:
            count += 1
    print(count)

Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {

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

		int firstSize = in.nextInt();
		int[] first = new int[firstSize];
		for (int i = 0; i < firstSize; i++) {
			first[i] = in.nextInt();
		}

		int secondSize = in.nextInt();
		int count = 0;
		for (int i = 0; i < secondSize; i++) {
			count += contains(in.nextInt(), first);
		}
		System.out.println(count);
	}

	/**
	 * returns 1 if the given element is in the given list and zero otherwise
	 */
	public static int contains(int ele, int[] nums) {
		for (Integer i : nums) {
			if (i == ele) {
				return 1;
			}
		}

		return 0;
	}

}


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

p = [int(i) for i in input().split()]
ans = 0
for i in range(1, n-1):
    if p[i-1] < p[i] and p[i] < p[i+1]:
        ans += 1
    elif p[i+1] < p[i] and p[i] < p[i-1]:
        ans += 1


print(ans)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define int long long
using namespace std;

signed main() {
    int N;
    cin >> N;

    vector<int> L(N);
    for (int& x : L) cin >> x;
    int ma = *max_element(L.begin(), L.end());
    cout << (ma < accumulate(L.begin(), L.end(), 0LL) - ma ? "Yes" : "No") << endl;

    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int countA=0,countB=0,countC=0,countD=0,countAr=0,countBr=0,countCr=0,countDr=0,A,B,C,D,Ar,Br,Cr,Dr;
  double r,l;


  while(scanf("%lf%lf",&l,&r)!=EOF){
  
   
    if(l>=1.1){ countA++; }
    if(l<1.1 && 0.6<=l){ countB++;  }
    if(l>=0.2 && 0.6>l){ countC++;  }
    if(0.2>l){ countD++; }

 if(r>=1.1){ countAr++; }
    if(r<1.1 && 0.6<=r){ countBr++;  }
    if(r>=0.2 && 0.6>r){ countCr++;  }
    if(0.2>r){ countDr++; }
    A=countA;
    B=countB;
    C=countC;
    D=countD;
    Ar=countAr;
    Br=countBr;
    Cr=countCr;
    Dr=countDr;
  }

  printf("%d %d\n",A,Ar);
 printf("%d %d\n",B,Br);
 printf("%d %d\n",C,Cr);
 printf("%d %d\n",D,Dr);
 return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b) - 1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)

#define PB push_back
#define INF INT_MAX/3
#define ALL(a) (a).begin(),(a).end()
#define CLR(a) memset(a,0,sizeof(a))

typedef long long int ll;

using namespace std;

int main(){
    while(true){
	int a,b,c,d,e;
	cin >> a;
	if(a == 0)break;
	cin >> b >> c >> d >> e;
	int m1 = min(e,b / c); 
	int m = b/d;
	REP(i,m1+1){
	    int tm,tm1;
	    tm = m;
	    tm1 = m1-i;
	    while((tm) * d + (tm1) * c > b){
		tm--;
		if(tm==0) {
		    break;
		}
	    }
	    if(tm+tm1 >= a) {
		m = tm;
		m1 = tm1;
		break;
	    }else if(i == m1){
		m = 0;
		m1 = 0;
	    }
	}
	if(m1 == 0) cout << "NA" << endl;
	else cout << m1 << " " << m << endl;
    }
    return 0;
}

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

int max(int a, int b){
    if(a>b){
        return a;
    }
    return b;
}

int main(){
    int n, a, b, c, temp;
    cin>>n;
    vector<vector<int>> happiness;
    vector<int> aVec, bVec, cVec;
    cin>>a>>b>>c;
    aVec.push_back(a);
    bVec.push_back(b);
    cVec.push_back(c);
    happiness.push_back(aVec);
    happiness.push_back(bVec);
    happiness.push_back(cVec);
    for(int i=1;i<n;i++){
        for(int j=0;j<3;j++){
            cin>>a;
            temp = max(happiness[(j+1)%3][i-1], happiness[(j+2)%3][i-1]);
            happiness[j].push_back(temp+a);
        }
    }
    cout<<max(max(happiness[0][n-1],happiness[1][n-1]), happiness[2][n-1])<<endl;
}

Measured memory_bytes: 4580
package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Split(bufio.ScanWords)
	n := nextInt()
	set := nextSet(n)
	fmt.Println(len(set))
}

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}

func nextSet(n int) map[string]struct{} {
	ret := make(map[string]struct{})
	for i := 0; i < n; i++ {
		ret[next()] = struct{}{}
	}
	return ret
}


Measured memory_bytes: 14460
#include <stdio.h>
#include <string.h>

int main(void){

  char a[100];
  char b[100];
  int i, j, k;
  i = j = k = 0;

  int c;
  char *p;

  while(( c = getchar() ) != '\n'){
    a[i] = c; i++;
  }

  while(( c = getchar() ) != '\n'){
    b[j] = c; j++;
  }

  char haystack[i+j];
  char needle[j+1];

  for(k = 0; k < i; k++){
    haystack[k] = a[k];
  }
  for(k = i; k < i+j-1; k++){
    haystack[k] = a[k-i];
  }
    haystack[i+j-1] = '\0';

  for(k = 0; k < j; k++){
    needle[k] = b[k];
  }

  needle[j] = '\0';

  if ((p = strstr (haystack, needle)) != NULL){
      printf("Yes\n");
  } else {
      printf("No\n");
  }

  return 0;
}

Measured memory_bytes: 524
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <queue>
#include <cmath>

std::vector <std::vector<int>> edges;
std::vector <int> ans, d;
int n, m;

struct cmp {
    bool operator () (int x, int y) const {
      return d[x] > d[y];
    }
};

void dijkstra () {
  for (int i = 0; i < n; ++i) d[i] = 1e9, ans[i] = -1;
  d[0] = 0;
  std::priority_queue <int,std::vector<int>,cmp> q;
  q.push (0);
  while (!q.empty()) {
    int u = q.top(); q.pop();
    for (int v : edges[u]) {
      if (d[v] > d[u] + 1) {
        d[v] = d[u] + 1;
        ans[v] = u;
        q.push (v);
      }
    }
  }
}

int main () {
  std::cin >> n >> m;
  edges.resize (n);
  ans.resize (n);
  d.resize (n);
  while (m--) {
    int u, v; std::cin >> u >> v;
    --u, --v;
    edges[u].emplace_back(v);
    edges[v].emplace_back(u);
  }
  dijkstra ();
  bool flag = true;
  for (int i = 1; i < n; ++i)
    if (ans[i] == -1) flag = false;
  if (!flag) {
    std::cout << "No" << "\n";
    return 0;
  }
  std::cout << "Yes\n";
  for (int i = 1; i < n; ++i)
    std::cout << ans[i]+1 << "\n";
  return 0;
}

Measured memory_bytes: 10936
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <queue>
using namespace std;
using ll = long long;
#define INF 1LL << 59
//西暦⇒時代の歴

ll a[201000];
ll N;
int main()
{
    cin >> N;
    ll l = 0LL;
    ll r = 0;
    for (int i = 0; i < N; ++i)
    {
        cin >> a[i];
    }
    for (int i = 0; i < N; ++i)
        r += a[i];

    ll minV = INF;

    for (int i = 0; i < N - 1; ++i)
    {
        l += a[i];
        r -= a[i];
        minV = min(minV, abs(l - r));
    }
    cout << minV << endl;
    return 0;
}

Measured memory_bytes: 1792
#include<stdio.h>
int main(){
  int a,b;
  int i;
  int s=0;
  scanf("%d",&a);
  if(a==1){
    printf("1");
  }else{
    for(i=0;i<46300;i++){
       b=(int)(i*1.08);
          if(b==a){
            printf("%d",i);
            s=1;
            
          }
      
    }
    if(s==0){
    printf(":(");
    }
  }
  return 0;
}
  


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  int n;
  cin >> n;
  vi a(n);
  rep(i, n) cin >> a[i];
  int ansa = 1;
  int ansb = 1;
  rep(i, n) {
    ansa *= 3;
    if(a[i] % 2 == 0) ansb *= 2;
  }
  cout << ansa - ansb << endl;
}

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

int main(){
    std::string S;
    std::cin >> S;
    if(S[0] == 'S') std::cout << "Cloudy" << std::endl;
    else if(S[0] == 'C') std::cout << "Rainy" << std::endl;
    else std::cout << "Sunny" << std::endl;    
    return 0;
}


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

int main(){
  int x,n;cin >> x >> n;
  map<int,int> m;
  int p[n];rep(i,n){
    cin >> p[i];
    m[p[i]] = 1;
  }
  int mini = 100000000;
  for(int i=-10;i<=110;++i){
    if(abs(x-i) < abs(x-mini) && m[i] == 0){
      mini = i;
    }
  }
  cout << mini << endl;
  return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define leading zero str.erase(0, min(str.find_first_not_of('0'), str.size()-1));
using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
string text="abcdefghijklmnopqrstuvwxyz";
const int maxn=1e6+7;
//        .--------------.
//        | Try First One|
//        '--------------'
//                |     .--------------.
//                |     |              |
//                V     V              |
//              .--------------.       |
//              |      AC.     |<---.  |
//              '--------------'    |  |
//              (True)|  |(False)   |  |
//           .--------'  |          |  |
//           |           V          |  |
//           |  .--------------.    |  |
//           |  |   Try Again  |----'  |
//           |  '--------------'       |
//           |                         |
//           |  .--------------.       |
//           '->| Try Next One |-------'
//              '--------------'
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    vector<ll>v,vv;
    ll n,m,k;
    cin>>n>>m>>k;
    ll nn=__gcd(n,m);
    for(ll i=1;i*i<=nn;i++){
        if(nn%i==0){
            v.push_back(i);
            if(i*i!=nn)v.push_back(nn/i);
        }
    }
    sort(v.begin(),v.end());
    cout<<v[v.size()-k]<<endl;
    //for(auto x: v)cout<<x<<" ";
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
#include <iostream>
#include <functional>
#include <vector>
#include <stdio.h>
#include <queue>
#include <string.h>
#include <math.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<=n;i++)
#define rep1(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=a;i>=n;i--)
#define per1(i,a,n) for (int i=a;i>n;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define endl "\n"
#define pi 3.14159265358979323846264338327950288419716939937510
#define IOS cin.sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define int long long
#pragma comment(linker, "/STACK:1024000000,1024000000")
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll mod=1000000007;
const int inf=0x3f3f3f3f;
const ll INF=0x3f3f3f3f3f3f3f3f;
ll qpow(ll a,ll b){ll s=1;while(b>0){if(b%2==1){s=s*a;}a=a*a;b=b>>1;}return s;}
ll qpowmod(ll a, ll b, ll c){ll res, t;res=1;t=a%c;while(b){if(b & 1){res=res*t%c;}t=t*t%c;b>>=1;}return res;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
inline long long read(){long long k=0,f=1;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9'){k=k*10+ch-'0';ch=getchar();}return k*f;}
inline void write(long long x){if(x<0)x=-x,putchar('-');if(x>9)write(x/10);putchar(x%10+'0');}
// head
const int maxn=2e5+5;
ll n,a[maxn],len,ans,cnt;
string s;
signed main()
{
    //IOS;
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
    }
    sort(a+1,a+1+n);
    for(int i=1; i<=n; i++)
    {
        for(int j=i+1; j<=n; j++)
        {
            for(int k=j+1; k<=n; k++)
            {
                if(a[i]!=a[j]&&a[j]!=a[k]&&a[i]!=a[k]&&a[i]+a[j]>a[k])
                {
                    //cout<<i<<' '<<j<<' '<<k<<endl;
                    ans++;
                }
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}
/*

*/


Measured memory_bytes: 3636
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;

const ll INF = 1000000000000000000LL;
const int MAX_N = 12;

int n, m;
ll dp[1 << MAX_N];

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

	cin >> n >> m;
	dp[0] = 0;
	for (int i = 1; i < (1 << n); i++)
		dp[i] = INF;

	for (int i = 0; i < m; i++)
	{
		int mask = 0;
		ll cost; cin >> cost;
		int cnt; cin >> cnt;
		while (cnt--)
		{
			int c; cin >> c; c--;
			mask |= (1 << c);
		}
		dp[mask] = min(dp[mask], cost);
	}

	for (int i = 1; i < (1 << n); i++)
	{
		if (dp[i] == INF)
			continue;
		for (int mask = i;; mask = (mask - 1) & i)
		{
			dp[mask] = min(dp[mask], dp[i]);
			if (mask == 0)
				break;
		}
	}

	for (int i = 0; i < (1 << n); i++)
	{
		for (int mask = i;; mask = (mask - 1) & i)
		{
			dp[i] = min(dp[i], dp[mask] + dp[i & (~mask)]);
			if (mask == 0)
				break;
		}
	}

	cout << (dp[(1 << n) - 1] == INF ? -1LL : dp[(1 << n) - 1]) << endl;

	return 0;
}

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

#define check cout<<"-------"<<endl
#define debug(x) cout<<x<<endl
#define aaa cout<<endl;print();cout<<endl

#define N 8

bool col[N];
bool row[N];
bool dpos[2*N];
bool dneg[2*N];

char a[N][N];

void putq(int i);
void print();

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    for(int i = 0; i < N; i++) {
        for(int j = 0; j < N; j++) {
            a[i][j] = '.';
        }
    }
    
    int n;
    cin>>n;
    int x, y;
    for(int i = 0; i < n; i++) {
        cin>>x>>y;
        a[x][y] = 'Q';
        row[x] = true;
        col[y] = true;
        dpos[x+y] = true;
        dneg[x-y+(N-1)] = true;
    }
    
    putq(0);
    
//    print();
    
    return 0;
}

void putq(int i) {
    if(i == N) {
        print();
        return;
    }

    for(int j = 0; j < N; j++) {
        
        if(a[i][j] == 'Q') putq(i+1);
        if(row[i] == true || col[j] == true || dpos[i+j] == true || dneg[i-j+(N-1)] == true) continue;
        a[i][j] = 'Q';
        row[i] = col[j] = dpos[i+j] = dneg[i-j+(N-1)] = true;
        
        putq(i+1);
        a[i][j] = '.';
        row[i] = col[j] = dpos[i+j] = dneg[i-j+(N-1)] = false;
    }
}

void print() {
    int i, j;
    for(i = 0; i < N; i++) {
        for(j = 0; j < N-1; j++) {
            cout<<a[i][j];
        }
        cout<<a[i][j]<<endl;
    }
    return;
}



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



int main(){

    int n,q;
    cin>>n>>q;
    string s;
    cin>>s;
    vector<int> ans(n+1);
    for(int i=1;i<n;i++){
        if(s[i-1]=='A' && s[i]=='C'){
            ans[i]=ans[i-1]+1;
        }
        else{
            ans[i]=ans[i-1];
        }
    }
    ans[n]=ans[n-1];
    while(q--){
        int l,r;
        cin>>l>>r;
        cout<<ans[r-1]-ans[l-1]<<endl;
    }


return 0;
}


Measured memory_bytes: 3848
n, k = map(int, input().split())
have = [False] * 101

for i in range(k):
    d = map(int, input())
    ds = map(int, input().split())
    for j in ds:
        have[j-1] = True

count = 0
for i in range(n):
    if not have[i]:
        count += 1

print(count)


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

int main() {
  ll sum = 0;
  int n;
  cin >> n;
  vector<ll> a(n);
  vector<ll> b(n);
  rep(i, n){
    cin >> a[i];
    sum = sum ^ a[i];
  }
  rep(i, n){
    ll tmp = sum;
    b[i] = tmp ^ a[i];
  }
  rep(i, n){
    cout << b[i] << (i == n - 1 ? "\n" : " ");
  }
}

Measured memory_bytes: 6392
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define INF (1LL<<50)
#define MOD 1000000007

int main(){
    ll A,B,K;
    ll ansA,ansB;
    cin >> A >> B >> K;
    if(A>=K){
        ansA = A -K;
        ansB = B;
    }else{
        if(B>=(K-A)){
            ansA = 0;
            ansB = B - K + A;
        }else{
            ansA = 0;
            ansB = 0;
        }
    }
    cout << ansA << " " << ansB << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define LL __int128
#define ll long long
#define sc(a) scanf("%d", &a)
#define sc2(a, b) scanf("%d%d", &a, &b)
#define sc3(a, b, c) scanf("%d%d%d", &a, &b, &c)
#define scl(a) scanf("%lld", &a)
#define scl2(a, b) scanf("%lld%lld", &a, &b)
#define ss(a) scanf("%s", a)
#define mem(a, b) memset(a, b, sizeof(a))
#define ios ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define PII pair<int, int>
using namespace std;
const int maxn = 1e5 + 5;
const int mod = 1e9 + 7;
int main() {
	ll a, b, c, d;
	cin >> a >> b >> c >> d;
	ll ans = max(a * c, a * d);
	ans = max(ans, b * c);
	ans = max(ans, b * d);
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3608