akhauriyash/Code-Regression huggingface dataset:
import string

result = {}
for char in string.ascii_lowercase:
    result[char] = 0

while True:
    try:
        words = input().lower()
    except:
        break
    
    for char in words:
        try:
          result[char] += 1
        except:
          pass

for char in string.ascii_lowercase:
    print(f"{char} : {result[char]}")


Measured memory_bytes: 6688
#include <bits/stdc++.h>
using namespace std;
long long INF = 1e18;

int main()
{
	int N, W;
	cin >> N >> W;
	
	vector<long long> weight(N), value(N);
	int V = 0;
	for (int i = 0; i < N; i++)
	{
		cin >> weight[i] >> value[i];
		V += value[i];
	}
	vector<long long> dp(V + 1, INF); // dp[v] - min weight for value v
	dp[0] = 0;
	for (int i = 0; i < N; i++)
	{
		for (int j = V - value[i]; j >= 0; j--)
		{
			if (dp[j] != INF)
				dp[j+value[i]] = min(dp[j+value[i]], dp[j] + weight[i]);
		}
	}
	for (int i = V; i >= 0; i--)
	{
		if (dp[i] <= W)
		{
			cout << i << '\n';
			break;
		}
	}
}


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

// 1-indexed
template <class T>
struct BIT {
  vector<T> lst;
  int treesize;
  // constructor
  BIT(int newn = 0) {
    treesize = newn;
    lst.resize(treesize + 1);
    for(int i = 0; i <= treesize; ++i) lst[i] = 0;
  }
  // a_place += num
  bool add(int place, T num) {
    while(place <= treesize) {
      lst[place] += num;
      place += place & -place;
    }
    return 1;
  }
  // add wide ver.(add num between l and r)
  bool addw(int left, int right, T num) {
    while(left <= right && left >= 1 && right <= treesize)
      add(left++, num);
    return 1;
  }
  // sum between [1,place]
  T calcsum(int place) {
    T answer = 0;
    while(place > 0) {
      answer += lst[place];
      place -= place & -place;
    }
    return answer;
  }
  // sum [l,r]
  T calcsumw(int left, int right) {
    return calcsum(right) - calcsum(left - 1);
  }
};

long long n, q;
string s;
BIT<long long> bit[26];

long long solve();

int main() {
  cin >> n >> s >> q;
  for(int i = 0; i < 26; ++i)
    bit[i] = BIT<long long>(n + 1);
  for(int i = 0; i < n; ++i) bit[s[i] - 'a'].add(i + 1, 1);
  for(int i = 0; i < q; ++i) {
    int x;
    cin >> x;
    if(x == 1) {
      int p;
      char c;
      cin >> p >> c;
      bit[s[p - 1] - 'a'].add(p, -1);
      bit[c - 'a'].add(p, 1);
      s[p - 1] = c;
    }
    else {
      int l, r, res = 0;
      cin >> l >> r;
      for(int j = 0; j < 26; ++j) {
        int now = bit[j].calcsum(r);
        if(l > 1) now -= bit[j].calcsum(l - 1);
        if(now >= 1) ++res;
      }
      cout << res << endl;
    }
  }
  cout << endl;
  return 0;
}

long long solve() {}

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

long long f(long long b, long long n) {
    if (n < b) return n;
    return f(b, floor((double)n / b)) + n % b;
}

vector<long long> divisor(long long n) {
    vector<long long> res;
    for (long long i = 1; i * i <= n; i++)
    {
        if (n % i == 0) {
            res.push_back(i);
            if (i != n / i) res.push_back(n / i);
        }
    }
    return res;
}

int main() {
    long long n, s;
    cin >> n >> s;

    if (n == s) {
        cout << n + 1 << endl;
        return 0;
    }

    for (long long i = 2; i * i <= n; i++) {
        if (f(i, n) == s) {
            cout << i << endl;
            return 0;
        } 
    }

    vector<long long> div = divisor(n - s);
    sort(div.begin(), div.end());

    for (int i = 0; i < (int)div.size(); i++) {
        if (f(div.at(i) + 1, n) == s) {
            cout << div.at(i) + 1 << endl;
            return 0;
        }
    }

    cout << "-1" << endl;
}   

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

