akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <iomanip>
#include <stack>
#include <queue>
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
typedef long long ll;
using namespace std;

int main(){
  int N,A,B;
  cin >> N >> A >> B;
  cout << min(B,N*A) << endl;

  return 0;
}


Measured memory_bytes: 256
package main
import (
	"bufio"
	"fmt"
	"io"
	"os"
	"runtime/debug"
	"sort"
	"strconv"
)
var in = NewScanner(os.Stdin, 0)
/* this is port of top c++ answer to test go performance */
func main(){
	debug.SetGCPercent(-1)
	n, m := in.Int(), in.Int()
	a, b := in.ArrayIntx(n, n+1), in.ArrayIntx(m, m+1)
	a.SortR()
	b.SortR()
	ans, c := 1, 0
	for i, j, k := n*m, 0, 0; i > 0; i--{
		if a[j] == i && b[k] == i{
			c += j + k
			j++
			k++
		} else if a[j] == i{
			ans = ans * k % M7
			c += k - 1
			j++
		} else if b[k] == i{
			ans = ans * j % M7
			c += j - 1
			k++
		} else{
			ans = ans * c % M7
			c--
		}
	}
	Pln(ans)
}
const M7 = 1000000007
type Scanner struct{
	*bufio.Scanner
}
func NewScanner(r io.Reader, x int) *Scanner{
	s := bufio.NewScanner(r)
	s.Split(scanWords)
	if x <= 0{
		x = 1048576
	}
	s.Buffer([]byte{}, x)
	return &Scanner{s}
}
func (s *Scanner) Int() int{
	s.Scan()
	i, e := strconv.ParseInt(s.Text(), 10, 64)
	if e != nil{
		panic(e)
	}
	return int(i)
}
func (s *Scanner) ArrayIntx(n, m int) IntSlice{
	r := make(IntSlice, m)
	for i := 0; i < n; i++{
		r[i] = s.Int()
	}
	return r
}
func isSpace(b byte) bool{
	return b == ' ' || b == '\n' || b == '\r' || b == '\t'
}
func scanWords(d []byte, e bool) (int, []byte, error){
	s := 0
	for s < len(d) && isSpace(d[s]){
		s++
	}
	for i := s; i < len(d); i++{
		if isSpace(d[i]){
			return i + 1, d[s:i], nil
		}
	}
	if e && len(d) > s{
		return len(d), d[s:], nil
	}
	return s, nil, nil
}
func Pln(s ...interface{}){
	fmt.Println(s...)
}
type ByteSlice []byte
type IntSlice []int
func (p IntSlice) Len() int{ return len(p) }
func (p IntSlice) Less(i, j int) bool{ return p[i] < p[j] }
func (p IntSlice) Swap(i, j int){ p[i], p[j] = p[j], p[i] }
func (p IntSlice) SortR(){ sort.Sort(sort.Reverse(p)) }


Measured memory_bytes: 640
#include <iostream>

using namespace std;

typedef long long ll;

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

  ll K, sum;
  for(ll i = 1; i <= N; i++)
  {
	if(i * (i + 1) / 2 >= N)
	{
	  K = i;
	  sum = i * (i + 1) / 2;
	  break;
	}
  }

  ll remove = -1;
  if(sum > N)
  {
	remove = sum - N;
  }

  for(int i = 1; i <= K; i++)
  {
	if(i != remove)
	{
	  cout << i << endl;
	}
  }  
}


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

