akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int X = sc.nextInt();
        for(int a=1000; a>=0; a--) {
            int tmp_a = calc(X, a, 0, 0, 0, 0, 0);
            if(0>tmp_a) continue;
            for(int b=1000-a; b>=0; b--) {
                int tmp_b = calc(X, a, b, 0, 0, 0, 0);
                if(0>tmp_b) continue;
                for(int c=1000-(a+b); c>=0; c--) {
                    int tmp_c = calc(X, a, b, c, 0, 0, 0);
                    if(0>tmp_c) continue;
                    for(int d=1000-(a+b+c); d>=0; d--) {
                        int tmp_d = calc(X, a, b, c, d, 0, 0);
                        if(0>tmp_d) continue;
                        for(int e=1000-(a+b+c+d); e>=0; e--) {
                            int tmp_e = calc(X, a, b, c, d, e, 0);
                            if(0>tmp_e) continue;
                            for(int f=1000-(a+b+c+d+e); f>=0; f--) {
                                int tmp_f = calc(X, a, b, c, d, e, f);
                                if(0>tmp_f) continue;
                                if(0==tmp_f) {
                                    System.out.println(String.format("1"));
                                    return;
                                }
                            }
                        }
                    }
                }
            }
        }
        System.out.println(String.format("0"));
    }
    static int calc(int X, int a, int b, int c, int d, int e, int f) {
        return X - (a*100+b*101+c*102+d*103+e*104+f*105);
    }
}


Measured memory_bytes: 22740
import java.util.Scanner


object Main {

  case class GF(representative: Long) extends AnyVal {
    def +(that: GF): GF = GF((this.representative + that.representative) % GF.mod)

    def -(that: GF): GF = GF((this.representative - that.representative + GF.mod) % GF.mod)

    def *(that: GF): GF = GF((this.representative * that.representative) % GF.mod)

    def /(that: GF): GF = this * that.inv

    def unary_- : GF = GF((-this.representative + GF.mod) % GF.mod)

    def inv: GF = GF.powGF(this, GF.mod - 2)
  }


  object GF {
    val mod: Long = (1e9 + 7).toLong

    val _0: GF = GF(0)
    val _1: GF = GF(1)

    def powGF(x: GF, t: Long): GF = {
      if (t == 0) {
        return GF(1)
      }
      val y = powGF(x, t / 2)
      if (t % 2 == 0) {
        y * y
      } else {
        x * y * y
      }
    }
  }

  def read() = {
    val sc = new Scanner(System.in)
    val n, k = sc.nextInt()
    (n, k)
  }

  def solve(n: Int, k: Int): Unit = {


    val fracGF = (1 to n).map(GF(_)).scanLeft(GF(1))(_ * _)

    def combGF(n: Int, r: Int): GF = {
      if (n < r) GF(0)
      else fracGF(n) / (fracGF(r) * fracGF(n - r))
    }

    for (i <- 1 to k) {
      val result = combGF(k - 1, i - 1) * combGF(n - k + 1, i)
      println(result.representative)
    }

  }

  def main(args: Array[String]): Unit = {
    val (n, k) = read()
    solve(n, k)
    //println(solve(n,k))
  }
}

Measured memory_bytes: 25548
import java.util.Scanner;


class Main {
	public static void main(String args[]) {
		
	    Scanner sc = new Scanner(System.in);
	    String  s1 = sc.next();
	    int a = Integer.parseInt(s1);
	    String  s2 = sc.next();
	    int b = Integer.parseInt(s2);
	    String  s3 = sc.next();
	    int c = Integer.parseInt(s3);
	    if( a < b && b < c){
	        System.out.println( "Yes" );
    	}
	    else{
	    	System.out.println( "No" );
	    }
	}

}

Measured memory_bytes: 17188
mod = 1000000007
eps = 10**-9


