akhauriyash/Code-Regression huggingface dataset:
N=int(input())
h=list(map(int,input().split()))
Min=h[N-1]
for i in range(len(h)):
	Min=min(Min,h[N-1-i])
	if  Min==h[N-1-i] or Min+1==h[N-1-i]:
		h[N-1-i]=Min
	else:
		print('No')
		break
else:
	print('Yes')

Measured memory_bytes: 14224
/** omgursocute **/
#include <bits/stdc++.h>

using namespace std;
typedef int64_t ll;
typedef uint64_t ull;
typedef long double ld;

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

	ll n;
	cin >> n;
	ll ct = 0;
	for(int i = 1; i <= n; i++)
		if((int)log10(i) % 2 == 0) ++ct;

	cout << ct;
	
	cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << " ms.\n";
}

// g++ o .cpp -O2 -std=c++11 -D cute -Wall -Wno-unused-result



Measured memory_bytes: 640
#include <stdio.h>
#include <math.h>
int abs(int n){
    if(n > 0){
        return n;
    } else {
        return -n;
    }
}


int main(){
  int n, m, c;
  scanf("%d %d %d", &n, &m, &c);
  int b[m];
  for(int i = 0; i < m; i++){
      scanf("%d", &b[i]);
  }
  
  int a[n][m];
  for(int i = 0; i < n; i++){
      for(int j = 0; j < m; j++){
          scanf("%d", &a[i][j]);
      }
  }

  int count = 0;
  int sum;
  for(int i = 0; i < n; i++){
      sum = 0;
      for(int j = 0; j < m; j++){
        sum += a[i][j]*b[j];
      }
      //sum += c;
      if(sum+c > 0){
          count++;
      }
  }
  

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


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

int main(){
	int r,c,S[101][101]={0};
	cin >> r >> c;
	for(int i=0;i<r;i++){
		for(int j=0;j<c;j++){
			cin >> S[i][j];
			S[i][c]+=S[i][j];
		}
	}

	for(int i=0;i<=c;i++){
		for(int j=0;j<r;j++){
			S[r][i]+=S[j][i];
		}
	}

	for(int i=0;i<=r;i++){
		for(int j=0;j<=c;j++){
			if(j)cout << " ";
			cout << S[i][j];
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 3112
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("sse,sse2")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

template<class T>
using ordered_set = tree <T, null_type ,  less<T> ,  rb_tree_tag ,  tree_order_statistics_node_update>;

template<class T>
using ordered_multiset = tree <T, null_type ,  less_equal<T> ,  rb_tree_tag ,  tree_order_statistics_node_update>;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

using vi = vector<int>;
using ii = pair<int, int>;
using vii = vector<ii>;
using vvi = vector<vi>;
using vvii = vector<vii>;

#define all(x) x.begin(), x.end()
#define all_r(x) x.rbegin(), x.rend()
#define pb push_back
#define FOR(i, n) for(int i = 0; i < (n); ++i)
#define REP(i, n) for(int i = n; i >= 0; --i)
#define f first
#define s second

int main() {
	ios_base :: sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int X, p[102] = {0}, n;
	cin >> X >> n;
	FOR(i, n) {
		int a;
		cin >> a;
		p[a] = 1;
	}
	int Y = 101, Z;
	for(int i = 0; i <= 101; ++i) {
		if(!p[i] && abs(X - i) < Y) {
			Y = abs(X - i);
			Z = i;
		}
	}
	cout << Z << '\n';
 	return 0;
}

Measured memory_bytes: 3560
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		List<Integer> cards = new ArrayList<Integer>();
		for(int i = 0; i < n; ++i) {
			int card = scan.nextInt();
			cards.add(card);
		}
		scan.close();

		int aliceSum = 0;
		int bobSum = 0;
		boolean aliceTurn = true;

		for(int i=0; i<cards.size(); ++i) {
			if(aliceTurn) {
				aliceSum += getMax(cards);
			} else {
				bobSum += getMax(cards);
			}
			aliceTurn = !aliceTurn;
		}
		System.out.println(aliceSum - bobSum);

	}

	public static int getMax(List<Integer> cards) {
		int max = -1;
		int id = -1;
		for(int i=0; i<cards.size(); ++i) {
			if(cards.get(i) > max) {
				max = cards.get(i);
				id = i;
			}
		}
		cards.set(id,0);
		return max;
	}
}

Measured memory_bytes: 21844
# コンテストは
# 1 回目から順に ABC001,ABC002,... と名付けられてきましたが、
# 999回目のコンテスト ABC999 を終え、これからのコンテストの名前をどうするかという問題が生じました。
# そこで、1000回目から1998回目のコンテストを順に ABD001,ABD002,...,ABD999 と名付けることとなりました。
#
# 1 以上 1998 以下の整数 N が与えられるので、
# N 回目のコンテストの名前の最初の 3 文字を出力してください。

# 標準入力から コンテストの回数 N を取得する
input_n = int(input())

# 取得した N を頼りに、最初の3文字（AB*）を出力する
reslut_str = 'ABC'
if input_n > 1999:
    result_str = 'The contest has not been held'
else:
    if input_n < 1000:
        reslut_str = 'ABC'
    elif input_n >= 1000:
        reslut_str = 'ABD'

print(reslut_str)


Measured memory_bytes: 9144
h,w,d=map(int,input().split())
ind={}
for i in range(h):
    l=list(map(int,input().split()))

    for j in range(w):
        ind[l[j]]=(i,j)
table=[0]*((((h*w)//d).bit_length())*h*w)
now=1
for i in range(1,h*w-d+1):
    a,s=ind[i]
    de,f=ind[i+d]
    table[i-1+d]=abs(a-de)+abs(s-f)
step=2
for i in range(1,((h*w)//d).bit_length()):
    for j in range(1,h*w-step*d+1):
        table[j-1+step*d+i*h*w]=table[j-1+d*step//2+(i-1)*h*w]+table[j-1+d*step+(i-1)*h*w]
    step*=2
#print(*[table[k*h*w:k*w*h+h*w]for k in range(((h*w)//d).bit_length())],sep="\n")
q=int(input())
for i in range(q):
    l,r=map(int,input().split())
    times=(r-l)//d
    cost=0
    now=1
    kata=0
    while times:
        if times%2:
            l+=d*now
            cost+=table[l-1+kata*h*w]

        times//=2
        now*=2
        kata+=1
    print(cost)

Measured memory_bytes: 74460
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int D = scanner.nextInt();
        int[][] xArr = new int[N][D];
        for (int i = 0; i < N; i++) {
            for (int k = 0; k < D; k++) {
                xArr[i][k] = scanner.nextInt();
            }
        }

        int count = 0;
        for (int h = 0; h < N; h++) {
            for (int i = h+1; i < N; i++) {
                double distance = 0;
                for (int k = 0; k < D; k++) {
                    distance += Math.pow(Math.abs(xArr[h][k] - xArr[i][k]), 2);
                }
                double result = Math.sqrt(distance);
                if (result == (int)result) count++;
            }
        }
        System.out.println(count);
    }
}

Measured memory_bytes: 21844
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		double power = 1;		
		for(int i = 1; i <= N; i++){
			power = (i * power) % (Math.pow(10, 9)+7);
		}
		System.out.println((int)power);
		sc.close();
         }
}
	

Measured memory_bytes: 23892
N,M = map(int,input().split())
##1からきている&&Nに行ける

road = [0]*N

for _ in range(M):
    a,b = map(int,input().split())

    if a == 1:
        road[b-1] += 1
    elif b == N:
        road[a-1] += 1

if 2 in road:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

Measured memory_bytes: 10424
import java.io.PrintWriter;
import java.util.*;

public class Main {
	static class Pair {
		int index;
		long value;
		public Pair(int index, long value) {
			this.index = index;
			this.value = value;
		}
		
	}
	static class Tree {
		public class Edge {
			int to, rev;

			public Edge(int to, int rev) {
				this.to = to;
				this.rev = rev;
			}
		}
		
		int V;
		ArrayList<ArrayList<Edge>> G;
		int root;
		int[] p;
		int[] v;
		
		public Tree(int[] a, int[] b) {
			this.V = a.length+1;
			p = new int[V];
			v = new int[V];
			
			G = new ArrayList<ArrayList<Edge>>();
			for(int i=0; i<V; i++) {
				G.add(new ArrayList<Edge>());
			}
			
			for(int i=0; i<V-1; i++) {
				G.get(a[i]).add(new Edge(b[i], G.get(b[i]).size()));
				G.get(b[i]).add(new Edge(a[i], G.get(a[i]).size()-1));
			}
			setRoot(0);
		}
		
		public void setRoot(int root) {
			this.root = root;
			setRoot(root, -1);
		}
		public void setRoot(int cur, int parent) {
			p[cur] = parent;
			for(int i=0; i<G.get(cur).size(); i++) {
				int next = G.get(cur).get(i).to;
				if(next!=parent) {
					setRoot(next, cur);
				}
			}
		}
		public void add(int index, int value) {
			v[index] += value;
		}
		
		public ArrayList<Pair> traverse() {
			ArrayList<Pair> result = new ArrayList<>();
			traverse(0, 0, result);
			return result;
		}

		void traverse(int index, int value, ArrayList<Pair> result) {
			result.add(new Pair(index, value+v[index]));
			
			ArrayList<Edge> node = G.get(index);
			for(Edge e : node) {
				if(e.to != p[index])
					traverse(e.to, value + v[index], result);
			}
		}
	}
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		PrintWriter pw = new PrintWriter(System.out);
		int N = sc.nextInt();
		int Q = sc.nextInt();
		int[] a = new int[N-1];
		int[] b = new int[N-1];
		for(int i=0; i<N-1; i++) {
			a[i] = sc.nextInt()-1;
			b[i] = sc.nextInt()-1;
		}
		
		Tree tree = new Tree(a, b);
		
		for(int i=0; i<Q; i++) {
			int p = sc.nextInt()-1;
			int x = sc.nextInt();
			tree.add(p, x);
		}
		
		ArrayList<Pair> result = tree.traverse();
		
		Collections.sort(result, new Comparator<Pair>() {
			public int compare(Pair p1, Pair p2) {
				return Integer.compare(p1.index, p2.index);
			}
		});
		
		for(int i=0; i<N; i++)
			pw.print(result.get(i).value + (i==N-1 ? "\n" : " "));
		
		pw.close();
		sc.close();
	}
}

Measured memory_bytes: 236420
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <vector>

#define INF 1000000000;
#define NODE 10000;

using namespace std;
int A[50],B[50],N,M,W,K,T,ans,a[200000],b[200000];
bool use_v[50],pre_e[50][50],use_e[50][50];
int ord[50],low[50],k;
string S,ex,af;

int abs(int x){
	if(x<0){
		return -x;
	}
	return x;
}

int min(int x,int y){
	if(x<y)return x;
	return y;
}
int max(int x,int y){
	if(x>y)return x;
	
	return y;
}

int main(){
	cin>>N;
	for(int i=0;i<N;i++){
		cin>>a[i];
	}
	W=1;
	K=0;
	if(N%2==1){
		b[(N-1)/2]=a[0];
		for(int i=1;i<=((N-1)/2);i++){
			b[((N-1)/2)+i]=a[W];
			W++;
			b[((N-1)/2)-i]=a[W];
			W++;
		}
		for(int i=0;i<N;i++){
			cout<<b[i]<<" ";
		}

	}else{
		for(int i=1;i<=(N/2)+1;i++){
			b[((N)/2)+i-1]=a[K];
			K++;
			b[((N)/2)-i]=a[K];
			K++;
		}
		for(int i=0;i<N;i++){
			cout<<b[i]<<" ";
		}
	}

	return 0;
}


Measured memory_bytes: 3712
#include <bits/stdc++.h>
using namespace std;
int a[200005], b[200005], c[200005];
map<int, int> cnt1, cnt2;
int n;
bool solve(vector<int> f, vector<pair<int, int> > x){
    bool ok = 1;
    for(int i=1;i<=n;i++){
        if(!x.empty()){
            if(x.back().first == a[i]){
                pair<int, int> temp = x.back();
                x.pop_back();
                if(!x.empty()){
                    x.back().second--;
                    c[i] = x.back().first;
                    if(x.back().second == 0) x.pop_back();
                }
                else{
                    if(f.empty()){
                        ok = 0;
                        break;
                    }
                    c[i] = f.back();
                    f.pop_back();
                }
                x.emplace_back(temp);
            }
            else{
                x.back().second--;
                c[i] = x.back().first;
                if(x.back().second == 0) x.pop_back();
            }
        }
        else{
            if(f.empty()){
                ok = 0;
                break;
            }
            c[i] = f.back();
            f.pop_back();
        }
    }
    return ok;
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    srand(178);

    cin >> n;
    vector<int> v;
    for(int i=1;i<=n;i++){
        cin >> a[i];
        cnt1[a[i]]++;
    }
    vector<int> f;
    vector<pair<int, int> > x;
    for(int i=1;i<=n;i++){
        cin >> b[i];
        cnt2[b[i]]++;
        if(!cnt1.count(b[i])) f.emplace_back(b[i]);
    }

    for(auto it:cnt2){
        if(cnt1.count(it.first)){
            x.emplace_back(make_pair(it.first, it.second));
        }
    }
    vector<int> f2 = f;
    vector<pair<int, int> > x2 = x;
    bool ok;
    for(int j=0;j<100;j++){
        f = f2;
        x = x2;
        ok = 1;
        random_shuffle(x.begin(), x.end());
        ok = solve(f, x);
        if(ok) break;
    }
    if(ok){
        printf("Yes\n");
        for(int i=1;i<=n;i++) printf("%d ", c[i]);
        printf("\n");
    }
    else printf("No\n");
}

Measured memory_bytes: 28808
#include<iostream>
#include<stdlib.h>
using namespace std;

int main(){
  int N;
  int h[100100];
  int dp[100010];
  cin >> N ;
  for(int i=0;i<N;i++){
    cin >> h[i] ;
  }
  for (int i = 0; i < 100010; ++i) dp[i] = 10000000;
  
  dp[0] = 0;
  dp[1] = abs(h[1]-h[0]);
  for(int i=1;i<N;i++){
    dp[i+1] = min(dp[i]+abs(h[i+1]-h[i]),dp[i-1]+abs(h[i+1]-h[i-1]));
  }
  
  cout << dp[N-1] << endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < n; ++i)
using ll = long long;
const ll MOD = 1000000007;//998244353;
struct UnionFind {
  vector<int> d;
  UnionFind(int n=0): d(n,-1) {}
  int find(int x) {
    if (d[x] < 0) return x;
    return d[x] = find(d[x]);
  }
  bool unite(int x, int y) {
    x = find(x); y = find(y);
    if (x == y) return false;
    if (d[x] > d[y]) swap(x,y);
    d[x] += d[y];
    d[y] = x;
    return true;
  }
  bool same(int x, int y) { return find(x) == find(y);}
  int size(int x) { return -d[find(x)];}
};
int main() {
   ios::sync_with_stdio(false);
   cin.tie(0);
   int n, m; cin >> n >> m;
   UnionFind uf(n);
   vector<int> p(n);
   rep(i,n){
      cin >> p[i];
      p[i]--;
   }
   rep(i,m){
      int x,y; cin >> x >> y;
      x--;y--;
      uf.unite(x,y);
   }
   int ans = 0;
   rep(i,n)
      ans += (uf.same(i,p[i]));
   cout << ans << endl;
}

Measured memory_bytes: 3976
#include<iostream>

using namespace std;

int main(){
	int N,s1,s2,s3;
	cin>>N;
	while(N--){
		cin>>s1>>s2>>s3;
		s1 = s1 * s1;
		s2 = s2 * s2;
		s3 = s3 * s3;
		if(s1 == s2 + s3 || s2 == s1 + s3 || s3 == s2 + s1){
			cout<<"YES"<<endl;
		}else{
			cout<<"NO"<<endl;
		}
	}
	return 0;
}

Measured memory_bytes: 1152
///cREATED bY BERNARB.01
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef tree<int,null_type,less<int>,rb_tree_tag, tree_order_statistics_node_update> indexed_set;
typedef priority_queue<int,vector<int>,greater<int>> pqil;
typedef priority_queue<int> pqig;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef pair<int, pii> piii;
typedef priority_queue<pii> pqiig;
typedef vector<pii> vii;
typedef vector<piii> viii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
typedef map<int, int> mii;
#define mid ((l+r)/2)
#define PB push_back
#define PP pop_back
#define PF push_front
#define DF pop_front
#define F first
#define S second
#define MP make_pair
#define C continue
#define B break
#define R return
#define sz(v) (int)(v).size()
#define len(s) (int)(s).length()
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define clr(arr, x) memset((arr), (x), sizeof (arr))
#define loop(n) for(int i=0; i<(n); i++)
#define lop(a, n) for(int i=(a); i<(n); i++)
#define jloop(n) for(ll j=0; j<(n); j++)
#define kloop(n) for(ll k=0; k<(n); k++)
#define gloop(n) for(ll g=0; g<(n); g++)
#define rloop(n) for(ll i=(n)-1; i>=0; i--)
#define sgm(y) (((y)*((y)+1))/2)
const ll INF = 2e17+423;
const ll mod = 1e9+7; //998244353;
const ld pi = acos(-1.0);
const ld cmpf = 1e-9;
//__int128_t
//      -ASCII-
//a -> z | A -> Z | 0 -> 9
//97 122 | 65  90 | 48  57
#define endl '\n'
ll po(ll,ll);

























int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    ll a, b;
    cin >> a >> b;
    cout << (a*b)/__gcd(a, b) << endl;
    R 0;
}
/*

*/




























































ll po(ll x, ll n){
  if(n==0) R 1;
  ll y = po(x, n/2);
  y = ((y)*(y));
  if(n%2) y = (y*(x));
  R y;
}


Measured memory_bytes: 256
num = int(input(""))
seqs = list(map(int,input().split())) #แยกทุกตัวฝนบรรทัดแล้วเก็บค่าเป็น int 
count = 0
    #วน loop ตามจำนวนตัวเลขที่ input เข้ามาในบรรทัดแรก
for i in range(num): 
    #กำหนดให้ minindex = i ถ้ารอบแรกก็เป็น index ที่ 0 คือ เลขที่อยู่ตำแหน่งแรก
    minIndex = i 
    #วน loop ตามจำนวนตั้งแต่ 0-4 เพื่อใช้เป็นการดึง index
    #ของบรรทัดที่ input ข้อมูลตัวแรกเข้ามา
    for j in range(i,num):
    #ถ้าหากตำแหน่งที่ j น้อยกว่าตำแหน่งที่ minindex ให้เปลี่ยนค่า minindex เป็น j
        if seqs[j] < seqs[minIndex]:
            minIndex = j
            
    #ถ้าตำแหน่ง minindex ไม่เท่ากับ i และ  seqs[j] >= seqs[minIndex]
    #ให้ทำการ swap สลับตำแหน่ง        
    if minIndex != i:
        seqs[i],seqs[minIndex]=seqs[minIndex],seqs[i]
        count+=1
    #แสดงผล sequence ทั้งหมดออกมาเป็น string รวมถึงแสดงผลว่าทำการ swap ไปกี่รอบ
print(" ".join(map(str, seqs)))
print(count)



Measured memory_bytes: 5596
import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy

N, X, T = map(int, input().split())

print((N + X - 1) // X * T)

Measured memory_bytes: 9692
#define _USE_MAT_DEFINES
#include<iostream>
#include <iomanip>
#include<stdio.h>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include <queue>
#include <utility>
#include <map>
#include <set>
#include <stack>
#include <deque>
#include <numeric>
#include <functional>
using namespace std;

int main() {
    int N, M;
    cin >> N >> M;
    vector<int>a(M),b(M);
    vector<vector<bool>>pass(N+1, vector<bool>(N+1, false));
    for (int i = 0; i < M; i++) {
        cin >> a[i] >> b[i];
        pass[a[i]][b[i]] = pass[b[i]][a[i]] = true;
    }

    int ans = 0;
    for (int i = 0; i < M; i++) {
        vector<bool>isVisited(N + 1, false);
        pass[a[i]][b[i]] = pass[b[i]][a[i]] = false;

        queue<int>q;
        q.push(1);
        while (!q.empty()) {
            int now = q.front(); q.pop();
            isVisited[now] = true;
            for (int i = 1; i <= N; i++) {
                if (pass[now][i] == true && isVisited[i] == false)q.push(i);
            }
        }

        if (count(isVisited.begin(), isVisited.end(), false)>1)ans++;
        pass[a[i]][b[i]] = pass[b[i]][a[i]] = true;
    }

    cout << ans << endl;

    return 0;
}

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

int main() {
  int n,buf,ans=0;
  cin >>n;
  int a[n];
  for (int i=0;i<n;i++) {
    cin >> buf;
    a[i]=buf;
  }
  bool can=true;
  while (can) {
    for (int i=0;i<n;i++) {
      if (a[i]%2!=0) can=false;
    }
    if (can) {
      for (int i=0;i<n;i++) a[i] /=2;
      ans++;
    }
  }
  cout << ans <<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <limits>
#include <iomanip>
using namespace std;
#define ll long long
#define rep(i, s, n) for(int i = s; i < n; i++)

ll gcd(ll a, ll b) {
    return b ? gcd(b, a%b) : a;
}

int main() {
    ll n, m;
    cin >> n >> m;
    string s, t;
    cin >> s >> t;
    ll l = n*m/gcd(n, m);

    ll p = l/n;
    ll q = l/m;
    ll r = p*q/gcd(p, q);
    for(ll i = 0; i < l; i+=r) {
        if(!(s[i/p] == t[i/q])) {
            cout << -1 << endl;
            return 0;
        }
    }
    cout << setprecision(20) << l << endl;
    return 0;
}

Measured memory_bytes: 512
N,Q = map(int,input().split())
S = input()

CS_l = [0] 
CS_r = [0,0]
for i in range(2,N+1):
    if S[i-2:i] == "AC":  
        CS_l.append(CS_l[-1]+1)
        CS_r.append(CS_r[-1]+1)
    else:
        CS_l.append(CS_l[-1])
        CS_r.append(CS_r[-1])
        
for _ in range(Q):
    l,r = map(int,input().split())
    print(CS_r[r]-CS_l[l-1])


Measured memory_bytes: 8524
N = int(input())
A = list(map(int, input().split()))

from fractions import gcd
from itertools import accumulate

X = list(accumulate(A, gcd))
Y = list(accumulate(A[::-1], gcd))

Y.insert(0,0)
X.insert(0,0)

ans = -1
for i in range(N):
  ans = max(ans, gcd(X[i], Y[N-1-i]))

print(ans)

Measured memory_bytes: 14584
n, k = gets.chomp.split(" ").map(&:to_i)
h = gets.chomp.split(" ").map(&:to_i)
 
dp = Array.new(n, 0)
dp[0] = 0
dp[1] = (h[1] - h[0]).abs
 
for i in 2..n - 1
  min = Float::INFINITY
  for j in 1..k
    break if i - j < 0
 
    cost = dp[i - j] + (h[i] - h[i - j]).abs
 
    if cost < min
      min = cost
    end
  end
  dp[i] = min
end
 
puts dp[n - 1]

Measured memory_bytes: 13860
#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: 3084
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>

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

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

    if (A * C < B)
        cout << C << endl;

    else
        cout << B / A << endl;

    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
long long q,h,s,d,n,ans;
int main()
{
	scanf("%lld%lld%lld%lld%lld",&q,&h,&s,&d,&n);
	if(q*2<h)h=2*q;
	if(h*2<s)s=2*h;
	if(s*2<d)d=2*s;
	n<<=2;
	long long num=n/8;
	ans+=num*d,n-=num*8;
	num=n/4;
	ans+=num*s,n-=num*4;
	num=n/2;
	ans+=num*h,n-=num*2;
	ans+=num*q;
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 128
// abc106_b
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) rep(i,v.size())cout<<" "<<v[i];cout<<endl<<endl;
#define show2d(v) rep(i,v.size()){rep(j,v[i].size())cout<<" "<<v[i][j];cout<<endl;}cout<<endl;
using namespace std;
typedef long long ll;
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={0,1,0,-1};
int dy[] = {1, 0, -1, 0};

int main(int argc, char *argv[])
{
  int n, cnt, ans=0;
  cin>>n;
  for (int i=1; i<=n; ++i) {
    cnt = 0;
    for(int j=1; j<=n; ++j) {
      if (i % 2 != 0 && i % j == 0) {
        cnt++;
      }
    }
    if (cnt == 8) {
      ans++;
    }
  }
  cout<<ans<<endl;
  return 0;
}


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

typedef long long LL;

const int maxn=2e5+5;

int n;

int main()
{
	scanf("%d",&n);
	if (n==1) {puts("No"); return 0;}
	
	double dt=log(n)/log(2);
	int t=dt;
	if ((1<<t)==n) {puts("No"); return 0;}
	
	puts("Yes");
	for(int i=2; i+1<=n; i+=2)
	{
		printf("%d %d\n",i,i+1);
		printf("%d %d\n",i+1,1);
		printf("%d %d\n",1,n+i);
		printf("%d %d\n",n+i,n+i+1);
	}
	printf("2 %d\n",1+n);
	
	if (!(n&1))
	{
		printf("%d %d\n",n,(1<<t)+1);
		printf("%d %d\n",n-(1<<t)+n,n+n);
	}
}

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

int main() {

  int N,K,count=0;
  cin>>N>>K;
  
  vector<int> A(N);
  for(int i=0; i<N; i++){
    cin>>A.at(i);}
  for(int i=0; i<N;i++){
    if(A.at(i)>=K){count++;}
  }
 
	cout<<count<<endl;
}


Measured memory_bytes: 640
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<cstring>
using namespace std;
const int maxn=1e5+5;
int n,h[maxn],minn[maxn];
void update(int now,int next)
{
    if(next<=n)
        minn[next]=min(minn[next],minn[now]+abs(h[now]-h[next]));
    return;
}
int main()
{
    int k;
    scanf("%d%d",&n,&k);
    for(int i=1;i<=n;i++)
        scanf("%d",&h[i]);
    memset(minn,0x3f,sizeof(minn));
    minn[1]=0;
    for(int i=1;i<=n;i++)
        for(int j=1;j<=k;j++)
            update(i,i+j);
    printf("%d\n",minn[n]);
    return 0;
}


Measured memory_bytes: 4588
#include <iostream>
#include <cstdio>
int array[31];

void swap(int a, int b) {
  int c = array[a];
  array[a] = array[b];
  array[b] = c;
}

int main(void) {
  int w, n, a, b;
  for(int i = 0 ; i < 31 ; i++) {
    array[i] = i;
  }
  scanf("%d %d", &w, &n);
  for(int i = 0 ; i < n ; i++) {
    scanf("%d,%d", &a, &b);
    swap(a, b);
  }
  for(int i = 1 ; i <= w ; i++){
    printf("%d\n", array[i]);
  }
  return 0;
}

Measured memory_bytes: 0
N,M=map(int,input().split())
A=[""]*N
B=[""]*M
for i in range(N):
  A[i]=input()
for i in range(M):
  B[i]=input()
  
A_tmp=[""]*M
for i in range(N-M+1):
  for j in range(N-M+1):
    for k in range(M):
      A_tmp[k]=A[j+k][i:i+M]
    if A_tmp==B:
      print("Yes")
      exit(0)

print("No")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int INF = 1000000000;
#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
#define rep(i,n) REP(i, 0, n)
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    map<string, int> ac;
    ac["lu"] = ac["ru"] = 1;
    ac["ld"] = ac["rd"] = -1;
    int N;
    while(cin >> N && N){
        int sum = 0, cnt = 0;
        bool climbed = false;
        rep(i, N){
            string a; cin >> a;
            sum += ac[a];
            if(sum == 2 && !climbed){
                climbed = true;
                cnt++;
            }
            if(sum == 0 && climbed){
                climbed = false;
                cnt++;
            }
        }
        cout << cnt << endl;
    }
    return 0;
}

Measured memory_bytes: 1228
# coding=utf-8


def vector_product(vect1, vect2):
    return [el1 * el2 for el1, el2 in zip(vect1, vect2)]


def inner_product(vect1, vect2):
    return sum(vector_product(vect1, vect2))


def cross_product(vect1, vect2):
    return vect1[0]*vect2[1] - vect1[1]*vect2[0]


def vector_minus(vect1, vect2):
    return [el1 - el2 for el1, el2 in zip(vect1, vect2)]


def line_slope(line_from, line_to):
    try:
        slope = (line_to[1] - line_from[1])/(line_to[0] - line_from[0])
    except ZeroDivisionError:
        slope = "未定義"
    return slope


"""
def is_parallel(l_from1, l_to1, l_from2, l_to2):
    slope1 = line_slope(l_from1, l_to1)
    slope2 = line_slope(l_from2, l_to2)
    if slope1 == slope2:
        return 1
    return 0
"""


def is_parallel(l_from1, l_to1, l_from2, l_to2):
    line1 = vector_minus(l_to1, l_from1)
    line2 = vector_minus(l_to2, l_from2)
    if cross_product(line1, line2) == 0:
        return 1
    return 0


def is_orthogonal(l_from1, l_to1, l_from2, l_to2):
    line1 = vector_minus(l_to1, l_from1)
    line2 = vector_minus(l_to2, l_from2)
    if inner_product(line1, line2) == 0:
        return 1
    return 0


if __name__ == '__main__':
    Q = int(input())

    for i in range(Q):
        all_list = list(map(int, input().split()))
        p0_list = all_list[:2]
        p1_list = all_list[2:4]
        p2_list = all_list[4:6]
        p3_list = all_list[6:]

        if is_parallel(p0_list, p1_list, p2_list, p3_list):
            print("2")
        elif is_orthogonal(p0_list, p1_list, p2_list, p3_list):
            print("1")
        else:
            print("0")



Measured memory_bytes: 5660
#include<bits/stdc++.h>
#define rep(i,x,y) for(register int i = x; i <= y; ++ i)
#define repd(i,x,y) for(register int i = x; i >= y; -- i)
typedef long long ll;
using namespace std;
template<typename T>inline bool chkmax(T&x,T y) { return x < y ? x = y,1 : 0; }
template<typename T>inline bool chkmin(T&x,T y) { return x > y ? x = y,1 : 0; }
template<typename T>inline void read(T&x)
{
	char c;int sign = 1;x = 0;
	do { c = getchar(); if(c == '-') sign = -1; }while(!isdigit(c));
	do { x = x * 10 + c - '0'; c = getchar(); }while(isdigit(c));
	x *= sign;
}
ll n,p;
const int N = 1e6 + 50;
bool vis[N]; int prime[N],cnt;

inline void pre(int n)
{
	rep(i,2,n)
	{
		if(!vis[i]) prime[++cnt] = i;
		for(register int j = 1;prime[j] * i <= n && j <= cnt; ++ j )
		{
			vis[i * prime[j]] = 1;
			if(i % prime[j] == 0) break;
		}
	}
}

int main()
{
	pre(N-50);
	read(n); read(p);
	if(n == 1) return printf("%lld",p),0;
	
	ll ans = 1;
	rep(i,1,cnt)
	{
		int x = 0;
		while(p % prime[i] == 0)
			p/=prime[i],++x;
		int t = x / n;
		while(t --) ans *= prime[i];
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3328
N = int(input())
ab_list = []
for _ in range(N):
    ab_list.append([int(x) for x in input().split()])
    
ab_list = sorted(ab_list, key=lambda x: x[-1])

sum_work = 0
res = 'Yes'
for a, b in ab_list:
    sum_work += a
    if sum_work > b:
        res = 'No'
        break
print(res)

Measured memory_bytes: 42832
n,m=map(int,input().split())
l=[]
r=[]
for i in range(m):
  li,ri=map(int,input().split())
  l.append(li)
  r.append(ri)
 
l_max=max(l)
r_min=min(r)
 
if r_min < l_max:
  print(0)
else:
  print(r_min-l_max+1)

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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}

using namespace std;

using ll=long long;

const ll mod=1000000007LL;

inline ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
inline ll ADD(const ll &a, const ll &b,const ll &mod) { return a+b<mod?a+b:a+b-mod;}
inline ll SUB(const ll &a, const ll &b,const ll &mod) { return a-b>=0?a-b:a-b+mod;}
inline ll MUL(const ll &a, const ll &b,const ll &mod) { return (1LL*a*b)%mod;}
inline ll INV(ll a,ll mod){ll x,y;extgcd(a,mod,x,y);return (x%mod+mod)%mod;}
inline ll DIV(const ll &a, const ll &b,const ll &mod) {return MUL(a,INV(b,mod),mod);}
inline ll POW(ll a,ll n,ll mod){ll b=1LL;for(a%=mod;n;a=MUL(a,a,mod),n>>=1)if(n&1) b=MUL(b,a,mod); return b;}

ll dp[5010][5010];

string s;

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

	const int m=s.size();
	dp[0][0]=1LL;
	rep(i,n)rep(j,n+1){
		dp[i+1][j+1]=ADD(dp[i+1][j+1],MUL(2LL,dp[i][j],mod),mod);
		dp[i+1][max(0,j-1)]=ADD(dp[i+1][max(0,j-1)],dp[i][j],mod);
	}

	cout << DIV(dp[n][m],POW(2LL,m,mod),mod) << endl;
	return 0;
}

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

int main() {
  double l;
  cin >> l;
  double x = l/3;
  double ans = pow(x,3);
  printf("%.10f\n", ans);
  return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
/*{{{*/  //template
#define REP(i,n) for(int i=0;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1<<29
#define LINF LLONG_MAX/3
#define MP make_pair
#define PB push_back
#define pb push_back
#define EB emplace_back
#define ALL(v) (v).begin(),(v).end()
#define all(v) ALL(v)
#define sz(x) (int)(x).size()
#define debug(x) cerr<<#x<<":"<<x<<endl
#define debug2(x,y) cerr<<#x<<","<<#y":"<<x<<","<<y<<endl
//struct fin{ fin(){ cin.tie(0); ios::sync_with_stdio(false); } } fin_;
struct Double{ double d; explicit Double(double x) : d(x){} };
ostream& operator<<(ostream& os,const Double x){ os << fixed << setprecision(20) << x.d; return os; }
template<typename T> ostream& operator<<(ostream& os,const vector<T>& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os,const pair<T,U>& p){ os << "(" << p.first << ","<< p.second <<")"; return os; }
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
ll gcd(ll a,ll b){ if(b==0) return a; else return gcd(b,a%b); }
constexpr double eps = 1e-14; 
constexpr ll mod = 1e9+7;
const int dx[]={1,0,-1,0} ,dy[] = {0,1,0,-1};
/*}}}*/

int N;
constexpr int n = 26;

void solve(){
    vector<int> c(N);
    rep(i,N){
        char cc;
        cin>>cc;
        c[i] = cc-'A';
    }

    vi cnt(n,0);
    rep(i,N){
        cnt[c[i]]++;
        vi t(cnt);
        sort(all(t));
        reverse(all(t));
        int mx1 = t[0];
        int mx2 = t[1];
        int rem = N-1-i;
        if(mx1-mx2>rem){
            rep(j,n) if(cnt[j]==mx1){
                cout << (char)('A'+j) << " " << (i+1) << endl;
                return;
            }
        }
    }
    cout << "TIE" << endl;
}

int main(){
    while(cin >> N){
        if(N==0) break;
        solve();
    }
}

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

using namespace std;

#define EACH(i,a) for (auto& i : a)
#define FOR(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define RFOR(i,a,b) for(int i=(int)b-1;i>=(int)a;--i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define debug(x) cerr << #x << ":" << x << endl;
#define OK(ok) cout << (ok ? "Yes" : "No") << endl;
typedef long long ll;

void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail) {
  cin >> head; CINT(move(tail)...);
}
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)

const int INF = 1e9 + 1;
const int MOD = 1e9 + 7;
const int MAX_N = 1e5 + 1;

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

  CIN(N, K);
  int num = 1;
  REP(i, N) {
    num = min(num * 2, num + K);
  }

  cout << num << endl;

  return 0;
}



Measured memory_bytes: 256
#include <stdio.h>

int main() {
	int a = 500;
	int b, c, d;
	scanf("%d %d", &b, &c);
	
	d = a * b;
	
	if(d < c) {
		printf("No");
	} else {
		printf("Yes");
	}
	
	return 0;
}

Measured memory_bytes: 3204
#include <iostream>

using namespace std;

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

    if(n == 22) cout << "Christmas Eve Eve Eve" << '\n';
    else if(n == 23) cout << "Christmas Eve Eve" << '\n';
    else if(n == 24) cout << "Christmas Eve" << '\n';
    else cout << "Christmas" << '\n';
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC080A
{
    class Program
    {
        static void Main(string[] args)
        {
            int n, a, b, x;
            var word = Console.ReadLine().Split(' ');

            n = int.Parse(word[0]);
            a = int.Parse(word[1]);
            b = int.Parse(word[2]);

           
            if (n*a <= b)
                x =n*a ;
            else 
                x = b;

            Console.WriteLine(x);
            Console.ReadKey();
        }
    }
}


Measured memory_bytes: 11092
#!/usr/bin/env python3
import sys, os
try: from typing import Any, Union, List, Tuple, Dict
except ImportError: pass
sys.setrecursionlimit(10**6)
if os.environ.get("USER") == "shun":
    def debug(*args): print(*args, file=sys.stderr)
else:
    print("NO DEBUG", file=sys.stderr)
    def debug(*args): pass
def exit(): sys.exit(0)


n, m = map(int, input().split())

p = 10**9 + 7
# 素因数分解
def prime_factorization(n):
    factors = {}
    q = 2
    while n != 1:
        if q**2 > n:
            factors[n] = 1
            break
        while n % q == 0:
            n = n // q
            if q in factors:
                factors[q] += 1
            else:
                factors[q] = 1
        q += 1
    return factors


def power(n, e):
    # debug(".")
    if e == 0:
        return 1
    if e % 2 == 0:
        return power(n**2%p, e//2) % p
    return n * power(n, e-1) % p


def inv(n):
    return power(n, p-2)


# def comb(a, b):
#     if a < b:
#         a, b = b, a
#     assert a >= b
#     res = 1
#     for i in range(a+1, a+b+1):
#         res = (res * i) % p
#     for i in range(1, b+1):
#         res = (res * inv(i)) % p
#     return res


bunbo = 1
for i in range(1, n):
    # debug(i)
    bunbo = (bunbo * i) % p
debug("foo")
bunbo = inv(bunbo)
debug("hoge")

ans = 1
fact = prime_factorization(m)
for q in fact:
    debug(q)
    k = fact[q]
    cur = 1
    for i in range(k+1, n+k):
        cur = (cur * i) % p
    ans = (ans * cur) % p
ans = (ans * power(bunbo, len(fact))) % p
print(ans)


Measured memory_bytes: 41036
//s.empty() //emptyなら1を出力 入っていれば0を出力
/*//ABC018-B 部分的にreverseをかける解法
int main() {
  string s;
  cin >> s;
  int n;
  cin >> n;
  vector<int>a(n);
  vector<int>b(n);
  rep(i,n) cin>>a.at(i)>>b.at(i);
  rep(i,n)a.at(i)--;
  rep(i,n)b.at(i)--;
  string t;
  rep(i,n){
    t = s;
    for(int k=0;k<=b.at(i)-a.at(i);k++){
      t.at(a.at(i)+k) = s.at(b.at(i)-k);
    }
    s = t;
  }
  cout << s << endl;
}
*///ABC018-B
//  string s;
//  cin >> s;
//  cout << s.at(0) <<endl;
//  cout << s.at(0)-'0' <<endl;
//  Aが16？
//  cout << char(i+48) << endl;//なぜかaは47と得る時がある。+48で出力もaにできる。
//  cout << char(97) << endl;//アスキーコードでaを出力
// sort(b.begin(), b.end());//bという配列を小さい方からソート
// reverse(b.begin(), b.end());//bという配列をリターン
// 10桁でdouble出力するパターン１ 
// printf("%.10f\n", ma);
// 10桁でdouble出力するパターン２
//cout << fixed << setprecision(10);
//  cout << ma << endl;

/*01 02 03 12 13 23　と６回見ていくパターン 
for(int i=0;i<n-1;i++){
  for(int j=i+1;j<n;j++){
    }
  }
*///vector<vector<int>> data(3, vector<int>(4));//int型の2次元配列(3×4要素の)の宣言
//int64_t a;
//10のi乗pow(10, i);
/*string s; stringでの文字列を数字型に変える方法
  cin >> s;
  rep(i,s.size()-2) {
  int a= (s.at(i)-'0')*100 + (s.at(i+1)-'0')*10+ s.at(i+2) -'0';
    */
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
  string s,t;
  cin >> s;
  if(s=="ABC")cout<<"ARC"<<endl;
  else cout<<"ABC"<<endl;
}


Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int L,R;
	int D;
	cin >> L >> R >> D;
	int cnt = 0;
	for(int i = L;i <= R;i++){
		if(i % D == 0){
			cnt++;
		}
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 3632
#include "bits/stdc++.h"
#define rep(i,b) for(ll i=0;i<b;i++)
#define ll long long
using namespace std;
/*--Input//////////////////////////////////////////////////*/
inline void IN(void){return;}
template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){cin >> first;IN(rest...);return;}
#define SS(T, ...)      T __VA_ARGS__; IN(__VA_ARGS__);
#define SV(type,c,n) vector<type> c(n);for(auto& i:c)cin >> i;
/*--Output/////////////////////////////////////////////////*/
inline int p(void){cout << endl; return 0;}
template<class Head> int p(Head&& head){cout << head;p();return 0;} template<class Head,class... Tail> int p(Head&& head,Tail&&... tail){cout<<head<<" ";p(forward<Tail>(tail)...);return 0;}
struct ProconInit {
    static constexpr bool AUTOFLUSH = false;
    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(20);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;

#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl10
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define vl vector<ll>
#define debug(x) cerr<<#x<<" "<<x<<'\n';
#define all(x) (x).begin(),(x).end()
#define bit(n) (1LL<<(n))
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; }
bool cmp(pair<ll,ll> a, pair<ll,ll> b) { return a.first+a.second > b.first+b.second; }

map< int64_t, int > prime_factor(int64_t n) {
    map< int64_t, int > ret;
    for(int64_t i = 2; i * i <= n; i++) {
        while(n % i == 0) {
            ret[i]++;
            n /= i;
        }
    }
    if(n != 1) ret[n] = 1;
    return ret;
}

signed main() {
  SS(ll,a);
  ll ans=0;
auto q = prime_factor(a);
for (auto itr=q.begin(); itr!=q.end(); ++itr) {
int soinnsuu_kosuu = itr->second;
  for(int i=1;i<10000000;i++){
    if(i*(i+1)/2>soinnsuu_kosuu){
      ans+=i-1;
      break;
  }
}
}
p(ans);
}

Measured memory_bytes: 3660
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    ごちゃごちゃ場合分けを考える前に全探索は考えましたか？
*/

int main(){
    ll N, K; cin >> N >> K;
    ll ans = K;
    for(int i=0; i<N-1; i++) ans *= K-1;

    cout << ans << endl;
}

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

int main(){
  int n;
  cin>>n;
  int a,b;
  for(int i=0;i<n;i++){
    int l,r;
    cin>>l>>r;
    a=r-l;
    b+=a+1;
    }
  cout<<b<<endl;
  }

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int q,a,b,c,d;
	scanf("%d",&q);
	while(q--)
	{
		scanf("%d%d%d%d",&a,&b,&c,&d);
		c--;
		long long x=(max(a,b)-1)/(min(a,b)+1)+1;
		long long la,lb;
		if(a>=x*b)
			la=a+b,lb=0;
		else if(b>=x*a)
			la=0,lb=a+b;
		else
			la=(x*a-b)/(x-1),lb=(x*b-a)/(x-1);
		bool cB=a-la+la/(x+1)-lb/(x+1)==0;
		for(int i=c;i<d;i++)
		{
			bool isB=i<la?i%(x+1)==x:i>=a+b-lb?(a+b-i-1)%(x+1)!=x:cB;
			printf("%c",isB?'B':'A');
		}
		puts("");
	}
	return 0;
}