int main() {
  double pi,unit,unit_r;
  pi     = 2.0 * asin(1.0); 
	unit   = pi / 180.0; 
	unit_r = 180.0 / pi;
  
  double a,b,x;
  cin>>a>>b>>x;
  double d=x/a;
  if(d==(a*b)/2){
    cout<<"45"<<endl;
    return 0;
  }
  if(d>(a*b)/2){
    double e=a*b-d;
    double f=2*e/a;
    cout<<fixed<<setprecision(10);
    cout<<atan(f/a)*unit_r<<endl;
  }
  if(d<(a*b)/2){
    double e=2*d/b;
    cout<<fixed<<setprecision(10);
    cout<<90-atan(e/b)*unit_r<<endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
 
int main(){
  int a,b;
  cin >> a >> b;
  if(a>b){
    cout << "a > b" << endl;
  }else if(a<b){
    cout << "a < b" << endl;
  }else{
    cout << "a == b" << endl;
  }
  return 0;
}

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

using i64 = int_fast64_t;
using f64 = double;

void solve() {
    i64 n, k, s;
    cin >> n >> k >> s;
    for (i64 i = 0; i < n; i++) {
        cout << (i ? " " : "") << (i < k ? s : (s < n ? (i64) 1e9 : 1));
    }
    cout << endl;
}

int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
#define ll long long
#define all(x) (x).begin(), (x).end()
using namespace std;

int main() {
    int n;
    cin >> n;
    int sum = 0;
    for (int i = 1; i <= n; i++){
        sum += to_string(i).size() % 2;
    }
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 256
import sys
input=sys.stdin.buffer.readline
n,m=map(int,input().split())
mod=10**9+7
dp=[0]*(n+1)
for _ in range(m):
    a=int(input())
    dp[a]=-1
dp[0]=1
for i in range(n):
    if dp[i]>=0:
        if i+1<=n:
            if dp[i+1]>=0:
                dp[i+1]+=dp[i]
                dp[i+1]%=mod
        if i+2<=n:
            if dp[i+2]>=0:
                dp[i+2]+=dp[i]
                dp[i+2]%=mod
print(dp[n] if dp[n]>0 else 0)

Measured memory_bytes: 6900
import java.util.*;
import java.io.*;
class Main{
  public static void main(String args[]){
    int n=readI();
    int countR=0;
    char ch[]=new char[n];
    for(int i=0;i<n;i++){
      ch[i] = readC();
      if(ch[i]=='R'){countR++;}
    }
    int ans=0;
    for(int i=0;i<countR;i++){
      if(ch[i]=='R'){
        ans++;
      }
    }
    ans = countR-ans;
    pl(ans+"");
  }

  static final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
  public static void pr(String str){
    System.out.print(str);
  }
  public static void pl(String str){
    System.out.println(str);
  }
  public static String read(){
    try{
      return ctos((char)br.read());
    }catch(IOException e){
      e.printStackTrace();
      return "";
    }
  }
  public static char readC(){
    try{
      return (char)br.read();
    }catch(IOException e){
      e.printStackTrace();
      return (char)-1;
    }
  }
  public static String readL(){
    try{
      return br.readLine();
    }catch(IOException e){
      e.printStackTrace();
      return "";
    }
  }
  public static String readS(){
    StringBuilder sb = new StringBuilder();
    while(true){
      try{
        int k = br.read();
        if(k==-1||(char)k==' '||(char)k=='\n'){break;}
        sb.append((char)k);
      }catch(IOException e){
        e.printStackTrace();
      }
    }
    return sb.toString();
  }
  public static int readI(){
    return stoi(readS());
  }
  public static long readLong(){
    return stol(readS());
  }
  public static long stol(String s){
    return Long.parseLong(s);
  }
  public static String[] readSs(){
    return readL().split(" ");
  }
  public static int[] readIs(){
    return stoi(readSs());
  }
  public static int stoi(String s){
    return Integer.parseInt(s);
  }
  public static int[] stoi(String s[]){
    int a[]=new int[s.length];
    for(int i=0;i<s.length;i++){
      a[i]=stoi(s[i]);
    }
    return a;
  }
  public static String itos(int i){
    return String.valueOf(i);
  }
  public static String[] itos(int[] a){
    String s[]=new String[a.length];
    for(int i=0;i<a.length;i++){
      s[i]=itos(a[i]);
    }
    return s;
  }
  public static String ctos(char c){
    return String.valueOf(c);
  }
  public static String cstos(char[] c){
    return new String(c);
  }
  public static char stoc(String s){
    return s.charAt(0);
  }
  public static char[] stocs(String s){
    return s.toCharArray();
  }
}


Measured memory_bytes: 38408
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define USE_LLONG_AS_INT
#ifdef USE_LLONG_AS_INT
#define int long long
#define inf (1ll<<60)
#else
#define inf (1<<30)
#endif
#define rep(i,n) for(int i=0;i<(n);i++)
#define Rep(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a,b) for(int i=(a);i<=(b);i++)
#define rev(i,n) for(int i=(n)-1;i>=0;i--)
#define vi vector<int>
#define vvi vector<vi>
#define vs vector<string>
#define pb push_back
#define eb emplace_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define Yes(f) cout<<(f?"Yes":"No")<<endl
#define yes(f) cout<<(f?"yes":"no")<<endl
#define YES(f) cout<<(f?"YES":"NO")<<endl
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v), greater<int>())

using namespace std;

const int mod=1e9+7;
// const int mod=998244353;
const string sp=" ";

void run();

void init() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(12);
}

signed main(){
    init();
    run();
    return 0;
}

void run(){
    char a;
    cin>>a;
    if('a'<=a&&a<='z')cout<<'a'<<endl;
    else cout<<'A'<<endl;
}

Measured memory_bytes: 3588
#include<cstdio>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<cstdlib>
#include<bitset>
#include<utility>
#include<sstream>
#include<iomanip>
using namespace std;

#define ll long long
#define MP make_pair

int main(void) {
	int n;
	cin>>n;
	cout<<(n-2)*180<<"\n";


	return 0;
}


Measured memory_bytes: 256
class _Node {
  constructor(key, parent = null, left = null, right = null) {
    this.key = key;
    this.parent = parent;
    this.left = left;
    this.right = right;
  }

  getChildrenNumber() {return Number(this.left !== null) + Number(this.right !== null);}

  isLeftChild() {
    if (this.parent === null) return null;
    return this.parent.left === this;
  }

  getLeftOrRight() {return this.isLeftChild() ? 'left' : 'right';}

  getSuccessor() {
    let n;
    if (this.right !== null) {
      n = this.right;
      while (n.left !== null) n = n.left;
    } else {
      n = this.parent;
      while (!n.isLeftChild && n.parent != null) n = n.parent;
    }
    return n;
  }
}

class BinaryTree {
  constructor() {
    this.root = null;
  }

  static get Node() { return _Node; }

  insert(key) {
    if (this.root === null) {
      this.root = new BinaryTree.Node(key);
      return;
    }
    let x = this.root, y;
    let newNode = new BinaryTree.Node(key);
    while (x !== null) {
      y = x;
      x = x[key < x.key ? 'left' : 'right'];
    }
    newNode.parent = y;
    y[key < y.key ? 'left' : 'right'] = newNode;
  }

  find(key, n = this.root) {
    if (n === null || n.key === key) return n;
    return this.find(key, n[key < n.key ? 'left' : 'right']);
  }

