akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define U [1<<17]={}
typedef long long L;using namespace std;map<L,L>T U;L P U,E U,Z U,H U,C U,A U,O U,X U,B U,k,n,a,b,c,p,r;char s U;
L D(L a){L d;Z[a]=1;for(map<L,L>::iterator I=T[a].begin();I!=T[a].end();I++)
    d=I->first,d-P[a]?P[d]=a,E[d]=E[a]+1,C[d]=I->second,D(d),Z[a]+=Z[d],!H[a]|Z[H[a]]<Z[d]?H[a]=d:0:0;}
#define G(a)((r=A[a]+A[P[a]]+C[a])%k?r:0)
L M(L i){return i?B[i]+M(i^i&-i):0;}
L S(L x,L i){for(x=G(x)+M(i++)-M(i);i<1<<17;i+=i&-i)B[i]+=x;}
//L W(){for(c=0;p=X[a],n=X[b],p-n;a=P[p])E[p]<E[n]?swap(p,n),swap(a,b),0:0,c+=M(O[a])-M(O[p])+G(p);cout<<c+abs(M(O[a])-M(O[b]))<<endl;}
L K(L a){
    p=X[a],n=X[b];
    if(p-n){
        if(E[p]<E[n]){
            swap(p,n),swap(a,b);
        }
        return M(O[a])-M(O[p])+G(p)+K(P[p]);
    }else return abs(M(O[a])-M(O[b]));
}
L W(){cout<<K(a)<<endl;}
main(){for(cin>>n>>k;++p<n;T[a][b]=T[b][a]=c)cin>>a>>b>>c;
       for(D(c=p=0);p<n;p++)if(!p|H[P[p]]-p)for(a=p;!c|a;S(a=H[a],O[a]=c++))X[a]=p;
       for(cin>>a;cin>>s>>a>>b;*s&2?W():A[a]+=b,S(H[a],O[a]),a?S(a,O[a]-1):0);}

Measured memory_bytes: 33380
Option Strict On

Module Module1
    Const n As Int32 = 4
    Dim A, B, C, D, tmp(n - 1) As Long

    Sub Main()
        For i As Int32 = 0 To n - 1
            tmp(i) = CLng(Console.ReadLine())
        Next

        'let'
        A = tmp(0) : B = tmp(1) : C = tmp(2) : D = tmp(3)

        Console.WriteLine(Math.Min(A, B) + Math.Min(C, D))

    End Sub
End Module

Measured memory_bytes: 11220
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
	int n;
	cin>>n;
	int arr[n];
	for(int i=0;i<n;i++){
		cin>>arr[i];
	}
	ll x=0;
	for(int i=0;i<n;i++){
		x^=arr[i];
	}
	int a;
	for(int i=0;i<n;i++){
		a=x^arr[i];
		cout<<a<<" ";
	}
}

Measured memory_bytes: 4348
#include "bits/stdc++.h"

using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
	REP(i, v.size()) { if (i)os << " "; os << v[i]; }return os;
}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
	REP(i, v.size()) { if (i)os << endl; os << v[i]; }return os;
}

