akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
using str = string;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
const double PI = 3.141592653589793238;
const ll mod = 1000000007;
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define REP(i, m, n) for (int i = m; i < (int)n; i++)
#define all(a) (a).begin(), (a).end()
#define allg(a) (a).begin(), (a).end(), greator<>()
#define d20 std::setprecision(20)
#define veci vector<int>
#define vecll vector<long long int>
#define vecd vector<double>
template <typename T>
T lcm(T a, T b)
{
	return a / __gcd(a, b) * b;
}
void comb(vector<vector<long long int>> &v)
{
	for (int i = 0; i < v.size(); i++)
	{
		v[i][0] = 1;
		v[i][i] = 1;
	}
	for (int k = 1; k < v.size(); k++)
	{
		for (int j = 1; j < k; j++)
		{
			v[k][j] = (v[k - 1][j - 1] + v[k - 1][j]);
		}
	}
}
bool is_not_out_of_range(size_t now, size_t max_num)
{
	return !(now < 0 || max_num <= now);
}
ll repeat_squaring(ll n, ll p, ll m)
{
	if (p == 0)
		return 1;
	if (p % 2 == 0)
	{
		ll t = repeat_squaring(n, p / 2, m);
		return t * t % m;
	}
	return n * repeat_squaring(n, p - 1, m);
}

int main()
{
	char a;
	cin >> a;
	bool is_ = false;
	switch (a)
	{
	case 'a':
	case 'e':
	case 'i':
	case 'o':
	case 'u':
		is_ = true;

	default:
		break;
	}
	cout << (is_ ? "vowel" : "consonant") << endl;
	return 0;
}

Measured memory_bytes: 256
// https://teratail.com/questions/282026
#include <bits/stdc++.h>
#include <math.h>
#define ALL(a)    a.begin(), a.end() 
#define rep(i, K, N)  for(long long int i = K; i < N; i++)
#define ll long long int
using namespace std;

int main(){
  ll N;cin >> N;
  vector<ll> V(N);
  vector<ll> A;
  
  rep(i, 0, N)cin >> V[i];
  
  sort(ALL(V));
  
  ll M = V[N - 1];
  // V.pop_back();
  
  for(auto v : V ){
  
    A.push_back(abs(M - v*2));
  }

auto Iter = min_element(ALL(A)) - A.begin();

cout << M << " " << V[Iter];

}

Measured memory_bytes: 5100
//#pragma GCC optimize ("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("avx,avx2,fma")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>
#define pb push_back
#define F first
#define S second
#define ins insert
//#define mp make_pair
#define fo(i, n1, n, x) for(int i = n1; i <= n; i += x)
#define foo(i, n, n1, x) for(int i = n; i >= n1; i -= x)
#define bit __builtin_popcount
#define md (l + ((r - l) / 2))
#define all(x) x.begin(),x.end()
#define eb emplace_back
#define ub upper_bound
#define lb lower_bound
#define ios ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define file(s) if (fopen(s".in", "r")) freopen(s".in", "r", stdin), freopen(s".out", "w", stdout)

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;


using ll = long long;

//#define int ll


const int N = 4e5 + 11, mod = 1e9 + 7, mod2 = 998244353;
const int MAX = 1e5 + 11;
const int INF1 = 2e9 + 11;
const ll INF2 = 2e18 + 11;
const double INF3 = 1e8 + 11;
const int base = 500;
const int P = 31;
const int dx[] = {1, -1, 0, 0, 1, 1, -1, -1};
const int dy[] = {0, 0, 1, -1, 1, -1, 1, -1};
const double EPS = 1e-4;
const double PI = acos(-1.0);


template<typename T> using ordered_set = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }


typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef vector <int> vi;
bool prime(int n) {
    for(int i=2;i<=sqrt(n);i++){
        if(n%i==0){return 0;}
    }return 1;}

//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int main() {
    ios;
    string s;
    cin >> s;
    deque<char> deq;
    for(int i = 0; i < s.size(); i ++) {
        deq.pb(s[i]);
    }
    bool f = 0;
    int qq;
    cin >> qq;
    while(qq --) {
        int t;
        cin >> t;
        if(t == 1) {
            f ^= t;
        }
        else {
            int p;
            char c;
            cin >> p >> c;
            if(f) {
                p = 3 - p;
            }

            if(p == 1) {
                deq.push_front(c);
            }
            else {
                deq.push_back(c);
            }
        }
    }
    if(!f) {
        while(!deq.empty()) {
            cout << deq.front();
            deq.pop_front();
        }
    }
    else {
        while(!deq.empty()) {
            cout << deq.back();
            deq.pop_back();
        }
    }
    return 0;
}


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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef tuple<int, int> duo;
const int dx[] = {0, 0, 1, -1, 1, 1, -1, -1};
const int dy[] = {1, -1, 0, 0, 1, -1, 1, -1};
const int Mod = 1000000000 + 0;
//{{{ templates
#define TT_ template<typename T>inline
#define TTF_ template<typename T,typename F>inline
TT_ T sq(T x){return x*x;}
TT_ T In(){T x;cin>>x;return x;}
TT_ void Out(T&x){cout<<x;}
TT_ void sort(T&v){sort(begin(v),end(v));}
TT_ void revs(T&v){reverse(begin(v),end(v));}
TT_ void uniq(T&v){sort(v);v.erase(unique(begin(v),end(v)),end(v));}
TT_ int ubnd(T&v,typename T::value_type x){return upper_bound(begin(v),end(v),x)-begin(v);}
TT_ int lbnd(T&v,typename T::value_type x){return lower_bound(begin(v),end(v),x)-begin(v);}
TTF_ void inpt(T&v,int n,F f){for(v.reserve(n);n--;v.emplace_back(f()));}
TTF_ void show(T&v,F f,string d=" ",string e="\n"){int i=0;for(auto&x:v)i++&&(cout<<d),f(x);cout<<e;}
TT_ typename T::iterator minel(T&v){return min_element(begin(v),end(v));}
TT_ typename T::iterator maxel(T&v){return max_element(begin(v),end(v));}

inline void fast_io(){ios::sync_with_stdio(0);cin.tie(0);}
inline int in(){int x;scanf("%d",&x);return x;}
inline ll pow_mod(ll a,ll k,ll m){ll r=1;for(;k>0;a=a*a%m,k>>=1)if(k&1)r=r*a%m;return r;}
inline ll mod_inv(ll a,ll p){return pow_mod(a,p-2,p);}
//}}} priority_queue queue deque front stringstream max_element min_element insert count make_tuple

