akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define pi acos(-1)
#define mx 1000000000
#define mod 1000000009
#define pii pair<int,int>
#define psi pair<string,int>
#define vi vector<int>
typedef long long ll;
using namespace std;
void fastio()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
}

int main()
{
#ifndef ONLINE_JUDGE
    freopen("inputf.txt", "r", stdin);
    freopen("outputf.txt", "w", stdout);
#endif
    fastio();
    int i,j,t,n,m,r;
    //cin>>t;
    //while(t--){
     int a[3];
     for(i=0;i<3;i++)cin>>a[i];
     sort(a,a+3); 
     if(a[0]==5 && a[1]==5 && a[2]==7)cout<<"YES"<<endl;
     else cout<<"NO"<<endl;
    //}
 return 0;
}



Measured memory_bytes: 3640
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;

#define rp(i,n) for(int i=0;i<n;i++)
#define rep(i,m,n) for(int i=m;i<=n;i++)
#define llrp(i,n) for(long long i=0;i<n;i++)
#define llrep(i,m,n) for(long long i=m;i<=n;i++)
#define sort(a) sort(a.begin(),a.end())
#define reverse(a) reverse(a.begin(),a.end())
#define pb push_back
#define elif else if
#define vcin(a); rp(i,a.size()){cin>>a[i];}
#define vcout(a); rp(i,a.size()){cout<<a[i]<<endl;}
#define allchar(c) for(char c='a';c<='z';c++)

typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<string> vs;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef long long ll;
typedef string S;
typedef pair<int,int> P;

const int mod=1e9+7;

ll modpow(ll a,ll b,ll p){
    if(b==0){
        return 1;
    }elif(b%2==0){
        return modpow((a*a)%p,b/2,p);
    }else{
        return (a*modpow(a,b-1,p))%p;
    }
}
ll gcd(ll a,ll b){
  if(b==0){
    return a;
  }else{
    return gcd(b,a%b);
  }
}

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,m;
    cin >> n >> m;
    ll l=lcm(n,m);
    S s,t;
    cin >> s >> t;
	bool flag=true;
  	llrp(i,n){
      if(i*m%n==0){
        if(s.at(i)!=t.at((i*m)/n))	flag=false;
      }
    }
    llrp(i,m){
      if(i*n%m==0){
        if(t.at(i)!=s.at((i*n)/m))	flag=false;
      }
    }
	if(flag){
      cout << l << endl;
	}else{
      cout << -1 << endl;
    }

    return 0;
}




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

//#pragma GCC optimize("O3,Ofast,no-stack-protector,unroll-loops,fast-math")

//#define int long long
typedef pair <int, int> pii;

int32_t main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	string s;
	cin >> s;
	int n = s.size();
	for (int i = 0; i < n; i++) {
		if (s[i] != s[n - 1 - i]) {
			cout << "No";
			return 0;
		}
	}
	for (int i = 0; i < n / 2; i++) {
		if (s[i] != s[n / 2 - 1 - i]) {
			cout << "No";
			return 0;
		}
	}
	cout << "Yes";
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
using ll = long long;
ll gcd(ll a,ll b){return b==0?a:gcd(b,a%b);}
bool chmin(ll&a,ll b){if(a>b){a=b;return true;}return false;}
bool chmax(ll&a,ll b){if(a<b){a=b;return true;}return false;}
#define debg cout<<"debg"<<endl
signed main(){
  cout<<fixed<<setprecision(10);
  double n,k;
  cin>>n>>k;
  double ans=0.0;
  for(int i=1;i<=n;++i){
    double x=(double)i;
    ll cnt=0;
    while(x<k){x*=2;cnt++;}
    ans+=1/n*pow(0.5,(double)cnt);
  }
  cout<<ans<<endl;

  return 0;
}



Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
def input(): return sys.stdin.readline().rstrip()

def main():
    L=int(input())
    tmp=L
    tmp2=L
    l=[]
    while tmp2!=0:
        c=0
        while tmp!=1:
            tmp//=2
            c+=1
        l.append(c)
        tmp2-=2**c
        tmp=tmp2
    N=l[0]+1
    M=0
    ans=[]
    w=1
    for i in range(l[0]):
        ans.append((i+1,i+2,0))
        ans.append((i+1,i+2,w))
        M+=2
        w*=2
    for x in l[1:]:
        ans.append((x+1,N,w))
        w+=2**x
        M+=1
    print(N,M)
    for z in ans:
        print(*z)
    

if __name__ == '__main__':
    main()


Measured memory_bytes: 38384
// DSL_2_B.cpp
// Range Query - Range Sum Query
// Refs:
// http://judge.u-aizu.ac.jp/onlinejudge/review.jsp?rid=2128527#1
// http://judge.u-aizu.ac.jp/onlinejudge/review.jsp?rid=1824167#1
#include <iostream>
#include <stack>
#include <vector>
using namespace std;
const int INIT = 0;
struct SegmentTreeNode {
    int val;
    int start, end;
    SegmentTreeNode *left, *right;
    SegmentTreeNode() {}
    SegmentTreeNode(int start, int end) :
            start(start), end(end), val(INIT), left(NULL), right(NULL) {}
};

SegmentTreeNode* buildTree(int start, int end) {
    if (start > end) return NULL;
    SegmentTreeNode* head = new SegmentTreeNode(start, end);
    if (start < end) {
        int mid = start + (end - start) / 2;
        head->left = buildTree(start, mid);
        head->right = buildTree(mid + 1, end);
    }
    return head;
}

void add(SegmentTreeNode* node, int i, int x) {
    int lt, rt, mid;
    while (node) {
        lt = node->start;
        rt = node->end;
        mid = lt + (rt - lt) / 2;
        node->val += x;
        if (i <= mid) {
            node = node->left;
        }
        else {
            node = node->right;
        }
    }
}

int getSum(SegmentTreeNode* node, int s, int t) {
    if (!node) return INIT;
    if (node->start == s && node->end == t)
        return node->val;
    int mid = (node->start + node->end) / 2;
    if (t <= mid) {
        return getSum(node->left, s, t);
    }
    else if (s > mid) {
        return getSum(node->right, s, t);
    }
    else {
        return getSum(node->left, s, mid) + getSum(node->right, mid + 1, t);
    }
}

int main()
{
    int n, q;
    cin >> n >> q;
    SegmentTreeNode* st = buildTree(1, n);
    int com, x, y;
    while (q--) {
        cin >> com >> x >> y;
        if (com) {
            cout << getSum(st, x, y) << endl;
        }
        else {
            add(st, x, y);
        }
    }
    return 0;
}

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

