akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;

using ll = long long int;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()

#define pi 3.14159265358979323846

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 cnt_rep = 0;
ll powmod(ll N, ll P, ll M){
  cnt_rep++;
  if(P == 0) return 1;
  if(P%2 == 0){
    ll t = powmod(N, P/2, M);
    return t*t % M;
  }
  return (N * powmod(N, P-1, M)) % M;
}


ll gcd(ll a, ll b){
  ll resi, g, l;
  if(a > b){
    g = a; l = b;
  }else if(b > a){
    g = b; l = a;
  }else{
    return a;
  }
  resi = g % l;
  if(resi != 0){
    return gcd(l, resi);
  }else{
    return l;
  } 
}

template<typename T>
void remove(std::vector<T>& vector, unsigned int index)
{
    vector.erase(vector.begin() + index);
}

int ans = 0;
int N, M, Q;

template<typename T>
void showall(vector<T> v){
  rep(i, 0, v.size()){
    cout << v[i] << " ";
  }
  cout << endl;
}

template<typename T>
ll com(T n, T m, T mod){
  ll a = 1, b = 1, ans;
  if(n == m || m == 0){
    ans = 1;
  }else{
    for(ll i = 0;i < m; i++){
      a *= n-i;
      a %= mod;
      b *= i+1;
      b %= mod;
    }
    ans = (a * powmod(b, mod-2, mod)) % mod;
  }
  
  return ans;
}



 
int main() {
  long double A;
  long double B;

  cin >> A >> B;

  ll ans = ll(floor(A*B));

  cout << ans << endl;



}



Measured memory_bytes: 3732
#include<iostream>
#include<string>
#include<vector>
#include<math.h>
#include<map>
using namespace std;
    int main(void){
    string a,b;
    cin>>a>>b;
    if(a.size()>b.size()){
        cout<<"GREATER"<<endl;
    }
    else if(a.size()<b.size()){
        cout<<"LESS"<<endl;
    }
    else if(a>b){
        cout<<"GREATER"<<endl;
    }
    else if(a<b){
        cout<<"LESS"<<endl;
    }else{
        cout<<"EQUAL"<<endl;
    }
  
    return 0;
}

Measured memory_bytes: 256
#pragma warning(disable:4996)
#include <bits/stdc++.h>

using namespace std;

//macro
#define FOR(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define EPS (1e-8)
#define equals(a,b)(fabs((a)-(b))<EPS)

using ll = long long;
using ull = unsigned long long;
using vb = vector<bool>;
using vi = vector<int>;
using vll = vector<ll>;
using vs = vector<string>;
using vvb = vector<vb>;
using vvi = vector<vi>;
using vvll = vector<vll>;
//func
template<typename A, typename T>void assign2d(A&arr, ll H, ll W, T t) { arr.resize(H); REP(i, H) arr[i].assign(W, t); }
template<class T> ostream &operator<<(ostream &os, const vector<T> &v) { int n = v.size(); REP(i, n)os << v[i] << (i == n - 1 ? "" : " "); return os; }
template <class T = int> inline T IN() { T x; cin >> x; return x; }
template<class T> inline void OUT(const T &x) { cout << x << "\n"; }
void YESNO(bool c) { OUT(c ? "YES" : "NO"); };
void YesNo(bool c) { OUT(c ? "Yes" : "No"); };
struct pre_ { pre_() { cin.tie(nullptr); ios::sync_with_stdio(false); /*cout << fixed << setprecision(6);*/ } } pre__;

int main() {
	int N, M;
	cin >> N >> M;
	N--; M--;
	OUT(N*M);
}

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


int main(){
	int n, x, m, min_ = 10000;
    cin >> n >> x;
	for(int i=0;i<n;i++){
        cin >> m;
        x = x - m;
        min_ = min(min_, m);
    }

    cout << n + x / min_ << endl;
	
	return 0;
}


Measured memory_bytes: 256
H, W = gets.split.map(&:to_i)
c = Array.new(H)

H.times do |i|
  c[i] = gets.chomp.chars.map{|x|x == '#'}
end
# p c
# puts c.map{|x| x.map{|xx| format('%s ', xx.to_s) }.join }.join("\n")

stack1 = [] # [h,w]
stack2 = []

H.times do |h|
  W.times do |w|
    if c[h][w]
      stack1 << [h,w]
    end
  end
end

cnt = 0
while true
  until stack1.empty?
# p stack1
    s = stack1.pop
    h, w = s[0], s[1]

    if h + 1 < H && !c[h+1][w]
      stack2 << [h+1,w]
      c[h+1][w] = true
    end

    if 0 <= h - 1 && !c[h-1][w]
      stack2 << [h-1,w]
      c[h-1][w] = true
    end

    if w + 1 < W && !c[h][w+1]
      stack2 << [h,w+1]
      c[h][w+1] = true
    end

    if 0 <= w - 1 && !c[h][w-1]
      stack2 << [h,w-1]
      c[h][w-1] = true
    end

    # [
      # [h+1, w],
      # [h-1, w],
      # [h, w+1],
      # [h, w-1]
    # ].select{|(hh,ww)| 0 <= hh && hh < H && 0 <= ww && ww < W }.each do |h,w|
      # if !c[h][w]
        # stack2 << [h,w]
        # c[h][w] = true
      # end
    # end
  end

  if stack2.empty?
    break
  else
    cnt += 1
    stack2, stack1 = stack1, stack2
  end


  # until stack2.empty?
    # s = stack2.pop
    # h, w = s[0], s[1]
    # [
      # [h+1, w],
      # [h-1, w],
      # [h, w+1],
      # [h, w-1]
    # ].select{|(hh,ww)| 0 <= hh && hh < H && 0 <= ww && ww < W }.each do |h,w|
      # if !c[h][w]
        # stack1 << [h,w]
        # c[h][w] = true
      # end
    # end
  # end

  # if stack1.empty?
    # break
  # else
    # cnt += 1
  # end
end

p cnt


# puts c.map{|x| x.map{|xx| format('%s ', xx.to_s) }.join }.join("\n")








