akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long; using ull = unsigned long long;
#define int ll
using vb = vector<bool>; using vvb = vector<vb>;
using vi = vector<int>; using vvi = vector<vi>;
using vl = vector<ll>; using vvl = vector<vl>;
template<class T> using V = vector<T>;
template<class T> using VV = vector<V<T>>;
#define fi first
#define se second
#define maxs(x,y) (x=max(x,y))
#define mins(x,y) (x=min(x,y))
using pii = pair<int,int>; using pll = pair<ll,ll>;
#define FOR(i,a,b) for(ll i = (a); i < (ll)(b); ++i)
#define REP(i,n) FOR(i,0,n)
#define RFOR(i,a,b) for(ll i = (ll)(b)-1;i >= a;--i)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define eb(val) emplace_back(val)
const double PI = acos(-1), EPS = 1e-10;
const ll MOD = 1e9+7;
void cioacc(){//accelerate cin/cout
  cin.tie(0);
  ios::sync_with_stdio(false);
}
typedef int Weight;
struct Edge {  //src:辺の始点,dst:辺の終点,weight:辺の重さ
  int src, dst;
  Weight weight;
  Edge(int src, int dst, Weight weight) :
    src(src), dst(dst), weight(weight) { }
};
bool operator < (const Edge &e, const Edge &f) {
  return e.weight != f.weight ? e.weight > f.weight : //辺は重さが重いものを"小さい"と定義する
    e.src != f.src ? e.src < f.src : e.dst < f.dst;
}
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

//引数 g:隣接リスト,r:最小全域木の始点
//戻値 total:最小全域木の重み,T:最小全域木の辺集合
pair<Weight, Edges> prim(const Graph &g, int r = 0) {
  int n = g.size();
  Edges T;
  Weight total = 0;
  vector<bool> visited(n);
  priority_queue<Edge> Q;
  Q.push( Edge(-1, r, 0) );    //始め、-1とrを結ぶ辺があると考える
  while (!Q.empty()) {
    Edge e = Q.top(); Q.pop();
    if (visited[e.dst]) continue;
    T.push_back(e);
    total += e.weight;
    visited[e.dst] = true;
    for(auto f=g[e.dst].begin();f!=g[e.dst].end();++f) if(!visited[f->dst]) Q.push(*f);
  }
  return pair<Weight, Edges>(total, T);
}
signed main(){
  int v,e;
  while(cin >> v >> e,v){
    Graph g(v);
    REP(i,e){
      int s,t;
      int w;
      cin >> s >> t >> w;
      g[s].push_back(Edge(s,t,w));
      g[t].push_back(Edge(t,s,w));
    }
      cout << prim(g).first << endl;
  }

}





Measured memory_bytes: 3028
import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools, random
from collections import deque, defaultdict, Counter; from heapq import heappush, heappop
from itertools import permutations, combinations, product, accumulate, groupby
from bisect import bisect_left, bisect_right, insort_left, insort_right
from operator import itemgetter as ig
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20; INF = float("INF"); ans = 0; tmp = 0; ansli = []; tmpli = []; candili = []
eps = 1.0 / 10 ** 10; mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]; ddn = dd + [(-1, 1), (1, 1), (1, -1), (-1, -1)]; ddn9 = ddn + [(0, 0)]
"""for dx, dy in dd:
        nx = j + dx; ny = i + dy
            if 0 <= nx < w and 0 <= ny < h:"""
def wi(): return list(map(int, sys.stdin.readline().split()))
def wip(): return [int(x) - 1 for x in sys.stdin.readline().split()]#WideIntPoint
def ws(): return sys.stdin.readline().split()
def i(): return int(sys.stdin.readline())
def s(): return input()
def hi(n): return [i() for _ in range(n)]
def hs(n): return [s() for _ in range(n)]#HeightString
def mi(n): return [wi() for _ in range(n)]#MatrixInt
def mip(n): return [wip() for _ in range(n)]
def ms(n): return [ws() for _ in range(n)]

a, b = wi()
if a + b == 15:
    print("+")
elif a * b == 15:
    print("*")
else:
    print("x")

Measured memory_bytes: 6224
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <queue>
#include <numeric>
#include <string>
#include <string.h>
#include <map>
#include <set>
#include <functional>
#include <complex>

using namespace std;

const int INF = (1<<30) - 1;

string table[] = {
    "",
    ".,!? ",
    "abc",
    "def",
    "ghi",
    "jkl",
    "mno",
    "pqrs",
    "tuv",
    "wxyz"
};

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int T;
    cin >> T;
    string in;
    while(T--){
        cin >> in;
        int i = 0;
        int n = in.length();
        
        while(i<n){
            int s = i;
            while(i<n && in[i]!='0'){
                i++;
            }
            if(0<i && in[i-1]-'0'!=0){
                string st = table[in[i-1]-'0'];
                cout << st[(i-s-1)%st.length()];
            }
            i++;
        }
        cout << endl;
    }
    
    return 0;
}

Measured memory_bytes: 1216
#include <iostream>
#include <algorithm>
using namespace std;
string alphabet = "abcdefghijklmnopqrstuvwxyz";

int main(){
 int a , b;
 cin >> a >> b;
 int k = a - 2 * b;
 if(k >= 0)cout << k << endl;
 else cout << 0 << endl;
}

Measured memory_bytes: 256
N=int(input())
A=list(map(int,input().split()))
D={}
for a in A:
    if a in D:D[a]=D[a]+1
    else:D[a]=1
    if a-1 in D:D[a-1]=D[a-1]+1
    else:D[a-1]=1
    if a+1 in D:D[a+1]=D[a+1]+1
    else:D[a+1]=1
L=list(D.values())
L.sort(reverse=True)
print(L[0])

Measured memory_bytes: 18732
n, q = map(int, input().split())
data = []
for i in range(n):
    tmp = input().split()
    tmp[1] = int(tmp[1])
    data.append(tmp)

dt_out = []
time_count = 0

while len(data) > 0 :
    tmp = data.pop(0)
    if(tmp[1] <= q):
        time_count += tmp[1]
        dt_out.append([tmp[0],time_count])
    else:
        tmp[1] -= q
        time_count += q
        data.append(tmp)

for tmp in dt_out:
    print(tmp[0]+" "+str(tmp[1]))