  delete(key) {
    const n = this.find(key);
    if (n === null) return;
    let leftOrRight = n.getLeftOrRight();
    switch (n.getChildrenNumber()) {
    case 0:
      n.parent[leftOrRight] = null;
      break;
    case 1:
      n.parent[leftOrRight] = n.left || n.right;
      n.parent[leftOrRight].parent = n.parent;
      break;
    default:
      let skey = n.getSuccessor().key;
      this.delete(skey);
      n.key = skey;
    }
  }

  printByIneorder() {
    let str = '';
    const innerFunc = (n) => {
      if (n === null) return;
      innerFunc(n.left);
      str += ` ${n.key}`;
      innerFunc(n.right);
    }
    innerFunc(this.root);
    console.log(str);
  }

  printByPreorder() {
    let str = '';
    const innerFunc = (n) => {
      if (n === null) return;
      str += ` ${n.key}`;
      innerFunc(n.left);
      innerFunc(n.right);
    }
    innerFunc(this.root);
    console.log(str);
  }

  print() {
    this.printByIneorder();
    this.printByPreorder();
  }
}

(function main(){
  const lines = require('fs').readFileSync('/dev/stdin', 'utf8').trim().split('\n');
  const n = Number(lines.shift());

  const tree = new BinaryTree();
  lines.forEach(function(cmd) {
    switch (cmd.charAt(0)) {
    case 'i': tree.insert(Number(cmd.split(' ')[1])); break;
    case 'f': console.log(tree.find(Number(cmd.split(' ')[1])) ? 'yes' : 'no'); break;
    case 'd': tree.delete(Number(cmd.split(' ')[1])); break;
    default: tree.print();
    }
  });
})();



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

int main(){
	long long int a[200000] = {}, maxw = 1, maxt = -1000000000;
	int n;
	cin >> n;

	for (int i = 0; i < n; i++){
		cin >> a[i];
	}
	for (int l = 0; l < n; l++){
		if (maxw < a[n-l-1]){
			maxw = a[n-l-1];
		}
		if (maxw-a[n-l-2] > maxt) maxt = maxw-a[n-l-2];
	}

	cout << maxt << "\n";

	return 0;
}


Measured memory_bytes: 4680
using System;
using System.Collections.Generic;
using System.Text;

namespace ConsoleApplication2
{
    class Program
    {


        static void Main(string[] args)
        {
            string[] lines = Console.ReadLine().Split(' ');
            int a = int.Parse(lines[0]);
            int b = int.Parse(lines[1]);
            int c = int.Parse(lines[2]);

            int num = 0;

            for (int x = a; x <= b; x++)
            {
                if ((c % x) == 0)
                    num++;
            }
            Console.WriteLine(num);
        }
    }
}

Measured memory_bytes: 9224
#include <iostream>
#include <string>
#include <vector>

int main()
{
    int num;
    std::cin >> num;

    std::vector<int> a(num);

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

    int prev = 0;

    for (auto it = a.cbegin(); it != a.cend();) {
        int n = *it;
        if (prev == n) {
            it = a.erase(it);
        }
        else {
            it++;
        }
        prev = n;
    }

    int result = 0;

    for (int i = 1; i < a.size() - 1; i++) {
        if (a[i - 1] < a[i] && a[i] > a[i + 1]) {
            result++;
            i++;
        }
        else if (a[i - 1] > a[i] && a[i] < a[i + 1]) {
            result++;
            i++;
        }
    }

    result += 1;

    std::cout << result << std::endl;

    return 0;
}

Measured memory_bytes: 768
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main(void){
  int numx, numy;
  scanf("%d %d", &numx, &numy);
  int zahyou_x[numx];
  int zahyou_y[numy];
  for(int i=0; i<numx; i++){
    scanf("%d", &zahyou_x[i]);
  }
  for(int i=0; i<numy; i++){
    scanf("%d", &zahyou_y[i]);
  }
  long long int x_sum = 0, y_sum = 0;
  for(int i=0; i<numx; i++){
    x_sum = (x_sum + (long)zahyou_x[i] * (i*2 - numx + 1))%1000000007;
  }
  for(int i=0; i<numy; i++){
    y_sum = (y_sum + (long)zahyou_y[i] * (i*2 - numy + 1))%1000000007;
  }
  printf("%lld\n", (x_sum * y_sum)%1000000007);
  return 0;
}


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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N,T;
int A[101010];


void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N>>T;
	FOR(i,N) cin>>A[i];
	
	int dm=0;
	int tm=0;
	int ret=0;
	for(i=N-1;i>=0;i--) {
		if(tm-A[i]>dm) dm=tm-A[i], ret=0;
		if(tm-A[i]==dm) ret++;
		tm=max(tm,A[i]);
	}
	cout<<ret<<endl;
	
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n';
	FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	solve(); return 0;
}


Measured memory_bytes: 640
while True:
  m,f,r=map(int,input().split())
  if (m,f,r)==(-1,-1,-1):
    break
  h=m+f
  if m == -1 or f == -1:
    print('F')
  elif h >= 80:
    print('A')
  elif h>=65 and h<80:
    print('B')
  elif h>=50 and h<65:
    print('C')
  elif h>=30 and h<50 and r>=50:
    print('C')
  elif h>=30 and h<50 and r<50:
    print('D')
  else:
    print('F')