int main() {
	ll x, y;

	cin >> x >> y;

	if (x == 1 || x == 3 || x == 5 || x == 7 || x == 8 || x == 10 || x == 12) {
		if (y == 1 || y == 3 || y == 5 || y == 7 || y == 8 || y == 10 || y == 12) {
			cout << "Yes" << endl;
		}
		else {
			cout << "No" << endl;
		}
	}
	else if (x == 4 || x == 6 || x == 9 || x == 11) {
		if (y == 4 || y == 6 || y == 9 || y == 11) {
			cout << "Yes" << endl;
		}
		else {
			cout << "No" << endl;
		}
	}
	else if (x == 2) {
		if (y == 2) {
			cout << "Yes" << endl;
		}
		else {
			cout << "No" << endl;
		}
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
#pragma GCC optimize(2)
#define int long long
#define MAXN 2000000
#define INF (1e13 + 7)
#define MANX MAXN

using namespace std;

inline int read()
{
	int x = 0, f = 1; char c = getchar();
	while (c > '9' || c < '0') { if (c == '-') f = -1; c = getchar(); }
	while (c >= '0' && c <= '9') { x = x * 10 + (c ^ 48); c = getchar(); }
	return f * x;
}

signed main()
{
	cout << read() * read();
	return 0;
}

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

#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef complex<double> point;
#define xx real()
#define yy imag()

#define REP(i, a, b) for(int i = (a); i < (int)(b); i++)
#define REPN(i, a, b) for(int i = (a); i <= (int)(b); i++)
#define FA(it, x) for(__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define SZ(x) (int)(x).size()
#define BE(x) (x).begin(), (x).end()
#define SORT(x) sort(BE(x))
#define _1 first
#define _2 second

#define x1 gray_cat_x1
#define y1 gray_cat_y1

template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

#define file "cycle"

const double EPS = 1e-9;
const double PI = acos(-1.);
const int INF = 1e9;
const ll MOD = 1e9 + 7;

const int MAXN = 1e5 + 5;

int a[MAXN];

void solve(){
	int n, m, ind[2], cnt;
	scanf("%d%d", &n, &m);
	ind[0] = ind[1] = -1;
	cnt = 0;
	REP(i, 0, m){
		scanf("%d", &a[i]);
		if (a[i] & 1){
			if (cnt < 2){
				ind[cnt] = i;
			}
			cnt++;
		}
	}
	if (cnt > 2){
		printf("Impossible\n");
		return;
	}
	if (cnt > 0){
		swap(a[0], a[ind[0]]);
	}
	if (cnt > 1){
		swap(a[m - 1], a[ind[1]]);
	}
	REP(i, 0, m){
		printf("%d ", a[i]);
	}
	if (m == 1 && a[0] != 1){
		a[0]--;
		a[1] = 1;
		m = 2;
	} else {
		a[0]++;
		a[m - 1]--;
		if (a[m - 1] == 0){
			m--;
		}
	}
	printf("\n%d\n", m);
	REP(i, 0, m){
		printf("%d ", a[i]);
	}
}	

int main(){

	//freopen(file".in", "r", stdin); freopen(file".out", "w", stdout);
	int t = 1;
	//cin >> t;
	while(t--){
		solve();	
	}
}

Measured memory_bytes: 256
#include <limits.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <math.h>

#define P 1000000007

int comp(const void *a, const void *b){return *(int*)a-*(int*)b;}
int compw(const void *a, const void *b){return (*(int*)a>*(int*)b)-(*(int*)a<*(int*)b);}

uint32_t nextpint(void){ char c=getchar(); while(c<'0'||'9'<c) c=getchar(); uint_fast32_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar(); } return x; }

inline int min2(const int a, const int b){return a>b?b:a;}
inline int dif2(const int a, const int b){return a>b?a-b:b-a;}

int a[2000];
int d[2000][2000];
int main(void){
	int n=nextpint();
	int x=nextpint();
	long ans=0;
	for(int i=0; i<n; i++){
		ans+=d[0][i]=a[i]=nextpint();
	}
	for(int j=1; j<n; j++){
		long now=(long)x*j;
		for(int i=0; i<n; i++){
			now+=d[j][i]=min2(d[j-1][(i+n-1)%n],a[i]);
		}
		if(now<ans) ans=now;
	}
	printf("%ld\n", ans);
}


Measured memory_bytes: 15744
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(long long i=0; i<(n); ++i)
#define REP(i, d, n) for(long long i=(d); i<(n); ++i)
#define all(v) v.begin(), v.end()
using ll = long long;
int main() {//言語変えろ言語変えろ言語変えろ言語変えろ言語変えろ
            
int a,b;cin>>a>>b;
  int ans;
  ans=a-2*b;
  if(ans<0){ans=0;}
  
  cout<<ans<<endl;
  
}


Measured memory_bytes: 256
/*   lmao i am nooooooooooooooooooooooooooooob :(
*/
#include<bits/stdc++.h>
    #define loop for(int i=0;i<n;i++)
    #define int long long
    #define MOD 1000000007
    using namespace std;
char g[105][105];
int h, w;
int dp[105][105];
int dfs(int i, int j){
    if(dp[i][j]!=-1) return dp[i][j];
    if(i==h && j==w){
        if(g[i][j]=='#') return 1;
        return 0;
    }
    int ans = h*w*5;
    if(i+1<=h){
        int comp = dfs(i+1, j);
        if(g[i][j]=='#' && g[i+1][j]!='#') comp++;
        ans = min(ans, comp);
    }
    if(j+1<=w){
        int comp = dfs(i, j+1);
        if(g[i][j]=='#' && g[i][j+1]!='#') comp++;
        ans = min(ans, comp);
    }
    return dp[i][j] = ans;
}
    int32_t main(){
        cin>>h>>w;
        for(int i = 1;i<=h;i++){
            for(int j = 1;j<=w;j++) cin>>g[i][j];
        }
        for(int i = 1;i<=h;i++){
            for(int j = 1;j<=w;j++) dp[i][j] = -1;
        }
        cout<<dfs(1, 1)<<endl;
    }

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

const ll MAXN = 200000;

ll N, ans=0, tmp=0;
vector<ll> A(MAXN, 0);

signed main(){
    cin >> N;
    for(int i=0;i<N;i++) {
        ll a;
        cin >> a;
        if(a%2==1) {
            cout << "first" << endl;
            return 0;
        }
    }
    cout << "second" << endl;
    return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int main()
{
  while(1)
  {
  long long int n,x,cnt=0;
  cin>>n>>x;
  if(n==0)
  {
    break;
  }
  else
  {
  for(long long int i=1;i<=n-2;i++)
  {
    for(long long int j=i+1;j<=n-1;j++)
    {
      for(long long int k=j+1;k<=n;k++)
      {
          if(i+j+k==x)
          {
            cnt++;
            break;
          }
      }
    }
  }
  cout<<cnt<<endl;
}
}
}



Measured memory_bytes: 3124
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <cmath>

using namespace std;

#define REP(i,n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef pair<int, int> pint;

int main() {
  int N, K; cin>>N>>K;
  bool ok = (N+1)/2>=K;
  cout << (ok ?	"YES" :	"NO") << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
const int INF=0x3f3f3f3f;
ll a[100006];
int main()
{
    ll a,b,c,k;cin>>a>>b>>c>>k;
    if(k<=a) cout<<k<<endl;
    else if(k<=a+b) cout<<a<<endl;
    else
        cout<<-1ll*(k-a-b)+a<<endl;
    return 0;
}


Measured memory_bytes: 3632
#include <iostream>
#include <stdio.h>
#include <math.h>
#include <algorithm>
#include <string>
#include <map>
#include <queue>
#include <vector>
#include <string.h>
using namespace std;
map<string,int>mp;
int main()
{
    int n;
    scanf("%d",&n);
    int cnt = 0;
    for (int i = 0;i<n;i++) {
        string c;
        cin>>c;
        if (mp.find(c)==mp.end()){
            cnt++;
            mp[c] = 1;
        }
        else {
            cnt--;
            mp.erase(c);
        }
    }
    printf("%d",cnt);
	return 0;
}


Measured memory_bytes: 12544
n = int(input())
b = [input() for i in range(n)]


m = int(input())
r = [input() for i in range(m)]

from collections import Counter
bc = Counter(b)
rc = Counter(r)

bs = list(set(b))

res = 0
for i in bs:
    res = max(res,bc[i]-rc[i])
    
print(res)

Measured memory_bytes: 9368
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		boolean travelable = true;
		for(int i=0;i<n;i++) {
			int t = in.nextInt();
			int x = in.nextInt();
			int y = in.nextInt();
			if(x+y>t || (x+y-t)%2!=0) {
				travelable = false;
				break;
			}
		}
		if(travelable) System.out.println("Yes");
		else System.out.println("No");
		in.close();
	}

}


Measured memory_bytes: 87076
function Main(input) {
  var WAry = input
    .trim()
    .split("\n")[1]
    .split(/\s/)
    .map(val => parseInt(val, 10));
  var minGap = Infinity;

  for (var i = 1; i < WAry.length; i++) {
    var copyAry = WAry.concat();
    var latterAry = copyAry.splice(i);

    var formerSum = 0;
    var latterSum = 0;
    for (var j = 0; j < copyAry.length; j++) {
      formerSum += copyAry[j];
    }
    for (var k = 0; k < latterAry.length; k++) {
      latterSum += latterAry[k];
    }
    minGap =
      minGap > Math.abs(formerSum - latterSum)
        ? Math.abs(formerSum - latterSum)
        : minGap;
  }
  console.log(minGap);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 21064
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPLL(i, n) for (ll i = 0; i < (ll)(n); i++)
using namespace std;
template<class T>inline bool chmax(T &a, const T &b){if(a < b){a = b; return 1;}return 0;}
template<class T>inline bool chmin(T &a, const T &b){if(a > b){a = b; return 1;}return 0;}
typedef long long ll;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int H, W, D; cin >> H >> W >> D;
  vector<pair<int, int> > A(H*W, pair<int, int>());
  REP(i, H){
    REP(j, W){
      int tmp; cin >> tmp; tmp--;
      A[tmp] = {i+1, j+1};
    }
  }
  vector<int> AA(H*W, 0);
  REP(i, D){
    for(int j = i; j < H*W; j += D){
      if(j >= D){
        AA[j] = AA[j-D] + abs(A[j].first-A[j-D].first)+abs(A[j].second-A[j-D].second);
      }
    }
  }
  int Q; cin >> Q;
  vector<int> L(Q);
  vector<int> R(Q);
  REP(i, Q){
    cin >> L[i] >> R[i]; L[i]--; R[i]--;
  }
  REP(i, Q){
    cout << AA[R[i]] - AA[L[i]] << endl;
  }
}

Measured memory_bytes: 2944
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
# define mod 1000000007
# define INF (1 << 29)
# define MAX_N 1000010
/* ACはうれCすぎてうれD */

int main(void){ 
    int n;
    cin >> n;
    vector<ll> A;
    for(int i=0; i<n; i++){
        ll tmp_a;
        cin >> tmp_a;
        A.push_back(tmp_a);
    }
    sort(A.begin(), A.end());

    vector<pair<ll, ll>> v;
    ll counter = 1;
    for(int i=0; i<n-1; i++){
        if(A[i] != A[i+1]){
            v.push_back(make_pair(A[i], counter));
            counter = 1;
        }
        else{
            counter += 1;
        }
    }
    v.push_back(make_pair(A[n-1], counter));

    int ans = 0;
    for(int i=0; i<v.size(); i++){
        if(v[i].first > v[i].second){
            ans += v[i].second;
        }
        else if(v[i].first < v[i].second){
            ans += v[i].second - v[i].first;
        }
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
long long t,n,a[200000+10],ans;
multiset <long long> st; 
int main(){
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i];
		st.insert(a[i]);
	}
	sort(a,a+n);
	for(int i=n-1;i>=0;i--){
		if(st.find(a[i])!=st.end()){
			t=1;
			st.erase(st.find(a[i]));
			for(int j=0;j<40;j++){
				t*=2;
				if(st.find(t-a[i])!=st.end()){
					st.erase(st.find(t-a[i]));
					ans++;
					break;
				}
			}
		}
	}
	cout<<ans;
}



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

struct Node{
    int key;
    Node *p, *l, *r;
};

Node *root, *NIL;

void insert(int n);
void print(Node *r);
void inorder(Node *r);
void preorder(Node *r);

int main(){
    int n; cin >> n;
    for(int i = 0; i < n; i++){
        string com; cin >> com;
        if(com == "insert"){
            int num; cin >> num;
            insert(num);
        }
        if(com == "print"){
            print(root);
        }
    }
}


void insert(int n){
    Node *y = NIL; //見つかった挿入箇所の親
    Node *x = root; //根から挿入箇所を調べていく
    Node *z;
    z = (Node *)malloc(sizeof(Node));
    z->key = n;
    z->l = NIL; z->r = NIL;

    while(x != NIL){ //一番下
        y = x; //調べているところのおや
        if(z->key < x->key){ //調べてる場所より小さい
            x = x->l;
        }else{
            x = x->r;
        }
    }
    z->p = y; //

    if(y == NIL){
        root = z;
    }else if(z->key  < y->key){
        y->l = z;
    }else{
        y->r = z;
    }
}

void print(Node *r){
    inorder(r);
    cout << endl;
    preorder(r);
    cout << endl;
}

void inorder(Node *r){
    if(r == NIL) return;
    inorder(r->l);
    cout << " " << r->key;
    inorder(r->r);
}

void preorder(Node *r){
    if(r == NIL) return;
    cout << " " << r->key;
    preorder(r->l);
    preorder(r->r);
}


Measured memory_bytes: 26548
#include <iostream>
#include<stdio.h>
#include<stdlib.h>
#include<vector>
#include<algorithm>
#include<math.h>

using namespace std;

int main()
{
	string S;
	cin >> S;
	int count = 0;
	for (int i = 0; i < S.length(); i++)
	{
		if (S[i] == 'x')	count++;
	}

	if (count >= 8)	cout << "NO";
	if (count <= 7)	cout << "YES";


	if(count)
	return 0;
}

Measured memory_bytes: 256
import numpy as np

n, m, x = map(int, input().split(" "))
c_min = np.inf
input_list = list(map(int, input().split(" ")))
c_list = np.array([input_list[0]])
a_list = np.array([input_list[1:]])
for _ in range(n - 1):
    input_list = list(map(int, input().split(" ")))
    c_list = np.append(c_list, input_list[0])
    a_list = np.vstack([a_list, input_list[1:]])

for i in range(1, 2 ** n):
    i_bin_str = str(bin(i))[2:]
    if len(i_bin_str) < n:
        i_bin_str = "0" * (n - len(i_bin_str)) + i_bin_str
    i_bin_list = np.array(list(map(int, list(f"{i_bin_str}"))))
    if len(a_list[i_bin_list > 0]) > 1:
        a_min = min(sum(a_list[i_bin_list > 0]))
    else:
        a_min = min(a_list[i_bin_list > 0][0])
    c_sum = sum(c_list[i_bin_list > 0])
    if a_min >= x and c_sum < c_min:
        c_min = c_sum

ans = -1 if np.isinf(c_min) else c_min
print(ans)


Measured memory_bytes: 27348
#include <iostream>
#include <fstream>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <stack>

#define rep(i,x) for(int i=0;i<x;i++)
#define rrep(i,x) for(int i=x-1;i>=0;i--)
#define rep_to(a,i,x) for(int i=a;i<x;i++)

using namespace std;

int main()
{
	int N,M,P;
	while(cin >> N >> M >> P && N)
	{
		int x[100000]={};
		double sum=0;

		rep(i,N)
		{
			cin >> x[i];
			sum+=x[i]*100;
		}

		if(x[M-1]!=0)cout<<floor(sum/x[M-1]*(100-P)/100)<<endl;
		else cout<<0<<endl;
	}
}

Measured memory_bytes: 1632
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for(int i = 0; (i) < ((int)(n)); ++(i))
const ll INF = 10e10;
const ll MOD = 10e9 + 7;

int main() {
    int ans = 0;
    int D, T, S;
    cin >> D >> T >> S;
    if(S * T >= D)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

Measured memory_bytes: 3592
n,m = map(int,input().split())
like=[0]*(m+1)#like[j]がj番目の食べ物を好きな人の人数
for i in range(n):
    k,*a=map(int,input().split())
    for j in a:
        like[j] += 1
print(like.count(n))


Measured memory_bytes: 2940
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int l = sc.nextInt();
		int[] arr  = new int[n];
		int sum = 0;
		for(int i=1;i<=n;i++) {
			arr[i-1]=l+i-1;
			sum = sum+arr[i-1];
		}
		int min = Integer.MAX_VALUE;
		int y = 0;
		for(int j=0;j<n;j++) {
			if(Math.abs(sum-(sum-arr[j]))<min) {
				min = Math.abs(sum-(sum-arr[j]));
				y=j;
				
			}
		}
		
		System.out.println(sum-arr[y]);

	}

}