def main():
    import sys
    input = sys.stdin.readline

    def PrimeDecomposition(N):
        ret = {}
        n = int(N ** 0.5)
        for d in range(2, n + 1):
            while N % d == 0:
                if d not in ret:
                    ret[d] = 1
                else:
                    ret[d] += 1
                N //= d
            if N == 1:
                break
        if N != 1:
            ret[N] = 1
        return ret

    N, P = map(int, input().split())
    prime = PrimeDecomposition(P)
    ans = 1
    for p in prime:
        ans *= p ** (prime[p] // N)
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 62608
N, K = map(int, input().split())
h = []
for i in range(N):
    h.append(int(input()))

h.sort()

m = h[-1] #現時点での最大

for i in range(N-K+1):
    x = h[K+i-1] - h[i]
    if m > x:
        m = x
print(m)


Measured memory_bytes: 7384
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <list>
#include <sstream>
#include <cmath>
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define reps(s,i,n) for(int i=s;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define skip(i,n,p) for(int i=0;i<n;i+=p)
#define all(a)  (a).begin(),(a).end()
#define int64 long long
#define debug cout << __FILE__ << ":" << __LINE__ << endl;
#define INF 1e9

struct Init {
    Init() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout.precision(20);
        cout << fixed;
    }
} init;

template <typename _Ty>
ostream& operator << (ostream& ostr, const vector<_Ty>& v) {
    for(int i = 0; i < (int) v.size(); i++) {
        ostr << v[i] << (i + 1 != v.size() ? " " : "");
    }
    return ostr;
}

template <typename _K, typename _V>
ostream& operator << (ostream& ostr, const map<_K, _V>& v) {
    ostr << "{";
    for (auto iter = v.begin(); iter != v.end(); ++iter) {
        ostr << (*iter).first << ": " << (*iter).second << ", ";
    }
    ostr << "}";
    return ostr;
}

template <typename _K>
ostream& operator << (ostream& ostr, const set<_K>& v) {
    for (auto iter = v.begin(); iter != v.end(); ++iter) {
        ostr << *iter << (iter != v.end() ? " " : "");
    }
    return ostr;
}

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

int64 modinv(int64 a, int64 m) {
    int64 b = m, u = 1, v = 0;
    while (b) {
        int64 t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

#define M map<int, int>
M f(int n) {
    M m;

    int c = 2;
    while (n != 1) {
        if (n % c == 0) {
            n = n / c;
            m[c]++;
        } else {
            c++;
        }
    }
    return m;
}

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

    vector<int> L(N);
    rep(i, N) cin >> L[i];

    int c = 0;
    rep(i, N) c += L[i];

    double t = (double)c / N;

    int ans = 0;
    double p = abs(t - L[0]);
    reps(1, i, N) {
        double _p = abs(t - L[i]);
        if (_p < p) {
            ans = i;
            p = _p;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#define _USE_MATH_DEFINES
#include <math.h>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <stdlib.h>
#include <functional>
#include <string>
#include <array>
#include <map>
#include <queue>
#include <limits.h>
#include <set>
#include <stack>
#include <random>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <nmmintrin.h>
#include <chrono>
const double EPS = 1e-8;
#define Scan(a) int a;scanf("%d", &a);
#define ScanS(a) char a[500];scanf("%s", a);
#define rep(i,s,n) for(int i = (s); (n) > i; i++)
#define REP(i,n) rep(i,0,n)
#define RANGE(x,a,b) ((a) <= (x) && (x) <= (b))
#define DUPLE(a,b,c,d) (RANGE(a,c,d) || RANGE(b,c,d) || RANGE(c,a,b) || RANGE(d,a,b))
#define INCLU(a,b,c,d) (RANGE(a,c,d) && (b,c,d))
#define PW(x) ((x)*(x))
#define ALL(x) (x).begin(), (x).end()
#define MODU 1000000007
#define bitcheck(a,b)   ((a >> b) & 1LL)
#define bitset(a,b)      ( a |= (1LL << b))
#define bitunset(a,b)    (a &= ~(1LL << b))
#define MP(a,b) make_pair((a),(b))
#define Manh(a,b) (abs((a).first-(b).first) + abs((a).second - ((b).second))
#define pritnf printf
#define scnaf scanf
#define itn int
#ifdef _MSC_VER
#define __builtin_popcount _mm_popcnt_u32
#define __builtin_popcountll _mm_popcnt_u64
#endif
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a%b);
}
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T &val) {
	std::fill((T*)array, (T*)(array + N), val);
}

pii Dir[8] = {
	{ 0 ,1 },{ -1 ,0 },{ 1 ,0 },{ 0 ,-1 },
	{ 1 ,1 },{ 1 ,-1 },{ -1 ,1 },{ -1 ,-1 }
};


pii operator+(pii obj, pii obj2) {
	return MP(obj.first + obj2.first, obj.second + obj2.second);
}
pii operator-(pii obj, pii obj2) {
	return MP(obj.first - obj2.first, obj.second - obj2.second);
}

struct Edge {
	int from, to, weight;
};

typedef vector<vector<Edge>> Graph;


int randxor()
{
	static unsigned int x = 123456789, y = 362436069, z = 521288629, w = 88675123;
	unsigned int t;
	t = (x ^ (x << 11)); x = y; y = z; z = w;
	return (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8))) % INT_MAX;
}

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

	ll dp[100] = {};
	dp[0] = 2;
	dp[1] = 1;
	rep(i, 2, 100) {
		dp[i] = dp[i - 1] + dp[i - 2];
	}
	cout << dp[n] << endl;
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define call(var) cerr<<#var<<"="<<var<<endl;
#define dup(x,y) (((x)+(y)-1)/(y))
using ll=long long;
using vi = vector<int>;
using vl = vector<ll>;
using vb = vector<bool>;
using Graph = vector<vi>;
using P = pair<int,int>;
const int MOD=(int)1e9+7;
const int INF=(int)1e9;
const ll LINF=(ll)1e18;
const int INTMAX = 2147483647;
template<class t,class u> inline bool chmax(t&a,u b){if(a<b){a=b;return true;}return false;}
template<class t,class u> inline bool chmin(t&a,u b){if(b<a){a=b;return true;}return false;}

