akhauriyash/Code-Regression huggingface dataset:
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;

public class Main {

    public static void main(String[] args) {
        new Main().run();
    }

    FastScanner sc;

    void run() {
        sc = new FastScanner();
        int N = sc.nextInt();
        int[] rabitts = new int[N];
        boolean[] decided = new boolean[N];
        for (int i = 0; i < N; i++) {
            rabitts[i] = sc.nextInt() - 1;
        }
        int cnt = 0;
        for (int i = 0; i < N; i++) {
            if (decided[i]) {
                continue;
            }
            int like = rabitts[i];
            if (rabitts[like] == i) {
                decided[like] = true;
                cnt++;
            }
        }

        System.out.println(cnt);
    }

}

class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;

    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        } else {
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }

    private int readByte() {
        if (hasNextByte())
            return buffer[ptr++];
        else
            return -1;
    }

    private static boolean isPrintableChar(int c) {
        return 33 <= c && c <= 126;
    }

    public boolean hasNext() {
        while (hasNextByte() && !isPrintableChar(buffer[ptr]))
            ptr++;
        return hasNextByte();
    }

    public String next() {
        if (!hasNext())
            throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while (isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    public long nextLong() {
        if (!hasNext())
            throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while (true) {
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            } else if (b == -1 || !isPrintableChar(b)) {
                return minus ? -n : n;
            } else {
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }

    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
            throw new NumberFormatException();
        return (int) nl;
    }

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

Measured memory_bytes: 9996
#include<bits/stdc++.h>
using namespace std;
//define
typedef pair<int,int>pi;
#define int long long
#define elif else if
#define rep(x,y) for(int i=x;i<y;i++)
#define REP(x,y) for(int j=x;j<y;j++)
#define Rep(x,y) for(int k=x;k<y;k++)
#define all(x) x.begin(),x.end()
#define pb push_back
#define vint vector<int>
#define vvint vector<vector<int>>
#define vtr vector<string>
#define vvtr vector<vector<string>>
#define vhar vector<char>
#define vvhar vector<vector<char>>
#define mod 100000007
#define elif else if
#define str string
int sum(int a){
  int b=0;
  while(a){
      b+=a%10;
      a/=10;
  }
  return b;
}
signed main(){
  int N,M,O,P=0,c=0,co=0,cou=0;
  double D,Do;
  char C,Ca;
  str S,T;
  cin>>N>>M>>O;
  while(1){
    c+=max(N,M);
    co++;
    if(O<=c){
      cout<<co<<endl;
      break;
    }
  }
}


Measured memory_bytes: 256
import numpy as np
n=int(input())
a=list(map(int,input().split()))
a=np.array(a)
all=np.sum(a)
c=int(all/n+0.5)
d=int(all/n)
ans1=a-c
ans1=ans1**2
ans2=a-d
ans2=ans2**2
ans1=np.sum(ans1)
ans2=np.sum(ans2)
if ans1<=ans2:
    print(ans1)
else:
    print(ans2)

Measured memory_bytes: 13032
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
using namespace std;

//
#define int long long
#define pb(x) push_back(x)
#define m0(x) memset((x), 0, sizeof(x))
#define mm(x) memset((x), -1, sizeof(x))

//container
#define ALL(x) (x).begin(), (x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define EACH(i, c) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
#define PERM(c) \
  sort(ALL(c)); \
  for (bool c##p = 1; c##p; c##p = next_permutation(ALL(c)))

// debug
#define GET_VAR_NAME(variable) #variable
#define test(x) cout << GET_VAR_NAME(x) << " = " << x << endl;

// bit_macro
#define bit(n) (1LL << (n))
#define bitset(a, b) (a) |= (1 << (b))
#define bitunset(a, b) (a) &= ~(1 << (b))
#define bitcheck(a, b) ((((a) >> (b)) & 1) == 1)
#define bitcount(a) __builtin_popcountll((a))

//typedef
typedef long long lint;
typedef unsigned long long ull;
typedef complex<long double> Complex;
typedef pair<int, int> P;
typedef tuple<int, int, int> TP;
typedef vector<int> vec;
typedef vector<vec> mat;

//constant
const int INF = (int)1e18;
const int MOD = (int)1e9 + 7;
const double PI = (double)acos(-1);
const double EPS = (double)1e-10;
const int dx[] = {-1, 0, 0, 1, 0, -1, -1, 1, 1};
const int dy[] = {0, -1, 1, 0, 0, 1, -1, 1, -1};

//
template <typename T>
void chmax(T &a, T b) { a = max(a, b); }
template <typename T>
void chmin(T &a, T b) { a = min(a, b); }
//
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T>
inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}

//
struct Accelerate_Cin {
  Accelerate_Cin() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(20);
  };
};

signed main() {
  string s;
  cin >> s;
  int w;
  cin >> w;

  for (int i = 0; i < s.size(); i++) {
    if (i % w == 0) {
      cout << s[i];
    }
  }

  return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS

#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <list>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_set>
#include <unordered_map>
#include <array>
#include <cassert>
#include <bitset>
#include <cstdint>
using namespace std;
using LL = long long;

int main() {
  int A,B;
  cin>>A>>B;
  cout<<(int)ceil((B-1.0)/(A-1.0))<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define x first
#define y second
#define pii pair<int , int>
#define mp make_pair
#define pb push_back
#define sz(a) (int)(a.size())
const int INF = 1000 * 1000 * 1000 + 7;
const ll LINF = INF * (ll)INF;
int main()
{
	int n;
	cin >> n;
	set<int> s;
	for(int i = 0; i < n; i++)
	{
		int x;
		cin >> x;
		s.insert(x);
	}
	cout << (sz(s) == n ? "YES" : "NO");
}


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

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

  vector<long long> w(n);
  vector<long long> v(n);
  for (int i = 0; i < n; ++i) {
    cin >> w[i] >> v[i];
  }

  // n items, knapsack capacity is at most weight
  // w_i: weight of item i
  // v_i: value of item i

  // dp[i] -> value of knapsack with weight i
  vector<long long> dp(weight + 1);
  for (int item = 0; item < n; ++item) {
    for (int already = weight - w[item]; already >= 0; --already) {
      dp[already + w[item]] = max(dp[already + w[item]], dp[already] + v[item]);
    }
  }
  long long ret = INT_MIN;
  for (long long el : dp) {
    ret = max(ret, el);
  }
  cout << ret << endl;

  return 0;
}


Measured memory_bytes: 3956
/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
			　　　　　　　　　　(¸.·´ (¸.·'* ☆
					*/

#include <iostream>
#include <vector>
#include <array>
#include <queue>
#include <stack>
#include <map>
#include <string>
#include <climits>
#include <tuple>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cmath>
#include <algorithm>
#include <memory>
#include <iomanip>

#define rep(i, n) for(Int (i) = 0; (i) < (n); ++(i))
using Int = int64_t;


void calc() {

	Int N, M; std::cin >> N >> M;
	Int ans = 0;
	if (N >= 2)ans += (N * (N - 1) / 2);
	if (M >= 2)ans += (M * (M - 1) / 2);
	std::cout << ans << "\n";
}


int main() {

	calc();

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<string>
#include<algorithm>
#include<vector>

using namespace std;

vector<string> CubeInfo[30];
string StrTmp[6];
int N;
bool SameFlag[30];
//top front right left back bottom
int RotateBase[24][6] = {
	{ 0,1,2,3,4,5 },{},{},{},
	{ 1,5,2,3,0,4 },{},{},{},
	{ 2,1,5,0,4,3 },{},{},{},
	{ 3,1,0,5,4,2 },{},{},{},
	{ 4,0,2,3,5,1 },{},{},{},
	{ 5,4,2,3,1,0 },{},{},{},
};


void fullRotateBase() {
	int tmp[6], num;

	for (int i = 0; i < 21; i += 4) {
		for (int j = 0; j < 6; ++j) {
			tmp[j] = RotateBase[i][j];
		}
		for (int k = 1; k < 4; ++k) {
			num = tmp[1];
			tmp[1] = tmp[3];
			tmp[3] = tmp[4];
			tmp[4] = tmp[2];
			tmp[2] = num;
			for (int j = 0; j < 6; ++j) {
				RotateBase[i + k][j] = tmp[j];
			}
		}
	}
	/*for (int i = 0; i < 24; ++i) {
		for (int j = 0; j < 6; ++j) {
			cout << RotateBase[i][j] + 1 << " ";
		}
		cout << endl;
	}
	cout << endl;*/
}

bool judgeSame(int i, int j) {
	string tmp[6];
	bool flag;

	for (int id = 0; id < 24; ++id) {
		for (int k = 0; k < 6; ++k) {
			tmp[k] = CubeInfo[j][RotateBase[id][k]];
		}
		for (int k = 0; k < 6; ++k) {
			if (CubeInfo[i][k] != tmp[k]) {
				flag = false;
				break;
			}
			flag = true;
		}
		if (flag) {
			return true;
		}
	}
	return false;
}

int solve() {
	int cnt;

	cnt = 0;
	for (int i = 0; i < N; ++i) {
		if (SameFlag[i]) {
			continue;
		}
		for (int j = i + 1; j < N; ++j) {
			if (judgeSame(i, j)) {
				SameFlag[j] = true;
				++cnt;
			}
		}
	}
	return cnt;
}

int main() {
	string str;

	fullRotateBase();
	while (cin >> N, N) {
		memset(SameFlag, false, sizeof(SameFlag));
		for (int i = 0; i < N; ++i) {
			CubeInfo[i].clear();
			for (int j = 0; j < 6; ++j) {
				cin >> str;
				CubeInfo[i].push_back(str);
			}
		}
		cout << solve() << endl;
	}

	return 0;
}


Measured memory_bytes: 3016
#include<iostream>
#include<cstdio>
#include <cstring>
using namespace std;
const int MaxN = 300;
const long long mod = 998244353;

/*
   n个数字
   要求全部相加以后只留下三个数字
   使得三个数字为3角形的三条边
   问方案数
   x  B >= sum/2
   前i个数 B的总和为 j有几种方案

//
a[i]这个数 只能加在R、G、B中
dp[i][j] = dp[i-1][j - a[i]] + dp[i-1][j] * 2LL;
 */

long long dp[MaxN + 5][MaxN * MaxN + 5];
int a[MaxN + 5];

int main(){
	//	最大的那条边 < sum/2
	long long ans = 1, res = 0;
	int n, sum = 0;
	scanf("%d", &n);
	for(int i = 1;i <= n;i++){
		scanf("%d",&a[i]);
		sum += a[i];
		ans = ans * 3LL % mod;
	}
	for(int i = 1;i <= sum;i++) dp[0][i] = 0;
	dp[0][0] = 1;
	for(int i = 1;i <= n;i++){
		for(int j = 0;j <= sum;j++){
			dp[i][j] = dp[i - 1][j] * 2LL % mod;
			if(j >= a[i]) dp[i][j] = (dp[i][j] + dp[i - 1][j - a[i]]) % mod;
		}
	}
	for(int i = (sum + 1) / 2;i <= sum;i++) res = (res + dp[n][i]) % mod;
	// 	res = B总和大于等于 sum/2的方案数
	if(sum % 2 == 0){
		for(int i = 1;i <= n;i++){
			for(int j = 0;j <= sum;j++){
				dp[i][j] = dp[i - 1][j] % mod;
				if(j >= a[i]) dp[i][j] = (dp[i][j] + dp[i - 1][j - a[i]]) % mod;
			}
		}
		res = (res - dp[n][sum/2LL] + mod % mod);
	}
	printf("%lld\n",(ans - res * 3LL % mod + mod)  % mod);
	return 0;
}

Measured memory_bytes: 213248
#pragma GCC optimize ("O3")

#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include <prettyprint.hpp>
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

template <typename T>
void print(T x) {
    cout << x << endl;
}

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REVFOR(i, m, n) for (int i = (n - 1); i >= (m); --i)
#define REP(i, n) FOR(i, 0, n)
#define REVREP(i, n) REVFOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;
ll MOD = 1e9+7;

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    
    int N, X;
    cin >> N >> X;

    vi A(N);
    REP(i, N) cin >> A[i];

    sort(ALL(A));

    X -= accumulate(ALL(A), 0LL);

    print(A.size() + X / A[0]);
    
}


Measured memory_bytes: 3644
#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;++i)
#include<string>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<int, int>P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//max=({});
//条件式が真ならwhileの中身を回し続ける
//printf("%d\n", ans);

//pairの入力
//vector<pair<ll, ll>>work(n);
//rep(i, n) {
//	ll a, b;
//	cin >> a >> b;
//	work[i] = make_pair(a, b);
//for(auto p:mp)(mapの探索)
//printf("%.10f\n",なんちゃら)

int g[15][15];
const int INF = 1001001001;
const int dx[4] = { -1,0,1,0 };
const int dy[4] = { 0,-1,0,1 };

//最大公約数
ll gcd(ll x, ll y) {
	return y ? gcd(y, x % y) : x;
}

ll lcm(ll x, ll y) {
	if (x == 0 || y == 0)return 0;
	return (x / gcd(x, y) * y);
}

//素因数分解
vector<pair<ll, int>>factorize(ll n) {
	vector<pair<ll, int>>res;
	for (ll i = 2;i * i <= n;++i) {
		if (n % i)continue;
		res.emplace_back(i, 0);
		while (n % i == 0) {
			n /= i;
			res.back().second++;
		}
	}
	if (n != 1)res.emplace_back(n, 1);
	return res;
}

vector<ll>relation[20], money(20, 1);

int main() {
	int  a, b;
	cin >> a >> b;
	int ans = a * b;
	if (ans % 2 == 0)puts("Even");
	else {
		puts("Odd");
	}
	return 0;
}

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

using namespace std;

typedef long long ll;

ll ans=0,n;

void dfs(ll x,ll a,ll b,ll c){
	if(x>n)
		return;
	if(a&&b&&c)
		ans++;
	dfs(x*10+3,a+1,b,c);
	dfs(x*10+5,a,b+1,c);
	dfs(x*10+7,a,b,c+1);
}

int main()
{
	cin>>n;
	dfs(0,0,0,0);
	cout<<ans;
	return 0;
}

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

using namespace std;
using ll=int64_t;
using pii = pair<int, int>;
using pli = pair<ll, int>;
using mii = map<int, int>;
using vi=vector<int>;
using vii=vector<vi>;
using vl=vector<ll>;
using vll=vector<vl>;
using tpi=tuple<int, int, int>;

using vqi=vector<queue<int>>;

using vqi=vector<queue<int>>;
using bs=bitset<60>;
using vbi=vector<bs>;
constexpr ll MOD = 1e9 + 7;

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

    if (N % 2 == 1) {
        cout << 0 << endl;
        return 0;
    }

    ll a = N / 2;

    ll ans = 0;
    ll b = a / 5;
    ans += b;

    while (b >= 5) {
        b = b / 5;
        ans += b;
    }

    cout << ans << endl;
    return 0;
}


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

// long powm(long x, long a, long m)
// {
//     long s = 1;
//     long p = x % m;
//     for (int i = 0; i < 32; i++)
//     {
//         if((a >> i) & 1){
//             s = (s * p) % m;
//         }
//         p = p*p % m;
//     }
//     return s;
// }

// long invm(long x, long m)
// {
//     return powm(x, m-2, m);
// }

void Main()
{
    const int mod = 1000000007;
    int n, k;
    cin >> n >> k;

    long sum = 1;
    if(n == k){
        int sign = 1;
        for (int i = 0; i < n; i++)
        {
            long tmp;
            cin >> tmp;
            sum = sum * abs(tmp) % mod;  
            if(tmp < 0) sign *= -1;   
        }
        if(sign < 0) sum = mod - sum;
        cout << sum << endl;
        return;
    }
    
    vector<long> sa, sb;
    vector<long> ma, mb;
    for (int i = 0; i < n; i++)
    {
        int tmp;
        cin >> tmp;
        if(tmp >= 0) sa.push_back(tmp);
        else sb.push_back(-tmp);
    }

    if(sa.size() == n){
        sort(sa.rbegin(), sa.rend());
        for (int i = 0; i < k; i++)
        {
            sum = sum * sa[i] % mod;
        }
        cout << sum << endl;
        return;
    }else if(sb.size() == n){
        if(k % 2 == 1){
            sort(sb.begin(), sb.end());
            for (int i = 0; i < k; i++)
            {
                sum = sum * abs(sb[i]) % mod;
            }
            sum = -sum + mod;
            cout << sum << endl;
            return;
        }else{
            sort(sb.rbegin(), sb.rend());
            for (int i = 0; i < k; i++)
            {
                sum = sum * abs(sb[i]) % mod;
            }
            cout << sum << endl;
            return;
        }
    }

    sort(sa.rbegin(), sa.rend());
    sort(sb.rbegin(), sb.rend());

    // ma.resize(sa.size()+1, 1);
    // for (int i = 0; i < sa.size(); i++)
    // {
    //     ma[i+1] = ma[i] * sa[i] % mod;
    // }
    // mb.resize(sb.size()+1, 1);
    // for (int i = 0; i < sb.size(); i++)
    // {
    //     mb[i+1] = mb[i] * sb[i] % mod;
    // }

    int na = k % 2;
    int nb = 0;
    long ans = 1;
    if(na == 1) ans = sa[0];
    for (int i = 0; i < k/2; i++)
    {
        if(na+2 > sa.size()){
            ans = ans * sb[nb] % mod * sb[nb+1] % mod;
            nb += 2;
        }else if(nb+2 > sb.size()){ 
            ans = ans * sa[na] % mod * sa[na+1] % mod;
            na += 2;
        }else if(sa[na]*sa[na+1] > sb[nb]*sb[nb+1]){
            ans = ans * sa[na] % mod * sa[na+1] % mod;
            na += 2;
        }else{ 
            ans = ans * sb[nb] % mod * sb[nb+1] % mod;
            nb += 2;
        }
    }
    
    cout << ans << endl;
}

int main(int argc, char **argv)
{
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    Main();
    return 0;
}


Measured memory_bytes: 5560
import heapq

n,m = map(int, input().split())
ab = [[] * (m+1) for i in range(m+1)]
for i in range(n):
  a,b = map(int, input().split())
  if m - a < 0:
    continue
  ab[a].append(b)

q=[]
ans = 0
heapq.heapify(q)
for i in range(1,m+1):
  for j in ab[i]:
    heapq.heappush(q, j*(-1))
  if q:
    b = heapq.heappop(q)
    ans += (-1) * b
print(ans)

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

#define rep(i,n) for(int i=0; i<(n); ++i)
#define rrep(i,n) for(int i=1; i<=(n); ++i)
#define drep(i,n) for(int i=(n)-1; i>=0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define fi first
#define se second
#define v(T) vector<T>
#define imposs {cout<<"-1\n";return 0;}
#define LL_MAX LLONG_MAX
#define LL_MIN LLONG_MIN

typedef unsigned int uint;
typedef long long int ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int,int> pii;
typedef vector<pii> vpii;
typedef set<int> si;
typedef multiset<int> msi;
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}

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

  int a, b, c, d, e;
  cin >> a >> b >> c >> d >> e;
  cout << (c*60+d-a*60-b-e) << '\n';
  return 0;
}


Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define BIG 1000000010
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
typedef long long int ll;


int main(){
  int a,b;
  cin>>a>>b;
  a=a%3;
  b=b%3;
  if(a==0 || b==0 || a+b==3) cout<<"Possible"<<endl;
  else cout<<"Impossible"<<endl;

  return 0;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, init, n) for(int i = (int)(init); i < (int)(n); i++)

int main() {
    int N;
    cin>>N;    
    map<string, int> poll;
    REP(i, 0, N) {
        string a;
        cin >> a;
        poll[a] += 1;
    }
    int maxv = 0;
    for(const auto& x: poll){
        int v = x.second;
        maxv = max(maxv, v);
    }
    for(auto itr = poll.begin(); itr != poll.end(); itr++){
        if(itr -> second == maxv){
            cout << itr->first << endl;
        }
    }
    
}

Measured memory_bytes: 25216
local n, k = io.read("*n", "*n")
local a = {}
for i = 1, n do
  a[i] = io.read("*n")
end
for i = k + 1, n do
  if a[i - k] < a[i] then
    print("Yes")
  else
    print("No")
  end
end


Measured memory_bytes: 6368
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
    while(true){
        int N;
        cin >> N;
        if(N == 0)
            break;
        vector<int> data(N*N, 101);
        
        for(int i = 0; i < N; i++){
            int M;
            cin >> M;
            vector<int> xs(M, 101);
            
            for(int j = 0; j < M; j++){
                int p;
                cin >> p;
                xs[j] = p;
            }
            sort( xs.begin(), xs.end() );
            for(int j = 0; j < M; j++){
                data[i*N+j] = xs[j];
            }
        }
        
        int K;
        cin >> K;
        vector<int> leak(K);
        for(int i = 0; i < K; i++){
            int l;
            cin >> l;
            leak[i] = l;
        }
        
        sort( leak.begin(), leak.end() );
        int ans = -1;
        for(int i = 0; i < N; i++){
            bool flag1 = true;
            int t = 0;
            for(int j = 0; j < K; j++){
                bool flag2 = false;
                while(true){
                    if(data[i*N+t] < leak[j]){
                        t += 1;
                    }
                    else if(data[i*N+t] == leak[j]){
                        t += 1;
                        break;
                    }
                    else{
                        flag2 = true;
                        break;
                    }
                }
                if(flag2){
                    flag1 = false;
                    break;
                }
            }
            if(flag1){
                if(ans == -1){
                    ans = i + 1;
                }
                else{
                    ans = -1;
                    break;
                }
            }
        }
        
        cout << ans <<endl;
        
    }
}

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

