akhauriyash/Code-Regression huggingface dataset:
#157b
a=[[int(i) for i in input().split()] for _ in range(3)]
n=int(input())
for i in range(n):
    b=int(input())
    for j in range(3):
        for k in range(3):
            if a[j][k]==b:
               a[j][k]=0
ans='No'
for i in range(3):
    if a[i][0]==a[i][1]==a[i][2]:
        ans='Yes'
    elif a[0][i]==a[1][i]==a[2][i]:
        ans='Yes'
    elif a[0][0]==a[1][1]==a[2][2]:
        ans='Yes'
    elif a[0][2]==a[1][1]==a[2][0]:
        ans='Yes'
print(ans)


Measured memory_bytes: 3064
#!/usr/bin/env python

n = int(input())
a = list(map(int, input().split()))

mod = int(1e9)+7

total = sum(a)
ans = 0 
for i in range(n):
    ans += (a[i]*(total-a[i]))%mod
    total -= a[i]

print(ans%mod)


Measured memory_bytes: 31600
<?php
$dollar =trim(fgets(STDIN));
$count =0;

for($j=0;$j<=14;$j++){
    for ($i=0;$i<=25;$i++){    
      
        $total =$i*4+$j*7;
        if ($total==$dollar){
            $count++;
        }
    }
}

if ($count>0){
    echo "Yes";
}else{
    echo "No";
}

?>

Measured memory_bytes: 4732
/**********************************************************************
   File hoge.cpp
   Author  harunaya
   Date   2020-08-27(Thu)
   note   
**********************************************************************/

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

int main() {
  int n, x, t; 
  cin >> n >> x >> t;
  int ans = 0;
  int count = 0;
  for (int i = 0; i <= 1000; ++i) {
    if (x*i >= n) {
      break;
    }
    count++;
  }
  cout << count*t << endl;
  return 0; 
}

Measured memory_bytes: 3552
#include <bits/stdc++.h>  
using namespace std;
using ll = long long int;
using pii = pair<int, int>;
#define rep(i,n) for(ll i=1; i<=(ll)(n); i++)
ll l=1000000007;

int main() {
  ll n,m;cin>>n>>m;
  ll ans=1;
  if(abs(n-m)<=1){
    rep(i,n){
      ans*=i;
      if(ans>=l)ans%=l;
    }
    rep(i,m){
      ans*=i;
      if(ans>=l)ans%=l;
    }
    if(n==m){
      ans*=2;
      if(ans>=l)ans%=l;
    }
  }
  else{ans=0;}
  cout<<ans;
  
  
}

Measured memory_bytes: 3640
/**
 *    author:  otera    
**/
#include<iostream>
#include<string> 
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm> 
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

//#define int long long
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cerr << #x << " = " << (x) << endl;
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 solve() {
	int n; cin >> n;
    vector<int> a(n);
    int ans = 0;
    rep(i, n) {
        cin >> a[i];
        if(i % 2 == 0 && a[i] % 2 == 1) ++ ans;
    }
    cout << ans << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//int t; cin >> t; rep(i, t)solve();
	solve();
    return 0;
}

Measured memory_bytes: 3640
#include<iostream>
#include<cstdlib>
#include<string>
#include<vector>
#include<map>
#include<unordered_map>
#include<queue>
#include<algorithm>
#include<iomanip>
#include<typeinfo>
#include<complex>
using namespace std;
using ll = long long int;
const int mod = 1e9 + 7;
#define rep(i, a, b) for(ll i = a;i < b; i++)
const long double PI = (acos(-1));