Measured memory_bytes: 21276
import Data.List
import Data.Function

main :: IO ()
main = do
  n <- readLn :: IO Int
  print $ fst $ maximumBy (compare `on` snd) $ map (\i -> (i, tryDiv2 i 0) :: (Int, Int)) [1..n]

tryDiv2 :: Int -> Int -> Int
tryDiv2 n cnt
  | n `mod` 2 /= 0 = cnt
  | otherwise = tryDiv2 (n `div` 2) (cnt + 1)


Measured memory_bytes: 508
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from itertools import permutations, accumulate, combinations, combinations_with_replacement
from math import sqrt, ceil, floor, factorial
from bisect import bisect_left, bisect_right
from copy import deepcopy
from operator import itemgetter
from functools import reduce
#from fractions import gcd
#from math import gcd
import sys
def I(): return int(input())
def Is(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def TI(): return tuple(map(int, input().split()))
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def TIR(n): return [TI() for _ in range(n)]
def S(): return input()
def Ss(): return input().split()
def LS(): return list(input())
def SR(n): return [S() for _ in range(n)]
def SsR(n): return [Ss() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
sys.setrecursionlimit(10**6)
MOD = 10**9+7
INF = float('inf')


n = I()
l = len(str(n))
ans = 0
if l % 2 == 1:
    ans += n - 10**(l-1) + 1

for i in range(l):
    if i % 2 == 1:
        ans += 9*10**(i-1)

print(ans)

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

int main() {
  int h, w;
  cin >> h >> w;

  vector<string> s(h);
  rep(i, h) cin >> s.at(i);

  string wall = "";
  rep(i, w + 2) wall += '.';
  vector<string> wall_s(h + 2, wall);
  for (int i = 1; i <= h; i++) {
    for (int j = 1; j <= w; j++) {
      wall_s.at(i).at(j) = s.at(i - 1).at(j - 1);
    }
  }

  for (int i = 1; i <= h; i++) {
    for (int j = 1; j <= w; j++) {
      int cnt = 0;
      if (wall_s.at(i).at(j) == '#') {
        continue;
      } else {
        if (wall_s.at(i - 1).at(j - 1) == '#') cnt++;
        if (wall_s.at(i - 1).at(j) == '#') cnt++;
        if (wall_s.at(i - 1).at(j + 1) == '#') cnt++;
        if (wall_s.at(i).at(j - 1) == '#') cnt++;
        if (wall_s.at(i).at(j + 1) == '#') cnt++;
        if (wall_s.at(i + 1).at(j - 1) == '#') cnt++;
        if (wall_s.at(i + 1).at(j) == '#') cnt++;
        if (wall_s.at(i + 1).at(j + 1) == '#') cnt++;
      }
      char c = cnt + '0';
      s.at(i - 1).at(j - 1) = c;
    }
  }

  rep(i, h) cout << s.at(i) << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define push_back pb
#define make_pair mp
using ll =  long long;
const int INF = 0x3f3f3f3f;
const int MAX_N = 2e5+10;

int A,B;

void solve()
{
	cout << max(A+B, max(A-B, A*B)) << endl;
}

int main()
{
	ios::sync_with_stdio(false);
	cin >> A >> B;
	solve();
	return 0;
}

Measured memory_bytes: 256
/*
 *
 */
#include <cstdio>
#include <iostream>

using namespace std;

typedef long long ll;

ll t[1005];
ll a[1005];

int main(){
    //freopen("c3.in", "r", stdin);
    int n;
    scanf("%d", &n);
    for (int i = 0; i < n; ++i) {
        scanf("%lli %lli", &t[i], &a[i]);
    }
    ll currentT = 1, currentA = 1;
    for (int i = 0; i < n; ++i) {
        ll multiT = (currentT - 1LL) / t[i] + 1LL;
        ll multiA = (currentA - 1LL) / a[i] + 1LL;
        ll multi = max(multiT, multiA);
        currentT = t[i] * multi;
        currentA = a[i] * multi;
        //printf("%d %lli %lli %lli %lli\n", i, multiT, multiA, currentT, currentA);
    }
    printf("%lli\n", currentT + currentA);
    return 0;
}


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

#define whole(f, x, ...)                                 \
  ([&](decltype((x)) whole) {                            \
    return (f)(begin(whole), end(whole), ##__VA_ARGS__); \
  })(x)

using namespace std;
using ll = long long;

void solve() {
  string s;
  cin >> s;
  int d;

  if (s[0] == 'S')
    if (s[1] == 'U')
      d = 7;
    else
      d = 1;
  else if (s[0] == 'M') {
    d = 6;
  } else if (s[0] == 'T') {
    if (s[1] == 'U')
      d = 5;
    else
      d = 3;
  } else if (s[0] == 'W') {
    d = 4;
  } else
    d = 2;

  cout << d << endl;
}

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

  solve();
  return 0;
}


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

int main(void){
  int X,N;
  cin >> X >> N;
  
  if(N==0){
    cout << X << endl;
    return 0;
  }
  
  int val_list[N] ={};
  for(int i=0;i<N;i++){
    cin >> val_list[i]; 
  }
  int small =0;
  int big = 0;
  int val_low;
  int val_high;
  
  for(int i=0;i<=X;i++)
  {
    val_low = X-i;
    bool flag = true;
    for(int i=0;i<N;i++){
      if(val_low == val_list[i]){
        flag = false;
        break;
      }
    }
    if(flag) break;
  }
  small = val_low;
  
  for(int i=1;i<=X;i++)
  {
    val_high = X+i;
    bool flag = true;
    for(int i=0;i<N;i++){
      if(val_high == val_list[i]){
        flag = false;
        break;
      }
    }
    if(flag) break;
  }
  big = val_high;
  
  if( abs(X-small)<=abs(big-X)){
    cout << small << endl;
    return 0;
  }
  else {
    cout << big << endl;
  }
  return 0;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define MOD 1000000007
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
using P = pair<int,int>;
  
int main()
{
  ll K,A,B;
  cin >> K >> A >> B;

  if(A>=B-2){
    cout << K+1 << endl;
  }else{
    if(K<=A){
      cout << K+1 << endl;
    }else if((K-A)%2==1){
      cout << B+(B-A)*(K-A-1)/2 << endl;
    }else if((K-A)%2==0){
      cout << B+(B-A)*(K-A-2)/2+1 << endl;
    }
  }
}

Measured memory_bytes: 256
def main():
    def modpow(x, n, mod):
        res = 1
        while n:
            if n % 2:
                res *= x % mod
            x *= x % mod
            n >>= 1
        return res

    s = input()
    s = s[::-1]
    s_len = len(s)
    mod = 2019
    d = [0] * mod
    d[0] = 1
    rev_num = 0
    # 2以上なら共通するmodがあったということになる
    for i in range(s_len):
        rev_num += int(s[i]) * int(modpow(10, i, mod))
        rev_num %= mod
        d[rev_num] += 1
    # 2以上同じmodがあったらそこから2つ選ぶ選び方
    # それを全てのmodで
    print(sum(i*(i-1)//2 for i in d))
 
if __name__ == '__main__':
    main()

Measured memory_bytes: 9336
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <cmath>
#include <string>
#include <sstream>
#include <iomanip>
#include <complex>
using namespace std;
#define ll long long
#define vvi vector< vector<int> >
#define All(X) X.begin(),X.end()
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back 
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

vector<string> nlist;
bool isinclude(string tmp){
	REP(i,nlist.size()){
		if(nlist[i]==tmp) return true;
	}
	return false;
}
int main(){
	int n;
	cin >> n;
	REP(i,n){
		string tmp;
		cin >> tmp;
		nlist.pb(tmp);
	}
	int nows = 0;
	cin >> n;
	REP(i,n){
		string tmp;
		cin >> tmp;
		if(isinclude(tmp)){
			if(nows == 1){
				cout << "Closed by " << tmp << endl;
			}else{
				cout << "Opened by " << tmp << endl;
			}
			nows = 1 - nows;
		}else{
			cout << "Unknown " << tmp << endl; 
		}
	}
	return 0;
}

Measured memory_bytes: 1220
N = int(input())
D, X = map(int, input().split())
A = []
for i in range(N):
    A.append(int(input()))
count = 0
for a in A:
    i = 0
    while True:
        tmp = 1 + i * a
        if tmp <= D:
            count += 1
            i += 1
        else:
            break
print(count+X)

Measured memory_bytes: 38896
s = input()
t = input()
ans = 'UNRESTORABLE'

for i in range(len(s) - len(t) + 1):
    match = True
    for tt, ss in zip(t, s[len(s) - len(t) - i: len(s) - i]):
        if ss not in ('?', tt):
            match = False
            break
    if match:
        ans = s[:len(s) - len(t) - i] + t + s[len(s) - i:]
        ans = ans.replace('?', 'a')
        break

print(ans)

Measured memory_bytes: 3064
#include<iostream>
#include<vector>
#include <cmath>
using namespace std;

int main(void){
    int N,D;
    cin>>N>>D;
   int a[N][D];

    int i,j;
    for(i=0;i<N;i++){
         for(j=0;j<D;j++){
             cin>>a[i][j];
        }
    }
    int k,l,m,n;
    int count=0,lang=0;
    for(k=0;k<N;k++){
        for(l=0;l<N-k-1;l++){
             for(m=0;m<D;m++){
                lang+=(a[k][m]-a[k+l+1][m])*(a[k][m]-a[k+l+1][m]);
            }
            n=(int)pow(lang,0.5);
            n=n*n;
            if(lang==n){
                count++;
            } 
            lang=0;           
        }
    }
    cout<<count<<endl;
    return 0;
}

Measured memory_bytes: 384
import java.util.Scanner;

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

    Scanner sc = new Scanner(System.in);

    int x = sc.nextInt();
    int a = sc.nextInt();
    int b = sc.nextInt();
//Math.adsで絶対値(+-)を取得
    int aa = x - a;
      if (Math.abs(x - a) < Math.abs(x - b)){
      System.out.println("A") ;
      }
      else {
      System.out.println("B") ;
      }
  }
}


Measured memory_bytes: 21716
from operator import itemgetter

N = int(input())

s = []
t = []

for i in range(N):
    x, l = map(int, input().split())
    s.append(x-l)
    t.append(x+l)

st = sorted([(s[i],t[i]) for i in range(N)], key=itemgetter(1))

ans = 0
last = -10000000

for i in range(N):
    if last <= st[i][0]:
        ans += 1
        last = st[i][1]
print(ans)


Measured memory_bytes: 20572
def check_prime(num):
  for i in range(2,num):
    if (x % i == 0):
      return False
      break
  else: 
    return True
 
if __name__ == "__main__":
  x = int(input())
  flag = True
  while flag: 
    if (check_prime(x)):
      print(x)
      flag = False
    else: 
      x = x + 1

Measured memory_bytes: 3060
/*
	Author: Ritik Patel
	
	Idea: 
*/


//&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& STL DEBUGGER &&&&&&&&&&&&&&&&&&&&&&&&&&&

// #define _GLIBCXX_DEBUG       // Iterator safety; out-of-bounds access for Containers, etc.
// #pragma GCC optimize "trapv" // abort() on (signed) integer overflow.

//&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& LIBRARIES &&&&&&&&&&&&&&&&&&&&&&&&&&&

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

/*#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
template<typename T, typename V = __gnu_pbds::null_type>
using ordered_set = __gnu_pbds::tree<T, V, less<T>, __gnu_pbds::rb_tree_tag, __gnu_pbds::tree_order_statistics_node_update>; 
*/
//find_by_order()->returns an iterator to the k-th largest element(0-based indexing)
//order_of_key()->Number of items that are strictly smaller than our item

//&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& DEFINES &&&&&&&&&&&&&&&&&&&&&&&&&&&

#define int long long int
#define all(i) i.begin(), i.end()
#define sz(a) (int)a.size()
 
// const ld PI  = 3.141592;
const int dx4[4] = {0, 1, 0, -1};
const int dy4[4] = {-1, 0, 1, 0};
const int dx8[8] = {-1, -1, -1, 0, 1, 1, 1, 0};
const int dy8[8] = {-1, 0, 1, 1, 1, 0, -1, -1};
 
//&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& DEBUG &&&&&&&&&&&&&&&&&&&&&&&&&&&
 
#define XOX
vector<string> vec_splitter(string s) {
    for(char& c: s) c = c == ','?  ' ': c;
    stringstream ss; ss << s;
    vector<string> res;
    for(string z; ss >> z; res.push_back(z));
    return res;
}
 
void debug_out(vector<string> __attribute__ ((unused)) args, __attribute__ ((unused)) int idx) { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, Head H, Tail... T) {
    if(idx > 0) cerr << ", ";
    stringstream ss; ss << H;
    cerr << args[idx] << " = " << ss.str();
    debug_out(args, idx + 1, T...);
}
 
#ifdef XOX
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __VA_ARGS__)
#else
#define debug(...) 42
#endif
 
 
//&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& CODE &&&&&&&&&&&&&&&&&&&&&&&&&&&

const int MOD = (int)1e9 + 7;
void solve(){
    int a; cin >> a;
    int res = 1;
    int ans = 0;
    for(int i = 1; i <= 3; ++i){
        res *= a;
        ans += res;
    }
    cout << ans << '\n';
}



int32_t main(){
    ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr); 
    int T = 1; 
    // cin >> T;
    for(int i = 1; i <= T; ++i){
        // brute();
        solve();
    }
    return 0;
}

/*
Sample inp
*/

Measured memory_bytes: 3656
#include <iostream>
#include <algorithm>

using namespace std;

const int MAXN = 1e4;

int n;
int l[MAXN];

void solve() {
  sort(l, l+n);
  int cnt = 0;
  for (int i=0;i<n;i++) {
    for (int j=i+1;j<n;j++) {
      cnt += lower_bound(l + j + 1, l + n, l[i] + l[j]) - (l + j + 1);
    }
  }
  cout << cnt << endl;
}

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


Measured memory_bytes: 256
// https://atcoder.jp/contests/abc062/tasks/abc062_b
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int H, W;
  cin >> H >> W;

  vector<string> row(H);
  vector<char> sharp(W + 2, '#');
  
  for (int i = 0; i < H; i++)
    cin >> row.at(i);

  for (int i = 0; i < sharp.size(); i++)
    cout << sharp.at(i);
  cout << endl;
  
  for (int i = 0; i < row.size(); i++){
    cout << '#';
    for (int j = 0; j < row.at(i).size(); j++)
      cout << row.at(i).at(j);
    cout << '#' << endl;
  }

  for (int i = 0; i < sharp.size(); i++)
    cout << sharp.at(i);
  cout << endl;
}

Measured memory_bytes: 256
import bisect

n = int(input())
l = [int(i) for i in input().split()]

l.sort(reverse=True)
ans = 0

l = list(map(lambda x: x * (-1), l))

for i in range(n-2):
    for j in range(i+1,n-1):
        need = l[i] - l[j] - 1
        idx = bisect.bisect_right(l,need)
        #print(i,j,idx,need,ans)
        ans += max(0,idx-j-1)
        
print(ans)

Measured memory_bytes: 44124
N, Y = (int(i) for i in input().split())

for x in range(N+1):
    for y in range(0, N-x+1):
        z = N - x - y
        if 10000*x + 5000*y + 1000*z == Y:
            print(x, y, z, sep=' ')
            exit(0)
        
print(-1, -1, -1, sep=' ')

Measured memory_bytes: 3060
num = int(input())
a = input().split()
for i in range(len(a)):
  a[i] = int(a[i])

flag = True  
new = -1
m = -1
for i in range(num):
  if i+1 == a[i]:
    pass
  else:
    if new == -1:
      new = i
    else:
      a[i],a[new] = a[new], a[i]
      break

for i in range(num):
  if i+1 == a[i]:
    pass
  else:
    flag = False
    print('NO')
    break
if flag:
  print('YES')

  

Measured memory_bytes: 38384
#include <bits/stdc++.h>
#define mkp make_pair
#define pb push_back
#define emb emplace_back
#define em emplace
#define ii pair<int,int>
#define iii pair<int ,ii>
#define x first
#define y second
#define all(x) x.begin(),x.end()
#define allc(x) x.begin(),x.end(),cmp
#define optimizar_io ios_base::sync_with_stdio(false);cin.tie(NULL);

using namespace std;
const int INF = 0x3f3f3f3f;
const int MXN = 1e5 + 5;

int dp[MXN][3];

int main(){
    int n;
    scanf("%d" ,&n);
    for(int i = 0 ; i < n ; i++){
        for(int j = 0 ; j < 3 ; j++){
            scanf("%d" ,&dp[i][j]);
        }
    }
    int mx = -1;
    for(int i = 1 ; i < n ; i++){
        for(int j = 0 ; j < 3 ; j++){
            mx = -1;
            for(int k = 0 ; k < 3 ; k++){
                if(j != k){
                    mx = max(mx , dp[i - 1][k] + dp[i][j]);
                }
            }
            dp[i][j] = mx;
        }
    }
    mx = -1;
    for(int i = 0 ; i < 3 ; i++){
        mx = max(mx , dp[n - 1][i]);
    }
    printf("%d" ,mx);
}

Measured memory_bytes: 1408
from collections import defaultdict
 
N = int(input())
W = [input().strip() for _ in range(N)]
 
dic = defaultdict(int)
 
for i in range(N):
  if i == 0:
    tmp = W[i][-1]
    dic[W[i]] += 1
  else:
    if tmp != W[i][0] or dic[W[i]]:
      print("No")
      break
    else:
      dic[W[i]] += 1
      tmp = W[i][-1]
else:
  print("Yes")

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long

const long long MOD = 1000000007;

int main(){
  double w,h,x,y;
  int t=0;
  cin >> w>>h>>x>>y;
  double ans=w*h/2.0;
  if(x==w/2 && y==h/2) t=1;
  cout<<ans<<" "<<t<<endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
  int a,b,c,i;
  
  scanf("%d %d %d",&a,&b,&c);
  
  for(i=1;i<100;i++){
    if(a*i%b==c){
      printf("YES");
      return 0;
    }
  }
  printf("NO");
}

Measured memory_bytes: 128
N, M = map(int, input().split())
S = tuple(map(int, input().split()))
T = tuple(map(int, input().split()))
MOD = 10 ** 9 + 7

dp = [[1] * (M + 1) for _ in range(N + 1)]
for i in range(N):
    for j in range(M):
        dp[i + 1][j + 1] = dp[i][j + 1] + dp[i + 1][j]
        if S[i] != T[j]:
            dp[i + 1][j + 1] -= dp[i][j]
        dp[i + 1][j + 1] %= MOD
print(dp[N][M])


Measured memory_bytes: 73436
#include<iostream>
#include<deque>

using namespace std;


int card[201];
int sub1[201];
int sub2[201];
int n, m;

void cut(int k);
void suffle(void);

int main()
{
	cin >> n;
	cin >> m;
	
	deque<int> step(m);
	
	for(int i = 0; i < m; i++){
		cin >> step[i];
	}
	
	for(int i = 0; i < 2*n; i++){		//ツカツーツドツ渉可甘コツ可サ
		card[i] = i+1;
	}
	
	for(int i = 0; i < m; i++){
		if(step[i] == 0){
			suffle();
		}
		else{
			cut(step[i]);
		}
	}
	
	for(int i = 0; i < 2*n; i++){
		cout << card[i] << endl;
	}
}

void cut(int k){
	int i;
	int temp;
	
	for(i = 0; i < k; i++){
		sub1[i] = card[i];
	}
	temp = i;
	
	for(int j = 0;j < 2*n; j++){
		sub2[j] = card[temp];
		temp++;
	}
	
	for(i = 0;i < 2*n-k; i++){
		card[i] = sub2[i];
	}
	for(int j = 0; i < 2*n; i++){
		card[i] = sub1[j];
		j++;
	}
}

void suffle(void){
	int i, j = 0;
	
	for(i = 0; i < n; i++){
		sub1[i] = card[i];
	}
	
	for(;i < 2*n; i++){
		sub2[j] = card[i];
		j++;
	}
	j = 0;
	for(int i = 0; i < 2*n; i+=2){
		card[i] = sub1[j];
		j++;
	}
	j = 0;
	for(int i = 1; i < 2*n; i+=2){
		card[i] = sub2[j];
		j++;
	}
}

Measured memory_bytes: 0
N = int(input())
W = [input() for i in range(N)]
ans = 0
if len(W) != len(set(W)):
    ans = 1
else:
    for i in range(N-1):
        if W[i][-1] != W[i+1][0]:
            ans = 1
            break

if ans == 0:
    print('Yes')
else:
    print('No')

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

using namespace std;

int main()
{
    int k;
    
    cin >> k;
    
    string arr;
    
    cin >> arr;
    
    if(k < arr.length())
    {
        for(int i=0; i<k; i++)
            cout << arr[i];
        
        cout << "...";
    }
    else
    {
        cout << arr;
    }

}


Measured memory_bytes: 3652
#include <cstdio>
#include <iostream>
using namespace std;
int main(){
    unsigned int N;
    unsigned long long result=1;
    cin >> N;
    for(int i=2; i<N+1; ++i)
        result = (result * i) % 1000000007;
    cout << result;
    return 0;
}

Measured memory_bytes: 256
extern crate proconio;
use proconio::input;

fn main() {
    input! {
        n: usize,
        a: [i64; n],
    }
    let mut dp = std::collections::HashSet::new();
    dp.insert(1000);
    for i in 1..n {
        let mut vs = vec![];
        for &v in &dp {
            let c = v / a[i - 1];
            let vv = v % a[i - 1] + c * a[i];
            if v < vv {
                vs.push(vv);
            }
        }
        if let Some(&v) = vs.iter().max() {
            dp.insert(v);
        }
    }
    println!("{}", dp.iter().max().unwrap());
}


Measured memory_bytes: 2172
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <sstream>
#include <algorithm>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <climits>
#include <bitset>
#include <functional>
#include <numeric>
#include <ctime>
#include <cassert>
#include <cstring>
#include <fstream>
#include <iomanip>

using namespace std;

#define FOR(i, a, b) for(int (i)=(a);(i)<(b);(i)++)
#define IFOR(i, a, b) for(int (i)=(a);(i)<=(b);(i)++)
#define RFOR(i, a, b) for(int (i)=(a);(i)>=(b);(i)--)
#define REP(i, n) FOR((i), 0, (n))

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

template<class T>
void print_container(T &container, string delim=" ") {
    bool first = true;
    for(auto &t: container){
        if(!first){
            cout << delim;
        }
        first = false;
        cout << t;
    }
    cout << endl;
}

int main() {
    int d, g;
    cin >> d >> g;
    vector<int> p(d), c(d);
    REP(i, d){
        cin >> p[i] >> c[i];
    }

    int ans = 1000000;
    for(int bit = (1<<d)-1;bit>=0;bit--){
        ll now = 0;
        int cnt = 0;
        FOR(i, 0, d){
            if((bit>>i)&1){
                now += 100*(i+1)*p[i] + c[i];
                cnt += p[i];
            }
        }
        if(now >= g){
            ans = min(ans, cnt);
            continue;
        }

        int rest = g - now;
        RFOR(i, d-1, 0){
            if((bit>>i)&1) continue;
            int t = (rest-1) / (100*(i+1)) + 1;
            if(t <= p[i]-1){
                cnt += t;
                rest -= 100*(i+1)*t;
                break;
            }
            else{
                cnt += p[i]-1;
                rest -= 100*(i+1)*(p[i]-1);
            }
        }
        if(rest <= 0){
            ans = min(ans, cnt);
        }

    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <vector>
#include <stack>
#include <queue>
#include <list>
using namespace std;

int main(){

    int n; cin >> n;

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

    int maxindex = 0;
    int lmax = 0;
    for(int i=0; i<n; i++){
        if(lmax < l[i]){
            lmax = l[i];
            maxindex = i;
        }
    }

    int sumothers = 0;
    for(int i=0; i<n; i++){
        if(i != maxindex){
            sumothers += l[i];
        }
    }

    if(sumothers > lmax){
        cout << "Yes";
    }
    else{
        cout << "No";
    }


    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String[][] c = new String[4][4];
		
		String[] x = new String[4];
		
		for(int i = 1; i < 4; i++) {
			x[i] = sc.next();
		}
		
		for(int i = 1; i < 4; i++) {
			for(int j = 1; j < 4; j++) {
				char y = x[i].charAt(j - 1);
				c[i][j] = String.valueOf(y);
			}
		}
		String a = c[1][1] + c[2][2] + c[3][3];
		System.out.println(a);
		
	}
}


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

using namespace std;

int main(){
  int a,b;
  cin >> a >> b;
  if((a+b)%2==0)  cout << (a+b)/2 << endl;
  else  cout << (a+b)/2+1 << endl;

  return 0;
}


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

using namespace std;

typedef long long ll;

const int N = 1e5 + 5;
const ll mod = 1e9 + 7;

ll cnt[N];
int n;

int main() {
  cin >> n;
  cnt[0] = 3LL;
  ll perm = 1LL;
  for(int i = 0; i < n; i++) {
    int x; cin >> x;
    perm = (perm * cnt[x]) % mod;
    cnt[x]--;
    cnt[x + 1]++;
  }
  cout << perm << '\n';
}

Measured memory_bytes: 1024
#include <iostream>
#include <iomanip>
#include <vector>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <cstring>
#define rep(i, N) for (int i = 0; i < (int)N; i++)
using namespace std;
typedef long long ll;
const ll LLINF = 9223372036854775807;
const int MOD = 1000000007;

int main() {
  string S; cin >> S;
  string arr[6] = {"abc", "acb", "bac", "bca", "cab", "cba"};
  string result = "No";
  if (find(arr, arr+6, S)!= arr+6) result = "Yes";
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cmath>
#include <string>

using namespace std;
typedef long long ll;

int main(){
  string a, b, c, d;

  cin>>a>>b>>c;
  a[0] += 'A'-'a';
  b[0] += 'A'-'a';
  c[0] += 'A'-'a';

  d = string(1, a[0])+string(1, b[0])+string(1, c[0]);
  cout<<d<<endl;
}

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

int main(){
    char s[201], t[101], p[101];
    
    scanf("%s %s", s, p);
    strcpy(t,s);
    strcat(s,t);
    
    if(strstr(s, p)==NULL) printf("No\n");
    else printf("Yes\n");
    
    return 0;
}

Measured memory_bytes: 2736
s = gets.chomp!
n = s.size
q, r = n.divmod(2)
a = "10" * q + "1" * r
b = "01" * q + "0" * r
cnta, cntb = 0, 0
n.times{|i|
  cnta += 1 if a[i]!=s[i]
  cntb += 1 if b[i]!=s[i]
}
puts cnta > cntb ? cntb : cnta


Measured memory_bytes: 2300
#include <stdio.h>
#include <iostream>
#include <vector>
#include <assert.h>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <stack>
#include <string>
#include <sstream>
#include <memory.h>
#include <time.h>
#include <string.h>
#include <stdlib.h>
#include <algorithm>
using namespace std;
typedef long long ll;
int k;
bool vis[55][100001];
bool DFS(int rem, int m) {
	if (rem < 0)
		return false;
	if (rem == 0 && m == 0)
		return true;
	if (vis[rem][m])
		return false;
	vis[rem][m] = true;
	for (int d = 0; d < 10; ++d)
		if (DFS(rem - d, (m * 10 + d) % k))
			return true;
	return false;
}
int main()
{
	cin >> k;
	int s = 0;
	int n = k;
	while (n) {
		s += n % 10;
		n /= 10;
	}
	int res = s;
	for (int i = 1; i < s; ++i) {
		if (DFS(i, 0)) {
			res = i;
			break;
		}
	}
	printf("%d\n", res);
	return 0;
}

Measured memory_bytes: 4352
#include<stdio.h>
#define N 100000
int main()
{
    int a,b,x[N],n;
    int sum=0;
    scanf("%d%d",&a,&b);
    for(n=0;n<a;n++)
    {
        scanf("%d",&x[n]);
        if(x[n]>=b)
        {
            sum++;
        }
    }
    printf("%d",sum);
}


Measured memory_bytes: 512
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <stdio.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define FOR(i,a,b) for(int i=a; i<(int)(b); i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort(ALL(x))
#define CLR(a) memset((a), 0 ,sizeof(a))
#define PB push_back
#define MP make_pair
#define SP << " " <<
const int INF = 1001001001;
const ll LINF = 100100100100100100;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}


void solve(){
	int a,b,c; cin>>a>>b>>c;
  cout<<max(c-(a-b),0)<<endl;
}


signed main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	solve();
	return 0;
}


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

int main() {
  int H, W, K;
  cin >> H >> W >> K;

  vector<vector<char>> A(H, vector<char>(W));

  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      cin >> A.at(i).at(j);
    }
  }

  int ans = 0;
  for (int tmp = 0; tmp < (1 << H); tmp++) {
    for (int tmp2 = 0; tmp2 < (1 << W); tmp2++) {
      int cnt = 0;
      for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
          if (tmp & (1 << i) || tmp2 & (1 << j)) continue;
          if (A.at(i).at(j) == '#') cnt++;
        }
      }
      if (cnt == K) ans++;
    }
  }

  cout << ans << endl;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