double d;

double solve();

int main() {
  cout << setprecision(12);
  cin >> d;
  cout << solve() << endl;
  return 0;
}

double solve() {
  double ans = (int)d + 1.0;
  d *= d;
  d /= 2.0;
  ans = max(ans, (double)2.0 * sqrt(d));
  return ans;
}



Measured memory_bytes: 3280
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <chrono>
#include <stack>
#include <string>
#include <bitset>
#include <unordered_map>
#include <cstdio>
#include <limits>
#include <vector>
#include <climits>
 
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <fstream>
#include <numeric>
#include <sstream>
#include <cassert>
#include <tuple>
#include <iomanip>
#include <random>
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <fstream>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pii;
typedef vector<pair<ll, ll> > vpi;
typedef vector<ll> vi;
typedef vector<bool> vb;
#define pb push_back
#define mk make_pair
#define fi first
#define se second
#define in insert
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const ll inf = 1e9 + 7;

int main(){
  int n,k;
  cin >> n >> k;
  ll dp[100100];
  ll a[n];
  for(int i = 0; i < n; i++){
    cin >> a[i];
  }

  for(int i = 0; i < n+100; i++){
    dp[i] = inf;
  }
  dp[0] = 0;
  for(int i = 0; i < n; i++){
    for(int j = 1; i+j< n && j <= k; j++){
      dp[i+j] = min(dp[i+j],dp[i]+abs(a[i]-a[i+j])); 
    }
  }
  cout << dp[n-1];
  return 0;
}

Measured memory_bytes: 1792
#include<iostream>

using namespace std;

int main(){
  int a,b,c,d,e;
  int total=0;

  cin>>a>>b>>c>>d>>e;

  if(a<0){
    while(a!=0){
      a++;
      total+=c;
    }
  }

  if(a==0)
    total+=d;

  while(a!=b){
    a++;
    total+=e;
  }

  cout<<total<<endl;
}

Measured memory_bytes: 3072
N = int(input())
H = list(map(int,input().split()))

count_list = []
count = 0

for i in range(N-1):
  if H[i] >= H[i+1]:
    count += 1
  else:
    count_list.append(count)
    count = 0
else:
  count_list.append(count)

print(max(count_list))

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

long long labs(long long a){
    return a>0?a:(-a);
}
long long lmax(long long a, long long b){
    return a>b?a:b;
}

int main(){
    int N;
    long long Z,W;
    long long A[2000];

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

    if(N==1) cout << labs(W-A[0]) << endl;
    else cout << lmax(labs(W-A[N-1]),labs(A[N-1]-A[N-2])) << endl;

    return 0;
}

Measured memory_bytes: 256
def OneStrokePath():
    from collections import deque
    import copy
    n, m = map(int, input().split())
    graph = [[] for _ in range(n)]
    ans = 0
    
    for _ in range(m):
        a, b = map(int, input().split())
        graph[a-1].append(b-1)
        graph[b-1].append(a-1)
    q = deque()
    q.append([0, []])
        
    while q:
        x0, route0 = q.pop()
        if x0 in route0:
            continue
        route1 = copy.deepcopy(route0)
        route1.append(x0)
        if len(route1) == n:
            ans += 1
        for i in graph[x0]:
            if i in route1:
                continue
            q.append([i, route1])
    print(ans)  

if __name__ == '__main__':
    OneStrokePath()
    


Measured memory_bytes: 70284
#include <bits/stdc++.h>
#define rep3(i, s, n, a) for (int i = (s); i < (int)(n); i += a)
#define rep2(i, s, n) rep3(i, s, n, 1)
#define rep(i, n) rep2(i, 0, n)

using namespace std;
using ll = long long;
using P = pair<int, int>;

int main(){
    int h, w;
    cin >> h >> w;
    vector<string> s;
    vector<vector<int>> board, dp;
    vector<int> tmp(w, 0);
    rep(i, h){
        board.push_back(tmp);
        dp.push_back(tmp);
        string str;
        cin >> str;
        s.push_back(str);
    }
    
    rep(i, h){
        rep(j, w){
            if(s[i][j]=='.') board[i][j] = 0;
            else    board[i][j] = 1;
        }
    }

    if(board[h-1][w-1]==0) dp[h-1][w-1] = 0;
    else dp[h-1][w-1] = 1;

    for(int i=h-1;i>=0;i--){
        for(int j=w-1;j>=0;j--){
            if(i==h-1){
                if(j==w-1) continue;
                if(board[i][j]==board[i][j+1]){ //most down
                    dp[i][j] = dp[i][j+1];
                }else{
                    if(board[i][j]==0)  dp[i][j] = dp[i][j+1];
                    else dp[i][j] = dp[i][j+1] + 1;
                }
            }else{
                if(j==w-1){ //most right
                    if(board[i][j]==board[i+1][j]){
                        dp[i][j] = dp[i+1][j];
                    }else{
                        if(board[i][j]==0)  dp[i][j] = dp[i+1][j];
                        else dp[i][j] = dp[i+1][j] + 1;
                    }
                }else{
                    int dpplusx, dpplusy;
                    if(board[i][j]-board[i][j+1]==-1){
                        dpplusx = 0;
                    }else{
                        dpplusx = board[i][j]-board[i][j+1];
                    }
                    if(board[i][j]-board[i+1][j]==-1){
                        dpplusy = 0;
                    }else{
                        dpplusy = board[i][j]-board[i+1][j];
                    }
                    int x = dp[i][j+1] + dpplusx;
                    int y = dp[i+1][j] + dpplusy;
                    //cout << x << "  " << y << endl;
                    dp[i][j] = min(x, y);
                }
            }
        }
    }


    cout << dp[0][0] << endl;
    return 0;
}

Measured memory_bytes: 384
class SegTree
  attr_reader :size
  attr_accessor :seg

  def self.create(a=[])
    n = 1
    n *= 2 while n < a.size
    this = new(n)
    a.size.times do |i|
      this.seg[i + n] = a[i]
    end
    (n-1).downto(1) do |i|
      this.seg[i] = this.seg[i*2] & this.seg[i*2+1]
    end
    this
  end

  def initialize(n=2**100_000)
    @size = n
    @seg = Array.new(size*2, 0)
  end

  def [](i)
    i += size
    seg[i]
  end

  def update(i,x)
    i += size
    seg[i] = x
    while i > 1
      i /= 2
      seg[i] = seg[i*2] & seg[i*2+1]
    end
  end

  def query(a,b)
    ans = 0xffff_ffff
    a += size; b += size
    while a < b
      (ans &= seg[a]; a += 1) if a.odd?
      (b -= 1; ans &= seg[b]) if b.odd?
      a /= 2; b /= 2
    end
    ans
  end

  def inspect
    { size: size, seg: seg }.to_s
  end
