akhauriyash/Code-Regression huggingface dataset:
/* Great things never come from comfort zones,
"whatever the mind of a man can conceive and believe,it can achieve." */
 
#include <bits/stdc++.h>
#define ll long long
#define scf(n) scanf("%d",&n)
#define lscf(n) scanf("%lld",&n)
#define lpri(n) printf("%lld ",n)
#define pri(n) printf("%d ",(int)n)
#define prin(n) printf("%d\n",(int)n)
#define lprin(n) printf("%lld\n",n)
#define rep(i,ini,n) for(int i=ini;i<(int)n;i++)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define inf INT_MAX
#define ninf INT_MIN
#define gcd __gcd
#define bitcount(n) __builtin_popcount(n)
using namespace std;
const ll mod =1e9+7;
const int N = 1e6+7;
 
 
int main()
{

      string s;
      cin>>s;

      ll ctr=0;

      int n=s.size();
      
      vector<int>v(2019,0);

      v[s[0]-'0']=1;

      rep(i,1,n)
      {
        int d=s[i]-'0';

        vector<int>a(2019,0);

        a[d]=1;

        rep(j,0,2019)
        {
          if(v[j]>0)
          {
            ll r=(10*j+d)%2019;

            if(r==0)
            ctr+=v[j];

            a[r]+=v[j];
          }

        }

        rep(i,0,2019)
        v[i]=a[i];

      
      }

      lprin(ctr);
      
}
 


Measured memory_bytes: 3808
#include <iostream>
#include <vector>
#include <set>
#include <string>
#include <algorithm>
#include <math.h>
typedef long long ll;
using namespace std;

int main()
{
	string a,b,c;
	cin >> a >> b >>c;
	cout << a[0] << b[1] << c[2];
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A, B, plus, minus, multipl;
  cin >> A >> B;
  
  plus = A + B;
  minus = A - B;
  multipl = A * B;
  
  if (plus > minus && plus > multipl) {
    cout << plus << endl;
  } else if (minus > multipl) {
    cout << minus << endl;
  } else {
    cout << multipl << endl;
  }
}

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


int main()
{
    map<string , int> blue , red;
    int n;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        string s;
        cin>>s;
        blue[s]++;
    }
    int m;
    cin>>m;
    for(int i=0;i<m;i++)
    {
        string s;
        cin>>s;
        red[s]++;
    }

    int ans =0;
    map<string ,int>::iterator  it = blue.begin();
    while( it!= blue.end())
    {
        string temp = it->first;
        int temp2 = it->second;

        ans = max( ans , temp2 - red[temp] );
        it++;
    }
    cout<<ans;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
int main()
{
    ios::sync_with_stdio(0);
	int k;
	string s;
	cin>>k>>s;
	if(s.size()<=k)cout<<s;
	else{
		for(int i=0;i<k;i++)
		cout<<s[i];
		cout<<"...";
	}
    return 0;
}


Measured memory_bytes: 3612
import java.util.Scanner;
import java.util.HashSet;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        HashSet<String> hs = new HashSet<String>();

        for (int i = 0; i < n; i++) {
            String cmd = sc.next();
            String input = sc.next();

            if (cmd.equals("insert")) {
                hs.add(input);
            } else if(cmd.equals("find")) {
                if (hs.contains(input)) {
                    System.out.println("yes");
                } else {
                    System.out.println("no");
                }
            }
        }
    }
}


Measured memory_bytes: 253560
#include <bits/stdc++.h>
using namespace std;
int main() {
    string s; cin >> s;
    string t;
    for(int i = 0; i < 4; i++) t += s.at(i);
    for(int i = 5; i < 7; i++) t += s.at(i);
    for(int i = 8; i < 10; i++) t += s.at(i);
    
    cout << (stoi(t)>20190430 ? "TBD" : "Heisei") << endl;
}


Measured memory_bytes: 256
A = int(input())

count =  0

if A<10:
    count= A
elif A <100:
    count = 9 
elif A < 1000:
    count = 9 + A - 99
elif A < 10000:
    count = 9 + 900
elif A < 100000:
    count = 9 + 900 + (A-9999)
else:
    count = 90909
    

print(count)


Measured memory_bytes: 2940
#include<bits/stdc++.h>
#pragma GCC optimize("O2")
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define all(c) c.begin(), c.end()
#define endl "\n"
#define sz(u) (int)(u.size())
#define L(x)(2*x)
#define R(x)(2*x+1)
#define M(x,y)((x+y)/2)
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
void solve(){
    int a,b,c,k;
    cin>>a>>b>>c>>k;
    ll sum=0;
    while(k>0){
        if(a>0){
            a--;
            sum++;
        }
        else if(b>0){
            b--;
        }
        else{
            c--;
            sum--;
        }
        k--;
    }
    cout<<sum;
}
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    //int t;
    //cin>>t;
    //while(t--){
        solve();
        //cout<<endl;
    //}
}



Measured memory_bytes: 3648
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
a1 = a[1]-a[0]
a2 = a[2]-a[1]
b1 = b[1]-b[0]
b2 = b[2]-b[1]
c1 = c[1]-c[0]
c2 = c[2]-c[1]
if (a1==b1) and (b1==c1) and (a2==b2) and (b2==c2):
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3064
#include <algorithm>
#include <assert.h>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <queue>
#include <stack>
#include <bitset>
#include <functional>
#include <numeric>

using namespace std;
using lint = int64_t;
using P = pair<int, int>;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep1(i, n) for (int i = 1; i < (n); ++i)
#define repn(i, a, b) for(int i = (a); i < (b); ++i)
#define rep_inv(i, n) for (int i = (n); i >= 0; --i)
#define all(vec) vec.begin(), vec.end()
#define cend printf("\n")

//constexpr lint mod = 998'244'353LL;
constexpr lint Mod = 1000'000'007LL;
constexpr lint Inf = 4'500'000'000'000'000'007LL; //4.5e18+7
constexpr double Pi = 3.141592653589793;