int n;
vector<int> a;
template <class T>
void readVector(int n, vector<T> &v){
	v.push_back(0);
	for(int i=0; i<n; ++i){
		T t;
		cin >> t;
		v.push_back(t);
	}
	v.push_back(0);
}
int s;

int main(){
//	cin.tie(0);
//	ios::sync_with_stdio(false);
	cin >> n;
	readVector(n, a);
	for(int i=1; i<a.size(); ++i)
		s += abs(a[i] - a[i-1]);
	for(int i=0; i<n; ++i)
		cout << s - abs(a[i+1] - a[i]) - abs(a[i+2] - a[i+1]) + abs(a[i+2] - a[i]) << "\n";
}

Measured memory_bytes: 1784
const main = (standardInput) => {
    const lengthList = standardInput.split(' ');
    const a = Number.parseInt(lengthList[0]);
    const b = Number.parseInt(lengthList[1]);
    const c = Number.parseInt(lengthList[2]);
    if (a < b && b < c){
        console.log('Yes');
    }else{
        console.log('No');
    }
}

main(require('fs').readFileSync('/dev/stdin', 'UTF-8'));


Measured memory_bytes: 15108
#include <bits/stdc++.h>
typedef long long LL;
#define SORT(c) sort((c).begin(),(c).end())

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