int main(){
    int n;
    cin >> n;
    int B[n+1];
    B[0] = B[n] = 1000000;
    for(int i=1;i<n;i++){
        cin >> B[i];
    }
    int ans =0;
    for(int i=1;i<=n;i++){
        ans += min(B[i-1],B[i]);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define sz(x) (int)(x).size()
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
int main(){
  char n;
  cin>>n;
  
  COUT((char)(n+1));

}

Measured memory_bytes: 256
#include <iostream>
#include <stdlib.h>
#include <cmath>
#include <math.h>
#include <algorithm>
#include <bits/stdc++.h> 
using namespace std;

int main(){
    int n;
    cin>>n;
    long long int cost[n];
    int h[n];
    for(int i=0;i<n;i++){
        cin>>h[i];
    }
    cost[0] = 0;
    cost[1] = abs(h[1]-h[0]);
    for(int i=2;i<n;i++){
        cost[i] = min(cost[i-1]+abs(h[i]-h[i-1]),cost[i-2]+abs(h[i]-h[i-2]));
    }
    cout<<cost[n-1];
}

Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
#define int long long
template<class T> inline bool chmin(T& a,T b){
    if( a > b) {a = b; return 1; } return 0;
}

int dp[100010],h[100010];
int INF = 1LL << 60;
signed main(){
    int n,k;
    cin >> n >> k; 
    for(int i = 0; i < n; i++)
    cin >> h[i];
    for(int i = 0; i < 100010; i++)
    dp[i] = INF;
    dp[0] = 0;
    for(int i = 1; i < n; i++){
        for(int j = 1; j <= k; j++){
            if(i - j >= 0)
            chmin(dp[i], dp[i - j] + abs(h[i - j] - h[i]));
        }
    }
    cout << dp[n - 1] << endl;
}

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

#define all(v) (v).begin(), (v).end()
#define sortv(v) sort(all(v))
#define uniqv(v) (v).erase(unique(all(v)), (v).end())
#define pb push_back
#define FI first
#define SE second
#define lb lower_bound
#define ub upper_bound
#define mp make_pair
#define test 1
#define TEST if(test)

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;

const int MOD = 1000000007; // 998244353
const int INF = 2e9;
const ll INFLL = 1e18;
const int MAX_N = 500;

int N;
int arr[MAX_N+1][MAX_N+1];
vector<int> v;
vector<int> gp[MAX_N+1];
int mx = 1;

void pro(int x, int y, int z){
	if(x==y)	return;
	if(x==y-1){
		arr[x][y] = z;
		return;
	}
	int m = (x+y)/2;
	pro(x, m, z+1); pro(m+1, y, z+1);
	for(int i=x; i<=m; i++){
		for(int j=m+1; j<=y; j++){
			arr[i][j] = z;
		}
	}
}

int main(){
	cin>>N;	
	pro(1, N, 1);
	for(int i=1; i<=N; i++){
		for(int j=i+1; j<=N; j++){
			printf("%d ", arr[i][j]);
		}
		printf("\n");
	}
	return 0;
}


Measured memory_bytes: 1536
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rrep(i,n) for(int i=(n)-1; i>=0; i--)
#define FOR(i,a,b) for(int i=(a); i<(b); i++)
#define RFOR(i,a,b) for(int i=(b-1); i>=(a); i--)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define pb push_back
using ll = long long;
using D = double;
using LD = long double;
using P = pair<int, int>;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main(){
    ll n,k; cin >> n >> k;
    ll a1 = n%k;
    ll a2 = k - (n%k);
    cout << min(a1, a2) << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <functional>
#include <stack>
#include <queue>
#include <string>
#include <map>
#include <unordered_map>
#include <bitset>
#include <numeric>
#include <vector>
#include <unordered_set>
#include <bitset>
#include <limits>
#include <random>
#include <complex>
#include <numeric>
#include <cstdlib>


using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;

const ll mod=1000000007ll;
const ll inf=1000000000000000ll;


int main(){
    ll k,s,ans;
    cin>>k>>s;
    ans=0;
    for(ll i=0;i<=k;i++){
        for(ll j=0;j<=k;j++){
                if(s-(i+j)<=k&&0<=s-(i+j))ans++;
        }
    }
    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 256
// #pragma GCC target("avx2")  // CPU 処理並列化
// #pragma GCC optimize("O3")  // CPU 処理並列化
// #pragma GCC optimize("unroll-loops")  // 条件処理の呼び出しを減らす
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
#include<numeric>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-10;
const double INF=1e+10;
const double PI=acos(-1.0);
const int C_SIZE = 3121000;
namespace{
	long long fact[C_SIZE];
	long long finv[C_SIZE];
	long long inv[C_SIZE];
	long long Comb(int a,int b){
	 	if(a<b||b<0)return 0;
	 	return fact[a]*finv[b]%mod*finv[a-b]%mod;
	}
	void init_C(int n){
		fact[0]=finv[0]=inv[1]=1;
		for(int i=2;i<n;i++){
			inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
		}
		for(int i=1;i<n;i++){
			fact[i]=fact[i-1]*i%mod;
			finv[i]=finv[i-1]*inv[i]%mod;
		}
	}
	long long pw(long long a,long long b){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%mod;
			a=a*a%mod;
			b/=2;
		}
		return ret;
	}
	int ABS(int a){return max(a,-a);}
	long long ABS(long long a){return max(a,-a);}
	double ABS(double a){return max(a,-a);}
	int sig(double r) { return (r < -EPS) ? -1 : (r > +EPS) ? +1 : 0; }
}
// ここから編集しろ
int UF[510];
int FIND(int a){
	if(UF[a]<0)return a;
	return UF[a]=FIND(UF[a]);
}
void UNION(int a,int b){
	a=FIND(a);b=FIND(b);if(a==b)return;UF[a]+=UF[b];UF[b]=a;
}
char in[210][210];
char t[210];
char s[5];
int main(){
	for(int i=0;i<510;i++)UF[i]=-1;
	int a,b;scanf("%d%d",&a,&b);
	for(int i=0;i<a;i++)scanf("%s",in[i]);
	long long ret=1;
	for(int i=0;i<a/2;i++){
		for(int j=0;j<b/2;j++){
			s[0]=in[i][j];
			s[1]=in[i][b-1-j];
			s[2]=in[a-1-i][j];
			s[3]=in[a-1-i][b-1-j];
			std::sort(s,s+4);
			int cnt=0;
			do{
				cnt++;
			}while(next_permutation(s,s+4));
			if(cnt==24){
				ret=ret*12%mod;
				UNION(i,j+a/2);
			}else{
				ret=ret*cnt%mod;
			}
		}
	}
	for(int i=0;i<a/2+b/2;i++){
		if(FIND(i)!=i){
			ret=ret*2%mod;
		}
	}
	if(a%2){
		for(int i=0;i<b;i++)t[i]=in[a/2][i];
		reverse(t,t+b);
		bool ok=false;
		for(int i=0;i<b;i++)if(t[i]!=in[a/2][i])ok=true;
		if(ok)ret=ret*2%mod;
	}
	if(b%2){
		for(int i=0;i<a;i++)t[i]=in[i][b/2];
		reverse(t,t+a);
		bool ok=false;
		for(int i=0;i<a;i++)if(t[i]!=in[i][b/2])ok=true;
		if(ok)ret=ret*2%mod;
	}
	printf("%lld\n",ret);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define For(i,x,y) for (register int i=(x);i<=(y);i++)
#define FOR(i,x,y) for (register int i=(x);i<(y);i++)
#define Dow(i,x,y) for (register int i=(x);i>=(y);i--)
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define siz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define fil(a,b) memset((a),(b),sizeof(a))
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pa;
typedef double db;
inline ll read(){
    ll x=0,f=1;char c=getchar();
    while ((c<'0'||c>'9')&&(c!='-')) c=getchar();
    if (c=='-') f=-1,c=getchar();
    while (c>='0'&&c<='9') x=x*10+c-'0',c=getchar();
    return x*f;
}

namespace Geometry{
	const db eps = 1e-9;
	struct point{
		db x,y;
		inline point operator + (const point &p){return (point){x+p.x,y+p.y};}
		inline point operator - (const point &p){return (point){x-p.x,y-p.y};}
		inline db operator * (const point &p){return x*p.x+y*p.y;}
		inline point operator / (const db &v){return (point){x/v,y/v};}
		inline point operator * (const db &v){return (point){x*v,y*v};}
	};
	typedef point vec;
	inline db dot(vec a,vec b){return a.x*b.x+a.y*b.y;}
	inline db sqr(db x){return x*x;}
	inline db dis(point a,point b){return sqrt(sqr(a.x-b.x)+sqr(a.y-b.y));}
	inline db dis2(point a,point b){return sqr(a.x-b.x)+sqr(a.y-b.y);}
	inline db cross(vec a,vec b){return a.x*b.y-a.y*b.x;}
	struct line{
		point a,b;
	};
	inline point projection(point A,line b){
		point B=b.a,C=b.b;
		vec BA=A-B,BC=C-B,BD=BC*(BA*BC/dis2(B,C));
		return B+BD;
	}
	inline point reflection(point A,line b){
		point D=projection(A,b);
		return (point){D.x*2-A.x,D.y*2-A.y};
	}
	inline int Counter_Clockwise(point A,line b){
		point B=b.a,C=b.b;
		db f1=cross(C-B,A-B);
		if (fabs(f1)>eps) return (f1<0?2:1);
		db f2=(C-B)*(A-B);
		if (f2<0) return 3;
		return dis(B,C)<dis(A,B)?4:5;
	}
};
using namespace Geometry;

int main(){
	//freopen("data.in","r",stdin);
	line a;scanf("%lf%lf%lf%lf",&a.a.x,&a.a.y,&a.b.x,&a.b.y);
	int T;scanf("%d",&T);
	while (T--){
		point b;scanf("%lf%lf",&b.x,&b.y);
		int ans=Counter_Clockwise(b,a);
		if (ans==1) puts("COUNTER_CLOCKWISE");
		if (ans==2) puts("CLOCKWISE");
		if (ans==3) puts("ONLINE_BACK");
		if (ans==4) puts("ONLINE_FRONT");
		if (ans==5) puts("ON_SEGMENT"); 
	}
}


Measured memory_bytes: 3248
N = int(input())
A=[]
B=[]
for i in range(N):
    A.append(input())

M = int(input())
for j in range(M):
    B.append(input())
C = []
for k in A:
    le = A.count(k)
    num=B.count(k)
    C.append(le-num)
    num=0

if(max(C)<0):
    print(0)
else:
    print(max(C))

Measured memory_bytes: 3064
#include <stdio.h>
#include <ctype.h>
#include <string.h>

int main(){
    char search[21], word[21];
    int count=0;
    int i;
    
    scanf("%s", search);
    while(1){
        scanf(" %s", word);
        if(strcmp(word, "END_OF_TEXT")==0)break;
        for(i=0;word[i]!='\0';i++){
            word[i]=tolower(word[i]);
        }
        if(strcmp(word, search)==0){
            count++;
        }
    }
    printf("%d\n", count);

return 0;
}


Measured memory_bytes: 2084
#include <stdio.h>
int main(void)
{
    int n,i,j,s=0;
    scanf("%d",&n);
    for(i=1;i<=9;i++){
        for(j=1;j<=9;j++){
         if(i*j==n)
            s++;
        }
    }
    if(s>=1)
        printf("Yes\n");
    else
        printf("No\n");
    return 0;
}



Measured memory_bytes: 128
#include <iostream>

using namespace std;

int n, m, k[15], s[15][15], p[15], ans;

int main()
{
	cin >> n >> m;
	for (int i = 1; i <= m; i++)
	{
		cin >> k[i];
		for (int j = 1; j <= k[i];j++)
		{
			cin >> s[i][j];
		}
	}
	for (int i = 1; i <= m; i++) cin >> p[i];
	for (int i = 0; i < (1<<(n)); i++)
	{
		bool fl = 1;
		for (int j = 1; j <= m; j++)
		{
			int cnt = 0;
			for (int a = 1; a <= k[j]; a++)
			{
				if ((1<<(s[j][a]-1)) & i) cnt++;
			}
			if (cnt % 2 != p[j]) {fl = 0; break;}
		}
		if (fl) ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 384
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
#include<bitset>
#include<stack>
#include<memory>
using namespace std;
using namespace std::chrono;
typedef long long int llint;
typedef double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
/*cout<<fixed<<setprecision(20);cin.tie(0);ios::sync_with_stdio(false);*/
const llint mod=1000000007;
const llint big=2.19e15+1;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-15;
template <class T,class U>bool mineq(T& a,U b){if(a>b){a=b;return true;}return false;}
template <class T,class U>bool maxeq(T& a,U b){if(a<b){a=b;return true;}return false;}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){if(a==0){return b;}return a/gcd(a,b)*b;}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
template<class T>llint LBI(vector<T>&ar,T in){return lower_bound(ar.begin(),ar.end(),in)-ar.begin();}
template<class T>llint UBI(vector<T>&ar,T in){return upper_bound(ar.begin(),ar.end(),in)-ar.begin();}
int main(void){
	llint i,j,B,W,n;cin>>B>>W;n=B+W+5;
	vector<llint>kai(n);
	kai[0]=1;
	for(i=1;i<n;i++){kai[i]=kai[i-1]*i%mod;}
	vector<llint>gya(n);gya[n-1]=1;
	llint bgen=kai[n-1];
	for(int h=0;h<30;h++){
		if((mod-2)&(1<<h)){gya[n-1]*=bgen;gya[n-1]%=mod;}
		bgen*=bgen;bgen%=mod;
	}
	for(i=n-1;i>0;i--){gya[i-1]=gya[i]*i%mod;}
	vector<llint>rui(n);rui[0]=1;
	for(i=1;i<n;i++){rui[i]=rui[i-1]*2%mod;}
	llint han=(mod+1)/2;
	vector<llint>gui(n);gui[0]=1;
	for(i=1;i<n;i++){gui[i]=gui[i-1]*han%mod;}
	llint Bkak=0,Wkak=0;
	
	for(i=1;i<=B+W;i++){
		//W枯渇確立
		cout<<(Bkak+(1+mod+mod-Bkak-Wkak)*han)%mod<<endl;
		//cerr<<Bkak*720%mod<<endl;
		if(i>=W){Bkak+=kai[i-1]*gya[W-1]%mod*gya[i-W]%mod*gui[i];Bkak%=mod;}
		if(i>=B){Wkak+=kai[i-1]*gya[B-1]%mod*gya[i-B]%mod*gui[i];Wkak%=mod;}
		
	}
	return 0;
}


Measured memory_bytes: 8448
import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline
read = sys.stdin.read

#h,w,k = [int(i) for i in read().split()]


s = input()
u = ""
t = ""
q = int(input())
num = 0

for _ in range(q):
    a = readline().split()
    if len(a)==1:
        u,t = t,u
        num ^= 1
    else:
        f = int(a[1])
        c = a[2]
        if f==1:
            t += c
        else:
            u += c

if num:
    print(t[::-1]+s[::-1]+u)
else:
    print(t[::-1]+s+u)
  

Measured memory_bytes: 4340
# -*- coding: utf-8 -*-
"""
Created on Mon Sep 14 13:35:45 2020

@author: ezwry
"""

k = int(input())
a = 7

for i in range(k):
    a = a % k
    if a == 0:
        print(i+1)
        exit()
    else:
        a = a*10 + 7

print(-1)

Measured memory_bytes: 63172
#include<bits/stdc++.h>
#define fo(i,a,b) for(int i= a ; i < b ; ++i)
#define rep(i,n) fo(i,0,n)
#define pln(n) printf("%lld",n)
#define sll(n) scanf("%lld",&n)
#define ss(n) scanf("%s",n)
#define vi vector < int >
#define pii pair < int , int >
#define pb push_back
#define mp make_pair
#define ll long long
#define ull unsigned long long
#define INF 0x3f3f3f3f
#define dbg(x) { cout<< #x << ": " << (x) << endl; }
#define dbg2(x,y) { cout<< #x << ": " << (x) << " , " << #y << ": " << (y) << endl; }
#define dbg3(x,y,z) { cout<< #x << ": " << (x) << " , " << #y << ": " << (y) <<" , "<< #z <<": "<<(z)<<endl; }
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define vll vector<long long>
#define vvll vector<vector<long long>>
#define vvvll vector<vector<vector<ll>>>
#define si set<int>
#define tr(c, it) \
for(decltype(c.begin()) it = c.begin(); it!= c.end(); it++)
#define pis pair<int,string>
#define present(c, x) (c.find(x) != c.end())
#define cpresent(c, x) (find(all(c),x) != c.end())
#define  ones(x)  __builtin_popcount(x)
using namespace std;

int main(){
    string a;
    getline(cin ,a);
    string b;
    getline(cin,b);
    int c = 0;
    for(int i = 0; i < a.size(); i++){
        if(a[i] == b[i])c++;
    }
    if(c == a.size())cout << "Yes";
    else cout <<"No";

}

Measured memory_bytes: 3600
//http://abc057.contest.atcoder.jp/tasks/abc057_b

#include <bits/stdc++.h>

using namespace std;

signed main(signed arg, char *args[])
{
    int i, n, m, a[50], b[50], c[50], d[50];
    cin >> n >> m;
    for(i=0; i<n; i++) cin >> a[i] >> b[i];
    for(i=0; i<m; i++) cin >> c[i] >> d[i];
 
    int cp=0, dis, dmin;
    for(int i=0; i<n; i++){
        dmin = 0x7FFFFFFF;
        for(int j=0; j<m; j++){
            dis = fabs(c[j]-a[i]) + fabs(d[j]-b[i]);
            if(dis < dmin){
                dmin = dis;
                cp = j + 1;
            }
        }
        cout << cp << endl;
    }
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep2(i,s,f) for(int i=s;i<f;i++)
#define INF 1000000000000000000
#define MOD 1000000007
#define endl "\n"
#define fcout cout<<fixed<<setprecision(15)
typedef pair<int, int> P;
//struct edge { int to, cost; };

int dx[8] = { 1,0,0,-1,1,1,-1,-1 };
int dy[8] = { 0,-1,1,0,-1,1,-1,1 };

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

bool prime(int n) {
    for (int i = 2; i <= sqrt(n); i++) {
        if (n % i == 0)return false;
    }
    return n != 1;
}
int gcd(int x, int y) {
    if (y == 0)return x;
    return gcd(y, x % y);
}
int lcm(int x, int y) {
    return x / gcd(x, y) * y;
}
int mod_pow(int n, int p, int m) {
    if (p == 0) return 1;
    if (p % 2 == 0) {
        int t = mod_pow(n, p / 2, m);
        return (t * t) % m;
    }
    return n * mod_pow(n, p - 1, m) % m;
}
int extGCD(int a, int b, int& x, int& y) {
    if (b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    long long d = extGCD(b, a % b, y, x);
    y -= a / b * x;
    return d;
}
int modinv(int a, int m) {
    int b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
int modinv2(int a, int mod) {
    return mod_pow(a, mod - 2, mod);
}
int digit(int x) {
    int cnt = 0;
    while (x > 0) {
        cnt += x % 10;
        x /= 10;
    }
    return cnt;
}
int read() {
    int tmp;
    cin >> tmp;
    return tmp;
}
int xor128() {
    static int x = 123456789, y = 362436069, z = 521288629, w = 88675123;
    int t = (x xor (x << 11));
    x = y; y = z; z = w;
    return (w = (w xor (w >> 19)) xor (t xor (t >> 8)));
}
map<int, int> factaring(int x) {
    map<int, int>ans;
    int now = 2;
    while (now * now <= x) {
        if (x % now == 0) {
            x /= now;
            ans[now]++;
        }
        else now++;
    }
    if (x != 1) ans[x]++;
    return ans;
}
int comb(int n, int k, int mod) {
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    k = min(k, n - k);
    int x = 1, y = 1;
    rep(i, k) {
        y *= i + 1;
        y %= mod;
    }
    for (int i = n - k + 1; i <= n; i++) {
        x *= i;
        x %= mod;
    }
    return x * modinv(y, mod) % mod;
}

signed main() {
    //srand((unsigned)time(NULL));

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

    int a, b, c, k;
    cin >> a >> b >> c >> k;
    cout << min(a, k) + min((int)0, (k - a - b)*-1) << endl;

    return 0;
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
using pint = pair<int, int>;
using ll = long long;
using ull = unsigned long long;
using vll = vector<long long>;
using pll = pair<ll, ll>;
#define FOR(i, begin, end) \
    for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) \
    for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define VREP(s, ite) for (auto ite = s.begin(); ite != s.end(); ++ite)
#define FI first
#define SE second
#define ALL(v) v.begin(), v.end()
#define endl "\n"
#define ciosup  \
    cin.tie(0); \
    ios::sync_with_stdio(false);
#define eb emplace_back
#define vint vector<int>
constexpr ll INF = 1e15 + 7LL;
constexpr ll MOD = 1e9 + 7LL;
template <typename T>
istream &operator>>(istream &is, vector<T> &v) {
    for (int i = 0; i < v.size(); ++i) {
        is >> v[i];
    }
    return is;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
    if (v.size() == 0) return os;
    for (int i = 0; i < v.size() - 1; ++i) {
        os << v[i] << " ";
    }
    os << v[v.size() - 1];
    return os;
}

void solve() {
    ll a,b,c ,d;
    cin >> a >> b >> c>> d;
    cout << max(a*c, max(a*d, max(b*c, b*d))) << endl;
}

int main() {
    solve();
    char tmp;
    while (cin >> tmp) {
        cin.putback(tmp);
        solve();
    }
}



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

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;
using pll = pair<ll,ll>;

#define INF (1LL << 60)
#define MOD 1000000007
#define PI 3.14159265358979323846

#define REP(i,m,n) for(ll (i)=(m),(i_len)=(n);(i)<(i_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define PR(x) cout << (x) << endl
#define PS(x) cout << (x) << " "
#define SZ(x) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define REV(x) reverse(ALL((x)))
#define ASC(x) sort(ALL((x)))
#define DESC(x) ASC((x)); REV((x))
#define pb push_back
#define eb emplace_back

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

int main()
{
    ll A, B, C, D;
    cin >> A >> B >> C >> D;
    ll E = C * D / gcd(C, D);
    --A;
    PR((B-(B/C+B/D-B/E))-(A-(A/C+A/D-A/E)));

    return 0;
}

/*



*/

Measured memory_bytes: 3604
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    long h = Integer.parseInt(sc.next());
    int n = Integer.parseInt(sc.next());
    long a = 0;
    for (int i = 0; i < n; i++) {
      a += Integer.parseInt(sc.next());
    }
    if (a >= h) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }

  }
}


Measured memory_bytes: 46068
#include<bits/stdc++.h>
#define mins(a,b) a=min(a,b)
#define maxs(a,b) a=max(a,b)
template < typename T > std::string to_string( const T& n )
  {
    std::ostringstream stm ;
    stm << n ;
    return stm.str() ;
  }
using namespace std;

const long long INF=9000000000000000;
int main(){
  long long x,y,z,k,aaa=0;
  cin>>x>>y>>z>>k;
  long long a[x];
  long long b[y];
  long long c[z];
  for(int i=0;i<x;i++){
    cin>>a[i];
  }
  for(int i=0;i<y;i++){
    cin>>b[i];
  }
  for(int i=0;i<z;i++){
    cin>>c[i];
  }
  long long ans[1000010]={};
  for(int i=0;i<x;i++){
    for(int j=0;j<y;j++){
        ans[aaa]=a[i]+b[j];
        aaa++;
      }
  }
  sort(ans,ans+x*y);
  reverse(ans,ans+x*y);
  long long aans[3100*z]={};
  aaa=0;
  for(int i=0;i<3100;i++){
    for(int j=0;j<z;j++){
      aans[aaa]=ans[i]+c[j];
      aaa++;
    }
  }
  sort(aans,aans+3100*z);
  reverse(aans,aans+3100*z);
 for(int i=0;i<k;i++){
    cout<<aans[i]<<endl;
  }
}


Measured memory_bytes: 32384
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#include <numeric>
#include <set>
#include <queue>
using namespace std;
typedef long long ll;

void solve() {
	int n; cin >> n;
	vector<int> a(n), b(n);
	for (int i = 0; i < n; i++)cin >> a[i] >> b[i];
	sort(a.begin(), a.end());
	sort(b.begin(), b.end());
	if (n & 1)cout << b[n / 2] - a[n / 2] + 1;
	else {
		int aa = b[n / 2 - 1] + b[n / 2];
		int bb = a[n / 2 - 1] + a[n / 2];
		cout << aa - bb + 1;
	}
}

int main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	// int t; cin >> t;
	// while (t--)
	solve();



}

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

#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mp make_pair
#define pb push_back
#define fst first
#define snd second
typedef long long ll;
typedef pair<int,int> pii;

int main(){
	ll s,x,z,r;
	cin>>s;
	if(s==ll(1e18)){
		cout<<0<<" "<<0<<" "<<ll(1e9)<<" "<<0<<" "<<0<<" "<<ll(1e9)<<endl;
		return 0;
	}
	if(s==ll(1e18)-1){
		ll y=ll(1e9)-1,z=ll(1e9)-1,x=1,r=ll(1e9)-z;
		cout<<0<<" "<<0<<" "<<x<<" "<<z+r<<" "<<x+y<<" "<<r<<endl;
		return 0;
	}
	for(ll y=ll(sqrt(s));y>=1;y--){
		if(s/y>=s%y){
			x=1;
			z=s%y;
			r=s/y-z;
			if(x>ll(1e9)||z+r>ll(1e9)||x+y>ll(1e9)||r>ll(1e9))continue;
			cout<<0<<" "<<0<<" "<<x<<" "<<z+r<<" "<<x+y<<" "<<r<<endl;
			return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;
public class Main
{
	
	private void solve()throws IOException
	{
		long N=nextLong();
		ArrayList<Integer> ans=solve(N+1);
		out.println(2*ans.size());
		for(int i:ans)
			out.print(i+" ");
		for(int i=1;i<=ans.size();i++)
			out.print(i+" ");
	}
	ArrayList<Integer> solve(long N)
	{
		ArrayList<Integer> ans=new ArrayList<>();
		if(N==1)
			return ans;
		if(N%2==0)
		{
			ArrayList<Integer> curr=solve(N/2);
			curr.add(curr.size()+1);
			ans=curr;
		}
		else
		{
			ArrayList<Integer> curr=solve(N-1);
			ans.add(curr.size()+1);
			ans.addAll(curr);
		}
		return ans;
	}

	 
	///////////////////////////////////////////////////////////

	public void run()throws IOException
	{
		br=new BufferedReader(new InputStreamReader(System.in));
		st=null;
		out=new PrintWriter(System.out);

		solve();
		
		br.close();
		out.close();
	}
	public static void main(String args[])throws IOException{
		new Main().run();
	}
	BufferedReader br;
	StringTokenizer st;
	PrintWriter out;
	String nextToken()throws IOException{
		while(st==null || !st.hasMoreTokens())
		st=new StringTokenizer(br.readLine());
		return st.nextToken();
	}
	String nextLine()throws IOException{
		return br.readLine();
	}
	int nextInt()throws IOException{
		return Integer.parseInt(nextToken());
	}
	long nextLong()throws IOException{
		return Long.parseLong(nextToken());
	}
	double nextDouble()throws IOException{
		return Double.parseDouble(nextToken());
	}
}

Measured memory_bytes: 23124
(a, b, c) = input().rstrip().split(' ')
a = int(a)
b = int(b)
c = int(c)

if a < b < c:
    print(a, b, c)
elif a < c < b:
    print(a, c, b)
elif b <= a <= c:
    print(b, a, c)
elif b <= c <= a:
    print(b, c, a)
elif c <= a <= b:
    print(c, a, b)
else:
    print(c, b, a)

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

long long a[100005],b[100005],c[100005],dp[100005][4];
/** Definition: dp[i][j] means in ith days i'll do jth activity **/

int main()
{
    long long i,j,k,n,ans;
    cin>>n;
    for(i=1 ; i<=n ; i++)   cin>>a[i]>>b[i]>>c[i];

    dp[1][1] = a[1];
    dp[1][2] = b[1];
    dp[1][3] = c[1];

    for(i=2 ; i<=n ; i++){
        dp[i][1] = a[i] + max(dp[i-1][2] , dp[i-1][3]);
        dp[i][2] = b[i] + max(dp[i-1][1] , dp[i-1][3]);
        dp[i][3] = c[i] + max(dp[i-1][1] , dp[i-1][2]);
    }
    ans = max(dp[n][1] , max(dp[n][2] , dp[n][3]));
    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 9024
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <deque>
#include <queue>
#include <string.h>
#include <stack>
using namespace std;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
typedef long long ll;
typedef pair<int,int> P;
int main() {
    int h,w;
    cin >> h >> w;
    vector<string>mp(h);
    rep(i, 0, h) {
        cin >> mp[i];
    }
    rep(i, 0, h) {
        cout << mp[i] << endl;
        cout << mp[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 3636
#include <stdio.h>

int main(void) {
  int n, a, count[7], i;

  while (1) {
    scanf("%d", &n);
    if (n == 0) break;
    for (i = 0; i < 7; i++)
      count[i] = 0;
    while (n--) {
      scanf("%d", &a);
      if (a < 10) count[0]++;
      else if (a < 20) count[1]++;
      else if (a < 30) count[2]++;
      else if (a < 40) count[3]++;
      else if (a < 50) count[4]++;
      else if (a < 60) count[5]++;
      else count[6]++;
    }
    for (i = 0; i < 7; i++)
      printf("%d\n", count[i]);
  }
}

Measured memory_bytes: 600
//標準入力をするときに記述する必要がある
process.stdin.resume();
process.stdin.setEncoding("utf8");

let lines; //標準入力代入用に宣言
let reader = require("readline").createInterface({
    input: process.stdin,
    output: process.stdout
});

//入力, 文字列で受け渡される
reader.on("line", (line) => {
    lines = parseInt(line)
});

//出力
reader.on("close", () => {
    console.log(lines >= 30 ? "Yes" : "No")
})

Measured memory_bytes: 29832
# Date [ 2020-08-23 14:02:31 ]
# Problem [ e.py ]
# Author Koki_tkg
# After Contest

import sys;          from decimal import Decimal
import math;         from numba import njit, i8, u1, b1
import bisect;       from itertools import combinations, product
import numpy as np;  from collections import Counter, deque, defaultdict

# sys.setrecursionlimit(10 ** 6)
MOD = 10 ** 9 + 7
INF = 10 ** 9
PI = 3.14159265358979323846

def read_str():      return sys.stdin.readline().strip()
def read_int():      return int(sys.stdin.readline().strip())
def read_ints(x=0):  return map(lambda num: int(num) - x, sys.stdin.readline().strip().split())
def read_str_list(): return list(sys.stdin.readline().strip().split())
def read_int_list(): return list(map(int, sys.stdin.readline().strip().split()))
def lcm(a: int, b: int) -> int: return (a * b) // math.gcd(a, b)

def solve(h,w,bomb):
    row = np.zeros(h, dtype=np.int64)
    column = np.zeros(w, dtype=np.int64)
    
    for y, x in bomb:
        row[y] += 1
        column[x] += 1
        
    max_row = np.max(row)
    max_col = np.max(column)
    val = max_row + max_col

    max_row_lis = np.ravel(np.where(row == row.max()))
    max_col_lis = np.ravel(np.where(column == column.max()))

    for r in max_row_lis:
        for c in max_col_lis:
            if (r, c) not in bomb:
                return val
    
    return val - 1
    

def Main():
    h, w, m = read_ints()
    bomb = set([tuple(read_ints(x=1)) for _ in range(m)])
    
    print(solve(h, w, bomb))


if __name__ == '__main__':
    Main()

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

using namespace std;

#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define mod 1000000007

int n;
int v[15];
int v2[15];

int f(int id){
	if(id == n){
		for(int i = 0; i < n; i++)
			if(!(v2[i]&1)){
				return 1;
			}
		return 0;
	}
	int ans = 0;
	v2[id] = v[id];
	ans += f(id+1);
	v2[id] = v[id]+1;
	ans += f(id+1);
	v2[id] = v[id]-1;
	ans += f(id+1);
	return ans;
}

int main () {
	scanf("%d",&n);
    for(int i = 0; i < n; i++)
    	scanf("%d",v+i);
    printf("%d\n",f(0) );
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++) 
#define all(x) (x).begin(),(x).end()
using namespace std;
using ll = long long;
typedef vector<int> vi;
typedef vector<vi> vvi;


int main() {
	double a,b,x;
	cin >> a >> b >> x;

	double trad;

	if (2 * x > a * a * b) {
		trad = a * a * a / (2 * (a * a * b - x));
	}

	else {
		trad = (2 * x) / (a * b * b);
	}

	cout << fixed << setprecision(8);
	cout << 90-(180 * atan(trad) / 3.14159265358979) << endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,(n)-1,0)
#define all(v) v.begin(), v.end()
#define endk '\n'
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
const ld eps = 1e-10;
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b){if(a>b) a=b;}
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b){if(a<b) a=b;}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  string a; cin >> a;
  int n = a.size();
  map<char, int> cnt;
  for(char c: a) cnt[c]++;
  ll ans = 1LL*n*(n-1)/2+1;
  for(auto ele: cnt) ans -= 1LL*ele.second*(ele.second-1)/2;
  cout << ans << endk;
  return 0;
}


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

typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef vector<vector<long long>> VVL;
typedef vector<string> VS;
typedef pair<int,int> P;
typedef tuple<int,int,int> tpl;

#define ALL(a)  (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())
#define EXIST(m,v) (m).find((v)) != (m).end()
#define LB(a,x) lower_bound((a).begin(), (a).end(), x) - (a).begin()
#define UB(a,x) upper_bound((a).begin(), (a).end(), x) - (a).begin()

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);--i)
#define RREP(i,n) RFOR(i,n,0)

#define en "\n"

constexpr double EPS = 1e-9;
constexpr double PI  = 3.1415926535897932;
constexpr int INF = 2147483647;
constexpr long long LINF = 1LL<<60;
constexpr long long MOD = 1000000007; // 998244353;

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

void Main(){
    ll N,D; cin >> N >> D; D *= D;
    int ans = 0;
    REP(i,N){
        ll x,y;cin >> x >> y;
        if(x*x+y*y<=D) ans++;
    }
    cout << ans << en;
    return;
}

int main(void){
    cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(0);cout<<fixed<<setprecision(15);
    int t=1; //cin>>t;
    REP(_,t) Main();
    return 0;
}

Measured memory_bytes: 3652
#define _USE_MATH_DEFINES
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <cassert>
#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>
#include <iomanip>


#ifdef _DEBUG
#define typeof(X) std::identity<decltype(X)>::type //C++0x (for vs2010)
#else
#define typeof(X) __typeof__(X) // for gcc
#endif

#define sz(a)  int((a).size())
#define FOREACH(it, c) for (typeof((c).begin()) it=(c).begin(); it != (c).end(); ++it)
#define FOR(i,count) for (int i = 0; i < (int)(count); 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); }

using namespace std;
static const double EPS = 1e-5;
typedef long long ll;
const int MODULO = 100000 ;
const int INF = 100000000; //1e8

typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
typedef complex<double> Cd;

using namespace std;

int tbl[8];

int encode(int x[8]){
	int p[8];
	int ret = 0;
	FOR(i,8) p[i] = i;
	FOR(i,8){
		int a = x[i];
		ret += p[a] * tbl[i];
		for(int i = a+1; i < 8; i++) p[i]--;
	}
	return ret;
}

void decode(int x[8],int val){
	int p[8];
	FOR(i,8) p[i] = i;
	FOR(i,7){
		int a = val / tbl[i];
		val -= a * tbl[i];
		x[i] = p[a];
		for(int i = a; i < 7; i++) p[i] = p[i+1];
	}
	x[7] = p[0];
}

int b[8*7*6*5*4*3*2*1];

void solve(){

	memset(b,-1,sizeof(b));
	tbl[6] = 1;
	for(int i = 5; i >= 0; i--) tbl[i] = tbl[i+1] * (7-i);
	queue<Pii> q;
	q.push(Pii(0,0));
	b[0] = 0;

	while(!q.empty()){
		int x[8];
		Pii pii = q.front(); q.pop();
		decode(x,pii.first);
		int cnt = pii.second;
		int zero_id = find(x,x+8,0) - x;
		static int dir[4] = {-4,-1,1,4};
		FOR(j,4){
			int n_zero = zero_id + dir[j];
			if(n_zero < 0 || n_zero >= 8 || n_zero + zero_id == 7) continue;
			swap(x[n_zero],x[zero_id]);
			int n_de = encode(x);
			if(b[n_de] == -1){
				b[n_de] = cnt + 1;
				q.push(Pii(n_de,cnt + 1));
			}
			swap(x[n_zero],x[zero_id]);
		}
	}
	
}

int main()
{
	solve();

	while(true){
		int start[8]; FOR(i,8) 
		if(!(cin>>start[i])) 
			return 0;
		int de = encode(start);
		cout << b[de] << endl;
	}

	return 0;
}

Measured memory_bytes: 1400
import sys

x, y = map(int, sys.stdin.readline().strip().split())

ans = 0
if abs(x) == abs(y):
    if x == y:
        print(ans)
    else:
        print(1)
elif abs(x) <= abs(y):
    if x < 0:
        # Bを押して符号を入れ替える
        x *= -1
        ans += 1

    tmp = abs(y) - x
    x += tmp
    if x == y:
        print(ans + tmp)
    else:
        # yが負なのでBを押して符号を入れ替える
        print(ans + tmp + 1)
else:
    if x > 0:
        # Bを押して符号を負にする
        x *= -1
        ans += 1

    tmp = abs(x) - abs(y)
    x += tmp
    if x == y:
        print(ans + tmp)
    else:
        # yが負なのでBを押して符号を入れ替える
        print(ans + tmp + 1)

Measured memory_bytes: 38384
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        final Scanner scanner = new Scanner(System.in);
        final int a = scanner.nextInt();
        final int b = scanner.nextInt();
        if ((a * b) % 2 == 0) {
            System.out.println("No");
        } else {
            System.out.println("Yes");
        }
    }

}


Measured memory_bytes: 21972
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
typedef long long ll;
typedef pair<int,int> pint;

int p,q,a,n;
int dfs(int x,int y,int c,int k){
    if(x*q==y*p) return 1;
    if(c==n||x*q>y*p) return 0;
    int cnt=0;
    for(int i=k;y*i<=a;++i){
        cnt+=dfs(x*i+y,y*i,c+1,i);
    }
    return cnt;
}
int main(){
    while(cin>>p>>q>>a>>n,p|q|a|n){
        int g=__gcd(p,q);
        p/=g,q/=g;
        cout<<dfs(0,1,0,1)<<endl;
    }
    return 0;
}


Measured memory_bytes: 3008
# -*- coding: utf-8 -*-
N=int(input())
A=list(map(int,input().split()))
a=0
for i in range(N):
    if A[i]%2==0:
        if A[i]%3!=0 and A[i]%5!=0:
            a=1
if a==1:
    print("DENIED")
else:
    print("APPROVED")

Measured memory_bytes: 3060
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ABC0613
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());

            if(n>1000)
            {
                while (true)
                {
                    n -= 1000;
                    if (n <= 1000) break;
                }
                Console.WriteLine(1000 - n);

            }
            else
            {
                Console.WriteLine(1000 - n);
            }
        }
    }
}


