akhauriyash/Code-Regression huggingface dataset:
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath>
#include <iomanip>
#include <ctype.h>

using namespace std;
using ll = long long;
using PAIR = pair<int, int>;
using PAIRLL = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;

#define rep(i,N) for(int i=0;i<(int)N;++i)

ll GCD(ll x, ll y) {
    if (y == 0) return x;
    else return GCD(y, x % y);
}

ll LCM(ll x, ll y) {
    return x / GCD(x, y) * y;
}

bool my_compare(pair<string, int> a, pair<string, int> b) {
    if (a.first != b.first) {
        return a.first < b.first;
    }

    if (a.second != b.second) {
        return a.second > b.second;
    }
    else {
        return true;
    }
}

int main()
{
    int A, B;
    cin >> A >> B;

    string S;
    cin >> S;

    int j = 0;

    if (S[A] != '-') { cout << "No" << endl; goto xyz; }

    rep(i, A) if (S[i] >= '0' && S[i] <= '9') { ++j; }

    for (int i = A + 1; i <= A + B; ++i) if (S[i] >= '0' && S[i] <= '9') { ++j; }

    if (j == A + B) { cout << "Yes" << endl; }
    else { cout << "No" << endl; }

xyz:;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
typedef pair<int,int> P;

int main() {
  int n,t;
  while(cin >> n >> t && n) {
    vector<P> v[n];
    int c[n],d=0;
    memset(c,0,sizeof(c));
    priority_queue<P,vector<P>,greater<P> > que;
    for(int i=0; i<n; i++) {
      int x,y;
      while(cin >> x && x) {
        cin >> y;
        v[i].push_back(P(x,y));
      }
      if(v[i].size()) que.push(P(v[i][0].F,i));
    }
    int ans=0;
    for(int i=0; i<t; i++) {
      if(que.top().F<=i&&!d) {
        P p=que.top();que.pop();
        ans+=max(0,i-p.F);
        int k=p.S;
        d+=v[k][c[k]].S;
        c[k]=(c[k]+1)%v[k].size();
        que.push(P(i+v[k][c[k]].F+d,k));
        d--;
      } else if(d) d--;
    }
    while(!que.empty()) {
      P p=que.top();que.pop();
      ans+=max(0,t-p.F);
    }
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 3016
INF = 10_0000_0007
K = gets.to_i

dist = Array.new(K, INF)
queue = [[1, 1]]
until queue.empty?
  v, c = queue.shift
  next if dist[v] <= c
  
  dist[v] = c
  queue << [(v+1)%K, c+1] if dist[(v+1)%K] > c+1
  queue << [(v*10)%K, c] if dist[(v*10)%K] > c
end

puts dist[0]

Measured memory_bytes: 12864
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int mx=0,mn=100000,n,h;
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>h;
        mn=min(mn,h);
        mx=max(mx,h);



    }
    cout<<mx-mn<<endl;





    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pint;
typedef vector<long long> vlong;
typedef vector<string> vstring;
#define _GLIBCXX_DEBUG
#define vpush(a,x) a.push_back(x);
#define rep(i, n) REP(i, 0, n)
#define all(v) v.begin(), v.end()
#define REP(i, x, n) for(int i = x; i < n; i++)
const int INF = 1 << 30;
const int dx[] = {1,0,-1,0,1,1,-1,-1};
const int dy[] = {0,-1,0,1,1,-1,-1,1};
#define stp(x)  setprecision(x)
int main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n,m;
  cin>>n>>m;
  vint a(n),b(n);
  vint c(m),d(m);
  rep(i,n){
    cin>>a[i]>>b[i];
  }
  rep(i,m){
    cin>>c[i]>>d[i];
  }
  rep(i,n){
    int min=INF,ans=0;
    rep(j,m){
      int kyo=abs(a[i]-c[j])+abs(b[i]-d[j]);
      if(min>kyo){
        min=kyo;
        ans=j+1;
      }
    }
    cout<<ans<<'\n';
  }
  return(0);
}


Measured memory_bytes: 256
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

x, y = MAP()

gA = [1, 3, 5, 7, 8, 10, 12]
gB = [4, 6, 9, 11]
gC = [2]

for l in [gA, gB, gC]:
	if x in l and y in l:
		print("Yes")
		break
else:
	print("No")


Measured memory_bytes: 3888
#include<stdio.h>
#include<string.h>
int min(int a, int  b){return a>b?b:a;}
int dp[1001][1001];
int main(){
	char s1[1001];
	char s2[1001];
	scanf("%s",&s1);
	scanf("%s",&s2);
	dp[0][0] = 0;
	for(int i = 1; i<=strlen(s1); i++){
		dp[i][0] = i;
	}
	for(int i = 1; i<=strlen(s2); i++){
		dp[0][i] = i;
	}
	for(int i = 1; i<=strlen(s1); i++){
		for(int j = 1; j<=strlen(s2); j++){
			if(s1[i-1]==s2[j-1]) dp[i][j] = dp[i-1][j-1];
			else {
				dp[i][j] = min(dp[i-1][j-1], min(dp[i-1][j],dp[i][j-1]))+1;
			}
		}
	}
	
	printf("%d\n",dp[strlen(s1)][strlen(s2)]);
	//printf("%s\n",s2);
	return 0;
}


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

typedef long long ll;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<vector<ll>>> vvvll;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<vector<vector<bool>>> vvvb;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<vpll> vvpll;
typedef vector<double> vd;
typedef vector<vd> vdd;

#define FOR(i,x,y) for(ll i=(ll)x; i<(ll)y; ++i)
#define REP(i,y) FOR(i, 0, y)
#define RFOR(i,x,y) for(ll i=(ll)x; i>=(ll)y; --i)
#define RREP(i,x) RFOR(i, x, 0)
#define ALL(a) a.begin(), a.end()
#define pb push_back
#define debug_print(x...) cerr << "line " << __LINE__ << " : "; debug_print_in(x);

template <typename First>
void debug_print_in(First first){
  cerr << first << endl;
  return;
}

template <typename First, typename... Rest>
void debug_print_in(First first, Rest... rest){
  cerr << first << " ";
  debug_print_in(rest...);
  return;
}

void IN(void){
  return;
}

template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){
  cin >> first;
  IN(rest...);
  return;
}