typedef long long ll;
#define  rep(i,a,b)for(long long i=a;i<b;++i)
#define  rrep(i,a,b)for(int i=a;i>=b;--i)
#define  yesno(flag)if(flag)cout<<"Yes"<<endl; else cout<<"No"<<endl;
using namespace std;
const ll INF=1000000000000LL;
const ll r197=1000000007;
typedef pair<ll,ll>P;
typedef pair<int,P>Pa;
bool Inframe(int a,int b,int c,int d,int h,int w){
	if(a+b>=0&&a+b<h&&c+d>=0&&c+d<w)return true;
	return false;
}
int n,q,c,d;
int b[100005]={};
int main() {
	cin>>n>>q;
	string str;
	cin>>str;
	for(int i=2;i<str.size()+1;++i){
		if(str[i-1]=='C'&&str[i-2]=='A')b[i]++;
	}
	for(int i=1;i<str.size()+1;++i){
		b[i]+=b[i-1];
	}
	int ans;
	rep(i,0,q){
		cin>>c>>d;
		ans=b[d]-b[c-1];
		if(c>1&&str[c-2]=='A'&&str[c-1]=='C')ans--;
		cout<<ans<<endl;
	}

	return 0;
}


Measured memory_bytes: 1408
def main():
    n = int(input())
    arr = list(map(int, input().split()))
    mi = 1000000000
    s = 0
    cnt = 0
    for i in range(n):
        if arr[i] < 0:
            cnt += 1
            s -= arr[i]
            mi = min(mi, -arr[i])
        else:
            s += arr[i]
            mi = min(mi, arr[i])
    if cnt & 1:
        print(s - 2 * mi)
    else:
        print(s)
    return 0