Measured memory_bytes: 27532
use std::io;
use std::cmp;
use std::collections::BTreeMap;
use std::collections::BTreeSet;

fn main() {

	let mut line = String::new();

	io::stdin().read_line(&mut line).expect("Failed to read line.");
	let mut tmp : Vec<i64> = line.trim().split(" ").map(|val| val.parse().unwrap()).collect();
	let (h, w) = (tmp[0],tmp[1]);


	// 現在、ある場所からスタートした時に、最終的にどこまで右に行くのかを記録
	// 不要なスタート地点は都度抜いていくが、
	// 最初は全ての場所(W個)をスタート地点にEntry
	let mut map_start_and_init = BTreeMap::new();
	// let mut set_answers = BTreeSet::new();
	// let mut map_answers = BTreeMap::new();
	let mut answers = BTreeSet::new();	
	for w_ in 0..w {
		map_start_and_init.insert(w_,w_);
		answers.insert((0,w_));	// 欲しいのはfirstだけだが、multiset的な使い方をするために、secondに開始位置格納。。。
	}


	for h_ in 0..h {
		// 行ごとに答えを更新していくスタイル
		line = "".to_string();
		io::stdin().read_line(&mut line).expect("Failed to read line.");
		tmp = line.trim().split(" ").map(|val| val.parse().unwrap()).collect();
		let (wall_left, wall_right_plus_one) = (tmp[0]-1,tmp[1]);
		// 前の行の壁内Entryで一番右まで行ってた位置
		let mut max_init_pos : i64 = -1;
		// println!("{}: {}", wall_left, wall_right_plus_one);

		// 現在のスタート位置のメモから、壁の左から先を切り取り(ここで元のメモからも消滅)
		// let mut in_wall_plus_one = map_start_and_init.split_off(&wall_left);
		// // 元のメモに、切り抜き過ぎた部分(壁の右[+1]列より右)をもう一度つける。。
		// let mut next_wall = in_wall_plus_one.split_off(&(wall_right_plus_one+1));
		// map_start_and_init.append(&mut next_wall);
		let mut tmp : Vec<(i64,i64)> = Vec::new();
		for (&start_pos,&init_pos) in map_start_and_init.range(wall_left..wall_right_plus_one+1) {
			tmp.push( (start_pos,init_pos) );
			// println!("Vec {}: {}", start_pos, init_pos);
		}

		for &( start_pos, init_pos ) in tmp.iter() {
			// 壁のある部分について、Entryを更新する
			// (壁startから、壁END[+1]の場所まで更新するので注意する)
			// 壁のある地点Entryを全部削除(=>すでに抜き出し済み)
			// 壁内の答えもセットで削除
			answers.remove( &(start_pos - init_pos, start_pos) );
			map_start_and_init.remove( &start_pos );
			// 前の行までに作った、行の壁内のEntry中で一番右の場所を取得
			max_init_pos = cmp::max( max_init_pos, init_pos );
			// println!("{}行目 {}: {}", h_+1, start_pos, init_pos);
		}

		if max_init_pos != -1 && wall_right_plus_one < w {
			// 壁内のEntryが更新された場合
			// 壁START〜壁END+1までのEntryは全て削除ずみ
			// それを壁END+1スタートのEntry１つにまとめて再登録する
			// (壁が右まで行っちゃってたら再登録しないので壁内のEntryは全消滅)
			// max_init_posには、壁内にあったEntryの中で(前の行で)一番右まで行ってたやつが入っているはず
			// この行では、前の行で、なるべく右まで行っていたものとみなす方が得なので、それを使用。
			// println!("wall_right_plus_one={}: max_init_pos={}", wall_right_plus_one, max_init_pos);
			answers.insert( (wall_right_plus_one - max_init_pos, wall_right_plus_one ) );//wall_right_plus_one - max_init_pos );
			map_start_and_init.insert(wall_right_plus_one, max_init_pos);
		}

		let mut ans = -1;
		if false == answers.is_empty() {
			// 答えは、消えてないEntry内で右移動した量の最小値
			let min_right_move = answers.iter().next().unwrap().0;
			// let first = set_answers.iter().next();
			ans = min_right_move + (h_+1);
		}

		println!("{}", ans);
	}
}