end

# SegTree.new(N)
# := 要素数Nで初期化、ただしNは2の冪
# SegTree.create(A)
# := 配列Aで初期化
# update(i,x) := Aiをxに更新
# query(a,b) := 半開区間[a,b)での演算結果

S = gets.chomp.chars.map{|c| 1 << c.ord - ?a.ord}
N = S.size
T = SegTree.create(S)

N.times do |i|
  if T.query(0,N-i) != 0
    puts i
    exit
  end

  (N-i-1).times do |j|
    T.update(j, T[j] | S[j+i+1])
  end
end


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

#define rep3(i, s, n, a) for (int i = (s); i < (int)(n); i+=a)
#define rep2(i, s, n) rep3(i, s, n, 1)
#define rep(i, n) rep2(i, 0, n)

int main() {
    int n, p_num=0, q_num=0, cnt=1, pf, qf;
    cin >> n;
    vector<int> p, q;
    vector<int> v;
    rep(i, n){
        cin >> pf;
        p.push_back(pf);
        v.push_back(i+1);
    }
    rep(i, n){
        cin >> qf;
        q.push_back(qf);
    }
    do{
        if(p == v){
            p_num = cnt;
        }
        if(q == v){
            q_num = cnt;
        }
        cnt++;
    }while(next_permutation(v.begin(), v.end()));
    cout << abs(p_num-q_num) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
int w,h,x,y,r,a,b,c;
a=0;
cin>>w>>h>>x>>y>>r;
if(x<r){
 a+=1;
}
b=x+r;
if(b>w){
 a+=1;
}
if(y<r){
 a+=1;
}
c=y+r;
if(c>h){
 a+=1;
}
if(a==0){
 cout<<"Yes"<<endl;
}else{
 cout<<"No"<<endl;
}
return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef unsigned long long int ulli;
#define vec(s) vector
;
#define vvec(s) vector<vector
> ;
typedef vector<lli> vi;
typedef vector<vi> vvi;
typedef pair<lli,lli> pii;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define YN(x) cout<<(bool x?"Yes":"No")<<endl;
#define out(s) cout<<s<<endl;
#define pb(s) push_back(s);
#define sp " ";
#define INF 10000000000
#define all(s) s.begin(),s.end()
void vout(vector<int> v){
    for(int i=0;i<v.size();i++)
    cout<<v.at(i)<<endl;
}
int main(){
    lli n,k;
    cin>>n>>k;
    vi h(n);
    rep(i,n) cin>>h[i];
    sort(all(h));
    lli ans=INF;
    rep(i,n-k+1){
        ans=min(ans,h[i+k-1]-h[i]);
    }
    out(ans);
}

Measured memory_bytes: 1152
a = gets.to_i
b = gets.to_i
c = gets.to_i
x = gets.to_i

def calc(array)
    total = (array[0]*500) + (array[1]*100) +(array[2]*50)
end

coins = [0,0,0]
count = 0
for i in 0..a
    coins[0] = i
    for i in 0..b
        coins[1] = i
        for i in 0..c
            coins[2] = i
            count = count + 1 if x == calc(coins) 
        end
    end
end

puts count

Measured memory_bytes: 1788
import java.util.*;
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();
    int k = sc.nextInt();
    if(a >= k){
      System.out.println(k);
    }else if(a < k && a + b >= k) {
      System.out.println(a);
    }else if(a + b < k && a + b+ c >= k) {
      System.out.println(2 * a + b - k);
    }
  }
}

Measured memory_bytes: 35812
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define MAX 300003
#define MOD 1000000007
#define INF 1000000000000000000
using Graph=vector<vector<int>>;

int main(){
  int N;
  cin>>N;
  vector<int> A(N);
  for(int i=0;i<N;i++){
    cin>>A.at(i);
  }

  map<int,ll> m;
  ll ans=0;
  for(int i=N-1;i>=0;i--){
    int x=A.at(i)+i;
    if(m.count(x)==0){
      m[x]=0;
    }
    ans+=m[x];
    int y=i-A.at(i);
    if(m.count(y)==0){
      m[y]=0;
    }
    m[y]++;
  }

  cout<<ans<<endl;
}


