akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define ll long long
#define pii pair<int,int>
#define all(x) begin(x), end(x)
#define loop(i,n) for(int i=0; i<n; i++)
#define rep(i,a,b,c) for(int i=a; i<b; i+=c)
#define brep(i,a,b,c) for(int i=a; i>b; i-=c)
#define tc(t) int t; cin>>t; while(t--)
#define sz(v) int((v).size())
#define pb push_back
#define int long long

int32_t main() {
    IOS;
    int n, k, p;
    cin>>n>>k;
    vector<int> v(n+1, 0);
    vector<bool> vis(n+1, false);

    loop(i, n) {
        cin>>p;
        v[i+1] = p;
    }

    bool isCycle = false;
    int cycleStart = -1;
    int nxt = v[1];
    loop (i, n) {
        if (vis[nxt]) { // found cycle
            cycleStart = nxt;
            isCycle = true;
            break;
        }
        vis[nxt] = true;
        nxt = v[nxt];
    }
    // cout<<cycleStart<<endl;
    if (isCycle) {
        // get tail length
        int x = v[1];
        while (x!=cycleStart) {
            k--;
            if (k==0) {
                cout<<x<<endl;
                return 0;
            }
            x=v[x];
        }
        k--;
        // get cycle length
        // cout<<k<<endl;
        int cycleLen = 1;
        if (cycleStart != v[cycleStart]) {
            x = v[cycleStart];
            while (x!=cycleStart) {
                x=v[x];
                cycleLen++;
            }
        }

        k%=(cycleLen);
        x = cycleStart;
        while (k>0) {
            x=v[x];
            k--;
        }

        // cout<<cycleLen<<endl;
        cout<<x<<endl;
        return 0;
    }

    k %= n;
    int x = 1;
    while (k>0) {
        x=v[x];
        k--;
    }
    cout<<x<<endl;

    return 0;
}

Measured memory_bytes: 4784
#include <iostream>
#include <math.h>

using namespace std;
int main(void){
    int a,b,C;
    cin >> a >> b >> C;
    
    double PI = acos(-1);
    double rad;
    rad = C * PI / 180;
    
    
    double h = b*sin(rad);
    double S = (a*h)/2;
    double L = sqrt(pow(a - (b * cos(rad)),2) + h*h) + a + b;
    
    cout << fixed << S << endl;
    cout << fixed << L << endl;
    cout << fixed << h << endl;

}


Measured memory_bytes: 3520
#include <cstdio>
#include <algorithm>
#include <vector>
#include <cstring>
#include <string>
#include <limits.h>
#define ll long long
#define xx first
#define yy second

using namespace std;

const int N = 100000 + 5;
int info[N], f[N], n;

int main () {
	/*scanf ("%d", &n);
	for (int i = 1; i <= n; ++i)
		scanf ("%d", &info[i]);
	int ans = 0;
	for (int i = n - 1; i >= 1; --i)
		f[i] = info[i] >= info[i + 1] ? f[i + 1] + 1 : 0, ans = max (ans, f[i]);
	printf ("%d\n", ans);*/
	int a, b;
	scanf ("%d%d", &a, &b);
	a--, b--;
	if (1 >= b) {
		printf ("0\n");
		return 0;
	}
	printf ("%d\n", (b - 1) / a + 1);
	return 0;
}

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

int N, D[401], L;
int ld[20];
vector< vector< int > > res;

void read_input(void);
void solve(void);
void dfs(int, int);

inline int find_max_ln(void) {
  for (int i = 400; i > 0; --i)
    if (D[i] > 0)
      return i;
  return 0;
}

int main() {
  while (cin >> N, N) {
    read_input();
    solve();
  }

  return 0;
}

void read_input(void) {
  fill(&D[0], &D[401], 0);
  for (int i = 0; i < N * (N - 1) / 2; ++i) {
    int di;
    cin >> di, ++D[di];
  }
}

void solve(void) {
  L = find_max_ln();
  res.clear(), ld[0] = 0, ld[N - 1] = L, --D[L];
  dfs(0, N - 1);

  sort(res.begin(), res.end());
  res.resize(unique(res.begin(), res.end()) - res.begin());
  for (int i = 0; i < res.size(); ++i, cout << "\n")
    for (int j = 0; j < res[i].size(); ++j) {
      if (j > 0)  cout << " ";
      cout << res[i][j];
    }
  cout << "-----\n";
}

void dfs(int lft, int rgh) {
//  cout << "lft = " << lft << ", rgh = " << rgh << "\n";
  if (lft + 1 == rgh) {
    res.push_back(vector< int >());
    for (int i = 1; i < N; ++i) {
      res.back().push_back(ld[i] - ld[i - 1]);
    }
    return;
  }

  int ln = find_max_ln(), i, j;
  bool is_valid;

//  cout << "ln = " << ln << "\n";
//
//  for (int k = 0; k < N; ++k)
//    if (k <= lft || rgh <= k)
//      cout << " " << ld[k];
//  cout << "\n";

  if (ld[lft] < ln && ln < ld[rgh]) {
//    cout << "oao\n";
    is_valid = true;
    for (i = 0; i < N && is_valid; ++i)
      if (i <= lft || rgh <= i) {
        --D[abs(ln - ld[i])];
        if (D[abs(ln - ld[i])] < 0)
          is_valid = false;
      }
    if (is_valid)
      ld[rgh - 1] = ln, dfs(lft, rgh - 1);
//    else
//      cout << "invalid\n";
    for (j = 0; j < i; ++j)
      if (j <= lft || rgh <= j)
        ++D[abs(ln - ld[j])];
  }

//  for (int k = 0; k < N; ++k)
//    if (k <= lft || rgh <= k)
//      cout << " " << ld[k];
//  cout << "\n";

  if (ld[lft] < L - ln && L - ln < ld[rgh]) {
//    cout << "oao\n";
    is_valid = true;
    for (i = 0; i < N && is_valid; ++i)
      if (i <= lft || rgh <= i) {
        --D[abs(L - ln - ld[i])];
        if (D[abs(L - ln - ld[i])] < 0)
          is_valid = false;
      }
    if (is_valid)
      ld[lft + 1] = L - ln, dfs(lft + 1, rgh);
//    else
//      cout << "invalid\n";
    for (j = 0; j < i; ++j)
      if (j <= lft || rgh <= j)
        ++D[abs(L - ln - ld[j])];
  }
}

