akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#define N 200005
using namespace std;
typedef long long ll;

ll n, a, b, M=1e9+7;
ll fac[N]={1,1}, inv[N]={1,1}, fiv[N]={1,1};

ll pow(ll p) {
	ll re;
	if(p==0) return 1;
	re = pow(p/2);
	re = re * re % M;
	if(p&1) re = re * 2 % M;
	return re;
}

ll C(ll p, ll q) {
	ll i, re=1;
	for(i=0; i<q; i++) re = re * (p-i) % M;
	return re * fiv[q] % M;
}

int main() {
	cin >> n >> a >> b;
	for(ll i=2; i<=max(a, b); i++) {
		fac[i] = fac[i-1] * i % M;
		inv[i] = inv[M%i] * (M-M/i) % M;
		fiv[i] = fiv[i-1] * inv[i] % M;
	}
	cout << (pow(n) - C(n, a) - C(n, b) -1 + 2*M) % M;
	return 0;
}

Measured memory_bytes: 4992
/*************************************************************************
  >         File: B.cc
  >       Author: Yuan Lei
  >         Mail: yuanlei@indeed.com
  > Created Time: Sun 22 Oct 2017 09:03:19 PM JST
*************************************************************************/
#include <vector>
#include <cstdio>
#include <bitset>
#include <utility>
#include <cstdlib>
#include <sstream>
#include <fstream>
#include <set>
#include <map>
#include <deque>
#include <cmath>
#include <ctime>
#include <queue>
#include <stack>
#include <string>
#include <iostream>
#include <algorithm>
#include <functional>

int main() {
  std::ios::sync_with_stdio(0);
  int n;
  int ans = 1;
  std::cin >> n;
  for (int i = 0; i < n; ++i) {
    int x;
    std::cin >> x;
    if (x & 1) ans *= 1;
    else ans *= 2;
  }
  int res = 1;
  for (int i = 0; i < n; ++i) res *= 3;
  std::cout << res - ans << std::endl;


  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>   
#define rep(i, n) for(long long int i = 0; i < n; i++)
#define _rep(i, m, n) for(long long int i = m; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll mod = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
string Yes[2] = {"Yes", "No"};
     
ll gcd(ll A, ll B){
    if(B == 0)return A;
    return gcd(B, A % B);
}
ll lcm(ll A, ll B){
    return A * B / gcd(A, B);
}
template <typename T>
T pow(T a, ll n, T e = 1) {
    T ret = e;
    while (n) {
        if (n & 1) ret *= a;
        a *= a;
        n >>= 1;
    }
    return ret;
}
 
template <int mod>
struct ModInt {
    int x;
    ModInt() : x(0) {}
    ModInt(long long x_) {
        if ((x = x_ % mod + mod) >= mod) x -= mod;
    }
    ModInt& operator+=(ModInt rhs) {
        if ((x += rhs.x) >= mod) x -= mod;
        return *this;
    }
    ModInt& operator-=(ModInt rhs) {
        if ((x -= rhs.x) < 0) x += mod;
        return *this;
    }
    ModInt& operator*=(ModInt rhs) {
        x = (unsigned long long)x * rhs.x % mod;
        return *this;
    }
    ModInt& operator/=(ModInt rhs) {
        x = (unsigned long long)x * rhs.inv().x % mod;
        return *this;
    }
 
    ModInt operator-() const { return -x < 0 ? mod - x : -x; }
    ModInt operator+(ModInt rhs) const { return ModInt(*this) += rhs; }
    ModInt operator-(ModInt rhs) const { return ModInt(*this) -= rhs; }
    ModInt operator*(ModInt rhs) const { return ModInt(*this) *= rhs; }
    ModInt operator/(ModInt rhs) const { return ModInt(*this) /= rhs; }
    bool operator==(ModInt rhs) const { return x == rhs.x; }
    bool operator!=(ModInt rhs) const { return x != rhs.x; }
    ModInt inv() const { return pow(*this, mod - 2); }
 
    friend ostream& operator<<(ostream& s, ModInt<mod> a) {
        s << a.x;
        return s;
    }
    friend istream& operator>>(istream& s, ModInt<mod>& a) {
        s >> a.x;
        return s;
    }
};

using mint = ModInt<1000000007>;
using Graph = vector<vector<int>>;
Graph G;

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

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

    ll n; cin >> n;
    vector<mint> have(n + 1), no(n + 1), other(n + 1), beki(n + 1);
    no[1] = 8, have[1] = 0, other[1] = 2;
    beki[1] = 10;
    _rep(i, 2, n + 1){
        no[i] = no[i - 1] * 8;
        have[i] = other[i - 1] + have[i - 1] * 10;
        beki[i] = beki[i - 1] * 10;
        other[i] = beki[i] - have[i] - no[i]; 
    } 
    cout << have[n] << endl;
}