int main(){
    int n,m;cin >> n >> m;
    vector<P> p(m);
    rep(i,m) cin >> p[i].second >> p[i].first;

    sort(p.begin(), p.end());
    int ans = 1;
    int pretail = p[0].first;
    int prehead = p[0].second;
    for(int i=1;i<m;++i){
        if(p[i].second >= pretail){
            ++ans;
            pretail = p[i].first;
            prehead = p[i].second;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
/*
  kadai4_2 colon
  unomi
*/
#include <stdio.h>
#include <math.h>

#define PI 3.1415926535

int main(void){
    long double h_length=0, m_length=0, hour=0, minute=0, h_rad=0, m_rad=0, diff_rad=0, ans_dist=0;
    // h_length(A),m_length(B),hour(H),minute(M) の入力を取得
    scanf("%Lf %Lf %Lf %Lf",&h_length, &m_length, &hour, &minute);

    // 時針が動いた角度(ラジアン)
    h_rad = (360 * (hour/12.0 + (minute/60.0)/12.0)) * PI / 180.0;
    // 分針が動いた角度(ラジアン)
    m_rad = (360 * (minute/60.0)) * PI /180.0;
    // 時針と分針が成す角の角度(ラジアン)
    diff_rad = h_rad - m_rad;

    // 余弦定理を用いて、端点の距離を計算
    ans_dist = sqrtl(h_length*h_length + m_length*m_length - 2*h_length*m_length*cos(diff_rad));

    printf("%10.10Lf\n",ans_dist);
    return 0;
}

Measured memory_bytes: 2480
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define _GLIBCXX_DEBUG
#define all(x) x.begin(), x.end()
using namespace std;
typedef long long ll;
typedef pair<int, int> pair;
const int inf = 1000000000; //10^9
const ll inff = 1000000000000000000; //10^18

int main(){
    string s;
    while(cin >> s) {
        if (s == "0") break;
        int a = s.size();
        ll ans = 0;
        for(int i = 0; i < a; i++) {
            ans += s[i] - '0';
    }

    cout << ans << endl;
    }

    return 0;
}


Measured memory_bytes: 3176
N = int(raw_input())
S = map(int, raw_input().split())
Q = int(raw_input())
T = map(int, raw_input().split())

S = sorted(S)
T = sorted(T)

ans = 0
s,t = 0,0
while s < len(S) and t < len(T):
    if S[s] == T[t]:
        ans += 1
        t += 1
    elif S[s] < T[t]:
        s += 1
    else:
        t += 1
print ans


Measured memory_bytes: 5224
#include <iostream>
#include <string>
 
using namespace std;
 
int main(int argc, char **argv)
{
    int n, o, h, t;
    string s;
    cin >> n;
     
    while(n--){
        o = h = t = 0;
        while(o < 3){
            cin >> s;
            if(s == "HIT"){
                if(h == 3){
                    t++;
                } else {
                    h++;
                }
            } else if(s == "HOMERUN"){
                t = t + h + 1;
                h = 0;
            } else {
                o++;
            }
        }
        cout << t << endl;
    }
     
    return 0;
}

Measured memory_bytes: 1208
//@Author: wxyww
#include<cstdio>
#include<iostream>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<queue>
#include<vector>
#include<ctime>
#include<cmath>
#include<map>
#include<string>
using namespace std;
typedef long long ll;

ll read() {
	ll x = 0,f = 1; char c = getchar();
	while(c < '0' || c > '9') {if(c == '-') f = -1;c = getchar();}
	while(c >= '0' && c <= '9') {x = x * 10 + c - '0',c = getchar();}
	return x * f;
}

int main() {
	ll n = read();
	cout<<((n - 1) * n >> 1);

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#ifdef LOCAL
#include<debug.h>
#else
#define db(...) 21
#endif
#define sz(a) (int)a.size()
#define found(m,x) ((m).find(x)!=(m).end())
#define uset unordered_set
#define umap unordered_map
#define a(x) x.begin(),x.end()
#define fo(i,n) for(int i=0;i<(int)n;i++)
#define Fo(i,k,n) for(int i=k;k<n?i<=(int)n:i>=(int)n;k<n?i++:i--)
#define input(v,n) fo(i,n)cin>>v[i]
typedef vector<int> vi;
typedef long long ll;
typedef pair<int,int> pi;

const int nax = 1e5+7;
const int mod = 1e9+7; //1e9+2667 :: 0xcf : inf, 0xc0 -inf
const int inf = numeric_limits<int> :: max() - (int)1e3;
// ===================== MANASH =================== //

int n,m;

void test() {

	string str;
	cin >> str;
	stack<int> s;
	for( char c : str ) {
		int x = c-'0';
		if(!s.empty() and s.top() != x ) {
			s.pop();
			continue;
		}
		s.push(x);
	}

	cout << sz(str) - sz(s);
}

signed main() {

	ios_base :: sync_with_stdio(false);
	cin.tie(NULL);

	#ifdef LOCAL
	freopen("input.txt","r",stdin);
	cout<<"Time Elapsed: " << 1.0*clock() / CLOCKS_PER_SEC << " sec.\n";
	#endif

	int T = 1;
	//cin >> T;
	while(T--) {
		test();
		cout << "\n";
	}
	return 0;

}

Measured memory_bytes: 1232
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define inf 1001001001001001001
#define mod 1000000007
#define mod2 998244353
#define pi acos(-1)
#define all(v) v.begin(),v.end()

int main(){
    int N;cin>>N;
    string s;cin>>s;
    int min=N;
    int sumE[N];//Eの累積和
    int sumW[N];//Wの累積和
    int e,w;
    int count;
    rep(i,N){
        if(i==0){
            if(s.at(0)=='E'){
                sumE[0]=1;
                sumW[0]=0;
            }else{
                sumE[0]=0;
                sumW[0]=1;
            }
        }else{
            if(s.at(i)=='E'){
                sumE[i]=sumE[i-1]+1;
                sumW[i]=sumW[i-1];
            }else{
                sumE[i]=sumE[i-1];
                sumW[i]=sumW[i-1]+1;
            }
        }
    }
    e=sumE[N-1];
    w=sumW[N-1];
    for(int i=0;i<N;i++){
        count=0;
        if(i==0){
            count=sumE[N-1]-sumE[0];
        }else if(i==N-1){
            count=sumW[N-2];
        }else{
            count+=sumW[i-1];
            count+=(e-sumE[i]);
        }
        if(count<min){
            min=count;
        }
    }
    cout<<min<<endl;

}

Measured memory_bytes: 6104
#include <bits/stdc++.h>
using namespace std;
#define mod 998244353
int a,b,c,d,dp[3005][3005];
long long solve(int x,int y)
{
	if (x<a || y<b)
	return 0;
	if (x==a && y==b)
	return 1;
	if (dp[x][y]!=-1)
	return dp[x][y];
	return dp[x][y]=(y*solve(x-1,y)+x*solve(x,y-1)-(x-1)*(y-1)*solve(x-1,y-1)%mod+mod)%mod;
}
int main()
{
	scanf("%d%d%d%d",&a,&b,&c,&d);
	memset(dp,-1,sizeof(dp));
	printf("%d",solve(c,d));
}

Measured memory_bytes: 39484
#include <iostream>

int main(){
   const int n = 5;
   int A[n];
   int index = -1;
   int max = 0;
   for(int i=0; i<n; ++i){
      std::cin >> A[i];
      if(max<10 - A[i]%10 && A[i]%10>0){
	 max = 10 - A[i]%10;
	 index = i;
      }
   }

   int ans = 0;
   for(int i=0; i<n; ++i){
      int time = (A[i]/10 + 1) * 10;
      if(A[i]%10==0) time -= 10;
      if(i==index) time = A[i];
      ans += time;
   }
   std::cout << ans << std::endl;

   return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define ss second
#define ff first
#define pb push_back
#define mp make_pair
int n,m;
vector<pair<int,int> > v;
int seg[100010*4];ll sum=0;
void build(int cr,int s,int e)
{
    if(s==e)
    {
        seg[cr]=s;
        return;
    }
    build(cr*2,s,(s+e)/2);
    build(cr*2+1,(s+e)/2+1,e);
    seg[cr]=max(seg[cr*2],seg[cr*2+1]);
    return;
}
int r;
int get(int cr,int s,int e)
{
    if(s>r)
        return 0;
    if(e<=r)
        return seg[cr];
    return max(get(cr*2,s,(s+e)/2),get(cr*2+1,(s+e)/2+1,e));
}int t;
void upd(int cr,int s,int e)
{
    if(t>e||s>t)
        return;
    if(s==e)
    {
        seg[cr]=0;
        return;
    }
    upd(cr*2,s,(s+e)/2);
    upd(cr*2+1,(s+e)/2+1,e);
    seg[cr]=max(seg[cr*2],seg[cr*2+1]);
    return;
}
int main() {
    cin>>n>>m;
    for(int i=1;i<=n;i++)
    {
        int a,b;
        scanf("%d%d",&a,&b);
        v.pb(mp(b,a));

    }
    sort(v.begin(),v.end());
    reverse(v.begin(),v.end());
    build(1,1,n);
    for(int i=0;i<n;i++)
    {   r=m-v[i].ss+1;
         t=get(1,1,n);
        if(t>0)
        {
            sum+=v[i].ff;
            upd(1,1,n);
        }
    }
    cout<<sum;
    return 0;
    }


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

int main(){
  int n;
  cin >> n;
  vector<ll>a(n);
  rep(i,n) cin >> a[i];
  sort(a.begin(),a.end());
  int cnt = 0;
  rep(i,n-1){
    if(a[i]==a[i+1]) {
      cnt++;
      break;
    }
    else continue;
  }
  if(cnt > 0) puts("NO");
  else puts("YES");
  return 0;
}

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

int main() {
  int N, A;
  cin >> N >> A;
  
  if (N % 500 <= A){
    cout << "Yes" << endl;
  }
  
  if (N % 500 > A){
    cout << "No" << endl;
  }
  
}
  

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1LL << 60;
ll MOD = 1e9 + 7;

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    vector<ll> cnt(n, 0);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        cnt[a[i] - 1]++;
    }
    ll sum = 0;
    for (int i = 0; i < n; i++) {
        if (cnt[i] == 0) continue;
        sum += cnt[i] * (cnt[i] - 1) / 2;
    }
    for (int i = 0; i < n; i++) {
        cout << sum - (cnt[a[i] - 1] - 1) << endl;
    }
    return 0;
}

Measured memory_bytes: 5612
def gcd_(a, b):
    if a < b:  a, b = b, a
    if b == 0:  return a
    return gcd_(b, a % b)

def gcd_bl(A):

    left = [0 for _ in range(N + 1)]
    right = [0 for _ in range(N + 1)]
    ans = [0 for _ in range(N)]

    left[1] = A[0]
    for i in range(1, N):  left[i + 1] = gcd_(left[i], A[i])
    right[-1 - 1] = A[-1]
    for i in range(1, N):  right[-1 - i - 1] = gcd_(right[-1 - i], A[-1 - i])
    for i in range(N):  ans[i] = gcd_(left[i], right[i + 1])
        
    return ans

def cin():
    in_ = list(map(int,input().split()))
    if len(in_) == 1:  return in_[0]
    else:  return in_

def solve():   
    if N == 1:  return A == K    
    g = gcd_bl(A)
    for i in range(N):
        if A[i] == K:  return 1
        elif A[i] > K:
            temp = (K - A[i]) / g[i]
            if temp == int(temp):  return 1
    return 0

N, K = cin()
A = cin()
ret = solve()
if ret:  print("POSSIBLE")
else:  print("IMPOSSIBLE")

Measured memory_bytes: 103176
#!/usr/bin/env python3
# coding: utf-8
import random


class Dice() :

    mask = {'N':(1,5,2,3,0,4), 'E':(3,1,0,5,4,2),
            'W':(2,1,5,0,4,3), 'S':(4,0,2,3,5,1)}
    way = ("N","E","W","S")

    def __init__(self, data):
        self.label = data

    def move(self, data):
        self.label = [self.label[idx] for idx in self.mask[data]]

    def get_up(self):
        return self.label[0]

    def compare(self, dice2):
        ok = False
        for i in range(1000):
            check = True
            for i2 in range(6):
                if self.label[i2] == dice2.label[i2] :
                    continue
                else:
                    check = False
                    break

            if check :
                ok = True
                break
            else:
                self.move(self.way[random.randint(0,1)])
        return ok

dice1 = Dice(input().split())
dice2 = Dice(input().split())

if dice1.compare(dice2) :
    print ("Yes")
else:
    print ("No")



Measured memory_bytes: 8188
#include<iostream>
#include<complex>
#include<vector>
#include<algorithm>
#include<cmath>
#include<map>
#include<iomanip>

#define EPS (1e-8)
#define EQ(a,b) (abs((a)-(b)) < EPS)
#define fs first
#define sc second
#define pb push_back
#define sz size()
#define all(a) (a).begin(),(a).end()
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)

using namespace std;

typedef complex<double> P;
typedef pair<P,P> L;
typedef pair<P,double> C;

const double PI = acos(-1);

P unit(P p){return p / abs(p);}
double dot(P x,P y){return real(conj(x)*y);}
double cross(P x,P y){return imag(conj(x)*y);}

P rotate(P v,double s){
  return P(real(v)*cos(s) - imag(v)*sin(s), real(v)*sin(s) + imag(v)*cos(s) );
}

double arg(P a,P b,P c){return acos(dot(b-a,c-a)/(abs(b-a)*abs(c-a)));}
double arg(double a,double b,double c){return acos( (b*b+c*c-a*a)/(2*b*c) );}

bool in_cir(C c,P x){return (abs(x-c.fs) +EPS < c.sc);}
bool on_cir(C c,P x){return EQ(abs(x-c.fs),c.sc);}

int cpr(C a,C b){
  double d = abs(a.fs-b.fs);
  if(a.sc+b.sc + EPS < d)return -1;
  if(b.sc+d + EPS < a.sc)return 1;
  if(a.sc+d + EPS < b.sc)return 2;
  if(abs(a.sc+b.sc - d) < EPS)return -3;
  if(abs(b.sc+d - a.sc) < EPS)return 3;
  if(abs(a.sc+d - b.sc) < EPS)return 4;
  return 0;
}

vector<P> cp_cir_to_cir(C a, C b){
  vector<P> v;
  int pos = cpr(a,b);
  if(pos==0){
    double s = arg(b.sc,abs(b.fs-a.fs),a.sc);
    P x = a.sc * unit(b.fs - a.fs);
    v.pb(a.fs + rotate(x,s));
    v.pb(a.fs + rotate(x,-s));
  }else if(abs(pos) >= 3){
    v.pb(a.fs + a.sc * unit(b.fs-a.fs));
  }
  return v;
}

double angle(P p, C c){
  P O = c.fs, A = P(c.fs.real(),c.fs.imag()+c.sc), B = p;
  double res = arg(O,A,B);
  if(cross(A-O,B-O)<-EPS)res = 2*PI-res;
  return res;
}

int n;
C c[110];
double x,y,r;

int main(){
  while(cin>>n,n){
    rep(i,n){
      cin >> x >> y >> r;
      c[i] = C(P(x,y),r);
    }

    vector<double> cp_list[110];
    rep(i,n){
      FOR(j,i+1,n){
	vector<P> p = cp_cir_to_cir(c[i],c[j]);
	if((int)p.sz==2){
	  rep(k,2)cp_list[i].pb(angle(p[k],c[i]));
	  rep(k,2)cp_list[j].pb(angle(p[k],c[j]));
	}
      }
    }

    rep(i,n){
      sort(all(cp_list[i]));
      rep(j,(int)cp_list[i].sz-1){
	if(EQ(cp_list[i][j],cp_list[i][j+1])){
	  cp_list[i].erase(cp_list[i].begin()+j);
	  j--;
	}
      }
    }

    double ans = 0;
    rep(i,n){
      if(cp_list[i].empty()){
	bool f = true;
	rep(j,n){
	  if(i==j)continue;
	  if(in_cir(c[j],c[i].fs) && c[i].sc < c[j].sc)f = false;
	}
	if(f)ans += 2*PI*c[i].sc;
      }else{
	rep(j,cp_list[i].sz){
	  double s;
	  if(j+1<(int)cp_list[i].sz)s = (cp_list[i][j]+cp_list[i][j+1])/2;
	  else s = (cp_list[i][j]+cp_list[i][0]+2*PI)/2;

	  P p = rotate(P(0,c[i].sc),s) + c[i].fs;
	  bool f = true;
	  rep(k,n){
	    if(i==k)continue;
	    if(in_cir(c[k],p))f = false;
	  }
	  double seta = cp_list[i][(j+1)%cp_list[i].sz]-cp_list[i][j];
	  if(seta<0)seta += 2*PI;
	  if(f)ans += seta*c[i].sc;
	}
      }
    }
    cout << fixed << setprecision(9) << ans << endl;
  }
}

Measured memory_bytes: 1388
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>

using namespace std;

#ifdef _MSC_VER
#define __typeof__ decltype

template <class T>
int __builtin_popcount(T n) { return n ? 1 + __builtin_popcount(n & (n - 1)) : 0; }
#endif

#define foreach(it, c) for (__typeof__((c).begin()) it=(c).begin(); it != (c).end(); ++it)
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define popcount __builtin_popcount
	
#define rep(i, n) for (int i = 0; i < n; ++i)

template <class T> void max_swap(T& a, const T b) { a = max(a, b); }
template <class T> void min_swap(T& a, const T b) { a = min(a, b); }

const double EPS = 1e-10;
typedef long long ll;
typedef pair<int, int> pint;


int main()
{
	int n;
	static int t[10100];
	scanf("%d", &n);
	rep (i, n - 1)
		scanf("%d", t + i);
	int m = n / 2;

	static int dp1[5100][10100], dp2[5100][10100];
	const int INF = 1e9;
	rep (i, m + 1)
		rep (j, n + 1)
			dp1[i][j] = dp2[i][j] = INF;

	dp1[1][0] = 0;
	fill(dp2[1] + 1, dp2[1] + n, t[0]);
	for (int i = 1; i <= m; ++i)
	{
		for (int j = 1; j <= n; ++j)
		{
			dp1[i][j] = min(dp1[i - 1][j - 1], dp2[i - 1][j] + t[j - 1]);
			dp2[i][j] = min(dp2[i][j - 1], dp1[i][j - 1] + t[j - 1]);
		}
	}

	printf("%d\n", dp2[m][n]);
}	

Measured memory_bytes: 0
import sys
import  math
import fractions
from collections import defaultdict
stdin = sys.stdin
     
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

N=int(input())
P=nl()

INF=10**18
min_val=INF
ans=0
for i in P:
    if(i<=min_val):
        min_val=i
        ans+=1

print(ans)
    
    

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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef complex<double> P;
typedef pair<int,int> pii;
#define REP(i,n) for(ll i=0;i<n;++i)
#define REPR(i,n) for(ll i=1;i<n;++i)
#define FOR(i,a,b) for(ll i=a;i<b;++i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define MOD (ll)(1e9+7)
#define ADD(a,b) a=((a)+(b))%MOD
#define FIX(a) ((a)%MOD+MOD)%MOD

struct user{int t,h;};

int main(){
  int n,t,h,l;
  cin >> n >> t >> h >> l;
  user users[n];
  REP(i,n){
    int _t, _h;
    cin >> _t >> _h;
    users[i] = (user){_t,_h};
    // cin >> users[i].t >> users[i].h;
  }
  int winner = -1;
  int nowval = 0;
  while(winner == -1){
    REP(i,n){
      user u = users[i];
      if(u.t == 0 && u.h == 0){
        winner = i+1;
        break;
      }
      if(u.t>0){
        u.t--;
        nowval += 10;
        t++;
      }else if(u.h>0){
        u.h--;
        nowval += 100;
        h++;
      }
      if(t > l){
        winner = i+1;
        break;
      }
      if(nowval >= 90){
        int ret = nowval - 90;
        ret /= 10;
        if(ret > t){
          winner = i+1;
          break;
        }
        u.t += ret;
        t -= ret;
        nowval = 0;
      }
      users[i] = u;
    }
  }
  cout << winner << endl;
  return 0;
}

Measured memory_bytes: 1160
n = int(input())
*a, = map(int,input().split())
c = [0 for _ in range(10**5+1)]
for A in a:
    c[A] += 1
ans = 0
l = len(c)
for i in range(l):
    z = c[i]

    if 0 <= i - 1 <l:
        z += c[i-1]

    if 0 <= i+1 <l:
        z += c[i+1]

    ans = max(ans, z)
print(ans)


Measured memory_bytes: 59076
#include<bits/stdc++.h>
#define rep(i,n,m) for(int i = (n); i <(m); i++)
#define rrep(i,n,m) for(int i = (n) - 1; i >=(m); i--)
using namespace std;
using ll = long long;

int main()
{
    int n, a, b;
    cin >> n >> a >> b;

    if ((b - 1 - a ) % 2 == 0)
        cout << "Borys" << endl;
    else
        cout << "Alice" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <array>
using namespace std;
using ULL = unsigned long long;
using UL = unsigned;
using LL = long long;
#define rep(i, n) for(UL i = 0; i < (n); i++)

struct Problem {


	void Solve() {
		UL a, b, c; cin >> a >> b >> c;
		UL ans = 0;
		while (true) {
			if (a & 1 || b & 1 || c & 1) { cout << ans << endl; return; }
			if (a == b || b == c) { cout << -1 << endl; return; }
			UL A, B, C;
			A = b + c; B = a + c; C = a + b;
			a = A / 2; b = B / 2; c = C / 2;
			ans++;
		}
	}


	Problem();
};
int main() {
	unique_ptr<Problem> p(new Problem());
	p->Solve();
	return 0;
}
Problem::Problem() {
	cout << fixed << setprecision(10);
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include<iostream>
#include<vector>
#include<algorithm>
#include<cctype>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>
#include<set>
#include<climits>
#include<bitset>
#include<stack>
#include<fstream>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)

using namespace std;

typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef tuple<ll, ll, ll> lltpl;
typedef tuple<int, int, int> tpl;

int dy8[8] = { 2,2,-2,-2,1,1,-1,-1 };
int dx8[8] = { 1,-1,1,-1,2,-2,2,-2 };
int dx4[4] = { 1,0,0,-1 };
int dy4[4] = { 0,1,-1,0 };


/******************************************************************************************/

template<typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T, typename... Ts>
auto make_v(size_t a, Ts... ts) {
	return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template<typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T& t, const V& v) { t = v; }
template<typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T& t, const V& v) {
	for (auto& e : t) fill_v(e, v);
}

// vector
template <typename T>
istream& operator>>(istream & is, vector<T> & vec) { for (T& x : vec) is >> x; return is; }
// pair
template <typename T, typename U>ostream& operator<<(ostream & os, pair<T, U> & pair_var) { os << "(" << pair_var.first << ", " << pair_var.second << ")"; return os; }
// vector
template <typename T>ostream& operator<<(ostream & os, const vector<T> & vec) { os << "{";	for (int i = 0; i < vec.size(); i++) { os << vec[i] << (i + 1 == vec.size() ? "" : ", "); }os << "}"; return os; }
// map
template <typename T, typename U>ostream& operator<<(ostream & os, map<T, U> & map_var) { os << "{";	repi(itr, map_var) { os << *itr; itr++; if (itr != map_var.end()) os << ", "; itr--; }os << "}"; return os; }
// set
template <typename T>ostream& operator<<(ostream & os, set<T> & set_var) { os << "{"; repi(itr, set_var) { os << *itr; itr++; if (itr != set_var.end()) os << ", "; itr--; }os << "}"; return os; }



const int IINF = 1e9 + 7;
const ll LINF = 1e18 + 7;
constexpr ll MOD = 1e9 + 7;

//ここから書くこと




ll dp[3005];

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int n, t;
	cin >> n >> t;
	vector<pii> a(n), b(n);
	for (int i = 0; i < n; i++)
	{
		cin >> a[i].first >> a[i].second;
	}
	sort(a.begin(), a.end());

	

	dp[0] = 0;

	for (int i = 0; i < n; i++)
	{
		for (int j = t - 1; j >= 0; j--)
		{
			dp[j] = max(dp[j], dp[j]);
			dp[min(j + a[i].first,t)] = max(dp[min(j + a[i].first,t)], dp[j] + a[i].second);
		}
		//dp[t] = max(dp[t], dp[t]);
	}


	ll maxi = 0;

	for (int i = 0; i < 3005; i++)
	{
		maxi = max(maxi, dp[i]);
	}
	cout << maxi << endl;






	return 0;
}


Measured memory_bytes: 384
use std::io::*;
use std::str::FromStr;

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let x = read::<usize>();
    let y = read::<usize>();
    println!("{}", x + y / 2);
}


Measured memory_bytes: 4352
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str = br.readLine();
		int[] times = new int[100];
		int max = 0;
		for (int i = 0; i < 100; i++) {
			times[i] = 0;
		}
		while (str!=null) {
			int num = Integer.parseInt(str);
			times[num - 1]++;
			if (times[num - 1] > max)
				max = times[num - 1];
			str = br.readLine();
		}
		for (int i = 0; i < 100; i++)
			if (times[i] == max)
				System.out.println(i+1);
	}
}

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