template<int N>
struct Sieve {
  int F[N];
  vector<int> P;
  Sieve(){}
  void build(){
    iota(F, F + N, 0);
    for (int p = 2; p < N; ++p){
      if (F[p] == p) P.emplace_back(p);
      for (int i = 0; i < P.size() && P[i] <= F[p]; ++i){
        int tmp = P[i] * p;
        if (tmp >= N) break;
        F[tmp] = P[i];
      }
    }
  }
  int count(int l, int r){
    if (l) return count(0, r) - count(0, l);
    return lbnd(P, r);
  }
};

int main()
{
  Sieve<1000000> sieve;
  sieve.build();

  for (int n; ~scanf("%d", &n);){
    printf("%d\n", sieve.count(0, n + 1));
  }

  return 0;
}

Measured memory_bytes: 5492
#include <iostream>
#include <vector>
using namespace std;
int main(void){
    
    int d, g;
    cin >> d >> g;
    vector<int> p(d), pp(d), c(d);
    for(int i = 0; i < d; i ++) cin >> pp[i] >> c[i];
    
    int nummin = 223657141;
    int ub = 1 << d;    // 3 種類あるなら 000 ~ 111 を試せばよい
    for(int i = 0; i < ub; i ++){
        for(int i = 0; i < d; i ++) p[i] = pp[i];
        int n = i, score = 0, num = 0;
        for(int j = 0; j < d; j ++){
            // ボーナスを取る
            if(n % 2){
                num += p[j];
                score += (j+1)*100*p[j] + c[j];
                p[j] = 0;
            }
            n /= 2;
        }

        // あとはスコアを貪欲に取っていく
        if(score >= g) goto po; // は？
        for(int j = d-1; j >= 0; j --){
            while(p[j] > 0){
                if(score >= g) goto po; // は？
                num ++; p[j] --;
                score += (j+1)*100;
            }
        }
        // 足らんけど（これありえるのか？）
        continue;
po:
        if(nummin > num) nummin = num;
    }
    cout << nummin << "\n";
}


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

int main() {
   int N, M;
  cin >> N;
  
  map<string, int> mp;
  for(int i = 0; i < N; i++) {
    string S;
    cin >> S;
    mp[S]++;
  }
  
  cin >> M;
  for(int i = 0; i < M; i++) {
    string T;
    cin >> T;
    mp[T]--;
  }
   int res = 0;
  for(auto itr = mp.begin(); itr != mp.end(); ++itr) {
   res = max(res,  itr->second);
  }
  cout << res << endl;
  return 0;
  
    
}
    

Measured memory_bytes: 256
N=int(input())
h=list(map(int,input().split()))
INF=float('inf')
dp=[INF]*(N)
dp[0]=0
for i in range(1,N):
    dp[i]= min(dp[i-1]+abs(h[i]-h[i-1]),dp[i])
    if i > 1:
        dp[i]=min(dp[i],dp[i-2]+abs(h[i]-h[i-2]))
print(dp[-1])


Measured memory_bytes: 13928
#include<iostream>
#include<array>
#include<vector>
#include<string>
#include<cstring>
#include<set>
#include<unordered_set>
#include<map>
#include<unordered_map>
#include<queue>
#include<stack>
#include<deque>
#include<algorithm>
#include<cmath>
#include<climits>

using namespace std;
#define ll long long
#define ff first
#define ss second
#define e endl

void solve() {
	string a, b;
	cin >> a >> b;
	ll count = INT_MAX;
	for(ll i = 0;i < a.length() - b.length() + 1;i++){
		ll x = 0;
		for(ll j = 0;j < b.length();j++){
			if(a[i+j] != b[j]) x++;
		}
		count = min(count, x);
	}
	cout << count << endl;
}

int main()
{
	//ll t; cin >> t; while (t--)
	solve();
	
}

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

struct Card { char suit, value; };

void bubbleSort(struct Card C[], int N) {
  for (int i = 0; i < N; i++) {
    for (int j = N - 1; j >= i + 1; j--) {
      if (C[j].value < C[j - 1].value) {
        Card temp = C[j];
        C[j] = C[j - 1];
        C[j - 1] = temp;
      }
    }
  }
}

void selectionSort(struct Card C[], int N) {
  for (int i = 0; i < N; i++) {
    int minj = i;
    for (int j = i; j < N; j++) {
      if (C[j].value < C[minj].value) {
        minj = j;
      }
    }
    Card temp = C[i];
    C[i] = C[minj];
    C[minj] = temp;
  }
}

void print(struct Card C[], int N) {
  for (int i = 0; i < N; i++) {
    if (i > 0) cout << " ";
    cout << C[i].suit << C[i].value;
  }
  cout << endl;
}

bool isStable (struct Card C1[], struct Card C2[], int N) {
  for (int i = 0; i < N; i++) {
    if (C1[i].suit != C2[i].suit) {
      return false;
    }
  }
  return true;
}
  
  
int main() {
  Card C1[MAX], C2[MAX];
  int N;
  
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> C1[i].suit >> C1[i].value;
    C2[i] = C1[i];
  }

  bubbleSort(C1, N);
  selectionSort(C2, N);

  print(C1, N);
  cout << "Stable" << endl;
  print(C2, N);
  if (isStable(C1, C2, N)) {
    cout << "Stable" << endl;
  } else {
    cout << "Not stable" << endl;
  }

  return 0;
}

Measured memory_bytes: 3088
#include<bits/stdc++.h>
#define REP(x,y,z) for(int x=y;x<=z;x++)
#define MSET(x,y) memset(x,y,sizeof(x))
#define M 105
using namespace std;
int n,m,w[M],v[M];
long long dp[100005];
int main()
{
    scanf("%d %d",&n,&m);
    REP(i,1,n) scanf("%d %d", &w[i], &v[i]);
    
    MSET(dp, -1);
    dp[0] = 0;
    REP(i,1,n) for (int j=m; j>=w[i]; j--) {
        if (dp[j-w[i]] >= 0) {
            dp[j] = max(dp[j], dp[j-w[i]] + v[i]);
        }
    }
    printf("%lld\n", *max_element(dp, dp+m+1));
    return 0;
}



Measured memory_bytes: 4588
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>

using namespace std;

#define int long long
#define rep(i,n) for(int i = 0; i < (n); i++)
#define INF ((long long)1e18)
#define MOD ((int)1e9+7)
#define endl "\n"

#define yn(f) ((f)?"Yes":"No")
#define YN(f) ((f)?"YES":"NO")

#define MAX

signed main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);
	
	int H, W, h, w;
	
	cin>>H>>W>>h>>w;
	
	cout<<H*W-(W*h+H*w)+w*h<<endl;
	
	return 0;
}