Measured memory_bytes: 5592
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE BinaryLiterals #-}
{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE NumDecimals #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TupleSections #-}

import Control.Applicative
import Control.Arrow
import Control.Monad
import Control.Monad.ST

import Data.Char
import Data.List
import Data.Maybe

import qualified Data.ByteString.Char8 as B

import Data.Array.ST.Safe
import Data.STRef

import Debug.Trace
import Text.Printf

readInt = readLn :: IO Int
readInts = map ( fst . fromJust . B.readInt ) . B.words <$> B.getLine
readNInts = readInt >>= flip replicateM readInt

which a b f = if f then a else b
mp [ a, b ] = ( a, b )

main = do
	n <- readInt
	as <- readInts
	print $ maximum $ solve 0 ( scanr1 gcd $ tail as ) as

solve l [] _ = [l]
solve l (r:rs) (a:as) = gcd l r : solve ( gcd l a ) rs as

Measured memory_bytes: 27004
#include<bits/stdc++.h>
#define fo(i,a,b) for(register int (i)=(a);(i)<=(b);++(i))
#define rd read()
#define maxn 200001
#define gc getchar()
#define mem(a,b) memset(a,b,sizeof(a))
#define mp make_pair
#define ll long long
#define ull unsigned ll
#define pb push_back
#define db double
#define pu puts(" ")
using namespace std;
const int p=998244353;
int read()
{
	int x=0,f=1;
	char ch=gc;
	while(!isdigit(ch))
	{
		if(ch=='-')f=-1;
		ch=gc;
	}
	while(isdigit(ch))x=x*10+ch-48,ch=gc;
	return x*f;
}
void print(int x)
{
	if(x<0)putchar('-'),x=-x;
	if(x>9)print(x/10);
	putchar(x%10+48);
}
int qp(int a,int b)
{
	int ans=1;
	while(b)
	{
		if(b&1)ans=(ll)ans*a%p;
		a=(ll)a*a%p;
		b>>=1;
	}
	return ans;
}
int main()
{
	char a[10005];
	int m,n;
	cin>>m>>n;
	for(int i=0; i<m; i++)
	{
		for(int j=0; j<n; j++)
		{
			scanf("%s",a);
			if(a[0]=='s'&&a[1]=='n'&&a[2]=='u'&&a[3]=='k'&&a[4]=='e')
				return printf("%c%d\n",'A'+j,i+1),0;
		}
	}
	return 0;
}

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

using namespace std;
using ll =long long;
typedef pair<int,int> P;
#define SORT(a) sort((a).begin(),(a).end())
#define rSORT(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define debug(x)  cerr << #x << " = " << (x) << endl;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//Write From this Line

int main()
{
	int x, y;
	cin >> x >> y;

	for(int i = 0; i <= 100; i++){
		int asi =  2 * i + (x - i) * 4;
		if(x-i >= 0){
			if(asi == y){
				cout << "Yes" << endl;
				return 0; 
			}
		}
	}
	cout << "No" << endl;
}


Measured memory_bytes: 3628
#include <iostream>
#include <vector>
#include <unordered_map>
#include <map>
#include <algorithm>
#include <set>
#include <unordered_set>
#include <deque>
#include <cmath>
#include <stack>
#include <queue>
#include <string>
#include <iomanip>
#include <cstring>
#include <climits>
#include <cstdio> 

#define nl '\n'

using namespace std;

long long x, b = 100, y;

int main() {

    cin >> x;

    while(b < x) {
        y++;
        b += (0.01 * b);
    }

    cout << y;



}
 
//g++ -std=c++14 comp.cpp -o c && c.exe
//g++ -std=c++14 comp.cpp -o c; ./c.exe
//g++ -std=c++14 comp.cpp && ./a.out

Measured memory_bytes: 3620
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;

const ll INF = 100000000000000;

class SegmentTree
{
    int nn;
    ll dat[1100000];
    
public:
    SegmentTree(int nnn){
        nn = nnn;
        fill(dat, dat + nn * 2, INF);
    }
    
    void add(int a, int b, ll x, int k, int l, int r){
        if(a <= l && r <= b){
            dat[k] = min(dat[k], x);
        }
        else if(a < r && l < b){
            add(a, b, x, k * 2, l, (l + r) / 2);
            add(a, b, x, k * 2 + 1, (l + r) / 2, r);
        }
    }
    
    ll ans(int k){
        ll res = INF;
        int now = k + nn;
        while(now){
            res = min(res, dat[now]);
            now /= 2;
        }
        return res;
    }
    
    void show(){
        for(int i = 0; i < nn * 2; i++) cout << i << " " << dat[i] << endl;
    }
};

int main()
{
    int n, q;
    cin >> n >> q;
    ll a[400004];
    ll s[200002], t[200002], x[200002];
    for(int i = 0; i < n; i++){
        cin >> s[i] >> t[i] >> x[i];
        s[i] -= x[i];
        t[i] -= x[i];
        a[i * 2] = s[i];
        a[i * 2 + 1] = t[i];
    }
    sort(a, a + n * 2);
    int nn = 1;
    while(nn < n * 2) nn *= 2;
    SegmentTree sg(nn);
    for(int i = 0; i < n; i++){
        int l = lower_bound(a, a + n * 2, s[i]) - a;
        int r = upper_bound(a, a + n * 2, t[i]) - a;
        sg.add(l, r - 1, x[i], 1, 0, nn);
    }
    ll d[200002];
    for(int i = 0; i < q; i++){
        cin >> d[i];
        int w = upper_bound(a, a + n * 2, d[i]) - a;
        if(w == n * 2 || w == 0 || sg.ans(w - 1) == INF) cout << -1 << endl;
        else cout << sg.ans(w - 1) << endl;
    }
}

Measured memory_bytes: 19456
#include<stdio.h>

int main(){
    int i,n,F[44];

    scanf("%d",&n);

    F[0]=F[1]=1;

    for(i=2;i<=n;i++) F[i]=F[i-2]+F[i-1];

    printf("%d\n",F[n]);

    return 0;
}

Measured memory_bytes: 596
/******************************************************************************

Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl,
C#, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog.
Code, Compile, Run and Debug online from anywhere in world.

*******************************************************************************/
#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 10;
long long int n , a , b , d , c;
vector<pair<long long int ,long long int> > v;
map<long long int , long long int> mp;
queue<long long int> q;
long long int carry = 0 , ans ;
int main(){
    cin >> n >> d >> c;
    for(int i = 0 ; i < n ; i++){
        cin >> a >> b;
        v.push_back(make_pair(a , b));
    }
    sort(v.begin() , v.end());
    for(int i = 0 ; i < n ; i++){
        while(!q.empty()){
            long long int val = q.front();
            if(val >= v[i].first)break;
            carry -= mp[val];
            q.pop();
        }
        if(v[i].second <= carry){ 
            continue;}
        v[i].second -= carry;
        long long int val = v[i].second / c + (v[i].second % c != 0);
        long long int costt = 1LL * val * c;
        ans += val;
        carry += costt;
        long long int go = 2 * d;
        mp[v[i].first + go ] += costt;
        q.push(v[i].first + go);
       // carry -= mp[v[i].first];
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 16620
process.stdin.resume();
process.stdin.setEncoding('utf8');

// 標準入力取込
let gInput = '';
process.stdin.on('data', (chunk) => (gInput += chunk));
process.stdin.on('end', () => main(gInput.split(/\r?\n/)));

// 解答
function main(inputs: string[]): void {
  const num = inputs[0].split(' ')[0];

  if (num.indexOf('7') !== -1) {
    console.log('Yes');
  } else {
    console.log('No');
  }
}


Measured memory_bytes: 29948
#include<stdio.h>
int main(void)
{
	int L,a,b,c,d;
	scanf("%d %d %d %d %d",&L,&a,&b,&c,&d);
	if(a%c>0){
		a=a/c+1;
	}
	else{
		a=a/c;
	}
	if(b%d>0){
		b=b/d+1;
	}
	else{
		b=b/d;
	}
	if(a>=b){
		printf("%d\n",L-a);
	}
	else{
		printf("%d\n",L-b);
	}
	return 0;
}


Measured memory_bytes: 2072
#include <bits/stdc++.h>
using namespace std;
int main()
  {int N, m(1e7), W; cin >> N;
  vector<int> S(N + 1); for (int i{}; i < N; ++i) cin >> W, S[i + 1] = S[i] + W;
  for (int T{1}; T < N; ++T) m = min(m, abs(2 * S[T] - S[N]));
  cout << m;}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define pll pair<ll,ll>
#define pint pll
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
  string s;
  cin >> s;
  if(s=="ABC")cout << "ARC";
  else cout << "ABC";
  cout << endl;
return 0;}

Measured memory_bytes: 3548
#include<bits/stdc++.h>
using namespace std;
struct XY
{
	int x;
	int y;
};
int main ()
{
	int n;
	cin>>n;
	while(n!=0)
	{
		vector<XY> a;
		XY j;
		j.x=0;
		j.y=0;
		a.push_back(j);
		for(int i=0;i<n-1;i++)
		{
			int x,y;
			cin>>x>>y;
			j=a[x];
			switch(y)
			{
			case 0:
				j.x--;
				break;
			case 1:
				j.y--;
				break;
			case 2:
				j.x++;
				break;
			case 3:
				j.y++;
				break;
			}
			a.push_back(j);
		}
		int q,w,e,r;
		q=0;w=0;e=0;r=0;
		for(int i=0;i<a.size();i++)
		{
			if(a[i].x>q)q=a[i].x;
			if(a[i].x<w)w=a[i].x;
			if(a[i].y>e)e=a[i].y;
			if(a[i].y<r)r=a[i].y;
		}
		cout<<abs(q-w)+1<<" "<<abs(e-r)+1<<endl;
		
		cin>>n;
	}
}

Measured memory_bytes: 1220
import math

D, G = map(int, input().split())
p = []
c = []
for _ in range(D):
    tmp_p, tmp_c = map(int, input().split())
    p.append(tmp_p)
    c.append(tmp_c)

# あるグループの問題をコンプすると、1問あたりの得点が実質100i+ci/pi点となる
# 各グループの問題について、コンプするかしないか全通り試す
# このボーナス込みの1問あたりの得点が大きい所から貪欲に解けばよい

point_per_q_including_bonus = [(100*idx + c[idx])/p[idx] for idx in range(D)]

sum_n_solve_list = []

for bit in range(2**D):
    comp_group_flag = []
    for idx in range(D):
        if ((bit>>idx) & 1):
            comp_group_flag.append(1)
        else:
            comp_group_flag.append(0)
    point_per_q = [100*(idx+1) + c[idx]/p[idx] if comp_group_flag[idx] == 1 else 100*(idx+1) for idx in range(D)]
    pointIDX = zip(point_per_q, comp_group_flag, p)
    pointIDX = sorted(pointIDX, reverse = True, key = lambda x: x[0])
    score = 0
    sum_n_solve = 0
    group = 0
    while score < G and group < D:
        if pointIDX[group][1] == 1:
            n_solve = pointIDX[group][2]
            sum_n_solve += n_solve
            score += pointIDX[group][0] * n_solve
            group += 1
        else:
            # コンプしないので最大でもグループに含まれる問題の数-1までしか解けないことに注意
            n_solve = min(math.ceil((G-score)/pointIDX[group][0]), pointIDX[group][2]-1)
            sum_n_solve += n_solve
            score += pointIDX[group][0] * n_solve
            group += 1
    if score >= G:
        sum_n_solve_list.append(sum_n_solve)

print(min(sum_n_solve_list))

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

typedef long long ll;

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define ANS(n) cout << (n) << endl

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FORR(i,a,b) for(int i=(a);i>=(b);i--)

#define ALL(obj) (obj).begin(),(obj).end()

#define pii pair<int,int>

#define pb(a) push_back(a)
#define mp make_pair

int main()
{
	ll n,a,b;
	cin >> n >> a >> b;
	ll ans = max(0ll, ((n-1) * b + a) - ((n-1) * a + b) + 1);
	ANS(ans);
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <limits>
#include <random>
#include <complex>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <tuple>
#include <cassert>
using namespace std;
typedef long long ll;
#define REP(i,n) for (int i = 0; i < n; i++)
template <class T> using reversed_priority_queue = priority_queue<T, vector<T>, greater<T> >;

int N;
int a[100010];
int b[100010];
int deg[100010];
vector<int> G[100010];
map<pair<int,int>,int> ans;
bool used[100010];

void dfs (int v, int pre)
{
    if (used[v]) {
        return;
    }
    set<int> used_t;
    //cerr << "deg " << G[v].size() << endl;
    REP(i,G[v].size()) {
        pair<int,int> et = make_pair(min(v, G[v][i]), max(v, G[v][i]));
        if (ans.find(et) != ans.end()) {
            used_t.insert(ans[et]);
        }
    }
    int cnt = 1;
    REP(i,G[v].size()) {
        pair<int,int> et = make_pair(min(v, G[v][i]), max(v, G[v][i]));
        if (ans.find(et) == ans.end()) {
            while (used_t.find(cnt) != used_t.end()) {
                cnt++;
            }
            used_t.insert(cnt);
            ans[et] = cnt;
        }
    }
    used[v] = true;
    REP(i,G[v].size()) {
        dfs(G[v][i], v);
    }
}


int main ()
{
    cin >> N;
    REP(i,N - 1) cin >> a[i + 1] >> b[i + 1];
    REP(i,N - 1) {
        deg[a[i + 1]]++;
        deg[b[i + 1]]++;
        G[a[i + 1]].push_back(b[i + 1]);
        G[b[i + 1]].push_back(a[i + 1]);
    }

    dfs(1, 0);

    set<int> col;
    for (auto &x: ans) {
        col.insert(x.second);
    }

    cout << col.size() << endl;
    REP(i,N - 1) {
        pair<int,int> e = make_pair(min(a[i + 1], b[i + 1]), max(a[i + 1], b[i + 1]));
        cout << ans[e] << endl;
    }
    
    return 0;
}


Measured memory_bytes: 25344
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; --i)
#define FOR(i, m, n) for (int i = m; i < n; ++i)
#define FORR(i, m, n) for (int i = m; i >= n; --i)
#define ALL(v) (v).begin(),(v).end()
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; }
const ll INF=1LL<<60;
const int inf=(1<<30)-1;
const int mod=1e9+7;
int dx[8]={1,0,-1,0,-1,-1,1,1};
int dy[8]={0,1,0,-1,-1,1,-1,1};
const int nmax=200005;
vector<int> res(nmax);
vector<bool> mem(nmax);
ll f(int x){
    if(mem[x]){
        return res[x];
    }
    if(x==0){
        mem[x]=true;
        return res[x]=0;
    }
    int num=x;
    int cnt=0;
    while(num){
        if(num&1){
            cnt++;
        }
        num/=2;
    }
    int p=x%cnt;
    mem[x]=true;
    return res[x]=1+f(p);
}
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;cin >> n;
    string x;cin >> x;
    int pop=0;
    REP(i,n){
        if(x[i]=='1'){
            pop++;
        }
    }
    if(pop==1){
        vector<int> t(n);
        t[0]=1;
        FOR(i,1,n){
            t[i]=t[i-1]*2%(pop+1);
        }
        int v=0;
        REP(i,n){
            if(x[i]=='1'){
                (v+=t[n-1-i])%=(pop+1);
            }
        }
        REP(i,n){
            if(x[i]=='1'){
                cout << 0 << endl;
            }
            else{
                int k=(v+pop+1+t[n-1-i])%(pop+1);
                cout << 1+f(k) << endl;
            }
        }
    }
    else{
        vector<int> s(n),t(n);
        s[0]=1;
        t[0]=1;
        FOR(i,1,n){
            s[i]=s[i-1]*2%(pop-1);
            t[i]=t[i-1]*2%(pop+1);
        }
        int u=0,v=0;
        REP(i,n){
            if(x[i]=='1'){
                (u+=s[n-1-i])%=(pop-1);
                (v+=t[n-1-i])%=(pop+1);
            }
        }
        REP(i,n){
            if(x[i]=='1'){
                int k=(u+pop-1-s[n-1-i])%(pop-1);
                cout << 1+f(k) << endl;
            }
            else{
                int k=(v+pop+1+t[n-1-i])%(pop+1);
                cout << 1+f(k) << endl;
            }
        }
    }
}

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