template <typename First>
void OUT(First first){
  cout << first << endl;
  return;
}

template <typename First, typename... Rest>
void OUT(First first, Rest... rest){
  cout << first << " ";
  OUT(rest...);
  return;
}

template<class t, class u> void chmax(t&a,u b){if(a<b)a=b;};
template<class t, class u> void chmin(t&a,u b){if(a>b)a=b;};
int popcount(int t){return __builtin_popcount(t);} //GCC
int popcount(ll t){return __builtin_popcountll(t);} //GCC

template <typename T>
void vec_print(vector<T> VEC){
  REP(i, VEC.size()){
    cerr << VEC[i] << " ";
  }
  cerr << endl;
};

template <typename T>
void mat_print(vector<vector<T> > MAT){
  REP(i,MAT.size()){
    REP(j,MAT[i].size()){
      cerr << MAT[i][j] << " ";
    }
    cerr << endl;
  }
};

constexpr int INF = (1<<30);
constexpr ll INFLL = 1LL<<62;
constexpr long double EPS = 1e-12;
constexpr ll MOD = (ll)(998244353);

ll A, B, C, D;
//vvll dp(5E3, vll(5E3, 0));
vvll dp;

int main(){
  cin.tie(0); // cut the cin and cout (default, std::flush is performed after std::cin)
  ios::sync_with_stdio(false); // cut the iostream and stdio (DON'T endl; BUT "\n";)

  IN(A,B,C,D);

  dp.resize(C+10, vll(D+10, 0));

  dp[C][D] = 1;
  for(ll i=C-1; i>=A; --i){
    dp[i][D] = (dp[i+1][D]*D)%MOD;
  }
  for(ll i=D-1; i>=B; --i){
    dp[C][i] = (dp[C][i+1]*C)%MOD;
  }

  for(ll s=C+D-2; s>=A+B; --s){
    for(ll x=A; s-x>=B; ++x){
      ll y = s-x;
      if(x>C) continue;
      if(y>D) continue;
      dp[x][y] = (y*dp[x+1][y])%MOD;
      dp[x][y] += (x*dp[x][y+1])%MOD;
      dp[x][y] -= (((x*y)%MOD)*dp[x+1][y+1])%MOD;
      if(dp[x][y]<0) dp[x][y] += 2*MOD;
      dp[x][y] %= MOD;
    }
  }

  OUT(dp[A][B]);


  return 0;
}


Measured memory_bytes: 74096
#include <sstream>
#include <cstring>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iterator>
#include <numeric>
#include <functional>
#include <climits>


using namespace std;
typedef unsigned long long ull;
typedef long long ll;

int main(int argc, char** argv){
  size_t n;
  cin >> n;
  int m, M, buf;
  cin >> m;
  M = INT_MIN;
  for (size_t i = 1; i < n; i++) {
    cin >> buf;
    M = max(M, buf - m);
    m = min(m, buf);
  }
  cout << M << endl;
  
  return 0;
}

Measured memory_bytes: 1168
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int l, i=0;
  	string s;
  	char a[255];
    cin >> s;
  
  	strcpy(a, s.c_str());

    if ((a[2] == a[3]) && (a[4] == a[5])) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  
  	return 0;
}


Measured memory_bytes: 256
h, w = map(int, input().split())
a = [list(map(str, list(input()))) for i in range(h)]
l1 = ["." for i in range(w)]
l2 = ["." for i in range(h)]
for i in range(h):
  if "#" in a[i]:
    l2[i] = "#"
for i in range(w):
  if "#" in [a[j][i] for j in range(h)]:
    l1[i] = "#"
for i in range(h):
  l = []
  for j in range(w):
    if l1[j] == "#" and l2[i] == "#":
      l.append(a[i][j])
  if len(l) != 0:
    print("".join(l))

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

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define Eunique(v) v.erase(unique(all(v)),v.end())
#define Eback(s) s.erase(s.end()-1,s.end())
#define pb push_back
#define pf push_front
#define mod 1000000007
#define m_p make_pair
#define DOUBLE fixed << setprecision(15)
#define OK puts("OK")
#define OK1 puts("OK1")
#define OK2 puts("OK2")
#define SIZE(s) (int)s.size()
#define Cout(n) cout<<(n)<<endl
#define INF 1000000000000000000LL

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef vector<pair<int,int>> vpii;
typedef vector<pair<ll,ll>> vpll;
typedef vector<string> vs;
const double pi = acos(-1.0);

template<class A, class B>
ostream& operator<<(ostream& ost, const pair<A, B>&p) {
	ost << "{" << p.first << ", " << p.second << "} ";
	return ost;
}

template<class T>
ostream& operator<<(ostream& ost, const vector<T>&v) {
	ost << "{";
	for (int i = 0; i<(int)v.size(); i++) {
		if (i)ost << " ";
		ost << v[i];
	}
	ost << "} \n";
	return ost;
}

template<class A, class B>
ostream& operator<<(ostream& ost, const map<A, B>&v) {
	ost << "{";
	for (auto p:v) {
		ost << "{" << p.first << ", " << p.second << "} ";
	}
	ost << "} ";
	return ost;
}

ll gcd(ll x, ll y) { return (y == 0) ? x : gcd(y, x % y); }
ll lcm(ll x, ll y) { return x * y / gcd(x, y); }

int main()
{
	ll h,w,n;
	cin >> h >> w >> n;
	cout << (n+(max(h,w)-1))/max(h,w) << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int a, b, c;
    cin>>a >> b >> c;
    swap(a, b);
    swap(a, c);
    cout<<a<<" "<<b<<" "<<c<<endl;
    return 0;
}


Measured memory_bytes: 256
S = input()
Numbers = [0] * len(S)
children_R = 1
children_L = 0