Measured memory_bytes: 26752
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
    vector<int> cost;
    int A,B;
    int N,M;
    int ans=0;

    cin >> N >> M;

    for(int i=0; i<M; ++i) {
        cin >> A >> B;
        cost.push_back(N-A);
    }

    sort(cost.begin(),cost.end());

    for(int i=0; i<M-1; ++i) {
        ans+=(cost[i]>0?cost[i]:0);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3144
#include <cstdio>
#include <algorithm>
using namespace std;
int a, b;

int main() {
    scanf("%d %d", &a, &b);
    if(a < b)
        puts("a < b");
    else if(a > b)
        puts("a > b");
    else
        puts("a == b");
    return 0;
}


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

int main(){
    long long a,b,ans(0);

    cin >> a >> b;

    if(a==0){
        cout << "Zero" << endl;
        return 0;
    }   
    if(a>0){
        cout << "Positive" << endl;
        return 0;
    }
    if(a<0&&b>0){
        cout << "Zero" << endl;
        return 0;
    }else{
        while(a<b){
            ans++;
            a++;
        }
    }
    
    if(ans%2==0){
        cout << "Negative" << endl;
        return 0;
    }
    if(ans%2==1){
        cout << "Positive" << endl;
        return 0;
    }
    
}

Measured memory_bytes: 256
#include <limits.h>

#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <stack>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)n; i++)
using namespace std;
using P = pair<int, int>;
using ll = long long;
template <typename T = long long>
vector<T> make_v(size_t a) {
  return vector<T>(a);
}
template <typename T, typename... Ts>
auto make_v(size_t a, Ts... ts) {
  return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  int k;
  cin >> k;
  rep(i, k + 1) {
    rep(j, k - i + 1) {
      int aa = a * pow(2, i), bb = b * pow(2, j), cc = c * pow(2, k - i - j);
      if (aa < bb && bb < cc) {
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
  cout << "No" << endl;
}


Measured memory_bytes: 4024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll MOD = 1e9 + 7;
const ll INF = LLONG_MAX;
const ll MINF = LLONG_MIN;
using Tree = vector<pair<int, int>>;

int main()
{
    int k, x;
    cin >> k >> x;
    int a = x - k + 1;
    for (int i = 0; i < 2 * k - 1; i++)
    {
        cout << a + i;
        if (i == 2 * k - 2)
        {
            cout << endl;
        }
        else
        {
            cout << " ";
        }
    }
}

Measured memory_bytes: 256
//↓template↓

#include "bits/stdc++.h"
using namespace std;
#define Would
#define you
#define all(n)  n.begin(),n.end()
#define rall(n) n.rbegin(),n.rend()
typedef long long ll;
const ll INF = 1e18;
const ll MOD = 1e9 + 7;
const double EPS = 1e-10;
const double pi = acos(-1);//3.1415926535897932384626433832795028...
const ll SIZE = 1 << 17;
int dx[] = { 1,0,-1,0 }, dy[] = { 0,1,0,-1 }, alp[30];
ll fac[200005], finv[200005], inv[200005];
vector<ll>dij;
struct edge { ll to, cost; };
vector<vector<edge> >G;

ll mod_pow(ll a, ll b) {
	ll res = 1, mul = a;
	for (int i = 0; i < 31; ++i) {
		if (b >> i & 1) {
			res *= mul;
			res %= MOD;
		}
		mul = (mul * mul) % MOD;
	}
	return res;
}

void addedge(int from, int to, int cost) {
	G[from].push_back({ to,cost });
	G[to].push_back({ from,cost });
}

template<typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }

template<typename T, typename... Ts>
auto make_v(size_t a, Ts... ts) {
	return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}

template<typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T & t, const V & v) { t = v; }

template<typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T & t, const V & v) {
	for (auto& e : t) fill_v(e, v);
}

template<typename T>
void outp(vector<T>v) {
	for (int i = 0; i < v.size(); ++i) {
		cout << v[i];
		if (i != v.size() - 1) { cout << " "; }
	}
}

double add(double a, double b) {
	if (abs(a + b) < EPS * (abs(a) + abs(b))) { return 0; }
	return a + b;
}

//↑template↑


int main() {
	string h;
	cin >> h;
	for (int i = 0; i < h.length(); ++i) {
		switch (i % 2) {
		case 0:
			if (h[i] == 'L') { cout << "No" << endl; return 0; }
			break;
		case 1:
			if (h[i] == 'R') { cout << "No" << endl; return 0; }
			break;
		}
	}
	cout << "Yes" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define ls id << 1
#define rs id << 1 | 1
#define mem(array, value, size, type) memset(array, value, ((size) + 5) * sizeof(type))
#define memarray(array, value) memset(array, value, sizeof(array))
#define pb(x) push_back(x)
#define st(x) (1LL << (x))
#define pii pair<int, int>
#define mp(a, b) make_pair((a), (b))
#define Flush fflush(stdout)
using namespace std;
const int N = 500050;
const int inf = 0x3f3f3f3f;
const ll llinf = 0x3f3f3f3f3f3f;
const ll mod = 998244353LL;
const double PI = acos(-1.0);
clock_t TIME__START, TIME__END;
void program_end()
{
#ifdef ONLINE
    printf("\nTime used: %.6lf(s)\n", ((double)TIME__END - TIME__START) / 1000);
    system("pause");
#endif
}
int x;

void solve()
{
    scanf("%d", &x);
    for (int ans = 8, i = 400; i <= 1999;ans--,i+=200)
    {
        if(x>=i && x<i+200)
        {
            printf("%d\n", ans);
            return;
        }
    }
}

int main()
{
    TIME__START = clock();
    int Test = 1;
    // scanf("%d", &Test);
    while (Test--)
        solve();
    TIME__END = clock();
    program_end();
    return 0;
}

Measured memory_bytes: 3800
#include<bits/stdc++.h>
#define D(x) cout<<"D: "<<#x<<'='<<x<<endl;
#define R(x, l) cout<<"R: Array "<<#x<<endl; for(int i = 0; i < l; i++) cout<<' '<<i<<':'<<*(x+i)<<endl;
#define pb push_back
using namespace std;

int n,x,y;
int ans[2005];

int main(void)
{
	cin >> n >> x >> y;
	x--;
	y--;
	for(int i=0;i<n;i++)
		for(int j=i+1;j<n;j++)
			ans[min(j-i,(abs(x-i)+abs(y-j))+1)]++;
	for(int i=1;i<n;i++)
		cout << ans[i] << endl;
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm> 
using namespace std;
int main(){ int array[3];
for(int i = 0; i < 3; i++) scanf("%d",&array[i]);
for(int i = 2; i > 0; i--)
{ 
    for(int j = 0; j < i; 
    j++){ if(array[j] > array[j+1])swap(array[j],array[j+1]);
    } 
    
} printf("%d %d %d\n",array[0],array[1],array[2]);

    
} 



Measured memory_bytes: 2688
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define repb(i, n) for (int i = (int)n; i >= 0; i--)
#define reps(i, m, n) for (int i = (int)m; i < (int)n; i++)
#define repsb(i, m, n) for (int i = (int)m; i >= (int)n; i--)
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define pb(a) push_back(a)
#define INF 999999999999999999
int dy[] = {0, 0, 1, -1, 0};
int dx[] = {1, -1, 0, 0, 0};
using namespace std;
int main(int argc, char const *argv[])
{
    string s;
    cin >> s;
    rep(i, s.size())
    {
        rep(j, s.size())
        {

            if (s[i] == s[j] && i != j)
            {
                cout << "no" << endl;
                return 0;
            }
        }
    }
    cout << "yes" << endl;

    return 0;
}


Measured memory_bytes: 256
import math
s=int(input())
t=list(map(int,input().split()))
u=list(map(int,input().split()))
def roop1():
  a=0
  for i in range(s):
    c=0
    for j in range(i):
      if t[j]<t[i]:
        c-=1
    c+=(t[i]-1)
    a+=(c)*math.factorial(s-i-1)
  return(a+1)
def roop2():
  b=0
  for i in range(s):
    d=0
    for j in range(i):
      if u[j]<u[i]:
        d-=1
    d+=(u[i]-1)
    b+=(d)*math.factorial(s-i-1)
  return(b+1)
print(abs(roop1()-roop2()))

Measured memory_bytes: 3064
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class Main {

  public static void main(String[] args) {
    new Main().run();
  }

  public void run() {
    
    try(BufferedReader in = new BufferedReader(new InputStreamReader(System.in))) {

      int n = Integer.parseInt(in.readLine());
      String line = in.readLine();

      int[] seqA = new int[n/2];
      int[] seqB = new int[n/2];

      int offset=0,next=0;
      char regx = ' ';
      List<Integer> listA = new ArrayList<>();
      List<Integer> listB = new ArrayList<>();
      Map<Integer,Integer> mapA = new HashMap<>();
      Map<Integer,Integer> mapB = new HashMap<>();
      for(int i=0, j=0; i<n; i++, j= i >> 1) {
        if((next = line.indexOf(regx,offset)) == -1)
          next = line.length();

        if((i & 1) == 0) {
          seqA[j] = Integer.parseInt(line.substring(offset, next));
          if(mapA.containsKey(seqA[j])) {
            mapA.replace(seqA[j], mapA.get(seqA[j]) + 1);
          } else {
            mapA.put(seqA[j], Integer.valueOf(1));
            listA.add(seqA[j]);
          }
        }
        else {
          seqB[j] = Integer.parseInt(line.substring(offset, next));
          if(mapB.containsKey(seqB[j])) {
            mapB.replace(seqB[j], mapB.get(seqB[j]) + 1);
          } else {
            mapB.put(seqB[j], Integer.valueOf(1));
            listB.add(seqB[j]);
          }
        }

        offset = ++next;
      }

      int vma,vmb,xa,xb;
      vma = vmb = xa = xb =0;
      for (Integer var : listA) {
        if(vma < mapA.get(var)) {
          vma = mapA.get(var);
          xa = var;
        }
      }
      for (Integer var : listB) {
        if(vmb < mapB.get(var)) {
          vmb = mapB.get(var);
          xb = var;
        }
      }

      int cca,ccb;
      cca = ccb = 0;
      for (int i : seqA) {
        if(i != xa) cca++;
      }
      for (int i : seqB) {
        if(i != xb) ccb++;
      }

      int vma2,vmb2,xa2,xb2;
      vma2 = vmb2= xa2 = xb2 =0;
      int cca2,ccb2;
      cca2 = ccb2 = 0;
      int ans = 0;
      if(xa == xb) {
        for (Integer var : listA) {
          int ma = mapA.get(var);
          if(var != xa && vma2 < ma) {
            vma2 = ma;
            xa2 = var;
          }
        }
        for (Integer var : listB) {
          int mb = mapB.get(var);
          if(var != xb && vmb2 < mb) {
            vmb2 = mb;
            xb2 = var;
          }
        }
      
        for (int i : seqA) {
          if(i != xa2) cca2++;
        }
        for (int i : seqB) {
          if(i != xb2) ccb2++;
        }

        ans = cca2 > ccb2 ? cca + ccb2 : cca2 + ccb;
      }
      else {
        ans = cca + ccb;
      }

      System.out.println(ans);
    }
    catch(IOException e) {
      System.err.println(e);
    }
  }
}

Measured memory_bytes: 47064
#include<stdio.h>
#define rep(i,n) for(int i=0;i<n;i++)
int n,l,r;
int a[51];
int main(void){
    while(1){
        scanf("%d%d%d",&n,&l,&r);
        if(n==0) break;
        for(int i=1;i<=n;i++){
            scanf("%d",&a[i]);
        }
        int cnt=0;
        for(int x=l;x<=r;x++){
            int flag=0;
            for(int i=1;i<=n;i++){
                if(x%a[i]==0){
                    if(i%2==1) cnt++;
                    flag=1;
                    break;
                }
            }
            
            if(flag==0){
                if(n%2==1);
                else cnt++;
            }
        }
        printf("%d\n",cnt);
    }
}



Measured memory_bytes: 2108
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;
import java.util.function.Function;
import java.util.stream.Collectors;

public class Main {

    public static void main(String[] args) {
        Scanner stdin = new Scanner(System.in);
        List<Long> s = stdin.nextLine()
                            .chars()
                            .boxed()
                            .collect(Collectors.groupingBy(Function.identity(), Collectors.counting()))
                            .values()
                            .stream()
                            .collect(Collectors.toList());
        String ans = s.equals(Arrays.asList(2L, 2L)) ? "Yes" : "No";
        System.out.println(ans);
    }

}


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

int main(){
  int n;
  ll ans,count=0;
  cin >> n;
  vector<ll> v(n,0);
  map<ll,ll> mp;
  r(i,n)cin >> v.at(i);
  r(i,n){
    if(i)v.at(i)+=v.at(i-1);
    mp[v.at(i)]++;
  }
  mp[0]++;
  for(auto it=mp.begin();it!=mp.end();it++){
    count+=((*it).second-1)*((*it).second)/2;
  }
    cout << count << endl;
}


Measured memory_bytes: 14336
// Red and Black
import java.util.Scanner;

public class Main {
	int w, h;
	String[] field;
	boolean[][] visited;

	public static void main(String[] args) {
		new Main().run();
	}

	void run() {
		Scanner sc = new Scanner(System.in);
		while (true) {
			w = sc.nextInt();
			h = sc.nextInt();
			if ((w | h) == 0)
				break;
			field = new String[h];
			visited = new boolean[h][w];
			int result = 0;
			for (int i = 0; i < h; i++)
				field[i] = sc.next();
			for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++) {
					if (field[i].charAt(j) == '@') {
						result = visit(j, i);
						break;
					}
				}
			}
			System.out.println(result);
		}
		sc.close();
	}

	int visit(int x, int y) {
		int result = 1;
		visited[y][x] = true;
		if (x > 0 && field[y].charAt(x - 1) != '#' && !visited[y][x - 1])
			result += visit(x - 1, y);
		if (x < w - 1 && field[y].charAt(x + 1) != '#' && !visited[y][x + 1])
			result += visit(x + 1, y);
		if (y > 0 && field[y - 1].charAt(x) != '#' && !visited[y - 1][x])
			result += visit(x, y - 1);
		if (y < h - 1 && field[y + 1].charAt(x) != '#' && !visited[y + 1][x])
			result += visit(x, y + 1);
		return result;
	}
}

Measured memory_bytes: 35484
import java.util.*;
class Main{
  public static void main(String args[])
  {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int tr = sc.nextInt();
    int ta = sc.nextInt();
    
    if(n*tr >= ta)
    {
      System.out.println(ta);
    }
    else
      System.out.println(n*tr);
  }
}
  

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

/* macro */
#define rep(i,a,b) for(int i=a;i<b;i++)
#define revrep(i,a,b) for(int i = a; i > b; i--)
#define int long long
#define exist(s,e) ((s).find(e)!=(s).end())
#define all(v) (v).begin(), (v).end()
#define each(s,itr) for(auto (itr) = s.begin(); (itr) != s.end(); (itr)++)
#define sum(v) accumulate(all(v), (0LL))
#define isin(a, b, c) (b <= a && a <= c)
#define println cout << "\n";
#define sz(v) (int)v.size()
#define bin(x) static_cast<bitset<16> >(x)


/* alias */
template<class T> using vec = vector<T>;
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef tuple<int, int, int> ti;
typedef map<int, int> mi;
typedef set<int> si;


/* constant */
const int inf = 1LL << 62;
const int mod = 1e9 + 7;
const int dx[8]={1,0,-1,0,-1,1,-1,1};
const int dy[8]={0,1,0,-1,-1,-1,1,1};
const string alphabet = "abcdefghijklmnopqrstuvwxyz";

/* io_method */
int input(){int tmp;cin >> tmp;return tmp;}
string raw_input(){string tmp;cin >> tmp;return tmp;}
template<class T> void printx(T n){cout << n;}
template<class T, class U> void printx(pair<T, U> p){cout << "(" << p.first << "," << p.second << ")";}
template<class T, class U, class V> void printx(tuple<T, U, V> t){cout << "{" << get<0>(t) << "," << get<1>(t) <<"," << get<2>(t) << "}" << endl;}
template<class T> void printx(vector<T> v){cout << "{";rep(i,0,v.size()){printx(v[i]);if(i != v.size()-1)printx(",");}cout << "}";}
template<class T> void print(T n){printx(n);cout << endl;}
template<class T> void print(set<T> s){cout << "{";each(s, e){if(e != s.begin()) printx(",");printx(*e);}cout << "}" << endl;}
template<class T, class U> void print(map<T, U> mp){cout << "{";each(mp, e){cout << "(" << e -> first << "," << e -> second << ")";}cout << "}" << endl;}
template<class T> void printans(vec<T> v){rep(i,0,sz(v)){cout << v[i] << (i == sz(v) - 1 ? "" : " ");}cout << endl;}


/* general_method */
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; }
template<class T>T cut(T &a, int l, int r){return T(a.begin()+l, a.begin()+r);}