int main(void) {
    int N,D; cin >> N >> D;
    int count = 0;
    for(int i=0; i<N; i++) {
        int X,Y; cin >> X >> Y;
        double kyori = pow(pow(X,2.0) + pow(Y,2.0),0.5);
        if(D >= kyori) count++;
    }
    cout << count << endl;
}

Measured memory_bytes: 4224
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Numerics;

namespace AtCoderWorkspace
{
    public class Solver
    {
        public void Solve()
        {
            var cin = new Scanner();
            var a = cin.nextInt();
            var b = cin.nextInt();
            var c = cin.nextInt();



            Console.WriteLine(c + " " + a + " " + b);
        }
    }

    class Scanner
    {
        string[] s;
        int i;

        char[] cs = new char[] { ' ' };

        public Scanner()
        {
            s = new string[0];
            i = 0;
        }

        public string next()
        {
            if (i < s.Length) return s[i++];
            string st = Console.ReadLine();
            while (st == "") st = Console.ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            if (s.Length == 0) return next();
            i = 0;
            return s[i++];
        }

        public int nextInt()
        {
            return int.Parse(next());
        }
        public int[] ArrayInt(int N, int add = 0)
        {
            int[] Array = new int[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextInt() + add;
            }
            return Array;
        }

        public int[] DPArrayInt(int N, int ex)
        {
            int[] Array = new int[N + ex];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextInt();
            }
            return Array;
        }