Measured memory_bytes: 61436
#include <cassert>
#include <cctype>
#include <cfloat>
#include <climits>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#if __cplusplus >= 201103L
#include <cfenv>
#include <cinttypes>
#include <cstdint>
#endif
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#if __cplusplus >= 201103L
#include <array>
#include <chrono>
#include <forward_list>
#include <initializer_list>
#include <random>
#include <ratio>
#include <regex>
#include <system_error>
#include <tuple>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
#if __cplusplus >= 201402L
#endif

#define rep(i,n) for(ll i = 0;i < n;++i)
#define all(v) v.begin(),v.end()
using namespace std;
using ll = long long;
typedef pair<int,int> P;

const int INF = 1001001001;
const long double PI = (acos(-1));
const int mod = 1e9+7;
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};

ll gcd(ll x,ll y){
    x = x%y;
    return x == 0 ? y : gcd(y,x);
}
ll lcm(ll x, ll y){
    return x*y/gcd(x,y);
}





int main(){
 
    string s,t;
    int ans = 0;
    int sum = 0;
    cin >> s >> t;
    rep(i,s.length()){
        rep(j,t.length()){
            if((s.length()-t.length() + 1) <= i) break;
            if(s[i + j] == t[j]){
                sum++;
            }

        }
        ans = max(ans,sum);
        sum = 0;
    }
    cout << t.length() - ans << endl;
    return 0;
}


Measured memory_bytes: 3164
#include <bits/stdc++.h>
#define REP(i,s,e) for(LL i=(s); i<(e);i++)
#define rep(i,n) REP(i,0,n)
#define rep1(i,n) REP(i,1,n)
#define repe(i,n) for(auto &&i:n)
#define all(v) (v).begin(),(v).end()
#define decimal fixed<<setprecision(20)
#define fastcin() cin.tie(0);ios::sync_with_stdio(false)
using namespace std;
using LL = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = 1e9;
const LL LLINF = 1e16;

int main(){
    LL a, b;
    cin >> a >> b;
    LL d = b - a;
    LL ans = 0;
    for(LL i=2; i<=b*2; i*=2){
        if(i == 2){
            ans += ((b+1)/2 - a/2)%2 ;
            // cout << ans << endl;
            continue;
        }
        LL tmp = 0;
        if(i <= d || b%i < a%i){
            tmp += i - max(a%i, i/2);
            tmp += max(0LL, b%i+1 - i/2);
        }else{
            tmp += max(0LL, b%i+1 - i/2) - max(0LL, a%i - i/2);
        }
        ans += (tmp%2) * (i/2);
        // cout << i << " " << ans << endl;
    }
    cout << ans << endl;

}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
using namespace std;
#ifndef FAST_IO
 #define IOS ios_base::sync_with_stdio(false);cin.tie(nullptr);