/* math_method */
int ceil(int a, int b){return a / b + (a % b > 0);}


/* main */

int a, b;
void in(){
 cin >> a >> b;
}

void solve(){

    if(a < b){
        print(0);
    }else{
        print(10);
    }

}

signed main(){

    cin.tie(0);
    ios::sync_with_stdio(false);
    in();
    solve();
    
}

Measured memory_bytes: 256
import sys
from collections import defaultdict
sys.setrecursionlimit(10**7)

class UnionFind():
    def __init__(self, N):
        self.N = N
        self.par = [n for n in range(N)]
        self.rank = [0 for _ in range(N)]

    def find(self, x):
        if self.par[x] == x:
            return x
        self.par[x] = self.find(self.par[x])
        return self.par[x]

    def union(self, x, y):
        x = self.find(self.par[x])
        y = self.find(self.par[y])
        if self.rank[x] < self.rank[y]:
            self.par[x] = y
        else:
            self.par[y] = x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1

    def isSame(self, x, y):
        return self.par[x] == self.par[y]

    def refresh(self):
        for p in range(N):
            self.find(p)

N, K, L = [int(x) for x in input().strip().split()]
road = UnionFind(N)
train = UnionFind(N)

for ｋ in range(K):
    p, q = [int(x) - 1 for x in input().strip().split()]
    road.union(p, q)
