akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define sz(x) (int)(x).size()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define EPS (1e-10)
#define equals(a, b) (fabs((a)-(b)) < EPS)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;
  
int main() {
  int N;
  ll K;
  cin >> N >> K;
  vl A(N);
  vl pos,neg,zero;
  rep(i,N) {
    cin >> A[i];
    if(A[i]>0) {
      pos.push_back(A[i]);
    } else if(A[i]<0) {
      neg.push_back(-1*A[i]);
    } else {
      zero.push_back(A[i]);
    }
  }
  ll p = sz(pos);
  ll n = sz(neg);
  ll z = sz(zero);
  ll a = p*n;
  ll b = z*(p+n)+z*(z-1)/2;
  ll c = p*(p-1)/2+n*(n-1)/2;
  if(a<K&&K<=a+b) {
    cout << 0 << endl;
    return 0;
  }
  sort(rng(pos));
  sort(rng(neg));
  if(K<=a) {
    // neg * pos 
    ll l=0,r=LINF;
    while(l+1<r) {
      ll m = (l+r)/2;
      ll cnt = 0;
      rep(pi,p) {
        int d = lower_bound(rng(neg),(m+pos[pi]-1)/pos[pi])-neg.begin();
        cnt += n-d;
      }
      if(cnt>=K) {
        l=m;
      } else {
        r=m;
      }
    }
    cout << -1*l << endl;
    return 0;
  } else {
    // pos * pos or neg * neg
    K -=a+b;
    ll l=0,r=LINF;
    while(l+1<r) {
      ll m = (l+r)/2;
      ll cnt = 0;
      rep(pi,p-1) {
        ll t = (m+pos[pi]-1)/pos[pi];
        if(t>=pos[pi]) {
          int d = lower_bound(rng(pos),t)-pos.begin();
          d--;
          if(d<pi) continue;
          cnt += (d-pi);
        }
      }
      rep(ni,n-1) {
        ll t = (m+neg[ni]-1)/neg[ni];
        if(t>=neg[ni]) {
          int d = lower_bound(rng(neg),t)-neg.begin();
          d--;
          if(d<ni) continue;
          cnt += (d-ni);
        }
      }
      if(cnt>=K) {
        r=m;
      } else {
        l=m;
      }
    }
    cout << l << endl;
  }
  return 0;
}

Measured memory_bytes: 4084
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            // 解答はココに書く
            var blueValue = 0;
            var redValue = 0;
            var ans = 0;
            
            var N = cin.ReadInt;
            string[] nList = new string[N];
            
            for (int i = 0 ; i<N; i++)
            {
                nList[i] = cin.ReadLine;
            }
            
            var M = cin.ReadInt;
            string[] mList = new string[M];
            
            for (int j = 0 ; j<M; j++)
            {
                mList[j] = cin.ReadLine;
            }
            
            var serchValue = nList.Distinct().ToArray();
            
            for(int x = 0; x<serchValue.Length; x++){
                
                
                blueValue = nList.Where( value => value == serchValue[x]).Count();
                redValue = mList.Where( value => value == serchValue[x]).Count();
                
                var result = blueValue - redValue;
                
                ans = ans < result && result > 0 ? result : ans ; 
                
            }
            WriteLine(ans);
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); }}
        public int ReadInt { get { return int.Parse(Read); }}
        public long ReadLong { get { return long.Parse(Read); }}
        public double ReadDouble { get { return double.Parse(Read); }}
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret;}
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret;}
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret;}
    }
}

Measured memory_bytes: 13408
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor, atan2
from operator import mul
from functools import reduce
sys.setrecursionlimit(10 ** 9)

INF = 10 ** 20
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 10 ** 9 + 7


n = I()
G = []
for _ in range(n):
    G += [LI()]


ret = 0
for i in range(n):
    for j in range(i + 1, n):
        flag = 1
        for k in range(n):
            if i == k or j == k:
                continue
            if G[i][j] > G[i][k] + G[k][j]:
                print(-1)
                exit()
            elif G[i][j] == G[i][k] + G[k][j]:
                flag = 0
        if flag:
            ret += G[i][j]


print(ret)

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

int main() {
	string s;
	cin>>s;
	long long cur=0,ans=0;
	for(int i=0;i<s.length();++i) {
		if(s[i] == 'W')
		ans += cur;
		else cur++;
	}
	cout<<ans;
	return 0;
}

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


#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;


using namespace std;

#if DEBUG && !ONLINE_JUDGE
    #include "debug.h"
#else
    #define debug(...)
#endif

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<vector<int> > vvi;
typedef vector<vector<ii> > vvii;

#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define fill(a,x) memset(a,x,sizeof(a))
#define ff first
#define ss second
#define trav(a, x) for(auto& a : x) 
#define FOR(i,a,b) for(int i = a; i<=b; ++i)
#define NFOR(i,a,b) for(int i = a; i>=b; --i)
#define PI 3.1415926535897932384626433832795
const ll INF = 1e18;
const int mod = 1e9 + 7;
const int N = 1e5;
ll gcd(ll a,ll b){if (a==0) return b;return gcd(b%a,a);}
ll lcm(ll a,ll b){return a*(b/gcd(a,b));}
ll Abs(ll a){if(a>0)return a;return -a;}
ll Ceil(ll a,ll b){if(a%b==0)return a/b;else return a/b+1;}
double Abs(double a){if(a>0)return a;return -a;}

//*X.find_by_order(2) element at index=2
//X.order_of_key(1) how many elements strictly less than 1

#define ordered_set tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_node_update> 

inline int pow_(ll x, ll y,ll p){
  int r = 1; while(y){if(y & 1) r = r * x % p; y >>= 1; x = x * x % p;} return r;
}
inline int inv_(int x){return pow_(x, mod - 2, mod);}
inline int add(int a, int b){a += b; if(a >= mod) a -= mod; return a;}
inline int mul(int a, int b){return a * 1LL * b % mod;}
inline int sub(int a, int b){a -= b; if(a < 0) a += mod; return a;}

