akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <fstream>
#include<cstdio>
#include<iomanip>

#define REP(i, n) for(int i=1;i<n+1;i++)

using namespace std;

typedef long long ll;
typedef unsigned long ul;
typedef long double ld;

//const int maxN = 200000;



int main() {
    ll N;
    ll miss=0;
    cin>>N;
    ll H[N];
    REP(i,N){
        cin>>H[i];
    }
    for(int i=0;i<N-1;i++){
        if(H[N-i]<H[N-i-1]){
            H[N-i-1]-=1;
        }
    }
    REP(i,N-1){
        if(H[i]>H[i+1]){
            miss+=1;
        }
    }


    if(miss==0){
        cout<<"Yes";
    }else{
        cout<<"No";
    }

    }










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

vector<ll> ans;
vector<vector<ll>> g;

void dfs(ll parent, ll v){
    for(auto nv: g[v]){
        if(nv == parent) continue;
        ans[nv] += ans[v];
        dfs(v, nv);
    }
}

int main(){
    ll n, q; cin >> n >> q;
    ans.resize(n,0);
    g.resize(n);

    rep(i,n-1){
        ll a, b; cin >> a >> b; a--; b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }

    rep(i,q){
        ll p, x; cin >> p >> x; p--;
        ans[p] += x;
    }

    dfs(-1, 0);

    rep(i,n) cout << ans[i] << " ";
    cout << endl;
}


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

bool is_square(int n)
{
    for (int i = 0; i <= n; i++)
    {
        if (i * i == n)
        {
            return true;
        }
    }
    return false;
}

int main()
{
    string s;
    cin>>s;
    int first_a_index=-1;
    int last_z_index=-1;
    for (size_t i = 0; i < s.length(); i++)
    {
        if(s[i]=='A'&&first_a_index==-1){
            first_a_index = i;
        }
        if(s[i]=='Z'){
            last_z_index = i;
        }
    }
    cout << last_z_index - first_a_index + 1 << endl;

    return 0;
}

Measured memory_bytes: 640
mod = 1000000007

def cmb(n, r, mod):
    n_1 = 1
    n_2 = 1

    r = min(r, n-r)
    for i in range(1, r+1):
        n_1 = n_1 * i % mod
        n_2 = n_2 * (n - i + 1) % mod

    return (n_2 * pow(n_1, mod - 2, mod))%mod

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

ans = (pow(2, n, mod) - cmb(n, a, mod) - cmb(n, b, mod) - 1) % mod
print(ans)


Measured memory_bytes: 3060
*a1, = map(int, input().split())
*a2, = map(int, input().split())
*a3, = map(int, input().split())
a = [a1, a2, a3]


n = int(input())
for _ in range(n):
    b = int(input())
    for i, row in enumerate(a):
        for j, x in enumerate(row):
            if x == b:
                a[i][j] = 0

is_bingo = False
for row in a:
    if sum(row) == 0:
        is_bingo = True

for col in zip(*a):
    if sum(col) == 0:
        is_bingo = True

if all(a[i][i] == 0 for i in range(3)):
    is_bingo = True

if a[0][2] == 0 and a[1][1] == 0 and a[2][0] == 0:
    is_bingo = True

print('Yes' if is_bingo else 'No')


Measured memory_bytes: 3064
h,w=map(int,input().split())
l=[list(input()) for i in range(h)]
for item in l:
  for i in range(w):
    if item[i]==".":
      item[i]=0

for i in range(h):
  for j in range(w):
    if l[i][j]=="#":
      if i>0:
        if l[i-1][j]!="#":
          l[i-1][j]+=1
        if j>0 and l[i-1][j-1]!="#":
          l[i-1][j-1]+=1
        if j<w-1 and l[i-1][j+1]!="#":
          l[i-1][j+1]+=1
      if i<h-1:
        if l[i+1][j]!="#":
          l[i+1][j]+=1
        if j>0 and l[i+1][j-1]!="#":
          l[i+1][j-1]+=1
        if j<w-1 and l[i+1][j+1]!="#":
          l[i+1][j+1]+=1
      if j>0 and l[i][j-1]!="#":
        l[i][j-1]+=1
      if j<w-1 and l[i][j+1]!="#":
        l[i][j+1]+=1
for item in l:
  print("".join(map(str,item)))

Measured memory_bytes: 3192
#include <algorithm>
#include <cmath>
#include <iostream>
#include <numeric>
#include <string>
#include <string.h>
#include <vector>

#define REP(i,x) for(int i{ 0 }; i < (int)(x); i++)
#define REPC(i,x) for(int i{ 0 }; i <= (int)(x); i++)
#define RREP(i,x) for(int i{ (int)(x) - 1 }; i >= 0 ;i--)
#define RREPC(i,x) for(int i{ (int)(x)}; i >= 0; i--)
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()

typedef int64_t int64;
typedef int64_t ll;

const int dx[4] = { 1, 0, -1,  0 };
const int dy[4] = { 0, 1,  0, -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; }

using namespace std;


class A {
	int n;
public:
	A()
	{
		cin >> n;
	}
	void solve()
	{
		cout << n * n * n << endl;
	}
};