Measured memory_bytes: 1348
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
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);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, FastScanner in, PrintWriter out) {
            int n = in.nextInt();

            int ans = 0;
            for (int i = 0; i < n; i++) {
                int l = in.nextInt();
                int r = in.nextInt();
                ans += r - l + 1;
            }

            out.println(ans);
        }

    }

    static class FastScanner {
        private InputStream in;
        private byte[] buffer = new byte[1024];
        private int bufPointer;
        private int bufLength;

        public FastScanner(InputStream in) {
            this.in = in;
        }

        private int readByte() {
            if (bufPointer >= bufLength) {
                if (bufLength == -1)
                    throw new InputMismatchException();

                bufPointer = 0;
                try {
                    bufLength = in.read(buffer);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }

                if (bufLength <= 0)
                    return -1;
            }
            return buffer[bufPointer++];
        }

        private static boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public long nextLong() {
            long n = 0;

            int b = readByte();
            while (isSpaceChar(b))
                b = readByte();

            boolean minus = (b == '-');
            if (minus)
                b = readByte();

            while (b >= '0' && b <= '9') {
                n *= 10;
                n += b - '0';
                b = readByte();
            }

            if (!isSpaceChar(b))
                throw new NumberFormatException();

            return minus ? -n : n;
        }

        public int nextInt() {
            long n = nextLong();

            if (n < Integer.MIN_VALUE || n > Integer.MAX_VALUE)
                throw new NumberFormatException();

            return (int) n;
        }

    }
}



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

int main()
{
	unsigned long long N = 0;
  	std::uint64_t ans = 0;

	std::cin >> N;

	std::unordered_map<std::string, std::uint64_t> mp;

	for (long long i = 0; i < N; i++)
	{
      	std::string S;
		std::cin >> S;
		std::sort(S.begin(), S.end());
		mp[S] += 1;
	}

	for(auto& s : mp) {
		ans += s.second * (s.second - 1) / 2;
	}

	std::cout << ans << std::endl;

	return 0;
}

Measured memory_bytes: 10660
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <string>
#include <cmath>
#include <vector>
#include <queue>
typedef long long ll;
using namespace std;

int main(void){
  int n,k,i,t,c;
  string s;
  cin>>n>>k>>s;

  t=0;
  for(i=0;i<n-1;i++){
    if(s[i]!=s[i+1]){
      t++;
    }
  }

  if(t<=k*2){
    cout<<n-1<<endl;
  }
  else{
    cout<<n-1-(t-k*2)<<endl;
  }

  return 0;
}


Measured memory_bytes: 512
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bitset>
#include <list>
#include <stdexcept>
#include <functional>
#include <utility>
#include <ctime>
#include <random>
#include <cassert>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
#define MEM(a,b) memset((a),(b),sizeof(a))
const LL INF = 1e9 + 7;
const int N = 2e5 + 10;
char str[N];
int dp[N][4];
int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	scanf("%s", str + 1);
	int n = strlen(str + 1);
	dp[0][0] = 1;
	for (int i = 1; i <= n; i++)
	{
		string s = "ABC";
		if (str[i] != '?') s = string(1, str[i]);
		for (auto& c : s)
		{
			dp[i][0] += dp[i - 1][0];
			if (dp[i][0] >= INF)
				dp[i][0] -= INF;
			for (int j = 1; j <= 3; j++)
			{
				dp[i][j] += dp[i - 1][j];
				if (dp[i][j] >= INF) dp[i][j] -= INF;
				if (c == j + 'A' - 1)
				{
					dp[i][j] += dp[i - 1][j - 1];
					if (dp[i][j] >= INF) dp[i][j] -= INF;
				}
			}
		}
	}
	cout << dp[n][3] << endl;
	return 0;
}


Measured memory_bytes: 1920
#include <stdio.h>

int main(){
  int W, H, x, y, r = 0;
  scanf("%d %d %d %d %d",&W, &H, &x, &y, &r);
  if(x+r<=W&&x-r>=0&&y+r<=H&&y-r>=0){
    printf("Yes\n");
  }else{
    printf("No\n");
  }
  return 0;
}

Measured memory_bytes: 1012
#include<bits/stdc++.h>
 
#define INF 1000000007
#define LINF 1000000000000000007
 
using namespace std;
 
typedef long long ll;
typedef pair<ll, ll> P;


string s;