for i in range(1,len(S)):
    if S[i] == "R":
        children_R += 1
    elif S[i] == "L" and S[i-1] == "R":
        children_R += 1
        if children_R % 2 != 0:
            Numbers[i] += (children_R//2)+1
        else:
            Numbers[i] += children_R//2
        Numbers[i-1] += children_R//2
        children_R = 0
    elif i == len(S) -1:
        children_L += 1
        if children_L % 2 != 0:
            Numbers[i-1-children_L] += (children_L//2)+1
        else:
            Numbers[i-1-children_L] += children_L//2
        Numbers[i-children_L] += children_L//2
        children_L = 0
    elif S[i] == "L" and S[i-1] == "L" and S[i+1] == "L":
        children_L += 1
    elif S[i] == "L" and S[i-1] == "L" and S[i+1] == "R":
        children_L += 1
        if children_L % 2 != 0:
            Numbers[i-1-children_L] += (children_L//2)+1
        else:
            Numbers[i-1-children_L] += children_L//2
        Numbers[i-children_L] += children_L//2
        children_L = 0

print(*Numbers)

Measured memory_bytes: 6400
def chance(x: int) -> int:
    return (x//2) ** 2 if x % 2 == 0 else ((x-1)//2) * ((x+1)//2)


# if __name__ == '__main__':
#     assert 2 == chance(3)
#     assert 9 == chance(6)
#     assert 30 == chance(11)
#     assert 625 == chance(50)

if __name__ == '__main__':
    x = int(input())
    print(chance(x))

Measured memory_bytes: 2940
#include <algorithm>
#include <functional>
#include <iostream>
#include <numeric>
#include <queue>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

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

using vll = vector<ll>;

void solve();

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

  solve();

  return 0;
}

#define ini(...)   \
  int __VA_ARGS__; \
  in(__VA_ARGS__)

#define inl(...)  \
  ll __VA_ARGS__; \
  in(__VA_ARGS__)

#define ins(...)      \
  string __VA_ARGS__; \
  in(__VA_ARGS__);

void in() {}
template <typename T, class... U>
void in(T& t, U&... u) {
  cin >> t;
  in(u...);
}

void out() {
  cout << endl;
}
template <typename T, class... U>
void out(const T& t, const U&... u) {
  cout << t;
  if (sizeof...(u))
    cout << " ";
  out(u...);
}

#define rep(i, n) for (long long i = 0; i < n; i++)

void solve();
#ifndef ONLINE_JUDGE
#include "./lib.hpp"
#endif

void solve() {
  ini(N, M);

  vll nums(N, 0);
  rep(i, M) {
    ll a, b;
    cin >> a >> b;
    nums[a - 1]++;
    nums[b - 1]++;
  }
  rep(i, N) out(nums[i]);
}


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

int main() {
  
  double X;
  cin >> X;
  
  int count=0;
  
  for(double i=X; i<10e5; i++){
    
    bool prime=true;
    
    for(int j=2; j<X; j++){
      int I = i/j;
      double D = i/j;
      
      if(I==D){
       prime=false;
        break;
      }
      
    }
    
    if(prime==true){
     cout << i << endl;
      break;
    }
    
  }
  
  cout << endl;
  
      
}


Measured memory_bytes: 256
from collections import Counter
import copy

def count(dic, key):
    ans = 0
    for i in key:
        d = dic[i]
        ans += d * (d - 1) // 2
    return(ans)

N = int(input())
A = list(map(int, input().split()))
a = dict(Counter(A))
k = list(a.keys())
m = count(a, k)
dic = {}
for i in k:
    dic[i] = m - a[i] + 1
for i in range(N):
    print(dic[A[i]])


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

namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {
            int a, b;
            string[] str = Console.ReadLine().Split(' ');
            a = int.Parse(str[0]);
            b = int.Parse(str[1]);
            if(a < 9 && b < 9)
            {
                Console.Write("Yay!");
            }
            else
            {
                Console.Write(":(");
            }
        }
    }
}


Measured memory_bytes: 11092
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <string.h>
#include <math.h>
#include <set>
#include <map>
using namespace std;

typedef long long ll;
typedef long double ld;
#define FOR(i,n,m) for(int i=n; i<m; i++)
#define ROF(i,n,m) for(int i=n; i>m; i--)
#define ri(a) scanf("%d",&a)
#define rii(a,b) ri(a),ri(b)
#define riii(a,b,c) rii(a,b),ri(c)
#define lri(a) scanf("%lld",&a)
#define lrii(a,b) lri(a),lri(b)
#define pb push_back
#define _1 first
#define _2 second

const int INF = 0x3f3f3f3f;
const ll INFLL = 1e18;
const int MOD = 1000000007;
const int alphabet = 26;
const int MAXINT = 2e5+1;

int a, b, c, k;

int main(){
    rii(a,b); rii(c,k);

    int ans = 0;
    ans += min(a,k);
    k -= min(a,k);
    k -= min(k,b);
    ans -= min(c,k);

    printf("%d\n", ans);
}

/*

*/  

Measured memory_bytes: 3228
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<n; i++)
#define rep1(i, n) for(int i=1; i<=n; i++)
#define repr(i, n) for(int i=n-1; i>=0; i--)
#define repr1(i, n) for(int i=n; i>=1; i--)
#define all(v) v.begin(),v.end()
using ll = long long;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = 1e9+7;
const double EPS = 1e-10;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main() {
    string S; cin >> S;
    int n = 0, w = 0, s = 0, e = 0;
    for (char c: S) {
        if (c == 'N') n++;
        if (c == 'W') w++;
        if (c == 'S') s++;
        if (c == 'E') e++;
    }

    bool ok = true;
    if (n > 0 && s == 0) ok = false;
    if (s > 0 && n == 0) ok = false;
    if (w > 0 && e == 0) ok = false;
    if (e > 0 && w == 0) ok = false;
    cout << (ok ? "Yes" : "No") << endl;
}


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

int main(){
  long n,m, sum=0,ans;
  cin >> n >> m;
  vector<long> a(m);
  for(long i = 0; i < m; i++)
    cin >> a.at(i);
  for(long i = 0; i < m; i++)
    sum += a.at(i);
  ans = n - sum;
  if(ans >=0)
    cout << ans << endl;
  else
    cout << "-1" << endl;
}

Measured memory_bytes: 3676
#include <iostream>
using namespace std;
#include<algorithm>
#define ll long long
#define rep(i, n) for (int i = 0; i < n; ++i)
 