main()

Measured memory_bytes: 14412
#include <stdio.h>

int main(void)
{
  int n, ans, poyo = 0;
  scanf("%d", &n);

  for (int i = 1; i <= n; i++) {
    int cnt = 0;
    for (int j = i; j != 0 && j % 2 == 0; cnt++, j /= 2);
    if (poyo <= cnt) {
      poyo = cnt;
      ans = i;
    }
  }

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

  return (0);
}


Measured memory_bytes: 128
// #include <boost/multiprecision/cpp_int.hpp> 
// using namespace boost::multiprecision; 
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define f first
#define s second
#define pb push_back
#define REP(i,a,b) for(long long int i=a ; i<b ; i++)
#define mp make_pair
#define INF 1000000000000000000
#define mod 1000000007
#define pi pair<ll,ll>
#define pd pair<ld,ld>
#define vi vector<ll>
#define vd vector<ld>
#define vvi vector<vi>
#define vvd vector<vd>
#define vpi vector<pi>
#define vpd vector<pd>
#define us unordered_set<ll>
#define um unordered_map<ll,ll>
#define sortA(a) sort(a.begin(),a.end())
#define sortD(a) sort(a.begin(),a.end(),greater<ll>())
#define all(a) a.begin(),a.end()
#define N 100005


#include <ext/pb_ds/assoc_container.hpp> 
using namespace __gnu_pbds; 
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> new_data_set; 
#define in insert
#define fbo find_by_order
#define ook order_of_key