#include <stdio.h>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>
#include <numeric>
#include <iostream>
#include <random>
#include <map>
#include <unordered_map>
#include <queue>

#pragma GCC optimize("Ofast")
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, n) for(int i = 1; i <= (n); ++i)
#define rep2(i, n) for(int i = 2; i < (n); ++i)
#define repr(i, n) for(int i = n; i >= 0; --i)
#define reprm(i, n) for(int i = n - 1; i >= 0; --i)
#define printynl(a) printf(a ? "yes\n" : "no\n")
#define printyn(a) printf(a ? "Yes\n" : "No\n")
#define printYN(a) printf(a ? "YES\n" : "NO\n")
#define printin(a) printf(a ? "possible\n" : "inposible\n")
#define printdb(a) printf("%.50lf\n", a)//少数出力
#define printdbd(a) printf("%.16lf\n", a)//少数出力(桁少なめ)
#define prints(s) printf("%s\n", s.c_str())//string出力
#define all(x) (x).begin(), (x).end()
#define allsum(a, b, c) ((a + b) * c / 2)//等差数列の和、初項,末項,項数
#define p push
#define pb push_back
#define priq priority_queue
#define rpriq priq<int, vector<int>, greater<int>>
#define deg_to_rad(deg) (((deg)/360.0)*2.0*PI)
#define rad_to_deg(rad) (((rad)/2.0/PI)*360.0)
#define Please return
#define AC 0