Measured memory_bytes: 24020
#include <iostream>
#include <memory>
#include <vector>

using namespace std;

vector<int> d;

bool bin(int l,int r,int key){
    int mid;
    while(l < r){
        mid = (l + r)/2;
        if(d[mid]==key){
            return mid;
        }else if(key < d[mid]){
            r = mid;
        }else{
            l = mid + 1;
        }
    }
    return false;
}

int main(){          

    int n,itmp;
    cin>>n;

    for(int i=0;i<n;++i){
        cin>>itmp;
        d.push_back(itmp);
    }

    int q, count=0;
    cin>>q;
    for(int i=0;i<q;i++){
        cin>>itmp;
        if(bin(0,n,itmp)){
//          cout<<" item:"<<itmp<<endl;
            count++;
        }
    }
    cout<<count<<endl;
    return 0;
}

Measured memory_bytes: 1672
//2017-10-17
//miaomiao
//
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <algorithm>

using namespace std;

#define LL long long
#define For(i, a, b) for(int i = (a); i <= (int)(b); ++i)
#define N (2000+5)

int a[N], b[N];

int main(){
	int n, x;
	LL ans = 0;

	scanf("%d%d", &n, &x);
	For(i, 0, n-1){
		scanf("%d", &a[i]); ans += b[i]=a[i];
	}

	LL add;
	For(k, 0, n-1){
		add = 0;
		For(i, 0, n-1)
			add += b[i] = min(b[i], a[(i-k+n)%n]);
		ans = min(ans, 1ll*x*k + add);
	}
	printf("%lld\n", ans);

	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
  int A=0,B=0;
  
 if( scanf("%d %d",&A,&B)==1);
  if(A==0){return 0;}
  if(B%A==0){printf("%d\n",A+B);}
  else{printf("%d\n",B-A);}
  
  return 0;
} 