Measured memory_bytes: 16512
#include <bits/stdc++.h>
typedef long long int lint;

#define PI acos(-1)
#define INF64 1LL << 60
#define INF32 1 << 29
#define all(a) (a).begin(), (a).end()
#define INV ((long long int)1000000007)

using namespace std;

void execute()
{
	int N;
	cin >> N;
	vector<lint> data(N);
	lint sum = 0;
	for (int i = 0; i < N; i++)
	{
		cin >> data[i];
		sum += data[i];
	}

	lint ans = INF64;
	lint right = 0;

	for (int i = 0; i < N - 1; i++)
	{

		right += data[i];
		ans = min(ans, abs(sum - right * 2));
	}

	cout << ans << endl;

	return;
}

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

	int stop;
	cin >> stop;

	return 0;
}

Measured memory_bytes: 1792
s = input()
flg = 0
for i in range(len(s)):
  if i % 2 == 0 and s[i] == 'L':
    flg = 1
  if i % 2 == 1 and s[i] == 'R':
    flg = 1
if flg == 0:
  print('Yes')
else:
  print('No')


Measured memory_bytes: 2940
#define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<sstream>
#include<algorithm>
#include<cmath>
#include<bitset>
#include<map>
#include<set>
#include<vector>
#include<stack>
#include<queue>
#include<deque>
using namespace std;