using namespace std;
map<string,vector<string> > team;
set<string> members;
int solve(string t){
  members.insert(t);
  if(!team.count(t)){ return 0; }
  int answer=1;
  vector<string> chg=team[t];
  team.erase(t);
  for(auto ch:chg) answer+=solve(ch);
  return answer;
}
int main(void)
{
  for(;;){
    int n;
    cin >> n;
    if(!n) return 0;
    team.clear();
    members.clear();
    string root;
    REP(i,n){
      string s;
      cin >> s;
      for(auto &c:s) if(c==':'||c==','||c=='.') c=' ';
      istringstream iss(s);
      string pa,ch;
      iss >> pa;
      if(i==0) root=pa;
      while(iss >> ch) team[pa].push_back(ch);
    }
    int tmp=solve(root);
    cout << members.size()-tmp << endl;
  }
}

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

using ll = long long;
using P = pair<int, int>;
#define reps(i,n) for (int i=1; i<=n; i++)
#define zarray(x,n) x[n+1]; reps(i,n) {x[i]=0;} 
#define zarray2(x,n,m) x[n+1][m+1]; reps(i,n) { reps(j,m) {x[i][j]=0;}}

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

    int zarray(h,n);
    reps(i,n) {
        cin >> h[i];
    }
    map<int,vector<int>> to;
    reps(i,m) {
        int a,b;
        cin >> a >> b;
        to[a].push_back(b);
        to[b].push_back(a);
    }

    int ans = 0;
    reps(i,n) {
        bool good = true;
        //cerr << "i:" << i << endl;
        for (auto neighbor : to[i]) {
            //cerr << "neighbor:" << neighbor << "hi" << h[i] << " hn" << h[neighbor] << endl;
            if (h[i] <= h[neighbor]) {
                good = false;
                break;
            }
        }
        if (good) ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 14624
/*************************************************************************
    > File Name: C.cpp
    > Author: Roundgod
    > Mail: wcysai@foxmail.com 
    > Created Time: 2018-06-23 19:55:14
 ************************************************************************/

#pragma GCC optimize(3)
#include<bits/stdc++.h>
#define MAXN 100005
#define INF 1000000000
#define MOD 1000000007
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int n,k,a[MAXN];
int main()
{
    scanf("%d%d",&n,&k);
    for(int i=1;i<=n;i++)
        scanf("%d",&a[i]);
    printf("%d\n",(n-2)/(k-1)+1);
    return 0;
}



Measured memory_bytes: 640
#include<iostream>
#include<cstdio>
#include<string>
#include<cstring>
#include<climits>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<stack>
#include<queue>
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pb push_back
#define mp make_pair
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define INF 1e9+7
#define LLINF 1e18
// #define int ll
using namespace std;
const int MOD = 1e9 +7;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int h,w,D,a,q,l[100010],r[100010],px[90001],py[90001],d[90001];
    cin>>h>>w>>D;
    rep(i,h)rep(j,w){
        cin>>a;
        px[a]=i;py[a]=j;
    }
    cin>>q;
    rep(i,q)cin>>l[i]>>r[i];
    rep2(i,D+1,h*w+1){
        d[i]=d[i-D]+abs(px[i]-px[i-D])+abs(py[i]-py[i-D]);
    }
    rep(i,q){
        cout<<d[r[i]]-d[l[i]]<<endl;
    }
    return 0;
}