int main(){
	cin >> s;
	
	for(int i = 0; i < s.size()-1; i++){
		if(s[i] == 'A' && s[i+1] == 'C'){
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
	
	return 0;
}

Measured memory_bytes: 256
S = list(input())

if S[0] == "A":
    if S[2:-1].count("C") == 1:
        idx = S.index("C")
        for i, s in enumerate(S):
            if s.isupper():
                if (i == 0) or (i == idx):
                    continue
                else:
                    print("WA")
                    exit()
        print("AC")
        exit()
print("WA")


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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define pb push_back
#define rep(i, a, n) for(int i = (a); i < (n); i++)
#define dep(i, a, n) for(int i = (a); i >= (n); i--)
#define mod (ll)(1e9+7)
#define int ll

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

signed main() {
  int a, b, c;
  cin >> a >> b >> c;
  int g = max(c, max(a, b));
  int f = (g - a) + (g - b) + (g - c);

  cout << f / 2 + (f % 2 ? 2 : 0) << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define mp make_pair
#define F first
#define S second
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
typedef long long ll;
vector<int> g[100005];
ll q,n;
ll a[1005];
int main()
{
    //IOS;
    while(cin>>n)
    {
        map<ll,ll> m;
        vector<ll> ans;
        rep(i,n)
        {
            ll tmp;
            cin>>tmp;
            m[tmp]++;
            if(m[tmp]%2==0) ans.pb(tmp);
        }
        sort(ans.begin(),ans.end());
        if(ans.size()<2) cout<<0<<"\n";
        else cout<<ans[ans.size()-1]*ans[ans.size()-2]<<"\n";
    }
    return 0;
}



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

int main() {

	using namespace std;

	string tag;
	cin >> tag;
	
	int max = 0;
	int ans = 0;

	for (int i = 0; i < 3; i++) {

		if (tag.substr(i,1) == "R") {
			ans++;
			max = ans;
		}
		else {
			ans = 0;
		}
		

	}

	cout << max << endl;

	return 0;

}

Measured memory_bytes: 3624
#include<ctime>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#define rt register int
#define l putchar('\n')
#define ll long long
#define r read()
using namespace std;
inline ll read(){
    ll x = 0; char zf = 1; char ch = getchar();
    while (ch != '-' && !isdigit(ch)) ch = getchar();
    if (ch == '-') zf = -1, ch = getchar();
    while (isdigit(ch)) x = x * 10 + ch - '0', ch = getchar(); return x * zf;
}
void write(ll y){if(y<0)putchar('-'),y=-y;if(y>9)write(y/10);putchar(y%10+48);}
void writeln(const ll y){write(y);putchar('\n');}
int i,j,k,m,n,x,y,z,cnt;
int main(){
	n=r;
	for(rt i=0;i<=9;i++)if(i*111>=n){
		cout<<i*111;
		return 0;
	}
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        
        while(true){
            int n = sc.nextInt();
            int suma=0,sumb = 0;
            	if(n == 0)
                    break;
        	for(int i=0;i<n;i++){
           	 int a = sc.nextInt();
           	 int b = sc.nextInt();
            		if(a > b){
                	    suma += a + b;
                	}else if(a<b){
                 	   sumb += a + b;
               		}else{
                 	   suma += a;
                 	   sumb += b;
              		}
            }
            System.out.print(suma + " " + sumb);
            System.out.println();
        }
    }
}


Measured memory_bytes: 59060
n = int(input())
ac = 0
wa = 0
tle = 0
re = 0
for i in range(n):
  s = input()
  if s == "AC":
    ac +=1
  elif s == "WA":
    wa +=1
  elif s == "TLE":
    tle += 1
  else:
    re += 1
print("AC x ",ac)
print("WA x ",wa)
print("TLE x ",tle)
print("RE x ",re)
  

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

using lint = long long int;
using namespace std;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  lint n, b;
  cin >> n;

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

  sort(a.begin(), a.end());
  if (n % 2 == 0)
    b = a[n / 2];
  else
    b = a[(n - 1) / 2];

  lint ans = 0;
  for (int x : a) {
    ans += abs(x - b);
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
    int n ,max,min,maxi,mini;
    cin >> n;
    int a[n];
    int b[n]={};
    int c=0;
    cin >> a[0];
        if(a[0]<0){
            b[0]=1;
            c++;
        }
        min =a[0];max=a[0];mini=0;maxi=0;
    for(int i=1;i<n;i++){
        cin >> a[i];
        if(a[i]<0){
            b[i]=1;
            c++;
        }
        if(min>a[i]){
            min=a[i];
            mini=i;
        }
        if(max<a[i]){
            max=a[i];
            maxi =i;
        }

    }
    
    if(-min<max){
        cout << c+n-1<<endl;
        for(int i=0;i<n;i++){
            if(b[i]==1)cout << maxi+1 << ' '<< i+1<<endl;
        }
        for(int i=1;i<n;i++)cout << i<<' '<< i+1<<endl;
    }else{
        cout << n-c+n-1<<endl;
        for(int i=0;i<n;i++){
            if(b[i]==0)cout << mini+1<<' '<< i+1<< endl;
        }
        for(int i=n;i>1;i--)cout << i << ' ' << i-1<< endl;
    }
    
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#define N 100

int main(){
  int m[N][N];
  int n,t,g,v;
  int i,j;

  scanf("%d",&n);
  for(i=0;i<n;i++){
    for(j=0;j<n;j++)m[i][j]=0;
  }
  for(i=0;i<n;i++){
    scanf("%d%d",&t,&g);
    t--;
    for(j=0;j<g;j++){
      scanf("%d",&v);
      v--;
      m[t][v]=1;
    }
  }
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      if(j)printf(" ");
      printf("%d",m[i][j]);
     }
    printf("\n");
  }
  return 0;
}
    



Measured memory_bytes: 2148
#include <bits/stdc++.h>
using namespace std;
#define all(a) (a).begin(),(a).end()
#define FOR(i,n) for(size_t i=0;i<(n);i++)
#define cinv(v,n) for(size_t i=0;i<(n);i++){cin>>(v)[i];}
#define nvec(type,v,n) vector<type> v(n);cinv(v,n)
#define npairs(type1,type2,v,n) vector<pair<type1,type2>> v(n);for(size_t i=0;i<(n);i++){cin>>v[i].first>>v[i].second;}

#define min_index(v) size_t(min_element(all(v))-(v).begin())
#define max_index(v) size_t(max_element(all(v))-(v).begin())
#define min_e(v) *min_element(all(v))
#define max_e(v) *max_element(all(v))

#define count_le(v,a) size_t(upper_bound(all(v),a)-(v).begin())
#define count_lt(v,a) size_t(lower_bound(all(v),a)-(v).begin())
#define count_ge(v,a) size_t((v).end()-lower_bound(all(v),a))
#define count_gt(v,a) size_t((v).end()-upper_bound(all(v),a))

#define order(neq_sl) [](const &auto s, const &auto l){return neq_sl;}
#define make_lr(v,type,l,r) vector<type> l(n+1),r(n+1);FOR(i,n){l[i+1]=l[i]+v[i];r[i+1]=r[i]+v[n-1-i];}

#define acm accumulate
#define SUM(v) accumulate(all(v),0l)

int main() {
  int n;
  cin>>n;
  nvec(int,p,n);
  int count=0;
  for (size_t i = 1; i < n-1; i++) {
    if(p[i-1]>p[i]&&p[i]>p[i+1]||p[i-1]<p[i]&&p[i]<p[i+1])count++;
  }
  cout<<count;
}

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

using namespace std;

#define sqr(x) ((x) * (x))
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()

typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<char> vc;
typedef pair<int, int> pii;
typedef long long ll;

const int MOD = 1000000007;

ll extgcd(ll a, ll b, ll &x, ll &y) {
  if (b == 0) {
    x = 1;
    y = 0;
    return a;
  }
  ll d = extgcd(b, a % b, y, x);
  y -= a / b * x;
  return d;
}

void cmb_init(int n, vll &fac, vll &finv) {
  ll x, y;
  for (int i = 2; i <= n; i++) {
    fac[i] = fac[i - 1] * i % MOD;
    extgcd(i, MOD, x, y);
    x = MOD + x % MOD;
    finv[i] = finv[i - 1] * x % MOD;
  }
}

// void cmb_init(int n, vll &fac, vll &finv) {
//   vll inv(n + 1, 1);
//   for (int i = 2; i <= n; i++) {
//     fac[i] = fac[i - 1] * i % MOD;
//     inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
//     finv[i] = finv[i - 1] * inv[i] % MOD;
//   }
// }

ll cmb(int n, int k, vll &fac, vll &finv) {
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

void solve() {
  int N, K;
  cin >> N >> K;
  vi A(N, 0);
  vll fac(N + 1, 1), finv(N + 1, 1);
  cmb_init(N, fac, finv);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  sort(all(A));
  ll sum = 0;
  for (int i = 0; i < N; i++) {
    sum -= (ll)A[i] * cmb(N - i - 1, K - 1, fac, finv) % MOD;
    sum += (ll)A[i] * cmb(i, K - 1, fac, finv) % MOD;
    sum %= MOD;
  }
  cout << sum << endl;
}

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

  solve();

  return 0;
}


Measured memory_bytes: 2176
#include"bits/stdc++.h"
//#include<bits/stdc++.h>
using namespace std;
#define print(x) cout<<x<<endl;
#define rep(i,a,b) for(int i=a;i<b;i++)
typedef long long ll;
const int mod = 1e9 + 7;



int main() {
	int n;
	ll x;
	cin >> n >> x;
	ll a[100002];
	rep(i, 0, n ) { cin >> a[i]; }
	ll cnt = 0;
	for (int i = 1; i < n;i++) {
		if (a[i] + a[i - 1]>x) {
			ll dif = a[i] + a[i - 1] - x;
			cnt += a[i] + a[i - 1] - x;
			a[i] = max(a[i] - dif, 0LL);
		}
	}

	print(cnt);
	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <queue>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <cctype>

using namespace std;

#define REP(i,n) for(ll (i) = (0); (i) < (n); ++i)
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define ALL(v) v.begin(),v.end()
#define Decimal fixed << setprecision(20)
#define SHOWP(x) cerr<<"["<<(x).FI<<", "<<(x).SE<<"]";
#define SHOWX(x) cerr<<#x<<": "<<x<<endl;
#define SHOWVEC(v, e) REP(i, e) cerr << (v[i]) << ' '; cerr << endl;
#define SHOW2D(a, h, w) REP(i, h){REP(j, w)cerr<<setw(3)<<(a[i][j])<<' ';cerr<<endl;}
constexpr int INF = 1100000000;
constexpr long long LLINF = 1100000000000000000LL;
constexpr long long MOD = 1000000007;

typedef long long ll;
typedef pair<ll, ll> P;


int main()
{
  int N, D;
  cin >> N >> D;
  int ans = 0;
  for (int i = 0; i < N; i++) {
    ans++;
    i += 2*D;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define Would
#define you
#define please

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



	int N, M;
	cin >> N >> M;

	int a[50], b[50];
	rep(i, M) {
		cin >> a[i] >> b[i];
	}

	int kotae = 0;
	rep(j, M) {
		vector<int> henn[51];
		rep(i, M) {
			if (i != j) {
				henn[a[i]].push_back(b[i]);
				henn[b[i]].push_back(a[i]);
			}
		}
		int B[51] = {};
		vector<int> que;
		que.push_back(1);
		while (que.size() != 0) {
			vector<int> que2;
			for (int itr : que) {
				if (B[itr] == 0) {
					B[itr] = 1;
					for (int itr2 : henn[itr]) {
						que2.push_back(itr2);
					}
				}
			}
			que = que2;
		}
		int renketu = 1;
		rep1(i, N) {
			if (B[i] == 0) renketu = 0;
		}
		if (renketu == 0) kotae++;
	}

	co(kotae);

	Would you please return 0;
}

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

ans = 0
for i in range(N):
    if A[i] >= B[i]:
        ans += B[i]
    else:
        if A[i] + A[i+1] >= B[i]:
            ans += B[i]
            A[i+1] -= (B[i] - A[i])
        else:
            ans += (A[i] + A[i+1])
            A[i+1] = 0
print(ans)



Measured memory_bytes: 97860
from collections import deque
import sys
input = sys.stdin.readline

N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
cntA = [0] * (N + 1)
cntB = [0] * (N + 1)
for i in range(N):
    cntA[A[i]] += 1
    cntB[B[i]] += 1
nums = [(cntA[i], cntB[i], i) for i in range(1, N+1) if cntA[i] or cntB[i]]
nums.sort(key=lambda p: p[0] + p[1], reverse=True)
a = deque()
b = deque()
c = deque(list(range(N)))
ansa = [0] * N
ansb = [0] * N
for x, y, n in nums:
    if x + y > len(a) + len(b) + len(c):
        print('No')
        exit()
    ra = x - len(a)
    rb = y - len(b)
    for i in range(ra):
        ansa[c[0]] = n
        b.append(c[0])
        c.popleft()
        x -= 1
    for i in range(rb):
        ansb[c[0]] = n
        a.append(c[0])
        c.popleft()
        y -= 1
    while c and (x or y):
        if x:
            ansa[c[0]] = n
            b.append(c[0])
            x -= 1
        else:
            ansb[c[0]] = n
            a.append(c[0])
            y -= 1
        c.popleft()
    for i in range(x):
        ansa[a[0]] = n
        a.popleft()
    for i in range(y):
        ansb[b[0]] = n
        b.popleft()
ans = [(ansa[i], ansb[i]) for i in range(N)]
ans.sort()
print('Yes')
print(*[p[1] for p in ans])

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

int main(){
  int N;
  cin >> N;
  int64_t a=2,b=1,c=0;
  for(int i=2; i<=N; i++){
    if(i%2==0)
      a += b;
    else
      b += a;
  }
  if(N!=1){
    if(a>b)
      cout << a << endl;
    else
      cout << b << endl;
  }
  else
    cout << b << endl;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void){
	int n;
  	scanf("%d", &n);
  	char s[100001];
  	scanf("%s", s);
  	int i = 0;
  	while(s[i] != '\0'){
      	s[i] += n;
      	if(s[i] > 90)
          s[i] = 64 + s[i]-90;
    	i++;
    }

    printf("%s\n", s);
}

Measured memory_bytes: 128
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<cstring>
using namespace std;

typedef long long ll;
const int maxn=1e5+10;
int n,p1,p2,now;
ll ans,res;
struct xx{
	int l,r,id;
}a[maxn],b[maxn];
bool x[maxn];

bool cmp(xx a,xx b){
	return a.r<b.r;
}
bool cmpp(xx a,xx b){
	return a.l>b.l;
}

int main(){
	cin>>n;
	for(int i=1;i<=n;++i){
		cin>>a[i].l>>a[i].r;
		a[i].id=i;
		b[i]=a[i];
	}
	sort(a+1,a+n+1,cmp);
	sort(b+1,b+n+1,cmpp);
	p1=p2=1;
	while(p1<=n&&p2<=n){
		if(p1<=n&&!(a[p1].l<=now&&now<=a[p1].r)&&!x[a[p1].id]){
			if(a[p1].l>now)
				res+=a[p1].l-now,now=a[p1].l;
			else
				res+=now-a[p1].r,now=a[p1].r;
			x[a[p1].id]=true;
		}
		if(p2<=n&&!(b[p2].l<=now&&now<=b[p2].r)&&!x[b[p2].id]){
			if(b[p2].l>now)
				res+=b[p2].l-now,now=b[p2].l;
			else
				res+=now-b[p2].r,now=b[p2].r;
			x[b[p2].id]=true;
		}
		++p1;
		++p2;
	}
	ans=max(ans,res+abs(now));
	res=0;
	now=0;
	p1=p2=1;
	memset(x,0,sizeof(x));
	while(p1<=n&&p2<=n){
		if(p2<=n&&!(b[p2].l<=now&&now<=b[p2].r)&&!x[b[p2].id]){
			if(b[p2].l>now)
				res+=b[p2].l-now,now=b[p2].l;
			else
				res+=now-b[p2].r,now=b[p2].r;
			x[b[p2].id]=true;
		}
		if(p1<=n&&!(a[p1].l<=now&&now<=a[p1].r)&&!x[a[p1].id]){
			if(a[p1].l>now)
				res+=a[p1].l-now,now=a[p1].l;
			else
				res+=now-a[p1].r,now=a[p1].r;
			x[a[p1].id]=true;
		}
		++p1;
		++p2;
	}
	ans=max(ans,res+abs(now));
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 2688
#include <iostream>
#include <vector>
#include <deque>
#include <algorithm>
#include <string>
#include <string.h>

using namespace std;

int main()
{
    int N,M;
    cin >> N >> M;

    cout << (1 << M)*((M*1900)+(N-M)*100) << endl;

    return 0;
}

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

class Program {
  static void Main (string[] args) {
    string[] str = Console.ReadLine().Split(' ');
    int a = int.Parse(str[0]);
    int b = int.Parse(str[1]);
    int ans = a + (b / 2);
    Console.WriteLine(ans);
  }
}

Measured memory_bytes: 13140
#include <iostream>
using namespace std;
int main(int argc, char const *argv[])
{
    int n;
    cin>>n;
    while (n--)
        {
            int a,b,c;
            cin>>a>>b>>c;
            if (a*a + b*b ==c*c || b*b+c*c==a*a || a*a+c*c==b*b)
            
                cout<<"YES"<<endl;
                else 
                    cout<<"NO"<<endl;
            
        }
    return 0;
}


Measured memory_bytes: 3052
#include <iostream>
#include <string>
#include <string.h>
#include <strings.h>
#include <bits/stdc++.h>
using namespace std;
/*ssssssss*/
int main()
{
string s;
cin>>s;
int f=s.length();
int z=f/2;
string s2="";
s2=s2+s.at(0);
f-=2;
for(int u=0;u<f;u+=2){
    s2=s2+s.at(u+2);
}
cout<<s2;
    return 0;
}


Measured memory_bytes: 640
import java.io.*;
import java.math.BigInteger;
import java.util.*;
import java.util.Map.Entry;


public class  Main{
	public static void main(String[] args) throws Exception{
    	MScanner sc = new MScanner(System.in);
        //MScanner sc = new MScanner("reduce.in");
        PrintWriter pw=new PrintWriter(System.out);
        int a=sc.nextInt();int b=sc.nextInt();
        if(a==b)pw.println(a+b);
        else {
        	pw.println(2*Math.max(a, b)-1);
        }
        pw.flush();
    }
    static class edge implements Comparable<edge>{
    	int node;int cost;
    	edge(int a,int b){
    		node=a;cost=b;
    	}
		@Override
		public int compareTo(edge o) {
			if(cost!=o.cost) {
				return cost-o.cost;
			}
				return node-o.node;
			
		}
		public String toString() {
			return "("+node+" "+cost+")";
		}
    }
    static class MScanner {
		StringTokenizer st;
		BufferedReader br;
 
		public MScanner(InputStream system) {
			br = new BufferedReader(new InputStreamReader(system));
		}
 
		public MScanner(String file) throws Exception {
			br = new BufferedReader(new FileReader(file));
		}
 
		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}
 
		public String nextLine() throws IOException {
			return br.readLine();
		}
 
		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}
 
		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}
 
		public char nextChar() throws IOException {
			return next().charAt(0);
		}
 
		public Long nextLong() throws IOException {
			return Long.parseLong(next());
		}
 
		public boolean ready() throws IOException {
			return br.ready();
		}
 
		public void waitForInput() throws InterruptedException {
			Thread.sleep(3000);
		}
	}
}

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

using namespace std;
typedef long long ll;

int main() {
  ll x;
  cin >> x;

  ll n = 100;
  int years = 0;
  while (n < x) {
    n *= 1.01;
    ++years;
  }

  cout << years;

  return 0;
}


Measured memory_bytes: 3636
from itertools import combinations
from collections import Counter
N, X, Y = map(int, input().split())
X, Y = X-1, Y-1
ans = []
for i, j in combinations(range(N), 2):
    ans.append(min(j-i, 1+abs(i-X)+abs(j-Y)))
c = Counter(ans)
for i in range(1,N):
    print(c[i])


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

int main(){
    int X,Y,Z;cin>>X>>Y>>Z;
    X-=Z;
    cout<<X/(Y+Z)<<endl;
}

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

#define fi first;
#define se second;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int MAXN = 5e5 + 5;

int N, Q, A[MAXN], comp[MAXN], ans, root[MAXN], P[MAXN];
vector<int> V[MAXN];

int get_idx(int val) { return lower_bound(comp+1, comp+1+N, val) - comp; }

struct NODE {
	int l, r, val;
	NODE(): l(0), r(0), val(0) {}
};

struct PST {
	NODE T[MAXN * 30];
	int sz = 0;
	int make(int y, int l, int r, int n) {
		if(r < y || y < l) return n;
		int cur = ++sz;
		T[cur] = T[n];
		if(l != r) {
			int mid = l + r >> 1;
			T[cur].l = make(y, l, mid, T[n].l);
			T[cur].r = make(y, mid+1, r, T[n].r);
		}
		T[cur].val++;
		return cur;
	}
	int query(int x, int y, int l, int r, int nx, int ny) {
		if(r < x || y < l) return 0;
		if(x <= l && r <= y) return T[ny].val - T[nx].val;
		int mid = l + r >> 1;
		return query(x, y, l, mid, T[nx].l, T[ny].l) + query(x, y, mid+1, r, T[nx].r, T[ny].r);
	}
} pst;

int main() {
	ios::sync_with_stdio(0); cin.tie(0);
	cin >> N >> Q;
	for(int i=1; i<=N; i++) cin >> A[i], comp[i] = A[i];
	sort(comp+1, comp+1+N);
	for(int i=1; i<=N; i++) V[get_idx(A[i])].push_back(i);
	for(int i=1; i<=N; i++) for(int j=0; j+1 < V[i].size(); j++) P[V[i][j]] = V[i][j+1];
	for(int i=1; i<=N; i++) {
		root[i] = root[i-1];
		if(P[i]) root[i] = pst.make(P[i], 1, N, root[i-1]);
	}
	while(Q--) {
		int l, r; cin >> l >> r;
		ans = (r - l + 1) - pst.query(1, r, 1, N, root[l-1], root[N]);
		cout << ans << '\n';
	}
}

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

int main(){
    int n;
    cin >> n;
    int p[n];
    for(int i = 0; i < n; i++) cin >> p[i];
    sort(p, p + n);
    int sum = 0;
    for(int i = 0; i < n - 1; i++) sum += p[i];
    sum += p[n-1] / 2;
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 256
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iostream>
#include <iostream>
#include <fstream>
#include <numeric>
#include <cstring>
#include <cassert>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <cmath>
#include <set>
#include <map>
#include <functional>
#include <bitset>
#include <iomanip>
#include <stack>
#include <list>
#include <cstdint>
#include <chrono>

using namespace std;
#define     loop(n,i,a)     for(ll i=a;i<n;i++)
#define     loopR(n,i,a)    for(ll i=a-1;i>=n;i--)
#define     all(arr,n)      arr,arr+n
#define     allv(v)         (v).begin(),(v).end()
#define     rallv(v)        (v).rbegin(),(v).rend()
#define     m_p             make_pair
#define     ll              long long
#define     pii             pair<ll,ll>
#define     vi              vector<int>
#define     vll             vector<ll>
#define     vii             vector<pii>
#define     sz(x)           (int)x.size()
#define     pb              push_back
#define     endl            "\n"
#define     Endl            "\n"
#define     f               first
#define     s               second
#define     mem(dp,n)       memset(dp,n,sizeof dp)
template<typename T>void max_self(T &a,T b){a=max(a,b);}
template<typename T>void min_self(T &a,T b){a=min(a,b);}
int dx[] = { 1 , 0 ,-1 , 0 ,-1 ,-1 , 1 , 1 };
int dy[] = { 0 , 1 , 0 ,-1 ,-1 , 1 ,-1 , 1 };
int KnightI[] = { 2, 1, -1, -2, -2, -1, 1, 2 };
int KnightJ[] = { 1, 2, 2, 1, -1, -2, -2, -1 };
void fast(){
    std::ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
}
vector<string> vec_splitter(string s) {
    s += ',';
    vector<string> res;
    while(!s.empty()) {
        res.push_back(s.substr(0, s.find(',')));
        s = s.substr(s.find(',') + 1);
    }
    return res;
}
void debug_out(
        vector<string> __attribute__ ((unused)) args,
        __attribute__ ((unused)) int idx,
        __attribute__ ((unused)) int LINE_NUM) { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
    if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
    stringstream ss; ss << H;
    cerr << args[idx] << " = " << ss.str();
    debug_out(args, idx + 1, LINE_NUM, T...);
}
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
const ll mxN=4e5+10,oo=0x3f3f3f3f,MOD=1e9+7;
const long double PI = acos(-1),eps=1.0e-14;

void solve(){
    int k,s;
    cin>>k>>s;
    int cnt=0;
    loop(k+1,i,0){
        loop(k+1,j,0){
            if(s-i-j<=k&&s-i-j>=0)
                cnt++;
        }
    }
    cout<<cnt<<endl;
}
int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    fast();
    solve();

}


Measured memory_bytes: 3660
R,C,N=map(int,input().split())
E=[]
for i in range(N):
  x1,y1,x2,y2=map(int,input().split())
  if (0<x1<R and 0<y1<C) or (0<x2<R and 0<y2<C):
    continue
  if y1==0:
    E.append((x1,i))
  elif x1==R:
    E.append((R+y1,i))
  elif y1==C:
    E.append((2*R+C-x1,i))
  elif x1==0:
    E.append((2*R+2*C-y1,i))
  if y2==0:
    E.append((x2,i))
  elif x2==R:
    E.append((R+y2,i))
  elif y2==C:
    E.append((2*R+C-x2,i))
  elif x2==0:
    E.append((2*R+2*C-y2,i))
E.sort()
visited=[False]*N
stack=[]
for p in E:
  if not visited[p[1]]:
    stack.append(p[1])
    visited[p[1]]=True
  elif visited[p[1]]:
    if stack[-1]==p[1]:
      stack.pop()
    else:
      print("NO")
      exit()
print("YES")
  
    

Measured memory_bytes: 74456
using System;
using System.Linq;
public class Hello{
    public static void Main(){
        int[] inpt = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
        
        int n = inpt[0]; int a = inpt[1]; int b = inpt[2];
        Console.Write(Math.Min(a,b));
        Console.Write(" ");
        Console.Write(Math.Max(a+b-n,0));
    }
}


Measured memory_bytes: 13268
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
constexpr int MOD = 1000000007;
constexpr int INF = 2147483647;
int main()
{
   lint N;
   cin >> N;
   vector<tuple<lint, lint>> t(N);
   REP(i, N) {
       lint X, L;
       cin >> X >> L;
       t[i] = make_tuple(X, L);
   }
   sort(t.begin(), t.end(), [](auto const &a, auto const &b) { return get<0>(a) < get<0>(b); });
   lint ans = 0;
   int last = 0;
   FOR(i, 1, N) {
       if(get<0>(t[i]) - get<0>(t[last]) < get<1>(t[i]) + get<1>(t[last])) {
           ans++;
           if(get<0>(t[i]) + get<1>(t[i]) < get<0>(t[last]) + get<1>(t[last])) last = i;
       } else {
           last = i;
       }
   }
   cout << N-ans << endl;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
typedef pair<ll, ll> P;
using VP = vector<P>;
using VVP = vector<VP>;
using VI = vector<ll>;
using VVI = vector<VI>;
using VVVI = vector<VVI>;
const int inf = 1e9 + 7;
const ll INF = 1LL << 61;
const ll mod = 1e9 + 7;

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 main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int i, j;
    int x;
    cin >> x;
    cout << 1 - x << endl;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
#define int           long long
#define	pb            push_back
#define all(a)        (a).begin(),(a).end()
#define sz(x)         (int)x.size()
#define F             first
#define S             second
#define endl          "\n"
#define inf           1000000007
#define FOR(i, a, b)  for(int i=a; i<b; i++)
#define bigint        1e18
mt19937 RNG(chrono::steady_clock::now().time_since_epoch().count()); 
#define SHUF(v) shuffle(aint(v), RNG);
// Use mt19937_64 for 64 bit random numbers. 

template <typename T>
T ceil(T a, T b){ return (a+b-1)/b; }

template<typename T>
T binpow(T a, T b) {
    T res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}

void solve(){
    int n, k;
    cin>>n>>k;
    int a[n];
    FOR(i, 0, n) cin>>a[i];
    sort(a, a+n);
    int lo = 1, hi = 1e9;
    while(lo<hi) {
        int m = lo+(hi-lo)/2, cnt=0;
        //cout<<lo<<' '<<hi<<' '<<m<<endl;
        FOR(i, 0, n) {
            cnt+=(ceil(a[i], m)-1);
        }
        if(cnt<=k) {
            hi = m;
        } else {
            lo = m+1;
        }
    }
    cout<<lo<<endl;
}
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);     
    int t=1;
    //cin>>t;
    FOR(i, 1, t+1){ 
        //cout<<"Case #"<<i<<": ";
        solve();
    }
    cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
    return 0;
 
}