using ll = long long;

const int INF = 1073741823;
const int MINF = -1073741823;
const ll LINF = ll(4661686018427387903);
const ll MOD = 1000000007;
const double PI = acos(-1);

using namespace std;

void scans(string& str) {
	char c;
	scanf("%c", &c);
	if (c == '\n')scanf("%c", &c);//最初の改行対策
	while (c != '\n' && c != -1) {
		str += c;
		scanf("%c", &c);
	}
}

void scanc(char& str) {
	char c;
	scanf("%c", &c);
	if (c == -1)return;
	while (c == '\n') {
		scanf("%c", &c);
	}
	str = c;
}

double acot(double x) {
	return PI / 2 - atan(x);
}

/*-----------------------------------------ここからコード-----------------------------------------*/


int main() {

	int n, m;
	scanf("%d%d", &n, &m);
	string s;
	scans(s);
	vector<int> ans;
	reverse(all(s));
	int now = 0, dice;
	while (now != n) {
		dice = m;
		while (now + dice > n)--dice;
		while (s[now + dice] == '1' && dice > 0)--dice;
		if (dice == 0) {
			printf("-1\n");
			return 0;
		}
		else {
			ans.pb(dice);
			now += dice;
		}
	}
	reverse(all(ans));
	for (auto a : ans)printf("%d\n", a);

	Please AC;
}


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