Measured memory_bytes: 18696
n = int(input())
a = list(map(int, input().split()))
sumall = sum(a)
sumodd = [0,a[1]*2]
sumeven = [0,a[0]*2]
for i in range(1,n//2+1):
    sumeven.append(sumeven[-1]+a[2*i]*2)
    if i<n//2:
        sumodd.append(sumodd[-1]+a[2*i+1]*2)
ans = []
for i in range(n):
    if i%2 == 0:
        ans.append(sumall-sumeven[i//2]-sumodd[-1]+sumodd[i//2])
    else:
        ans.append(sumall-sumodd[i//2]-sumeven[-1]+sumeven[i//2+1])
print(*ans)

Measured memory_bytes: 19168
w, h, n = map(int, input().split())
w1 = 0
h1 = 0
w2 = w
h2 = h
for _ in range(n):
    x, y, a = map(int, input().split())
    if a == 1 and x > w1:
        w1 = x
    elif a == 2 and x < w2:
        w2 = x
    elif a == 3 and h1 < y:
        h1 = y
    elif a == 4 and h2 > y:
        h2 = y

ans = (w2 - w1) * (h2 - h1)
if w2 - w1 < 0 or h2 - h1 < 0:
    print(0)
else:
    print(ans)


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

int main() {
    int n, k;
    cin >> n >> k;
    string s;
    cin >> s;
    switch(s[k-1]){
    case 'A':
        s[k-1] = 'a';
        break;
    case 'B':
        s[k-1] = 'b';
        break;
    case 'C':
        s[k-1] = 'c';
        break;
    }

    cout << s << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring> 
using namespace std;
int main()
{
	int n,a,s=10000000;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>a;
		int s1=0;
		while(a%2==0)
		{
			a=a/2;
			s1++;
		}
		s=min(s,s1);
	}
	cout<<s<<endl;	
	return 0;
}


Measured memory_bytes: 256
//
//  main.cpp
//  CoderProj
//
//  Created by Minoru Hayashi on 2020/05/02.
//  Copyright © 2020 Minoru Hayashi. All rights reserved.
//
//  ABC165
//
//

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

#define REP(i,n) for (int i=0; i<(n); i++)
#define REP2(i,x,n) for (int i=x; i<(n); i++)
#define ALL(n) begin(n), end(n)

using ll = long long;

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

// const ll INF = 1LL<<60;
// const int INF = 1<<29;
// const int MOD = 1000000007;
//#define __DBG__



void solve(void){
  
  int N;
  
  cin >> N;
  
  vector<int> A(N+1,0);
  map<int,int> C;
  
  REP2(i,1,N+1){
    cin >> A[i];
    
    auto itr = C.find(i-A[i]);
    if(itr != C.end()){
      C[i-A[i]]++;
    }
    else
    {
      C[i-A[i]]=1;
    }
  }
  ll ans=0;

  REP2(i,1,N+1){
    auto itr = C.find(i+A[i]);
    if(itr != C.end()){
      ans += C[i+A[i]];
    }
  }
  cout << ans << endl;
  return;
}



#define TESTCASES 1

int main() {


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

    REP(i,TESTCASES){
      solve();
    }
 
    return 0;
}




Measured memory_bytes: 12520
#include <bits/stdc++.h>
using namespace std;
int main(){
    vector<int> a(3);
    for(int i = 0; i < 3; i++) scanf("%d", &a.at(i));
    sort(a.begin(), a.end());
    for(int i = 0; i < 2; i++) printf("%d ", a.at(i));
    printf("%d\n", a.at(2));
}


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

using namespace std;

const int N = 2e5;
int a[N], n, k;
long long ans = 0;

void solve(int l, int r) {
  if (l == r) {
    ans += a[l] == 1;
    return;
  }
  int m = l + r >> 1;
  solve(l, m), solve(m + 1, r);
  unordered_map<int, int> cnt;
  int sumr = 0, ptr = m + 1;
  for (int i = m + 1; i <= r and i - m <= k - 2; ++i, ++ptr) {
    sumr += a[i];
    sumr %= k;
    ++cnt[(sumr - (i - m) + k) % k];
  }
  --ptr;
  int suml = 0;
  for (int i = m; i >= l and (m - i + 1) <= k - 2; --i) {
    suml += a[i];
    suml %= k;
    ans += cnt[(k - suml + (m - i + 1)) % k];
    if (ptr - m + (m - i + 2) >= k) {
      --cnt[(sumr - (ptr - m) + k) % k];
      sumr = (sumr + k - a[ptr]) % k;
      --ptr;
    }
  }
}

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

  cin >> n >> k;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    a[i] %= k;
  }
  solve(0, n - 1);
  cout << ans;

  return 0;
}


Measured memory_bytes: 9348
#include<bits/stdc++.h>
using namespace std;
namespace FAST_IO
{
	template<typename T> void read(T &a)
	{
		a=0;
		int f=1;
		char c=getchar();
		while(!isdigit(c))
		{
			if(c=='-')
			{
				f=-1;
			}
			c=getchar();
		}
		while(isdigit(c))
		{
			a=a*10+c-'0';
			c=getchar();
		}
		a=a*f;
	}
	template <typename T> void write(T a)
	{
		if(a<0)
		{
			a=-a;
			putchar('-');
		}
		if(a>9)
		{
			write(a/10);
		}
		putchar(a%10+'0');
	}
	template <typename T> void writeln(T a)
	{
		write(a);
		puts("");
	}
}
int main()
{
	char a;
	cin>>a;
	if(a=='a'||a=='e'||a=='i'||a=='o'||a=='u')
	{
		cout<<"vowel";
	}
	else
	{
		cout<<"consonant";
	}
}


Measured memory_bytes: 256
#include<iostream>
#include<map>
#include<set>
#include<string>
#include<utility>
#include<vector>
#include<cmath>
#include<algorithm>
#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 MAX 10000
typedef long long ll;
using namespace std;

int main(void){
  int a, b;  cin >> a >> b;
  string s; cin >> s;
  if(s[a]!='-' || s.find('-')!=a || s.rfind('-')!=a){
    cout << "No" << endl;
  }else{
    cout << "Yes" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include<string>
#include<iostream>
#include<deque>
using namespace std;
using ulli = unsigned long long int;

int main() {
    ulli r, d, x;
    cin >> r >> d >> x;
    for (int i = 1; i <= 10; i++) {
        int temp = x;
        x = r * temp - d;
        cout << x << endl;
    }
    return 0;
}

Measured memory_bytes: 3584
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i, c) for(__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
typedef long long ll;

const int MOD = 1000000007;

map<vector<int>, int> p2id;
vector<int> id2p[40320+2];
vector<int> g[40320+2];

int w, k;

int memo[110][10];
int solve(int h, int pos) {
  int& res = memo[h][pos];
  if(res < 0) {
    if(h == 0) {
      if(pos == k-1) {
        res = 1;
      } else {
        res = 0;
      }
    } else {
      res = 0;
      REP(pat, 1 << w) {
        bool ok = true;
        if(pat & (1 << (w-1))) {
          ok = false;
        }
        if(pat & (pat << 1)) {
          ok = false;
        }
        if(!ok) {
          continue;
        }
        if(pat & (1 << pos)) {
          res = (res + solve(h-1, pos+1)) % MOD;
        } else if(pos > 0 && (pat & (1 << (pos-1)))) {
          res = (res + solve(h-1, pos-1)) % MOD;
        } else {
          res = (res + solve(h-1, pos)) % MOD;
        }
      }
    }
  }
  return res;
}

int main(void) {
  int h;
  cin >> h >> w >> k;

  memset(memo, -1, sizeof memo);
  int res = solve(h, 0);
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 2176
#include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(a); (i)<(b); ++(i))
#define rFor(i, a, b) for(int (i)=(a)-1; (i)>=(b); --(i))
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef pair<int, int> pii;
typedef pair<lint, lint> pll;

int main(){
    int n;
    scanf("%d", &n);
    pll a[n+1];
    rep(i, n){
        lint t;
        scanf("%lld", &t);
        a[i] = make_pair(t, i);
    }
    a[n] = make_pair(0, -1);
    sort(a, a+n+1, greater<pll>());
    lint ans[n];
    rep(i, n) ans[i] = 0;
    lint cur = 1e7;
    rep(i, n){
        cur = min(cur, a[i].se);
        if(a[i].fi != a[i+1].fi){
            ans[cur] += (lint)(a[i].fi - a[i+1].fi) * (i+1);
        }
    }
    rep(i, n) printf("%lld\n", ans[i]);
}


Measured memory_bytes: 3456
#include<bits/stdc++.h>
using namespace std;
	
#define all(a) a.begin(),a.end()
#define F first
#define S second
#define pb push_back
#define ll long long
#define vi vector<int>
#define pi pair<int,int>
#define mp make_pair
	
#ifdef LOCAL
#include "debug.h"
#else
#define debug(...) 42
#endif
	
const int mod=1e9+7;
	
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
	
int mul(int a,int b)
{
	return ((a)*1ll*(b))%mod;
}
	
void add(int &a,int b)
{
	a+=b;
	if(a>=mod)a-=mod;
}
	
int sub(int a,int b){
	a-=b;
	if(a<0){
		a+=mod;
	}
	return a;
}
	
int powz(int a,int b){
	int res=1;
	while(b){
		if(b&1){
			res=mul(res,a);
		}
		b/=2;
		a=mul(a,a);
	}
	return res;
}
	
template <typename A, typename B>
istream& operator>>(istream& input,pair<A,B>& x) {
	input>>x.F>>x.S;
	return input;
}
	
template <typename A>
istream& operator>>(istream& input,vector<A>& x) {
	for(auto& i:x)
		input>>i;
	return input;
}
	
template<typename A>
ostream& operator<<(ostream& output,vector<A>& x) {
	for(auto& i:x)
		output<<i<<' ';
	return output;
}

const int N=1000002;

int dp[51][51];

void solve(){
	int n;
	cin>>n;
	ll ans=0;
	for(int i=0;i<n;i++){
		double x;
		cin>>x;
		long long val=(x+1e-12)*1e9;
		ll tw=0,fv=0;
		if(val==0){
			ans+=n;
			continue;
		}
		while(val%2==0){
			tw++;
			val/=2;
		}
		while(val%5==0){
			fv++;
			val/=5;
		}
		for(int j=0;j<=50;j++){
			if(tw+j<18){
				continue;
			}
			for(int k=0;k<=50;k++){
				if(fv+k>=18){
					ans+=dp[j][k];
				}
			}
		}
		dp[tw][fv]++;
	}
	cout<<ans;
	
}
	
signed main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int tc=1;
	// cin>>tc;
	for(int _=0;_<tc;_++){
		// cout<<"Case #"<<_+1<<": ";
		solve();
		if(_!=tc-1)
		cout<<"\n";
	}
}

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

ans = 100000

for A in range(1, N):
    B = N - A
    a_sum = 0
    b_sum = 0
    for i in range(0, 5):
        a_sum += (A % (10 ** (i + 1))) // (10 ** i)
        b_sum += (B % (10 ** (i + 1))) // (10 ** i)
    ans = min(ans, a_sum + b_sum)

print(ans)


Measured memory_bytes: 3060
#include <cstdlib>
#include <iostream>
#include <string>
#include <vector>
typedef long long LL;

struct SegmentTree {
 public:
  SegmentTree(int n) {
    num_ = 1;
    while (num_ < n) num_ *= 2;
    data_.assign(2*num_-1, 0);
  }

  void Update(int i,  LL v) {
    i += num_ - 1;
    data_[i] = v;
    while (i > 0) {
      i = (i-1)/2;
      data_[i] = std::max(data_[2*i+1],  data_[2*i+2]);
    }
  }

  LL Query() { return data_[0]; }
  LL Query(int a, int b) { return Query(a, b, 0, 0, num_); }
  LL Query(int a, int b, int i,  int l,  int r) {
    if (r <= a || b <= l) return 0;
    if (a <= l && r <= b) return data_[i];

    LL left = Query(a, b, 2*i+1, l, (l+r)/2);
    LL right = Query(a, b, 2*i+2, (l+r)/2, r);
    return std::max(left, right);
  }

 private:
  std::vector<LL> data_;
  int num_;
};

int main() {
  int N; std::cin >> N;
  std::vector<int> h(N), a(N);
  for (int i = 0; i < N; ++i) std::cin >> h[i];
  for (int i = 0; i < N; ++i) std::cin >> a[i];

  SegmentTree tree(N+1);

  for (int i = 0; i < N; ++i) {
    LL max_value = tree.Query(0, h[i]);
    tree.Update(h[i], a[i] + max_value);
  }

  std::cout << tree.Query() << std::endl;
}


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

using ll = long long;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = (n); i > 0; i--)
#define all(n) n.begin(), n.end()
#define print(n) cout << n << endl

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    
    string s;
    cin >> s;
    if(s[0]==s[1] && s[1]==s[2]) print("No");
    else print("Yes");
    return 0;
}

Measured memory_bytes: 256
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long N = sc.nextLong();
		String[] S = new String[(int) N];
		for (int i = 0; i < N; i++) {
			S[i] = sc.next();
		}

		Map<String, Long> m = new HashMap<String, Long>();
		m.put("AC", 0L);
		m.put("WA", 0L);
		m.put("TLE", 0L);
		m.put("RE", 0L);
		for (int i = 0; i < S.length; i++) {
			m.put(S[i], m.get(S[i]) + 1);
		}
		System.out.printf("AC x %d%n", m.get("AC"));
		System.out.printf("WA x %d%n", m.get("WA"));
		System.out.printf("TLE x %d%n", m.get("TLE"));
		System.out.printf("RE x %d%n", m.get("RE"));
	}
}


Measured memory_bytes: 63312
#include <bits/stdc++.h>
using namespace std;
 
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &vec){ os << "["; for (auto v : vec) os << v << ", "; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const deque<T> &vec){ os << "deq["; for (auto v : vec) os << v << ", "; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const set<T> &vec){ os << "{"; for (auto v : vec) os << v << ", "; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_set<T> &vec){ os << "{"; for (auto v : vec) os << v << ", "; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ", "; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ", "; os << "}"; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa){ os << "(" << pa.first << ", " << pa.second << ")"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << ": " << v.second << ", "; os << "}"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const unordered_map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << ": " << v.second << ", "; os << "}"; return os; }
template<typename T> void ndarray(vector<T> &vec, int len) { vec.resize(len); }
template<typename T, typename... Args> void ndarray(vector<T> &vec, int len, Args... args) { vec.resize(len); for (auto &v : vec) ndarray(v, args...); }
template<typename T> bool chmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T> bool chmin(T &m, const T q) { if (q < m) {m = q; return true;} else return false; }
template<typename T1, typename T2> pair<T1, T2> operator+(const pair<T1, T2> &l, const pair<T1, T2> &r) { return make_pair(l.first + r.first, l.second + r.second); }
template<typename T1, typename T2> pair<T1, T2> operator-(const pair<T1, T2> &l, const pair<T1, T2> &r) { return make_pair(l.first - r.first, l.second - r.second); }
#define f first
#define s second
 
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int len;
    cin >> len;
    set<int> seen;
    int dup = 0;
    for(int i = 0; i < len; i++) {
        int a;
        cin >> a;
        if(seen.count(a)) {
            dup++;
        } else {
            seen.insert(a);
        }
    }
    if(dup % 2 == 1) {
        dup++;
    }
    cout << len - dup;
}