Measured memory_bytes: 5152
#include <bits/stdc++.h>
#define sz(v)   ((int)(v).size())
#define  all(v)    ((v).begin()),((v).end())
#define  allr(v)    ((v).rbegin()),((v).rend())
#define   pb         push_back
#define   mp         make_pair
#define    clr(v,d)      memset( v, d ,sizeof(v))
typedef  long long     ll ;
typedef  unsigned long long ull;
const double EPS= (1e-9);
using namespace std;
int getBit(int num, int idx) {return ((num >> idx) & 1) == 1;}
int setBit1(int num, int idx) {return num | (1<<idx);}
ll setBit0(ll num, int idx) {return num & ~(1ll<<idx);}
ll flipBit(int num, int idx) {return num ^ (1<<idx);}
void GO(){ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);}
const int N=100000+9,mod=1000000000+7;
ll cnt[N],fres[N];
int go(int n){

   for(int i=1;i*i<=n;i++){

       if(n%i==0){
         cnt[i]++;
         if(n/i!=i) cnt[n/i]++;
       }

   }
  return 0;
}
ll power(ll b,ll p){

   if(p==0) return 1;
   if((p&(1ll))){
     return b%mod*power((b*b)%mod,p/2)%mod;
   }
   else{
    return  power((b*b)%mod,p/2);
   }
}
int main(){
    GO();
    int n,k;
    cin>>n>>k;
    for(int i=1;i<=k;i++){
        go(i);
    }
    ll ans=0;
    for(int i=k;i>=1;i--){
        fres[i]=power(cnt[i],n);
         for(int j=i*2;j<=k;j+=i){
            fres[i]=((fres[i]-fres[j])+mod)%mod;
         }
         ans+= (1ll*fres[i]*i)%mod;
         if(ans>=mod) ans-=mod;

    }
   cout<<ans<<"\n";
}




