Measured memory_bytes: 2944
a, b, m = map(int, input().split())
al = list(map(int, input().split()))
bl = list(map(int, input().split()))

payl = []
nom = min(al) + min(bl)
payl.append(nom)

for i in range(m):
    ml = list(map(int, input().split()))
    payl.append(al[ml[0] - 1] + bl[ml[1] - 1] - ml[2])

print(min(payl))

Measured memory_bytes: 18648
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
#include<complex>
using namespace std;

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 998244353;
const ll INF = mod * mod;
typedef pair<int, int>P;
typedef pair<int, bool> sP;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef pair<ll, ll> LP;
typedef vector<ll> vec;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-6;
const ld pi = acos(-1.0);
typedef vector<vector<ll>> mat;
typedef vector<ll> vec;


char mp[300][300];
vector<int> loc[300];
int ans[300][300];
void solve() {
	int h, w, k; cin >> h >> w >> k;
	rep(i, h)rep(j, w) {
		cin >> mp[i][j];
	}

	rep(i, h) {
		rep(j, w) {
			if (mp[i][j] == '#')loc[i].push_back(j);
		}
	}
	int tmp = 1;
	int le = 0;
	rep(i, h) {
		if (loc[i].size() == 0)continue;
		int l = 0; int r;
		rep(j, loc[i].size()) {
			int id = loc[i][j];
			r = id;
			if (j == loc[i].size() - 1)r = w - 1;
			for (int x = le; x <= i; x++) {
				for (int y = l; y <= r; y++) {
					ans[x][y] = tmp;
				}
			}
			l = id + 1; tmp++;
		}
		le = i + 1;
	}
	if (le < h) {
		for (int x = le; x < h; x++) {
			rep(j, w) {
				ans[x][j] = ans[x - 1][j];

			}
		}
	}
	rep(i, h){
		rep(j, w) {
			if (j > 0)cout << " ";
			cout << ans[i][j];

		}
		cout << endl;
	}
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(9);
	//init();
	solve();
	//stop
		return 0;
}



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