#endif
#define FILE_IO freopen("input.txt","r",stdin);
#define f first
#define int long long
#define s second
#define endl '\n'
#define all(c) c.begin(),c.end()
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template<typename T>void print(T t){for(auto &it:t)cout<<it<<" ";}
inline int powerexp(int a,int b,int m){int res=1;while(b){if(b&1)res=res*a%m;a=a*a%m,b>>=1;}return res%m;}
const int MAXN=1e5+1;
bool isprime[MAXN];
int v[MAXN];
void solve(){
    int x,t;
    cin>>x>>t;
    cout<<(t>x?"0":to_string(x-t))<<endl;
}
//-----------------------------
//comment from here for TOPCODER 
int32_t main(){
    IOS;
    solve();
    #ifdef LOCAL_DEFINE
    cerr<<"time elapsed "<<(double)clock()/CLOCKS_PER_SEC<<endl;
    #endif
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f
#include <cstdio>
#include <iostream>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>
 
using namespace std;
 
typedef long long ll;
typedef pair <int,int> P;
typedef pair <int,P > PP;
 
const static int tx[] = {0,1,0,-1};
const static int ty[] = {-1,0,1,0};

const static double EPS = 1e-8;

int stage[10][5];
bool marked[10][5];


void disp(int W,int H){
  for(int y = 0; y < H; y++){
    for(int x = 0; x < W; x++){
      printf("%d ",stage[y][x]);
    }
    printf("\n");
  }
  printf("\n");
}

bool mark(int W,int H){
  bool res = false;
  memset(marked,false,sizeof(marked));
  for(int sy = 0; sy < H; sy++){
    for(int sx = 0; sx < W; sx++){
      int count = 1;
      for(int x = sx; x + 1 < W; x++){
        if(stage[sy][x] != -1 
           && stage[sy][x] == stage[sy][x+1]){
          count++;
        }
        else {
          break;
        }
      }
      if(count >= 3){
        for(int x = sx; count > 0; x++,count--){
          marked[sy][x] = true;
          res = true;
        }
      }
    }
  }
  return res;
}

int compute_score(int W,int H){
  int freq[10] = {};
  for(int y = 0; y < H; y++){
    for(int x = 0; x < W; x++){
      if(marked[y][x]){
        freq[stage[y][x]]++;
      }
    }
  }

  int res = 0;
  for(int i = 1; i <= 9; i++){
    res += freq[i] * i;
  }
  return res;
}

void erase(int W,int H){
  int next[10][5];
  memset(next,-1,sizeof(next));

  for(int x = 0; x < W; x++){
    int pos = H - 1;
    for(int y = H - 1; y >= 0; y--){
      if(!marked[y][x]){
        next[pos][x] = stage[y][x];
        pos--;
      }
    }
  }
  memcpy(stage,next,sizeof(int)*10*5);
}

int main(){
  int H;
  const int W = 5;
  while(~scanf("%d",&H)){
    if(H == 0) break;
    memset(stage,-1,sizeof(stage));
    for(int y = 0; y < H; y++){
      for(int x = 0; x < W; x++){
        scanf("%d",&stage[y][x]);
      }
    }

    int res = 0;
    while(mark(W,H)){
      res += compute_score(W,H);
      erase(W,H);
    }
    printf("%d\n",res);
  }
}

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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;


int main() {
  ll n, a, b;
  cin>>n>>a>>b;

  ll val = 0;
  ll chk = n - (n/(a+b))*(a+b);
  if(a<chk) val = a;
  else val = chk;
  ll r = (n/(a+b))*a + val;
  cout<<r<<endl;
  
  

  return 0;
}


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

int main() {
    int n;
    cin >> n;
    set<int> ans;
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;
        ans.emplace(a);
    }
    
    cout << ans.size() << endl;
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using static System.Math;
 
public class Hello{
    public static void Main(){
        string[] input = ReadLine().Split(' ');
        int n = int.Parse(input[0]);
        int m = int.Parse(input[1]);
//        int b = int.Parse(input[2]);
//        string temp = ReadLine();
//        int a = int.Parse(ReadLine());
        if(n%3==0 || m%3==0 || (n+m)%3==0){
            WriteLine("Possible");
        }else{
            WriteLine("Impossible");
        }
    }
}

Measured memory_bytes: 11092
#include <iostream>
#include <string>

using namespace std;

int main() {
	string s;
	cin >> s;
	int tmp = 0;
	for (int i = 0; i < s.length() - 1; ++i) {
		for (int j = i + 1; j < s.length(); ++j) {
			if (s[i] == s[j]) {
				tmp++;
			}
		}
	}
	if (tmp == 2) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
}


Measured memory_bytes: 256
def check(m,d1,d10):
    if d1 < "2" or d10 < "2":
        return False
    if int(d1)*int(d10) == m:
        return True
    return False

M,D = map(int,input().split())
count = 0
for m in range(1,M+1):
    for d in range(1,D+1):
        d = str(d)
        if len(d) == 1:
            d = "0"+d
        if check(m,d[1],d[0]):
            count += 1
print(count)
    

Measured memory_bytes: 3060
ma = lambda :map(int,input().split())
lma = lambda :list(map(int,input().split()))
tma = lambda :tuple(map(int,input().split()))
ni = lambda:int(input())
yn = lambda fl:print("Yes") if fl else print("No")
ips = lambda:input().split()
import collections
import math
import itertools
import heapq as hq
import sys
n,c = ma()
INF=10**18
xv = []
for i in range(n):
    xv.append(lma())
xvr=xv[::-1]

ans=0
v1=0
v2=0
cost1=[0]*(n+1) #cost[i] ::iまで来た時の最大gain(戻る分を含む)
cost2=[0]*(n+1) #反時計回り
for i in range(n):
    v1 += xv[i][1]
    cost1[i]=max(v1-2*xv[i][0],cost1[i-1])
    v2+=xvr[i][1]
    cost2[i]=max(v2-2*(c-xvr[i][0]),cost2[i-1])
tmp=0
# print(cost1,cost2)
for i in range(n):
    tmp+=xv[i][1]
    #print(tmp,cost2[n-i-1])
    ans = max(ans, cost2[n-i-2] +tmp-xv[i][0] )
tmp=0
for i in range(n):
    tmp+=xvr[i][1]
    #print(tmp,cost1[n-i-1])
    ans = max(ans, cost1[n-i-2] +tmp-(c-xvr[i][0]) )

print(ans)


Measured memory_bytes: 92840
#include <iostream>

using namespace std;

int main(){
    int a, b, c, x, cnt;
    cin >> a >> b >> c >> x;
    cnt = 0;
    for(int i = 0; i <= a; i++){
        for(int j = 0; j <= b; j++){
            for(int k = 0; k <= c; k++){
                if(x == i * 500 + j * 100 + k * 50) cnt++;
            }
        }
    }
    cout << cnt << endl;
    return 0;
}


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

int main(){
    int t;
    cin>>t;
    for(int i=0;i<t;i++){
        int n,k,x[100000],a[100000],ans=0;
        cin>>n>>k;
        for (int j=0;j<n;j++){
            cin>>x[j];
        }
        for(int j=0;j<n-1;j++){
            a[j]=x[j+1]-x[j];
        }
        sort(a,a+n-1);
        for(int j=0;j<n-k;j++){
            ans+=a[j];
        }
        cout<<ans<<endl;
    }
}


Measured memory_bytes: 3788
#include<stdio.h>
#include<stdlib.h>

typedef struct{
  int id;
  int num;
  int par;
  int *c;
}Node
;

int dep(Node *A,int i){
  if(A[i].par!=-1){
    return dep(A, A[i].par)+1;
  }
  else{
    return 0;
  }
}

int main(){
  int n,i,j,id;
  Node *A;

  scanf("%d",&n);
  A=(Node *)malloc(sizeof(Node)*n);
  for(i=0;i<n;i++){
    A[i].par=-1;
  }
  for(i=0;i<n;i++){
    scanf("%d",&id);
    scanf("%d",&A[id].num);
    A[id].id=id;
    A[id].c=(int*)malloc(sizeof(int)*A[id].num);
    for(j=0;j<A[id].num;j++){
      scanf("%d",&A[id].c[j]);
      A[A[id].c[j]].par=A[id].id;
    }
  }



  
  for(i=0;i<n;i++){
    printf("node %d: parent = %d, depth = %d, ",A[i].id,A[i].par,dep(A,A[i].id));
    if(A[i].par==-1){
      printf("root, ");
    }
    else if(A[i].num==0){
      printf("leaf, ");
    }
    else  printf("internal node, ");

    printf("[");
    for(j=0;j<A[i].num;j++){
      if(j!=0){
	printf(", ");
      }
      printf("%d",A[i].c[j]);
    }
    printf("]\n");
  }


  
  return 0;
}



Measured memory_bytes: 7560
import sys
import math
from fractions import gcd
# import queue
# from collections import Counter
# from itertools import accumulate
# from functools import reduce

def lcm(a, b):
    return a * b // gcd(a, b)

def combination_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

big_prime = 1000000007

"""
# 標準入力取得
## 文字列
 =  sys.stdin.readline().rstrip()
 =  list(sys.stdin.readline().rstrip())

## 数値
 =  int(sys.stdin.readline())
 =  map(int, sys.stdin.readline().split())
 =  list(map(int, sys.stdin.readline().split()))
 =  [list(map(int,list(sys.stdin.readline().split()))) for i in range(N)]
"""
n=  int(sys.stdin.readline())
print(n**3)

Measured memory_bytes: 5588
#include<bits/stdc++.h>
using namespace std;
int main (){
  int K,A,B;
  cin >> K >> A >> B;
  for (int i = 1;i < 1001;i++){
  if (A <= K*i && K*i <= B){
  cout << "OK" << endl;
    break;
  }
    if (i == 1000){
    cout << "NG" << endl;
    }
  }
}


Measured memory_bytes: 3620
#![allow(unused_imports)]

use std::cmp;
use std::cmp::{max, min, Ordering};
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
use std::io::stdin;
use std::ops::*;
use std::process::exit;
use std::str::FromStr;


fn main() {
    let n: usize = input();
    let ss: Vec<String> = input_lines(n);
    let mut ss: Vec<Vec<char>> = ss.into_iter().map(|x| {
        let mut r = x.chars().collect::<Vec<_>>();
        r.sort();
        r
    }).collect();
    ss.sort();

    let mut ans = 0usize;
    let mut c = 1;
    for (s, t) in ss.windows(2).map(|x| (&x[0], &x[1])) {
        if s == t {
            c += 1;
        } else {
            ans += c * (c - 1) / 2;
            c = 1;
        }
    }
    ans += c * (c - 1) / 2;

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

pub fn input<T: FromStr>() -> T {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    buf.trim().parse().ok().unwrap()
}

pub fn input_vec<T: FromStr>() -> Vec<T> {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    buf.trim()
        .split_whitespace()
        .map(|x| x.parse().ok().unwrap())
        .collect::<Vec<_>>()
}

pub fn input_lines<T: FromStr>(l: usize) -> Vec<T> {
    let mut res = Vec::new();
    for _i in 0..l {
        res.push(input());
    }
    res
}

pub fn input_lines_two<T: FromStr, U: FromStr>(l: usize) -> Vec<(T, U)> {
    let mut res = Vec::new();
    for _i in 0..l {
        res.push(input_two());
    }
    res
}

pub fn input_lines_three<T: FromStr, U: FromStr, V: FromStr>(l: usize) -> Vec<(T, U, V)> {
    let mut res = Vec::new();
    for _i in 0..l {
        res.push(input_three());
    }
    res
}

pub fn input_two<T: FromStr, U: FromStr>() -> (T, U) {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    let s: Vec<&str> = buf.split_whitespace().collect();
    (
        s[0].parse::<T>().ok().unwrap(),
        s[1].parse::<U>().ok().unwrap(),
    )
}

pub fn input_three<T: FromStr, U: FromStr, V: FromStr>() -> (T, U, V) {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    let s: Vec<&str> = buf.split_whitespace().collect();
    (
        s[0].parse::<T>().ok().unwrap(),
        s[1].parse::<U>().ok().unwrap(),
        s[2].parse::<V>().ok().unwrap(),
    )
}

pub fn input_four<T: FromStr, U: FromStr, V: FromStr, W: FromStr>() -> (T, U, V, W) {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    let s: Vec<&str> = buf.split_whitespace().collect();
    (
        s[0].parse().ok().unwrap(),
        s[1].parse().ok().unwrap(),
        s[2].parse().ok().unwrap(),
        s[3].parse().ok().unwrap(),
    )
}


Measured memory_bytes: 18680
import core.bitop;
import std.algorithm;
import std.ascii;
import std.bigint;
import std.conv;
import std.functional;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.random;
import std.typecons;
import std.container;

alias sread = () => readln.chomp();
ulong bignum = 1_000_000_007;
alias SugarWater = Tuple!(long, "swater", long, "sugar");

T lread(T = long)()
{
    return readln.chomp.to!T();
}

T[] aryread(T = long)()
{
    return readln.split.to!(T[])();
}

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}

void main()
{
    auto n = lread();
    auto a = aryread();
    foreach (i; iota(1, n))
    {
        if (a[i - 1] <= a[i] - 1)
            a[i] -= 1;
    }
    bool check = true;
    foreach (i; iota(1, n))
        check &= a[i - 1] <= a[i];
    
    if(check)
        writeln("Yes");
    else
        writeln("No");
}

Measured memory_bytes: 4404
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; 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 rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;
//inline int in() { int x; scanf("%d",&x); return x;}
inline ll in() { ll x; cin >> x; return x; }
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("YES");}else{puts("NO");}
const int MX = 200005;