int main() {
  // ここにプログラム
  long int n, m;
  cin >> n >> m;
  if(n >= m) {
    cout << "0" << endl;
    return 0;
  }
  vector<long int> vec(m);
  for(long int i = 0; i < m; i++) {
    cin >> vec.at(i);
  }
  sort(vec.begin(), vec.end());
  vector<long int> ans(m - 1);
  long int sum = 0;
  for(long int i = 0; i < m - 1; i++) {
    ans.at(i) = vec.at(i + 1) - vec.at(i);
    sum += ans.at(i);
  }
  sort(ans.begin(), ans.end());
  for(long int i = 0; i < n - 1; i++) {
    sum -= ans.at(m - 2 - i);
  }
  cout << sum << endl;
  
    
  
  
}

Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <set>
#include <map>
#include <iomanip>
#include <cassert>
#include <stack>
#include <queue>
#include <deque>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
//using namespace __gnu_pbds;

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

// template<typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
//  order_of_key (k) : Number of items strictly smaller than k .
//  find_by_order(k) : K-th element in a set (counting from zero).
#define sz(a) (int)a.size()
#define all(a) a.begin(), a.end()
#define pb push_back
#define ppb pop_back
#define mkp make_pair
#define F first
#define S second
#define show(a) cerr << #a <<" -> "<< a <<"\n"
#define fo(a, b, c, d) for(int (a) = (b); (a) <= (c); (a) += (d))
#define foo(a, b, c ,d) for(int (a) = (b); (a) >= (c); (a) -= (d))
//#define int ll