int main()
{
    #ifdef LOCAL_TEST
    freopen("in.txt","r",stdin);
    //freopen("out.txt", "w", stdout);
    #else
    ios_base::sync_with_stdio(false);cin.tie(NULL);
    #endif
    int H,W;
    cin>>H>>W;
    int h,w;
    cin>>h>>w;
    ll ans = H*W - (H*w + W*h - w*h);
    cout << ans << "\n";   
    return 0;
}

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

// #undef DEBUG  // Uncomment this line to forcefully disable debug print.
#if DEBUG
template <typename T>
void debug(T value) {
  std::cerr << value;
}
template <typename T, typename... Ts>
void debug(T value, Ts... args) {
  std::cerr << value << ", ";
  debug(args...);
}
#define dbg(...)                              \
  do {                                        \
    cerr << #__VA_ARGS__ << ": ";             \
    debug(__VA_ARGS__);                       \
    cerr << " (L" << __LINE__ << ")" << endl; \
  } while (0)
#else
#define dbg(...)
#endif

void read_from_cin() {}
template <typename T, typename... Ts>
void read_from_cin(T& value, Ts&... args) {
  std::cin >> value;
  read_from_cin(args...);
}
#define in(type, ...) \
  type __VA_ARGS__;   \
  read_from_cin(__VA_ARGS__);

template <typename T>
void write_to_cout(const T& value) {
  std::cout << value << std::endl;
}
template <typename T, typename... Ts>
void write_to_cout(const T& value, const Ts&... args) {
  std::cout << value << ' ';
  write_to_cout(args...);
}
#define out(...) write_to_cout(__VA_ARGS__);

#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)

using ll = long long;

template <typename T>
using V = std::vector<T>;
template <typename T>
using VV = V<V<T>>;

using namespace std;

using P = pair<int, int>;

struct Q {
  P lr;
  int bucket;
  int i;
  int kinds;
};

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

  in(int, n, q);
  V<int> c(n);
  rep(i, n) cin >> c[i];

  auto bucket = [](int i) { return int(sqrt(i)); };

  V<Q> qs(q);
  rep(i, q) {
    cin >> qs[i].lr.first >> qs[i].lr.second;
    --qs[i].lr.first;
    --qs[i].lr.second;
    qs[i].i = i;
    qs[i].bucket = bucket(qs[i].lr.first);
  }
  sort(all(qs), [](const Q& l, const Q& r) {
    if (l.bucket != r.bucket) {
      return l.bucket < r.bucket;
    }
    return l.lr.second < r.lr.second;
  });

  vector<int> kinds(n + 1);
  int n_kinds = 0;
  auto add = [&](int i) {
    if (kinds[c[i]] == 0) {
      ++n_kinds;
    }
    ++kinds[c[i]];
  };
  auto del = [&](int i) {
    --kinds[c[i]];
    if (kinds[c[i]] == 0) {
      --n_kinds;
    }
  };
  rep(i, q) {
    auto [L, R] = qs[i].lr;
    if (i == 0 || qs[i].bucket != qs[i - 1].bucket) {
      n_kinds = 0;
      rep(i, n) kinds[i + 1] = 0;
      for (int j = L; j <= R; ++j) {
        add(j);
      }
    } else {
      auto [PL, PR] = qs[i - 1].lr;
      if (PL < L) {
        for (int j = PL; j < L; ++j) {
          del(j);
        }
      } else {
        for (int j = L; j < PL; ++j) {
          add(j);
        }
      }
      if (PR < R) {
        for (int j = R; j > PR; --j) {
          add(j);
        }
      } else {
        for (int j = PR; j > R; --j) {
          del(j);
        }
      }
    }
    qs[i].kinds = n_kinds;
  }
  sort(all(qs), [](const Q& l, const Q& r) { return l.i < r.i; });
  rep(i, q) { out(qs[i].kinds); }
}

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

#define pout(n)  printf ("%d\n", n)

#define rep(i,a,n) for (int i = a;i < n;i++)
#define per(i,n,a) for (int i = n-1;i >= a;i--)

const int d4x[4] = {1, 0, -1, 0};
const int d4y[4] = {0, 1, 0, -1};
const int d8x[8] = { 1,1,0,-1,-1,-1,0,1 };
const int d8y[8] = { 0,1,1,1,0,-1,-1,-1 };

#define MAX_N (int)2e5+20
#define INF 1e12+20

typedef long long ll;
using namespace std;