int main() {
    string s;
    cin >> s;
    sort(s.begin(), s.end());
    if (s[0] == s[1] && s[1] != s[2] && s[2] == s[3]) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 3620
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<cstdio>
#include<sstream>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double EPS=1e-10;
const int inf=1e9;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
class SCC{//cmp(0 - kk-1) is scc's return. Same number is group. The number is no relatoin.
	public:
	int n;
	vvi G;
	vvi rG;
	vector<bool>used;
	vi vs;
	vi cmp;
	SCC(int size){
		n=size;
		G=rG=vvi(n);
		used=vector<bool>(n);
		cmp=vi(n);
		vs=vi(0);
	}
	void add_edge(int s,int t){
		G[s].pb(t);
		rG[t].pb(s);
	}
	void rdfs(int v,int k){
		used[v]=true;
		cmp[v]=k;
		rep(i,rG[v].size())if(!used[rG[v][i]])rdfs(rG[v][i],k);
	}
	void dfs(int v){
		used[v]=true;
		rep(i,G[v].size())if(!used[G[v][i]])dfs(G[v][i]);
		vs.pb(v);
	}
	int scc(){
		rep(i,n)used[i]=false;
		rep(v,n)if(!used[v])dfs(v);
		rep(i,n)used[i]=false;
		int kk=0;
		for(int i=vs.size()-1;i>=0;i--)if(!used[vs[i]])rdfs(vs[i],kk++);
		return kk;  
	}
};
int main(){
	int n,m;
	cin>>n>>m;
	SCC scc(n);
	while(m--){
		int a,b;
		cin>>a>>b;
		scc.add_edge(a,b);
	}
	scc.scc();
	int q;cin>>q;
	while(q--){
		int a,b;
		cin>>a>>b;
		if(scc.cmp[a]==scc.cmp[b])cout<<1<<endl;
		else cout<<0<<endl;
	}
}
 

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

using int32 = int_fast32_t;
using int64 = int_fast64_t;

const int32 INF = 1e9;
const int32 MOD = 1e9+7;
const int64 LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define ANS(n) cout << (n) << endl
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define ALL(obj) (obj).begin(),(obj).end()
#define pii pair<int32,int32>
#define pll pair<int64,int64>
#define pb(a) push_back(a)
#define mp make_pair

int main()
{
    int32 n,d,x;
    cin >> n >> d >> x;
    int32 ans = x;
    REP(i,n){
        int32 a;
        cin >> a;
        ans += (d-1) / a + 1;
    }
    ANS(ans);
    return 0;
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {

	void run() {
		try (Scanner sc = new Scanner(System.in)) {
			int n = sc.nextInt();
			long ww = sc.nextLong();
			long[] w = new long[n];
			long[] v = new long[n];
			List<Long>[] vs = new ArrayList[4];
			for (int i = 0; i < 4; i++) {
				vs[i] = new ArrayList<Long>();
			}

			for (int i = 0; i < n; i++) {
				w[i] = sc.nextLong();
				v[i] = sc.nextLong();
				vs[(int) (w[i] - w[0])].add(v[i]);
			}

			for (int i = 0; i < 4; i++) {
				Collections.sort(vs[i]);
				Collections.reverse(vs[i]);
			}

			long[][] vSum = new long[4][];
			for (int i = 0; i < 4; ++i) {
				vSum[i] = new long[vs[i].size() + 1];
				for (int j = 0; j < vs[i].size(); ++j) {
					vSum[i][j + 1] = vSum[i][j] + vs[i].get(j);
				}
			}

			long max = 0;
			for (int a = 0; a <= vs[0].size(); a++) {
				for (int b = 0; b <= vs[1].size(); b++) {
					for (int c = 0; c <= vs[2].size(); c++) {
						for (int d = 0; d <= vs[3].size(); d++) {
							long nSum = w[0] * a + (w[0] + 1) * b + (w[0] + 2) * c + (w[0] + 3) * d;
							if (nSum > ww) {
								continue;
							}

							max = Math.max(max, vSum[0][a] + vSum[1][b] + vSum[2][c] + vSum[3][d]);
						}
					}
				}
			}

			System.out.println(max);
		}
	}

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

}


Measured memory_bytes: 22612
#include <bits/stdc++.h>
using namespace std::literals::string_literals;
using i64 = long long;
using std::cout;
using std::endl;
using std::cin;

struct UnionFind {
	std::vector<int> data;
	
	UnionFind(int n) {
		data.assign(n, -1);
	}
	bool unite(int x, int y) {
		x = find(x); y = find(y);
		if(x == y) return false;
		if(data[x] > data[y]) std::swap(x, y);
		data[x] += data[y];
		data[y] = x;
		return true;
	}
	int find(int k) {
		if(data[k] < 0) return k;
		return find(data[k]);
	}
	int size(int k) {
		return -data[find(k)];
	}
	int size(int x, int y) {
		x = find(x); y = find(y);
		if(x == y) return size(x);
		return size(x) + size(y);
	}
	bool same(int x, int y) {
		return find(x) == find(y);
	}
};

int main() {
	int n, m, k; scanf("%d%d%d", &n, &m, &k);
	std::vector<int> c(n);
	for(int i = 0; i < n; i++) scanf("%d", &c[i]);
	std::vector<std::pair<i64, std::pair<int, int>>> vec;
	std::vector<std::vector<std::pair<int, int>>> g(n);
	for(int i = 0; i < m; i++) {
		int a, b, w; scanf("%d%d%d", &a, &b, &w);
		
		g[a - 1].push_back({b - 1, w});
		g[b - 1].push_back({a - 1, w});
		vec.push_back({w, {a - 1, b - 1}});
	}
	sort(begin(vec), end(vec));
	
	int K = 1, free = 0;
	std::vector<bool> used(n, false);
	for(int i = 0; i < n; i++) {
		if(used[i]) continue;
		
		int count = 0;
		std::set<int> st;
		std::function<void (int)> dfs = [&](int v) {
			if(used[v]) return; used[v] = true;
	
			if(c[v] == 0) count++;
			else st.insert(c[v]);
			for(auto e: g[v]) {
				dfs(e.first);
			}
		};
		dfs(i);
		K += st.size() + count - 1;
		free += count;
	}
	
	// cout << K << endl;
	if(K < k) {
		printf("-1\n");
		return 0;
	}
	
	i64 ans = 0, tmp = 0, count = 0;
	std::set<std::pair<int, int>> st;
	UnionFind uf(n + k + 2);
	used.assign(n + 1, false);
	for(auto v: vec) {
		int x = v.second.first, y = v.second.second;
		if(x == y) continue;
		int nx = c[x], ny = c[y];
		if(c[x] == 0) nx = x + k + 1;
		if(c[y] == 0) ny = y + k + 1;
		
		if(!c[x] and !c[y]) {
			if(uf.unite(nx, ny)) {
				ans += v.first;
				count++;
			}
			
			/*
			// cout << v.first << endl;
			if(!st.count({nx, ny})) {
				uf.unite(nx, ny);
				ans += v.first;
				count++;
			}
			st.insert({nx, ny});
			st.insert({ny, nx});
			*/
		} else if(uf.unite(nx, ny)) {
		//	cout << v.first << " " << x << " " << y << endl;
			ans += v.first;
			count++;
		}
		if(count == k - 1) break;
	}
	printf("%lld\n", ans);
	return 0;
}


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

int main(void) {
    string str;
    int A[8];
    int ans[8];
    long long max, min;
    long long x;
    int n;
    
    cin >> n;
    
    for(int i = 0; i < n; ++i) {
        max = 0;
        min = 0;
        x = 1;
        
        cin >> str;
        for(int j = 0; j < str.length(); ++j) {
            A[j] = str[j] - '0';
        }
        
        for(int k = 0; k < 7; ++k) {
            for(int l = k + 1; l < 8; ++l) {
                if(A[l] < A[k]) {
                    int copy = A[k];
                    A[k] = A[l];
                    A[l] = copy;
                }
            }
        }
        
        for(int j = 0; j < 8; ++j) {
            max += A[j] * x;
            min += A[7 - j] * x;
            x *= 10;
        }
        
        cout << max - min << endl;
    }
}


Measured memory_bytes: 3148
program sample
    implicit none
  
    integer(8) :: i,j,m,n,h,k
    integer(8),allocatable :: x(:),y(:)
  
    read(*,*) n,m
    if(n*m==1)then
        write(*,*)1
    elseif(n==1 .or. m==1)then
        write(*,*)n*m-2
        
    elseif(n==2 .or. m==2)then
        write(*,*) 0
    else
        write(*,*)(n-2)*(m-2)
    endif
  
    stop
end program sample
  



Measured memory_bytes: 2756
package main

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

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getInts(N int) []int {
	ret := make([]int, N)
	for i := 0; i < N; i++ {
		ret[i] = getInt()
	}
	return ret
}

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

// min, max, asub, absなど基本関数
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func asub(a, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

func abs(a int) int {
	if a >= 0 {
		return a

	}
	return -a
}

func lowerBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] >= x
	})
	return idx
}

func upperBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] > x
	})
	return idx
}

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer([]byte{}, 1000000)
	A, B := getInt(), getInt()

	ans := B
	if A >= 6 && A <= 12 {
		ans = B / 2
	}
	if A <= 5 {
		ans = 0
	}
	out(ans)
}


Measured memory_bytes: 1772
#include <stdio.h>
#include <string.h>
//?????????????????????????????????...?????????????????¬?????????????????????????????????????¶?????????????????????°https://kakusekyuu.jp ???600??????????????????????????????????????????
int main()
{
    int n;
    int i,j,k,t,a,b;
    int namenagasa,kanbannagasa;
    int cnt=0;
    char name[26],kanban[201] ;
    scanf("%d",&n);
    scanf("%s",name);
    namenagasa=strlen(name);
    for(i=0;i<n;i++){
        scanf("%s",kanban);
        kanbannagasa=strlen(kanban);
        for(j=0;j<kanbannagasa; j++){
            for(k=1;j+(namenagasa-1)*k<kanbannagasa;k++){
				a=0;
				b=0;
                for( t=0;t<namenagasa;t++){
                    if(kanban[j+t*k]!=name[t]){
						a=1;
						break;
				    }
                }
				if(a==0){
                	cnt++;
					b=1;
					break;
				}
		    }
			if(b==1){
				break;
			}
        }
    }
    printf("%d\n",cnt);
    return 0;
}

Measured memory_bytes: 600
#include<bits/stdc++.h>
using namespace std;
typedef vector<int> vint;
typedef vector<string> vstr;
int main(void){
	int N,ans;
	ans=0;
	cin>>N;
	vint l(N),r(N);
	for(int i=0;i<N;i++) {
		cin>>l[i]>>r[i];
		ans+=r[i]-l[i]+1;
	}
	cout<<ans<<endl;
 
}

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

int main () {
    long long N = 100;
    long long M;
    int  ans = 0;
    cin >> M;
    while (N < M)
    {
        N += floor(N * 0.01);
        ans += 1;
    }
    cout << ans << endl;
}


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

#define ll long long int
#define pi 3.141592653589793238
#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define mod 1000000007
ll dx[4]={0,0,1,-1};
ll dy[4]={-1,1,0,0};


void solve()
{
    string s,t;
    cin>>s>>t;
    int n=s.size();
    int m=t.size();
    int ans=m;
    for(int i=0;i<=n-m;i++)
    {
        int cnt=0;
        for(int j=0;j<m;j++)
        {
            // cout<<s[i+j]<<t[j]<<" ";
            if(s[i+j]!=t[j])
                cnt++;
        }
        // cout<<cnt<<endl;
        ans=min(ans,cnt);
    }
    cout<<ans;
    return;
}

int main()
{
	FAST;
    ll q;
    q=1;
    // cin>>q;
    while(q--)
        solve();
	return 0;
}

Measured memory_bytes: 3608
#include <stdio.h>
int main(void){
    // Your code here!
    int P,Q,R,max;
    scanf("%d %d %d", &P,&Q,&R);
    if(P>=Q)
    {
        if(P>=R)
        {
            max = P;
        }
        else
        {
            max = R;
        }
    }
    else
    {
        if(Q>=R)
        {
            max = Q;
        }
        else
        {
            max = R;
        }
    }
    printf("%d\n",P+Q+R-max);
}