int main() {

	vector<int> a(5);
	int mini = 10;

	rep(i, 0, 5) {
		cin >> a[i];
		if (a[i] % 10 != 0) mini = min(mini, a[i] % 10);
	}

	int ans = 0;
	rep(i, 0, 5) {
		int x = a[i] % 10;
		if (x == 0) ans += a[i];
		else if (x != mini) ans += a[i] + (10 - x);
		else {
			ans += a[i];
			mini = 10;
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<stdio.h>
#include<cmath>
#include<string.h>

using namespace std;

int main(void)
{
	char a[5];
	int i;
	int num=0;
	for (i = 0; i < 4; i++)
	{
		cin >> a[i];
	}
	for (i = 0; i < 3; i++)
	{
		if (a[i] == a[i + 1]&&a[1]==a[i])
		{
			num++;
		}
	}
	if (num == 2||num==3)
	{
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
N,M=map(int,input().split())
S=input()
S=S[::-1]
now = 0
ok=1
history = []
while True:
  for i in range(min(M, N-now),0,-1):
    if S[now+i] == '0':
      now += i
      history.append(str(i))
      break
    if i==1:
      print(-1)
      ok=0
      break
  if ok==0:break
  if now == N:break

if ok==1:print(' '.join(history[::-1]))

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

int N;
int num;
vector <int> b;
vector <int> ans;
bool possible=true;

int main()
{
    cin>>N;

    for (int i=0; i<N; i++)
    {
        cin>>num;
        b.push_back(num);
    }

    while (possible)
    {
        possible=false;
        
        for (int i=b.size()-1; i>=0; i--)
        {
            if (b[i]==i+1)
            {
                b.erase(b.begin()+i);
                possible=true;
                ans.push_back(i+1);
                break;
            }
        }
    }

    reverse(ans.begin(), ans.end());

    if (b.empty())
    {
        for (int i=0; i<ans.size(); i++)
        {
            cout<<ans[i]<<endl;
        }
    }

    else
    {
        cout<<"-1"<<endl;
    }
}

Measured memory_bytes: 3620
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt(), B = sc.nextInt();
		if(A % 2 != B % 2)
			System.out.println("IMPOSSIBLE");
		else
			System.out.println((A+B)/2);

	}

}


Measured memory_bytes: 21332
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
using ll = long long ;
using P = pair<int,int> ;
using pll = pair<long long,long long>;
constexpr int INF = 1e9;
constexpr long long LINF = 1e17;
constexpr int MOD = 1000000007;


struct SegmentTree{
        int n;
        vector<ll> node;
        
        SegmentTree(vector<ll> v){
                int sz = v.size();
                n = 1;
                while(n < sz) n *= 2;
                node.resize(2*n-1,0);
                for(int i=0;i<sz;i++) node[i+n-1] = v[i];
                for(int i=n-2;i>=0;i--) node[i] = max(node[2*i+1],node[2*i+2]);
        }
        
        void update(int x,ll val){
                x += n-1;
                node[x] = val;
                while(x > 0){
                        x = (x-1)/2;
                        node[x] = max(node[2*x+1],node[2*x+2]);
                }
        }
        
        ll getmax(int a,int b,int k=0,int l=0,int r=-1){
                if(r < 0) r = n;
                if(r <= a || b <= l) return 0;
                if(a <= l && r <= b) return node[k];
                ll vl = getmax(a,b,2*k+1,l,(l+r)/2);
                ll vr = getmax(a,b,2*k+2,(l+r)/2,r);
                return max(vl,vr);
        }
};

int main(){
    int n;
    cin >> n;
    vector<ll> h(n),a(n),dp(n,0);
    rep(i,n){
        cin >> h[i];
        --h[i];
    }
    rep(i,n) cin >> a[i];
    SegmentTree segdp(dp);
    rep(i,n){
        ll now = segdp.getmax(0,h[i]) + a[i];
        segdp.update(h[i],now);
    }
    cout << segdp.getmax(0,n+1) << endl;
    return 0;
}

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

int main() {
  vector<char> S(4);
  for(int i=0;i<4;i++){
  	cin>>S.at(i);
  }
  sort(S.begin(),S.end());
  
  if((S.at(0)==S.at(1)&&S.at(2)==S.at(3))&&S.at(0)!=S.at(2))
    cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
namespace I_am_the_brown_coder{
    class Inonoa{
        static void Main(){
            string[] w_h_x_y = Console.ReadLine().Split();
            long w = long.Parse(w_h_x_y[0]);
            long h = long.Parse(w_h_x_y[1]);
            long x = long.Parse(w_h_x_y[2]);
            long y = long.Parse(w_h_x_y[3]);

            Console.Write( ((double)w*h/2.0 ).ToString()+ " ");
            if(x*2==w && y*2==h){
                Console.WriteLine(1);
            }else{
                Console.WriteLine(0);
            }
        }
    }
}


Measured memory_bytes: 11092
W = input()
dic = {}

for w in W:
  if w in dic:
    dic[w] += 1
  else:
    dic[w] = 1

count = 0
for i in dic.values():
  if i % 2 == 0: count += 1

if count == len(dic): print("Yes")
else: print("No")

Measured memory_bytes: 3064
#include <iostream>
#include<vector>
#include<map>
#include<string>
#include<stdio.h>
#include<math.h>
#include <algorithm>

#define PI		3.14159265358979
#define IMAX	2147483647

using namespace std;

int main(void) {

	string ans = "Yes";

	char a;
	char b;
	int a1 = 0;
	int b1 = 0;

	string str;
	cin >> str;

	a = str[0];
	for (int i = 1; i < str.size(); i++) {
		if (str[i] == a)continue;
		if (str[i] != a) {
			b = str[i];
			break;
		}
	}
	for (int i = 0; i < str.size(); i++) {
		if (str[i] == a ) {
			a1++;
			continue;
		}
		if (str[i] == b) {
			b1++;
			continue;
		}
		ans = "No";
		break;
	}
	if ((a == b) || (a1 != 2)) {
		ans = "No";
	}




	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
using System;
class Program
{
    static void Main(string[] args)
    {
        int N = int.Parse(Console.ReadLine());
        double sum = 0;
        for(int i = 0; i < N; i++)
        {
            string[] input = Console.ReadLine().Split(' ');
            if(input[1][0] == 'J')
            {
                sum += float.Parse(input[0]);
            }
            else
            {
                sum += float.Parse(input[0]) * 380000f;
            }
        }
        Console.WriteLine(sum);
    }
}


Measured memory_bytes: 13140
#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <math.h>
using namespace std;

struct Card{
    char suit, value;
};

void solve() {
    int n;
    cin >> n;

    int res = 0;
    for(int i = 1; i <= 50000; i++){
        if((int)(i * 1.08) == n) {
            res = i;
            break;
        }
    }
    if(res == 0) cout << ":(" << endl;
    else cout << res << endl;
}

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

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

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

  int sum = 0, x = -1, y = -1, t = -1; 
  
  for (int i = 0; i <= N; i++) {
    for (int j = 0; j <= N; j++) {
      int z = N - i - j;
      if (z < 0) continue;
      int tmp = 10000 * i + 5000 * j + 1000 * z;
      if (Y == tmp) {
        //cout << i << " " << j << " " << z << endl;
        x = i, y = j, t = z;
      }
    }
  }
  cout << x << " " << y << " " << t << endl;
}

Measured memory_bytes: 3608
#include<bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i,n) for(int i=0;i<n;++i)
#define all(v) v.begin(), v.end()
#define PI 3.141592653589793238462643383279
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))
typedef long long int ll;
typedef unsigned long long ull;
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;}
typedef pair<ll,ll> P;
const long long MOD = 1e9+7;
const ll INF = 1LL << 60;
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};

int main(){
    int x; cin >> x;
    if(x >= 30){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }


}

Measured memory_bytes: 3632
#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <numeric>
#include <algorithm>

using namespace std;
using lint = long long;
constexpr int MOD = 1000000007, INF = 1010101010;
constexpr lint LINF = 1LL << 60;

template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
	for (const auto &e : vec) os << e << (&e == &vec.back() ? "\n" : " ");
	return os;
}

#ifdef _DEBUG
template <class T>
void dump(const char* str, T &&h) { cerr << str << " = " << h << "\n"; };
template <class Head, class... Tail>
void dump(const char* str, Head &&h, Tail &&... t) {
	while (*str != ',') cerr << *str++; cerr << " = " << h << "\n";
	dump(str + (*(str + 1) == ' ' ? 2 : 1), t...);
}
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else 
#define DMP(...) ((void)0)
#endif

template<class T>
inline bool chmin(T &a, const T b) { return a > b && (a = b, true); }

template<class T>
struct Edge {
	int to;
	T cost;
	Edge() {}
	Edge(int to, T cost) : to(to), cost(cost) {}
	bool operator>(const Edge &r) const { return this->cost > r.cost; }
};

template<class T>
vector<T> Dijkstra(const vector<vector<Edge<T>>> &edges, const int st) {

	const int V = (int)edges.size();
	const T inf = numeric_limits<T>::max() / 2;
	vector<T> cost(V, inf);

	cost[st] = 0;

	priority_queue<Edge<T>, vector<Edge<T>>, greater<Edge<T>>> pq;
	pq.emplace(st, cost[st]);

	while (!pq.empty()) {

		Edge<T> now(pq.top().to, pq.top().cost);
		pq.pop();

		if (cost[now.to] < now.cost) continue;
		for (const Edge<T> &e : edges[now.to]) {
			T tmp_cost = now.cost + e.cost;
			if (cost[e.to] > tmp_cost) {
				cost[e.to] = tmp_cost;
				pq.emplace(e.to, cost[e.to]);
			}
		}
	}

	return cost; // min cost to vertex idx from st
}