        public long nextLong()
        {
            return long.Parse(next());
        }

        public long[] ArrayLong(int N, long add = 0)
        {
            long[] Array = new long[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextLong() + add;
            }
            return Array;
        }

        public long[] DPArrayLong(int N, int ex)
        {
            long[] Array = new long[N + ex];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextLong();
            }
            return Array;
        }

        public double nextDouble()
        {
            return double.Parse(next());
        }


        public double[] ArrayDouble(int N, double add = 0)
        {
            double[] Array = new double[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextDouble() + add;
            }
            return Array;
        }
    }

    class Program
    {
        static void Main(string[] s) => new Solver().Solve();
    }
}


Measured memory_bytes: 13140
#include <iostream>
#include <vector>
#include <cstdio>
#include <cassert>
#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
using namespace std;
int ans;
int n,k,s;
vector<int> debug;
void checker(int st,int dep,int cnt);
int main() {
  while(true){
    cin >> n >> k >> s;
    if(n==0&&k==0&&s==0) break;
    ans=0;
    checker(0,1,0);
    cout << ans << endl;
  }
  return 0;
}

void checker(int st,int dep,int cnt){
  if(dep<k) REP(i,st,n){
      debug.push_back(i+1);
      checker(i+1,dep+1,cnt+i+1);
      debug.pop_back();
    }else REP(i,st,n) if(cnt+i+1==s){
      ans++;
      //      rep(j,k-1) cout << debug[j] << ",";
      //      cout << i+1 << endl;
    }
}