const int N = 2e5 + 5;
const int oo = 1e9 + 5;
const int mod = 1e9 + 7;

int n, c[N], dp[N], last[N];

void solve() {
	cin >> n;
	for (int i = 1; i <= n; ++i) {
		cin >> c[i];
	}	
	dp[0] = 1;
	for (int i = 1; i <= n; ++i) {
		dp[i] = dp[i - 1];
		if (last[c[i]] && c[i] != c[i - 1]) {
			dp[i] += dp[last[c[i]]];
		}
		if (dp[i] >= mod) dp[i] -= mod;
		last[c[i]] = i;
	}
	cout << dp[n];
}

int main () {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int tt = 1;
	while (tt --) {
		solve();
	}
	return 0;
}
/*
	If you only do what you can do, 
	You will never be more than you are now!
*/

Measured memory_bytes: 2560
#include<stdio.h>

int main(){
    int ans = 0;
    char a[5];
    int i;

    scanf("%s", &a);

    for(i=0; i<4; i++){
        if(a[i] == '+'){
            ans += 1;
        }else{
            ans -= 1;
        }
    }

    printf("%d", ans);

    return 0;
}

Measured memory_bytes: 128
#include<stdio.h>

int main(){
    int A,B,C,i;
    int n=0;
    scanf("%d%d%d",&A,&B,&C);
    if(A*C<=B) n=C;
    else {for(i=0;B>=A*i;){i++;}
        n=i-1;}
    printf("%d\n",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){ //ok
  /* your code */
  NodePointer t = nil->next;
  //printf("list %d\n",t->key);
  while(1){
    if( key == t->key ){
        return t;
    }
    //printf("%d\n",t->key);
    t = t->next;
    if( t == nil ) break;
  }
 
  return nil;
}

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

void printList(){  //ok
  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){  //ok
  (t->next)->prev = t->prev;
  (t->prev)->next = t->next;
  return;
}

void deleteFirst(){  //ok
  NodePointer t = nil->next;
  if ( t == nil ) return;
  deleteNode(t);
  //printList();printf("\n");
  return;
}

void deleteLast(){  //ok
  NodePointer t = nil->prev;
  if ( t == nil ) return;
  deleteNode(t);
  //printList();printf("\n");
  return;
}

void delete(int key){//ok
  /* your code */
  NodePointer t = listSearch(key);
  if( t != nil ) deleteNode(t);
  return;
}

void insert(int key){
  NodePointer x;
  x = malloc(sizeof(struct node));
  x->key = key;
  x->next = nil->next;
  x->prev = nil;
  (nil->next)->prev = x;
  nil->next = x;
  return;
}

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", com); //printf("%s %d\n",com,key);
    if ( com[0] == 'i' ) {scanf("%d",&key);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 {
        scanf("%d",&key); delete(key); nd++; /*printList();printf("\n");*/
      }
      size--;
    }
  }

  printList();
  return 0;
}



Measured memory_bytes: 36044
from operator import mul
from functools import reduce

n,k=map(int,input().split())

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(lambda x,y: x*y ,range(n,n-r,-1))
    under = reduce(mul,range(1,r+1))
    return over // under %(1000000000+7)

for i in range(1,k+1):
    c=0
    if i<=n-k+1:
        c=cmb(n-k+1,i)*cmb(k-1,i-1)%(1000000000+7)
    print("{}".format(c))


Measured memory_bytes: 3944
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <ctime>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int main() {
	int n;
	cin >> n;
	vector<pair<double, int> > a(n);
	map<double, int> mp;
	REP(i,n){
		cin >> a[i].first;
		a[i].second = i;
		mp[a[i].first]++;
	}
	sort(ALL(a));
	VI ans(n);
	int x = 0;
	REP(i,n){
		int j = a[i].second;
		if (i > 0 && a[i].first == a[i-1].first){
			ans[j] = x;
			continue;
		}
		x = 3*i + mp[a[i].first] - 1;
		ans[j] = x;
	}
	REP(i,n) cout << ans[i] << endl;


    return 0;
}

Measured memory_bytes: 4928
#include <iostream>
using namespace std;
int main(void){
int h1,h2,k1,k2,a,b,c,d,H,K;
cin>>h1>>h2>>k1>>k2>>a>>b>>c>>d;
H=h1*a+h2*b+(h1/10*c)+(h2/20*d);
K=k1*a+k2*b+(k1/10*c)+(k2/20*d);
if(H<K){
    cout<<"kenjiro"<<endl;
   }
   else if(H>K){
        cout<<"hiroshi"<<endl;
   }
        else{
            
         cout<<"even"<<endl;
        }
        return 0;
        
    }