template<class T> using prique     = priority_queue<T>;
template<class T> using prique_inv = priority_queue<T, vector<T>, greater<T>>;
template<class T, class U>inline istream& operator>>(istream& is, pair<T, U>& rhs) { return is >> rhs.first >> rhs.second; }
template<class T, class U>inline ostream& operator<<(ostream& os, const pair<T, U>& rhs) { return os << "(" << rhs.first << ", " << rhs.second << ")"; }
template<class InputIterator> void arrin(InputIterator first, InputIterator last) { for (; first != last; ++first) cin >> (*first); }
template<class InputIterator> void arrout(InputIterator first, InputIterator last) {
	for (; first != last; ++first) {
		cout << (*first) << ((first + 1) != last ? " " : "\n");
	}
}

void print(string a, string b, bool f) { cout << (f ? a : b) << endl; }

bool pri(lint x) { 
	for (lint i = 2; i * i <= x; ++i) {
		if (x % i == 0) return false;
	}
	return 1 < x; 
}

lint fact[3000000];
void fact_init(lint n, lint m = Mod) {
	if (3000000 <= n) return;
	fact[0] = fact[1] = 1;
	for (lint i = 2; i <= n; ++i) {
		fact[i] = i * fact[i - 1] % m;
	}
}

lint modpow(lint x, lint n, lint m = Mod) {
	lint res = 1;
	while (n > 0) {
		if (n & 1) res = res * x % m;
		x = x * x % m;
		n >>= 1;
	}
	return res;
}

lint intpow(lint x, lint n) {
	lint res = 1;
	while (n > 0) {
		if (n & 1) res *= x;
		x *= x;
		n >>= 1;
	}
	return res;
}

lint comb(lint n, lint r, lint m = Mod) {
	if (r == 0 || r == n) return 1;
	lint res = fact[n] * modpow(fact[n - r], m - 2, m) % m * modpow(fact[r], m - 2, m) % m;
	return res < 0 ? res + m : res;
}

map<lint, lint> factring(lint n) {
	map<lint, lint> res;
	for (lint i = 2; i * i <= n; ++i) {
		while (n % i == 0) {
			n /= i;
			++res[i];
		}
	}
	if (n != 1) ++res[n];
	return res;
}

int main() {
	int n, x, t;
	cin >> n >> x >> t;
	cout << t * ((n + x - 1) / x) << endl;
}

Measured memory_bytes: 3628
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;
int main() {
	int n, k;
	cin >> n >> k;
	vector<int> t(n);
	int sum = n;
	for (int i = 0; i < n; i++) {
		cin >> t[i];
	}
	vector<int > b(n - 1);
	for (int i = 0; i < n-1; i++) {
		b[i] = t[i + 1] - t[i]-1;
	}
	sort(b.begin(), b.end());
	for (int i = 0; i < n - k; i++) {
		sum += b[i];
	}
	cout << sum << endl;
}


Measured memory_bytes: 3620
#include<iostream>
#include<string>
#include<vector>
#include<queue>
#include<algorithm>
#include<map>
#include<set>
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;

const int MAX = 510000;
const int MOD = 1000000007;