Measured memory_bytes: 3144
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
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(x, name)in(x)
#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(x,v) for(auto &x:(v))
#define all(x) (x).begin(),(x).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();}

void solve() {
  VAR(int, X, Y);
  vl v = {0, 1, 2, 1, 3, 1, 3, 1, 1, 3, 1, 3, 1};
  print(v[X] == v[Y] ? "Yes" : "No");
}


Measured memory_bytes: 256
macro_rules! get {
    (Vec<$t:ty>) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
            get!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
            get!($($t),*)
        ).collect::<Vec<_>>()
    };
}

fn main() {
    let (A, B) = get!(i64, i64);

    let ans = if A + B >= 10 {
        "error".to_string()
    } else {
        (A + B).to_string()
    };

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

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


long long x, g, tmp;
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    
    cin >> x;
    g = __gcd(360LL, x);
    tmp = 360LL / g;
    cout << tmp;
    
	return 0;
}


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

#define loop(n) for(int i = 0;i < (int)(n);++i)
#define rep(i,n) for(int i = 0;i < (int)(n);++i)
#define all(vec) (vec).begin(),(vec).end()
#define sort(vec) std::sort(all(vec))
#define rev(vec) std::reverse(all(vec))

void input(){return;}
template<typename First,typename... Rest> void input(First &first,Rest&... rest){
    std::cin >> first;
    input(rest...);
}

void inputVector(){return;}
template<typename First,typename... Rest> void inputVector(std::vector<First> &first,Rest&... rest){
    int N = first.size();
    for(int i = 0;i < N;i++){
        std::cin >> first[i];
    }
    inputVector(rest...);
}

template<typename First,typename Second> void inputTwoVector(std::vector<First> &first,std::vector<Second>& second){
    int N = first.size();
    for(int i = 0;i < N;i++){
        std::cin >> first[i] >> second[i];
    }
}

void calculate(){
    int N;input(N);
    std::vector<int> a(N); inputVector(a);
    sort(a);
    rev(a);
    int res = 0;
    for(int i = 0;i < N;++i){
        if(i % 2 == 0) res += a[i];
        else res -= a[i];
    }
    std::cout << res << '\n';
}

int main(int,char**){
    calculate();    
}




Measured memory_bytes: 256
def examA():
    S = SI()
    T = "AKIHABARA"
    ans = "YES"
    d = defaultdict(int)
    L = len(T); cur = 0
    for s in S:
        d[s] +=1
        while(cur<L):
            if s==T[cur]:
                break
            cur +=1
        if cur>=L:
            ans = "NO"
            break
        cur += 1
    if d["K"]<1 or d["I"]<1 or d["H"]<1 or d["B"]<1 or d["R"]<1:
        ans = "NO"
    print(ans)
    return


import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

if __name__ == '__main__':
    examA()


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


int main(){
    int N, A[(int)2e5], max=0;
    scanf("%d", &N);
    for(int i=0;i<N;i++){
        scanf("%d", &A[i]);
        if(max<A[i]) max = A[i];
    }
    // end input

    int e[(int)1e6+1] = {0};
    for(int i=0;i<N;i++){
        int n = A[i];
        for(int j=A[i]*2;j<max+1;j+=A[i]){
            e[j] = 1;
        }
    }

    int count = 0;
    for(int i=0;i<N;i++){
        if(e[A[i]] == -1){
            count--;
            e[A[i]] = -2;
            continue;
        }
        if(e[A[i]]==0){
            //printf("match: %d\n", A[i]);
            e[A[i]] = -1;
            count++;
        }
    }
    printf("%d\n", count);

    return 0;
}



Measured memory_bytes: 6404
/* 
	Author: ankrypt
*/


#include <bits/stdc++.h>

using namespace std;

#define MOD 1000000007
#define ll long long int
#define u64 unsigned long long int

double arr[15];
string S[15];
ll N;

int main() {
	scanf("%lld", &N);
	for(int i = 0; i < N; i++) {
		scanf("%lf", &arr[i]);
		cin >> S[i];
	}
	double sum = 0;
	for(int i = 0; i < N; i++) {
		if(S[i] == "JPY") {
			sum += arr[i];
		}
		else {
			sum += arr[i] * 380000.0;
			// cout << fixed << setprecision(9) << sum << " ";
		}
	}
	printf("%.9lf\n", sum);
	return 0;
}
/*
	Powered by Buggy Plugin
*/


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define dbg(x) cerr << #x << " = " << x << endl
#define all(x) begin(x), end(x)
#define _ << ' ' <<
using namespace std;
using ll = long long;

int a[300][300];
pair<int, int> f[300 * 300 + 1];