void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

ll powmod(ll x,ll y)
{
	if(x==0)
		return 0;
	if(y==0 || x==1)
		return 1;
	if(y%2==0)
		return powmod((x*x)%mod,y/2)%mod;
	return (x*powmod(x,y-1)%mod)%mod;
}
void print1D(vi a)
{
	for(ll i=0;i<a.size();++i)
	{
		cout<<a[i]<<" ";
	}
	cout<<endl;
}
void print2D(vector<vi> a)
{
	for(ll i=0;i<a.size();++i)
	{
		for(ll j=0;j<a[i].size();++j)
		{
			cout<<a[i][j]<<" ";
		}
		cout<<endl;
	}
}
void solve()
{
	ll n;
	cin>>n;
	vi a(n-1);
	um U;
	for(ll i=0;i<n-1;++i)
	{
		cin>>a[i];
		U[a[i]]++;
	}
	for(ll i=0;i<n;++i)
	{
		cout<<U[i+1]<<endl;
	}
}
int main()
{
	ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL);
	ll t=1;
	// cin>>t;
	while(t--)
	{
		solve();
	}
}


Measured memory_bytes: 13060
#define _CRT_SECURE_NO_WARNINGS
#pragma GCC optimize(3)
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma comment(linker, "/stack:200000000")
#include <bits/stdc++.h>
#define SIZE 300010
#define rep(i, a, b) for (int i = a; i <= b; ++i)
#define ll long long
#define mp make_pair
#define pi acos(-1.0)
#define eps 1e-6
using namespace std;
void io() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); }
ll n, m;
ll a[SIZE], b[SIZE], dp[SIZE];
int main() {
	io(); cin >> m >> n;
	rep(i, 1, n) cin >> a[i] >> b[i];
	rep(i, 1, 100000) dp[i] = 2e9;
	rep(i, 1, n) {
		for (int j = a[i]; j <= 50000; ++j) {
			dp[j] = min(dp[j - a[i]] + b[i], dp[j]);
		}
	}
	ll ans = 1e18;
	rep(i, m, (50000)) ans = min(ans, dp[i]);
	cout << ans;
}