Measured memory_bytes: 128
N = int(input())
A = [int(_) for _ in input().split()]
B = [int(_) for _ in input().split()]
ans = 0

for i in range(N):
    left = min(A[i], B[i])
    A[i] -= left
    B[i] -= left
    ans += left

    right = min(A[i + 1], B[i])
    A[i + 1] -= right
    B[i] -= right
    ans += right

print(ans)

Measured memory_bytes: 18468
#include <iostream>
#include <vector>
#include <unordered_set>
#include <map>

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

    std::map<char, std::unordered_set<std::string>> initial_sets;
    for (char initial : "MARCH") {
        initial_sets[initial] = std::unordered_set<std::string>();
    }
    for (int i = 0; i < N; i ++) {
        std::string s;
        std::cin >> s;
        initial_sets[s[0]].insert(s);
    }

    long count = 0;
    for (int i = 0; i < 5; i ++) {
        char initial1 = "MARCH"[i];
        for (int j = i + 1; j < 5; j ++) {
            char initial2 = "MARCH"[j];
            for (int k = j + 1; k < 5; k ++) {
                char initial3 = "MARCH"[k];
                count += initial_sets[initial1].size() * initial_sets[initial2].size() * initial_sets[initial3].size();
            }
        }
    }
    std::cout << count << std::endl;
}


Measured memory_bytes: 9852
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/rope>
using namespace std;
using namespace chrono;
using namespace __gnu_pbds;
using namespace __gnu_cxx;
mt19937 rng(high_resolution_clock::now().time_since_epoch().count());
mt19937_64 rngll(high_resolution_clock::now().time_since_epoch().count());
template<typename T> T ctmax(T &x, const T &y){ return x = max(x, y); }
template<typename T> T ctmin(T &x, const T &y){ return x = min(x, y); }
template<typename T> using Tree = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;



int main(){
	cin.tie(0)->sync_with_stdio(0);
	int n;
	long long c;
	cin >> n >> c;
	vector<int> h(n);
	for(auto i = 0; i < n; ++ i){
		cin >> h[i];
	}
	auto cost = [&](int i, int j){
		return 1LL * (h[i] - h[j]) * (h[i] - h[j]) + c;
	};
	vector<long long> dp(n);
	auto cross = [&](int i, int j){
		int l = j, r = n;
		while(r - l > 1){
			int mid = l + r >> 1;
			dp[i] + cost(i, mid) <= dp[j] + cost(j, mid) ? l = mid : r = mid;
		}
		return l;
	};
	deque<int> q{0};
	for(auto i = 1; i < n; ++ i){
		while(int(q.size()) > 1 && cross(*q.begin(), *next(q.begin())) < i){
			q.pop_front();
		}
		dp[i] = dp[q.front()] + cost(q.front(), i);
		while(int(q.size()) > 1 && cross(*next(q.rbegin()), *q.rbegin()) >= cross(*q.rbegin(), i)){
			q.pop_back();
		}
		q.push_back(i);
	}
	cout << dp.back();
	return 0;
}

/*

*/

////////////////////////////////////////////////////////////////////////////////////////
//                                                                                    //
//                                   Coded by Aeren                                   //
//                                                                                    //
////////////////////////////////////////////////////////////////////////////////////////

Measured memory_bytes: 2688
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vii = vector<vi>;
using vs = vector<string>;
using in6 = int64_t;
using ind = double;
using pii = pair<int,int>;
using psi = pair<string,int>;
using vpi = vector<pii>;
using vps = vector<psi>;
#define rep(i, n) for (in6 i = 0; i < (in6)(n); i++)
#define repa(i,a,n) for(in6 i = a; i < (in6)(n); i++)
#define repdown(i,n) for(in6 i = n; i > 0; i--)
#define kyun ios::sync_with_stdio(false)
#define hinata cout << "\n"
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define inf 2147483647
#define dset(n) cout << fixed << setprecision(n)