int main() {

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

	int N, M, S;
	cin >> N >> M >> S;
	
	const int A_max = 2500;
	vector<vector<Edge<lint>>> edges(N * A_max);
	for (int i = 0; i < M; i++) {
		int u, v, time, cost;
		cin >> u >> v >> cost >> time;
		u--, v--;
		for (int j = 0; j + cost < A_max; j++) {
			edges[u * A_max + j + cost].emplace_back(v * A_max + j, time);
			edges[v * A_max + j + cost].emplace_back(u * A_max + j, time);
		}
	}

	for (int i = 0; i < N; i++) {
		int cost, time;
		cin >> cost >> time;
		for (int j = 0; j + cost < A_max; j++) {
			edges[i * A_max + j].emplace_back(i * A_max + cost + j, time);
		}
	}

	auto d = Dijkstra(edges, min(S, A_max - 1));
	for (int i = 1; i < N; i++) {
		lint ans = LINF;
		for (int j = 0; j < A_max; j++) {
			chmin(ans, d[i * A_max + j]);
		}
		cout << ans << "\n";
	}

	return 0;
}

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

using namespace std;
const int N = 3005;
const int MOD = 1e9+7;
int dp[N][N];

int main()
{
    int n;
    string s;
    cin >> n >> s;
    dp[1][1] = 1;
    for (int i = 2; i<=n; i++)
    {
        if (s[i-2] == '<')
        {
            for (int j = 1; j<=i; j++)
                dp[i][j] = (dp[i-1][j-1]+dp[i][j-1])%MOD;
        }
        else
        {
            for (int j = i-1; j>=1; j--)
                dp[i][j] = (dp[i-1][j]+dp[i][j+1])%MOD;
        }
    }
    int ans = 0;
    for (int i = 1; i<=n; i++)
        ans = (ans+dp[n][i])%MOD;
    cout << ans;
}


Measured memory_bytes: 34176
#include<cstdio>
#include<algorithm>
#include<functional>
#include<cstring>
#include<queue>
using namespace std;
typedef pair<int,int> P;
char s[1000][1001];
int a[1000][1000];
int main(void)
{
	int i,j,h,w,ch,cw,dh,dw,cnt,x,y,cc,xx,yy,flg;
	priority_queue<P,vector<P> ,greater<P> > q;
	P pp;
	int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};
	int dx2[24]={-2,-2,-2,-2,-2,-1,-1,-1,-1,-1,0,0,0,0,
	1,1,1,1,1,2,2,2,2,2};
	int dy2[24]={-2,-1,0,1,2,-2,-1,0,1,2,-2,-1,1,2,
			-2,-1,0,1,2,-2,-1,0,1,2};
	scanf("%d %d",&h,&w);
	scanf("%d %d",&ch,&cw);
	ch--;	cw--;
	scanf("%d %d",&dh,&dw);
	dh--;	dw--;
	for(i=0;i<h;i++)	scanf("%s",s[i]);
	for(i=0;i<h;i++)	{
		for(j=0;j<w;j++)	{
			if(s[i][j]=='#')	a[i][j]=-2;
			else a[i][j]=-1;
		}
	}
	pp.first=0;	pp.second=ch*10000+cw;
	q.push(pp);
	a[ch][cw]=0;
	flg=0;
	while(q.size()!=0)	{
		pp=q.top();
		x=pp.second%10000;	y=pp.second/10000;	cc=pp.first;
		q.pop();
		if(cc==a[y][x])	{
			if(x==dw && y==dh)	{
				flg=1;	break;
			}
			for(i=0;i<4;i++)	{
				xx=x+dx[i];	yy=y+dy[i];
				if(xx>=0 && xx<w && yy>=0 && yy<h &&
				(a[yy][xx]==-1 || a[yy][xx]>cc))	{
					pp.first=cc;	pp.second=yy*10000+xx;
					q.push(pp);
					a[yy][xx]=cc;
				}
			}
			for(i=0;i<24;i++)	{
				xx=x+dx2[i];	yy=y+dy2[i];
				if(xx>=0 && xx<w && yy>=0 && yy<h &&
				(a[yy][xx]==-1 || a[yy][xx]>cc+1))	{
					pp.first=cc+1;	pp.second=yy*10000+xx;
					q.push(pp);
					a[yy][xx]=cc+1;
				}
			}
		}
	}
	if(flg==1)	printf("%d\n",cc);
	else printf("-1\n");
	return 0;
}

Measured memory_bytes: 8076
n,m=map(int,input().split())
A=sorted(list(map(int,input().split())))[::-1]
vote_min=sum(A)*(1/(4*m))
prod_popular=0
ans="No"
for a in A:
    if a>=vote_min:
        prod_popular+=1
    if prod_popular==m:
        ans="Yes"
print(ans)

Measured memory_bytes: 9188
s=input()
n=len(s)

ans=[0] * n

for i in range(n-1):
    if s[i] == 'R' and s[i+1] == 'L':
        
        cnt=2 # while一回目を偶数にしたい
        xi = i
        # 左側R探索
        while xi >= 0:
            if s[xi] == 'L': break
            if cnt % 2 :ans[i+1] += 1
            else:ans[i] +=1

            cnt+=1
            xi -=1

        cnt=2
        yi = i +1
        # 左側L探索
        while yi < n:
            if s[yi] == 'R': break
            if cnt % 2 :ans[i] += 1
            else:ans[i+1] +=1

            cnt+=1
            yi +=1
            

print(" ".join(map(str,ans)))


Measured memory_bytes: 10484
import java.util.*;
import java.lang.*;

class Main {
	public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();

        PriorityQueue<Integer> pq = new PriorityQueue<>(Comparator.reverseOrder());

        for(int i = 0; i < N; i++){
            pq.add(sc.nextInt());
        }

        for(int i = 0; i < M; i++){
            pq.add(pq.poll() / 2);
        }

        long minSum = 0;
        for(int i = 0; i < N; i++){
            minSum = minSum + pq.poll();
        }

        System.out.println(minSum);

    }
}






Measured memory_bytes: 60004
# -*- coding: utf-8 -*-
import sys
from collections import defaultdict
from fractions import gcd
N=int(sys.stdin.readline().strip())
A=map(int, sys.stdin.readline().split())

def factorization(n):
    arr=set()
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.add(i)

    if temp!=1:
        arr.add(temp)

    if arr==[]:
        arr.add(n)

    return arr

pairwise_coprime=True

SOINSU=defaultdict(lambda: 0)