Measured memory_bytes: 5120
import java.util.Scanner;
import java.util.Arrays;
class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int k = sc.nextInt();
    int[] health = new int[n];
    for(int i = 0; i < n; i++){
      health[i] = sc.nextInt();
    }
    Arrays.sort(health);
    Long total = 0L;
    for(int i = 0; i < n - k; i++){
      total += health[i];
    }
    System.out.println(total);
  }
}

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

int main()
{
    int a,b;
    int cnt=0;
    int sum=0;
    // 
    cin >> a >> b;
    //
    for(int i = 1; i < 1000; i++)
    {
        sum +=i;
        for(int j=1;j<1000000; j++)
        {
            if((a+j) == sum && (b+j) == (sum+i+1)) 
            {
                cnt = j;
                break;  
            }
        }
    }
    cout << cnt << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
 
#define SQ(X) \
  ( (X) * (X) )
#define RAD(D) \
  ( (D) * M_PI / 180. )
#define degsin(D) \
  sin ( RAD( D ) )
#define degcos(D) \
  cos ( RAD( D ) )
 
int
main (
  int   argc,
  char *argv[ ]
  )
{
  int a, b, c;
 
  scanf ( "%d%d%d", &a, &b, &c );
  printf ( "%.4f\n", a * b * degsin ( c ) / 2. );
  printf ( "%.4f\n", a + b + sqrt ( SQ( a ) + SQ( b ) - 2. * a * b * degcos ( c ) ) );
  printf ( "%.4f\n", b * degsin ( c ) );
 
  return ( 0 );
}


Measured memory_bytes: 2108
//It doesn't matter as long as you rise to the top - Katsuki Bakugo
#include<bits/stdc++.h>
using namespace std;
     
     
#define Fast_as_duck ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define pb push_back 
#define forn(i,st,n) for(int i = st; i < n ; i++)
#define rev(i,st,n) for(int i = st; i >= n ; i--)
#define ss second
#define ff first
#define ll long long 

typedef pair <int , int> pii;

const int N = 1e5 + 10 , mod =  1000000007;

void solve(){

    // int n; cin >> n;
    // int arr[n];
    // forn(i,0,n)cin >> arr[i];

    int l , r , d;
    cin >> l >> r >> d;

    int ans = 0;

    forn(i,l,r+1){
        if(i % d == 0)ans++;
    }


    cout << ans << "\n";

    
    

    
    
        


}

int main(){
    Fast_as_duck;

/*
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
*/
    int t = 1; 
    
    // cin >> t;
    

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




    return 0;
}
      
       


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

using ll= long long;
#define double long double
#define sz(x) (int)x.size()
#define all(x) (x).begin(),(x).end()
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define _set(x) __builtin_popcount(x)
#define PI  3.14159265358979323846264338327950L
#define mod 1000000007
#define dpv(...) cerr<< "["#__VA_ARGS__ " : ";for(int i: (__VA_ARGS__)){cerr<<i<<" ";}cerr<<"]\n"

void solve(){
	ll a,b;
	cin>>a>>b;
	cout<<a*b<<"\n";
}

int32_t main(){
	IOS
	// freopen("input.txt","r",stdin);
	int _;
	// cin>>_;
	_=1;
	while(_--){
        solve();
    }
	return 0;
}

/*
   check for overflows int long long
   correct size of array
*/

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> vvl;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvec;
typedef vector<vector<bool>> vveb;
typedef vector<vector<string>> vves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pb push_back
#define pp pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
//const int64 INF = 1LL << 58;
#define dame { puts("-1"); return 0;}
#define YES { cout << "YES" << endl; return 0; }
#define NO { cout << "NO" << endl; return 0; }
#define Yes { cout << "Yes" << endl; return 0; }
#define No { cout << "No" << endl; return 0; }
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 (a>b) { a=b; return 1; } return 0; }
int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};

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

    int a,b,c;
    cin >> a >> b >> c;
    int tmp = b/a;
    cout << min(tmp,c);
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
long long int a,b;
while(scanf("%lld%lld",&a,&b)!=EOF)
{


long long int c,d,e;
c=d=e=0;
if(a<b)
{
   c+=a;
c+=(b-2*a)/4;
}
else
{
    c+=b/2;
}

printf("%lld\n",c);

}