long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++) {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
//注意！nはllかもしれない？<-大丈夫そう
long long COM(int n, int k) {
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}


int main() {
    COMinit();
	int n,k;
    cin >> n >> k;
	vector<ll> a(n);
	rep(i, n) cin >> a[i];
	sort(a.begin(), a.end());
	ll maxX = 0, minX = 0;
    rep(i, n - k + 1) {
        ll maxi = 0;
        maxi += a[i + k-1] * COM(i + k - 1, k - 1);
        maxi %= MOD;
        maxX += maxi;
        maxX %= MOD;
    }
    rep(i, n - k + 1) {
        ll mini = 0;
        mini = a[i] * COM(n - 1 - i, k - 1);
        mini %= MOD;
        minX += mini;
        minX %= MOD;
    }
    cout << (maxX - minX + MOD) % MOD << endl;
}

Measured memory_bytes: 12928
#include <bits/stdc++.h>
using namespace std;
int main(){
  int h, n, sum = 0, tmp;
  cin >> h >> n;
  for(int i = 0; i < n; i++){
    cin >> tmp;
    sum += tmp;
  }
  if(h - sum <= 0){
    cout << "Yes";
  }else{
    cout << "No";
  }
}

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

int main() {
  string s;
  cin >> s;
  int ai = 1001001001;
  int zi = 0;
  rep(i, s.size()) {
    if (s[i] == 'A') {
      ai = min(ai, i);
    }
    if (s[i] == 'Z') {
      zi = max(zi, i);
    }
  }
  cout << zi - ai + 1 << endl;
  return 0;
}

Measured memory_bytes: 3708
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ok() puts(ok?"Yes":"No");
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef set<int> si;
typedef map<string, int> msi;
typedef greater<int> gt;
typedef priority_queue<int, vector<int>, gt> minq;
typedef long long ll;
typedef pair<ll,ll> pll;
const ll LINF = 1e18L + 1;
const int INF = 1e9 + 1;
//clang++ -std=c++11 -stdlib=libc++ 

vi color;
vector<vector<int>> g;
vvi dist;

void dfs(int u = 0, int len = 0)
{
  for (int i=0; i<g[u].size(); i++)
  {
    int v = g[u][i];
    if (v == u)
      continue;
    if (color[v] != -1) continue;
    color[v] = (len + dist[u][i])%2;
    dfs(v, (len+dist[u][i])%2);
  }
}

int main() {
  int n; cin >> n;
  g.resize(n);
  color.resize(n, -1);
  dist.resize(n);
  color[0] = 0;
  rep(i,n-1) {
    int u,v,w; cin >> u >> v >> w;
    u--; v--;
    g[u].push_back(v);
    g[v].push_back(u);
    dist[u].push_back(w);
    dist[v].push_back(w);
  }
  dfs();
  rep(i,n) cout << color[i] << endl;
  return 0;
}

Measured memory_bytes: 13312
#include <bits/stdc++.h>//Carefully Crafted by hetp111
using namespace std;
#define int long long
#define double long double
#define all(v) (v).begin(),(v).end()
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int,int>
#define vii vector<pii>
//#define MOD (1000000007)
#define MOD (998244353)
#define PI acos(-1)
#define eps (1e-8)
#define INF (1e18)
#define FASTER ios_base::sync_with_stdio(0);cin.tie(0)
template<class A,class B>ostream&operator<<(ostream&out,const pair<A,B>&a){return out<<"("<<a.first<<","<<a.second<<")";}
template<class A>ostream&operator<<(ostream&out,const vector<A>&a){for(const A &it:a)out<<it<<" ";return out;}
template<class A,class B>istream&operator>>(istream&in,pair<A,B>&a){return in>>a.first>>a.second;}
template<class A>istream&operator>>(istream&in,vector<A>&a){for(A &i:a)in>>i;return in;}
//ifstream cinn("input.txt");ofstream coutt("output.txt");

signed main(){
    FASTER;
    string s;cin>>s;
    if(s[2]==s[3] && s[4]==s[5]){
        cout<<"Yes";
    }else cout<<"No";
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <math.h>
#include <string.h>
#include <vector>

typedef long long ll;
using namespace std;

int gcd (int a, int b){
    int tmp;
    if (a < b) swap(a, b);

    while (b != 0){
        tmp = a % b;
        a = b;
        b = tmp;
    }
    return a;
}



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

    ll a[n];

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

    ans = a[0];

    for (int i = 0; i < n; i++){
        ans = gcd(ans, a[i]);
    }

    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define y0    lol
#define y1    lool
#define yn    loool
#define prev  looool
#define next  loooool
#define read  looooool
#define tm    loooooool
#define fi first
#define se second
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define rep(i,a,b) for(int i = (a); i <= (b); i++)
#define rrep(i,a,b) for(int i = (b); i >= (a); i--)
#ifdef LOCAL
#define rall(x,a) for(x : a)
#define LL "%lld"
#else
#define rall(x,a) for(auto x : a)
#define LL "%I64d"
#endif
#define rng(a) a.begin(), a.end()
#define PI 3.14159265358979323846
#define MOD 1000000007
#define endl "\n"
#define int long long
typedef long long ll;
using namespace std;

const int N = 111111;
int a[N];
int n;

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin >> n;
    vector<pair<int, int> > pos;
    rep(i, 1, n) {
        cin >> a[i];
        if(a[i] < 0) {
            pos.pb(make_pair(a[i], i));
        }
    }
    sort(rng(pos));
    rep(i, 0, sz(pos) / 2 - 1) {
        a[pos[2 * i].se] *= -1;
        a[pos[2 * i + 1].se] *= -1;
    }
    if(sz(pos) & 1) {
        int x = pos.back().fi;
        int ind = pos.back().se;
        int best = ind == 1 ? 2 : 1;
        rep(i, 1, n) {
            if(i != ind && a[i] < a[best]) {
                best = i;
            }
        }
        if(a[best] < -a[ind]) {
            a[best] *= -1;
            a[ind] *= -1;
        }
    }
    int ans = 0;
    rep(i, 1, n) {
        ans += a[i];
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3060
#include <stdio.h>

int n;
int A[500020],count=0;
int S[500020];

void mergeSort(int A[],int,int);
void mergeSort(int A[],int,int);

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

    mergeSort(A,left,right);
    for(i=0;i<n;i++){
      if(i==n-1)
	printf("%d\n",A[i]);
      else
	printf("%d ",A[i]);
    }

    printf("%d\n",count);
    return 0;
}

void merge(int A[],int left,int mid,int right)
{
  int n1,n2,i,j,k;
  int L[500120],R[500120];
  n1 =mid-left;
  n2 =right-mid;
 
  for(i=0;i<n1;i++){
    L[i]=A[left+i];
  }
  for(j=0;j<n2;j++){
    R[j]=A[mid+j];
  }
  L[n1]=1000000000;
  R[n2]=1000000000;
  i=0;
  j=0;
  for(k=left;k<right;k++)
    {
      if(L[i]<=R[j]){
       	A[k]=L[i];
	i++;
	count++;
      }
      else{
	A[k]=R[j];
	j++;
	count++;
      }
      
    }
}

void mergeSort(int A[],int left,int right)
{
  int mid;
  if(left+1<right){
    mid =(left + right)/2;
    mergeSort(A,left,mid);
    mergeSort(A,mid,right);
    merge(A,left,mid,right);
  }
}



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

int main(void)
{
    int totalNumber;
    cin >> totalNumber;

    int* data = new int[totalNumber];
    for (int i = 0; i < totalNumber; i++) cin >> data[i];
    for (int i = 0; i < totalNumber; i++) {
        if (i) cout << ' ';
        cout << data[i];
    }
    cout << endl;

    int currentData;
    for (int i = 1; i < totalNumber; i++) {
        currentData = data[i];

        int j = i - 1;
        while (j >= 0 && data[j] > currentData) {
            data[j + 1] = data[j];
            j--;
        }
        data[j + 1] = currentData;

        for (int i = 0; i < totalNumber; i++) {
            if (i) cout << ' ';
            cout << data[i];
        }
        cout << endl;
    }

    return 0;
}

Measured memory_bytes: 1188
#include<stdio.h>
  int f[100][100];
int main()
{
  int i,j,k,l,m,n,num,p;
  char ch;

  scanf("%d%d",&j,&k);
  ch=getchar();
  for (i=0;i<j;i++)
    for (l=0;l<k;l++)
  {
     ch=getchar();
     if (ch=='\n')l--;
     if (ch!='\n')f[i][l]=ch;
  }
  for (i=0;i<k+2;i++)printf("#");
  printf("\n");
for (i=0;i<j;i++)
{
     printf("#");
     for (l=0;l<k;l++)
     printf("%c",f[i][l]);
     printf("#\n");
  }
   for (i=0;i<k+2;i++)printf("#");
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <numeric>
#define REP(i, s, n) for (int i = s; i < n; ++i)
#define rep(i, n) REP(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define SORT_INV(c) sort((c).begin(), (c).end(), greater<int>())
#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG true
#define LL long long
#define Num 1000000007
// sort(a.begin(), a.end(), std::greater<int>());
using namespace std;

int main()
{
    string a;
    string b;
    cin >> a >> b;
    char aa[a.size()], bb[a.size()];
    rep(i, a.size())
    {
        aa[i] = a[i];
    }
    rep(i, b.size())
    {
        bb[i] = b[i];
    }
    rep(i, b.size() * 3)
    {
        rep(j, a.size())
        {
            if (aa[j] != bb[j])
            {
                break;
            }
            else if(j==a.size()-1)
            goto OUT;
        }
        char temp = aa[a.size() - 1];
        rep(j, a.size() - 1)
        {
            aa[a.size() - 1 - j] = aa[a.size() - 2 - j];
        }
        aa[0] = temp;
    }
    cout << "No" << endl;
    return 0;
OUT:
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 256
import Control.Monad

data Judge = AC | WA deriving(Show)

alp :: [Char]
alp = ['A'..'Z']

solver' :: String -> Judge
solver' xs
    | (head xs) `elem` alp = WA
    | (last xs) `elem` alp = WA
    | otherwise            = 
        let ys = (init . tail) xs
            zs = filter (\z -> z `elem` alp) ys
            cs = length $ filter (\c -> c == 'C') zs
            in if cs /= 1 then WA 
               else if (length zs) > cs then WA 
               else AC


solver :: String -> Judge
solver []       = WA
solver (x:xs)
    | x == 'A'  = solver' xs
    | otherwise = WA


main :: IO ()
main = do
    line <- getLine
    print $ solver line


Measured memory_bytes: 380
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String str = sc.next();
    long sum = 0;
    int i, j, len = str.length();
    for(i = 0; i < 1<<(len - 1); i++) {
      String firstChar = String.valueOf(str.charAt(0));
      StringBuilder sb = new StringBuilder(firstChar);
      for(j = 0; j < len - 1; j++) {
        if((1 & i >> j) == 1) sb.append("+");
        sb.append(str.charAt(j + 1));
      }
      String[] subsets = sb.toString().split("\\+");
      for(String tempStr : subsets) {
        sum += Long.parseLong(tempStr);
      }
    }
    System.out.println(sum);
  }
}


Measured memory_bytes: 21972
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <tuple>
#include <cmath>
#include <iomanip>
#include <map>
#include <cstring> //memset(dp,0,sizeof(dp))
#include <functional>
#include <cctype>
#include <locale>
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
#define ALL(a) (a).begin(),(a).end()
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
typedef pair<int,int> P;
typedef pair<long long,long long> Pll;
#define fout(num) cout << fixed << setprecision(20) << (num) << endl
//s[i]=tolower(s[i]); islower(s[i]); cout << tolower(s[i])はバグ
//vector<vector<ll>> dp(n,vector<ll>(n))
//exist x map o setconst ll MOD = 1e9+7;return fac[n]*(finv[k]*finv[n-k] % MOD) % MOD;
const ll MOD = 1e9+7;
signed main(){
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    int l,r,d; cin >> l >> r >> d;
    cout << (r/d)-(l-1)/d << endl;
}



Measured memory_bytes: 3588
#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#define _USE_MATH_DEFINES
using namespace std;

int main() {
    int X;
    cin >> X;
    int ans = 1;
    for(int b = 1; b < 32; b++){
        int num = b;
        for(int p = 1; p < 10; p++){
            num *= b;
            if(num > X){
                break;
            }
            if(num > ans){
                ans = num;
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define rrep(i, n) for (int(i) = (n)-1; (i) >= 0; (i)--)
 
int mod=1e9+7;

struct modCalc{
	int mod;
	int n;
	bool ok;
	vector<int> fact,invfact;
	modCalc(){};
	modCalc(int _mod,int _n){
		mod=_mod,n=_n;
		ok=false;
	};
	void init(){
		fact.resize(n+1,1);
		for(int i=0;i<n;i++)fact[i+1]=fact[i]*(i+1)%mod;
		invfact.resize(n+1,1);
		invfact[n]=modinv(fact[n]);
		for(int i=n;i>1;i--)invfact[i-1]=invfact[i]*i%mod;
		ok=true;
	}

	int modpow(int x,int n,int m=-1){
		if(m==-1)m=mod;
		int ret=1;
		while(n>0){
			if(n&1)(ret*=x)%=m;
			(x*=x)%=m;
			n>>=1;
		}
		return ret;
	}

	int modinv(int x,int m=-1){
		if(m==-1)m=mod;
		return modpow(x,m-2,m);
	}

	int nCm(int x,int y){
		if(!ok)init();
		if(y==0)return 1;
		else return fact[x]*invfact[y]%mod*invfact[x-y]%mod;
	}
	int nPm(int x,int y=-1){
		if(y==-1)y=x;
		if(!ok)init();
		return fact[x]*invfact[x-y]%mod;
	}
};



signed main() {
	int n,m,k;cin>>n>>m>>k;

	modCalc md(mod,n*m);
	int combNum=md.nCm(n*m-2,k-2);
	int ret=0;
	for(int i=1;i<n;i++)(ret+=i*(n-i)*m*m)%=mod;
	for(int i=1;i<m;i++)(ret+=i*(m-i)*n*n)%=mod;
	cout<<ret*combNum%mod<<endl;

}

Measured memory_bytes: 3328
#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#define REP(i,a,n) for(int i = a; i < n; ++i)
#define INF 0x3fffffff
#define Modulo 1000000007
using namespace std;

long long d1[100001];
long long d2[100001];

int h, w, a, b;

long long divmod(int a, int b) {
	long long pow[31];
	long long tmp = b;
	long long ret = 1;
	REP(i, 0, 31) {
		pow[i] = tmp;
		tmp = (tmp * tmp) % Modulo;
		if ((Modulo - 2) & (0x1 << i)) {
			ret = (ret * pow[i]) % Modulo;
		}
	}
	return (a * ret) % Modulo;
}

void init() {
	const long long n1 = h - a + b - 1;
	const long long n2 = w - b + a - 1;
	REP(i, 0, h - a) {
		if (i == 0) {
			d1[i] = 1;
		} else {
			d1[i] = divmod((d1[i - 1] * (n1 - i + 1)) % Modulo, i);
		}
	}
	REP(i, 0, w - b) {
		if (i == 0) {
			d2[i] = 1;
		} else {
			d2[i] = divmod((d2[i - 1] * (n2 - i + 1) % Modulo), i);
		}
	}
}


int main() {
	long long sum = 0;
	cin >> h >> w >> a >> b;
	if (h - a > w - b) {
		swap(h, w);
		swap(a, b);
	}
	init();
	REP(i, 0, h - a) {
		sum = (sum + d1[i] * d2[w - b - h + a + i]) % Modulo;
	}
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 1664
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin >>s;
  int num;
  int diff=1000000;
  for(int i=0;i<s.length()-2;i++){
    num=(s[i]-'0')*100+(s[i+1]-'0')*10+(s[i+2]-'0');
    diff=min(diff, abs(num-753));
  }
  cout << diff << endl;
  return 0;
}
  

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
	
	char c;
	
	int number[4];
	
	int i,k;
	
	for(i=1;i<=3;i++){
		
		c = getchar ();
		
		k = c - 48;
		
		number[i] = k;
		
	}
	
	if(number[1] == number[3]){
		
		printf ("Yes\n");
		
	}else{
		
		printf ("No\n");
		
	}
	
	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;
const ll INF = 1001001001;
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 D = 80*160+10;
const int D2 = D*2;
typedef bitset<D2> bs;

int a[100][100];
bs dp[90][90];

int main(){
    int h,w;
    cin >> h >> w;
    rep(i,h){
        rep(j,w){
            int x;
            cin >> x;
            a[i][j] = x;
        }
    }
    rep(i,h){
        rep(j,w){
            int x;
            cin >> x;
            a[i][j] = abs(a[i][j]-x);
        }
    }
    dp[0][0][D+a[0][0]] = 1;
    dp[0][0][D-a[0][0]] = 1;
    
    rep(i,h){
        rep(j,w){
            if(i){
                dp[i][j] |= dp[i-1][j] << a[i][j];
                dp[i][j] |= dp[i-1][j] >> a[i][j];
            }
            if(j){
                dp[i][j] |= dp[i][j-1] << a[i][j];
                dp[i][j] |= dp[i][j-1] >> a[i][j];
            }
        }
    }
    int ans = D2;
    
    rep(i,D2){
        if(dp[h-1][w-1][i]){
            ans = min(ans,abs(i-D));
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 24004
#include<bits/stdc++.h>
#define FOR(i,n) for(int i=0;i<n;i++)
#define SFOR(i,a,b) for(int i=a;i<b;i++)
#define elif(a) else if(a)
#define INF INT_MAX
#define F first
#define S second
#define endl '\n'
using namespace std;
typedef long long ll;
typedef pair<ll,ll>P;
int n,m;
ll a[100005],ans;
P b[100005];
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin>>n>>m;
  FOR(i,n){
    cin>>a[i];
  }
  FOR(i,m){
    cin>>b[i].S>>b[i].F;
  }
  sort(b,b+m,greater<P>());
  sort(a,a+n);
  int cnt=0;
  while(1){
    int fl=0;
    FOR(i,n){
     if(cnt!=m && a[i]<b[cnt].F && b[cnt].S>0){
        a[i]=b[cnt].F;
        b[cnt].S--;
        if(b[cnt].S==0) cnt++;
     }else if(cnt==m || b[cnt].S!=0){
       fl=1;
       break;
     }
    }
    if(fl==1) break;
    for(int i=n-1;i>=0;i--){
      if(a[i]<b[cnt].F && b[cnt].S>0){
        a[i]=b[cnt].F;
        b[cnt].S--;
        if(b[cnt].S==0) cnt++;
      }else if(cnt==m || b[cnt].S!=0){
        fl=1;
        break;
      }
    }
    if(fl==1) break;
  }
  FOR(i,n) ans+=a[i];
  cout<<ans<<endl;
  return 0;
}



Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
#define inf 1e9
#define ll long long
#define ull unsigned long long
#define M 1000000007
#define P pair<int,int>
#define PLL pair<ll,ll>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
#define IN(n,a) rep(i,n){ cin>>a[i]; }
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define PI 3.14159265

map<string,bool> mp;
string t[100];
int k;

void g(string s,int m,bool b[],int n){
  if(m==k){
    mp[s]=true;
    return;
  }
  rep(i,n){
    if(!b[i]){
      b[i]=true;
      g(s+t[i],m+1,b,n);
      b[i]=false;
    }
  }
}

void f(int n){
  mp.clear();
  string s="";

  rep(i,n){
    cin>>t[i];
  }
  bool b[100]={};
  g(s,0,b,n);

  cout<<mp.size()<<endl;
}


int main(){
  int n;
  while(1){
    cin>>n>>k;
    if(n==0) break;
    f(n);
  }
}


Measured memory_bytes: 3372
#include <iostream>
#include <vector>

using namespace std;


class DisjointSet{
    public:
    vector<int> rank,p;
    DisjointSet(){}
    DisjointSet(int size){
        rank.resize(size,0);
        p.resize(size,0);
        for(int i=0;i<size;i++)makeSet(i);
    }

    void makeSet(int x){
        p[x]=x;
        rank[x]=0;
    }

    bool same(int x, int y){
        return findSet(x)==findSet(y);
    }

    void unite(int x, int y){
        link(findSet(x),findSet(y));
    }

    void link(int x, int y){
        if(rank[x]>rank[y]){
            p[y]=x;
        }else{
            p[x]=y;
            if(rank[x]==rank[y]){
                rank[y]++;
            }
        }
    }

    int findSet(int x){
        if(x!=p[x]){
            p[x]=findSet(p[x]);
        }
        return p[x];
    }
};

int main()
{
    int n,a,b,q,t;
    cin>>n>>q;
    DisjointSet ds=DisjointSet(n);
    for(int i=0;i<q;i++) {
        cin>>t>>a>>b;
        if(t==0)ds.unite(a,b);
        else if(t==1){
            if(ds.same(a,b)) cout<<1<<endl;
            else cout<<0<<endl;
        }
    }

    return 0;

}


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

typedef long long ll;
using vi = vector<int>;
using vii = vector<vector<int>>;
using vl = vector<ll>;
using vll = vector<vector<ll>>;

#define inf 10e17
#define rep(i,n) for(long long i=0; i<n; i++)
#define repr(i,n,m) for(long long i=m; i<n; i++)
#define MOD 1000000007
#define sorti(x) sort(x.begin(), x.end())
#define sortd(x) sort(x.begin(), x.end(), std::greater<long long>())
#define debug(x) std::cerr << (x) << std::endl;
#define roll(x) for (auto&& itr : x) { cerr << (itr) << " "; }

template <class T> inline void chmax(T &ans, T t) { if (t > ans) ans = t;}
template <class T> inline void chmin(T &ans, T t) { if (t < ans) ans = t;}

int main() {
  int n;
  cin >> n;
  vector<int> s(n), t(n);
  vector<string> str(n);
  rep(i, n) {
    cin >> str[i] >> s[i];
  }
  string x;
  cin >> x;

  int ans = 0;
  bool flag = false;
  for (int i = 0; i < n; ++i) {
    if (flag) ans += s[i];
    if (str[i] == x){
      flag = true;
    }
  }

  cout << ans << endl;
}


Measured memory_bytes: 256
x_1,y_1,x_2,y_2=map(int,input().split())
a=x_2-x_1
b=y_2-y_1
x_4=x_1-b
y_4=y_1+a
x_3=x_4+a
y_3=y_4+b
print(x_3,y_3,x_4,y_4)

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

int main() {

  int N, K;
  cin >> N >> K;

  vector<int> h(N+1);

  for (int i = 1; i <= N; i++) {
    cin >> h[i];
  }

  int answer = 0;

  vector<int> dp(N+1);

  fill(dp.begin(), dp.end(), 1000000000);

  dp[0] = 0;
  dp[1] = 0;

  for (int i = 2; i <= N; i++) {
    for (int j = 1; j <= K && 1 <= i - j; j++) {
      dp[i] = min(dp[i], abs(h[i - j] - h[i]) + dp[i - j]);
    }
  }

  cout << dp[N] << endl;

}

Measured memory_bytes: 1024
#include<iostream>
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<iterator>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;

typedef long long int ll;

string S,T;

int main(){
    cin>>S>>T;
    for(int i=0;i<27;++i){
        if(S+(char)(i+'a')==T){
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    cout<<"No"<<endl;
}

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

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

int main(void) {
  ll h, w, n;
  cin >> h >> w >> n;

  map<P, int> mp;
  for (int i = 0; i < n; i++) {
    int a, b;
    cin >> a >> b;

    for (int j = 0; j < 3; j++) {
      for (int k = 0; k < 3; k++) {
        int na = a - j, nb = b - k;
        if (na <= 0 || nb <= 0 || na + 3 > h + 1 || nb + 3 > w + 1) continue;
        mp[P(na, nb)]++;
      }
    }
  }

  ll cnt[10] = {}, sum = 0;
  for (auto i : mp) {
    cnt[i.second]++;
    sum++;
  }
  cnt[0] = (h - 2) * (w - 2) - sum;

  for (int i = 0; i < 10; i++) {
    cout << cnt[i] << endl;
  }

  return 0;
}

Measured memory_bytes: 56448
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <utility>
#include <algorithm>
#include <cstdio>
#include <iomanip>
#include <queue>
#include <deque>
#include <stack>
#include <fstream>
#include <cmath>
#include <random>
#include <complex>
#include <functional>
#include <bitset>
#include <sstream>
#include <cassert>
#include <time.h>

#define ll int64_t
#define Rep(i, n) for (ll i = 0; i < n; i++)
using namespace std;
typedef vector<ll> vec;
typedef vector<vec> mat;

const ll inf = 1LL << 60;

template<class T> inline void chmin(T& a, T b) {
    if (a > b) {
        a = b;
    }
}
template<class T> inline void chmax(T& a, T b) {
    if (a < b) {
        a = b;
    }
}
void printvec (vec &v) {
    Rep (i, (ll)v.size()) {
        cout << v[i] << " \n"[i+1 == (ll)v.size()];
    }
}

template <class T>
class SegTree {
    int n;
    vector<T> data;
    T def;
    function<T(T, T)> operation;
    function<T(T, T)> update;

    T _query(int a, int b, int k, int l, int r) {
        if (r <= a or b <= l) return def;
        if (a <= l and r <= b) return data[k];
        else {
            T c1 = _query(a, b, 2*k+1, l, (l+r)/2);
            T c2 = _query(a, b, 2*k+2, (l+r)/2, r);
            return operation(c1, c2);
        }
    }

    public:
    SegTree(ll _n, T _def, function<T(T, T)> _operation, function<T(T, T)> _update) : def(_def), operation(_operation), update(_update) {
        n = 1;
        while (n <= _n) {
            n *= 2;
        }
        data = vector<T>(2*n-1, def);
    }

    void change(int i, T x) {
        i += n-1;
        data[i] = update(data[i], x);
        while (i > 0) {
            i = (i-1) / 2;
            data[i] = operation(data[i*2+1], data[i*2+2]);
        }
    }

    T query(int a, int b) {
        return _query(a, b, 0, 0, n);
    }

    T operator[] (int i) {
        return data[i+n-1];
    }
};

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

    ll N;
    cin >> N;
    vec h(N), a(N);
    Rep (i, N) {
        cin >> h[i];
        h[i]--;
    }
    Rep (i, N) cin >> a[i];

    SegTree<ll> st(N, 0, [](ll a, ll b){return max(a, b);}, [](ll a, ll b){return b;});
    Rep (i, N) {
        ll tmp = st.query(0, h[i]) + a[i];
        chmax(tmp, st[h[i]]);
        st.change(h[i], tmp);
    }

    cout << st.query(0, N) << "\n";



}

Measured memory_bytes: 10600
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // std::ifstream in("input.txt");
    // std::cin.rdbuf(in.rdbuf());
    const ll mod = 1e9 + 7;
    ll n, m;
    cin >> n >> m;
    vector<ll> x(n), y(m);
    rep(i, n) cin >> x[i];
    rep(i, m) cin >> y[i];
    ll xsum = 0, ysum = 0;
    rep(i, n) {
        xsum = (xsum + i * x[i] - (n - i - 1) * x[i]) % mod;
    }
    rep(i, m) {
        ysum = (ysum + i * y[i] - (m - i - 1) * y[i]) % mod;
    }
    ll ans = (xsum * ysum) % mod;
    cout << ans << endl;
    return 0;
}


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

int main(){

  long long X,y,a,b,c;
 cin>>X>>y>>a>>b>>c;
  vector<int>R,B,T;


  long long x;

  for(int i=0;i<a;i++){
    cin>>x;
    R.push_back(x); }

    for(int i=0;i<b;i++){
    cin>>x;
     B.push_back(x); }

  for(int i=0;i<c;i++){
    cin>>x;
    T.push_back(x); }

   sort(R.begin(),R.end(),greater<int>());
   sort(B.begin(),B.end(),greater<int>());

 for(int i=0;i<X;i++)
    T.push_back(R[i]);

 for(int i=0;i<y;i++)
  T.push_back(B[i]);

    sort(T.begin(),T.end(),greater<int>());

   long long sum=0;
 for(int i=0;i<X+y;i++){
    sum += T[i];
 }

  cout<<sum<<endl;

return 0;
}

Measured memory_bytes: 3188
#define _CRT_SECURE_NO_WARNINGS // #pragma warning(disable:4996)
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <functional>
#include <sstream>
#include <cmath>
#include <set>
#include <map>
using namespace std; 

#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define pb push_back
#define mp(a,b) make_pair(a,b)
#define all(a) a.begin(),a.end()
#define len(x) ((int)(x).size())
#define tmax(a,b,c) max((a),max((b),(c)))
#define tmin(a,b,c) min((a),min((b),(c)))
#define debug(x) cerr << #x << " is " << x << endl;

typedef pair<int, int> Pii;
typedef vector<int> Vi;
typedef vector<vector<int> > VVi;
typedef long long ll;
const int inf = 2e9;
const ll ll_inf = 1e17;
const int mod = 1e9 + 7;
const long double eps = 1e-10;

int prime[10001000];

int main()
{
	rep(i,2,1001) {
		int j = i;
		while (j < 10000000) {
			j += i;
			prime[j]++;
		}
	}
	prime[0]++;
	prime[1]++;

	while(1) {
		int a, d, n;
		cin >> a >> d >> n;
		if (!a && !d && !n) break;
		int cnt = 0;
		while (cnt < n) {
			if (!prime[a]) cnt++;
			a += d;
		}
		a -= d;
		cout << a << endl;
	}
	
	return 0;
}

Measured memory_bytes: 40224
#include<bits/stdc++.h>
using namespace std;
 
#define int long long
#define endl "\n"
#define IOS ios::sync_with_stdio(false); cin.tie(nullptr);
#define sz(x) ((int)x.size())

template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }
 
const int N = 1e5+5;
typedef vector<int> vi;

 
int32_t main()
{
   int n;
   cin >> n;
   int ans = (n)*(n+1)/2;
   cout << ans << endl;
   return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
namespace abc150a
{
    class Program
    {
        static void Main(string[] args)
        {
            var vs = Console.ReadLine().Split().Select(s => int.Parse(s)).ToArray();
            Console.WriteLine(vs[0] * 500 >= vs[1] ? "Yes":"No");
        }
    }
}


Measured memory_bytes: 13396
#include<bits/stdc++.h>
using namespace std;
int main(){
	char a[4];
	cin>>a;
	if(a[0]==a[1]&&a[1]==a[2]||a[1]==a[2]&&a[2]==a[3])
		cout<<"Yes"<<endl;
	else
		cout<<"No"<<endl;
	return 0;
}


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

int menseki(int a, int b, int h) {
  int answer = 0;
  answer = (a + b) * h / 2;
  return answer;
}

int main() {
  int a, b, h;
  cin >> a >> b >> h;
  cout << menseki(a, b, h) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a; i< (int)(b); ++i)
using namespace std;



int main(){
   cin.tie(0);
   ios::sync_with_stdio(false);
   cout << fixed << setprecision(20);
   
   int a,b,ans=0; cin >> a >>b;
   if(a<b) swap(a,b);
   ans+=a;
   ans+=max(a-1,b);
   cout << ans << endl;
}



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

int main() {
    int K; cin >> K;
    queue<lld> que;
    for (int i = 1; i <= 9; i++) que.push(i);
    lld x;
    for (int i = 0; i < K; i++) {
        x = que.front(); que.pop();
        int r = x % 10;
        if (r > 0) que.push(10 * x + r - 1);
        que.push(10 * x + r);
        if (r < 9) que.push(10 * x + r + 1);
    }
    cout << x << endl;
}

Measured memory_bytes: 1792
#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 = 1 << 30;
const ll LLINF = 1LL << 62;

int mod = 1000000007;

int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N; cin >> N;
    string S; cin >> S;
    //文字書き換えかswapで RRRRRR....WWWWWW....にする
    int l = 0, r = N-1;
    int ans = 0;
    while(l < r){
        while(l < r && S[l] == 'R') l++;
        while(l < r && S[r] == 'W') r--;
        if(l < r){
            swap(S[l], S[r]);
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3772
N,K = gets.split.map(&:to_i)
S = Array.new(N + 1, 0)
K.times do
  d = gets.to_i
  gets.split.map(&:to_i).each do |u|
    S[u] += 1
  end
end
puts (1 .. N).count{|u| S[u].zero? }

Measured memory_bytes: 14428
#include <bits/stdc++.h> 
    #include<ext/pb_ds/assoc_container.hpp> 
    #include<ext/pb_ds/tree_policy.hpp>
    using namespace __gnu_pbds;
    using namespace std;
    template <typename T>
    using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
    #define int long long  
    typedef long double ld;
    #define pb push_back
    #define f(i,a,b) for(int i=a;i<b;i++)
    #define fd(i,a,b) for(int i=a-1;i>=b;i--)
    #define pf push_front
    #define fi first
    #define se second
     int mn=1e9+7;
    int cnt=0;
    vector<pair<int ,int >> v1,v2;  
    signed main() {
    ios_base::sync_with_stdio(false);
     cin.tie(NULL);  
    
 
    // -------------------------------------Code starts here--------------------------------------------------------------------- 

   int r;
   cin>>r;
   float a=3.14*2*r;
   cout<<a<<endl;
}

Measured memory_bytes: 3804
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

using pi = pair<int,int>;
const int N = 100000;

int n;
vector<int> G[N];

// ??°??£????????????????????????/??????
pi dp1[N];
void dfs(int v, int par)
{
    int res = 0;
    for(int nx:G[v])if(nx!=par)
    {
        dfs(nx,v);
        res += dp1[nx].fi+2;
    }

    int notback = res;
    for(int nx:G[v])if(nx!=par)
    {
        int t = res;
        t -= dp1[nx].fi+2;
        t += dp1[nx].se+1;
        notback = min(notback,t);
    }

    dp1[v] = {res,notback};
}

int dp2[N];
void dfs2(int v, int par, pi d)
{
    vector<pair<pi,int>> c;
    for(int nx:G[v])if(nx!=par) c.pb({dp1[nx],nx});
    c.pb({d,-1});

    int C = c.size();
    int sum = 0;
    rep(i,C) sum += c[i].fi.fi+2;

    // second????????¶?????¨????????£?????????????????????(?°?????????????????¬???????)
    // (??????,??????)
    vector<pi> gain;

    int ans = sum;
    rep(i,C)
    {
        int t = sum;
        int g = c[i].fi.se+1 - (c[i].fi.fi+2);
        t += g;
        ans = min(ans,t);

        gain.pb({g,c[i].se});
    }
    dp2[v] = ans;

    sort(all(gain));
    // printf(" NOW: v= %d\n", v);
    // rep(i,C) dbg(gain[i]);

    rep(i,C)
    {
        int nx = gain[i].se;
        if(nx==-1) continue;

        pi nd;
        nd.fi = sum - (dp1[nx].fi+2);

        nd.se = nd.fi;
        if(i==0)
        {
            if(C>1) nd.se += gain[1].fi;
        }
        else nd.se += gain[0].fi;

        dfs2(nx,v,nd);
    }
}

int main()
{
    cin >>n;
    rep(i,n-1)
    {
        int u,v;
        cin >>u >>v;
        --u;
        --v;
        G[u].pb(v);
        G[v].pb(u);
    }

    dfs(0,-1);
    // rep(i,n) printf(" %d:  (%d %d)\n", i,dp1[i].fi,dp1[i].se);

    dfs2(0,-1,{-2,-1});
    rep(i,n) cout << dp2[i] << endl;
    return 0;
}

Measured memory_bytes: 33188
R, C, K, *RCV = [int(_) for _ in open(0).read().split()]
RCV = sorted([(r, -c, v) for r, c, v in zip(RCV[::3], RCV[1::3], RCV[2::3])])


class SegmentTree():
    def __init__(self, array, f, ti):
        """
        Parameters
        ----------
        array : list
            to construct segment tree from
        f : func
            binary operation of the monoid
        ti : 
            identity element of the monoid
        """
        self.f = f
        self.ti = ti
        self.n = n = 2**(len(array).bit_length())
        self.dat = dat = [ti] * n + array + [ti] * (n - len(array))
        for i in range(n - 1, 0, -1):  # build
            dat[i] = f(dat[i << 1], dat[i << 1 | 1])

    def update(self, p, v):  # set value at position p (0-indexed)
        f, n, dat = self.f, self.n, self.dat
        p += n
        dat[p] = v
        while p > 1:
            p >>= 1
            dat[p] = f(dat[p << 1], dat[p << 1 | 1])

    def operate_right(self, p, v):  # apply operator from the right side
        f, n, dat = self.f, self.n, self.dat
        p += n
        dat[p] = f(dat[p], v)
        while p > 1:
            p >>= 1
            dat[p] = f(dat[p << 1], dat[p << 1 | 1])

    def operate_left(self, p, v):  # apply operator from the left side
        f, n, dat = self.f, self.n, self.dat
        p += n
        dat[p] = f(v, dat[p])
        while p > 1:
            p >>= 1
            dat[p] = f(dat[p << 1], dat[p << 1 | 1])

    def query(self, l, r):  # result on interval [l, r) (0-indexed)
        f, ti, n, dat = self.f, self.ti, self.n, self.dat
        vl = vr = ti
        l += n
        r += n
        while l < r:
            if l & 1:
                vl = f(vl, dat[l])
                l += 1
            if r & 1:
                r -= 1
                vr = f(dat[r], vr)
            l >>= 1
            r >>= 1
        return f(vl, vr)


dp1 = SegmentTree([0] * (C + 1), max, -1)
dp2 = SegmentTree([0] * (C + 1), max, -1)
dp3 = SegmentTree([0] * (C + 1), max, -1)

rnow = 0
rcv = {}
for r, c, v in RCV:
    if rnow != r:
        rnow = r
        rcv[r] = []
    rcv[r] += [(-c, v)]
for r in sorted(rcv.keys()):
    cv = rcv[r]
    for c, v in cv:
        dp1.update(c, dp3.query(0, c + 1) + v)
    for c, v in cv:
        dp2.update(c, max(dp1.query(c, c + 1), dp1.query(0, c) + v))
    for c, v in cv:
        dp3.update(c, max(dp2.query(c, c + 1), dp2.query(0, c) + v))
ans = dp3.query(0, C + 1)
print(ans)


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

using namespace std;


int main()
{


/*#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif*/

	const int INF = 1e9 + 5;

	int n;
	cin >> n;
	int cnt = 0;
	int ans = 0;

	long long a[n];

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

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

		else
		{
			if (cnt < ans)
			{
				cnt = ans;
			}

			ans = 0;
		}
	}

	if (cnt < ans)
	{
		cnt = ans;
	}

	cout << cnt;
}



Measured memory_bytes: 1024