int n,al = 0,bo = 0,ans;
int main() {
    cin >> n;
    int a[n];
    rep(i,0,n){
        cin >> a[i];
    }
    sort(a,a+n);
    for(int i = 0; i < n; i += 2){
        al += a[i];
    }
    for(int i = 1; i < n; i += 2){
        bo += a[i];
    }
    if(al>bo){
        ans = al-bo;
    }
    else{
        ans = bo-al;
    }
    pout(ans);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define vout(x) rep(i,x.size()) cout << x[i] << " "
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const int inf = 1e9;
const ll inf_l = 1e18;
const int MAX = 1e5;

int main() {
    ll n; cin >> n;
    int ans = inf;
    for (ll i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            string a = to_string(i);
            string b = to_string(n/i);
            int x = max(a.size(),b.size());
            ans = min(ans,x);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>

int main(){
  char O[60] = {};
  char E[60] = {};
  char Pass[110] = {};
  scanf("%s%s", O, E);
  int lo = strlen(O), le = strlen(E);
  for(int i = 0; i < lo || i < le; i++){
    Pass[2*i]   = O[i];
    Pass[2*i+1] = E[i];
  }
  printf("%s\n", Pass);
  return 0;
}


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

int main()
{
  int n;
  cin >> n;
  int trailing_zeros = 1;
  for (auto i = 0; i < n; i++) {
    uint u;
    cin >> u;
    trailing_zeros = min(trailing_zeros, __builtin_ctz(u));
  }
  cout << (trailing_zeros == 0 ? "first" : "second") << endl;
}


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

int main() {
    ll R, G, B, N;
    cin >> R >> G >> B >> N;

    ll cnt=0;
    for(ll r=0; r<=N; ++r) {
        for (ll g=0; g<=N; ++g) {
            if (((N-r*R-g*G)%B)==0 && (N-r*R-g*G)/B>=0) {
                cnt++;
            }
        }
    }

    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 3632
(eval-when (:compile-toplevel :load-toplevel :execute)
  (defparameter OPT
    #+swank '(optimize (speed 3) (safety 2))
    #-swank '(optimize (speed 3) (safety 0) (debug 0)))
  #+swank (progn (ql:quickload '(:cl-debug-print :fiveam))
                 (shadow :run)
                 (use-package :fiveam)))
#+swank (cl-syntax:use-syntax cl-debug-print:debug-print-syntax)

;; BEGIN_INSERTED_CONTENTS
(defun read-fixnum ()
  (declare #.OPT)
  (macrolet ((%read-byte ()
               `(the (unsigned-byte 8)
                     #+swank (char-code (read-char *standard-input* nil #\Nul))
                     #-swank (sb-impl::ansi-stream-read-byte *standard-input* nil #.(char-code #\Nul) nil))))
    (let* ((minus nil)
           (result (loop (let ((byte (%read-byte)))
                           (cond ((<= 48 byte 57)
                                  (return (- byte 48)))
                                 ((zerop byte) ; #\Nul
                                  (return-from read-fixnum 0))
                                 ((= byte #.(char-code #\-))
                                  (setf minus t)))))))
      (declare ((integer 0 #.most-positive-fixnum) result))
      (loop
        (let* ((byte (%read-byte)))
          (if (<= 48 byte 57)
              (setq result (+ (- byte 48) (the fixnum (* result 10))))
              (return (if minus (- result) result))))))))

(defmacro dbg (&rest forms)
  #+swank
  `(progn
     ,@(mapcar (lambda (form) `(format *error-output* "~A => ~A~%" ',form ,form))
               forms))
  #-swank (declare (ignore forms)))

(defmacro define-int-types (&rest bits)
  `(progn
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "UINT~A" b)) () '(unsigned-byte ,b))) bits)
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "INT~A" b)) () '(signed-byte ,b))) bits)))
(define-int-types 2 4 7 8 15 16 31 32 62 63 64)

(defmacro println (obj &optional (stream '*standard-output*))
  `(let ((*read-default-float-format* 'double-float))
     (prog1 (princ ,obj ,stream) (terpri ,stream))))

(defconstant +mod+ 1000000007)

;; Body

(defun main ()
  (declare #.OPT)
  (let* ((n (read))
         (ps (make-array n :element-type 'uint32))
         (res 0))
    (declare (uint32 res))
    (dotimes (i n) (setf (aref ps i) (- (the fixnum (read-fixnum)) 1)))
    (dotimes (i n (println res))
      (when (and (= (aref ps i) i))
        (if (= i (- n 1))
            (rotatef (aref ps i) (aref ps (- i 1)))
            (rotatef (aref ps i) (aref ps (+ i 1))))
        (incf res)))))

#-swank(main)


Measured memory_bytes: 21988
#include <cstdio>
#include <vector>
#include <map>
using namespace std;

int main() {
        int n;
        scanf("%d", &n);
        vector<long long> a(n);
        for (int i = 0; i < n; i ++) scanf("%lld", &a[i]);
        map<long long, int> cnt;
        for (int i = 0; i < n; i ++) cnt[a[i]] ++;
        long long ans = 0;
        for (auto it : cnt) {
                if (it.first > it.second) {
                        ans += it.second;
                } else {
                        ans += it.second - it.first;
                }
        }
        printf("%lld\n", ans);
        return 0;
}



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

int main(){
  int n,m;
  cin >> n >> m;
  vt<int> L(m), R(m);
  rep(i,m)
    cin >> L[i] >> R[i];

  int max_L = *max_element(L.begin(),L.end());
  int min_R = *min_element(R.begin(),R.end());

  if(min_R - max_L < 0)
    cout << 0 << endl;
  else
    cout << min_R - max_L + 1 << endl;
  return 0;
}


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

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

    int cnt = 0;
    
    while(s)
    {
        int x = s % 10;
        if(x == 1)
        {
            cnt++;
        }
        s /= 10;
    }
    
    cout << cnt << endl;
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <deque>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <tuple>
#include <numeric>
#include <string>
#include <bitset>
#include <functional>

using ld = long double;
using vld = std::vector<ld>;
using vvld = std::vector<vld>;
using vvvld = std::vector<vvld>;
using ll = long long;
using vll = std::vector<ll>;
using vvll = std::vector<vll>;
using vvvll = std::vector<vvll>;
using pll = std::pair<ll, ll>;
using vpll = std::vector<pll>;
using str = std::string;
using vstr = std::vector<str>;

template<typename T> bool chmin(T a, T &b) { return a < b ? b = a, true : false; }
template<typename T> bool chmax(T a, T &b) { return a > b ? b = a, true : false; }

constexpr ld PI = 3.141592653589793L;
constexpr ld EPS = std::numeric_limits<ld>::epsilon();

ll gcd(ll n, ll m) { return m ? gcd(m, n % m) : n; }
ll lcm(ll n, ll m) { return n / gcd(n, m) * m; }
bool isprime(ll n) {
    if (n < 2) return false;
    for (ll i = 2; i * i <= n; i++)
        if (n % i == 0) return false;
    return true;
}
vll sieve(ll n) {
    str flg = str(n + 1, '1');
    for (ll i = 2; i * i <= n; i++) if (flg[i] ^ '0')
        for (ll j = i * i; j <= n; j += i)
            flg[j] = '0';
    vll res;
    for (ll i = 2; i <= n; i++)
        if (flg[i] ^ '0') res.push_back(i);
    return res;
}
ll rpow(ll x, ll n) {
    if (n == 0) return 1;
    ll k = 1;
    for (; n > 1; n /= 2) {
        if (n & 1) k *= x;
        x *= x;
    }
    return k * x;
}
ll modpow(ll x, ll n, ll mod) {
    if (n == 0) return 1;
    ll k = 1;
    for (; n > 1; n /= 2) {
        if (n & 1) (k *= x) %= mod;
        (x *= x) %= mod;
    }
    return k * x % mod;
}
ll modcomb(ll n, ll r, ll mod) {
    if (r < 0 || n < r) return 0;
    chmin(n - r, r);
    ll mul = 1, div = 1;
    for (ll i = 0; i < r; i++) {
        (mul *= n - i) %= mod;
        (div *= i + 1) %= mod;
    }
    return mul * modpow(div, mod - 2, mod) % mod;
}

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

constexpr ll MOD = 1e9 + 7;

void solve();

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

    solve();
}
void solve() {
    ll n;
    std::cin >> n;

    auto legendre = [&](ll n, ll p) -> ll {
        ll res = 0;
        for (ll i = p; i <= n; i *= p)
            res += n / i;

        return res;
    };

    ll ans = 1;
    for (ll p : sieve(n))
        (ans *= legendre(n, p) + 1) %= MOD;

    std::cout << ans << '\n';
}


Measured memory_bytes: 3600
#pragma GCC optimize("O3")

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
using namespace std;

/*----------macros----------*/

//output================
#define endl '\n'
#define fcout cout << fixed << setprecision(15)

//typedef===============
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<ll, ll> Pll;

//const number==========
constexpr ll INF9   = (ll)1e9 + 1;
constexpr ll INF18  = (ll)1e18 + 1;
constexpr ll MOD    = 1000000007;
constexpr ld PI     = 3.141592653589793L;

//member================
#define pb push_back
#define eb emplace_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second

//others================
#define all(x)          (x).begin(), (x).end()
#define rall(x)         (x).rbegin(), (x).rend()
#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 CtoI(c)         int((c)) - int('0')

//functions=============
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

//vector<int> dx = {1, 0, -1, 0}, dy = {0, 1, 0, -1};
//vector<int> dx2 = { 1,1,0,-1,-1,-1,0,1 }, dy2 = { 0,1,1,1,0,-1,-1,-1 };



/*--------additional--------*/



/*----------main------------*/

int main() {
/*----------fastio----------*/
    std::cin.tie(nullptr);
    std::cout.tie(nullptr);
    std::ios::sync_with_stdio(false);
/*----------solve-----------*/

    int h1, m1, h2, m2, k; cin >> h1 >> m1 >> h2 >> m2 >> k;
    int minute1 = h1*60 + m1, minute2 = h2*60 + m2;

    cout << minute2 - minute1 - k << endl;

return 0;
}

Measured memory_bytes: 3588
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate, product, combinations_with_replacement
import sys
import bisect
import string
import math
import time


def I(): return int(input())
def S(): return input()
def MI(): return map(int, input().split())
def MS(): return map(str, input().split())
def LI(): return [int(i) for i in input().split()]
def LI_(): return [int(i)-1 for i in input().split()]
def StoI(): return [ord(i)-97 for i in input()]
def ItoS(nn): return chr(nn+97)
def input(): return sys.stdin.readline().rstrip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def print_matrix(mat):
    for i in range(len(mat)):
        print(*['IINF' if v == IINF else "{:0=4}".format(v) for v in mat[i]])


yn = {False: 'No', True: 'Yes'}
YN = {False: 'NO', True: 'YES'}
MOD = 10**9+7
inf = float('inf')
IINF = 10**19
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
ts = time.time()
sys.setrecursionlimit(10**6)
nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']
show_flg = False
# show_flg = True


def main():
    N = I()
    c = list(S())

    left = 0
    right = N - 1
    ans = 0

    while True:
        if c[left] != 'W':
            left += 1
        if c[right] != 'R':
            right -= 1

        if left >= right:
            break

        if c[left] == 'W' and c[right] == 'R':
            c[left] = 'R'
            c[right] = 'W'
            ans += 1

        # print(left, right, c, ans)

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 78456
using System;
class Mark{
  public static void Main(){
    int n = int.Parse(Console.ReadLine());
    int sub;
    while(n!=0){
      sub = 10000000;
      String[] str = Console.ReadLine().Split(' ');
      int[] mark = new int[n];
      for(int i=0; i<n; i++){
        mark[i] = int.Parse(str[i]);
      }
      Array.Sort(mark);
      for(int i=0; i<n-1; i++){
        if(mark[i+1]-mark[i] < sub){
          sub = mark[i+1]-mark[i];
        }
      }
      Console.WriteLine(sub);
      n = int.Parse(Console.ReadLine());
    }
  }
}



Measured memory_bytes: 15952
ref = list("AADINNUY")
aizu = "AIZUNYAN"
inp = raw_input()
if len(inp) < 8:
	print inp
else:
	ans = ""
	l = len(inp)
	i = 0
	while i < l:
		if i <= l - 8 and sorted(inp[i:i+8]) == ref:
			ans += aizu
			i += 8
		else:
			ans += inp[i]
			i += 1
	print ans
	

Measured memory_bytes: 4216
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#define MAX_V 2000000
#define INF 1 << 29
using namespace std;
typedef long long ll;
typedef pair<ll, int> pli;
struct Edge {
    int to;
    ll cost;
};
vector<Edge> g[MAX_V];
ll d[MAX_V];
void solve() {
    d[0] = 0;
    queue<pli> q;
    q.push(pli(0LL, 0));
    while (!q.empty()) {
        pli p = q.front(); q.pop();
        int v = p.second;
        for (size_t i = 0U; i < g[v].size(); ++i) {
            Edge e = g[v][i];
            if (d[e.to] > e.cost + d[v]) {
                d[e.to] = e.cost + d[v];
                q.push(pli(d[e.to], e.to));
            }
        }
    }
}
int main(void) {
    int k; cin >> k;
    for (int i = 0; i <= k; ++i) {
        d[i] = INF;
    }
    for (int i = 0; i < k; ++i) {
        Edge e = { i + 1, 1LL };
        g[i].push_back(e);
    }
    for (int i = 1; i < k; ++i) {
        Edge e = { i * 10 % k, 0LL };
        if (e.to == 0) e.to = k;
        g[i].push_back(e);
    }
    solve();
    cout << d[k] << endl;
    return 0;
}






















Measured memory_bytes: 54400
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

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

int main(){
  int n,m;
  cin>>n>>m;
  
  vector<ll> X(n),Y(n),Z(n);
  rep(i,n) cin>>X[i]>>Y[i]>>Z[i];
  
  ll ma=0;
  rep(i,8){
    int a=1,b=1,c=1;
    if(i&1) a=-1;
    if(i&(1<<1)) b=-1;
    if(i&(1<<2)) c=-1;
    vector<ll> A(n);
    rep(j,n) A[j]=a*X[j]+b*Y[j]+c*Z[j];
    sort(ALL(A));
    reverse(ALL(A));
    ll sum=0;
    rep(j,m) sum+=A[j];
    ma=max(ma,sum);
  }
  cout<<ma<<endl;
    
  return 0; 
}

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

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int INF = 1e9;

int main() {
  int a, b;
  string s;
  cin >> a >> b >> s;
  // regex re("^[0-9]{3}-{0-9}[4]$");
  // regex re("^[0-9]{3}-{0-9}[4]$");
  bool flg = true;
  for (int i = 0; i < s.length(); ++i) {
    if (i == a) {
      if (s[i] != '-') {
        flg = false;
        break;
      }
    } else {
      if (s[i] == '-') {
        flg = false;
        break;
      }
    }
  }
  cout << (flg ? "Yes" : "No") << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef  long long  ll;
ll inf=1000000000000000,mod=1000000007;
int main(){
    ios_base::sync_with_stdio(false);
        cin.tie(NULL);

     ll a,b,c,lef,rig;
     ll k;
     cin>>a>>b>>c;
     lef=c-a-b;
     if(lef<0)
     {
         cout<<"No"<<endl;return 0;
     }
     lef*=lef;
     rig=4*a*b;
     if(lef>rig)
    cout<<"Yes"<<endl;
    else
    cout<<"No"<<endl;
}


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

int main() {
	int N;
	cin >> N;	// 1 <= N <= 86

	auto v = vector<long long>(N + 1);
	v.at(0) = 2;
	v.at(1) = 1;

	for (int i = 2; i <= N; i++) {
		v.at(i) = v.at(i - 1) + v.at(i - 2);
	}
	
	cout << v.at(N) << endl;	// Output
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long LL;
typedef pair<int, int> P;
const LL MOD = 1000000007LL;
int a[100000];
int cnt[100000];
LL sum[100000];
int main() {
	int n, m;
	cin >> n >> m;
	for (int i = 0; i < n; i++) cin >> a[i], a[i]--;
	for (int i = 0; i + 1 < n; i++) {
		if (a[i] < a[i + 1]) {
			if (a[i] + 1 < m) cnt[a[i] + 1]++;
			 cnt[a[i + 1]]--;
		}
		else {
			if (a[i] + 1 < m) cnt[a[i] + 1]++;
			cnt[0]++;
			cnt[a[i + 1]]--;
		}
		sum[a[i + 1]] += (a[i + 1] - a[i] + m) % m - 1;
	}
	for (int i = 1; i < m; i++) cnt[i] += cnt[i - 1];
	LL now = 0;
	for (int i = 0; i + 1 < n; i++) {
		now += min((a[i + 1] - a[i] + m) % m, a[i + 1] + 1);
	}
	LL ans = now;
	for (int i = 0; i + 1 < m; i++) {
		now += sum[i];
		now -= cnt[i];
		ans = min(ans, now);
	}
	cout << ans << endl;
}

Measured memory_bytes: 1792
IDENTIFICATION DIVISION.
       PROGRAM-ID. test1.
       ENVIRONMENT DIVISION.
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01 A PICTURE 999.
       01 B PICTURE 999.
       01 REN PICTURE 9999.
       01 RE PIC Z(4).
       PROCEDURE DIVISION.
       MAIN.
        ACCEPT A.
        ADD 1 TO A GIVING B.
        COMPUTE REN=A*B/2.
        MOVE REN TO RE.
        DISPLAY RE.
        STOP RUN.

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

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define MOD 1000000007LL

#define rep(i, n) for(ll (i) = 0LL;(i) < (ll)(n);(i)++)
#define rep2(i, s, e) for(ll (i) = (ll)(s);(i) < (ll)(e);(i)++)
#define repi(i, n) for(ll (i) = 0LL;(i) <= (ll)(n);(i)++)
#define repi2(i, s, e) for(ll (i) = (ll)(s);(i) <= (ll)(e);(i)++)
#define per(i, n) for(ll (i) = (ll)(n) - 1LL;(i) >= 0LL;(i)--)
#define per2(i, s, e) for(ll (i) = (ll)(s) - 1LL;(i) >= (ll)(e);(i)--)
#define peri(i, n) for(ll (i) = (ll)(n);(i) >= 0LL;(i)--)
#define peri2(i, s, e) for(ll (i) = (ll)(s);(i) >= (ll)(e);(i)--)
#define iter(i, it) for(auto &(i): (it))

template<typename T, typename U> ostream& operator<<(ostream &s, const pair<T, U> m) {
    cout << "(" << m.first << ", " << m.second << ")";
    return s;
}
template<typename T, typename U> ostream& operator<<(ostream &s, const map<T, U> m) {
    ll c = 0;
    cout << "{ ";
    iter(i, m) cout << i << (c++ == m.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
    cout << "{ ";
    rep(i, v.size()) cout << v[i] << (i == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const list<T> &v) {
    ll c = 0;
    cout << "{ ";
    iter(i, v) cout << i << (c++ == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}

int main(void) {
    ll N, D;
    cin >> N >> D;
    ll temp = 2 * D + 1;
    cout << N / temp + !!(N % temp) << endl;
    return 0;
}


Measured memory_bytes: 3628
import sys
import bisect
h, w, d = [int(i) for i in sys.stdin.readline().split()]
a_ls = []
for y in range(h):
    a = [int(i) for i in sys.stdin.readline().split()]
    for x in range(w):
        a_ls += [(a[x], x, y)]

a_ls.sort(key=lambda x:x[0])
diff_ls = []
for ind in range(h*w):
    if ind < d:
        diff_ls.append(0)
    else:
        start = a_ls[ind-d]
        goal = a_ls[ind]
        diff = diff_ls[ind-d] + abs(start[2] - goal[2]) + abs(start[1] - goal[1])
        diff_ls.append(diff)
q = int(input())
for j in range(q):
    l, r = [int(i) for i in sys.stdin.readline().split()]
    l -= 1
    r -= 1
    print(diff_ls[r] - diff_ls[l])

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

int main(void){
  int N,i,j,count,min,east,west,RE,RW,LE,LW;
  char str[300005],s[300005],*p;
  
  fgets(str,sizeof(str),stdin);
  N=atoi(str);
  fgets(str,sizeof(str),stdin);
  p=strtok(str," \n");
  strcpy(s,p);
  
  min=N;
  
  for(i=0,east=0,west=0;i<N;i++){
    if(s[i]=='E'){
      east++;
    }
    if(s[i]=='W'){
      west++;
    }
  }
  
  for(i=0;i<N;i++){
    count=0;
    
    if(i==0){
      if(s[i]=='E'){
        RE=0,RW=0,LE=east-1,LW=west;
        count=east-1;
      }else{
        RE=0,RW=0,LE=east,LW=west-1;
        count=east;
      }
    }else{
      if(s[i-1]=='E'){
        RE+=1;
      }else{
        RW+=1;
      }
      
      if(s[i]=='E'){
        LE-=1;
      }else{
        LW-=1;
      }
      count=RW+LE;
    }
    
    if(count<min){
      min=count;
    }
  }
  
  printf("%d\n",min);
  
 return 0; 
}


Measured memory_bytes: 768
n = int(input())
A = [0]*(n+1)
 
for x in range(1,101):
    for y in range(1,101):
        for z in range(1,101):
            a = x**2+y**2+z**2+x*y+y*z+z*x
            if a <= n:
                A[a] += 1
            else:
                break
            
                
for i in range(n):
    print(A[i+1])
        

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

using namespace std;
typedef long long ll;
const int N=2e5+10;
const int mod=998244353;
ll sum[N<<2],lazy[N<<2],n;
ll p[15][N];
void push_down(int rt,int l,int r){
    if(lazy[rt]){
        int mid=l+r>>1;
        sum[rt<<1]=p[lazy[rt]][mid-l+1]*p[10][n-mid]%mod;
        sum[rt<<1|1]=p[lazy[rt]][r-mid]*p[10][n-r]%mod;
        lazy[rt<<1]=lazy[rt<<1|1]=lazy[rt];
        lazy[rt]=0;
    }
}
void build(int l,int r,int rt){
    if(l==r){sum[rt]=p[10][n-r];return;};
    int mid=l+r>>1;
    build(l,mid,rt<<1);build(mid+1,r,rt<<1|1);
    sum[rt]=(sum[rt<<1]+sum[rt<<1|1])%mod;
}
void update(int l,int r,int L,int R,int val,int rt){
    if(L<=l&&r<=R){
        sum[rt]=p[val][r-l+1]*p[10][n-r]%mod;
        lazy[rt]=val;
        return ;
    }
    push_down(rt,l,r);
    int mid=l+r>>1;
    if(L<=mid)update(l,mid,L,R,val,rt<<1);
    if(mid<R)update(mid+1,r,L,R,val,rt<<1|1);
    sum[rt]=(sum[rt<<1]+sum[rt<<1|1])%mod;
}
void init(int n){
    for(int i=1;i<=9;i++){
        for(int j=1;j<=n;j++)
            p[i][j]=(p[i][j-1]*10+i)%mod;
    }
    p[10][0]=1;
    for(int i=1;i<=n;i++)p[10][i]=p[10][i-1]*10%mod;
}
int main(){
    init(200000);int m;
    scanf("%d %d",&n,&m);
    build(1,n,1);
    while(m--){
        int l,r,val;scanf("%d %d %d",&l,&r,&val);
        update(1,n,l,r,val,1);
        printf("%lld\n",sum[1]);
    }
}


Measured memory_bytes: 27660
N = int(input())
d = {'M': 0, "A": 0, "R": 0, "C": 0, "H": 0}
for _ in range(N):
    try:
        d[input()[0]] += 1
    except KeyError:
        pass

ans = 0
v = d.values()
v = list(v)
for i in range(5):
    for j in range(i+1, 5):
        for k in range(j+1, 5):
            ans += v[i]*v[j]*v[k]
print(ans)


Measured memory_bytes: 43624
class UnionFind:
    def __init__(self, data):
        self.parent = {}
        self.rank = {}
        for i in range(1, data+1):
            self.parent[i] = i
            self.rank[i] = 0
 
    def find(self, x):
        if self.parent[x] == x:
            return x
        else:
            self.parent[x] = self.find(self.parent[x])
            return self.parent[x]
 
    def same(self, x, y):
        return self.find(x) == self.find(y)
 
 
    def unite(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if self.find(x) == self.find(y):
            return
        if self.rank[x] > self.rank[y]:
            self.parent[y] = x
            return
        else:
            self.parent[x] = y
            if self.rank[x] == self.rank[y]: self.rank[y] += 1
            return

N, M = map(int, input().split())
P = list(map(int, input().split()))
L = []
for i in range(M):
    L.append([int(x) for x in input().split()])
tree = UnionFind(N)
for i in range(M):
    tree.unite(P[L[i][0]-1], P[L[i][1]-1])
ans = 0
for i in range(N):
    if tree.same(P[i], i+1):
        ans += 1
print(ans)

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

typedef long long ll;
typedef double ld;
typedef pair <ll, ll> pll;

#define pb push_back
#define mp make_pair
#define all(_c) _c.begin(), _c.end()

int cost[] = {0, 2, 5, 5, 4, 5, 6, 3, 7, 6};

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

    int n, m;
    cin >> n >> m;

    int a[m];
    for (int i = 0; i < m; i++)
        cin >> a[i];
    
    // dp[i] -> max length of number possible using i sticks
    vector <int> dp(n + 1, -1);

    dp[0] = 0;
    for (int i = 1; i <= n; i++)
        for (int j = 0; j < m; j++)
            if (cost[a[j]] <= i)
                dp[i] = max(dp[i], dp[i - cost[a[j]]] + 1);
    
    sort(a, a + m);
    for (int i = 0, st = n; i < dp[n]; i++)
        for (int j = m - 1; j >= 0; j--)
            if (cost[a[j]] <= st)
                if (dp[st - cost[a[j]]] == dp[st] - 1) {
                    cout << a[j];
                    st -= cost[a[j]];
                    break;
                }
    cout << '\n';
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <fstream>
#include <string>
#include <math.h>
#include <cstdlib>
#include <istream>
#include <sstream>
#include <cctype>
#include <iomanip>
#define rep(i,N) for(int i=0;i<(int)N;++i)
//cout << fixed << setprecision(20) << *** << endl;
typedef long long ll;
using namespace std;
ll gcd(ll a,ll b){
	ll t;
	if(a<b){
		t=a;
		a=b;
		b=t;
	}
	if(a%b==0)return b;
	return gcd(b,a%b);
}
int main()
{
	ll A;
	long double B;
	cin>>A>>B;
	B=floor(B*(100+0.1));
	cout << fixed << setprecision(0) << floor(A*B/100) << endl;
}


Measured memory_bytes: 3244
#include <bits/stdc++.h>
#define hell 1000000007
#define fast ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define pb push_back
#define ll long long 
#define pi 3.1415926536
using namespace std;
const ll N=1e6;
void solve()
{ll n,k,h,x,y,z,w,a,b,c,d,mini,maxi=INT_MAX,prev;
 cin>>a>>b>>n;
 z=min(n,b-1);
 y=floor((double)(a*z)/(double)b);
 cout<<y;
}
  
int main()
{
  fast
  //for(ll i=0;i<=9;i++)
  //cal(1,3234566667,i);
  //sort(v.begin(),v.end());
  //pre();
ll t=1;
//cin>>t;
//SieveOfEratosthenes();
//cout<<"ok";
while(t--)
{ //cout<<"ok";

solve();
 //cout<<ma<<endl;
}
return 0;}
/*
ll pr(ll a,ll b,ll c)
{
	if(b==0)
	return 1LL;
	ll ans=1;
	while(b>0)
	{
		if(b%2)
		ans=((ans%c)*(a%c))%c;
		a=((a%c)*(a%c))%c;
		b/=2;
		a%=c;
		ans%=c;
	}
	return ans;
}
vector<ll> fact(N+1);
void pre()
{
	fact[0]=1;
	for(ll i=1;i<=N;i++)
	fact[i]=fact[i-1]*i,fact[i]%=hell;
	
}
*/

Measured memory_bytes: 3700
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
typedef long long int lli;
#define pb emplace_back
#define mp make_pair
#define pii pair<int,int>
#define INF 1000000000
#define fastio	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)

int a,b;

int main(){
    fastio;
    cin>>a>>b;
    if(a == b){
        cout<<a+b<<endl;
    }else if(a > b){
        cout<<a+a-1<<endl;
    }else{
        cout<<b+b-1<<endl;
    }  
    
    return 0;
}


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

int main() {
	int a, b;
	cin >> a >> b;
	if (a*b % 2 == 0) {
		cout << "No" << endl;
	}
	else {
		cout << "Yes" << endl;
	}
	return 0;
}

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

int main(){
    int n;
    cin >> n;
    
    int sum = 0;
    int maxp = 0;
    
    for (int i = 0; i < n; i++) {
        int buf;
        cin >> buf;
        sum += buf;
        maxp = max(maxp,buf);
    }
    
    cout << sum - maxp / 2 << endl;
    
    return 0;
}


Measured memory_bytes: 256
/* code by AbhiTaker
         ____
        /    \
       /  __  \              _______      __       _   _    _____    _____
      /  /  \  \            |__   __|    /  \     | | / /  |  ___|  |  _  |
     /  /____\  \     ___      | |      / /\ \    | |/ /   | |__    | |_| |
    /  /______\  \   |___|     | |     / /__\ \   |   /    |  __|   |    _|
   /  /        \  \            | |    / /----\ \  | |\ \   | |___   | |\ \
  /__/          \__\           |_|   /_/      \_\ |_| \_\  |_____|  |_| \_\
*/
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define M 1000000007
#define N 1000016
#define ff first.first
#define fs first.second
#define sf second.first
#define ss second.second
#define f first
#define s second
#define inf 9000000000000000000
pair<ll, pair<ll, ll> > p[N];

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    ll n,i;
    cin>>n;
    p[0] = {0, {0,0}};
    for(i=1; i<=n; i++)
        cin>>p[i].f>>p[i].sf>>p[i].ss;

    ll flag = 0;
    for(i=1; i<=n; i++)
    {
        ll t = p[i].f - p[i-1].f;
        ll dis = abs(p[i].sf - p[i-1].sf) + abs(p[i].ss - p[i-1].ss) ;
        if(dis>t)
        {
            flag = 1;
            break;
        }

        if( (dis%2==0 && t%2!=0) || (dis%2!=0 && t%2==0))
        {
            flag = 1;
            break;
        }

    }

    if(flag)
        cout<<"No\n";
    else
        cout<<"Yes\n";

    return 0;
}


Measured memory_bytes: 4352
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <map>
#include <unordered_map>

using namespace std;

int main() 
{
	int N, M;

	cin >> N >> M;

	int sum = N * (N - 1) / 2 + M * (M - 1) / 2;

	cout << sum << endl;
}

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

int main() {
  int A;
  string op;
  int B;
  int ans;
  cin>>A>>op>>B;
  if(op=="+"){
    ans=A+B;
  }
  if(op=="-"){
    ans=A-B;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 3632
from collections import Counter
from collections import deque
from functools import reduce
# from pprint import pprint
# import statistics
import bisect
import copy
import fractions
import math
import random
import sys
import time
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def MI(): return map(int, sys.stdin.readline().split())
def IS(): return input()

h, w = MI()
s = [IS() for _ in range(h)]
q = deque()
x_diff = [-1, 0, 1, 0]
y_diff = [0, 1, 0, -1]
require = [[0 for i in range(w)] for j in range(h)]
check = [[0 for i in range(w)] for j in range(h)]

all_grid = h * w
sharp_count = 0
for i in range(h):
    sharp_count += s[i].count('#')

q.append([0, 0])
check[0][0] = 1

while len(q) != 0:
    tmp_y, tmp_x = q.popleft()
    for i in range(4):
        next_y = tmp_y + y_diff[i]
        next_x = tmp_x + x_diff[i]
        if ( 0 <= next_x <= w-1
            and 0 <= next_y <= h-1
            and check[next_y][next_x] == 0
            and s[next_y][next_x] != '#'):
                check[next_y][next_x] = 1
                require[next_y][next_x] = require[tmp_y][tmp_x] + 1
                q.append([next_y, next_x])

hosuu = require[h-1][w-1]
# print(hosuu)
# require = [[str(require[j][i]).zfill(2) for i in range(w)] for j in range(h)]
# pprint(require, width=400)
if hosuu == 0:
    print(-1)
else:
    print(all_grid - sharp_count - hosuu -1)



Measured memory_bytes: 65900
/*********************************************JMD**********************************************/
//                                  |\  |     | |   |   /\                                   //
    //                              | \ |     | |---|  /--\                              //
        //                          |  \| |___| |   | /    \1999                     //
/*******************************************************************************************/
#include <bits/stdc++.h>
using namespace std;

typedef long long int ll;
typedef unsigned long long int ull;

#define mp make_pair
#define pb push_back
#define pf push_front
#define ss second
#define ff first
#define mem(x,val) memset(x,val,sizeof(x))
#define forr(i,a,b) for(ll i=a;i<b;i++)
#define f(i,n) forr(i,0,n)
#define sz(x) ll((x).size())
#define all(x) ((x).begin(),(x).end())
#define asc(x) ((int)(x))
#define precision(x) cout<<fixed<<setprecision((x));

const ll mod=998244353;
/*******************************************************************************************/

//container ostream...
inline void display(vector<ll> v)
{
    for(auto x:v) clog<<x<<"\n";
}

inline void display(vector<vector<ll> > v)
{
    for(auto x:v) for(auto xx:x) clog<<xx<<"\n";
}

//function to calculate a^b under mod...
ll powmod(ll a,ll b, ll modulo)
{
    if(b==0 || a==1) return 1;
    ll half=powmod(a,(b/2),modulo) % modulo;
    ll full = (half*half)%modulo;

    if(b%2) return (full*a)%modulo;
    return full%modulo;
}

//function to calculate inverse modulo under mod...assuming gcd is 1
ll invmod(ll a,ll modulo)
{
    ll check=powmod(a,modulo-2,modulo) %modulo;
    return check;
}

vector<ll> primes;
bool prime[10000001];

void sieve(int n=10000000)
{
    memset(prime, true, sizeof(prime));

    for (int p=2; p*p<=n; p++)
    {
        if (prime[p] == true)
        {
            for (int i=p*p; i<=n; i += p)
                prime[i] = false;
        }
    }
    for (int p=2; p<=n; p++)  if (prime[p]) primes.emplace_back(p);
}

/*******************************************************************************************/

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

    map<ll,ll> m;

    ll x;
    cin>>x;
    if(x)
    {
        cout<<"0\n";
        return;
    }

    f(i,n-1)
    {
        cin>>x;
        m[x]++;
    }

    ll ans=1;
    ll curr=1;

    for(auto x:m)
    {
        if(x.ff!=curr)
        {
            cout<<"0\n";
            return;
        }
        if(x.ff!=1)
        {
            ll v1=x.ss;
            ll v2=m[curr-1];
            ll val=powmod(v2,v1,mod);
            ans*=val;
            ans%=mod;
        }
        curr++;
    }
    cout<<ans<<"\n";
    return;
}

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

    ll t=1;
    //cin>>t;
    clock_t launch=clock();

    while(t--)
    {
        solve();
    }

    clog<<((long double)(clock()-launch)/CLOCKS_PER_SEC)<<"\n";
}


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

int main() {
  string a, b, c;
  cin >> a >> b >> c;
  
  char A = a.at(0);
  char B = b.at(0);
  char C = c.at(0);
  
  cout << A << B << C << endl;
}


Measured memory_bytes: 3600
import java.util.Scanner;

public class Main {

    private static Scanner scan;

    private static void start() {
        scan = new Scanner(java.lang.System.in);

    }

    private static void finish() {
    }

    public static void main(String[] args) {
        start();

        int n = scan.nextInt();
        int smallestValue = Integer.MAX_VALUE;
        int smallestPosition = Integer.MAX_VALUE;

        for (int i = 0; i < n; i++) {
            int rank = scan.nextInt();
            int value = scan.nextInt();
            if (smallestValue > value) {
                smallestValue = value;
                smallestPosition = rank;
            }
        }
        System.out.println(smallestPosition + smallestValue);


        finish();
    }
}


Measured memory_bytes: 62956