int main() {
  kyun;
  int a,b,c;
  cin >> a >> b >> c;
  int ans = max(0,c-(a-b));
  cout << ans;
  hinata;
}

Measured memory_bytes: 256
using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using E = System.Linq.Enumerable;
 
class Program
 {
        static void Main(string[] args)
        {
          //入力を受け取る
          var n = int.Parse(Console.ReadLine());
          var v = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
          var Odd  = new Dictionary<int, int>();
          var Even = new Dictionary<int, int>();
          
          for(int i = 0; i < n ; i++){
            if(i%2 == 0){
              if(Even.ContainsKey(v[i])){
                Even[v[i]] += 1;
              }else{
                Even.Add(v[i],1);
              }
            }else{
              if(Odd.ContainsKey(v[i])){
                Odd[v[i]] += 1;
              }else{
                Odd.Add(v[i],1);
              }
            }
          }
          
          int maxOddValue=0;
          int maxOddKey=0;
          int SecondOddValue=0;
          int SecondOddKey=0;
          
          foreach(KeyValuePair<int, int> item in Odd) {
            if(maxOddValue < item.Value){
              SecondOddValue = maxOddValue;
              SecondOddKey   = maxOddKey;
              maxOddValue = item.Value;
              maxOddKey   = item.Key;
            }else if(SecondOddValue < item.Value){
              SecondOddValue = item.Value;
              SecondOddKey   = item.Key;
            }
          }
          
          int maxEvenValue=0;
          int maxEvenKey=0;
          int SecondEvenValue=0;
          int SecondEvenKey=0;
          
          foreach(KeyValuePair<int, int> item in Even) {
            if(maxEvenValue < item.Value){
              SecondEvenValue = maxEvenValue;
              SecondEvenKey   = maxEvenKey;
              maxEvenValue = item.Value;
              maxEvenKey   = item.Key;
            }else if(SecondEvenValue < item.Value){
              SecondEvenValue = item.Value;
              SecondEvenKey   = item.Key;
            }
          }
          
          //それぞれの変更に必要な回数を求める
          int changeOdd = (n/2)-maxOddValue;
          int changeEven = (n/2)-maxEvenValue;
          
          if(maxOddKey == maxEvenKey){
              changeOdd = (n/2)-SecondOddValue;
              var a = changeOdd+changeEven;
              changeOdd = (n/2)-maxOddValue;
              changeEven = (n/2)-SecondEvenValue;
              var b = changeOdd+changeEven;
              
            if(a < b){
              Console.WriteLine(a);
            }else{
              Console.WriteLine(b);
            }
          }else{
            Console.WriteLine(changeOdd+changeEven);
          }
        }
}


Measured memory_bytes: 25184
#include <cstdint>
#include <queue>
#include <vector>

using namespace std;

#define GRAPH_SIZE 101
#define START_INDEX 1

enum color_t {
  WHITE,
  GRAY,
  BLACK,
};

struct data_t {
  uint32_t index;
  vector<uint32_t> connection;
  uint32_t distance;
};

static vector<uint32_t> graph[GRAPH_SIZE];
static color_t state[GRAPH_SIZE];

void breadth_first_search(void (*callback)(uint32_t, uint32_t))
{
  for (uint32_t i = START_INDEX; i < GRAPH_SIZE; i++) {
    state[i] = WHITE;
  }

  queue<data_t> queue;

  data_t data;
  data.index = START_INDEX;
  data.connection = graph[START_INDEX];
  data.distance = 0;

  queue.push(data);
  state[START_INDEX] = GRAY;

  while (!queue.empty()) {
    data_t top = queue.front();
    queue.pop();

    state[top.index] = BLACK;
    callback(top.index, top.distance);

    for (uint32_t i = 0; i < top.connection.size(); i++) {
      if (state[top.connection[i]] == WHITE) {
        data_t data;
        data.index = top.connection[i];
        data.connection = graph[top.connection[i]];
        data.distance = top.distance + 1;
        queue.push(data);
        state[data.index] = GRAY;
      }
    }
  }
}

#include <iostream>

int32_t distances[GRAPH_SIZE];

static void callback(uint32_t index, uint32_t distance)
{
  distances[index] = distance;
}

int32_t main()
{
  uint32_t num;
  cin >> num;

  for (uint32_t i = START_INDEX; i < START_INDEX + num; i++) {
    distances[i] = -1;
  }

  for (uint32_t i = 0; i < num; i++) {
    uint32_t index, len;
    cin >> index >> len;
    for (uint32_t j = 0; j < len; j++) {
      uint32_t val;
      cin >> val;
      graph[index].push_back(val);
    }
  }

  breadth_first_search(callback);

  for (uint32_t i = START_INDEX; i < START_INDEX + num; i++) {
    cout << i << " " << distances[i] << endl;
  }

  return 0;
}

Measured memory_bytes: 3152
#include<stdio.h>

int main()
{
  int i,n,m,a,b,error,mex;
  error = -1;
  scanf("%d",&n);
  scanf("%d",&m);
  mex = m;  

  for(i=0;i<n;i++)
    {
      scanf("%d %d",&a,&b);
      m += (a-b);
      if(m < 0)
	error = 0;
      if(mex < m)
	mex = m;
    }

  error != -1?printf("0\n"):printf("%d\n",mex);

  return 0;
}

Measured memory_bytes: 592
#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 FORR(i, m, n) for (int i = m; i >= n; i--)
#define INF 1e9;
using namespace std;
typedef long long ll;
int main() {
  ll N;
  cin >> N;
  ll A[N];
  REP(i, N) {
    cin >> A[i];
    A[i] -= i + 1;
  }
  sort(A, A + N);

  ll b;
  if (N % 2 == 0) {
    b = (A[N / 2 - 1] + A[N / 2]) / 2;
  } else {
    b = A[N / 2];
  }

  ll ans = 0;
  REP(i, N) { ans += abs(A[i] - b); }

  cout << ans;

  return 0;
}

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