Measured memory_bytes: 5200
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const  ll INF = 1e9;
const  ll MOD = 1e9 + 7;
#define all(v) v.begin(), v.end()
#define repi(i,n,init) for(ll i=init;i<(n);i++)
#define repd(i,n,init) for(ll i=(n);i>=init;i--)
#define repm(i,m) for(auto i=m.begin();i!=m.end();i++)
#define repb(bit,n,init) for(ll bit=init;bit<(1<<n);++bit)

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

int main()
{
    int k,a,b;
    cin >> k >> a >> b;
    repi(i,b+1,a){
        if(i % k == 0){
            cout << "OK" << endl;
            return 0;
        }
    }
    cout << "NG" << endl;
    return 0;
}

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

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	string s;
	long long t = 0, x = 0;
	cin >> s;
	for (auto i:s)
	{
	    x = (int)i;
	    x -= 48;
	    t += x;
	}
	if (t%9 == 0) cout << "Yes";
	else cout << "No";
	return 0;
}


Measured memory_bytes: 3780
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void _main()
{
    int N;
    cin >> N;
    double ans = 0.0;
    rep(i, 0, N)
    {
        double x;
        string u;
        cin >> x >> u;
        if (u == "JPY")
        {
            ans += x;
        }
        else
        {
            ans += x * 380000.0;
        }
    }
    printf("%.10f\n", ans);
}