Measured memory_bytes: 3096
def DFS(s, t):
    t += 1
    flag[s] = 1
    d[s] = t
    for i in range(1, n+1):
        if G[s][i] == 1:
            if flag[i] == 0:
                DFS(i, t)
                t = f[i]
    f[s] = t + 1

n = int(raw_input())
G = [[0 for i in range(n+1)] for j in range(n+1)]
d = [0 for i in range(n+1)]
f = [0 for i in range(n+1)]

for i in range(n):
    v = map(int, raw_input().split())
    for j in range(v[1]):
        G[v[0]][v[2+j]] = 1

flag = [0 for i in range(n+1)]
for i in range(1, n+1):
    if flag[i] == 0:
        DFS(i, max(f))

for i in range(1, n+1):
    print(str(i) + " " + str(d[i]) + " " + str(f[i]))

Measured memory_bytes: 6480
#include<iostream>
#include<algorithm>
#include<string>
#include<cmath>
#include<vector>
using namespace std;

int main() {
	int n;
	cin >> n;
	int x[n], y[n], h[n];
	for (int i = 0; i < n; i++) {
		cin >> x[i] >> y[i] >> h[i];
	}
	//ok
	for (int i = 0; i < n; i++) {
		if (h[i] != 0) {
			swap(x[i], x[0]);
			swap(y[i], y[0]);
			swap(h[i], h[0]);
			break;
		}
	}
	//ok
	for (int cx = 0; cx <= 100; cx++) {
		for (int cy = 0; cy <= 100; cy++) {
			int H = h[0] + abs(x[0] - cx) + abs(y[0] - cy);//仮に決まったもの
			bool flag = true;
			for (int i = 0; i < n; i++) {//矛盾が無いか
				int p = H - abs(x[i] - cx) - abs(y[i] - cy);
				if (h[i] != max(p, 0))flag = false;
			}
			if (flag) {
				cout << cx << " " << cy << " " << H << endl;
			}
		}
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < (int)(n); i++)
#define ALL(a) a.begin(), a.end()
#define MOD 1000000007
using namespace std;
using ll = long long;

int main() {
    ll a, b, c, d; cin >> a >> b >> c >> d;

    ll ans = -(1LL << 60);
    ans = max(ans, a * c);
    ans = max(ans, a * d);
    ans = max(ans, b * c);
    ans = max(ans, b * d);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <limits>
#include <climits>
#include <utility>
#include <algorithm>
#include <numeric>

using namespace std;

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

int main()
{
    int N, K;
    cin >> N >> K;

    ll ans = K;

    for (int i = 1; i < N; ++i) {
        ans *= (K-1);
    }

    cout << ans << endl;

    return 0;
}


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

class Dice{
    int _num[6];
  public:
    void set(int num[6]){
        for(int i=0;i<6;i++){
            _num[i] = num[i];
        }
    }
    void printTop(){
        cout << _num[0] << endl;
    }
    void printRight(){
        cout << _num[2] << endl;
    }
    void N(){
        int buf = _num[0];
        _num[0] = _num[1];
        _num[1] = _num[5];
        _num[5] = _num[4];
        _num[4] = buf;
    }
    void S(){
        int buf = _num[0];
        _num[0] = _num[4];
        _num[4] = _num[5];
        _num[5] = _num[1];
        _num[1] = buf;
    }
    void W(){
        int buf = _num[0];
        _num[0] = _num[2];
        _num[2] = _num[5];
        _num[5] = _num[3];
        _num[3] = buf;
    }
    void E(){
        int buf = _num[0];
        _num[0] = _num[3];
        _num[3] = _num[5];
        _num[5] = _num[2];
        _num[2] = buf;
    }
    void SetTop(int n){
        if(_num[2]==n)
            W();
        else if(_num[3]==n)
            E();
        else{
            while(true){
                if(_num[0]==n)
                    break;
                S();
            }
        }
    }
    void SetFront(int n){
            while(true){
                if(_num[1]==n)
                    break;
                S();
                W();
                N();
            }
    }
};

int main(void){
    int num[6];
    for(int i=0;i<6;i++){
        int n;
        cin >> n;
        num[i] = n;
    }
    
    Dice d;
    d.set(num);
    
    int q;
    cin >> q;

    for(int i=0;i<q;i++){
        int t,f;
        cin >> t >> f;

        d.SetTop(t);
        d.SetFront(f);
        
        d.printRight();
    }
    

    return 0;
}

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

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

const int MAX = 1e6 + 10;
const int INF = 1e9;
const ll MOD = 1e9 + 7;

int N, A[MAX];

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

    int maxi[2];
    maxi[0] = maxi[1] = 0;

    for(int i=0;i<N;i++){
        if(maxi[0] < A[i]){
            maxi[1] = maxi[0];
            maxi[0] = A[i];
        } else if(maxi[1] < A[i]){
            maxi[1] = A[i];
        }
    }

    for(int i=0;i<N;i++){
        if(maxi[0] == A[i]) cout << maxi[1] << endl;
        else cout << maxi[0] << endl;
    }
}

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

int main(){
  string S;
  cin >> S;
  bool flag = true;
  int n = S.size();
  if(n % 2 == 1) flag = false;
  for(int i = 0; i < n; i++){
    if(i % 2 == 0 && S.at(i) != 'h') flag = false;
    if(i % 2 == 1 && S.at(i) != 'i') flag = false;
  }
  if(flag) cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 256
using System;
using System.Linq;//リストの使用
using System.Collections.Generic;
class Program
{
	static void Main()
	{
		string[] input = Console.ReadLine().Split(' ');//Splitで区切り文字を指定して複数個受け取る。
		long m = long.Parse(input[0]);
		long n = long.Parse(input[1]);

		Console.WriteLine(DivideMod(m,n,1000000007));//WriteLineをWriteとすると、改行なしで出力。
	}

  static long DivideMod(long x, long a, long p)//戻り値はx^a(mod p)
{
  long num = 2;
  long answer = 1;
  long check = a;
  long memo = x%p;
  
  while(check > 0)
  {
    if(check % num == num / 2)
    {
      check -= num / 2;
      answer *= memo;
      answer %= p;
    }
  memo *= memo;
  memo %= p;
  num *= 2;
  }
  return answer;
}

  
}


Measured memory_bytes: 17964