int main() {

    int i, j;

    while(cin >> i >> j && (i || j) ) {
        if ( i * j % 2 == 1) {
            cout << "no" << endl;
        } else {
            cout << "yes" << endl;
        }
    }
     
    return 0;
}

Measured memory_bytes: 0
#include<stdio.h>
#define rep(i,n) for((i)=0;(i)<(int)(n);(i)++)

int main(void){
  int i,n,k,a[100001],sum,ans;
  
  while(scanf("%d %d",&n,&k),n,k){
    ans=sum=0;
    rep(i,n)scanf("%d",&a[i]);
    rep(i,k)sum+=a[i];
    for(i=0;k<n;i++,k++){
      sum+=a[k]-a[i];
      ans=(ans>sum)?ans:sum;
    }
    printf("%d\n",ans);
  }
  return 0;
}

Measured memory_bytes: 0
#include <stdio.h>

int main(){
  int N,i,j,A[1000],l,v;
  scanf("%d",&N);
  for(i=0;i<N;i++){
    scanf("%d",&A[i]);
  }
  for(i=0;i<N;i++){
    printf("%d",A[i]);
    if(i!=N-1){printf(" ");}
  }
  printf("\n");
  
  for(i=1;i<=N-1;i++){
    v = A[i];
    j = i-1;
    while(j>=0 && A[j]>v){
      A[j+1]=A[j];
    j--;
    }
    A[j+1]=v;
    for(l=0;l<N;l++){
      printf("%d",A[l]);
      if(l!=N-1){printf(" ");}
    }
    printf("\n");
  }
  

  return 0;
}


  



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

int main(){
	map<char,int> mp;
	string s;
	cin >> s;
	for(int i=0;i<s.size();++i){
		mp[s[i]]++;
	}
	for(auto itr=mp.begin();itr!=mp.end();++itr){
		if(itr->second%2!=0){
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 256