Measured memory_bytes: 8272
M, K = map(int, input().split())

answer = []
if K == 0:
  for i in range(2 ** M):
    answer.append(i)
    answer.append(i)
  print(*answer)
  exit()

if K >= 2 ** M:
  print(-1)
  exit()
  
tmp = 0
for i in range(2 ** M):
  if i != K:
    tmp ^= i
if tmp != K:
  print(-1)
else:
  tmp_arr = []
  for i in range(1, 2 ** M):
    if i != K:
      tmp_arr.append(i)
  answer = tmp_arr + [K] + tmp_arr[::-1] + [0, K, 0]
  print(*answer)

Measured memory_bytes: 69616
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<iostream>
#define ll long long
using namespace std;
const int inf=0x3f3f3f3f;
inline int read()
{
	int x=0,t=1;char ch=getchar();
	while(ch>'9'||ch<'0'){if(ch=='-')t=-1;ch=getchar();}
	while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
	return x*t;
}
int A,B;
int main()
{
	cin>>A>>B;
	if(A>=1&&A<=9&&B>=1&&B<=9) cout<<A*B<<endl;
	else puts("-1");
	return 0;
}


Measured memory_bytes: 256
from itertools import accumulate
from collections import defaultdict, deque
def resolve():
    N, K = map(int, input().split())
    A = list(map(int, input().split()))
    A = accumulate([a % K for a in A])
    A = [0] + list(A)

    # 区間 [i,j] の和(累積和): dj+1−di
    # 区間 [i,j] の要素の数(0_indの為 +1): j−i+1
    # 上記を一般化:  dr−dl=r−l となるものの個数を求める
    # r−l<K  の時、mod K において式変形が成り立つ, dr−r=dl−l
    # rを固定し辞書で管理すれば、dl−lと同じ値なので個数を求められる。

    cnt = defaultdict(int)
    q = deque()
    ans = 0
    for r in range(N + 1):
        t = (A[r] - r) % K
        ans += cnt[t]
        cnt[t] += 1

        q.append(t)
        if len(q) == K:
            left = q.popleft()
            cnt[left] -= 1

    print(ans)