Measured memory_bytes: 256
import itertools
N,M,Q=map(int, input().split())
abcd = [list(map(int, input().split())) for _ in range(Q)]
A=[]
ans=[]
for i in itertools.combinations_with_replacement(list(range(1,M+1)), N):
    A.append(i)
# print(A)
for i in A:
    ans_=0
    for j in abcd:
        if i[j[1]-1] - i[j[0]-1] == j[2]:
            ans_+=j[3]
    ans.append(ans_)
print(max(ans))

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

#define BUF_SIZE 300002
int main(void) {
  FILE *fp = stdin;
  char line[BUF_SIZE];
  if(!fgets(line, BUF_SIZE, fp)) return 0;
  int num;
  sscanf(line, "%d", &num);

  if(!fgets(line, BUF_SIZE, fp)) return 0;
  int cum_left[BUF_SIZE] = {0};
  int cum_right[BUF_SIZE] = {0};
  int i;
  // requires 'E' direction, so increment in case of 'W'
  for(i = 1; i < num; i++) {
    cum_left[i] = cum_left[i-1] + (line[i-1]=='W');
  }
  // requires 'W' direction, so increment in case of 'E'
  for(i = num-2; i >= 0; i--) {
    cum_right[i] = cum_right[i+1] + (line[i+1]=='E');
  }

  int min = BUF_SIZE;
  for(i = 0; i < num; i++) {
    int res = 0;
    res += cum_right[i] + cum_left[i];
    if(res < min) min = res;
  }

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

Measured memory_bytes: 2816
#include <bits/stdc++.h>
 #define f first
 #define s second
 #define endl '\n'
 #define LL long long
 #define pb push_back
 #define sz(a) (int)a.size()
 #define all(a) a.begin(),a.end()
 #define rall(a) a.rbegin(),a.rend()
 #define debug(x) cerr << #x << " is " << x << endl;
 using namespace std;
 int const MAXN = 2e6 + 9;
 int main(){
    ios_base::sync_with_stdio (0),cin.tie(0);
    int n;
    cin >> n;
    string a,b;
    cin >> a >> b;
    for (int i =0; i < n; i++) cout << a[i] << b[i];
 }


Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main()
{
	for (int a = 0; a == 0;)
	{
		int price;
		int oturi;
		int count = 0;
		cin >> price;

		oturi = 1000 - price;

		if (price != 0)
		{
			while (oturi > 0)
			{
				if (oturi >= 500)
				{
					count++;
					oturi -= 500;
				}
				else if (oturi >= 100)
				{
					count++;
					oturi -= 100;
				}
				else if (oturi >= 50)
				{
					count++;
					oturi -= 50;
				}
				else if (oturi >= 10)
				{
					count++;
					oturi -= 10;
				}
				else if (oturi >= 5)
				{
					count++;
					oturi -= 5;
				}
				else if (oturi >= 1)
				{
					count++;
					oturi -= 1;
				}
			}
			cout << count << endl;
		}
		else
		{
			break;
		}

	}
	
	return 0;
}

Measured memory_bytes: 1160
import itertools
import math
n = int(input())
p = [list(map(int, input().split())) for i in range(n)]
r = 0 
for l in itertools.permutations(p):
        for i in range(len(l)-1):
                r += math.sqrt((l[i][0] - l[i+1][0])**2 + (l[i][1] - l[i+1][1])**2)
print(r/math.factorial(n))

Measured memory_bytes: 3064
#ifndef ___Rank_Union_Find
#define ___Rank_Union_Find

#include <vector>

// ------ Class ------ //
class UnionFind {
private:
	unsigned size_; std::vector<unsigned> par, rank;
public:
	UnionFind() : size_(0), par(std::vector<unsigned>()), rank(std::vector<unsigned>()) {};
	UnionFind(unsigned size__) : size_(size__) {
		par.resize(size_); rank.resize(size_);
		for (unsigned i = 0; i < size_; i++) par[i] = i, rank[i] = 0;
	}
	unsigned size() { return size_; }
	unsigned root(unsigned x) { return par[x] == x ? x : par[x] = root(par[x]); }
	bool same(unsigned x, unsigned y) { return root(x) == root(y); }
	void unite(unsigned x, unsigned y) {
		x = root(x), y = root(y);
		if (x == y) return;
		if (rank[x] < rank[y]) par[x] = y;
		else if (rank[x] == rank[y]) par[y] = x, rank[x]++;
		else par[y] = x;
	}
	bool operator==(const UnionFind &u) { return par == u.par; }
	bool operator!=(const UnionFind &u) { return par != u.par; }
};

#endif

#include <map>
#include <cstdio>
#include <vector>
#pragma warning(disable : 4996)
using namespace std;
int N, K, L, p, q;
int main() {
	scanf("%d%d%d", &N, &K, &L);
	UnionFind uf1(N), uf2(N);
	for (int i = 0; i < K; i++) {
		scanf("%d%d", &p, &q); p--, q--;
		uf1.unite(p, q);
	}
	for (int i = 0; i < L; i++) {
		scanf("%d%d", &p, &q); p--, q--;
		uf2.unite(p, q);
	}
	map<pair<int, int>, int> cnt;
	for (int i = 0; i < N; i++) {
		cnt[make_pair(uf1.root(i), uf2.root(i))]++;
	}
	for (int i = 0; i < N; i++) {
		printf(i ? " %d" : "%d", cnt[make_pair(uf1.root(i), uf2.root(i))]);
	}
	printf("\n");
	return 0;
}

Measured memory_bytes: 15104
#include <algorithm>
#include <array>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#define REP(X, Y, Z) for (ll(X) = (Y); (X) < (Z); (X)++)
#define REV(X, Y, Z) for (ll(X) = (Y); (X) > (Z); (X)--)

using namespace std;
using ll = long long;
using dll = deque<ll>;
using pll = pair<ll, ll>;
using qll = queue<ll>;
using usll = unordered_set<ll>;
using umll = unordered_map<ll, ll>;
using sll = stack<int>;
using vll = vector<ll>;
using vvll = vector<vll>;

constexpr ll kMod = 1e9 + 7;

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

ll lcm(ll a, ll b) {
  return a / gcd(a, b) * b;
}

void init() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
}

int main() {
  init();

  ll N, P;
  cin >> N >> P;

  if (N == 1) {
    cout << P << endl;
  } else if (N >= 40) {
    cout << 1 << endl;
  } else {
    ll ans = 1;
    for (ll i = 1, j = 1; (j = pow(i, N)) <= P; ++i) {
      if (P % j == 0) {
        ans = i;
      }
    }
    cout << ans << endl;
  }

  return 0;
}


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