typedef long long ll;
typedef long double ld;
typedef vector<ll> vi;
typedef pair<ll, ll> pii;
typedef vector<pii> vii;
typedef vector<vi> vvi;
const int MOD = 1e9 + 7;

#define fastIO \
ios_base::sync_with_stdio(false); cin.tie(nullptr);
#define endl '\n'
#define pb push_back
#define ff first
#define ss second
#define mp make_pair 

#ifdef DIV_DEBUG
#define cerr(...) __cerr(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __cerr(const char *name, Arg1 &&arg1) {
    cerr << name << " = " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __cerr(const char *names, Arg1 &&arg1, Args&&... args) {
    const char *sep = strchr(names + 1, ',');
    cerr.write(names, sep - names) << " = " << arg1 << " |";
    __cerr(sep + 1, args...);
}
#else
#define cerr(...) 
#endif


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

    vi psum;
    vi found(M, -1);
    ll A = X;
    while (found[A] == -1) {
        found[A] = int(psum.size());
        psum.pb(A);
        A = (A * A) % M;
    }

    int sz = psum.size();
    if (N < sz) {
        for (int i = 1; i < sz; i++)    psum[i] += psum[i - 1];
        cout << psum[N - 1] << endl;
        return 0;
    }
    
    for (int i = 1; i < found[A]; i++)    psum[i] += psum[i - 1];
    for (int i = found[A] + 1; i < sz; i++) psum[i] += psum[i - 1];
    ll ans = found[A] > 0 ? psum[found[A] - 1] : 0;
    ll cycles = (N - found[A]) / (sz - found[A]), rem = (N - found[A]) % (sz - found[A]);
    ans += cycles * psum[sz - 1] + (rem > 0 ? psum[found[A] + rem - 1] : 0);
    cout << ans << endl;
    return 0;
}   

Measured memory_bytes: 4612
import java.math.BigDecimal;
import java.util.Scanner;

/**
 * @author : Ritchie Zhang
 * @date : 2020/5/10
 * @description： TODO
 * @modifiedBy：
 * @version: 1.0
 */
public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        BigDecimal a = scanner.nextBigDecimal();
        BigDecimal b = scanner.nextBigDecimal();

        BigDecimal c = a.multiply(b);
        long d = c.longValue();
        System.out.println(d);
    }

}


Measured memory_bytes: 37564
#include <iostream>
using namespace std;
int hit(int a[],int b[]);
int blow(int a[], int b[]);
int main(){
    int a[4];
    int b[4];
    while (cin >> a[0] >> a[1] >> a[2] >> a[3]){
        cin >> b[0] >> b[1] >> b[2] >> b[3];
        int hi = hit(a,b);
        int bl = blow(a,b);
        cout << hi << " " << bl << endl;
    }
}

int hit(int a[],int b[]){
    int n=0;
    for (int i=0; i<4;i++){
        if (a[i]==b[i])
            n++;
    }
    return n;
}

int blow(int a[], int b[]){
    int n=0;
    for (int i=0; i<4; i++){
        for (int j=0; j<4; j++){
            if (a[i]==b[j])
                n++;
        }
    }
    n -= hit(a,b);
    return n;
}

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

using namespace std;

int main()
{

    int n;  cin >> n;
    int k;  cin >> k;

    int* arr = new int[n];
    for (int i = 0; i < n; i++){
        cin >> arr[i];
    }

    sort(arr, arr+n);

    int sum = 0;
    for (int i = 0; i < k; i++){
        sum += arr[i];
    }

    cout << sum << endl;

    return 0;
}