setwise_coprime=None
for i,a in enumerate(A):
    #全ての数が互いに素か　pairwise coprime判定
    if pairwise_coprime==False:
        pass
    else:
        f=factorization(a)
        for x in f:
            if SOINSU[x]==1:
                pairwise_coprime=False
                break
            SOINSU[x]=1
    #GCDの累積を取る　setwise coprime判定
    if i==0:
        setwise_coprime=a
    else:
        setwise_coprime=gcd(setwise_coprime,a)

if pairwise_coprime==True:
    print "pairwise coprime"
elif setwise_coprime==1:
    print "setwise coprime"
else:
    print "not coprime"

Measured memory_bytes: 174600
'use strict'
const main = input => {
  input = input[0].split(' ');
  const n = parseInt(input[0], 10), d = parseInt(input[1], 10); 
  console.log(Math.ceil(n/(2*d+1)));
  
}
main(require("fs").readFileSync("/dev/stdin", "utf8").split('\n'));

Measured memory_bytes: 7372
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
typedef pair<ll,ll> P;
using VP = vector<P>; using VVP = vector<VP>;
using VI = vector<ll>; using VVI = vector<VI>; using VVVI = vector<VVI>;
const int inf=1e9+7;
const ll INF=1LL<<61;
const ll mod=1e9+7;