#define rep(X,N) for(ll X = 0; X < (N); X++)
#define PI (acos(-1.0))
#define pback push_back
#define mpair make_pair
#define MODN 1000000007
#define ALL(V) (V).begin(),(V).end()
#define INT_MAX_HALF (INT_MAX / 2)
#define EPS (1e-10)

using namespace std;
typedef long long ll;

int main(){

    string s;
    cin >> s;
    int size = s.size();

    vector<int> digit_mod13(size, 1);

    for(int i = 1; i < size; i++){
        digit_mod13[i] = digit_mod13[i - 1] * 10 % 13;
    }

    reverse(ALL(digit_mod13));

    int start_mod = 0;
    vector<int> q_index;

    rep(i, size){
        if(s[i] != '?'){
            start_mod = (start_mod + digit_mod13[i] * (s[i] - '0')) % 13;
        }else{
            q_index.pback(i);
        }
    }

    int qcount = q_index.size();

    vector<vector<int>> dp(qcount + 1, vector<int>(13));

    dp[0][start_mod] = 1;

    rep(i, qcount){
        int digit = q_index[i];
        int digit_mod = digit_mod13[digit];

        for(int j = 0; j < 13; j++){
            for(int k = 0; k <= 9; k++){

                dp[i + 1][(j + digit_mod * k) % 13] = (dp[i + 1][(j + digit_mod * k) % 13] + dp[i][j]) % MODN;

            }
        }
    }

    cout << dp[qcount][5] << endl;

    return 0;
}


Measured memory_bytes: 9720
#![allow(non_snake_case, unused)]
use std::cmp::*;
use std::collections::*;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        D: f64,
        T: f64,
        S: f64
    }
    if D / S <= T {
        println!("Yes");
    } else {
        println!("No");
    }
}


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

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

#mid = n//2 + n%2

#print(* range(10)[::2] )

ans = [0]*(n+1)

for _ in range(n):# 0 ... n-1
    i = n-_ # n ... 1

    ta = sum(ans[i::i])
    ans[i] = 0 if ta%2 == an[i-1] else 1

#    print(i, an[i-1::i])


m = sum(ans)
print(m)

if m > 0:
    print(*[i for i, x in enumerate(ans) if x >0])

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

int main(){
	int n;
	cin >> n;
	string s;
	cin >> s;
	int counts =0;
	rep(i,s.size()-2){
		if(s[i] == 'A' && s[i+1] == 'B' && s[i+2] == 'C') counts ++;
	} 
	cout << counts << endl;
}

Measured memory_bytes: 3548
#define _GLIBCXX_DEBUG//TLEの原因になるので注意！！！！！！！！！！！
#include<cmath>
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
vector<int> arr;
stack<int> st;
queue<int> qu;
queue<pair<int,int> > qu2;
priority_queue<int> pq;
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define rep2(i,n) for(int i=1; i<=(int)(n); i++)
#define mins(x,y) x=min(x,y)
#define maxs(x,y) x=max(x,y)
typedef set<int> set_t;
typedef set<string> set_g;
typedef complex<double> xy_t;
static const int NIL = -1;
static const int INF = 1000000007;
#define mp make_pair
#define sz(x) int(x.xise())
#define mod 1000000007
#define reps(i,s,n) for(int i = s; i < n; i++)
deque<int> deq;
//#define int long long

//cerrはコメントアウトしなくても通る//ただしTLEを引き起こすことがある

int a[100005];
int d[100005];
int used[100005];


int main(){
    int n;
    cin >> n;
    rep(i,n){
        cin >> a[i];
    }
    ll ans=1;
    rep(i,n){
        int num=a[i];
        if(num==0){
            if(d[0]==0){
                ans*=3;
            }else if(d[0]==1){
                ans*=2;
            }else if(d[0]==2){
                ans*=1;
            }else{
                cout<<0<<endl;
                return 0;
            }
            d[num]++;
            continue;
        }
        if(d[num-1]==0||d[num-1]>=4){
            cout<<0<<endl;
            return 0;
        }
        if(d[num-1]==1){
            ans*=1-used[num-1];
        }else if(d[num-1]==2){
            ans*=2-used[num-1];
        }else if(d[num-1]==3){
            ans*=3-used[num-1];
        }
        if(ans<0){
            cout<<0<<endl;
            return 0;
        }
        ans%=mod;
        used[num-1]++;
        d[num]++;
    }
    ans%=mod;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 1408
import sys

def propare():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    
    tokens = iterate_tokens()
    N = int(next(tokens))
    S = next(tokens)

    solve(N, S)

def solve(N: int, S: str):
    if N%2 == 0:
        half = int(N/2)
        s_first = S[:half]
        s_last = S[half:]
        if s_first == s_last:
            print('Yes')
        else:
            print('No')
    else: 
        print('No')

    return


 
if __name__ == "__main__":
    propare()

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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long int

using namespace __gnu_pbds;

typedef tree<pair<ll,pair<ll,ll> >, null_type, less<pair<ll,pair<ll,ll> > >, rb_tree_tag, tree_order_statistics_node_update>ordered_set;


#define me BOSS
#define bug() cout<<"AIkahne aise"<<endl
#define PI acos(-1)
#define mod 1000000007
/* Precode Start Here *\


power of 2 less than or equal to N

ll largest_power(ll N)
{
    //changing all right side bits to 1.
    N = N (N>>1);
    N = N| (N>>2);
    N = N| (N>>4);
    N = N| (N>>8);


//as now the number is 2 * x-1, where x is required answer, so adding 1 and dividing it by
 2.
            return (N+1)>>1;

}


     Sieve
void sieve()
{
    for(ll i=3; i<=2000; i+=2)
    {
        for(ll j=i*i; j<=4000000; j+=i)
            A[j]=1;
    }
    v.push_back(2);
    for(ll i=3; i<=4000000; i+=2)
        if(A[i]==0)
            v.push_back(i);
}

     Power Function Modulo P

ll modPow(ll a, ll x, ll p) {
    //calculates a^x mod p in logarithmic time.
    long res = 1;
    while(x > 0) {
        if( x % 2 != 0) {
            res = (res * a) % p;
        }
        a = (a * a) % p;
        x /= 2;
    }
    return res;
}


   factorial

ll fact(ll n)
{
    ll ans=1;
    for(ll i=1;i<=n;i++)
    {
        ans=(ans*i)%mod;
    }
    return ans;
}
     Calculating nCr using Fermats law Theorem

ll modInverse(ll a, ll p) {
    //calculates the modular multiplicative of a mod m.
    //(assuming p is prime).
    return modPow(a, p-2, p);
}


ll modBinomial(ll n, ll k, ll p) {
// calculates C(n,k) mod p (assuming p is prime).

    ll numerator = 1; // n * (n-1) * ... * (n-k+1)
    for (ll i=0; i<k; i++) {
        numerator = (numerator * (n-i) ) % p;
    }

    ll denominator = 1; // k!
    for (ll i=1; i<=k; i++) {
        denominator = (denominator * i) % p;
    }

    // numerator / denominator mod p.
    return ( numerator* modInverse(denominator,p) ) % p;
}
     num of divisor and euler totient

ll phi[1000001],mark[1000001],divi[1000001];;
void divisorPhi(ll n)
{
    for(int i=1;i<=n;i++)
        phi[i]=i;
    for(int i=2;i<=n;i++)
    {
        if(!mark[i])
        {
            for(int j=i;j<=n;j+=i)
            {
                mark[j]=1;
                phi[j]*=(1-1/(double)i);
            }
        }
    }
    for(ll i=1;i<=n;i++)
    {
        for(ll j=i;j<=n;j+=i)
            divi[j]++;
    }
}




/* Precode Ends */
ll A[5000001],B[5000001];
vector<ll>v;
map<ll,ll>myMap;
map<ll,ll>pen;
set<ll>mySet;
vector<pair<ll,ll> >vp;
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);

 ll n,m,score=0,penalty=0;
 cin>>n>>m;
 for(int i=0;i<m;i++)
 {
    ll num;
    string ver;
    cin>>num>>ver;
    if(myMap[num]==1)
    {
        continue;
    }
    else
    {
        if(ver=="AC")
        {
            myMap[num]=1;
        }
        else
            pen[num]++;
    }
 }
 for(int i=1;i<=n;i++)
 {
     if(myMap[i]==1)
     {
         score++;
         penalty+=pen[i];
     }
 }
 cout<<score<<" "<<penalty<<endl;