for l in range(L):
    r, s = [int(x) - 1 for x in input().strip().split()]
    train.union(r, s)

d = defaultdict(int)
for n in range(N):
    r = road.find(n)
    t = train.find(n)
    d[(r, t)] += 1

for n in range(N):
    print(d[(road.par[n], train.par[n])], end=' ')

Measured memory_bytes: 112840
#include<iostream>
#include <string.h>
#include<stdio.h>
#include <vector>

using namespace std;



int main(){
	string a;
	a = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
	char x;

	cin >> x;
	int k = 0;
	for (int i = 0; i <= 52; i++) {
		if (x == a[i]) {
			k = i;
		}
	}
	if (k <= 25) cout << 'a' << endl;
	else cout << 'A' << endl;


return 0;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define np next_permutation
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define pi acos(-1.0)
const ll INF = 1LL<<61;
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; }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
ll jou(ll N, ll P){if(P==0) return 1;
    if(P%2==0){ll t = jou(N, P/2);return t*t % mod;
    }return (N * jou(N, P-1)) % mod;}  //jou(n,mod-2)で逆元
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'大文字'+=32;    で小文字に
//  cout << fixed << setprecision (20);   小数点以下2０桁まで
//実行時間制約2秒では２×10^8回くらいまで計算できる



int main(){
  int x,n;
  cin>>x>>n;
  
  if(n==0){
    cout << x << endl;
    return 0;
  }

  vector<ll> p(n);
  vector<bool> q(102,false);
  rep(i,n){
    cin>>p[i];
    q[p[i]]=true;
  }

  ll sa=INF;
  ll ans;
  rep(i,102){
    if(q[i]) continue;
    ll s=abs(i-x);
    if(s<sa) ans=i;
    chmin(sa,s);
  }
  
  cout << ans << endl;

}


Measured memory_bytes: 3628
#include <cstdio>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int MOD;

class Bit
{
    int n;
    vector<int> data;
public:
    Bit(int n){ // コンストラクタ
        this->n = n;
        data.assign(n+1, 0);
    }
    void add(int k, int x){ // k番目の要素にxを加算する
        ++ k;
        while(k <= n){
            data[k] += x;
            data[k] %= MOD;
            k += k & -k;
        }
    }
    int sum(int k){ // 区間[0,k]の総和を返す
        ++ k;
        int ret = 0;
        while(k > 0){
            ret += data[k];
            ret %= MOD;
            k -= k & -k;
        }
        return ret;
    }
    int sum(int a, int b){ // 区間[a,b]の総和を返す
        int ret = sum(b) - sum(a-1);
        ret = (ret % MOD + MOD) % MOD;
        return ret;
    }
};

int main()
{
    for(;;){
        int a, b;
        cin >> a >> b >> MOD;
        if(a == 0)
            return 0;

        vector<string> s(b-a+1);
        for(int i=0; i<b-a+1; ++i){
            ostringstream oss;
            oss << (a + i);
            s[i] = oss.str();
        }
        sort(s.begin(), s.end());

        Bit x(b-a+1);
        for(int i=0; i<b-a+1; ++i){
            istringstream iss(s[i]);
            int k;
            iss >> k;
            x.add(k-a, x.sum(k-a-1) + 1);
        }

        cout << x.sum(0, b-a) << endl;
    }
}

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