int main(){
  int i,j;
  int n,m;
  cin>>n>>m;
  if(n==m) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;

  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>                                                 
                                                                  
int main(void){                                                   
   int N;                                                         
   scanf("%d",&N);                                                
                                                                  
   if(N / 100 == 7 || (N/10)%10 == 7 || N % 10 == 7){             
      printf("Yes");                                              
   } else {                                                       
      printf("No");                                               
   }                                                              
   return 0;                                                      
} 

Measured memory_bytes: 1696
#include<stdio.h>
int main(){
    int p,q,r;
    scanf("%d%d%d",&p,&q,&r);
    if(p>=q&&p>=r)printf("%d",q+r);
    else if(q>=p&&q>=r)printf("%d",p+r);
    else printf("%d",p+q);
    return 0;
}

Measured memory_bytes: 128
from sys import stdin
from math import ceil, floor
n,a,b = [int(x) for x in stdin.readline().rstrip().split()]
s=list(stdin.readline().rstrip())
c=a+b
d=e=0
for i in range(n):
    if d<c and s[i]=="a":
        print("Yes")
        d+=1
    elif d<c and e<b and s[i]=="b":
        print("Yes")
        d+=1
        e+=1
    else:
        print("No")

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

using namespace std;
using Graph = vector<vector<int>>;
using Grid= vector<vector<char>>;
using vin= vector<int>;
using ll=long long;
using vll= vector<ll>;
using vbl=vector<bool>;
using vch=vector<char>;
using pinin=pair<int ,int>;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rell(i,n) for (ll i=0; i< (ll)(n); i++)
#define sort(x) sort(x.begin(), x.end());
#define rese(x) reverse(x.begin(), x.end());
#define vnn(x,y,name) vector<vector<int>> name(x, vector<int>(y));

string yes="Yes",no="No";

int main() {
    ll n,m,k;
    cin>>n>>m>>k;
    vll a(n),b(m);
    rep(i,n) cin>>a[i];
    rep(i,m) cin>>b[i];
    vll bsum(m+1,0),asum(n+1,0);
    rep(i,m) bsum[i+1]=bsum[i]+b[i];
    rep(i,n) asum[i+1]=asum[i]+a[i];
    ll ans=0;
    rep(i,n+1){
        if(asum[i]>k) break;
        ll ok=-1,ng=m+1;
        while(ng-ok>1){
            int mid=(ok+ng)/2;
            if(asum[i]+bsum[mid]>k) ng=mid;
            else ok=mid;
        }
        ans=max(ans,i+ok);
    }
    cout<<ans<<endl;
    
    
    
}


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

#define ll long long
#define pi acos(-1)
#define valid(a , b) a >= 0 && a < r && b >= 0 && b < c && arr[a][b] == '.'

int main()
{
    //ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    /*
    #ifndef ONLINE_JUDGE
    freopen("input.cpp", "r" , stdin);
    //freopen("output.cpp" , "w" , stdout);
    #endif // ONLINE_JUDGE
    //*/
    ll h;cin >> h;
    ll ans = 0;
    ll prev = 1;
    while(h != 1){
        ans += prev;
        prev *= 2;
        h /= 2;
    }
    ans += prev;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <iomanip>
#include <tuple>
using namespace std;
using i64 = int64_t;
#define rep(i, j, n) for(int i = (j); i < (n); ++i)
#define rrep(i, j, n) for(int i = (n) - 1; (j) <= i; --i)
constexpr i64 MOD = 1000000007;
constexpr i64 INF = 1LL << 60;

int main() {
	int n; cin >> n;
	int t = 0, x = 0, y = 0, nt, nx, ny;
	rep(i, 0, n) {
		cin >> nt >> nx >> ny;
		int move = abs(x - nx) + abs(y - ny);
		int dt = nt - t;
		if (move > dt || (move + dt) % 2) {
			cout << "No" << endl;
			return 0;
		}
		t = nt;
		x = nx;
		y = ny;
	}
	cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n,s,sum=0;
    cin>>n;
    std::deque<int> score;
    for (int i=0;i<n;i++) {
        cin>>s;
        score.emplace_back(s);
        sum+=s;
    }
    sort(score.begin(),score.end());
    if (sum%10==0) {
        for (int j=0;j<n;j++) {
            if ( (sum-score[j])%10!=0 ) {
                cout<<sum-score[j]<<endl;
                break;
            }
            if (j==n-1&&(sum-score[j])%10==0) {
                cout<<0<<endl;
            }
        }
    } else {
        cout<<sum<<endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int flag=1,i;
  string s;
  cin>>s;
  int n=s.length();
  for(i=0;i<n;i++)
  {
    char ch=s.at(i);
    if((i+1)%2==0)
    {
      if(ch!='L' && ch!='U' && ch!='D')
      {
        flag=0;
        break;
      }
    }
    if((i+1)%2!=0)
    {
      if(ch!='R' && ch!='U' && ch!='D')
      {
        flag=0;
        break;
      }
    }
  }
  if(flag==1)
    cout<<"Yes";
  else
    cout<<"No";
}

Measured memory_bytes: 256
MOD = 10 ** 9 + 7
N, M = map(int, input().split())
table = [0] * (N + 1)
table[0] = 1
banned = [0] * (N + 1)
for _ in range(M):
    banned[int(input())] = 1
for i in range(N + 1):
    now = table[i]
    if i + 1 < N + 1 and not banned[i + 1]:
        table[i + 1] = (table[i + 1] + now) % MOD
    if i + 2 < N + 1 and not banned[i + 2]:
        table[i + 2] = (table[i + 2] + now) % MOD
print(table[N])

Measured memory_bytes: 7736
#include <iostream>
#include <string>
#include <stdio.h>
#include <cmath>
#include <cfloat>
#include <algorithm>
#include <numeric>
#include <vector>
#include <iterator>
#include <set>
#include <map>
using namespace std;

const double PI=acos(-1);

int main(){
    long n, sum = 0;
    cin >> n;
    vector<long> a(n+1), b(n);
    for(int i = 0; i < n+1; i++) cin >> a[i];
    for(int i = 0; i < n; i++) cin >> b[i];
    for(int i = 0; i < n; i++){
        sum += min(a[i]+a[i+1], b[i]);
        if(a[i] < b[i]){
            a[i+1] -= b[i] - a[i];
            if(a[i+1] < 0) a[i+1] = 0;
        }
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 1792
//### In The Name Of GOD ###

//%% Remember; (((He))) is The (((Accepter))) %%

// GOD IS GREATER ...

#include <bits/stdc++.h>

using namespace std;

typedef long long ll ;
typedef long double ld ;

#define int ll
#define pb push_back
#define bp pop_back
#define pf push_front
#define fp pop_front
#define X first
#define Y second
#define IO ios_base::sync_with_stdio(false);
#define sz(a) (int)(a.size())
#define sg(a, b) (a + b - 1) / b

const int MOD = 1000 * 1000 * 1000 + 7;
const int INF = (int)8 * 1000 * 1000 * 1000 + 200;
const int MAXN =  100 * 1000 + 10;
const int MLOG = 80;
const int NMAX = 20;

signed main() {
	IO;
	int h, w, a, b;
	cin >> h >> w >> a >> b;
	int A[h][w] = {};
	if(a > w / 2 || b > h / 2){cout << -1; return 0;}
	for(int i = 0; i < h; i++) {
		for(int j = 0; j < w; j++){
			if((i < b)^(j < a)) A[i][j] = true;
		}
	}
	for(int i = 0; i < h; i++, cout << endl) 
		 for(int j = 0; j < w; j++)
			 cout << A[i][j];

}


Measured memory_bytes: 9088
n = int(input())
cs = ['M', 'A', 'R', 'C', 'H']
nums = dict()
for c in cs:
    nums.setdefault(c, 0)

for i in range(n):
    s = input()
    try:
        nums[s[0]] += 1
    except:
        pass

from itertools import combinations
ans = 0
for c1, c2, c3 in combinations(cs, 3):
    ans += nums[c1] * nums[c2] * nums[c3]
print(ans)


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

int main() {
  int N, Sum=0, cnt=1;
  cin >> N;
  vector<int> A(N);
  rep(i, N) cin >> A.at(i);
  rep(i, N){
    if(A.at(i)!=cnt) Sum++;
    else cnt++;
  }
  if(Sum!=N) cout << Sum << endl;
  else cout << -1 << endl;
}

Measured memory_bytes: 1024
s=list(input())
count=0
if len(s)%2==0:
  for i in range(int(len(s)/2)):
    if s[i]!=s[len(s)-1-i]:
      s[len(s)-1-i]=s[i]
      count+=1
elif len(s)%2!=0:
  for i in range(int((len(s)-1)/2)):
    if s[i]!=s[len(s)-1-i]:
      s[len(s)-1-i]=s[i]
      count+=1
print(count)

Measured memory_bytes: 3064
#![allow(non_snake_case)]
#![allow(unused_imports)]
#![allow(dead_code)]

use proconio::{input, fastout};
use proconio::marker::*;
use whiteread::parse_line;
use std::collections::*;
use num::*;
use num_traits::*;
use superslice::*;
use std::ops::*;

use itertools::Itertools;
use itertools_num::ItertoolsNum;


#[fastout]
fn solve() {
    const MOD: usize = 1_000_000_007;
    const INF: usize = std::usize::MAX;
    
    input!{
        n: isize, a: isize, b: isize,
    }

    let mut v = vec![];

    if (b - a) % 2 == 0 {
        v.push((b - a) / 2)
    } else {
        v.push(std::cmp::min(n-b, a-1) + 1 + (b-a-1)/2);
    }

    println!("{}", v.iter().min().unwrap())
}

fn main() {
    solve()
}

#[cfg(test)]
mod test {
    use super::solve;
}


Measured memory_bytes: 2184
from collections import deque


def bfs(que, maze, dis):
    max_x = len(maze[0])
    max_y = len(maze)

    while len(q) > 0:
        x, y, d = que.popleft()
        dxy = [[-1, 0], [1, 0], [0, 1], [0, -1]]

        for dx, dy in dxy:
            nx = x + dx
            ny = y + dy

            if 0 > nx or max_x <= nx or 0 > ny or max_y <= ny:
                continue
            if maze[ny][nx] == "#":
                continue
            if dis[ny][nx] != -1:
                continue

            dis[ny][nx] = d + 1
            que.append([nx, ny, dis[ny][nx]])

    return


h, w = map(int, input().split())
maze = [[] for _ in range(h)]
distance = [[-1] * w for _ in range(h)]

for i in range(h):
    maze[i] = input()

q = deque()

for i in range(h):
    for j in range(w):
        if maze[i][j] == "#":
            q.append([j, i, 0])

bfs(q, maze, distance)

ans = 0
for i in range(h):
    for j in range(w):
        ans = max(ans, distance[i][j])

print(ans)


Measured memory_bytes: 148956
#include<iostream>
#include<cstdlib>
#include<cstring>
#include<stack>
#include<queue>
#include<algorithm>
#include<vector>
#include<math.h>
#include<bitset>
#include<iomanip>
#include<numeric>
#include<list>
using namespace std;

typedef stack<int> IntStack;
typedef queue<int> IntQueue;

const double pi = 3.141592653589793;


//最大公約数
template<class T> T gcd(T a, T b)
{
	while (true)
	{
		T r;
		if (a%b == 0) return b;
		else
		{
			r = a % b;
			a = b;
			b = r;
		}
	}
}
//最小公倍数
template<class T> T lcm(T a, T b)
{
	return a / gcd(a, b)*b;
}
//文字0~9をint型0~9に変換
int char_to_int(char c)
{
	if (c == '0') return 0;
	if (c == '1') return 1;
	if (c == '2') return 2;
	if (c == '3') return 3;
	if (c == '4') return 4;
	if (c == '5') return 5;
	if (c == '6') return 6;
	if (c == '7') return 7;
	if (c == '8') return 8;
	if (c == '9') return 9;
	else return -1;
}
//int型0~9を文字0~9に変換
char int_to_char(int c) {
	if (c == 0) return '0';
	if (c == 1) return '1';
	if (c == 2) return '2';
	if (c == 3) return '3';
	if (c == 4) return '4';
	if (c == 5) return '5';
	if (c == 6) return '6';
	if (c == 7) return '7';
	if (c == 8) return '8';
	if (c == 9) return '9';
	else return'x';
}
//a^b mod MODを計算
long long int ModPower(long long int a, long long int b, long long int MOD)
{
	if (b == 0) return 1;
	else if (b % 2 == 0)
	{
		long long int d = ModPower(a, b / 2, MOD);
		return (d*d) % MOD;
	}
	else
	{
		return (a*ModPower(a, b - 1, MOD)) % MOD;
	}
}
//nCr mod MODを計算
long long int ModCombi(long long int n, long long int r, long long int MOD)
{
	if (n == 0 || r == 0) return 1;

	long long int Kn = 1, Kr = 1, Knr = 1;

	long long int temp = 1;
	for (long long int i = 1; i <= n; i++)
	{
		temp *= i;
		temp %= MOD;
		if (i == n) Kn = temp;
		if (i == r) Kr = temp;
		if (i == n - r) Knr = temp;
	}

	long long int x = ModPower(Kr, MOD - 2, MOD);
	long long int y = ModPower(Knr, MOD - 2, MOD);

	long long int ans;
	ans = Kn * x;
	ans %= MOD;
	ans *= y;
	ans %= MOD;

	return ans;
}
//int型10進数をord桁のstring型2進数に変換する
string binary(int x, int ord)
{
	int y;
	string ans = "";
	for (int i = 0; i < ord; i++)
	{
		y = x / (int)pow(2, ord - 1 - i);
		y %= 2;
		if (y == 0) ans += "0";
		else ans += "1";
	}

	return ans;
}
//ord桁のstring型2進数をint型10進数に変換する
int rep_binary(string x, int ord)
{
	int res = 0;
	for (int i = 0; i < ord; i++)
	{
		if (x[i] == '1') res += (int)pow(2, ord - 1 - i);
	}
	return res;
}
//xとyのビットごとの排他的論理和
template<class T> T XOR(T x, T y)
{
	T n = 0;
	while (max(x, y) > pow(2, n)) n++;
	T ans=0;
	for (int i = 0; i <= n; i++)
	{
		T x1 = (x % (T)pow(2, i + 1)) / (T)pow(2, i);
		T y1 = (y % (T)pow(2, i + 1)) / (T)pow(2, i);
		if (x1 != y1) ans += (T)pow(2, i);
	}
	return ans;
}

/*ここまでテンプレ*//*ここまでテンプレ*//*ここまでテンプレ*//*ここまでテンプレ*/



int main()
{
	long long H, W;
	cin >> H >> W;

	if (H == 1 || W == 1) cout << 1 << endl;
	else if (H % 2 == 0 || W % 2 == 0)
		cout << H * W / 2 << endl;
	else
		cout << (H * W + 1) / 2 << endl;
		 
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
    int x,y,z;
    int a,i,Num;
    int Room[5][5][12];
    
    for(x=1;x<=4;x++){
        for(y=1;y<=3;y++){
            for(z=1;z<=10;z++){
                Room[x][y][z]=0;
            }
        }
    }
    
    scanf("%d",&Num);
    
    for(i=0;i<Num;i++){
        scanf("%d %d %d %d",&x,&y,&z,&a);
        Room[x][y][z]+=a;
    }
    
    for(x=1;x<=4;x++){
        for(y=1;y<=3;y++){
            for(z=1;z<=10;z++){
                printf(" %d",Room[x][y][z]);
            }
            printf("\n");
        }
        if(x<=3){
        printf("####################\n");
        }
    }
}


Measured memory_bytes: 2108
import sys
input = sys.stdin.readline
H, W = map(int, input().split())
A = []
for _ in range(H):
    A.append(list(map(int, input().split())))
B = []
C = []
for y in range(H):
    B.append(list(map(int, input().split())))
    C.append(list(abs(a-b) for (a, b) in zip(A[y], B[y])))
VMAX = 80*159+1
dp = [[0 for _ in range(W)] for _ in range(H)]
dp[0][0] |= 1 << C[0][0]
for y in range(H):
    for x in range(W):
        if y==0 and x==0:
            continue
        if y-1 >= 0:
            dp[y][x] |= dp[y-1][x] << C[y][x]
            dp[y][x] |= dp[y-1][x] >> C[y][x]
            d = C[y][x]+1
            r = format(dp[y-1][x] & (2**d-1), '0'+str(d)+'b')
            r = r[::-1]
            dp[y][x] |= int(r, 2)
        if x-1 >= 0:
            dp[y][x] |= dp[y][x-1] << C[y][x]
            dp[y][x] |= dp[y][x-1] >> C[y][x]
            d = C[y][x]+1
            r = format(dp[y][x-1] & (2**d-1), '0'+str(d)+'b')
            r = r[::-1]
            dp[y][x] |= int(r, 2)
ans = -1
for v in range(VMAX):
    if dp[-1][-1] >> v & 1:
        ans = v
        break
print(ans)

Measured memory_bytes: 9064
//Bismillahir Rahmanir Raheem
//#include<bits/stdc++.h>
#include<iostream>
#include<stdlib.h>
#include<map>
#include<math.h>
#include<vector>
#include<algorithm>
#include<string>
#include<set>
using namespace std;
#define pb push_back
#define all(x) (x).begin(), (x).end()
typedef long long LL;
typedef vector<int> vi;
typedef map<int, int> mii;
typedef pair<int, int> pii;
#define FF first
#define SS second
#define mxN (int) 2e5 + 2
#define MP make_pair
bool isPal(string s)
{
    string r(s);
    reverse(all(r));
    return s == r;
}

int main()
{
    string s;
    cin >> s;
    if(isPal(s) && isPal(s.substr(0,(int)s.length()/2)) && isPal(s.substr((int)s.length()/2 + 1, (int)s.length()/2)))
        cout << "Yes\n";
    else cout << "No\n";

}





Measured memory_bytes: 256
N,L=map(int,input().split())
aji=0
Nlist=[x for x in range(L,L+N,1)]
Nabslist=[abs(Nlist[x]) for x in range(len(Nlist))]
Nmindex=Nabslist.index(min(Nabslist))
for i in range(len(Nlist)):
    if i==Nmindex:
        continue
    aji=aji+Nlist[i]
print(aji)


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

using namespace std;

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

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef complex<double> Point;

int days[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30};
int main()
{
	reep(i, 1, 12){
		days[i] += days[i-1];
	}
	
	for(;;){
		int e[2];
		rep(i, 2){
			int y, m, d;
			scanf("%d%d%d", &y, &m, &d);
			if(y<0)
				return 0;
			
			e[i] = days[m-1] + d - 1;
			if(y%4==0 && (y%100!=0 || y%400==0) && m>=3)
				++e[i];
			--y;
			e[i] += y*365 + y/4 - y/100 + y/400;
		}
		
		printf("%d\n", e[1] - e[0]);
	}
	
	return 0;
}

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

int N,x;
int a[110];

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

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

    sort(a,a+N);
    
    long long sum = 0;
    int ans = 0;
    for (int i = 0; i < N; i++)
    {
        sum += a[i];
        if(sum<=x) ans++;

        if(i==N-1 && sum<x) ans--;
    }
    
    cout << ans << endl;
    

    return 0;
}


Measured memory_bytes: 256
N,Q=map(int,input().split())
S='.'+input()+'.'

TD=[]
for i in range(Q):
    t, d = input().split()
    if d=='L':
        TD.append([t,-1])
    else:
        TD.append([t,1])

def check(place):
    for i in range(Q):
        td=TD[i]
        if td[0]!=S[place]:
            continue
        else:
            place+=td[1]

        if place<=0:
            return -1
        if place>=N+1:
            return 1
    return 0

l,r=0,N+1
L,R=0,N+1

while abs(r-l)>1:
    m=(l+r)//2
    if check(m)<0:
        l=m
    else:
        r=m
L=l
l,r=0,N+1

while abs(r-l)>1:
    m=(l+r)//2
    if check(m)>0:
        r=m
    else:
        l=m

R=r

print(max(R-L-1,0))


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

using namespace std;
typedef long long ll;

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

int main(){
// ここに処理を記述

    int N;
    cin >> N;

    vector<int> d;
    int temp = 0;
    for(int i=0; i<N; i++){
        cin >> temp;
        d.push_back(temp);
    }

    vector<int> a;
    REP(i,N){
        FOR(j,i+1,N){
            temp = d[i] * d[j];
            a.push_back(temp);
        }
    }

    ll ans = 0;
    REP(i,a.size()){
        ans += a[i];
    }

    cout << ans << "\n";

return 0;
}

Measured memory_bytes: 256
import sys


pair = {')': '(', ']': '['}
for line in sys.stdin:
    line = line.rstrip()
    if line == '.':
        break
    st = []
    for c in line:
        if c == '(' or c == '[':
            st.append(c)
        elif c in pair:
            if len(st) > 0 and st[-1] == pair[c]:
                st.pop()
            else:
                print 'no'
                break
    else:
        if len(st) == 0:
            print 'yes'
        else:
            print 'no'

Measured memory_bytes: 4260
#include <algorithm>
#include <bitset>
#include <iomanip>
#include <ios>
#include <iostream>
#include <numeric>
#include <string>
#include <vector>
using namespace std;

int main()
{
    bool found[1000000] = { false };
    int n;
    int m = 1;
    cin >> n;
    while (true) {
        if (found[n]) {
            cout << m << "\n";
            return 0;
        }
        found[n] = true;
        if (n % 2 == 0) {
            n /= 2;
        } else {
            n = 3 * n + 1;
        }
        m++;
    }
}

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

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

    int sum;

    rep(i, N) {
        int l, r;
        cin >> l >> r;

        sum += r - l + 1;

    }

    cout << sum << endl;
}

Measured memory_bytes: 256
from collections import deque

N = int(input())
a = list(map(int, input().split()))

d = deque()

for x in range(N):
    if x % 2 == 0:
        d.append(str(a[x]))
    else:
        d.appendleft(str(a[x]))
if N % 2 == 0:
    print(" ".join(d))
else:
    print(" ".join(reversed(d)))


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

typedef long long ll;

const int Maxn = 100005;
const int mod = 998244353;

int n;
vector <int> my[Maxn];
int res = 1;

int main()
{
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) {
        int d; scanf("%d", &d);
        my[d].push_back(i);
    }
    if (my[0].size() != 1 || my[0][0] != 1) { printf("0\n"); return 0; }
    for (int i = 1; i < Maxn; i++)
        for (int j = 0; j < my[i].size(); j++)
            res = ll(res) * ll(my[i - 1].size()) % mod;
    printf("%d\n", res);
    return 0;
}


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

#define show(x) cerr << #x << " = " << x << endl ;
#define input_from_file freopen("input.txt","r",stdin)
#define output_to_file freopen("output.txt" , "w",stdout)
#define output_to_error freopen("error.txt" , "w" ,stderr)
#define fastio ios_base::sync_with_stdio(0)
#define endl '\n'

pair < int , int > p[9];
int per[9];
int main()
{
    #ifdef LOCAL
        input_from_file;
        output_to_file;
        output_to_error;
    #endif
    fastio;cin.tie(0);cout.tie(0);
    int n ; cin >> n ;
    for(int i = 1 ; i <= n ; ++i)
    {
        cin >> p[i].first >> p[i].second ;
        per[i] = i ;
    }
    double ans = 0;
    int cnt = 0;
    do
    {
        double dist = 0;
        for(int i = 1 ; i < n ; ++i)
        {
            int x1 = p[per[i]].first , y1 = p[per[i]].second;
            int x2 = p[per[i+1]].first , y2 = p[per[i+1]].second;
            dist += sqrtl((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));
        }
        ++cnt;
        ans += dist;
    }while(next_permutation(per+1 , per+n+1));

    cout << fixed << setprecision(10) << ans/cnt;


    return 0;
}


Measured memory_bytes: 256
// ※※※ ロジック見直し ※※※
// ryoissy氏.
// https://atcoder.jp/contests/cf17-final/submissions/1803042
#include <bits/stdc++.h>
using namespace std;
using P = pair<int, int>;
#define rep(i, n) for(int i = 0; i < n; i++)
#define a first
#define b second
int n, d[51];
P p[51];
int gg[51];

int main(){
    scanf("%d",&n);
    rep(i, n){
        scanf("%d", d + i);
        p[i] = P(abs(12 - d[i]), d[i]);
    }
    p[n] = P(12, 0);
    sort(p, p + n + 1);
    int s = 1;
    rep(i, n + 1){
        if(s == 1) gg[i] = min(p[i].b, 24 - p[i].b);
        else       gg[i] = max(p[i].b, 24 - p[i].b);
        s = 1 - s;
    }
    sort(gg, gg + n + 1);
    int diff = 24;
    rep(i, n) diff = min(diff, gg[i + 1] - gg[i]);
    diff = min(diff, 24 - gg[n] + gg[0]);
    printf("%d\n", diff);
    return 0;
}

Measured memory_bytes: 256
n,y = map(int,input().split())
for i in range(n+1):
    for j in range(n-i+1):
        if i * 10000 + j * 5000 + (n - i - j) * 1000 == y:
            print(i, j, n - i - j)
            exit()
print("-1 -1 -1")

Measured memory_bytes: 40684
A,B,C = map(int,input().split())
K = int(input())

for i in range(K):
    if C <= B:
        C = C * 2
    elif B <= A:
        B = B * 2
    else:
        C = C * 2

if C > B and B > A:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 9176
N, K = gets.split.map(&:to_i)
as = gets.split.map(&:to_i)

gcd = as[0]
as.each do |a|
    gcd = gcd.gcd(a)
end

if K % gcd == 0 && K <= as.max
    puts 'POSSIBLE'
else
    puts 'IMPOSSIBLE'
end

Measured memory_bytes: 8452
#include<bits/stdc++.h>
using namespace std;
#define INF (1e8)
#define MAX 205
int n;
char s[MAX];
 
int dpA[MAX][MAX];
int dpB[MAX][MAX];
bool flgA[MAX][MAX];
bool flgB[MAX][MAX];
 
int solveA(int,int);
int solveB(int,int);
 
int main(){
  scanf("%s",s);
  n=strlen(s);
  int ans=solveA(0,n);
  assert( abs(ans) < 1e6 );
  printf("%d\n",ans);
  return 0;
}
 
int solveA(int l,int r){
  if(flgA[l][r])return dpA[l][r];
  flgA[l][r]=true;
  int res=-INF,cnt=0,num=0;
  int L=INF,R=-INF;
  for(int i=l;i<r;i++){
    if(s[i]<'0'||'9'<s[i])continue;
    L=min(L,i);
    R=max(R,i);
  }
  for(int i=l;i<r;i++){
    if(s[i]=='+'){
      if(L<=i-3&&'0'<=s[i-1]&&s[i-1]<='9'&&s[i-2]=='(')continue;
      if(i+3< R&&'0'<=s[i+1]&&s[i+1]<='9'&&s[i+2]==')')continue;
      res=max(res, solveA(l,i)+solveA(i+1,r));
    }else if(s[i]=='-'){
      if(L<=i-3&&'0'<=s[i-1]&&s[i-1]<='9'&&s[i-2]=='(')continue;
      if(i+3< R&&'0'<=s[i+1]&&s[i+1]<='9'&&s[i+2]==')')continue;
      res=max(res, solveA(l,i)-solveB(i+1,r));
    }else if('0'<=s[i]&&s[i]<='9'){
      cnt++;
      num=s[i]-'0';
    }
  }
  if(cnt==1)res=num;
 
     
  return dpA[l][r]=res;
}
 
int solveB(int l,int r){
  if(flgB[l][r])return dpB[l][r];
  flgB[l][r]=true;
  int res=INF,cnt=0,num=0;
  int L=INF,R=-INF;
  for(int i=l;i<r;i++){
    if(s[i]<'0'||'9'<s[i])continue;
    L=min(L,i);
    R=max(R,i);
  }
   
  for(int i=l;i<r;i++){
    if(s[i]=='+'){
      if(L<=i-3&&'0'<=s[i-1]&&s[i-1]<='9'&&s[i-2]=='(')continue;
      if(i+3<R &&'0'<=s[i+1]&&s[i+1]<='9'&&s[i+2]==')')continue;
      res=min(res, solveB(l,i)+solveB(i+1,r));
    }else if(s[i]=='-'){
      if(L<=i-3&&'0'<=s[i-1]&&s[i-1]<='9'&&s[i-2]=='(')continue;
      if(i+3< R&&'0'<=s[i+1]&&s[i+1]<='9'&&s[i+2]==')')continue;
      res=min(res, solveB(l,i)-solveA(i+1,r));
    }else if('0'<=s[i]&&s[i]<='9'){
      cnt++;
      num=s[i]-'0';
    }
  }
  if(cnt==1)res=num;
  return dpB[l][r]=res;
}

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

int main(){
  int a,b;
  cin >> a >> b;
  int ans;
  if(a <= 5) ans = 0;
  else if(a <= 12) ans = b/2;
  else ans = b;
  cout << ans << endl;
  return 0;
}


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

using namespace std;

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

typedef long long ll;

const int Inf = 1e9;
const double EPS = 1e-9;

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

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

int bitCount(long bits) {
    bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
    bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
    bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
    bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
    return (bits & 0x0000ffff) + (bits >>16 & 0x0000ffff);
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    int ans = 1;
    string tmp = s.substr(0, 1);
    FOR (i, 1, s.size()) {
        string t;
        t = s[i];
        if (tmp == t) {
            t += s[++i];
            if (i == s.size()) break;
        }
        tmp = t;
        ans++;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 720
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i, n) FOR(i, 0, (n))
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define LAR(a, b) ((a)=max((a),(b)))
#define SML(a, b) ((a)=min((a),(b)))
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pair<int, int>> vpii;
typedef pair<int, int> pii;
#define PB push_back
#define EB emplace_back
#ifdef LOCAL_DEBUG
#define DEBUG(...) printf(__VA_ARGS__)
#else
#define DEBUG(...)
#endif

ll n, g[6];

inline ll op(ll n){
	DEBUG("%d %d\n", g[0]>=g[3], g[1]>=g[4]);
	ll ret = 0;
	for(ll i=0; i*g[0]<=n; i++){
		ll m = n-i*g[0];
		for(ll j=0; j*g[1]<=m; j++){
			ll o = m-j*g[1];
			ll k = 0, p = o;
			if(g[2] < g[5]){
				k = o/g[2];
				p = o-k*g[2];
			}
			LAR(ret,
					p + i*g[3] + j*g[4] + k*g[5]);
			if(g[1]>=g[4]) break;
		}
		if(g[0]>=g[3]) break;
	}
	return ret;
}

int main(){
	scanf("%lld", &n);
	REP(i, 6) scanf("%lld", g+i);
	n = op(n);
	REP(i, 3) swap(g[i], g[i+3]);
	if(g[2] >= g[5]){
		swap(g[0], g[2]);
		swap(g[3], g[5]);
	}
	n = op(n);
	printf("%lld\n", n);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define ll long long
#define loop(a) loopi(i,a)
#define loopi(i,a) for(int i=0; i<(a); i++)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pow2(x) (1ll<<(x))
 
using namespace std;
 
const int Mod=1e9+7;

int main(){
	ios_base::sync_with_stdio(0),cin.tie(0);
	int a,b;
	cin >> a >> b;
	int c=a+b;
	if(c==3) cout << 3 << "\n";
	else if(c==4) cout << 2 << "\n";
	else cout << 1 << "\n";
	return 0;
}


Measured memory_bytes: 256