return 0;
}



Measured memory_bytes: 12800
#include <bits/stdc++.h>
    using namespace std;
     
    int main() {
      string N;
       cin >> N;
     
      for (int i=0; i< N.size(); i++) {
        if(i%2 == 0){
          if (N.at(i) == 'L') {
          cout << "No" << endl;
          return 0;
        }
        }
        
        else {
          if (N.at(i) == 'R') {
          cout << "No" << endl;
          return 0;
        }
        }
      }
        cout << "Yes" << endl;
        return 0;
      }

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

using namespace std;

inline int ctoi(char c) { if(c < '0' || '9' < c) throw invalid_argument("ctoi error"); return c - '0'; }
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, k, n) for(int i = (int)(k); i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()

template <typename T>
inline T gcd(T x, T y){
	if (x <= 0 || y <= 0) throw invalid_argument("gcd error: x <= 0 or y <= 0");
	
	if(x < y) swap(x, y);
	T r = x % y;

	while(r != 0){
		x = y;
		y = r;
		r = x % y;
	}

	return y;
}
template <typename T>
inline T lcm(T x, T y){
	if (x <= 0 || y <= 0) throw invalid_argument("lcm error: x <= 0 or y <= 0");

	return x * y / gcd(x, y);
}

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

	if(0 <= n && n <= 9){
		if(n == 3) cout << "bon";
		else if(n == 0 || n == 1 || n == 6 || n == 8) cout << "pon";
		else cout << "hon";
	}
	else if(10 <= n && n <= 99){
		n %= 10;
		
		if(n == 3) cout << "bon";
		else if(n == 0 || n == 1 || n == 6 || n == 8) cout << "pon";
		else cout << "hon";
	}
	else{
		n %= 100;
		n %= 10;
		
		if(n == 3) cout << "bon";
		else if(n == 0 || n == 1 || n == 6 || n == 8) cout << "pon";
		else cout << "hon";
	}

	return 0;
}

Measured memory_bytes: 3596
import numpy as np
N = int(input())
L = [int(x) for x in input().split(' ')]
myarray = np.array(L)
Lmax = np.max(myarray)
Lsum = np.sum(myarray) - Lmax
if Lmax < Lsum:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 21648
#include <algorithm>
#include <iostream>
#include <map>
using namespace std;

int a[100000];

int main() {
	int N; cin >> N;
	for (int i = 0; i < N; i++)
		cin >> a[i];

	map<int, int> mp;
	for (int i = 0; i < N; i++)
		mp[a[i]]++;

	int ans = 0;
	for (auto p: mp) {
		int x = p.first;
		int n = p.second;
		if (n < x) ans += n;
		else ans += n - x;
	}

	cout << ans << endl;
}

Measured memory_bytes: 5120
#include<bits/stdc++.h>
#define pb push_back
#define ll long long
#define ii pair<int,int>
#define st first
#define nd second
#define N 205
#define inf 1000000000
#define MOD 998244353
#define sz(x) ((int)x.size())
#define umax(x,y) x=max(x,y)
#define umin(x,y) x=min(x,y)
using namespace std;

int main(int arg,char* argv[]) {

	int n;

	cin>>n;

	vector<double> a(n);

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

	sort(a.begin(),a.end(),greater<double>());
	
	while(sz(a)>1) {

		double sum=0;

		for(int i=0;i<2;i++) {

			sum+=a.back();
			a.pop_back();

		}

		a.pb(sum/2);

	}

	cout<<fixed<<setprecision(15)<<a[0];

}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define ull unsigned long long
#define ll long long
const int w=2e5+5;
int a[w];
int main()
{
    int i,j;
    int n,k;
    cin>>n>>k;
    for(i=1;i<=n;i++)
        scanf("%d",&a[i]);
    sort(a+1,a+1+n);
    if(k>=n)
        puts("0");
    else
    {
        ll ans=0;
        for(i=1;i<=n-k;i++)
            ans+=a[i];
        cout<<ans<<endl;
    }
    return 0;
}