int N, M;
int p[100001];
int parent[100001];

int root(int x){
  if(parent[x]==x){
    return x;
  }else{
    return parent[x]=root(parent[x]);
  }
}

int main() {
  cin >> N >> M;
  for(int i=1; i<=N; i++){
    cin >> p[i];
  }
  for(int i=1; i<=N; i++){
    parent[i]=i;
  }
  for(int i=0; i<M; i++){
    int x,y; cin >> x >> y;
    x=root(x); y=root(y);
    parent[x]=y;
  }
  int count=0;
  for(int i=1; i<=N; i++){
    if(root(i)==root(p[i])){
      count++;
    }
  }
  cout << count << endl;
}

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

int n;
bool s[4] = {false, false, false, false};
char c;
int num = 0;;

int main(){
    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> c;
        if(c == 'P' && !s[0]){
            s[0] = true;
            num++;
        }else if(c == 'W' && !s[1]){
            s[1] = true;
            num++;
        }else if(c == 'G' && !s[2]){
            s[2] = true;
            num++;
        }else if(c == 'Y' && !s[3]){
            s[3] = true;
            num++;
        }
    }
    if(num == 3){
        cout << "Three" << endl;
    }else{
        cout << "Four" << endl;
    }
    return 0;
}

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

int main(){
  int t,n;
  string str;
  bool book[2][50000];
  int v[3][20000],a[3][20000];

  cin >> t;
  while(t--){
    cin >> n >> str;
    for(int i=0;i<2;i++){
      for(int j=0;j<2*n;j++)book[i][j+1] = (str[i*2*n+j]=='Y');
      book[i][0] = book[i][2*n+1] = false;
    }

    for(int i=0;i<3;i++)
      for(int j=0;j<=n;j++){
	v[i][j] = a[i][j] = 100000000;
      }
    a[0][0] = 0;

    for(int i=0;i<=n;i++){
      if(book[1][2*i] || book[1][2*i+1]){
	v[0][i] = min(min(v[0][i],a[0][i] + 3),min(a[1][i] + 2,a[2][i] + 2));
	if(book[0][2*i] || book[0][2*i+1]){
	  v[1][i] = min(min(v[1][i],a[0][i] + 2),min(a[1][i] + 2,a[2][i] + 2));
	  v[2][i] = min(min(v[2][i],a[0][i] + 2),min(a[1][i] + 2,a[2][i] + 3));
	}else{
	  v[1][i] = min(min(v[1][i],a[0][i] + 2),min(a[1][i] + 1,a[2][i] + 1));
	  v[2][i] = min(min(v[2][i],a[0][i] + 2),min(a[1][i] + 1,a[2][i] + 1));
	}
      }else if(book[0][2*i] || book[0][2*i+1]){
	v[0][i] = min(min(v[0][i],a[0][i] + 1),min(a[1][i] + 1,a[2][i] + 2));
	v[1][i] = min(min(v[1][i],a[0][i] + 1),min(a[1][i] + 1,a[2][i] + 2));
	v[2][i] = min(min(v[2][i],a[0][i] + 2),min(a[1][i] + 2,a[2][i] + 3));
      }else{
	v[0][i] = min(min(v[0][i],a[0][i]),min(a[1][i] + 1,a[2][i] + 2));
	v[1][i] = min(min(v[1][i],a[0][i] + 1),min(a[1][i],a[2][i] + 1));
	v[2][i] = min(min(v[2][i],a[0][i] + 2),min(a[1][i] + 1,a[2][i]));
      }

      if(i==n)break;

      for(int j=0;j<3;j++)a[j][i+1] = v[j][i] + 1;
    }
    /*
    for(int i=0;i<=2*n+1;i++)cout << book[0][i];
    cout << endl;
    for(int i=0;i<=2*n+1;i++)cout << book[1][i];
    cout << endl;

    for(int i=0;i<3;i++){
      for(int j=0;j<=n;j++)cout << v[i][j] << " ";
      cout << endl;
    }
    */
    cout << v[0][n] << endl;
  }  
}

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

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

    vector<int> p(n), q(n);

    rep(i,n) cin >> p[i];
    rep(i,n) cin >> q[i];

    vector<int> a(n);
    rep(i,n) {
        a[i] = i+1;
    }

    map<vector<int>, int> mp;
    int count = 0;
    do {
        mp[a] = count;
        count++;
    } while (next_permutation(a.begin(), a.end()));

    cout << abs(mp[p] - mp[q]) << endl;
    return 0;
}

Measured memory_bytes: 8576
import numpy as np

A = []
for i in range(3):
  b = list(map(int, input().split()))
  A.append(b)

N = int(input())

NP_A = np.array(A)
b = []
for n in range(N):
  b.append(int(input()))

for n in range(N):
  NP_A = np.where(NP_A==b[n], 0, NP_A)

ans = "No"

for i in range(2):
    if 0 in NP_A.sum(axis=i):
        ans = "Yes"
        break

if ans == "Yes":
    pass
else:
    sum = 0
    for i in range(3):
        sum += NP_A[i, i]
    if sum == 0:
        ans = "Yes"
    else:
        sum = NP_A[0, 2] + NP_A[1, 1] + NP_A[2, 0]
        if sum == 0:
            ans = "Yes"

print(ans)

Measured memory_bytes: 27092
#include <bits/stdc++.h>
using namespace std;
#define for0(i, n) for(int i = 0; i < n; i++)
#define for1(i, n) for(int i = 1; i <= n; i++)
#define pb push_back
#define mp make_pair
#define all(v) v.begin(), v.end()
#define V vector<int>
#define VP vector<pair<int, int> >
#define FASTIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#ifdef _WIN32
#include <windows.h>
#define print(x) PRINT(x, #x)
template<typename T> inline const void PRINT(T VARIABLE, string NAME)
{
#ifndef ONLINE_JUDGE /// ONLINE_JUDGE IS DEFINED ON CODEFORCES
    HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
    SetConsoleTextAttribute(hConsole, 10);
    cerr << NAME << " = " << VARIABLE;
    SetConsoleTextAttribute(hConsole, 7);
    cerr << '\n';
#endif
}
#else
#define print(x) 0
#endif
typedef long long ll;
typedef unsigned long long ull;
const ll INFLL = 2 * (ll)1e18 + 100;
const int INFINT = 2 * (int)1e9 + 100;
const double PI = atan(1) * 4;
const double EPS = 1e-12;
const int SEED = 1e3 + 7;