Measured memory_bytes: 3548
#include<iostream>
#include<cstdio>
using namespace std;
int n, k, ans, d,a[110], b[110]; 
int main()
{
	cin >> n >> k;
	for(int i = 1; i <= k; i++)
	{
		cin>>d;
		for(int j = 1; j <= d; j++)
		{
			cin>>a[j];
			if(b[a[j]] == 0) ans++;
			b[a[j]]++;
		}
	}
	cout<<n - ans;
	return 0;
} 

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

int main() {
  int a, b;
  cin >> a >> b;
  if (a > 1 || b > 1)
    cout << a * (a - 1) / 2 + b * (b - 1) / 2 << endl;
  else 
    cout << 0 << endl;
  
}


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

#define rep(i, n) for(int i = 0; i < (n); i++)
using LL = long long;
using ULL = unsigned long long;


void solve() {
	unsigned n, k; cin >> n >> k;
	vector<ULL> a(n);
	vector<ULL> Sa(n + 1); Sa[0] = 0;
	rep(i, n) {
		cin >> a[i];
		a[i]--;
		Sa[i + 1] = Sa[i] + a[i];
	}
	map<ULL, ULL> s;
	ULL ans = 0;
	rep(i, n) {
		ULL inst = Sa[i] % k;
		if (s.count(inst)) s[inst]++;
		else s[inst] = 1;
		ULL tg = Sa[i + 1] % k;
		if (s.count(tg)) ans += s[tg];
	}
	s.clear();
	rep(i, n) {
		if (i + 1 >= k) {
			ULL inst = Sa[i + 1 - k] % k;
			if (s.count(inst)) s[inst]++;
			else s[inst] = 1;
		}
		ULL tg = Sa[i + 1] % k;
		if (s.count(tg)) ans -= s[tg];
	}

	cout << ans << endl;
}

int main() {

	solve();

	return 0;
}


Measured memory_bytes: 15872
#include <iostream>
#include <math.h>
#include <algorithm>
#include <vector>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
//string alp = "abcdefghijklmnopqrstuvwxyz";
using namespace std;
int main(){
  string n;
  cin >> n;
  bool b = true;
  REP(i,n.size()/2){
    if(n[i]!=n[n.size()-i-1])b=false;
  }
  cout << (b?"Yes":"No") << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
 
int main () {
	int n, a, b, num1, num2, num3, num4, num5;
	int sum = 0;
	scanf("%d %d %d", &n, &a, &b);
	for(int i = 1; i <= n; i++) {
		num1 = i % 10;
		num2 = (i / 10) % 10;
		num3 = (i / 100) % 10;
		num4 = (i / 1000) % 10;
		num5 = (i / 10000) % 10;
		if ((num1+num2+num3+num4+num5) >= a && (num1+num2+num3+num4+num5) <= b) {
			sum += i;
		}
	}
	printf("%d\n", sum);	
	return 0;
}

Measured memory_bytes: 1632
N = int(input())
X = list()

for i in range(0,N-1):
    X.append(list(map(int,input().strip().split(" "))))

for i in range(0, N):
    Y = 0
    for j in range(i, N-1):
        if Y <= X[j][1]:
            Y = X[j][1]
        else:
            if Y%X[j][2]==0:
                Y = Y
            else:
                Y = Y + X[j][2] - Y%X[j][2]
        Y += X[j][0]
    print(Y)

Measured memory_bytes: 3188
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
using ull = unsigned long long;
using ll = long long;
using namespace std;

int main(void) {
    
    int a, b, c;
    cin >> a >> b >> c;
    
    if ( c <= a + b) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;

}

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

using namespace std;

typedef long long ll;

const int INF = 1e9;
const int N = 1e5 + 5;

int n;
int h[N];
int dp[N];


int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> h[i];
  }
  fill(dp, dp + n, INF); 
  dp[0] = 0;
  dp[1] = abs(h[1] - h[0]);
  for (int i = 2; i < n; ++i) {
    dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i - 2] - h[i]));
  }
  cout << dp[n - 1] << endl;
  return 0;
}



Measured memory_bytes: 4400
#include <bits/stdc++.h>
#define rep(i,l,r) for(int i=l;i<=r;i++)
#define per(i,r,l) for(int i=r;i>=l;i--)
#define IMAX 0x3f3f3f3f
#define LLMAX 0x3f3f3f3f3f3f3f3f
using namespace std;
typedef long long ll;
typedef double db;
inline int read() {
  int x=0,f=1;
  char c=getchar();
  while(!isdigit(c)){if(c=='-')f=-1;c=getchar();}
  while(isdigit(c)){x=x*10+c-'0';c=getchar();}
  return x*f;
}

const int N=200007;

ll n,k,a[N];

signed main() {
  int _=1;//_=read();
  while(_--){
    scanf("%lld%lld",&k,&n);
    rep(i,1,n)a[i]=read();
    ll ans=a[n]-a[1];
    rep(i,2,n)ans=min(ans,(ll)k-a[i]+a[i-1]);
    printf("%lld\n",ans);
  }
}

Measured memory_bytes: 1920
import fractions
mod = 10**9+7
def LCM(a,b):
    return a*b//fractions.gcd(a,b)

N=int(input())
A = [int(i) for i in input().split()]
curLCM = A[0]
for i in range(1,N):
    curLCM = LCM(curLCM,A[i])
ans = 0
for a in A:
    ans += curLCM//a 
print(ans%mod)


Measured memory_bytes: 6108
from itertools import repeat
a, b = input().split()
a = int(a)
b = int(b)
l = []
if a < b or a == b:
    a = str(a)
    l.extend(repeat(a, b))
    print("".join(l))
else:
    b = str(b)
    l.extend(repeat(b, a))
    print("".join(l))

Measured memory_bytes: 3060
#include <algorithm>
#include <iostream>
#include <string>
#include <random>
#include <cassert>
#include <cstring>
#include <chrono>
#include <set>
#include <map>

using namespace std;

typedef long long ll;

int main()
{
  ll A, B, N;
  cin >> A >> B >> N;
  ll r = min(B - 1, N);
  cout << r * A / B << endl;
  return 0;
}


Measured memory_bytes: 3624
#include <stdio.h>