if __name__ == "__main__":
    resolve()


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

int main(){
    ll a,b,x;
    cin>>a>>b>>x;
    if(a==0)cout<<b/x+1<<endl;
    else cout<<b/x-(a-1)/x<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
#define ll long long
 
const int N = (int)1005;
 
ll a[N], t[N];
 
main () {
  int n; scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%lld %lld", &t[i], &a[i]);
  }
  ll s1 = t[1];
  ll s2 = a[1];
  for (int i = 2; i <= n; i++) {
    if (t[i] < s1 || a[i] < s2) {
      ll mult = (s1 - 1) / t[i] + 1;
      ll mult1 = (s2 - 1) / a[i] + 1;
      mult = max(mult, mult1);
      t[i] *= mult;
      a[i] *= mult;
//      cout << t[i] << ' ' << a[i] << endl;
      s1 = t[i];
      s2 = a[i];
    } else {
      s1 = t[i];
      s2 = a[i];
    }
  }
  cout << s1 + s2;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
#define yn {puts("Yes");}else{puts("No");}
#define MAX_N 200005

int main() {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    rep(i,10000){
        if(i % 2 == 0){
            c -= b;
            if(c <= 0){
                cout << "Yes" << endl;
                return 0;
            }
        }else{
            a -= d;
            if(a <= 0){
                cout << "No" << endl;
                return 0;
            }
        }
    }
    return 0;
}




Measured memory_bytes: 3644
import java.util.*;

 class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] A = new int[N];
        for(int i=0; i<N; i++) {
            A[i] = sc.nextInt();	
        }
       
        int[] ans = new int[N];
    	ans[0]=0;
    	for(int i=0; i<N; i++) {
    		ans[0]=(int) (ans[0]+A[i]*Math.pow(-1,i));
    	}
        System.out.print(ans[0]);
    	
        for(int i=1; i<N; i++) {
        	ans[i] = 2*A[i-1] - ans[i-1];
            System.out.print(" ");
            System.out.print(ans[i]);
        }
        
    }
}

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

#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define LL long long
#define pii pair <int,int>
#define fi first
#define se second
#define pb push_back
#define mpr make_pair

using namespace std;

const LL MOD=1e9+7;

int num[70],x,len;
string s,t;

string solve(int lb,int ub)
{
	string ret="";
	if(lb==ub)
	{
		rep(i,num[lb]) ret.pb(s[lb]);
		return ret;
	}
	string a=solve(lb,(lb+ub)/2),b=solve((lb+ub)/2+1,ub);
	int curx=0,cury=0;
	while(curx<a.size()&&cury<b.size())
	{
		t="";
		rep(i,curx+1) t.pb(a[i]);
		for(int i=cury;i<b.size();i++) t.pb(b[i]);
		cout<<"? "<<t<<endl;
		cout.flush();
		cin>>x;
		if(x==len-t.size()) ret.pb(a[curx++]);
		else ret.pb(b[cury++]);
	}
	while(curx<a.size()) ret.pb(a[curx++]);
	while(cury<b.size()) ret.pb(b[cury++]);
	return ret;
}

int main()
{
	rep(i,26) s.pb(i+'A');
	rep(i,26) s.pb(i+'a');
	rep(i,10) s.pb(i+'0');
	rep(i,62)
	{
		t="";
		rep(j,128) t.pb(s[i]);
		cout<<"? "<<t<<endl;
		cout.flush();
		cin>>x;
		num[i]=128-x;
		len+=num[i];
	}
	string ans=solve(0,61);
	cout<<"! "<<ans<<endl;
	cout.flush();
	return 0;
}

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


#define N 3
#define true 1
#define false 0