return 0;

}


Measured memory_bytes: 128
fn main() {
    let mut sc = Scanner::new();
    let a: usize = sc.read();
    let b: usize = sc.read();
    for c in 1..4 {
        if (a * b * c) % 2 == 1 {
            println!("Yes");
            return;
        }
    }
    println!("No");
}

struct Scanner {
    ptr: usize,
    length: usize,
    buf: Vec<u8>,
    small_cache: Vec<u8>,
}

#[allow(dead_code)]
impl Scanner {
    fn new() -> Scanner {
        Scanner {
            ptr: 0,
            length: 0,
            buf: vec![0; 1024],
            small_cache: vec![0; 1024],
        }
    }

    fn load(&mut self) {
        use std::io::Read;
        let mut s = std::io::stdin();
        self.length = s.read(&mut self.buf).unwrap();
    }

    fn byte(&mut self) -> u8 {
        if self.ptr >= self.length {
            self.ptr = 0;
            self.load();
            if self.length == 0 {
                self.buf[0] = b'\n';
                self.length = 1;
            }
        }

        self.ptr += 1;
        return self.buf[self.ptr - 1];
    }

    fn is_space(b: u8) -> bool {
        b == b'\n' || b == b'\r' || b == b'\t' || b == b' '
    }

    fn read_vec<T>(&mut self, n: usize) -> Vec<T>
    where
        T: std::str::FromStr,
        T::Err: std::fmt::Debug,
    {
        (0..n).map(|_| self.read()).collect()
    }