Measured memory_bytes: 128
import sys
from math import ceil, floor, sqrt
from collections import deque, Counter, defaultdict
from fractions import gcd
from decimal import Decimal
input = lambda: sys.stdin.readline().rstrip()

def eprint(s):
    sys.stderr.write('DEBUG: {}'.format(s))
    return

def main():
    a,b,c = map(int, input().split())

    if Decimal(a).sqrt() + Decimal(b).sqrt() < Decimal(c).sqrt():
        print('Yes')
    else:
        print('No')    
    return

if __name__ == '__main__':
    main()

Measured memory_bytes: 5584
package main

import (
	"fmt"
)

func main() {
	var n [3]int
	var s = []int{5, 7, 5}

	for i:=0; i<3; i++ {
		fmt.Scan(&n[i])
	}

	for i:=0; i<3; i++ {
		for j:=0; j<len(s); j++ {
			if n[i] == s[j] {
				s = append(s[:j], s[j+1:]...)
				break
			}
		}
	}

	if len(s) == 0 {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define ll long long
#define sz(x) (int)(x).size()
using namespace std;
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
//uniform_int_distribution<int>(1000,10000)(rng)

ll binpow(ll a, ll b)
{
    if (b == 0)
        return 1;
    ll res = binpow(a, b / 2);
    res*=res;
    if (b % 2)
        return res * a;
    return res;
}

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

string to_upper(string a)
{
    for (int i=0;i<(int)a.size();++i) if (a[i]>='a' && a[i]<='z') a[i]-='a'-'A';
    return a;
}
 
string to_lower(string a)
{
    for (int i=0;i<(int)a.size();++i) if (a[i]>='A' && a[i]<='Z') a[i]+='a'-'A';
    return a;
}

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n,c=0;
    ll ans=0;
    cin>>n;
    int a[n];
    for (int i=0;i<n;++i)
        cin>>a[i];
    sort(a,a+n,greater<int>());
    vector<int> v;
    if (n==2)
    {
        cout<<a[0];
        return 0;
    }
    ans=a[0];
    v.push_back(a[1]);
    v.push_back(a[1]);
    for (int i=2;i<n;++i)
    {
        ans+=v[c];
        ++c;
        v.push_back(a[i]);
        v.push_back(a[i]);
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 6112
loop do
  h, w = gets.split.map(&:to_i)
  break if h == 0 && w == 0
 
  h.times do |i|
    if i == 0 || i == h - 1
      puts "#" * w
    else
      puts "#" + ("." * (w - 2)) + "#"
    end
  end
  puts
end

Measured memory_bytes: 8916
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <queue>
#include <map>
#include <algorithm>
#include <numeric>

typedef long long ll;
const ll INF = 1e18;

// Greatest Common Divisor
ll gcd(ll a, ll b)
{
  while (b != 0) {
    a = a % b;
    std::swap(a, b);
  }
  return a;
}

int main(int argc, char* argv[])
{
  ll A, B;
  std::cin >> A >> B;

  ll ans = (A-1) * (B-1);
  std::cout << ans << std::endl;

  return 0;
}


Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Pradyumn Agrawal coderbond007
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, FastReader in, PrintWriter out) {
            String s = in.nextString();
            out.println(s.charAt(0) + "" + (s.length() - 2) + "" + s.charAt(s.length() - 1));
        }

    }

    static class FastReader {
        private InputStream stream;
        private byte[] buf = new byte[8192];
        private int curChar;
        private int pnumChars;
        private FastReader.SpaceCharFilter filter;

        public FastReader(InputStream stream) {
            this.stream = stream;
        }

        private int pread() {
            if (pnumChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= pnumChars) {
                curChar = 0;
                try {
                    pnumChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (pnumChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public String nextString() {
            int c = pread();
            while (isSpaceChar(c))
                c = pread();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = pread();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        private boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        private static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        private interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}



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

using namespace std;

int main()
{
	string S;
	int K;
	cin >> K >> S;

	if (S.size() <= K) {
		cout << S << endl;
		return 0;
	}

	for (int i = 0; i < K; i++) {
		cout << S.at(i);
	}
	cout << "..." << endl;
	return 0;
}

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

int main(){
  long long A,B,K;
  cin >> A >> B >> K;
  
  if(K<A){
    cout << A-K << " " << B << endl;
  }
  else if(K>=A&&K<A+B){
    cout << 0 << " " << (A+B)-K << endl;
  }
  else if(K>=A+B){
    cout <<  0 << " " << 0 <<endl;
  }
}

Measured memory_bytes: 256
class BinaryTree {
  constructor(n) {
    this.nodes = [];
    for (let i = 0; i < n; i++) this.nodes[i] = {id: i + 1, parentId: -1, leftId: -1, rightId: -1}
  }

  get root() { return this.nodes.find(n => n.parentId === -1); }

  find(id) { return this.nodes[id - 1] || {}; }

  getByPostorder() {
    let res = [];
    const postorder = (id) => {
      if (id === -1) return;
      let n = this.find(id);
      postorder(n.leftId);
      postorder(n.rightId);
      res.push(id);
    };
    postorder(this.root.id);
    return res;
  }
}

(function main(){
  const lines = require('fs').readFileSync('/dev/stdin', 'utf8').trim().split('\n');
  const n = Number(lines.shift());
  const preOrder = lines.shift().split(' ').map(Number);
  const inOrder = lines.shift().split(' ').map(Number);

  let tree = makeTree(preOrder, inOrder);
  console.log(tree.getByPostorder().join(' '));
})();

function makeTree(preOrder, inOrder) {
  let tree = new BinaryTree(preOrder.length);
  const innerMakeTree = (p, i) => {
    let midId = p[0];
    let midIdx = i.indexOf(midId);
    if (midIdx === -1) return;
    if (midIdx > 0) {
      tree.find(midId).leftId = p[1];
      tree.find(p[1]).parentId = midId;
      innerMakeTree(p.slice(1, midIdx + 1), i.slice(0, midIdx))
    }
    if (midIdx < i.length - 1) {
      tree.find(midId).rightId = p[midIdx + 1];
      tree.find(p[midIdx + 1]).parentId = midId;
      innerMakeTree(p.slice(midIdx + 1), i.slice(midIdx + 1))
    }
  }
  innerMakeTree(preOrder, inOrder);
  return tree;
}



Measured memory_bytes: 15424
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <map>
#include <set>
using namespace std;
int n,a[100005],b[100005],fa[100005];
pair<int,int> c[100005],d[100005];
int find(int k){
	if(fa[k]!=k) fa[k]=find(fa[k]);
	return fa[k];
}
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%d",&a[i]),a[n+1]^=a[i];
	for(int i=1;i<=n;i++) scanf("%d",&b[i]),b[n+1]^=b[i];
	for(int i=1;i<=n+1;i++) c[i]=make_pair(a[i],i),d[i]=make_pair(b[i],i);
	sort(c+1,c+n+2);
	sort(d+1,d+n+2);
	for(int i=1,cnt=0;i<=n+1;i++){
		if(i==1||c[i].first!=c[i-1].first) cnt++;
		a[c[i].second]=cnt;
		b[d[i].second]=cnt;
		if(c[i].first!=d[i].first){
			puts("-1");return 0;
		}
	}
	int sum=0,t=0;
	for(int i=1;i<=n;i++) if(a[i]!=b[i]){
		int x=find(a[i]),y=find(b[i]);
		if(!x) fa[a[i]]=a[i],x=a[i];
		if(!y) fa[b[i]]=b[i],y=b[i];
		fa[x]=y;
		sum++;
		if(b[i]==a[n+1]&&i<=n) t=1;
	}
	if(!sum) return puts("0"),0;
	int ans=0;
	for(int i=1;i<=n+1;i++) if(find(i)==i) ans++;
	printf("%d",ans+sum-t);
	return 0;
}

Measured memory_bytes: 4480
#include <iostream>

 using namespace std;

int main()
{
   int i, h, m, s;
   cin >> i;
   h = i / 3600;
   m = i / 60 - (h * 60);
   s = i % 60;
   cout << h << ":" << m << ":" << s << endl;

   return 0;
}


Measured memory_bytes: 3088
#include <cstdio>
#include <cstdint>
#include <cmath>
#include <vector>
#include <algorithm>
#include <string>
#include <utility>

int main() {
  size_t n;
  scanf("%zu", &n);

  std::vector<std::pair<int, int>> xy(n);
  for (auto& p: xy)
    scanf("%d %d", &p.first, &p.second);

  std::sort(xy.begin(), xy.end());
  int div = 0;
  double sum = 0;
  do {
    double cur = 0;
    for (size_t i = 1; i < n; ++i) {
      double dx = xy[i].first - xy[i-1].first;
      double dy = xy[i].second - xy[i-1].second;
      cur += std::hypot(dx, dy);
    }
    sum += cur;
    ++div;
  } while (std::next_permutation(xy.begin(), xy.end()));
  printf("%.12f\n", sum / div);
}


Measured memory_bytes: 384
using System;
using System.Collections.Generic;
public class ABC139C {
    public static void Main() {
        int N, rightMax = 0, right = 0;
        N = int.Parse(Console.ReadLine());
        List<int> H = new List<int>();
        string[] str = Console.ReadLine().Split(' ');
        for (int i = 0; i < N; i++) {
            H.Add(int.Parse(str[i]));
        }
        for (int i = 0; i < N - 1; i++) {
            if (H[i] >= H[i + 1]) {
                right++;
                if (rightMax < right) rightMax = right;
            } else {
                right = 0;
            }
        }
        Console.WriteLine(rightMax);
    }
}


Measured memory_bytes: 25692
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define mt make_tuple
#define pqueue priority_queue
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  map<int, int> amap;
  amap[4]=1;
  amap[6]=1;
  amap[9]=1;
  amap[11]=1;
  amap[2]=2;
  int x, y;
  cin>>x>>y;
  if(amap[x]==amap[y]) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}


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

int main(){
  int n,m;
  cin>>m>>n;
  cout<<m*(m-1)/2+n*(n-1)/2<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 5;
#define ll long long
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	string n;
	cin >> n;
	ll ans = 0;
	for(int i = 0;i<int(n.size());++i) {
		ans += n[i] - '0';
	}
	cout << (ans%9==0?"Yes":"No") << endl;
}

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

using i32 = std::int_fast32_t;
using i64 = std::int_fast64_t;
template <typename T> constexpr T inf = numeric_limits<T>::has_infinity ? numeric_limits<T>::infinity() : numeric_limits<T>::max() / 4;

#define REP(i, stop) FOR(i, 0, stop)
#define FOR(i, start, stop) for (int i = start, i##_len = stop; i < i##_len; ++i)
#define RREP(i, n) for (int i = n; i-- > 0;)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define COMP(key) [](const auto& a, const auto& b) { return a.key < b.key; }

template<typename T, typename U> istream& operator>>(istream& is, pair<T, U>& a) { return is >> a.first >> a.second; }
template<typename T> istream& operator>>(istream& is, vector<T>& a) { for (T& x : a) is >> x; return is; }

void LOG(const int& x) { cerr << x << "\n"; }
template<typename T> void LOG(const vector<T>& a) { for (const T& x : a) cerr << x << " "; cerr << "\n"; }
template<typename T, std::size_t S> void LOG(const T (&a)[S]) { REP(i, S) cerr << a[i] << " "; cerr << "\n"; }
template<typename T, std::size_t S, std::size_t R> void LOG(const T (&a)[S][R]) { REP(i, S) { REP(j, R) cerr << a[i][j] << " "; cerr << "\n"; } }

i64 ceil(i64 a, i64 b) { return (a - 1) / b + 1; }
i64 gcd(i64 a, i64 b) { while (b != 0) { i64 t = b; b = a % b; a = t; } return a; }
i64 lcm(i64 a, i64 b) { return a / gcd(a, b) * b; }
i64 gcd(const vector<i64>& v) { return accumulate(ALL(v), 1LL, static_cast<i64(*)(i64, i64)>(gcd)); }
i64 lcm(const vector<i64>& v) { return v.empty() ? 0LL : accumulate(v.begin() + 1, v.end(), v[0], static_cast<i64(*)(i64, i64)>(lcm)); }
i64 pow(i64 x, i64 y, i64 z) { i64 a = 1; while (y > 0) { if (y & 1) a = a * x % z; x = x * x % z; y /= 2; } return a; }
i64 inv(i64 x, i64 m) { return pow(x, m - 2, m); }

struct InitCpp { InitCpp() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(10); } } initCpp;

const i64 INF = inf<i64>;
i64 C[310][310];
i64 D[310][310];
using P = pair<i64, i64>;
signed main() {
  i64 N, M, L;
  cin >> N >> M >> L;
  REP(i, N) {
    REP(j, N) {
      C[i][j] = INF;
      D[i][j] = INF;
    }
  }
  REP(_, M) {
    i64 a, b, c;
    cin >> a >> b >> c;
    a -= 1;
    b -= 1;
    C[a][b] = c;
    C[b][a] = c;
  }
  REP(k, N) {
    REP(i, N) {
      REP(j, N) {
        C[i][j] = min(C[i][j], C[i][k] + C[k][j]);
      }
    }
  }
  REP(i, N) {
    REP(j, N) {
      if (C[i][j] <= L) {
        D[i][j] = 1;
      }
    }
  }
  REP(k, N) {
    REP(i, N) {
      REP(j, N) {
        D[i][j] = min(D[i][j], D[i][k] + D[k][j]);
      }
    }
  }
  i64 Q;
  cin >> Q;
  REP(_, Q) {
    i64 s, t;
    cin >> s >> t;
    s -= 1;
    t -= 1;
    cout << (D[s][t] == INF ? -1 : D[s][t] - 1) << endl;
  }
}


Measured memory_bytes: 2048
#include <stdio.h>

void a(int);
void b();

int ro[8],co[8],dp[15],dn[15],A[8][8];

int main(){
  int i,j,k,r,c;

  for(i=0;i<8;i++){
    ro[i]=-1;
    co[i]=-1;
  }
  for(i=0;i<15;i++){
    dp[i]=-1;
    dn[i]=-1;
  }

  for(i=0;i<8;i++){
    for(j=0;j<8;j++){
      A[i][j]=-1;
    }
  }

  scanf("%d",&k);

  for(i=0;i<k;i++){
    scanf("%d%d",&r,&c);
    A[r][c]=1;
  }

  a(0);

  return 0;
}

void a(int i){
  int j;
  
  if(i==8){
    b();
    return;
  }

  for(j=0;j<8;j++){
    if(co[j]==1||dp[i+j]==1||dn[i-j+7]==1){
      continue;
    }
    ro[i]=j;
    co[j]=dp[i+j]=dn[i-j+7]=1;
    a(i+1);
    ro[i]=co[j]=dp[i+j]=dn[i-j+7]=-1;
  }

}

void b(){
  int i,j;

  for(i=0;i<8;i++){
    for(j=0;j<8;j++){
      if(A[i][j]==1){
	if(ro[i]!=j){
	  return;
	}
      }
    }
  }
  for(i=0;i<8;i++){
    for(j=0;j<8;j++){
      printf("%s",((ro[i]==j)?"Q":"."));
    }
    printf("\n");
  }
  
}


Measured memory_bytes: 2108
#include <stdio.h>
#include <limits.h>
#include <stdlib.h>

// Here we implement list in double linked list.

typedef struct _Node {
	int value;
	struct _Node *prev;
	struct _Node *next;
} Node;

typedef struct {
	Node *head;
	Node *cursor;
} List;

Node *createNode(int _value) {
	Node *node = (Node*)malloc(sizeof(Node));
	node->value = _value;
	node->prev = NULL;
	node->next = NULL;
	return node;
}

List *initList() {
	Node *end_node = createNode(INT_MAX);	// we set INT_MAX as the special element END
	List *list = (List*)malloc(sizeof(List));
	list->head = end_node;
	list->cursor = end_node;
	return list;
}

void disposeList(List *_list) {
	Node *tmp;
	if (_list != NULL) {
		for (tmp = _list->head; tmp != NULL; tmp = _list->head) {
			_list->head = tmp->next;
			free(tmp);
		}
	}
}

void insert(List *_list, int _x) {
	Node *new_node = createNode(_x);
	new_node->next = _list->cursor;
	if (_list->head == _list->cursor) {	// if cursor indicate the head
		_list->head = new_node;
	}
	else {
		new_node->prev = _list->cursor->prev;
		new_node->prev->next = new_node;
	}
	_list->cursor->prev = new_node;
	_list->cursor = new_node;
}

void move(List *_list, int _d) {
	if (_d > 0) {
		while (_d--) {
			_list->cursor = _list->cursor->next;
		}
	}
	else {
		while (_d++) {
			_list->cursor = _list->cursor->prev;
		}
	}
}

void erase(List *_list) {
	Node *tmp = _list->cursor;
	tmp->next->prev = tmp->prev;
	if (_list->head == _list->cursor) {
		_list->head = tmp->next;
	}
	else {
		tmp->prev->next = tmp->next;
	}
	_list->cursor = tmp->next;
	free(tmp);
}

void printList(List *_list) {
	Node *tmp = _list->head;
	while (tmp->value != INT_MAX) {
		printf("%d\n", tmp->value);
		tmp = tmp->next;
	}
}

int main() {
	int q;  // amount of queries
	int op; // number of operations
	int si; // the second input
	int i;  // index
	List *list = initList();
	scanf("%d", &q);
	for (i = 0; i != q; ++i) {
		scanf("%d", &op);
		switch (op) {
			case 0:
				scanf("%d", &si);
				insert(list, si);
				break;
			case 1:
				scanf("%d", &si);
				move(list, si);
				break;
			default:
				erase(list);
		}
	}
	printList(list);
	disposeList(list);
	return 0;
}


Measured memory_bytes: 17368
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bitset>
#include <list>
#include <stdexcept>
#include <functional>
#include <utility>
#include <ctime>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;;
#define MEM(a,b) memset((a),(b),sizeof(a))
const LL INF = 1e9 + 7;
const int N = 5e3 + 10;

int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	LL n, m;
	cin >> n >> m;
	if (abs(n - m) <= 1) puts("Brown");
	else puts("Alice");
	return 0;
}

Measured memory_bytes: 256