akhauriyash/Code-Regression huggingface dataset:
#!/usr/bin/python3
# coding: utf-8

# 整数 > 整数型
def I(): return int(input())

# 整数列 '1 2 3 4' > 整数型リスト
def IsIl(): return list(map(lambda x: int(x), input().split()))

# 改行挟む整数列　'1/n 2/n 3/n' > 整数型りすと
def InIl(n): return [input() for i in range(n)]

# 整数列 '1 2' > 整数型タプル
def IsIt(): return map(lambda x: int(x), input().split())

# 改行挟む整数列　'1\n 2\n 3\n' > 整数型たぷる
def InIl(n): return map(input() for i in range(n))

# 文字列 'abcd' > 文字型リスト
def SsSl(): return list(map(lambda x: x, input()))

# 整数 '1234' > 整数型リスト

# 文字列 'aba' > 辞書（文字型:個数）{'a':2,'b':1}
def SSd():
    from collections import defaultdict
    A = input() # [int(i) for i in input().split()]
    dd=defaultdict(int)
    for a in A:
        dd[a]+=1
    return dd

#リストにn個要素を読み込む

# その他アルゴリズムテンプレート
# https://qiita.com/chun1182/items/ddf2b6cba932b2bb0d4e


day = input()

day_lis = {'SUN':7,'MON':6,'TUE':5,'WED':4,'THU':3,'FRI':2,'SAT':1}

print(day_lis[day])


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define forn(i, a, b) for (int i = a; i < b; ++i)
#define SZ(x) int(x.size())
#define pb push_back
#define F first
#define S second
void dbg_out() { cerr << endl; }
template <typename Head, typename... Tail>
void dbg_out(Head H, Tail... T) {
  cerr << ' ' << H;
  dbg_out(T...);
}

const int N = 3 * 1e5 + 1;
int n, k;

typedef int T;
struct segtree {
  vector<T> st;
  int n;
  T neutro = 0;

  segtree(int p) {
    n = p;
    st.assign(n * 4, 0);
    build(1, 0, n - 1);
  }

  void build(int p, int L, int R) {
    if (L == R)
      st[p] = 0;
    else {
      int m = (L + R) / 2, l = p * 2, r = l + 1;
      build(l, L, m);
      build(r, m + 1, R);
      st[p] = max(st[l], st[r]);
    }
  }

  T query(int i, int j) { return query(1, 0, n - 1, i, j); }
  void upd(int i, int j, T val) { upd(1, 0, n - 1, i, j, val); }

  T query(int p, int L, int R, int i, int j) {
    if (i > R || j < L) return neutro;
    if (i <= L && j >= R) return st[p];
    int m = (L + R) / 2, l = p * 2, r = l + 1;
    T lf = query(l, L, m, i, j);
    T rg = query(r, m + 1, R, i, j);
    return max(lf, rg);
  }

  void upd(int p, int L, int R, int i, int j, T val) {
    if (i > R || j < L) return;
    if (i <= L && j >= R)
      st[p] = val;
    else {
      int m = (L + R) / 2, l = p * 2, r = l + 1;
      upd(l, L, m, i, j, val);
      upd(r, m + 1, R, i, j, val);
      st[p] = max(st[l], st[r]);
    }
  }
};

int main() {
#ifdef LOCAL
  freopen("d.txt", "r", stdin);
// freopen("main.txt", "w", stdout);
#define dbg(...) cerr << "(" << #__VA_ARGS__ << "):", dbg_out(__VA_ARGS__)
#else
  ios::sync_with_stdio(0);
  cin.tie(0);
#define endl '\n'
#define dbg(...) 18
#endif
  cin >> n >> k;
  int mx = 0;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    mx = max(mx, a[i]);
  }
  segtree st(mx + 1);
  for (int i = 0; i < n; i++) {
    st.upd(a[i], a[i], st.query(a[i] - k, a[i] + k) + 1);
  }
  cout << (st.query(0, mx)) << endl;
  return 0;
}

Measured memory_bytes: 9020
#include<stdio.h>