    fn usize_read(&mut self) -> usize {
        self.read()
    }

    fn read<T>(&mut self) -> T
    where
        T: std::str::FromStr,
        T::Err: std::fmt::Debug,
    {
        let mut b = self.byte();
        while Scanner::is_space(b) {
            b = self.byte();
        }

        for pos in 0..self.small_cache.len() {
            self.small_cache[pos] = b;
            b = self.byte();
            if Scanner::is_space(b) {
                return String::from_utf8_lossy(&self.small_cache[0..(pos + 1)])
                    .parse()
                    .unwrap();
            }
        }

        let mut v = self.small_cache.clone();
        while !Scanner::is_space(b) {
            v.push(b);
            b = self.byte();
        }
        return String::from_utf8_lossy(&v).parse().unwrap();
    }
}


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

long long x,y;

long long extGCD(long long a, long long b, long long *px, long long *py){
    if(b == 0){
        *px = 1;
        *py = 0;
        return a;
    }
    long long d = extGCD(b, a%b, py, px);
    *py -= a/b * (*px);
    return d;
}

vector<long long> min_factor;

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

int main(){
    long long N;
    cin >> N;
    long long A[N+1];
    long long i;
    for(i=1; i<=N; i++){
        cin >> A[i];
    }
    long long g=A[1];
    for(i=2; i<=N; i++){
        g=extGCD(g,A[i],&x,&y);
    }
    if(g>1){
        cout << "not coprime" << endl;
        return 0;
    }
    set<long long> used_prime;
    long long pre;
    bool dabu=0;
    for(i=1; i<=N; i++){
        for(auto p: prime_factor(A[i])){
            pre=used_prime.size();
            used_prime.insert(p.first);
            if(pre==used_prime.size()){
                dabu=1;
                break;
            }
        }
        if(dabu==1) break;
    }
    if(dabu==1){
        cout << "setwise coprime" << endl;
    }else{
        cout << "pairwise coprime" << endl;
    }
    return 0;
}

Measured memory_bytes: 11432
#include <bits/stdc++.h>
using namespace std;
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; }

int q;
const int MAX = 100100;

vector<bool> primeno(MAX, true);
void Eratosthenes(int n) {
    primeno.at(0) = primeno.at(1) = false;
    int limit = sqrt(n);
    for(int i = 2; i < limit; ++i) {
        if(primeno.at(i)) {
            for(int j = 0; i*(j+2) < n; ++j) {
                primeno.at(i*(j+2)) = false;
            }
        }
    }
}

int main() {
    cin >> q;
    Eratosthenes(MAX);
    vector<int> ans(MAX, 0);
    for(int i = 0; i < 100000; ++i) {
        if((i+1) % 2 == 0) {
            ans.at(i+1) += ans.at(i);
        }else {
            if(primeno.at(i+1) && primeno.at((i+2)/2)) ans.at(i+1) += (ans.at(i)+1);
            else ans.at(i+1) += ans.at(i);
        }
    }

    for(int i = 0; i < q; ++i) {
        int l, r;
        cin >> l >> r;
        cout << ans.at(r) - ans.at(l-1) << endl;
    }
}

Measured memory_bytes: 1024