int main()
{
    int h, w, d;
    cin >> h >> w >> d;
    for (int i = 0; i < h; ++i)
        for (int j = 0; j < w; ++j)
            cin >> a[i][j], f[a[i][j]] = {i, j};

    vector<vector<int>> rsq(d);
    for (int i = 1; i <= h * w; ++i)
    {
        if (i + d > h * w) continue;
        int p, q, r, s;
        tie(p, q) = f[i];
        tie(r, s) = f[i + d];
        rsq[i % d].push_back(abs(p - r) + abs(q - s));
    }
    for (vector<int>& v : rsq)
        for (int i = 1; i < v.size(); ++i)
            v[i] += v[i - 1];

    int q;
    cin >> q;
    while (q--)
    {
        int l, r;
        cin >> l >> r;
        int step = (r - l) / d;
        auto sum = [](vector<int>& v, int l, int r)
        {
            int ret = v[r];
            if (l)
                ret -= v[l - 1];
            return ret;
        };
        cout << (step ? sum(rsq[l % d], (l - 1) / d, (l - 1) / d + step - 1) : 0)<< '\n';
    }
}


Measured memory_bytes: 3584
#include<bits/stdc++.h>
#define ll long long
#define endl '\n'
using namespace std;
#define fast ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

ll func(ll n)
{

    ll count = 1;
    ll tempC=1;
    while (n % 2 == 0)
    {
        tempC++;
        n = n/2;
    }
    count *= tempC;

    for (ll i = 3; i*i <= n; i = i + 2)
    {
        tempC=1;
        while (n % i == 0)
        {
            tempC++;
            n = n/i;
        }
        count *= tempC;
    }


    if (n > 2)
        count *= 2;
    return count;
}

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

    ll sum=0;

    for(ll i=1;i<n;i++)
        sum += func(i);

    cout<<sum;

    return 0;
}


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

#define froop1(a,n) for(int i = a;i < n;i++)
#define froop2(a,n) for(int i = a;i > n;i--)
int main(){
	int N;
  cin >> N;
  long long sum = 0;
  froop1(0,N){
    int a;
    cin >>a;
    sum += a - 1;
  }
  cout << sum << endl;

return 0;
}

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

int n;
vector<int> vi;
vector<int> cur;
map<int,int> occ;
vector<int> tmp;

int main(){
	scanf("%d",&n);
	for(int i=0;i<(1<<n);i++){
		int x;
		scanf("%d",&x);
		vi.push_back(x);
		occ[-x]++;
	}
	sort(vi.begin(),vi.end());
//	for(int i=0;i<vi.size();i++) cout << vi[i] << " ";
//	cout << endl;
	int idx = (1<<n)-1;
	cur.push_back(-vi[idx]);
	idx--;
	for(int i=0;i<n;i++){
//		cout << i << endl;
		tmp.clear();
		for(int j=0;j<cur.size();j++){
			map<int,int>::iterator it = occ.upper_bound(cur[j]);
			if(it == occ.end()){
				cout << "No\n";
				return 0;
			}
			int nil = it->first;
//			cout << "GET " << nil << endl;
			tmp.push_back(nil);
			occ[nil]--;
			if(occ[nil] == 0) occ.erase(nil);
//			if(cur[j] <= vi[idx-j]){
//				cout << "No\n";
//				return 0;
//			}
		}
		int pan = tmp.size();
		for(int j=0;j<pan;j++){
			cur.push_back(tmp[j]);
//			idx--;
		}
	}
	cout << "Yes\n";
	return 0;
}


Measured memory_bytes: 15476
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
using namespace std;
using ll=long long;
#define rep(i,a,b) for(ll i=a;i<ll(b);i++)
#define repr(i,a,b) for(ll i=a;i>=ll(b);i--)
#define endl "\n"
#define ALL(x) x.begin(),x.end()
#define ALLR(x) x.rbegin(),x.rend()
#define INF 1e9
#define DEBUG(x) cout<<"debug: "<<x<<endl

string s, t;
int main() {
    cin >> s >> t;

    int maxMuch = 0;
    int sl = s.length(), tl = t.length();
    rep(i, 0, sl - tl + 1){
        int much = 0;
        rep(k, 0, tl){
            if(s[i+k] == t[k]) much++;
        }
        maxMuch = max(maxMuch, much);
    }

    int ans = tl - maxMuch;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3148
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iomanip>
#include <numeric>
#include <queue>
#include <cmath>
using namespace std;

int main() {
    int h, w;
    cin >> h >> w;
    vector<string>vs;
    int ch, cw, dh, dw;
    cin >> ch >> cw >> dh >> dw;
    ch--, cw--, dh--, dw--;
    
    for (int i = 0; i < h; i++) {
        string s;
        cin >> s;
        vs.push_back(s);
    }
    int res = 0;
    vector<pair<int, int>> vp1, vp2, vp3;
    vector<vector<int>> v(h, vector<int>(w, 0));
    v[ch][cw] = 1;
    vp1.push_back(make_pair(ch, cw));
    vector<vector<int>> dir{{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
    while (vp1.size() > 0) {
        vp3.clear();
        while (vp1.size() > 0) {
            int x = vp1.back().first, y = vp1.back().second;
            vp3.push_back(make_pair(x, y));
            vp1.pop_back();
            for (auto d : dir) {
                int nx = x + d[0], ny = y + d[1];
                if (nx < 0 || ny < 0 || nx >= h || ny >= w || vs[nx][ny] == '#') continue;
                if (v[nx][ny] == 0) {
                    vp1.push_back(make_pair(nx, ny));
                    v[nx][ny] = 1;
                }
            }
        }

        vp2.clear();
        vp1.clear();
        for (auto p : vp3) {

            int x = p.first, y = p.second;
            if (x == dh && y == dw) {
                cout << res << endl;
                return 0;
            }
            for (int i = -2; i <= 2; i++) {
                for (int j = -2; j <= 2; j++) {
                    int nx = x + i, ny = y + j;
                    if (nx < 0 || ny < 0 || nx >= h || ny >= w || vs[nx][ny] == '#') continue;
                    if (v[nx][ny] == 0) {
                        v[nx][ny] = 1;
                        vp1.push_back(make_pair(nx, ny));
                    }
                }
            }
        }
        res++;
    }
    cout << -1 << endl;
}


Measured memory_bytes: 8696