Measured memory_bytes: 256
N,K = map(int, input().split())
ans = 0
nusuke = [0] * N
for i in range(K):
  d = int(input())
  data = list(map(int, input().split()))
  for j in data:
    nusuke[j-1] += 1

for k in nusuke:
  if k == 0:
    ans += 1

print(ans)  

Measured memory_bytes: 9140
#include "bits/stdc++.h"
using namespace std;
using ll     = long long;
using pii    = pair<int, int>;
using pll    = pair<ll, ll>;
using vi     = vector<int>;
using vl     = vector<ll>;
using vvi    = vector<vi>;
using vvl    = vector<vl>;
const ll INF = 1LL << 60;
const ll MOD = 1000000007;
template <class T>
bool chmax(T &a, const T &b) {
    return (a < b) ? (a = b, 1) : 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    return (b < a) ? (a = b, 1) : 0;
}
template <class C>
void print(const C &c, std::ostream &os = std::cout) {
    std::copy(std::begin(c), std::end(c), std::ostream_iterator<typename C::value_type>(os, " "));
    os << std::endl;
}

int main() {
    ll n, k;
    cin >> n >> k;
    vl h(n);
    for (int i = 0; i < n; ++i) {
        cin >> h[i];
    }
    sort(h.begin(), h.end());
    ll ret = 0;
    for (int i = 0; i < n - k; ++i) {
        ret += h[i];
    }
    cout << ret << "\n";
    return 0;
}

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