Measured memory_bytes: 1024
#include<cstdio>
#include<queue>
#include<utility>
#include<cstring>
#include<stack>
#include<algorithm>
#include<cmath>
#include<iostream>
#include<map>
#define MAX_N 100001
#define INF_INT 2147483647
#define INF_LL 9223372036854775807
#define REP(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> P;
int main()
{
  ll a[51],K,k,mo,d;
  REP(i,50){
    a[i] = i;
  }
  cin >> K;
  d = K/50;
  mo = K % 50;
  REP(i,50){
    a[i] += d;
  }
  REP(i,mo){
    a[49-i] += 1;
  }
  cout << 50 << endl;
  REP(i,50)
    cout << a[i] << endl;
  return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
ll mod=1e9+7;
#define endl '\n'
#define SIGMA 128
const ld PI=3.14159265358979;
#define fr(i,n) for(ll i=1;i<=(n);i++)
#define rep(i,k,n) for(ll i=k;i<=(n);i++)
#define w(x) int x;cin>>x;while(x--)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define ps(x,y) cout<<fixed<<setprecision(y)<<x<<endl
#define pb push_back
#define all(x) x.begin(),x.end()
#define vi vector<int>
#define vll vector<ll>
#define vvl vector<vll>
#define ppi pair<int,int>
#define ppl pair<ll,ll>
#define F first
#define S second 
#define LB lower_bound
#define UB upper_bound
#define mset multiset
#define uset unordered_set
#define umap unordered_map
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
ll binpow(ll x, ll y, ll p){  ll res = 1;x = x % p;if (x == 0)return 0;while (y > 0)  { if (y & 1) res = (res*x) % p; y = y>>1;x = (x*x) % p;}return res;}  
ll gcd(ll a, ll b){ if (b == 0) return a; return gcd(b, a % b); } 
bool parity(ll x,ll y){ bool f = ((x ^ y) < 0);return !f;}
string getBase(ll x,ll b){
    // returns number in reversed form
    //getBase(6,2) gives 011 AND NOT 110
    // make the sizes of returned strings equal before processing
    string ans;
    while(x){
        ans+=('0'+x%b);
        x/=b;
    }
    return ans;
}

string L,R;
ll d;
ll dp[10010][2][2][102];

ll cal(ll level,ll tlo,ll thi,ll rem)
{
    if(level>=R.size())
    {
        if(rem==0)
            return 1;
        return 0;
    }
    ll &ret=dp[level][tlo][thi][rem];
    if(ret!=-1)
        return ret;

    ret=0;

    ll diglo=0;
    ll dighi=9;
    if(tlo)
        diglo=L[level]-'0';
    if(thi)
        dighi=R[level]-'0';

    for(int i=diglo;i<=dighi;i++)
    {
        ll newlo=tlo;
        ll newhi=thi;
        if(i>L[level]-'0')
            newlo=0;
        if(i<R[level]-'0')
            newhi=0;
        
        ret+=cal(level+1,newlo,newhi,(rem+i)%d);
        ret%=mod;
    }
    return ret;
}

int main()
{
    // #ifndef ONLINE_JUDGE
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    // #endif

    IOS
    
    L="1";
    
    cin>>R;
    cin>>d;
    while (L.size()<R.size())
    {
        L+='0';
    }
    reverse(all(L));

    rep(i,0,10002)
        rep(j,0,1)
            rep(k,0,1)
                rep(kk,0,101)
                    dp[i][j][k][kk]=-1;

    cout<<cal(0,1,1,0)<<endl;
    

    return 0;  
}



Measured memory_bytes: 36480
def lcs(x,y):
    L=[]
    for chk in y:
        bg_i=0
        for i,chr_i in enumerate(L):
            cur_i=x.find(chk,bg_i)+1
            if not cur_i:
                break
            L[i]=min(cur_i,chr_i)
            bg_i=chr_i
        else:
            cur_i=x.find(chk,bg_i)+1
            if cur_i:
                L.append(cur_i)
    return len(L)

n=int(input())
ans=[]
for i in range(n):
    x=input()
    y=input()
    ans.append(lcs(x,y))
for i in ans:
    print(i)


Measured memory_bytes: 5616
import java.util.Scanner;


public class Main {
	int firstCheck(char c) {
		if (c == '(') return 1;
		if (c == '[') return 2;
		return 0;
	}
	int lastCheck(char c) {
		if (c == ')') return 1;
		if (c == ']') return 2;
		return 0;
	}
	void run() {
		Scanner scan = new Scanner(System.in);
		while (true) {
			String str = scan.nextLine();
			if (str.equals(".")) break;
			if (str.charAt(str.length() - 1) != '.') {
				do {
					str += scan.nextLine();
				} while(str.charAt(str.length() - 1) != '.');
			}
			char[] array = str.toCharArray();
			int[] brackets = new int[100];
			int lastindex = 0;
			boolean flag = false;
			for (int i = 0; i < array.length; i++) {
				int check = firstCheck(array[i]);
				if (check == 1 || check == 2) {
					brackets[lastindex] = check;
					lastindex++;
					continue;
				}
				check = lastCheck(array[i]);
				if (check == 1 || check == 2) {
					if (lastindex == 0) {
						flag = true;
						break;
					}
					if (brackets[lastindex - 1] == check) {
						brackets[lastindex - 1] = 0;
						lastindex--;
					} else {
						flag = true;
						break;
					}
				}
			}
			if (lastindex != 0) flag = true;
			if (flag) System.out.println("no");
			else System.out.println("yes");
		}
	}
	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 47528
#include<iostream>
using namespace std;
int main(){
    int x[5];
    int k;
    for(int i = 0; i < 5; ++i) cin >> x[i];
    cin >> k;
    if(x[4] - x[0] > k){
        cout << ":(" << endl;
    }
    else cout << "Yay!" << endl;
}


Measured memory_bytes: 256
/*
AizuOnline A0007
Debt Hell
*/
#include <stdio.h>
#include <float.h>
#include <math.h>

main()
{

  int i,weeks;
  float debt;

  debt = 100000.0;

  scanf("%ld",&weeks);
  
  for(i=0;i<weeks;i++)
    {       debt *=1.05;
            debt = 1000.0 * ceil(debt/1000.0);
    }

  printf("%ld\n",(long int)debt);

return(0);
}

Measured memory_bytes: 0
// She is Pretty pretty!
#include<bits/stdc++.h>
using namespace std;

#define ll long long
#define ff first
#define ss second
#define mp make_pair
#define pb push_back

const int N = 3e3+100;
ll dp[N][N];
int a[N], n;
int main()
{
    cin >> n;
    for(int i = 1; i <= n; i++){
        cin >> a[i];
    }
    for(int i = 1; i <= n; i++){
        for(int j = i ; j <= n; j++){
            int l = j - i + 1, r = j;
            dp[l][r] = max(a[l] - dp[l+1][r], a[r]-dp[l][r-1] );
        }
    }
    cout << dp[1][n] <<endl;
    return 0;
}

Measured memory_bytes: 73984
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <functional>
#include <utility>
#include <tuple>
#include <cctype>
using namespace std;
#define INF 0x3f3f3f3f
//#define INF 1100000000000000000LL
#define MOD 1000000007
#define mp make_pair
#define mt make_tuple
#define pb push_back
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
int dx[8] = { 0,0,-1,1,1,1,-1,-1 };
int dy[8] = { -1,1,0,0,1,-1,1,-1 };
const int SIZE = 100050;
//int arr[SIZE]={};
//ここまでテンプレ
int main() {
	int N,M;
	cin>>N>>M;
	vint node[SIZE];
	bool done[SIZE]={};
	int fa,fb;
	for(int i=0;i<M;i++){
		int a,b;
		cin>>a>>b;
		a--;b--;
		node[a].pb(b);
		node[b].pb(a);
		fa=a,fb=b;
	}
	done[fa]=1;done[fb]=1;
	bool flaga=0,flagb=0;
	deque<int> dq;
	dq.push_front(fa);
	dq.push_back(fb);
	while(!flaga || !flagb){
		flaga=1,flagb=1;
		int sa=node[fa].size();
		int sb=node[fb].size();
		for(int i=0;i<sa;i++){
			if(!done[node[fa][i]]){
				flaga=0;
				fa=node[fa][i];
				done[fa]=1;
				dq.push_front(fa);
				break;
			}
		}
		for(int i=0;i<sb;i++){
			if(!done[node[fb][i]]){
				flagb=0;
				fb=node[fb][i];
				done[fb]=1;
				dq.push_back(fb);
				break;
			}
		}
	}
	vint ans;
	for(int i:dq)
		ans.pb(i);
	int sz=ans.size();
	cout<<sz<<endl;
	for(int i=0;i<sz-1;i++)
		cout<<ans[i]+1<<" ";
	cout<<ans[sz-1]+1<<endl;
	return 0;
}

Measured memory_bytes: 7288
#include<bits/stdc++.h>
using namespace std;
int a[200001];
int main(){
	int i,n;
	scanf("%d",&n);
	for (i=1;i<=n;i++) scanf("%d",&a[i]);
	if (n&1){
		for (i=n;i>=1;i-=2) printf("%d ",a[i]);
		for (i=2;i<=n;i+=2) printf("%d ",a[i]);
	}
	else{
		for (i=n;i>=1;i-=2) printf("%d ",a[i]);
		for (i=1;i<=n;i+=2) printf("%d ",a[i]);
	}
	return 0;
}

Measured memory_bytes: 2944
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; (i) < (int)(n); ++ (i))
#define REP3(i, m, n) for (int i = (m); (i) < (int)(n); ++ (i))
#define REP_R(i, n) for (int i = (int)(n) - 1; (i) >= 0; -- (i))
#define REP3R(i, m, n) for (int i = (int)(n) - 1; (i) >= (int)(m); -- (i))
#define ALL(x) ::std::begin(x), ::std::end(x)
using namespace std;


int64_t solve(int N, vector<int64_t> & A) {
    // TODO: edit here
    long long TEN = 1;
    REP(_,18) TEN *= 10;
    sort(begin(A),end(A));
    __int128_t ans = 1;
    for(auto &x : A){
        ans *= x;
        if(ans > TEN) return -1;
    }
    return ans;
}

// generated by online-judge-template-generator v4.4.0 (https://github.com/kmyk/online-judge-template-generator)
int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    constexpr char endl = '\n';
    int N;
    cin >> N;
    vector<int64_t> A(N);
    REP (i, N) {
        cin >> A[i];
    }
    auto ans = solve(N, A);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3888
#pragma GCC optimize ("-O3")
#include <bits/stdc++.h>  
#include <complex>
#include <queue>
#include <set>
#include <unordered_set>
#include <list>
#include <chrono>
#include <random>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <stack>
#include <iomanip>
#include <fstream>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> p32;
typedef pair<ll,ll> p64;
typedef pair<double,double> pdd;
typedef vector<ll> v64;
typedef vector<ll> v32;
typedef vector<vector<ll> > vv32;
typedef vector<vector<ll> > vv64;
typedef vector<vector<p64> > vvp64;
typedef vector<p64> vp64;
typedef vector<p32> vp32;
ll MOD = 1e9+7;
#define forn(i,e) for(ll i = 0; i < e; i++)
#define forsn(i,s,e) for(ll i = s; i < e; i++)
#define rforn(i,s) for(ll i = s; i >= 0; i--)
#define rforsn(i,s,e) for(ll i = s; i >= e; i--)
#define ln "\n"
#define dbg(x) cout<<#x<<" = "<<x<<ln
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define INF 1e18
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((ll)(x).size())
#define vvv64 vector<vv32>
#define vvvv64 vector<vvv32>
void solve()
{
	int a,b;
	cin>>a>>b;
	cout<<6-a-b<<endl;
}   
 
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t=1;
    // cin>>t;
    while (t--)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 256
N,K = list(map(int, input().split()))
A = list(map(int, input().split()))
firstT = [-1] * N
firstT[0] = 0
now = 0
secondT, secondi = -1, -1
for i in range(1,N*2):
  now = A[now] - 1
  ## loopする前にKに到着した時
  if i == K:
    print(now+1)
    exit(0)
  if firstT[now] == -1:
    firstT[now] = i
  else:
    secondT = i
    secondi = now
    break

K = K - firstT[secondi]
K = K % (secondT - firstT[secondi])

#print(firstT)
#print(secondT, secondi)

now = secondi
for i in range(0,N):
  if i == K:
    print(now+1)
    exit(0)
  now = A[now] - 1

Measured memory_bytes: 32248
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
using P   = pair<ll, ll>;
using mat = vector<vector<ll>>;

void IOS() { ios::sync_with_stdio(false), cin.tie(0); }

const ll INF = 1e16;
const ll MOD = 1e9 + 7;
const ld EPS = 1e-12;

template <typename T> void dump(T x) { cout << x << endl; }
void dumpf(ld x, int t) { cout << setprecision(t) << fixed << x << endl; }
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
	fill((T *)array, (T *)(array + N), val);
}