int main()
{
	A solution;
	solution.solve();

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef long double ld;
const double pi=acos(-1.0);
const ll mod=pow(10,9)+7;
const ll INF=pow(2,31)-1;
typedef pair<int,int> P;
typedef vector<int> vi;

ll gcd(ll a,ll b){
    ll v0=a,v1=b,v2=a%b;
    while(v2!=0){
        v0=v1;
        v1=v2;
        v2=v0%v1;
    }
    return v1;
}

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

int main(){
    ios::sync_with_stdio(false);
    int a,b,k;
    cin >> a >> b >> k;
    int x=b-a;
    if(x>=2*k){
        for(int i=0;i<k;i++){
            cout << a+i << endl;
        }
        for(int i=k-1;i>=0;i--){
            cout << b-i << endl;
        }
    }
    else {
        rep(i,x+1){
            cout << a+i << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 256
int main(void){
  unsigned long long int N,i,j,r,a,b,c,d;
  unsigned long long int T[100];
  
  scanf("%lld",&N);
  for(i = 0;i<N;i++)
    scanf("%lld",&T[i]);
  
  a = T[0];
  
  for(j = 1;j<N;j++){
    d = a;
    r = T[j];
    while(r!=0){
      b = a%r;
      a = r;
      r = b;
    }
    a = T[j]/a*d;
  }
 
  printf("%lld\n",a);
  
  return 0;
}

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

using namespace std;
 
#define int1(a) scanf("%d",&a)
#define int2(a,b) scanf("%d %d",&a,&b)
#define int3(a,b,c) scanf("%d %d %d",&a,&b,&c)
#define int4(a,b,c,d) scanf("%d %d %d %d",&a,&b,&c,&d)
 
#define lint1(a) scanf("%lld",&a)
#define lint2(a,b) scanf("%lld %lld",&a,&b)
#define lint3(a,b,c) scanf("%lld %lld %lld",&a,&b,&c)
#define lint4(a,b,c,d) scanf("%lld %lld %lld %lld",&a,&b,&c,&d)
#define lli long long int
 
#define pint(x) printf("%d",x)
#define plint(x) printf("%lld",x)
#define endl '\n'
#define nl printf("\n");
#define ps printf(" "); 
 
#define all(x) x.begin(),x.end()
#define pb push_back
#define Set(a, s) memset(a, s, sizeof (a))
#define mod1 (lli)(1e9 + 7)
#define mod2 (lli)(1e9 + 9)
#define EPS 1e-9

#define fore(i,n) for(int i=n; i>=0; i--)
#define fors(i,a,n) for(int i=a; i<n; i++)
#define fora(i,ele) for(auto i: ele)
 
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
 
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef vector<lli> vli;
 
template< class T > T gcd(T a, T b) { return (b != 0 ? gcd<T>(b, a%b) : a); }
template< class T > T lcm(T a, T b) { return (a / gcd<T>(a, b) * b); }
 
double tick(){static clock_t oldt,newt=clock();double diff=1.0*(newt-oldt)/CLOCKS_PER_SEC;oldt=newt;return diff;}
float roundoff(float val, float p){ return floor(val*pow(10.0,p)+0.5)/pow(10.0,p);}
lli power(lli a, lli b, lli mod){lli x=1,y=a; while(b > 0){if(b&1){x=(x*y)%mod;}y = (y*y)%mod; b /= 2;}return x;}
 
const int INF = 0x3f3f3f3f;
const float pi = 3.14159265;
 
//int dx[]={1,1,0,-1,-1,-1,0,1};int dy[]={0,1,1,1,0,-1,-1,-1};
//int dx[]={1,-1,0,0}; int dy[]={0,0,1,-1};
 
int main(void) {
    ios_base::sync_with_stdio(true);
    cin.tie(NULL);
    cout.tie(NULL);
	//srand (time(NULL));
	/*
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
	*/
    // cout<<"Execution time : "<<tick()<<"\n";
    
	int n;
	int1(n);
	int cnt = 0;
	while(n!=0){
		int temp = n%10;
		n/=10;
		if(temp==2) cnt++;
	}
	cout<<cnt;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#define EPS 1e-9
using namespace std;

int main(){
	int n,m,p;
	while(cin >> n >> m >> p,n){
		int x[100];
		double sum = 0;
		for(int i = 0;i < n;i++){
			cin >> x[i];
			sum += x[i];
		}
		if(!x[m - 1]) cout << 0 << endl;
		else cout << (int)(sum * 100.0 * (1.0 - (double)p / 100.0) / (double)x[m - 1] + EPS) << endl;
	}
	return 0;
}

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


int main() {
  int K,A,B;
  cin >> K >> A >> B;
  if(K == 1){
    cout << "OK" << endl;
  }
  else if(A%K ==0 || B%K ==0){
    cout << "OK" <<endl;
  }
  else if(B/K != A/K){
    cout << "OK" <<endl;
  }
  else{
    cout << "NG" <<endl;
  }
}


Measured memory_bytes: 3636
n=int(input())
hl=list(map(int,input().split()))
mx=0
mxh=[]
ans=1
for i in range(n):
    mx=max(mx,hl[i])
    mxh.append(mx)
for i in range(1,n):
    if hl[i]>=mxh[i-1]:
        ans+=1
print(ans)

Measured memory_bytes: 3064
# coding: utf-8
from math import ceil
N = int(input())
mod = 10**9 + 7
A = list(map(int, input().split()))
A.sort()
flag = True
if len(set(A)) != ceil(N / 2):
    flag = False
if N % 2 == 1:
    if A[0] != 0:
        flag = False
    else:
        for i in range(1, N, 2):
            if A[i] != A[i+1] or A[i] % 2 == 1:
                flag = False
else:
    for i in range(N, 2):
        if A[i] != A[i+1] or A[i] % 2 == 0:
            flag = False
ans = 1
if flag:
    for i in range(N//2):
        ans *= 2
        ans %= mod
else:
    ans = 0
print(ans)

Measured memory_bytes: 13812
import sys
import math
import copy
from typing import Tuple, List, Union
input = sys.stdin.readline


def main():
    n = int(input())
    S = tuple(map(int,input().split()))
    q = int(input())
    T = tuple(map(int,input().split()))
    res = 0
    for t in T:
        for s in S:
            if s == t:
                res += 1
                break
    return res


if __name__ == '__main__':
    print(main())



Measured memory_bytes: 8100
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
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; }
 
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    ごちゃごちゃ場合分けを考える前に全探索は考えましたか？
    詰まった時に、別の分野の問題として考え直す（これdpでは？、グラフとしてみればいいのでは？）
    多くの問題はパターンマッチだが、パターンに落とし込むまでが難しく、そのための訓練としてわからない問題をあれこれ色々な角度から考察してみるのではないか
*/

const ll mod = 1e9+7;

void chmod(ll &M){
    if(M >= mod) M %= mod;
    else if(M < 0){
        M += (abs(M)/mod + 1)*mod;
        M %= mod;
    }
}

ll modpow(ll x, ll n){
    if(n == 0) return 1;

    ll res = modpow(x, n/2);
    if(n%2 == 0) return res*res%mod;
    else return res*res%mod*x%mod;
}

ll power(ll x, ll n){
    if(n == 0) return 1;

    ll res = power(x, n/2);
    if(n%2 == 0) return res*res;
    else return res*res*x;
}

int getl(int i, int N) { return i==0? N-1:i-1; };
int getr(int i, int N) { return i==N-1? 0:i+1; };

/* <--------------------------------------------> */

typedef tuple<ll, ll, ll> T;



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

    ll n; cin >> n;
    ll k; cin >> k;

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

    vector<ll> right_ten(n, 0), all_ten(n, 0);

    for(int i=0; i<n; ++i){
        for(int j=i+1; j<n; ++j) if(a[i] > a[j]) ++right_ten[i];
        for(int j=0; j<n; ++j) if(a[i] > a[j]) ++all_ten[i];
    }

    ll ans = 0;
    for(int i=0; i<n; ++i){
        ans += k*right_ten[i]%mod;
        chmod(ans);
        ans += k*(k-1)/2%mod*all_ten[i];
        chmod(ans);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define all(x) (x).begin(),(x).end()

using ll = long long;
using ld = long double;
using namespace std;

const ll inf = 2e18;
const ll mod = 1e9 + 7;
const ll N = 2e5 + 5;

string s;

void code() {
    cin >> s;
    ll ans = 0;
    for (int i = 0; i < s.size(); i++) {
        ans += (s[i] - '0');
    }

    cout << (ans % 9 == 0 ? "Yes\n" : "No\n");
}

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

    int t = 1;

    while (t-- > 0) {
        code();
    }
}

Measured memory_bytes: 3744
s = input()

s = s[::-1]
s = list(s)
#print(s)
count = 0
can = True
jm = []
j = 0
maxcount = 0
for i in s:
    jm.append(i)
    j += 1
    count += 1
    if count > 7:
        can = False
#        print(0)
        break
    elif "".join(jm) == "maerd":
        maxcount += count
        count,j = 0,0
        jm = []
#        print(1)
    elif "".join(jm) == "remaerd":
        maxcount += count
        count,j = 0,0
        jm = []
#        print(2)
    elif "".join(jm) == "esare":
        maxcount += count
        count,j = 0,0
        jm = []
#        print(3)
    elif "".join(jm) == "resare":
        maxcount += count
        count,j = 0,0
        jm = []
#        print(4)
    else:
#        print(5,end = "")
        pass


#print("forward bool is" + str(can))

if maxcount == 0:
    can = False

if can:
    print("YES")
else:
    print("NO")

Measured memory_bytes: 4004
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
#include<complex>
#include<numeric>
using namespace std;

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
constexpr ll mod = 1000000009;
const ll INF = mod * mod;
typedef pair<int, int>P;
#define stop char nyaa;cin>>nyaa;
#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++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acos(-1.0);


struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n%mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint &a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint &a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint &a, modint b) { a.n = ((ll)a.n*b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
	if (n == 0)return modint(1);
	modint res = (a*a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1 << 18;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}
modint combP(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[a - b];
}
int dx[4] = { 1,0,-1,0 };
int dy[4] = { 0,1,0,-1 };

void solve() {
	int x, y; cin >> x >> y;
	if (y % 2) {
		cout << "No\n"; return;
	}
	if (2 * x <= y && y <= 4 * x) {
		cout << "Yes\n";
	}
	else {
		cout << "No\n";
	}
}


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


Measured memory_bytes: 7744
use std::io;


fn main() {
    let (x, y) = {
        let i = read::<isize>();
        (i[0], i[1])
    };

    let gx = match x {
        1|3|5|7|8|10|12 => 1,
        4|6|9|11 => 2,
        2 => 3,
        _ => 4,
    };

    let gy = match y {
        1|3|5|7|8|10|12 => 1,
        4|6|9|11 => 2,
        2 => 3,
        _ => 4,
    };

    if gx == gy { println!("Yes"); }
    else { println!("No"); }
}


#[allow(dead_code)]
fn read<T>() -> Vec<T>
where T:
    std::str::FromStr,
    T::Err: std::fmt::Debug {

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.split_whitespace()
        .map(|s| s.trim().parse().unwrap())
        .collect()
}

#[allow(dead_code)]
fn read_one<T>() -> T
where T:
    std::str::FromStr,
    T::Err: std::fmt::Debug {

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.trim().parse().unwrap()
}

Measured memory_bytes: 4352
#include <iostream>
#include <vector>
#include <queue>
#include <map>
using namespace std;

struct state{
	int node,dist,comp;
	bool operator<(const state& r)const{
		return dist>r.dist;
	}
};

struct edge{
	int to,comp;
};

int main(){
	int N,M,inf = 1e9;
	cin >> N >> M;
	vector<vector<edge>> v(N+1);
	map<int,int> dp[N+1];
	map<int,vector<int>> m[N+1];
	int id = N+1;
	int p,q,c;
	for(int i=0;i<M;i++){
		cin >> p >> q >> c;
		v[p].push_back({q,c});
		v[q].push_back({p,c});
		m[p][c].push_back(q);
		m[q][c].push_back(p);
	}
	priority_queue<state> Q;
	dp[1][0] = 0;
	Q.push({1,0,0});
	while(!Q.empty()){
		state now = Q.top(); Q.pop();
		if(dp[now.node][now.comp]<now.dist) continue;
		state ne = now;
		if(now.comp!=0){
			ne.comp = 0;
			if(!dp[ne.node].count(ne.comp) || dp[ne.node][ne.comp]>ne.dist){
				dp[ne.node][ne.comp] = ne.dist;
				Q.push(ne);
			}
			for(auto x:m[now.node][now.comp]){
				ne.node = x;
				ne.comp = now.comp;
				ne.dist = now.dist;
				if(!dp[ne.node].count(ne.comp) || dp[ne.node][ne.comp]>ne.dist){
					dp[ne.node][ne.comp] = ne.dist;
					Q.push(ne);
				}
			}
		}
		else{
			for(auto x:v[now.node]){
				ne.node = x.to;
				ne.comp = x.comp;
				ne.dist = now.dist+1;
				if(!dp[ne.node].count(ne.comp) || dp[ne.node][ne.comp]>ne.dist){
					dp[ne.node][ne.comp] = ne.dist;
					Q.push(ne);
				}
			}
		}
	}
	cout << (dp[N].count(0)? dp[N][0]:-1) << endl;
}

Measured memory_bytes: 87216
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
#include <utility>
#include <climits>
#include <iomanip>
using namespace std;
#define MAXSIZE 100005
#define MAXL 100
#define MOD 998244353
typedef long long int lli;

int main(){
    lli N;
    cin >> N;
    vector<lli> h(N);
    for(lli i = 0; i < N; ++i){
        cin >> h[i];
    }

    for(lli i = N - 1; i >= 1; --i){
        if(h[i] >= h[i - 1]){
            continue;
        }else if(h[i] == h[i - 1] - 1){
            h[i - 1]--;
            continue;
        }else{
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 1024
S = input()
T = input()

d1 = dict()
d2 = dict()

ret = "Yes"

for s, t in zip(S, T):
    #print("{}-->{}".format(s, t))
    tmp1 = d1.get(s, None)
    tmp2 = d2.get(t, None)
    if (tmp1 == None or tmp1 == t) and (tmp2 == None or tmp2 == s):
        d1[s] = t
        d2[t] = s
    else:
        ret = "No"

print(ret)


Measured memory_bytes: 3632
#include <ios>
#include <iomanip>
#include <iostream>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <climits>

using namespace std;
typedef long long int ll;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#define INF (1e9)
#define PI (acos(-1))
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl

ll gcd(ll a, ll b) { return b ? gcd(b,a%b) : a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
typedef pair <ll,ll> P;

ll nCrModp(ll n, ll r, ll p)
{
    ll C[r+1];
    memset(C, 0, sizeof(C));

    C[0] = 1;

    for (ll i = 1; i <= n; i++)
    {
        for (ll j = min(i, r); j > 0; j--)
            C[j] = (C[j] + C[j-1])%p;
    }
    return C[r];
}

int main()
{
    ll N;
    cin >> N;
    ll mi = MOD;
    for(ll i = 1; i < N; ++i) {
        ll A = i;
        ll B = N-i;
        ll cA = 0;
        ll cB = 0;
        while(A > 0) {
            cA += A % 10;
            A /= 10;
        }
        while(B > 0) {
            cB += B % 10;
            B /= 10;
        }
        mi = min(mi, cA+cB);
    }
    print(mi);
    return 0;
}


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

typedef struct
{
  string name;
  int point;
} Character;

class LessPoint
{
public:
  bool operator() (const Character& lhs, const Character& rhs) const
  {
    if (lhs.point == rhs.point)
      return lhs.name < rhs.name;
    return lhs.point < rhs.point;
  }
};

int main()
{
  int n;
  while (cin >> n) {
    if (n == 0)
      break;

    vector<Character> ans(n);
    vector<vector<int> > freq(n, vector<int>(31, 0));
    for (int i = 0; i < n; ++i) {
      int m;
      cin >> ans[i].name >> m;
      ans[i].point = 0;
      for (int j = 0; j < m; ++j) {
	int d;
	cin >> d;
	freq[i][d] = 1;
      }
    }

    for (int i = 0; i < n; ++i) {
      for (int j = 0; j < 31; ++j) {
	if (!freq[i][j])
	  continue;
	int tmp = n;
	for (int k = 0; k < n; ++k) {
	  if (i == k)
	    continue;
	  if (freq[k][j])
	    --tmp;
	}
	ans[i].point += tmp;
      }
    }
    sort(ans.begin(), ans.end(), LessPoint());
    cout << ans[0].point << " " << ans[0].name << endl;
  }
  return 0;
}

Measured memory_bytes: 0
#include "bits/stdc++.h"
using namespace std;
int main()
{
	int n, a[3] = {0, 0, 0};
	scanf("%d", &n);
	for(int i = 0, j; i < n; ++i)
	{
		scanf("%d", &j);
		if(!(j % 4))
		{
			++a[2];
		}
		else if (!(j % 2))
		{
			++a[1];
		}
		else
		{
			++a[0];
		}
	}
	if(a[1])
	{
		if(a[0] <= a[2])
		{
			printf("Yes\n");
			return 0;
		}
	}
	else
	{
		if(a[0] <= a[2] + 1)
		{
			printf("Yes\n");
			return 0;
		}
	}
	printf("No\n");
}

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

typedef double db;

const int N = 3005;
const db pi = std::acos(-1);

int n, L;
db t[N];

std::complex<db> ans, point[N];

std::complex<db> polar(db theta) {
	return {std::cos(theta), std::sin(theta)};
}

int main() {
	std::ios::sync_with_stdio(0), std::cin.tie(0);
	std::cin >> n >> L;
	for (int i = 0; i < n; ++i)
		std::cin >> t[i], t[i] = t[i] / L * 2 * pi, point[i] = polar(t[i]);
	for (int A = 0; A < n; ++A) {
		std::complex<db> sum(0, 0); int number = 0;
		for (int B = (A + 1) % n; B != A; B = (B + 1) % n) {
			std::complex<db> M = polar((t[A] + t[B]) / 2 + (t[B] > t[A]) * pi);
			ans += (db) number * M + sum * (point[A] - M);
			db a = t[B] - t[A]; if (a < 0) a += 2 * pi;
			++number, sum += polar(a / 2);
		}
	}
	ans /= (n * (n - 1) / 2), ans /= (n - 2);
	std::cout << std::fixed << std::setprecision(18) << ans.real() << ' ' << ans.imag() << '\n';
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
 
#define FAST ios_base::sync_with_stdio(0); cin.tie(); cout.tie();
 
#define MAXX 100005
 
#define PI   3.14159265358979323846264338327950

#define PB push_back 
#define F first
#define S second
 
#define ll 	 long long int

#define mod  1000000007




int main()
{
	FAST;
	ll a, b;
	ll n;
	cin >> n;
	ll x = 0;
	for(ll i = 0; i < n; i ++){
		cin >> a;
		while(a % 2 ==0){
			x ++;
			a /= 2;
		}
	}
	cout << x;
	return 0;
}

Measured memory_bytes: 3668
#include <cstdio>
int read () {
	int k=0;
	char c=getchar();
	while (c<'0'||c>'9') c=getchar();
	while (c>='0'&&c<='9') {k=k*10+c-'0';c=getchar();}
	return k;
}
main () {
    int a,b;
    a=read();b=read();
    printf ("%d",(a-1)*(b-1));
}

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


int main()
{
int n;cin >> n;
    vector<int> a(n);
    for(int i = 0; i<n; i++)cin>>a[i];
    sort(a.begin(),a.end());
    cout << a[n-1]-a[0] << endl;
    return 0;
    
}

Measured memory_bytes: 256
#ifdef MY_LOCAL
#define MY_NAMESPACE(ns) namespace ns {
#define MY_NAMESPACE_    }
#define MY_DEBUG(s)      s
#else
#define MY_NAMESPACE(ns) 
#define MY_NAMESPACE_    
#define MY_DEBUG(s)      
#endif

#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <string>
#include <tuple>
#include <unordered_map>
#include <utility>
#include <vector>

using namespace std;

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

#define EPS (1e-7)


MY_NAMESPACE(testbed)
int main()
{
	string s, t;
	cin >> s;
	cin >> t;

	if (s.length() + 1 != t.length())
	{
		cout << "No" << "\n";
		return 0;
	}

	if (s.compare(0, s.length(), t, 0, s.length()) != 0)
	{
		cout << "No" << "\n";
		return 0;
	}

	cout << "Yes" << "\n";
	return 0;
}
MY_NAMESPACE_

Measured memory_bytes: 3608
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,a,b,c;
    cin>>n;
    vector<vector<int>>dp(n,vector<int>(3,0));

    for(int i=0;i<n;i++)
    {
        cin>>a>>b>>c;
        dp[i][0]=a;
        dp[i][1]=b;
        dp[i][2]=c;
    }

    for(int i=1;i<n;i++)
    {
        for(int j=0;j<3;j++)
        {
            if(j==0)
            {
                dp[i][j]+=max(dp[i-1][j+1],dp[i-1][j+2]);
            }
            else if(j==2)
            {
                dp[i][j]+=max(dp[i-1][j-2],dp[i-1][j-1]);
            }
            else
            {
                dp[i][j]+=max(dp[i-1][j+1],dp[i-1][j-1]);
            }
            
        }
    }
    cout<<*max_element(dp[n-1].begin(),dp[n-1].end());
    return 0;
}

Measured memory_bytes: 5760
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace Tasks
{
    public class C
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }

        public static void Solve()
        {
            var N = Scanner.Scan<int>();
            var dict = new Dictionary<string, int>();
            for (var i = 0; i < N; i++)
            {
                var S = Scanner.Scan<string>();
                if (!dict.ContainsKey(S)) dict[S] = 0;
                dict[S]++;
            }
            var max = dict.Values.Max();
            foreach (var s in dict.Where(x => x.Value == max).OrderBy(x => x.Key))
            {
                Console.WriteLine(s.Key);
            }
        }

        public static class Scanner
        {
            private static Queue<string> queue = new Queue<string>();
            public static T Next<T>()
            {
                if (!queue.Any()) foreach (var item in Console.ReadLine().Trim().Split(" ")) queue.Enqueue(item);
                return (T)Convert.ChangeType(queue.Dequeue(), typeof(T));
            }
            public static T Scan<T>() => Next<T>();
            public static (T1, T2) Scan<T1, T2>() => (Next<T1>(), Next<T2>());
            public static (T1, T2, T3) Scan<T1, T2, T3>() => (Next<T1>(), Next<T2>(), Next<T3>());
            public static (T1, T2, T3, T4) Scan<T1, T2, T3, T4>() => (Next<T1>(), Next<T2>(), Next<T3>(), Next<T4>());
            public static (T1, T2, T3, T4, T5) Scan<T1, T2, T3, T4, T5>() => (Next<T1>(), Next<T2>(), Next<T3>(), Next<T4>(), Next<T5>());
            public static IEnumerable<T> ScanEnumerable<T>() => Console.ReadLine().Trim().Split(" ").Select(x => (T)Convert.ChangeType(x, typeof(T)));
        }
    }
}


Measured memory_bytes: 57364
/*MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWO:,'..'xXWWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMO. .:kOo.,kNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMO. .lNWWo..lXMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
MNOxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxMMMMWKxoloxKWNc  .:xxd;  ,dxxxkXMXkxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxMM
MKc''''''''''''''''.  ..'''''.   .''''.  .''MMMWx..,:. .xXo''.  .''.  ..'';kMk;'''''.  .'.''.  .''''''.  ..''.   .''MM
MWNXNNNNNNNNNNNNNNNO' ;KNNNNNKo. cKNNNd. lXNMMMK; ,0Wx. :NWXXl .dNNO' ;KNNNWMWNNNNNXc .kNNNNx. cXNNNNNO' ;KNN0; 'ONNMM
MMMMMMMMMMMMMMMMMWM0' :NMMMMWMX: .OMWWx. oWMMMMWx. ';. .dNMWWo .xMM0' :NWWMMMMMMMMWWl .OMMMWk. lWWMMWM0' ;XMMX: ,KMMMM
MMMMMMWMWkccccccccc;. :NMWNNNKd. :XMMWx. oWMMMWKo. .',. .,ldx; .dMM0' :NMMMMMMMNNWMWl .OMMMWk. lWMMMMM0' ;XMMX: ,0MMMM
MMWXKNWMWxcc,. .;cc;. :XMk,''..'lKWMMWx. oWMNx:. .lONNKxl.     .xMM0' :NMMMMMM0:,oKO' ,KMMMMk. lWWNkoc,. .;::;. ,KMMMM
MMXc.lXMMWWWNd..xWM0' :NM0;  ;kXWMMMWNl  oWMK:.;xXWWMWXx:. ,c' .dMM0' :NMMMMMMKc. ...;kWMMMMk. lWWc .:;. .clc:. ,KMMMM
MWWx. lXMWMMMK, lWM0' :NMMNx'.,ldxxoc'   oWMWNKNWWWN0o' .:kNWo .dMM0' :NMMMMMMMNO;  ,OWWWMMMk. lWM' lXx. lNMMX: ,KMMMM
MMMWk'.,xKNX0c..kWM0' :NMMMMNkl;,'',:l:  oWMMMMMWMWO' 'l0WMWWo .xMM0' :NMMMMMMMMMNd. .oXWMMMk. lWMd.....;0WMMX: ,KMMMM
MMMMWKo'...'..:kWMM0' :NMMMMMMMWWNNWWWx. oWMMMMMMMMWOxXWMWMWWo .xMM0' :NMMMMMMMMMMMKl. ,kNMMk. lWMWKkxx0NMWMMX: ,KMMMM
MMMMMMMN0kxk0XNWMMWKl;xNMMMMMMMMMMMMWM0c;kWMMMMMMMMMMMWWMMMMWk;:OMMXl,dNMMMMMMMMMMMMWO; .dNM0c;kWWMMMMMMMMMMMNd,oXMMMM
MMMMMMMMWWMWMMMMMMMMMWWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWWMMWWMMWMMMMMMMMMMMMMMNkxKWMMWWMMMMMMMMMMMMMMWMMWMMMMM
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM*/

//             Author: Udit "luctivud" Gupta @ (https://www.linkedin.com/in/udit-gupta-1b7863135/)                  //


#include <bits/stdc++.h>
#pragma GCC optimize "trapv"

using namespace std;

typedef long long int lld;
typedef unsigned long long int llu;

#define         TESTCASES()    cin >> (T3X0); T353 = T3X0; while(T3X0--)
#define         _input(V3C)    for(auto &V3C_I7 : (V3C)) cin >> (V3C_I7)
#define   mems(A77AY, V4LU)    memset((A77AY), (V4LU), sizeof((A77AY)))
#define    CH3K(I7, E4, S7)    (((S7)<0) ? (I7)>(E4) : (I7)<(E4))
#define   for4(I7,S4,E4,S7)    for(auto I7=(S4); CH3K(I7,E4,S7); (I7)+=(S7))



void solveEachTest(lld T35TC453N = 1) {
	lld n; cin >> n;
	lld ans = 1ll;
	for4(i, 0ll, n, 1ll) {
		lld temp; cin >> temp;
		// cout << ans * temp << __gcd(ans, temp) << " ";
		lld g =  __gcd(ans, temp);
		ans = (ans / g * temp) ;
		// what you found here is a secret.
	}

	cout << ans;
	// cout << "\n";

	return;
}


signed main() {
	ios_base::sync_with_stdio(false); cin.tie(0);

	lld T3X0 = 0, T353 = 1;

	// TESTCASES()
	solveEachTest(T353 - T3X0);
	return 0;
}
// Random Thought :  null

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

using namespace std;

template<typename T>void read(T&x){x=0;int fl=1;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')
fl=-1;ch=getchar();}while(ch>='0'&&ch<='9'){x=(x<<1)+(x<<3)+ch-'0';ch=getchar();}x*=fl;}
template<typename T,typename...Args>inline void read(T&t,Args&...args){read(t);read(args...);}

typedef long long LL;
typedef vector<int> vi;
typedef pair<int, int> pii;
#define mp(x, y) make_pair(x, y)
#define pb(x) emplace_back(x)

const LL MOD = 1e9+7;
const int N = 1000005;

LL dp[4][N];

int main(){
	int n; read(n);
	if(n == 1)	return puts("0"), 0;
	dp[0][1] = 8, dp[1][1] = dp[2][1] = 1, dp[3][1] = 0;
	for(int i = 2; i <= n; i++){
		dp[0][i] = dp[0][i-1] * 8 % MOD;
		dp[1][i] = (dp[1][i-1] * 9 + dp[0][i-1]) % MOD;
		dp[2][i] = (dp[2][i-1] * 9 + dp[0][i-1]) % MOD;
		dp[3][i] = (dp[3][i-1] * 10 + dp[2][i-1] + dp[1][i-1]) % MOD;
	}
	printf("%lld\n", dp[3][n]);
	return 0;
}

Measured memory_bytes: 34752
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
using namespace std;
typedef long long ll;
int s[500];
int main() {
    int n;
    while(cin >> n) {
        for(int i = 0; i < n; i++)
            scanf("%d", &s[i]);
        int ans = 1e9;
        for(int i = -100; i <= 100; i++) {
            int sum = 0;
            for(int j = 0; j < n; j++) {
                sum += (s[j] - i) * (s[j] - i);
            }
            ans = min(ans, sum);
        }
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
#define N 19
#define M (1<<N)
#define ll long long
#define mod 998244353
int n,m;
ll ksm(ll a,ll b=mod-2)
{
	if(b==0) return 1;
	if(b==1) return a;
	ll q=ksm(a,b>>1);
	if(b&1) return q*q%mod*a%mod;
	return q*q%mod;
}
ll inv2=499122177;
void fwt(ll f[],int opt)
{
	for(int l=1;l<m;l<<=1)
		for(int j=0;j<M;j+=l<<1)
			for(int i=0;i<l;i++)
			{
				ll v=f[i+j+l];
				f[i+j+l]=(f[i+j]-v+mod)%mod;
				f[i+j]=(f[i+j]+v)%mod;
				if(opt==-1)
				{
					f[i+j]=f[i+j]*inv2%mod;
					f[i+j+l]=f[i+j+l]*inv2%mod;
				}
			}
}
ll num[M];
ll f[M+10],g[M+10];
int main()
{
	scanf("%d",&n);
	m=1<<n;
	ll sum=0;
	for(int i=0;i<m;i++) scanf("%lld",&num[i]),sum=(sum+num[i])%mod;
	sum=ksm(sum);
	f[0]=m-1;
	for(int i=1;i<m;i++) f[i]=mod-1;
	for(int i=0;i<m;i++) g[i]=num[i]*sum%mod;
	g[0]=(g[0]-1+mod)%mod;
	fwt(f,1);
	fwt(g,1);
	int id=0;
	for(int i=0;i<m;i++)
	if(g[i]) f[i]=f[i]*ksm(g[i])%mod;
	else f[i]=0,id=i;
	fwt(f,-1);
	ll v=f[0];
	fwt(f,1);
	f[id]=(mod-v)*m%mod;
	fwt(f,-1);
	for(int i=0;i<m;i++) printf("%lld\n",f[i]);
}

Measured memory_bytes: 15104
#include <bits/stdc++.h>
using namespace std;
using lint = int64_t;
#define rep(i, n) for(int i=0; i<(n); ++i)
#define all(v)    begin(v), end(v)
#define in        []{lint n; cin>>n; return n;}()

int main(){
	int N = in;
	vector<int> A(N);
    rep( i, N ) A[i] = in-1;

    stack<int> ans;
    while( !A.empty() ) {
        for( int i=A.size()-1; i>=0; i-- ) {
            if( A[i] == i ) {
                A.erase( A.begin() +i );
                ans.push(i);
                goto E;
            }
        }
        cout << "-1\n";
        return 0;
        E:;
    }

    while( !ans.empty() ) {
        cout << ans.top()+1 << "\n";
        ans.pop();
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fst ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endk cout<<"\n";
typedef long long int ll;
typedef long int l;
#define l(i,a,b) for(i=a;i<b;i++)
#define lo(i,a,b) for(i=a;i>=b;i--)
#define s(v) sort(v.begin(),v.end());
#define pb push_back;
#define vll vector<ll>
#define vint vector<int>
#define test() ll t;cin>>t;while(t--){solve();};
#define test1() int t=1;while(t--){solve();};
bool isPrime(ll x)
{
    ll i,n;
    n=sqrt(x);
    if(x==1) return false;
    if(x==2 || x==3) return true;
    for(i=2;i<=n;i++)
    {
        if(!(x%i)) return false;
    }
    return true;
}
ll power(ll x,ll y)
{
	ll ans=1;
	while(y>0)
	{
		if(y&1) ans=ans*x;
		x=x*x;
		y=y>>1;
	}
	return ans;
}
int solve()
{
    ll d,t,s,k;
    cin>>d>>t>>s;
    float c;
    c=1.0*d/s;
    k=ceil(c);
    if(k<=t)
    {
        cout<<"Yes";
    }
    else
    {
        cout<<"No";
    }
    return 0;
}
int main()
{
    fst;
    test1();
    return 0;
}


Measured memory_bytes: 3692
#include <iostream>
#include <regex>
#include <vector>

using namespace std;



int main(int argc, const char * argv[]) {
    int N;
    float total = 0;
    cin >> N;
    
    for ( auto i = 0 ; i < N ; i++ ){
        float M;
        string c;
        cin >> M >> c;
        if (c == "JPY") {
            total += M;
        }else{
            total += M * 380000.0;
        }
    }
    cout << total;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#define ll long long 
#define mod 1000000007
using namespace std;
int main() {
    ll n,m;
    cin>>n>>m;
    char matrix[n][m];
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            cin>>matrix[i][j];
        }
    }
    ll dp[n][m];
    dp[0][0]=1;
    for(int i=1;i<n;i++){
        if(matrix[i][0]=='#'){
            dp[i][0]=0;
        }
        else{
            dp[i][0]=dp[i-1][0]%mod;
        }
    } 
    for(int i=1;i<m;i++){
        if(matrix[0][i]=='#'){
            dp[0][i]=0;
        }
        else{
            dp[0][i]=dp[0][i-1]%mod;
        }
    }
    for(int i=1;i<n;i++){
        for(int j=1;j<m;j++){
            if(matrix[i][j]=='#'){
                dp[i][j]=0;
            }
            else{
                dp[i][j]=(dp[i-1][j]%mod+dp[i][j-1]%mod)%mod;
            }
        }
    }
    cout<<dp[n-1][m-1]%mod;

    
}


Measured memory_bytes: 9088
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MOD 1000000007

const int Nmax=200010;

int main() {
	ll N;
	cin >> N;
	vector<int> L(N),R(N);
	for(int i=0;i < N;i++){
		cin >> L[i] >> R[i];
	}
	sort(L.begin(), L.end());
	reverse(L.begin(), L.end());
	sort(R.begin(), R.end());
	ll ans1=0,ans2=0;
	ll now=0;//現在の座標　nowより内側へ内側へと行く
	for(int i=0;i < N;i++){
		if(now < L[i]){//最初に右行くver
			ans1+=abs(L[i]-now);
			now = L[i];
		}else break;
		if(now > R[i]){
			ans1+=abs(now-R[i]);
			now = R[i];
		}else break;
	}
	ans1+=abs(now);
	
	now = 0;
	for(int i=0;i < N;i++){
		if(R[i] < now){//最初に左行くver
			ans2+=abs(now-R[i]);
			now = R[i];
		}else break;
		if(L[i] > now){
			ans2+=abs(L[i]-now);
			now = L[i];
		}else break;
	}
	ans2+=abs(now);
	cout << max(ans1, ans2) << endl;
	return 0;
}

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

using namespace std;

int a[110];

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

    for(int i = 1 ; i <= n ; i ++){
            scanf("%d" , &a[i]);
            a[i] += a[i-1];
    }
    int ans = 1e5;
    for(int i = 1 ; i <= n ; i ++){
            ans = min(ans , abs(a[i] - (a[n] - a[i])));
    }
    printf("%d\n" , ans);

    return 0;
}


Measured memory_bytes: 256
X, N = map(int, input().split())
p = sorted(list(map(int, input().split())))

if N == 0:
    print(X)
else:
    a = [int(i) for i in range(-201, 201) if not i in p]
    m = 100
    val = 0
    for i in a:
        if abs(i-X) < m:
            m = abs(i-X)
            val = i
    print(val)


Measured memory_bytes: 9188
#!/usr/bin/env python3
from collections import Counter
n, *a = map(int, open(0).read().split())
a = [0] + list(list(zip(*Counter(a).items()))[1]) + [1]
for i in range(len(a)-1): a[i+1] = a[i+1]+a[i]-1
ans = 0
li = len(a)-1
for i in range(1, li):
	tmp = abs(a[li]-a[i]-a[i-1])
	x = a[i]-a[i-1]
	if tmp>=x: cnt = tmp-x
	else: cnt = (x-tmp)%2
	ans = max(ans, li-1-cnt)
print(ans)


Measured memory_bytes: 22232
#include<iostream>
using std::cout;
using std::cin;
using std::endl;

#include<vector>
using std::vector;

int main()
{
  int n;
  cin >> n;
  
  vector<int> n_direct(n);
  
  int temp;
  for(int i = 0; i < n - 1; i ++)
  {
    cin >> temp;
    n_direct.at(temp - 1)++;
  }
  
  for(auto m : n_direct)
    cout << m << endl;
  
  return 0;
}


Measured memory_bytes: 4052
#include <bits/stdc++.h>
#define exrep(i, a, b) for(long long i = a; i <= b; i++)
#define rep(i,n)for(long long i=0;i<(long long)(n);i++)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
const ll MOD=1e9+7;
const ll INF=1e18;
const int MAX=510000;
const double pi=acos(-1);
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};



int main(){
  cin.tie(0);
  ios::sync_with_stdio(false); 
  ll n,k;
  cin >> n >> k;
  ll ans=0;
  exrep(r,k,n+1){
    ans+=r*(n-r+1)+1;
    ans%=MOD;
  }
  cout << ans << endl;
}


Measured memory_bytes: 3612
using System;

namespace abc081A
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            string A = Console.ReadLine();
            string temp = "";
            int Ans = 0;
            for(int i=0; i<3; i++)
            {
                temp = A.Substring(i, 1);
                if (temp == "1")
                    Ans = Ans + 1;
            }
            Console.WriteLine(Ans);
        }
    }
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
int main()
{
 string S;
  
  cin>> S;
  
  if(S=="Sunny"){
    cout<<"Cloudy";
  }
  if(S=="Rainy"){
    cout<<"Sunny";
  }
  if(S=="Cloudy"){
    cout<<"Rainy";
  }
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		//List<String> list=new ArrayList<String>(Arrays.asList(s.split("")));
		//List<Integer> list=new ArrayList<Integer>();
		//int[][] array = new int[3][3];
		int n = sc.nextInt();
		int m = sc.nextInt();
		List<Integer> list_answer=new ArrayList<Integer>();
		List<Integer> list_keta = new ArrayList<Integer>();
		List<Integer> list_su = new ArrayList<Integer>();
		for(int i=0;m>i;i++) {
			int s = sc.nextInt();
			int c = sc.nextInt();
			list_keta.add(s);
			list_su.add(c);
		}

		if(n==1) {
			for(int j=0;10>j;j++) {
				int count=0;
				String x = String.valueOf(j);
				List<String> list=new ArrayList<String>(Arrays.asList(x.split("")));
				for(int i=0;m>i;i++) {
					String y = String.valueOf(list_su.get(i));
					if(list.get(list_keta.get(i)-1).equals(y))
						count++;
				}
				if(count==m)
					list_answer.add(j);
			}
		}

		else if(n==2) {
			for(int j=10;100>j;j++) {
				int count=0;
				String x = String.valueOf(j);
				List<String> list=new ArrayList<String>(Arrays.asList(x.split("")));
				for(int i=0;m>i;i++) {
					String y = String.valueOf(list_su.get(i));
					if(list.get(list_keta.get(i)-1).equals(y))
						count++;
				}
				if(count==m)
					list_answer.add(j);
			}

		}

		else {
			for(int j=100;1000>j;j++) {
				int count=0;
				String x = String.valueOf(j);
				List<String> list=new ArrayList<String>(Arrays.asList(x.split("")));
				for(int i=0;m>i;i++) {
					String y = String.valueOf(list_su.get(i));
					if(list.get(list_keta.get(i)-1).equals(y))
						count++;
				}
				if(count==m)
					list_answer.add(j);
			}

		}

		if(list_answer.size()==0)
			System.out.println(-1);
		else
			System.out.println(Collections.min(list_answer));
	}
}

Measured memory_bytes: 23124
#include <bits/stdc++.h>
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(a) sort(a.begin(), a.end())
#define Reverse(a) reverse(a.begin(), a.end())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define Ans(f, y, n) if(f) cout << y << endl; else cout << n << endl;
#define int long long
#define INF 1000000000000000000
using namespace std;

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;

template<typename T>
void readv(vector<T> &a){ REP(i, a.size()) cin >> a[i]; }
void readi(vector<int> &a){ REP(i, a.size()){cin >> a[i]; a[i]--;} }
template<typename T>
void debug(vector<vector<T>> m){ REP(i, m.size()){ REP(j, m[i].size()){ cout << m[i][j] << ","; } cout << endl;} }



signed main(){

    int N; cin >> N;
    vec A(N), B(N);
    vector<Pii> d(N);
    REP(i, N){
        cin >> A[i] >> B[i];
        d[i] = Pii(A[i] + B[i], i);
    }
    Sort(d);
    Reverse(d);
    int a = 0, b = 0;
    
    REP(i, N){
        if(i % 2 == 0) a += A[d[i].second];
        else b += B[d[i].second];
    }
    //REP(i, (N + 1) / 2) a += A[d[i].second];
    //FOR(i, (N + 1) / 2, N) b += B[d[i].second];
    cout << a - b << endl;
    
    return 0;
}

Measured memory_bytes: 3328
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

class Main {

    public static void main(String[] args) throws Exception {

        try {

            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

            long count = Integer.parseInt(br.readLine());
            List<Long> numberList = new ArrayList<>();
            for (long i = 1; i <= count; i++) {
                if (i % 3 == 0 && i % 5 == 0) {
                    continue;
                } else if (i % 3 == 0) {
                    continue;
                } else if (i % 5 == 0) {
                    continue;
                } else {
                    numberList.add(i);
                }
            }

            long result = 0;
            for (long number : numberList) {
                result = result + number;
            }
            System.out.println(result);
        } catch (IOException | NumberFormatException e) {
            e.printStackTrace();
            System.exit(0);
        } catch (final Exception e) {
            e.printStackTrace();
            System.exit(0);
        }
    }
}

Measured memory_bytes: 52992
import sys
import math


def MI(): return map(int,sys.stdin.readline().rstrip().split())


N,X,M = MI()

if M == 1:
    print(0)
    exit()

flag = [-1]*M
Z = [X]
flag[X] = 1
r = X
for i in range(2,M+2):
    r = r ** 2
    r %= M
    if flag[r] != -1:
        a,b = flag[r],i  # [a,b) = 循環節
        break
    else:
        flag[r] = i
        Z.append(r)

z = len(Z)
ans = 0

for i in range(a-1):
    ans += Z[i]
    
n = N-a+1
q = n//(b-a)
r = n % (b-a)

for i in range(a-1,a+r-1):
    ans += (q+1)*Z[i]
for i in range(a+r-1,b-1):
    ans += q*Z[i]

print(ans)


Measured memory_bytes: 71192
import java.util.*;
 
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
 
        while(true){
            int h = sc.nextInt();
            int w = sc.nextInt();
 
            if(h==0 && w==0){break;}
            else{
                for(int i=0;i<h;i++){
                    for(int j=0;j<w;j++){
                        if(i%2==0){
                            if(j%2==0){System.out.printf("#");}
                            else{System.out.printf(".");}
                        }else{
                            if(j%2==0){System.out.printf(".");}
                            else{System.out.printf("#");}
                        }
                    }
                    System.out.println();
 
                }
                System.out.println();
            }
        }
    }
}


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

int main(){
    long long n,k;
    unsigned long long ans=0;
    cin>>n>>k;
    if(n==1 && k==1){
        cout<<1<<endl;
        return 0;
    }
    if(n==1 && k==2){
        cout<<0<<endl;
        return 0;
    }
    if(n==1 && k==3){
        cout<<1<<endl;
        return 0;
    }
    if(k==1){
        cout<<n*n*n<<endl;
        return 0;
    }
    for(int a=1;a<=n;a++){
        int b=k-a;
        int c=k-a;
        if(b<1)b=b%k;
        if(b<1)b+=k;
        if(c<1)c=c%k;
        if(c<1)c+=k;
        if((a+c)%k || (b+c)%k)continue;
        ans+=((n-c)/k+1)*((n-b)/k+1);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
<?php

$in_s = trim(fgets(STDIN));
$n = strlen($in_s);
$arr_s = str_split($in_s);

//echo "\ntest : $n : $in_s";
//var_dump($arr_s);

$arr_ans = array();
$arr_result = array();

for($c = 0; $c < 2; $c++){
    $arr_ans[$c] = 0;
    for($i = 0; $i < $n; $i++){
        $arr_result[$i] = strval(($i + $c) % 2);
    }
//    echo "\ntest : $n : $c";
//    var_dump($arr_result);
    $arr_ans[$c] = count(array_diff_assoc($arr_s, $arr_result));
}

if($arr_ans[0] > $arr_ans[1]){
    $ans = $arr_ans[1];
}else{
    $ans = $arr_ans[0];
}

//echo "\ntest ans : $ans\n";
//echo "\ntest ans : \n";
//var_dump($arr_ans);

echo "$ans\n";

?>

Measured memory_bytes: 25076