using namespace std;
#define tam 100001
int A[tam][3],n;
int dp[tam][3];
int solver(int y, int x)
{
    if(dp[y][x]!=-1)
        return dp[y][x];
    if(y == 0 )
    {
    	dp[y][x] = A[y][x];
        return A[y][x];
    }
    return dp[y][x] = max(solver((y-1),(x+1)%3)+ A[y][x],
	solver((y-1),(x+2)%3) + A[y][x]);
}
int main()
{
    int bas;
    cin>>n;
    for(int i = 0;i < n ;i++)
        for(int j = 0 ; j < 3; j++)
            cin >>A[i][j];
    memset(dp,-1,sizeof dp);
     for(int i = 0; i < 3; i ++)
    	bas = solver(n-1,i);
    cout <<max(max(dp[n-1][0],dp[n-1][1]),max(dp[n-1][0],dp[n-1][2]))<<"\n";
    return 0;
}

Measured memory_bytes: 12120
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep2(i, s, n) for(int i=s; i<(n); ++i)

using namespace std;

typedef long long ll;

static const int INTINF = (2147483647);
static const ll LLINF = (9223372036854775807);
static const int MAX = 100001;
static const ll MOD = 1000000007;

//--global--//



//----------//

int main(int argc, const char * argv[]) {
    //提出時、消す----//
    //--------------//

    string s, t;
    cin >> s >> t;

    char sc[100];
    char tc[100];

    rep(i, s.size()){
        sc[s[i]-'a'] = t[i];
        tc[t[i]-'a'] = s[i];
    }

    rep(i, s.size()){
        if(sc[s[i]-'a'] != t[i] || tc[t[i]-'a'] != s[i]){
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;
    
    return 0;
}


Measured memory_bytes: 776
//Author:- Yatin Patel
//Mail:- yatinpatel.gt@gmail.com

#include <bits/stdc++.h>
#define FILEIN ifstream fin;fin.open("input.txt");
#define FILEOUT ofstream fout;fout.open("output.txt");

using namespace std;

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << endl;
    err(++it, args...);
}

#define FAST ios::sync_with_stdio(false);ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

#define ll long long
#define ld long double
#define pb push_back
#define ff first
#define ss second

#define precision(x,d) cout<<fixed<<setprecision(d)<<x
#define minQueue priority_queue<ll,vector<ll>,greater<ll> >
#define maxQueue priority_queue<ll,vector<ll>,less<ll> > 

#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define RFOR(i,a,b) for(ll i=a;i>b;i--)
#define FILL(a,b) memset((a),(b),sizeof((a)))

#define MOD 1000000007
#define INF LONG_MAX
#define MINF LONG_MIN

ll power(ll x, unsigned ll y){
    if (y == 0)
        return 1;
    else if (y%2 == 0)
        return power(x, y/2)*power(x, y/2);
    else
        return x*power(x, y/2)*power(x, y/2);
}

//#define fin cin
//#define fout cout

int main(){

    FAST;
    ll n;
    cin>>n;

    ll sum1 = 0;
    ll sum2 =0 ;
    vector<ll> a(n);
    for(ll i=0;i<n;i++){
        cin>>a[i];
        sum1 += a[i];
    }

    vector<ll> b(n);
    for(ll i=0;i<n;i++){
        cin>>b[i];
        sum2 += b[i];
    }

    if(sum2>sum1){
        cout<<-1;
        return 0;
    }

    vector<ll> v(n);
    for(ll i=0;i<n;i++){
        v[i] = a[i]-b[i];
    }
    
    sort(v.begin(),v.end());

    ll ans = 0;
    ll sum = 0;
    for(ll i=0;i<n;i++){
        if(v[i]>=0)
            break;
      //  cout<<v[i]<<" ";
        sum += v[i];
        ans++;
    }

    for(ll i=v.size()-1;i>=0;i--){
        if(v[i]<0)
            break;
        if(sum>=0)
            break;
    //    cout<<v[i]<<" ";
        sum += v[i];
        ans++;
    }

    cout<<ans;

    return 0;
}






Measured memory_bytes: 2560
#include <iostream>
#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()
{
    int n, m;
    cin >> n >> m;
    if (n == m) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


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

#define ll long long
#define mod 1000000007
#define pb push_back

ll check[100000]={0};
//vector<ll,pair<ll,vector<ll>>> mp;
int main()
{
ll a,b;
cin>>a>>b;
ll count=0;
while(a)
{
  a/=b;
  count++;
}
cout<<count<<endl;
}


Measured memory_bytes: 256
H,W = map(int, input().split())
field = [list(input()) for _ in range(H)]
dy = [1,-1,0,0]
dx = [0,0,1,-1]


count = 0

# for i in range(H):
#     for j in range(W):
#         if field[i][j] == start:
#             sy, sx = i, j
#         elif field[i][j] == goal:
#             gy, gx = i, j
sy,sx = 0,0
gy,gx = H-1,W-1
seen = [[0 for i in range(W)] for j in range(H)]
queue = [[sy,sx]]
flag = False
while queue != []:
    h,w = queue.pop(0)
    before = seen[h][w]
    for i in range(4):
        nh = h + dy[i]
        nw = w + dx[i]
        if (nh == gy) and (nw == gx):
            count = before+1
            flag = True
        if (0<=nh<H) and (0<=nw<W):
            if field[nh][nw] != '#':
                if seen[nh][nw] == 0:
                    seen[nh][nw] = before+1
                    queue.append([nh,nw])
    if flag:
        break
whites = 0
for i in range(H):
    for j in range(W):
        if field[i][j] == '.':
            whites += 1
if count != 0 :
    print(whites - count-1)
else:
    print(-1)
    


    

Measured memory_bytes: 3064
#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <numeric>
#include <algorithm>

using namespace std;
using lint = long long;
constexpr int MOD = 1000000007, INF = 1010101010;
constexpr lint LINF = 1LL << 60;

template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
	for (const auto &e : vec) os << e << (&e == &vec.back() ? "\n" : " ");
	return os;
}

#ifdef _DEBUG
template <class T>
void dump(const char* str, T &&h) { cerr << str << " = " << h << "\n"; };
template <class Head, class... Tail>
void dump(const char* str, Head &&h, Tail &&... t) {
	while (*str != ',') cerr << *str++; cerr << " = " << h << "\n";
	dump(str + (*(str + 1) == ' ' ? 2 : 1), t...);
}
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else 
#define DMP(...) ((void)0)
#endif

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int N, x;
	cin >> N >> x;

	if (N == 1) {
		cout << "Yes" << "\n";
		cout << 1 << "\n";
		return 0;
	}

	if (x == 1 || x == 2 * N - 1) {
		cout << "No" << "\n";
		return 0;
	}

	cout << "Yes" << "\n";

	for (int i = N - (x > N); i >= 1; i--) if(i != x) cout << i << "\n";
	cout << x << "\n";
	for (int i = 2 * N - 1; i >= N + (x <= N); i--) if (i != x) cout << i << "\n";

	return 0;
}