inline ll mod(ll a, ll b) {
	if (a > 0) return a % b;
	if (a % b == 0) return 0;
	ll x = -a / b + 1;
	a += x * b;
	return a % b;
}

// ll dx[4] = {1, 0, -1, 0};
// ll dy[4] = {0, 1, 0, -1};

vector<P> g[1145141]; // to, cost
ll d[1145141];

signed main() {
	IOS();
	ll n, m;
	cin >> n >> m;
	set<P> s;
	s.insert(P(1, -1));
	s.insert(P(n, -1));
	vector<ll> p(m), q(m), r(m);
	for (int i = 0; i < m; i++) {
		cin >> p[i] >> q[i] >> r[i];
		s.insert(P(p[i], r[i]));
		s.insert(P(q[i], r[i]));
		s.insert(P(p[i], -1));
		s.insert(P(q[i], -1));
	}
	map<P, ll> mp; //組から点へ
	ll cnt = 0;
	for (auto it = s.begin(); it != s.end(); it++) {
		mp[*it] = cnt;
		cnt++;
	}

	ll start = mp[P(1, -1)], end = mp[P(n, -1)];

	for (int i = 0; i < m; i++) {
		ll a = mp[P(p[i], r[i])];
		ll b = mp[P(q[i], r[i])];
		ll c = mp[P(p[i], -1)];
		ll d = mp[P(q[i], -1)];
		g[a].push_back(P(b, 0));
		g[b].push_back(P(a, 0));
		g[a].push_back(P(c, 1));
		g[c].push_back(P(a, 0));
		g[b].push_back(P(d, 1));
		g[d].push_back(P(b, 0));
		if (p[i] == 1) g[start].push_back(P(a, 0));
		if (q[i] == 1) g[start].push_back(P(b, 0));
		if (p[i] == n) g[a].push_back(P(end, 1));
		if (p[i] == n) g[a].push_back(P(end, 1));
	}
	Fill(d, INF);
	d[start] = 0;
	deque<ll> que;
	que.push_back(start);
	while (!que.empty()) {
		ll x = que.front();
		que.pop_front();
		for (int i = 0; i < g[x].size(); i++) {
			int to   = g[x][i].first;
			int cost = g[x][i].second;
			if (d[to] > d[x] + cost) {
				if (cost)
					que.push_back(to);
				else
					que.push_front(to);
				d[to] = d[x] + cost;
			}
		}
	}
	dump(d[end] < INF ? d[end] : -1);
	return 0;
}