int x[4]={0,-1,0,1};
int y[4]={1,0,-1,0};
int l;
int w[N][N];


void swap(int *,int *);
int abc();
int dfs(int,int,int,int);
void Solved(int,int);

int main()
{
  int i,j,ax,ay;
   
   for(i=0;i<N;i++){
     for(j=0;j<N;j++){
       scanf("%d",&w[i][j]);
        if(w[i][j]==0){
	  ay=i;
	    ax=j;
	}
        }
   }
     
   Solved(ay,ax);
     
     return 0;
}


void swap(int *s,int *t)
{
  int tmp=*s;
  
  *s=*t;
  *t=tmp;
  
  return ;
}


int abc()
{
  int i,j,s=0,r;
  
  for(i=0;i<N;i++){
    for(j=0;j<N;j++){
    if(w[i][j]==0)continue;
    r=w[i][j]-1;
    
    s+=abs(r/N-i)+abs(r%N-j);
    
    }
  }
  
  return s;
}


int dfs(int d,int p,int ay,int ax)
{
  int i,m=abc();
  
  if(m==0)return true;
  
  if(d+m>l)return false;
  
  for(i=0;i<4;i++){
    if(abs(i-p)==2)continue;
    
    int tx=ax+x[i],ty=ay+y[i];
    
    if(tx<0||ty<0||tx>=N||ty>=N)continue;
    
    swap(&w[ty][tx],&w[ay][ax]);
    
    if(dfs(d+1,i,ty,tx))return true;
    
    swap(&w[ty][tx],&w[ay][ax]);
  }
  
  return false;
}


void Solved(int ay,int ax)
{
  for(l=0;;l++){
    if(dfs(0,99,ay,ax)){
      printf("%d\n",l);
      return ;
    }
  }
}



Measured memory_bytes: 2112
#include <cstdio>
#include <iostream>
#include <string>

using namespace std;

string makeString(char c, int num)
{
	string ret = "";
	for (int i = 0; i < num; i++)
	{
		ret += c;
	}

	return ret;
}

int main()
{
	int sx, sy, tx, ty;
	cin >> sx >> sy >> tx >> ty;

	int w = tx - sx;
	int h = ty - sy;

	string ans = "";
	ans += makeString('R', w);
	ans += makeString('U', h);
	ans += makeString('L', w);
	ans += makeString('D', h);

	ans += makeString('D', 1);
	ans += makeString('R', w + 1);
	ans += makeString('U', h + 1);
	ans += makeString('L', 1);
	ans += makeString('U', 1);
	ans += makeString('L', w + 1);
	ans += makeString('D', h + 1);
	ans += makeString('R', 1);

	cout << ans << "\n";
}

Measured memory_bytes: 256
def print_A():
    for i, n in enumerate(A):
        if i == N - 1:
            print(A[i])
        else:
            print(A[i], end=' ')

N = int(input())
A = [int(n) for n in input().split()]
cnt = 0
flg = 0
for i in range(N):
    min_j = i
    for j in range(i, N):
        if A[j] < A[min_j]:
            min_j = j
            flg = 1
    if flg == 1:
        cnt += 1
        flg = 0
        w = A[i]; A[i] = A[min_j]; A[min_j] = w
print_A()
print(cnt)



Measured memory_bytes: 5608
def main():
    from collections import deque
    S = input()
    Q = int(input())
    rev = 0  # 1のとき反転
    que = deque((s for s in S))
    for _ in range(Q):
        Cmd = [i for i in input().split()]
        if Cmd[0] == "1":
            rev ^= 1
        else:
            if rev == 0:
                if Cmd[1] == "1":
                    # 先頭に追加
                    que.appendleft(Cmd[2])
                else:
                    # 末尾に追加
                    que.append(Cmd[2])
            else:
                if Cmd[1] == "1":
                    # 先頭に追加
                    que.append(Cmd[2])
                else:
                    # 末尾に追加
                    que.appendleft(Cmd[2])
    ans = "".join(que)
    if rev == 1:
        ans = ans[::-1]
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 103160
import sys
if sys.version_info.major >= 3 and sys.version_info.minor >= 5:
    from math import gcd
else:
    from fractions import gcd


def calc_anti(N, C, D):
    lcm = C * D // gcd(C, D)
    div = N // C + N // D - N // lcm
    return N - div


A, B, C, D = map(int, input().split())
print(calc_anti(B, C, D) - calc_anti(A-1, C, D))


Measured memory_bytes: 5052
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}
fn main() {
    input! {
        x: usize,
        y: usize,
        z: usize,
    }
    let mut sum = 0;
    let mut time = 0;
    while sum <= x - z {
        sum+=y+z;
        time+=1;
    }
    println!("{}", time -1);
}

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

int selectionSort(vector<int> &A, int N)
{
    int i, j, minj;
    int change_count = 0;
    for (i = 0; i < N; i++)
    {
        minj = i;
        for (j = i; j < N; j++)
        {
            if (A[j] < A[minj])
            {
                minj = j;
            }
        }
        if (i != minj)
        {
            swap(A[i], A[minj]);
            change_count++;
        }
    }
    return change_count;
}

int main()
{
    int N, i, change;
    cin >> N;
    vector<int> A(N);
    for (i = 0; i < N; i++)
    {
        cin >> A[i];
    }
    change = selectionSort(A, N);
    cout << A[0];
    for (i = 1; i < N; i++)
    {
        cout << " " << A[i];
    }
    cout << "\n"
         << change << endl;
}


Measured memory_bytes: 3092
#include <iostream>
using namespace std;
int main(){
  int n, b;
  cin >> n >> b;
  for(int i = 0;i < n-1;i++){
    if(b-n+1+i >= -1000000 && b-n+1 <= 1000000)
      cout << b-n+1+i << ' ';
  }
  cout << b << ' ';
  for(int i = 0;i < n-1;i++){
    if(b+i+1 >= -1000000 && b+i+1 <= 1000000)
      cout << b+i+1 << ' ';
  }
  return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    int t;
    cin >> t;
    int  AC =0;
    int WA=0;
    int TLE=0;
    int RE =0;

    for(int i=0; i<t ;i++){
        string n;
        cin >> n;
        if (n=="AC"){
            AC+=1;

        }else if(n=="WA"){
            WA+=1;

        }else if(n=="TLE"){
            TLE+=1;

        }else if(n=="RE"){
            RE+=1;

        }
    }
    cout << "AC " << "x " << AC << "\n";
    cout << "WA " << "x " << WA <<"\n";
    cout << "TLE " << "x "<< TLE << "\n";
    cout << "RE " << "x " << RE << "\n";

    return 0;
}