vector<int> to[2505];
vector<int> rto[2505];
bool reachablefrom1[2505];
bool reachableToN[2505];
bool ok[2505];

void dfs(int v) {
  if (reachablefrom1[v]) return;
  reachablefrom1[v] = true;
  for (int u : to[v]) {
    dfs(u);
  }
}
void rdfs(int v) {
  if (reachableToN[v]) return;
  reachableToN[v] = true;
  for (int u : rto[v]) {
    rdfs(u);
  }
}

int main() {
  int n = in();
  int ans = 0;
  int cnt = 0;
  int prev;
  int now = in();
  rep(i, n-1) {
    prev = now;
    now = in();
    if (prev >= now) cnt++;
    else cnt = 0;
    if (cnt > ans) ans = cnt;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; 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 rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#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 bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;

map<string,int> mp;
int main() {
  int n;
  cin >> n;
  rep(i,n){
    string s;
    cin >> s;
    mp[s]++;
  }
  //sort(mp.begin(),mp.end());
  int mx = 0;
  for(auto itr = mp.begin(); itr != mp.end(); ++itr) {
    maxs(mx,itr->second);
  }
  vector<string> v;
  for(auto itr = mp.begin(); itr != mp.end(); ++itr) {
    if(itr->second == mx){
      v.push_back(itr->first);
    }
  }
  sort(v.begin(),v.end());
  for(auto ans :v){
    cout<<ans<<endl;
  }
  return 0;
}

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

int main(){
    int s;
    cin >> s;
    
    bool flag = false;
    
    int a[100009];
    a[0] = s;

    for(int i = 1; i < 1000008; i++){
        if(a[i-1] %2 == 0){
            a[i] = a[i-1]/2;
        }else{
            a[i] = 3*a[i-1] + 1;
        }

        for(int j = 0; j < i; j++){
            if(a[j] == a[i]){
                cout << i+1 << endl;
                flag = true;
                break;
            }
        }

        if(flag){
            break;
        }
    }
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
const ll LINF=0x1fffffffffffffff;
const int INF=0x3fffffff;
const int MOD=1000000007;
#define VAR(type,...) type __VA_ARGS__;in(__VA_ARGS__)
#define VEC(type,name,size) vector<type> name(size);each(i, name)in(i)
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define rrep(i,a,b) for(int i=(a-1);i>=(b);--i)
#define each(i,v) for(auto &i:(v))
#define all(v) (v).begin(),(v).end()
#define print(...) out(__VA_ARGS__);cout<<endl
void in(){} template<class T,class... U> void in(T &t,U &...u){cin>>t;in(u...);}
void out(){} template<class T,class... U> void out(T t,U ...u){cout<<t<<" ";out(u...);}
void solve();
int main(){cin.tie(0);ios::sync_with_stdio(0);solve();}

ll gcd(ll a,ll b){while(a^=b^=a^=b%=a);return b;}

void solve() {
  VAR(int, K);
  ll ans = 0;
  rep(i, 1, K+1) {
    rep(j, 1, K+1) {
      rep(k, 1, K+1) {
        ans += gcd(gcd(i, j), k);
      }
    }
  }
  print(ans);
}


Measured memory_bytes: 3652
#include<iostream>
#include<set>
#include<vector>
#include<algorithm>


using namespace std;

typedef pair<int,char> P;

int main()
{
	int b,r,g,c,s,t;
	while(cin>>b>>r>>g>>c>>s>>t,b|r|g|c|s|t){
		int res=100;
		
		res+=77*b; t-=b*6;
		res+=51*r; t-=r*4;
		res+=4*g;  t-=g;
		res+=-1*c; t-=c;
		res+=0*s;  t-=s;
		
				
		res-=t*3;
		
		cout<<res<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
typedef vector<ll> vll;

#define INX(x) (cin >> x)
#define OUTX(x) (cout << x << endl)

#define ADD emplace_back
#define MP make_pair
#define VVEC(type) vector<vector<type>>


int main()
{
    ll N, M, K;
    cin >> N >> M >> K;

    ll aindex = 0;
    ll sum = 0;
    vll A(N+1), Asum(N+1);
    A[0] = Asum[0] = 0;
    for (ll i = 1; i <= N; i++)
    {
        cin >> A[i];
        //sum += A[i];
        sum = sum > LLONG_MAX - A[i] ? LLONG_MAX : sum + A[i];
        Asum[i] = sum;

        if(sum <= K)
        {
            aindex = i;
        }
    }
    
    ll bindex = 0;
    sum = 0;
    vll B(M+1), Bsum(M+1);
    B[0] = Bsum[0] = 0;
    for (ll i = 1; i <= M; i++)
    {
        cin >> B[i];
        //sum += B[i];
        sum = sum > LLONG_MAX - B[i] ? LLONG_MAX : sum + B[i];
        Bsum[i] = sum;

        if(sum <= K)
        {
            bindex = i;
        }
    }


    ll result = 0;
    for (ll i = 0, j = bindex; i <= aindex; i++)
    {
        for(; j >= 0; j--)
        {
            //ll sum = Asum[i] + Bsum[j];
            ll sum = Bsum[j] > LLONG_MAX - Asum[i] ? LLONG_MAX : Asum[i] + Bsum[j];
            if(sum <= K)
            {
                ll tmpresult = i + j;
                if(tmpresult > result)
                {
                    result = tmpresult;
                }
                break;
            }
        }
    }
    OUTX(result);


    return 0;
}


Measured memory_bytes: 9568
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author aakas
 */
import java.util.*;
public class Main{
    static long mod1 = 1000000007;
    static int m,n;
    static char[][] grid;
    static boolean v[][];
    static long[][] dp;
    public static void main(String args[])
    {
        Scanner sc = new Scanner(System.in);
        m = sc.nextInt();
        n = sc.nextInt();
        grid = new char[m][n];
        v = new boolean[m][n];
        dp = new long[m][n];
        for(int i=0;i<m;i++)
        {
            String temp = sc.next();
            for(int j=0;j<n;j++)
            {
                grid[i][j] = temp.charAt(j);
            }
        }
        System.out.println(s(0,0));
    }
    public static long s(int i,int j)
    {
        if(i>m-1)
            return 0;
        if(j>n-1)
            return 0;
        if(i==m-1 && j==n-1)
            return 1;
        if(grid[i][j]=='#')
            return 0;
        if(v[i][j])
            return dp[i][j];
        v[i][j] = true;
        return dp[i][j] = (s(i+1,j) + s(i,j+1))%mod1; 
    }
}


Measured memory_bytes: 53936
#include <bits/stdc++.h>
using namespace std;
#define maxN 1000001
#define mod 1000000007
#define maxLL 1000000000000000000
#define PI 3.14159265358979323846264338327950L
typedef long long ll;

//how to search mid = l+(r-l/2)

bool compared(int a,int b){
	return a < b;
}

int cmp(const void *a,const void *b){
	return(*(int*)b - *(int*)a);
}

int GCD(int a,int b){
	return b?GCD(b,a%b):a;
}

int LCM(int a,int b){
	return a/__gcd(a,b)*b;
}

int main(){
//	freopen("input.txt","r",stdin);
//    freopen("output.txt","w",stdout);
	int n;
	cin>>n;
	n = n%1000;
	if(n == 0){
		cout<<n<<endl;
	}
	else{
		n = (1000 - n);
		cout<<n<<endl;
	}
	return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <string>

using namespace std;

int main(){
	string a;
	long long int alp[26];
	long long int ans=1;
	long long int length;

	for(int i=0; i<26; i++)
		alp[i]=0;

	cin>> a;
	length= a.size();

	for(int i=0; i<length; i++){
		int num= a.at(i)-'a';
		alp[num]++;
	}

	ans+= length* (length-1) /2;

	for(int i=0; i<26; i++){
		ans-= alp[i] * (alp[i]-1) /2;
	}

	cout<<ans<<endl;
	
}

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

#define REP(i ,n) for(int i=0 ;i < n; i++)
#define REPB(i ,n) for(int i=n; i >= 0; i--)
#define FOR(i ,m ,n) for(int i=m; i < n; i++)
#define FORB(i, m, n) for(int i=m; i>= m; i--)
#define ll long long
#define pb push_back
#define popb pop_back
using namespace std;

int main(){
  int r;
  cin >> r;
  if(r < 1200){
      cout << "ABC" << endl;
    }else if(r < 2800){
      cout << "ARC" << endl;
      }else{
        cout << "AGC" << endl;
        }
        return 0;
}


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

long long N, X[1009], Y[1009], H[1009]; 
vector<tuple<long long, long long, long long>>vec;

int main() {
	cin >> N; 
  tuple<long long, long long, long long>G = make_tuple(-1, -1, -1);
	for (int i = 1; i <= N; i++) {
		cin >> X[i] >> Y[i] >> H[i];
		if (H[i] >= 1) G = make_tuple(X[i], Y[i], H[i]);
	}
	for (int i = 0; i <= 100; i++) {
		for (int j = 0; j <= 100; j++) {
			long long V = get<2>(G) + abs(get<0>(G) - i) + abs(get<1>(G) - j); 
      V = max(V, 0LL); 
      bool flag = true;
			for (int k = 1; k <= N; k++) {
				long long VV = V - abs(X[k] - i) - abs(Y[k] - j); VV = max(VV, 0LL);
				if (H[k] != VV) flag = false;
			}
			if (flag == true) vec.push_back(make_tuple(i, j, V));
		}
	}
	if (vec.size() == 1) {
		cout << get<0>(vec[0]) << " " << get<1>(vec[0]) << " " << get<2>(vec[0]) << endl;
	}
	return 0;
}


Measured memory_bytes: 3612
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main(void){
    // Your code here!
    int i=0,j=0;
    string a;
    string s,f;
    cin>>a;
    while(cin>>s){
        std::transform(s.begin(), s.end(), s.begin(), ::tolower);
        if(s.find(a)==-1){
            
        }else if(s.find(a)==0&&s.size()==a.size()){
            j++;
            
        }
    }
    
    cout<<j<<endl;
}



Measured memory_bytes: 3172
#include<stdio.h>
int main()
{
	int a,b,n;
	int s,f,i;
	scanf("%d%d%d",&a,&b,&n);
	for(i=0;i<n;i++){
		scanf("%d%d",&s,&f);
		if(a<f&&b>s){
			printf("1\n");
			return 0;
		}
	}
	printf("0\n");
	return 0;
}



Measured memory_bytes: 2688
#include<bits/stdc++.h>
#include<boost/variant.hpp>
using namespace std;
typedef long long ll;
typedef vector<boost::variant<bool, ll, int, string, double, char*, const char*>> any;
template<typename T> inline void pr(const vector<T> &xs){
	for(int i=0; i<xs.size()-1; i++) cout<<xs[i]<<" ";
	(xs.empty()?cout:(cout<<xs[xs.size()-1]))<<endl;
}
#ifdef DEBUG
#define debug(...) pr(any{__VA_ARGS__})
#define debugv(x) pr((x))
#else
#define debug(...)
#define debugv(x)
#endif

int main(){
	int A, B;
	cin >> A >> B;

	for(int x=1; x<100000; x++){
		if(floor(0.08*x)==A && floor(0.1*x)==B){
			cout << x << endl;
			return 0;
		}
	}
	cout << -1 << endl;

	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<stack>
#include<stdlib.h>

using namespace std;

int cnt[100005];

int main(){
    long long ans=0;
    long long n,b,c,q;
    cin>>n;
    for(int i=0;i<n;++i){
        int tmp;
        cin>>tmp;
        cnt[tmp]++;
        ans+=tmp;
    }
    cin>>q;
    for(int i=0;i<q;++i){
        cin>>b>>c;
        long long num = cnt[b];
        cnt[c]+=cnt[b];
        cnt[b]=0;
        ans=ans+(c-b)*num;
        cout<<ans<<endl;
    }
    return 0;
}

Measured memory_bytes: 3956
#include <iostream>

int A[20];
int m[200];

bool Solve(int i, int m, int n)
{
    if (m == 0) {
        return true;
    }
    if (i >= n) {
        return false;
    }
    bool res = Solve(i+1, m, n) || Solve(i+1, m - A[i], n);
    return res;
}


int main(int argc, char *argv[])
{
    int n, q, i, j;
    bool is_sum_equal_flag = false;

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

    scanf("%d", &q);
    for (i = 0; i < q; i++) {
        scanf("%d", &m[i]);
        if (Solve(0, m[i], n)) {
            fprintf(stdout, "yes\n");
        } else {
            fprintf(stdout, "no\n");
        }
    }

    return 0;
}


Measured memory_bytes: 3160
#include<iostream>
using namespace std;
int main(){
long n,w,p,pp[152],i,j,k;
for(i=0;i<=151;i++)pp[i]=27350;
for(i=0;i<=25;i++){
for(j=0;j<=17;j++){
for(k=0;k<=10;k++){
w=i*2+j*3+k*5;
p=(i/5*5)*380*0.8+(i%5)*380+(j/4*4)*550*0.85+(j%4)*550+(k/3*3)*850*0.88+(k%3)*850;
if(pp[w]>p)pp[w]=p;
}
}
}
while(cin>>n){
if(n==0)break;
cout<<pp[n/100]<<endl;
}
return 0;
}

Measured memory_bytes: 1160
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<tuple>
#include<map>
#include<bitset>
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;

int main(){
  
  int A;
  cin >> A;
  int a = A / 1000;
  A %= 1000;
  const int n = 3;
  vi vec(n);
  int b = 100;
  for (int i=0; i<n; i++){
    vec.at(i) = A / b;
    A %= b;
    b /= 10;
  }

  bitset<n> s2;
  for (int tmp=0; tmp<(1<<n); tmp++){
    bitset<n> s(tmp);

    int sum = a;
    for (int i=0; i<n; i++){
      if (s.test(i)){
        sum += vec.at(i);
      }
      else {
        sum -= vec.at(i);
      }
    }

    if (sum == 7){
      s2 = s;
      break;
    }
  }

  cout << a;
  for (int i=0; i<n; i++){
    if (s2.test(i)){
      cout << "+";
    }
    else {
      cout << "-";
    }
    cout << vec.at(i);
  }
  cout << "=7" << endl;
}


Measured memory_bytes: 3604
#include<stdio.h>
int main()
{
int a,b;
scanf("%d %d",&a,&b);
if(a==0||b==0)
{
printf("Even");
}
else if(a%2==0||b%2==0)
{
 printf("Even");
}
else
{
printf("Odd");
}
return 0;
}


Measured memory_bytes: 128
#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>;
const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};



struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
};
int main() {
    int n; cin >> n;
    vector<mint> a(n);
    vector<mint> s(n+1);
    s[0] = 0;
    rep(i, n) {
        int x; cin >> x;
        a[i] = x;
        s[i+1] = s[i] + a[i];
    }
    mint ans = 0;
    rep(i, n-1) {
        ans += a[i] * (s[n] - s[i+1]);
    }
    cout << ans.x << endl;
}


Measured memory_bytes: 6420
d = []
s = input()
n = len(s)
ans = 0
for i in range(n):
    if len(d) > 0:
        if d[-1] != s[i]:
            d.pop()
            ans += 1
        else:
            d.append(s[i])
    else:
        d.append(s[i])

print(ans*2)


Measured memory_bytes: 3956
N=int(input())
A=[[int(i) for i in input().split()] for i in range(N)]
ans=0
for i in range(N):
    for j in range(i+1,N):
        flag=True
        for k in range(N):
            if j==k or i==k:
                continue
            if A[i][j]>A[i][k]+A[k][j]:
                print(-1)
                exit()
            if A[i][j]==A[i][k]+A[k][j]:
                flag=False
        if flag:
            ans+=A[i][j]
print(ans)


Measured memory_bytes: 44636
#include<bits/stdc++.h>
#define ll long long
#define llu unsigned long long
#define pb push_back
#define f(n) for(ll i=0;i<n;i++)
#define ina for(ll i=0;i<n;i++)cin>>a[i];
#define all(v) v.begin(),v.end()
#define YES printf("YES\n")
#define NO printf("NO\n")
#define fastio std::ios_base:: sync_with_stdio(false); cin.tie(0); cout.tie(0);
using namespace std;
//long long bigmod/* (a^p)%m */ ( long long a, long long p, long long m ){long long res = 1;long long x = a;while ( p ){if ( p & 1 ){res = ( res * x ) % m;}x = ( x * x ) % m;p = p >> 1;}return res;}
//ll modInverse(ll a, ll m) { ll m0 = m; ll y = 0, x = 1; if (m == 1) return 0; while (a > 1) { ll q = a / m; ll t = m; m = a % m, a = t; t = y; y = x - q * y; x = t; } if (x < 0) x += m0; return x; }
//call manipulated_seive(N) and get prime in prime vector
//const long long MAX_SIZE = 1000001; vector<long long >isprime(MAX_SIZE , true); vector<long long >prime; vector<long long >SPF(MAX_SIZE); void manipulated_seive(int N) { isprime[0] = isprime[1] = false ; for (long long int i=2; i<N ; i++) { if (isprime[i]) { prime.push_back(i); SPF[i] = i; } for (long long int j=0; j < (int)prime.size() && i*prime[j] < N && prime[j] <= SPF[i]; j++) { isprime[i*prime[j]]=false; SPF[i*prime[j]] = prime[j] ; } } }
//ll phi[5000001];bool mark[5000001];void sievephi(ll n){ll i,j;for(ll i=1;i<=n;i++) phi[i]=i;mark[1]=true;for(ll i=2;i<=n;i++)if(!mark[i]){for(ll j=i;j<=n;j+=i){mark[j]=true;phi[j]=phi[j]/i*(i-1);}}}

/*speedup
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
*/
// vule geli coilbi na dada cout << fixed << setprecision(6) << pi <<" "<<npi<<endl;
//Pattern? OEIS
// prime factorize?? think about 2


vector<int>v;
int a[200003];

int main()
{
    fastio;

        ll t; cin>>t;
        cout<<!t<<endl;
    return 0;
}




Measured memory_bytes: 3596
import sys

sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inl = lambda: [int(x) for x in sys.stdin.readline().split()]
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw))


def solve():
    s = ins()
    if s == "RRR":
        return 3
    if "RR" in s:
        return 2
    if "R" in s:
        return 1
    return 0


print(solve())


Measured memory_bytes: 9120
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef int ll;
typedef long double ld;
const ll N = 2000005;
char en = '\n';
ll inf = 1e16;
ll mod = 998244353;
ll power(ll x, ll n, ll mod) {
  ll res = 1;
  x %= mod;
  while (n) {
    if (n & 1)
      res = (res * x) % mod;
    x = (x * x) % mod;
    n >>= 1;
  }
  return res;
}
ll pre[N];

bool prime[N];

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

  ll r;
  cin >> r;
  cout << r * r << en;

  return 0;
}

/*
5
1 2 3 1 2
1
1 5
 */

Measured memory_bytes: 256
#include<iostream>
#include<cstring>

using namespace std;

int main(void) {
  int n;
  cin >> n;
  if (n == 1) {
    cout << 1 << endl;
    return 0;
  }
  int c[n];
  int color_max = 0;
  for (int i = 0; i < n; i++) {
    cin >> c[i];
    if (c[i] > color_max) color_max = c[i];
    if (i > 0 && c[i-1] == c[i]) {
      i--;
      n--;
    }
  }
  int dp[color_max + 1];
  memset(dp, 0, sizeof dp);
  dp[0] = 1;
  dp[c[n-1]] = 1;
  for (int i = n - 2; i >= 0; i--) {
    int tmp = (dp[c[i]] + dp[0]) % 1000000007;
    dp[0] = tmp;
    dp[c[i]] = tmp;
  }
  cout << dp[0] << endl;
  return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
const ll MOD=10000;
const ll INF=1000000000;
const int MAX=100001;
const double EPS=1e-10;
using namespace std;
struct BIT{
    vector<ll>bit;
    int n=1;
    void init(ll m){
        while(n<m){
            n*=2;
        }
        bit.resize(n+1);
    }
    int sum(ll i){
        ll s=0;
        while(i>0){
            s+=bit[i];
            i-=i&-i;
        }
        return s;
    }
    void add(ll i,ll x){
        while(i<=n){
            bit[i]+=x;
            i+=i&-i;
        }
    }
};
ll b[200010];
map<ll,ll> m;
void compress(ll n){
    vector<ll> v;
    for(int i=0;i<=n;i++){
        v.push_back(b[i]);
    }
    sort(v.begin(),v.end());
    for(ll i=0;i<(ll)v.size();i++){
        m[v[i]]=i+1;
    }
}
int main() {
    int n;ll k;ll a[200010];
    cin>>n>>k;
    ll sum=0;
    b[0]=0;
    for(ll i=1;i<=n;i++){
        scanf("%lld",&a[i]);
        sum+=a[i];
        b[i]=sum-i*k;
    }
    compress(n);
    BIT bit;
    bit.init(n+1);
    ll ans=0;
    for(int i=0;i<=n;i++){
        ll x=m[b[i]];
        ans+=bit.sum(x);
        bit.add(x,1);
    }
    cout<<ans<<endl;
    
}








Measured memory_bytes: 18004
#include<stdio.h>
int main(void){
    int n;

    for(;;){
    scanf("%d",&n);
    if(n==0)break;

    int a[100][100] = {0};

    int w,y,x,z=1;

    int i,j,k;

    //for(i=n-1;i<1000;i++)



        for(i=n/2+1,j=n/2;j<1000;i++,j++,z++){

            if(i==n)i=0;
            if(i==n+1)i=1;

            if(j==n)j=0;







            if(a[i][j]!=0)i++,j--;
            if(i==n)i=0;
            if(i==n+1)i=1;

            if(j==n)j=0;
            if(j==-1)j=n-1;
            if(a[i][j]!=0){
                i=10000;
                j=10000;
                }





            else a[i][j]=z;


        }


    //printf("%d",a[n/2+1][0]);
    for(x=0;x<n;x++){
       // if(x!=0)printf("\n");
        for(y=0;y<n;y++){
            printf("%4d",a[x][y]);
        }
    printf("\n");
    }


    }
    return 0;
}

Measured memory_bytes: 660
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using i64 = int64_t;
using vi = vector<i64>;
using vvi = vector<vi>;
constexpr i64 MOD = 1e9 + 7;
 
int main() {
  string s;
  cin >> s;
  int N = s.size();
  int D;
  cin >> D;
  vector<vvi> dp(N + 1, vvi(2, vi(D)));
  dp[0][0][0] = 1;
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < 2; j++) {
      for (int k = 0; k < D; k++) {
        for (int d = 0; d <= (j ? 9 : s[i] - '0'); d++) {
          (dp[i + 1][j | (d < s[i] - '0')][(k + d) % D] += dp[i][j][k]) %= MOD;
        }
      }
    }
  }
  cout << (dp[N][0][0] + dp[N][1][0] - 1 + MOD) % MOD << endl;
}

Measured memory_bytes: 17024
#include <bits/stdc++.h>
#define pb push_back
#define ff first
#define ss second
#define assign(x,val) memset(x,val,sizeof(x))
#define motherfucker  ios_base::sync_with_stdio(false); cin.tie(NULL);
#define all(x) (x).begin(), (x).end()
#define for0(i,n) for(ll i=0;i<n;++i)
#define for1(i,n) for(ll i=1;i<=n;++i)
#define ford(i,n) for(ll i=n;i>=1;--i)
#define forg(i,a,b) for(ll i=a;i<b;++i)
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpi;
typedef pair<ll, ll> pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pll> vpl;
long long mod = 1000000007;
const long double PI = (long double)(3.1415926535897932384626433832795);
 
 
void solve(){
	int n;cin>>n;
	ll sum = 0;
	vector<pair<string, int>>v(n);
	for0(i,n) cin>>v[i].ff>>v[i].ss;
	string t;cin>>t;
	bool go = false;
	for0(i,n){
		if(go) sum += v[i].ss;
		if(v[i].ff==t) go = true;
	}
	cout<<sum<<endl;
}
 
int main(){
	
	motherfucker
	ll t = 1;
	//cin>>t;
	for0(i, t){
		solve();
	}
	return 0;
}

Measured memory_bytes: 256
#include <bitset>
#include <iostream>
using namespace std;
int main(){
    bitset<32> a,b;
    long long int n;
    cin>>n;
    a=n;
    cin>>n;
    b=n;
    cout<<(a&b)<<endl<<(a|b)<<endl<<(a^b)<<endl;
}


Measured memory_bytes: 3152
#include<map>
#include<set>
#include<queue>
#include<cmath>
#include<cstdio>
#include<vector>
#include<string>
#include<cstring>
#include<iostream>
#include<algorithm>
#define lc (x<<1)
#define rc (x<<1|1)
#define gc getchar()//(p1==p2&&(p2=(p1=buf)+fread(buf,1,size,stdin),p1==p2)?EOF:*p1++)
#define mk make_pair
#define pi pair<int,int>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int N=2e5+10,size=1<<20;

//char buf[size],*p1=buf,*p2=buf;
template<class o> void qr(o &x) {
	char c=gc; x=0; int f=1;
	while(!isdigit(c)){if(c=='-')f=-1; c=gc;}
	while(isdigit(c)) x=x*10+c-'0',c=gc;
	x*=f;
}
template<class o> void qw(o x) {
	if(x/10) qw(x/10);
	putchar(x%10+'0');
}
template<class o> void pr1(o x) {
	if(x<0)x=-x,putchar('-');
	qw(x); putchar(' ');
}
template<class o> void pr2(o x) {
	if(x<0)x=-x,putchar('-');
	qw(x); puts("");
}

int n,m,q,a[N],b[N],c[N],d[N],w[N],ans;

void dfs(int x,int i) {
	if(x>n) {
		int s=0;
		for(int i=1;i<=q;i++)
			s+=d[i]*(w[b[i]]-w[a[i]]==c[i]);
		ans=max(ans,s);
		return ;
	}
	for(	;i<=m;i++) w[x]=i,dfs(x+1,i);
}


int main() {
	qr(n); qr(m); qr(q);
	for(int i=1;i<=q;i++) qr(a[i]),qr(b[i]),qr(c[i]),qr(d[i]);
	dfs(1,1);
	pr2(ans);
	return 0;
}



Measured memory_bytes: 3652