Measured memory_bytes: 131968
import math
import heapq
from collections import Counter

#N,K=map(int, input[].split())  #複数数値入力　「A B」みたいなスペース空いた入力のとき
#x=list(map(int, input[].split()))  #リスト入力 「a1 a2 a3 ...」みたいな配列のような入力のとき

N,M=map(int, input().split())  #複数数値入力　「A B」みたいなスペース空いた入力のとき


if N==1 or M==1:
    if N==1 and M==1:
        print('1')
    else:
        print(N*M-2)    
else:
    print((N-2)*(M-2))


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

void to_mcxi(int d, string &s)
{
    //cout << "d=" << d << endl;
    if (d/1000) {
        if (d/1000 != 1)
            s.push_back((char)(d/1000+ '0'));
        s.push_back('m');
        d%=1000;
    }
    if (d/100) {
        if (d/100 != 1)
            s.push_back((char)(d/100+ '0'));
        s.push_back('c');
        d%=100;
    }
    if (d/10) {
        if (d/10 != 1)
            s.push_back((char)(d/10+ '0'));
        s.push_back('x');
        d%=10;
    }
    if (d / 1) {
        if (d != 1)
            s.push_back((char)(d+ '0'));
        s.push_back('i');
    }

}
int to_digit(string s)
{
    int ret=0;
    int tmp = 1;

    for(auto c : s) {
        if (isalpha(c)) {
            switch(c) {
            case 'm':
                ret += tmp*1000;
                break;
            case 'c':
                ret += tmp*100; 
                break;
            case 'x':
                ret += tmp*10; 
                break;
            case 'i':
                ret += tmp*1; 
                break;
            default:
                cout << "!!!!!!!!" << endl;
                assert(false);
            }
            tmp = 1;
        }
        else {
            tmp = c-'0';
            //cout << "tmp=" << tmp << endl;
        }
    }
    //cout << "ret=" << ret << endl;
    return ret;
}
int main() {
    int n; cin >> n;
    vector<pair<string, string>> p(n);
    rep(i, n) {
        cin >> p.at(i).first >> p.at(i).second;
    }
    rep(i, n) {
        string s;
        to_mcxi(to_digit(p.at(i).first) + to_digit(p.at(i).second), s);
        cout << s << endl;
    }
}


Measured memory_bytes: 3272
#include <cstdio>
#include <cstring>

char ans3[4][4]={"aab","b.b","baa"};
char ans4[5][5]={"aacd","bbcd","dcaa","dcbb"};
char ans5[6][6]={"aabc.","..bcd","ccd.d","d.daa","dccbb"};
char ans6[7][7]={"a..bcc","a..bdd",".bccb.",".baab.","ddb..a","ccb..a"};
char ans7[8][8]={"aacd...","bbcd...","ccaab..","..b.bdd","..baacc","....cba","....cba"};

char s[1010][1010];

inline void paint3(int x){ for(int i=0;i<3;++i) for(int j=0;j<3;++j) s[x+i][x+j]=ans3[i][j]; }
inline void paint4(int x){ for(int i=0;i<4;++i) for(int j=0;j<4;++j) s[x+i][x+j]=ans4[i][j]; }
inline void paint5(int x){ for(int i=0;i<5;++i) for(int j=0;j<5;++j) s[x+i][x+j]=ans5[i][j]; }
inline void paint6(int x){ for(int i=0;i<6;++i) for(int j=0;j<6;++j) s[x+i][x+j]=ans6[i][j]; }
inline void paint7(int x){ for(int i=0;i<7;++i) for(int j=0;j<7;++j) s[x+i][x+j]=ans7[i][j]; }

int main(){
	int n; scanf("%d",&n); if(n==2){ puts("-1"); return 0; }
	for(int i=0;i<n;++i) for(int j=0;j<n;++j) s[i][j]='.';
	if(n%6==0){ for(int i=0;i<n/6;++i) paint6(6*i); }
	if(n%6==1){ for(int i=0;i<n/6-1;++i) paint6(6*i); paint7(n-7); }
	if(n%6==2){ for(int i=0;i<n/6-1;++i) paint6(6*i); paint4(n-8); paint4(n-4); }
	if(n%6==3){ for(int i=0;i<n/3;++i) paint3(3*i); }
	if(n%6==4){ for(int i=0;i<n/6;++i) paint6(6*i); paint4(n-4); }
	if(n%6==5){ for(int i=0;i<n/6;++i) paint6(6*i); paint5(n-5); }
	for(int i=0;i<n;++i){ for(int j=0;j<n;++j) printf("%c",s[i][j]); puts(""); }
	return 0;
}

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

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

using namespace std;

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

	int ans=0;
	rep(i,11){
		rep(j,5){
			int sum=0;
			rep(y,3) rep(x,3) sum+=7*(i+y)+(j+x+1);
			if(sum%11==k) ans++;
		}
	}
	ans*=(n-2)/11;
	rep(i,(n-2)%11){
		rep(j,5){
			int sum=0;
			rep(y,3) rep(x,3) sum+=7*(i+y)+(j+x+1);
			if(sum%11==k) ans++;
		}
	}
	printf("%d\n",ans);

	return 0;
}


Measured memory_bytes: 256