Measured memory_bytes: 1536
int main(void){
  int n,a=0;
  
  scanf("%d",&n);
  
  for (int i = 1; i <= 9; i ++)
    for (int j = 1; j <= 9; j ++) 
      if(i*j == n)
        a = 1;
   
  
  a ? puts("Yes") : puts("No");
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n;
  cin >> n;
  vector<int> h(n);
  
  for (int i = 0; i < n; i++){
    cin >> h.at(i);
  }
  vector<int> dp(n);
  dp.at(0) = 0;
  dp.at(1) = abs(h.at(1)-h.at(0));
  
  for(int j = 2;j<n;j++){
    dp.at(j) = min(abs(h.at(j)-h.at(j-1)) + dp.at(j-1), abs(h.at(j)-h.at(j-2)) + dp.at(j-2));
  }
  long long res = dp.at(n-1);

  cout << res << endl;
}

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

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;
	}
}

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



int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    
    	ll x,y,a,b,c;
    	cin>>x>>y>>a>>b>>c;
    	multiset<ll> s;
    	vector<ll> vec1(a),vec2(b),vec3(c);
    	for(ll i=0;i<a;++i)
    	{
    		cin>>vec1[i];
    	}

    	for(ll i=0;i<b;++i)
    	{
    		cin>>vec2[i];
    	}

    	for(ll i=0;i<c;++i)
    	{
    		cin>>vec3[i];
    	}
        sort(vec1.rbegin(),vec1.rend());
    	sort(vec2.rbegin(),vec2.rend());
    	sort(vec3.rbegin(),vec3.rend());
    	for(ll i=0;i<x;++i)
    	{
    		s.insert(vec1[i]);
    	}

    	for(ll i=0;i<y;++i)
    	{
    		s.insert(vec2[i]);
    	}

    	for(ll i=0;i<c;++i)
    	{
    		s.insert(vec3[i]);
    	}

    	


    	vector<ll> dp;
    	ll sum=0;
    	for(auto it=s.begin();it!=s.end();++it)
    	{
    		
    		dp.push_back(*it);
    		//cout<<*it<<" ";
    	}
        reverse(dp.begin(),dp.end());
    	ll n=dp.size();
        for(int i=0;i<x+y;++i)
        {
        
            sum+=dp[i];
        }
        cout<<sum<<endl;


    

}


Measured memory_bytes: 22004
import itertools

n,m = map(int,input().split())
graph = dict()
for i in range(1,n+1):
    graph[i] = []
for i in range(m):
    a,b = map(int,input().split())
    graph[a].append(b)
    graph[b].append(a)

t = [i for i in range(1,n+1)]
testcase = list(itertools.permutations(t))
counter = 0
for i in range(len(testcase)):
    if testcase[i][0] != 1:
        break
    else:
        temp = True
    now = 1
    for k in range(1,n):
        if testcase[i][k] not in graph[now]:
            temp = False
            break
        else:
            now = testcase[i][k]
    if temp:
        counter += 1

print(counter)

Measured memory_bytes: 8052
#include<iostream>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<string>
using namespace std;
long long a[100010],b[100010],x[100010],v[100010];

int main()
{
//	cout<<a[0]<<" "<<b[0];
	long long n,c;
	cin>>n>>c;
	cin>>x[1]>>v[1];
	a[1]=v[1]-x[1];
	for(int i=2;i<=n;i++){
		cin>>x[i]>>v[i];
		a[i]=a[i-1]-x[i]+v[i]+x[i-1];
	}
	b[1]=v[n]-(c-x[n]);
	for(int i=2;i<=n;i++){
		b[i]=b[i-1]-(c-x[n-i+1])+v[n-i+1]+(c-x[n-i+2]);
	}
	long long ans=0;
	for(int i=2;i<=n;i++){
		a[i]=max(a[i-1],a[i]);
		b[i]=max(b[i-1],b[i]);
		ans=max(ans,max(a[i],b[i]));
	}
	long long ans1=0,ans2=0;
	for(int i=1;i<=n;i++){
		if(i<n){
			ans1=max(ans1, a[i]-x[i]+b[n-i] );
			ans2=max(ans2, b[i]-(c-x[n-i+1])+a[n-i] );
		}
		else{
			ans1=max(ans1, a[i]);
			ans2=max(ans2, b[i]);
		}
	}
	cout<<max( ans, max(ans1,ans2) )<<endl;
}

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

typedef long long ll;
const int MOD = 1e9 + 7;
typedef vector<ll> vll;

int main() {
    int n, t;
    cin >> n >> t;
    int ans = 1e9;
    int ci, ti;
    bool found = false;
    for (int i = 0; i < n; ++i) {
        cin >> ci >> ti;
        if (ti <= t) {
            found = true;
            ans = min(ans, ci);
        }
    }
    if (found)
        cout << ans << endl;
    else
        cout << "TLE" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define ff first
#define ss second
using namespace std;

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

//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);

    //int tt; cin >> tt; while(tt--) {solve(); cout << "\n";}

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

    int ans = 0;

    for (int i = l; i <= r; ++i) {
        if (i % d == 0)
            ++ans;
    }

    cout << ans;

}

/*
*/



Measured memory_bytes: 3608
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		FastScanner in = new FastScanner(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskC solver = new TaskC();
		solver.solve(1, in, out);
		out.close();
	}

	static class TaskC {
		public void solve(int testNumber, FastScanner in, PrintWriter out) {
			long x = in.nextLong();
			long ans = 2 * (x / 11);
			x %= 11;
			if (x == 0) {
				ans += 0;
			} else if (x <= 6) {
				ans += 1;
			} else {
				ans += 2;
			}
			out.println(ans);
		}

	}

	static class FastScanner {
		private BufferedReader in;
		private StringTokenizer st;

		public FastScanner(InputStream stream) {
			in = new BufferedReader(new InputStreamReader(stream));
		}

		public String next() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					String rl = in.readLine();
					if (rl == null) {
						return null;
					}
					st = new StringTokenizer(rl);
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return st.nextToken();
		}

		public long nextLong() {
			return Long.parseLong(next());
		}

	}
}



Measured memory_bytes: 8404
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <iomanip>
#include <cmath>
using namespace std;
using ll = long long;
#define rep(i, j, n) for(size_t i = (j); i < (n); ++i)
#define rrep(i, j, n) for(size_t i = (n) - 1; (j) <= i; --i)
constexpr ll MOD = 1000000007;
constexpr ll INF = 1LL << 60;
constexpr ll MAX = 800000;


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

	int a, b;
	cin >> a >> b;
	if (a <= 9 && b <= 9) cout << a * b;
	else cout << -1;
	return 0;

}


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