Measured memory_bytes: 384
using System;
using System.Collections.Generic;
using System.Linq;

namespace AtCoder
{
    public static class program
    {
        public static void Main()
        {
            var K = int.Parse(Console.ReadLine());
            var S = Console.ReadLine();

            if (K < S.Length)
            {
                var ans = "";
                for (var i = 0; i < K; i++)
                {
                    ans = ans + S[i];
                }
                ans = ans + "...";
                Console.WriteLine(ans);
            }
            else
            {
                Console.WriteLine(S);
            }
        }
    }
}

Measured memory_bytes: 27536
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define rush() int T;scanf("%d",&T);while(T--)
#define mm(a,b) memset(a,b,sizeof(a))
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define sc(a) scanf("%d",&a)
#define sc2(a,b) scanf("%d%d",&a,&b)
#define pf(a) printf("%d\n",a)
#define pf2(a,b) printf("%d %d\n",a,b)
#define p_f(a) printf("%d ",a)
#define fi first
#define se second
#define db double
#define ll long long
using namespace std;
const int inf=0x3f3f3f3f;
const ll INF=0x3f3f3f3f3f3f3f3f;
const db eps=1e-9;
int a,b;
int main()
{
    cin>>a>>b;
    int t1=ceil(a*1.0/0.08),t2=ceil(b*1.0/0.1);
    int t=max(t1,t2);
    int a1=floor(t*0.08),a2=floor(t*0.1);
    if(a1==a&&a2==b)pf(t);
    else pf(-1);
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int main(void)
{
  int n;
  long int a,b,c;
  long int ans;

  scanf("%d",&n);

  a=1;
  b=1;
  c=1;

  for(int i=0;i<n;i++)
  {
    a=(a*10)%(1000000007);
    b=(b*9)%(1000000007);
    c=(c*8)%(1000000007);
  }

  ans = (a-2*b+c)%(1000000007);

  if(ans<0) ans+=1000000007;

  printf("%ld\n",ans);

  return 0;
}

Measured memory_bytes: 1728
#include <iostream>
#include <cmath>
using namespace std;
int main(){
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  int ans1 = abs(c - a);
  int ans2 = abs(b - a);
  int ans3 = abs(c - b);
  //cout << ans1 <<" "<< ans2 <<" "<< ans3 << endl;
  if(ans1 <= d || (ans2 <= d && ans3 <= d)){
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}

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

using namespace std;

void solve() {
    int n;
    cin >> n;
    vector<int> p(n);
    for(int i = 0; i < n; i++){
        cin >> p[i];
    }
    sort(p.begin(),p.end());
    if(p.size() % 2 != 0 || p[p.size()/2-1] == p[p.size()/2])
        cout << 0 << endl;
    else cout << p[p.size()/2] - p[p.size()/2-1] << endl;
}

int main() {
    solve();
    return 0;
}

Measured memory_bytes: 640
#include<stdio.h>
int main(void){
  
  int a,b,i;
  
  scanf("%d%d",&a,&b);
  
  if(a>b) for(i=0; i<a; i++) printf("%d",b);
  else    for(i=0; i<b; i++) printf("%d",a);
  
  return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
    #define ll long long int
    #define loop(n) for(ll i=0;i<n;i++)
    using namespace std;
    int main()
    {
        ll n;
        bool flag=1;
        cin>>n;
        ll a[n];
        loop(n)
        {
            cin>>a[i];
        }
        loop(n)
        {
            if(a[i]%2==0 && (a[i]%3!=0 && a[i]%5!=0))
            {
                flag=0;
                break;
            }
        }
        if(flag==1)
        cout<<"APPROVED"<<endl;
        else
        cout<<"DENIED"<<endl;
        return 0;
    }

Measured memory_bytes: 256
n = int(input())
p = 10**9 + 7

def fact(n, p):
    n_ = [1]
    for i in range(1, n+1):
         n_.append((n_[-1]*i) % p)
    return n_

def invfact(n, f, p):
    m = [pow(f[n], p-2, p)]
    for i in range(n, 0, -1):
        m.append(m[-1] * i % p)
    return m

ans = 0
m = n - 1
f = fact(m, p)
rf = invfact(m, f, p)
rf.reverse()
perm = 0

for k in range((n+1)//2, n):
    perm_ = f[k-1] * rf[2*k-n] %p * f[k] % p
    ans += (perm_ - perm) %p * k % p
    ans %= p
    perm = perm_

print(ans)

Measured memory_bytes: 82224
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c,d,e;
    cin >> a >> b >> c >> d >> e;
    if(a==0) cout << 1;
    else if(b==0) cout << 2;
    else if(c==0) cout << 3;
    else if(d==0) cout << 4;
    else cout << 5;
}

Measured memory_bytes: 3632
// https://atcoder.jp/contests/dp/tasks/dp_i
#include <algorithm>
#include <iostream>
#include <map>
#include <set>
#include <vector>
using namespace std;

#define lengthof(x) (sizeof(x) / sizeof(*(x)))
#define EPS (1e-7)
#define INF (1e9)
#define MODI (1000000007)

typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;

// dp[i][j] : コインをi枚使い、j枚が表である確率
// double dp[3001][3001];

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    using std::swap;
    int n;
    cin >> n;
    // 入力、DP後、DP前
    vector<double> p(n), dpA(n + 1, 0), dpB(n + 1, 0);
    for (int i = 0; i < n; i++) {
        cin >> p[i];
    }
    dpB[0] = 1;
    for (int i = 1; i <= n; i++) {
        for (int j = 0; j <= i; j++) {
            // i-1回目で表の枚数がj-1で、i回目が表
            // i-1回目で表の枚数がjで、i回目が裏
            dpA[j] = dpB[j - 1] * p[i - 1] + dpB[j] * (1.0 - p[i - 1]);
        }
        swap(dpB, dpA);
    }
    double ans = 0;
    for (int i = n / 2 + 1; i <= n; i++) {
        ans += dpB[i];
    }
    printf("%0.10f\n", ans);

    return 0;
}

Measured memory_bytes: 384
import sys
from heapq import*
r=sys.stdin.readline
def g(s,g):
 F=[1e7]*-~n;F[s]=0
 H=[(0,s)]
 while H:
  c,u=heappop(H)
  if u==g:return c
  for f,v in E[u]:
   t=c+f
   if t<F[v]:
    F[v]=t
    heappush(H,(t,v))
 return-1
for e in iter(input,'0 0'):
 n,k=map(int,e.split())
 E=[[]for _ in[0]*-~n]
 for _ in[0]*k:
  f=[*map(int,r().split())]
  if f[0]:
   c,d,e=f[1:]
   E[c]+=[(e,d)];E[d]+=[(e,c)]
  else:print(g(*f[1:]))


Measured memory_bytes: 6272