Measured memory_bytes: 3608
#include<iostream>
#include<vector>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;
const int MAXN=100000;
int n;
vector<int> G[MAXN+10];
int dep[MAXN+10],sz[MAXN+10];
int f[MAXN+10];
void dfs(const int x,const int fa)
{
	sz[x]=1;dep[x]=dep[fa]+1;f[x]=fa;
	for(unsigned int i=0;i!=G[x].size();++i)
	{
		if(G[x][i]==fa)continue;
		dfs(G[x][i],x);
		sz[x]+=sz[G[x][i]];
	}
}
int main()
{
	scanf("%d",&n);
	int u,v;
	for(int i=1;i<n;++i)
	{
		scanf("%d%d",&u,&v);
		G[u].push_back(v);
		G[v].push_back(u);
	}
	dfs(1,0);
	int cnt=(dep[n]-2)>>1,now=n;
	while(cnt--)now=f[now];
	if(sz[now]>=n-sz[now])puts("Snuke");
	else puts("Fennec");
	return 0;
}

Measured memory_bytes: 14720
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <bitset>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <queue>

#define mp make_pair
#define pb push_back


typedef long long ll;
typedef long double ld;

using namespace std;
const int MX = 510;

int h, w;
char s[MX][MX];
char a[MX][MX];
char b[MX][MX];

int main() {
	scanf("%d%d", &h, &w);
	for (int i = 0; i < h; ++i)
		scanf(" %s", s[i]);
	for (int i = 0; i < h; ++i) {
		a[i][0] = '#';
		a[i][w - 1] = '.';
		if (i % 2 == 0) {
			for (int j = 1; j < w - 1; ++j)
				a[i][j] = '#';
		}
		else {
			for (int j = 1; j < w - 1; ++j)
				if (s[i][j] == '#')
					a[i][j] = '#';
				else
					a[i][j] = '.';
		}
	}
	for (int i = 0; i < h; ++i) {
		b[i][w - 1] = '#';
		b[i][0] = '.';
		if (i % 2 == 1) {
			for (int j = 1; j < w - 1; ++j)
				b[i][j] = '#';
		}
		else {
			for (int j = 1; j < w - 1; ++j)
				if (s[i][j] == '#')
					b[i][j] = '#';
				else
					b[i][j] = '.';
		}
	}
	for (int i = 0; i < h; ++i)
		printf("%s\n", a[i]);
	printf("\n");
	for (int i = 0; i < h; ++i)
		printf("%s\n", b[i]);
	return 0;
}




Measured memory_bytes: 1536
#!/usr/bin/env python3
import sys
input = sys.stdin.readline

a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k = int(input())
print(a[k-1])

Measured memory_bytes: 3060
#include  <stdio.h>

int main(void)
{
   int a,b;
    scanf("%d %d",&a,&b);
    
    int d = a ;
    a = 0;
    
    for(int i=1;i<d;i++)
    {
       a = a + i;
    }
    
    
    int c = b ;
    b = 0;
    
    for(int i=1;i<c;i++)
    {
       b = b + i;
    }
    
    printf("%d",a+b);
    
    
    return 0;
    }

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

int main() {
    string result = "";
    int n, l;
    cin >> n >> l;
    vector<string> vec(n);
    
    for(int i = 0; i < n; i++) {
        cin >> vec.at(i);
    }
    sort(vec.begin(),vec.end());
    
    for(int i = 0; i < n; i++) {
        result += vec.at(i);
    }
    cout << result << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string.h>
#include <algorithm>
#include <cstring>
#include <queue>
#include <assert.h>
#include <cmath>
#include <deque>
#include <set>
#include <unordered_map>
#include <complex>
#include <fstream>
#include <map>
#include <numeric>
#include <functional>
using namespace std;
using ll = long long;
using ld = long double;
const int mxn = 2e5+10;
int a[mxn];

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int n,k; cin>>n>>k;
	for(int i=1; i<=n; i++) cin>>a[i];

	for(int i=k+1; i<=n; i++) {
		if(a[i]>a[i-k]) cout << "Yes\n";
		else cout <<"No\n";
	}

	return 0;
}

Measured memory_bytes: 4416
/*/-Saya-Javelin-/*/
#include <bits/stdc++.h>
//#pragma GCC optimize("O2")
//#pragma GCC optimize("O3")
#define Fo freopen ("in.in", "r", stdin); freopen ("out.out", "w", stdout)
#define Fc fclose (stdin); fclose (stdout)
#define iln inline
#define rgt register
#define Max(a,b) (a)>(b):(a):(b)
#define Min(a,b) (a)<(b):(a):(b)
#define Abs(a) (a)>0?(a):-(a)
#define Swap(a,b) (a)^=(b)^=(a)^=(b)
//#define int long long
#define ll long long
#define ld long double
using namespace std;

const int D=1000000;
char AAA[D];
char *SSR,*UR;
inline char gc(){
	if (SSR==UR) UR=(SSR=AAA)+fread(AAA,1,D,stdin);
	return *SSR++;
}

//#define gc rrr=gc()
#define gc rrr=getchar()
iln void read (int &ur) {
	int ssr=1; char rrr; ur=0;
	while (gc, rrr>'9' || rrr<'0')
	if (rrr=='-') ssr=-1;
	while (rrr>='0' && rrr<='9')
	ur=ur*10+rrr-'0', gc;
	ur=ur*ssr;
	return;
}
#undef gc

iln void write (int ur) {
	if (ur<0) putchar ('-'), ur=-ur;
	if (ur>=10) write (ur/10);
	putchar (ur%10+'0');
	return;
}

iln void wtn (int ur) {
	write (ur);
	putchar ('\n');
	return;
}

iln void wts (int ur) {
	write (ur);
	putchar (' ');
	return;
}

bitset <2002*2002> a;
int n, x[2002], sum=0;

int main () {
	read (n);
	for (rgt int i=1; i<=n; ++i) {
		read (x[i]);
		sum+=x[i];
	}
	a[0]=1;
	for (rgt int i=n; i>=1; --i) {
		a|=a<<x[i];
	}
	for (rgt int i=(sum+1)/2; i<=sum; ++i) {
		if (a.test(i)) {
			wtn (i);
			return 0;
		}
	}
}

Measured memory_bytes: 1664
#include <algorithm>
#include <cassert>
#include <climits>
#include <cstdio>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>

using namespace std;
using ll = long long;

const int INF = 1e9;
const long long LINF = 1e18;
const double PI=3.14159265358979323846;