const int MOD = 1e9 + 7; /// careful here (7 or 9, 66.. etc)
const int NMAX = 1e6 + 5;

string n;


int main()
{
    FASTIO;
    cin >> n;
    bool ok = 0;
    for(auto i: n)
    {
        if(i != '9') ok = 1;
    }
    int test = 0, mmax = 0;
   // cin >> test;
    for1(i, test)
    {
        int temp = i, c = 0;
        while(temp)
        {
            c += temp % 10;
            temp /= 10;
        }
        mmax = max(mmax, c);
    }
    cerr << mmax << '\n';
    if(!ok) return cout << n.size() * 9, 0;
    if(n.size() == 1) return cout << n, 0;
    int f = n[0] - '0' - 1;
    int sol = 0;
    for(auto i: n)
    {
        sol += i - '0';
    }
    cout << max((int) f + 9 * (int) n.size() - 9, sol);

    return 0;
}


Measured memory_bytes: 256
n = int(input())
d = list(map(int, input().split()))
m = int(input())
t = list(map(int, input().split()))

summary_d = {}
summary_t = {}

for i in range(0, len(d)):
    summary_d[d[i]] = summary_d.get(d[i],0) + 1

for i in range(0, len(t)):
    summary_t[t[i]] = summary_t.get(t[i],0) + 1

result = {}

for k,v in summary_t.items():
    result[k] = summary_d.get(k,0) - v

if min(result.values()) >= 0:
    print("YES")
else:
    print("NO")


Measured memory_bytes: 69972
#include<iostream>

using namespace std;

int main()
{
	int n,m,i,j,p[1000];
	
	for(;;)
	{
		cin >> n >> m;
		if(n==0)
			break;
		
		int ans=0;
		
		for(i=0;i<n;i++)
		{
			cin >> p[i];
		}
		for(i=0;i<n;i++)
		{
			for(j=i+1;j<n;j++)
			{
				if(p[i]<p[j])
				{
					int a;
					a=p[i];
					p[i]=p[j];
					p[j]=a;
				}
			}
		}
		for(i=0;i<n;i++)
		{
			if((i+1)%m!=0)
				ans+=p[i];
		}
		cout << ans << endl;
	}
}

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

using namespace std;

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

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

ll A[100005];

class Prime {
public:
    Prime(ll n) {
        mPrimeTbl.clear();
        vector<bool> u(n, false);
        for (ll i = 2; i <= n; ++i) {
            if (u[i])
                continue;
            mPrimeTbl.push_back(i);
            for (ll p = i; p <= n; p += i)
                u[p] = true;
        }
    }

    ~Prime() {}

    ll num() {
        return static_cast<ll>(mPrimeTbl.size());
    }

    ll get(ll index) {
        return mPrimeTbl[index];
    }

private:
    vector<ll> mPrimeTbl;
};

int main() {
    ll N;
    cin >> N;
    REP(i, N) {
        cin >> A[i];
    }
    Prime p(100000);
    ll ans = 0;
    ll M = p.num();
    REP(i, N) {
        bool isPrime = true;
        for (int j = 0; j < M && p.get(j) * p.get(j) <= A[i]; j++)
        {
            if (A[i] % p.get(j) == 0) {
                isPrime = false;
                break;
            }
        }
        if (isPrime)
            ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3320
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int a , b ;
    cin >> a >> b ;
    int arr[a+5]{};
    for(int i = 0 ; i < a ; i++){
        cin >> arr[i];
    }
    sort(arr,arr+a);
    long long sum = 0;
    for(int i = 0 ; i < b ; i++){
        sum+=arr[i];
    }
    cout << sum << endl;
    return 0;
}


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

int main() {
  int x, y;
  cin >> x >> y;
  int a[] = {0,1,3,1,2,1,2,1,1,2,1,2,1};
  int p = a[x], q = a[y];
  if (p == q) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
  return 0;
}

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

int main() {
  char a, b, c;
  cin >> a >> b >> c;
  int ans=0;

  if(a=='S' && b=='S' && c=='S'){
    cout << 0 << endl;
  }
  else if(a=='R' && b=='R' && c=='R'){
    cout << 3 << endl;
  }
  else if(a=='S' && b=='R' && c=='R'){
    cout << 2 << endl;
  }
  else if(a=='R' && b=='R' && c=='S'){
    cout << 2 << endl;
  }
  else{
    cout << 1 << endl;
  }

return 0;
}


Measured memory_bytes: 3632
#include <iostream>
#include <queue>
using namespace std;
typedef pair<int, int> P;
const int MAX_HW = 1000;
int n, h, w, rat, s[2], g[2], flag[MAX_HW+1][MAX_HW+1][2];
int town[MAX_HW][MAX_HW];
char town2[MAX_HW][MAX_HW];
queue <P> que;
P p;
void bfs(int sy, int sx){
	que.push(P(sy, sx));
	flag[sy][sx][0]=rat;
	while (que.size()){
	RE:
		p = que.front();
		que.pop();
		for (int i = -1; i <= 1; i++){
			for (int j = -1; j <= 1; j++){
				if (i == 0 || j == 0){
					if (town2[p.first + i][p.second + j] != 'X'&&flag[p.first + i][p.second + j][0] != rat&&p.first + i < h&&p.first + i >= 0 && p.second + j < w&&p.second + j >= 0) {
							flag[p.first+i][p.second+j][0] = rat;
							flag[p.first + i][p.second + j][1] = flag[p.first][p.second][1] + 1;
							if (town[p.first + i][p.second + j] == rat){
							if (rat == n) return;
							rat++;
							flag[p.first+i][p.second+j][0] = rat;
							while (que.size()){
								que.pop();
							}
							que.push(P(p.first + i, p.second + j));
							goto RE;
						}
						else{
						que.push(P(p.first + i, p.second + j));
						}
					}
				}
			}
		}
	}
}
int main(){
	cin >> h >> w >> n;
	rat = 1;
	for (int i = 0; i < h; i++){
		for (int j = 0; j < w; j++){
			cin >> town2[i][j];
			town[i][j] = town2[i][j] - 48;
			if (town2[i][j] == 'S'){
				s[0] = i;
				s[1] = j;
			}
			if (town[i][j] == n){
				g[0] = i;
				g[1] = j;
			}
		}
	}
	bfs(s[0], s[1]);
	cout << flag[g[0]][g[1]][1] << endl;
	return 0;
}

Measured memory_bytes: 13920