int main(void)
{
  int n,r,x;
  scanf("%d %d",&n,&r);
  if(n>=10) 
  {
    printf("%d",r);
  }
  else
  {
    x = 100 * (10 - n);
    x = r + x;
    printf("%d",x);
  }
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using PII = pair<int, int>;
using VI = vector<int>;

int main() {
#ifdef LOCAL_EXEC
//	freopen("sample.in", "r", stdin);
//	freopen("sample.out", "w", stdout);
#else
  ios_base::sync_with_stdio(false); cin.tie(NULL);
#endif

  int n, k; cin >> n >> k;
  vector<int> a(n);
  int sum = 0, ans = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    sum += a[i];
    if (i >= k) sum -= a[i - k];
    ans = max(ans, sum + k);
  }
  cout << (ans / 2) << '.' << ((ans % 2) * 5) << endl;

  return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod = 1000000007;

int main()
{
	int n;
	cin >> n;
	vector<int> x(n);
	for (int i = 0; i < n; i++) cin >> x[i];
	vector<int> y(x);
	sort(y.begin(), y.end());

	for (int i = 0; i < n; i++) {
		if (x[i] < y[n / 2]) cout << y[n / 2] << endl;
		else cout << y[n / 2 - 1] << endl;
	}
}

Measured memory_bytes: 3712
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <map>
#include <stack>
#include <string>
#include <list>
#include <queue>
#include <deque>
#include <math.h>
using namespace std;

typedef pair<int, int> P;
#define ll long long
#define int ll
#define INF (1LL<<60)
#define mod 1000000007
int dx[4] = { 0, 1, 0, -1 };
int dy[4] = { 1, 0, -1, 0 };

// 素数判定
bool isprime(ll  n){
	if (n < 2) return false;
	else if (n == 2) return true;
	else if (n % 2 == 0) return false;
	else
		for (int i = 3; i*i <= n; i++)
			if (n%i == 0) return false;

	return true;
}

// ax+by=1の解
ll extgcd(ll a, ll b, ll& x, ll& y){
	ll d = a;
	if (b != 0){
		d = extgcd(b, a%b, y, x);
		y -= (a / b)*x;
	}
	else{
		x = 1; y = 0;
	}
	return d;
}

// mod mでのaの逆数
ll mod_inverse(ll a, ll m){
	ll x, y;
	extgcd(a, m, x, y);
	return (m + x%m) % m;
}

// nの階乗 mod p
ll factorial(int n, int p){
	ll r = 1;
	for (int i = 1; i <= n; i++)
		r = (r*i) % p;
	return r;
}

// nPr
ll permutation(int n, int r){
	ll a = 1;
	for (int i = n - r + 1; i <= n; i++)
		a *= i;
	return a;
}

// nPr mod p
ll permutation(int n, int r, int p){
	ll a = 1;
	for (int i = n-r+1; i <= n; i++)
		a = (a*i) % p;
	return a;
}

// nCr mod p
ll combination(int n, int r, int p){
	if (r > n / 2) r = n - r;
	ll numerator = permutation(n, r, p);
	ll denominator = factorial(r, p) % p;
	ll inv = mod_inverse(denominator, p);
	return (numerator * inv) % p;
}

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

	if (isprime(M)) cout << N << endl;
	else{
		int result = 1;
		for (int i = 2;; i++){
			int power = 0;
			while (M>0 && M%i == 0){
				M /= i;
				power++;
			}
			if (power > 0){
				result *= combination(N + power - 1, power, mod);
				result = result % mod;
			}
			if (M == 1) break;
		}
		cout << result << endl;
	}

	return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
//#define DEBUG
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>

int printkigou(int, char);

int main(void) {
#ifdef DEBUG
	printf("");
#endif

	int N;
	int s;
	int sum=0;
	int i;
	int min=999;

	scanf("%d", &N);
	for (i = 0; i < N; i++) {
		scanf("%d", &s);
		sum += s;
		if (s % 10 != 0) {
			if (s < min) {
				min = s;
			}
		}
	}

	if (sum % 10 != 0) {
		printf("%d\n", sum);
	}
	else {
		if (min != 999) {
			printf("%d\n", sum - min);
		}
		else {
			printf("0\n");
		}
	}

	return 0;
}



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

struct node{
	unsigned int key;
	struct node *next;
	struct node *prev;
};

typedef struct node * NodePointer;

NodePointer nil;

NodePointer listSearch(int key){
	NodePointer cur = nil->next;
	while (cur != nil){
		if (key == cur->key){ return cur; }
		cur = cur->next;
	}
	return NULL;
}

void init(){
	nil = (NodePointer)malloc(sizeof(struct node));
	nil->next = nil;
	nil->prev = nil;
}

void printList(){
	NodePointer cur = nil->next;
	int isf = 1;
	while (1){
		if (cur == nil) break;
		if (isf == 0)  printf(" ");
		printf("%d", cur->key);
		cur = cur->next;
		isf = 0;
	}
	printf("\n");
}

void deleteNode(NodePointer t){
	t->prev->next = t->next;
	t->next->prev = t->prev;
	free(t);
}

void deleteFirst(){
	NodePointer t = nil->next;
	if (t == nil) return;
	deleteNode(t);
}

void deleteLast(){
	NodePointer t = nil->prev;
	if (t == nil) return;
	deleteNode(t);
}

void delete(int key){
	NodePointer t = listSearch(key);
	if (t != NULL){
		t->prev->next = t->next;
		t->next->prev = t->prev;
		free(t);
	}
}


void insert(int key){
	NodePointer x;
	x = (NodePointer)malloc(sizeof(struct node));
	x->key = key;

	x->next=nil->next;
	nil->next->prev = x;
	x->prev = nil;
	nil->next = x;
}

int main(){
	int key, n, i;
	int size = 0;
	char com[20];
	int np = 0, nd = 0;
	scanf("%d", &n);
	init();
	for (i = 0; i < n; i++){
		scanf("%s%d", com, &key);
		if (com[0] == 'i') { insert(key); np++; size++; }
		else if (com[0] == 'd') {
			if (strlen(com) > 6){
				if (com[6] == 'F') deleteFirst();
				else if (com[6] == 'L') deleteLast();
			}
			else {
				delete(key); nd++;
			}
			size--;
		}
	}

	printList();
	return 0;
}

Measured memory_bytes: 31788
import std.stdio;
import std.array;
import std.string;

string s, ans;

void main(){
	int n;
	readf("%d\n", &n);
	for (int i = 0; i < n; i++) {
		s = chomp(readln());
		if (s.length < 6) ans = "NA";
		else if (s[0..2] == ">'" && isA()) ans ="A";
		else if (s[0..2] == ">^" && isB()) ans = "B";
		else ans = "NA";
		writeln(ans);
	}
}

bool isA(){
	int pos = -1;
	for (int i = 0; i < s.length; i++) {
		if (s[i] == '#') {
			pos = i;
			break;
		}
	}
	return s[$-1] == '~' && pos != -1 && s[2..pos] == s[pos+1..$-1];
}

bool isB(){
	for (int i = 2; i < s.length-2; i+=2) {
		if (s[i..i+2] != "Q=") return false;
	}
	return s[$-2..$] == "~~";
}

Measured memory_bytes: 1036
#include <bits/stdc++.h>
 
#define se second
#define sz(x) (int)(x.size())
#define ll long long
#define rep(i,x,y) for(int i = x; i <= y; ++i)
#define repr(i,x,y) for(int i = x; i >= y; --i)
#define pb push_back
#define mp make_pair
#define fi first
#define ull unsigned ll
 
#define pi 3.14159265358979
 
using namespace std;
 
const int N = (int)(1e6) + 322;
const ll INF = 2e18 + 17;
const int inf = 2e9;
const int mod = 1000000007;
const double eps = 1e-9;
 
int gcd(int a, int b) { return b ? gcd (b, a % b) : a; }
 
int nbr_bits(int a){
	return log2(a)+1;
}
 
 
int binpow(int a, int n, int mod) {
    int res = 1;
    while (n) {
        if (n & 1) {
            res *= a;
            res %= mod;
        }
        a *= a;
        a %= mod;
        n >>= 1;
    }
    return res;
}

int fastpow(int a, int n, int mod) {
    if(n==0)
    	return 1;
    if(n%2==0){
    	int res = fastpow(a,n/2,mod);
    	res*=res;
    	res%=mod;
    	return res;
	}
	int res = (fastpow(a,n-1,mod)*a)%mod;
	return res;
    
}
 
// ---------------------------------------------------- 
 
signed main()
{

	int n, k;
	cin >> n >> k;
	int sum = n*3 + k;
	cout << sum / 2 << endl;
	return 0;
}
	

Measured memory_bytes: 3688
# include <iostream>
# include <algorithm>
# include <cmath>
# include <vector>
# include <string>
# include <set>
# include <queue>
# include <map>

using namespace std;

const long long N = 1e5 + 100;
long long n, a[N];
map < long long, long long > cnt;
set < long long > st;

int main()
{
    ios_base::sync_with_stdio( false );
    cin >> n;
    for( int i = 1; i <= n; i ++ ){
        cin >> a[i];
        cnt[ a[i] ] ++;
        st.insert( a[i] );
    }
    if( st.size() > 3 ){
        cout << "No";
        return 0;
    }
    if( st.size() == 3 ){
        long long x1 = *st.begin();
        st.erase( st.begin() );
        long long x2 = *st.begin();
        st.erase( st.begin() );
        long long x3 = *st.begin();
        st.erase( st.begin() );
        if( (x1 ^ x2) == x3 && cnt[x1] == cnt[x2] && cnt[x2] == cnt[x3] ){
            cout << "Yes";
        }else{
            cout << "No";
        }
        return 0;
    }if( st.size() == 2 ){
        long long x1 = *st.begin();
        st.erase( st.begin() );
        long long x2 = *st.begin();
        st.erase( st.begin() );
        if( x1 == 0 && cnt[x1] * 2 == cnt[x2] ){
            cout << "Yes";
        }else{
            cout << "No";
        }
        return 0;
    }if( st.size() == 1 ){
        long long x1 = *st.begin();
        st.erase( st.begin() );
        if( x1 == 0 ){
            cout << "Yes";
        }else{
            cout << "No";
        }
        return 0;
    }
    return 0;
}


Measured memory_bytes: 9344
/*
Author : Chandan Agrawal
College : Poornima College of Engg. jaipur, Raj
Mail : chandanagrawal23@gmail.com


" when you are not practicing someone else is ,
 and the day u meet them u will lose "

*/
#include<bits/stdc++.h>
#include<stdio.h>
using namespace std;

#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define MAX 200050

#define ll long long
#define ld long double
#define lli long long int

#define pb push_back
#define INF 1000000000000
#define mod 1000000007

// trignometric function always give value in Radians only
#define PI acos(-1) //3.1415926535897932384626433832795028
#define dsin(degree) sin(degree*(PI/180.0))
#define dcos(degree) cos(degree*(PI/180.0))
#define dtan(degree) tan(degree*(PI/180.0))

#define rsin(radian) sin(radian)
#define rcos(radian) cos(radian)
#define rtan(radian) tan(radian)

#define mem0(a) memset(a,0,sizeof(a))
#define mem1(a) memset(a,-1,sizeof(a))
#define memf(a) memset(a,false,sizeof(a))

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

#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define makeuniq(v) v.resize(unique(all(v)) - v.begin()); //only uniq element in vector after this
#define sz(x) int(x.size())
#define F first
#define S second

#define mii map<lli,lli>

#define pii pair<lli,lli>

#define vi vector<lli>
#define vvi vector<vi>
#define vpi vector<pii>
#define vbool vector<bool>

#define seti set<lli>

#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) (a/gcd(a,b))*b
#define abs(x) ((x < 0)?-(x):x)

#define endl '\n'

template <typename T>
void print(T x){cout<<x<<endl;}
template <typename T1, typename T2>
void print2(T1 x,T2 y){cout<<x<<" "<<y<<endl;}
template <typename T1, typename T2,typename T3>
void print3(T1 x, T2 y,T3 z){cout<<x<<" "<<y<<" "<<z<<endl;}

#define scanarr(a,n) for(lli i=0;i<n;i++)    cin>>a[i];
#define scanvec(a,n) for(lli i=0;i<n;i++){ lli x ; cin>>x; a.pb(x);}

#define printarr(a,n) for(lli i=0;i<n;i++)   cout<<a[i]<<" "; cout<<endl;
#define printvec(vec) for(auto xt : vec) cout<<xt<<" ";    cout<<"\n";

#define FD(N) fixed<<setprecision(N)

#define deb(x) cout<<#x<<" "<<x<<endl;

/*
1D vector -  vi dp(n,value);
2D vector -  vvi dp(n,vi(n,value));
*/

// chandan1,2
void chandan1(){int y=1;return;}
void chandan2(){
        loop(i,10){
        lli x=1;
    }
    return(chandan1());
}


int main(){
fastio
lli t=1;
//cin>>t;
chandan2();
while(t--) {
    string s;
    cin>>s;
    lli sum=0;
    for(auto xt :s)
    {
        sum  = (sum%9 + (xt-'0')%9)%9;
    }
    if(sum==0)
        print("Yes");
    else
        print("No");
  }
return 0;
}


Measured memory_bytes: 3804
x_1,y_1,x_2,y_2=map(int,input().split())

x_4=x_1-y_2+y_1
y_4=y_1+x_2-x_1

x_3=x_2-y_2+y_1
y_3=y_2+x_2-x_1

print(x_3,y_3,x_4,y_4)

Measured memory_bytes: 9036
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <numeric>
#include <iomanip>
#include <map>
#include <set>
#include <deque>
#include <utility>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repk(i, k, n) for (int i = k; i < n; i++)
#define MOD 1e9 + 7
#define INF 1e9
#define SENTINEL 2e9
#define PIE 3.14159265358979323

template <class T>
inline bool chmin(T &a, T b){if (a > b){a = b;return true;}return false;}
template <class T>
inline bool chmax(T &a, T b){if (a < b){a = b;return true;}return false;}
template <class T>
inline T GCD(T a, T b){if (b == 0) return a; else return GCD(b, a % b);}
template <class T>
inline T LCM(T a, T b) {return (a * b) / GCD(a, b);}

void ans(bool flag){
    if (flag)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

int main(){
    int a, b;
    string s;
    cin >> a >> s >> b;
    if (s=="+")
        cout << a + b << endl;
        else
            cout << a - b << endl;
}


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

using ld = long double;
using vld = std::vector<ld>;
using vvld = std::vector<vld>;
using vvvld = std::vector<vvld>;
using ll = long long;
using vll = std::vector<ll>;
using vvll = std::vector<vll>;
using vvvll = std::vector<vvll>;
using pll = std::pair<ll, ll>;
using vpll = std::vector<pll>;
using str = std::string;
using vstr = std::vector<str>;

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

constexpr ld PI = 3.141592653589793L;
constexpr ld EPS = std::numeric_limits<ld>::epsilon();

ll gcd(ll n, ll m) { return m ? gcd(m, n % m) : n; }
ll lcm(ll n, ll m) { return n / gcd(n, m) * m; }
bool isprime(ll n) {
    if (n < 2) return false;
    for (ll i = 2; i * i <= n; i++)
        if (n % i == 0) return false;
    return true;
}
vll sieve(ll n) {
    str flg(n + 1, '1');
    for (ll i = 2; i * i <= n; i++) {
        if (flg[i] == '0') continue;
        for (ll j = i * i; j <= n; j += i)
            flg[j] = '0';
    }
    vll res;
    for (ll i = 2; i <= n; i++)
        if (flg[i] == '1') res.push_back(i);
    return res;
}
ll rpow(ll x, ll n) {
    if (n == 0) return 1;
    ll k = 1;
    for (; n > 1; n /= 2) {
        if (n & 1) k *= x;
        x *= x;
    }
    return k * x;
}
ll modpow(ll x, ll n, ll mod) {
    if (n == 0) return 1;
    ll k = 1;
    for (; n > 1; n /= 2) {
        if (n & 1) (k *= x) %= mod;
        (x *= x) %= mod;
    }
    return k * x % mod;
}
ll modcomb(ll n, ll r, ll mod) {
    if (r < 0 || n < r) return 0;
    chmin(n - r, r);
    ll mul = 1, div = 1;
    for (ll i = 0; i < r; i++) {
        (mul *= n - i) %= mod;
        (div *= i + 1) %= mod;
    }
    return mul * modpow(div, mod - 2, mod) % mod;
}

/*----------------------------------------------------------------*/

void solve();

int main() {
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    std::cout << std::setprecision(15);

    solve();
}
void solve() {
    ll a, b;
    std::cin >> a >> b;

    ll ans = 0;
    for (ll i = a; i <= b; i++) {
        str s = std::to_string(i);
        ans += s == str(s.rbegin(), s.rend());
    }

    std::cout << ans << '\n';
}


Measured memory_bytes: 3724
K = int(input())
lis = []

lis = []
def search(s):
  lis.append(s)
  
  if int(s) > 3234566667:
    return
  
  it = int(s[-1])
  if it == 0:
    search(s + '0')
    search(s + '1')
  elif it == 9:
    search(s + '8')
    search(s + '9')
  else:
    search(s + str(it - 1))
    search(s + str(it))
    search(s + str(it + 1))
  

for i in range(1, 10):
  search(str(i))

x = list(map(int, lis))
x.sort()
print(x[K-1])

Measured memory_bytes: 104172
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
using str = string;
using ll = long long;
using vi = vector<int>;
using vii = vector<vi>;
using vc = vector<char>;
using vcc = vector<vc>;
 
int main() {
    int H, W;
    cin >> H >> W;
    vcc C(H, vc(W));
    for(int i = 0; i < H; i++) {
        for(int j = 0; j < W; j++) {
            cin >> C[i][j];
        }
    }
    for(int i = 0; i < H; i++) {
        for(int j = 0; j < W; j++) {
            cout << C[i][j];
        }
        cout << endl;
        for(int j = 0; j < W; j++) {
            cout << C[i][j];
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 256
x1,y1,x2,y2=map(int,input().split())

Ly=y2-y1
Lx=x2-x1

x3=x2-Ly
x4=x1-Ly

y3=y2+Lx
y4=y1+Lx

print(x3,y3,x4,y4)


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

using namespace std;

int n;
unordered_map<int, vector<int>> edge;
vector<int> visited;
set<pair<int, int>> used;

bool filled() {
  for (int i = 1; i <= n; ++i) {
    if (visited[i] == 0) return false;
  }
  return true;
}

void dfs(int from, function<void()> f) {
  visited[from] = 1;
  if (filled()) {
    f();
  }
  for (auto &e : edge[from]) {
    if (visited[e] == 1)
      continue;
    used.insert(make_pair(from, e));
    dfs(e, f);
    used.erase(make_pair(from, e));
  }
  visited[from] = 0;
}

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

  int m;
  cin >> n >> m;
  for (int i = 0; i < m; ++i) {
    int from, to;
    cin >> from >> to;
    edge[from].push_back(to);
    edge[to].push_back(from);
  }

  int ans = 0;
  set<set<pair<int, int>>> pattern;
  visited.resize(n + 1);
  for (auto &e : visited) {
    e = 0;
  }
  used.clear();
  dfs(1, [&]() {
      set<pair<int, int>> p;
      for (auto& e : used) {
        if (e.first < e.second) {
          p.insert(make_pair(e.first, e.second));
          // cout << e.first << "->" << e.second << ", ";
        } else {
          p.insert(make_pair(e.second, e.first));
          // cout << e.second << "->" << e.first << ", ";
        }
      }
      pattern.insert(p);
      cout << "\n";
    });
  cout << pattern.size() << "\n";
}


Measured memory_bytes: 2432
#include <cstdio>
#include <algorithm>

using namespace std;

int main() {
	long long a, b, c, ans;
	scanf("%lld%lld%lld", &a, &b, &c);
	if(a % 2 and b % 2 and c % 2) {
		ans = min(a * b, min(a * c, b * c));
	}
	else ans = 0;
	printf("%lld\n", ans);
}


Measured memory_bytes: 128
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<set>
#define lol(i,n) for(ll i=0;i<n;i++)
#define mod 1000000007
typedef long long ll;

using namespace std;
vector<ll> n;
vector<ll> add(ll x){
  vector<ll> r=n;
  r[0]+=x;
  for(int i=0;i<n.size();i++){
    ll val=r[i];
    if(i+1==r.size()&&val/10)r.push_back(val/10);
    else r[i+1]+=val/10;
    r[i]=val%10;
    x/=10;
  }
  return r;
}
bool BN(ll x){
  vector<ll> r=add(x);
  ll sum=0;
  for(int i=0;i<r.size();i++)sum+=(r[i]);
  bool res=x>=sum;
  res&=(x-sum)%9==0;
  return res;
}
int main(){
  string s;cin>>s;
  for(int i=0;i<s.size();i++)n.push_back(s[i]-'0');
  reverse(n.begin(),n.end());
  ll kuri=0;
  for(int i=0;i<n.size();i++){
    int val=n[i];
    val=val*9+kuri; kuri=val/10;
    if(i+1==n.size()&&kuri)n.push_back(0);
    n[i]=val%10;
  }
  
  ll l=0,r=1e8,m;
  while(l<r-1){
    m=(l+r)/2;
    if(BN(m))r=m;
    else l=m;
  }
  cout<<(r+8)/9<<endl;
    return 0;
}


Measured memory_bytes: 16440
#include<bits/stdc++.h>
 using namespace std;
 int main(){
 	long long n,k;
 	cin>>n>>k;
 	map<int,int>ma;
 	for(int i=1;i<=n;i++){
 		int x;
 		cin>>x;
 		ma[x]++;
 	}
 	vector<int>vec;
 	long long ans=0,count=0;
 	for(auto i:ma){
    vec.push_back(i.second);      
  }
  sort(vec.rbegin(),vec.rend());
   while(vec.size()>k){
   	ans+=vec.back();
   	vec.pop_back();
   }
cout<<ans<<"\n";
 	return 0;
 }

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

int main(){
	int     a,b,c,d   ;
	cin>>  a>>b>>c>>d    ;
	cout <<   (a+b+c+d)/60 << '\n' << (a+b+c+d)%60  <<endl;
	return 0;
}


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

using namespace std;
int n;
int main(){
    cin >> n;
    string s[n];
    int cnt[5];
    cnt[0]=0;
    cnt[1]=0;
    cnt[2]=0;
    cnt[3]=0;
    for(int i = 0;i < n;i++ ){
        cin >> s[i];
        if(s[i] == "AC")cnt[0]++;
        if(s[i] == "WA")cnt[1]++;
        if(s[i] == "TLE")cnt[2]++;
        if(s[i] == "RE")cnt[3]++;  
    }

    cout <<"AC x " << cnt[0] << endl;
    cout <<"WA x " << cnt[1] << endl;
    cout <<"TLE x " << cnt[2] << endl;
    cout <<"RE x " << cnt[3] << endl;
    }

Measured memory_bytes: 6716
#include <bits/stdc++.h>
#define rep(i, l, r) for (__typeof(l) i = (l); i <= (r); ++i)
#define per(i, r, l) for (__typeof(r) i = (r); i >= (l); --i)
using namespace std;
typedef long long ll;
const int mod = 998244353;
int read() {
	int f = 1, x = 0; char ch = getchar(); while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = getchar(); }
	while (ch >= '0' && ch <= '9') { x = x * 10 + ch - '0'; ch = getchar(); } return f * x;
}
int qpow(int a, int b) { int res = 1; while (b) { if (b & 1) res = (ll)res * a % mod; a = (ll)a * a % mod; b >>= 1; } return res; }

const int N = 2020;
int n, x, y, dis[N], ans[N];
vector <int> g[N];
void bfs(int s) {
	queue <int> q;
	memset(dis, 0x3f, sizeof(dis));
	dis[s] = 0;
	q.push(s);
	while (!q.empty()) {
		int u = q.front();
		q.pop();
		for (int i = 0; i < g[u].size(); ++i) {
			int v = g[u][i];
			if (dis[v] == dis[0]) {
				dis[v] = dis[u] + 1;
				q.push(v);
			}
		}
	}
}
int main() {
	scanf ("%d%d%d", &n, &x, &y);
	for (int i = 1; i < n; ++i) g[i].push_back(i + 1), g[i + 1].push_back(i);
	g[x].push_back(y), g[y].push_back(x);
	for (int i = 1; i <= n; ++i) {
		bfs(i);
		for (int j = 1; j <= n; ++j) ++ans[dis[j]];
	}
	for (int k = 1; k <= n - 1; ++k) printf("%d\n", ans[k] / 2);
	return 0;
}


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

using namespace std;

int main()
{
   int N, D, X;
   int A[N + 1];
   cin >> N >> D >> X;
   int temp;
   int contador = 0;
   for(int i = 1; i <= N; ++i){
    cin >> temp;
    contador += ceil((float)D/temp);
   }
   
   cout << contador + X << endl;


}


Measured memory_bytes: 3612
t=input()
s = list(t)

# maemozi=''
# for i in range(len(t)):
#     if s[i]=='?':
#         if maemozi=='P':
#             s[i]='D'
#         else:
#             if i==len(t)-1:
#                 s[i]='D'
#             elif i==0:
#                 if s[i+1]=='D'or s[i+1]=='?':
#                     s[i]='P'
#                 else:
#                     s[i]='D'
#             else:
#                 if s[i+1]=='P':
#                     s[i]='D'
#                 else:
#                     s[i]='P'
#     maemozi=s[i]
for i in range(len(t)):
    if s[i]=='?':
        s[i]='D'

print("".join(s))

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

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

    long long ans = 0;
    for (long long i = 1; i <= N; i++)
    {
        long long n = (N / i);
        ans += i * n * (n + 1) / 2;
    }

    cout << ans << endl;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
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;
}
void debug() { cerr << "\n"; }
template <class T> void debug(const T &x) { cerr << x << "\n"; }
template <class T, class... Args> void debug(const T &x, const Args &... args) {
    cerr << x << " ";
    debug(args...);
}
template <class T> void debugVector(const vector<T> &v) {
    for(const T &x : v) {
        cerr << x << " ";
    }
    cerr << "\n";
}
using ll = long long;

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
const double PI = acos(-1);
constexpr int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//-------------------------------------

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

Measured memory_bytes: 3588
#include <algorithm>
#include <bitset>
#include <cmath>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>

using namespace std;
using ll = int64_t;
using VL = vector<ll>;
using VD = vector<double>;
using VVL = vector<VL>;

#define FOR(i, start, end) for(ll i = (start), (i ## xxxx_end)=(end); i < (i ## xxxx_end); ++i)
#define FORD(i, start, end) for(ll i = (start), (i ## xxxx_end)=(end); i > (i ## xxxx_end); --i)
#define REP(i, n) FOR(i, 0, n)
#define REPD(i, n) FORD(i, n - 1, -1)

#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))

template<class T, class U>bool chmax(T &a, const U &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T, class U>bool chmin(T &a, const U &b) { if (b<a) { a=b; return 1; } return 0; }

template <class T, class U>ostream &operator<<(ostream &o, const map<T, U>&obj) {o << "{"; for (auto &x : obj) o << " {" << x.first << " : " << x.second << "}" << ","; o << " }"; return o;}
template <class T>ostream &operator<<(ostream &o, const set<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const multiset<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const vector<T>&obj) {o << "{"; for (int i = 0; i < (int)obj.size(); ++i)o << (i > 0 ? ", " : "") << obj[i]; o << "}"; return o;}
template <class T, class U>ostream &operator<<(ostream &o, const pair<T, U>&obj) {o << "{" << obj.first << ", " << obj.second << "}"; return o;}
template <template <class tmp>  class T, class U> ostream &operator<<(ostream &o, const T<U> &obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr)o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
void print(void) {cout << endl;}
template <class Head> void print(Head&& head) {cout << head;print();}
template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) {cout << head << " ";print(forward<Tail>(tail)...);}

#define INF 1000000000000
#define MOD 10000007

ll N, M;
VVL graph;
VL dp;

ll max_len_path(ll current) {
    if(dp[current] != -1)
        return dp[current];

    ll ret = 0;
    for(auto&& i : graph[current]) {
        chmax(ret, max_len_path(i) + 1);
    }
    return (dp[current] = ret);
}

void solve() {
    cin >> N >> M;
    graph = VVL(N, VL());
    REP(i, M) {
        ll x, y;
        cin >> x >> y;
        graph[x - 1].push_back(y - 1);
    }

    dp = VL(N, -1);
    ll ans = -1;
    REP(i, N) {
        chmax(ans, max_len_path(i));
    }
    print(ans);
}

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

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

int main()
{
	int K;
	string S;
	
	scanf("%d", &K);
	cin >> S;
	
	if( (int)(S.length()) <= K)
		printf("%s", S.c_str());
		
	else
	{
		for(int i = 0; i < K; i++)
			printf("%c", S[i]);
			
		printf("...");
	}
}


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

int main()
{
    int N;
    cin >> N;
    vector<int> P(N);
    for(int i = 0;i < N;i++)
        cin >> P[i];
    int ans = 0;
    int min = N+1;
    for(int i = 0;i < N;i++){
        if(P[i] > min)continue;
        else min = P[i];
        ans++;
        if(P[i] == 1)
            break;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <queue>
#include <cstdlib>

using namespace std;

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

const ll mod = 1000000007;

template <class T>
struct segtree {
  int n;
  vector<T> data;

  segtree(const int s) {
    init(s);
  }

  segtree(const int s, const T u) {
    init(s);
    for (int i = 0; i < s; i++) {
      data[i+n-1] = u;
    }
    for (int i = n-2; i >= 0; i--) {
      data[i] = data[i*2+1] + data[i*2+2];
    }
  }

  segtree(const vector<T> &v) {
    int s = v.size();
    init(s);
    for (int i = 0; i < s; i++) {
      data[i+n-1] = v[i];
    }
    for (int i = n-2; i >= 0; i--) {
      data[i] = 0;
    }
  }

  void init(const int s) {
    n = 1;
    while (n < s) n <<= 1;
    data = vector<T>(2*n-1);
  }

  void update(int x, T v) {
    int p = x + n - 1;

    // update bottom
    data[p] += v;

    // update rest
    while (p > 0) {
      p = (p - 1) >> 1;
      data[p] = data[p*2+1] + data[p*2+2];
    }
  }

  T query(int l, int r, int p = 0, int a = 0, int b = -1) {
    if (b < 0) b = n; // init
    if (r <= a || b <= l) return 0; // out of range

    if (l <= a && b <= r) return data[p];// fully covered

    int vl = query(l, r, p*2+1, a, (a + b) / 2); // left
    int vr = query(l, r, p*2+2, (a + b) / 2, b); // right
    return vl + vr;
  }
};

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

  int n, q;
  cin >> n >> q;
  vector<vector<int> > query(q, vector<int>(4));
  for (int i = 0; i < q; i++) {
    cin >> query[i][0] >> query[i][1] >> query[i][2];
  }

  segtree<ll> st(n);
  vector<ll> ans;
  for (int i = 0; i < q; i++) {
    if (query[i][0] == 0) { // update
      st.update(query[i][1]-1, query[i][2]);
    }
    else { // findMin
      ans.push_back(st.query(query[i][1]-1, query[i][2]));
    }
  }

  for (auto &x: ans) cout << x << endl;

  return 0;
}



Measured memory_bytes: 10916
#define _CRT_SECURE_NO_WARNINGS
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#define int ll
//#define endl "\n"
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
#define all(c) (c).begin(), (c).end()
#define loop(i,a,b) for(ll i=a; i<ll(b); i++)
#define rep(i,b) loop(i,0,b)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
template<class T> ostream & operator<<(ostream & os, vector<T> const &);
template<int n, class...T> typename enable_if<(n>=sizeof...(T))>::type _ot(ostream &, tuple<T...> const &){}
template<int n, class...T> typename enable_if<(n< sizeof...(T))>::type _ot(ostream & os, tuple<T...> const & t){ os << (n==0?"":" ") << get<n>(t); _ot<n+1>(os, t); }
template<class...T> ostream & operator<<(ostream & os, tuple<T...> const & t){ _ot<0>(os, t); return os; }
template<class T, class U> ostream & operator<<(ostream & os, pair<T,U> const & p){ return os << "(" << p.first << ", " << p.second << ") "; }
template<class T> ostream & operator<<(ostream & os, vector<T> const & v){ rep(i,v.size()) os << v[i] << (i+1==(int)v.size()?"":" "); return os; }
template<class T> inline bool chmax(T & x, T const & y){ return x<y ? x=y,true : false; }
template<class T> inline bool chmin(T & x, T const & y){ return x>y ? x=y,true : false; }
#ifdef DEBUG
#define dump(...) (cerr<<#__VA_ARGS__<<" = "<<mt(__VA_ARGS__)<<" ["<<__LINE__<<"]"<<endl)
#else
#define dump(...)
#endif
// ll const mod = 1000000007;
// ll const inf = 1LL<<60;

int main(){
    int a,b;
    cin >> a >> b;
    cout << a*b << endl;
}

Measured memory_bytes: 1164
#include <bits/stdc++.h>
#define ll long long int    
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
using namespace std;

int main() {
    fast;
  	string s;
  	cin >> s;
  	cout << s[0] << s[1] << s[2];
  	return 0;
}

Measured memory_bytes: 3624
//全然閃かない・・・
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
//#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread_unlocked(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}

int P[200001], P1[200001];
int Find(int A) {
	if (P[A] < 0) return A;
	return P[A] = Find(P[A]);
}
int Find1(int A) {
	if (P1[A] < 0) return A;
	return P1[A] = Find1(P1[A]);
}

ll root[200001];
ll tmp[200001];
void pakuripair_sort(int N, ll A[], int B[]) {
	const int b = 9;
	rep(k, 4) {
		int kazu[1 << b] = {}, kazu2[1 << b] = {};
		rep(i, N) kazu[A[i] >> k * b & ((1 << b) - 1)]++;
		rep(i, (1 << b) - 1) kazu[i + 1] += kazu[i];
		for (int i = N - 1; i >= 0; i--) {
			tmp[--kazu[A[i] >> k * b & ((1 << b) - 1)]] = A[i];
			P1[kazu[A[i] >> k * b & ((1 << b) - 1)]] = B[i];
		}
		k++;
		rep(i, N) kazu2[tmp[i] >> k * b & ((1 << b) - 1)]++;
		rep(i, (1 << b) - 1) kazu2[i + 1] += kazu2[i];
		for (int i = N - 1; i >= 0; i--) {
			A[--kazu2[tmp[i] >> k * b & ((1 << b) - 1)]] = tmp[i];
			B[kazu2[tmp[i] >> k * b & ((1 << b) - 1)]] = P1[i];
		}
	}
}

const int dm = 1 << 21;
char dn[dm], * di = dn;
inline void putint(int X) {
	int keta = 0;
	char C[10];
	while (X) {
		*(C + keta) = '0' + X % 10;
		X /= 10;
		keta++;
	}
	for (int i = keta - 1; i >= 0; i--)* di++ = (*(C + i));
	*di++ = ' ';
}

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


	int N = getint(), K = getint(), L = getint();
	rep1(i, N) {
		P[i] = -1;
		P1[i] = -1;
	}
	rep(i, K) {
		int p = getint(), q = getint();
		p = Find(p);
		q = Find(q);
		if (p != q) {
			if (P[p] > P[q]) swap(p, q);
			P[p] += P[q];
			P[q] = p;
		}
	}
	rep1(i, N) root[i] = Find(i);

	rep(i, L) {
		int p = getint(), q = getint();
		p = Find1(p);
		q = Find1(q);
		if (p != q) {
			if (P1[p] > P1[q]) swap(p, q);
			P1[p] += P1[q];
			P1[q] = p;
		}
	}
	rep1(i, N) {
		P[i] = i;
		root[i] += (ll)Find1(i) << 18;
	}
	pakuripair_sort(N, root + 1, P + 1);

	int mae = 1;
	for (int i = 2; i <= N; i++) {
		if (root[mae] != root[i]) {
			for (int j = mae; j < i; j++) P1[P[j]] = i - mae;
			mae = i;
		}
	}
	for (int j = mae; j <= N; j++) P1[P[j]] = N + 1 - mae;

	rep1(i, N) putint(P1[i]);

	fwrite(dn, 1, di - dn, stdout);

	Would you please return 0;
}

Measured memory_bytes: 6016
#include <iostream>
#include <cstring>
#include <map>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <set>
#include <vector>
#include <queue>
#include <list>
#include <numeric>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <math.h>
#include <stack>
#include <climits>
#include <bitset>
#include <utility>


using namespace std;
typedef long long ll;
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; }
// const ll INF = 1LL <<60;
const int INF = 10000;

//最小公倍数
ll gcd(ll x, ll y) {
  ll tmp = 0;
  if (x < y){
    tmp=x;
    x=y;
    y=tmp;
  }
  while (y > 0) {
    ll r = x % y;
    x = y;
    y = r;
  }
  return x;
}

//最大公倍数
ll lcm(ll x,ll y){
  return x/gcd(x,y)*y;
}

//階乗
ll kaijo(ll k){
    ll sum = 1;
    for (ll i = 1; i <= k; ++i)
    {
        sum *= i;
        sum%=1000000000+7;
    }
    return sum;
}

//for(int i = ; i < ; i++){}

ll lmax(ll s,ll t){
  if(s>t){
    return s;
  }
  else{
    return t;
  }
}

ll lmin(ll s,ll t){
  if(s<t){
    return s;
  }
  else{
    return t;
  }
}
// ここから開始

int main(){
  string s;
  cin>>s;
  int g = 0, p = 0;
  for(int i = 0; i < s.length(); i++) {
    if(s[i]=='g') g++;
    else p++;
  }
  int idea_p = s.length()/2;
  cout<<idea_p-p<<endl;
  return 0;
}


Measured memory_bytes: 512
#include <stdio.h>

class Dice3{
public:
	Dice3(){
		number = new int[6];
		checkTable = new int[101];
		for(int i = 0; i < 101; i++) checkTable[i] = -1;
	};
	~Dice3(){
		delete[] number;
		delete[] checkTable;
	};

	void setLabel(int index,int num){
		number[index] = num;
		checkTable[num] = index;
	};

	void roll(char dst){
		switch(dst){
		case 'E':
			setNumber(number[3],number[1],number[0],number[5],number[4],number[2]);
			break;
		case 'N':
			setNumber(number[1],number[5],number[2],number[3],number[0],number[4]);
			break;
		case 'S':
			setNumber(number[4],number[0],number[2],number[3],number[5],number[1]);
			break;
		case 'W':
			setNumber(number[2],number[1],number[5],number[0],number[4],number[3]);
			break;
		}
	};

	bool isValidMember(int inputed[]){
		for(int i = 0; i < 6; i++)
		{
			if(checkTable[inputed[i]] == -1)
				return false;
		}
		return true;
	}
	bool isSameDice(int inputed[]){
		char order[25] = "NNNNWNNNWNNNENNNENNNWNNN";
		for(int i = 0; i < 24; i++){
			roll(order[i]);
			for(int j = 0; j < 6; j++){
				if(inputed[j] != number[j])
					break;
				if(j == 5)
					return true;
			}
		}
		return false;
	}

private:
	void setNumber(int n0,int n1,int n2,int n3,int n4,int n5){
		number[0] = n0;
		number[1] = n1;
		number[2] = n2;
		number[3] = n3;
		number[4] = n4;
		number[5] = n5;
	}

private:
	int* number;
	int* checkTable;
};

int main(){
	Dice3 dice3;
	int tmp,inputed[6];
	for(int i = 0; i < 6; i++){
		scanf("%d",&tmp);
		dice3.setLabel(i,tmp);
	}
	for(int i = 0; i < 6; i++) scanf("%d",&inputed[i]);

	if(dice3.isValidMember(inputed) && dice3.isSameDice(inputed))
		printf("Yes\n");
	else{
		printf("No\n");
	}
}

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

#define REP(i, n) for(int i = 0; i < (n); i++)
#define ALL(a) (a).begin(),(a).end()
#define SORT(a) sort((a).begin(),(a).end())
#define RSORT(a) sort((a).rbegin(),(a).rend())
#define ll long long
#define pb(a) push_back(a)

#define PRINTV(v) {for(ll deB=0; deB<(v).size(); deB++){cout << (v)[deB] << " ";}cout << endl;}

int main(){
	
	
	ll N, M;
	cin >> N >> M;
	vector< list<ll> > l(N+1, list<ll>());
	REP(i,M) {
		ll A,B;
		cin >> A >> B;
		l[A].push_back(B);
		l[B].push_back(A);
	}

	vector<ll> memo(N+1, 0);
	ll ret = 0;

	REP(i, N+1){
		ll test = 0;
		queue<ll> que;
		que.push(i);
		while(!que.empty()){
			ll n = que.front();
			que.pop();

			if(memo[n] != 0) continue;
			memo[n] = 1;
			test++;
			for(list<ll>::iterator it = l[n].begin(); it != l[n].end(); it++){
				que.push(*it);
			}
		}
		ret = max(ret, test);
	}
	cout << ret << endl;
	
	return 0;

abnormal:
	cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 22644
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

from bisect import bisect_right
import itertools

N,X,*A = map(int,read().split())

A.sort()
Acum = list(itertools.accumulate(A))

answer = bisect_right(Acum,X)
if answer == N:
    if Acum[-1] < X:
        answer -= 1
print(answer)

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

int orig_2_pow(int n)
{
    int k = 1;
    for(int i = 0; i < n; i++){
        k *= 2;
    }
    return k;
}

int main()
{
    int n, m;
    cin >> n >> m;
    cout << (1900 * m + (n - m) * 100) * orig_2_pow(m) << endl;
    return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<sstream>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<random>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())



int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n;
	long long ans = 0;
	cin >> n;
	int p = 0;
	rep(i,n) {
		int a;
		cin >> a;
		ans += a / 2;
		if (a % 2) {
			if (p) {
				p = 0;
				ans++;
			}
			else {
				p = 1;
			}
		}
		else if (a == 0)p = 0;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cassert>
#include <functional>
#include <numeric>
#include <limits>
#include <iomanip>
#include <queue>
#include <cmath>
#include <math.h>
#include <string>
#include <cmath>
#include <bitset>
#include <set>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
const long long INF = 1LL << 60;
using pll = pair<long long, long long>;
typedef long long ll;
#define min(a, b) ((a) < (b) ? (a) : (b))
#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)


int main() {
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	// cout << std::fixed << std::setprecision(15);
	int N;
	cin >> N;
	vector<vector<long long>> ABC(N, vector<long long>(3));

	for (int i = 0; i < N; i++) {
		cin >> ABC.at(i).at(0) >> ABC.at(i).at(1) >> ABC.at(i).at(2);
	}
	vector<vector<long long>> DP(N, vector<long long>(3, 0));
	DP.at(0).at(0) = ABC.at(0).at(0);
	DP.at(0).at(1) = ABC.at(0).at(1);
	DP.at(0).at(2) = ABC.at(0).at(2);
	for (int i = 1; i < N; i++) {
		chmax(DP.at(i).at(0), DP.at(i - 1).at(1) + ABC.at(i).at(0));
		chmax(DP.at(i).at(0), DP.at(i - 1).at(2) + ABC.at(i).at(0));
		chmax(DP.at(i).at(1), DP.at(i - 1).at(0) + ABC.at(i).at(1));
		chmax(DP.at(i).at(1), DP.at(i - 1).at(2) + ABC.at(i).at(1));
		chmax(DP.at(i).at(2), DP.at(i - 1).at(0) + ABC.at(i).at(2));
		chmax(DP.at(i).at(2), DP.at(i - 1).at(1) + ABC.at(i).at(2));
	}
	long long res = 0;
	chmax(res, DP.at(N - 1).at(0));
	chmax(res, DP.at(N - 1).at(1));
	chmax(res, DP.at(N - 1).at(2));
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 11136
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <unordered_map>
#include <utility>
#include <algorithm>
#include <set>
#include <cmath>
#include <array>
#include <bitset>
using namespace std;
typedef long long ll;
const ll mod=1000000007;
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b+1;i++)
#define Per(i,b,a) for(int i=b;i>=a;i--)
int main(){
    int A,B;
    cin>>A>>B;
    rep(cost,10000){
        int cost8 = (8*cost)/100;
        int cost10 = (10*cost)/100;
        if(cost8==A && cost10==B) {
            cout<<cost<<endl;
            return 0;
        }
    }
    cout<<-1<<endl;
    return 0;
}

Measured memory_bytes: 256
using System;
class Program
{
		static void Main(string[] args)
		{
			var s = Console.ReadLine().Split(' ');
			int a = int.Parse(s[0]);
			int b = int.Parse(s[1]);
			int c = a / b + ((a%b==0)?0:1);
			Console.WriteLine(c);
		}
}

Measured memory_bytes: 13140
N = int(input())

red = [list(map(int, input().split())) for i in range(N)]
blue = [list(map(int, input().split())) for i in range(N)]
red.sort(key=lambda x: x[1], reverse=True)
blue.sort()
ans = 0

for b_x, b_y in blue:
    for r_x, r_y in red:
        if b_x > r_x and b_y > r_y:
            red.remove([r_x, r_y])
            ans += 1
            break

print(ans)

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

int main() {
    int N;
    cin >> N;
    long long ans=1;
    long long A[N];
    for (int i=0; i<N; i++) cin >> A[i];
    for (int i=0; i<N; i++){
        if (A[i]==0){
            cout << 0 << endl;
            return 0;
        }
    }
    for (int i=0; i<N; i++){
        if (A[i]<=1000000000000000000/ans){
            ans*=A[i];
        }
        else{
            cout << -1 << endl;
            return 0;
        }
    }
    cout << ans << endl;
}


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

using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread_unlocked(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}

void pakuri_sort(int N, int A[]) {
	const int b = 8;
	int tmp[100001];
	rep(k, 4) {
		int kazu[1 << b] = {}, kazu2[1 << b] = {};
		rep(i, N) kazu[A[i] >> k * b & ((1 << b) - 1)]++;
		rep(i, (1 << b) - 1) kazu[i + 1] += kazu[i];
		for (int i = N - 1; i >= 0; i--) tmp[--kazu[A[i] >> k * b & ((1 << b) - 1)]] = A[i];
		k++;
		rep(i, N) kazu2[tmp[i] >> k * b & ((1 << b) - 1)]++;
		rep(i, (1 << b) - 1) kazu2[i + 1] += kazu2[i];
		for (int i = N - 1; i >= 0; i--) A[--kazu2[tmp[i] >> k * b & ((1 << b) - 1)]] = tmp[i];
	}
}

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


	int N = getint();

	int A[100000], B[100000], C[100000];
	rep(i, N) A[i] = getint();
	rep(i, N) B[i] = getint();
	rep(i, N) C[i] = getint();
	pakuri_sort(N, A);
	pakuri_sort(N, B);
	pakuri_sort(N, C);

	int BA[100000];
	int p = 0;
	rep(i, N) {
		while (p < N && A[p] < B[i]) p++;
		BA[i] = p;
	}
	ll kotae = 0;
	p = 0;
	ll kari = 0;
	rep(i, N) {
		while (p < N && B[p] < C[i]) {
			kari += BA[p];
			p++;
		}
		kotae += kari;
	}
	printf("%lld", kotae);

	Would you please return 0;
}

Measured memory_bytes: 2304