#define debug1(x)		  cout<<x<<endl
#define debug2(x,y)       cout<<x<<"   "<<y<<endl
#define debug3(x,y,z)     cout<<x<<"   "<<y<<"   "<<z<<endl
#define debug4(x,y,z,xy)  cout<<x<<"   "<<y<<"   "<<z<<"   "<<xy<<endl

#define sl(x) scanf("%lld",&x)
#define sll(x,y) scanf("%lld%lld",&x,&y)
#define slll(x,y,z) scanf("%lld%lld%lld",&x,&y,&z)
#define pl(x) printf("%lld\n",x)
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define ff first
#define ss second
#define MAX 1000000
#define mod 1000000007

int main(){
    ll x,a,b,n,i;
    cin>>x;
    cin>>a>>b;
    x-=a;

    while(1){
        if(x-b>=0){
            x-=b;
        }else{
            break;
        }
    }
    cout<<x<<endl;
}


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

int main()
{
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  if (a[0] != 0) {
    cout << -1 << endl;
    return 0;
  }
  long long ans = 0;
  for (int i = 1; i < n; ++i) {
    if (a[i] > a[i - 1] + 1) {
      cout << -1 << endl;
      return 0;
    }
    if (a[i] == a[i - 1] + 1) {
      ++ans;
    } else {
      ans += a[i];
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1152
#include<stdio.h>

int main(void){

  int i, t = 0, n, p, a[50], koisi;

  while(t != 1){
    
    scanf("%d%d",&n,&p);

    if(n != 0){
      
      for(i = 0; i < n; i++){
	a[i] = 0;
      }
      
      koisi = p;
      i = 0;
      
      while(i < 100){
	
      if(koisi > 0){
	a[i] += 1;
	koisi -= 1;
      }
      
      else{
	koisi = a[i];
	a[i] = 0;
      }
      
      if(i == n-1){
	i = 0;
      }
      
      else{
	i += 1;
      }
      
      if(a[i] > 0 && a[i] == p){
	printf("%d\n", i);
	break;
      }
      
      }
      
    }
    if(n == 0){
      t = 1;
    }
  }
  return 0;
}

Measured memory_bytes: 600
#include<iostream>
using namespace std;
#define MAX 300005
int n;
int main(){
  while(1){
    cin>>n;
    if(n==1)break;
    bool t[MAX]={};
    cout<<n<<':';
    for(int i=6;i<=n;i+=7){

      if(n%i==0&&!t[i])cout<<' '<<i;
      for(int k=6;i*k<MAX;k+=7)t[i*k]=true;
      for(int k=1;i*k<MAX;k+=7)t[i*k]=true;

      int j=i+2;
      if(n%j==0&&!t[j])cout<<' '<<j;
      for(int k=6;j*k<MAX;k+=7)t[j*k]=true;
      for(int k=1;j*k<MAX;k+=7)t[j*k]=true;
    }
    cout<<endl;
  }
  return 0;
}

Measured memory_bytes: 1456
N,x = map(int,input().split())

A = sorted(list(map(int,input().split())))

ans = 0
for i in range(N):
    if x-A[i]>0 and i==N-1:break
    elif x-A[i]<0:break
    else:
        x -= A[i]
        ans += 1
        
print(ans)

Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int n = s.length();
		int[] a = new int[3];
		for(int i = 0 ; i < n ; i++) {
			if(s.charAt(i) == 'a') {
				a[0]++;
			} else if(s.charAt(i) == 'b') {
				a[1]++;
			} else if(s.charAt(i) == 'c') {
				a[2]++;
			}
 		}
		boolean ok = true;
		if(a[0] >= 1 && a[1] >= 1 && a[2] >= 1) {
			// 3種類
			if(Math.abs(a[0] - a[1]) >= 2 || Math.abs(a[0] - a[2]) >= 2 || Math.abs(a[1] - a[2]) >= 2) {
				ok = false;
			}
		} else if((a[0] == 0 && a[1] >= 1 && a[2] >= 1) || (a[0] >= 1 && a[1] == 0 && a[2] >= 1) || (a[0] >= 1 && a[1] >= 1 && a[2] == 0)) {
			// 2種類
			if(!(n == 2 && s.charAt(0) != s.charAt(1))) {
				ok = false;
			}
		} else if((a[0] == 0 && a[1] >= 0 && a[2] >= 1) || (a[0] >= 0 && a[1] == 1 && a[2] >= 0) || (a[0] >= 1 && a[1] >= 0 && a[2] == 0)) {
			// 1種類
			if(n != 1) {
				ok = false;
			}
		}
			if(ok == true) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
	}
}


Measured memory_bytes: 24148