typedef priority_queue<int, vector<int>, greater<int>> priority_queue_asc;

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

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

    int ans = 0;
    for (size_t i = 0; i < N; i++) {
        if (p[i] == i + 1) {
            i++;
            ans++;
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3192
#include <cstdio>

int main()
{
  int n, t;
  scanf("%d %d", &n, &t);
  int ans = 1e9;
  for (int i = 0; i < n; ++i)
  {
    int a, b;
    scanf("%d %d", &a, &b);
    if (b <= t && ans > a) ans = a;
  }
  if (ans == 1e9)
  {
    puts("TLE");
  }
  else
  {
    printf("%d\n", ans);
  }
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using longlong=long long;

int main(){
    std::cin.tie(nullptr);std::cin.sync_with_stdio(false);
    int n;std::cin>>n;
    std::vector<int>a(n);
    for(int i=0;i<n;i++){
        std::cin>>a.at(i);
    }
    int ans=1000000;
    for(int i=0;i<=100;i++){
        int now=0;
        for(int j=0;j<n;j++){
            now+=(a.at(j)-i)*(a.at(j)-i);
        }
        if(now<ans)ans=now;
    }
    std::cout<<ans<<std::endl;
}

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

int main(){
  int A,B,C;
  cin >> A >> B >> C;
  vector<int> vec={A,B,C};
  
  sort(vec.begin(),vec.end());
  
  if(vec.at(0)==5&&vec.at(1)==5&&vec.at(2)==7){
    cout << "YES" << endl;
  }
  else{
    cout << "NO" << endl;
  }
}
    


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <cmath>
#include <climits>
#include <math.h>
#include <bitset>

#define P pair
#define X first
#define Y second
#define VSORT(v) sort(v.begin(), v.end())
#define VREV(v) reverse(v.begin(), v.end())
#define VMAX_P(v) max_element(v.begin(), v.end())
#define VMIN_P(v) min_element(v.begin(), v.end())
#define VMAX_IDX(v) distance(v.begin(), VMAX_P(v))
#define VMIN_IDX(v) distance(v.begin(), VMIN_P(v))
#define VCOPY(src, dst) copy(src.begin(), src.end(), back_inserter(dst))
#define SUPPER(src, dst) transform(src.begin(), src.end(), dst.begin(), toupper);
#define SLOWER(src, dst) transform(src.begin(), src.end(), dst.begin(), tolower);

using namespace std;
using ll = long long;

void displayVec(vector<int> v)
{
    for (int i = 0; i < v.size(); i++)
    {
        cout << v[i] << endl;
    }
    cout << endl;
}

int binarySearch(vector<int> v, int target)
{
    int left = -1;
    int right = v.size();

    while (right - left > 1)
    {
        int mid = left + (right - left) / 2;

        if (v[mid] >= target)
        {
            right = mid;
        }
        else
        {
            left = mid;
        }
    }

    if (right < v.size() && v[right] == target)
    {
        return right;
    }
    return -1;
}

int countDays(int year, int month, int day)
{
    int days[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
    int cnt = day;

    if (month == 1)
    {
        return cnt;
    }

    for (int i = 0; i < month - 1; i++)
    {
        cnt += days[i];
    }

    if (month >= 3 && ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0))
    {
        cnt++;
    }

    return cnt;
}

int main(int argc, const char *argv[])
{
    string s;
    cin >> s;

    bool flag = true;
    for (int i = 0; i < s.length(); i++)
    {
        if (i % 2 == 0)
        {
            if (!(s[i] == 'R' || s[i] == 'U' || s[i] == 'D'))
            {
                flag = false;
                break;
            }
        }
        else
        {
            if (!(s[i] == 'L' || s[i] == 'U' || s[i] == 'D'))
            {
                flag = false;
                break;
            }
        }
    }
    if (flag)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std ;
typedef long long ll ;
const ll N = 60 ;
ll mod = 1e9+7 ;
ll n, k, ans;
struct mat{
	ll a[N][N] ;
	mat(){memset(a, 0, sizeof(a)) ;}
	ll* operator[](int i) {return a[i] ;}
	mat operator*(mat now){
		mat ans ;
		for(int i = 1 ; i <= n ; i ++)
			for(int k = 1 ; k <= n ; k ++)
				for(int j = 1 ; j <= n ; j ++)
					ans[i][j] = (ans[i][j]+(now[i][k]*a[k][j]))%mod;
		return ans ;
	}
};
mat A;
mat poww(mat a, long long b){
	mat c ; if(b == 0) return c ;
	for(int i = 1 ; i <= n ; i ++) c[i][i] = 1 ;
	for(; b ; b = b >> 1){
		if(b & 1) c = c * a ;
		a = a * a ;
	}
	return c ;
}
int main ()
{
	scanf("%lld%lld", &n, &k) ;
	for(int i = 1 ; i <= n ; i ++)
		for(int j = 1 ; j <= n ; j ++) scanf("%lld", &A[i][j]) ;
	A = poww(A ,k) ;
	for(int i = 1 ; i <= n ; i ++)
		for(int j = 1 ; j <= n ; j ++) ans = (ans + A[i][j]) % mod ;
	cout << ans ;
}


Measured memory_bytes: 384
S = input()
ans = 0
for i in range(2**(len(S)-1)):
    tmp = int(S[0])
    for j in range(1, len(S)):
        if i & 1 == 1:
            ans += tmp
            tmp = int(S[j])
        else:
            tmp = tmp*10+int(S[j])
        i = i >> 1
    ans += tmp
print(ans)




Measured memory_bytes: 8844
#include "bits/stdc++.h"
using namespace std;
#ifdef ONLINE_JUDGE
#define trace(...)
#endif

using LL = long long;

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

	LL a, b, x; cin >> a >> b >> x;
	LL vol = a * a * b;

	double ans = 0;
	if (vol <= 2 * x) {
		double num = 2 * (vol - x);
		double den = a * a * a;
		ans = atan(num / den);
	} else {
		double num = a * b * b;
		double den = 2 * x;
		ans = atan(num / den);
	}
	ans *= 180 / acos(-1);

	cout << setprecision(10) << fixed << ans << endl;
	
	return 0;
}


Measured memory_bytes: 512
#include <stdio.h>

int main(void)
{
	int notice;
	int room[4][3][10][2];
	int inputadder[4];
	
	for(int building = 0; building < 4; building++){	
		for(int floor = 0; floor < 3; floor++){
			for(int bilik = 0; bilik < 10; bilik++){
				room[building][floor][bilik][1] = 0;
				room[building][floor][bilik][0] = 0;
			}
		}
	}
	
	
	scanf("%d", &notice);
	
	for(int i = 0; i < notice; i++){
		scanf("%d %d %d %d", &inputadder[0], &inputadder[1], &inputadder[2], &inputadder[3]);
		int a = inputadder[0] - 1;
		int b = inputadder[1] - 1;
		int c = inputadder[2] - 1;
		int d = inputadder[3];
	//	printf("\%d %d %d %d\n", inputadder[0], inputadder[1], inputadder[2], inputadder[3]);
		if(room[a][b][c][1] == 0){
			room[a][b][c][0] = d;
			room[a][b][c][1] = 1;
		
		}
		else if(room[a][b][c][1] == 1){
			room[a][b][c][0] += d;
		}
		
	}
	for(int building = 0; building < 4; building++){	
		for(int floor = 0; floor < 3; floor++){
			for(int bilik = 0; bilik < 10; bilik++){
				if(room[building][floor][bilik][1] == 1){
					printf(" %d", room[building][floor][bilik][0]);
				}
				else{
					printf(" 0");
				}
			}
			printf("\n");
		}
	
		if(building != 3) printf("####################\n");
	}
	return 0;
}


Measured memory_bytes: 2112
/**-------------------------
|--------From A.R.A--------|
-------------------------**/
#include <bits/stdc++.h>

#define ll long long int
#define ull unsigned long long int
#define FOR(i,n) for(ll i=0;i<n;i++)
#define input (a,i,n)for(ll i=0;i<n;i++){      cin>>a[i];}
#define output(a,i,n)for(ll i=0;i<n;i++){cout<<a[i]<<" ";}
#define pb push_back
#define sz(c) (c).size()
#define vi vector <int>
#define vs vector <string>
#define vc vector <char>
#define vl vector <ll>
#define sall(c) sort((c).begin(),(c).end())
#define rsall(c) sort((c).rbegin(),(c).rend())
#define max3(a,b,c) max(max(a,b),c)
#define min3(a,b,c) min(min(a,b),c)
int64_t TN=1;
using namespace std;
void  solution(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int64_t x,y=100,k=0;
    cin>>x;
    while(x>y){
        y=y+(y/100);
        k++;
    }
    cout<<k;

}
int main()
{

    ios_base::sync_with_stdio(0);
    cin.tie(0);
    //cin>>TN;
    while(TN--){
        solution();
    }
    return 0;
}


Measured memory_bytes: 3652
#include <stdio.h>
#define N 10000
#define Q 500

int linearSearch(void);

int S[N], T[Q], n, q;

int main()
{
  int C=0, i;

  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&S[i]);
  }
  scanf("%d",&q);
  for(i=0;i<q;i++){
    scanf("%d",&T[i]);
  }

  C=linearSearch();
  printf("%d\n",C);
  
  return 0;
}
  

int linearSearch()
{
  int i, j, C=0;

  for(i=0;i<q;i++){
    for(j=0;j<n;j++){
      if(T[i]==S[j]){
      C++;
      break;
      }
    }
  }
  return C;
}
    

  



Measured memory_bytes: 2088
//----------BHAVIK DIWANI(PICT_COMP)---------------
#include<bits/stdc++.h>
#define test ll t; cin>>t; while(t--)
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define mod 1000000007
#define ll long long
#define int long long
#define ull unsigned long long
#define MAX 1000005
#define pb push_back
#define mkp make_pair
#define vi vector<int>
#define pii pair<int,int>
#define endl '\n'
#define vs vector<string>
#define mii map<int,int>
#define msi map<string,int>
#define vpii vector< pair<int, int > >
#define vpsi vector< pair< string ,int > >
#define forci(p,q) for(int i=p;i<q;i++)
ll gcd(ll a,ll b){ if(b==0) return a;    return gcd(b,a%b);}
ll lcm(ll a,ll b) { return (a/gcd(a,b)*b);}
ull power(ull a, ull b) {a %= mod;  ull res = 1;  while (b > 0) { if (b & 1) res = res * a % mod;  a = a * a % mod;  b >>= 1; }  return res%mod; }
ll modmul(ll x, ll y){return (x*y)%mod;}
ll modadd(ll x, ll y){return (x+y)%mod;}
ll modsub(ll x, ll y){return (x-y+mod)%mod;}
ll fact[1000007]={0};
void facto() {fact[0]=1;fact[1]=1;for(int i=2;i<1000007;i++)fact[i]=(fact[i-1]*i)%mod;}
ll ncr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[r],mod-2)))%mod; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
ll npr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
inline long long toint(const std::string &s) {std::stringstream ss; ss << s; long long x; ss >> x; return x;}
inline std::string tostring(long long number) {std::stringstream ss; ss << number; return ss.str();}
inline std::string tobin(long long x) {return std::bitset<63>(x).to_string();}
/*bool prime[MAX];
ull sieve(){memset(prime,true,sizeof(prime));for(ull p=2;p*p<MAX;p++){if(prime[p]==true){for(ull i=2*p;i<MAX;i+=p){prime[i]=false;}}}prime[0]=0;prime[1]=0;
}*/
/*int inv[1000001]={0};
void findinverse(){inv[1] = 1;for(int i = 2; i <=1e6 ; ++i)	inv[i] = (mod - (mod/i) * inv[mod%i] % mod) % mod;}
*/
using namespace std;
int solve()
{
	int n;
	cin>>n;
	int a[n],b[n];
	forci(0,n){
		cin>>a[i];
		b[i]=a[i];
	}
	int cnt=0;
	sort(b,b+n);
	for(int i=0;i<n;i++){
		if(a[i]!=b[i])
			cnt++;
	}
	if(cnt<=2){
		cout<<"YES";
	}
	else
		cout<<"NO";
	return 0;
}
signed main()
{
	fastio;
//	test
		solve();
}







Measured memory_bytes: 3636
H,W = map(int,input().split())
A = [input() for i in range(H)]
B = []
for row in A:
    if all(c=='.' for c in row): continue
    B.append(row)

ans = ['' for _ in range(len(B))]
for col in zip(*B):
    if all(c=='.' for c in col): continue
    for i,c in enumerate(col):
        ans[i] += c

for row in ans:
    print(row)

Measured memory_bytes: 9212
x, n = map(int, input().split())
p = set(map(int, input().split()))
ans_can = set(range(-200, 200))
ans_can = sorted(list(ans_can - p))

ans = 10000000
for i in ans_can:
    if abs(x - i) < abs(x - ans):
        ans = i

print(ans)


Measured memory_bytes: 9224