struct UnionFind {
    vector<int> par;

    UnionFind(int N) : par(N) {
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) {
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        if (rx == ry) return;
        par[rx] = ry;
    }

    bool same(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

int main() {
    long long int n, m, x, y, z, ans = 0;
    cin >> n >> m;
    UnionFind tree(n);
    for(int i = 0; i < m; ++i) {
        cin >> x >> y >> z;
        x--;y--;
        tree.unite(x, y);
    }
    for(int i = 0; i < n; ++i) {
        if(tree.root(i) == i) {
            ans++;
        }
    }
    cout << ans << '\n';
}

Measured memory_bytes: 896
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<time.h>
using namespace std;
int n;
int a[119];
int main() {

	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		cout << a[i];
		if (i < n - 1) cout << ' ';
	}
	cout << endl;
	int j, i;
	for ( i = 1; i < n; i++) {
		j = i - 1;
		int k = a[i];
		while (j >= 0 && a[j] > k) {
			a[j + 1] = a[j];
			j--;
		}
		a[j + 1] = k;
		int v;
		for (v = 0; v < n; v++) {
			cout << a[v];
			if (v < n - 1) cout << ' ';
		}

		cout << endl;
	}

}


Measured memory_bytes: 3092
#include <iostream>
#include <algorithm>
#include <math.h>
using namespace std;

int main() {
	long long n, div, apart;
	cin>>n;
	
	div=sqrt(n);
	
	while(div>0){
		if(n%div==0){
			apart=n/div;
			cout<<div+apart-2;
			break;
		}
		div--;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod= int(1e9)+7;
//const int mod=998244353;
using P = pair<int,int>;
using Pll = pair<ll,ll>;
using ld=long double;
using V=vector<int>;
using Vl=vector<ll>;
using VV=vector<vector<int>>;
using VVl=vector<vector<ll>>;

int main(){
    map<ll,int>mp;
    int n;cin >>n;
    for (int i = 0; i < n; ++i) {
        ll d;cin >>d;
        mp[d]++;
    }
    int m;cin >>m;
    bool flg=true;
    for (int i = 0; i < m; ++i) {
        int t;cin >>t;
        if(mp[t]>0)mp[t]--;
        else {
            flg=false;
            break;
        }
    }
    if(flg)puts("YES");
    else puts("NO");
}



Measured memory_bytes: 16104
#include <cstdio>
#include <algorithm>
using namespace std;
using ll = long long int;
const ll INF = 1LL << 60;

ll N, A[100010], dp[100010][3];
char op[100010];

int main() {
    scanf("%lld", &N);
    for(int i=0; i<N; i++) {
        if(i+1 != N) {
            scanf(" %lld %c", &A[i], &op[i]);
        }
        else {
            scanf(" %lld", &A[i]);
        }
    }

    fill(dp[0], dp[100010], -INF);
    dp[0][0] = 0;
    for(int i=0; i<N; i++) {
        for(int k=0; k<3; k++) {
            if(dp[i][k] == -INF) continue;
            int ni = i+1, nk = k;
            if(i > 0 && op[i-1] == '-') nk++;
            if(nk == 3) nk -= 2;
            ll nval = dp[i][k] + A[i] * (nk % 2 ? -1 : 1);
            for(; nk>=0; nk--) {
                dp[ni][nk] = max(dp[ni][nk], nval);
            }
        }
    }
    /*
    for(int i=0; i<=N; i++) {
        for(int k=0; k<3; k++) {
            printf("dp[%d][%d] = %lld\n", i, k, dp[i][k]);
        }
    }
    */
    printf("%lld\n", dp[N][0]);
    return 0;
}

Measured memory_bytes: 3328
#include <iostream>
using namespace std;
int main()
{
	int a[10],n,m = 0;
	int t = 0;
	cin >> n;
	for (int i = 0; i < n; ++i) {
		cin >> a[i];
		t += a[i];
		if (a[i] > m)m = a[i];
	}
	if (t - m > m)cout << "Yes" << "\n";
	else cout << "No" << "\n";
	return 0;
}

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

int main(){
    int x, y;
    
    for(int i = 0;  i < 5000; i++){
        cin >> x >> y;
        if(x == 0 && y == 0) break;
        if(x <= y) cout << x << " " << y << endl;
        if(y < x) cout << y << " " << x << endl;
    }
    return 0;
}


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

using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;
using LL = long long;
using VL = vector<LL>;
using VVL = vector<VL>;
using PLL = pair<LL, LL>;
using VS = vector<string>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))

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

#define FF first
#define SS second
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}
template<class S, class T>
ostream& operator<<(ostream& os, const pair<S,T>& p){
  return os << p.FF << " " << p.SS;
}
template<class T>
void maxi(T& x, T y){
  if(x < y) x = y;
}
template<class T>
void mini(T& x, T y){
  if(x > y) x = y;
}


const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;

const int MAX = 1<<20;
LL N, M;
double num[MAX], prob[MAX];

using LLL = __int128;

LLL gcd(LLL x, LLL y){
  if(y == 0) return x;
  return gcd(y, x%y);
}
LLL lcm(LLL x, LLL y){
  return x / gcd(x, y) * y;
}

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

  cin >> N >> M;
  VL xs(N);
  vector<double> ps(N);
  REP(i,N)
	cin >> xs[i];
  REP(i,N){
	cin  >> ps[i];
	ps[i] /= 100.;
  }

  FOR(b,1,1<<N){
	LLL l = 1;
	int bc = 0;
	REP(i,N){
	  if(b>>i&1){
		if(l <= M)
		  l = lcm(l, xs[i]);
		++bc;
	  }
	  num[b] = (bc%2*2-1) * M / l;
	}
  }

  for(int i=0;i<N;++i){
	for(int b=0;b<(1<<N);++b){
	  if((b>>i&1) == 1)
		num[b] += num[b^(1<<i)];
	}
  }

  double ans = 0.;
  REP(b,1<<N){
	prob[b] = 1;
	REP(i,N){
	  prob[b] *= (b>>i&1? ps[i]: 1.-ps[i]);
	}
	ans += prob[b] * num[b];
  }

  cout << fixed << setprecision(9) << ans << endl;
  
  return 0;
}

Measured memory_bytes: 19656