int main(){
  int a, b, c, d;
  int r;
  scanf("%d %d %d %d", &a, &b, &c, &d);

  if(a == 12 && c == 1){
    r = 1;
  }
  else if(a+1 == c){
    r = 1;
  }
  else{
    r = 0;
  }
  printf("%d\n", r);
  return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
const int N=1000005;
int n,top,x,y,ans,ma,dis[N],head[N];
struct node{
	int too,next;
}edge[N*2];
void add(int a,int b)
{
	edge[++top].too=b;edge[top].next=head[a];head[a]=top;
}
void dfs(int u,int fa)
{
	dis[u]=dis[fa]+1;
	if(dis[u]>ma)
	{
		ma=dis[u];
		ans=u;
	}
	for(int i=head[u];i;i=edge[i].next)
	{
		int v=edge[i].too;
		if(v==fa)continue;
		dfs(v,u);
	}
}
int main()
{
	int T;
	T=1;
	while(T--)
	{
		scanf("%d",&n);
		top=0;
		memset(head,0,sizeof(head));
		for(int i=1;i<n;i++)
		{
			scanf("%d%d",&x,&y);
			add(x,y);
			add(y,x);
		}
		memset(dis,0,sizeof(dis));
		ma=0,ans=0;
		dfs(1,0);
		memset(dis,0,sizeof(dis));
		x=ans;
		ma=0,ans=0;
		dfs(x,0);
		if(ma==1)
		{
			puts("First");
			continue;
		}
		if((ma-2)%3==0)puts("Second");
		else puts("First");
	}
}
/*
如果选的是叶子，最后一层就只有这一个点了
如果不是叶子，叶子全消除
说明要么去掉一层，要么去掉两层
直径一定是两个叶子 
*/
/*
3
3
1 2
2 3
6
1 2
2 3
2 4
4 6
5 6
7
1 7
7 4
3 4
7 5
6 3
2 1
*/

Measured memory_bytes: 19712
#include <bits/stdc++.h>
#define vi vector<int>
#define Vi vector<vector<int>>
#define ll long long
#define P pair<int,int>
#define vp  vector<P>
#define mod 1000000009
using namespace std;
int main(){
	int A,B;
	cin>>A>>B;
	// int x=A*25;
	// int y=B*10;
	for(int i=1;i<1000000;i++){
		if(floor(i*0.08)==A && floor(i*0.1)==B){
			cout<<i<<endl;
			return 0;
		} 
	}
	cout<<-1<<endl;
	return 0;
}

Measured memory_bytes: 764
#include <iostream>
#include <map>

using namespace std;

int main() {
    size_t n;
    cin >> n;
    map<unsigned long long, bool> dict;
    for (size_t i = 0; i < n; ++i) {
        unsigned long long a;
        cin >> a;
        if (dict.count(a) == 0) {
            dict[a] = true;
        }
        else {
            dict[a] = !dict[a];
        }
    }
    size_t num = 0;
    for (const auto& item : dict) {
        if (item.second) ++num;
    }
    cout << num << endl;
    return EXIT_SUCCESS;
}

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


using namespace std;


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


int main(void) {
    ll X;
    ull K, D;
    cin >> X >> K >> D;

    ll ans = 0;
    if (K * D < (ull)abs(X)) {
        ans = (ull)abs(X) - K * D;
    } else {
        ull d = (ull)abs(X) / D;
        ull r = (ull)abs(X) % D;
        ull move_left = K - d;

        if (move_left % 2 == 0) {
            ans = r;
        } else {
            ans = D - r;
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 3632
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
#define REP(i,n) for(int i=0;i<n;++i)
using namespace std;
const int INF = 100000000;

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int digit[] = {0, 2,5,5,4,5,6,3,7,6};
  int n, m, a[9], dp[10001];
  cin >> n >> m;
  REP(i, m) {
    cin >> a[i];
  }
  dp[0] = 0;
  for(int i = 1; i <= n; ++i) {
    dp[i] = -INF;
  }
  for(int i = 1; i <= n; ++i) {
    REP(j, m) {
      if(i - digit[a[j]] >= 0) {
        dp[i] = max(dp[i], 1 + dp[i - digit[a[j]]]);
      }
    }
  }
  sort(a, a + m);
  reverse(a, a + m);
  int rem = n;
  for(int i = dp[n]; i > 0; --i) {
    int j;
    for(j = 0; j < m; ++j) {
      if(rem - digit[a[j]] >= 0
          && dp[rem] == dp[rem - digit[a[j]]] + 1) {
        break;
      }
    }
    rem -= digit[a[j]];
    cout << a[j];
  }
  cout << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <string>
#define REP(i,n) for (int i=0;i<(n);i++)
#define ALL(a) (a).begin(),(a).end()
#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 ll long long
#define ull unsigned long long
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
 
using namespace std;

    template < typename T > std::string to_string( const T& n )
    {
        std::ostringstream stm ;
        stm << n ;
        return stm.str() ;
    }

 
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
	int n;
	int k;
	cin >> n >> k;
	string d = "0123456789";
	REP(i,n){
		int tmp;
		cin >> tmp;
		REP(j,d.size()){
			if(d[j]-'0' == tmp)	d.erase(d.begin() + j);
		}
	}
	for(int ans = n;ans<=n*10;ans++){
		string s_a = to_string(ans);
		bool is_ok = true;
		REP(i,s_a.size()){
			REP(j,d.size()){
				if(s_a[i] == d[j])break;
				if(j == d.size()-1)is_ok = false;
			}
			if(!is_ok)break;
		}
		if(is_ok){
			cout << ans << endl;
			break;
		}
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N,M; cin>>N>>M;
  int ansAC = 0;
  int ansWA = 0;
  
  vector<bool> jud(N); //AC済かどうかを記録するバケット
  for (int i=0; i<N; i++) jud[i]=false;
  
  vector<int> coWA(N);
  for (int i=0; i<N; i++) coWA[i]=0;
  
  for (int i=0; i<M; i++){
    int p; cin>>p;
    string S; cin>>S;
    
    if (jud[p-1]==true){ //既にAC済のとき
      continue;
    }
	
    if (S=="AC"){ //AC未了かつ今回AC
       jud[p-1] = true;
       ansAC++;   
       ansWA += coWA[p-1];
    }
    else if (S=="WA"){ //AC未了かつ今回WA
       coWA[p-1]++;
    }     
  }
  
  cout << ansAC << " " << ansWA << endl;
}

Measured memory_bytes: 640
inp = require('fs').readFileSync('/dev/stdin', 'utf8').trim().split('\n')
S = inp.shift().split('')
cnt = 0
b = []
l = 0
while(S[S.length-1] == 'B') {
    S.pop()
}
for(i=0;i<S.length;i++) {
    if (S[i] == 'B') {
        b.push(i)
    } else {
        l = i
    }
}
for(i=0;i<b.length;i++) {
    cnt += l - b[i] - (b.length - i - 1)
}
console.log(cnt)

Measured memory_bytes: 17228
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define ld long double
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpll vector<pll>
#define vpii vector<pii>
#define umap unordered_map
#define uset unordered_set
#define PQ priority_queue
#define printa(a, L, R)         \
    for (int i = L; i < R; i++) \
    cout << a[i] << (i == R - 1 ? '\n' : ' ')
#define printv(a) printa(a, 0, a.size())
#define print2d(a, r, c)            \
    for (int i = 0; i < r; i++)     \
        for (int j = 0; j < c; j++) \
    cout << a[i][j] << (j == c - 1 ? '\n' : ' ')
#define pb push_back
#define eb emplace_back
#define UB upper_bound
#define LB lower_bound
#define F first
#define S second
#define mem(a, x) memset(a, x, sizeof(a))
#define inf 1e18
#define E 2.71828182845904523536
#define gamma 0.5772156649
#define nl "\n"
#define lg(r, n) (int)(log2(n) / log2(r))
#define rev(v) reverse(v.begin(), v.end())
#define srt(v) sort(v.begin(), v.end())
#define grtsrt(v) sort(v.begin(), v.end(), greater<ll>())
#define all(v) v.begin(), v.end()
#define mnv(v) *min_element(v.begin(), v.end())
#define mxv(v) *max_element(v.begin(), v.end())
#define toint(a) atoi(a.c_str())
#define BeatMeScanf ios_base::sync_with_stdio(false)
#define one(x) __builtin_popcount(x)
#define Unique(v) v.erase(unique(all(v)), v.end())
#define fout(x) fixed << setprecision(x)

const int mod = 1e9 + 7;
const int N = 3e5 + 9;
const ld eps = 1e-9;
const ld PI = acos(-1.0);
ll gc(ll a, ll b)
{
    while (b)
    {
        ll x = a % b;
        a = b;
        b = x;
    }
    return a;
}
ll lc(ll a, ll b) { return a / gc(a, b) * b; }
ll qpow(ll n, ll k)
{
    ll ans = 1;
    assert(k >= 0);
    n %= mod;
    while (k > 0)
    {
        if (k & 1)
            ans = (ans * n) % mod;
        n = (n * n) % mod;
        k >>= 1;
    }
    return ans % mod;
}

#define MX 300000LL

ll t[1400000];

ll mx(ll v, ll tl, ll tr, ll l, ll r) {
    if (l > r) 
        return 0;
    if (l == tl && r == tr) {
        return t[v];
    }
    ll tm = (tl + tr) / 2;
    return max(mx(v*2, tl, tm, l, min(r, tm))
           , mx(v*2+1, tm+1, tr, max(l, tm+1), r));
}

void update(ll v, ll tl, ll tr, ll pos, ll new_val) {
    if (tl == tr) {
        t[v] = new_val;
    } else {
        ll tm = (tl + tr) / 2;
        if (pos <= tm)
            update(v*2, tl, tm, pos, new_val);
        else
            update(v*2+1, tm+1, tr, pos, new_val);
        t[v] = max(t[v*2] , t[v*2+1]);
    }
}

void solve()
{
    ll n, k;
    cin>>n>>k;
    for(ll i=1;i<=n;i++)
    {
        ll x;
        cin>>x;
        ll y=mx(1, 0, MX, max(0LL, x-k), min(MX, x+k));
        update(1, 0, MX, x, y+1);
    }
    cout<<t[1]<<nl;
}

int main()
{
    solve();
    return 0;
}


Measured memory_bytes: 11832
n,k=map(int,input().split())

a=[0]*n
for i in range(k):
 d=int(input())
 lis=map(int,input().split())
 for j in lis:
  a[j-1]=1
  
ans=0
for i in a:
 if i==0:
  ans=ans+1
print(ans)

Measured memory_bytes: 9048
#include <iostream>

using namespace std;

int group(int a) {
	if (a == 2) {
		return 28;
	} else if (a == 4 || a == 6 || a == 9 || a == 11) {
		return 30;
	} else {
		return 31;
	}
}

int main() {
	int x, y;
	cin >> x >> y;

	cout << (group(x) == group(y) ? "Yes" : "No") << endl;
	return 0;
}


Measured memory_bytes: 256
/*

aとbの最小公倍数、最大公約数を求めよ。
aとbは20億以下とする。
ただし、公倍数も20億以下とする。

やり方：
	・aとbを入力。
	・最小公倍数を求める関数koubai00と、最大公約数を求める関数kouyaku00を使い、
		配列2つ（koubai[]とkouyaku[]）にそれぞれ記録していく。
	・表示して終わり。

結果：Run time error

何がおかしいのだろう。
普通に実行できるのだが。

*/
#include <stdio.h>

int koubai00(int a, int b);		//最小公倍数を求める関数。詳細は下部。
int kouyaku00(int a, int b);		//最大公約数を求める関数。ユークリッドさんの互除法。

int main()
{
	int a,b;
	int i=0,count;
	int koubai,kouyaku;
	int ret;
	while(1){
		ret=scanf("%d %d",&a, &b);
		if(ret==EOF){
			break;
		}
		koubai=koubai00(a, b);
		kouyaku=kouyaku00(a, b);
		printf("%d %d\n",kouyaku, koubai);
	}
    return 0;
}

int koubai00(int a, int b)				//最小公倍数を求める関数。
{										//A*B=最大公約数*最小公倍数		らしい。
	int small,big;
	int r;
	int result;
	if(a<b){
		small=a;
		big=b;
	}
	else if(a>b){
		small=b;
		big=a;
	}
	else{
		return a;
	}
	while(small!=0){
		r=big%small;
		big=small;
		small=r;
	}
	result=(a/big)*b;
	return result;
}

int kouyaku00(int a, int b)				//最大公約数を求める関数。ユークリッドさんの互除法。
{
	int r;
	int small,big;
	if(a<b){
		small=a;
		big=b;
	}
	else if(a>b){
		small=b;
		big=a;
	}
	else{
		return a;
	}
	while(small!=0){
		r=big%small;
		big=small;
		small=r;
	}
	return big;
}

Measured memory_bytes: 592